ID:1830028
 
I wrote a quick tool using AutoIt to make function navigations faster in Dream Seeker.

IFRAME: https://www.youtube.com/embed/asZ8eCIUqBU

Old way: Copy function name, open GoTo dialog, paste name, hit F3 a bunch of times, realize you have to change the option to "all files", hit F3 a bunch more and then repeat for every function search for the rest of your life.

New way: Double click function name and hit ctrl+s. Done.

It's a bit of a hack but it seems to be working consistently for me. Only thing it does (currently) is navigate directly to the highlighted function. My syntax preference will likely not be similar to your own so you'll want to add/update your own version of the 'SearchFilesUsingCurl' function.

Use at your own risk and what not. There seems to be a sticky key issues with the Ctrl key while debugging and I haven't figured it out yet. Just hit ctrl a couple times to fix.

There's a fair amount of potential with a "overlaying" tool like this one but I don't have any plans to invest in it right now.

How it works:
- The tool runs in the background (see autoit icon in systray to exit).
- When you hit ctrl+s with a function name highlighted, it saves the project (to ensure files on disk are latest), it crawls the BYOND working directory and searches all the .dm files looking for a matching function name. When found, it navigates you to the appropriate .dm file and then makes a call to the GoTo dialog to get you to the correct line.

- Couple notes.
- The tool interacts with the UI and has to use a couple 'SENDKEYS' to make everything work which is what makes it hacky.
- It performs very well and very consistently on my machine but your mileage may very.
- Again, it's not tested all that much. Only tested on high performing Win 7 machine with latest beta build of AutoIt and BYOND.
- The awful ding sound comes from BYOND/Windows when the tool (or whenever) hits ENTER in the tree view.

- Open the config.txt file and specify the full path to your project folder containing the .dm files.
Example: ProjectPath,E:\MyEDrive\Projects\AutoIt\BYOND IDE Helper\v0.1\Example Game\Dungeon Dominus
- Update the search function to match your syntax
- Save and close.
- Launch the 'BYOND IDE Helper.au3' (or .exe of you compiled it)
- Double click a method name so only the name is selected. We don't want the curely braces or anything else.
- Hit ctrl+s on your keyboard

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=BYOND IDE Helper
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Poplava, Copyright 2015
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include-once
#include <..\..\Libs\Common_Lib.au3>

#include <ButtonConstants.au3>
#include <Clipboard.au3>
#include <ColorConstants.au3>
#include <Constants.au3>
#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <Misc.au3>
#include <ScreenCapture.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
#include <TrayConstants.au3>
#include <EditConstants.au3>
#include <WinAPIDiag.au3>
#include <File.au3>

Global $g_bIsRunning = 1;
Global $g_bIsBYONDHelperGUIRunning = False
Global $g_sProjectPath
Global $g_sSearchType = "Tab"

Opt("WinTitleMatchMode", 2)
Opt("TrayMenuMode", 3)

Func Main()
Local $idExit = TrayCreateItem("Exit")
TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu.
While $g_bIsRunning
Switch TrayGetMsg()
Case $idExit ; Exit the loop.
ExitLoop
EndSwitch
WEnd
EndFunc

Func Find()
Local $hDreameMaker = WinActive ( "Dream Maker" )

If $hDreameMaker = 0 Then
Return
EndIf

SEND ("^+s") ; Save all so recent edits won't mess with line by line search
SEND ("^c") ; Copy the highlighted text

; RegularExpression used for finding functions is defined by the user in the config file.
; Kept the search logic simple
Local $aResults = SearchFiles( $g_sProjectPath, ClipGet() )

If $aResults == -1 Then
HotKeySet ( "^s", "Find" ) ; otherwise it gets stuck down
Return
EndIf

ControlClick ( $hDreameMaker, "", "[CLASS:SysTabControl32; INSTANCE:2]") ; Put focus in the File/Object tab view
SEND ("{LEFT}") ; In case we are on the object tab, move us to the File tab
ControlClick ( $hDreameMaker, "", "SysTreeView321") ; Put focus in the treeview
Local $iNodeCount = ControlTreeView ( $hDreameMaker, "", "[CLASS:SysTreeView32; INSTANCE:1]", "GetItemCount" ) ; Get a count of all nodes in tree
Local $i = 1

; Loop through all nodes in tree looking for a matching node that we returned by SearchFiles
While $i < $iNodeCount
Local $sNodeName = ControlTreeView ( $hDreameMaker, "", "[CLASS:SysTreeView32; INSTANCE:1]", "GetText", "#" & $i ) ; Get the name of each node

; Does this node match the one returned by SearchFiles?
If $sNodeName == $aResults[0] Then
ControlTreeView ( $hDreameMaker, "", "[CLASS:SysTreeView32; INSTANCE:1]", "Select", "#"&$i ) ; Select the matching node (filename.dm) and stop looking.
ExitLoop
EndIf
$i = $i + 1
WEnd

SEND ("{ENTER}") ; Navigate to the file (filename.dm); Note: Only way I could figure out how to do this and it makes an annoying ding.
SEND ("^g") ; Open the Goto Line# dialog
Local $hGotoDialog = WinWaitActive ( "Goto Line", "", 5 )
ControlSetText ($hGotoDialog, "", "[CLASS:Edit; INSTANCE:1]", $aResults[1] )
ControlClick ( $hGotoDialog, "", "[CLASS:Button; INSTANCE:1]" )
HotKeySet ( "^s", "Find" ) ; otherwise it gets stuck down
EndFunc

Func GetTabCount($sLine)
Local $iTabCount = 0
Local $aListOfTabs = StringSplit ( $sLine, @TAB, 1 )

For $a in $aListOfTabs
If $a == "" Then
$iTabCount = $iTabCount + 1
EndIf
Next

Return $iTabCount
EndFunc

Func SearchFiles($sFilePath, $sSearchString)
Local $aListOfFileNames = _FileListToArrayRec($sFilePath, "*.dm", $FLTAR_FILES,$FLTAR_RECUR, $FLTAR_SORT)
Local $aListOfFiles = _FileListToArrayRec($sFilePath, "*.dm", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT, $FLTAR_FULLPATH)
Local $aResults[2]

If UBound ( $aListOfFiles ) = 0 Then
Return -1; Nothing to search
EndIf

Local $iLineNumber ;$aResults[2]

; Loop through all the .dm files we found
For $i = 1 to UBound($aListOfFiles) - 1
Local $aListOfLinesInFile = FileReadToArray ( $aListOfFiles[$i] )

If $g_sSearchType == "curl" Then
$aResults = SearchFilesUsingCurl ( $aListOfLinesInFile, $sSearchString )
If UBound($aResults) > 0 Then
$aResults[0] = $aListOfFileNames[$i]
Return $aResults
EndIf
EndIf
Next

Return -1
EndFunc

;
; NOTE: This is where the magic happens in terms of finding the functions
; I use curely braces in my code so you'll need to update this function to handle your code style.
;
Func SearchFilesUsingCurl ( $aListOfLinesInFile, $sSearchString )
Local $bIsInProc = False
Local $aResults[2]
Local $iProcTabLevel = 0
For $j = 0 to UBound($aListOfLinesInFile) - 1
Local $sLine = $aListOfLinesInFile[$j]
Local $sLineWithoutWS = StringStripWS ( $sLine, $STR_STRIPALL )

; Only search while inside of a proc block
If $bIsInProc = False And $sLineWithoutWS == "proc" Then
$bIsInProc = True
$iProcTabLevel = GetTabCount($sLine)
ContinueLoop
EndIf

If $bIsInProc = False Then
ContinueLoop
EndIf

Local $iLineTabLevel = GetTabCount($sLine)

; Only look at one level below proc and ignore all else.
If $iLineTabLevel <> $iProcTabLevel+1 Then
ContinueLoop
EndIf

; Make sure the line has one or more tabs followed by the function name. This prevents finding function names in things like comments
Local $iMatch = StringRegExp($sLine, "\t+" & $sSearchString & "\(", 1)

If UBound($iMatch) > 0 Then
$aResults[1] = $j+1
Return $aResults
EndIf
Next

Return -1
EndFunc

Func GetLinesFromFile($sPath)
Local $listOfLines[1]
;
; If the file exists
; else, return @Error
;
If FileExists($sPath) Then
Local $oFile = FileOpen($sPath, 0)
;
; Loop through all lines in file (test case paths)
;
While 1
Local $sLine = FileReadLine($oFile)
;
; Reached end of file?
;
If @error = -1 Then
ExitLoop
EndIf
;
; Does caller want to add blank lines or not?
;
If StringIsSpace ( $sLine ) = True Then
ContinueLoop
EndIf

_ArrayAdd($listOfLines, $sLine)
$listOfLines[0] = $listOfLines[0] + 1
Wend
FileClose($oFile)
Return $listOfLines
Else
Return @Error ; Returns 0 if path/file does not exist.
EndIf
EndFunc

Func LoadConfigFile()
Local $listOfLines = Common_GetLinesFromFile( @WorkingDir & "\Config.txt" )

If UBound ( $listOfLines ) = 0 Then
SaveSettingsToDisk(); Save defaults
Return ; Nothing to load
EndIf

For $i = 1 to UBound($listOfLines) - 1
Local $sArrayOfAttribs = StringSplit($listOfLines[$i], ",")
Local $sAttribute = StringLower ( $sArrayOfAttribs[1] )
Local $sValue = StringLower ( $sArrayOfAttribs[2] )
If $sAttribute == "projectpath" Then
$g_sProjectPath = $sValue
ElseIf $sAttribute == "searchtype" Then
$g_sSearchType = $sValue
EndIf
Next
EndFunc

Func SaveSettingsToDisk()
Local $hFileOpen = FileOpen ( @WorkingDir & "\Config.txt", 10 ); 10 = CREATE & OVERWRITE
FileWriteLine ( $hFileOpen, "ProjectPath,?")
FileClose ( $hFileOpen )
EndFunc

Func Init()
HotKeySet ( "^s", "Find" )
LoadConfigFile()
EndFunc

Init()
Main()


config.txt (put in same directory as the tool.)
ProjectPath,E:\Projects\AutoIt\BYOND IDE Helper\v0.1\Example Game\Dungeon Dominus
SearchType,Curl


Note: Tool and config can be placed anywhere as long as they are together.