Exemple #1
0
#pragma warning restore 67

    #endregion

    private void _c_NodeMouseClick(object sender, TreeNodeAdvMouseEventArgs e)
    {
        if (e.ModifierKeys != 0)
        {
            return;
        }
        var f = e.Node.Tag as FileNode;

        switch (e.Button)
        {
        case MouseButtons.Left:
            Program.Model.SetCurrentFile(f);
            break;

        case MouseButtons.Right:
            var m = new AMenu();
            m["Close\tM-click"] = o => Program.Model.CloseFile(f, true);
            using (m.Submenu("Multiple")) {
                m["Close all other"] = o => Program.Model.CloseEtc(FilesModel.ECloseCmd.CloseAll, dontClose: f);
                m["Close all"]       = o => Program.Model.CloseEtc(FilesModel.ECloseCmd.CloseAll);
            }
            m.Show(_c);
            break;

        case MouseButtons.Middle:
            Program.Model.CloseFile(f, true);
            break;
        }
    }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            AMenu selectedMenu = OrderContent.SelectedItem as AMenu;

            currentOrder.RemoveMenu(selectedMenu.GetUniqueId());
            ReinitOrderSource();
        }
 public SmallDecorator(AMenu baseComponent)
     : base(baseComponent)
 {
     this.Price    = base.GetCost();
     this.UniqueId = baseComponent.GetUniqueId();
     this.Items    = baseComponent.Items;
 }
Exemple #4
0
 public ToggleButton(AMenu cnt, String text, Vector2 p, MenuManager.HandlerAction h, Object data = null, float s = 0.6f)
     : base(cnt, text, p, h, data, s)
 {
     alpha = 0.5f;
         if (!(bool)arg)
             Content.Color *= alpha;
 }
        private void SetUpMenus()
        {
            resourceViewMenu = new VerticalMenu <ResourceTypes>(resourceMenuPanel, new SizeF(resourceMenuPanel.Width, 25));

            resourceViewMenu.tabChanged += OnResourceViewTabChange;

            resourceViewMenu.tabColor    = BackColor;
            resourceViewMenu.textColor   = ForeColor;
            resourceViewMenu.borderWidth = 0;
            resourceViewMenu.bordorColor = Color.White;

            resourceViewMenu.CreateTab("Raw", ResourceTypes.Raw);
            resourceViewMenu.CreateTab("Intermediate", ResourceTypes.Intermediate);
            resourceViewMenu.CreateTab("Finalized", ResourceTypes.Finalized);

            resourceViewMenu.ChangeTab(0);


            mainViewMenu = new VerticalMenu <UserControl>(mainViewMenuPanel, new SizeF(mainViewMenuPanel.Width, 50));

            mainViewMenu.tabChanged += OnMainViewTabChange;

            mainViewMenu.tabColor    = BackColor;
            mainViewMenu.textColor   = ForeColor;
            mainViewMenu.borderWidth = 0;
            mainViewMenu.bordorColor = Color.White;

            mainViewMenu.CreateTab("Resources", new ResourceViewControl());
            mainViewMenu.CreateTab("Buildings", null);
            mainViewMenu.CreateTab("Produce", null);

            mainViewMenu.ChangeTab(0);
        }
Exemple #6
0
    public void CloseMenu(AMenu m)
    {
        m.SetClosed();

        // check if it's the top pop-up
        if (popups.Size() > 0 && popups.First() == m)
        {
            Destroy(popups.First().gameObject);
            popups.RemoveFirst();
            if (popups.Size() > 0)
            {
                popups.First().gameObject.SetActive(true);
            }
        }

        var it = popups.Iterator();         // remove menu from the list

        while (it.Next())
        {
            if (it.Value() == m)
            {
                Destroy(it.Value().gameObject);
                it.Remove();
            }
        }
        it = menus.Iterator();         // remove menu from the list
        while (it.Next())
        {
            if (it.Value() == m)
            {
                Destroy(it.Value().gameObject);
                it.Remove();
            }
        }
    }
Exemple #7
0
 public NormalDecorator(AMenu baseComponent)
     : base(baseComponent)
 {
     Price    = base.GetCost() + 2.5f;
     UniqueId = baseComponent.GetUniqueId();
     Items    = baseComponent.Items;
 }
Exemple #8
0
#pragma warning restore 67

    #endregion

    private void _c_NodeMouseClick(object sender, TreeNodeAdvMouseEventArgs e)
    {
        if (e.ModifierKeys != 0)
        {
            return;
        }
        var t = e.Node.Tag as RunningTask;
        var f = t.f;

        switch (e.Button)
        {
        case MouseButtons.Left:
            Program.Model.SetCurrentFile(f);
            break;

        case MouseButtons.Right:
            var name = f.DisplayName;
            var m    = new AMenu();
            m["End task  " + name] = o => Program.Tasks.EndTask(t);
            m["End all  " + name]  = o => Program.Tasks.EndTasksOf(f);
            m.Separator();
            m["Close\tM-click"] = o => Program.Model.CloseFile(f, true);
            if (null == Panels.Editor.ZGetOpenDocOf(f))
            {
                m.LastMenuItem.Enabled = false;
            }
            m.Show(_c);
            break;

        case MouseButtons.Middle:
            Program.Model.CloseFile(f, true);
            break;
        }
    }
Exemple #9
0
 public void Close(AMenu menu)
 {
     if (menu)
     {
         menu.OnClose();
         menu.open  = false;
         lastClosed = menu;
     }
 }
Exemple #10
0
 public void Open(AMenu menu)
 {
     if (menu)
     {
         menu.OnOpen();
         menu.open  = true;
         lastOpened = menu;
     }
 }
Exemple #11
0
    private static void UtilTest()
    {
        Rect r1 = Rect.MinMaxRect(0, 0, 3, 5);
        Rect r2 = Rect.MinMaxRect(1, 1, 6, 2);
        Rect u  = AMenu.Union(r1, r2);

        UT.assert(u.x == 0 && u.y == 0 && u.width == 6f && u.height == 5f);
        UT.print("Union: " + u);
    }
Exemple #12
0
        void _FillGrid()
        {
            _noeventGridValueChanged = true;
            var g = _grid;

            g.ZClear();

            g.ZAdd(null, "Control", "Edit window/control...", false, etype: ParamGrid.EditType.Button,
                   buttonAction: (unu, sed) => { var r = _code.ZShowWndTool(_wnd, _con, !_useCon); if (r.ok)
                                                 {
                                                     _SetWndCon(r.wnd, r.con, r.useCon, true);
                                                 }
                   },
                   tt: "Search only in control (if captured), not in whole window.\r\nTo edit window or/and control name etc, click 'Edit window/control...' or edit it in the code field.");
            g.ZEnableCell(0, 0, false);
            g.ZAdd("rect", "Search in rectangle", "(left, top, width, height)", etype: ParamGrid.EditType.TextButton, buttonAction: _MenuRect,
                   tt: "Limit the search area to this rectangle in the client area of the window or control.\nSmaller = faster.");
            g.ZAdd("windowPixels", "Get window pixels", "WIFlags.WindowDC|WIFlags.PrintWindow", tt: "Window can be in background.\nWorks not with all windows.\nWindowDC makes faster.\nPrintWindow works with more windows.", etype: ParamGrid.EditType.ComboList, comboIndex: 0);
            g.ZAdd("colorDiff", "Allow color difference", "10", tt: "Parameter colorDiff.\nValid values: 0 - 250.\nBigger = slower.");
            g.ZAdd("skip", "Skip matching images", "1", tt: "0-based index of matching image.\nFor example, if 1, gets the second matching image.");

            //g.ZAddHeaderRow("Results, wait, action");
            g.ZAddCheck("all", "Find all", tt: "Find all matching images");
            g.ZAdd("Wait", "Wait", "5", tt: c_infoWait);
            g.ZAdd("WaitNot", "Wait until disappears", "5", tt: c_infoWait);
            g.ZAddCheck("orThrow", "Exception if not found", true);
            g.ZAdd(null, "Mouse", "Move|Click|Right click", true, tt: "When found, call MouseMove or MouseClick", etype: ParamGrid.EditType.ComboList, comboIndex: 0);

            _noeventGridValueChanged = false;
            g.ZAutoSize();

            void _MenuRect(object unu, EventArgs sed)
            {
                if (_wnd.Is0)
                {
                    return;
                }
                var m = new AMenu();

                m["Rectangle of the captured image"] = o => _SetRect(_rect);
                m["Select rectangle..."]             = o => { if (_CaptureImageOrRect(true, out var r))
                                                              {
                                                                  _SetRect(r.rect);
                                                              }
                };
                m.Show(this);
                void _SetRect(RECT k)
                {
                    _grid.ZSetCellText("rect", 1, $"({k.left}, {k.top}, {k.Width}, {k.Height})");
                    _Check("rect", true);
                }
            }
        }
Exemple #13
0
        public bool IsOpen(string menuName)
        {
            AMenu menu = GetMenu(menuName);

            if (menu)
            {
                return(menu.open);
            }
            else
            {
                return(false);
            }
        }
Exemple #14
0
        public void Return(string menuName)
        {
            AMenu menu = GetMenu(menuName);

            if (menu)
            {
                if (menu.callingMenu)
                {
                    Open(menu.callingMenu);
                }
            }
            Close(menuName);
        }
Exemple #15
0
        /* METHODS */

        public void Open(string menuName, AMenu callingMenu)
        {
            AMenu menu = GetMenu(menuName);

            if (menu)
            {
                if (callingMenu)
                {
                    menu.callingMenu = callingMenu;
                }
                Open(menu);
            }
        }
Exemple #16
0
        /* UNITY MESSAGES */
        // Use this for initialization
        protected override void Start()
        {
            base.Start();

            menuDictionary = new Dictionary <string, AMenu>();

            foreach (GameObject prefab in menuPrefabs)
            {
                AMenu menu = Instantiate(prefab).GetComponent <AMenu>();
                menu.open = false;
                menuDictionary.Add(prefab.name, menu);
                menu.menuManager = this;
            }
        }
Exemple #17
0
            internal void ShowContextMenu(Point p)
            {
                var m = new AMenu();

                using (m.Submenu("Width")) {
                    for (int i = 1, k = this.SplitterWidth; i <= 10; i++)
                    {
                        m.Add(i.ToString(), o => {
                            this.SplitterWidth = o.Item.Text.ToInt();
                            _manager._UpdateLayout(true);                             //not this.UpdateLayout() because may need to apply minimal layouts
                        }).Checked = k == 0;
                    }
                }

                m.Show(_manager, p.X, p.Y);
            }
Exemple #18
0
    public AMenu CreateMenu(UIAlign anchor)
    {
        AMenu m = Instantiate(MenuPrefab).GetComponent <AMenu>();

        m.main.anchor = anchor;
        m.Initialize(this);
        if (menus.Size() > 0)
        {
            m.SetLayerOrder(menus.Last().GetLayerOrder() + 1);
        }
        else
        {
            m.SetLayerOrder(1);
        }
        menus.AddLast(m);
        return(m);
    }
Exemple #19
0
    public AMenu CreatePopup(UIAlign anchor)
    {
        AMenu m = CreateMenu(anchor);

        popups.AddFirst(m);
        popups.AssertValid();

        // inactivate others
        var it = popups.Iterator();

        it.Next();
        while (it.Next())
        {
            it.Value().gameObject.SetActive(false);
        }
        return(m);
    }
Exemple #20
0
 public AButton(AMenu cnt, String text, Vector2 p, MenuManager.HandlerAction h, Object data = null, float s = 0.6f)
     : base(App.Game)
 {
     Container = cnt;
     scale = s;
     arg = data;
     execute = h;
     DefaultColor = Constants.Color.border;
     OverColor = Constants.Color.p1Light;
     Content = new GameString(text, TextManager.EFont.AHARONI, Constants.Color.border, scale);
     size = TextManager.Instance.getSizeString(Content.Font, Content.Value);
     int middle = 10;
     TotalSize = new Vector2((35 + (53 * middle) + 35) * scale, 115 * scale);
     LeftPos = p;
     rightPos = new Vector2(p.X + (35 + middle * 53) * scale, p.Y);
     Content.Pos = new Vector2(LeftPos.X + (35 * 2 + 53 *10 - size.X) / 2 * scale,
                   LeftPos.Y + (115 - size.Y + size.Y * 0.3f) / 2 * scale);
 }
Exemple #21
0
    public static void Add()
    {
        _trayIcon             = new NotifyIcon();
        _trayIcon.MouseClick += _trayIcon_MouseClick;
        _trayIcon.Icon        = EdStock.IconTrayNormal;
        _trayIcon.Text        = Program.AppName;
        _trayIcon.Visible     = true;

        var m = new AMenu {
            MultiShow = true, ActivateMenuWindow = true
        };

        m["End green task\tSleep"]     = o => Program.Tasks.EndTask();
        m["Disable triggers\tM-click"] = o => Run.DisableTriggers(null); var dt = m.LastMenuItem;
        m.Control.Opening += (unu, sed) => { dt.Checked = _disabled; };
        m.Separator();
        m["Exit"] = o => Strips.Cmd.File_Exit();
        _trayIcon.ContextMenuStrip = m.Control;
    }
Exemple #22
0
 public void UpdateBounds()
 {
     if (list.Size() == 0)
     {
         bounds = new Rect();             // no objects, no bounds
     }
     else
     {
         var it = list.Iterator();
         it.Next();
         bounds = it.Value().GetRelativeRect();             // start with the first object
         UT.print("UpdateBounds: rect " + it.Value().GetRelativeRect() + ", bounds " + bounds);
         while (it.Next())
         {
             bounds = AMenu.Union(bounds, it.Value().GetRelativeRect());
             UT.print("UpdateBounds: rect " + it.Value().GetRelativeRect() + ", bounds " + bounds);
         }
     }
 }
Exemple #23
0
    //unsafe class MapArray
    //{
    //	public int[] _a;
    //	public Vector128<int>[] _v;

    //	public MapArray(int n)
    //	{
    //		_a = new int[n];
    //		for(int i = 0; i < _a.Length; i++) _a[i] = i;

    //		_v = new Vector128<int>[n];
    //	}

    //	public void Move(int i)
    //	{
    //		int n = _a.Length - i - 1;
    //		Array.Copy(_a, i, _a, i + 1, n);

    //		//fixed(int* p = _a) Api.memmove(p + i + 1, p + 1, n * 4); //same speed
    //	}

    //	[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
    //	public void Inc(int i, int add)
    //	{
    //		//for(; i < _a.Length; i++) _a[i]+=add;

    //		long add2 = add; add2 = add2 << 32 | add2;
    //		fixed(int* ip = _a) {
    //			var p = (long*)ip;
    //			for(int n = _a.Length / 2; i < n; i++) {
    //				//var v = p[i];
    //				p[i] += add2;
    //			}

    //		}

    //		//var va = Vector128.Create(add);
    //		//for(;  i < _v.Length; i++) {
    //		//	_v[i]=Sse2.Add(_v[i], va);
    //		//}
    //	}

    //	//public void Insert(int i, int add)
    //	//{
    //	//	for(; i < _a.Length; i++) _a[i]+=add;
    //	//}

    //	public void AOutput.WriteVector()
    //	{
    //		AOutput.Write(_a);

    //		//for(int i=0; i < _v.Length; i++) {
    //		//	AOutput.Write(_v[i].GetElement(0), _v[i].GetElement(1), _v[i].GetElement(2), _v[i].GetElement(3));
    //		//}
    //	}
    //}

    //class JSettings
    //{
    //	public string OneTwo { get; set; }
    //	public int ThreeFour { get; set; }
    //	public int Five { get; set; }
    //	public bool Six { get; set; }
    //	public string Seven { get; set; }
    //	public string Eight { get; set; } = "def";
    //}

    //void TestJson()
    //{
    //	var file = @"Q:\test\sett.json";
    //	var file2 = @"Q:\test\sett.xml";

    //	var v = new JSettings { OneTwo = "text ąčę", ThreeFour = 100 };

    //	for(int i = 0; i < 5; i++) {
    //		//100.ms();
    //		//APerf.First();
    //		//var k1 = new JsonSerializerOptions { IgnoreNullValues = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, WriteIndented = true };
    //		//var b1 = JsonSerializer.SerializeToUtf8Bytes(v, k1);
    //		//APerf.Next();
    //		//File.WriteAllBytes(file, b1);
    //		//APerf.NW();

    //		100.ms();
    //		APerf.First();
    //		var b2 = File.ReadAllBytes(file);
    //		APerf.Next();
    //		var k2 = new JsonSerializerOptions { IgnoreNullValues = true };
    //		APerf.Next();
    //		v = JsonSerializer.Deserialize<JSettings>(b2, k2);
    //		APerf.NW('J');
    //	}

    //	for(int i = 0; i < 5; i++) {
    //		//100.ms();
    //		//APerf.First();
    //		//var r1 = new XElement("r");
    //		//r1.Add(new XElement("OneTwo", v.OneTwo));
    //		//r1.Add(new XElement("ThreeFour", v.ThreeFour.ToString()));
    //		//APerf.Next();
    //		//r1.Save(file2);
    //		//APerf.NW();

    //		100.ms();
    //		APerf.First();
    //		var r2 = XElement.Load(file2);
    //		APerf.Next();
    //		v = new JSettings();
    //		v.OneTwo = r2.Element("OneTwo").Value;
    //		var s2 = r2.Element("ThreeFour").Value;
    //		APerf.NW('X');
    //		v.ThreeFour = s2.ToInt();
    //	}

    //	AOutput.Write(v.OneTwo, v.ThreeFour, v.Five, v.Six, v.Seven, v.Eight);

    //	//JsonDocument d; d.RootElement.
    //}

    //[DllImport("CppE")]
    //static extern int Cpp_Install(int step, string dir);

    //[DllImport("CppE")]
    //static extern int Cpp_Uninstall();


    void TestMenu()
    {
        var m = new AMenu();

        m["One"] = o => AOutput.Write(o);
        m["Two"] = o => AOutput.Write(o);
        m.LazySubmenu("Submenu 1", _ => {
            AOutput.Write("adding items of " + m.CurrentAddMenu.OwnerItem);
            m["Three"] = o => AOutput.Write(o);
            m["Four"]  = o => AOutput.Write(o);
            m.LazySubmenu("Submenu 2", _ => {
                AOutput.Write("adding items of " + m.CurrentAddMenu.OwnerItem);
                m["Five"] = o => AOutput.Write(o);
                m["Six"]  = o => AOutput.Write(o);
            });
            m["Seven"] = o => AOutput.Write(o);
        });
        m["Eight"] = o => AOutput.Write(o);
        m.Show();
    }
Exemple #24
0
        public Form1()
        {
            InitializeComponent();

            menu1 = new HorizontalMenu <string>(panel1, new SizeF(50, 50));
            menu2 = new VerticalMenu <string>(panel2, new SizeF(50, 50));

            menu1.tabType = typeof(testTab <string>);

            menu1.tabChanged += onTabChange;
            menu2.tabChanged += onTabChange;

            for (int i = 0; i < 5; i++)
            {
                menu1.CreateTab("tab" + i, i.ToString());
                menu2.CreateTab(new VerticalTab <string>("tab" + i, i.ToString()));
            }

            menu1.ChangeTab(0);
            menu2.ChangeTab(0);
        }
Exemple #25
0
    void MouseTriggers()
    {
        //examples of mouse triggers

        Triggers.Mouse[TMClick.Right, "Ctrl+Shift", TMFlags.ButtonModUp] = o => AOutput.Write(o.Trigger); //Ctrl+Shift+RightClick
        Triggers.Mouse[TMEdge.RightInCenter50] = o => {                                                   //the right edge of the primary screen, center 50%
            var m = new AMenu("example");
            m["A"] = o => {  };
            m["B"] = o => {  };
            using (m.Submenu("C")) {
                m["D"] = o => {  };
                m["E"] = o => {  };
            }
            m.Show();

            //To create menus can be used snippet menuSnippet. Start typing "menu" and you will see snippets in the completion list.
        };
        Triggers.Mouse[TMMove.LeftRightInCenter50, screen : TMScreen.Any] = o => AWnd.SwitchActiveWindow(); //move the mouse quickly to the left and back in center 50% of any screen
        Triggers.Mouse[TMMove.RightLeftInCenter50, screen : TMScreen.Any] = o => AKeys.Key("Ctrl+Tab");     //to the right and back. Ctrl+Tab should switch the active document.

        Triggers.FuncOf.NextTrigger     = o => AKeys.IsScrollLock;                                          //example of a custom scope (aka context, condition)
        Triggers.Mouse[TMWheel.Forward] = o => AOutput.Write($"{o.Trigger} while ScrollLock is on");
    }
Exemple #26
0
    public void Run_EndTask()
    {
        var f = Program.Model.CurrentFile;

        if (f != null)
        {
            if (f.FindProject(out _, out var fMain))
            {
                f = fMain;
            }
            if (Program.Tasks.EndTasksOf(f))
            {
                return;
            }
        }
        var t = Program.Tasks.GetGreenTask(); if (t == null)
        {
            return;
        }
        var m = new AMenu();

        m["End task  " + t.f.DisplayName] = o => Program.Tasks.EndTask(t);
        m.Show(Program.MainForm);
    }
Exemple #27
0
 public void Initialize(Action _action, AMenu _menu, bool _closeOnClick)
 {
     action       = _action;
     menu         = _menu;
     closeOnClick = _closeOnClick;
 }
Exemple #28
0
    void _FillGrid()
    {
        var g = _grid;

        _role = _meta.role switch
        {
            "miniProgram" => ERole.miniProgram,
            "exeProgram" => ERole.exeProgram,
            "editorExtension" => ERole.editorExtension,
            "classLibrary" when _isClass => ERole.classLibrary,
            "classFile" when _isClass => ERole.classFile,
            _ => _isClass ? ERole.classFile : ERole.miniProgram,
        };
        var roles = _isClass ? "miniProgram|exeProgram|editorExtension|classLibrary|classFile" : "miniProgram|exeProgram|editorExtension";

        _AddCombo("role", roles, null,
                  @"<b>role</b> - purpose of this C# code file. What type of assembly to create and how to execute.
 • <i>miniProgram</i> - execute in a separate host process started from editor.
 • <i>exeProgram</i> - create/execute .exe file. It can run on any computer, without editor installed.
 • <i>editorExtension</i> - execute in the editor's UI thread. Dangerous, unstoppable. Rarely used.
 • <i>classLibrary</i> - create .dll file. It can be used as a reference assembly anywhere.
 • <i>classFile</i> - don't create/execute. Compile together with other C# code files in the project or using meta c. Inherits meta comment options of the main file of the compilation.

Default role for scripts is miniProgram; cannot be the last two. Default for class files is classFile.
",
                  noCheckbox: true, index: (int)_role);

        g.ZAddHeaderRow("Run");
        _AddEdit("testScript", _f.TestScript?.ItemPath,
                 @"<b>testScript</b> - a script to run when you click the Run button.
Can be path relative to this file (examples: Script5.cs, Folder\Script5.cs, ..\Folder\Script5.cs) or path in the workspace (examples: \Script5.cs, \Folder\Script5.cs).

Usually it is used to test this class file or class library. It can contain meta comment option <c green>c this file<> that adds this file to the compilation, or <c green>pr this file<> that adds the output dll file as a reference assembly. The recommended way to add this option correctly and easily is to try to run this file and click a link that is then printed in the output.

Unlike most other options, this option is saved not in meta comments. It is saved in file files.xml.
");
        _AddCombo("runMode", "green|blue", _meta.runMode,
                  @"<b>runMode</b> - whether tasks can run simultaneously, etc.
 • <i>green</i> (default) - multiple green tasks cannot run simultaneously.
 • <i>blue</i> - multiple blue tasks can run simultaneously (see ifRunning).

Green tasks change the tray icon and obey the ""End task"" hotkey; blue tasks don't.

This option is ignored when the task runs as .exe program started not from editor.
");
        _AddCombo("ifRunning", "warn|warn_restart|cancel|cancel_restart|wait|wait_restart|run|run_restart|restart", _meta.ifRunning,
                  @"<b>ifRunning</b> - when trying to start this script, what to do if it is already running.
 • <i>warn</i> (default) - write warning in output and don't run.
 • <i>cancel</i> - don't run.
 • <i>wait</i> - run later, when it ends.
 • <i>run</i> - run simultaneously. Requires runMode blue.
 • <i>restart</i> - end it and run.

Suffix _restart means: restart when clicked the Run button/menu; don't restart when using other ways to run the script.

This option is ignored when the task runs as .exe program started not from editor.
");
        _AddCombo("ifRunning2", "same|warn|cancel|wait", _meta.ifRunning2,
                  @"<b>ifRunning2</b> - when trying to start this green script, what to do if another green script is running.
 • <i>same</i> (default) - same as of ifRunning: cancel if cancel[_restart], wait if wait[_restart], else warn.
 • <i>warn</i> - write warning in output and don't run.
 • <i>cancel</i> - don't run.
 • <i>wait</i> - run later, when it ends.

This option is ignored when the task runs as .exe program started not from editor.
");
        _AddCombo("uac", "inherit|user|admin", _meta.uac,
                  @"<b>uac</b> - <help articles/UAC>UAC<> integrity level (IL) of the task process.
 • <i>inherit</i> (default) - the same as of the editor process. Normally High IL if installed on admin account, else Medium IL.
 • <i>user</i> - Medium IL, like most applications. The task cannot automate high IL process windows, write some files, change some settings, etc.
 • <i>admin</i> - High IL, aka ""administrator"", ""elevated"". The task has many rights, but cannot automate some apps through COM, etc.

This option is ignored when the task runs as .exe program started not from editor.
");
        _AddCombo("prefer32bit", "false|true", _meta.prefer32bit,
                  @"<b>prefer32bit</b> - whether the task process must be 32-bit everywhere.
 • <i>false</i> (default) - the process is 64-bit or 32-bit, the same as Windows on that computer.
 • <i>true</i> - the process is 32-bit on all computers.
");

        g.ZAddHeaderRow("Compile");
        _AddCombo("optimize", "false|true", _meta.optimize,
                  @"<b>optimize</b> - whether to make the compiled code as fast as possible.
 • <i>false</i> (default) - don't optimize. Define DEBUG and TRACE. This is known as ""Debug configuration"".
 • <i>true</i> - optimize. This is known as ""Release configuration"".

If true, low-level processing code is faster, but can be difficult to debug.
This option is also applied to class files compiled together. Use true if they contain code that must be as fast as possible. Not applied to used dlls.
");
        _AddEdit("define", _meta.define,
                 @"<b>define</b> - symbols that can be used with #if.
List separated by comma, semicolon or space. Example: TRACE,ETC
If no optimize true, DEBUG and TRACE are added implicitly.
These symbols also are visible in class files compiled together, but not in used dlls.
See also <google C# #define>#define<>.
");
        _AddCombo("warningLevel", "4|3|2|1|0", _meta.warningLevel,
                  @"<b>warningLevel</b> - how many warnings to show.
0 - no warnings.
1 - only severe warnings.
2 - level 1 warnings plus certain, less-severe warnings.
3 - most warnings.
4 (default) all warnings.

This option is also applied to class files compiled together.
 ");
        _AddEdit("noWarnings", _meta.noWarnings,
                 @"<b>noWarnings</b> - don't show these warnings.
List separated by comma, semicolon or space. Example: 151,3001,120

This option is also applied to class files compiled together.
See also <google C# #pragma warning>#pragma warning<>.
");
        _AddEdit("preBuild", _meta.preBuild,
                 @"<b>preBuild</b> - a script to run before compiling this code file.
Can be path relative to this file (examples: Script5.cs, Folder\Script5.cs, ..\Folder\Script5.cs) or path in the workspace (examples: \Script5.cs, \Folder\Script5.cs).

The script must have role editorExtension. It runs synchronously in compiler's thread. To stop compilation, let it throw an exception.
By default it receives full path of the output exe or dll file in args[0]. If need more info, specify command line arguments, like in this example: Script5.cs /$(outputPath) $(optimize). The script will receive real values in args[0], args[1] and so on. Variables:
 • $(outputFile) - full path of the output exe or dll file.
 • $(outputPath) - meta comment option 'outputPath'.
 • $(source) - path of this C# code file in the workspace.
 • $(role) - meta comment option 'role'.
 • $(optimize) - meta comment option 'optimize'.
 • $(prefer32bit) - meta comment option 'prefer32bit'.
");
        _AddEdit("postBuild", _meta.postBuild,
                 @"<b>postBuild</b> - a script to run after compiling this code file successfully.
Everything else is like with preBuild.
");

        g.ZAddHeaderRow("Assembly");
        _AddEdit("outputPath", _meta.outputPath,
                 @"<b>outputPath</b> - directory for the output assembly file and related files (used dlls, etc).
Full path. Can start with %environmentVariable% or %AFolders.SomeFolder%. Can be path relative to this file or workspace, like with other options. Default if role exeProgram: <link>%AFolders.Workspace%\bin<>. Default if role classLibrary: <link>%AFolders.ThisApp%\Libraries<>. The compiler creates the folder if does not exist.

If role exeProgram, the exe file is named like the script. The 32-bit version has suffix ""-32"". If optimize true, creates both 64-bit and 32-bit versions. Else creates only 32-bit if prefer32bit true or 32-bit OS, else only 64-bit.
If role classLibrary, the dll file is named like the class file. It can be used by 64-bit and 32-bit processes.
", noCheckbox: true, buttonAction: (sender, sed) => {
            var m = new AMenu();
            m[_role == ERole.classLibrary ? @"%AFolders.ThisApp%\Libraries" : @"%AFolders.Workspace%\bin"] = o => _SetEditCellText(o.ToString());
            m["Browse..."] = o => {
                var f = new FolderBrowserDialog {
                    SelectedPath = AFolders.ThisAppDocuments, ShowNewFolderButton = true
                };
                if (f.ShowDialog(this) == DialogResult.OK)
                {
                    _SetEditCellText(f.SelectedPath);
                }
                f.Dispose();
            };
            m.Show(sender as Control);
        });
        _AddCombo("console", "false|true", _meta.console,
                  @"<b>console</b> - let the program run with console.
");
        _AddEdit("icon", _meta.icon,
                 @"<b>icon</b> - icon of the output assembly file.
The file must be in this workspace. Can be path relative to this file (examples: App.ico, Folder\App.ico, ..\Folder\App.ico) or path in the workspace (examples: \App.ico, \Folder\App.ico).

The icon will be added as a native resource and displayed in File Explorer etc.
");
        _AddEdit("manifest", _meta.manifest,
                 @"<b>manifest</b> - <google manifest file site:microsoft.com>manifest<> of the output assembly file.
The file must be in this workspace. Can be path relative to this file (examples: App.manifest, Folder\App.manifest, ..\Folder\App.manifest) or path in the workspace (examples: \App.manifest, \Folder\App.manifest).

The manifest will be added as a native resource.
");
        _AddEdit("resFile", _meta.resFile,
                 @"<b>resFile</b> - .res file containing resources to add to the output assembly file as native resources.
The file must be in this workspace. Can be path relative to this file or path in the workspace.

.res files contain compiled native resources of any type, including icons and manifest.
This option is rarely used. Instead you use managed resources (button ""Resource..."").
");
        _AddEdit("xmlDoc", _meta.xmlDoc,
                 @"<b>xmlDoc</b> - XML documentation file to create from XML comments of classes, functions, etc.
If not full path, the compiler creates the XML file in the 'outputPath' folder.

The XML file can be used to create a help file, for example with <google>Sandcastle Help File Builder<>.
");
        _AddEdit("sign", _meta.sign,
                 @"<b>sign</b> - strong-name signing key file, to sign the output assembly.
The file must be in this workspace. Can be path relative to this file (examples: App.snk, Folder\App.snk, ..\Folder\App.snk) or path in the workspace (examples: \App.snk, \Folder\App.snk).
");

        _SelectRole();
        _SelectRunMode();

        g.ZAutoSize(false, true);         //and _SelectRole autosizes rows through ZShowRows

        g.ZValueChanged += _grid_ZValueChanged;

        void _AddCombo(string name, string values, string select, string info = null, bool noCheckbox = false, int index = -1)
        {
            var  a           = values.SegSplit("|");
            bool isSpecified = select != null;

            if (index < 0)
            {
                index = 0;
                if (isSpecified)
                {
                    isSpecified = false;
                    for (int i = 0; i < a.Length; i++)
                    {
                        if (a[i] == select)
                        {
                            index = i; isSpecified = true; break;
                        }
                    }
                }
            }
            g.ZAdd(null, name, values,
                   noCheckbox ? default(bool?) : isSpecified,
                   null, info,
                   etype: ParamGrid.EditType.ComboList,
                   comboIndex: index);
            if (info != null)
            {
                _infoDict.Add(name, info);
            }
        }

        void _AddEdit(string name, string text, string info = null, bool noCheckbox = false, EventHandler buttonAction = null)
        {
            g.ZAdd(null, name, text,
                   noCheckbox ? default(bool?) : text != null,
                   null, info,
                   etype: buttonAction != null ? ParamGrid.EditType.TextButton : ParamGrid.EditType.Text,
                   buttonAction: buttonAction);
            if (info != null)
            {
                _infoDict.Add(name, info);
            }
        }

        void _SetEditCellText(string s)
        {
            if (!_grid.ZGetEditCell(out var cc))
            {
                return;
            }
            int row = cc.Position.Row;

            _grid.ZSetCellText(row, 1, s);
            _grid.ZCheck(row, true);
        }
    }
Exemple #29
0
 public TextButton(AMenu cnt, String text, Vector2 p, MenuManager.HandlerAction h, Object data = null, float s = 0.6f)
     : base(cnt, text, p, h, data, s)
 {
 }
Exemple #30
0
 internal ZContextMenuEventArgs(object gPanel, AMenu cm) : base(gPanel)
 {
     menu = cm;
 }
Exemple #31
0
        /// <summary>
        /// Toolbar button MouseUp handler. Implements context menu that allows to customize.
        /// </summary>
        private void _OnMouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }
            var  item        = sender as ToolStripItem;
            var  ts          = item.Owner;
            var  dd          = ts as ToolStripDropDownMenu;
            bool isMenu      = dd != null;
            bool isCustom    = ts == _tsCustom1 || ts == _tsCustom2;
            bool isSeparator = item is ToolStripSeparator;
            bool isHidden    = item.Overflow == ToolStripItemOverflow.Always;
            var  x           = item.Tag as XElement;

            var m = new AMenu();

            m["Properties..."] = o => {
                using (var f = new FSMProperties(this, item.Tag as XElement, isMenu)) {
                    if (f.ShowDialog(_form) == DialogResult.OK)
                    {
                        _Strips_Customize(6, item, null, f);
                    }
                }
            };
            if (!isMenu)
            {
                if (!isSeparator)
                {
                    m["Hide"] = o => _Strips_Customize(5, item); if (isHidden)
                    {
                        m.LastMenuItem.Checked = true;
                    }
                }
                if (isCustom || isSeparator)
                {
                    m["Remove"] = o => _Strips_Customize(3, item);
                }
                if (!isHidden)
                {
                    m["Add separator"] = o => _Strips_Customize(4, item, ts);
                }
            }
            if (isCustom)
            {
                if (_tsCustom1 != null && _tsCustom2 != null)
                {
                    if (ts == _tsCustom1)
                    {
                        m["Move to toolbar Custom2"] = o => _Strips_Customize(2, item, _tsCustom2);
                    }
                    else
                    {
                        m["Move to toolbar Custom1"] = o => _Strips_Customize(2, item, _tsCustom1);
                    }
                }
            }
            else
            {
                if (_tsCustom1 != null)
                {
                    m["Copy to toolbar Custom1"] = o => _Strips_Customize(1, item, _tsCustom1);
                }
                if (_tsCustom2 != null)
                {
                    m["Copy to toolbar Custom2"] = o => _Strips_Customize(1, item, _tsCustom2);
                }
            }
            if (!isMenu)
            {
                m.Separator();
                m["How to customize..."] = o => ADialog.ShowInfo("Customizing toolbars and menus",
                                                                 @"There are several standard toolbars and two custom toolbars (initially empty). Standard toolbar buttons cannot be added and removed, but can be hidden and reordered. Menu items cannot be added, removed, hidden and reordered.

You can find most customization options in two context menus. Right-clicking a button or menu item shows its context menu. Right-clicking before the first button shows toolbar's context menu. You can Alt+drag toolbar buttons to reorder them on the same toolbar. You can Alt+drag toolbars to dock them somewhere else. Use splitters to resize. Right click a splitter to change its thickness."
                                                                 );
                string folder = APath.GetDirectoryPath(_xmlFileCustom), link = $"<a href=\"{folder}\">{folder}</a>";
                m["How to backup, restore, reset..."] = o => {
                    ADialog.Show("How to backup, restore or reset customizations",
                                 $@"All customizations are saved in XML files in folder
{link}

To backup:  copy the file.
To restore:  exit this application and replace the file with the backup file.
To reset:  exit this application and delete the file."
                                 , icon: DIcon.Info, onLinkClick: h => { AExec.Run(h.LinkHref); });
                };
            }

            m.Show(ts);
        }
Exemple #32
0
    //void TestMenu2()
    //{
    //	var m = new AMenu();
    //	m["One"] = o => AOutput.Write(o);
    //	m["Two"] = o => AOutput.Write(o);
    //	m.LazySubmenu("Submenu 1").Fill = _ => {
    //		AOutput.Write("adding items of " + m.CurrentAddMenu.OwnerItem);
    //		m["Three"] = o => AOutput.Write(o);
    //		m["Four"] = o => AOutput.Write(o);
    //		m.LazySubmenu("Submenu 2", _ => {
    //			AOutput.Write("adding items of " + m.CurrentAddMenu.OwnerItem);
    //			m["Five"] = o => AOutput.Write(o);
    //			m["Six"] = o => AOutput.Write(o);
    //		});
    //		m["Seven"] = o => AOutput.Write(o);
    //	};
    //	m["Eight"] = o => AOutput.Write(o);
    //	m.Show();

    //}

    //void TestMenu2()
    //{
    //	var m = new AMenu();
    //	m["One"] = o => AOutput.Write(o);
    //	m["Two"] = o => AOutput.Write(o);
    //	m.LazySubmenu("Submenu 1");
    //	m.LazyFill = _ => {
    //		AOutput.Write("adding items of " + m.CurrentAddMenu.OwnerItem);
    //		m["Three"] = o => AOutput.Write(o);
    //		m["Four"] = o => AOutput.Write(o);
    //		m.LazySubmenu("Submenu 2", _ => {
    //			AOutput.Write("adding items of " + m.CurrentAddMenu.OwnerItem);
    //			m["Five"] = o => AOutput.Write(o);
    //			m["Six"] = o => AOutput.Write(o);
    //		});
    //		m["Seven"] = o => AOutput.Write(o);
    //	};
    //	m["Eight"] = o => AOutput.Write(o);
    //	m.Show();

    //}

#if false
    void TestToolbar()
    {
        for (int i = 0; i < 1; i++)
        {
            var t = new AToolbar("123");
            //t.NoText = true;
            //t.Border= TBBorder.Sizable3;t.Control.Text = "Toolbar";
            //t.Border = TBBorder.SizableWithCaptionX;

            //t["Find", @"Q:\app\find.ico"] = o => AOutput.Write(o);
            //t["Copy", @"Q:\app\copy.ico"] = o => AOutput.Write(o);
            //t.Separator("Tpi group");
            //t["Delete", @"Q:\app\delete.ico"] = o => AOutput.Write(o);
            //t["No image"] = o => AOutput.Write(o);
            //t["TT", tooltip: "WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW WWWWWWWWWWWW "] = o => AOutput.Write(o);
            ////t.LastButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
            ////t.LastButton.AutoToolTip = false;
            ////t.LastButton.ToolTipText = "ggg";
            //t.Separator();
            //t["Run", @"Q:\app\run.ico"] = o => AOutput.Write(o);
            //t.Separator("");
            //t["Paste text", @"Q:\app\paste.ico"] = o => AOutput.Write(o);
            //t.LastButton.ToolTipText = "Toooooltip";

            //t.ExtractIconPathFromCode = true;
            //t["Auto icon"] = o => AOutput.Write("notepad.exe");
            //t["Failed icon", @"Q:\app\-.ico"] = o => AOutput.Write(o);
            ////t.LastButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            ////t.Separator("");
            ////t.Add(new ToolStripTextBox { ToolTipText= "ToolStripTextBox", AutoSize=false, Width=50 });
            ////t.Add(new ToolStripComboBox { ToolTipText= "ToolStripComboBox", AutoSize=false, Width=50 });
            ////t.Add(new ToolStripTextBox());
            ////t.Add(new ToolStripTextBox());
            ////t.Add(new ToolStripTextBox());
            ////t.Add(new ToolStripButton("aaa"));
            ////t.Add(new ToolStripButton("bbb"));
            ////t["Multi\r\nline"] = o => AOutput.Write(o);

            //t["None"] = o => _B(TBBorder.None);
            //t["SWC"] = o => _B(TBBorder.SizableWithCaption);
            //t["Sizable1"] = o => _B(TBBorder.Sizable1);
            //t["Sizable2"] = o => _B(TBBorder.Sizable2);
            //t["Sizable3"] = o => _B(TBBorder.Sizable3);
            //t["Sizable3D"] = o => _B(TBBorder.Sizable3D);
            //t["Sizable"] = o => _B(TBBorder.Sizable);
            //t["FixedWithCaption"] = o => _B(TBBorder.FixedWithCaption);
            //t["SizableWithCaption"] = o => _B(TBBorder.SizableWithCaption);
            //t["Close"] = o => t.Close();

#if false
            var dd = new ToolStripDropDownButton("DD");
            t.Add(dd, @"Q:\app\find.ico");
            dd.DropDownOpening += (unu, sed) => {
                var m = new AMenu(dd);
                m["one"] = o => AOutput.Write(o);
                using (m.Submenu("Sub")) {
                    m["si"] = o => AOutput.Write(o);
                }
            };
            var sb = new ToolStripSplitButton("SB");
            t.Add(sb, @"Q:\app\copy.ico", o => AOutput.Write(o));
#elif true
            //t.Control.Font = new Font("Courier New", 16);
            //t.Control.RightToLeft = RightToLeft.Yes;
            t.MenuButton("DD", m => {
                AOutput.Write("dd");
                //m.MultiShow = false;
                m["one"] = o => AOutput.Write(o);
                using (m.Submenu("Sub")) {
                    m["si"] = o => AOutput.Write(o);
                }
            }, @"Q:\app\find.ico", "MenuButton");
            t.SplitButton("SB", m => {
                m["one"] = o => AOutput.Write(o);
                //var sb = m.Control.OwnerItem as ToolStripSplitButton;
                //AOutput.Write(sb);
                //sb.DefaultItem = m.LastItem;
                using (m.Submenu("Sub")) {
                    m["si"] = o => AOutput.Write(o);
                }
            }, @"Q:\app\copy.ico", "SplitButton", o => AOutput.Write(o));
            t.Separator("");
            t[true, "DD2", @"Q:\app\delete.ico"] = m => {
                AOutput.Write("create menu");
                //m.MultiShow = false;
                m["one"] = o => AOutput.Write(o);
                using (m.Submenu("Sub")) {
                    m["si"] = o => AOutput.Write(o);
                }
            };
            //t.SplitButton("SB", o => {
            //	AOutput.Write(o);
            //}, m => {
            //	m["one"] = o => AOutput.Write(o);
            //	using(m.Submenu("Sub")) {
            //		m["si"] = o => AOutput.Write(o);
            //	}
            //}, @"Q:\app\copy.ico", "SplitButton");
            //Action<AMenu> menu1 = m => {
            //	m["one"] = o => AOutput.Write(o);
            //	using(m.Submenu("Sub")) {
            //		m["si"] = o => AOutput.Write(o);
            //	}
            //};
            //t.MenuButton("DD", menu1, @"Q:\app\find.ico", "MenuButton");
#elif false
            t.MenuButton("DD", @"Q:\app\find.ico");
            t.Menu = m => {
                m["one"] = o => AOutput.Write(o);
                using (m.Submenu("Sub")) {
                    m["si"] = o => AOutput.Write(o);
                }
            };
#else
            t.MenuButton("DD", @"Q:\app\find.ico").Menu = m => {
                AOutput.Write("dd");
                //m.MultiShow = false;
                m["one"] = o => AOutput.Write(o);
                using (m.Submenu("Sub")) {
                    m["two"] = o => AOutput.Write(o);
                }
            };
            t.SplitButton("SB", o => AOutput.Write(o), @"Q:\app\copy.ico").Menu = m => {
                AOutput.Write("dd");
                m["one"] = o => AOutput.Write(o);
                using (m.Submenu("Sub")) {
                    m["two"] = o => AOutput.Write(o);
                }
            };
#endif
            //t.Separator("");
            ////t["GC"] = o => GC.Collect();

            //var dd = new ToolStripSplitButton("SB2", null, (unu,sed)=>AOutput.Write("click"));
            //t.Add(dd, @"Q:\app\delete.ico");
            //dd.DropDownOpening += (unu, sed) => {
            //	var m = new AMenu();
            //	dd.DropDown = m.Control;
            //	m["one"] = o => AOutput.Write(o);
            //};
            //dd.ButtonClick += (unu, sed) => AOutput.Write("button click");
            //dd.DoubleClickEnabled = true;
            //dd.ButtonDoubleClick += (unu, sed) => AOutput.Write("button double click");

            //ATimer.After(3000, _ => {
            //	var c = t.Control.Items[0];
            //	c.Select();
            //});

            //void _B(TBBorder b){
            //	t.Border = b;
            //	//AOutput.Write(AWnd.More.BorderWidth((AWnd)t.Control));
            //}

            //t.Bounds = new Rectangle(i * 300 + 700, 200, 200, 200);
            t.Show();
            //t.Window.ActivateLL();
            ATime.SleepDoEvents(200);

            //for(int j = 1; j <= (int)TBBorder.SizableWithCaptionX; j++) {
            //	ATime.SleepDoEvents(1000);
            //	t.Border = (TBBorder)j;
            //}

            //ATime.SleepDoEvents(1000);
            //t.Border = TBBorder.FixedWithCaption;
            //ATime.SleepDoEvents(3000);
            //t.Border = TBBorder.SizableWithCaption;

            //var m = new AMenu();
            //using(m.Submenu("Sub")) {

            //}
            //m.Show()
        }

        //var c = new System.Windows.Forms.VisualStyles.VisualStyleRenderer(VisualStyleElement.Window.FrameLeft.Inactive).GetColor(ColorProperty.BorderColor);
        //AOutput.Write((uint)c.ToArgb());

        //ATimer.After(500, _ => {
        //	var w = (AWnd)t.Control;
        //	//w.SetStyle(WS.DLGFRAME, SetAddRemove.Add);
        //});

        ADialog.Options.TopmostIfNoOwnerWindow = true;
        ADialog.Show();

        //ATimer.After(10000, _ => Application.Exit());
        //Application.Run();
    }
Exemple #33
0
            internal void ShowContextMenu(Point p)
            {
                var  gp    = this as _Panel;
                bool isTab = this is _Tab gt;
                var  state = this.DockState;
                var  m     = new AMenu();

                m.Control.Text = "Menu";

                //dock state
                m.Add("Float\tD-click, drag", o => this.SetDockState(_DockState.Floating)).Enabled      = state != _DockState.Floating;
                m.Add("Dock    \tD-click, Alt+drag", o => this.SetDockState(_DockState.Docked)).Enabled = state != _DockState.Docked;
                //menu.Add("Auto Hide", o => this.SetDockState(_DockState.AutoHide)).Enabled = state != _DockState.AutoHide && !isTab; //not implemented
                m["Hide\tM-click"] = o => this.SetDockState(_DockState.Hidden);

                m.Separator();
                using (m.Submenu("Show Panel")) _manager.ZAddShowPanelsToMenu(m.LastMenuItem.DropDown, false);
                using (m.Submenu("Show Toolbar")) _manager.ZAddShowPanelsToMenu(m.LastMenuItem.DropDown, true);

                m.Separator();
                var k = (!this.IsTabbedPanel || this.IsFloating) ? this : gp.ParentTab;

                //caption edge
                using (m.Submenu("Caption At")) {
                    m["Top"] = o => k._SetCaptionEdge(CaptionEdge.Top); if (k.CaptionAt == CaptionEdge.Top)
                    {
                        m.LastMenuItem.Checked = true;
                    }
                    m["Bottom"] = o => k._SetCaptionEdge(CaptionEdge.Bottom); if (k.CaptionAt == CaptionEdge.Bottom)
                    {
                        m.LastMenuItem.Checked = true;
                    }
                    m["Left"] = o => k._SetCaptionEdge(CaptionEdge.Left); if (k.CaptionAt == CaptionEdge.Left)
                    {
                        m.LastMenuItem.Checked = true;
                    }
                    m["Right"] = o => k._SetCaptionEdge(CaptionEdge.Right); if (k.CaptionAt == CaptionEdge.Right)
                    {
                        m.LastMenuItem.Checked = true;
                    }
                }
                //fixed width/height
                if (this.IsDockedOn(_manager))
                {
                    _AddFixedSize(k.ParentSplit, k);
                    void _AddFixedSize(_Split gs, _Node gn)
                    {
                        if (gs.IsSplitterVisible)
                        {
                            bool fixedSize = gs.IsChildFixedSize(gn);
                            m.Add(gs.IsVerticalSplit ? "Fixed Width" : "Fixed Height", o => gs.SetChildFixedSize(gn, !fixedSize)).Checked = fixedSize;
                        }
                        var gs2 = gs.ParentSplit;

                        if (gs2 != null)
                        {
                            using (m.Submenu("Container")) {
                                m.LastMenuItem.DropDown.Opened += (unu, sed) => {
                                    var osd = new AOsdRect {
                                        Rect = _manager.RectangleToScreen(gs.Bounds), Color = 0x00c000
                                    };
                                    osd.Show();
                                    ATimer.After(1000, _ => osd.Dispose());
                                };
                                _AddFixedSize(gs2, gs);
                            }
                        }
                    }
                }

                //test
                //m.Separator();
                //m["test"] = o =>
                //{
                //};

                //custom
                _manager.ZPanelContextMenu?.Invoke(new ZContextMenuEventArgs(gp, m));

                m.Show(this.ParentControl, p.X, p.Y);
            }