- snprintf (buf, sizeof (buf), "%.2f", bpm);
- bpm_entry.set_text (buf);
- bpm_entry.select_region (0, -1);
-
- hspacer1.set_border_width (5);
- hspacer1.pack_start (bpm_entry, false, false);
- vspacer1.set_border_width (5);
- vspacer1.pack_start (hspacer1, false, false);
-
- bpm_frame.add (vspacer1);
-
- button_box.set_border_width (10);
- button_box.set_spacing (5);
- button_box.set_homogeneous (true);
- button_box.pack_start (ok_button);
- button_box.pack_start (cancel_button);
-
- vpacker.set_border_width (10);
- vpacker.set_spacing (5);
+ vector<string> strings;
+ NoteTypes::iterator x;
+
+ bpm_spinner.set_numeric (true);
+ bpm_spinner.set_digits (2);
+ bpm_spinner.set_wrap (true);
+ bpm_spinner.set_value (bpm);
+ bpm_spinner.set_alignment (1.0);
+
+ note_types.insert (make_pair (_("whole"), 1.0));
+ strings.push_back (_("whole"));
+ note_types.insert (make_pair (_("second"), 2.0));
+ strings.push_back (_("second"));
+ note_types.insert (make_pair (_("third"), 3.0));
+ strings.push_back (_("third"));
+ note_types.insert (make_pair (_("quarter"), 4.0));
+ strings.push_back (_("quarter"));
+ note_types.insert (make_pair (_("eighth"), 8.0));
+ strings.push_back (_("eighth"));
+ note_types.insert (make_pair (_("sixteenth"), 16.0));
+ strings.push_back (_("sixteenth"));
+ note_types.insert (make_pair (_("thirty-second"), 32.0));
+ strings.push_back (_("thirty-second"));
+ note_types.insert (make_pair (_("sixty-fourth"), 64.0));
+ strings.push_back (_("sixty-fourth"));
+ note_types.insert (make_pair (_("one-hundred-twenty-eighth"), 128.0));
+ strings.push_back (_("one-hundred-twenty-eighth"));
+
+ set_popdown_strings (pulse_selector, strings);
+
+ for (x = note_types.begin(); x != note_types.end(); ++x) {
+ if (x->second == note_type) {
+ pulse_selector.set_active_text (x->first);
+ break;
+ }
+ }
+
+ if (x == note_types.end()) {
+ pulse_selector.set_active_text (strings[3]); // "quarter"
+ }
+
+ strings.clear();
+
+ tempo_types.insert (make_pair (_("ramped"), TempoSection::Ramp));
+ strings.push_back (_("ramped"));
+ tempo_types.insert (make_pair (_("constant"), TempoSection::Constant));
+ strings.push_back (_("constant"));
+ set_popdown_strings (tempo_type, strings);
+ TempoTypes::iterator tt;
+ for (tt = tempo_types.begin(); tt != tempo_types.end(); ++tt) {
+ if (tt->second == type) {
+ tempo_type.set_active_text (tt->first);
+ break;
+ }
+ }
+ if (tt == tempo_types.end()) {
+ tempo_type.set_active_text (strings[1]); // "constant"
+ }
+
+ strings.clear();
+
+ lock_styles.insert (make_pair (_("music"), MusicTime));
+ strings.push_back (_("music"));
+ lock_styles.insert (make_pair (_("audio"), AudioTime));
+ strings.push_back (_("audio"));
+ set_popdown_strings (lock_style, strings);
+ LockStyles::iterator ls;
+ for (ls = lock_styles.begin(); ls != lock_styles.end(); ++ls) {
+ if (ls->second == style) {
+ lock_style.set_active_text (ls->first);
+ break;
+ }
+ }
+ if (ls == lock_styles.end()) {
+ lock_style.set_active_text (strings[0]); // "music"
+ }
+
+ Table* table;
+
+ if (UIConfiguration::instance().get_allow_non_quarter_pulse()) {
+ table = manage (new Table (5, 7));
+ } else {
+ table = manage (new Table (5, 6));
+ }
+
+ table->set_spacings (6);
+ table->set_homogeneous (false);
+
+ int row;
+ Label* bpm_label = manage (new Label(_("Beats per minute:"), ALIGN_LEFT, ALIGN_CENTER));
+ table->attach (*bpm_label, 0, 1, 0, 1);
+ table->attach (bpm_spinner, 1, 5, 0, 1);
+
+ if (UIConfiguration::instance().get_allow_non_quarter_pulse()) {
+ table->attach (pulse_selector_label, 0, 1, 1, 2);
+ table->attach (pulse_selector, 1, 5, 1, 2);
+ row = 2;
+ } else {
+ row = 1;
+ }
+
+ char buf[64];
+
+ snprintf (buf, sizeof (buf), "%" PRIu32, when.bars);
+ when_bar_entry.set_text (buf);
+ snprintf (buf, sizeof (buf), "%" PRIu32, when.beats);
+ when_beat_entry.set_text (buf);