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,28 +20,29 @@ gtkardour.Append(CCFLAGS="-DLIBSIGC_DISABLE_DEPRECATED")
gtkardour.Append(PACKAGE=domain)
gtkardour.Append(POTFILE=domain + '.pot')
gtkardour.Merge ( [libraries['ardour'],
libraries['gtkmm2ext'],
libraries['midi++2'],
libraries['pbd3'],
libraries['gtkmm2'],
libraries['sigc2'],
libraries['libgnomecanvasmm'],
libraries['sysmidi'],
libraries['sndfile'],
libraries['lrdf'],
libraries['glibmm2'],
libraries['pangomm'],
libraries['atkmm'],
libraries['gdkmm2'],
libraries['gtk2'],
libraries['libgnomecanvas2'],
libraries['xml'],
libraries['soundtouch'],
libraries['raptor'],
libraries['samplerate'],
libraries['jack']]
)
gtkardour.Merge ([
libraries['ardour'],
libraries['gtkmm2ext'],
libraries['midi++2'],
libraries['pbd3'],
libraries['gtkmm2'],
libraries['libgnomecanvasmm'],
libraries['sysmidi'],
libraries['sndfile'],
libraries['lrdf'],
libraries['glibmm2'],
libraries['pangomm'],
libraries['atkmm'],
libraries['gdkmm2'],
libraries['sigc2'],
libraries['gtk2'],
libraries['libgnomecanvas2'],
libraries['xml'],
libraries['soundtouch'],
libraries['raptor'],
libraries['samplerate'],
libraries['jack']
])
if gtkardour['VST']:
gtkardour.Merge ([ libraries['fst']])

View File

@ -30,6 +30,7 @@
#include <gtkmm.h>
#include <pbd/error.h>
#include <pbd/compose.h>
#include <pbd/basename.h>
#include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h>
@ -37,7 +38,6 @@
#include <gtkmm2ext/pix.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/fastmeter.h>
#include <gtkmm2ext/stop_signal.h>
#include <gtkmm2ext/popup.h>
@ -816,9 +816,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
follow_button (_("follow\nPH")),
auditioning_alert_button (_("AUDITIONING")),
solo_alert_button (_("SOLO")),
session_selector (1, 0),
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_usec = 0;
ui_manager = UIManager::create ();
shuttle_grabbed = false;
shuttle_fract = 0.0;
set_shuttle_units (Percentage);
set_shuttle_behaviour (Sprung);
Glib::RefPtr<ActionGroup> shuttle_style_actions = ActionGroup::create ();
Glib::RefPtr<ActionGroup> shuttle_unit_actions = ActionGroup::create ();
Glib::RefPtr<ActionGroup> shuttle_actions = ActionGroup::create ("ShuttleActions");
shuttle_unit_actions->add (Action::create (_("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_style_actions->add (Action::create (_("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_("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));
uiManager->insert_action_group (shuttle_style_actions);
uiManager->insert_action_group (shuttle_unit_actions);
ui_manager->insert_action_group (shuttle_actions);
shuttle_style_menu = uiManager.get_widget ('/ShuttleStyle');
shuttle_unit_menu = uiManager.get_widget ('/ShuttleUnits');
shuttle_style_menu = dynamic_cast<Menu*> (ui_manager->get_widget ("ShuttleStylePopup"));
shuttle_unit_menu = dynamic_cast<Menu*> (ui_manager->get_widget ("ShuttleUnitPopup"));
gettimeofday (&last_peak_grab, 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));
string msg = compose (_("\
string msg = PBD::compose (_("\
You cannot record-enable\n\
track %1\n\
because it has no input connections.\n\
@ -957,7 +954,7 @@ ARDOUR_UI::set_engine (AudioEngine& e)
/* start the time-of-day-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_cpu_load ();
@ -1022,8 +1019,7 @@ ARDOUR_UI::configure_handler (GdkEventConfigure* conf)
if (have_configure_timeout) {
gettimeofday (&last_configure_time, 0);
} else {
TimeoutSig t;
t.connect (mem_fun(*this, &ARDOUR_UI::configure_timeout), 100);
Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::configure_timeout), 100);
have_configure_timeout = true;
}
@ -1067,7 +1063,7 @@ ARDOUR_UI::startup ()
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
@ -1108,17 +1104,17 @@ ARDOUR_UI::ask_about_saving_session (string what)
string msg;
msg = compose(_("Save and %1"), what);
msg = PBD::compose(_("Save and %1"), what);
Gtk::Button save_button (msg);
save_button.set_name ("EditorGTKButton");
msg = compose(_("Just %1"), what);
msg = PBD::compose(_("Just %1"), what);
Gtk::Button nosave_button (msg);
nosave_button.set_name ("EditorGTKButton");
msg = compose(_("Don't %1"), what);
msg = PBD::compose(_("Don't %1"), what);
Gtk::Button noquit_button (msg);
noquit_button.set_name ("EditorGTKButton");
@ -1131,7 +1127,7 @@ ARDOUR_UI::ask_about_saving_session (string what)
} 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 = 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());
prompt_label.set_text (prompt);
@ -1158,9 +1154,6 @@ ARDOUR_UI::ask_about_saving_session (string what)
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;
@ -1644,49 +1637,42 @@ ARDOUR_UI::toggle_some_session_state (ToggleButton& button,
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 Gtkmm2ext;
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.gobj(), 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] == '/') {
@ -1695,49 +1681,27 @@ ARDOUR_UI::redisplay_recent_sessions ()
/* 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 */
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 */
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;
}
}
@ -1745,66 +1709,20 @@ ARDOUR_UI::redisplay_recent_sessions ()
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);
@ -1812,16 +1730,55 @@ ARDOUR_UI::build_session_selector ()
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_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
@ -1839,28 +1796,55 @@ ARDOUR_UI::fs_delete_event (GdkEventAny* ev, Gtk::FileSelection* fs)
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
ARDOUR_UI::open_session ()
{
/* popup selector window */
if (open_session_selector == 0) {
open_session_selector = new Gtk::FileSelection(_("open session"));
open_session_selector->get_ok_button()-.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::open_ok_clicked));
open_session_selector->get_cancel_button()-.signal_clicked().connect (bind (mem_fun(*this, &ARDOUR_UI::fs_cancel_clicked), open_session_selector));
open_session_selector->signal_delete_event().connect (bind (mem_fun(*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->add_filter (filter_ardour);
}
switch (open_session_selector->run ()) {
case RESPONSE_OK:
break;
default:
return;
}
open_session_selector->show_all ();
allow_focus (true);
/* wait for selection */
}
void
ARDOUR_UI::open_ok_clicked ()
{
open_session_selector->hide_all();
string session_path = open_session_selector->get_filename();
string path, name;
bool isnew;
@ -1871,31 +1855,8 @@ ARDOUR_UI::open_ok_clicked ()
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
ARDOUR_UI::session_add_midi_track ()
@ -2365,7 +2326,7 @@ ARDOUR_UI::start_engine ()
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;
@ -2543,6 +2504,7 @@ void
ARDOUR_UI::snapshot_session ()
{
ArdourPrompter prompter (true);
string snapname;
string now;
time_t n;
@ -2553,18 +2515,17 @@ ARDOUR_UI::snapshot_session ()
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 == Gtkmm2ext::Prompter::entered) {
string snapname;
switch (prompter.run()) {
case RESPONSE_ACCEPT:
prompter.get_result (snapname);
if (snapname.length()){
save_state (snapname);
}
break;
default:
break;
}
}
@ -2639,21 +2600,21 @@ ARDOUR_UI::rec_enable_button_blink (bool onoff, DiskStream *dstream, Widget *w)
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);
}
}
}
@ -2668,19 +2629,19 @@ ARDOUR_UI::transport_rec_enable_blink (bool onoff)
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;
}
}
@ -2718,23 +2679,23 @@ ARDOUR_UI::save_template ()
{
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 == Gtkmm2ext::Prompter::entered) {
string name;
switch (prompter.run()) {
case RESPONSE_ACCEPT:
prompter.get_result (name);
if (name.length()) {
session->save_template (name);
}
break;
default:
break;
}
}
@ -2748,6 +2709,9 @@ ARDOUR_UI::new_session (bool startup, string predetermined_path)
new_session_window->run ();
#if 0
// GTK2FIX
/* write favorites either way */
Session::FavoriteDirs 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()) {
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);
// 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;
error << PBD::compose(_("Session %1 already exists at %2"), session_name, session_path) << endmsg;
return;
}
@ -2847,7 +2812,7 @@ This prevents the session from being loaded."));
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;
}
@ -2900,7 +2865,7 @@ ARDOUR_UI::build_session (string path, string snap_name,
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;
}
@ -2932,7 +2897,7 @@ ARDOUR_UI::show ()
}
if (about) {
about->get_window().raise ();
about->present ();
}
}
@ -2940,16 +2905,9 @@ void
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
@ -2979,58 +2937,68 @@ require some unused files to continue to exist."));
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;
};
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::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 (PBD::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 (PBD::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 (PBD::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 (PBD::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.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.signal_clicked().connect (Main::quit.slot ());
results.Hiding.connect (Main::quit.slot ());
results.add (vpacker);
results.set_position (Gtk::WIN_POS_MOUSE);
results.set_title (_("ardour: cleanup"));
results.set_modal (true);
results.run ();
}
@ -3068,15 +3036,16 @@ Unused audio files will be moved to a \"dead sounds\" location."));
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));
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;
}
@ -3320,14 +3289,12 @@ what you would like to do.\n"));
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;
}

View File

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

View File

@ -107,37 +107,37 @@ 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_entry, true, true);
isrc_entry.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_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
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_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
performer_entry.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_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
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_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
composer_entry.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_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
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_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
scms_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::scms_toggled));
preemph_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::preemph_toggled));
scms_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::scms_toggled));
preemph_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::preemph_toggled));
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_clock, 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_go_button.clicked.connect( bind ( mem_fun(*this, &LocationEditRow::go_button_pressed), LocStart));
start_clock.ValueChanged.connect (bind ( mem_fun(*this, &LocationEditRow::clock_changed), LocStart));
start_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_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));
end_hbox.pack_start (end_go_button, false, false);
@ -146,9 +146,9 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
//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_go_button.clicked.connect( bind ( mem_fun(*this, &LocationEditRow::go_button_pressed), LocEnd));
end_clock.ValueChanged.connect (bind ( mem_fun(*this, &LocationEditRow::clock_changed), LocEnd));
end_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_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));
// item_table.attach (length_clock, 3, 4, 0, 1, 0, 0, 4, 0);
length_clock.ValueChanged.connect (bind ( mem_fun(*this, &LocationEditRow::clock_changed), LocLength));
@ -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 (remove_button, 7, 8, 0, 1, 0, Gtk::FILL, 4, 0);
cd_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::cd_toggled));
hide_check_button.toggled.connect(mem_fun(*this, &LocationEditRow::hide_toggled));
cd_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::cd_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);
@ -218,7 +218,7 @@ LocationEditRow::set_location (Location *loc)
if (!location) return;
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());
@ -229,7 +229,7 @@ LocationEditRow::set_location (Location *loc)
name_label.set_size_request (80, -1);
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();
@ -239,20 +239,20 @@ LocationEditRow::set_location (Location *loc)
name_entry.set_text (location->name());
name_entry.set_size_request (100, -1);
name_entry.set_editable (true);
name_entry.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_out_event()().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
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_out_event().connect (mem_fun(*this, &LocationEditRow::entry_focus_event));
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();
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()) {
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
@ -273,10 +273,10 @@ LocationEditRow::set_location (Location *loc)
if (!location->is_mark()) {
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()) {
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);
@ -449,7 +449,7 @@ LocationEditRow::cd_toggled ()
}
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);
cd_track_details_hbox.show_all();
@ -598,7 +598,7 @@ LocationUI::LocationUI ()
set_wmclass(_("ardour_locations"), "Ardour");
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);
@ -692,7 +692,7 @@ void LocationUI::location_remove_requested (ARDOUR::Location *loc)
// must do this to prevent problems when destroying
// 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->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested));
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()) {
punch_edit_row.set_session (session);
@ -782,7 +782,7 @@ LocationUI::map_locations (Locations::LocationList& locations)
else {
erow = manage (new LocationEditRow(session, location));
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/radiobutton.h>
#include <gtkmm/frame.h>
#include <gtkmm/filechooserwidget.h>
#include <gtkmm/box.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/comboboxtext.h>
@ -18,7 +19,6 @@ namespace ARDOUR {
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/selector.h>
#include <gtkmm2ext/newsavedialog.h>
#include "ardour_dialog.h"
class NewSessionDialog : public ArdourDialog
@ -26,7 +26,7 @@ class NewSessionDialog : public ArdourDialog
public:
NewSessionDialog (ARDOUR::AudioEngine&, bool startup, std::string path);
Gtkmm2ext::NewSaveDialog file_selector;
Gtk::FileChooserWidget file_selector;
Gtk::ComboBoxText control_out_channel_combo;
Gtk::ComboBoxText master_out_channel_combo;
Gtk::CheckButton use_control_button;
@ -85,8 +85,8 @@ class NewSessionDialog : public ArdourDialog
static void _mix_template_refiller (Gtk::CList &clist, void *);
void mix_template_refiller (Gtk::CList &clist);
void mix_template_shift (Gtkmm2ext::Selector *, Gtkmm2ext::SelectionResult*);
void mix_template_control (Gtkmm2ext::Selector *, Gtkmm2ext::SelectionResult*);
void mix_template_shift (Gtkmm2ext::Selector *, Gtkmm2ext::Selector::Result*);
void mix_template_control (Gtkmm2ext::Selector *, Gtkmm2ext::Selector::Result*);
void fixup_at_realize ();
void fixup_at_show ();

View File

@ -55,14 +55,9 @@ using namespace ARDOUR;
using namespace Gtk;
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)
: ArdourDialog ("track/bus inspector"),
engine (eng),
route_select_list (internationalize(route_display_titles)),
_route(0),
track_menu(0)
{
@ -78,21 +73,29 @@ RouteParams_UI::RouteParams_UI (AudioEngine& eng)
using namespace Notebook_Helpers;
input_frame.set_shadow_type(GTK_SHADOW_NONE);
output_frame.set_shadow_type(GTK_SHADOW_NONE);
input_frame.set_shadow_type(Gtk::SHADOW_NONE);
output_frame.set_shadow_type(Gtk::SHADOW_NONE);
notebook.set_show_tabs (true);
notebook.set_show_border (true);
notebook.set_name ("RouteParamNotebook");
route_select_list.column_titles_active();
route_select_list.set_name ("RouteParamsListDisplay");
route_select_list.set_shadow_type (Gtk::SHADOW_IN);
route_select_list.set_selection_mode (GTK_SELECTION_SINGLE);
route_select_list.set_reorderable (false);
route_select_list.set_size_request (75, -1);
route_select_scroller.add (route_select_list);
route_select_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
// create the tree model
route_display_model = ListStore::create(route_display_columns);
// setup the treeview
route_display.set_model(route_display_model);
route_display.append_column(_("Tracks/Buses"), route_display_columns.text);
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_frame.set_name("RouteSelectBaseFrame");
route_select_frame.set_shadow_type (Gtk::SHADOW_IN);
@ -139,10 +142,8 @@ RouteParams_UI::RouteParams_UI (AudioEngine& eng)
set_wmclass (_("ardour_route_parameters"), "Ardour");
// events
route_select_list.select_row.connect (mem_fun(*this, &RouteParams_UI::route_selected));
route_select_list.unselect_row.connect (mem_fun(*this, &RouteParams_UI::route_unselected));
route_select_list.click_column.connect (mem_fun(*this, &RouteParams_UI::show_track_menu));
route_display.get_selection()->signal_changed().connect(mem_fun(*this, &RouteParams_UI::route_selected));
route_display.get_column(0)->signal_clicked().connect(mem_fun(*this, &RouteParams_UI::show_track_menu));
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)));
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 ()
@ -167,10 +168,10 @@ RouteParams_UI::add_route (Route* route)
return;
}
const gchar *rowdata[1];
rowdata[0] = route->name().c_str();
route_select_list.rows().push_back (rowdata);
route_select_list.rows().back().set_data (route);
TreeModel::Row row = *(route_display_model->append());
row[route_display_columns.text] = route->name();
row[route_display_columns.route] = route;
//route_select_list.rows().back().select ();
route->name_changed.connect (bind (mem_fun(*this, &RouteParams_UI::route_name_changed), route));
@ -182,15 +183,21 @@ void
RouteParams_UI::route_name_changed (void *src, Route *route)
{
ENSURE_GUI_THREAD(bind (mem_fun(*this, &RouteParams_UI::route_name_changed), src, route));
CList_Helpers::RowList::iterator i;
if ((i = route_select_list.rows().find_data (route)) == route_select_list.rows().end()) {
error << _("route display list item for renamed route not found!") << endmsg;
return;
bool found = false ;
TreeModel::Children rows = route_display_model->children();
for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) {
if((*iter)[route_display_columns.route] == route) {
(*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) {
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);
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);
post_redirect_box->set_title (post_display_titles[0]);
post_redirect_box->set_title(_("Post Redirects"));
post_redirect_box->set_title_shown (true);
pre_redir_hpane.add1 (*pre_redirect_box);
@ -324,12 +331,15 @@ RouteParams_UI::route_removed (Route *route)
session->foreach_route (this, &RouteParams_UI::add_route);
route_select_list.thaw ();
*/
CList_Helpers::RowList::iterator i;
if ((i = route_select_list.rows().find_data (route)) == route_select_list.rows().end()) {
// couldn't find route to be deleted
return;
TreeModel::Children rows = route_display_model->children();
TreeModel::Children::iterator ri;
for(TreeModel::Children::iterator iter = rows.begin(); iter != rows.end(); ++iter) {
if((*iter)[route_display_columns.route] == route) {
route_display_model->erase(iter);
break;
}
}
if (route == _route)
@ -344,9 +354,6 @@ RouteParams_UI::route_removed (Route *route)
_post_redirect = 0;
update_title();
}
route_select_list.rows().erase(i);
}
void
@ -354,8 +361,10 @@ RouteParams_UI::set_session (Session *sess)
{
ArdourDialog::set_session (sess);
route_select_list.freeze ();
route_select_list.clear ();
// GTK2FIX
// route_select_list.freeze ();
route_display_model.clear();
if (session) {
session->foreach_route (this, &RouteParams_UI::add_route);
@ -366,7 +375,7 @@ RouteParams_UI::set_session (Session *sess)
stop_updating ();
}
route_select_list.thaw ();
//route_select_list.thaw ();
_plugin_selector->set_session (session);
}
@ -375,8 +384,9 @@ RouteParams_UI::set_session (Session *sess)
void
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_pre_view();
@ -393,17 +403,19 @@ RouteParams_UI::session_gone ()
}
void
RouteParams_UI::route_selected (gint row, gint col, GdkEvent *ev)
RouteParams_UI::route_selected()
{
Route *route;
if ((route = (Route *) route_select_list.get_row_data (row)) != 0) {
Glib::RefPtr<TreeSelection> selection = route_display.get_selection();
TreeModel::iterator iter = selection->get_selected(); // only used with Gtk::SELECTION_SINGLE
if(iter) {
//If anything is selected
Route* route = (*iter)[route_display_columns.route] ;
if (_route == route) {
// do nothing
return;
}
// remove event binding from previously selected
if (_route) {
_route_conn.disconnect();
@ -413,42 +425,59 @@ RouteParams_UI::route_selected (gint row, gint col, GdkEvent *ev)
cleanup_post_view();
cleanup_io_frames();
}
// update the other panes with the correct info
_route = route;
//update_routeinfo (route);
setup_io_frames();
setup_redirect_boxes();
// bind to redirects changed event for this route
_route_conn = route->redirects_changed.connect (mem_fun(*this, &RouteParams_UI::redirects_changed));
track_input_label.set_text (_route->name());
update_title();
} else {
// no selection
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
RouteParams_UI::route_unselected (gint row, gint col, GdkEvent *ev)
{
if (_route) {
_route_conn.disconnect();
//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();
// 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();
}
}
// _route = 0;
// _pre_redirect = 0;
// _post_redirect = 0;
// track_input_label.set_text(_("NO TRACK"));
// update_title();
// }
//}
void
RouteParams_UI::redirects_changed (void *src)
@ -477,7 +506,7 @@ RouteParams_UI::redirects_changed (void *src)
void
RouteParams_UI::show_track_menu (gint arg)
RouteParams_UI::show_track_menu()
{
using namespace Menu_Helpers;

View File

@ -23,7 +23,15 @@
#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/stateful.h>
@ -69,7 +77,6 @@ class RouteParams_UI : public ArdourDialog
Gtk::VBox mixer_scroller_vpacker;
Gtk::VBox list_vpacker;
Gtk::TreeView route_select_list;
Gtk::Label route_list_button_label;
Gtk::Button route_list_button;
Gtk::ScrolledWindow route_select_scroller;
@ -134,6 +141,22 @@ class RouteParams_UI : public ArdourDialog
};
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*);
@ -141,8 +164,8 @@ class RouteParams_UI : public ArdourDialog
void route_removed (ARDOUR::Route *route);
void route_selected (gint row, gint col, GdkEvent *ev);
void route_unselected (gint row, gint col, GdkEvent *ev);
void route_selected();
//void route_unselected (gint row, gint col, GdkEvent *ev);
void setup_io_frames();
void cleanup_io_frames();
@ -168,7 +191,7 @@ class RouteParams_UI : public ArdourDialog
void update_routeinfo (ARDOUR::Route * route);
Gtk::Menu *track_menu;
void show_track_menu(gint arg);
void show_track_menu();
void update_title ();
//void unselect_all_redirects ();

View File

@ -37,8 +37,8 @@
#include <ardour/diskstream.h>
#include "i18n.h"
using namespace sigc;
/* there is a compose() here.. */
//using namespace sigc;
using namespace Gtk;
using namespace Gtkmm2ext;
using namespace ARDOUR;
@ -391,14 +391,14 @@ RouteUI::update_rec_display ()
switch (_session.record_status ()) {
case Session::Disabled:
case Session::Enabled:
if (rec_enable_button->get_state() != GTK_STATE_ACTIVE) {
rec_enable_button->set_state (GTK_STATE_ACTIVE);
if (rec_enable_button->get_state() != Gtk::STATE_ACTIVE) {
rec_enable_button->set_state (Gtk::STATE_ACTIVE);
}
break;
case Session::Recording:
if (rec_enable_button->get_state() != GTK_STATE_SELECTED) {
rec_enable_button->set_state (GTK_STATE_SELECTED);
if (rec_enable_button->get_state() != Gtk::STATE_SELECTED) {
rec_enable_button->set_state (Gtk::STATE_SELECTED);
}
break;
}
@ -422,7 +422,7 @@ RouteUI::build_solo_menu (void)
check = new CheckMenuItem(_("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));
items.push_back (CheckMenuElem(*check));
check->show_all();
@ -444,28 +444,28 @@ RouteUI::build_mute_menu(void)
check = new CheckMenuItem(_("Pre Fader"));
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));
items.push_back (CheckMenuElem(*check));
check->show_all();
check = new CheckMenuItem(_("Post Fader"));
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));
items.push_back (CheckMenuElem(*check));
check->show_all();
check = new CheckMenuItem(_("Control Outs"));
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));
items.push_back (CheckMenuElem(*check));
check->show_all();
check = new CheckMenuItem(_("Main Outs"));
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));
items.push_back (CheckMenuElem(*check));
check->show_all();
@ -565,7 +565,7 @@ bool
RouteUI::choose_color()
{
bool picked;
GdkColor color;
Gdk::Color color;
gdouble current[4];
current[0] = _color.get_red() / 65535.0;
@ -583,14 +583,14 @@ RouteUI::choose_color()
}
void
RouteUI::set_color (Gdk_Color c)
RouteUI::set_color (Gdk::Color c)
{
char buf[64];
_color = c;
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);
_route.gui_changed ("color", (void *) 0); /* EMIT_SIGNAL */
@ -634,9 +634,9 @@ RouteUI::set_color_from_route ()
if ((prop = xml_node->property ("color")) != 0) {
int r, g, b;
sscanf (prop->value().c_str(), "%d:%d:%d", &r, &g, &b);
_color.red = r;
_color.green = g;
_color.blue = b;
_color.set_red(r);
_color.set_green(g);
_color.set_blue(b);
return 0;
}
return 1;
@ -665,7 +665,7 @@ RouteUI::remove_this_route ()
Gtk::Main::run ();
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);
}
void
decorate (Gtk::Window& w, Gdk::WMDecoration d)
{
w.get_window().set_decorations (d);
}

View File

@ -55,13 +55,21 @@ public:
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
a single click.
*/
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > selection_made;
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > choice_made;
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > shift_made;
sigc::signal<void,Gtk::TreeView&, Glib::RefPtr<Gtk::TreeSelection> > control_made;
sigc::signal<void,Result*> selection_made;
sigc::signal<void,Result*> choice_made;
sigc::signal<void,Result*> shift_made;
sigc::signal<void,Result*> control_made;
sigc::signal<void> update_contents;

View File

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

View File

@ -197,8 +197,8 @@ namespace StringPrivate
}
// now for the real thing(s)
//namespace String
//{
namespace PBD
{
// 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
// composited string
@ -387,7 +387,7 @@ namespace StringPrivate
.arg(o10).arg(o11).arg(o12).arg(o13).arg(o14).arg(o15);
return c.str();
}
//}
}
#endif // STRING_COMPOSE_H