1 | // Aseprite |
---|---|
2 | // Copyright (C) 2022 Igara Studio S.A. |
3 | // Copyright (C) 2001-2016 David Capello |
4 | // |
5 | // This program is distributed under the terms of |
6 | // the End-User License Agreement for Aseprite. |
7 | |
8 | #ifdef HAVE_CONFIG_H |
9 | #include "config.h" |
10 | #endif |
11 | |
12 | #include "app/ui/editor/navigate_state.h" |
13 | |
14 | #include "app/ui/editor/editor.h" |
15 | #include "app/ui/editor/scrolling_state.h" |
16 | #include "ui/message.h" |
17 | |
18 | namespace app { |
19 | |
20 | using namespace ui; |
21 | |
22 | NavigateState::NavigateState() |
23 | { |
24 | } |
25 | |
26 | bool NavigateState::onMouseDown(Editor* editor, MouseMessage* msg) |
27 | { |
28 | if (editor->hasCapture()) |
29 | return true; |
30 | |
31 | // UIContext* context = UIContext::instance(); |
32 | // // When an editor is clicked the current view is changed. |
33 | // context->setActiveView(editor->getDocView()); |
34 | |
35 | // Start scroll loop |
36 | EditorStatePtr newState(new ScrollingState()); |
37 | editor->setState(newState); |
38 | newState->onMouseDown(editor, msg); |
39 | return true; |
40 | } |
41 | |
42 | bool NavigateState::onMouseUp(Editor* editor, MouseMessage* msg) |
43 | { |
44 | editor->releaseMouse(); |
45 | return true; |
46 | } |
47 | |
48 | bool NavigateState::onMouseMove(Editor* editor, MouseMessage* msg) |
49 | { |
50 | editor->updateStatusBar(); |
51 | return true; |
52 | } |
53 | |
54 | bool NavigateState::onKeyDown(Editor* editor, KeyMessage* msg) |
55 | { |
56 | return false; |
57 | } |
58 | |
59 | bool NavigateState::onKeyUp(Editor* editor, KeyMessage* msg) |
60 | { |
61 | return false; |
62 | } |
63 | |
64 | void NavigateState::disableQuickTool() const |
65 | { |
66 | // Do nothing, as this state is used for the preview, creating a new |
67 | // navigate state disabling the quick tool here will break the |
68 | // Alt+click to use the eyedropper between editors when the Preview |
69 | // window is visible. |
70 | } |
71 | |
72 | } // namespace app |
73 |