From 98269c23eb55821eade8acb638b96070b753ce41 Mon Sep 17 00:00:00 2001 From: ahlstrom Date: Sat, 7 Oct 2023 07:31:27 -0400 Subject: [PATCH] For issue #117, added 'usr' option to enable Esc key to close the pattern editor if play is stopped and not in paint mode. --- README.md | 6 +- TODO | 5 +- data/linux/qseq66.usr | 9 +-- doc/latex/tex/configuration.tex | 14 ++++- doc/latex/tex/menu.tex | 9 ++- libseq66/include/cfg/usrsettings.hpp | 16 ++++- libseq66/src/cfg/usrfile.cpp | 11 ++-- libseq66/src/cfg/usrsettings.cpp | 4 +- libseq66/src/play/sequence.cpp | 3 +- seq_qt5/forms/qseditoptions.ui | 94 ++++++++-------------------- seq_qt5/include/qseditoptions.hpp | 3 +- seq_qt5/src/qseditoptions.cpp | 17 ++++- seq_qt5/src/qseqeditframe64.cpp | 19 +++++- 13 files changed, 119 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index ba64b0c6..700537a7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# README for Seq66 0.99.10 2023-10-04 +# README for Seq66 0.99.10 2023-10-07 __Seq66__: MIDI sequencer/live-looper with a hardware-sampler grid interface; pattern banks, triggers, and playlists for song management; scale and chord @@ -83,6 +83,10 @@ Windows, and using a conventional source tarball. ## Recent Changes * Version 0.99.10: + * Issue #117 Option to close pattern windows with esc key. Must + be enabled via a 'usr' option first. + * Issue #118 Make virtual ports ports enabled by default. TO DO. + * Issue #119 "Quantized Record Active does not work" fixed. * Multiple tempo events can be drawn in a line in the data pane. They can be dragged up and down in the data pane. * If configured for double-click, can now open or create a pattern diff --git a/TODO b/TODO index 279a12a4..e0553815 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,9 @@ TO DO for Seq66 0.99.10 Chris Ahlstrom -2019-04-13 to 2023-10-06 +2019-04-13 to 2023-10-07 Misc: - - Issue #117 - Issue #118 - Document and test mute groups. Issues: - performer: cliear_mute_groups(), reset_mute_groups(), and @@ -348,7 +347,7 @@ ISSUES: different settings... Post processing quantize works as expected (i,e, Ctrl-A then q) - STATUS: Fixed in the portfix branch. An embarrasing misstep! + STATUS: Fixed in the portfix branch. An embarrassing misstep! To close as fixed (and remove from TODO): diff --git a/data/linux/qseq66.usr b/data/linux/qseq66.usr index 1091741c..2b9c3e79 100644 --- a/data/linux/qseq66.usr +++ b/data/linux/qseq66.usr @@ -1,7 +1,7 @@ # Seq66 0.99.9 user ('usr') configuration file # # /home/usr/.config/seq66/qseq66.usr -# Written 2023-09-22 09:01:45 +# Written 2023-10-07 09:01:45 # # 'usr' file. Edit it and place it in ~/.config/seq66. It allows naming each # MIDI bus/port, channel, and control code. @@ -259,12 +259,13 @@ visibility = true # is indicated when the loop has the name 'Untitled' and no events. These # values save time during a live recording session. The valid values for # record-style are 'merge' (default), 'overwrite', 'expand', 'one-shot', -# and 'one-shot-reset'. -# 'wrap-around', if true, allows recorded notes to wrap around to the -# pattern start. +# and 'one-shot-reset'. 'wrap-around' allows recorded notes to wrap to the +# pattern start. 'escape-pattern' allows the Esc key to close the pattern +# editor if not playing or in paint mode. [new-pattern-editor] +escape-pattern = false armed = false thru = false record = false diff --git a/doc/latex/tex/configuration.tex b/doc/latex/tex/configuration.tex index 9810fdd6..d1324831 100644 --- a/doc/latex/tex/configuration.tex +++ b/doc/latex/tex/configuration.tex @@ -6,7 +6,7 @@ % \library Documents % \author Chris Ahlstrom % \date 2021-01-18 -% \update 2023-09-27 +% \update 2023-10-07 % \version $Revision$ % \license $XPC_GPL_LICENSE$ % @@ -218,8 +218,8 @@ \subsection{Command Line} \label{subsec:configuration_command_line} Command-line options are well-described in the \textsl{Seq66} "man" page. - Here, we will present a brief note about each option, and, where applicable, a - reference to the corresponding configuration file option. + Here, we will present a brief note about each option, and, where applicable, + a reference to the corresponding configuration file option. Here is the basic command line: \begin{verbatim} @@ -1758,6 +1758,7 @@ \subsubsection{'usr' File / Additional Options} \begin{verbatim} [new-pattern-editor] + escape-pattern = false armed = false thru = false record = false @@ -1766,6 +1767,13 @@ \subsubsection{'usr' File / Additional Options} wrap-around = false \end{verbatim} + The \texttt{escape-pattern} option applies to an open pattern window. + If enabled, the \texttt{Esc} key can close the pattern window if + patterns are not playing and if not in paint mode. If both are true, then + the first \texttt{Esc} stops playing, the second \texttt{Esc} exits + paint mode, and the third \texttt{Esc} closes the window. + The use must enable this option deliberately. + Also included is a flag to allow notes to wrap around, where the Note On comes near the end of the pattern, but the Note Off appears before the Note On. diff --git a/doc/latex/tex/menu.tex b/doc/latex/tex/menu.tex index 5586f120..8a6448cb 100644 --- a/doc/latex/tex/menu.tex +++ b/doc/latex/tex/menu.tex @@ -6,7 +6,7 @@ % \library Documents % \author Chris Ahlstrom % \date 2015-08-31 -% \update 2023-09-22 +% \update 2023-10-07 % \version $Revision$ % \license $XPC_GPL_LICENSE$ % @@ -1417,6 +1417,13 @@ \subsubsection{Menu / Edit / Preferences} Still not sure what's wrong with \textsl{Seq66} randomization, but it is only important if randomizing a large number of times. + The second section, not shown, is \textbf{Additional 'usr' Options}. + It contains only one option at present, + \textbf{Escape Can Close Pattern Editor}. + If set (the default is false), then the \texttt{Esc} + key can not only stop playing and exit paint mode, but + can also close the pattern window. + \paragraph{Menu / Edit / Preferences / Session} \label{paragraph:menu_edit_preferences_session} diff --git a/libseq66/include/cfg/usrsettings.hpp b/libseq66/include/cfg/usrsettings.hpp index 4a11dd05..247d0487 100644 --- a/libseq66/include/cfg/usrsettings.hpp +++ b/libseq66/include/cfg/usrsettings.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2015-09-22 - * \updates 2023-09-30 + * \updates 2023-10-07 * \license GNU GPLv2 or above * * This module defines the following categories of "global" variables that @@ -939,9 +939,11 @@ class usrsettings final : public basesettings /** * [new-pattern-editor] * - * A new feature, in progress. + * Options for a pattern that is newly-created, plus a new option to let + * the Esc key close a pattern editor window. */ + bool m_escape_pattern; bool m_new_pattern_armed; bool m_new_pattern_thru; bool m_new_pattern_record; @@ -1716,6 +1718,11 @@ class usrsettings final : public basesettings * New-pattern options */ + bool escape_pattern () const + { + return m_escape_pattern; + } + bool new_pattern_armed () const { return m_new_pattern_armed; @@ -1973,6 +1980,11 @@ class usrsettings final : public basesettings m_session_url = value; } + void escape_pattern (bool flag) + { + m_escape_pattern = flag; + } + void new_pattern_armed (bool flag) { m_new_pattern_armed = flag; diff --git a/libseq66/src/cfg/usrfile.cpp b/libseq66/src/cfg/usrfile.cpp index 8f9eed1d..d6694293 100644 --- a/libseq66/src/cfg/usrfile.cpp +++ b/libseq66/src/cfg/usrfile.cpp @@ -26,7 +26,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-11-23 - * \updates 2023-09-29 + * \updates 2023-10-07 * \license GNU GPLv2 or above * * Note that the parse function has some code that is not yet enabled. @@ -495,6 +495,8 @@ usrfile::parse () usr().session_visibility(flag); tag = "[new-pattern-editor]"; + flag = get_boolean(file, tag, "escape-pattern"); + usr().escape_pattern(flag); flag = get_boolean(file, tag, "armed"); usr().new_pattern_armed(flag); flag = get_boolean(file, tag, "thru"); @@ -986,11 +988,12 @@ usrfile::write () "# is indicated when the loop has the name 'Untitled' and no events. These\n" "# values save time during a live recording session. The valid values for\n" "# record-style are 'merge' (default), 'overwrite', 'expand', 'one-shot', \n" -"# and 'one-shot-reset'.\n" -"# 'wrap-around', if true, allows recorded notes to wrap around to the\n" -"# pattern start.\n" +"# and 'one-shot-reset'. 'wrap-around' allows recorded notes to wrap to the\n" +"# pattern start. 'escape-pattern' allows the Esc key to close the pattern\n" +"# editor if not playing or in paint mode.\n" "\n[new-pattern-editor]\n\n" ; + write_boolean(file, "escape-pattern", usr().escape_pattern()); write_boolean(file, "armed", usr().new_pattern_armed()); write_boolean(file, "thru", usr().new_pattern_thru()); write_boolean(file, "record", usr().new_pattern_record()); diff --git a/libseq66/src/cfg/usrsettings.cpp b/libseq66/src/cfg/usrsettings.cpp index fcd885a3..804bb274 100644 --- a/libseq66/src/cfg/usrsettings.cpp +++ b/libseq66/src/cfg/usrsettings.cpp @@ -25,7 +25,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2015-09-23 - * \updates 2023-09-30 + * \updates 2023-10-07 * \license GNU GPLv2 or above * * Note that this module also sets the remaining legacy global variables, so @@ -411,6 +411,7 @@ usrsettings::usrsettings () : m_session_url (), m_in_nsm_session (false), m_session_visibility (true), + m_escape_pattern (false), m_new_pattern_armed (false), m_new_pattern_thru (false), m_new_pattern_record (false), @@ -510,6 +511,7 @@ usrsettings::set_defaults () m_session_url.clear(); m_in_nsm_session = false; m_session_visibility = true; + m_escape_pattern = false; m_new_pattern_armed = false; m_new_pattern_thru = false; m_new_pattern_record = false; diff --git a/libseq66/src/play/sequence.cpp b/libseq66/src/play/sequence.cpp index 96847d91..fbb1d3e3 100644 --- a/libseq66/src/play/sequence.cpp +++ b/libseq66/src/play/sequence.cpp @@ -4095,7 +4095,8 @@ sequence::stream_event (event & ev) ev.note_velocity(m_rec_vol); /* modify incoming */ /* - * See USE_OLD_CODE below. We need to do this here, not there. + * See USE_OLD_CODE below. We need to do this here, not + * there. Fixes issue #119. */ if (alter_recording() && ev.is_note()) diff --git a/seq_qt5/forms/qseditoptions.ui b/seq_qt5/forms/qseditoptions.ui index 5152756b..e751599f 100644 --- a/seq_qt5/forms/qseditoptions.ui +++ b/seq_qt5/forms/qseditoptions.ui @@ -37,7 +37,6 @@ - 50 false @@ -65,7 +64,6 @@ - 50 false @@ -89,7 +87,6 @@ - 75 true @@ -210,7 +207,6 @@ - 75 true @@ -261,7 +257,6 @@ DejaVu Sans - 75 true @@ -318,7 +313,6 @@ - 75 true @@ -337,7 +331,6 @@ - 75 true @@ -366,7 +359,6 @@ - 75 true @@ -396,7 +388,6 @@ - 75 true @@ -436,7 +427,6 @@ - 75 true @@ -452,7 +442,6 @@ - 75 true @@ -522,7 +511,6 @@ Each port number can be found by name-lookup. - 50 false @@ -646,7 +634,6 @@ slot by channel number (0 to 15). - 75 true @@ -667,7 +654,6 @@ slot by channel number (0 to 15). DejaVu Sans - 75 true @@ -734,7 +720,6 @@ slot by channel number (0 to 15). - 75 true @@ -770,7 +755,6 @@ slot by channel number (0 to 15). - 50 false @@ -1401,7 +1385,6 @@ Range: 0.5 to 3.0 - 50 true false @@ -1421,7 +1404,6 @@ Range: 0.5 to 3.0 - 75 true @@ -1440,7 +1422,6 @@ Range: 0.5 to 3.0 - 75 true @@ -1482,7 +1463,6 @@ Range: 0.5 to 3.0 - 75 true @@ -1501,7 +1481,6 @@ Range: 0.5 to 3.0 - 75 true @@ -1751,7 +1730,6 @@ connects to the MIDI I/O ports it finds. - 75 true @@ -1770,7 +1748,6 @@ connects to the MIDI I/O ports it finds. - 50 true false @@ -1839,7 +1816,6 @@ in the Song Editor. - 75 true @@ -1857,7 +1833,6 @@ in the Song Editor. - 50 false @@ -1880,7 +1855,6 @@ playback resumes. - 50 false @@ -1904,7 +1878,6 @@ the default PPQN. - 50 false @@ -1925,7 +1898,6 @@ the default PPQN. Sans - 75 true @@ -1997,7 +1969,6 @@ Seq66 exits. - 75 true @@ -2015,7 +1986,6 @@ Seq66 exits. - 50 false @@ -2034,7 +2004,6 @@ Seq66 exits. - 50 false @@ -2053,7 +2022,6 @@ Seq66 exits. - 50 false @@ -2072,7 +2040,6 @@ Seq66 exits. - 50 false @@ -2098,7 +2065,6 @@ Seq66 exits. - 75 true @@ -2116,7 +2082,6 @@ Seq66 exits. - 50 false @@ -2135,7 +2100,6 @@ Seq66 exits. - 50 false @@ -2154,7 +2118,6 @@ Seq66 exits. - 50 false @@ -2200,7 +2163,6 @@ Seq66 exits. - 75 true @@ -2215,7 +2177,6 @@ Seq66 exits. - 75 true @@ -2231,7 +2192,6 @@ Seq66 exits. - 75 true @@ -2254,7 +2214,6 @@ Seq66 exits. - 75 true @@ -2270,7 +2229,6 @@ Seq66 exits. - 75 true @@ -2329,7 +2287,6 @@ Seq66 exits. - 75 true @@ -2345,7 +2302,6 @@ Seq66 exits. - 75 true @@ -2358,7 +2314,6 @@ Seq66 exits. - 75 true @@ -2371,7 +2326,6 @@ Seq66 exits. - 75 true @@ -2393,7 +2347,6 @@ Seq66 exits. - 75 true @@ -2415,7 +2368,6 @@ Seq66 exits. - 75 true @@ -2437,7 +2389,6 @@ Seq66 exits. - 75 true @@ -2494,7 +2445,6 @@ Seq66 exits. - 75 true @@ -2523,7 +2473,6 @@ Seq66 exits. - 75 true @@ -2565,7 +2514,6 @@ Seq66 exits. - 75 true @@ -2617,7 +2565,6 @@ Seq66 exits. - 75 true @@ -2646,7 +2593,6 @@ Seq66 exits. - 75 true @@ -2787,7 +2733,7 @@ Seq66 exits. 272 32 329 - 249 + 131 @@ -2875,6 +2821,32 @@ Seq66 exits. + + + + 270 + 180 + 331 + 131 + + + + Additional 'usr' Options + + + + + 20 + 40 + 301 + 28 + + + + Escape Can Close Pattern Editor + + + @@ -2891,7 +2863,6 @@ Seq66 exits. - 50 false @@ -2948,7 +2919,6 @@ Seq66 exits. - 75 true @@ -2969,7 +2939,6 @@ Seq66 exits. 11 - 50 true false @@ -2997,7 +2966,6 @@ required. - 75 true @@ -3227,7 +3195,6 @@ required. - 50 true false @@ -3247,7 +3214,6 @@ required. - 50 true false @@ -3345,7 +3311,6 @@ required. - 50 true false @@ -3410,7 +3375,6 @@ path added to this name is stripped. - 50 true false @@ -3430,7 +3394,6 @@ path added to this name is stripped. - 50 true false @@ -3450,7 +3413,6 @@ path added to this name is stripped. - 50 true false @@ -3531,7 +3493,6 @@ path added to this name is stripped. - 75 true @@ -3577,7 +3538,6 @@ path added to this name is stripped. 11 - 50 true false diff --git a/seq_qt5/include/qseditoptions.hpp b/seq_qt5/include/qseditoptions.hpp index 73b3a5ee..064b7691 100644 --- a/seq_qt5/include/qseditoptions.hpp +++ b/seq_qt5/include/qseditoptions.hpp @@ -28,7 +28,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-09-29 + * \updates 2023-10-07 * \license GNU GPLv2 or above */ @@ -256,6 +256,7 @@ private slots: void slot_metro_thru_buss (int index); void slot_metro_thru_channel (int index); void slot_metro_reload (); + void slot_escape_pattern (); void slot_new_pattern_arm (); void slot_new_pattern_qrecord (); void slot_new_pattern_record (); diff --git a/seq_qt5/src/qseditoptions.cpp b/seq_qt5/src/qseditoptions.cpp index 337771f2..f42f15e6 100644 --- a/seq_qt5/src/qseditoptions.cpp +++ b/seq_qt5/src/qseditoptions.cpp @@ -24,7 +24,7 @@ * \library seq66 application * \author Chris Ahlstrom * \date 2018-01-01 - * \updates 2023-09-29 + * \updates 2023-10-07 * \license GNU GPLv2 or above * * This version is located in Edit / Preferences. @@ -1431,6 +1431,7 @@ qseditoptions::slot_metro_thru_channel (int index) /* * Duty now for the Future! * + * checkBoxEscapePattern (for issue #117) * checkBoxNewPatternArm * checkBoxNewPatternQRecord * checkBoxNewPatternRecord @@ -1454,6 +1455,12 @@ qseditoptions::setup_tab_pattern () * New-pattern boolean options. */ + ui->checkBoxEscapePattern->setChecked(usr().escape_pattern()); + connect + ( + ui->checkBoxEscapePattern, SIGNAL(clicked(bool)), + this, SLOT(slot_escape_pattern()) + ); ui->checkBoxNewPatternArm->setChecked(usr().new_pattern_armed()); connect ( @@ -1523,6 +1530,14 @@ qseditoptions::setup_tab_pattern () ); } +void +qseditoptions::slot_escape_pattern () +{ + bool enable = ui->checkBoxEscapePattern->isChecked(); + usr().escape_pattern(enable); + modify_usr(); +} + void qseditoptions::slot_new_pattern_arm () { diff --git a/seq_qt5/src/qseqeditframe64.cpp b/seq_qt5/src/qseqeditframe64.cpp index edf548d9..918435ad 100644 --- a/seq_qt5/src/qseqeditframe64.cpp +++ b/seq_qt5/src/qseqeditframe64.cpp @@ -1181,7 +1181,20 @@ qseqeditframe64::keyPressEvent (QKeyEvent * event) } else if (key == Qt::Key_Escape) { - m_seqroll->set_adding(false); + /* + * If the parent is a qseqeditex, and if enabled, Esc can + * close the pattern editor. A concession for issue #117. + */ + + if (m_seqroll->adding()) + { + m_seqroll->set_adding(false); + } + else if (not_nullptr(m_qseqeditex_frame)) + { + if (usr().escape_pattern() && ! short_version()) + m_qseqeditex_frame->close(); + } } else if (isctrl) { @@ -1431,7 +1444,9 @@ qseqeditframe64::initialize_panels () { scroll_to_tick(ts); scroll_to_note(n); -printf("Avg note = %d\n", n); +#if defined SEQ66_PLATFORM_DEBUG + printf("Avg note = %d\n", n); +#endif } else {