Skip to content

Commit

Permalink
Hidden work to support show meta text, in progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlstromcj committed Apr 30, 2023
1 parent 04794ff commit 820308f
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 33 deletions.
3 changes: 1 addition & 2 deletions libseq66/include/midi/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,14 @@ class event
event & operator = (const event & rhs);
virtual ~event ();

void prep_for_send (midipulse tick, const event & source);

/*
* Operator overload, the only one needed for sorting events in a list
* or a map.
*/

bool operator < (const event & rhsevent) const;
bool match (const event & target) const;
void prep_for_send (midipulse tick, const event & source);

void set_input_bus (bussbyte b)
{
Expand Down
12 changes: 7 additions & 5 deletions libseq66/include/midi/eventlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ class eventlist

bool m_has_time_signature;

/**
* Another flag.
*/

bool m_has_key_signature;

/**
* Stores the setting of usr().new_pattern_wraparound(). It is used in
* the link_new() function.
Expand Down Expand Up @@ -385,11 +391,7 @@ class eventlist
bool randomize_selected (midibyte status, int plus_minus);
bool randomize_selected_notes (int jitter, int range);
bool jitter_notes (int jitter);
bool link_notes
(
event::iterator eon,
event::iterator eoff
);
bool link_notes (event::iterator eon, event::iterator eoff);
void link_tempos ();
void clear_tempo_links ();
bool mark_selected ();
Expand Down
12 changes: 8 additions & 4 deletions libseq66/include/util/strfunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* \author Chris Ahlstrom
* \date 2018-11-23
* \updates 2023-04-27
* \updates 2023-04-29
* \version $Revision$
*
* Also see the strfunctions.cpp module.
Expand Down Expand Up @@ -85,15 +85,18 @@ extern bool strncompare
extern bool strcasecompare (const std::string & a, const std::string & b);
extern std::string & ltrim
(
std::string & str, const std::string & chars = SEQ66_TRIM_CHARS
std::string & str,
const std::string & chars = SEQ66_TRIM_CHARS
);
extern std::string & rtrim
(
std::string & str, const std::string & chars = SEQ66_TRIM_CHARS
std::string & str,
const std::string & chars = SEQ66_TRIM_CHARS
);
extern std::string trim
(
const std::string & str, const std::string & chars = SEQ66_TRIM_CHARS
const std::string & str,
const std::string & chars = SEQ66_TRIM_CHARS
);
extern std::string string_replace
(
Expand Down Expand Up @@ -125,6 +128,7 @@ extern double string_to_double
);
extern std::string double_to_string(double value, int precision = 0);
extern long string_to_long (const std::string & s, long defalt = 0L);
extern std::string long_to_string (long value);
extern unsigned long string_to_unsigned_long
(
const std::string & s, unsigned long defalt = 0UL
Expand Down
19 changes: 8 additions & 11 deletions libseq66/src/midi/eventlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ eventlist::eventlist () :
m_is_modified (false),
m_has_tempo (false),
m_has_time_signature (false),
m_has_key_signature (false),
m_link_wraparound (usr().new_pattern_wraparound())
{
// No code needed
Expand All @@ -79,6 +80,7 @@ eventlist::eventlist (const eventlist & rhs) :
m_is_modified (rhs.m_is_modified),
m_has_tempo (rhs.m_has_tempo),
m_has_time_signature (rhs.m_has_time_signature),
m_has_key_signature (false),
m_link_wraparound (rhs.m_link_wraparound)
{
// no code
Expand All @@ -98,6 +100,7 @@ eventlist::operator = (const eventlist & rhs)
m_is_modified = rhs.m_is_modified;
m_has_tempo = rhs.m_has_tempo;
m_has_time_signature = rhs.m_has_time_signature;
m_has_key_signature = rhs.m_has_key_signature;
m_link_wraparound = rhs.m_link_wraparound;
}
return *this;
Expand Down Expand Up @@ -182,6 +185,9 @@ eventlist::append (const event & e)
if (e.is_time_signature())
m_has_time_signature = true;

if (e.is_key_signature())
m_has_key_signature = true;

return true;
}

Expand Down Expand Up @@ -356,13 +362,11 @@ eventlist::link_new (bool wrap)
{
if (link_notes(on, off))
{
// #if defined USE_NEW_CODE
if (! wrap_em)
{
if (off->timestamp() < on->timestamp())
off->set_timestamp(get_length() - 1);
}
// #endif
break;
}
++off;
Expand Down Expand Up @@ -480,12 +484,7 @@ void
eventlist::clear_links ()
{
for (auto & e : m_events)
{
#if 0
if (not_nullptr(&e)) /* ca 2023-04-24 */
#endif
e.clear_links(); /* does unmark() and unlink() */
}
e.clear_links(); /* does unmark() and unlink() */
}

int
Expand Down Expand Up @@ -804,7 +803,7 @@ eventlist::adjust_timestamp (event & er, midipulse delta_tick)
result = note_off_margin();
}
}
else /* if (wrap) */
else /* if (wrap) */
{
if (result == seqlength)
{
Expand Down Expand Up @@ -1786,8 +1785,6 @@ eventlist::select_events
{
if (event_in_range(er, status, tick_s, tick_f))
{
// midibyte d0, d1;
// er.get_data(d0, d1);
if (er.is_desired(status, cc))
{
if (action == select::selecting)
Expand Down
12 changes: 10 additions & 2 deletions libseq66/src/util/strfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2018-11-24
* \updates 2023-04-27
* \updates 2023-04-29
* \version $Revision$
*
* We basically include only the functions we need for Seq66, not
Expand Down Expand Up @@ -842,6 +842,14 @@ string_to_long (const std::string & s, long defalt)
return result;
}

std::string
long_to_string (long value)
{
char temp[32];
(void) snprintf(temp, sizeof temp, "%ld", value);
return std::string(temp);
}

/**
* Converts a string to an unsigned long integer.
*/
Expand Down Expand Up @@ -1084,7 +1092,7 @@ tokenize_stanzas
BR = brackets[1];
CBR = brackets[1];
}
tokens.clear(); /* set size = 0 */
tokens.clear();
bleft = source.find_first_of(BL, bleft);
if (bleft != std::string::npos)
{
Expand Down
13 changes: 11 additions & 2 deletions seq_qt5/forms/qsessionframe.ui
Original file line number Diff line number Diff line change
Expand Up @@ -643,16 +643,22 @@ author and dates. The size limit is 1024 characters.</string>
<height>26</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Changes the current track number, ranging&lt;/p&gt;&lt;p&gt;from 0 to the highest pattern. Then, if&lt;/p&gt;&lt;p&gt;any Meta Text is present in that pattern,&lt;/p&gt;&lt;p&gt;then the first one is shown.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QScrollBar" name="scrollBarTextNumber">
<property name="geometry">
<rect>
<x>110</x>
<x>120</x>
<y>380</y>
<width>61</width>
<width>41</width>
<height>26</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Moves forward (not yet backward) to the&lt;/p&gt;&lt;p&gt;next Meta Text event, if any.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand All @@ -672,6 +678,9 @@ author and dates. The size limit is 1024 characters.</string>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Displays the time stamp of the current&lt;/p&gt;&lt;p&gt;Meta Text event. Editable as well.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelTimeStamp">
<property name="geometry">
Expand Down
31 changes: 30 additions & 1 deletion seq_qt5/include/qsessionframe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2020-08-24
* \updates 2023-04-29
* \updates 2023-04-30
* \license GNU GPLv2 or above
*
* We want to be able to survey the existing mute-groups.
Expand Down Expand Up @@ -93,6 +93,9 @@ class qsessionframe : public QFrame
return m_performer;
}

void sync_track_label ();
void sync_track_high ();

protected: // overrides of event handlers

virtual void keyPressEvent (QKeyEvent *) override;
Expand All @@ -105,6 +108,8 @@ private slots:
void slot_flag_reload ();
void slot_songinfo_change ();
void slot_save_info ();
void slot_track_number (int trk);
void slot_text_number (int textnum);
void slot_macros_active ();
void slot_macro_pick (const QString &);
void slot_log_file ();
Expand All @@ -121,8 +126,32 @@ private slots:

qsmainwnd * m_main_window;

/**
* The main player :-).
*/

performer & m_performer;

/**
* Holds the currently selected track, needed when the track selection
* changes in order to clear the "next match" flag.
*/

int m_current_track;

/**
* A counter for Meta Text events when a track contains more than one.
*/

int m_current_text_number;

/**
* The highest-numbered track, plus one, kept synchronized with
* performer::m_sequence_high.
*/

int m_track_high;

};

} // namespace seq66
Expand Down
Loading

0 comments on commit 820308f

Please sign in to comment.