private void computeLineNumMargin(ScintillaNet.Scintilla Editor) { if (lineNumbersToolStripMenuItem.Checked) { Editor.Margins[0].Width = Editor.Lines.Count.ToString().Length * 10; } }
} // ; private void open_tab(string name) { foreach (TabPage B in tabControl1.TabPages) { fileInfo fi = (fileInfo)B.Tag; if (fi.InternalPath == name) { tabControl1.SelectTab(B); return; } } fileInfo F = info.files[info.dirs + "\\" + name]; if (F == null) { throw new NullReferenceException("Could not find file " + info.dirs + "\\" + name); } TabPage P = new TabPage(F.FileName + F.Extension); P.Controls.Add(new textEditor(this, console)); P.Controls[0].Controls["scintilla2"].Text = F.Text; P.Controls[0].Size = tabControl1.Size; P.Controls[0].Dock = DockStyle.Fill; ScintillaNet.Scintilla note = (ScintillaNet.Scintilla)P.Controls[0].Controls["scintilla2"]; note.UndoRedo.EmptyUndoBuffer(); P.Controls[0].Tag = P; P.Tag = F; tabControl1.TabPages.Add(P); tabControl1.SelectTab(P); }
private ScintillaNet.Scintilla AddNewTab( ) { DevExpress.XtraTab.XtraTabPage page = this.ScriptTabControl.TabPages.Add("Script" + this.ScriptTabControl.TabPages.Count); ScriptTabControl.SuspendLayout(); ScintillaNet.Scintilla richText = new ScintillaNet.Scintilla(); richText.ConfigurationManager.Language = "sql"; richText.Dock = System.Windows.Forms.DockStyle.Fill; richText.Indentation.ShowGuides = true; richText.Indentation.SmartIndentType = ScintillaNet.SmartIndent.Simple; richText.Location = new System.Drawing.Point(0, 0); richText.Margins.Margin0.Width = 40; richText.Margins.Margin2.Width = 20; richText.Name = "Script"; richText.Size = new System.Drawing.Size(644, 452); richText.Styles.BraceBad.FontName = "Verdana"; richText.Styles.BraceLight.FontName = "Verdana"; richText.Styles.ControlChar.FontName = "Verdana"; richText.Styles.Default.FontName = "Verdana"; richText.Styles.Default.Size = 8; richText.Styles.IndentGuide.FontName = "Verdana"; richText.Styles.LastPredefined.FontName = "Verdana"; richText.Styles.LineNumber.FontName = "Verdana"; richText.Styles.Max.FontName = "Verdana"; richText.TabIndex = 2; richText.Whitespace.Mode = ScintillaNet.WhitespaceMode.VisibleAfterIndent; richText.Dock = DockStyle.Fill; // richText.Font=new Font( richText.Font.FontFamily , 9 ); richText.PreviewKeyDown += new PreviewKeyDownEventHandler(Script_PreviewKeyDown); page.Controls.Add(richText); ScriptTabControl.SelectedTabPage = page; ScriptTabControl.ResumeLayout(); return(richText); }
public void SetLine(int a_line) { ScintillaNet.Scintilla sourceView = m_mainForm.GetSourceView(); if (m_state.m_currentPos >= 0) { sourceView.Lines[m_state.m_currentPos].DeleteMarker(m_markerArrow); m_state.m_currentPos = -1; } m_state.m_currentPos = a_line - 1; sourceView.Lines[m_state.m_currentPos].AddMarker(m_markerArrow); // center the source view around the cursor int topLine = sourceView.Lines.FirstVisible.Number; int visLines = sourceView.Lines.VisibleCount; int scrollLines = 0; int centre = (topLine + (visLines >> 1)); int lq = centre - (visLines >> 2); int hq = centre + (visLines >> 2); if (m_state.m_currentPos < lq) { scrollLines = m_state.m_currentPos - centre; } else if (m_state.m_currentPos > hq) { scrollLines = m_state.m_currentPos - centre; } // LineScroll(0, scrollLines); sourceView.Scrolling.ScrollBy(0, scrollLines); }
public void OnToggleBreakpoint() { ScintillaNet.Scintilla sourceView = m_mainForm.GetSourceView(); // add a break point at the current line. int line = sourceView.Lines.Current.Number; // m_scintillaEdit.GetCurrentPos(); bool enabled = true; // do we have a break point at this line already??? if (sourceView.Lines[line].GetMarkers().Contains(m_markerBreakpoint)) { enabled = false; } if (m_state.m_currentDebugThread != 0 && (m_state.m_isDebugging != false)) { m_state.m_breakPoint.m_enabled = enabled; m_state.m_breakPoint.m_allThreads = true; m_state.m_breakPoint.m_responseId = ++m_state.m_responseId; m_state.m_breakPoint.m_sourceId = m_state.m_sourceId; m_state.m_breakPoint.m_lineNumber = line + 1; m_state.m_breakPoint.m_threadId = 0; m_debuggerSession.gmMachineSetBreakPoint(m_state.m_breakPoint.m_responseId, (int)m_state.m_breakPoint.m_sourceId, m_state.m_breakPoint.m_lineNumber, 0, enabled ? 1 : 0); } }
public bool SetSource(uint a_sourceId, String a_source) { if (a_sourceId == m_state.m_sourceId) { return(true); } ScintillaNet.Scintilla sourceView = m_mainForm.GetSourceView(); // do we have the source foreach (DebuggerState.Source source in m_state.m_sources) { if (source.m_id == a_sourceId) { sourceView.IsReadOnly = false; sourceView.Text = source.m_source; sourceView.IsReadOnly = true; m_state.m_sourceId = a_sourceId; return(true); } } // we dont have the source, add it if (a_source != null) { sourceView.IsReadOnly = false; sourceView.Text = a_source; sourceView.IsReadOnly = true; m_state.m_sourceId = a_sourceId; m_state.m_sources.Add(new DebuggerState.Source(a_source, a_sourceId)); return(true); } return(false); }
private void mainWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.S) { if (tabControl1.Focused) { if (tabControl1.SelectedTab != null) { save_tab(tabControl1.SelectedTab); } } else { save_all(); } } if (e.Control && e.KeyCode == Keys.F) { if (tabControl1.Focused) { if (tabControl1.SelectedTab != null) { ScintillaNet.Scintilla pad = (ScintillaNet.Scintilla)tabControl1.SelectedTab.Controls[0].Controls["scintilla2"]; } } else { // ScintillaNet.FindReplaceDialog dialog = new ScintillaNet.FindReplaceDialog(); // dialog.ShowDialog(); // ScintillaNet.FindReplace FF; } } }
public void ExecuteScript( ) { if (ScriptTabControl.SelectedTabPage == null) { return; } ScintillaNet.Scintilla rtbScript = (ScintillaNet.Scintilla)ScriptTabControl.SelectedTabPage.Controls[0]; String stQuery = rtbScript.Selection.Text.Trim(); if (String.IsNullOrEmpty(stQuery)) { stQuery = rtbScript.Text; } if (String.IsNullOrEmpty(stQuery)) { return; } Cursor.Current = Cursors.WaitCursor; DevExpress.Utils.WaitDialogForm waiting = new DevExpress.Utils.WaitDialogForm(); waiting.SetCaption("Executing . . .!"); waiting.Show(); DataSet ds = ABCDataLib.ConnectionManager.DatabaseHelper.RunQuery(stQuery); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1) { ResultRichText.Text = ds.Tables[0].Rows[0][0].ToString(); } waiting.Close(); Cursor.Current = Cursors.Default; }
public static ScintillaNet.Scintilla ApplyImageList(ScintillaNet.Scintilla scinti) { Bitmap[] bmList = new Bitmap[imgList.Count]; foreach (KeyValuePair <int, Bitmap> i in imgList) { bmList[i.Key] = i.Value; } scinti.AutoComplete.RegisterImages(bmList.ToList <Bitmap>()); return(scinti); }
private void Editor_SelectionChanged(object sender, EventArgs e) { ScintillaNet.Scintilla Editor = sender as ScintillaNet.Scintilla; string selText; if (editorToolTip != null && editorToolTip.Active) { editorToolTip.Hide(Editor); editorToolTip.Dispose(); } if (Editor.NativeInterface.GetSelectionStart() == Editor.NativeInterface.GetSelectionEnd()) { return; } Editor.NativeInterface.GetSelText(out selText); selText = selText.Trim(); if (selText.Length > 0) { if (selText.Length > 4 && selText.StartsWith("U", StringComparison.OrdinalIgnoreCase)) { editorToolTip = new ToolTip(); editorToolTip.Popup += new PopupEventHandler(editorToolTip_Popup); editorToolTip.OwnerDraw = true; editorToolTip.Draw += new DrawToolTipEventHandler(editorToolTip_Draw); string[] splitted = selText.Split(' '); StringBuilder concated = new StringBuilder(); foreach (string split in splitted) { if (split.StartsWith("U", StringComparison.OrdinalIgnoreCase) && split.Length > 4) { string hexString = split.Substring(1, 4); int hexCode; if (int.TryParse(hexString, System.Globalization.NumberStyles.AllowHexSpecifier, null, out hexCode)) { concated.Append((char)hexCode); } } } Point caretPoint = new Point(); if (GetCaretPos(out caretPoint)) { caretPoint.X += 5; caretPoint.Y -= 30; toolTipString = concated.ToString(); editorToolTip.Show(toolTipString, Editor, caretPoint); } } } }
private void gotoLineToolStripMenuItem_Click(object sender, EventArgs e) { TabPage P = tabControl1.SelectedTab; if (P == null) { return; } ScintillaNet.Scintilla note = (ScintillaNet.Scintilla)tabControl1.SelectedTab.Controls[0].Controls["scintilla2"]; if (note == null) { return; } note.GoTo.ShowGoToDialog(); }
public void open_tab(string name, int line) { ScintillaNet.Scintilla chat; if (name.Contains(info.dir)) { name = name.Remove(0, info.dir.Length + 1); } foreach (TabPage B in tabControl1.TabPages) { fileInfo fi = (fileInfo)B.Tag; if (fi.InternalPath == name) { tabControl1.SelectTab(B); chat = (ScintillaNet.Scintilla)tabControl1.SelectedTab.Controls[0].Controls["scintilla2"]; chat.GoTo.Line(line); return; } } if (!info.files.ContainsKey(info.dir + "\\" + name)) { throw new NullReferenceException("Could not find file " + info.dir + "\\" + name); } fileInfo F = info.files[info.dir + "\\" + name]; if (F.Extension != ".dm") { return; } if (F == null) { throw new NullReferenceException("Could not find file " + info.dir + "\\" + name); } TabPage P = new TabPage(F.FileName + F.Extension); P.Controls.Add(new textEditor(this, console)); P.Controls[0].Controls["scintilla2"].Text = F.Text; P.Controls[0].Size = tabControl1.Size; P.Controls[0].Dock = DockStyle.Fill; ScintillaNet.Scintilla note = (ScintillaNet.Scintilla)P.Controls[0].Controls["scintilla2"]; note.UndoRedo.EmptyUndoBuffer(); P.Controls[0].Tag = P; P.Tag = F; tabControl1.TabPages.Add(P); tabControl1.SelectTab(P); chat = (ScintillaNet.Scintilla)tabControl1.SelectedTab.Controls[0].Controls["scintilla2"]; chat.GoTo.Line(Convert.ToInt32(line)); }
private void open_tab(fileInfo name) { if (name == null) { return; } foreach (TabPage B in tabControl1.TabPages) { fileInfo fi = (fileInfo)B.Tag; if (fi == name) { tabControl1.SelectTab(B); return; } } fileInfo F = name; if (F == null) { throw new NullReferenceException("Could not find file " + F.FullPath); } if (info.sound_Filetypes.Contains(F.Extension)) { TabPage V = new TabPage(F.FileName + F.Extension); V.Text = "TEST"; V.Name = V.Text; V.Controls.Add(new Mediaplayer(info, F.FullPath)); tabControl1.TabPages.Add(V); tabControl1.SelectTab(V); return; } if (F.Extension != ".dm") { return; } TabPage P = new TabPage(F.FileName + F.Extension); P.Controls.Add(new textEditor(this, console)); P.Controls[0].Controls["scintilla2"].Text = F.Text; P.Controls[0].Size = tabControl1.Size; P.Controls[0].Dock = DockStyle.Fill; ScintillaNet.Scintilla note = (ScintillaNet.Scintilla)P.Controls[0].Controls["scintilla2"]; note.UndoRedo.EmptyUndoBuffer(); P.Controls[0].Tag = P; P.Tag = F; tabControl1.TabPages.Add(P); tabControl1.SelectTab(P); }
public void ShowStoredProcedure(String strSPname) { ScintillaNet.Scintilla richText = AddNewTab(); DataSet ds = ABCDataLib.ConnectionManager.DatabaseHelper.RunQuery(String.Format("sp_helptext [{0}];", strSPname)); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { richText.Text += dr[0].ToString(); } } richText.Text = richText.Text.Replace("CREATE PROCEDURE", "ALTER PROCEDURE"); }
public void gmDebuggerAck(int a_response, int a_posNeg) { if ((a_response == m_app.m_state.m_responseId) && (a_posNeg != 0)) { ScintillaNet.Scintilla sourceView = m_app.m_mainForm.GetSourceView(); if (m_app.m_state.m_breakPoint.m_enabled) { sourceView.Lines[m_app.m_state.m_breakPoint.m_lineNumber - 1].AddMarker(m_app.m_markerBreakpoint); } else { sourceView.Lines[m_app.m_state.m_breakPoint.m_lineNumber - 1].DeleteMarker(m_app.m_markerBreakpoint); } } }
private void Editor_CharAdded(object sender, ScintillaNet.CharAddedEventArgs e) { ScintillaNet.Scintilla Editor = sender as ScintillaNet.Scintilla; curWord = Editor.GetWordFromPosition(Editor.Selection.Start); if (curWord.Length == 0) { return; } Predicate <string> startWord = compareWithCurrentWord; List <string> list = autoCompleteList.FindAll(startWord); if (list.Count > 0) { Editor.AutoComplete.Show(curWord.Length, string.Join(SciEditor.AutoComplete.ListSeparator.ToString(), list.ToArray())); } }
public void InitScintilla() { ScintillaNet.Scintilla sourceView = m_mainForm.GetSourceView(); sourceView.Margins[0].Width = 20; // Show line numbers sourceView.IsReadOnly = true; // Disable editing sourceView.ConfigurationManager.Language = "cpp"; sourceView.EndOfLine.Mode = ScintillaNet.EndOfLineMode.Crlf; m_markerBreakpoint = sourceView.Markers[0]; m_markerBreakpoint.Symbol = ScintillaNet.MarkerSymbol.RoundRectangle; m_markerBreakpoint.ForeColor = Color.Black; m_markerBreakpoint.BackColor = Color.Red; m_markerArrow = sourceView.Markers[1]; m_markerArrow.Symbol = ScintillaNet.MarkerSymbol.Arrow; m_markerArrow.ForeColor = Color.Black; m_markerArrow.BackColor = Color.Blue; }
public ConfigStyles(ScintillaNet.Scintilla control, Dictionary <string, int> dict) { STLControl = control; nameToIndex = dict; originalStyles = new Dictionary <int, styleCopy>(); indexToName = new Dictionary <int, string>(); foreach (string name in dict.Keys) { ScintillaNet.Style thisSyle = STLControl.Styles[dict[name]]; styleCopy copy = new styleCopy(); copy.Font = thisSyle.Font; copy.ForeColor = thisSyle.ForeColor; copy.BackColor = thisSyle.BackColor; originalStyles.Add(dict[name], copy); indexToName.Add(dict[name], name); } InitializeComponent(); }
public ConfigStyles(ScintillaNet.Scintilla control, Dictionary<string, int> dict) { STLControl = control; nameToIndex = dict; originalStyles = new Dictionary<int, styleCopy>(); indexToName = new Dictionary<int, string>(); foreach (string name in dict.Keys) { ScintillaNet.Style thisSyle = STLControl.Styles[dict[name]]; styleCopy copy = new styleCopy(); copy.Font = thisSyle.Font; copy.ForeColor = thisSyle.ForeColor; copy.BackColor = thisSyle.BackColor; originalStyles.Add(dict[name], copy); indexToName.Add(dict[name], name); } InitializeComponent(); }
/// <summary> /// Returns a scintilla editor to the cache once it has been used. /// </summary> /// <param name="scintilla"></param> public void Return(ScintillaNet.Scintilla scintilla) { this.p_Scintillas.Push(scintilla); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DocumentForm)); this.scintilla = new ScintillaNet.Scintilla(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); ((System.ComponentModel.ISupportInitialize)(this.scintilla)).BeginInit(); this.SuspendLayout(); // // scintilla // this.scintilla.AutoComplete.CancelAtShowPoint = false; this.scintilla.AutoComplete.ListString = ""; this.scintilla.AutoComplete.TriggerChars = ((System.Collections.Generic.List<string>)(resources.GetObject("scintilla.AutoComplete.TriggerChars"))); this.scintilla.Caret.CurrentLineBackgroundColor = System.Drawing.Color.PaleTurquoise; this.scintilla.Caret.HighlightCurrentLine = true; this.scintilla.ConfigurationManager.Language = "lua"; this.scintilla.Dock = System.Windows.Forms.DockStyle.Fill; this.scintilla.Folding.MarkerScheme = ScintillaNet.FoldMarkerScheme.Custom; this.scintilla.LineWrap.VisualFlags = ScintillaNet.WrapVisualFlag.End; this.scintilla.Location = new System.Drawing.Point(0, 0); this.scintilla.Margins.Margin0.Width = 40; this.scintilla.Margins.Margin1.AutoToggleMarkerNumber = 0; this.scintilla.Margins.Margin1.IsClickable = true; this.scintilla.Markers.Folder.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.Folder.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.Folder.Number = 30; this.scintilla.Markers.Folder.Symbol = ScintillaNet.MarkerSymbol.BoxPlus; this.scintilla.Markers.FolderEnd.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.FolderEnd.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.FolderEnd.Number = 25; this.scintilla.Markers.FolderEnd.Symbol = ScintillaNet.MarkerSymbol.BoxPlusConnected; this.scintilla.Markers.FolderOpen.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.FolderOpen.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.FolderOpen.Number = 31; this.scintilla.Markers.FolderOpen.Symbol = ScintillaNet.MarkerSymbol.BoxMinus; this.scintilla.Markers.FolderOpenMid.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.FolderOpenMid.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.FolderOpenMid.Number = 26; this.scintilla.Markers.FolderOpenMid.Symbol = ScintillaNet.MarkerSymbol.BoxMinusConnected; this.scintilla.Markers.FolderOpenMidTail.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.FolderOpenMidTail.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.FolderOpenMidTail.Number = 27; this.scintilla.Markers.FolderOpenMidTail.Symbol = ScintillaNet.MarkerSymbol.TCorner; this.scintilla.Markers.FolderSub.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.FolderSub.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.FolderSub.Number = 29; this.scintilla.Markers.FolderSub.Symbol = ScintillaNet.MarkerSymbol.VLine; this.scintilla.Markers.FolderTail.BackColor = System.Drawing.Color.Gray; this.scintilla.Markers.FolderTail.ForeColor = System.Drawing.Color.White; this.scintilla.Markers.FolderTail.Number = 28; this.scintilla.Markers.FolderTail.Symbol = ScintillaNet.MarkerSymbol.LCorner; this.scintilla.Name = "scintilla"; this.scintilla.Size = new System.Drawing.Size(292, 266); this.scintilla.Styles.BraceBad.BackColor = System.Drawing.Color.White; this.scintilla.Styles.Default.BackColor = System.Drawing.SystemColors.Window; this.scintilla.Styles.LastPredefined.BackColor = System.Drawing.SystemColors.Info; this.scintilla.TabIndex = 0; this.scintilla.StyleNeeded += new System.EventHandler<ScintillaNet.StyleNeededEventArgs>(this.scintilla_StyleNeeded); this.scintilla.ModifiedChanged += new System.EventHandler(this.scintilla_ModifiedChanged); // // saveFileDialog // this.saveFileDialog.Filter = "All Files (*.*)|*.*"; // // DocumentForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.scintilla); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "DocumentForm"; this.Activated += new System.EventHandler(this.DocumentForm_Activated); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DocumentForm_FormClosing); this.Load += new System.EventHandler(this.DocumentForm_Load); ((System.ComponentModel.ISupportInitialize)(this.scintilla)).EndInit(); this.ResumeLayout(false); }
private void Editor_TextChanged(object sender, EventArgs e) { ScintillaNet.Scintilla Editor = sender as ScintillaNet.Scintilla; //sm.HiliteSyntax(); computeLineNumMargin(Editor); }