Exemplo n.º 1
0
        private void SetupEditor(LispEditor editor)
        {
            if (editor == null)
            {
                return;
            }

            editor.Scintilla.ConfigurationManager.Configure(this.scintillaConfig.ScintillaConfiguration);
            editor.Scintilla.IsBraceMatching = true;

            editor.Scintilla.Folding.IsEnabled   = ConfigurationManager.EnableFolding;
            editor.Scintilla.Margins[2].Width    = ConfigurationManager.EnableFolding ? FOLD_MARGIN_WIDTH : 0;
            editor.Scintilla.Margins[0].Width    = ConfigurationManager.ShowLineNumbers ? LINE_NUMBERS_MARGIN_WIDTH : 0;
            editor.Scintilla.EndOfLine.IsVisible = ConfigurationManager.ShowEOL;
            editor.Scintilla.Whitespace.Mode     = ConfigurationManager.ShowWhitespace
                                                   ? WhitespaceMode.VisibleAlways
                                                   : WhitespaceMode.Invisible;
            editor.Scintilla.LineWrap.Mode      = ConfigurationManager.EnableWordWrap ? WrapMode.Word : WrapMode.None;
            editor.Scintilla.Indentation.Guides = ConfigurationManager.EnableIndentGuides
                                                      ? IndentGuideView.LookForward
                                                      : IndentGuideView.None;

            if (ConfigurationManager.Font != null)
            {
                editor.Scintilla.UseFont         = true;
                editor.Scintilla.Font            = ConfigurationManager.Font;
                editor.Scintilla.Styles[32].Font = ConfigurationManager.Font;
            }
        }
Exemplo n.º 2
0
        private void NewFile()
        {
            LispEditor editor = FileCommands.NewFile();

            SetupEditor(editor);
            ShowEditor(editor, DockState.Document);
        }
Exemplo n.º 3
0
        private void ShowEditor(LispEditor editor, DockState dockState)
        {
            if (editor == null)
            {
                return;
            }

            editor.Show(this.dockPanel1, dockState);
            SetStatusLabels();
        }
Exemplo n.º 4
0
 void closeAllButThisContextMenuItem_Click(object sender, EventArgs e)
 {
     IDockContent[] editors = this.parent.DockPanel.DocumentsToArray();
     foreach (IDockContent editor in editors)
     {
         LispEditor leditor = editor as LispEditor;
         if (leditor != null && leditor != this.parent)
         {
             leditor.Close();
         }
     }
 }
Exemplo n.º 5
0
        private void OpenFile(string filePath, DockState dockState)
        {
            // Ensure this file isn't already open
            if (!IsOpen(filePath))
            {
                LispEditor editor = FileCommands.OpenFile(filePath); //Open the file

                if (editor != null)
                {
                    SetupEditor(editor);
                    ShowEditor(editor, dockState);
                }
            }
        }
Exemplo n.º 6
0
        private void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e)
        {
            SetTitle();

            if (this.activeDocument != null)
            {
                this.activeDocument.Scintilla.SelectionChanged -= Scintilla_SelectionChanged;
                this.activeDocument.Scintilla.DocumentChange   -= Scintilla_DocumentChange;
                this.activeDocument.TextChanged -= ActiveDocument_TextChanged;
            }

            this.activeDocument = this.ActiveDocument;

            bool editItems = true;

            if (this.activeDocument == null)
            {
                editItems = false;
                this.eolFormatStatusLabel.Enabled = false;
                this.lineInfoStatusLabel.Enabled  = false;
                this.lengthStatusLabel.Enabled    = false;
            }
            else
            {
                this.eolFormatStatusLabel.Enabled = true;
                this.lineInfoStatusLabel.Enabled  = true;
                this.lengthStatusLabel.Enabled    = true;

                this.activeDocument.Scintilla.SelectionChanged += Scintilla_SelectionChanged;
                this.activeDocument.Scintilla.DocumentChange   += Scintilla_DocumentChange;
                this.activeDocument.TextChanged += ActiveDocument_TextChanged;
            }

            SetStatusLabels();

            SetToolstripItemsEnabled(editItems);
        }
Exemplo n.º 7
0
 private void SaveFile(LispEditor editor)
 {
     FileCommands.SaveFile(this, editor);
 }
Exemplo n.º 8
0
 public LispEditorContextMenu(LispEditor parent) : base()
 {
     this.parent = parent;
     InitializeComponent();
 }
Exemplo n.º 9
0
 public LispEditorContextMenu(LispEditor parent, IContainer container) : base(container)
 {
     this.parent = parent;
     InitializeComponent();
 }