Simplify spacer code
This commit is contained in:
parent
dae2dcd53e
commit
06938105a4
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2016 Robin Gareus <robin@gareus.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __gtkardour_ardour_spacer_h__
|
||||
#define __gtkardour_ardour_spacer_h__
|
||||
|
||||
#include "gtkmm2ext/cairo_widget.h"
|
||||
|
||||
class ArdourVSpacer : public CairoWidget
|
||||
{
|
||||
public:
|
||||
ArdourVSpacer (float r = 0.75f) : CairoWidget (), ratio (r) {}
|
||||
|
||||
protected:
|
||||
void render (cairo_t* cr, cairo_rectangle_t* r) {
|
||||
float h = r->height * ratio;
|
||||
float t = .5f * (r->height - h);
|
||||
cairo_rectangle (cr, 0, t, 1, h);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
void on_size_request (Gtk::Requisition* req) {
|
||||
req->width = 1;
|
||||
req->height = 0;
|
||||
CairoWidget::on_size_request (req);
|
||||
}
|
||||
|
||||
float ratio;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -380,8 +380,6 @@ public:
|
|||
|
||||
ARDOUR::PresentationInfo::order_t translate_order (RouteDialogs::InsertAt);
|
||||
|
||||
bool spacer_expose (GdkEventExpose*);
|
||||
|
||||
protected:
|
||||
friend class PublicEditor;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "ardour/session.h"
|
||||
#include "ardour/types.h"
|
||||
|
||||
#include "ardour_spacer.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "keyboard.h"
|
||||
#include "public_editor.h"
|
||||
|
@ -70,7 +71,6 @@ using namespace Gtk;
|
|||
using namespace Glib;
|
||||
using namespace ARDOUR_UI_UTILS;
|
||||
|
||||
|
||||
void
|
||||
ARDOUR_UI::setup_tooltips ()
|
||||
{
|
||||
|
@ -179,18 +179,6 @@ bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult resu
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ARDOUR_UI::spacer_expose (GdkEventExpose* ev)
|
||||
{
|
||||
cairo_t *cr = gdk_cairo_create (ev->window);
|
||||
|
||||
cairo_rectangle (cr, 1, 0, ev->area.width-2, ev->area.height);
|
||||
cairo_set_source_rgb (cr, 0,0,0);
|
||||
cairo_fill (cr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ARDOUR_UI::transport_expose (GdkEventExpose* ev)
|
||||
{
|
||||
|
@ -476,9 +464,7 @@ ARDOUR_UI::setup_transport ()
|
|||
transport_table.attach (*shuttle_box, 1, 2, 1, 2 , FILL, SHRINK, 3, 0);
|
||||
|
||||
//spacer
|
||||
EventBox *spacer = manage (new EventBox ()); spacer->set_size_request(3, 42);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
transport_table.attach (*spacer, 2, 3, 0, 2 , FILL, SHRINK, 3, 0);
|
||||
transport_table.attach (*(manage (new ArdourVSpacer ())), 2, 3, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
|
||||
|
||||
transport_table.attach (punch_label, 3, 4, 0, 1 , FILL, SHRINK, 3, 0);
|
||||
transport_table.attach (layered_label, 3, 4, 1, 2 , FILL, SHRINK, 3, 0);
|
||||
|
@ -488,26 +474,20 @@ ARDOUR_UI::setup_transport ()
|
|||
transport_table.attach (layered_button, 4, 7, 1, 2 , FILL, SHRINK, 0, 2);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 42);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
transport_table.attach (*spacer, 7, 8, 0, 2 , FILL, SHRINK, 3, 0);
|
||||
transport_table.attach (*(manage (new ArdourVSpacer ())), 7, 8, 3, 0 , SHRINK, EXPAND|FILL, 3, 0);
|
||||
|
||||
transport_table.attach (follow_edits_button, 8, 9, 0, 1 , FILL, SHRINK, 2, 0);
|
||||
transport_table.attach (auto_return_button, 8, 9, 1, 2 , FILL, SHRINK, 2, 0);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 42);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
transport_table.attach (*spacer, 9, 10, 0, 2 , FILL, SHRINK, 3, 0);
|
||||
transport_table.attach (*(manage (new ArdourVSpacer ())), 9, 10, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
|
||||
|
||||
transport_table.attach (*primary_clock, 10, 12, 0, 1 , FILL, SHRINK, 2, 0);
|
||||
transport_table.attach (*primary_clock->left_btn(), 10, 11, 1, 2 , FILL, SHRINK, 2, 0);
|
||||
transport_table.attach (*primary_clock->right_btn(), 11, 12, 1, 2 , FILL, SHRINK, 2, 0);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 42);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
transport_table.attach (*spacer, 12, 13, 0, 2 , FILL, SHRINK, 3, 0);
|
||||
transport_table.attach (*(manage (new ArdourVSpacer ())), 12, 13, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
|
||||
|
||||
if (!ARDOUR::Profile->get_small_screen()) {
|
||||
transport_table.attach (*secondary_clock, 13, 15, 0, 1 , FILL, SHRINK, 2, 0);
|
||||
|
@ -516,17 +496,12 @@ ARDOUR_UI::setup_transport ()
|
|||
}
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 42);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
transport_table.attach (*spacer, 15, 16, 0, 2 , FILL, SHRINK, 3, 0);
|
||||
transport_table.attach (*(manage (new ArdourVSpacer ())), 15, 16, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
|
||||
|
||||
transport_table.attach (*alert_box, 16, 17, 0, 2, SHRINK, EXPAND|FILL, 2, 0);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 42);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
transport_table.attach (*spacer, 17, 18, 0, 2 , FILL, SHRINK, 3, 0);
|
||||
|
||||
transport_table.attach (*(manage (new ArdourVSpacer ())), 17, 18, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
|
||||
|
||||
/* editor-meter is in transport_hbox */
|
||||
transport_hbox.set_spacing (PX_SCALE(1));
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
|
||||
#include "actions.h"
|
||||
#include "analysis_window.h"
|
||||
#include "ardour_spacer.h"
|
||||
#include "audio_clock.h"
|
||||
#include "audio_region_view.h"
|
||||
#include "audio_streamview.h"
|
||||
|
@ -758,11 +759,6 @@ Editor::Editor ()
|
|||
global_vpacker.set_spacing (2);
|
||||
global_vpacker.set_border_width (0);
|
||||
|
||||
//spacer
|
||||
EventBox *spacer = manage (new EventBox ()); spacer->set_size_request(-1, 1);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
// global_vpacker.pack_start (*spacer, false, false, 0);
|
||||
|
||||
global_vpacker.pack_start (toolbar_hbox, false, false);
|
||||
global_vpacker.pack_start (edit_pane, true, true);
|
||||
global_hpacker.pack_start (global_vpacker, true, true);
|
||||
|
@ -3190,38 +3186,23 @@ Editor::setup_toolbar ()
|
|||
|
||||
if (!ARDOUR::Profile->get_trx()) {
|
||||
|
||||
//spacer
|
||||
EventBox *spacer = manage (new EventBox ()); spacer->set_size_request(3, 12);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
toolbar_hbox.pack_start (*spacer, false, false, 3);
|
||||
toolbar_hbox.pack_start (*(manage (new ArdourVSpacer ())), false, false, 3);
|
||||
|
||||
toolbar_hbox.pack_start (_zoom_box, false, false);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 12);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
toolbar_hbox.pack_start (*spacer, false, false, 3);
|
||||
toolbar_hbox.pack_start (*(manage (new ArdourVSpacer ())), false, false, 3);
|
||||
|
||||
toolbar_hbox.pack_start (_track_box, false, false);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 12);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
toolbar_hbox.pack_start (*spacer, false, false, 3);
|
||||
toolbar_hbox.pack_start (*(manage (new ArdourVSpacer ())), false, false, 3);
|
||||
|
||||
toolbar_hbox.pack_start (snap_box, false, false);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 12);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
toolbar_hbox.pack_start (*spacer, false, false, 3);
|
||||
toolbar_hbox.pack_start (*(manage (new ArdourVSpacer ())), false, false, 3);
|
||||
|
||||
toolbar_hbox.pack_start (*ep_box, false, false);
|
||||
|
||||
//spacer
|
||||
spacer = manage (new EventBox ()); spacer->set_size_request(3, 12);
|
||||
spacer->signal_expose_event().connect (sigc::mem_fun (ARDOUR_UI::instance(), &ARDOUR_UI::spacer_expose), false); spacer->show();
|
||||
toolbar_hbox.pack_start (*spacer, false, false, 3);
|
||||
toolbar_hbox.pack_start (*(manage (new ArdourVSpacer ())), false, false, 3);
|
||||
|
||||
toolbar_hbox.pack_start (*nudge_box, false, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue