Exemple #1
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Save == null)
            {
                items.Save = new SetItem()
                {
                    Text  = "Export .clixml...",
                    Click = delegate { SaveData(); }
                }
            }
            ;

            base.HelpMenuInitItems(items, e);
        }

        /// <summary>
        /// Files data.
        /// </summary>
        IList <object> CollectData()
        {
            var Files = Explorer.Cache;
            var r     = new List <object>();

            r.Capacity = Files.Count;
            foreach (FarFile f in Files)
            {
                if (f.Data != null)
                {
                    r.Add(f.Data);
                }
            }
            return(r);
        }
    }
Exemple #2
0
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.ApplyCommand == null)
            {
                items.ApplyCommand = new SetItem()
                {
                    Text  = Res.UIApply,
                    Click = delegate { UIApply(); }
                };
            }

            base.HelpMenuInitItems(items, e);
        }
Exemple #3
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Save == null && (AsSaveData != null || Parent != null && (Parent is DataPanel)))
            {
                items.Save = new SetItem()
                {
                    Text  = "Save data",
                    Click = delegate { SaveData(); }
                }
            }
            ;

            base.HelpMenuInitItems(items, e);
        }
Exemple #4
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Copy == null)
                items.Copy = new SetItem()
                {
                    Text = "&Copy property(s)",
                    Click = delegate { UICopyMove(false); }
                };

            if (items.CopyHere == null && Explorer.CanCloneFile)
                items.CopyHere = new SetItem()
                {
                    Text = "Copy &here",
                    Click = delegate { UIClone(); }
                };

            if (items.Move == null)
                items.Move = new SetItem()
                {
                    Text = "&Move property(s)",
                    Click = delegate { UICopyMove(true); }
                };

            if (items.Rename == null && e.CurrentFile != null && Explorer.CanRenameFile)
                items.Rename = new SetItem()
                {
                    Text = "&Rename property",
                    Click = delegate { UIRename(); }
                };

            if (items.Create == null && Explorer.CanCreateFile)
                items.Create = new SetItem()
                {
                    Text = "&New property",
                    Click = delegate { UICreate(); }
                };

            if (items.Delete == null && Explorer.CanDeleteFiles)
                items.Delete = new SetItem()
                {
                    Text = "&Delete property(s)",
                    Click = delegate { UIDelete(false); }
                };

            base.HelpMenuInitItems(items, e);
        }
Exemple #5
0
        /// <summary>
        /// Derived should add its items, then call base.
        /// </summary>
        internal virtual void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Exit == null)
            {
                items.Exit = new SetItem()
                {
                    Text  = "E&xit panel",
                    Click = delegate { Close(); }
                }
            }
            ;

            if (items.Help == null)
            {
                items.Help = new SetItem()
                {
                    Text  = "Help (F1)",
                    Click = delegate { ShowHelpForPanel(); }
                }
            }
            ;
        }
Exemple #6
0
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            e.Menu.Add("Sort").Click = delegate { OnSort(); };

            e.Menu.Add("Filter").Click = delegate { OnFilter(); };

            e.Menu.Add(string.Empty).IsSeparator = true;

            if (Adapter != null)
            {
                e.Menu.Add("Page limit").Click = delegate { OnPageLimit(); };

                e.Menu.Add("Page offset").Click = delegate { OnPageOffset(); };

                e.Menu.Add(string.Empty).IsSeparator = true;
            }

            if (items.Create == null)
            {
                items.Create = new SetItem()
                {
                    Text  = "&New row",
                    Click = delegate { UICreate(); }
                }
            }
            ;

            if (items.Delete == null)
            {
                items.Delete = new SetItem()
                {
                    Text  = "&Delete row(s)",
                    Click = delegate { UIDelete(false); }
                }
            }
            ;

            base.HelpMenuInitItems(items, e);
        }
Exemple #7
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.OpenFileMembers == null)
            {
                items.OpenFileMembers = new SetItem()
                {
                    Text = HelpMenuTextOpenFileMembers,
                    Click = delegate { UIOpenFileMembers(); }
                };
            }

            if (items.ApplyCommand == null)
            {
                items.ApplyCommand = new SetItem()
                {
                    Text = Res.UIApply,
                    Click = delegate { UIApply(); }
                };
            }

            base.HelpMenuInitItems(items, e);
        }
Exemple #8
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.OpenFileAttributes == null && UIAttributesCan())
                items.OpenFileAttributes = new SetItem()
                {
                    Text = "Item &properties",
                    Click = delegate { UIAttributes(); }
                };

            if (items.OpenFile == null)
                items.OpenFile = new SetItem()
                {
                    Text = "Child items",
                    Click = delegate { UIOpenFile(CurrentFile); }
                };

            if (items.Copy == null && UICopyMoveCan(false))
                items.Copy = new SetItem()
                {
                    Text = "&Copy item(s)",
                    Click = delegate { UICopyMove(false); }
                };

            if (items.CopyHere == null && e.CurrentFile != null)
                items.CopyHere = new SetItem()
                {
                    Text = "Copy &here",
                    Click = delegate { UIClone(); }
                };

            if (items.Move == null && UICopyMoveCan(true))
                items.Move = new SetItem()
                {
                    Text = "&Move item(s)",
                    Click = delegate { UICopyMove(true); }
                };

            if (items.Rename == null && e.CurrentFile != null && Explorer.CanRenameFile)
                items.Rename = new SetItem()
                {
                    Text = "&Rename item",
                    Click = delegate { UIRename(); }
                };

            if (items.Create == null)
                items.Create = new SetItem()
                {
                    Text = "&New item",
                    Click = delegate { UICreate(); }
                };

            if (items.Delete == null)
                items.Delete = new SetItem()
                {
                    Text = "&Delete item(s)",
                    Click = delegate { UIDelete(false); }
                };

            base.HelpMenuInitItems(items, e);
        }
Exemple #9
0
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            e.Menu.Add("Sort").Click = delegate { OnSort(); };

            e.Menu.Add("Filter").Click = delegate { OnFilter(); };

            e.Menu.Add(string.Empty).IsSeparator = true;

            if (Adapter != null)
            {
                e.Menu.Add("Page limit").Click = delegate { OnPageLimit(); };

                e.Menu.Add("Page offset").Click = delegate { OnPageOffset(); };

                e.Menu.Add(string.Empty).IsSeparator = true;
            }

            if (items.Create == null)
                items.Create = new SetItem()
                {
                    Text = "&New row",
                    Click = delegate { UICreate(); }
                };

            if (items.Delete == null)
                items.Delete = new SetItem()
                {
                    Text = "&Delete row(s)",
                    Click = delegate { UIDelete(false); }
                };

            base.HelpMenuInitItems(items, e);
        }
Exemple #10
0
        /// <summary>
        /// Creates or gets existing menu.
        /// </summary>
        IMenu HelpMenuCreate()
        {
            // create
            IMenu r = Far.Api.CreateMenu();

            r.AutoAssignHotkeys = true;
            r.Sender            = this;
            r.Title             = "Help menu";
            r.AddKey(KeyCode.F1);

            // args
            PanelMenuEventArgs e = new PanelMenuEventArgs(r, CurrentFile, SelectedList);

            // event
            if (MenuCreating != null)
            {
                MenuCreating(this, e);
            }

            // init items
            HelpMenuItems items = new HelpMenuItems();

            HelpMenuInitItems(items, e);

            // add main items
            if (items.OpenFile != null)
            {
                r.Items.Add(items.OpenFile);
            }
            if (items.OpenFileMembers != null)
            {
                r.Items.Add(items.OpenFileMembers);
            }
            if (items.OpenFileAttributes != null)
            {
                r.Items.Add(items.OpenFileAttributes);
            }
            if (items.ApplyCommand != null)
            {
                r.Items.Add(items.ApplyCommand);
            }
            if (items.Copy != null)
            {
                r.Items.Add(items.Copy);
            }
            if (items.CopyHere != null)
            {
                r.Items.Add(items.CopyHere);
            }
            if (items.Move != null)
            {
                r.Items.Add(items.Move);
            }
            if (items.Rename != null)
            {
                r.Items.Add(items.Rename);
            }
            if (items.Create != null)
            {
                r.Items.Add(items.Create);
            }
            if (items.Delete != null)
            {
                r.Items.Add(items.Delete);
            }
            if (items.Save != null)
            {
                r.Items.Add(items.Save);
            }
            if (items.Exit != null)
            {
                r.Items.Add(items.Exit);
            }
            if (items.Help != null)
            {
                r.Items.Add(items.Help);
            }

            return(r);
        }
Exemple #11
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.OpenFileAttributes == null && UIAttributesCan())
            {
                items.OpenFileAttributes = new SetItem()
                {
                    Text  = "Item &properties",
                    Click = delegate { UIAttributes(); }
                }
            }
            ;

            if (items.OpenFile == null)
            {
                items.OpenFile = new SetItem()
                {
                    Text  = "Child items",
                    Click = delegate { UIOpenFile(CurrentFile); }
                }
            }
            ;

            if (items.Copy == null && UICopyMoveCan(false))
            {
                items.Copy = new SetItem()
                {
                    Text  = "&Copy item(s)",
                    Click = delegate { UICopyMove(false); }
                }
            }
            ;

            if (items.CopyHere == null && e.CurrentFile != null)
            {
                items.CopyHere = new SetItem()
                {
                    Text  = "Copy &here",
                    Click = delegate { UIClone(); }
                }
            }
            ;

            if (items.Move == null && UICopyMoveCan(true))
            {
                items.Move = new SetItem()
                {
                    Text  = "&Move item(s)",
                    Click = delegate { UICopyMove(true); }
                }
            }
            ;

            if (items.Rename == null && e.CurrentFile != null && Explorer.CanRenameFile)
            {
                items.Rename = new SetItem()
                {
                    Text  = "&Rename item",
                    Click = delegate { UIRename(); }
                }
            }
            ;

            if (items.Create == null)
            {
                items.Create = new SetItem()
                {
                    Text  = "&New item",
                    Click = delegate { UICreate(); }
                }
            }
            ;

            if (items.Delete == null)
            {
                items.Delete = new SetItem()
                {
                    Text  = "&Delete item(s)",
                    Click = delegate { UIDelete(false); }
                }
            }
            ;

            base.HelpMenuInitItems(items, e);
        }
Exemple #12
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Copy == null)
            {
                items.Copy = new SetItem()
                {
                    Text  = "&Copy property(s)",
                    Click = delegate { UICopyMove(false); }
                }
            }
            ;

            if (items.CopyHere == null && Explorer.CanCloneFile)
            {
                items.CopyHere = new SetItem()
                {
                    Text  = "Copy &here",
                    Click = delegate { UIClone(); }
                }
            }
            ;

            if (items.Move == null)
            {
                items.Move = new SetItem()
                {
                    Text  = "&Move property(s)",
                    Click = delegate { UICopyMove(true); }
                }
            }
            ;

            if (items.Rename == null && e.CurrentFile != null && Explorer.CanRenameFile)
            {
                items.Rename = new SetItem()
                {
                    Text  = "&Rename property",
                    Click = delegate { UIRename(); }
                }
            }
            ;

            if (items.Create == null && Explorer.CanCreateFile)
            {
                items.Create = new SetItem()
                {
                    Text  = "&New property",
                    Click = delegate { UICreate(); }
                }
            }
            ;

            if (items.Delete == null && Explorer.CanDeleteFiles)
            {
                items.Delete = new SetItem()
                {
                    Text  = "&Delete property(s)",
                    Click = delegate { UIDelete(false); }
                }
            }
            ;

            base.HelpMenuInitItems(items, e);
        }
Exemple #13
0
        ///
        internal override void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Save == null && (AsSaveData != null || Parent != null && (Parent is DataPanel)))
                items.Save = new SetItem()
                {
                    Text = "Save data",
                    Click = delegate { SaveData(); }
                };

            base.HelpMenuInitItems(items, e);
        }
Exemple #14
0
        /// <summary>
        /// Creates or gets existing menu.
        /// </summary>
        IMenu HelpMenuCreate()
        {
            // create
            IMenu r = Far.Api.CreateMenu();
            r.AutoAssignHotkeys = true;
            r.Sender = this;
            r.Title = "Help menu";
            r.AddKey(KeyCode.F1);

            // args
            PanelMenuEventArgs e = new PanelMenuEventArgs(r, CurrentFile, SelectedList);

            // event
            if (MenuCreating != null)
                MenuCreating(this, e);

            // init items
            HelpMenuItems items = new HelpMenuItems();
            HelpMenuInitItems(items, e);

            // add main items
            if (items.OpenFile != null) r.Items.Add(items.OpenFile);
            if (items.OpenFileMembers != null) r.Items.Add(items.OpenFileMembers);
            if (items.OpenFileAttributes != null) r.Items.Add(items.OpenFileAttributes);
            if (items.ApplyCommand != null) r.Items.Add(items.ApplyCommand);
            if (items.Copy != null) r.Items.Add(items.Copy);
            if (items.CopyHere != null) r.Items.Add(items.CopyHere);
            if (items.Move != null) r.Items.Add(items.Move);
            if (items.Rename != null) r.Items.Add(items.Rename);
            if (items.Create != null) r.Items.Add(items.Create);
            if (items.Delete != null) r.Items.Add(items.Delete);
            if (items.Save != null) r.Items.Add(items.Save);
            if (items.Exit != null) r.Items.Add(items.Exit);
            if (items.Help != null) r.Items.Add(items.Help);

            return r;
        }
Exemple #15
0
        /// <summary>
        /// Derived should add its items, then call base.
        /// </summary>
        internal virtual void HelpMenuInitItems(HelpMenuItems items, PanelMenuEventArgs e)
        {
            if (items.Exit == null)
                items.Exit = new SetItem()
                {
                    Text = "E&xit panel",
                    Click = delegate { Close(); }
                };

            if (items.Help == null)
                items.Help = new SetItem()
                {
                    Text = "Help (F1)",
                    Click = delegate { ShowHelpForPanel(); }
                };
        }