Inheritance: System.Windows.Forms.UserControl
Exemplo n.º 1
0
        protected TextEditorControlBase()
        {
            this.GenerateDefaultActions();
            TextEditorControlBase textEditorControlBase = this;

            HighlightingManager.Manager.ReloadSyntaxHighlighting += new EventHandler(textEditorControlBase.OnReloadHighlighting);
        }
Exemplo n.º 2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         TextEditorControlBase textEditorControlBase = this;
         HighlightingManager.Manager.ReloadSyntaxHighlighting -= new EventHandler(textEditorControlBase.OnReloadHighlighting);
         this.document.HighlightingStrategy        = null;
         this.document.UndoStack.TextEditorControl = null;
     }
     base.Dispose(disposing);
 }
 public void loadSourceCodeFileIntoTextEditor(String fileToLoad, TextEditorControlBase tecTargetTextEditor)
 {
     fileToLoad = tryToResolveFileLocation(fileToLoad, this);
     //this.okThreadSync(delegate
     //ExtensionMethods.invokeOnThread((Control)this, () =>
     tecSourceCode.invokeOnThread(
         () =>
             {
                 try
                 {
                     partialFileViewMode = false;
                     lbPartialFileView.Visible = false;
                     tecSourceCode.Visible = true;
                     long iCurrentFileSize = Files_WinForms.getFileSize(fileToLoad);
                     if (iCurrentFileSize > (iMaxFileSize*1024))
                     {
                         PublicDI.log.error("File to load is too big: max is {0}k, this file is {1}k : {2}",
                                      iMaxFileSize,
                                      iCurrentFileSize/1024, fileToLoad);
                         loadPartialFileView(fileToLoad);
                     }
                     else
                     {
                         if (fileToLoad.extension(".h2"))
                         {
                             setPathToFileLoaded(fileToLoad);
                             setDocumentContents(H2.load(fileToLoad).SourceCode, fileToLoad, false);
                             setDocumentHighlightingStrategy("aa.cs");
                         }
                         else
                         {
                             tecTargetTextEditor.LoadFile(fileToLoad);
                         }
                         if (fileToLoad.extension(".o2"))
                         {
                             var realFileTypeToload = Path.GetFileNameWithoutExtension(fileToLoad);
                             tecSourceCode.Document.HighlightingStrategy =
                                 HighlightingStrategyFactory.CreateHighlightingStrategyForFile(realFileTypeToload);
                         }
                         lbSourceCode_UnsavedChanges.Visible = false;
                         btSaveFile.Enabled = false;
                         eFileOpen(fileToLoad);
                     }
                 }
                 catch (Exception ex)
                 {
                     PublicDI.log.error("in loadSourceCodeFileIntoTextEditor: {0}", ex.Message);
                 }
                 return default(object);
             });
 }
        public void configureDefaultSettingsForTextEditor(TextEditorControlBase tecTargetTextEditor)
        {
            tecTargetTextEditor.Document.DocumentChanged += Document_DocumentChanged;

            cboxLineNumbers.Checked = true;

            cboxInvalidLines.Checked = true;
            cboxInvalidLines_CheckedChanged(null, null);

            cboxEOLMarkers.Checked = false;
            cboxEOLMarkers_CheckedChanged(null, null);

            cboxHRuler.Checked = false;
            cboxHRuler_CheckedChanged(null, null);

            cboxSpaces.Checked = false;
            cboxSpaces_CheckedChanged(null, null);

            cboxTabs.Checked = false;
            cboxTabs_CheckedChanged(null, null);

            cboxVRuler.Checked = false;
            cboxVRuler_CheckedChanged(null, null);
        }