summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-10-07 22:24:00 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-10-07 22:24:00 +0000
commit93c2af8c9e3b660731e0b73a23a827aadb75c5fd (patch)
treed52cdb50c2c034bac0452e4bcbec5d2d21f0868d /gtk2_ardour
parent599b18f95063b1c44056c427cc9369d3a59ebb4e (diff)
revert last fix - its not relevant to 3.0 (yet)
git-svn-id: svn://localhost/ardour2/branches/3.0@3883 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/bundle_manager.cc2
-rw-r--r--gtk2_ardour/bundle_manager.h2
-rw-r--r--gtk2_ardour/io_selector.cc24
-rw-r--r--gtk2_ardour/io_selector.h2
-rw-r--r--gtk2_ardour/port_matrix.cc163
-rw-r--r--gtk2_ardour/port_matrix.h3
-rw-r--r--gtk2_ardour/route_ui.cc2
7 files changed, 152 insertions, 46 deletions
diff --git a/gtk2_ardour/bundle_manager.cc b/gtk2_ardour/bundle_manager.cc
index 0ba8d8eb96..63c348decc 100644
--- a/gtk2_ardour/bundle_manager.cc
+++ b/gtk2_ardour/bundle_manager.cc
@@ -43,7 +43,7 @@ BundleEditorMatrix::BundleEditorMatrix (
}
void
-BundleEditorMatrix::set_state (int r, std::string const & p, bool s)
+BundleEditorMatrix::set_state (int r, std::string const & p, bool s, uint32_t keymod)
{
if (s) {
_bundle->add_port_to_channel (r, p);
diff --git a/gtk2_ardour/bundle_manager.h b/gtk2_ardour/bundle_manager.h
index 4d4d44074f..097328b602 100644
--- a/gtk2_ardour/bundle_manager.h
+++ b/gtk2_ardour/bundle_manager.h
@@ -35,7 +35,7 @@ class BundleEditorMatrix : public PortMatrix
public:
BundleEditorMatrix (ARDOUR::Session &, boost::shared_ptr<ARDOUR::Bundle>);
- void set_state (int, std::string const &, bool);
+ void set_state (int, std::string const &, bool, uint32_t);
bool get_state (int, std::string const &) const;
uint32_t n_rows () const;
uint32_t maximum_rows () const;
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc
index d1ee8be31c..a4defec834 100644
--- a/gtk2_ardour/io_selector.cc
+++ b/gtk2_ardour/io_selector.cc
@@ -64,21 +64,21 @@ IOSelector::ports_changed (ARDOUR::IOChange change, void *src)
}
void
-IOSelector::set_state (int r, std::string const & p, bool s)
+IOSelector::set_state (int r, std::string const & p, bool s, uint32_t keymod)
{
if (s) {
if (!_offer_inputs) {
_io->connect_input (_io->input(r), p, 0);
} else {
_io->connect_output (_io->output(r), p, 0);
- }
- } else {
- if (!_offer_inputs) {
- _io->disconnect_input (_io->input(r), p, 0);
- } else {
- _io->disconnect_output (_io->output(r), p, 0);
- }
- }
+ }
+ } else {
+ if (!_offer_inputs) {
+ _io->disconnect_input (_io->input(r), p, 0);
+ } else {
+ _io->disconnect_output (_io->output(r), p, 0);
+ }
+ }
}
bool
@@ -276,8 +276,8 @@ IOSelectorWindow::IOSelectorWindow (
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), this));
_selector.scrolled_window().add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
- _selector.scrolled_window().signal_enter_notify_event().connect (mem_fun (*this, &IOSelectorWindow::enter_scroller));
- _selector.scrolled_window().signal_leave_notify_event().connect (mem_fun (*this, &IOSelectorWindow::leave_scroller));
+ _selector.scrolled_window().signal_enter_notify_event().connect (mem_fun (*this, &IOSelectorWindow::enter_scroller), false);
+ _selector.scrolled_window().signal_leave_notify_event().connect (mem_fun (*this, &IOSelectorWindow::leave_scroller), false);
}
IOSelectorWindow::~IOSelectorWindow()
@@ -296,7 +296,7 @@ IOSelectorWindow::enter_scroller (GdkEventCrossing* ignored)
bool
IOSelectorWindow::leave_scroller (GdkEventCrossing* ignored)
{
- cerr << "OUT\n";
+ cerr << "OUT, ev = " << ignored << "\n";
suggestion.set_text (_("Right-click on individual port names for per-port operations"));
return false;
}
diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h
index e2c749935f..57c6e6db86 100644
--- a/gtk2_ardour/io_selector.h
+++ b/gtk2_ardour/io_selector.h
@@ -27,7 +27,7 @@ class IOSelector : public PortMatrix {
public:
IOSelector (ARDOUR::Session&, boost::shared_ptr<ARDOUR::IO>, bool);
- void set_state (int, std::string const &, bool);
+ void set_state (int, std::string const &, bool, uint32_t);
bool get_state (int, std::string const &) const;
uint32_t n_rows () const;
uint32_t maximum_rows () const;
diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc
index 0decce8d7a..7486e5d2c5 100644
--- a/gtk2_ardour/port_matrix.cc
+++ b/gtk2_ardour/port_matrix.cc
@@ -37,6 +37,7 @@
#include "ardour/midi_track.h"
#include "ardour/data_type.h"
#include "io_selector.h"
+#include "keyboard.h"
#include "utils.h"
#include "gui_thread.h"
#include "i18n.h"
@@ -63,8 +64,10 @@ PortGroup::add (std::string const & p)
*/
PortGroupUI::PortGroupUI (PortMatrix& m, PortGroup& g)
- : _port_matrix (m), _port_group (g), _ignore_check_button_toggle (false),
- _visibility_checkbutton (g.name)
+ : _port_matrix (m)
+ , _port_group (g)
+ , _ignore_check_button_toggle (false)
+ , _visibility_checkbutton (g.name)
{
int const ports = _port_group.ports.size();
int const rows = _port_matrix.n_rows ();
@@ -81,15 +84,22 @@ PortGroupUI::PortGroupUI (PortMatrix& m, PortGroup& g)
_port_checkbuttons[i].resize (ports);
}
+
for (int i = 0; i < rows; ++i) {
for (uint32_t j = 0; j < _port_group.ports.size(); ++j) {
CheckButton* b = new CheckButton;
b->signal_toggled().connect (
- sigc::bind (sigc::mem_fun (*this, &PortGroupUI::port_checkbutton_toggled), b, i, j)
- );
+ sigc::bind (sigc::mem_fun (*this, &PortGroupUI::port_checkbutton_toggled), b, i, j));
+ b->signal_button_release_event().connect (
+ sigc::bind (sigc::mem_fun (*this, &PortGroupUI::port_checkbutton_release), b, i, j), false);
+
_port_checkbuttons[i][j] = b;
+
+ cerr << this << " bind to " << &_port_checkbuttons << " via " << b
+ << endl;
+
_table.attach (*b, j, j + 1, i, i + 1);
}
}
@@ -163,8 +173,63 @@ void
PortGroupUI::port_checkbutton_toggled (CheckButton* b, int r, int c)
{
if (_ignore_check_button_toggle == false) {
- _port_matrix.set_state (r, _port_group.prefix + _port_group.ports[c], b->get_active());
+ _port_matrix.set_state (r, _port_group.prefix + _port_group.ports[c], b->get_active(), 0);
+ }
+}
+
+bool
+PortGroupUI::port_checkbutton_release (GdkEventButton* ev, CheckButton* b, int r, int c)
+{
+ cerr << this << " RELEASE on " << b << " state = " << ev->state << endl;
+
+ if (ev->state == 0) {
+ /* let usual toggle handler take care of it */
+ return false;
+ }
+
+ /* The fun starts here
+ */
+
+ int const ports = _port_group.ports.size();
+ int const rows = _port_matrix.n_rows ();
+
+ if (rows == 0 || ports == 0) {
+ return true;
+ }
+
+ /* For each port in the group, change the state of
+ the connection for the corresponding "connector" port.
+ */
+
+ for (uint32_t j = c; j < ports; ++j) {
+
+ /* we've got a port to connect, now lets find the thing to
+ connect it too ... (search "down" the rows)
+ */
+
+ cerr << "we're going to connect port " << j << " of " << ports << endl;
+
+ for (int i = r; i < rows; ++i) {
+
+ cerr << this << " going to connect to row " << i << " of " << rows << endl;
+ cerr << "access [" << i << "][" << j << "]\n";
+ cerr << " @ " << &_port_checkbuttons << endl;
+
+ _port_checkbuttons[i][j]->set_active (!_port_checkbuttons[i][j]->get_active());
+
+ /* next time, get at least as far as this port before looking
+ for more.
+ */
+
+ r = i + 1;
+
+ /* changed connection state, stop looking for more */
+
+ break;
+ }
}
+
+ return true;
}
/** Set up visibility of the port group according to PortGroup::visible */
@@ -187,7 +252,7 @@ RotatedLabelSet::RotatedLabelSet (PortGroupList& g)
: Glib::ObjectBase ("RotatedLabelSet"), Widget (), _port_group_list (g), _base_width (128)
{
set_flags (NO_WINDOW);
- set_angle (30);
+ set_angle (atoi (getenv ("AD_ANGLE")));
}
RotatedLabelSet::~RotatedLabelSet ()
@@ -236,6 +301,8 @@ RotatedLabelSet::on_size_request (Requisition* requisition)
std::pair<int, int> const d = setup_layout (_port_group_list.get_port_by_index (n - 1, false));
requisition->width += d.first;
}
+
+ cerr << "Labels will be " << requisition->width << " x " << requisition->height << endl;
}
void
@@ -244,9 +311,7 @@ RotatedLabelSet::on_size_allocate (Allocation& allocation)
set_allocation (allocation);
if (_gdk_window) {
- _gdk_window->move_resize (
- allocation.get_x(), allocation.get_y(), allocation.get_width(), allocation.get_height()
- );
+ _gdk_window->move_resize (allocation.get_x(), allocation.get_y(), allocation.get_width(), allocation.get_height());
}
}
@@ -319,10 +384,17 @@ RotatedLabelSet::setup_layout (std::string const & s)
_pango_layout->get_pixel_size (w, h);
/* Rotate the width and height as appropriate. I thought Pango might be able
- to do this for us, but I can't find out how... */
+ to do this for us, but I can't find out how...
+ */
+
std::pair<int, int> d;
- d.first = int (w * cos (_angle_radians) - h * sin (_angle_radians));
- d.second = int (w * sin (_angle_radians) + h * cos (_angle_radians));
+
+ // cerr << "\"" << s << "\" was " << w << " x " << h << endl;
+
+ d.first = int (fabs (w * cos (_angle_radians) + h * sin (_angle_radians)));
+ d.second = int (fabs (w * sin (_angle_radians) + h * cos (_angle_radians)));
+
+ // cerr << "\trotated by " << _angle_degrees << " = " << d.first << " x " << d.second << endl;
return d;
}
@@ -343,7 +415,9 @@ RotatedLabelSet::on_expose_event (GdkEventExpose* event)
if ((*i)->visible) {
for (uint32_t j = 0; j < (*i)->ports.size(); ++j) {
std::pair<int, int> const d = setup_layout ((*i)->ports[j]);
- get_window()->draw_layout (_gc, int ((n + 0.25) * spacing), height - d.second, _pango_layout, _fg_colour, _bg_colour);
+ int x = atoi (getenv ("AD_X_SHIFT"));
+ int y = atoi (getenv ("AD_Y_SHIFT"));
+ get_window()->draw_layout (_gc, int ((n + 0.25) * spacing) + x, height - d.second + y, _pango_layout, _fg_colour, _bg_colour);
++n;
}
}
@@ -380,21 +454,36 @@ PortMatrix::PortMatrix (ARDOUR::Session& session, ARDOUR::DataType type, bool of
_visibility_checkbutton_box.pack_start (*(manage (new Label (_("Connections displayed: ")))), false, false, 10);
pack_start (_visibility_checkbutton_box, false, false);
- _side_vbox.pack_start (*manage (new Label ("")));
_scrolled_window.set_policy (POLICY_ALWAYS, POLICY_AUTOMATIC);
_scrolled_window.set_shadow_type (SHADOW_NONE);
+
VBox* b = manage (new VBox);
- b->pack_start (_column_labels, false, false);
- b->pack_start (_port_group_hbox, false, false);
- Alignment* a = manage (new Alignment (0, 1, 0, 0));
+
+ if (offer_inputs) {
+ b->pack_start (_port_group_hbox, false, false);
+ b->pack_start (_column_labels, false, false);
+ } else {
+ b->pack_start (_column_labels, false, false);
+ b->pack_start (_port_group_hbox, false, false);
+ }
+
+ Alignment* a;
+
+ if (offer_inputs) {
+ a = manage (new Alignment (1, 0, 0, 0));
+ } else {
+ a = manage (new Alignment (0, 1, 0, 0));
+ }
+
a->add (*b);
+
_scrolled_window.add (*a);
if (offer_inputs) {
- _overall_hbox.pack_start (_side_vbox, false, false, 10);
+ _overall_hbox.pack_start (_side_vbox, false, false, 6);
_overall_hbox.pack_start (_scrolled_window, true, true);
} else {
- _overall_hbox.pack_start (_scrolled_window, true, true, 10);
+ _overall_hbox.pack_start (_scrolled_window, true, true, 6);
_overall_hbox.pack_start (_side_vbox, false, false);
}
@@ -419,15 +508,18 @@ PortMatrix::clear ()
if (_row_labels_vbox) {
_side_vbox.remove (*_row_labels_vbox);
+ delete _row_labels_vbox;
+ _row_labels_vbox = 0;
}
- delete _row_labels_vbox;
- _row_labels_vbox = 0;
+ /* remove lurking, invisible label and padding */
+
+ _side_vbox.children().clear ();
+
if (_side_vbox_pad) {
- _side_vbox.remove (*_side_vbox_pad);
+ delete _side_vbox_pad;
+ _side_vbox_pad = 0;
}
- delete _side_vbox_pad;
- _side_vbox_pad = 0;
for (std::vector<PortGroupUI*>::iterator i = _port_group_ui.begin(); i != _port_group_ui.end(); ++i) {
_port_group_hbox.remove ((*i)->get_table());
@@ -481,8 +573,12 @@ PortMatrix::setup_dimensions ()
}
if (_side_vbox_pad) {
- _side_vbox_pad->set_size_request (-1, scrollbar_height + unit_size.second / 4);
- }
+ if (_offer_inputs) {
+ _side_vbox_pad->set_size_request (-1, unit_size.second / 4);
+ } else {
+ _side_vbox_pad->set_size_request (-1, scrollbar_height + unit_size.second / 4);
+ }
+ }
}
@@ -520,9 +616,17 @@ PortMatrix::setup ()
_row_labels_vbox->pack_start (*b, false, false);
}
- _side_vbox.pack_start (*_row_labels_vbox, false, false);
- _side_vbox_pad = new Label ("");
- _side_vbox.pack_start (*_side_vbox_pad, false, false);
+ _side_vbox_pad = new Label (""); /* unmanaged, explicitly deleted */
+
+ if (_offer_inputs) {
+ _side_vbox.pack_start (*_side_vbox_pad, false, false);
+ _side_vbox.pack_start (*_row_labels_vbox, false, false);
+ _side_vbox.pack_start (*manage (new Label ("")));
+ } else {
+ _side_vbox.pack_start (*manage (new Label ("")));
+ _side_vbox.pack_start (*_row_labels_vbox, false, false);
+ _side_vbox.pack_start (*_side_vbox_pad, false, false);
+ }
/* Checkbutton tables and visibility checkbuttons */
for (PortGroupList::iterator i = _port_group_list.begin(); i != _port_group_list.end(); ++i) {
@@ -535,6 +639,7 @@ PortMatrix::setup ()
_visibility_checkbutton_box.pack_start (t->get_visibility_checkbutton(), false, false);
CheckButton* chk = dynamic_cast<CheckButton*>(&t->get_visibility_checkbutton());
+
if (chk) {
chk->signal_toggled().connect (sigc::mem_fun (*this, &PortMatrix::reset_visibility));
}
diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h
index 7f4eed23fb..89208f357a 100644
--- a/gtk2_ardour/port_matrix.h
+++ b/gtk2_ardour/port_matrix.h
@@ -70,6 +70,7 @@ class PortGroupUI
private:
void port_checkbutton_toggled (Gtk::CheckButton*, int, int);
+ bool port_checkbutton_release (GdkEventButton* ev, Gtk::CheckButton* b, int r, int c);
void visibility_checkbutton_toggled ();
PortMatrix& _port_matrix; ///< the PortMatrix that we are working for
@@ -164,7 +165,7 @@ class PortMatrix : public Gtk::VBox {
void set_offer_inputs (bool);
bool offering_input() const { return _offer_inputs; }
- virtual void set_state (int, std::string const &, bool) = 0;
+ virtual void set_state (int, std::string const &, bool, uint32_t) = 0;
virtual bool get_state (int, std::string const &) const = 0;
virtual uint32_t n_rows () const = 0;
virtual uint32_t maximum_rows () const = 0;
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index d948d47550..44032a4ea5 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -503,7 +503,7 @@ RouteUI::update_rec_display ()
void
RouteUI::build_remote_control_menu ()
{
- remote_control_menu = new Menu;
+ remote_control_menu = manage (new Menu);
refresh_remote_control_menu ();
}