Skip to content

Commit a854e8d

Browse files
committed
added inspectPane
- TOC button on last page - inspectPane
1 parent bfeb1e2 commit a854e8d

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

Tutorial-o-Matic/src/main/groovy/ToM.groovy

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ToM{
3131
copyPaste : 'ToM_copy' ,
3232
select : 'ToM_select' ,
3333
openMap : 'ToM_openMap' ,
34+
openTutMap: 'ToM_openTutMap',
3435
]
3536

3637
static final exeHowIcons = ['emoji-1F507', 'emoji-2328', 'emoji-1F5B1']
@@ -107,14 +108,17 @@ class ToM{
107108
case styles.openMap:
108109
addOpenMapPane(myPanel, tutNode)
109110
break
111+
case styles.openTutMap:
112+
addInspectPane(myPanel, tutNode)
113+
break
110114
default:
111115
ui.informationMessage('node style not defined')
112116
break
113117
}
114118
startingNewPage = false
115119
if(interruptLoop) break
116120
}
117-
if(!interruptLoop) addNextPagePane(myPanel, null)
121+
if(!interruptLoop) addNextPagePane(myPanel, nextTutNodes[-1], false, false)
118122
tomui.adjustHeight(myPanel, doClear)
119123
}
120124

@@ -144,14 +148,14 @@ class ToM{
144148
addPageTitle(myP, nodo.text)
145149
}
146150

147-
def static addNextPagePane(myP, lastNode, boolean included = false){
151+
def static addNextPagePane(myP, lastNode, boolean included = false, boolean showNextButton = true){
148152
def closeLabel = 'Stop tutorial'
149153
def closeToolTip = 'Click to stop the tutorial and close the tutorial tab'
150154
def nextLabel = 'Next page'
151155
def nextToolTip = 'Click to continue to the next page of the tutorial'
152-
def bttnAction = lastNode? { e -> fillPage(myP, lastNode, included, true) } : null
153-
def tocLabel = 'Table of Contents'
154-
def tocToolTip = 'Click to show the Table of Contents of the tutorial'
156+
def bttnAction = showNextButton? { e -> fillPage(myP, lastNode, included, true) } : null
157+
def tocLabel = 'Table of Contents'
158+
def tocToolTip = 'Click to show the Table of Contents of the tutorial'
155159
def tocBttnAction = { e -> showTOC(myP,lastNode) }
156160

157161
def nextButtonPanel = tomui.getNextButtonPanel(tabName, closeLabel, closeToolTip, nextLabel, nextToolTip , bttnAction, tocLabel, tocToolTip, tocBttnAction)
@@ -412,6 +416,22 @@ class ToM{
412416
myP.add(buttonPanel, tomui.GBC)
413417
}
414418

419+
def static addInspectPane(myP, nodo){
420+
def msgHtml = "Click to inspect this page in the tutorial map"
421+
def bttnText = "inspect"
422+
def bttnToolTip = "Click to select the page's source nodes"
423+
def bttnAction = { e ->
424+
def pageNode = nodo.parent
425+
def m = c.mapLoader(nodo.map.file).withView()//.selectNodeById(pageNodeId)
426+
m.load()
427+
pageNode.pathToRoot*.folded = false
428+
c.select(pageNode)
429+
}
430+
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
431+
myP.add(buttonPanel, tomui.GBC)
432+
}
433+
434+
415435
// end:
416436

417437
// region: Getting map

Tutorial-o-Matic/src/main/groovy/ToM_ui.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class ToM_ui{
291291
toolTipText : closeToolTip,
292292
actionPerformed : {closeTab(tabName)},
293293
)
294-
if(tocButtonAction && nextButtonAction){
294+
if(tocButtonAction /* && nextButtonAction */ ){
295295
button(
296296
label : tocLabel,
297297
constraints : CENTER,

0 commit comments

Comments
 (0)