| 49 | #endif |
| 50 | |
| 51 | HelpWindow::HelpWindow(Widget* parent, weak_ptr<Ipc> weakIpc, function<void()> closeCallback) : |
| 52 | Window{parent, "Help"}, mCloseCallback{closeCallback} { |
| 53 | |
| 54 | auto closeButton = new Button{button_panel(), "", FA_TIMES}; |
| 55 | closeButton->set_callback(mCloseCallback); |
| 56 | |
| 57 | static constexpr int WINDOW_WIDTH = 650; |
| 58 | static constexpr int WINDOW_HEIGHT = 640; |
| 59 | |
| 60 | set_layout(new GroupLayout{}); |
| 61 | set_fixed_width(WINDOW_WIDTH); |
| 62 | |
| 63 | mTabWidget = new TabWidget{this}; |
| 64 | mTabWidget->set_fixed_height(WINDOW_HEIGHT); |
| 65 | |
| 66 | // Keybindings tab |
| 67 | Widget* tmp = new Widget(mTabWidget); |
| 68 | mScrollPanel = new VScrollPanel{tmp}; |
| 69 | mTabWidget->append_tab("Keybindings", tmp); |
| 70 | |
| 71 | Widget* shortcuts = new Widget(mScrollPanel); |
| 72 | shortcuts->set_layout(new GroupLayout{}); |
| 73 | |
| 74 | static constexpr auto addRow = [](Widget* current, string keys, string desc) { |
| 75 | auto row = new Widget{current}; |
| 76 | row->set_layout(new BoxLayout{Orientation::Horizontal, Alignment::Fill, 0, 10}); |
| 77 | auto descWidget = new Label{row, desc, "sans"}; |
| 78 | descWidget->set_fixed_width(250); |
| 79 | new Label{row, keys, "sans-bold"}; |
| 80 | }; |
| 81 | |
| 82 | new Label{shortcuts, "Image loading", "sans-bold", 18}; |
| 83 | auto imageLoading = new Widget{shortcuts}; |
| 84 | imageLoading->set_layout(new BoxLayout{Orientation::Vertical, Alignment::Fill, 0, 0}); |
| 85 | |
| 86 | addRow(imageLoading, COMMAND + "+O", "Open image"); |
| 87 | addRow(imageLoading, COMMAND + "+S", "Save view as image"); |
| 88 | addRow(imageLoading, COMMAND + "+R or F5", "Reload image"); |
| 89 | addRow(imageLoading, COMMAND + "+Shift+R or " + COMMAND + "+F5", "Reload all images"); |
| 90 | addRow(imageLoading, COMMAND + "+W", "Close image"); |
| 91 | addRow(imageLoading, COMMAND + "+Shift+W", "Close all images"); |
| 92 | addRow(imageLoading, COMMAND + "+C", "Copy image to clipboard"); |
| 93 | addRow(imageLoading, COMMAND + "+Shift+C", "Copy image's path to clipboard"); |
| 94 | addRow(imageLoading, COMMAND + "+V", "Paste image from clipboard"); |
| 95 | |
| 96 | new Label{shortcuts, "Image options", "sans-bold", 18}; |
| 97 | auto imageSelection = new Widget{shortcuts}; |
| 98 | imageSelection->set_layout(new BoxLayout{Orientation::Vertical, Alignment::Fill, 0, 0}); |
| 99 | |
| 100 | addRow(imageSelection, "Left Click", "Select hovered image"); |
| 101 | addRow(imageSelection, "1…9", "Select N-th image"); |
| 102 | addRow(imageSelection, "Down/Up or S/W or Ctrl+Tab/Ctrl+Shift+Tab", "Select next/previous image"); |
| 103 | addRow(imageSelection, "Home/End", "Select first/last image"); |
| 104 | addRow(imageSelection, "Space", "Toggle playback of images as video"); |
| 105 | |
| 106 | addRow(imageSelection, "Click & Drag or H/J/K/L (+Shift/Ctrl)", "Translate image"); |
| 107 | addRow(imageSelection, "Click & Drag+C (hold)", "Crop image"); |
| 108 | addRow(imageSelection, "+/- or Scroll (+Shift/Ctrl)", "Zoom in/out of image"); |
nothing calls this directly
no test coverage detected