2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2000 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/stop_signal.h>
|
2005-10-26 14:12:00 -04:00
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/route_group.h>
|
|
|
|
|
|
|
|
#include "editor.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "marker.h"
|
|
|
|
#include "time_axis_view.h"
|
|
|
|
#include "prompter.h"
|
2005-10-26 14:12:00 -04:00
|
|
|
#include "gui_thread.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <ardour/route.h>
|
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace sigc;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace Gtk;
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::edit_group_list_column_click (gint col)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (edit_group_list_menu == 0) {
|
|
|
|
build_edit_group_list_menu ();
|
|
|
|
}
|
|
|
|
|
|
|
|
edit_group_list_menu->popup (0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::build_edit_group_list_menu ()
|
|
|
|
|
|
|
|
{
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
|
|
|
|
edit_group_list_menu = new Menu;
|
|
|
|
edit_group_list_menu->set_name ("ArdourContextMenu");
|
|
|
|
MenuList& items = edit_group_list_menu->items();
|
|
|
|
|
2005-09-25 17:19:23 -04:00
|
|
|
items.push_back (MenuElem (_("Show All"), mem_fun(*this, &Editor::select_all_edit_groups)));
|
|
|
|
items.push_back (MenuElem (_("Hide All"), mem_fun(*this, &Editor::unselect_all_edit_groups)));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::unselect_all_edit_groups ()
|
|
|
|
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::select_all_edit_groups ()
|
|
|
|
|
|
|
|
{
|
2005-10-26 14:12:00 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* XXX potential race with remove_track(), but the select operation
|
|
|
|
cannot be done with the track_lock held.
|
|
|
|
*/
|
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
Gtk::TreeModel::Children children = group_model->children();
|
|
|
|
for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
|
|
|
|
edit_group_list.get_selection()->select (iter);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::new_edit_group ()
|
|
|
|
|
|
|
|
{
|
|
|
|
if (session == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArdourPrompter prompter;
|
|
|
|
string result;
|
|
|
|
|
|
|
|
prompter.set_prompt (_("Name for new edit group"));
|
|
|
|
prompter.show_all ();
|
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
switch (prompter.run ()) {
|
|
|
|
case GTK_RESPONSE_ACCEPT:
|
|
|
|
prompter.get_result (result);
|
|
|
|
if (result.length()) {
|
|
|
|
session->add_edit_group (result);
|
|
|
|
}
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::edit_group_list_button_clicked ()
|
|
|
|
{
|
|
|
|
new_edit_group ();
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
Editor::edit_group_list_button_press_event (GdkEventButton* ev)
|
|
|
|
{
|
2005-10-26 14:12:00 -04:00
|
|
|
RouteGroup* group;
|
|
|
|
TreeIter iter;
|
|
|
|
TreeModel::Path path;
|
|
|
|
TreeViewColumn* column;
|
|
|
|
int cellx;
|
|
|
|
int celly;
|
|
|
|
|
|
|
|
if (!edit_group_list.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
|
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
|
|
|
|
|
|
|
case 1:
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (Keyboard::is_edit_event (ev)) {
|
|
|
|
// RouteGroup* group = (RouteGroup *) edit_group_list.row(row).get_data ();
|
|
|
|
// edit_route_group (group);
|
|
|
|
|
|
|
|
return stop_signal (edit_group_list, "button_press_event");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
/* allow regular select to occur */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
if ((iter = group_model->get_iter (path))) {
|
|
|
|
/* path points to a valid node */
|
|
|
|
|
|
|
|
if ((group = (*iter)[group_columns.routegroup]) != 0) {
|
|
|
|
group->set_active (!group->is_active (), this);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
return stop_signal (edit_group_list, "button_press_event");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-10-26 14:12:00 -04:00
|
|
|
Editor::edit_group_selection_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::iterator i;
|
|
|
|
TreeModel::Children rows = group_model->children();
|
|
|
|
Glib::RefPtr<TreeSelection> selection = edit_group_list.get_selection();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
for (i = rows.begin(); i != rows.end(); ++i) {
|
|
|
|
RouteGroup* group;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
group = (*i)[group_columns.routegroup];
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
if (selection->is_selected (i)) {
|
|
|
|
for (TrackViewList::iterator j = track_views.begin(); j != track_views.end(); ++j) {
|
|
|
|
if ((*j)->edit_group() == group) {
|
|
|
|
select_strip_in_display (*j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (TrackViewList::iterator j = track_views.begin(); j != track_views.end(); ++j) {
|
|
|
|
if ((*j)->edit_group() == group) {
|
2005-11-12 17:07:07 -05:00
|
|
|
unselect_strip_in_display (**j);
|
2005-10-26 14:12:00 -04:00
|
|
|
}
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::add_edit_group (RouteGroup* group)
|
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::add_edit_group), group));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
TreeModel::Row row = *(group_model->append());
|
|
|
|
row[group_columns.is_active] = group->is_active();
|
|
|
|
row[group_columns.text] = group->name();
|
|
|
|
row[group_columns.routegroup] = group;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 17:19:23 -04:00
|
|
|
group->FlagsChanged.connect (bind (mem_fun(*this, &Editor::group_flags_changed), group));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Editor::group_flags_changed (void* src, RouteGroup* group)
|
|
|
|
{
|
2005-10-26 14:12:00 -04:00
|
|
|
/* GTK2FIX not needed in gtk2?
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (src != this) {
|
|
|
|
// select row
|
|
|
|
}
|
|
|
|
|
|
|
|
CList_Helpers::RowIterator ri = edit_group_list.rows().find_data (group);
|
|
|
|
|
|
|
|
if (group->is_active()) {
|
|
|
|
edit_group_list.cell (ri->get_row_num(),0).set_pixmap (check_pixmap, check_mask);
|
|
|
|
} else {
|
|
|
|
edit_group_list.cell (ri->get_row_num(),0).set_pixmap (empty_pixmap, empty_mask);
|
|
|
|
}
|
2005-10-26 14:12:00 -04:00
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-10-26 14:12:00 -04:00
|
|
|
|