tools/skui: put all enums in a common namespace
Change-Id: Icd331e8946d80652750b8b6ea0db65f5f676ac3e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238058
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 28aa9dc..eaf8358 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -335,7 +335,7 @@
fWindow->inval();
});
// Alias that to Backspace, to match SampleApp
- fCommands.addCommand(Window::Key::kBack, "Backspace", "GUI", "Jump to slide picker", [this]() {
+ fCommands.addCommand(skui::Key::kBack, "Backspace", "GUI", "Jump to slide picker", [this]() {
this->fShowImGuiDebugWindow = true;
this->fShowSlidePicker = true;
fWindow->inval();
@@ -385,17 +385,17 @@
break;
}
});
- fCommands.addCommand(Window::Key::kRight, "Right", "Navigation", "Next slide", [this]() {
+ fCommands.addCommand(skui::Key::kRight, "Right", "Navigation", "Next slide", [this]() {
this->setCurrentSlide(fCurrentSlide < fSlides.count() - 1 ? fCurrentSlide + 1 : 0);
});
- fCommands.addCommand(Window::Key::kLeft, "Left", "Navigation", "Previous slide", [this]() {
+ fCommands.addCommand(skui::Key::kLeft, "Left", "Navigation", "Previous slide", [this]() {
this->setCurrentSlide(fCurrentSlide > 0 ? fCurrentSlide - 1 : fSlides.count() - 1);
});
- fCommands.addCommand(Window::Key::kUp, "Up", "Transform", "Zoom in", [this]() {
+ fCommands.addCommand(skui::Key::kUp, "Up", "Transform", "Zoom in", [this]() {
this->changeZoomLevel(1.f / 32.f);
fWindow->inval();
});
- fCommands.addCommand(Window::Key::kDown, "Down", "Transform", "Zoom out", [this]() {
+ fCommands.addCommand(skui::Key::kDown, "Down", "Transform", "Zoom out", [this]() {
this->changeZoomLevel(-1.f / 32.f);
fWindow->inval();
});
@@ -1401,20 +1401,20 @@
return inv.mapXY(x, y);
}
-bool Viewer::onTouch(intptr_t owner, InputState state, float x, float y) {
+bool Viewer::onTouch(intptr_t owner, skui::InputState state, float x, float y) {
if (GestureDevice::kMouse == fGestureDevice) {
return false;
}
const auto slidePt = this->mapEvent(x, y);
- if (fSlides[fCurrentSlide]->onMouse(slidePt.x(), slidePt.y(), state, ModifierKey::kNone)) {
+ if (fSlides[fCurrentSlide]->onMouse(slidePt.x(), slidePt.y(), state, skui::ModifierKey::kNone)) {
fWindow->inval();
return true;
}
void* castedOwner = reinterpret_cast<void*>(owner);
switch (state) {
- case InputState::kUp: {
+ case skui::InputState::kUp: {
fGesture.touchEnd(castedOwner);
#if defined(SK_BUILD_FOR_IOS)
// TODO: move IOS swipe detection higher up into the platform code
@@ -1435,11 +1435,11 @@
#endif
break;
}
- case InputState::kDown: {
+ case skui::InputState::kDown: {
fGesture.touchBegin(castedOwner, x, y);
break;
}
- case InputState::kMove: {
+ case skui::InputState::kMove: {
fGesture.touchMoved(castedOwner, x, y);
break;
}
@@ -1449,7 +1449,7 @@
return true;
}
-bool Viewer::onMouse(int x, int y, InputState state, ModifierKey modifiers) {
+bool Viewer::onMouse(int x, int y, skui::InputState state, skui::ModifierKey modifiers) {
if (GestureDevice::kTouch == fGestureDevice) {
return false;
}
@@ -1461,22 +1461,22 @@
}
switch (state) {
- case InputState::kUp: {
+ case skui::InputState::kUp: {
fGesture.touchEnd(nullptr);
break;
}
- case InputState::kDown: {
+ case skui::InputState::kDown: {
fGesture.touchBegin(nullptr, x, y);
break;
}
- case InputState::kMove: {
+ case skui::InputState::kMove: {
fGesture.touchMoved(nullptr, x, y);
break;
}
}
fGestureDevice = fGesture.isBeingTouched() ? GestureDevice::kMouse : GestureDevice::kNone;
- if (state != InputState::kMove || fGesture.isBeingTouched()) {
+ if (state != skui::InputState::kMove || fGesture.isBeingTouched()) {
fWindow->inval();
}
return true;
@@ -2382,11 +2382,11 @@
}
}
-bool Viewer::onKey(sk_app::Window::Key key, InputState state, ModifierKey modifiers) {
+bool Viewer::onKey(skui::Key key, skui::InputState state, skui::ModifierKey modifiers) {
return fCommands.onKey(key, state, modifiers);
}
-bool Viewer::onChar(SkUnichar c, ModifierKey modifiers) {
+bool Viewer::onChar(SkUnichar c, skui::ModifierKey modifiers) {
if (fSlides[fCurrentSlide]->onChar(c)) {
fWindow->inval();
return true;