Tidy up a bit in the case where the port matrix has nothing to display.
git-svn-id: svn://localhost/ardour2/branches/3.0@6089 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
ccf58b8de2
commit
2e02e157c3
@ -565,6 +565,17 @@ PortGroupList::io_from_bundle (boost::shared_ptr<ARDOUR::Bundle> b) const
|
|||||||
return boost::shared_ptr<IO> ();
|
return boost::shared_ptr<IO> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PortGroupList::empty () const
|
||||||
|
{
|
||||||
|
List::const_iterator i = _groups.begin ();
|
||||||
|
while (i != _groups.end() && (*i)->total_channels() == 0) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (i == _groups.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RouteBundle::RouteBundle (boost::shared_ptr<Bundle> r)
|
RouteBundle::RouteBundle (boost::shared_ptr<Bundle> r)
|
||||||
: _route (r)
|
: _route (r)
|
||||||
|
@ -122,13 +122,15 @@ class PortGroupList : public sigc::trackable
|
|||||||
void resume_signals ();
|
void resume_signals ();
|
||||||
|
|
||||||
List::const_iterator begin () const {
|
List::const_iterator begin () const {
|
||||||
return _groups.begin();
|
return _groups.begin ();
|
||||||
}
|
}
|
||||||
|
|
||||||
List::const_iterator end () const {
|
List::const_iterator end () const {
|
||||||
return _groups.end();
|
return _groups.end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool empty () const;
|
||||||
|
|
||||||
sigc::signal<void> Changed;
|
sigc::signal<void> Changed;
|
||||||
sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
|
sigc::signal<void, ARDOUR::Bundle::Change> BundleChanged;
|
||||||
|
|
||||||
|
@ -55,6 +55,31 @@ PortMatrixBody::~PortMatrixBody ()
|
|||||||
bool
|
bool
|
||||||
PortMatrixBody::on_expose_event (GdkEventExpose* event)
|
PortMatrixBody::on_expose_event (GdkEventExpose* event)
|
||||||
{
|
{
|
||||||
|
if (_matrix->columns()->empty() || _matrix->rows()->empty()) {
|
||||||
|
|
||||||
|
/* nothing to connect */
|
||||||
|
|
||||||
|
cairo_t* cr = gdk_cairo_create (get_window()->gobj());
|
||||||
|
|
||||||
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||||
|
cairo_rectangle (cr, 0, 0, _alloc_width, _alloc_height);
|
||||||
|
cairo_fill (cr);
|
||||||
|
|
||||||
|
stringstream t;
|
||||||
|
t << _("There are no ") << (_matrix->type() == ARDOUR::DataType::AUDIO ? _("audio") : _("MIDI")) << _(" ports to connect.");
|
||||||
|
|
||||||
|
cairo_text_extents_t ext;
|
||||||
|
cairo_text_extents (cr, t.str().c_str(), &ext);
|
||||||
|
|
||||||
|
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||||
|
cairo_move_to (cr, (_alloc_width - ext.width) / 2, (_alloc_height + ext.height) / 2);
|
||||||
|
cairo_show_text (cr, t.str().c_str ());
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Gdk::Rectangle const exposure (
|
Gdk::Rectangle const exposure (
|
||||||
event->area.x, event->area.y, event->area.width, event->area.height
|
event->area.x, event->area.y, event->area.width, event->area.height
|
||||||
);
|
);
|
||||||
@ -147,6 +172,13 @@ PortMatrixBody::on_size_request (Gtk::Requisition *req)
|
|||||||
pair<int, int> const row = _row_labels->dimensions ();
|
pair<int, int> const row = _row_labels->dimensions ();
|
||||||
pair<int, int> const grid = _grid->dimensions ();
|
pair<int, int> const grid = _grid->dimensions ();
|
||||||
|
|
||||||
|
if (grid.first == 0 && grid.second == 0) {
|
||||||
|
/* nothing to display */
|
||||||
|
req->width = 256;
|
||||||
|
req->height = 64;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* don't ask for the maximum size of our contents, otherwise GTK won't
|
/* don't ask for the maximum size of our contents, otherwise GTK won't
|
||||||
let the containing window shrink below this size */
|
let the containing window shrink below this size */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user