X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Foption_editor.cc;h=040146876b413d5bd37934dc230bdc12e64fdc34;hb=459eda7e11e4b8fa9767dc8a3e2b1228dc54078e;hp=807aee93bdcabafaba687f23e184bbabc4c266cf;hpb=84a801a7913714a2284f1142cb9bb3a335dd1a7e;p=ardour.git diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 807aee93bd..040146876b 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -109,7 +109,7 @@ EntryOption::EntryOption (string const & i, string const & n, sigc::slot _set (s) { _label = manage (new Label (n + ":")); - _label->set_alignment (1, 0.5); + _label->set_alignment (0, 0.5); _entry = manage (new Entry); _entry->signal_activate().connect (sigc::mem_fun (*this, &EntryOption::activated)); } @@ -191,6 +191,35 @@ FaderOption::add_to_page (OptionEditorPage* p) add_widgets_to_page (p, &_label, &_box); } +ClockOption::ClockOption (string const & i, string const & n, sigc::slot g, sigc::slot s) + : Option (i, n) + , _clock (X_("timecode-offset"), false, X_("TimecodeOffset"), true, false, true, false) + , _get (g) + , _set (s) +{ + _label.set_text (n + ":"); + _label.set_alignment (0, 0.5); + _label.set_name (X_("OptionsLabel")); +} + +void +ClockOption::set_state_from_config () +{ + _clock.set (_get ()); +} + +void +ClockOption::add_to_page (OptionEditorPage* p) +{ + add_widgets_to_page (p, &_label, &_clock); +} + +void +ClockOption::set_session (Session* s) +{ + _clock.set_session (s); +} + OptionEditorPage::OptionEditorPage (Gtk::Notebook& n, std::string const & t) : table (1, 3) { @@ -211,7 +240,7 @@ OptionEditor::OptionEditor (Configuration* c, std::string const & t) using namespace Notebook_Helpers; set_default_size (300, 300); - set_wmclass (X_("ardour_preferences"), "Ardour"); + set_wmclass (X_("ardour_preferences"), PROGRAM_NAME); set_name ("Preferences"); add_events (Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK); @@ -267,11 +296,26 @@ OptionEditor::add_option (std::string const & pn, OptionEditorComponent* o) _pages[pn] = new OptionEditorPage (_notebook, pn); } - cout << "add thing to " << pn << "\n"; - OptionEditorPage* p = _pages[pn]; p->components.push_back (o); o->add_to_page (p); o->set_state_from_config (); } + +void +OptionEditor::set_current_page (string const & p) +{ + int i = 0; + while (i < _notebook.get_n_pages ()) { + if (_notebook.get_tab_label_text (*_notebook.get_nth_page (i)) == p) { + _notebook.set_current_page (i); + return; + } + + ++i; + } +} + + +