private void UpdateStructHighlighting() { StringBuilder sb = new StringBuilder(5000); foreach (Script script in _agsEditor.GetAllScriptHeaders()) { foreach (ScriptStruct thisClass in script.AutoCompleteData.Structs) { sb.Append(thisClass.Name + " "); } foreach (ScriptEnum thisEnum in script.AutoCompleteData.Enums) { sb.Append(thisEnum.Name + " "); } } this.scintilla.SetClassNamesList(sb.ToString()); }
IList <Script> IAGSEditor.GetAllScriptHeaders() { return(_agsEditor.GetAllScriptHeaders()); }
private void GoToDefinition(string structName, string memberName) { ScriptToken found = null; Script foundInScript = null; List <Script> scriptsToSearch = new List <Script>(); scriptsToSearch.AddRange(_agsEditor.GetAllScriptHeaders()); // all scripts! scriptsToSearch.Add(_script); foreach (Script script in scriptsToSearch) { found = FindTokenInScript(script, structName, memberName); foundInScript = script; if ((found != null) && (script.IsHeader)) { // Always prefer the definition in the main script to // the import in the header Script mainScript = _agsEditor.CurrentGame.RootScriptFolder.FindMatchingScriptOrHeader(script); if (mainScript != null) { if (!mainScript.AutoCompleteData.Populated) { AutoComplete.ConstructCache(mainScript, _agsEditor.GetImportedScriptHeaders(mainScript)); } ScriptToken foundInScriptBody = FindTokenInScript(mainScript, structName, memberName); if (foundInScriptBody != null) { found = foundInScriptBody; foundInScript = mainScript; } } } if (found != null) { break; } } if ((found == null) && (structName == null)) { found = FindTokenAsLocalVariable(memberName, false); } if (found != null) { if (foundInScript.FileName == AGSEditor.BUILT_IN_HEADER_FILE_NAME) { Factory.GUIController.LaunchHelpForKeyword(_goToDefinition); } else if (foundInScript.FileName == Tasks.AUTO_GENERATED_HEADER_NAME) { Factory.GUIController.ShowMessage("This variable is internally defined by AGS and probably corresponds to an in-game entity such as a Character or Inventory Item.", MessageBoxIcon.Information); } else if (foundInScript.FileName == GlobalVariablesComponent.GLOBAL_VARS_HEADER_FILE_NAME) { IGlobalVariablesController globalVariables = (IGlobalVariablesController)Factory.ComponentController.FindComponentThatImplementsInterface(typeof(IGlobalVariablesController)); globalVariables.SelectGlobalVariable(_goToDefinition); } else { Factory.GUIController.ZoomToFile(foundInScript.FileName, ZoomToFileZoomType.ZoomToCharacterPosition, found.StartsAtCharacterIndex); } } }