Example #1
0
    public static void Init()
    {
        //using var p = APerf.Create();

        //map command handler names/delegates etc
        _cmd = new CmdHandlers();
        //p.Next();

        //ADebug.MemorySetAnchor_();
        _strips = new AuStripManager(Program.MainForm, _cmd);
        _strips.BuildAll(AFolders.ThisAppBS + @"Default\Strips.xml", ProgramSettings.DirBS + "Strips.xml", new AuDockPanel.ZDockedToolStripRenderer());
        //ADebug.MemoryPrint_();
        //p.Next();

        //get top-level toolstrips (menu bar and toolbars)
        Menubar   = _strips.MenuBar;
        tbFile    = _strips.Toolbars["File"];
        tbEdit    = _strips.Toolbars["Edit"];
        tbRun     = _strips.Toolbars["Run"];
        tbTools   = _strips.Toolbars["Tools"];
        tbHelp    = _strips.Toolbars["Help"];
        tbCustom1 = _strips.Toolbars["Custom1"];
        tbCustom2 = _strips.Toolbars["Custom2"];

        //get submenus that will be filled later or used separately etc
        (ddFileNew = _strips.Submenus["File_New"]).Opening += (o, e) => Panels.Files.ZFillMenuNew(o as ToolStripDropDownMenu);
        _strips.Submenus["File_RecentWorkspaces"].Opening  += (o, e) => Panels.Files.ZFillMenuRecentWorkspaces(o as ToolStripDropDownMenu);
        _strips.Submenus["Tools_Panels"].Opening           += (se, da) => Panels.PanelManager.ZAddShowPanelsToMenu(se as ToolStripDropDown, false, true);
        _strips.Submenus["Tools_Toolbars"].Opening         += (se, da) => Panels.PanelManager.ZAddShowPanelsToMenu(se as ToolStripDropDown, true, true);
        ddFile   = _strips.Submenus["Menu_File"];
        ddEdit   = _strips.Submenus["Menu_Edit"];
        ddOutput = _strips.Submenus["Tools_Output"];
        //ddStatusBar = _strips.Submenus["Tools_StatusBar"];

        //get controls
        cHelpFind = tbHelp.Items["Help_Find"] as ToolStripSpringTextBox;
        //var cw1 = new ComboWrapper(cHelpFind.Control);
        //cw1.ArrowButtonPressed += (unu, sed) => AOutput.Write("not implemented");
        cHelpFind.Visible = false;         //FUTURE

        //p.NW();

        //make some buttons wider
        int wider = Au.Util.ADpi.ScaleInt(5);

        tbRun.Items["Run_Run"].Padding = new Padding(wider, 0, wider, 0);

        //tbHelp.Padding = new Padding(); //removes 1-pixel right margin that causes a visual artifact because of gradient, but then not good when no margin when the edit is at the very right edge of the form

#if DEBUG
        //all commands have menu items?
        //var p = APerf.Create();
        foreach (var k in _cmd.Dict.Keys)
        {
            //AOutput.Write(k);
            if (_strips.Xml.Desc(k) == null)
            {
                AWarning.Write("no menu item for command " + k);
            }
        }
        //p.NW(); //450
        //for vice versa, AuStripManager takes care
#endif

#if TRACE
        //tbCustom2.Items.Add("Test", null, TestCompiler.Test);
        tbCustom2.Items.Add("Test", null, (unu, sed) => {
            Program.MainForm.TestEditor();
            //Panels.Files.Test();
            //Panels.Editor.Test();
            //Program.Model.LoadState();
            //TestCompiler.TestCompiling();
            //TestCompiler.TestParsing();
        });
#endif
    }
Example #2
0
    ///// <summary>
    ///// The child list control.
    ///// </summary>
    //public AuListControl ListControl => _list;

    public CiPopupList(CiCompletion compl)
    {
        _compl = compl;

        _w = new _Window(this);
        _w.SuspendLayout();
        _w.Size = Au.Util.ADpi.ScaleSize((300, 360));

        _list = new _FastListBox();
        _list.SuspendLayout();
        _list.AccessibleName         = _list.Name = "Codein_list";
        _list.Dock                   = DockStyle.Fill;
        _list.BackColor              = Color.White;
        _list.ZItemClick            += _list_ItemClick;
        _list.ZSelectedIndexChanged += _list_SelectedIndexChanged;

        _tb = new Au.Util.AToolStrip();
        _tb.SuspendLayout();
        _tb.AccessibleName = _tb.Name = "Codein_listFilter";
        _tb.Renderer       = new AuDockPanel.ZDockedToolStripRenderer();
        _tb.GripStyle      = ToolStripGripStyle.Hidden;
        _tb.LayoutStyle    = ToolStripLayoutStyle.VerticalStackWithOverflow;
        int tbWidth = 0;

        var kindNames = CiUtil.ItemKindNames;

        _nKindButtons = kindNames.Length;
        for (int i = 0; i < kindNames.Length; i++)
        {
            _AddButton(kindNames[i], CiUtil.GetKindImage((CiItemKind)i));
        }
        _tb.Items.Add(new ToolStripSeparator());
        _groupButton = _AddButton("Group by namespace or inheritance", EdResources.GetImageNoCacheDpi(nameof(Au.Editor.Resources.Resources.ciGroupBy)));
        if (Program.Settings.ci_complGroup)
        {
            _groupButton.Checked = true;
        }

        ToolStripButton _AddButton(string text, Image image)
        {
            var b = _tb.Items.Add(image) as ToolStripButton;

            b.DisplayStyle = ToolStripItemDisplayStyle.Image;
            b.ImageScaling = ToolStripItemImageScaling.None;
            b.Name         = b.AccessibleName = b.ToolTipText = text;
            b.Margin       = new Padding(1, 1, 0, 0);
            if (tbWidth == 0)
            {
                tbWidth = 4 + b.ContentRectangle.Left * 2 + image.Width;
            }
            return(b);
        }

        _tb.Width        = tbWidth; _tb.AutoSize = false;  //does not work well with autosize, eg width too small when high DPI
        _tb.Dock         = DockStyle.Left;
        _tb.ItemClicked += _tb_ItemClicked;

        _w.Controls.Add(_list);
        _w.Controls.Add(_tb);
        _tb.ResumeLayout();
        _list.ResumeLayout();
        _w.ResumeLayout(true);

        _imgStatic   = EdResources.GetImageNoCacheDpi(nameof(Au.Editor.Resources.Resources.ciOverlayStatic));
        _imgAbstract = EdResources.GetImageNoCacheDpi(nameof(Au.Editor.Resources.Resources.ciOverlayAbstract));

        _popupHtml  = new CiPopupHtml(CiPopupHtml.UsedBy.PopupList);
        _popupTimer = new ATimer(_ShowPopupHtml);
    }