public ScintillaWrapper()
{
InitializeComponent();
if (AutoCompleteIcons.Count == 0)
{
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("prop.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("method.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("gvar.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("enum.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("statprop.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("statmeth.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("roprop.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("struct.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("define.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("keyword.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("methodext.xpm"));
AutoCompleteIcons.Add(Resources.ResourceManager.GetResourceAsString("localvar.xpm"));
}
for (int i = 0; i < AutoCompleteIcons.Count; i++)
{
this.scintillaControl1.RegisterImage(i + 1, AutoCompleteIcons[i]);
}
this.scintillaControl1.EOLMode = (int)EndOfLine.Crlf;
this.scintillaControl1.WrapMode = (int)Wrap.None;
this.scintillaControl1.ClearAll();
this.scintillaControl1.SetLexer(Scintilla.Enums.Lexer.Cpp);
this.scintillaControl1.StyleSetFont((int)Scintilla.Enums.StylesCommon.Default, DEFAULT_FONT);
this.scintillaControl1.StyleSetFontSize((int)Scintilla.Enums.StylesCommon.Default, DEFAULT_FONT_SIZE);
this.scintillaControl1.StyleSetFont((int)Cpp.BraceBad, DEFAULT_FONT);
this.scintillaControl1.StyleSetFontSize((int)Cpp.BraceBad, DEFAULT_FONT_SIZE);
this.scintillaControl1.StyleSetBack(Cpp.BraceBad, Color.FromArgb(255, 0, 0));
this.scintillaControl1.StyleSetFont((int)Cpp.BraceLight, DEFAULT_FONT);
this.scintillaControl1.StyleSetFontSize((int)Cpp.BraceLight, DEFAULT_FONT_SIZE);
this.scintillaControl1.StyleSetBold(Cpp.BraceLight, true);
this.scintillaControl1.StyleSetBack(Cpp.BraceLight, Color.FromArgb(210, 210, 0));
this.scintillaControl1.StyleSetFore(Cpp.Word, Color.FromArgb(0, 0, 244));
this.scintillaControl1.StyleSetFore(Cpp.Word2, Color.FromArgb(43, 145, 175));
this.scintillaControl1.StyleSetFore(Cpp.Comment, Color.FromArgb(27, 127, 27));
this.scintillaControl1.StyleSetFore(Cpp.CommentLine, Color.FromArgb(27, 127, 27));
this.scintillaControl1.StyleSetFore(Cpp.CommentDoc, Color.FromArgb(27, 127, 27));
this.scintillaControl1.StyleSetFore(Cpp.CommentLineDoc, Color.FromArgb(27, 127, 27));
this.scintillaControl1.StyleSetFore(Cpp.Number, Color.FromArgb(150, 27, 27));
this.scintillaControl1.StyleSetFore(Cpp.String, Color.FromArgb(70, 7, 7));
this.scintillaControl1.StyleSetFore(Cpp.Operator, Color.FromArgb(0, 70, 0));
this.scintillaControl1.StyleSetBack(Cpp.Preprocessor, Color.FromArgb(210, 210, 210));
this.scintillaControl1.StyleSetFont((int)Cpp.CallTip, USER_FRIENDLY_FONT);
this.scintillaControl1.StyleSetFontSize((int)Cpp.CallTip, USER_FRIENDLY_FONT_SIZE);
this.scintillaControl1.StyleSetFore(Cpp.CallTip, Color.Black);
this.scintillaControl1.StyleSetBack(Cpp.CallTip, Color.LightGoldenrodYellow);
this.scintillaControl1.CallTipSetForeHlt(Color.FromArgb(240, 0, 0));
this.scintillaControl1.CallTipUseStyle(0);
this.scintillaControl1.IsAutoCIgnoreCase = true;
this.scintillaControl1.IsAutoCCancelAtStart = false;
this.scintillaControl1.IsAutoCAutoHide = false;
this.scintillaControl1.AutoCMaxHeight = 8;
this.scintillaControl1.AutoCMaxWidth = 100;
this.scintillaControl1.AutoCStops(AUTO_COMPLETE_CANCEL_CHARS);
this.scintillaControl1.MouseDwellTime = 500;
// ensure scintilla does not handle Ctrl+Space
this.scintillaControl1.ClearCmdKey(' ' | ((int)KeyMod.Ctrl << 16));
// disable Ctrl+T swapping lines since it used to be Test Game
this.scintillaControl1.ClearCmdKey('T' | ((int)KeyMod.Ctrl << 16));
this.scintillaControl1.TabWidth = Factory.AGSEditor.Preferences.TabSize;
this.scintillaControl1.IsUseTabs = Factory.AGSEditor.Preferences.IndentUsingTabs;
this.scintillaControl1.UsePopUp(false);
// override the selected text colour
this.scintillaControl1.SetSelFore(true, Color.FromArgb(255, 255, 255));
this.scintillaControl1.SetSelBack(true, Color.FromArgb(0, 34, 130));
// remove the default margins
this.scintillaControl1.SetMarginWidth(0, 0);
this.scintillaControl1.SetMarginWidth(1, 16);
this.scintillaControl1.MarkerDefine(MARKER_TYPE_BREAKPOINT, (int)MarkerSymbol.Background);
this.scintillaControl1.MarkerSetBack(MARKER_TYPE_BREAKPOINT, Color.FromArgb(255, 100, 100));
this.scintillaControl1.MarkerSetFore(MARKER_TYPE_BREAKPOINT, Color.White);
this.scintillaControl1.MarkerDefine(MARKER_TYPE_BREAKPOINT2, (int)MarkerSymbol.Circle);
this.scintillaControl1.MarkerSetBack(MARKER_TYPE_BREAKPOINT2, Color.Red);
this.scintillaControl1.MarkerSetFore(MARKER_TYPE_BREAKPOINT2, Color.Black);
this.scintillaControl1.SetMarginSensitivity(1, 1);
this.scintillaControl1.MarkerDefine(MARKER_TYPE_CURRENT_STATEMENT, (int)MarkerSymbol.Arrow);
this.scintillaControl1.MarkerSetBack(MARKER_TYPE_CURRENT_STATEMENT, Color.Yellow);
this.scintillaControl1.MarkerSetFore(MARKER_TYPE_CURRENT_STATEMENT, Color.White);
this.scintillaControl1.MarkerDefine(MARKER_TYPE_CURRENT_STATEMENT2, (int)MarkerSymbol.Background);
this.scintillaControl1.MarkerSetBack(MARKER_TYPE_CURRENT_STATEMENT2, Color.Yellow);
this.scintillaControl1.MarkerSetFore(MARKER_TYPE_CURRENT_STATEMENT2, Color.White);
this.scintillaControl1.ModEventMask = 3; // Insert/Delete text only
this.scintillaControl1.SavePointLeft += new EventHandler(OnSavePointLeft);
this.scintillaControl1.SavePointReached += new EventHandler(OnSavePointReached);
this.scintillaControl1.CharAdded += new EventHandler<Scintilla.CharAddedEventArgs>(OnCharAdded);
this.scintillaControl1.UpdateUI += new EventHandler(OnUpdateUI);
this.scintillaControl1.ModifyAttemptOnReadOnly += new EventHandler(OnModifyAttemptOnReadOnly);
this.scintillaControl1.TextModified += new EventHandler<Scintilla.TextModifiedEventArgs>(scintillaControl1_TextModified);
this.scintillaControl1.MouseUp += new MouseEventHandler(ScintillaWrapper_MouseUp);
this.scintillaControl1.DwellStart += new EventHandler<Scintilla.DwellStartEventArgs>(scintillaControl1_DwellStart);
this.scintillaControl1.DwellEnd += new EventHandler(scintillaControl1_DwellEnd);
this.scintillaControl1.MarginClick += new EventHandler<Scintilla.MarginClickEventArgs>(scintillaControl1_MarginClick);
this.scintillaControl1.SetFolding();
// Prettier folding markers
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDER, (int)Scintilla.Constants.SC_MARK_BOXPLUS);
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDEROPEN, (int)Scintilla.Constants.SC_MARK_BOXMINUS);
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDEREND, (int)Scintilla.Constants.SC_MARK_BOXPLUSCONNECTED);
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDERMIDTAIL, (int)Scintilla.Constants.SC_MARK_TCORNER);
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDEROPENMID, (int)Scintilla.Constants.SC_MARK_BOXMINUSCONNECTED);
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDERSUB, (int)Scintilla.Constants.SC_MARK_VLINE);
this.scintillaControl1.MarkerDefine(Scintilla.Constants.SC_MARKNUM_FOLDERTAIL, (int)Scintilla.Constants.SC_MARK_LCORNER);
Color FoldingForeColor = ColorTranslator.FromHtml("#F3F3F3");
Color FoldingBackColor = ColorTranslator.FromHtml("#808080");
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDER, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDER, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDEREND, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDEREND, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDEROPEN, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDEROPEN, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDEROPENMID, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDEROPENMID, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDERMIDTAIL, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDERMIDTAIL, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDEREND, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDEREND, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDERSUB, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDERSUB, FoldingBackColor);
this.scintillaControl1.MarkerSetFore((int)Scintilla.Constants.SC_MARKNUM_FOLDERTAIL, FoldingForeColor);
this.scintillaControl1.MarkerSetBack((int)Scintilla.Constants.SC_MARKNUM_FOLDERTAIL, FoldingBackColor);
// Indentation guides
this.scintillaControl1.SetIndentationGuides(3);
this.scintillaControl1.StyleSetFore(Cpp.IndentGuide, ColorTranslator.FromHtml("#DDDDDD"));
this.scintillaControl1.IsReadOnly = true;
}