13
0

improvements to BBT marker dialog appearance and behavior

This commit is contained in:
Paul Davis 2022-06-03 13:20:13 -06:00
parent 88a035b000
commit de2c553e1a
6 changed files with 31 additions and 5 deletions

View File

@ -34,6 +34,7 @@ BBTMarkerDialog::BBTMarkerDialog (timepos_t const & pos)
, _point (0) , _point (0)
, _position (pos) , _position (pos)
, entry_label (_("Position")) , entry_label (_("Position"))
, name_label (_("Name"))
{ {
BBT_Time bbt = TempoMap::use()->bbt_at (pos).round_to_beat (); BBT_Time bbt = TempoMap::use()->bbt_at (pos).round_to_beat ();
@ -50,11 +51,22 @@ BBTMarkerDialog::BBTMarkerDialog (timepos_t const & pos)
bar_entry.set_value (bbt.bars); bar_entry.set_value (bbt.bars);
beat_entry.set_value (bbt.beats); beat_entry.set_value (bbt.beats);
name_box.pack_start (name_label);
name_box.pack_start (name_entry);
name_entry.signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &BBTMarkerDialog::response), Gtk::RESPONSE_OK));
get_vbox()->pack_start (name_box);
get_vbox()->pack_start (bbt_box); get_vbox()->pack_start (bbt_box);
bbt_box.show_all (); bbt_box.show_all ();
name_box.show_all ();
add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (Stock::CANCEL, RESPONSE_CANCEL);
add_button (_("Add Marker"), RESPONSE_OK); add_button (_("Add Marker"), RESPONSE_OK);
get_vbox()->set_border_width (12);
get_vbox()->set_spacing (12);
} }
BBT_Time BBT_Time
@ -71,3 +83,9 @@ BBTMarkerDialog::position() const
{ {
return _position; return _position;
} }
std::string
BBTMarkerDialog::name () const
{
return name_entry.get_text();
}

View File

@ -20,6 +20,7 @@
#define __ardour_gtk_bbt_marker_dialog_h__ #define __ardour_gtk_bbt_marker_dialog_h__
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <gtkmm/spinbutton.h> #include <gtkmm/spinbutton.h>
@ -37,6 +38,7 @@ public:
Temporal::timepos_t position() const; Temporal::timepos_t position() const;
Temporal::BBT_Time bbt_value () const; Temporal::BBT_Time bbt_value () const;
std::string name() const;
private: private:
void init (); void init ();
@ -47,6 +49,10 @@ private:
Gtk::SpinButton bar_entry; Gtk::SpinButton bar_entry;
Gtk::SpinButton beat_entry; Gtk::SpinButton beat_entry;
Gtk::Label entry_label; Gtk::Label entry_label;
Gtk::HBox name_box;
Gtk::Entry name_entry;
Gtk::Label name_label;
}; };
#endif /* __ardour_gtk_bbt_marker_dialog_h__ */ #endif /* __ardour_gtk_bbt_marker_dialog_h__ */

View File

@ -3817,12 +3817,14 @@ BBTRulerDrag::finished (GdkEvent* event, bool movement_occurred)
int result = marker_dialog->run (); int result = marker_dialog->run ();
BBT_Time bbt; BBT_Time bbt;
std::string name;
switch (result) { switch (result) {
case RESPONSE_ACCEPT: case RESPONSE_ACCEPT:
case RESPONSE_OK: case RESPONSE_OK:
bbt = marker_dialog->bbt_value (); bbt = marker_dialog->bbt_value ();
map->set_bartime (bbt, marker_dialog->position()); name = marker_dialog->name();
map->set_bartime (bbt, marker_dialog->position(), name);
delete marker_dialog; delete marker_dialog;
break; break;
default: default:

View File

@ -164,7 +164,7 @@ Editor::reassociate_metric_marker (TempoMap::SharedPtr const & tmap, TempoMap::M
void void
Editor::make_bbt_marker (MusicTimePoint const * mtp) Editor::make_bbt_marker (MusicTimePoint const * mtp)
{ {
bbt_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker"), "foo!", *mtp)); bbt_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker"), *mtp));
} }
void void

View File

@ -721,8 +721,8 @@ MeterMarker::point() const
/***********************************************************************/ /***********************************************************************/
BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Item& parent, guint32 rgba, const string& text, Temporal::MusicTimePoint const & p) BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Item& parent, guint32 rgba, Temporal::MusicTimePoint const & p)
: MetricMarker (editor, parent, rgba, text, BBTPosition, p.time(), false) : MetricMarker (editor, parent, rgba, p.name(), BBTPosition, p.time(), false)
, _point (&p) , _point (&p)
{ {
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_bbt_marker_event), group, this)); group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_bbt_marker_event), group, this));

View File

@ -211,7 +211,7 @@ class MeterMarker : public MetricMarker
class BBTMarker : public MetricMarker class BBTMarker : public MetricMarker
{ {
public: public:
BBTMarker (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, const std::string& text, Temporal::MusicTimePoint const &); BBTMarker (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, Temporal::MusicTimePoint const &);
~BBTMarker (); ~BBTMarker ();
void reset_point (Temporal::MusicTimePoint const &); void reset_point (Temporal::MusicTimePoint const &);