示例#1
0
        public DocumentForm NewDocument()
        {
            DocumentForm doc = new DocumentForm();

            doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount);
            doc.Show(dockPanel);
            toolIncremental.Searcher.Scintilla = doc.Scintilla;
            return(doc);
        }
示例#2
0
        public DocumentForm OpenFile(string filePath)
        {
            try
            {
                DocumentForm doc = new DocumentForm();


                doc.Scintilla.Text = File.ReadAllText(filePath);
                doc.Scintilla.UndoRedo.EmptyUndoBuffer();
                doc.Scintilla.Modified = false;
                doc.Text     = Path.GetFileName(filePath);
                doc.FilePath = filePath;
                doc.Show(dockPanel);
                toolIncremental.Searcher.Scintilla = doc.Scintilla;

                return(doc);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
示例#3
0
文件: CGEeditor.cs 项目: nadar71/Krea
        public DocumentForm OpenFile(string filePath)
        {
            try
            {
                DocumentForm doc = new DocumentForm();
                //doc.Scintilla.BackColor = Settings1.Default.CodeEditorBackColor;
                //doc.Scintilla.ForeColor = Settings1.Default.CodeEditorFontColor;
                //doc.Scintilla.FindReplace.Indicator.Color = Settings1.Default.CodeEditorSelectionColor;

                if (filePath.Contains(".lua"))
                {
                    doc.Scintilla.CharAdded += new EventHandler<CharAddedEventArgs>(this.sciDocument_CharAdded);
                    doc.Scintilla.TextDeleted += new EventHandler<TextModifiedEventArgs>(Scintilla_TextDeleted);
                    doc.Scintilla.AutoCompleteAccepted += new EventHandler<AutoCompleteAcceptedEventArgs>(Scintilla_AutoCompleteAccepted);
                    doc.Scintilla.MarkerChanged += new EventHandler<MarkerChangedEventArgs>(Scintilla_MarkerChanged);
                    doc.Scintilla.SelectionChanged += new EventHandler(Scintilla_SelectionChanged);
                    //doc.Scintilla.NativeInterface.UpdateUI += new EventHandler<NativeScintillaEventArgs>(Scintilla_SUpdateUI);
                    doc.Scintilla.IsBraceMatching = true;

                }

                doc.Scintilla.UndoRedo.EmptyUndoBuffer();

                List<Marker> markers = doc.Scintilla.Markers.GetMarkers(0);
                if (markers.Count > 0)
                    markers[0].BackColor = Color.OrangeRed;

                doc.Show(dockPanel);
                doc.Scintilla.Text = File.ReadAllText(filePath);

                doc.Scintilla.Modified = false;
                doc.Text = Path.GetFileName(filePath);
                doc.FilePath = filePath;

                if (filePath.Contains(".lua"))
                {
                    checkIntegrityLuaSceneFileFromV1_14ToV1_15(doc);
                }

                doc.Save();

                if (this.Mode.Equals("DEBUG"))
                    doc.Scintilla.IsReadOnly = true;
                else
                {
                    doc.Scintilla.IsReadOnly = false;

                    foreach (DocumentForm documentForm in dockPanel.Documents)
                    {
                        documentForm.Scintilla.Snippets.List.Clear();

                        documentForm.Scintilla.Snippets.List.AddRange(this.codeEditorSnippets);
                    }

                }

                return doc;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
        }
示例#4
0
文件: CGEeditor.cs 项目: nadar71/Krea
        //------------------------------ Change made to scene.lua files (initializeComponents become class method of "scene")
        public void checkIntegrityLuaSceneFileFromV1_14ToV1_15(DocumentForm doc)
        {
            if (doc != null)
            {
                string case1ToFind = "function initializeComponents(localGroup)";
                string case1ToReplace = "function scene:initializeComponents()\n\t local localGroup = self.view\n";

                doc.Scintilla.Text = doc.Scintilla.Text.Replace(case1ToFind, case1ToReplace);

                //-----

                string case2ToFind = "initializeComponents(group)";
                string case2ToReplace = "self:initializeComponents()";

                doc.Scintilla.Text = doc.Scintilla.Text.Replace(case2ToFind, case2ToReplace);
            }
        }
示例#5
0
文件: CGEeditor.cs 项目: nadar71/Krea
        private DocumentForm NewDocument()
        {
            DocumentForm doc = new DocumentForm();

            doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount);

            doc.Scintilla.CharAdded += new EventHandler<CharAddedEventArgs>(this.sciDocument_CharAdded);
            doc.Scintilla.TextDeleted += new EventHandler<TextModifiedEventArgs>(Scintilla_TextDeleted);
            doc.Scintilla.AutoCompleteAccepted += new EventHandler<AutoCompleteAcceptedEventArgs>(Scintilla_AutoCompleteAccepted);

            doc.Scintilla.UndoRedo.EmptyUndoBuffer();
            doc.Scintilla.Modified = false;
            doc.Show(dockPanel);

            return doc;
        }
示例#6
0
        public DocumentForm OpenFile(string filePath)
        {
            try
            {
                DocumentForm doc = new DocumentForm();

                doc.Scintilla.Text = File.ReadAllText(filePath);
                doc.Scintilla.UndoRedo.EmptyUndoBuffer();
                doc.Scintilla.Modified = false;
                doc.Text = Path.GetFileName(filePath);
                doc.FilePath = filePath;
                doc.Show(dockPanel);
                toolIncremental.Searcher.Scintilla = doc.Scintilla;

                return doc;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }
        }
示例#7
0
        public DocumentForm NewDocument()
        {
            DocumentForm doc = new DocumentForm();

            doc.Text = String.Format(CultureInfo.CurrentCulture, "{0}{1}", NEW_DOCUMENT_TEXT, ++_newDocumentCount);
            doc.Show(dockPanel);
            toolIncremental.Searcher.Scintilla = doc.Scintilla;
            return doc;
        }