Exemple #1
0
        private void btFonts_Click(object sender, EventArgs e)
        {
            FONTSdialog.ProtoLabelRef  = HudBarRef.ProtoLabelRef;
            FONTSdialog.ProtoValueRef  = HudBarRef.ProtoValueRef;
            FONTSdialog.ProtoValue2Ref = HudBarRef.ProtoValue2Ref;
            FONTSdialog.Fonts?.Dispose( );
            FONTSdialog.Fonts = new GUI.GUI_Fonts(m_configFonts); // let the Config use a clone to apply changes for preview

            if (FONTSdialog.ShowDialog(this) == DialogResult.OK)
            {
                // store fonts
                m_configFonts.Dispose( );
                m_configFonts      = new GUI.GUI_Fonts(FONTSdialog.Fonts); // maintain the changes
                m_applyFontChanges = true;                                 // if called multiple times it only stores the Accept one
            }
        }
Exemple #2
0
        // LOAD is called on any invocation of the Dialog
        // Load all items from HUD to make them editable
        private void frmConfig_Load(object sender, EventArgs e)
        {
            this.TopMost = false; // inherited from parent - we don't want this here

            if (HudBarRef == null)
            {
                return;                // sanity ..
            }
            if (ProfilesRef?.Count < c_NumProfiles)
            {
                return;                                // sanity ..
            }
            cbxUnits.Checked          = HudBarRef.ShowUnits;
            cbxFlightRecorder.Checked = HudBarRef.FlightRecorder;

            PopulateASave(cbxASave); //20211204
            cbxASave.SelectedIndex = (int)HudBarRef.FltAutoSave;
            PopulateVoice(cbxVoice); // 20211006
            LoadVoice(cbxVoice);
            _speech.SetVoice(cbxVoice.SelectedItem.ToString( ));
            _speech.Enabled = true;

            PopulateVoiceCallouts( ); // 20211018

            // Hotkeys // 20211211
            m_hotkeys = HudBarRef.Hotkeys.Copy( );
            PopulateHotkeys( );
            chkKeyboard.Checked = HudBarRef.KeyboardHook; // 20211208
            chkInGame.Checked   = HudBarRef.InGameHook;   // 20211208


            // for all profiles
            for (int p = 0; p < c_NumProfiles; p++)
            {
                m_pName[p].Text = ProfilesRef[p].PName;
                m_flpHandler[p] = new FlpHandler(m_flps[p], p + 1,
                                                 ProfilesRef[p].ProfileString( ), ProfilesRef[p].FlowBreakString( ), ProfilesRef[p].ItemPosString( ));
                m_flpHandler[p].LoadFlp(HudBarRef);
                PopulateFonts(m_pFont[p]);
                ProfilesRef[p].LoadFontSize(m_pFont[p]);
                PopulatePlacement(m_pPlace[p]);
                ProfilesRef[p].LoadPlacement(m_pPlace[p]);
                PopulateKind(m_pKind[p]);
                ProfilesRef[p].LoadKind(m_pKind[p]);
                PopulateCond(m_pCondensed[p]);
                ProfilesRef[p].LoadCond(m_pCondensed[p]);
                PopulateTrans(m_pTransparency[p]);
                ProfilesRef[p].LoadTrans(m_pTransparency[p]);

                // mark the selected one
                if (SelectedProfile == p)
                {
                    m_pName[p].BackColor = Color.LimeGreen;
                }

                txShelfFolder.Text = HudBarRef.ShelfFolder; // 20220212
            }

#if DEBUG
            btDumpConfigs.Visible = true; // way to dump the configuration
#endif

            // use a Config Copy to allow Cancel changes
            FONTSdialog   = new FrmFonts( );
            m_configFonts = new GUI.GUI_Fonts(HudBarRef.FontRef);

            initDone = true;
        }