<commit_before>/*
 * Copyright ©1998-2021 by <NAME>. All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, version 2.0. If a copy of the MPL was not distributed with
 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses", as
 * defined by the Mozilla Public License, version 2.0.
 */

package com.trollworks.gcs.character;

import com.trollworks.gcs.attribute.Attribute;
import com.trollworks.gcs.attribute.AttributeDef;
import com.trollworks.gcs.attribute.AttributeEditor;
import com.trollworks.gcs.body.HitLocationEditor;
import com.trollworks.gcs.datafile.DataChangeListener;
import com.trollworks.gcs.menu.file.CloseHandler;
import com.trollworks.gcs.page.PageSettingsEditor;
import com.trollworks.gcs.preferences.Preferences;
import com.trollworks.gcs.ui.UIUtilities;
import com.trollworks.gcs.ui.layout.PrecisionLayout;
import com.trollworks.gcs.ui.layout.PrecisionLayoutAlignment;
import com.trollworks.gcs.ui.layout.PrecisionLayoutData;
import com.trollworks.gcs.ui.widget.BaseWindow;
import com.trollworks.gcs.ui.widget.Label;
import com.trollworks.gcs.utility.I18n;
import com.trollworks.gcs.utility.text.Text;
import com.trollworks.gcs.utility.units.LengthUnits;
import com.trollworks.gcs.utility.units.WeightUnits;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class SettingsEditor extends BaseWindow implements ActionListener, DocumentListener, ItemListener, CloseHandler, DataChangeListener, Runnable {
    private GURPSCharacter           mCharacter;
    private Settings                 mSettings;
    private JCheckBox                mUseMultiplicativeModifiers;
    private JCheckBox                mUseModifyingDicePlusAdds;
    private JCheckBox                mUseKnowYourOwnStrength;
    private JCheckBox                mUseReducedSwing;
    private JCheckBox                mUseThrustEqualsSwingMinus2;
    private JCheckBox                mUseSimpleMetricConversions;
    private JCheckBox                mShowCollegeInSpells;
    private JCheckBox                mShowDifficulty;
    private JCheckBox                mShowAdvantageModifierAdj;
    private JCheckBox                mShowEquipmentModifierAdj;
    private JCheckBox                mShowSpellAdj;
    private JCheckBox                mShowTitleInsteadOfNameInPageFooter;
    private JComboBox<LengthUnits>   mLengthUnitsCombo;
    private JComboBox<WeightUnits>   mWeightUnitsCombo;
    private JComboBox<DisplayOption> mUserDescriptionDisplayCombo;
    private JComboBox<DisplayOption> mModifiersDisplayCombo;
    private JComboBox<DisplayOption> mNotesDisplayCombo;
    private JTextArea                mBlockLayoutField;
    private PageSettingsEditor       mPageSettingsEditor;
    private AttributeEditor mAttributeEditor;
    private HitLocationEditor        mHitLocationsEditor;
    private JButton                  mResetButton;
    private boolean                  mUpdatePending;

    public static SettingsEditor find(GURPSCharacter character) {
        for (Window window : Window.getWindows()) {
            if (window.isShowing() && window instanceof SettingsEditor) {
                SettingsEditor wnd = (SettingsEditor) window;
                if (wnd.mCharacter == character) {
                    return wnd;<commit_msg>Format file<commit_after>/*
 * Copyright ©1998-2021 by <NAME>. All rights reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, version 2.0. If a copy of the MPL was not distributed with
 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses", as
 * defined by the Mozilla Public License, version 2.0.
 */

package com.trollworks.gcs.character;

import com.trollworks.gcs.attribute.Attribute;
import com.trollworks.gcs.attribute.AttributeDef;
import com.trollworks.gcs.attribute.AttributeEditor;
import com.trollworks.gcs.body.HitLocationEditor;
import com.trollworks.gcs.datafile.DataChangeListener;
import com.trollworks.gcs.menu.file.CloseHandler;
import com.trollworks.gcs.page.PageSettingsEditor;
import com.trollworks.gcs.preferences.Preferences;
import com.trollworks.gcs.ui.UIUtilities;
import com.trollworks.gcs.ui.layout.PrecisionLayout;
import com.trollworks.gcs.ui.layout.PrecisionLayoutAlignment;
import com.trollworks.gcs.ui.layout.PrecisionLayoutData;
import com.trollworks.gcs.ui.widget.BaseWindow;
import com.trollworks.gcs.ui.widget.Label;
import com.trollworks.gcs.utility.I18n;
import com.trollworks.gcs.utility.text.Text;
import com.trollworks.gcs.utility.units.LengthUnits;
import com.trollworks.gcs.utility.units.WeightUnits;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowEvent;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class SettingsEditor extends BaseWindow implements ActionListener, DocumentListener, ItemListener, CloseHandler, DataChangeListener, Runnable {
    private GURPSCharacter           mCharacter;
    private Settings                 mSettings;
    private JCheckBox                mUseMultiplicativeModifiers;
    private JCheckBox                mUseModifyingDicePlusAdds;
    private JCheckBox                mUseKnowYourOwnStrength;
    private JCheckBox                mUseReducedSwing;
    private JCheckBox                mUseThrustEqualsSwingMinus2;
    private JCheckBox                mUseSimpleMetricConversions;
    private JCheckBox                mShowCollegeInSpells;
    private JCheckBox                mShowDifficulty;
    private JCheckBox                mShowAdvantageModifierAdj;
    private JCheckBox                mShowEquipmentModifierAdj;
    private JCheckBox                mShowSpellAdj;
    private JCheckBox                mShowTitleInsteadOfNameInPageFooter;
    private JComboBox<LengthUnits>   mLengthUnitsCombo;
    private JComboBox<WeightUnits>   mWeightUnitsCombo;
    private JComboBox<DisplayOption> mUserDescriptionDisplayCombo;
    private JComboBox<DisplayOption> mModifiersDisplayCombo;
    private JComboBox<DisplayOption> mNotesDisplayCombo;
    private JTextArea                mBlockLayoutField;
    private PageSettingsEditor       mPageSettingsEditor;
    private AttributeEditor          mAttributeEditor;
    private HitLocationEditor        mHitLocationsEditor;
    private JButton                  mResetButton;
    private boolean                  mUpdatePending;

    public static SettingsEditor find(GURPSCharacter character) {
        for (Window window : Window.getWindows()) {
            if (window.isShowing() && window instanceof SettingsEditor) {
                SettingsEditor wnd = (SettingsEditor) window;
                if (wnd.mCharacter == character) {
                    return wnd;
{'fraction_non_alphanumeric': 0.07169949834821975, 'fraction_numerical': 0.004160039153309678, 'mean_word_length': 3.53858967240422, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1220372', 'n_tokens_mistral': 2357, 'n_tokens_neox': 2307, 'n_words': 512}