public CreateOrRenameDialog(LuaForAGSEditorComponent component, LuaScriptFileInfo script) { this.component = component; this.script = script; this.renaming = true; this.folder = script.parent; InitializeComponent(); }
public LuaScriptEditPane(LuaForAGSEditorComponent parentComponent, IAGSEditor owningEditor, LuaScriptFileInfo scriptInfo) { this.parentComponent = parentComponent; ScriptInfo = scriptInfo; InitializeComponent(); editor = owningEditor; textBox1.Select(0, 0); textBox1.Hide(); scintillaWrapper = new Scintilla(); scintilla = scintillaWrapper.NativeInterface; scintillaWrapper.Parent = this; scintillaWrapper.Location = textBox1.Location; scintillaWrapper.Size = textBox1.Size; scintillaWrapper.Anchor = textBox1.Anchor; scintilla.RegisterImage(1, ResourceManager.GetResourceAsString("table.xpm")); scintilla.SetMarginWidthN(0, 32); scintilla.SetMarginTypeN(0, (int)MarginType.Number); scintillaWrapper.Folding.Flags = FoldFlag.LineAfterContracted; scintilla.SetMarginWidthN(2, 16); scintilla.SetMarginTypeN(2, (int)MarginType.Symbol); scintilla.MarkerDefine((int)MarkerOutline.FolderOpen, (int)MarkerSymbol.BoxMinus); scintilla.MarkerDefine((int)MarkerOutline.Folder, (int)MarkerSymbol.BoxPlus); scintilla.MarkerDefine((int)MarkerOutline.FolderSub, (int)MarkerSymbol.VLine); scintilla.MarkerDefine((int)MarkerOutline.FolderTail, (int)MarkerSymbol.LCorner); scintilla.MarkerDefine((int)MarkerOutline.FolderEnd, (int)MarkerSymbol.BoxPlusConnected); scintilla.MarkerDefine((int)MarkerOutline.FolderOpenMid, (int)MarkerSymbol.BoxMinusConnected); scintilla.MarkerDefine((int)MarkerOutline.FolderMidTail, (int)MarkerSymbol.TCorner); scintilla.SetMarginSensitiveN(2, true); /* scintillaWrapper.Folding.Flags = FoldFlag.LineBeforeContracted | FoldFlag.LineAfterExpanded; scintilla.SetMarginWidthN(2, 16); scintilla.SetMarginTypeN(2, (int)MarginType.Symbol); scintilla.MarkerDefine((int)MarkerOutline.FolderOpen, (int)MarkerSymbol.BoxMinus); scintilla.MarkerDefine((int)MarkerOutline.Folder, (int)MarkerSymbol.BoxPlus); scintilla.MarkerDefine((int)MarkerOutline.FolderSub, (int)MarkerSymbol.VLine); scintilla.MarkerDefine((int)MarkerOutline.FolderTail, (int)MarkerSymbol.LCorner); scintilla.MarkerDefine((int)MarkerOutline.FolderEnd, (int)MarkerSymbol.BoxPlusConnected); scintilla.MarkerDefine((int)MarkerOutline.FolderOpenMid, (int)MarkerSymbol.BoxMinusConnected); scintilla.MarkerDefine((int)MarkerOutline.FolderMidTail, (int)MarkerSymbol.TCorner); scintilla.SetMarginSensitiveN(2, true); */ scintillaWrapper.Font = codeFont; for (int i = 0; i <= 32; i++) { scintillaWrapper.Styles[i].Font = codeFont; } scintillaWrapper.Lexing.Lexer = Lexer.Lua; scintillaWrapper.Styles[0].ForeColor = Color.FromArgb(0, 0, 0); scintillaWrapper.Styles[1].ForeColor = Color.FromArgb(0, 127, 0); scintillaWrapper.Styles[2].ForeColor = Color.FromArgb(0, 127, 0); scintillaWrapper.Styles[3].ForeColor = Color.FromArgb(127, 127, 127); scintillaWrapper.Styles[4].ForeColor = Color.FromArgb(0, 150, 175); scintillaWrapper.Styles[5].ForeColor = Color.FromArgb(0, 0, 127); scintillaWrapper.Styles[5].Bold = true; scintillaWrapper.Styles[6].ForeColor = Color.FromArgb(170, 0, 170); scintillaWrapper.Styles[7].ForeColor = Color.FromArgb(170, 0, 170); scintillaWrapper.Styles[8].ForeColor = Color.FromArgb(170, 0, 170); scintillaWrapper.Styles[9].ForeColor = Color.FromArgb(0, 0, 0); // Standard library keywords scintillaWrapper.Styles[12].ForeColor = Color.FromArgb(0, 0, 0); scintillaWrapper.Styles[12].BackColor = Color.FromArgb(224, 192, 224); scintillaWrapper.Styles[12].Bold = true; scintillaWrapper.Styles[12].IsSelectionEolFilled = true; // Brace match scintillaWrapper.Styles[34].ForeColor = Color.FromArgb(47, 47, 255); scintillaWrapper.Styles[34].Bold = true; // Brace mismatch scintillaWrapper.Styles[35].ForeColor = Color.FromArgb(255, 47, 47); scintillaWrapper.Styles[35].Bold = true; scintillaWrapper.Styles[13].ForeColor = Color.FromArgb(120, 156, 124); scintillaWrapper.Styles[13].Bold = true; scintillaWrapper.Styles[13].IsSelectionEolFilled = true; scintilla.UpdateUI += Scintilla_UpdateUI; scintillaWrapper.AutoComplete.CancelAtStart = false; scintillaWrapper.AutoComplete.AutoHide = false; scintillaWrapper.AutoComplete.MaxHeight = 8; scintillaWrapper.AutoComplete.MaxWidth = 100; scintillaWrapper.AutoComplete.StopCharacters = ")}; "; scintillaWrapper.Indentation.UseTabs = false; scintillaWrapper.Indentation.TabWidth = 2; scintillaWrapper.Indentation.IndentWidth = 2; scintillaWrapper.Caret.HighlightCurrentLine = true; scintillaWrapper.Caret.CurrentLineBackgroundColor = Color.FromArgb(232, 232, 255); scintillaWrapper.Lexing.SetKeywords(0, @" and break do else elseif end false for function if in local nil not or repeat return then true until while"); scintillaWrapper.Lexing.SetKeywords(1, @" _G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall coroutine.create coroutine.resume coroutine.running coroutine.status coroutine.wrap coroutine.yield debug.debug debug.getfenv debug.gethook debug.getinfo debug.getlocal debug.getmetatable debug.getregistry debug.getupvalue debug.setfenv debug.sethook debug.setlocal debug.setmetatable debug.setupvalue debug.traceback io.close io.flush io.input io.lines io.open io.output io.popen io.read io.stderr io.stdin io.stdout io.tmpfile io.type io.write math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos math.cosh math.deg math.exp math.floor math.fmod math.frexp math.huge math.ldexp math.log math.log10 math.max math.min math.modf math.pi math.pow math.rad math.random math.randomseed math.sin math.sinh math.sqrt math.tan math.tanh os.clock os.date os.difftime os.execute os.exit os.getenv os.remove os.rename os.setlocale os.time os.tmpname package.cpath package.loaded package.loaders package.loadlib package.path package.preload package.seeall string.byte string.char string.dump string.find string.format string.gmatch string.gsub string.len string.lower string.match string.rep string.reverse string.sub string.upper table.concat table.insert table.maxn table.remove table.sort"); scintillaWrapper.CharAdded += Scintilla_CharAdded; scintillaWrapper.Scrolling.HorizontalWidth = 80; SetText(File.ReadAllText(path)); scintilla.SetSavePoint(); scintillaWrapper.UndoRedo.EmptyUndoBuffer(); }
private void OnWatchedChange(WatcherChangeTypes change, string name, string oldName) { switch (change) { case WatcherChangeTypes.Created: string path = Path.Combine(dir.FullName, name); if (Directory.Exists(path)) { LuaScriptFolderInfo newFolder = new LuaScriptFolderInfo(component, this, new DirectoryInfo(path)); RefreshIcons(); if (name == creating) { component.editor.GUIController.ProjectTree.SelectNode(component, newFolder.key); } } else { LuaScriptFileInfo newScript = new LuaScriptFileInfo(component, this, new FileInfo(path)); RefreshIcons(); if (name == creating) { component.editor.GUIController.ProjectTree.SelectNode(component, newScript.key); newScript.Open(); } } creating = null; break; case WatcherChangeTypes.Deleted: { LuaScriptFileInfo script; LuaScriptFolderInfo folder; if (Scripts.TryGetValue(name.ToLower(), out script)) { script.BeenDeleted(); } else if (SubFolders.TryGetValue(name.ToLower(), out folder)) { folder.BeenDeleted(); } break; } case WatcherChangeTypes.Changed: break; case WatcherChangeTypes.Renamed: if (SubFolders.ContainsKey(oldName.ToLower())) { SubFolders[oldName.ToLower()].BeenRenamed(name); } else if (Scripts.ContainsKey(oldName.ToLower())) { Scripts[oldName.ToLower()].BeenRenamed(name); } break; } }