Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set/Get Bookmark in QM Editor item
#1
Bookmarks (tags) at specific points (lines) of an item

Function SetBookm
Code:
Copy      Help
str si.getmacro(getopt(itemid) 1)
str caller.getmacro(getopt(itemid 1) 1);err    caller=si
if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : <open>%s</open>%s" NowT si _error.place si caller

;www.quickmacros.com/forum/viewtopic.php?p=31513

int c=GetQmCodeEditor

str newText=F" $BkM []"
;int j=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
;SendMessage c SCI.SCI_GOTOPOS j+len(newText)-2 0

int j=SendMessage(c SCI.SCI_GETCURRENTPOS 0 0)
int l=SendMessage(c SCI.SCI_LINEFROMPOSITION j 0)
SendMessage c SCI.SCI_GOTOLINE l 0
SendMessage c SCI.SCI_INSERTTEXT -1 newText
j=SendMessage(c SCI.SCI_GETLINEENDPOSITION l 0)
SendMessage c SCI.SCI_GOTOPOS j 0
0.25
int x y cx cy
GetCaretXY x y cx cy
ShowTooltip "Type the bookmark's label" 3 x y+cy 0 1

Function GetBookm
Code:
Copy      Help
str si.getmacro(getopt(itemid) 1)
str caller.getmacro(getopt(itemid 1) 1);err    caller=si
if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : <open>%s</open>%s" NowT si _error.place si caller
;www.quickmacros.com/forum/viewtopic.php?p=31513

int c=GetQmCodeEditor

ARRAY(int) lines
int i=QMEFindAll("$BkM" lines)
if i=0
,beeS 1000 300
,Task_Message "There exist no Bookmarks !" 0 1170 2
,ret
str items s
int lens
for i 0 lines.len
,lens=SendMessage(c SCI.SCI_GETTEXTLENGTH lines[i] 0)
,s.fix(SendMessage(c SCI.SCI_GETLINE lines[i] s.all(lens)))
,_s.get(s 6)
,items.formata("%s" _s)
;,out F"{i+1}. {lines[i]}"

i=ListDialog(items "Select the Label of a Bookmark to Go" "Go to Bookmark" 128)
;outt F"{i} - {lines[i-1]}"
SendMessage(c SCI.SCI_GOTOLINE lines[i-1] 0)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)