} //mxd #endregion #region ================== Constructor / Disposer // Constructor public ScriptLumpDocumentTab(ScriptEditorPanel panel, string lumpname, ScriptConfiguration config) : base(panel, config) { // Initialize if (lumpname == MapManager.CONFIG_MAP_HEADER) { this.lumpname = MapManager.TEMP_MAP_HEADER; this.ismapheader = true; } else { this.lumpname = lumpname; this.ismapheader = false; } // Load the lump data MemoryStream stream = General.Map.GetLumpData(this.lumpname); if (stream != null) { editor.SetText(stream.ToArray()); //mxd editor.ClearUndoRedo(); } // Set title SetTitle(ismapheader ? General.Map.Options.CurrentName : this.lumpname.ToUpper()); }
internal ScriptResourceDocumentTab(ScriptEditorPanel panel, ScriptResource resource, ScriptConfiguration config) : base(panel, config) { // Store resource source = resource; // Load the data MemoryStream stream = source.Resource.LoadFile(source.Filename, source.LumpIndex); if (stream != null) { hash = MD5Hash.Get(stream); editor.SetText(stream.ToArray()); editor.Scintilla.ReadOnly = source.IsReadOnly; editor.ClearUndoRedo(); } else { General.ErrorLogger.Add(ErrorType.Warning, "Failed to load " + source.ScriptType + " resource \"" + source.Filename + "\" from \"" + source.Resource.Location.GetDisplayName() + "\"."); } // Set title and tooltip tabtype = ScriptDocumentTabType.RESOURCE; filepathname = source.FilePathName; SetTitle(source.ToString()); this.ToolTipText = filepathname; // Update navigator panel.ShowErrors(UpdateNavigator(), true); }
public new event EventHandler OnTextChanged; //mxd #endregion #region ================== Constructor // Constructor protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config) { // Keep panel and config this.panel = panel; this.config = config; //mxd // Make the script control editor = new ScriptEditorControl(); editor.Location = new Point(EDITOR_BORDER_LEFT, EDITOR_BORDER_TOP); editor.Size = new Size(this.ClientSize.Width - EDITOR_BORDER_LEFT - EDITOR_BORDER_RIGHT, this.ClientSize.Height - EDITOR_BORDER_TOP - EDITOR_BORDER_BOTTOM); editor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; editor.Name = "editor"; editor.TabStop = true; editor.TabIndex = 1; this.Controls.Add(editor); // Bind events editor.OnExplicitSaveTab += panel.ExplicitSaveCurrentTab; editor.OnOpenScriptBrowser += panel.OpenBrowseScript; editor.OnOpenFindAndReplace += panel.OpenFindAndReplace; editor.OnFindNext += panel.FindNext; editor.OnFindPrevious += panel.FindPrevious; //mxd editor.OnTextChanged += editor_TextChanged; //mxd //mxd. Bind functionbar events editor.OnFunctionBarDropDown += functionbar_DropDown; //mxd. Setup styles editor.SetupStyles(config); }
protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config) { this.panel = panel; this.config = config; editor = new ScriptEditorControl(); this.Controls.Add(editor); }
// Constructor public ScriptFileDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config) : base(panel, config) { string ext = ""; // Initialize this.filepathname = ""; if (config.Extensions.Length > 0) { ext = "." + config.Extensions[0]; } SetTitle("Untitled" + ext); editor.ClearUndoRedo(); }
public new event EventHandler OnTextChanged; //mxd #endregion #region ================== Constructor // Constructor protected ScriptDocumentTab(ScriptEditorPanel panel, ScriptConfiguration config) { // Keep panel and config this.panel = panel; this.config = config; //mxd this.BackColor = SystemColors.ControlLightLight; //mxd // Make the script control editor = new ScriptEditorControl(); editor.Location = new Point(EDITOR_BORDER_LEFT, EDITOR_BORDER_TOP); editor.Size = new Size(this.ClientSize.Width - EDITOR_BORDER_LEFT - EDITOR_BORDER_RIGHT, this.ClientSize.Height - EDITOR_BORDER_TOP - EDITOR_BORDER_BOTTOM); editor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; editor.Name = "editor"; editor.TabStop = true; editor.TabIndex = 1; this.Controls.Add(editor); // Bind events editor.OnExplicitSaveTab += panel.ExplicitSaveCurrentTab; editor.OnOpenScriptBrowser += panel.OpenBrowseScript; editor.OnOpenFindAndReplace += panel.OpenFindAndReplace; editor.OnFindNext += panel.FindNext; editor.OnFindPrevious += panel.FindPrevious; //mxd editor.OnFindNextWrapAround += panel.FindNextWrapAround; editor.OnFindPreviousWrapAround += panel.FindPreviousWrapAround; editor.OnTextChanged += editor_TextChanged; //mxd editor.OnGoToLine += panel.GoToLine; //mxd editor.OnCompileScript -= Compile; //mxd //mxd. Bind functionbar events editor.OnFunctionBarDropDown += functionbar_DropDown; //mxd. Setup styles editor.SetupStyles(config); //mxd. Apply panel settings editor.ShowWhitespace = panel.ShowWhitespace; editor.WrapLongLines = panel.WrapLongLines; //mxd. Set icon this.ImageIndex = panel.Icons.GetScriptIcon(config.ScriptType); }
// Constructor public ScriptDocumentTab(ScriptEditorPanel panel) { // Keep panel this.panel = panel; // Make the script control editor = new ScriptEditorControl(); editor.Location = new Point(EDITOR_BORDER_LEFT, EDITOR_BORDER_TOP); editor.Size = new Size(this.ClientSize.Width - EDITOR_BORDER_LEFT - EDITOR_BORDER_RIGHT, this.ClientSize.Height - EDITOR_BORDER_TOP - EDITOR_BORDER_BOTTOM); editor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; editor.Name = "editor"; editor.TabStop = true; editor.TabIndex = 0; this.Controls.Add(editor); // Bind events editor.OnExplicitSaveTab += panel.ExplicitSaveCurrentTab; editor.OnOpenScriptBrowser += panel.OpenBrowseScript; editor.OnOpenFindAndReplace += panel.OpenFindAndReplace; editor.OnFindNext += panel.FindNext; }
public void Setup(ScriptEditorPanel scriptpanel, Dictionary<ScriptType, HashSet<ScriptResource>> resources) { this.scriptpanel = scriptpanel; projecttree.ImageList = scriptpanel.Icons.Icons; // Link icons resourcesperlocation = new Dictionary<string, Dictionary<ScriptType, HashSet<ScriptResource>>>(); foreach(HashSet<ScriptResource> group in resources.Values) { foreach(ScriptResource resource in group) { string key = resource.Resource.Location.location; if(!resourcesperlocation.ContainsKey(key)) resourcesperlocation.Add(key, new Dictionary<ScriptType, HashSet<ScriptResource>>()); if(!resourcesperlocation[key].ContainsKey(resource.ScriptType)) resourcesperlocation[key].Add(resource.ScriptType, new HashSet<ScriptResource>()); resourcesperlocation[key][resource.ScriptType].Add(resource); } } // Add used script types to the filter combobox string curfilter = filterbytype.SelectedText; filterbytype.Items.Clear(); filterbytype.Items.Add(new ScriptTypeItem { Name = "All", Type = ScriptType.UNKNOWN }); usedscripttypes = new List<ScriptTypeItem>(); foreach(ScriptType st in resources.Keys) usedscripttypes.Add(new ScriptTypeItem { Name = Enum.GetName(typeof(ScriptType), st), Type = st }); usedscripttypes.Sort((i1, i2) => String.Compare(i1.Name, i2.Name, StringComparison.Ordinal)); int toselect = 0; for(int i = 0; i < usedscripttypes.Count; i++) { if(usedscripttypes[i].Name == curfilter) toselect = i; filterbytype.Items.Add(usedscripttypes[i]); } filterbytype.SelectedIndex = toselect; // This will also trigger tree update }
internal ScriptResourceDocumentTab(ScriptEditorPanel panel, ScriptResource resource, ScriptConfiguration config) : base(panel, config) { source = resource; filepathname = source.FilePathName; this.ToolTipText = filepathname; }