From 3f288c4f90a053cbee2c8d6c91beddb068309163 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 2 Apr 2021 14:57:25 +0200 Subject: [PATCH] tour:: allow help extensions, and slide_url command --- tour.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tour.cpp b/tour.cpp index 25ca7f61..917e26a1 100644 --- a/tour.cpp +++ b/tour.cpp @@ -35,7 +35,7 @@ EX int currentslide; enum presmode { pmStartAll = 0, pmStart = 1, pmFrame = 2, pmStop = 3, pmKey = 4, pmRestart = 5, - pmAfterFrame = 6, + pmAfterFrame = 6, pmHelpEx = 7, pmGeometry = 11, pmGeometryReset = 13, pmGeometryStart = 15, pmGeometrySpecial = 16 }; @@ -96,6 +96,13 @@ EX void slide_restore_all() { } } +EX void slide_url(presmode mode, char key, string text, string url) { + if(mode == pmHelpEx) + help_extensions.push_back(help_extension{key, text, [url] () { + open_url(url); + }}); + } + /** \brief an auxiliary function to enable a visualization in the Canvas land */ EX void setCanvas(presmode mode, char canv) { if(mode == pmStart) { @@ -177,12 +184,14 @@ string get_subname(const string& s, const string& folder) { /** \brief display the help text for the current slide if texts enabled */ EX void slidehelp() { - if(texts && slides[currentslide].help[0]) + if(texts && slides[currentslide].help[0]) { gotoHelp( help = helptitle(XLAT(get_slidename(slides[currentslide].name)), 0xFF8000) + XLAT(slides[currentslide].help) ); + presentation(pmHelpEx); + } } /** \brief return from a subgame launched while in presentation */