Exemple #1
0
        /// <summary>
        /// Handler for all show/hide column buttons.
        /// </summary>
        /// <param name="sender">Identifies the button that was clicked.</param>
        /// <param name="e">Stuff.</param>
        private void ColumnVisibilityButtonClick(object sender, EventArgs e)
        {
            int index = -1;

            for (int i = 0; i < mColButtons.Length; i++)
            {
                if (sender == mColButtons[i])
                {
                    index = i;
                    break;
                }
            }
            Debug.Assert(index != -1);

            string widthStr = mSettings.GetString(AppSettings.CDLV_COL_WIDTHS, null);

            Debug.Assert(!string.IsNullOrEmpty(widthStr));
            ProjectView.CodeListColumnWidths widths =
                ProjectView.CodeListColumnWidths.Deserialize(widthStr);
            if (widths.Width[index] == 0)
            {
                // Expand to default width.  The default width changes when the font
                // changes, so it's best to just reacquire the default width set as needed.
                ProjectView.CodeListColumnWidths defaultWidths =
                    mProjectView.GetDefaultCodeListColumnWidths();
                widths.Width[index] = defaultWidths.Width[index];
            }
            else
            {
                widths.Width[index] = 0;
            }
            widthStr = widths.Serialize();
            mSettings.SetString(AppSettings.CDLV_COL_WIDTHS, widthStr);
            SetShowHideButton(index, widths.Width[index]);

            SetDirty(true);
        }
Exemple #2
0
        private void EditAppSettings_Load(object sender, EventArgs e)
        {
            // Column widths.  We called SaveCodeListColumnWidths() earlier, so this
            // should always be a valid serialized string.
            string widthStr = mSettings.GetString(AppSettings.CDLV_COL_WIDTHS, null);

            Debug.Assert(!string.IsNullOrEmpty(widthStr));
            ProjectView.CodeListColumnWidths widths =
                ProjectView.CodeListColumnWidths.Deserialize(widthStr);
            Debug.Assert(widths != null);
            for (int i = 0; i < NUM_COLUMNS; i++)
            {
                SetShowHideButton(i, widths.Width[i]);
            }

            // Display localized font string.
            FontConverter cvt = new FontConverter();

            currentFontDisplayLabel.Text = cvt.ConvertToString(mProjectView.CodeListViewFont);

            // Upper-case formatting.
            upperHexCheckBox.Checked    = mSettings.GetBool(AppSettings.FMT_UPPER_HEX_DIGITS, false);
            upperOpcodeCheckBox.Checked = mSettings.GetBool(
                AppSettings.FMT_UPPER_OP_MNEMONIC, false);
            upperPseudoOpCheckBox.Checked = mSettings.GetBool(
                AppSettings.FMT_UPPER_PSEUDO_OP_MNEMONIC, false);
            upperACheckBox.Checked  = mSettings.GetBool(AppSettings.FMT_UPPER_OPERAND_A, false);
            upperSCheckBox.Checked  = mSettings.GetBool(AppSettings.FMT_UPPER_OPERAND_S, false);
            upperXYCheckBox.Checked = mSettings.GetBool(AppSettings.FMT_UPPER_OPERAND_XY, false);

            int clipIndex = mSettings.GetInt(AppSettings.CLIP_LINE_FORMAT, 0);

            if (clipIndex >= 0 && clipIndex < clipboardFormatComboBox.Items.Count)
            {
                clipboardFormatComboBox.SelectedIndex = clipIndex;
            }

            spacesBetweenBytesCheckBox.Checked =
                mSettings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false);
            enableDebugCheckBox.Checked = mSettings.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);

            // Assemblers.
            PopulateAsmConfigItems();
            showAsmIdentCheckBox.Checked =
                mSettings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false);
            disableLabelLocalizationCheckBox.Checked =
                mSettings.GetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION, false);
            longLabelNewLineCheckBox.Checked =
                mSettings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);
            showCycleCountsCheckBox.Checked =
                mSettings.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false);

            // Pseudo ops.
            string opStrCereal = mSettings.GetString(AppSettings.FMT_PSEUDO_OP_NAMES, null);

            if (!string.IsNullOrEmpty(opStrCereal))
            {
                PseudoOp.PseudoOpNames opNames = PseudoOp.PseudoOpNames.Deserialize(opStrCereal);
                ImportPseudoOpNames(opNames);
            }
            else
            {
                // no data available, populate with blanks
                //PseudoOp.PseudoOpNames opNames = PseudoOp.sDefaultPseudoOpNames;
                ImportPseudoOpNames(new PseudoOp.PseudoOpNames());
            }

            PopulateWidthDisamSettings();

            string         exprMode = mSettings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
            ExpressionMode mode;

            if (!Enum.TryParse <ExpressionMode>(exprMode, out mode))
            {
                mode = ExpressionMode.Common;
            }
            SetExpressionStyle(mode);

            if (mInitialTab != Tab.Unknown)
            {
                settingsTabControl.SelectTab((int)mInitialTab);
            }

            mDirty = false;
            UpdateControls();
        }