Ejemplo n.º 1
0
 public SimpleLuaValueEditor(LuaForAGSEditorComponent component, VisualLuaTableValue parentTable, VisualLuaValueType newValueType)
 {
     this.component = component;
     this.creatingType = newValueType;
     this.parentTable = parentTable;
     InitializeComponent();
 }
Ejemplo n.º 2
0
 public CreateOrRenameDialog(LuaForAGSEditorComponent component, LuaScriptFileInfo script)
 {
     this.component = component;
     this.script = script;
     this.renaming = true;
     this.folder = script.parent;
     InitializeComponent();
 }
Ejemplo n.º 3
0
 public CreateOrRenameDialog(LuaForAGSEditorComponent component, LuaScriptFolderInfo scriptFolder, bool creatingFolder)
 {
     this.component = component;
     this.folder = scriptFolder;
     this.renaming = false;
     this.targetingFolder = creatingFolder;
     InitializeComponent();
 }
Ejemplo n.º 4
0
        public LuaScriptFolderInfo(LuaForAGSEditorComponent l4a_component, LuaScriptFolderInfo parent, DirectoryInfo actualDir)
        {
            this.component = l4a_component;
            this.parent = parent;
            this.dir = actualDir;
            EnsureExistence();

            foreach (DirectoryInfo subdir in dir.GetDirectories())
            {
                // adds self to folders automatically
                new LuaScriptFolderInfo(component, this, subdir);
            }
            foreach (FileInfo file in dir.GetFiles("*.lua"))
            {
                // adds self to Scripts automatically
                new LuaScriptFileInfo(component, this, file);
            }

            InitFileSystemWatcher();
        }
Ejemplo n.º 5
0
 public VisualLuaNumberValue(LuaForAGSEditorComponent editorComponent, string ns)
     : base(editorComponent, ns)
 {
 }
Ejemplo n.º 6
0
 public static VisualLuaValue GetFromXml(LuaForAGSEditorComponent editorComponent, string ns, XmlNode node)
 {
     string name = node.Name;
     switch (node.Attributes["Type"].Value)
     {
         case "Number":
             VisualLuaNumberValue num = new VisualLuaNumberValue(editorComponent, ns);
             num.FromXml(node);
             return num;
         case "String":
             VisualLuaStringValue str = new VisualLuaStringValue(editorComponent, ns);
             str.FromXml(node);
             return str;
         case "Boolean":
             VisualLuaBooleanValue bl = new VisualLuaBooleanValue(editorComponent, ns);
             bl.FromXml(node);
             return bl;
         case "Table":
             VisualLuaTableValue tbl = new VisualLuaTableValue(editorComponent, ns);
             tbl.FromXml(node);
             return tbl;
     }
     return null;
 }
Ejemplo n.º 7
0
 protected VisualLuaValue(LuaForAGSEditorComponent editorComponent, string ns)
 {
     _editorComponent = editorComponent;
     _namespace = ns;
 }
Ejemplo n.º 8
0
 public VisualLuaBooleanValue(LuaForAGSEditorComponent editorComponent, string ns)
     : base(editorComponent, ns)
 {
 }
Ejemplo n.º 9
0
 public VisualLuaTableValue(LuaForAGSEditorComponent editorComponent, string ns)
     : base(editorComponent, ns)
 {
     this.Editable = false;
 }
Ejemplo n.º 10
0
        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();
        }