コード例 #1
0
ファイル: MainForm.Menu.cs プロジェクト: rizwan3d/elalang
 private void BuildHelpList(IMenuBuilder<MenuStrip> builder)
 {
     var svc = App.GetService<IViewService>();
     svc.EnumerateInfos("views")
         .OfType<ViewInfo>()
         .Where(v => v.ViewType == ViewType.Help)
         .ForEach(v => builder.Item(v.Title, v.Shortcut, () => { if (svc.IsViewActive(v.Key)) svc.CloseView(v.Key); else svc.OpenView(v.Key); },
             null, () => svc.IsViewActive(v.Key)));
 }
コード例 #2
0
ファイル: MainForm.Menu.cs プロジェクト: hardliner66/ela-lang
        private void BuildWindowList(IMenuBuilder <MenuStrip> builder)
        {
            var srv = App.GetService <IDocumentService>();
            var seq = srv.EnumerateDocuments().Take(10).ToList();

            for (var i = 0; i < seq.Count; i++)
            {
                var doc = seq[i];
                builder.Item("&" + (i + 1) + ". " + seq[i], () => srv.SetActiveDocument(doc));
            }
        }
コード例 #3
0
 protected virtual ContextMenuStrip BuildMenu(IMenuBuilder <ContextMenuStrip> builder)
 {
     return(builder
            .Item("Cut", "Ctrl+X", Cut, sci.HasSelections)
            .Item("Copy", "Ctrl+C", sci.Copy, sci.HasSelections)
            .Item("Paste", "Ctrl+V", Paste, sci.CanPaste)
            .Separator()
            .Item("Clear All", SmartClear, () => sci.GetTextLength() > lastLen)
            .Item("Clear History", () => history.Clear(), () => history.Size > 0)
            .Separator()
            .Item("Search", "Ctrl+F", Search, () => sci.GetTextLength() > 0)
            .Finish());
 }
コード例 #4
0
ファイル: MainForm.Menu.cs プロジェクト: hardliner66/ela-lang
        private void BuildRecentList(IMenuBuilder <MenuStrip> builder)
        {
            var con      = App.Config <WorkbenchConfig>();
            var recFiles = con.RecentFiles;

            if (recFiles == null || recFiles.Count == 0)
            {
                builder.Item("[None]", null, () => false);
            }
            else
            {
                var count = 0;

                foreach (var fls in new List <String>(recFiles))
                {
                    count++;
                    builder.Item("&" + count + ". " + fls, () =>
                    {
                        var fi = new FileInfo(fls);

                        if (!fi.Exists)
                        {
                            if (App.GetService <IDialogService>().ShowWarningDialog(
                                    "File '{0}' doesn't exist. Do you want to remove it from the recently used list?", fi.FullName))
                            {
                                recFiles.Remove(fls);
                            }
                        }
                        else
                        {
                            App.GetService <IFileService>().OpenFile(fi);
                        }
                    });
                }
            }
        }
コード例 #5
0
ファイル: MainForm.Menu.cs プロジェクト: hardliner66/ela-lang
        private void BuildHelpList(IMenuBuilder <MenuStrip> builder)
        {
            var svc = App.GetService <IViewService>();

            svc.EnumerateInfos("views")
            .OfType <ViewInfo>()
            .Where(v => v.ViewType == ViewType.Help)
            .ForEach(v => builder.Item(v.Title, v.Shortcut, () => { if (svc.IsViewActive(v.Key))
                                                                    {
                                                                        svc.CloseView(v.Key);
                                                                    }
                                                                    else
                                                                    {
                                                                        svc.OpenView(v.Key);
                                                                    } },
                                       null, () => svc.IsViewActive(v.Key)));
        }
コード例 #6
0
ファイル: InteractiveTextBox.cs プロジェクト: ngoffee/ela
        protected override ContextMenuStrip BuildMenu(IMenuBuilder <ContextMenuStrip> builder)
        {
            var sci = GetScintilla();

            return(builder
                   .Item("Cut", "Ctrl+X", Cut, sci.HasSelections)
                   .Item("Copy", "Ctrl+C", sci.Copy, sci.HasSelections)
                   .Item("Paste", "Ctrl+V", Paste, sci.CanPaste)
                   .Separator()
                   .Item("Clear All", ClearAll, () => sci.GetTextLength() > GetLastLength())
                   .Separator()
                   .Item("Stop Execution", StopExecution, () => execThread != null && execThread.IsAlive)
                   .Item("Reset Session", ResetSession)
                   .Separator()
                   .Item("Search", "Ctrl+F", Search, () => sci.GetTextLength() > 0)
                   .Finish());
        }
コード例 #7
0
ファイル: ElaEditor.cs プロジェクト: ngoffee/ela
        protected override void BuildAuxContextMenu(IMenuBuilder <ContextMenuStrip> builder)
        {
            var sci = GetScintilla();

            builder
            .Item("Run", "F5", ElaFuns.Run, () => sci.GetTextLength() > 0)
            .Item("Eval Selected", "Ctrl+F5", ElaFuns.RunSelected)
            .Item("Send Selection to Interactive", "Ctrl+F6", ElaFuns.EvaluateSelected)
            .Item("Send Current Module to Interactive", "Ctrl+F7", ElaFuns.EvaluateCurrentModule)
            .Item("Generate AST from Selection", ElaFuns.GenerateAst)
            .Separator()
            .Item("Find Symbol", "Alt+F12", ElaFuns.FindSymbol, () => sci.GetTextLength() > 0)
            .Item("Autocomplete", "Ctrl+Space", ElaFuns.Autocomplete)
            .Menu("Outlining")
            .Item("Toggle Outlining Expansion", "Ctrl+M", () => sci.ToggleFold(sci.CurrentLine))
            .Item("Collapse to Definitions", sci.CollapseAllFold)
            .Item("Expand All Code", "Ctrl+Shift+M", sci.ExpandAllFold)
            .CloseMenu()
            .Separator();
        }
コード例 #8
0
ファイル: MainForm.Menu.cs プロジェクト: hardliner66/ela-lang
 private void BuildEditorList(IMenuBuilder <MenuStrip> builder)
 {
     App.GetService <IEditorService>().EnumerateInfos("editors").OfType <EditorInfo>()
     .Where(e => !e.Flags.Set(EditorFlags.Main) && !e.Flags.Set(EditorFlags.Hidden))
     .ForEach(e => builder.Item(e.DisplayName, () => App.GetService <IFileService>().NewFile(e.Key)));
 }
コード例 #9
0
ファイル: MainForm.Menu.cs プロジェクト: rizwan3d/elalang
 private void BuildEditorList(IMenuBuilder<MenuStrip> builder)
 {
     App.GetService<IEditorService>().EnumerateInfos("editors").OfType<EditorInfo>()
         .Where(e => !e.Flags.Set(EditorFlags.Main) && !e.Flags.Set(EditorFlags.Hidden))
         .ForEach(e => builder.Item(e.DisplayName, () => App.GetService<IFileService>().NewFile(e.Key)));
 }
コード例 #10
0
ファイル: MainForm.Menu.cs プロジェクト: rizwan3d/elalang
        private void BuildWindowList(IMenuBuilder<MenuStrip> builder)
        {
            var srv = App.GetService<IDocumentService>();
            var seq = srv.EnumerateDocuments().Take(10).ToList();

            for (var i = 0; i < seq.Count; i++)
            {
                var doc = seq[i];
                builder.Item("&" + (i + 1) + ". " + seq[i], () => srv.SetActiveDocument(doc));
            }
        }
コード例 #11
0
ファイル: MainForm.Menu.cs プロジェクト: rizwan3d/elalang
        private void BuildRecentList(IMenuBuilder<MenuStrip> builder)
        {
            var con = App.Config<WorkbenchConfig>();
            var recFiles = con.RecentFiles;

            if (recFiles == null || recFiles.Count == 0)
                builder.Item("[None]", null, () => false);
            else
            {
                for (var i = 0; i < recFiles.Count; i++)
                {
                    var idx = i;
                    builder.Item("&" + (i + 1) + ". " + recFiles[i], () =>
                        {
                            var fi = new FileInfo(recFiles[idx]);

                            if (!fi.Exists)
                            {
                                if (App.GetService<IDialogService>().ShowWarningDialog(
                                    "File '{0}' doesn't exist. Do you want to remove it from the recently used list?", fi.FullName))
                                    recFiles.RemoveAt(i);
                            }
                            else
                                App.GetService<IFileService>().OpenFile(fi);
                        });
                }
            }
        }