modified patch from lincoln to show/control rec-enable status in track/bus list
git-svn-id: svn://localhost/ardour2/branches/3.0@5216 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1fed50f817
commit
8b63f9cac7
|
@ -48,6 +48,7 @@
|
|||
#include <gtkmm2ext/utils.h>
|
||||
#include <gtkmm2ext/window_title.h>
|
||||
#include <gtkmm2ext/choice.h>
|
||||
#include <gtkmm2ext/cell_renderer_pixbuf_toggle.h>
|
||||
|
||||
#include "ardour/audio_diskstream.h"
|
||||
#include "ardour/audio_track.h"
|
||||
|
@ -523,20 +524,38 @@ Editor::Editor ()
|
|||
bottom_hbox.set_border_width (2);
|
||||
bottom_hbox.set_spacing (3);
|
||||
|
||||
|
||||
CellRendererPixbufToggle* rec_col_renderer = Gtk::manage( new CellRendererPixbufToggle() );
|
||||
|
||||
rec_col_renderer->set_active_pixbuf(::get_icon("record_normal_red"));
|
||||
rec_col_renderer->set_inactive_pixbuf(::get_icon("record_disabled_grey"));
|
||||
|
||||
rec_col_renderer->signal_toggled().connect(mem_fun(*this, &Editor::on_tv_rec_enable_toggled));
|
||||
|
||||
Gtk::TreeViewColumn* rec_state_column = Gtk::manage(new Gtk::TreeViewColumn("Rec", *rec_col_renderer));
|
||||
rec_state_column->add_attribute(rec_col_renderer->property_active(), route_display_columns.rec_enabled);
|
||||
rec_state_column->add_attribute(rec_col_renderer->property_visible(), route_display_columns.is_track);
|
||||
|
||||
route_display_model = ListStore::create(route_display_columns);
|
||||
route_list_display.set_model (route_display_model);
|
||||
|
||||
route_list_display.append_column (*rec_state_column);
|
||||
route_list_display.append_column (_("Show"), route_display_columns.visible);
|
||||
route_list_display.append_column (_("Name"), route_display_columns.text);
|
||||
|
||||
route_list_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
|
||||
route_list_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
|
||||
route_list_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2));
|
||||
|
||||
route_list_display.set_headers_visible (true);
|
||||
route_list_display.set_name ("TrackListDisplay");
|
||||
route_list_display.get_selection()->set_mode (SELECTION_SINGLE);
|
||||
route_list_display.get_selection()->set_mode (SELECTION_NONE);
|
||||
route_list_display.set_reorderable (true);
|
||||
route_list_display.set_size_request (100,-1);
|
||||
route_list_display.add_object_drag (route_display_columns.route.index(), "routes");
|
||||
|
||||
CellRendererToggle* route_list_visible_cell = dynamic_cast<CellRendererToggle*>(route_list_display.get_column_cell_renderer (0));
|
||||
CellRendererToggle* route_list_visible_cell = dynamic_cast<CellRendererToggle*>(route_list_display.get_column_cell_renderer (1));
|
||||
|
||||
route_list_visible_cell->property_activatable() = true;
|
||||
route_list_visible_cell->property_radio() = false;
|
||||
|
||||
|
@ -871,6 +890,21 @@ Editor::~Editor()
|
|||
delete _drag;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::on_tv_rec_enable_toggled(const Glib::ustring& path_string){
|
||||
|
||||
// Get the model row that has been toggled.
|
||||
Gtk::TreeModel::Row row = *route_display_model->get_iter(Gtk::TreeModel::Path(path_string));
|
||||
|
||||
TimeAxisView *tv = row[route_display_columns.tv];
|
||||
AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
|
||||
|
||||
if(atv != 0 && atv->is_audio_track()){
|
||||
atv->get_diskstream()->set_record_enabled(!atv->get_diskstream()->record_enabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Editor::add_toplevel_controls (Container& cont)
|
||||
{
|
||||
|
|
|
@ -399,6 +399,8 @@ class Editor : public PublicEditor
|
|||
void goto_visual_state (uint32_t);
|
||||
void save_visual_state (uint32_t);
|
||||
|
||||
void update_rec_display ();
|
||||
|
||||
protected:
|
||||
void map_transport_state ();
|
||||
void map_position_change (nframes64_t);
|
||||
|
@ -1761,22 +1763,30 @@ public:
|
|||
void reposition_zoom_rect (nframes64_t start, nframes64_t end);
|
||||
|
||||
/* diskstream/route display management */
|
||||
Glib::RefPtr<Gdk::Pixbuf> rec_enabled_icon;
|
||||
Glib::RefPtr<Gdk::Pixbuf> rec_disabled_icon;
|
||||
|
||||
struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
RouteDisplayModelColumns() {
|
||||
add (text);
|
||||
add (visible);
|
||||
add (rec_enabled);
|
||||
add (temporary_visible);
|
||||
add (is_track);
|
||||
add (tv);
|
||||
add (route);
|
||||
}
|
||||
Gtk::TreeModelColumn<Glib::ustring> text;
|
||||
Gtk::TreeModelColumn<bool> visible;
|
||||
Gtk::TreeModelColumn<bool> rec_enabled;
|
||||
Gtk::TreeModelColumn<bool> temporary_visible;
|
||||
Gtk::TreeModelColumn<bool> is_track;
|
||||
Gtk::TreeModelColumn<TimeAxisView*> tv;
|
||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
|
||||
};
|
||||
|
||||
void on_tv_rec_enable_toggled(const Glib::ustring& path_string);
|
||||
|
||||
RouteDisplayModelColumns route_display_columns;
|
||||
Glib::RefPtr<Gtk::ListStore> route_display_model;
|
||||
Glib::RefPtr<Gtk::TreeSelection> route_display_selection;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "mixer_strip.h"
|
||||
#include "gui_thread.h"
|
||||
#include "actions.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "pbd/unknown_type.h"
|
||||
|
||||
|
@ -114,6 +115,7 @@ Editor::handle_new_route (RouteList& routes)
|
|||
row[route_display_columns.visible] = tv->marked_for_display();
|
||||
row[route_display_columns.tv] = tv;
|
||||
row[route_display_columns.route] = route;
|
||||
row[route_display_columns.is_track] = (boost::dynamic_pointer_cast<Track>(route) != 0);
|
||||
|
||||
track_views.push_back (tv);
|
||||
|
||||
|
@ -381,9 +383,8 @@ Editor::redisplay_route_list ()
|
|||
tv->set_marked_for_display (false);
|
||||
tv->hide ();
|
||||
}
|
||||
|
||||
n++;
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
/* whenever we go idle, update the track view list to reflect the new order.
|
||||
|
@ -395,6 +396,7 @@ Editor::redisplay_route_list ()
|
|||
|
||||
full_canvas_height = position + canvas_timebars_vsize;
|
||||
vertical_adjustment.set_upper (full_canvas_height);
|
||||
|
||||
if ((vertical_adjustment.get_value() + _canvas_height) > vertical_adjustment.get_upper()) {
|
||||
/*
|
||||
We're increasing the size of the canvas while the bottom is visible.
|
||||
|
@ -595,7 +597,11 @@ Editor::route_list_display_button_press (GdkEventButton* ev)
|
|||
}
|
||||
|
||||
switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
|
||||
|
||||
case 0:
|
||||
/* allow normal processing to occur */
|
||||
return false;
|
||||
case 1:
|
||||
if ((iter = route_display_model->get_iter (path))) {
|
||||
TimeAxisView* tv = (*iter)[route_display_columns.tv];
|
||||
if (tv) {
|
||||
|
@ -605,7 +611,7 @@ Editor::route_list_display_button_press (GdkEventButton* ev)
|
|||
}
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
/* allow normal processing to occur */
|
||||
return false;
|
||||
|
||||
|
@ -688,6 +694,7 @@ Editor::route_list_delete (const Gtk::TreeModel::Path& path)
|
|||
ignore_route_list_reorder = false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Editor::route_list_display_drag_data_received (const RefPtr<Gdk::DragContext>& context,
|
||||
int x, int y,
|
||||
|
@ -836,3 +843,23 @@ Editor::move_selected_tracks (bool up)
|
|||
|
||||
session->sync_order_keys (_order_key);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::update_rec_display ()
|
||||
{
|
||||
TreeModel::Children rows = route_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<Route> route = (*i)[route_display_columns.route];
|
||||
|
||||
if (boost::dynamic_pointer_cast<Track>(route)) {
|
||||
|
||||
if (route->record_enabled()){
|
||||
(*i)[route_display_columns.rec_enabled] = true;
|
||||
} else {
|
||||
(*i)[route_display_columns.rec_enabled] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 449 B |
|
@ -322,6 +322,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
|
|||
virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
|
||||
#endif
|
||||
|
||||
virtual void update_rec_display () = 0;
|
||||
|
||||
static const int window_border_width;
|
||||
static const int container_border_width;
|
||||
static const int vertical_spacing;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "pbd/controllable.h"
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "editor.h"
|
||||
#include "route_ui.h"
|
||||
#include "keyboard.h"
|
||||
#include "utils.h"
|
||||
|
@ -201,6 +202,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
|
|||
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track>(_route);
|
||||
|
||||
connections.push_back (t->diskstream()->RecordEnableChanged.connect (mem_fun (*this, &RouteUI::route_rec_enable_changed)));
|
||||
connections.push_back (t->diskstream()->RecordEnableChanged.connect (mem_fun (PublicEditor::instance(), &PublicEditor::update_rec_display)));
|
||||
connections.push_back (_session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed)));
|
||||
|
||||
rec_enable_button->show();
|
||||
|
@ -501,7 +503,6 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
|
|||
set_mix_group_rec_enable (_route, !_route->record_enabled());
|
||||
|
||||
} else {
|
||||
|
||||
reversibly_apply_track_boolean ("rec-enable change", &Track::set_record_enable, !track()->record_enabled(), this);
|
||||
check_rec_enable_sensitivity ();
|
||||
}
|
||||
|
@ -715,6 +716,9 @@ RouteUI::update_rec_display ()
|
|||
rec_enable_button->set_active (model);
|
||||
ignore_toggle = false;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
/* now make sure its color state is correct */
|
||||
|
||||
|
|
|
@ -2316,8 +2316,6 @@ Route::put_control_outs_at (Placement p)
|
|||
|
||||
_processors.insert(loc, _control_outs);
|
||||
|
||||
cerr << _name << " moved control outs to " << enum_2_string (p) << endl;
|
||||
|
||||
processors_changed (); /* EMIT SIGNAL */
|
||||
_session.set_dirty ();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
Copyright (C) 2009 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: cell_renderer_toggle_pixbuf.cc $
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include <gtkmm2ext/cell_renderer_pixbuf_toggle.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Gtk;
|
||||
using namespace Gdk;
|
||||
using namespace Glib;
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
|
||||
CellRendererPixbufToggle::CellRendererPixbufToggle() :
|
||||
Glib::ObjectBase( typeid(CellRendererPixbufToggle) ),
|
||||
Gtk::CellRenderer(),
|
||||
property_pixbuf_(*this, "pixbuf"),
|
||||
property_active_(*this, "active", false)
|
||||
{
|
||||
property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
|
||||
property_xpad() = 2;
|
||||
property_ypad() = 2;
|
||||
property_sensitive() = false;
|
||||
}
|
||||
|
||||
Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> >
|
||||
CellRendererPixbufToggle::property_pixbuf()
|
||||
{
|
||||
return property_pixbuf_.get_proxy();
|
||||
}
|
||||
|
||||
Glib::PropertyProxy<bool>
|
||||
CellRendererPixbufToggle::property_active()
|
||||
{
|
||||
return property_active_.get_proxy();
|
||||
}
|
||||
|
||||
// Overridden methods of the parent CellRenderer
|
||||
Glib::PropertyProxy_Base
|
||||
CellRendererPixbufToggle::_property_renderable()
|
||||
{
|
||||
return property_pixbuf();
|
||||
}
|
||||
|
||||
bool
|
||||
CellRendererPixbufToggle::activate_vfunc(GdkEvent*, Gtk::Widget&, const Glib::ustring& path, const Gdk::Rectangle&, const Gdk::Rectangle&, Gtk::CellRendererState)
|
||||
{
|
||||
signal_toggled_(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
CellRendererPixbufToggle::render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, Gtk::CellRendererState flags)
|
||||
{
|
||||
int offset_width = 0;
|
||||
int offset_height = 0;
|
||||
|
||||
if(property_active() == true){
|
||||
|
||||
offset_width = cell_area.get_x() + (int)(cell_area.get_width() - inactive_pixbuf->get_width())/2;
|
||||
offset_height = cell_area.get_y() + (int)(cell_area.get_height() - inactive_pixbuf->get_height())/2;
|
||||
|
||||
window->draw_pixbuf (RefPtr<GC>(), active_pixbuf, 0, 0, offset_width, offset_height, -1, -1, Gdk::RGB_DITHER_NORMAL, 0, 0);
|
||||
}
|
||||
else {
|
||||
offset_width = cell_area.get_x() + (int)(cell_area.get_width() - inactive_pixbuf->get_width())/2;
|
||||
offset_height = cell_area.get_y() + (int)(cell_area.get_height() - inactive_pixbuf->get_height())/2;
|
||||
|
||||
window->draw_pixbuf (RefPtr<GC>(), inactive_pixbuf, 0, 0, offset_width, offset_height, -1, -1, Gdk::RGB_DITHER_NORMAL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CellRendererPixbufToggle::get_size_vfunc (Gtk::Widget& widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) const
|
||||
{
|
||||
//cerr << "cell_renderer_pixbuf_toggle get_size" << endl;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
CellRendererPixbufToggle::set_active_pixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf){
|
||||
active_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
void
|
||||
CellRendererPixbufToggle::set_inactive_pixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf){
|
||||
inactive_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
CellRendererPixbufToggle::SignalToggled&
|
||||
CellRendererPixbufToggle::signal_toggled()
|
||||
{
|
||||
return signal_toggled_;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
Copyright (C) 2000-2009 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.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __gtkmm2ext_cell_renderer_pixbuf_toggle_h__
|
||||
#define __gtkmm2ext_cell_renderer_pixbuf_toggle_h__
|
||||
|
||||
#include <gtkmm/drawingarea.h>
|
||||
#include <gtkmm/adjustment.h>
|
||||
#include <gtkmm/widget.h>
|
||||
#include <gdkmm.h>
|
||||
|
||||
using namespace Gtk;
|
||||
|
||||
namespace Gtkmm2ext {
|
||||
|
||||
class CellRendererPixbufToggle : public Gtk::CellRenderer
|
||||
{
|
||||
public:
|
||||
|
||||
CellRendererPixbufToggle();
|
||||
virtual ~CellRendererPixbufToggle(){};
|
||||
|
||||
virtual void render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, Gtk::CellRendererState flags);
|
||||
|
||||
virtual void get_size_vfunc (Gtk::Widget& widget, const Gdk::Rectangle* cell_area, int* x_offset, int* y_offset, int* width, int* height) const;
|
||||
|
||||
virtual bool activate_vfunc(GdkEvent*, Gtk::Widget&, const Glib::ustring& path, const Gdk::Rectangle&, const Gdk::Rectangle&, Gtk::CellRendererState);
|
||||
|
||||
Glib::PropertyProxy_Base _property_renderable();
|
||||
|
||||
Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf();
|
||||
Glib::PropertyProxy<bool> property_active();
|
||||
|
||||
void set_active_pixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf);
|
||||
void set_inactive_pixbuf(Glib::RefPtr<Gdk::Pixbuf> pixbuf);
|
||||
|
||||
typedef sigc::signal<void, const Glib::ustring&> SignalToggled;
|
||||
|
||||
SignalToggled& signal_toggled();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf_;
|
||||
Glib::Property<bool> property_active_;
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> active_pixbuf;
|
||||
Glib::RefPtr<Gdk::Pixbuf> inactive_pixbuf;
|
||||
|
||||
//void on_cell_toggled(const Glib::ustring& path_string);
|
||||
|
||||
SignalToggled signal_toggled_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif /* __gtkmm2ext_cell_renderer_pixbuf_toggle_h__ */
|
|
@ -40,6 +40,7 @@ def build(bld):
|
|||
auto_spin.cc
|
||||
barcontroller.cc
|
||||
binding_proxy.cc
|
||||
cell_renderer_pixbuf_toggle.cc
|
||||
choice.cc
|
||||
click_box.cc
|
||||
dndtreeview.cc
|
||||
|
|
Loading…
Reference in New Issue