Exemple #1
0
        /// <summary>
        /// Handles a text-changed event in the executable and column width text boxes.
        /// </summary>
        private void AsmConfig_TextChanged(object sender, EventArgs e)
        {
            AsmComboItem item = (AsmComboItem)asmConfigComboBox.SelectedItem;

            AssemblerConfig.SetConfig(mSettings, item.AssemblerId, GetAsmConfigFromUi());
            SetDirty(true);
        }
Exemple #2
0
        /// <summary>
        /// Populates the assembler combo box.  Attempts to match the defaultAsm arg with
        /// the entries to configure the initial value.
        /// </summary>
        private void PopulateAssemblerComboBox(string defaultAsm)
        {
            //assemblerComboBox.DisplayMember = "Name";   // show this property

            assemblerComboBox.Items.Clear();
            IEnumerator <AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
            bool foundMatch = false;

            while (iter.MoveNext())
            {
                AssemblerInfo    info    = iter.Current;
                AssemblerVersion version = AssemblerVersionCache.GetVersion(info.AssemblerId);
                AsmComboItem     item    = new AsmComboItem(info, version);
                assemblerComboBox.Items.Add(item);
                if (item.AssemblerId.ToString() == defaultAsm)
                {
                    Debug.WriteLine("matched current " + defaultAsm);
                    assemblerComboBox.SelectedItem = item;
                    foundMatch = true;
                }
            }
            if (!foundMatch)
            {
                // Need to do this or box will show empty.
                assemblerComboBox.SelectedIndex = 0;
            }
        }
Exemple #3
0
        private void ConfigureComboBox(ComboBox cb)
        {
            // Show the Name field.
            cb.DisplayMember = "Name";

            cb.Items.Clear();
            IEnumerator <AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
            bool foundMatch = false;

            while (iter.MoveNext())
            {
                AssemblerInfo info = iter.Current;
                AsmComboItem  item = new AsmComboItem(info);
                cb.Items.Add(item);
                if (item.AssemblerId == mInitialAsmId)
                {
                    cb.SelectedItem = item;
                    foundMatch      = true;
                }
            }
            if (!foundMatch)
            {
                // Need to do this or box will show empty.
                cb.SelectedIndex = 0;
            }
        }
Exemple #4
0
        /// <summary>
        /// Configures assembler-specific items, such as the installation directory of the
        /// assembler binary.
        /// </summary>
        private void DoSettings()
        {
            // Pop open the app settings dialog, with the appropriate tab selected.
            mProjView.ShowAppSettings(AppForms.EditAppSettings.Tab.Assembler);

            // Update the controls based on whether or not the assembler is now available.
            UpdateAssemblerControls();
            AsmComboItem item = (AsmComboItem)assemblerComboBox.SelectedItem;

            PopulateAssemblerComboBox(item.AssemblerId.ToString());
        }
Exemple #5
0
        private void AssemblerSettingsButton_Click(object sender, RoutedEventArgs e)
        {
            // Pop open the app settings dialog, with the appropriate tab selected.
            mMainCtrl.ShowAppSettings(this, EditAppSettings.Tab.AsmConfig,
                                      mSelectedAssemblerId);

            // Update the controls based on whether or not the assembler is now available.
            UpdateAssemblerControls();
            AsmComboItem item = (AsmComboItem)assemblerComboBox.SelectedItem;

            Debug.Assert(item != null);
            PopulateAssemblerComboBox(item.AssemblerId.ToString());
        }
Exemple #6
0
        private void assemblerComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            AsmComboItem sel = (AsmComboItem)assemblerComboBox.SelectedItem;

            if (mSelectedAssemblerId != sel.AssemblerId)
            {
                // Selection changed, discard window contents.
                mSelectedAssemblerId = sel.AssemblerId;
                AppSettings.Global.SetString(AppSettings.SRCGEN_DEFAULT_ASM,
                                             mSelectedAssemblerId.ToString());
                ResetElements();
            }
        }
Exemple #7
0
        private void pseudoOpSetButton_Click(object sender, EventArgs e)
        {
            AsmComboItem item = (AsmComboItem)pseudoOpQuickComboBox.SelectedItem;

            AssemblerInfo.Id  asmId = item.AssemblerId;
            AsmGen.IGenerator gen   = AssemblerInfo.GetGenerator(asmId);

            PseudoOp.PseudoOpNames       opNames;
            Asm65.Formatter.FormatConfig formatConfig;
            gen.GetDefaultDisplayFormat(out opNames, out formatConfig);
            ImportPseudoOpNames(opNames);

            // dirty flag set by change watchers if one or more fields have changed
        }
Exemple #8
0
        private void displayFmtSetButton_Click(object sender, EventArgs e)
        {
            AsmComboItem item = (AsmComboItem)displayFmtQuickComboBox.SelectedItem;

            AssemblerInfo.Id  asmId = item.AssemblerId;
            AsmGen.IGenerator gen   = AssemblerInfo.GetGenerator(asmId);

            PseudoOp.PseudoOpNames       opNames;
            Asm65.Formatter.FormatConfig formatConfig;
            gen.GetDefaultDisplayFormat(out opNames, out formatConfig);

            SetWidthDisamSettings(formatConfig.mForceAbsOpcodeSuffix,
                                  formatConfig.mForceLongOpcodeSuffix,
                                  formatConfig.mForceAbsOperandPrefix,
                                  formatConfig.mForceLongOperandPrefix);
            SetExpressionStyle(formatConfig.mExpressionMode);
            // dirty flag set by change watchers if one or more fields have changed
        }
Exemple #9
0
        /// <summary>
        /// Updates the selected assembler as the combo box selection changes.  This is
        /// expected to be called during the window load event, to initialize the field.
        /// </summary>
        private void AssemblerComboBox_SelectionChanged(object sender,
                                                        SelectionChangedEventArgs e)
        {
            AsmComboItem sel = (AsmComboItem)assemblerComboBox.SelectedItem;

            if (sel == null)
            {
                // this happens on Items.Clear()
                return;
            }
            if (mSelectedAssemblerId != sel.AssemblerId)
            {
                // Selection changed, discard window contents.
                mSelectedAssemblerId = sel.AssemblerId;
                AppSettings.Global.SetString(AppSettings.SRCGEN_DEFAULT_ASM,
                                             mSelectedAssemblerId.ToString());
                ResetElements();
            }
        }
Exemple #10
0
        private void asmExeBrowseButton_Click(object sender, EventArgs e)
        {
            AsmComboItem item = (AsmComboItem)asmConfigComboBox.SelectedItem;

            AssemblerInfo.Id asmId = item.AssemblerId;

            // Figure out what we're looking for.  For example, cc65 needs "cl65".
            AsmGen.IAssembler asm = AssemblerInfo.GetAssembler(asmId);
            asm.GetExeIdentifiers(out string humanName, out string exeName);

            // Ask the user to find it.
            string pathName = BrowseForExecutable(humanName, exeName);

            if (pathName != null)
            {
                asmExePathTextBox.Text = pathName;
                AssemblerConfig.SetConfig(mSettings, asmId, GetAsmConfigFromUi());
                SetDirty(true);
            }
        }
Exemple #11
0
        /// <summary>
        /// Populates the UI elements from the asm config item in the settings.  If that doesn't
        /// exist, use the default config.
        /// </summary>
        private void PopulateAsmConfigItems()
        {
            AsmComboItem item = (AsmComboItem)asmConfigComboBox.SelectedItem;

            AssemblerInfo.Id asmId = item.AssemblerId;

            AssemblerConfig config = AssemblerConfig.GetConfig(mSettings, asmId);

            if (config == null)
            {
                AsmGen.IAssembler asm = AssemblerInfo.GetAssembler(asmId);
                config = asm.GetDefaultConfig();
            }

            asmExePathTextBox.Text         = config.ExecutablePath;
            asmLabelColWidthTextBox.Text   = config.ColumnWidths[0].ToString();
            asmOpcodeColWidthTextBox.Text  = config.ColumnWidths[1].ToString();
            asmOperandColWidthTextBox.Text = config.ColumnWidths[2].ToString();
            asmCommentColWidthTextBox.Text = config.ColumnWidths[3].ToString();
        }