// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include "JFJochMouseShortcutsWindow.h" #include #include namespace { struct Shortcut { QString action; QString effect; }; struct Section { QString title; QVector rows; }; QString BuildHtml() { const QVector
sections = { // JFJochImage / JFJochDiffractionImage mouse handling {"Diffraction image", { {"Wheel", "Zoom in / out, centred on the cursor"}, {"Shift + wheel", "Move the foreground (upper contrast limit) in linear steps"}, {"Ctrl + wheel", "Move the foreground in multiplicative steps (×1.15 per notch)"}, {"Alt + wheel", "Step through the dataset, one image per notch (up = next image)"}, {"F held + wheel", "Same as Shift + wheel, for as long as F is held"}, {"A", "Switch on the automatic foreground"}, {"Hover", "Status bar shows the pixel position, its value and the resolution"}, {"Drag", "Pan the image"}, {"Shift + drag", "Draw a rectangular ROI"}, {"Shift + Ctrl + drag", "Draw a circular ROI"}, {"Drag an ROI or its handle", "Move or resize the selected ROI"}, {"Right click", "Copy / save the image, fit to view, clear the ROI"}, }}, // JFJochGridScanImage {"Grid scan", { {"Hover", "Status bar shows the image number, the grid position and its value"}, {"Shift + hover", "Load the image under the cursor while moving over the grid"}, {"Double click", "Load the image under the cursor"}, }}, {"Other views", { {"2D azimuthal image: double click", "Zoom the diffraction image on the corresponding detector position"}, {"Dataset-info plot: hover", "Status bar shows the image number and the plotted value"}, {"Dataset-info plot: Shift + hover", "Load the hovered image"}, {"Spot / reflection list: double click", "Zoom the diffraction image on that spot or prediction"}, {"Image list: double click", "Load that image"}, {"Reciprocal space: drag", "Rotate the view"}, {"Reciprocal space: right drag", "Pan the view"}, {"Reciprocal space: wheel", "Zoom the view"}, {"Reciprocal space: double click", "Zoom the diffraction image on the nearest spot"}, {"Magnifier: wheel", "Zoom the magnifier; it follows the cursor on the main image"}, }}, }; QString html = ""; for (const auto §ion : sections) { html += "

" + section.title + "

"; html += ""; for (const auto &row : section.rows) html += ""; html += "
" + row.action + "" + row.effect + "
"; } html += "

Note: some window managers take Alt-modified mouse events for themselves " "before the application sees them. That is a window-manager setting, not something " "the viewer can take back.

"; html += ""; return html; } } JFJochMouseShortcutsWindow::JFJochMouseShortcutsWindow(QWidget *parent) : QDialog(parent) { setWindowTitle("Mouse Shortcuts"); resize(620, 620); auto *browser = new QTextBrowser(this); browser->setHtml(BuildHtml()); auto *layout = new QVBoxLayout(this); layout->addWidget(browser); }