I often find myself needing to move around various functions in a .wbt file. Though I've tried to be consistent with my naming, I don't always remember the *exact* name of the function I'm looking for, so I find myself doing a Find for '#defineFunction' to get a list of all of the functions in the file. However the find results UI is cluttered with the name of the file and line number that I have to look past/parse my way through to find the function name I'm looking for.
With the recent-ish changes to the editor to add projects (which makes moving from file to file very easy), I thought it would also be useful to have a navigator which lists all SubRoutines/DefineFunction instances in the current file - without the clutter of the filenames and line numbers - just a simple list of names. Just as with the find results, double clicking the name would jump to that function in the file. Perhaps it could be a split portion of the project file lister? Top half is the list of files in the project, the bottom half the names of Subroutines/Functions ...
Anyway, just thought I would toss the idea out there.
Regards,
Micheal
It is good to hear that you find the Projects Tree useful. I know I have found it to be a big productivity boosters.
We have actually been thinking about adding something similar to what you describe to WinBatch Studio. The idea is that we add a combo like box that contains the names of all the USF/UDS's in the current file. Selecting a name would cause the cursor to jump to the selected UDF/UDS's definition while also scrolling the definition into view. If this sounds familiar, it is because the idea was stolen from Microsoft Visual Studio.
Not stolen! "Inspired By ..." :D
That would be very welcome.
...and while you are at it please provide a 'vi' emulator option within WinBatch Studio. Just the basic stuff. I would use it if you did :)
Thanks.
Jim
I dunno if this is helpful, but I've been using the following to navigate around large programs for years:
; JumpTo.wbt a winbatch studio "plug in"
;
; To use, set up a "tool" by using Debug / Customize Tools
; Menu text: &JumpTo
; Command: JumpTo.wbt
;
; Then use View / Toolbars / Commands to drag a button to the
; tool bar for this new "tool." This way, you can run
; JumpTo with one click.
;
;
MInfo = MouseInfo(2)
SaveLine = wGetLineNo()
SaveCol = wGetColNo()
if !isdefined(SavedTime) then SavedTime = '2000:01:01:00:00:00'
if !isdefined(SavedFile) then SavedFile = ''
errormode(@off)
x = TimeDiffSecs(timeymdhms(),SavedTime) < 60 && SavedFile == wGetFileName()
errormode(@on)
if x
wStatusMsg("Reusing cached JumpTo position list")
FList = SavedjumpList
FLisn = itemcount(FList,@tab)
else
FList=''
FLisn = 0
endif
if FList == ''
gosub ComputeFlist
SavedJumpList = FList
SavedTime = timeymdhms()
SavedFile = wGetFileName()
endif
if FList > ''
sx = int( itemextract(1,minfo,' ') / 1000.0 * winmetrics(0) / winmetrics(-6) ) - 3
sy = int( itemextract(2,minfo,' ') / 1000.0 * winmetrics(1) / winmetrics(-5) ) + 9
if !itemlocate("dlgproc1",intcontrol(77,103,0,0,0),@tab) then gosub DlgProc1
;intcontrol(49,1,999,0,0) ; allow close box
DlgFormat=`WWWDLGED,6.1`
DlgCaption=`Jump To2`
DlgX=sx
DlgY=sy
DlgWidth=170
DlgHeight=241
DlgNumControls=002
DlgProcedure=`DlgProc1`
DlgFont=`Microsoft Sans Serif|6656|70|34`
DlgFont=`Courier New|8192|70|49`
DlgTextColor=`DEFAULT`
DlgBackground=`DEFAULT,DEFAULT`
DlgConfig=0
Dlg001=`001,001,164,222,ITEMBOX,FList,DEFAULT,DEFAULT,1,256,DEFAULT,DEFAULT,DEFAULT`
Dlg002=`011,225,142,010,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("Dlg")
if ButtonPushed < 999
x = itemextract(2,FList,"|")
if x == 0
s= `The JumpTo feature lets you`
s=s:@lf:`jump to noteable file positions`
s=s:@lf:`with a single click. Positions`
s=s:@lf:`that JumpTo sees are:`
s=s:@lf:``
s=s:@lf:` #DefineFunction `
s=s:@lf:` #DefineSubroutine `
s=s:@lf:` :labels `
s=s:@lf:` ;:labeled comments`
s=s:@lf:``
s=s:@lf:`The list of positions is cached`
s=s:@lf:`for one minute.`
display(19, "JumpTo", s)
SavedTime = '2000:01:01:00:00:00'
AroundAgain = 1
else
wGotoLine(x)
wHome()
endif
else
wGotoLine(SaveLine)
wGotoCol(SaveCol)
endif
else
wGotoLine(SaveLine)
wGotoCol(SaveCol)
display(3,"Jump To","none found")
endif
exit
:ComputeFList
wTopOfFile()
errormode(@off)
SaveText = clipget()
errormode(@on)
tab = ''
wClearSel()
x = 0
while wFind("(#define(subroutine|function) |^[ \x09]*;?:)",1,0,1,0)
x = x + 1
wStatusMsg("Creating JumpTo position list ":x)
wCopyLine()
s = strtrim(strreplace(clipget(),@tab,' '))
if strsub(s,1,1)=="#"
l = strlower(strsub(s,8,1))
s = strtrim(strsub(s,strindexnc(s," ",1,0)+1,-1))
q = strindex(s,")",1,0)
if q == 0 then continue
s = strtrim(strsub(s,1,q))
else
if strindex(s,';:',1,0)
l = ';'
s = strsub(strtrim(strsub(s,1, strindex(s,@cr,1,0)-1 )) ,3,-1)
else
l = ':'
s = strsub(strtrim(strsub(s,1, strindex(s,@cr,1,0)-1 )) ,2,-1)
endif
endif
FList=strcat(FList,tab, s,strfill(' ',90),'|',wGetLineNo(),'|',l)
wDownLine()
wHome()
tab = @tab
FLisn = FLisn + 1
endwhile
if SaveText != 0 then clipput(SaveText)
FList = itemsort(Flist,@tab)
for i = 1 to Flisn
s = itemextract(i,FList,@tab)
s = strcat(itemextract(3,s,'|'), ' ', itemremove(3,s,'|') )
Flist = itemreplace(s,i,FList,@tab)
next
Flist = Flist : @tab:"<<help>>":strfill(' ',90):"|0"
wStatusMsg("JumpTo position list ready")
return
:DlgProc1
#definesubroutine DlgProc1(h,e,c,x1,x2)
switch e
case 0
dialogprocoptions(h,2,1)
dialogprocoptions(h,7,1)
return -2
case 2
return 999
case 7
return itemlocate(dialogcontrolget(h,1,6),dialogcontrolget(h,1,5),@tab)
endswitch
return 999
#endsubroutine
return
Haven't tried it yet but looks good and thanks for the post.
Just to add my 2¢...love the Projects tree in the studio! :)