diff options
author | Taybin Rutkin <taybin@taybin.com> | 2006-01-13 22:46:04 +0000 |
---|---|---|
committer | Taybin Rutkin <taybin@taybin.com> | 2006-01-13 22:46:04 +0000 |
commit | 9747fa891093251d1c828cd9acadebc4a432d6cf (patch) | |
tree | 36d348cd9fe8d37858fa008c5b59a8a6cfb94f72 | |
parent | 6817b59169b2c334245f8018d7e3f2235e195aa0 (diff) |
All useage of ArdourPrompter checks for a valid result.
Gtkmm2ext::Prompter set as WINDOW_TYPE_HINT_DIALOG.
Adding fields to the sfdb works.
git-svn-id: svn://localhost/trunk/ardour2@271 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/audio_time_axis.cc | 20 | ||||
-rw-r--r-- | gtk2_ardour/editor_edit_groups.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 25 | ||||
-rw-r--r-- | gtk2_ardour/visual_time_axis.cc | 38 | ||||
-rw-r--r-- | gtk2_ardour/visual_time_axis.h | 4 | ||||
-rw-r--r-- | libs/ardour/audio_library.cc | 8 | ||||
-rw-r--r-- | libs/gtkmm2ext/prompter.cc | 1 |
8 files changed, 49 insertions, 54 deletions
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 2adc56e43f..013635f954 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -837,7 +837,9 @@ AudioTimeAxisView::rename_current_playlist () switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: prompter.get_result (name); - pl->set_name (name); + if (name.length()) { + pl->set_name (name); + } break; default: @@ -876,9 +878,11 @@ AudioTimeAxisView::use_copy_playlist () switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: prompter.get_result (name); - ds->use_copy_playlist (); - pl = ds->playlist(); - pl->set_name (name); + if (name.length()) { + ds->use_copy_playlist (); + pl = ds->playlist(); + pl->set_name (name); + } break; default: @@ -906,9 +910,11 @@ AudioTimeAxisView::use_new_playlist () switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: prompter.get_result (name); - ds->use_new_playlist (); - pl = ds->playlist(); - pl->set_name (name); + if (name.length()) { + ds->use_new_playlist (); + pl = ds->playlist(); + pl->set_name (name); + } break; default: diff --git a/gtk2_ardour/editor_edit_groups.cc b/gtk2_ardour/editor_edit_groups.cc index d9728345c8..b77594aabd 100644 --- a/gtk2_ardour/editor_edit_groups.cc +++ b/gtk2_ardour/editor_edit_groups.cc @@ -89,7 +89,7 @@ Editor::new_edit_group () switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: - prompter.get_result (result); + prompter.get_result (result); if (result.length()) { session->add_edit_group (result); } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index c92eadc284..0605371170 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -4465,11 +4465,10 @@ Editor::mouse_rename_region (ArdourCanvas::Item* item, GdkEvent* event) prompter.show_all (); switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: - string str; + string str; prompter.get_result(str); if (str.length()) { - - clicked_regionview->region.set_name (str); + clicked_regionview->region.set_name (str); } break; } diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 891a8dad19..d737d409fd 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -74,6 +74,7 @@ SoundFileBox::SoundFileBox () main_box.pack_start(top_box, false, false); main_box.pack_start(bottom_box, false, false); + field_view.set_model (fields); field_view.set_size_request(200, 150); field_view.append_column (_("Field"), label_columns.field); field_view.append_column_editable (_("Value"), label_columns.data); @@ -161,6 +162,8 @@ SoundFileBox::setup_fields () { ENSURE_GUI_THREAD(mem_fun (*this, &SoundFileBox::setup_fields)); + fields->clear (); + vector<string> field_list; Library->get_fields(field_list); @@ -168,12 +171,15 @@ SoundFileBox::setup_fields () Gtk::TreeModel::iterator iter; Gtk::TreeModel::Row row; for (i = field_list.begin(); i != field_list.end(); ++i) { - string value = Library->get_field(path, *i); - iter = fields->append(); - row = *iter; - - row[label_columns.field] = *i; - row[label_columns.data] = value; + if (!(*i == _("channels") || *i == _("samplerate") || + *i == _("resolution") || *i == _("format"))) { + iter = fields->append(); + row = *iter; + + string value = Library->get_field(path, *i); + row[label_columns.field] = *i; + row[label_columns.data] = value; + } } } @@ -244,10 +250,11 @@ SoundFileBox::add_field_clicked () switch (prompter.run ()) { case Gtk::RESPONSE_ACCEPT: - cout << name << endl; prompter.get_result (name); - Library->add_field (name); - Library->save_changes (); + if (name.length()) { + Library->add_field (name); + Library->save_changes (); + } break; default: diff --git a/gtk2_ardour/visual_time_axis.cc b/gtk2_ardour/visual_time_axis.cc index b282b239e9..3dbdf10898 100644 --- a/gtk2_ardour/visual_time_axis.cc +++ b/gtk2_ardour/visual_time_axis.cc @@ -91,7 +91,6 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se size_button (_("h")) { time_axis_name = name ; - name_prompter = 0 ; _color = unique_random_color() ; _marked_for_display = true; @@ -130,11 +129,6 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se */ VisualTimeAxis::~VisualTimeAxis() { - if(name_prompter) - { - delete name_prompter ; - name_prompter = 0 ; - } } @@ -350,33 +344,25 @@ VisualTimeAxis::idle_remove_this_time_axis(VisualTimeAxis* ta, void* src) void VisualTimeAxis::start_time_axis_rename() { - if(name_prompter) - { - delete name_prompter ; - name_prompter = 0 ; - } - - name_prompter = new ArdourPrompter() ; + ArdourPrompter name_prompter; - name_prompter->set_prompt (_("new name: ")) ; - name_prompter->show_all() ; + name_prompter.set_prompt (_("new name: ")) ; + name_prompter.show_all() ; - switch (name_prompter->run ()) { + switch (name_prompter.run ()) { case Gtk::RESPONSE_ACCEPT: string result; - name_prompter->get_result (result); - if (editor.get_named_time_axis(result) != 0) { - ARDOUR_UI::instance()->popup_error (_("A track already exists with that name")); - return ; - } + name_prompter.get_result (result); + if (result.length()) { + if (editor.get_named_time_axis(result) != 0) { + ARDOUR_UI::instance()->popup_error (_("A track already exists with that name")); + return ; + } - set_time_axis_name(result, this) ; + set_time_axis_name(result, this) ; + } } - delete name_prompter ; - name_prompter = 0 ; label_view() ; - - } /** diff --git a/gtk2_ardour/visual_time_axis.h b/gtk2_ardour/visual_time_axis.h index 6e3629ea06..4be2da3b9a 100644 --- a/gtk2_ardour/visual_time_axis.h +++ b/gtk2_ardour/visual_time_axis.h @@ -243,10 +243,6 @@ class VisualTimeAxis : public TimeAxisView /** the name of this TimeAxis object */ std::string time_axis_name ; - /** used to get a new name for this TimeAxis */ - ArdourPrompter* name_prompter ; - - //---------------------------------------------------------------------------------------// // Super class methods not handled by VisualTimeAxis diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index 37f558445b..33a1ad230e 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -88,10 +88,10 @@ AudioLibrary::initialize_db () lrdf_add_triple(src.c_str(), SOUNDFILE, RDF_TYPE, RDFS_CLASS, lrdf_uri); // add intergral fields - add_field("channels"); - add_field("samplerate"); - add_field("resolution"); - add_field("format"); + add_field(_("channels")); + add_field(_("samplerate")); + add_field(_("resolution")); + add_field(_("format")); } void diff --git a/libs/gtkmm2ext/prompter.cc b/libs/gtkmm2ext/prompter.cc index f61d093083..6bcce00c6f 100644 --- a/libs/gtkmm2ext/prompter.cc +++ b/libs/gtkmm2ext/prompter.cc @@ -45,6 +45,7 @@ Prompter::Prompter (bool modal) void Prompter::init () { + set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG); set_position (Gtk::WIN_POS_MOUSE); set_name ("Prompter"); |