aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer/Viewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/viewer/Viewer.cpp')
-rw-r--r--tools/viewer/Viewer.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 8ca27fecd6..2108b09cb5 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -265,6 +265,7 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
, fDisplayStats(false)
, fRefresh(false)
, fShowImGuiDebugWindow(false)
+ , fShowSlidePicker(false)
, fShowImGuiTestWindow(false)
, fShowZoomWindow(false)
, fLastImage(nullptr)
@@ -336,6 +337,18 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
this->fShowImGuiDebugWindow = !this->fShowImGuiDebugWindow;
fWindow->inval();
});
+ // Command to jump directly to the slide picker and give it focus
+ fCommands.addCommand('/', "GUI", "Jump to slide picker", [this]() {
+ this->fShowImGuiDebugWindow = true;
+ this->fShowSlidePicker = true;
+ fWindow->inval();
+ });
+ // Alias that to Backspace, to match SampleApp
+ fCommands.addCommand(Window::Key::kBack, "Backspace", "GUI", "Jump to slide picker", [this]() {
+ this->fShowImGuiDebugWindow = true;
+ this->fShowSlidePicker = true;
+ fWindow->inval();
+ });
fCommands.addCommand('g', "GUI", "Toggle GUI Demo", [this]() {
this->fShowImGuiTestWindow = !this->fShowImGuiTestWindow;
fWindow->inval();
@@ -1218,11 +1231,20 @@ void Viewer::drawImGui(SkCanvas* canvas) {
}
}
+ if (fShowSlidePicker) {
+ ImGui::SetNextTreeNodeOpen(true);
+ }
+
if (ImGui::CollapsingHeader("Slide")) {
static ImGuiTextFilter filter;
static ImVector<const char*> filteredSlideNames;
static ImVector<int> filteredSlideIndices;
+ if (fShowSlidePicker) {
+ ImGui::SetKeyboardFocusHere();
+ fShowSlidePicker = false;
+ }
+
filter.Draw();
filteredSlideNames.clear();
filteredSlideIndices.clear();