aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-11-14 15:32:20 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-14 20:55:04 +0000
commitfce09c5c72afb6aa45a201844ddeb8dae98f4c56 (patch)
tree8eb0aec01ae36c81ea70b519f2c9bd231424d312 /tools/viewer
parent76589f9b9bec198eded10ded7ae27de7741b5601 (diff)
Viewer: backspace jumps directly to the slide picker
Bug: skia: Change-Id: I8107358e49ef20bf26ddf6a6dbb21efc07f167e7 Reviewed-on: https://skia-review.googlesource.com/71460 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tools/viewer')
-rw-r--r--tools/viewer/Viewer.cpp22
-rw-r--r--tools/viewer/Viewer.h1
2 files changed, 23 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();
diff --git a/tools/viewer/Viewer.h b/tools/viewer/Viewer.h
index 8f248320d5..f121c17994 100644
--- a/tools/viewer/Viewer.h
+++ b/tools/viewer/Viewer.h
@@ -78,6 +78,7 @@ private:
SkPaint fImGuiFontPaint;
SkPaint fImGuiGamutPaint;
bool fShowImGuiDebugWindow;
+ bool fShowSlidePicker;
bool fShowImGuiTestWindow;
bool fShowZoomWindow;