move CairoWidget into gtkmm2ext, add CairoPacker, made the time info box use CairoPacker, make the info status "bar" use CairoPacker
git-svn-id: svn://localhost/ardour2/branches/3.0@10933 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
bb737997ae
commit
20aeb5af0a
@ -28,8 +28,7 @@
|
||||
#include "pbd/signals.h"
|
||||
#include "gtkmm2ext/binding_proxy.h"
|
||||
#include "gtkmm2ext/activatable.h"
|
||||
|
||||
#include "cairo_widget.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
|
||||
class ArdourButton : public CairoWidget , public Gtkmm2ext::Activatable
|
||||
{
|
||||
|
@ -509,27 +509,21 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
void build_menu_bar ();
|
||||
|
||||
Gtk::Label wall_clock_label;
|
||||
Gtk::EventBox wall_clock_box;
|
||||
gint update_wall_clock ();
|
||||
|
||||
Gtk::Label disk_space_label;
|
||||
Gtk::EventBox disk_space_box;
|
||||
void update_disk_space ();
|
||||
|
||||
Gtk::Label cpu_load_label;
|
||||
Gtk::EventBox cpu_load_box;
|
||||
void update_cpu_load ();
|
||||
|
||||
Gtk::Label buffer_load_label;
|
||||
Gtk::EventBox buffer_load_box;
|
||||
void update_buffer_load ();
|
||||
|
||||
Gtk::Label sample_rate_label;
|
||||
Gtk::EventBox sample_rate_box;
|
||||
void update_sample_rate (ARDOUR::framecnt_t);
|
||||
|
||||
Gtk::Label format_label;
|
||||
Gtk::EventBox format_box;
|
||||
void update_format ();
|
||||
|
||||
gint every_second ();
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "gtkmm2ext/window_title.h"
|
||||
#include "gtkmm2ext/tearoff.h"
|
||||
#include "gtkmm2ext/cairo_packer.h"
|
||||
|
||||
#include "pbd/file_utils.h"
|
||||
#include "pbd/fpu.h"
|
||||
@ -532,37 +533,21 @@ ARDOUR_UI::build_menu_bar ()
|
||||
|
||||
EventBox* ev = manage (new EventBox);
|
||||
ev->show ();
|
||||
HBox* hbox = manage (new HBox);
|
||||
CairoHPacker* hbox = manage (new CairoHPacker);
|
||||
hbox->show ();
|
||||
|
||||
ev->add (*hbox);
|
||||
|
||||
wall_clock_box.add (wall_clock_label);
|
||||
wall_clock_box.set_name ("WallClock");
|
||||
wall_clock_label.set_name ("WallClock");
|
||||
|
||||
disk_space_box.add (disk_space_label);
|
||||
disk_space_box.set_name ("WallClock");
|
||||
wall_clock_label.set_use_markup ();
|
||||
disk_space_label.set_name ("WallClock");
|
||||
disk_space_label.set_use_markup ();
|
||||
|
||||
cpu_load_box.add (cpu_load_label);
|
||||
cpu_load_box.set_name ("CPULoad");
|
||||
cpu_load_label.set_name ("CPULoad");
|
||||
cpu_load_label.set_use_markup ();
|
||||
|
||||
buffer_load_box.add (buffer_load_label);
|
||||
buffer_load_box.set_name ("BufferLoad");
|
||||
buffer_load_label.set_name ("BufferLoad");
|
||||
buffer_load_label.set_use_markup ();
|
||||
|
||||
sample_rate_box.add (sample_rate_label);
|
||||
sample_rate_box.set_name ("SampleRate");
|
||||
sample_rate_label.set_name ("SampleRate");
|
||||
sample_rate_label.set_use_markup ();
|
||||
|
||||
format_box.add (format_label);
|
||||
format_box.set_name ("Format");
|
||||
format_label.set_name ("Format");
|
||||
format_label.set_use_markup ();
|
||||
|
||||
@ -583,24 +568,24 @@ ARDOUR_UI::build_menu_bar ()
|
||||
disk_space = true;
|
||||
}
|
||||
|
||||
hbox->pack_end (wall_clock_box, false, false, 2);
|
||||
hbox->pack_end (disk_space_box, false, false, 4);
|
||||
hbox->pack_end (cpu_load_box, false, false, 4);
|
||||
hbox->pack_end (buffer_load_box, false, false, 4);
|
||||
hbox->pack_end (sample_rate_box, false, false, 4);
|
||||
hbox->pack_end (format_box, false, false, 4);
|
||||
hbox->pack_end (wall_clock_label, false, false, 2);
|
||||
hbox->pack_end (disk_space_label, false, false, 4);
|
||||
hbox->pack_end (cpu_load_label, false, false, 4);
|
||||
hbox->pack_end (buffer_load_label, false, false, 4);
|
||||
hbox->pack_end (sample_rate_label, false, false, 4);
|
||||
hbox->pack_end (format_label, false, false, 4);
|
||||
|
||||
menu_hbox.pack_end (*ev, false, false);
|
||||
|
||||
menu_bar_base.set_name ("MainMenuBar");
|
||||
menu_bar_base.add (menu_hbox);
|
||||
|
||||
_status_bar_visibility.add (&wall_clock_box, X_("WallClock"), _("Wall Clock"), wall_clock);
|
||||
_status_bar_visibility.add (&disk_space_box, X_("Disk"), _("Disk Space"), disk_space);
|
||||
_status_bar_visibility.add (&cpu_load_box, X_("DSP"), _("DSP"), true);
|
||||
_status_bar_visibility.add (&buffer_load_box, X_("Buffers"), _("Buffers"), true);
|
||||
_status_bar_visibility.add (&sample_rate_box, X_("JACK"), _("JACK Sampling Rate and Latency"), true);
|
||||
_status_bar_visibility.add (&format_box, X_("Format"), _("File Format"), true);
|
||||
_status_bar_visibility.add (&wall_clock_label, X_("WallClock"), _("Wall Clock"), wall_clock);
|
||||
_status_bar_visibility.add (&disk_space_label, X_("Disk"), _("Disk Space"), disk_space);
|
||||
_status_bar_visibility.add (&cpu_load_label, X_("DSP"), _("DSP"), true);
|
||||
_status_bar_visibility.add (&buffer_load_label, X_("Buffers"), _("Buffers"), true);
|
||||
_status_bar_visibility.add (&sample_rate_label, X_("JACK"), _("JACK Sampling Rate and Latency"), true);
|
||||
_status_bar_visibility.add (&format_label, X_("Format"), _("File Format"), true);
|
||||
|
||||
ev->signal_button_press_event().connect (sigc::mem_fun (_status_bar_visibility, &VisibilityGroup::button_press_event));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
#include "cairo_widget.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef __gtk_ardour_editor_summary_h__
|
||||
#define __gtk_ardour_editor_summary_h__
|
||||
|
||||
#include "cairo_widget.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
#include "editor_component.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <gtkmm/menu.h>
|
||||
#include "editor_component.h"
|
||||
#include "cairo_widget.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class Session;
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cairo_widget.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
|
||||
class LED : public CairoWidget
|
||||
{
|
||||
|
@ -143,14 +143,6 @@ TimeInfoBox::TimeInfoBox ()
|
||||
Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed));
|
||||
|
||||
Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), ui_bind (&TimeInfoBox::track_mouse_mode, this), gui_context());
|
||||
|
||||
Gdk::Color bg;
|
||||
|
||||
bg.set_red (lrint (0.149 * 65535));
|
||||
bg.set_green (lrint (0.149 * 65535));
|
||||
bg.set_blue (lrint (0.149 * 65535));
|
||||
|
||||
CairoWidget::provide_background_for_cairo_widget (*this, bg);
|
||||
}
|
||||
|
||||
TimeInfoBox::~TimeInfoBox ()
|
||||
@ -343,31 +335,3 @@ TimeInfoBox::punch_changed (Location* loc)
|
||||
punch_end->set (loc->end());
|
||||
}
|
||||
|
||||
bool
|
||||
TimeInfoBox::on_expose_event (GdkEventExpose* ev)
|
||||
{
|
||||
{
|
||||
int x, y;
|
||||
Gtk::Widget* window_parent;
|
||||
Glib::RefPtr<Gdk::Window> win = Gtkmm2ext::window_to_draw_on (*this, &window_parent);
|
||||
|
||||
if (win) {
|
||||
|
||||
Cairo::RefPtr<Cairo::Context> context = win->create_cairo_context();
|
||||
|
||||
#if 0
|
||||
translate_coordinates (*window_parent, ev->area.x, ev->area.y, x, y);
|
||||
context->rectangle (x, y, ev->area.width, ev->area.height);
|
||||
context->clip ();
|
||||
#endif
|
||||
translate_coordinates (*window_parent, 0, 0, x, y);
|
||||
context->set_source_rgba (0.149, 0.149, 0.149, 1.0);
|
||||
Gtkmm2ext::rounded_rectangle (context, x, y, get_allocation().get_width(), get_allocation().get_height(), 9);
|
||||
context->fill ();
|
||||
}
|
||||
}
|
||||
|
||||
HBox::on_expose_event (ev);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/table.h>
|
||||
|
||||
#include "gtkmm2ext/cairo_packer.h"
|
||||
|
||||
#include "ardour/ardour.h"
|
||||
#include "ardour/session_handle.h"
|
||||
|
||||
@ -38,7 +40,7 @@ namespace ARDOUR {
|
||||
|
||||
class AudioClock;
|
||||
|
||||
class TimeInfoBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
|
||||
class TimeInfoBox : public CairoHPacker, public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
TimeInfoBox ();
|
||||
@ -46,9 +48,6 @@ class TimeInfoBox : public Gtk::HBox, public ARDOUR::SessionHandlePtr
|
||||
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
||||
protected:
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
|
||||
private:
|
||||
Gtk::Table left;
|
||||
Gtk::Table right;
|
||||
|
@ -54,7 +54,6 @@ gtk2_ardour_sources = [
|
||||
'automation_time_axis.cc',
|
||||
'axis_view.cc',
|
||||
'bundle_manager.cc',
|
||||
'cairo_widget.cc',
|
||||
'canvas-flag.cc',
|
||||
'canvas-hit.cc',
|
||||
'canvas-note-event.cc',
|
||||
|
56
libs/gtkmm2ext/cairo_packer.cc
Normal file
56
libs/gtkmm2ext/cairo_packer.cc
Normal file
@ -0,0 +1,56 @@
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
#include "gtkmm2ext/cairo_packer.h"
|
||||
|
||||
void
|
||||
CairoPacker::draw_background (Gtk::Widget& w, GdkEventExpose* ev)
|
||||
{
|
||||
int x, y;
|
||||
Gtk::Widget* window_parent;
|
||||
Glib::RefPtr<Gdk::Window> win = Gtkmm2ext::window_to_draw_on (w, &window_parent);
|
||||
|
||||
if (win) {
|
||||
|
||||
Cairo::RefPtr<Cairo::Context> context = win->create_cairo_context();
|
||||
w.translate_coordinates (*window_parent, 0, 0, x, y);
|
||||
context->set_source_rgba (0.149, 0.149, 0.149, 1.0);
|
||||
Gtkmm2ext::rounded_rectangle (context, x, y, w.get_allocation().get_width(), w.get_allocation().get_height(), 9);
|
||||
context->fill ();
|
||||
}
|
||||
}
|
||||
|
||||
CairoHPacker::CairoHPacker ()
|
||||
{
|
||||
Gdk::Color bg;
|
||||
|
||||
bg.set_red (lrint (0.149 * 65535));
|
||||
bg.set_green (lrint (0.149 * 65535));
|
||||
bg.set_blue (lrint (0.149 * 65535));
|
||||
|
||||
CairoWidget::provide_background_for_cairo_widget (*this, bg);
|
||||
}
|
||||
|
||||
bool
|
||||
CairoHPacker::on_expose_event (GdkEventExpose* ev)
|
||||
{
|
||||
draw_background (*this, ev);
|
||||
return HBox::on_expose_event (ev);
|
||||
}
|
||||
|
||||
CairoVPacker::CairoVPacker ()
|
||||
{
|
||||
Gdk::Color bg;
|
||||
|
||||
bg.set_red (lrint (0.149 * 65535));
|
||||
bg.set_green (lrint (0.149 * 65535));
|
||||
bg.set_blue (lrint (0.149 * 65535));
|
||||
|
||||
CairoWidget::provide_background_for_cairo_widget (*this, bg);
|
||||
}
|
||||
|
||||
bool
|
||||
CairoVPacker::on_expose_event (GdkEventExpose* ev)
|
||||
{
|
||||
draw_background (*this, ev);
|
||||
return VBox::on_expose_event (ev);
|
||||
}
|
@ -17,8 +17,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "cairo_widget.h"
|
||||
#include "gui_thread.h"
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
|
||||
static const char* has_cairo_widget_background_info = "has_cairo_widget_background_info";
|
||||
|
34
libs/gtkmm2ext/gtkmm2ext/cairo_packer.h
Normal file
34
libs/gtkmm2ext/gtkmm2ext/cairo_packer.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef __gtkmm2ext_cairo_packer_h__
|
||||
#define __gtkmm2ext_cairo_packer_h__
|
||||
|
||||
#include <gtkmm/box.h>
|
||||
|
||||
class CairoPacker
|
||||
{
|
||||
public:
|
||||
CairoPacker () {}
|
||||
virtual ~CairoPacker () {}
|
||||
|
||||
protected:
|
||||
virtual void draw_background (Gtk::Widget&, GdkEventExpose*);
|
||||
};
|
||||
|
||||
class CairoHPacker : public CairoPacker, public Gtk::HBox
|
||||
{
|
||||
public:
|
||||
CairoHPacker ();
|
||||
~CairoHPacker() {}
|
||||
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
};
|
||||
|
||||
class CairoVPacker : public CairoPacker, public Gtk::VBox
|
||||
{
|
||||
public:
|
||||
CairoVPacker ();
|
||||
~CairoVPacker () {}
|
||||
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
};
|
||||
|
||||
#endif /* __gtkmm2ext_cairo_packer_h__ */
|
@ -28,6 +28,8 @@ gtkmm2ext_sources = [
|
||||
'bindable_button.cc',
|
||||
'bindings.cc',
|
||||
'cairocell.cc',
|
||||
'cairo_packer.cc',
|
||||
'cairo_widget.cc',
|
||||
'cell_renderer_color_selector.cc',
|
||||
'cell_renderer_pixbuf_multi.cc',
|
||||
'cell_renderer_pixbuf_toggle.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user