#include <iostream>
-#include <gtk--.h>
#include <pbd/error.h>
+#include <pbd/compose.h>
#include <pbd/basename.h>
#include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h>
-#include <gtkmmext/gtk_ui.h>
-#include <gtkmmext/pix.h>
-#include <gtkmmext/utils.h>
-#include <gtkmmext/click_box.h>
-#include <gtkmmext/selector.h>
-#include <gtkmmext/fastmeter.h>
-#include <gtkmmext/stop_signal.h>
-#include <gtkmmext/popup.h>
+#include <gtkmm2ext/gtk_ui.h>
+#include <gtkmm2ext/pix.h>
+#include <gtkmm2ext/utils.h>
+#include <gtkmm2ext/click_box.h>
+#include <gtkmm2ext/fastmeter.h>
+#include <gtkmm2ext/stop_signal.h>
+#include <gtkmm2ext/popup.h>
#include <midi++/port.h>
#include <midi++/mmc.h>
#include <ardour/port.h>
#include <ardour/audio_track.h>
+#include "actions.h"
#include "ardour_ui.h"
#include "ardour_message.h"
#include "public_editor.h"
#include "i18n.h"
using namespace ARDOUR;
-using namespace Gtkmmext;
+using namespace Gtkmm2ext;
using namespace Gtk;
-using namespace SigC;
+using namespace sigc;
ARDOUR_UI *ARDOUR_UI::theArdourUI = 0;
-SoundFileSelector* ARDOUR_UI::sfdb_window = 0;
-SigC::Signal1<void,bool> ARDOUR_UI::Blink;
-SigC::Signal0<void> ARDOUR_UI::RapidScreenUpdate;
-SigC::Signal0<void> ARDOUR_UI::SuperRapidScreenUpdate;
-SigC::Signal1<void,jack_nframes_t> ARDOUR_UI::Clock;
+sigc::signal<void,bool> ARDOUR_UI::Blink;
+sigc::signal<void> ARDOUR_UI::RapidScreenUpdate;
+sigc::signal<void> ARDOUR_UI::SuperRapidScreenUpdate;
+sigc::signal<void,jack_nframes_t> ARDOUR_UI::Clock;
/* XPM */
static const gchar *h_meter_strip_xpm[] = {
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
- : Gtkmmext::UI ("ardour", argcp, argvp, rcfile),
-
+ : Gtkmm2ext::UI ("ardour", argcp, argvp, rcfile),
+
primary_clock (X_("TransportClockDisplay"), true, false, true),
secondary_clock (X_("SecondaryClockDisplay"), true, false, true),
preroll_clock (X_("PreRollClock"), true, true),
follow_button (_("follow\nPH")),
auditioning_alert_button (_("AUDITIONING")),
solo_alert_button (_("SOLO")),
-
- session_selector (1, 0),
-
shown_flag (false)
{
using namespace Gtk::Menu_Helpers;
- Gtkmmext::init();
+ Gtkmm2ext::init();
/* actually, its already loaded, but ... */
theArdourUI = this;
}
+ ActionManager::init ();
+
+ m_new_session_dialog = 0;
+ m_new_session_dialog_ref = NewSessionDialogFactory::create();
+ m_new_session_dialog_ref->get_widget_derived (NewSessionDialogFactory::top_level_widget_name(), m_new_session_dialog);
editor = 0;
mixer = 0;
session = 0;
meter_bridge = 0;
option_editor = 0;
location_ui = 0;
- sfdb_window = 0;
- new_session_window = 0;
open_session_selector = 0;
have_configure_timeout = false;
have_disk_overrun_displayed = false;
_will_create_new_session_automatically = false;
session_loaded = false;
+
last_configure_time.tv_sec = 0;
last_configure_time.tv_usec = 0;
set_shuttle_units (Percentage);
set_shuttle_behaviour (Sprung);
- shuttle_unit_menu.items().push_back (MenuElem (_("Percentage"), bind (slot (*this, &ARDOUR_UI::set_shuttle_units),
- Percentage)));
- shuttle_unit_menu.items().push_back (MenuElem (_("Semitones"), bind (slot (*this, &ARDOUR_UI::set_shuttle_units),
- Semitones)));
-
- shuttle_style_menu.items().push_back (MenuElem (_("Sprung"), bind (slot (*this, &ARDOUR_UI::set_shuttle_behaviour),
- Sprung)));
- shuttle_style_menu.items().push_back (MenuElem (_("Wheel"), bind (slot (*this, &ARDOUR_UI::set_shuttle_behaviour),
- Wheel)));
+ Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions");
+
+ shuttle_actions->add (Action::create (X_("SetShuttleUnitsPercentage"), _("Percentage")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Percentage));
+ shuttle_actions->add (Action::create (X_("SetShuttleUnitsSemitones"), _("Semitones")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_units), Semitones));
+ shuttle_actions->add (Action::create (X_("SetShuttleActionSprung"), _("Sprung")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Sprung));
+ shuttle_actions->add (Action::create (X_("SetShuttleActionWheel"), _("Wheel")), bind (mem_fun(*this, &ARDOUR_UI::set_shuttle_behaviour), Wheel));
+
+ ActionManager::add_action_group (shuttle_actions);
+ shuttle_style_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("ShuttleStylePopup"));
+ shuttle_unit_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("ShuttleUnitPopup"));
+
gettimeofday (&last_peak_grab, 0);
gettimeofday (&last_shuttle_request, 0);
- ARDOUR::DiskStream::CannotRecordNoInput.connect (slot (*this, &ARDOUR_UI::cannot_record_no_input));
- ARDOUR::DiskStream::DeleteSources.connect (slot (*this, &ARDOUR_UI::delete_sources_in_the_right_thread));
- ARDOUR::DiskStream::DiskOverrun.connect (slot (*this, &ARDOUR_UI::disk_overrun_handler));
- ARDOUR::DiskStream::DiskUnderrun.connect (slot (*this, &ARDOUR_UI::disk_underrun_handler));
+ ARDOUR::DiskStream::CannotRecordNoInput.connect (mem_fun(*this, &ARDOUR_UI::cannot_record_no_input));
+ ARDOUR::DiskStream::DeleteSources.connect (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread));
+ ARDOUR::DiskStream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
+ ARDOUR::DiskStream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
/* handle pending state with a dialog */
- ARDOUR::Session::AskAboutPendingState.connect (slot (*this, &ARDOUR_UI::pending_state_dialog));
+ ARDOUR::Session::AskAboutPendingState.connect (mem_fun(*this, &ARDOUR_UI::pending_state_dialog));
channel_combo_strings = internationalize (channel_setup_names);
void
ARDOUR_UI::cannot_record_no_input (DiskStream* ds)
{
- ENSURE_GUI_THREAD (bind (slot (*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 = string_compose (_("\
You cannot record-enable\n\
track %1\n\
because it has no input connections.\n\
{
engine = &e;
- engine->Stopped.connect (slot (*this, &ARDOUR_UI::engine_stopped));
- engine->Running.connect (slot (*this, &ARDOUR_UI::engine_running));
- engine->Halted.connect (slot (*this, &ARDOUR_UI::engine_halted));
- engine->SampleRateChanged.connect (slot (*this, &ARDOUR_UI::update_sample_rate));
+ engine->Stopped.connect (mem_fun(*this, &ARDOUR_UI::engine_stopped));
+ engine->Running.connect (mem_fun(*this, &ARDOUR_UI::engine_running));
+ engine->Halted.connect (mem_fun(*this, &ARDOUR_UI::engine_halted));
+ engine->SampleRateChanged.connect (mem_fun(*this, &ARDOUR_UI::update_sample_rate));
_tooltips.enable();
}
if (GTK_ARDOUR::show_key_actions) {
- KeyboardTarget::show_all_actions ();
+ // GTK2FIX
+ // show_all_actions ();
exit (0);
}
/* start the time-of-day-clock */
update_wall_clock ();
- Main::timeout.connect (slot (*this, &ARDOUR_UI::update_wall_clock), 60000);
+ Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::update_wall_clock), 60000);
update_disk_space ();
update_cpu_load ();
update_sample_rate (engine->frame_rate());
- starting.connect (slot (*this, &ARDOUR_UI::startup));
- stopping.connect (slot (*this, &ARDOUR_UI::shutdown));
+ starting.connect (mem_fun(*this, &ARDOUR_UI::startup));
+ stopping.connect (mem_fun(*this, &ARDOUR_UI::shutdown));
}
ARDOUR_UI::~ARDOUR_UI ()
if (have_configure_timeout) {
gettimeofday (&last_configure_time, 0);
} else {
- TimeoutSig t;
- t.connect (slot (*this, &ARDOUR_UI::configure_timeout), 100);
+ Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::configure_timeout), 100);
have_configure_timeout = true;
}
with the scheduling of the audio thread.
*/
- Gtk::Main::idle.connect (slot (*this, &ARDOUR_UI::start_engine));
+ Glib::signal_idle().connect (mem_fun(*this, &ARDOUR_UI::start_engine));
}
void
string msg;
- msg = compose(_("Save and %1"), what);
+ msg = string_compose(_("Save and %1"), what);
Gtk::Button save_button (msg);
save_button.set_name ("EditorGTKButton");
- msg = compose(_("Just %1"), what);
+ msg = string_compose(_("Just %1"), what);
Gtk::Button nosave_button (msg);
nosave_button.set_name ("EditorGTKButton");
- msg = compose(_("Don't %1"), what);
+ msg = string_compose(_("Don't %1"), what);
Gtk::Button noquit_button (msg);
noquit_button.set_name ("EditorGTKButton");
} else {
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 = string_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());
prompt_label.set_text (prompt);
prompt_label.set_alignment (0.5, 0.5);
prompt_label.set_name (X_("PrompterLabel"));
- save_button.clicked.connect (bind(slot(window,&ArdourDialog::stop), 1));
- nosave_button.clicked.connect (bind(slot(window,&ArdourDialog::stop), 0));
- noquit_button.clicked.connect (bind(slot(window,&ArdourDialog::stop), -1));
+ save_button.signal_clicked().connect (bind(mem_fun(window,&ArdourDialog::stop), 1));
+ nosave_button.signal_clicked().connect (bind(mem_fun(window,&ArdourDialog::stop), 0));
+ noquit_button.signal_clicked().connect (bind(mem_fun(window,&ArdourDialog::stop), -1));
button_packer.set_spacing (10);
button_packer.pack_start (save_button);
window.set_name (_("Prompter"));
window.set_title (_("ardour: save session?"));
- window.set_position (GTK_WIN_POS_MOUSE);
+ window.set_position (Gtk::WIN_POS_MOUSE);
window.set_modal (true);
window.add (packer);
window.show_all ();
-
- window.realize();
- window.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
window.set_keyboard_input (true);
save_the_session = 0;
{
char buf[32];
- ENSURE_GUI_THREAD (bind (slot (*this, &ARDOUR_UI::update_sample_rate), ignored));
+ ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::update_sample_rate), ignored));
if (!engine->connected()) {
void
ARDOUR_UI::queue_map_control_change (Session::ControlType t)
{
- ENSURE_GUI_THREAD (bind (slot (*this, &ARDOUR_UI::map_control_change), t));
+ ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::map_control_change), t));
}
void
gint
ARDOUR_UI::session_menu (GdkEventButton *ev)
{
- session_popup_menu->popup (0, 0, 0, 0);
+ session_popup_menu->popup (0, 0);
return TRUE;
}
void
ARDOUR_UI::redisplay_recent_sessions ()
{
- using namespace Gtkmmext;
- using namespace Gtk::CTree_Helpers;
-
vector<string *> *sessions;
vector<string *>::iterator i;
RecentSessionsSorter cmp;
-
- /* ---------------------------------------- */
- /* XXX MAKE ME A FUNCTION (no CTree::clear() in gtkmm 1.2) */
-
- gtk_ctree_remove_node (session_selector.gtkobj(), NULL);
- /* ---------------------------------------- */
-
+
+ recent_session_display.set_model (Glib::RefPtr<TreeModel>(0));
+ recent_session_model->clear ();
RecentSessions rs;
ARDOUR::read_recent_sessions (rs);
if (rs.empty()) {
- session_selector.thaw();
+ recent_session_display.set_model (recent_session_model);
return;
}
+
/* sort them alphabetically */
- sort(rs.begin(), rs.end(), cmp);
+ sort (rs.begin(), rs.end(), cmp);
sessions = new vector<string*>;
+
for (RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
sessions->push_back (new string ((*i).second));
}
- session_selector.freeze();
-
for (i = sessions->begin(); i != sessions->end(); ++i) {
vector<string*>* states;
vector<const gchar*> item;
string fullpath = *(*i);
-
+
/* remove any trailing / */
if (fullpath[fullpath.length()-1] == '/') {
/* now get available states for this session */
- if ((states = Session::possible_states(fullpath)) == 0) {
+ if ((states = Session::possible_states (fullpath)) == 0) {
/* no state file? */
continue;
}
- /* OK, try to add entries for this session */
-
-
- /* add the parent */
-
- 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 */
+ TreeModel::Row row = *(recent_session_model->append());
- session_selector.rows().back().set_leaf (true);
+ row[recent_session_columns.visible_name] = PBD::basename (fullpath);
+ row[recent_session_columns.fullpath] = fullpath;
- } else {
-
- session_selector.rows().back().set_leaf (false);
+ if (states->size() > 1) {
- vector<string *>::iterator i2;
-
/* add the children */
- for (i2 = states->begin(); i2 != states->end(); ++i2) {
-
- string statename = *(*i2);
-
- item.clear ();
- item.push_back (statename.c_str());
-
- 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);
+ for (vector<string*>::iterator i2 = states->begin(); i2 != states->end(); ++i2) {
+ TreeModel::Row child_row = *(recent_session_model->append (row.children()));
+
+ child_row[recent_session_columns.visible_name] = **i2;
+ child_row[recent_session_columns.fullpath] = fullpath;
+
delete *i2;
}
}
delete states;
}
- session_selector.thaw();
+ recent_session_display.set_model (recent_session_model);
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
ARDOUR_UI::build_session_selector ()
{
session_selector_window = new ArdourDialog ("session selector");
- Gtk::VBox *vpacker = new Gtk::VBox;
- Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow;
- Gtk::HBox *button_packer = new Gtk::HBox;
- Gtk::Button *cancel_button = new Gtk::Button (_("cancel"));
- Gtk::Button *rescan_button = new Gtk::Button (_("rescan"));
+ Gtk::VBox *vpacker = manage (new Gtk::VBox);
+ Gtk::ScrolledWindow *scroller = manage (new Gtk::ScrolledWindow);
+ Gtk::HBox *button_packer = manage (new Gtk::HBox);
+ Gtk::Button *cancel_button = manage (new Gtk::Button (_("cancel")));
+ Gtk::Button *rescan_button = manage (new Gtk::Button (_("rescan")));
button_packer->pack_start (*rescan_button);
button_packer->pack_start (*cancel_button);
vpacker->pack_start (*scroller);
vpacker->pack_start (*button_packer, false, false);
- scroller->add (session_selector);
- scroller->set_policy(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ 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);
session_selector_window->add (*vpacker);
session_selector_window->set_name ("SessionSelectorWindow");
- session_selector_window->set_usize (200, 400);
-
- session_selector_window->delete_event.connect (bind (slot (just_hide_it), static_cast<Gtk::Window*>(session_selector_window)));
- cancel_button->clicked.connect (bind (slot (*this, &ARDOUR_UI::hide_dialog), session_selector_window));
- session_selector.tree_select_row.connect (slot (*this, &ARDOUR_UI::session_selection));
+ session_selector_window->set_size_request (200, 400);
}
void
-ARDOUR_UI::fs_cancel_clicked (Gtk::FileSelection* fs)
+ARDOUR_UI::open_recent_session ()
{
- fs->hide_all();
- fs->get_selection_entry()->set_text("");
- allow_focus (false);
+ /* 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);
+
}
-gint
-ARDOUR_UI::fs_delete_event (GdkEventAny* ev, Gtk::FileSelection* fs)
+bool
+ARDOUR_UI::filter_ardour_session_dirs (const FileFilter::Info& info)
{
- fs_cancel_clicked (fs);
- return 1;
+ 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
/* popup selector window */
if (open_session_selector == 0) {
- open_session_selector = new Gtk::FileSelection(_("open session"));
- open_session_selector->get_ok_button()->clicked.connect (slot (*this, &ARDOUR_UI::open_ok_clicked));
- open_session_selector->get_cancel_button()->clicked.connect (bind (slot (*this, &ARDOUR_UI::fs_cancel_clicked), open_session_selector));
- open_session_selector->delete_event.connect (bind (slot (*this, &ARDOUR_UI::fs_delete_event), open_session_selector));
- }
+ open_session_selector = new Gtk::FileChooserDialog (_("open session"), FILE_CHOOSER_ACTION_OPEN);
+ open_session_selector->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ open_session_selector->add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
+
+ 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->show_all ();
- allow_focus (true);
+ open_session_selector->add_filter (filter_ardour);
+ }
- /* wait for selection */
-}
+ switch (open_session_selector->run ()) {
+ case RESPONSE_OK:
+ break;
+ default:
+ return;
+ }
-void
-ARDOUR_UI::open_ok_clicked ()
-{
- open_session_selector->hide_all();
string session_path = open_session_selector->get_filename();
string path, name;
bool isnew;
load_session (path, name);
}
}
-
- open_session_selector->get_selection_entry()->set_text("");
-
- /* XXX hack hack hack */
-
- GtkCList* clist = (GtkCList*) open_session_selector->gtkobj()->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
ARDOUR_UI::session_add_midi_track ()
void
ARDOUR_UI::queue_transport_change ()
{
- Gtkmmext::UI::instance()->call_slot (slot (*this, &ARDOUR_UI::map_transport_state));
+ Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &ARDOUR_UI::map_transport_state));
}
void
void
ARDOUR_UI::engine_stopped ()
{
- ENSURE_GUI_THREAD (slot (*this, &ARDOUR_UI::engine_stopped));
+ ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::engine_stopped));
jack_disconnect_item->set_sensitive (false);
jack_reconnect_item->set_sensitive (true);
void
ARDOUR_UI::engine_running ()
{
- ENSURE_GUI_THREAD (slot (*this, &ARDOUR_UI::engine_running));
+ ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::engine_running));
jack_disconnect_item->set_sensitive (true);
jack_reconnect_item->set_sensitive (false);
void
ARDOUR_UI::engine_halted ()
{
- ENSURE_GUI_THREAD (slot (*this, &ARDOUR_UI::engine_halted));
+ ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::engine_halted));
jack_disconnect_item->set_sensitive (false);
jack_reconnect_item->set_sensitive (true);
solution, its what we have.
*/
- Main::timeout.connect (slot (*this, &ARDOUR_UI::make_session_clean), 1000);
+ Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::make_session_clean), 1000);
}
return FALSE;
void
ARDOUR_UI::start_clocking ()
{
- clock_signal_connection = RapidScreenUpdate.connect (slot (*this, &ARDOUR_UI::update_clocks));
+ clock_signal_connection = RapidScreenUpdate.connect (mem_fun(*this, &ARDOUR_UI::update_clocks));
}
void
}
MenuList& items = diskstream_menu->items();
- items.push_back (MenuElem (dstream.name(), bind (slot (*this, &ARDOUR_UI::diskstream_selected), (gint32) dstream.id())));
+ items.push_back (MenuElem (dstream.name(), bind (mem_fun(*this, &ARDOUR_UI::diskstream_selected), (gint32) dstream.id())));
}
void
using namespace Menu_Helpers;
MenuList& items = diskstream_menu->items();
- items.push_back (MenuElem (_("No Stream"), (bind (slot (*this, &ARDOUR_UI::diskstream_selected), -1))));
+ items.push_back (MenuElem (_("No Stream"), (bind (mem_fun(*this, &ARDOUR_UI::diskstream_selected), -1))));
session->foreach_diskstream (this, &ARDOUR_UI::add_diskstream_to_menu);
ARDOUR_UI::snapshot_session ()
{
ArdourPrompter prompter (true);
+ string snapname;
string now;
time_t n;
prompter.set_name ("Prompter");
prompter.set_prompt (_("Name for snapshot"));
prompter.set_initial_text (now);
- prompter.done.connect (Gtk::Main::quit.slot());
- prompter.show_all ();
-
- Gtk::Main::run ();
-
- if (prompter.status == Gtkmmext::Prompter::entered) {
- string snapname;
-
+
+ switch (prompter.run()) {
+ case RESPONSE_ACCEPT:
prompter.get_result (snapname);
if (snapname.length()){
save_state (snapname);
}
+ break;
+
+ default:
+ break;
}
}
}
}
-void
-ARDOUR_UI::allow_focus (bool yn)
-{
- if (keyboard) {
- keyboard->allow_focus (yn);
- }
-}
-
void
ARDOUR_UI::primary_clock_value_changed ()
{
switch (rs) {
case Session::Disabled:
case Session::Enabled:
- if (w->get_state() != GTK_STATE_SELECTED) {
- w->set_state (GTK_STATE_SELECTED);
+ if (w->get_state() != STATE_SELECTED) {
+ w->set_state (STATE_SELECTED);
}
break;
case Session::Recording:
- if (w->get_state() != GTK_STATE_ACTIVE) {
- w->set_state (GTK_STATE_ACTIVE);
+ if (w->get_state() != STATE_ACTIVE) {
+ w->set_state (STATE_ACTIVE);
}
break;
}
} else {
- if (w->get_state() != GTK_STATE_NORMAL) {
- w->set_state (GTK_STATE_NORMAL);
+ if (w->get_state() != STATE_NORMAL) {
+ w->set_state (STATE_NORMAL);
}
}
}
switch (session->record_status()) {
case Session::Enabled:
if (onoff) {
- rec_button.set_state (GTK_STATE_ACTIVE);
+ rec_button.set_state (STATE_ACTIVE);
} else {
- rec_button.set_state (GTK_STATE_NORMAL);
+ rec_button.set_state (STATE_NORMAL);
}
break;
case Session::Recording:
- rec_button.set_state (GTK_STATE_ACTIVE);
+ rec_button.set_state (STATE_ACTIVE);
break;
default:
rec_button.set_active (false);
- rec_button.set_state (GTK_STATE_NORMAL);
+ rec_button.set_state (STATE_NORMAL);
break;
}
}
-gint
-ARDOUR_UI::generic_focus_in_event (GdkEventFocus *ev)
-{
- ARDOUR_UI::instance()->allow_focus (true);
- return FALSE;
-}
-
-gint
-ARDOUR_UI::generic_focus_out_event (GdkEventFocus *ev)
-{
- ARDOUR_UI::instance()->allow_focus (false);
- return FALSE;
-}
-
gint
ARDOUR_UI::hide_and_quit (GdkEventAny *ev, ArdourDialog *window)
{
{
ArdourPrompter prompter (true);
- prompter.set_name ("Prompter");
+ string name;
+
+ prompter.set_name (X_("Prompter"));
prompter.set_prompt (_("Name for mix template:"));
prompter.set_initial_text(session->name() + _("-template"));
-
- prompter.done.connect(Gtk::Main::quit.slot());
- prompter.show_all();
- Gtk::Main::run();
-
- if (prompter.status == Gtkmmext::Prompter::entered) {
- string name;
-
+ switch (prompter.run()) {
+ case RESPONSE_ACCEPT:
prompter.get_result (name);
-
+
if (name.length()) {
session->save_template (name);
}
+ break;
+
+ default:
+ break;
}
}
void
-ARDOUR_UI::new_session (bool startup, string predetermined_path)
+ARDOUR_UI::new_session (bool startup, std::string predetermined_path)
{
- if (new_session_window == 0){
- new_session_window = new NewSessionDialog (*engine, startup, predetermined_path);
- editor->ensure_float (*new_session_window);
- }
-
- new_session_window->run ();
-
- /* write favorites either way */
- Session::FavoriteDirs favs;
- new_session_window->file_selector.get_favorites (favs);
- Session::write_favorite_dirs (favs);
-
- if (new_session_window->run_status()) {
- return;
- }
-
- string session_path = new_session_window->file_selector.get_path ();
- string session_name = PBD::basename (session_path);
-
- // Check that it doesn't already exist.
- access(session_path.c_str(), R_OK);
- if (errno != ENOENT){
- error << compose(_("Session %1 already exists at %2"), session_name, session_path) << endmsg;
- return;
- }
-
- _session_is_new = true;
+ m_new_session_dialog->show_all();
+ m_new_session_dialog->set_transient_for(*editor);
+ m_new_session_dialog->set_name(predetermined_path);
- if (session_path[session_path.length()-1] != '/') {
+ int response = Gtk::RESPONSE_CANCEL;
- string template_name = new_session_window->get_template_name ();
-
- if (template_name.length()) {
-
- load_session (session_path, session_name, &template_name);
-
- } else {
-
- uint32_t cchns;
- uint32_t mchns;
- Session::AutoConnectOption iconnect;
- Session::AutoConnectOption oconnect;
-
- if (new_session_window->use_control_button.get_active()) {
- cchns = (uint32_t) channel_combo_get_channel_count (new_session_window->control_out_channel_combo);
- } else {
- cchns = 0;
- }
- if (new_session_window->use_master_button.get_active()) {
- mchns = (uint32_t) channel_combo_get_channel_count (new_session_window->master_out_channel_combo);
- } else {
- mchns = 0;
- }
-
- if (new_session_window->connect_to_physical_inputs_button.get_active()) {
- iconnect = Session::AutoConnectPhysical;
- } else {
- iconnect = Session::AutoConnectOption (0);
- }
+ do {
+ response = m_new_session_dialog->run ();
+
+ if(response == Gtk::RESPONSE_OK) {
- if (new_session_window->connect_to_master_button.get_active ()) {
- oconnect = Session::AutoConnectMaster;
- } else if (new_session_window->connect_to_physical_outputs_button.get_active ()) {
- oconnect = Session::AutoConnectPhysical;
+ _session_is_new = true;
+
+ std::string session_name = m_new_session_dialog->session_name();
+ std::string session_path = m_new_session_dialog->session_folder();
+ std::string template_name = m_new_session_dialog->session_template_name();
+
+ if (m_new_session_dialog->use_session_template()) {
+
+ load_session (session_path, session_name, &template_name);
+
} else {
- oconnect = Session::AutoConnectOption (0);
- }
-
- uint32_t nphysin = (uint32_t) new_session_window->in_count_adjustment.get_value();
- uint32_t nphysout = (uint32_t) new_session_window->out_count_adjustment.get_value();
-
- build_session (session_path, session_name, cchns, mchns, iconnect, oconnect, nphysin, nphysout,
- engine->frame_rate() * 60 * 5);
+
+ uint32_t cchns;
+ uint32_t mchns;
+ Session::AutoConnectOption iconnect;
+ Session::AutoConnectOption oconnect;
+
+ if (m_new_session_dialog->create_control_track()) {
+ cchns = (uint32_t) m_new_session_dialog->control_channel_count();
+ } else {
+ cchns = 0;
+ }
+
+ if (m_new_session_dialog->create_master_track()) {
+ mchns = (uint32_t) m_new_session_dialog->master_channel_count();
+ } else {
+ mchns = 0;
+ }
+
+ if (m_new_session_dialog->connect_inputs()) {
+ iconnect = Session::AutoConnectPhysical;
+ } else {
+ iconnect = Session::AutoConnectOption (0);
+ }
+
+ /// @todo some minor tweaks.
+
+ if (m_new_session_dialog->connect_outs_to_master()) {
+ oconnect = Session::AutoConnectMaster;
+ } else if (m_new_session_dialog->connect_outs_to_physical()) {
+ oconnect = Session::AutoConnectPhysical;
+ } else {
+ oconnect = Session::AutoConnectOption (0);
+ }
+
+ uint32_t nphysin = (uint32_t) m_new_session_dialog->input_limit_count();
+ uint32_t nphysout = (uint32_t) m_new_session_dialog->output_limit_count();
+
+ build_session (session_path,
+ session_name,
+ cchns,
+ mchns,
+ iconnect,
+ oconnect,
+ nphysin,
+ nphysout,
+ engine->frame_rate() * 60 * 5);
+ }
}
- }
+
+ } while(response == Gtk::RESPONSE_HELP);
+ m_new_session_dialog->hide_all();
}
int
catch (...) {
- error << compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
+ error << string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
return -1;
}
catch (...) {
- error << compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
+ error << string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name) << endmsg;
return -1;
}
return 0;
}
-void
-ARDOUR_UI::hide_dialog (ArdourDialog *dialog)
-{
- dialog->hide_all();
-}
-
void
ARDOUR_UI::show ()
{
}
if (about) {
- about->get_window().raise ();
+ about->present ();
}
}
ARDOUR_UI::show_splash ()
{
if (about == 0) {
- about = new About(this);
- 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 = new About();
}
+ about->present();
}
void
ArdourDialog results ("cleanup results");
- const gchar* list_titles[] = {
- list_title,
- 0
+ struct CleanupResultsModelColumns : public Gtk::TreeModel::ColumnRecord {
+ CleanupResultsModelColumns() {
+ add (visible_name);
+ add (fullpath);
+ }
+ Gtk::TreeModelColumn<Glib::ustring> visible_name;
+ Gtk::TreeModelColumn<Glib::ustring> fullpath;
};
+
+
+ Glib::RefPtr<Gtk::ListStore> results_model;
+ CleanupResultsModelColumns results_columns;
+ Gtk::TreeView results_display;
- Gtk::CList list (internationalize (list_titles));
+ 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::Label txt;
Gtk::Button ok_button (_("OK"));
Gtk::VBox vpacker;
- const char* rowtext[1];
-
- list_scroller.set_policy (GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
vpacker.set_border_width (10);
vpacker.set_spacing (10);
if (rep.space < 1048576.0f) {
if (removed > 1) {
- txt.set_text (compose (msg, removed, _("files"), (float) rep.space / 1024.0f, "kilo"));
+ txt.set_text (string_compose (msg, removed, _("files"), (float) rep.space / 1024.0f, "kilo"));
} else {
- txt.set_text (compose (msg, removed, _("file"), (float) rep.space / 1024.0f, "kilo"));
+ txt.set_text (string_compose (msg, removed, _("file"), (float) rep.space / 1024.0f, "kilo"));
}
} else {
if (removed > 1) {
- txt.set_text (compose (msg, removed, _("files"), (float) rep.space / 1048576.0f, "mega"));
+ txt.set_text (string_compose (msg, removed, _("files"), (float) rep.space / 1048576.0f, "mega"));
} else {
- txt.set_text (compose (msg, removed, _("file"), (float) rep.space / 1048576.0f, "mega"));
+ txt.set_text (string_compose (msg, removed, _("file"), (float) rep.space / 1048576.0f, "mega"));
}
}
vpacker.pack_start (txt, false, false);
for (vector<string>::iterator i = rep.paths.begin(); i != rep.paths.end(); ++i) {
- rowtext[0] = (*i).c_str();
- list.rows().push_back (rowtext);
+ TreeModel::Row row = *(results_model->append());
+ row[results_columns.visible_name] = *i;
+ row[results_columns.fullpath] = *i;
}
- list_scroller.add_with_viewport (list);
- list_scroller.set_usize (-1, 250);
+ list_scroller.add (results_display);
+ 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 (ok_button, false, false);
- ok_button.clicked.connect (Main::quit.slot ());
- results.Hiding.connect (Main::quit.slot ());
-
results.add (vpacker);
- results.set_position (GTK_WIN_POS_MOUSE);
+ results.set_position (Gtk::WIN_POS_MOUSE);
results.set_title (_("ardour: cleanup"));
results.set_modal (true);
+
results.run ();
}
checker.set_name (_("CleanupDialog"));
checker.set_title (_("ardour cleanup"));
checker.set_wmclass (_("ardour_cleanup"), "Ardour");
- checker.set_position (GTK_WIN_POS_MOUSE);
- checker.realize ();
- checker.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
+ checker.set_position (Gtk::WIN_POS_MOUSE);
- ok_button.clicked.connect (bind (slot (checker, &ArdourDialog::stop), 1));
- cancel_button.clicked.connect (bind (slot (checker, &ArdourDialog::stop), 0));
+ ok_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 1));
+ cancel_button.signal_clicked().connect (bind (mem_fun (checker, &ArdourDialog::stop), 0));
checker.run ();
- if (checker.run_status() != 1) {
+ switch (checker.run_status()) {
+ case 0:
+ break;
+ default:
return;
}
void
ARDOUR_UI::halt_on_xrun_message ()
{
- ENSURE_GUI_THREAD (slot (*this, &ARDOUR_UI::halt_on_xrun_message));
+ ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::halt_on_xrun_message));
ArdourMessage msg (editor, X_("haltonxrun"),
_("Recording was stopped because your system could not keep up."));
void
ARDOUR_UI::delete_sources_in_the_right_thread (list<ARDOUR::Source*>* deletion_list)
{
- ENSURE_GUI_THREAD (bind (slot (*this, &ARDOUR_UI::delete_sources_in_the_right_thread), deletion_list));
+ ENSURE_GUI_THREAD (bind (mem_fun(*this, &ARDOUR_UI::delete_sources_in_the_right_thread), deletion_list));
for (list<Source*>::iterator i = deletion_list->begin(); i != deletion_list->end(); ++i) {
delete *i;
void
ARDOUR_UI::disk_overrun_handler ()
{
- ENSURE_GUI_THREAD (slot (*this, &ARDOUR_UI::disk_underrun_handler));
+ ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
if (!have_disk_overrun_displayed) {
have_disk_overrun_displayed = true;
void
ARDOUR_UI::disk_underrun_handler ()
{
- ENSURE_GUI_THREAD (slot (*this, &ARDOUR_UI::disk_underrun_handler));
+ ENSURE_GUI_THREAD (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
if (!have_disk_underrun_displayed) {
have_disk_underrun_displayed = true;
hpacker.pack_start (use_button);
hpacker.pack_start (cancel_button);
- use_button.clicked.connect (bind (slot (dialog, &ArdourDialog::stop), 0));
- cancel_button.clicked.connect (bind (slot (dialog, &ArdourDialog::stop), 1));
+ use_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0));
+ cancel_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1));
dialog.add (vpacker);
- dialog.set_position (GTK_WIN_POS_CENTER);
+ dialog.set_position (WIN_POS_CENTER);
dialog.show_all ();
- dialog.realize();
- dialog.get_window().set_decorations (GdkWMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
dialog.run ();
- if (dialog.run_status () == 0) {
+ if (dialog.run_status () != 0) {
return 1;
}