<commit_before>package klaue.furrycrossposter;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.KeyboardFocusManager;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;

import klaue.furrycrossposter.sites.DeviantArt;
import klaue.furrycrossposter.sites.E621;
import klaue.furrycrossposter.sites.FurAffinity;
import klaue.furrycrossposter.sites.FurryNetwork;
import klaue.furrycrossposter.sites.InkBunny;
import klaue.furrycrossposter.sites.Site;
import klaue.furrycrossposter.sites.Weasyl;
import klaue.furrycrossposter.sites.sofurry.SoFurry;
import layout.TableLayout;
import layout.TableLayoutConstraints;

public class MainWindow extends JFrame implements ActionListener, DocumentListener, ChangeListener {
	private static final long serialVersionUID = 5580717767809657474L;
	private static ArrayList<Site> pages = new ArrayList<>();
	static {
		pages.add(new InkBunny());
		pages.add(new FurAffinity());
		pages.add(new Weasyl());
		pages.add(new FurryNetwork());
		pages.add(new DeviantArt());
		pages.add(new E621());
		pages.add(new SoFurry());
	}
	JFileChooser fileChooser = new JFileChooser();
	
	ImageInfo imageInfo = new ImageInfo();

	private JButton btnSelMainImage = new JButton("Select Image");
	private JButton btnSelThumbImage = new JButton("Select Thumbnail (optional)");
	private JLabel imageLabel = new JLabel("", JLabel.CENTER);
	private JLabel thumbLabel = new JLabel("", JLabel.CENTER);

	private JComboBox<ImageInfo.Type> typeBox = new JComboBox<ImageInfo.Type>();
	private JComboBox<ImageInfo.RatingSexual> ratingSexualBox = new JComboBox<ImageInfo.RatingSexual>();
	private JComboBox<ImageInfo.RatingViolence> ratingViolenceBox = new JComboBox<ImageInfo.RatingViolence>();
	
	private JTextField titleText = new JTextField();
	private JTextArea descrText = new JTextArea(5, 10);
	
	private JCheckBox chkScraps = new JCheckBox("Put in Scraps");
	private JCheckBox chkNoNotification = new JCheckBox("No notification");
	private JCheckBox chkFriendsOnly = new JCheckBox("Friends only");
	private JCheckBox chkUnlisted = new JCheckBox("Unlisted");
	
	private JCheckBox chkMale = new JCheckBox("Male");
	private JCheckBox chkFemale = new JCheckBox("Female");
	private JCheckBox chkHerm = new JCheckBox("Herm");
	private JCheckBox chkDickgirl = new JCheckBox("Dickgirl");
	private JCheckBox chkCuntboy = new JCheckBox("Cuntboy");
	private JCheckBox chkMaleherm = new JCheckBox("Maleherm");
	private JCheckBox chkMtF = new JCheckBox("M2F Trans");
	private JCheckBox chkFtM = new JCheckBox("F2M Trans");
	
	private JTextPane speciesTags = new JTextPane();
	private JTextPane kinkTags = new JTextPane();
	private JTextPane otherTags = new JTextPane();
	
	private JLabel lblNonworkingSizes = new JLabel();
	private JButton btnLetsDoThisShit = new JButton("Let's do this! Select pages to upload to!");
	
	public MainWindow() {
		imageInfo.addChangeListener(this);
		FileFilter imageFilter = new FileNameExtensionFilter("Image files", "jpg", "jpeg", "png", "gif");
		fileChooser.setFileFilter(imageFilter);
		fileChooser.setAccessory(new ImagePreview(fileChooser));
		//fileChooser.setFileView(new ImageFileView());
		
		this.setTitle("Furry Crossposter by Double Helix Industries");
		this.setSize(900, 768);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);
		
		JPanel mainPanel = new JPanel();
		mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		this.add(mainPanel);
		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
		
		JLabel artDetails = new JLabel("Artwork Details:");
		artDetails.setFont(artDetails.getFont().deriveFont(24f));
		mainPanel.add(artDetails);
		mainPanel.add(Box.createVerticalStrut(10));
		JLabel sizeNote = new JLabel("Please remember that some sites, like E621, do not resize your image. It will be uploaded as it is.");
		sizeNote.setFont(sizeNote.getFont().deriveFont(Font.PLAIN));
		mainPanel.add(sizeNote);
		mainPanel.add(Box.createVerticalStrut(10));
		
		/**
		 * START OF IMAGE PANEL (FIRST ROW)
		 */
		
		JPanel imagesPanel = new JPanel();
		imagesPanel.setLayout(new BoxLayout(imagesPanel, BoxLayout.X_AXIS));
		imagesPanel.setAlignmentX(LEFT_ALIGNMENT);
		
		JPanel mainImagePanel = new JPanel();
		mainImagePanel.setLayout(new BoxLayout(mainImagePanel, BoxLayout.Y_AXIS));
		
		btnSelMainImage.addActionListener(this);<commit_msg>added version no to title<commit_after>package klaue.furrycrossposter;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.KeyboardFocusManager;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;

import klaue.furrycrossposter.sites.DeviantArt;
import klaue.furrycrossposter.sites.E621;
import klaue.furrycrossposter.sites.FurAffinity;
import klaue.furrycrossposter.sites.FurryNetwork;
import klaue.furrycrossposter.sites.InkBunny;
import klaue.furrycrossposter.sites.Site;
import klaue.furrycrossposter.sites.Weasyl;
import klaue.furrycrossposter.sites.sofurry.SoFurry;
import layout.TableLayout;
import layout.TableLayoutConstraints;

public class MainWindow extends JFrame implements ActionListener, DocumentListener, ChangeListener {
	private static final long serialVersionUID = 5580717767809657474L;
	private static ArrayList<Site> pages = new ArrayList<>();
	static {
		pages.add(new InkBunny());
		pages.add(new FurAffinity());
		pages.add(new Weasyl());
		pages.add(new FurryNetwork());
		pages.add(new DeviantArt());
		pages.add(new E621());
		pages.add(new SoFurry());
	}
	JFileChooser fileChooser = new JFileChooser();
	
	ImageInfo imageInfo = new ImageInfo();

	private JButton btnSelMainImage = new JButton("Select Image");
	private JButton btnSelThumbImage = new JButton("Select Thumbnail (optional)");
	private JLabel imageLabel = new JLabel("", JLabel.CENTER);
	private JLabel thumbLabel = new JLabel("", JLabel.CENTER);

	private JComboBox<ImageInfo.Type> typeBox = new JComboBox<ImageInfo.Type>();
	private JComboBox<ImageInfo.RatingSexual> ratingSexualBox = new JComboBox<ImageInfo.RatingSexual>();
	private JComboBox<ImageInfo.RatingViolence> ratingViolenceBox = new JComboBox<ImageInfo.RatingViolence>();
	
	private JTextField titleText = new JTextField();
	private JTextArea descrText = new JTextArea(5, 10);
	
	private JCheckBox chkScraps = new JCheckBox("Put in Scraps");
	private JCheckBox chkNoNotification = new JCheckBox("No notification");
	private JCheckBox chkFriendsOnly = new JCheckBox("Friends only");
	private JCheckBox chkUnlisted = new JCheckBox("Unlisted");
	
	private JCheckBox chkMale = new JCheckBox("Male");
	private JCheckBox chkFemale = new JCheckBox("Female");
	private JCheckBox chkHerm = new JCheckBox("Herm");
	private JCheckBox chkDickgirl = new JCheckBox("Dickgirl");
	private JCheckBox chkCuntboy = new JCheckBox("Cuntboy");
	private JCheckBox chkMaleherm = new JCheckBox("Maleherm");
	private JCheckBox chkMtF = new JCheckBox("M2F Trans");
	private JCheckBox chkFtM = new JCheckBox("F2M Trans");
	
	private JTextPane speciesTags = new JTextPane();
	private JTextPane kinkTags = new JTextPane();
	private JTextPane otherTags = new JTextPane();
	
	private JLabel lblNonworkingSizes = new JLabel();
	private JButton btnLetsDoThisShit = new JButton("Let's do this! Select pages to upload to!");
	
	public MainWindow() {
		imageInfo.addChangeListener(this);
		FileFilter imageFilter = new FileNameExtensionFilter("Image files", "jpg", "jpeg", "png", "gif");
		fileChooser.setFileFilter(imageFilter);
		fileChooser.setAccessory(new ImagePreview(fileChooser));
		//fileChooser.setFileView(new ImageFileView());
		
		this.setTitle("Furry Crossposter by Double Helix Industries - 1.1");
		this.setSize(900, 768);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);
		
		JPanel mainPanel = new JPanel();
		mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		this.add(mainPanel);
		mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
		
		JLabel artDetails = new JLabel("Artwork Details:");
		artDetails.setFont(artDetails.getFont().deriveFont(24f));
		mainPanel.add(artDetails);
		mainPanel.add(Box.createVerticalStrut(10));
		JLabel sizeNote = new JLabel("Please remember that some sites, like E621, do not resize your image. It will be uploaded as it is.");
		sizeNote.setFont(sizeNote.getFont().deriveFont(Font.PLAIN));
		mainPanel.add(sizeNote);
		mainPanel.add(Box.createVerticalStrut(10));
		
		/**
		 * START OF IMAGE PANEL (FIRST ROW)
		 */
		
		JPanel imagesPanel = new JPanel();
		imagesPanel.setLayout(new BoxLayout(imagesPanel, BoxLayout.X_AXIS));
		imagesPanel.setAlignmentX(LEFT_ALIGNMENT);
		
		JPanel mainImagePanel = new JPanel();
		mainImagePanel.setLayout(new BoxLayout(mainImagePanel, BoxLayout.Y_AXIS));
		
		btnSelMainImage.addActionListener(this);
{'fraction_non_alphanumeric': 0.1062794093785494, 'fraction_numerical': 0.008761966574720104, 'mean_word_length': 6.368200836820083, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3737108', 'n_tokens_mistral': 4188, 'n_tokens_neox': 3892, 'n_words': 850}