Heavy-duty abstraction work to split type-specific classes into
[ardour.git] / gtk2_ardour / editor_markers.cc
index cafe1cec0c4042eaa35aeb2a7c7e7b8b50c1dbe4..f34b8590a48a9d0e079a67c7b290354b53ea5daf 100644 (file)
 #include "gui_thread.h"
 #include "simplerect.h"
 #include "actions.h"
+#include "prompter.h"
 
 #include "i18n.h"
 
 using namespace std;
 using namespace sigc;
 using namespace ARDOUR;
+using namespace PBD;
 using namespace Gtk;
 
 void
@@ -712,9 +714,9 @@ Editor::marker_menu_set_from_selection ()
                                }
                        }
                        else {
-                               if (!selection->audio_regions.empty()) {
-                                       l->set_start (selection->audio_regions.start());
-                                       l->set_end (selection->audio_regions.end_frame());
+                               if (!selection->regions.empty()) {
+                                       l->set_start (selection->regions.start());
+                                       l->set_end (selection->regions.end_frame());
                                }
                        }
                }
@@ -807,10 +809,10 @@ Editor::marker_menu_rename ()
 
        if (!loc) return;
        
-       Dialog dialog;
-       Entry  entry;
-       HBox dhbox;
-       Label dlabel (_("New Name:"));
+       ArdourPrompter dialog (true);
+       string txt;
+
+       dialog.set_prompt (_("New Name:"));
        
        if (loc->is_mark()) {
                dialog.set_title (_("ardour: rename mark"));
@@ -821,20 +823,12 @@ Editor::marker_menu_rename ()
        dialog.set_name ("MarkRenameWindow");
        dialog.set_size_request (250, -1);
        dialog.set_position (Gtk::WIN_POS_MOUSE);
-       dialog.set_modal (true);
-       dhbox.pack_start (dlabel, true, false, 10);
-       dhbox.pack_start (entry, true, false, 10);
-       dialog.get_vbox()->pack_start (dhbox, true, false, 10);
 
-       dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
        dialog.add_button (_("Rename"), RESPONSE_ACCEPT);
-       dialog.set_default_response (RESPONSE_ACCEPT);
-
-       entry.set_text (loc->name());
-       entry.set_name ("MarkerNameDisplay");
+       dialog.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
+       dialog.set_initial_text (loc->name());
 
-       dialog.show_all ();
-       entry.grab_focus ();
+       dialog.show ();
 
        switch (dialog.run ()) {
        case RESPONSE_ACCEPT:
@@ -846,7 +840,8 @@ Editor::marker_menu_rename ()
        begin_reversible_command ( _("rename marker") );
        session->add_undo( session->locations()->get_memento() );
 
-       loc->set_name (entry.get_text());
+       dialog.get_result(txt);
+       loc->set_name (txt);
        
        session->add_redo_no_execute( session->locations()->get_memento() );
        commit_reversible_command ();