diff --git a/CHANGELOG.md b/CHANGELOG.md index 3964121f..1df3e7f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ New: - Receive game controllers, by cable or wireless, through SDL 2 (optional at build time; not yet on Windows): Preferences > Controls > Game controllers lists those connected and shows the last button pressed or stick pushed, and `--list-gamepads` writes them in the terminal, without a window, to check a controller before a show. A controller that SDL does not know can be described in `gamecontrollerdb.txt`, in the folder of the data of MapMap. Linking their buttons and sticks to settings comes in a later version. - Control the playback of a video file alone: go to a moment with `/mapmap/source/seek ,if `, move forward or back with `/mapmap/source/skip`, by id or by name pattern; mute it without losing its volume (`muted`, saved in the project); pause it alone with the Play switch of the inspector, which a key or a MIDI pad can learn, or with its setting `playing`. A paused video shows the image at the moment it was sent to, and a seek received before the video is loaded is done once it is. The inspector shows the duration of a video; the MCP tool `get_source` gives its `position` and `duration` in seconds, `set_property` seeks, and the new tool `skip_source` moves forward or back (#457, #512). - A source paused alone by OSC (`/mapmap/source/pause`) stays paused when the whole project plays again or a layer is shown. -- Place up to eight cues in a video file and jump to them with a key or a MIDI pad: the Cues group of the inspector of a video has one row per cue, with its colour, its name, its moment, and the buttons Go, Set and Clear, which a key or a pad can learn. Go jumps to the exact image of the cue and plays the video, even when paused; on an empty cue, it places the cue where the video plays. A bar shows the cues and where the video plays, and the status bar says which cue was reached or placed. The cues belong to the file: every source reading it has the same, and the project keeps them under `media`. OSC and MCP reach them at `cues//go`, `set`, `clear`, `time`, `name` and `color`. +- Place up to eight cues in a video file and jump to them with a key or a MIDI pad: the Cues tab of the bottom section shows the cues of the video chosen as a list, one row per cue with its colour, its name, its moment, and the buttons Go, Set and Clear, which a key or a pad can learn, and as a grid of eight pads, which a click plays and a right click renames, colours, sets or clears; the cue reached stands out in both, and a cue is gray until it is coloured. Go jumps to the exact image of the cue and plays the video, even when paused; on an empty cue, it places the cue where the video plays. A bar shows the cues and where the video plays, and the status bar says which cue was reached or placed. The cues belong to the file: every source reading it has the same, and the project keeps them under `media`. OSC and MCP reach them at `cues//go`, `set`, `clear`, `time`, `name` and `color`. - Put an effect on a source, which changes all its shapes, or on a layer, which changes only its shape. The first effect, Color Adjustment, sets the brightness, the contrast, the saturation and the hue. Effects are ISF shaders that read an image; the same file serves both places. An effect shows as a row under its source or its layer, with an eye to turn it on or off and a cross to remove it; a right-click on a source or a layer adds or replaces its effect, Delete removes the selected one, and selecting it shows its settings in the inspector. The eye of an effect and the rows of its page can be linked to a key or a MIDI control, like the other settings. Effects are also put and set through the MCP tools `list_effect_types`, `add_effect` and `remove_effect`, by OSC and links at the path `effect//`, and kept in the project. See `docs/extensions/isf.md`. - A hidden layer, or an effect turned off, keeps a faint eye in the lists, to show where to click to turn it on again. - Control every setting of a source or a layer by OSC at an address that follows its path: `/mapmap/layer//`, for example `/mapmap/layer/3/output/vertices/5`. The new MCP tool `list_settings` gives the settings of a source or a layer with their type, bounds and options, and `set_property` takes a path. @@ -45,6 +45,7 @@ New: Improvements: - The settings panel shows values in pixels without their unit, and numbers without thousands separators: 1024, not 1,024 px. +- A bottom section under the editor, hidden at first, holds tabs; Window > Editor, Bottom Section, and Editor and Bottom Section (Ctrl+Alt+1, 2 and 3; Cmd+Option on macOS), two buttons beside its tabs and the OSC address `/mapmap/view/panels` show one, the other or both, and MapMap remembers the choice. - The frames per second in the status bar keep the same width as they change: the other boxes of the status bar no longer move each second. - Turning the mouse wheel over a menu of the settings panel scrolls the panel instead of changing the value. - A new shape opens the settings panel on the Media tab, the settings of its source. diff --git a/docs/informations/learning.md b/docs/informations/learning.md index 87bad3d7..25e820d7 100644 --- a/docs/informations/learning.md +++ b/docs/informations/learning.md @@ -76,15 +76,17 @@ The MIDI controls keep acting when Edit > Learned Keys Active is off: only the k ## Cues of a video: jump with a pad -A video file has eight cues: moments to jump to, during a show, with a key or a pad. They are in the "Cues" group of the inspector of a video, one row per cue: its number on its colour, its name, its moment, and three buttons. A click on the colour changes it. +A video file has eight cues: moments to jump to, during a show, with a key or a pad. They are in the "Cues" tab of the bottom section of the window, under the editor; choose a video in the Library, or a layer that shows one. The section is hidden at first: Window > Bottom Section (Cmd+Option+2 on macOS, Ctrl+Alt+2 elsewhere) shows it alone, and Window > Editor and Bottom Section (Cmd+Option+3, Ctrl+Alt+3) under the editor; Window > Editor (Cmd+Option+1, Ctrl+Alt+1) hides it. The two buttons at the right of its tabs hide or show the editor, and hide the section. + +The tab shows the cues as a list, as a grid of eight pads, or both: the buttons List and Grid choose. In the list, a row per cue: its number on its colour, its name, its moment, and three buttons; a click on the colour changes it. A cue has the same gray until it is coloured. When the section is narrow, the moment goes first, then Set and Clear; the number and the name stay. In the grid, a pad per cue, with its number and its name: a click does what Go does, and a right click renames it, colours it, sets it or clears it. The cue the video last reached is outlined in the grid and lit in the list. - **Go** jumps to the cue and plays the video from there, even when it was paused. On an empty cue, it places the cue where the video plays: during a rehearsal, press the pad at the right moment, and the cue is there. - **Set** places the cue where the video plays, or moves it there. - **Clear** removes it. -Learn a key or a pad on Go, as on any control: while learning, click Go in the row of the cue. A pad then places the cue the first time and jumps to it after. One can also type the moment, in seconds, in the row. +Learn a key or a pad on Go, as on any control: while learning, click Go in the row of the cue, in the list. A pad then places the cue the first time and jumps to it after. One can also type the moment, in seconds, in the row. -A thin bar above the rows shows the length of the video, a mark of its colour for each cue, and a white line where the video plays. The status bar says which cue was reached, "Cue 3 — Explosion", or placed, "Cue 3 set at 00:12.48". +A thin bar above the list and the grid shows the length of the video, a mark of its colour for each cue, and a white line where the video plays. The status bar says which cue was reached, "Cue 3 — Explosion", or placed, "Cue 3 set at 00:12.48". The cues belong to the file, not to the source: two sources reading the same file have the same cues, and a source that reads another file shows the cues of that one. They are saved in the project. diff --git a/docs/informations/osc.md b/docs/informations/osc.md index 4bc72ff5..51b15576 100644 --- a/docs/informations/osc.md +++ b/docs/informations/osc.md @@ -121,6 +121,10 @@ Place the output window: `/mapmap/output/window ,iiii ` The names and numbers of the screens are those that `mapmap --list-screens` writes. Covering the screen of MapMap does not ask first, so that an installation with a single screen starts on its own. The place of the window is in the coordinates of the desktop: it applies at once when the output is in a window, else the next time it is. +## Main window + +Show the editor alone, the bottom section alone (such as the cues of a video), or both: `/mapmap/view/panels ,s ` + ## Security OSC has no authentication. By default MapMap listens on the loopback diff --git a/docs/project-format.md b/docs/project-format.md index 259e0458..b4c47f10 100644 --- a/docs/project-format.md +++ b/docs/project-format.md @@ -168,7 +168,7 @@ A project may have a `media` array: what belongs to a media file rather than to ``` - `uri` is the path of the file, written as the `uri` of a source (see "Media paths"): relative to the project when the file is in its directory. Two sources reading the same file share its cues, and a source that reads another file shows the cues of that one. -- `number` is from 1 to 8, `time` the moment in seconds from the start of the file. `name` and `color` are written only when the user gave them; a cue without a colour has the one of its number: red, orange, yellow, green, cyan, blue, violet and pink. +- `number` is from 1 to 8, `time` the moment in seconds from the start of the file. `name` and `color` are written only when the user gave them; a cue without a colour is gray. - The reader skips an entry without `uri`, a cue whose number is out of range or given twice, and a cue without a time or with a negative one, with a warning naming it. It keeps the keys it does not know, in an entry and in a cue, and writes them back. A cue beyond the end of its video is kept: a jump to it stops at the end. The settings of a cue are in its video source, at `cues//`, as in OSC and MCP: `time` (empty while the cue is not placed; writing it places the cue), `name`, `color`, and the buttons `go` (jumps to the cue and plays this video; places the cue where the video plays when it is empty), `set` (places or moves it there) and `clear`. They are not written with the source. diff --git a/src/control/OscAction.cpp b/src/control/OscAction.cpp index 0e3cf49c..f33ff40b 100644 --- a/src/control/OscAction.cpp +++ b/src/control/OscAction.cpp @@ -297,6 +297,20 @@ OscAction parseOutput(const QStringList& sub, const QVariantList& args) return invalid("unknown output command: " + sub.join('/')); } +// Parses /mapmap/view/panels: sub is what follows "view". +OscAction parseView(const QStringList& sub, const QVariantList& args) +{ + if (sub.size() != 1 || sub.first() != QLatin1String("panels")) + return invalid("unknown view command: " + sub.join('/')); + OscAction a; + if (args.isEmpty()) + return invalid("view panels needs editor, bottom or both"); + if (!panelsShownFromName(args.at(0).toString(), &a.panelsShown)) + return invalid("view panels needs editor, bottom or both, not: " + args.at(0).toString()); + a.type = OscAction::ViewSetPanels; + return a; +} + } // namespace OscAction parseOscAction(const QString& address, const QVariantList& args) @@ -343,6 +357,9 @@ OscAction parseOscAction(const QString& address, const QVariantList& args) if (head == QLatin1String("output")) return parseOutput(rest.mid(1), args); + if (head == QLatin1String("view")) + return parseView(rest.mid(1), args); + return invalid("unknown command: " + address); } diff --git a/src/control/OscAction.h b/src/control/OscAction.h index 406a20a3..256d5c5c 100644 --- a/src/control/OscAction.h +++ b/src/control/OscAction.h @@ -25,6 +25,7 @@ #include #include "OutputScreen.h" +#include "PanelsShown.h" namespace mmp { @@ -68,6 +69,9 @@ struct OscAction { OutputSetMode, ///< Hide the output, show it in a window, or cover a screen. OutputSetScreen, ///< Choose the output screen, by name or by number from 1 (selector). OutputSetWindow, ///< Place the ordinary output window. + + // The main window. + ViewSetPanels, ///< Show the editor, the bottom section, or both. }; /// Direction of a LayerFlip. @@ -113,6 +117,9 @@ struct OscAction { OutputMode outputMode = OutputMode::Hidden; QRect windowGeometry; ///< In the coordinates of the desktop. + // --- Payload for ViewSetPanels. --- + PanelsShown panelsShown = PanelsShown::Editor; + // Human-readable reason, set when type == Invalid (for verbose logging / tests). QString error; diff --git a/src/control/OscInterface.cpp b/src/control/OscInterface.cpp index 14bbd8f4..914baf1b 100644 --- a/src/control/OscInterface.cpp +++ b/src/control/OscInterface.cpp @@ -249,6 +249,9 @@ bool OscInterface::applyAction(MainWindow &main_window, const OscAction& action) case OscAction::OutputSetMode: main_window.setOutputMode(action.outputMode); return true; + case OscAction::ViewSetPanels: + main_window.setPanelsShown(action.panelsShown); + return true; case OscAction::OutputSetScreen: { const bool found = action.selectByName ? main_window.setOutputScreenByName(action.name) diff --git a/src/core/MediaCues.cpp b/src/core/MediaCues.cpp index 4897451c..dfaef4f7 100644 --- a/src/core/MediaCues.cpp +++ b/src/core/MediaCues.cpp @@ -31,16 +31,9 @@ namespace mmp { namespace { /// The colours of the cues that have none of their own, from cue 1 to cue 8. -const QColor DEFAULT_COLORS[MediaCues::CUE_COUNT] = { - QColor(0xe5, 0x39, 0x35), // red - QColor(0xfb, 0x8c, 0x00), // orange - QColor(0xfd, 0xd8, 0x35), // yellow - QColor(0x43, 0xa0, 0x47), // green - QColor(0x00, 0xac, 0xc1), // cyan - QColor(0x1e, 0x88, 0xe5), // blue - QColor(0x8e, 0x24, 0xaa), // violet - QColor(0xd8, 0x1b, 0x60), // pink -}; +/// The colour of a cue the user did not colour: a gray lighter than the buttons of MapMap, +/// under a number in white. +const QColor DEFAULT_COLOR(0x7a, 0x7d, 0x89); /// The keys of a cue that this version reads. const char* const CUE_KEYS[] = { ProjectLabels::NUMBER, ProjectLabels::TIME, ProjectLabels::NAME, @@ -82,9 +75,9 @@ bool MediaCues::isValidNumber(int number) return number >= 1 && number <= CUE_COUNT; } -QColor MediaCues::defaultColor(int number) +QColor MediaCues::defaultColor() { - return isValidNumber(number) ? DEFAULT_COLORS[number - 1] : QColor(Qt::white); + return DEFAULT_COLOR; } QString MediaCues::displayName(const Cue& cue, int number) diff --git a/src/core/MediaCues.h b/src/core/MediaCues.h index b39ab119..33ad08fb 100644 --- a/src/core/MediaCues.h +++ b/src/core/MediaCues.h @@ -38,7 +38,7 @@ struct Cue { double time = 0.0; /// The name given by the user; empty when none was given. QString name; - /// The colour; invalid for the colour of its number (see MediaCues::defaultColor()). + /// The colour; invalid for the gray of a cue not coloured (see MediaCues::defaultColor()). QColor color; /// The keys of the project file this version does not know, written back as they were. QJsonObject unknownKeys; @@ -64,9 +64,8 @@ class MediaCues : public QObject { /// Returns true for a number from 1 to CUE_COUNT. static bool isValidNumber(int number); - /// Returns the colour of a cue that has none of its own: red, orange, yellow, green, cyan, - /// blue, violet and pink, in the order of DJ controllers. - static QColor defaultColor(int number); + /// Returns the colour of a cue that has none of its own: one gray for every cue. + static QColor defaultColor(); /// Returns the text naming a cue: its name, or "Cue " when it has none. static QString displayName(const Cue& cue, int number); diff --git a/src/core/Source.cpp b/src/core/Source.cpp index e8af7a28..9c91d289 100644 --- a/src/core/Source.cpp +++ b/src/core/Source.cpp @@ -550,7 +550,8 @@ void Video::_addPlaybackSettings() void Video::_addCueSettings() { SettingGroup* cues = settings()->addGroup(ProjectLabels::CUES); - cues->setPanelTitle(tr("Cues"), false); + // Shown in the bottom section of the window, not with the other settings of the video. + cues->setHiddenFromPanel(true); for (int number = 1; number <= MediaCues::CUE_COUNT; ++number) { SettingGroup* group = cues->addGroup(QString::number(number)); @@ -562,13 +563,13 @@ void Video::_addCueSettings() // Kept in the cues of the project, by file, not with the source. group->addSetting(SettingInfo::color(ProjectLabels::COLOR, tr("Colour")) - .defaultValue(MediaCues::defaultColor(number)) + .defaultValue(MediaCues::defaultColor()) .notStored() .displayRow(QLatin1String(CUE_ROW)) .description(tr("The colour of the cue."))) ->bind([this, number]() { const QColor color = _cues->cue(_uri, number).color; - return QVariant(color.isValid() ? color : MediaCues::defaultColor(number)); + return QVariant(color.isValid() ? color : MediaCues::defaultColor()); }, [this, number](const QVariant& value) { return _cues->setColor(_uri, number, value.value()); diff --git a/src/gui/BottomPanel.cpp b/src/gui/BottomPanel.cpp new file mode 100644 index 00000000..8dd8dfc2 --- /dev/null +++ b/src/gui/BottomPanel.cpp @@ -0,0 +1,117 @@ +/* + * BottomPanel.cpp + * + * (c) 2026 MapMap contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "BottomPanel.h" + +#include +#include +#include +#include +#include + +namespace mmp { + +namespace { + +/// Margins around the tabs and the pages, in pixels. +const int PANEL_MARGIN = 4; + +/// Space between the tabs and the page, in pixels. +const int PANEL_SPACING = 2; + +/// Text of the button that hides the editor: an arrow up, the section grows to the top. +const QString HIDE_EDITOR_TEXT = QStringLiteral("⤒"); // ⤒ + +/// Text of the button that shows the editor again: an arrow down. +const QString SHOW_EDITOR_TEXT = QStringLiteral("⤓"); // ⤓ + +/// Text of the button that hides the section: a cross. +const QString HIDE_SECTION_TEXT = QStringLiteral("✕"); // ✕ + +} // namespace + +BottomPanel::BottomPanel(QWidget* parent) + : QWidget(parent), + _tabs(new QTabBar(this)), + _pages(new QStackedWidget(this)), + _editorButton(new QToolButton(this)), + _hideButton(new QToolButton(this)) +{ + setObjectName(QStringLiteral("bottomPanel")); + + _tabs->setExpanding(false); + _tabs->setDrawBase(false); + connect(_tabs, &QTabBar::currentChanged, _pages, &QStackedWidget::setCurrentIndex); + + _editorButton->setAutoRaise(true); + _editorButton->setCheckable(true); + connect(_editorButton, &QToolButton::toggled, this, [this](bool hidden) { + setEditorShown(!hidden); + emit editorHiddenRequested(hidden); + }); + setEditorShown(true); + + _hideButton->setAutoRaise(true); + _hideButton->setText(HIDE_SECTION_TEXT); + _hideButton->setToolTip(tr("Hide this section")); + _hideButton->setAccessibleName(tr("Hide this section")); + connect(_hideButton, &QToolButton::clicked, this, &BottomPanel::hideRequested); + + QHBoxLayout* header = new QHBoxLayout; + header->setContentsMargins(0, 0, 0, 0); + header->addWidget(_tabs); + header->addStretch(1); + header->addWidget(_editorButton); + header->addWidget(_hideButton); + + QVBoxLayout* layout = new QVBoxLayout(this); + layout->setContentsMargins(PANEL_MARGIN, PANEL_MARGIN, PANEL_MARGIN, PANEL_MARGIN); + layout->setSpacing(PANEL_SPACING); + layout->addLayout(header); + layout->addWidget(_pages, 1); +} + +int BottomPanel::addPage(const QString& title, QWidget* page) +{ + _pages->addWidget(page); + return _tabs->addTab(title); +} + +int BottomPanel::count() const +{ + return _tabs->count(); +} + +QWidget* BottomPanel::currentPage() const +{ + return _pages->currentWidget(); +} + +void BottomPanel::setEditorShown(bool shown) +{ + const QString text = shown ? tr("Hide the editor above") : tr("Show the editor above"); + _editorButton->blockSignals(true); + _editorButton->setChecked(!shown); + _editorButton->blockSignals(false); + _editorButton->setText(shown ? HIDE_EDITOR_TEXT : SHOW_EDITOR_TEXT); + _editorButton->setToolTip(text); + _editorButton->setAccessibleName(text); +} + +} // namespace mmp diff --git a/src/gui/BottomPanel.h b/src/gui/BottomPanel.h new file mode 100644 index 00000000..5ad11cc0 --- /dev/null +++ b/src/gui/BottomPanel.h @@ -0,0 +1,76 @@ +/* + * BottomPanel.h + * + * (c) 2026 MapMap contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BOTTOM_PANEL_H_ +#define BOTTOM_PANEL_H_ + +#include + +class QStackedWidget; +class QTabBar; +class QToolButton; + +namespace mmp { + +/** + * The section under the input and output views: a row of tabs, a page per tab, and, at the + * right of the tabs, a button that hides or shows the editor above and one that hides the + * section. The main window decides what these buttons do. + */ +class BottomPanel : public QWidget { + Q_OBJECT + +public: + explicit BottomPanel(QWidget* parent = nullptr); + + /// Adds a page under a tab; returns the index of the tab. + int addPage(const QString& title, QWidget* page); + + /// Returns the number of tabs. + int count() const; + + /// Returns the page shown. + QWidget* currentPage() const; + + /// Says whether the editor above is shown, which the first button shows. + void setEditorShown(bool shown); + + /// Returns the button that hides or shows the editor, for tests. + QToolButton* editorButton() const { return _editorButton; } + + /// Returns the button that hides the section, for tests. + QToolButton* hideButton() const { return _hideButton; } + +signals: + /// The user asked to hide the editor above (true) or to show it again (false). + void editorHiddenRequested(bool hidden); + + /// The user asked to hide the section. + void hideRequested(); + +private: + QTabBar* _tabs; + QStackedWidget* _pages; + QToolButton* _editorButton; + QToolButton* _hideButton; +}; + +} // namespace mmp + +#endif /* BOTTOM_PANEL_H_ */ diff --git a/src/gui/CueBar.cpp b/src/gui/CueBar.cpp index e4bd2546..1ed726ec 100644 --- a/src/gui/CueBar.cpp +++ b/src/gui/CueBar.cpp @@ -22,9 +22,7 @@ #include #include -#include "Inspector.h" #include "MediaCues.h" -#include "ProjectLabels.h" #include "Source.h" namespace mmp { @@ -63,8 +61,16 @@ CueBar::CueBar(Video* video, QWidget* parent) setToolTip(tr("Where the cues are, and where the video plays")); _timer->setInterval(REFRESH_INTERVAL_MS); connect(_timer, &QTimer::timeout, this, QOverload<>::of(&QWidget::update)); - if (video) - connect(video->cueStore(), &MediaCues::changed, this, QOverload<>::of(&QWidget::update)); + setVideo(video); +} + +void CueBar::setVideo(Video* video) +{ + disconnect(_cuesConnection); + _video = video; + if (video && video->cueStore()) + _cuesConnection = connect(video->cueStore(), &MediaCues::changed, this, QOverload<>::of(&QWidget::update)); + update(); } int CueBar::xOf(double seconds) const @@ -99,7 +105,7 @@ void CueBar::paintEvent(QPaintEvent*) const Cue cue = cues->cue(uri, number); const int x = xOf(cue.time); painter.fillRect(QRect(x - MARK_WIDTH / 2, 0, MARK_WIDTH, height()), - cue.color.isValid() ? cue.color : MediaCues::defaultColor(number)); + cue.color.isValid() ? cue.color : MediaCues::defaultColor()); } painter.fillRect(QRect(xOf(_video->position()), 0, PLAYHEAD_WIDTH, height()), PLAYHEAD_COLOR); } @@ -116,15 +122,4 @@ void CueBar::hideEvent(QHideEvent* event) QWidget::hideEvent(event); } -void showCueBar(InspectorPage* page, Source* source) -{ - Video* video = qobject_cast(source); - if (video && video->isCamera()) - video = nullptr; - QPointer