summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorNick Mainsbridge <beatroute@iprimus.com.au>2006-05-10 10:22:38 +0000
committerNick Mainsbridge <beatroute@iprimus.com.au>2006-05-10 10:22:38 +0000
commit3732decd72d387d7005644621205b872ff7fd8d6 (patch)
treec4a90c842ef08d19e22226b840d5c919aa746610 /gtk2_ardour
parentc67a576d611759154976ee19b8faf78583474f97 (diff)
Some fixes to the new session dialog.
git-svn-id: svn://localhost/trunk/ardour2@495 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui.cc10
-rw-r--r--gtk2_ardour/glade/new_session_dialog.glade13
-rw-r--r--gtk2_ardour/new_session_dialog.cc136
-rw-r--r--gtk2_ardour/new_session_dialog.h7
4 files changed, 85 insertions, 81 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 169b150d70..cb0881c620 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1706,14 +1706,20 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
m_new_session_dialog->show_all();
m_new_session_dialog->set_modal(true);
m_new_session_dialog->set_name(predetermined_path);
+ m_new_session_dialog->reset_recent();
int response = Gtk::RESPONSE_CANCEL;
do {
response = m_new_session_dialog->run ();
- if(response == Gtk::RESPONSE_CANCEL) {
+ if(response == Gtk::RESPONSE_CANCEL || response == Gtk::RESPONSE_DELETE_EVENT) {
quit();
return;
+
+ } else if (response == 0) {
+ /* Clear was pressed */
+ m_new_session_dialog->reset();
+
} else if (response == Gtk::RESPONSE_YES) {
/* YES == OPEN, but there's no enum for that */
std::string session_name = m_new_session_dialog->session_name();
@@ -1803,7 +1809,7 @@ ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
}
}
- } while(response == Gtk::RESPONSE_HELP);
+ } while (response == 0);
m_new_session_dialog->hide_all();
show();
diff --git a/gtk2_ardour/glade/new_session_dialog.glade b/gtk2_ardour/glade/new_session_dialog.glade
index 5824ab4952..5ecee3b386 100644
--- a/gtk2_ardour/glade/new_session_dialog.glade
+++ b/gtk2_ardour/glade/new_session_dialog.glade
@@ -28,19 +28,6 @@
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<child>
- <widget class="GtkButton" id="HelpButton">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-help</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-11</property>
- </widget>
- </child>
-
- <child>
<widget class="GtkButton" id="QuitButton">
<property name="visible">True</property>
<property name="can_default">True</property>
diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc
index 106fea7339..533cd2aa96 100644
--- a/gtk2_ardour/new_session_dialog.cc
+++ b/gtk2_ardour/new_session_dialog.cc
@@ -77,77 +77,17 @@ NewSessionDialog::NewSessionDialog(BaseObjectType* cobject,
xml->get_widget(X_("TheTreeview"), m_treeview);
xml->get_widget(X_("OkButton"), m_okbutton);
-
if (m_treeview) {
- /* Shamelessly ripped from ardour_ui.cc */
- std::vector<string *> *sessions;
- std::vector<string *>::iterator i;
- RecentSessionsSorter cmp;
-
recent_model = Gtk::TreeStore::create (recent_columns);
m_treeview->set_model (recent_model);
m_treeview->append_column (_("Recent Sessions"), recent_columns.visible_name);
m_treeview->set_headers_visible (false);
m_treeview->get_selection()->set_mode (Gtk::SELECTION_SINGLE);
-
- recent_model->clear ();
-
- ARDOUR::RecentSessions rs;
- ARDOUR::read_recent_sessions (rs);
-
- /* sort them alphabetically */
- sort (rs.begin(), rs.end(), cmp);
- sessions = new std::vector<std::string*>;
-
- for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
- sessions->push_back (new string ((*i).second));
- }
-
- for (i = sessions->begin(); i != sessions->end(); ++i) {
-
- std::vector<std::string*>* states;
- std::vector<const gchar*> item;
- std::string fullpath = *(*i);
-
- /* remove any trailing / */
-
- if (fullpath[fullpath.length()-1] == '/') {
- fullpath = fullpath.substr (0, fullpath.length()-1);
- }
-
- /* now get available states for this session */
-
- if ((states = ARDOUR::Session::possible_states (fullpath)) == 0) {
- /* no state file? */
- continue;
- }
-
- Gtk::TreeModel::Row row = *(recent_model->append());
-
- row[recent_columns.visible_name] = PBD::basename (fullpath);
- row[recent_columns.fullpath] = fullpath;
-
- if (states->size() > 1) {
-
- /* add the children */
-
- for (std::vector<std::string*>::iterator i2 = states->begin(); i2 != states->end(); ++i2) {
-
- Gtk::TreeModel::Row child_row = *(recent_model->append (row.children()));
-
- child_row[recent_columns.visible_name] = **i2;
- child_row[recent_columns.fullpath] = fullpath;
-
- delete *i2;
- }
- }
-
- delete states;
- }
- delete sessions;
+
}
-
+
m_new_session_dialog->set_response_sensitive (Gtk::RESPONSE_OK, false);
+ m_new_session_dialog->set_response_sensitive (0, false);
m_new_session_dialog->set_default_response (Gtk::RESPONSE_OK);
m_notebook->show_all_children();
m_notebook->set_current_page(0);
@@ -321,6 +261,7 @@ NewSessionDialog::entry_key_release (GdkEventKey* ev)
{
if (m_name->get_text() != "") {
m_new_session_dialog->set_response_sensitive (Gtk::RESPONSE_OK, true);
+ m_new_session_dialog->set_response_sensitive (0, true);
} else {
m_new_session_dialog->set_response_sensitive (Gtk::RESPONSE_OK, false);
}
@@ -331,6 +272,7 @@ void
NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum)
{
if (pagenum == 1) {
+ m_new_session_dialog->set_response_sensitive (0, false);
m_okbutton->set_label(_("Open"));
m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::OPEN, Gtk::ICON_SIZE_BUTTON)));
if (m_treeview->get_selection()->count_selected_rows() == 0) {
@@ -339,6 +281,9 @@ NewSessionDialog::notebook_page_changed (GtkNotebookPage* np, uint pagenum)
m_new_session_dialog->set_response_sensitive (Gtk::RESPONSE_OK, true);
}
} else {
+ if (m_name->get_text() != "") {
+ m_new_session_dialog->set_response_sensitive (0, true);
+ }
m_okbutton->set_label(_("New"));
m_okbutton->set_image (*(new Gtk::Image (Gtk::Stock::NEW, Gtk::ICON_SIZE_BUTTON)));
if (m_name->get_text() == "") {
@@ -387,6 +332,71 @@ NewSessionDialog::reset_template()
}
void
+NewSessionDialog::reset_recent()
+{
+ /* Shamelessly ripped from ardour_ui.cc */
+ std::vector<string *> *sessions;
+ std::vector<string *>::iterator i;
+ RecentSessionsSorter cmp;
+
+ recent_model->clear ();
+
+ ARDOUR::RecentSessions rs;
+ ARDOUR::read_recent_sessions (rs);
+
+ /* sort them alphabetically */
+ sort (rs.begin(), rs.end(), cmp);
+ sessions = new std::vector<std::string*>;
+
+ for (ARDOUR::RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
+ sessions->push_back (new string ((*i).second));
+ }
+
+ for (i = sessions->begin(); i != sessions->end(); ++i) {
+
+ std::vector<std::string*>* states;
+ std::vector<const gchar*> item;
+ std::string fullpath = *(*i);
+
+ /* remove any trailing / */
+
+ if (fullpath[fullpath.length()-1] == '/') {
+ fullpath = fullpath.substr (0, fullpath.length()-1);
+ }
+
+ /* now get available states for this session */
+
+ if ((states = ARDOUR::Session::possible_states (fullpath)) == 0) {
+ /* no state file? */
+ continue;
+ }
+
+ Gtk::TreeModel::Row row = *(recent_model->append());
+
+ row[recent_columns.visible_name] = PBD::basename (fullpath);
+ row[recent_columns.fullpath] = fullpath;
+
+ if (states->size() > 1) {
+
+ /* add the children */
+
+ for (std::vector<std::string*>::iterator i2 = states->begin(); i2 != states->end(); ++i2) {
+
+ Gtk::TreeModel::Row child_row = *(recent_model->append (row.children()));
+
+ child_row[recent_columns.visible_name] = **i2;
+ child_row[recent_columns.fullpath] = fullpath;
+
+ delete *i2;
+ }
+ }
+
+ delete states;
+ }
+ delete sessions;
+}
+
+void
NewSessionDialog::reset()
{
reset_name();
diff --git a/gtk2_ardour/new_session_dialog.h b/gtk2_ardour/new_session_dialog.h
index 5e5e9723dd..8ee4a93969 100644
--- a/gtk2_ardour/new_session_dialog.h
+++ b/gtk2_ardour/new_session_dialog.h
@@ -93,15 +93,16 @@ public:
bool connect_outs_to_master() const;
bool connect_outs_to_physical() const ;
int get_current_page();
+ void reset_recent();
+
+ // reset everything to default values.
+ void reset();
protected:
void reset_name();
void reset_template();
- // reset everything to default values.
- void reset();
-
// references to widgets we care about.
Gtk::Dialog* m_new_session_dialog;
Gtk::Entry* m_name;