Files
Jungfraujoch/viewer/windows/JFJochMouseShortcutsWindow.cpp
T
leonarski_fandClaude Opus 5 dccc415a53 viewer: the Help menu says what the mouse does and who is credited, and a spot can be hidden by what it is
The mouse bindings were only in the code and in one bullet of the viewer page: the wheel and its
four modifiers, the two ROI drags, and the hover and double-click behaviour of the grid scan, the
plots and the auxiliary views. They are now a window under Help, and the same table is a section of
docs/JFJOCH_VIEWER.md.

docs/ACKNOWLEDGEMENT.md is shipped in the viewer's resources and shown under Help beside the
third-party licenses, so the credit travels with the binary rather than only with the docs, and it
ends with a declaration of how generative AI was used in developing this code.

The image overlay draws every spot it has, which makes a frame with ice or with a large unindexed
population hard to read. The Inspector can now leave out the spots that were not assigned to a
lattice, and the spots that fall on an ice ring, independently of each other and of the ice-ring
highlight.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UdFBP5TjGsJ5Kvy2H8P9L9
2026-09-08 21:17:07 +02:00

76 lines
4.0 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include "JFJochMouseShortcutsWindow.h"
#include <QTextBrowser>
#include <QVBoxLayout>
namespace {
struct Shortcut { QString action; QString effect; };
struct Section { QString title; QVector<Shortcut> rows; };
QString BuildHtml() {
const QVector<Section> 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 (&times;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 = "<html><body>";
for (const auto &section : sections) {
html += "<h3>" + section.title + "</h3>";
html += "<table cellspacing='0' cellpadding='4' width='100%'>";
for (const auto &row : section.rows)
html += "<tr><td width='38%'><b>" + row.action + "</b></td><td>" + row.effect + "</td></tr>";
html += "</table>";
}
html += "<p><i>Note:</i> 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.</p>";
html += "</body></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);
}