Ejemplo n.º 1
0
        /// <summary>
        /// Load and overwrite items from a default profile
        /// </summary>
        /// <param name="defaultProfile">The default profile ID</param>
        public void LoadDefaultProfile(DProfile defaultProfile)
        {
            var dp = DefaultProfiles.GetDefaultProfile(defaultProfile);

            if (dp == null)
            {
                return;             // sanity, defaultProfile does not exist
            }
            LoadDefaultProfile(dp); // use default Bar props
        }
Ejemplo n.º 2
0
        public frmConfig( )
        {
            initDone = false;
            InitializeComponent( );

            // Show the instance name in the Window Border Text
            this.Text = "Hud Bar Configuration - Instance: " + (string.IsNullOrEmpty(Program.Instance) ? "Default" : Program.Instance);
            // load the Profile Name Context Menu with items
            ctxMenu.Items.Clear( );
            ctxMenu.Items.Add("Copy items", null, ctxCopy_Click);
            ctxMenu.Items.Add("Paste items here", null, ctxPaste_Click);
            ctxMenu.Items.Add(new ToolStripSeparator( ));

            // Add Aircraft Merges
            var menu = new ToolStripMenuItem("Aircraft Merges");

            ctxMenu.Items.Add(menu);
            AcftMerges.AddMenuItems(menu, ctxAP_Click);

            // Add Default Profiles
            menu = new ToolStripMenuItem("Default Profiles");
            ctxMenu.Items.Add(menu);
            DefaultProfiles.AddMenuItems(menu, ctxDP_Click);
            m_tooltip.ReshowDelay  = 100; // pop a bit faster
            m_tooltip.InitialDelay = 300; // pop a bit faster
            m_tooltip.SetToolTip(txHkShowHide, "Hotkey to Show/Hide the Bar\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkProfile1, "Hotkey to select this Profile\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkProfile2, "Hotkey to select this Profile\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkProfile3, "Hotkey to select this Profile\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkProfile4, "Hotkey to select this Profile\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkProfile5, "Hotkey to select this Profile\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkShelf, "Hotkey to toggle the Flight Bag\nDouble click to edit the Hotkey");
            m_tooltip.SetToolTip(txHkCamera, "Hotkey to toggle the Camera Selector\nDouble click to edit the Hotkey");

            // indexed access for profile controls
            m_flps[0]          = flp1; m_flps[1] = flp2; m_flps[2] = flp3; m_flps[3] = flp4; m_flps[4] = flp5;
            m_pName[0]         = txP1; m_pName[1] = txP2; m_pName[2] = txP3; m_pName[3] = txP4; m_pName[4] = txP5;
            m_pFont[0]         = cbxFontP1; m_pFont[1] = cbxFontP2; m_pFont[2] = cbxFontP3; m_pFont[3] = cbxFontP4; m_pFont[4] = cbxFontP5;
            m_pPlace[0]        = cbxPlaceP1; m_pPlace[1] = cbxPlaceP2; m_pPlace[2] = cbxPlaceP3; m_pPlace[3] = cbxPlaceP4; m_pPlace[4] = cbxPlaceP5;
            m_pKind[0]         = cbxKindP1; m_pKind[1] = cbxKindP2; m_pKind[2] = cbxKindP3; m_pKind[3] = cbxKindP4; m_pKind[4] = cbxKindP5;
            m_pCondensed[0]    = cbxCondP1; m_pCondensed[1] = cbxCondP2; m_pCondensed[2] = cbxCondP3; m_pCondensed[3] = cbxCondP4; m_pCondensed[4] = cbxCondP5;
            m_pTransparency[0] = cbxTrans1; m_pTransparency[1] = cbxTrans2; m_pTransparency[2] = cbxTrans3; m_pTransparency[3] = cbxTrans4; m_pTransparency[4] = cbxTrans5;
        }
Ejemplo n.º 3
0
        // A default profile is clicked
        private void ctxDP_Click(object sender, EventArgs e)
        {
            var    tsi  = (sender as ToolStripItem);
            object item = tsi.Owner;

            // backup the menu tree
            while (!(item is ContextMenuStrip))
            {
                if (item is ToolStripDropDownMenu)
                {
                    item = (item as ToolStripDropDownMenu).OwnerItem;
                }
                else if (item is ToolStripMenuItem)
                {
                    item = (item as ToolStripMenuItem).Owner;
                }
                else
                {
                    return; // not an expected menu tree
                }
            }
            var ctx = item as ContextMenuStrip;
            // col is the profile index assuming Col 0..4 carry the profiles...
            var col = tlp.GetColumn(ctx.SourceControl);

            if (col > c_NumProfiles)
            {
                return;                  // sanity
            }
            var dp = DefaultProfiles.GetDefaultProfile(tsi.Text);

            if (dp != null)
            {
                m_flpHandler[col].LoadDefaultProfile(dp);
                m_flpHandler[col].LoadFlp(HudBarRef);
                m_pName[col].Text = dp.Name;
            }
        }