changes from colin for route_params, nick for location_ui and route_ui, and me for ardour_ui.cc

git-svn-id: svn://localhost/trunk/ardour2@50 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2005-10-06 18:24:23 +00:00
parent f7b1b0fbbd
commit 5a52d8fee4
12 changed files with 471 additions and 425 deletions

View file

@ -20,12 +20,12 @@ gtkardour.Append(CCFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
gtkardour.Append(PACKAGE=domain) gtkardour.Append(PACKAGE=domain)
gtkardour.Append(POTFILE=domain + '.pot') gtkardour.Append(POTFILE=domain + '.pot')
gtkardour.Merge ( [libraries['ardour'], gtkardour.Merge ([
libraries['ardour'],
libraries['gtkmm2ext'], libraries['gtkmm2ext'],
libraries['midi++2'], libraries['midi++2'],
libraries['pbd3'], libraries['pbd3'],
libraries['gtkmm2'], libraries['gtkmm2'],
libraries['sigc2'],
libraries['libgnomecanvasmm'], libraries['libgnomecanvasmm'],
libraries['sysmidi'], libraries['sysmidi'],
libraries['sndfile'], libraries['sndfile'],
@ -34,14 +34,15 @@ gtkardour.Merge ( [libraries['ardour'],
libraries['pangomm'], libraries['pangomm'],
libraries['atkmm'], libraries['atkmm'],
libraries['gdkmm2'], libraries['gdkmm2'],
libraries['sigc2'],
libraries['gtk2'], libraries['gtk2'],
libraries['libgnomecanvas2'], libraries['libgnomecanvas2'],
libraries['xml'], libraries['xml'],
libraries['soundtouch'], libraries['soundtouch'],
libraries['raptor'], libraries['raptor'],
libraries['samplerate'], libraries['samplerate'],
libraries['jack']] libraries['jack']
) ])
if gtkardour['VST']: if gtkardour['VST']:
gtkardour.Merge ([ libraries['fst']]) gtkardour.Merge ([ libraries['fst']])

View file

@ -30,6 +30,7 @@
#include <gtkmm.h> #include <gtkmm.h>
#include <pbd/error.h> #include <pbd/error.h>
#include <pbd/compose.h>
#include <pbd/basename.h> #include <pbd/basename.h>
#include <pbd/pathscanner.h> #include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h> #include <pbd/failed_constructor.h>
@ -37,7 +38,6 @@
#include <gtkmm2ext/pix.h> #include <gtkmm2ext/pix.h>
#include <gtkmm2ext/utils.h> #include <gtkmm2ext/utils.h>
#include <gtkmm2ext/click_box.h> #include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/fastmeter.h> #include <gtkmm2ext/fastmeter.h>
#include <gtkmm2ext/stop_signal.h> #include <gtkmm2ext/stop_signal.h>
#include <gtkmm2ext/popup.h> #include <gtkmm2ext/popup.h>
@ -816,9 +816,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
follow_button (_("follow\nPH")), follow_button (_("follow\nPH")),
auditioning_alert_button (_("AUDITIONING")), auditioning_alert_button (_("AUDITIONING")),
solo_alert_button (_("SOLO")), solo_alert_button (_("SOLO")),
session_selector (1, 0),
shown_flag (false) shown_flag (false)
{ {
@ -861,25 +858,25 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
last_configure_time.tv_sec = 0; last_configure_time.tv_sec = 0;
last_configure_time.tv_usec = 0; last_configure_time.tv_usec = 0;
ui_manager = UIManager::create ();
shuttle_grabbed = false; shuttle_grabbed = false;
shuttle_fract = 0.0; shuttle_fract = 0.0;
set_shuttle_units (Percentage); set_shuttle_units (Percentage);
set_shuttle_behaviour (Sprung); set_shuttle_behaviour (Sprung);
Glib::RefPtr<ActionGroup> shuttle_style_actions = ActionGroup::create (); Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions");
Glib::RefPtr<ActionGroup> shuttle_unit_actions = ActionGroup::create ();
shuttle_unit_actions->add (Action::create (_("Percentage")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Percentage)); shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Percentage));
shuttle_unit_actions->add (Action::create (_("Semitones")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Semitones)); shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Semitones));
shuttle_style_actions->add (Action::create (_("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung)); shuttle_actions->add (Action::create (X_("SetShuttleActionSprung"), _("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung));
shuttle_style_actions->add (Action::create (_("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel)); shuttle_actions->add (Action::create (X_("SetShuttleActionWheel"), _("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel));
uiManager->insert_action_group (shuttle_style_actions); ui_manager->insert_action_group (shuttle_actions);
uiManager->insert_action_group (shuttle_unit_actions);
shuttle_style_menu = uiManager.get_widget ('/ShuttleStyle'); shuttle_style_menu = dynamic_cast<Menu*> (ui_manager->get_widget ("ShuttleStylePopup"));
shuttle_unit_menu = uiManager.get_widget ('/ShuttleUnits'); shuttle_unit_menu = dynamic_cast<Menu*> (ui_manager->get_widget ("ShuttleUnitPopup"));
gettimeofday (&last_peak_grab, 0); gettimeofday (&last_peak_grab, 0);
gettimeofday (&last_shuttle_request, 0); gettimeofday (&last_shuttle_request, 0);
@ -903,7 +900,7 @@ ARDOUR_UI::cannot_record_no_input (DiskStream* ds)
{ {
ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::cannot_record_no_input), ds)); ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::cannot_record_no_input), ds));
string msg = compose (_("\ string msg = PBD::compose (_("\
You cannot record-enable\n\ You cannot record-enable\n\
track %1\n\ track %1\n\
because it has no input connections.\n\ because it has no input connections.\n\
@ -957,7 +954,7 @@ ARDOUR_UI::set_engine (AudioEngine& e)
/* start the time-of-day-clock */ /* start the time-of-day-clock */
update_wall_clock (); update_wall_clock ();
Main::timeout.connect (mem_fun(*this, &ARDOUR_UI::update_wall_clock), 60000); Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::update_wall_clock), 60000);
update_disk_space (); update_disk_space ();
update_cpu_load (); update_cpu_load ();
@ -1022,8 +1019,7 @@ ARDOUR_UI::configure_handler (GdkEventConfigure* conf)
if (have_configure_timeout) { if (have_configure_timeout) {
gettimeofday (&last_configure_time, 0); gettimeofday (&last_configure_time, 0);
} else { } else {
TimeoutSig t; Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::configure_timeout), 100);
t.connect (mem_fun(*this, &ARDOUR_UI::configure_timeout), 100);
have_configure_timeout = true; have_configure_timeout = true;
} }
@ -1067,7 +1063,7 @@ ARDOUR_UI::startup ()
with the scheduling of the audio thread. with the scheduling of the audio thread.
*/ */
Gtk::Main::idle.connect (mem_fun(*this, &ARDOUR_UI::start_engine)); Glib::signal_idle().connect (mem_fun(*this, &ARDOUR_UI::start_engine));
} }
void void
@ -1108,17 +1104,17 @@ ARDOUR_UI::ask_about_saving_session (string what)
string msg; string msg;
msg = compose(_("Save and %1"), what); msg = PBD::compose(_("Save and %1"), what);
Gtk::Button save_button (msg); Gtk::Button save_button (msg);
save_button.set_name ("EditorGTKButton"); save_button.set_name ("EditorGTKButton");
msg = compose(_("Just %1"), what); msg = PBD::compose(_("Just %1"), what);
Gtk::Button nosave_button (msg); Gtk::Button nosave_button (msg);
nosave_button.set_name ("EditorGTKButton"); nosave_button.set_name ("EditorGTKButton");
msg = compose(_("Don't %1"), what); msg = PBD::compose(_("Don't %1"), what);
Gtk::Button noquit_button (msg); Gtk::Button noquit_button (msg);
noquit_button.set_name ("EditorGTKButton"); noquit_button.set_name ("EditorGTKButton");
@ -1131,7 +1127,7 @@ ARDOUR_UI::ask_about_saving_session (string what)
} else { } else {
type = _("snapshot"); type = _("snapshot");
} }
prompt = compose(_("The %1\n\"%2\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"), prompt = PBD::compose(_("The %1\n\"%2\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"),
type, session->snap_name()); type, session->snap_name());
prompt_label.set_text (prompt); prompt_label.set_text (prompt);
@ -1158,9 +1154,6 @@ ARDOUR_UI::ask_about_saving_session (string what)
window.set_modal (true); window.set_modal (true);
window.add (packer); window.add (packer);
window.show_all (); window.show_all ();
window.realize();
window.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
window.set_keyboard_input (true); window.set_keyboard_input (true);
save_the_session = 0; save_the_session = 0;
@ -1644,43 +1637,36 @@ ARDOUR_UI::toggle_some_session_state (ToggleButton& button,
gint gint
ARDOUR_UI::session_menu (GdkEventButton *ev) ARDOUR_UI::session_menu (GdkEventButton *ev)
{ {
session_popup_menu->popup (0, 0, 0, 0); session_popup_menu->popup (0, 0);
return TRUE; return TRUE;
} }
void void
ARDOUR_UI::redisplay_recent_sessions () ARDOUR_UI::redisplay_recent_sessions ()
{ {
using namespace Gtkmm2ext;
using namespace Gtk::CTree_Helpers;
vector<string *> *sessions; vector<string *> *sessions;
vector<string *>::iterator i; vector<string *>::iterator i;
RecentSessionsSorter cmp; RecentSessionsSorter cmp;
/* ---------------------------------------- */ recent_session_display.set_model (Glib::RefPtr<TreeModel>(0));
/* XXX MAKE ME A FUNCTION (no CTree::clear() in gtkmm 1.2) */ recent_session_model->clear ();
gtk_ctree_remove_node (session_selector.gobj(), NULL);
/* ---------------------------------------- */
RecentSessions rs; RecentSessions rs;
ARDOUR::read_recent_sessions (rs); ARDOUR::read_recent_sessions (rs);
if (rs.empty()) { if (rs.empty()) {
session_selector.thaw(); recent_session_display.set_model (recent_session_model);
return; return;
} }
/* sort them alphabetically */ /* sort them alphabetically */
sort (rs.begin(), rs.end(), cmp); sort (rs.begin(), rs.end(), cmp);
sessions = new vector<string*>; sessions = new vector<string*>;
for (RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) { for (RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
sessions->push_back (new string ((*i).second)); sessions->push_back (new string ((*i).second));
} }
session_selector.freeze();
for (i = sessions->begin(); i != sessions->end(); ++i) { for (i = sessions->begin(); i != sessions->end(); ++i) {
vector<string*>* states; vector<string*>* states;
@ -1700,43 +1686,21 @@ ARDOUR_UI::redisplay_recent_sessions ()
continue; continue;
} }
/* OK, try to add entries for this session */ TreeModel::Row row = *(recent_session_model->append());
row[recent_session_columns.visible_name] = PBD::basename (fullpath);
row[recent_session_columns.fullpath] = fullpath;
/* add the parent */ if (states->size() > 1) {
item.clear ();
string basen = PBD::basename (fullpath);
item.push_back (basen.c_str());
session_selector.rows().push_back (Element (item));
session_selector.rows().back().set_data (new string (fullpath), deferred_delete<string>);
if (states->size() == 1) {
/* only 1 state, show it at the top level */
session_selector.rows().back().set_leaf (true);
} else {
session_selector.rows().back().set_leaf (false);
vector<string *>::iterator i2;
/* add the children */ /* add the children */
for (i2 = states->begin(); i2 != states->end(); ++i2) { for (vector<string*>::iterator i2 = states->begin(); i2 != states->end(); ++i2) {
string statename = *(*i2); TreeModel::Row child_row = *(recent_session_model->append (row.children()));
item.clear (); child_row[recent_session_columns.visible_name] = **i2;
item.push_back (statename.c_str()); child_row[recent_session_columns.fullpath] = fullpath;
session_selector.rows().back().subtree().push_back (Element (item));
session_selector.rows().back().subtree().back().set_data (new string (statename),
deferred_delete<string>);
session_selector.rows().back().subtree().back().set_leaf (true);
delete *i2; delete *i2;
} }
@ -1745,66 +1709,20 @@ ARDOUR_UI::redisplay_recent_sessions ()
delete states; delete states;
} }
session_selector.thaw(); recent_session_display.set_model (recent_session_model);
delete sessions; delete sessions;
} }
void
ARDOUR_UI::session_selection (Gtk::CTree_Helpers::Row row, gint column)
{
using namespace Gtk::CTree_Helpers;
string session_name;
string session_path;
string session_state;
if (!row.is_leaf()) {
row.expand();
return;
}
string *stp = static_cast<string *> (row.get_data());
if ((*stp)[0] != '/' && (*stp)[0] != '.') {
/* its a state file node, so get the parent for the session information,
and combine with the state file name.
*/
string *spp = static_cast<string *> (row.get_parent().get_data());
session_name = *spp;
session_path = *spp;
session_state = *stp;
} else {
/* its a session directory node, so just get the session path,
and use "default" to load the state.
*/
string *spp = static_cast<string *> (row.get_data());
session_name = *spp;
session_path = *spp;
session_state = PBD::basename (*spp);
}
session_selector_window->hide ();
_session_is_new = false;
load_session (session_path, session_state);
}
void void
ARDOUR_UI::build_session_selector () ARDOUR_UI::build_session_selector ()
{ {
session_selector_window = new ArdourDialog ("session selector"); session_selector_window = new ArdourDialog ("session selector");
Gtk::VBox *vpacker = new Gtk::VBox; Gtk::VBox *vpacker = manage (new Gtk::VBox);
Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow; Gtk::ScrolledWindow *scroller = manage (new Gtk::ScrolledWindow);
Gtk::HBox *button_packer = new Gtk::HBox; Gtk::HBox *button_packer = manage (new Gtk::HBox);
Gtk::Button *cancel_button = new Gtk::Button (_("cancel")); Gtk::Button *cancel_button = manage (new Gtk::Button (_("cancel")));
Gtk::Button *rescan_button = new Gtk::Button (_("rescan")); Gtk::Button *rescan_button = manage (new Gtk::Button (_("rescan")));
button_packer->pack_start (*rescan_button); button_packer->pack_start (*rescan_button);
button_packer->pack_start (*cancel_button); button_packer->pack_start (*cancel_button);
@ -1812,16 +1730,55 @@ ARDOUR_UI::build_session_selector ()
vpacker->pack_start (*scroller); vpacker->pack_start (*scroller);
vpacker->pack_start (*button_packer, false, false); vpacker->pack_start (*button_packer, false, false);
scroller->add (session_selector); recent_session_model = TreeStore::create (recent_session_columns);
recent_session_display.set_model (recent_session_model);
recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
recent_session_display.set_headers_visible (false);
scroller->add (recent_session_display);
scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
session_selector_window->add (*vpacker); session_selector_window->add (*vpacker);
session_selector_window->set_name ("SessionSelectorWindow"); session_selector_window->set_name ("SessionSelectorWindow");
session_selector_window->set_size_request (200, 400); session_selector_window->set_size_request (200, 400);
}
void
ARDOUR_UI::open_recent_session ()
{
/* popup selector window */
if (session_selector_window == 0) {
build_session_selector ();
}
redisplay_recent_sessions ();
session_selector_window->run ();
switch (session_selector_window->run_status()) {
case 0:
break;
default:
return;
}
Gtk::TreeModel::iterator i = recent_session_display.get_selection()->get_selected();
if (i == recent_session_model->children().end()) {
return;
}
Glib::ustring path = (*i)[recent_session_columns.fullpath];
Glib::ustring state = (*i)[recent_session_columns.visible_name];
session_selector_window->response (RESPONSE_ACCEPT);
_session_is_new = false;
load_session (path, state);
session_selector_window->signal_delete_event().connect (bind (ptr_fun (just_hide_it), static_cast<Gtk::Window*>(session_selector_window)));
cancel_button-.signal_clicked().connect (bind (mem_fun(*this, &ARDOUR_UI::hide_dialog), session_selector_window));
session_selector.tree_select_row.connect (mem_fun(*this, &ARDOUR_UI::session_selection));
} }
void void
@ -1839,28 +1796,55 @@ ARDOUR_UI::fs_delete_event (GdkEventAny* ev, Gtk::FileSelection* fs)
return 1; return 1;
} }
bool
ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info)
{
struct stat statbuf;
if (stat (info.filename.c_str(), &statbuf) != 0) {
return false;
}
if (!S_ISDIR(statbuf.st_mode)) {
return false;
}
string session_file = info.filename;
session_file += '/';
session_file += PBD::basename (info.filename);
session_file += ".ardour";
if (stat (session_file.c_str(), &statbuf) != 0) {
return false;
}
return S_ISREG (statbuf.st_mode);
}
void void
ARDOUR_UI::open_session () ARDOUR_UI::open_session ()
{ {
/* popup selector window */ /* popup selector window */
if (open_session_selector == 0) { if (open_session_selector == 0) {
open_session_selector = new Gtk::FileSelection(_("open session")); open_session_selector = new Gtk::FileChooserDialog (_("open session"), FILE_CHOOSER_ACTION_OPEN);
open_session_selector->get_ok_button()-.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::open_ok_clicked)); open_session_selector->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
open_session_selector->get_cancel_button()-.signal_clicked().connect (bind (mem_fun(*this, &ARDOUR_UI::fs_cancel_clicked), open_session_selector)); open_session_selector->add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
open_session_selector->signal_delete_event().connect (bind (mem_fun(*this, &ARDOUR_UI::fs_delete_event), open_session_selector));
FileFilter filter_ardour;
filter_ardour.set_name (_("Ardour sessions"));
filter_ardour.add_custom (FILE_FILTER_FILENAME, mem_fun (*this, &ARDOUR_UI::filter_ardour_session_dirs));
open_session_selector->add_filter (filter_ardour);
} }
open_session_selector->show_all (); switch (open_session_selector->run ()) {
allow_focus (true); case RESPONSE_OK:
break;
/* wait for selection */ default:
return;
} }
void
ARDOUR_UI::open_ok_clicked ()
{
open_session_selector->hide_all();
string session_path = open_session_selector->get_filename(); string session_path = open_session_selector->get_filename();
string path, name; string path, name;
bool isnew; bool isnew;
@ -1871,31 +1855,8 @@ ARDOUR_UI::open_ok_clicked ()
load_session (path, name); load_session (path, name);
} }
} }
open_session_selector->get_selection_entry()->set_text("");
/* XXX hack hack hack */
GtkCList* clist = (GtkCList*) open_session_selector->gobj()->file_list;
gtk_clist_unselect_all (clist);
allow_focus(false);
} }
void
ARDOUR_UI::open_recent_session ()
{
/* popup selector window */
if (session_selector_window == 0) {
build_session_selector ();
}
redisplay_recent_sessions ();
session_selector_window->show_all ();
/* wait for selection */
}
void void
ARDOUR_UI::session_add_midi_track () ARDOUR_UI::session_add_midi_track ()
@ -2365,7 +2326,7 @@ ARDOUR_UI::start_engine ()
solution, its what we have. solution, its what we have.
*/ */
Main::timeout.connect (mem_fun(*this, &ARDOUR_UI::make_session_clean), 1000); Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::make_session_clean), 1000);
} }
return FALSE; return FALSE;
@ -2543,6 +2504,7 @@ void
ARDOUR_UI::snapshot_session () ARDOUR_UI::snapshot_session ()
{ {
ArdourPrompter prompter (true); ArdourPrompter prompter (true);
string snapname;
string now; string now;
time_t n; time_t n;
@ -2553,18 +2515,17 @@ ARDOUR_UI::snapshot_session ()
prompter.set_name ("Prompter"); prompter.set_name ("Prompter");
prompter.set_prompt (_("Name for snapshot")); prompter.set_prompt (_("Name for snapshot"));
prompter.set_initial_text (now); prompter.set_initial_text (now);
prompter.done.connect (Gtk::Main::quit.slot());
prompter.show_all ();
Gtk::Main::run ();
if (prompter.status == Gtkmm2ext::Prompter::entered) {
string snapname;
switch (prompter.run()) {
case RESPONSE_ACCEPT:
prompter.get_result (snapname); prompter.get_result (snapname);
if (snapname.length()){ if (snapname.length()){
save_state (snapname); save_state (snapname);
} }
break;
default:
break;
} }
} }
@ -2639,21 +2600,21 @@ ARDOUR_UI::rec_enable_button_blink (bool onoff, DiskStream *dstream, Widget *w)
switch (rs) { switch (rs) {
case Session::Disabled: case Session::Disabled:
case Session::Enabled: case Session::Enabled:
if (w->get_state() != GTK_STATE_SELECTED) { if (w->get_state() != STATE_SELECTED) {
w->set_state (GTK_STATE_SELECTED); w->set_state (STATE_SELECTED);
} }
break; break;
case Session::Recording: case Session::Recording:
if (w->get_state() != GTK_STATE_ACTIVE) { if (w->get_state() != STATE_ACTIVE) {
w->set_state (GTK_STATE_ACTIVE); w->set_state (STATE_ACTIVE);
} }
break; break;
} }
} else { } else {
if (w->get_state() != Gtk::STATE_NORMAL) { if (w->get_state() != STATE_NORMAL) {
w->set_state (Gtk::STATE_NORMAL); w->set_state (STATE_NORMAL);
} }
} }
} }
@ -2668,19 +2629,19 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
switch (session->record_status()) { switch (session->record_status()) {
case Session::Enabled: case Session::Enabled:
if (onoff) { if (onoff) {
rec_button.set_state (GTK_STATE_ACTIVE); rec_button.set_state (STATE_ACTIVE);
} else { } else {
rec_button.set_state (Gtk::STATE_NORMAL); rec_button.set_state (STATE_NORMAL);
} }
break; break;
case Session::Recording: case Session::Recording:
rec_button.set_state (GTK_STATE_ACTIVE); rec_button.set_state (STATE_ACTIVE);
break; break;
default: default:
rec_button.set_active (false); rec_button.set_active (false);
rec_button.set_state (Gtk::STATE_NORMAL); rec_button.set_state (STATE_NORMAL);
break; break;
} }
} }
@ -2718,23 +2679,23 @@ ARDOUR_UI::save_template ()
{ {
ArdourPrompter prompter (true); ArdourPrompter prompter (true);
prompter.set_name ("Prompter"); string name;
prompter.set_name (X_("Prompter"));
prompter.set_prompt (_("Name for mix template:")); prompter.set_prompt (_("Name for mix template:"));
prompter.set_initial_text(session->name() + _("-template")); prompter.set_initial_text(session->name() + _("-template"));
prompter.done.connect(Gtk::Main::quit.slot()); switch (prompter.run()) {
prompter.show_all(); case RESPONSE_ACCEPT:
Gtk::Main::run();
if (prompter.status == Gtkmm2ext::Prompter::entered) {
string name;
prompter.get_result (name); prompter.get_result (name);
if (name.length()) { if (name.length()) {
session->save_template (name); session->save_template (name);
} }
break;
default:
break;
} }
} }
@ -2748,6 +2709,9 @@ ARDOUR_UI::new_session (bool startup, string predetermined_path)
new_session_window->run (); new_session_window->run ();
#if 0
// GTK2FIX
/* write favorites either way */ /* write favorites either way */
Session::FavoriteDirs favs; Session::FavoriteDirs favs;
new_session_window->file_selector.get_favorites (favs); new_session_window->file_selector.get_favorites (favs);
@ -2756,14 +2720,15 @@ ARDOUR_UI::new_session (bool startup, string predetermined_path)
if (new_session_window->run_status()) { if (new_session_window->run_status()) {
return; return;
} }
#endif
string session_path = new_session_window->file_selector.get_path (); string session_path = new_session_window->file_selector.get_filename ();
string session_name = PBD::basename (session_path); string session_name = PBD::basename (session_path);
// Check that it doesn't already exist. // Check that it doesn't already exist.
access(session_path.c_str(), R_OK); access(session_path.c_str(), R_OK);
if (errno != ENOENT){ if (errno != ENOENT){
error << compose(_("Session %1 already exists at %2"), session_name, session_path) << endmsg; error << PBD::compose(_("Session %1 already exists at %2"), session_name, session_path) << endmsg;
return; return;
} }
@ -2847,7 +2812,7 @@ This prevents the session from being loaded."));
catch (...) { catch (...) {
error << compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg; error << PBD::compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
return -1; return -1;
} }
@ -2900,7 +2865,7 @@ ARDOUR_UI::build_session (string path, string snap_name,
catch (...) { catch (...) {
error << compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg; error << PBD::compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
return -1; return -1;
} }
@ -2932,7 +2897,7 @@ ARDOUR_UI::show ()
} }
if (about) { if (about) {
about->get_window().raise (); about->present ();
} }
} }
@ -2940,16 +2905,9 @@ void
ARDOUR_UI::show_splash () ARDOUR_UI::show_splash ()
{ {
if (about == 0) { if (about == 0) {
about = new About(this); about = new About();
about->show_all();
about->show_sub (true);
about->get_window().raise ();
}
else {
about->get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
about->show_all ();
about->get_window().raise ();
} }
about->present();
} }
void void
@ -2979,58 +2937,68 @@ require some unused files to continue to exist."));
ArdourDialog results ("cleanup results"); ArdourDialog results ("cleanup results");
const gchar* list_titles[] = { struct CleanupResultsModelColumns : public Gtk::TreeModel::ColumnRecord {
list_title, CleanupResultsModelColumns() {
0 add (visible_name);
add (fullpath);
}
Gtk::TreeModelColumn<Glib::ustring> visible_name;
Gtk::TreeModelColumn<Glib::ustring> fullpath;
}; };
Gtk::CList list (internationalize (list_titles));
Glib::RefPtr<Gtk::ListStore> results_model;
CleanupResultsModelColumns results_columns;
Gtk::TreeView results_display;
results_model = ListStore::create (results_columns);
results_display.set_model (results_model);
results_display.append_column (list_title, results_columns.visible_name);
results_display.set_headers_visible (true);
Gtk::ScrolledWindow list_scroller; Gtk::ScrolledWindow list_scroller;
Gtk::Label txt; Gtk::Label txt;
Gtk::Button ok_button (_("OK")); Gtk::Button ok_button (_("OK"));
Gtk::VBox vpacker; Gtk::VBox vpacker;
const char* rowtext[1];
list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
vpacker.set_border_width (10); vpacker.set_border_width (10);
vpacker.set_spacing (10); vpacker.set_spacing (10);
if (rep.space < 1048576.0f) { if (rep.space < 1048576.0f) {
if (removed > 1) { if (removed > 1) {
txt.set_text (compose (msg, removed, _("files"), (float) rep.space / 1024.0f, "kilo")); txt.set_text (PBD::compose (msg, removed, _("files"), (float) rep.space / 1024.0f, "kilo"));
} else { } else {
txt.set_text (compose (msg, removed, _("file"), (float) rep.space / 1024.0f, "kilo")); txt.set_text (PBD::compose (msg, removed, _("file"), (float) rep.space / 1024.0f, "kilo"));
} }
} else { } else {
if (removed > 1) { if (removed > 1) {
txt.set_text (compose (msg, removed, _("files"), (float) rep.space / 1048576.0f, "mega")); txt.set_text (PBD::compose (msg, removed, _("files"), (float) rep.space / 1048576.0f, "mega"));
} else { } else {
txt.set_text (compose (msg, removed, _("file"), (float) rep.space / 1048576.0f, "mega")); txt.set_text (PBD::compose (msg, removed, _("file"), (float) rep.space / 1048576.0f, "mega"));
} }
} }
vpacker.pack_start (txt, false, false); vpacker.pack_start (txt, false, false);
for (vector<string>::iterator i = rep.paths.begin(); i != rep.paths.end(); ++i) { for (vector<string>::iterator i = rep.paths.begin(); i != rep.paths.end(); ++i) {
rowtext[0] = (*i).c_str(); TreeModel::Row row = *(results_model->append());
list.rows().push_back (rowtext); row[results_columns.visible_name] = *i;
row[results_columns.fullpath] = *i;
} }
list_scroller.add_with_viewport (list); list_scroller.add (results_display);
list_scroller.set_size_request (-1, 250); list_scroller.set_size_request (-1, 250);
list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
vpacker.pack_start (list_scroller, true, true); vpacker.pack_start (list_scroller, true, true);
vpacker.pack_start (ok_button, false, false); vpacker.pack_start (ok_button, false, false);
ok_button.signal_clicked().connect (Main::quit.slot ());
results.Hiding.connect (Main::quit.slot ());
results.add (vpacker); results.add (vpacker);
results.set_position (Gtk::WIN_POS_MOUSE); results.set_position (Gtk::WIN_POS_MOUSE);
results.set_title (_("ardour: cleanup")); results.set_title (_("ardour: cleanup"));
results.set_modal (true); results.set_modal (true);
results.run (); results.run ();
} }
@ -3068,15 +3036,16 @@ Unused audio files will be moved to a \"dead sounds\" location."));
checker.set_title (_("ardour cleanup")); checker.set_title (_("ardour cleanup"));
checker.set_wmclass (_("ardour_cleanup"), "Ardour"); checker.set_wmclass (_("ardour_cleanup"), "Ardour");
checker.set_position (Gtk::WIN_POS_MOUSE); checker.set_position (Gtk::WIN_POS_MOUSE);
checker.realize ();
checker.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
ok_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 1)); ok_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 1));
cancel_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 0)); cancel_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 0));
checker.run (); checker.run ();
if (checker.run_status() != 1) { switch (checker.run_status()) {
case 0:
break;
default:
return; return;
} }
@ -3320,14 +3289,12 @@ what you would like to do.\n"));
cancel_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1)); cancel_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1));
dialog.add (vpacker); dialog.add (vpacker);
dialog.set_position (GTK_WIN_POS_CENTER); dialog.set_position (WIN_POS_CENTER);
dialog.show_all (); dialog.show_all ();
dialog.realize();
dialog.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
dialog.run (); dialog.run ();
if (dialog.run_status () == 0) { if (dialog.run_status () != 0) {
return 1; return 1;
} }

View file

@ -41,7 +41,6 @@
#include <gtkmm2ext/gtk_ui.h> #include <gtkmm2ext/gtk_ui.h>
#include <gtkmm2ext/pix.h> #include <gtkmm2ext/pix.h>
#include <gtkmm2ext/click_box.h> #include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/selector.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/session.h> #include <ardour/session.h>
@ -380,8 +379,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtk::Label speed_display_label; Gtk::Label speed_display_label;
Gtk::Button shuttle_units_button; Gtk::Button shuttle_units_button;
Gtk::Button shuttle_style_button; Gtk::Button shuttle_style_button;
Gtk::Menu shuttle_unit_menu; Gtk::Menu* shuttle_unit_menu;
Gtk::Menu shuttle_style_menu; Gtk::Menu* shuttle_style_menu;
ShuttleBehaviour shuttle_behaviour; ShuttleBehaviour shuttle_behaviour;
ShuttleUnits shuttle_units; ShuttleUnits shuttle_units;
@ -448,23 +447,36 @@ class ARDOUR_UI : public Gtkmm2ext::UI
static void rate_printer (char buf[32], Gtk::Adjustment &, void *); static void rate_printer (char buf[32], Gtk::Adjustment &, void *);
Gtk::Menu* session_popup_menu; Gtk::Menu* session_popup_menu;
Gtkmm2ext::Selector session_selector;
ArdourDialog* session_selector_window;
Gtk::FileSelection* open_session_selector; struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
RecentSessionModelColumns() {
add (visible_name);
add (fullpath);
}
Gtk::TreeModelColumn<Glib::ustring> visible_name;
Gtk::TreeModelColumn<Glib::ustring> fullpath;
};
RecentSessionModelColumns recent_session_columns;
Gtk::TreeView recent_session_display;
Glib::RefPtr<Gtk::TreeStore> recent_session_model;
ArdourDialog* session_selector_window;
Gtk::FileChooserDialog* open_session_selector;
void build_session_selector(); void build_session_selector();
void session_selection (Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection>); void recent_session_selection_changed ();
void redisplay_recent_sessions();
struct RecentSessionsSorter { struct RecentSessionsSorter {
bool operator() (std::pair<string,string> a, std::pair<string,string> b) const { bool operator() (std::pair<string,string> a, std::pair<string,string> b) const {
return cmp_nocase(a.first, b.first) == -1; return cmp_nocase(a.first, b.first) == -1;
} }
}; };
void redisplay_recent_sessions();
/* menu bar and associated stuff */ /* menu bar and associated stuff */
Gtk::MenuBar menu_bar; Gtk::MenuBar* menu_bar;
Gtk::Fixed menu_bar_base; Gtk::Fixed menu_bar_base;
Gtk::HBox menu_hbox; Gtk::HBox menu_hbox;
@ -720,6 +732,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtk::Menu* jack_bufsize_menu; Gtk::Menu* jack_bufsize_menu;
int make_session_clean (); int make_session_clean ();
bool filter_ardour_session_dirs (const Gtk::FileFilter::Info&);
Glib::RefPtr<Gtk::UIManager> ui_manager;
}; };
#endif /* __ardour_gui_h__ */ #endif /* __ardour_gui_h__ */

View file

@ -107,36 +107,36 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
cd_track_details_hbox.pack_start (composer_label, false, false); cd_track_details_hbox.pack_start (composer_label, false, false);
cd_track_details_hbox.pack_start (composer_entry, true, true); cd_track_details_hbox.pack_start (composer_entry, true, true);
isrc_entry.changed.connect (mem_fun(*this, &LocationEditRow::isrc_entry_changed)); isrc_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::isrc_entry_changed));
isrc_entry.signal_focus_in_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); isrc_entry.signal_focus_in_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
isrc_entry.signal_focus_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); isrc_entry.signal_focus_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
performer_entry.changed.connect (mem_fun(*this, &LocationEditRow::performer_entry_changed)); performer_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::performer_entry_changed));
performer_entry.signal_focus_in_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); performer_entry.signal_focus_in_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
performer_entry.signal_focus_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); performer_entry.signal_focus_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
composer_entry.changed.connect (mem_fun(*this, &LocationEditRow::composer_entry_changed)); composer_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::composer_entry_changed));
composer_entry.signal_focus_in_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); composer_entry.signal_focus_in_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
composer_entry.signal_focus_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); composer_entry.signal_focus_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
scms_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::scms_toggled)); scms_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::scms_toggled));
preemph_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::preemph_toggled)); preemph_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::preemph_toggled));
set_session (sess); set_session (sess);
item_table.attach (number_label, 0, 1, 0, 1, 0, 0, 3, 0); item_table.attach (number_label, 0, 1, 0, 1, FILL, FILL, 3, 0);
start_hbox.pack_start (start_go_button, false, false); start_hbox.pack_start (start_go_button, false, false);
start_hbox.pack_start (start_clock, false, false); start_hbox.pack_start (start_clock, false, false);
start_hbox.pack_start (start_set_button, false, false); start_hbox.pack_start (start_set_button, false, false);
item_table.attach (start_hbox, 2, 3, 0, 1, 0, 0, 4, 0); item_table.attach (start_hbox, 2, 3, 0, 1, FILL, FILL, 4, 0);
start_set_button.clicked.connect( bind ( mem_fun(*this, &LocationEditRow::set_button_pressed), LocStart)); start_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_button_pressed), LocStart));
start_go_button.clicked.connect( bind ( mem_fun(*this, &LocationEditRow::go_button_pressed), LocStart)); start_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocStart));
start_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocStart)); start_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocStart));
@ -146,8 +146,8 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
//item_table.attach (end_hbox, 2, 3, 0, 1, 0, 0, 4, 0); //item_table.attach (end_hbox, 2, 3, 0, 1, 0, 0, 4, 0);
end_set_button.clicked.connect( bind ( mem_fun(*this, &LocationEditRow::set_button_pressed), LocEnd)); end_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_button_pressed), LocEnd));
end_go_button.clicked.connect( bind ( mem_fun(*this, &LocationEditRow::go_button_pressed), LocEnd)); end_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocEnd));
end_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocEnd)); end_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocEnd));
// item_table.attach (length_clock, 3, 4, 0, 1, 0, 0, 4, 0); // item_table.attach (length_clock, 3, 4, 0, 1, 0, 0, 4, 0);
@ -157,10 +157,10 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
// item_table.attach (hide_check_button, 5, 6, 0, 1, 0, Gtk::FILL, 4, 0); // item_table.attach (hide_check_button, 5, 6, 0, 1, 0, Gtk::FILL, 4, 0);
// item_table.attach (remove_button, 7, 8, 0, 1, 0, Gtk::FILL, 4, 0); // item_table.attach (remove_button, 7, 8, 0, 1, 0, Gtk::FILL, 4, 0);
cd_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::cd_toggled)); cd_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::cd_toggled));
hide_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::hide_toggled)); hide_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::hide_toggled));
remove_button.clicked.connect(mem_fun(*this, &LocationEditRow::remove_button_pressed)); remove_button.signal_clicked().connect(mem_fun(*this, &LocationEditRow::remove_button_pressed));
pack_start(item_table, true, true); pack_start(item_table, true, true);
@ -218,7 +218,7 @@ LocationEditRow::set_location (Location *loc)
if (!location) return; if (!location) return;
if (!hide_check_button.get_parent()) { if (!hide_check_button.get_parent()) {
item_table.attach (hide_check_button, 6, 7, 0, 1, 0, Gtk::FILL, 4, 0); item_table.attach (hide_check_button, 6, 7, 0, 1, FILL, Gtk::FILL, 4, 0);
} }
hide_check_button.set_active (location->is_hidden()); hide_check_button.set_active (location->is_hidden());
@ -229,7 +229,7 @@ LocationEditRow::set_location (Location *loc)
name_label.set_size_request (80, -1); name_label.set_size_request (80, -1);
if (!name_label.get_parent()) { if (!name_label.get_parent()) {
item_table.attach (name_label, 1, 2, 0, 1, 0, Gtk::FILL, 4, 0); item_table.attach (name_label, 1, 2, 0, 1, FILL, Gtk::FILL, 4, 0);
} }
name_label.show(); name_label.show();
@ -239,20 +239,20 @@ LocationEditRow::set_location (Location *loc)
name_entry.set_text (location->name()); name_entry.set_text (location->name());
name_entry.set_size_request (100, -1); name_entry.set_size_request (100, -1);
name_entry.set_editable (true); name_entry.set_editable (true);
name_entry.changed.connect (mem_fun(*this, &LocationEditRow::name_entry_changed)); name_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::name_entry_changed));
name_entry.signal_focus_in_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); name_entry.signal_focus_in_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
name_entry.signal_focus_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event)); name_entry.signal_focus_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
if (!name_entry.get_parent()) { if (!name_entry.get_parent()) {
item_table.attach (name_entry, 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL, 4, 0); item_table.attach (name_entry, 1, 2, 0, 1, FILL | EXPAND, FILL, 4, 0);
} }
name_entry.show(); name_entry.show();
if (!cd_check_button.get_parent()) { if (!cd_check_button.get_parent()) {
item_table.attach (cd_check_button, 5, 6, 0, 1, 0, Gtk::FILL, 4, 0); item_table.attach (cd_check_button, 5, 6, 0, 1, FILL, Gtk::FILL, 4, 0);
} }
if (!remove_button.get_parent()) { if (!remove_button.get_parent()) {
item_table.attach (remove_button, 7, 8, 0, 1, 0, Gtk::FILL, 4, 0); item_table.attach (remove_button, 7, 8, 0, 1, FILL, Gtk::FILL, 4, 0);
} }
/* XXX i can't find a way to hide the button without messing up /* XXX i can't find a way to hide the button without messing up
@ -273,10 +273,10 @@ LocationEditRow::set_location (Location *loc)
if (!location->is_mark()) { if (!location->is_mark()) {
if (!end_hbox.get_parent()) { if (!end_hbox.get_parent()) {
item_table.attach (end_hbox, 3, 4, 0, 1, 0, 0, 4, 0); item_table.attach (end_hbox, 3, 4, 0, 1, FILL, FILL, 4, 0);
} }
if (!length_clock.get_parent()) { if (!length_clock.get_parent()) {
item_table.attach (length_clock, 4, 5, 0, 1, 0, 0, 4, 0); item_table.attach (length_clock, 4, 5, 0, 1, FILL, FILL, 4, 0);
} }
end_clock.set (location->end(), true); end_clock.set (location->end(), true);
@ -449,7 +449,7 @@ LocationEditRow::cd_toggled ()
} }
if(!cd_track_details_hbox.get_parent()) { if(!cd_track_details_hbox.get_parent()) {
item_table.attach (cd_track_details_hbox, 1, 8, 1, 2, Gtk::FILL | Gtk::EXPAND, 0, 4, 0); item_table.attach (cd_track_details_hbox, 1, 8, 1, 2, FILL | EXPAND, FILL, 4, 0);
} }
// item_table.resize(2, 7); // item_table.resize(2, 7);
cd_track_details_hbox.show_all(); cd_track_details_hbox.show_all();
@ -598,7 +598,7 @@ LocationUI::LocationUI ()
set_wmclass(_("ardour_locations"), "Ardour"); set_wmclass(_("ardour_locations"), "Ardour");
set_name ("LocationWindow"); set_name ("LocationWindow");
delete_event.connect (bind (ptr_fun (just_hide_it), static_cast<Window*>(this))); signal_delete_event().connect (bind (ptr_fun (just_hide_it), static_cast<Window*>(this)));
add (location_hpacker); add (location_hpacker);
@ -692,7 +692,7 @@ void LocationUI::location_remove_requested (ARDOUR::Location *loc)
// must do this to prevent problems when destroying // must do this to prevent problems when destroying
// the effective sender of this event // the effective sender of this event
Main::idle.connect (bind (mem_fun(*this, &LocationUI::do_location_remove), loc)); Glib::signal_idle().connect (bind (mem_fun(*this, &LocationUI::do_location_remove), loc));
} }
@ -769,7 +769,7 @@ LocationUI::map_locations (Locations::LocationList& locations)
erow = manage (new LocationEditRow(session, location, mark_n)); erow = manage (new LocationEditRow(session, location, mark_n));
erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested)); erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested));
erow->redraw_ranges.connect (mem_fun(*this, &LocationUI::location_redraw_ranges)); erow->redraw_ranges.connect (mem_fun(*this, &LocationUI::location_redraw_ranges));
loc_children.push_back(Box_Helpers::Element(*erow, false, false, 1)); loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
} }
else if (location->is_auto_punch()) { else if (location->is_auto_punch()) {
punch_edit_row.set_session (session); punch_edit_row.set_session (session);
@ -782,7 +782,7 @@ LocationUI::map_locations (Locations::LocationList& locations)
else { else {
erow = manage (new LocationEditRow(session, location)); erow = manage (new LocationEditRow(session, location));
erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested)); erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested));
range_children.push_back(Box_Helpers::Element(*erow, false, false, 1)); range_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
} }
} }

View file

@ -4,6 +4,7 @@
#include <gtkmm/adjustment.h> #include <gtkmm/adjustment.h>
#include <gtkmm/radiobutton.h> #include <gtkmm/radiobutton.h>
#include <gtkmm/frame.h> #include <gtkmm/frame.h>
#include <gtkmm/filechooserwidget.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/checkbutton.h> #include <gtkmm/checkbutton.h>
#include <gtkmm/comboboxtext.h> #include <gtkmm/comboboxtext.h>
@ -18,7 +19,6 @@ namespace ARDOUR {
#include <gtkmm2ext/click_box.h> #include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/selector.h> #include <gtkmm2ext/selector.h>
#include <gtkmm2ext/newsavedialog.h>
#include "ardour_dialog.h" #include "ardour_dialog.h"
class NewSessionDialog : public ArdourDialog class NewSessionDialog : public ArdourDialog
@ -26,7 +26,7 @@ class NewSessionDialog : public ArdourDialog
public: public:
NewSessionDialog (ARDOUR::AudioEngine&, bool startup, std::string path); NewSessionDialog (ARDOUR::AudioEngine&, bool startup, std::string path);
Gtkmm2ext::NewSaveDialog file_selector; Gtk::FileChooserWidget file_selector;
Gtk::ComboBoxText control_out_channel_combo; Gtk::ComboBoxText control_out_channel_combo;
Gtk::ComboBoxText master_out_channel_combo; Gtk::ComboBoxText master_out_channel_combo;
Gtk::CheckButton use_control_button; Gtk::CheckButton use_control_button;
@ -85,8 +85,8 @@ class NewSessionDialog : public ArdourDialog
static void _mix_template_refiller (Gtk::CList &clist, void *); static void _mix_template_refiller (Gtk::CList &clist, void *);
void mix_template_refiller (Gtk::CList &clist); void mix_template_refiller (Gtk::CList &clist);
void mix_template_shift (Gtkmm2ext::Selector *, Gtkmm2ext::SelectionResult*); void mix_template_shift (Gtkmm2ext::Selector *, Gtkmm2ext::Selector::Result*);
void mix_template_control (Gtkmm2ext::Selector *, Gtkmm2ext::SelectionResult*); void mix_template_control (Gtkmm2ext::Selector *, Gtkmm2ext::Selector::Result*);
void fixup_at_realize (); void fixup_at_realize ();
void fixup_at_show (); void fixup_at_show ();

View file

@ -55,14 +55,9 @@ using namespace ARDOUR;
using namespace Gtk; using namespace Gtk;
using namespace sigc; using namespace sigc;
static const gchar *route_display_titles[] = { N_("Tracks/Buses"), 0 };
static const gchar *pre_display_titles[] = { N_("Pre Redirects"), 0 };
static const gchar *post_display_titles[] = { N_("Post Redirects"), 0 };
RouteParams_UI::RouteParams_UI (AudioEngine& eng) RouteParams_UI::RouteParams_UI (AudioEngine& eng)
: ArdourDialog ("track/bus inspector"), : ArdourDialog ("track/bus inspector"),
engine (eng), engine (eng),
route_select_list (internationalize(route_display_titles)),
_route(0), _route(0),
track_menu(0) track_menu(0)
{ {
@ -78,22 +73,30 @@ RouteParams_UI::RouteParams_UI (AudioEngine& eng)
using namespace Notebook_Helpers; using namespace Notebook_Helpers;
input_frame.set_shadow_type(GTK_SHADOW_NONE); input_frame.set_shadow_type(Gtk::SHADOW_NONE);
output_frame.set_shadow_type(GTK_SHADOW_NONE); output_frame.set_shadow_type(Gtk::SHADOW_NONE);
notebook.set_show_tabs (true); notebook.set_show_tabs (true);
notebook.set_show_border (true); notebook.set_show_border (true);
notebook.set_name ("RouteParamNotebook"); notebook.set_name ("RouteParamNotebook");
route_select_list.column_titles_active(); // create the tree model
route_select_list.set_name ("RouteParamsListDisplay"); route_display_model = ListStore::create(route_display_columns);
route_select_list.set_shadow_type (Gtk::SHADOW_IN);
route_select_list.set_selection_mode (GTK_SELECTION_SINGLE); // setup the treeview
route_select_list.set_reorderable (false); route_display.set_model(route_display_model);
route_select_list.set_size_request (75, -1); route_display.append_column(_("Tracks/Buses"), route_display_columns.text);
route_select_scroller.add (route_select_list); route_display.set_name(X_("RouteParamsListDisplay"));
route_display.get_selection()->set_mode(Gtk::SELECTION_SINGLE); // default
route_display.set_reorderable(false);
route_display.set_size_request(75, -1);
route_display.set_headers_visible(true);
route_display.set_headers_clickable(true);
route_select_scroller.add(route_display);
route_select_scroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); route_select_scroller.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
route_select_frame.set_name("RouteSelectBaseFrame"); route_select_frame.set_name("RouteSelectBaseFrame");
route_select_frame.set_shadow_type (Gtk::SHADOW_IN); route_select_frame.set_shadow_type (Gtk::SHADOW_IN);
route_select_frame.add(route_select_scroller); route_select_frame.add(route_select_scroller);
@ -139,10 +142,8 @@ RouteParams_UI::RouteParams_UI (AudioEngine& eng)
set_wmclass (_("ardour_route_parameters"), "Ardour"); set_wmclass (_("ardour_route_parameters"), "Ardour");
// events // events
route_select_list.select_row.connect (mem_fun(*this, &RouteParams_UI::route_selected)); route_display.get_selection()->signal_changed().connect(mem_fun(*this, &RouteParams_UI::route_selected));
route_select_list.unselect_row.connect (mem_fun(*this, &RouteParams_UI::route_unselected)); route_display.get_column(0)->signal_clicked().connect(mem_fun(*this, &RouteParams_UI::show_track_menu));
route_select_list.click_column.connect (mem_fun(*this, &RouteParams_UI::show_track_menu));
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK);
@ -151,7 +152,7 @@ RouteParams_UI::RouteParams_UI (AudioEngine& eng)
static_cast<Window *> (_plugin_selector))); static_cast<Window *> (_plugin_selector)));
delete_event.connect (bind (ptr_fun (just_hide_it), static_cast<Gtk::Window*> (this))); signal_delete_event().connect(bind(ptr_fun(just_hide_it), static_cast<Gtk::Window *>(this)));
} }
RouteParams_UI::~RouteParams_UI () RouteParams_UI::~RouteParams_UI ()
@ -167,10 +168,10 @@ RouteParams_UI::add_route (Route* route)
return; return;
} }
const gchar *rowdata[1]; TreeModel::Row row = *(route_display_model->append());
rowdata[0] = route->name().c_str(); row[route_display_columns.text] = route->name();
route_select_list.rows().push_back (rowdata); row[route_display_columns.route] = route;
route_select_list.rows().back().set_data (route);
//route_select_list.rows().back().select (); //route_select_list.rows().back().select ();
route->name_changed.connect (bind (mem_fun(*this, &RouteParams_UI::route_name_changed), route)); route->name_changed.connect (bind (mem_fun(*this, &RouteParams_UI::route_name_changed), route));
@ -183,14 +184,20 @@ RouteParams_UI::route_name_changed (void *src, Route *route)
{ {
ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::route_name_changed), src, route)); ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::route_name_changed), src, route));
CList_Helpers::RowList::iterator i; bool found = false ;
TreeModel::Children rows = route_display_model->children();
if ((i = route_select_list.rows().find_data (route)) == route_select_list.rows().end()) { for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) {
error << _("route display list item for renamed route not found!") << endmsg; if((*iter)[route_display_columns.route] == route) {
return; (*iter)[route_display_columns.text] = route->name() ;
found = true ;
break;
}
} }
route_select_list.cell ((*i)->get_row_num(), 0).set_text (route->name()); if(!found)
{
error << _("route display list item for renamed route not found!") << endmsg;
}
if (route == _route) { if (route == _route) {
track_input_label.set_text (route->name()); track_input_label.set_text (route->name());
@ -210,9 +217,9 @@ RouteParams_UI::setup_redirect_boxes()
pre_redirect_box = new RedirectBox(PreFader, *session, *_route, *_plugin_selector, _rr_selection); pre_redirect_box = new RedirectBox(PreFader, *session, *_route, *_plugin_selector, _rr_selection);
post_redirect_box = new RedirectBox(PostFader, *session, *_route, *_plugin_selector, _rr_selection); post_redirect_box = new RedirectBox(PostFader, *session, *_route, *_plugin_selector, _rr_selection);
pre_redirect_box->set_title (pre_display_titles[0]); pre_redirect_box->set_title(_("Pre Redirects"));
pre_redirect_box->set_title_shown (true); pre_redirect_box->set_title_shown (true);
post_redirect_box->set_title (post_display_titles[0]); post_redirect_box->set_title(_("Post Redirects"));
post_redirect_box->set_title_shown (true); post_redirect_box->set_title_shown (true);
pre_redir_hpane.add1 (*pre_redirect_box); pre_redir_hpane.add1 (*pre_redirect_box);
@ -325,11 +332,14 @@ RouteParams_UI::route_removed (Route *route)
route_select_list.thaw (); route_select_list.thaw ();
*/ */
CList_Helpers::RowList::iterator i; TreeModel::Children rows = route_display_model->children();
TreeModel::Children::iterator ri;
if ((i = route_select_list.rows().find_data (route)) == route_select_list.rows().end()) { for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) {
// couldn't find route to be deleted if((*iter)[route_display_columns.route] == route) {
return; route_display_model->erase(iter);
break;
}
} }
if (route == _route) if (route == _route)
@ -344,9 +354,6 @@ RouteParams_UI::route_removed (Route *route)
_post_redirect = 0; _post_redirect = 0;
update_title(); update_title();
} }
route_select_list.rows().erase(i);
} }
void void
@ -354,8 +361,10 @@ RouteParams_UI::set_session (Session *sess)
{ {
ArdourDialog::set_session (sess); ArdourDialog::set_session (sess);
route_select_list.freeze (); // GTK2FIX
route_select_list.clear (); // route_select_list.freeze ();
route_display_model.clear();
if (session) { if (session) {
session->foreach_route (this, &RouteParams_UI::add_route); session->foreach_route (this, &RouteParams_UI::add_route);
@ -366,7 +375,7 @@ RouteParams_UI::set_session (Session *sess)
stop_updating (); stop_updating ();
} }
route_select_list.thaw (); //route_select_list.thaw ();
_plugin_selector->set_session (session); _plugin_selector->set_session (session);
} }
@ -375,8 +384,9 @@ RouteParams_UI::set_session (Session *sess)
void void
RouteParams_UI::session_gone () RouteParams_UI::session_gone ()
{ {
ENSURE_GUI_THREAD(mem_fun(*this, &RouteParams_UI::session_gone));
route_select_list.clear (); route_display_model.clear();
cleanup_io_frames(); cleanup_io_frames();
cleanup_pre_view(); cleanup_pre_view();
@ -393,11 +403,13 @@ RouteParams_UI::session_gone ()
} }
void void
RouteParams_UI::route_selected (gint row, gint col, GdkEvent *ev) RouteParams_UI::route_selected()
{ {
Route *route; Glib::RefPtr<TreeSelection> selection = route_display.get_selection();
TreeModel::iterator iter = selection->get_selected(); // only used with Gtk::SELECTION_SINGLE
if ((route = (Route *) route_select_list.get_row_data (row)) != 0) { if(iter) {
//If anything is selected
Route* route = (*iter)[route_display_columns.route] ;
if (_route == route) { if (_route == route) {
// do nothing // do nothing
@ -427,12 +439,8 @@ RouteParams_UI::route_selected (gint row, gint col, GdkEvent *ev)
track_input_label.set_text (_route->name()); track_input_label.set_text (_route->name());
update_title(); update_title();
} } else {
} // no selection
void
RouteParams_UI::route_unselected (gint row, gint col, GdkEvent *ev)
{
if (_route) { if (_route) {
_route_conn.disconnect(); _route_conn.disconnect();
@ -449,6 +457,27 @@ RouteParams_UI::route_unselected (gint row, gint col, GdkEvent *ev)
update_title(); update_title();
} }
} }
}
//void
//RouteParams_UI::route_unselected (gint row, gint col, GdkEvent *ev)
//{
// if (_route) {
// _route_conn.disconnect();
// remove from view
// cleanup_io_frames();
// cleanup_pre_view();
// cleanup_post_view();
// cleanup_redirect_boxes();
// _route = 0;
// _pre_redirect = 0;
// _post_redirect = 0;
// track_input_label.set_text(_("NO TRACK"));
// update_title();
// }
//}
void void
RouteParams_UI::redirects_changed (void *src) RouteParams_UI::redirects_changed (void *src)
@ -477,7 +506,7 @@ RouteParams_UI::redirects_changed (void *src)
void void
RouteParams_UI::show_track_menu (gint arg) RouteParams_UI::show_track_menu()
{ {
using namespace Menu_Helpers; using namespace Menu_Helpers;

View file

@ -23,7 +23,15 @@
#include <list> #include <list>
#include <gtkmm.h> #include <gtkmm/box.h>
#include <gtkmm/button.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/frame.h>
#include <gtkmm/label.h>
#include <gtkmm/paned.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/togglebutton.h>
#include <gtkmm/treeview.h>
#include <ardour/ardour.h> #include <ardour/ardour.h>
#include <ardour/stateful.h> #include <ardour/stateful.h>
@ -69,7 +77,6 @@ class RouteParams_UI : public ArdourDialog
Gtk::VBox mixer_scroller_vpacker; Gtk::VBox mixer_scroller_vpacker;
Gtk::VBox list_vpacker; Gtk::VBox list_vpacker;
Gtk::TreeView route_select_list;
Gtk::Label route_list_button_label; Gtk::Label route_list_button_label;
Gtk::Button route_list_button; Gtk::Button route_list_button;
Gtk::ScrolledWindow route_select_scroller; Gtk::ScrolledWindow route_select_scroller;
@ -135,14 +142,30 @@ class RouteParams_UI : public ArdourDialog
ConfigView _current_view; ConfigView _current_view;
/* treeview */
struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
RouteDisplayModelColumns() {
add(text);
add(route);
}
Gtk::TreeModelColumn<Glib::ustring> text;
Gtk::TreeModelColumn<ARDOUR::Route*> route;
};
RouteDisplayModelColumns route_display_columns ;
Gtk::TreeView route_display;
Glib::RefPtr<Gtk::ListStore> route_display_model;
void add_route (ARDOUR::Route*); void add_route (ARDOUR::Route*);
void route_name_changed (void *src, ARDOUR::Route *route); void route_name_changed (void *src, ARDOUR::Route *route);
void route_removed (ARDOUR::Route *route); void route_removed (ARDOUR::Route *route);
void route_selected (gint row, gint col, GdkEvent *ev); void route_selected();
void route_unselected (gint row, gint col, GdkEvent *ev); //void route_unselected (gint row, gint col, GdkEvent *ev);
void setup_io_frames(); void setup_io_frames();
void cleanup_io_frames(); void cleanup_io_frames();
@ -168,7 +191,7 @@ class RouteParams_UI : public ArdourDialog
void update_routeinfo (ARDOUR::Route * route); void update_routeinfo (ARDOUR::Route * route);
Gtk::Menu *track_menu; Gtk::Menu *track_menu;
void show_track_menu(gint arg); void show_track_menu();
void update_title (); void update_title ();
//void unselect_all_redirects (); //void unselect_all_redirects ();

View file

@ -37,8 +37,8 @@
#include <ardour/diskstream.h> #include <ardour/diskstream.h>
#include "i18n.h" #include "i18n.h"
/* there is a compose() here.. */
using namespace sigc; //using namespace sigc;
using namespace Gtk; using namespace Gtk;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace ARDOUR; using namespace ARDOUR;
@ -391,14 +391,14 @@ RouteUI::update_rec_display ()
switch (_session.record_status ()) { switch (_session.record_status ()) {
case Session::Disabled: case Session::Disabled:
case Session::Enabled: case Session::Enabled:
if (rec_enable_button->get_state() != GTK_STATE_ACTIVE) { if (rec_enable_button->get_state() != Gtk::STATE_ACTIVE) {
rec_enable_button->set_state (GTK_STATE_ACTIVE); rec_enable_button->set_state (Gtk::STATE_ACTIVE);
} }
break; break;
case Session::Recording: case Session::Recording:
if (rec_enable_button->get_state() != GTK_STATE_SELECTED) { if (rec_enable_button->get_state() != Gtk::STATE_SELECTED) {
rec_enable_button->set_state (GTK_STATE_SELECTED); rec_enable_button->set_state (Gtk::STATE_SELECTED);
} }
break; break;
} }
@ -422,7 +422,7 @@ RouteUI::build_solo_menu (void)
check = new CheckMenuItem(_("Solo-safe")); check = new CheckMenuItem(_("Solo-safe"));
check->set_active (_route.solo_safe()); check->set_active (_route.solo_safe());
check->toggled.connect (bind (mem_fun (*this, &RouteUI::toggle_solo_safe), check)); check->signal_toggled().connect (bind (mem_fun (*this, &RouteUI::toggle_solo_safe), check));
_route.solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check)); _route.solo_safe_changed.connect(bind (mem_fun (*this, &RouteUI::solo_safe_toggle), check));
items.push_back (CheckMenuElem(*check)); items.push_back (CheckMenuElem(*check));
check->show_all(); check->show_all();
@ -444,28 +444,28 @@ RouteUI::build_mute_menu(void)
check = new CheckMenuItem(_("Pre Fader")); check = new CheckMenuItem(_("Pre Fader"));
init_mute_menu(PRE_FADER, check); init_mute_menu(PRE_FADER, check);
check->toggled.connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), PRE_FADER, check)); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), PRE_FADER, check));
_route.pre_fader_changed.connect(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), check)); _route.pre_fader_changed.connect(bind (mem_fun (*this, &RouteUI::pre_fader_toggle), check));
items.push_back (CheckMenuElem(*check)); items.push_back (CheckMenuElem(*check));
check->show_all(); check->show_all();
check = new CheckMenuItem(_("Post Fader")); check = new CheckMenuItem(_("Post Fader"));
init_mute_menu(POST_FADER, check); init_mute_menu(POST_FADER, check);
check->toggled.connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), POST_FADER, check)); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), POST_FADER, check));
_route.post_fader_changed.connect(bind (mem_fun (*this, &RouteUI::post_fader_toggle), check)); _route.post_fader_changed.connect(bind (mem_fun (*this, &RouteUI::post_fader_toggle), check));
items.push_back (CheckMenuElem(*check)); items.push_back (CheckMenuElem(*check));
check->show_all(); check->show_all();
check = new CheckMenuItem(_("Control Outs")); check = new CheckMenuItem(_("Control Outs"));
init_mute_menu(CONTROL_OUTS, check); init_mute_menu(CONTROL_OUTS, check);
check->toggled.connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), CONTROL_OUTS, check)); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), CONTROL_OUTS, check));
_route.control_outs_changed.connect(bind (mem_fun (*this, &RouteUI::control_outs_toggle), check)); _route.control_outs_changed.connect(bind (mem_fun (*this, &RouteUI::control_outs_toggle), check));
items.push_back (CheckMenuElem(*check)); items.push_back (CheckMenuElem(*check));
check->show_all(); check->show_all();
check = new CheckMenuItem(_("Main Outs")); check = new CheckMenuItem(_("Main Outs"));
init_mute_menu(MAIN_OUTS, check); init_mute_menu(MAIN_OUTS, check);
check->toggled.connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MAIN_OUTS, check)); check->signal_toggled().connect(bind (mem_fun (*this, &RouteUI::toggle_mute_menu), MAIN_OUTS, check));
_route.main_outs_changed.connect(bind (mem_fun (*this, &RouteUI::main_outs_toggle), check)); _route.main_outs_changed.connect(bind (mem_fun (*this, &RouteUI::main_outs_toggle), check));
items.push_back (CheckMenuElem(*check)); items.push_back (CheckMenuElem(*check));
check->show_all(); check->show_all();
@ -565,7 +565,7 @@ bool
RouteUI::choose_color() RouteUI::choose_color()
{ {
bool picked; bool picked;
GdkColor color; Gdk::Color color;
gdouble current[4]; gdouble current[4];
current[0] = _color.get_red() / 65535.0; current[0] = _color.get_red() / 65535.0;
@ -583,14 +583,14 @@ RouteUI::choose_color()
} }
void void
RouteUI::set_color (Gdk_Color c) RouteUI::set_color (Gdk::Color c)
{ {
char buf[64]; char buf[64];
_color = c; _color = c;
ensure_xml_node (); ensure_xml_node ();
snprintf (buf, sizeof (buf), "%d:%d:%d", c.red, c.green, c.blue); snprintf (buf, sizeof (buf), "%d:%d:%d", c.get_red(), c.get_green(), c.get_blue());
xml_node->add_property ("color", buf); xml_node->add_property ("color", buf);
_route.gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */ _route.gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */
@ -634,9 +634,9 @@ RouteUI::set_color_from_route ()
if ((prop = xml_node->property ("color")) != 0) { if ((prop = xml_node->property ("color")) != 0) {
int r, g, b; int r, g, b;
sscanf (prop->value().c_str(), "%d:%d:%d", &r, &g, &b); sscanf (prop->value().c_str(), "%d:%d:%d", &r, &g, &b);
_color.red = r; _color.set_red(r);
_color.green = g; _color.set_green(g);
_color.blue = b; _color.set_blue(b);
return 0; return 0;
} }
return 1; return 1;
@ -665,7 +665,7 @@ RouteUI::remove_this_route ()
Gtk::Main::run (); Gtk::Main::run ();
if (prompter.get_choice() == 0) { if (prompter.get_choice() == 0) {
Main::idle.connect (bind (mem_fun (&RouteUI::idle_remove_this_route), this)); Glib::signal_idle().connect (bind (mem_fun (&RouteUI::idle_remove_this_route), this));
} }
} }

View file

@ -518,3 +518,9 @@ rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a)
return (uint32_t) RGBA_TO_UINT(r,g,b,a); return (uint32_t) RGBA_TO_UINT(r,g,b,a);
} }
void
decorate (Gtk::Window& w, Gdk::WMDecoration d)
{
w.get_window().set_decorations (d);
}

View file

@ -55,13 +55,21 @@ public:
tview.columns_autosize (); tview.columns_autosize ();
} }
struct Result {
Gtk::TreeView& view;
Glib::RefPtr<Gtk::TreeSelection> selection;
Result (Gtk::TreeView& v, Glib::RefPtr<Gtk::TreeSelection> sel)
: view (v), selection (sel) {}
};
/* selection is activated via a double click, choice via /* selection is activated via a double click, choice via
a single click. a single click.
*/ */
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > selection_made; sigc::signal<void,Result*> selection_made;
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > choice_made; sigc::signal<void,Result*> choice_made;
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > shift_made; sigc::signal<void,Result*> shift_made;
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > control_made; sigc::signal<void,Result*> control_made;
sigc::signal<void> update_contents; sigc::signal<void> update_contents;

View file

@ -143,7 +143,8 @@ Selector::accept ()
Gtk::TreeModel::iterator iter = tree_sel->get_selected(); Gtk::TreeModel::iterator iter = tree_sel->get_selected();
if (iter) { if (iter) {
selection_made (tview, tree_sel);
selection_made (new Result (tview, tree_sel));
} else { } else {
cancel (); cancel ();
} }
@ -151,13 +152,12 @@ Selector::accept ()
void void
Selector::chosen () Selector::chosen ()
{ {
Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection(); Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection();
Gtk::TreeModel::iterator iter = tree_sel->get_selected(); Gtk::TreeModel::iterator iter = tree_sel->get_selected();
if (iter) { if (iter) {
choice_made (tview, tree_sel); choice_made (new Result (tview, tree_sel));
} else { } else {
cancel (); cancel ();
} }
@ -165,13 +165,12 @@ Selector::chosen ()
void void
Selector::shift_clicked () Selector::shift_clicked ()
{ {
Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection(); Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection();
Gtk::TreeModel::iterator iter = tree_sel->get_selected(); Gtk::TreeModel::iterator iter = tree_sel->get_selected();
if (iter) { if (iter) {
shift_made (tview, tree_sel); shift_made (new Result (tview, tree_sel));
} else { } else {
cancel (); cancel ();
} }
@ -179,13 +178,12 @@ Selector::shift_clicked ()
void void
Selector::control_clicked () Selector::control_clicked ()
{ {
Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection(); Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection();
Gtk::TreeModel::iterator iter = tree_sel->get_selected(); Gtk::TreeModel::iterator iter = tree_sel->get_selected();
if (iter) { if (iter) {
control_made (tview, tree_sel); control_made (new Result (tview, tree_sel));
} else { } else {
cancel (); cancel ();
} }
@ -193,12 +191,11 @@ Selector::control_clicked ()
void void
Selector::cancel () Selector::cancel ()
{ {
Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection(); Glib::RefPtr<Gtk::TreeSelection> tree_sel = tview.get_selection();
tree_sel->unselect_all(); tree_sel->unselect_all();
selection_made (tview, tree_sel); selection_made (new Result (tview, tree_sel));
} }
void void

View file

@ -197,8 +197,8 @@ namespace StringPrivate
} }
// now for the real thing(s) // now for the real thing(s)
//namespace String namespace PBD
//{ {
// a series of functions which accept a format string on the form "text %1 // a series of functions which accept a format string on the form "text %1
// more %2 less %3" and a number of templated parameters and spits out the // more %2 less %3" and a number of templated parameters and spits out the
// composited string // composited string
@ -387,7 +387,7 @@ namespace StringPrivate
.arg(o10).arg(o11).arg(o12).arg(o13).arg(o14).arg(o15); .arg(o10).arg(o11).arg(o12).arg(o13).arg(o14).arg(o15);
return c.str(); return c.str();
} }
//} }
#endif // STRING_COMPOSE_H #endif // STRING_COMPOSE_H