13
0

add enum and member var for controlling what kind of tempo editing we are doing

note: this was much harder than it ought to be
This commit is contained in:
Paul Davis 2023-04-07 15:59:55 -06:00
parent 4b1d5d9b63
commit 8fbf2c3f52
11 changed files with 47 additions and 0 deletions

View File

@ -163,5 +163,15 @@ const char *importmodestrs[] = {
#undef IMPORTMODE
#define IMPORTMODE(a) /*empty*/
//TEMPOEDITBEHAVIOR
#undef TEMPOEDITBEHAVIOR
#define TEMPOEDITBEHAVIOR(s) N_(#s),
const char *tempoeditbehaviorstrs[] = {
#include "editing_syms.h"
0
};
#undef TEMPOEDITBEHAVIOR
#define TEMPOEDITBEHAVIOR(a) /*empty*/
} // namespace Editing

View File

@ -41,6 +41,7 @@
#define WAVEFORMSCALE(a) /*empty*/
#define WAVEFORMSHAPE(a) /*empty*/
#define INSERTTIMEOPT(a) /*empty*/
#define TEMPOEDITBEHAVIOR(a) /*empty*/
namespace Editing {
@ -197,6 +198,18 @@ enum InsertTimeOption {
#undef INSERTTIMEOPT
#define INSERTTIMEOPT(a) /*empty*/
#undef TEMPOEDITBEHAVIOR
#define TEMPOEDITBEHAVIOR(a) a,
enum TempoEditBehavior {
#include "editing_syms.h"
};
extern const char *tempoeditbehaviorstrs[];
inline const char* enum2str(TempoEditBehavior m) {return tempoeditbehaviorstrs[m];}
TempoEditBehavior str2tempoeditbehavior(const std::string &);
#undef TEMPOEDITBEHAVIOR
#define TEMPOEDITBEHAVIOR(a) /*empty*/
/////////////////////
// These don't need their state saved. yet...

View File

@ -32,6 +32,7 @@ DEFINE_ENUM_CONVERT(Editing::SnapMode)
DEFINE_ENUM_CONVERT(Editing::EditPoint)
DEFINE_ENUM_CONVERT(Editing::RegionListSortType)
DEFINE_ENUM_CONVERT(Editing::MouseMode)
DEFINE_ENUM_CONVERT(Editing::TempoEditBehavior)
} // namespace PBD

View File

@ -107,3 +107,6 @@ EDITPOINT(EditAtMouse)
INSERTTIMEOPT(LeaveIntersected)
INSERTTIMEOPT(MoveIntersected)
INSERTTIMEOPT(SplitIntersected)
TEMPOEDITBEHAVIOR(TempoMapping)
TEMPOEDITBEHAVIOR(TempoChanging)

View File

@ -470,6 +470,7 @@ Editor::Editor ()
, _stepping_axis_view (0)
, quantize_dialog (0)
, _main_menu_disabler (0)
, _tempo_edit_behavior (UIConfiguration::instance().get_default_tempo_edit_behavior())
{
/* we are a singleton */

View File

@ -620,6 +620,9 @@ public:
void remove_region_marker (ARDOUR::CueMarker&);
void make_region_markers_global (bool as_cd_markers);
Editing::TempoEditBehavior tempo_edit_behavior() const { return _tempo_edit_behavior; }
void set_tempo_edit_behavior (Editing::TempoEditBehavior teb);
protected:
void map_transport_state ();
void map_position_change (samplepos_t);
@ -2525,6 +2528,8 @@ private:
void choose_mapping_drag (ArdourCanvas::Item*, GdkEvent*);
Editing::TempoEditBehavior _tempo_edit_behavior;
template<typename T>
Temporal::TimeDomain drag_time_domain (T* thing_with_time_domain) {
return thing_with_time_domain ? thing_with_time_domain->time_domain() : Temporal::AudioTime;

View File

@ -894,3 +894,9 @@ Editor::mid_tempo_per_region_update (RegionView* rv)
{
rv->tempo_map_changed ();
}
void
Editor::set_tempo_edit_behavior (TempoEditBehavior teb)
{
_tempo_edit_behavior = teb;
}

View File

@ -60,6 +60,7 @@ setup_gtk_ardour_enums ()
StartupFSM::DialogID startup_dialog;
Gtk::ResponseType dialog_response;
AddRouteDialog::TypeWanted type_wanted;
TempoEditBehavior tempo_edit_behavior;
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear()
@ -227,4 +228,8 @@ setup_gtk_ardour_enums ()
REGISTER_CLASS_ENUM (AddRouteDialog, VCAMaster);
REGISTER_CLASS_ENUM (AddRouteDialog, FoldbackBus);
REGISTER (type_wanted);
REGISTER_ENUM (TempoMapping);
REGISTER_ENUM (TempoChanging);
REGISTER (tempo_edit_behavior);
}

View File

@ -53,6 +53,7 @@
#include "canvas/text.h"
#include "editing_convert.h"
#include "ui_config.h"
#include "pbd/i18n.h"

View File

@ -43,6 +43,7 @@
#include "gtkmm2ext/colors.h"
#include "widgets/ui_config.h"
#include "editing.h"
#include "utils.h"
class UIConfiguration : public ArdourWidgets::UIConfigurationBase

View File

@ -146,6 +146,7 @@ UI_CONFIG_VARIABLE (int, default_upper_midi_note, "default-upper-midi-note", 71)
UI_CONFIG_VARIABLE (bool, ask_before_closing_last_window, "ask-before-closing-last-window", true)
UI_CONFIG_VARIABLE (std::string, freesound_dir, "freesound-dir", "")
UI_CONFIG_VARIABLE (int, max_note_height, "max-note-height", 20)
UI_CONFIG_VARIABLE (Editing::TempoEditBehavior, default_tempo_edit_behavior, "default-tempo-edit-behavior", Editing::TempoMapping)
/* these are visibility-type selections in the New Track dialog that we should make persistent for the user's choices */
UI_CONFIG_VARIABLE (bool, show_on_cue_page, "show-on-cue-page", true)