summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-01-03 07:06:57 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-01-03 07:06:57 +0000
commit6481d09cdc90e6bc8462b322c2c4cbecd5efc39b (patch)
tree6a872353d3c959df9bb5e691277767f439478943
parente829e4d936614a551ea492dcc2b32b9e4858084c (diff)
make meters work properly (and very slightly faster)
git-svn-id: svn://localhost/trunk/ardour2@230 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.cc5
-rw-r--r--gtk2_ardour/editor_region_list.cc19
-rw-r--r--libs/gtkmm2ext/fastmeter.cc60
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/fastmeter.h2
4 files changed, 33 insertions, 53 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index faa58359e5..052676cd4a 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -615,7 +615,6 @@ Editor::Editor (AudioEngine& eng)
list<Gtk::TargetEntry> region_list_target_table;
- region_list_target_table.push_back (TargetEntry ("STRING"));
region_list_target_table.push_back (TargetEntry ("text/plain"));
region_list_target_table.push_back (TargetEntry ("text/uri-list"));
region_list_target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
@@ -624,7 +623,7 @@ Editor::Editor (AudioEngine& eng)
region_list_display.signal_drag_data_received().connect (mem_fun(*this, &Editor::region_list_display_drag_data_received));
region_list_scroller.add (region_list_display);
- region_list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+ region_list_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
region_list_display.signal_key_press_event().connect (mem_fun(*this, &Editor::region_list_display_key_press));
region_list_display.signal_key_release_event().connect (mem_fun(*this, &Editor::region_list_display_key_release));
@@ -634,7 +633,7 @@ Editor::Editor (AudioEngine& eng)
// region_list_display.signal_popup_menu().connect (bind (mem_fun (*this, &Editor::show_region_list_display_context_menu), 1, 0));
named_selection_scroller.add (named_selection_display);
- named_selection_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+ named_selection_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
named_selection_model = TreeStore::create (named_selection_columns);
named_selection_display.set_model (named_selection_model);
diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc
index 3765f852bf..81070f7c63 100644
--- a/gtk2_ardour/editor_region_list.cc
+++ b/gtk2_ardour/editor_region_list.cc
@@ -493,7 +493,7 @@ Editor::region_list_display_button_release (GdkEventButton *ev)
TreeViewColumn* column;
int cellx;
int celly;
- Region* region;
+ Region* region = 0;
if (region_list_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
if ((iter = region_list_model->get_iter (path))) {
@@ -501,24 +501,11 @@ Editor::region_list_display_button_release (GdkEventButton *ev)
}
}
- if (Keyboard::is_delete_event (ev)) {
+ if (region && Keyboard::is_delete_event (ev)) {
session->remove_region_from_region_list (*region);
return true;
}
- switch (ev->button) {
- case 1:
- return false;
- break;
-
- case 3:
- return false;
- break;
-
- default:
- break;
- }
-
return false;
}
@@ -546,7 +533,7 @@ Editor::consider_auditioning (Region& region)
int
Editor::region_list_sorter (TreeModel::iterator a, TreeModel::iterator b)
{
- int cmp;
+ int cmp = 0;
Region* r1 = (*a)[region_list_columns.region];
Region* r2 = (*b)[region_list_columns.region];
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc
index 5067bf5c16..245a189c62 100644
--- a/libs/gtkmm2ext/fastmeter.cc
+++ b/libs/gtkmm2ext/fastmeter.cc
@@ -52,19 +52,19 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
- pixrect.set_x(0);
- pixrect.set_y(0);
+ pixrect.x = 0;
+ pixrect.y = 0;
if (orientation == Vertical) {
- pixrect.set_width(min (v_pixwidth, (gint) dimen));
- pixrect.set_height(v_pixheight);
+ pixrect.width = min (v_pixwidth, (gint) dimen);
+ pixrect.height = v_pixheight;
} else {
- pixrect.set_width(h_pixwidth);
- pixrect.set_height(min (h_pixheight, (gint) dimen));
+ pixrect.width = h_pixwidth;
+ pixrect.height = min (h_pixheight, (gint) dimen);
}
- request_width = pixrect.get_width();
- request_height= pixrect.get_height();
+ request_width = pixrect.width;
+ request_height= pixrect.height;
}
FastMeter::~FastMeter ()
@@ -147,26 +147,21 @@ FastMeter::on_expose_event (GdkEventExpose* ev)
bool
FastMeter::vertical_expose (GdkEventExpose* ev)
{
- Rectangle intersect;
gint top_of_meter;
- bool blit = false;
- bool intersecting = false;
+ GdkRectangle intersection;
top_of_meter = (gint) floor (v_pixheight * current_level);
- pixrect.set_height(top_of_meter);
+ pixrect.height = top_of_meter;
- intersect = pixrect.intersect(wrap(&ev->area), intersecting);
- if (intersecting) {
+ if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
*/
RefPtr<Gdk::Window> win(get_window());
win->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
- intersect.get_x(), v_pixheight - top_of_meter,
- intersect.get_x(), v_pixheight - top_of_meter,
- intersect.get_width(), intersect.get_height());
-
- blit = true;
+ intersection.x, v_pixheight - top_of_meter,
+ intersection.x, v_pixheight - top_of_meter,
+ intersection.width, intersection.height);
}
/* draw peak bar */
@@ -174,9 +169,9 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
if (hold_state) {
RefPtr<Gdk::Window> win(get_window());
win->draw_drawable(get_style()->get_fg_gc(get_state()), v_pixmap,
- intersect.get_x(), v_pixheight - (gint) floor (v_pixheight * current_peak),
- intersect.get_x(), v_pixheight - (gint) floor (v_pixheight * current_peak),
- intersect.get_width(), 3);
+ intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
+ intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
+ intersection.width, 3);
}
return true;
@@ -185,23 +180,22 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
bool
FastMeter::horizontal_expose (GdkEventExpose* ev)
{
- Rectangle intersect;
- bool intersecting = false;
+ GdkRectangle intersection;
gint right_of_meter;
right_of_meter = (gint) floor (h_pixwidth * current_level);
- pixrect.set_width(right_of_meter);
+ pixrect.width = right_of_meter;
+
+ if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
- intersect = pixrect.intersect(wrap(&ev->area), intersecting);
- if (intersecting) {
/* draw the part of the meter image that we need.
*/
RefPtr<Gdk::Window> win(get_window());
win->draw_drawable(get_style()->get_fg_gc(get_state()), h_pixmap,
- intersect.get_x(), intersect.get_y(),
- intersect.get_x(), intersect.get_y(),
- intersect.get_width(), intersect.get_height());
+ intersection.x, intersection.y,
+ intersection.x, intersection.y,
+ intersection.width, intersection.height);
}
/* draw peak bar */
@@ -209,9 +203,9 @@ FastMeter::horizontal_expose (GdkEventExpose* ev)
if (hold_state) {
RefPtr<Gdk::Window> win(get_window());
win->draw_drawable(get_style()->get_fg_gc(get_state()), h_pixmap,
- right_of_meter, intersect.get_y(),
- right_of_meter, intersect.get_y(),
- 3, intersect.get_height());
+ right_of_meter, intersection.y,
+ right_of_meter, intersection.y,
+ 3, intersection.height);
}
return true;
diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
index 5c41fcba84..3143c71b12 100644
--- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
+++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
@@ -67,7 +67,7 @@ class FastMeter : public Gtk::DrawingArea {
Orientation orientation;
Glib::RefPtr<Gdk::Pixmap> backing;
- Gdk::Rectangle pixrect;
+ GdkRectangle pixrect;
gint request_width;
gint request_height;
unsigned long hold_cnt;