black bg for meters, font fixups for startup message, new notebook widget (incomplete)
git-svn-id: svn://localhost/trunk/ardour2@178 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e21dc7dede
commit
6d33b9a2d6
|
@ -551,19 +551,6 @@ Editor::Editor (AudioEngine& eng)
|
|||
edit_group_vbox.pack_start (edit_group_list_button, false, false);
|
||||
edit_group_vbox.pack_start (edit_group_list_scroller, true, true);
|
||||
|
||||
route_list_frame.set_name ("BaseFrame");
|
||||
route_list_frame.set_shadow_type (Gtk::SHADOW_IN);
|
||||
route_list_frame.add (route_list_scroller);
|
||||
|
||||
edit_group_list_frame.set_name ("BaseFrame");
|
||||
edit_group_list_frame.set_shadow_type (Gtk::SHADOW_IN);
|
||||
edit_group_list_frame.add (edit_group_vbox);
|
||||
|
||||
route_group_vpane.add1 (route_list_frame);
|
||||
route_group_vpane.add2 (edit_group_list_frame);
|
||||
|
||||
list_vpacker.pack_start (route_group_vpane, true, true);
|
||||
|
||||
region_list_model = TreeStore::create (region_list_columns);
|
||||
region_list_sort_model = TreeModelSort::create (region_list_model);
|
||||
region_list_model->set_sort_func (0, mem_fun (*this, &Editor::region_list_sorter));
|
||||
|
@ -615,44 +602,21 @@ Editor::Editor (AudioEngine& eng)
|
|||
named_selection_display.signal_button_press_event().connect (mem_fun(*this, &Editor::named_selection_display_button_press));
|
||||
named_selection_display.get_selection()->signal_changed().connect (mem_fun (*this, &Editor::named_selection_display_selection_changed));
|
||||
|
||||
region_selection_vpane.pack1 (region_list_scroller, true, true);
|
||||
region_selection_vpane.pack2 (named_selection_scroller, true, true);
|
||||
the_notebook.append_page (route_list_scroller, _("Tracks/Busses"));
|
||||
the_notebook.append_page (edit_group_vbox, _("Edit Groups"));
|
||||
the_notebook.append_page (region_list_scroller, _("Regions"));
|
||||
the_notebook.append_page (named_selection_scroller, _("Chunks"));
|
||||
the_notebook.set_show_tabs (true);
|
||||
|
||||
canvas_region_list_pane.pack1 (edit_frame, true, true);
|
||||
canvas_region_list_pane.pack2 (region_selection_vpane, true, true);
|
||||
edit_pane.pack1 (edit_frame, true, true);
|
||||
edit_pane.pack2 (the_notebook, true, true);
|
||||
|
||||
track_list_canvas_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler),
|
||||
static_cast<Gtk::Paned*> (&track_list_canvas_pane)));
|
||||
canvas_region_list_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler),
|
||||
static_cast<Gtk::Paned*> (&canvas_region_list_pane)));
|
||||
route_group_vpane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler),
|
||||
static_cast<Gtk::Paned*> (&route_group_vpane)));
|
||||
region_selection_vpane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler),
|
||||
static_cast<Gtk::Paned*> (®ion_selection_vpane)));
|
||||
|
||||
track_list_canvas_pane.pack1 (list_vpacker, true, true);
|
||||
track_list_canvas_pane.pack2 (canvas_region_list_pane, true, true);
|
||||
|
||||
/* provide special pane-handle event handling for easy "hide" action */
|
||||
|
||||
/* 0: collapse to show left/upper child
|
||||
1: collapse to show right/lower child
|
||||
*/
|
||||
|
||||
route_group_vpane.set_data ("collapse-direction", (gpointer) 0);
|
||||
region_selection_vpane.set_data ("collapse-direction", (gpointer) 0);
|
||||
canvas_region_list_pane.set_data ("collapse-direction", (gpointer) 0);
|
||||
track_list_canvas_pane.set_data ("collapse-direction", (gpointer) 1);
|
||||
|
||||
route_group_vpane.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast<Paned*> (&route_group_vpane)));
|
||||
region_selection_vpane.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast<Paned*> (®ion_selection_vpane)));
|
||||
canvas_region_list_pane.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast<Paned*> (&canvas_region_list_pane)));
|
||||
track_list_canvas_pane.signal_button_release_event().connect (bind (sigc::ptr_fun (pane_handler), static_cast<Paned*> (&track_list_canvas_pane)));
|
||||
edit_pane.signal_size_allocate().connect_notify (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Gtk::Paned*> (&edit_pane)));
|
||||
|
||||
top_hbox.pack_start (toolbar_frame, true, true);
|
||||
|
||||
HBox *hbox = manage (new HBox);
|
||||
hbox->pack_start (track_list_canvas_pane, true, true);
|
||||
hbox->pack_start (edit_pane, true, true);
|
||||
|
||||
global_vpacker.pack_start (top_hbox, false, false);
|
||||
global_vpacker.pack_start (*hbox, true, true);
|
||||
|
@ -817,7 +781,7 @@ Editor::set_frames_per_unit (double fpu)
|
|||
|
||||
// convert fpu to frame count
|
||||
|
||||
frames = (jack_nframes_t) (fpu * canvas_width);
|
||||
frames = (jack_nframes_t) floor (fpu * canvas_width);
|
||||
|
||||
/* don't allow zooms that fit more than the maximum number
|
||||
of frames into an 800 pixel wide space.
|
||||
|
@ -907,15 +871,14 @@ Editor::zoom_adjustment_changed ()
|
|||
return;
|
||||
}
|
||||
|
||||
double fpu = (double) zoom_range_clock.current_duration() / (double) canvas_width;
|
||||
double fpu = zoom_range_clock.current_duration() / canvas_width;
|
||||
|
||||
if (fpu < 1.0) {
|
||||
fpu = 1.0;
|
||||
zoom_range_clock.set ((jack_nframes_t) (fpu * canvas_width));
|
||||
}
|
||||
else if (fpu > session->current_end_frame() / (double) canvas_width) {
|
||||
fpu = session->current_end_frame() / (double) canvas_width;
|
||||
zoom_range_clock.set ((jack_nframes_t) (fpu * canvas_width));
|
||||
zoom_range_clock.set ((jack_nframes_t) floor (fpu * canvas_width));
|
||||
} else if (fpu > session->current_end_frame() / canvas_width) {
|
||||
fpu = session->current_end_frame() / canvas_width;
|
||||
zoom_range_clock.set ((jack_nframes_t) floor (fpu * canvas_width));
|
||||
}
|
||||
|
||||
temporal_zoom (fpu);
|
||||
|
@ -1065,13 +1028,13 @@ Editor::map_position_change (jack_nframes_t frame)
|
|||
void
|
||||
Editor::center_screen (jack_nframes_t frame)
|
||||
{
|
||||
float page = canvas_width * frames_per_unit;
|
||||
double page = canvas_width * frames_per_unit;
|
||||
|
||||
/* if we're off the page, then scroll.
|
||||
*/
|
||||
|
||||
if (frame < leftmost_frame || frame >= leftmost_frame + page) {
|
||||
center_screen_internal (frame,page);
|
||||
center_screen_internal (frame, page);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2180,14 +2143,8 @@ Editor::get_state ()
|
|||
geometry->add_property("x_off", string(buf));
|
||||
snprintf(buf, sizeof(buf), "%d", yoff);
|
||||
geometry->add_property("y_off", string(buf));
|
||||
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&canvas_region_list_pane)->gobj()));
|
||||
geometry->add_property("canvas_region_list_pane_pos", string(buf));
|
||||
snprintf(buf,sizeof(buf), "%d", gtk_paned_get_position (static_cast<Paned*>(&track_list_canvas_pane)->gobj()));
|
||||
geometry->add_property("track_list_canvas_pane_pos", string(buf));
|
||||
snprintf(buf,sizeof(buf), "%d", gtk_paned_get_position (static_cast<Paned*>(®ion_selection_vpane)->gobj()));
|
||||
geometry->add_property("region_selection_pane_pos", string(buf));
|
||||
snprintf(buf,sizeof(buf), "%d", gtk_paned_get_position (static_cast<Paned*>(&route_group_vpane)->gobj()));
|
||||
geometry->add_property("route_group_pane_pos", string(buf));
|
||||
snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&edit_pane)->gobj()));
|
||||
geometry->add_property("edit_pane_pos", string(buf));
|
||||
|
||||
node->add_child_nocopy (*geometry);
|
||||
}
|
||||
|
@ -3738,72 +3695,21 @@ Editor::pane_allocation_handler (Gtk::Allocation &alloc, Gtk::Paned* which)
|
|||
height = atoi(geometry->property("y_size")->value());
|
||||
}
|
||||
|
||||
if (which == static_cast<Gtk::Paned*> (&track_list_canvas_pane)) {
|
||||
if (which == static_cast<Gtk::Paned*> (&edit_pane)) {
|
||||
|
||||
if (done[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!geometry || (prop = geometry->property("track_list_canvas_pane_pos")) == 0) {
|
||||
if (!geometry || (prop = geometry->property ("edit_pane_pos")) == 0) {
|
||||
pos = 75;
|
||||
snprintf (buf, sizeof(buf), "%d", pos);
|
||||
} else {
|
||||
pos = atoi (prop->value());
|
||||
}
|
||||
|
||||
if ((done[0] = GTK_WIDGET(track_list_canvas_pane.gobj())->allocation.width > pos)) {
|
||||
track_list_canvas_pane.set_position (pos);
|
||||
}
|
||||
|
||||
} else if (which == static_cast<Gtk::Paned*> (&canvas_region_list_pane)) {
|
||||
|
||||
if (done[1]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!geometry || (prop = geometry->property("canvas_region_list_pane_pos")) == 0) {
|
||||
pos = width - (95 * 2);
|
||||
snprintf (buf, sizeof(buf), "%d", pos);
|
||||
} else {
|
||||
pos = atoi (prop->value());
|
||||
}
|
||||
|
||||
if ((done[1] = GTK_WIDGET(canvas_region_list_pane.gobj())->allocation.width > pos)) {
|
||||
canvas_region_list_pane.set_position (pos);
|
||||
}
|
||||
|
||||
} else if (which == static_cast<Gtk::Paned*> (&route_group_vpane)) {
|
||||
|
||||
if (done[2]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!geometry || (prop = geometry->property("route_group_pane_pos")) == 0) {
|
||||
pos = width - (95 * 2);
|
||||
snprintf (buf, sizeof(buf), "%d", pos);
|
||||
} else {
|
||||
pos = atoi (prop->value());
|
||||
}
|
||||
|
||||
if ((done[2] = GTK_WIDGET(route_group_vpane.gobj())->allocation.height > pos)) {
|
||||
route_group_vpane.set_position (pos);
|
||||
}
|
||||
|
||||
} else if (which == static_cast<Gtk::Paned*> (®ion_selection_vpane)) {
|
||||
|
||||
if (done[3]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!geometry || (prop = geometry->property("region_selection_pane_pos")) == 0) {
|
||||
pos = width - (95 * 2);
|
||||
snprintf (buf, sizeof(buf), "%d", pos);
|
||||
} else {
|
||||
pos = atoi (prop->value());
|
||||
}
|
||||
|
||||
if ((done[3] = GTK_WIDGET(region_selection_vpane.gobj())->allocation.height > pos)) {
|
||||
region_selection_vpane.set_position (pos);
|
||||
if ((done[0] = GTK_WIDGET(edit_pane.gobj())->allocation.width > pos)) {
|
||||
edit_pane.set_position (pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -374,8 +374,8 @@ class Editor : public PublicEditor
|
|||
|
||||
void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*);
|
||||
|
||||
Gtk::HPaned canvas_region_list_pane;
|
||||
Gtk::HPaned track_list_canvas_pane;
|
||||
Gtk::Notebook the_notebook;
|
||||
Gtk::HPaned edit_pane;
|
||||
|
||||
Gtk::EventBox meter_base;
|
||||
Gtk::HBox meter_box;
|
||||
|
@ -674,8 +674,8 @@ class Editor : public PublicEditor
|
|||
gint hscroll_right_arrow_button_press (GdkEventButton *);
|
||||
gint hscroll_right_arrow_button_release (GdkEventButton *);
|
||||
|
||||
guint32 canvas_width;
|
||||
guint32 canvas_height;
|
||||
double canvas_width;
|
||||
double canvas_height;
|
||||
|
||||
Gtk::ScrolledWindow track_canvas_scroller;
|
||||
Gtk::ScrolledWindow time_canvas_scroller;
|
||||
|
@ -765,7 +765,6 @@ class Editor : public PublicEditor
|
|||
NamedSelectionDisplayModelColumns named_selection_columns;
|
||||
Glib::RefPtr<Gtk::TreeStore> named_selection_model;
|
||||
|
||||
Gtk::VPaned region_selection_vpane;
|
||||
Gtk::TreeView named_selection_display;
|
||||
Gtk::ScrolledWindow named_selection_scroller;
|
||||
|
||||
|
@ -1404,10 +1403,6 @@ class Editor : public PublicEditor
|
|||
|
||||
bool audio_region_selection_covers (jack_nframes_t where);
|
||||
|
||||
Gtk::VPaned route_group_vpane;
|
||||
Gtk::Frame route_list_frame;
|
||||
Gtk::Frame edit_group_list_frame;
|
||||
|
||||
/* transport range select process */
|
||||
enum RangeMarkerOp {
|
||||
CreateRangeMarker,
|
||||
|
|
|
@ -269,74 +269,46 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
|
|||
|
||||
if (session == 0 && !ARDOUR_UI::instance()->will_create_new_session_automatically()) {
|
||||
|
||||
Pango::FontDescription font = get_font_for_style (N_("FirstActionMessage"));
|
||||
|
||||
cerr << "font for style = "
|
||||
<< font.get_family() << ' '
|
||||
<< font.get_size() << ' '
|
||||
<< font.get_weight() << ' '
|
||||
<< font.get_variant() << ' '
|
||||
<< endmsg;
|
||||
|
||||
const char *txt1 = _("Start a new session\n");
|
||||
const char *txt2 = _("via Session menu");
|
||||
|
||||
/* this mess of code is here to find out how wide this text is and
|
||||
position the message in the center of the editor window. there
|
||||
are two lines, so we use the longer of the the lines to
|
||||
compute width, and multiply the height by 2.
|
||||
position the message in the center of the editor window.
|
||||
*/
|
||||
|
||||
int pixel_height;
|
||||
int pixel_width;
|
||||
|
||||
/* this is a dummy widget that exists so that we can get the
|
||||
style from the RC file.
|
||||
*/
|
||||
|
||||
Label foo (_(txt2));
|
||||
Glib::RefPtr<Pango::Layout> layout;
|
||||
ustring msg = string_compose ("<span face=\"sans\" style=\"normal\" weight=\"bold\" size=\"x-large\">%1%2</span>",
|
||||
_("Start a new session\n"), _("via Session menu"));
|
||||
|
||||
top_hbox.pack_start (foo);
|
||||
foo.set_name ("FirstActionMessage");
|
||||
foo.ensure_style ();
|
||||
|
||||
layout = foo.create_pango_layout (_(txt2));
|
||||
layout->set_font_description (font);
|
||||
layout->set_font_description (font);
|
||||
RefPtr<Pango::Layout> layout = create_pango_layout (msg);
|
||||
Pango::FontDescription font = get_font_for_style (N_("FirstActionMessage"));
|
||||
layout->get_pixel_size (pixel_width, pixel_height);
|
||||
|
||||
top_hbox.remove (foo);
|
||||
|
||||
if (first_action_message == 0) {
|
||||
|
||||
char txt[strlen(txt1)+strlen(txt2)+1];
|
||||
|
||||
/* merge both lines */
|
||||
|
||||
strcpy (txt, _(txt1));
|
||||
strcat (txt, _(txt2));
|
||||
|
||||
first_action_message = new ArdourCanvas::Text (*track_canvas.root());
|
||||
first_action_message->property_font_desc() = font;
|
||||
first_action_message->property_fill_color_rgba() = color_map[cFirstActionMessage];
|
||||
first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0;
|
||||
first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height));
|
||||
first_action_message->property_x() = (canvas_width - pixel_width) / 2.0;
|
||||
first_action_message->property_y() = (canvas_height/2.0) - pixel_height;
|
||||
first_action_message->property_anchor() = ANCHOR_NORTH_WEST;
|
||||
first_action_message->property_text() = ustring (txt);
|
||||
first_action_message->property_markup() = msg;
|
||||
|
||||
} else {
|
||||
|
||||
/* center it */
|
||||
first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0;
|
||||
first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height));
|
||||
first_action_message->property_x() = (canvas_width - pixel_width) / 2.0;
|
||||
first_action_message->property_y() = (canvas_height/2.0) - pixel_height;
|
||||
}
|
||||
}
|
||||
|
||||
zoom_range_clock.set ((jack_nframes_t) (canvas_width * frames_per_unit));
|
||||
zoom_range_clock.set ((jack_nframes_t) floor ((canvas_width * frames_per_unit)));
|
||||
edit_cursor->set_position (edit_cursor->current_frame);
|
||||
playhead_cursor->set_position (playhead_cursor->current_frame);
|
||||
reset_scrolling_region (&alloc);
|
||||
|
||||
double last_canvas_unit = ceil ((double) max_frames / frames_per_unit);
|
||||
|
||||
track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_width), canvas_height);
|
||||
time_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_width), canvas_height);
|
||||
|
||||
if (edit_cursor) edit_cursor->set_length (canvas_height);
|
||||
if (playhead_cursor) playhead_cursor->set_length (canvas_height);
|
||||
|
@ -348,27 +320,27 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
|
|||
|
||||
if (range_marker_drag_rect) {
|
||||
range_marker_drag_rect->property_y1() = 0.0;
|
||||
range_marker_drag_rect->property_y2() = (double) canvas_height;
|
||||
range_marker_drag_rect->property_y2() = canvas_height;
|
||||
}
|
||||
|
||||
if (transport_loop_range_rect) {
|
||||
transport_loop_range_rect->property_y1() = 0.0;
|
||||
transport_loop_range_rect->property_y2() = (double) canvas_height;
|
||||
transport_loop_range_rect->property_y2() = canvas_height;
|
||||
}
|
||||
|
||||
if (transport_punch_range_rect) {
|
||||
transport_punch_range_rect->property_y1() = 0.0;
|
||||
transport_punch_range_rect->property_y2() = (double) canvas_height;
|
||||
transport_punch_range_rect->property_y2() = canvas_height;
|
||||
}
|
||||
|
||||
if (transport_punchin_line) {
|
||||
transport_punchin_line->property_y1() = 0.0;
|
||||
transport_punchin_line->property_y2() = (double) canvas_height;
|
||||
transport_punchin_line->property_y2() = canvas_height;
|
||||
}
|
||||
|
||||
if (transport_punchout_line) {
|
||||
transport_punchout_line->property_y1() = 0.0;
|
||||
transport_punchout_line->property_y2() = (double) canvas_height;
|
||||
transport_punchout_line->property_y2() = canvas_height;
|
||||
}
|
||||
|
||||
update_fixed_rulers ();
|
||||
|
@ -386,58 +358,6 @@ Editor::track_canvas_allocate (Gtk::Allocation alloc)
|
|||
void
|
||||
Editor::reset_scrolling_region (Gtk::Allocation* alloc)
|
||||
{
|
||||
guint32 last_canvas_unit;
|
||||
double height;
|
||||
guint32 canvas_alloc_height, canvas_alloc_width;
|
||||
TrackViewList::iterator i;
|
||||
|
||||
/* We need to make sure that the canvas always has its
|
||||
scrolling region set to larger of:
|
||||
|
||||
- the size allocated for it (within the container its packed in)
|
||||
- the size required to see the entire session
|
||||
|
||||
If we don't ensure at least the first of these, the canvas
|
||||
does some wierd and in my view unnecessary stuff to center
|
||||
itself within the allocated area, which causes bad, bad
|
||||
results.
|
||||
|
||||
XXX GnomeCanvas has fixed this, and has an option to
|
||||
control the centering behaviour.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
last_canvas_unit = (guint32) ceil ((float) max_frames / frames_per_unit);
|
||||
|
||||
height = 0;
|
||||
|
||||
if (session) {
|
||||
for (i = track_views.begin(); i != track_views.end(); ++i) {
|
||||
if ((*i)->control_parent) {
|
||||
height += (*i)->effective_height;
|
||||
height += track_spacing;
|
||||
}
|
||||
}
|
||||
|
||||
if (height) {
|
||||
height -= track_spacing;
|
||||
}
|
||||
}
|
||||
|
||||
canvas_height = (guint32) height;
|
||||
#endif
|
||||
|
||||
if (alloc) {
|
||||
canvas_alloc_height = alloc->get_height();
|
||||
canvas_alloc_width = alloc->get_width();
|
||||
} else {
|
||||
canvas_alloc_height = track_canvas.get_height();
|
||||
canvas_alloc_width = track_canvas.get_width();
|
||||
}
|
||||
|
||||
canvas_height = 0;
|
||||
canvas_height = max (canvas_height, canvas_alloc_height);
|
||||
track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_alloc_width), canvas_height);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -147,7 +147,6 @@ Editor::hscroll_slider_button_release (GdkEventButton *ev)
|
|||
|
||||
return TRUE;
|
||||
|
||||
|
||||
start = (gint) floor (bar_max * ((double) leftmost_frame / session->current_end_frame()));
|
||||
width = (gint) floor (bar_max * ((canvas_width * frames_per_unit) / session->current_end_frame()));
|
||||
|
||||
|
|
|
@ -3651,7 +3651,6 @@ Editor::drag_selection (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
if (event->button.x >= track_canvas_scroller.get_hadjustment()->get_value() + canvas_width) {
|
||||
start_canvas_autoscroll (1);
|
||||
}
|
||||
|
@ -4184,7 +4183,6 @@ Editor::drag_range_markerbar_op (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
if (event->button.x >= track_canvas_scroller.get_hadjustment()->get_value() + canvas_width) {
|
||||
start_canvas_autoscroll (1);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ Editor::draw_measures ()
|
|||
line = get_time_line ();
|
||||
line->property_x1() = xpos;
|
||||
line->property_x2() = xpos;
|
||||
line->property_y2() = (gdouble) canvas_height;
|
||||
line->property_y2() = canvas_height;
|
||||
line->property_color_rgba() = color;
|
||||
line->raise_to_top();
|
||||
line->show();
|
||||
|
|
|
@ -26,16 +26,18 @@
|
|||
#include <gtkmm/style.h>
|
||||
|
||||
using namespace Gtk;
|
||||
using namespace Gdk;
|
||||
using namespace Glib;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace std;
|
||||
|
||||
Glib::RefPtr<Gdk::Pixmap> FastMeter::v_pixmap;
|
||||
Glib::RefPtr<Gdk::Bitmap> FastMeter::v_mask;
|
||||
RefPtr<Pixmap> FastMeter::v_pixmap;
|
||||
RefPtr<Bitmap> FastMeter::v_mask;
|
||||
gint FastMeter::v_pixheight = 0;
|
||||
gint FastMeter::v_pixwidth = 0;
|
||||
|
||||
Glib::RefPtr<Gdk::Pixmap> FastMeter::h_pixmap;
|
||||
Glib::RefPtr<Gdk::Bitmap> FastMeter::h_mask;
|
||||
RefPtr<Pixmap> FastMeter::h_pixmap;
|
||||
RefPtr<Bitmap> FastMeter::h_mask;
|
||||
gint FastMeter::h_pixheight = 0;
|
||||
gint FastMeter::h_pixwidth = 0;
|
||||
|
||||
|
@ -48,7 +50,7 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
|||
current_level = 0;
|
||||
current_user_level = -100.0f;
|
||||
|
||||
set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
||||
set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
|
||||
|
||||
pixrect.set_x(0);
|
||||
pixrect.set_y(0);
|
||||
|
@ -69,13 +71,27 @@ FastMeter::~FastMeter ()
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::on_realize ()
|
||||
{
|
||||
DrawingArea::on_realize();
|
||||
|
||||
RefPtr<Style> style = get_style();
|
||||
Color black = style->get_black();
|
||||
|
||||
style->set_bg (STATE_NORMAL, black);
|
||||
style->set_bg (STATE_ACTIVE, black);
|
||||
style->set_bg (STATE_SELECTED, black);
|
||||
style->set_bg (STATE_INSENSITIVE, black);
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::set_vertical_xpm (const char **xpm)
|
||||
{
|
||||
if (v_pixmap == 0) {
|
||||
gint w, h;
|
||||
|
||||
v_pixmap = Gdk::Pixmap::create_from_xpm(Gdk::Colormap::get_system(), v_mask, xpm);
|
||||
v_pixmap = Pixmap::create_from_xpm(Colormap::get_system(), v_mask, xpm);
|
||||
v_pixmap->get_size(w, h);
|
||||
|
||||
v_pixheight = h;
|
||||
|
@ -89,7 +105,7 @@ FastMeter::set_horizontal_xpm (const char **xpm)
|
|||
if (h_pixmap == 0) {
|
||||
gint w, h;
|
||||
|
||||
h_pixmap = Gdk::Pixmap::create_from_xpm(Gdk::Colormap::get_system(), h_mask, xpm);
|
||||
h_pixmap = Pixmap::create_from_xpm(Colormap::get_system(), h_mask, xpm);
|
||||
h_pixmap->get_size(w, h);
|
||||
|
||||
h_pixheight = h;
|
||||
|
@ -131,7 +147,7 @@ FastMeter::on_expose_event (GdkEventExpose* ev)
|
|||
bool
|
||||
FastMeter::vertical_expose (GdkEventExpose* ev)
|
||||
{
|
||||
Gdk::Rectangle intersect;
|
||||
Rectangle intersect;
|
||||
gint top_of_meter;
|
||||
bool blit = false;
|
||||
bool intersecting = false;
|
||||
|
@ -139,12 +155,12 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
|||
top_of_meter = (gint) floor (v_pixheight * current_level);
|
||||
pixrect.set_height(top_of_meter);
|
||||
|
||||
intersect = pixrect.intersect(Glib::wrap(&ev->area), intersecting);
|
||||
intersect = pixrect.intersect(wrap(&ev->area), intersecting);
|
||||
if (intersecting) {
|
||||
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
||||
*/
|
||||
|
||||
Glib::RefPtr<Gdk::Window> win(get_window());
|
||||
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,
|
||||
|
@ -156,7 +172,7 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
|||
/* draw peak bar */
|
||||
|
||||
if (hold_state) {
|
||||
Glib::RefPtr<Gdk::Window> win(get_window());
|
||||
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),
|
||||
|
@ -169,19 +185,19 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
|||
bool
|
||||
FastMeter::horizontal_expose (GdkEventExpose* ev)
|
||||
{
|
||||
Gdk::Rectangle intersect;
|
||||
Rectangle intersect;
|
||||
bool intersecting = false;
|
||||
gint right_of_meter;
|
||||
|
||||
right_of_meter = (gint) floor (h_pixwidth * current_level);
|
||||
pixrect.set_width(right_of_meter);
|
||||
|
||||
intersect = pixrect.intersect(Glib::wrap(&ev->area), intersecting);
|
||||
intersect = pixrect.intersect(wrap(&ev->area), intersecting);
|
||||
if (intersecting) {
|
||||
/* draw the part of the meter image that we need.
|
||||
*/
|
||||
|
||||
Glib::RefPtr<Gdk::Window> win(get_window());
|
||||
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(),
|
||||
|
@ -191,7 +207,7 @@ FastMeter::horizontal_expose (GdkEventExpose* ev)
|
|||
/* draw peak bar */
|
||||
|
||||
if (hold_state) {
|
||||
Glib::RefPtr<Gdk::Window> win(get_window());
|
||||
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(),
|
||||
|
|
|
@ -52,7 +52,8 @@ class FastMeter : public Gtk::DrawingArea {
|
|||
protected:
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
void on_size_request (GtkRequisition*);
|
||||
|
||||
void on_realize ();
|
||||
|
||||
private:
|
||||
static Glib::RefPtr<Gdk::Pixmap> h_pixmap;
|
||||
static Glib::RefPtr<Gdk::Bitmap> h_mask;
|
||||
|
|
Loading…
Reference in New Issue