2008-06-19 00:57:47 +02:00
|
|
|
/*
|
|
|
|
|
timeline-ruler.cpp - Implementation of the time ruler widget
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
|
|
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
#include <cairomm-1.0/cairomm/cairomm.h>
|
|
|
|
|
|
|
|
|
|
#include "timeline-ruler.hpp"
|
2008-08-07 21:27:41 +02:00
|
|
|
#include "../timeline-widget.hpp"
|
2008-06-19 00:57:47 +02:00
|
|
|
#include "../../window-manager.hpp"
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
#include "../../../lib/time.h"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
using namespace Gtk;
|
2008-06-25 21:23:53 +02:00
|
|
|
using namespace Cairo;
|
2008-06-19 00:57:47 +02:00
|
|
|
using namespace std;
|
|
|
|
|
using namespace lumiera::gui;
|
|
|
|
|
using namespace lumiera::gui::widgets;
|
|
|
|
|
using namespace lumiera::gui::widgets::timeline;
|
|
|
|
|
|
|
|
|
|
namespace lumiera {
|
|
|
|
|
namespace gui {
|
|
|
|
|
namespace widgets {
|
|
|
|
|
namespace timeline {
|
|
|
|
|
|
2008-08-07 21:27:41 +02:00
|
|
|
TimelineRuler::TimelineRuler(
|
|
|
|
|
lumiera::gui::widgets::TimelineWidget *timeline_widget) :
|
2008-06-23 11:54:37 +02:00
|
|
|
Glib::ObjectBase("TimelineRuler"),
|
2008-07-15 19:36:43 +02:00
|
|
|
mouseChevronOffset(0),
|
2008-06-23 18:07:57 +02:00
|
|
|
annotationHorzMargin(0),
|
2008-06-23 22:01:29 +02:00
|
|
|
annotationVertMargin(0),
|
|
|
|
|
majorTickHeight(0),
|
|
|
|
|
minorLongTickHeight(0),
|
2008-06-23 22:18:20 +02:00
|
|
|
minorShortTickHeight(0),
|
2008-08-07 21:27:41 +02:00
|
|
|
minDivisionWidth(100),
|
|
|
|
|
timelineWidget(timeline_widget)
|
|
|
|
|
{
|
|
|
|
|
REQUIRE(timelineWidget != NULL);
|
|
|
|
|
|
2008-06-23 18:07:57 +02:00
|
|
|
// Install style properties
|
2008-06-23 22:01:29 +02:00
|
|
|
register_styles();
|
2008-06-19 22:37:36 +02:00
|
|
|
}
|
2008-06-19 00:57:47 +02:00
|
|
|
|
2008-06-20 00:35:53 +02:00
|
|
|
void
|
2008-08-07 21:27:41 +02:00
|
|
|
TimelineRuler::set_mouse_chevron_offset(int offset)
|
2008-06-23 11:54:37 +02:00
|
|
|
{
|
2008-08-07 21:27:41 +02:00
|
|
|
mouseChevronOffset = offset;
|
2008-06-25 21:23:53 +02:00
|
|
|
queue_draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2008-08-07 21:27:41 +02:00
|
|
|
TimelineRuler::update_view()
|
2008-06-25 21:23:53 +02:00
|
|
|
{
|
2008-08-07 21:27:41 +02:00
|
|
|
rulerImage.clear();
|
2008-06-23 11:54:37 +02:00
|
|
|
queue_draw();
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-23 22:01:29 +02:00
|
|
|
void
|
|
|
|
|
TimelineRuler::on_realize()
|
|
|
|
|
{
|
|
|
|
|
Widget::on_realize();
|
2008-06-25 21:23:53 +02:00
|
|
|
|
|
|
|
|
// Set event notifications
|
2008-07-14 21:16:11 +02:00
|
|
|
add_events(Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK);
|
2008-06-23 22:01:29 +02:00
|
|
|
|
|
|
|
|
// Load styles
|
|
|
|
|
read_styles();
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-19 00:57:47 +02:00
|
|
|
bool
|
|
|
|
|
TimelineRuler::on_expose_event(GdkEventExpose* event)
|
2008-06-19 22:37:36 +02:00
|
|
|
{
|
2008-06-25 21:23:53 +02:00
|
|
|
REQUIRE(event != NULL);
|
|
|
|
|
|
2008-06-19 22:37:36 +02:00
|
|
|
// This is where we draw on the window
|
|
|
|
|
Glib::RefPtr<Gdk::Window> window = get_window();
|
|
|
|
|
if(!window)
|
|
|
|
|
return false;
|
2008-06-23 18:07:57 +02:00
|
|
|
|
2008-06-19 22:37:36 +02:00
|
|
|
// Prepare to render via cairo
|
2008-06-25 21:23:53 +02:00
|
|
|
const Allocation allocation = get_allocation();
|
|
|
|
|
|
|
|
|
|
Cairo::RefPtr<Context> cairo = window->create_cairo_context();
|
|
|
|
|
REQUIRE(cairo);
|
|
|
|
|
|
|
|
|
|
// Draw the ruler
|
|
|
|
|
if(!rulerImage)
|
|
|
|
|
{
|
|
|
|
|
// We have no cached rendering - it must be redrawn
|
|
|
|
|
// but do we need ro allocate a new image?
|
|
|
|
|
if(!rulerImage ||
|
|
|
|
|
rulerImage->get_width() != allocation.get_width() ||
|
|
|
|
|
rulerImage->get_height() != allocation.get_height())
|
|
|
|
|
rulerImage = ImageSurface::create(FORMAT_RGB24,
|
|
|
|
|
allocation.get_width(), allocation.get_height());
|
|
|
|
|
|
|
|
|
|
ENSURE(rulerImage);
|
|
|
|
|
|
|
|
|
|
Cairo::RefPtr<Context> image_cairo = Context::create(rulerImage);
|
|
|
|
|
ENSURE(image_cairo);
|
|
|
|
|
|
|
|
|
|
draw_ruler(image_cairo, allocation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw the cached ruler image
|
|
|
|
|
cairo->set_source(rulerImage, 0, 0);
|
|
|
|
|
cairo->paint();
|
|
|
|
|
|
2008-08-07 21:27:41 +02:00
|
|
|
// Draw the overlays
|
2008-06-25 21:23:53 +02:00
|
|
|
draw_mouse_chevron(cairo, allocation);
|
2008-08-07 21:27:41 +02:00
|
|
|
draw_selection(cairo, allocation);
|
2008-06-25 21:23:53 +02:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
TimelineRuler::on_motion_notify_event(GdkEventMotion *event)
|
|
|
|
|
{
|
|
|
|
|
REQUIRE(event != NULL);
|
|
|
|
|
|
2008-07-15 19:36:43 +02:00
|
|
|
set_mouse_chevron_offset(event->x);
|
2008-06-25 21:23:53 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
TimelineRuler::on_size_request (Gtk::Requisition *requisition)
|
|
|
|
|
{
|
|
|
|
|
REQUIRE(requisition != NULL);
|
|
|
|
|
|
|
|
|
|
// Initialize the output parameter
|
|
|
|
|
*requisition = Gtk::Requisition();
|
|
|
|
|
|
|
|
|
|
requisition->width = 0;
|
|
|
|
|
get_style_property("height", requisition->height);
|
|
|
|
|
}
|
2008-06-19 00:57:47 +02:00
|
|
|
|
2008-06-25 21:23:53 +02:00
|
|
|
void
|
|
|
|
|
TimelineRuler::on_size_allocate(Gtk::Allocation& allocation)
|
|
|
|
|
{
|
|
|
|
|
Widget::on_size_allocate(allocation);
|
|
|
|
|
rulerImage.clear(); // The widget has changed size - redraw
|
|
|
|
|
}
|
2008-06-19 22:37:36 +02:00
|
|
|
|
2008-06-25 21:23:53 +02:00
|
|
|
void
|
|
|
|
|
TimelineRuler::draw_ruler(Cairo::RefPtr<Cairo::Context> cairo,
|
2008-08-07 21:27:41 +02:00
|
|
|
const Gdk::Rectangle ruler_rect)
|
2008-06-25 21:23:53 +02:00
|
|
|
{
|
|
|
|
|
REQUIRE(cairo);
|
|
|
|
|
REQUIRE(ruler_rect.get_width() > 0);
|
|
|
|
|
REQUIRE(ruler_rect.get_height() > 0);
|
2008-08-07 21:27:41 +02:00
|
|
|
REQUIRE(timelineWidget != NULL);
|
|
|
|
|
|
|
|
|
|
const gavl_time_t left_offset = timelineWidget->timeOffset;
|
|
|
|
|
const int64_t time_scale = timelineWidget->timeScale;
|
2008-06-25 21:23:53 +02:00
|
|
|
|
|
|
|
|
// Preparation steps
|
|
|
|
|
const int height = ruler_rect.get_height();
|
|
|
|
|
Glib::RefPtr<Pango::Layout> pango_layout = create_pango_layout("");
|
|
|
|
|
Glib::RefPtr<Style> style = get_style();
|
|
|
|
|
|
2008-06-20 00:35:53 +02:00
|
|
|
// Render the background, and clip inside the area
|
2008-06-19 22:37:36 +02:00
|
|
|
Gdk::Cairo::set_source_color(cairo, style->get_bg(STATE_NORMAL));
|
2008-06-23 16:42:14 +02:00
|
|
|
cairo->rectangle(0, 0,
|
2008-06-25 21:23:53 +02:00
|
|
|
ruler_rect.get_width(), ruler_rect.get_height());
|
2008-06-20 00:35:53 +02:00
|
|
|
cairo->fill_preserve();
|
|
|
|
|
cairo->clip();
|
2008-06-19 22:37:36 +02:00
|
|
|
|
2008-06-23 11:54:37 +02:00
|
|
|
// Make sure we don't have impossible zoom
|
2008-08-07 21:27:41 +02:00
|
|
|
if(time_scale <= 0)
|
2008-06-25 21:23:53 +02:00
|
|
|
return;
|
2008-06-23 11:54:37 +02:00
|
|
|
|
2008-06-19 22:37:36 +02:00
|
|
|
// Render ruler annotations
|
2008-06-20 00:35:53 +02:00
|
|
|
Gdk::Cairo::set_source_color(cairo, style->get_fg(STATE_NORMAL));
|
|
|
|
|
|
2008-06-23 16:42:14 +02:00
|
|
|
const gavl_time_t major_spacing = calculate_major_spacing();
|
2008-06-23 18:48:48 +02:00
|
|
|
const gavl_time_t minor_spacing = major_spacing / 10;
|
2008-06-19 22:37:36 +02:00
|
|
|
|
2008-08-07 21:27:41 +02:00
|
|
|
int64_t time_offset = left_offset - left_offset % major_spacing;
|
|
|
|
|
if(left_offset < 0)
|
2008-06-25 21:23:53 +02:00
|
|
|
time_offset -= major_spacing;
|
|
|
|
|
|
2008-06-20 00:35:53 +02:00
|
|
|
int x = 0;
|
2008-08-07 21:27:41 +02:00
|
|
|
const int64_t x_offset = left_offset / time_scale;
|
2008-06-20 00:35:53 +02:00
|
|
|
|
|
|
|
|
do
|
2008-06-19 00:57:47 +02:00
|
|
|
{
|
2008-08-07 21:27:41 +02:00
|
|
|
x = (int)(time_offset / time_scale - x_offset);
|
2008-06-19 00:57:47 +02:00
|
|
|
|
2008-06-20 00:35:53 +02:00
|
|
|
cairo->set_line_width(1);
|
2008-06-19 00:57:47 +02:00
|
|
|
|
2008-06-23 18:48:48 +02:00
|
|
|
if(time_offset % major_spacing == 0)
|
|
|
|
|
{
|
|
|
|
|
// Draw the major grid-line
|
2008-06-23 22:01:29 +02:00
|
|
|
cairo->move_to(x + 0.5, height - majorTickHeight);
|
|
|
|
|
cairo->line_to(x + 0.5, height);
|
2008-06-23 18:48:48 +02:00
|
|
|
cairo->stroke();
|
|
|
|
|
|
|
|
|
|
// Draw the text
|
|
|
|
|
pango_layout->set_text(lumiera_tmpbuf_print_time(time_offset));
|
|
|
|
|
cairo->move_to(annotationHorzMargin + x, annotationVertMargin);
|
|
|
|
|
pango_layout->add_to_cairo_context(cairo);
|
|
|
|
|
cairo->fill();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-06-23 22:01:29 +02:00
|
|
|
// Draw the long or short minor grid-line
|
2008-06-23 18:48:48 +02:00
|
|
|
if(time_offset % (minor_spacing * 2) == 0)
|
2008-06-23 22:01:29 +02:00
|
|
|
cairo->move_to(x + 0.5, height - minorLongTickHeight);
|
2008-06-23 18:48:48 +02:00
|
|
|
else
|
2008-06-23 22:01:29 +02:00
|
|
|
cairo->move_to(x + 0.5, height - minorShortTickHeight);
|
2008-06-23 18:48:48 +02:00
|
|
|
|
2008-06-23 22:01:29 +02:00
|
|
|
cairo->line_to(x + 0.5, height);
|
2008-06-23 18:48:48 +02:00
|
|
|
cairo->stroke();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time_offset += minor_spacing;
|
2008-06-19 00:57:47 +02:00
|
|
|
}
|
2008-06-25 21:23:53 +02:00
|
|
|
while(x < ruler_rect.get_width());
|
2008-06-19 22:37:36 +02:00
|
|
|
}
|
2008-06-23 16:42:14 +02:00
|
|
|
|
2008-06-23 22:01:29 +02:00
|
|
|
void
|
2008-06-25 21:23:53 +02:00
|
|
|
TimelineRuler::draw_mouse_chevron(Cairo::RefPtr<Cairo::Context> cairo,
|
2008-08-07 21:27:41 +02:00
|
|
|
const Gdk::Rectangle ruler_rect)
|
2008-06-23 22:01:29 +02:00
|
|
|
{
|
2008-06-25 21:23:53 +02:00
|
|
|
REQUIRE(cairo);
|
|
|
|
|
REQUIRE(ruler_rect.get_width() > 0);
|
|
|
|
|
REQUIRE(ruler_rect.get_height() > 0);
|
2008-06-23 22:01:29 +02:00
|
|
|
|
2008-07-15 19:36:43 +02:00
|
|
|
// Is the mouse chevron in view?
|
|
|
|
|
if(mouseChevronOffset < 0 ||
|
|
|
|
|
mouseChevronOffset >= ruler_rect.get_width())
|
|
|
|
|
return;
|
|
|
|
|
|
2008-06-25 21:23:53 +02:00
|
|
|
// Set the source colour
|
|
|
|
|
Glib::RefPtr<Style> style = get_style();
|
|
|
|
|
Gdk::Cairo::set_source_color(cairo, style->get_fg(STATE_NORMAL));
|
|
|
|
|
|
2008-07-15 19:36:43 +02:00
|
|
|
cairo->move_to(mouseChevronOffset + 0.5,
|
2008-06-25 21:23:53 +02:00
|
|
|
ruler_rect.get_height());
|
2008-08-07 21:27:41 +02:00
|
|
|
cairo->rel_line_to(-mouseChevronSize, -mouseChevronSize);
|
|
|
|
|
cairo->rel_line_to(2 * mouseChevronSize, 0);
|
2008-06-25 21:23:53 +02:00
|
|
|
|
|
|
|
|
cairo->fill();
|
2008-06-23 22:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
2008-08-07 21:27:41 +02:00
|
|
|
void
|
|
|
|
|
TimelineRuler::draw_selection(Cairo::RefPtr<Cairo::Context> cairo,
|
|
|
|
|
const Gdk::Rectangle ruler_rect)
|
|
|
|
|
{
|
|
|
|
|
REQUIRE(cairo);
|
|
|
|
|
REQUIRE(ruler_rect.get_width() > 0);
|
|
|
|
|
REQUIRE(ruler_rect.get_height() > 0);
|
|
|
|
|
REQUIRE(timelineWidget != NULL);
|
|
|
|
|
|
|
|
|
|
Glib::RefPtr<Style> style = get_style();
|
|
|
|
|
Gdk::Cairo::set_source_color(cairo, style->get_fg(STATE_NORMAL));
|
|
|
|
|
|
|
|
|
|
// Draw the selection start chevron
|
|
|
|
|
const int a = timelineWidget->time_to_x(
|
|
|
|
|
timelineWidget->selectionStart) + 1;
|
|
|
|
|
if(a >= 0 && a < ruler_rect.get_width())
|
|
|
|
|
{
|
|
|
|
|
cairo->move_to(a, ruler_rect.get_height());
|
|
|
|
|
cairo->rel_line_to(0, -mouseChevronSize);
|
|
|
|
|
cairo->rel_line_to(-mouseChevronSize, 0);
|
|
|
|
|
cairo->fill();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw the selection end chevron
|
|
|
|
|
const int b = timelineWidget->time_to_x(
|
|
|
|
|
timelineWidget->selectionEnd);
|
|
|
|
|
if(b >= 0 && b < ruler_rect.get_width())
|
|
|
|
|
{
|
|
|
|
|
cairo->move_to(b, ruler_rect.get_height());
|
|
|
|
|
cairo->rel_line_to(0, -mouseChevronSize);
|
|
|
|
|
cairo->rel_line_to(mouseChevronSize, 0);
|
|
|
|
|
cairo->fill();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-23 16:42:14 +02:00
|
|
|
gavl_time_t
|
|
|
|
|
TimelineRuler::calculate_major_spacing() const
|
|
|
|
|
{
|
2008-08-07 21:27:41 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
REQUIRE(timelineWidget != NULL);
|
2008-06-23 16:42:14 +02:00
|
|
|
|
2008-08-07 21:27:41 +02:00
|
|
|
const int64_t time_scale = timelineWidget->timeScale;
|
2008-06-23 16:42:14 +02:00
|
|
|
const gavl_time_t major_spacings[] = {
|
|
|
|
|
GAVL_TIME_SCALE / 1000,
|
|
|
|
|
GAVL_TIME_SCALE / 400,
|
|
|
|
|
GAVL_TIME_SCALE / 200,
|
|
|
|
|
GAVL_TIME_SCALE / 100,
|
|
|
|
|
GAVL_TIME_SCALE / 40,
|
|
|
|
|
GAVL_TIME_SCALE / 20,
|
|
|
|
|
GAVL_TIME_SCALE / 10,
|
|
|
|
|
GAVL_TIME_SCALE / 4,
|
|
|
|
|
GAVL_TIME_SCALE / 2,
|
|
|
|
|
GAVL_TIME_SCALE,
|
|
|
|
|
2l * GAVL_TIME_SCALE,
|
|
|
|
|
5l * GAVL_TIME_SCALE,
|
|
|
|
|
10l * GAVL_TIME_SCALE,
|
|
|
|
|
15l * GAVL_TIME_SCALE,
|
|
|
|
|
30l * GAVL_TIME_SCALE,
|
|
|
|
|
60l * GAVL_TIME_SCALE,
|
|
|
|
|
2l * 60l * GAVL_TIME_SCALE,
|
|
|
|
|
5l * 60l * GAVL_TIME_SCALE,
|
|
|
|
|
10l * 60l * GAVL_TIME_SCALE,
|
|
|
|
|
15l * 60l * GAVL_TIME_SCALE,
|
|
|
|
|
30l * 60l * GAVL_TIME_SCALE,
|
|
|
|
|
60l * 60l * GAVL_TIME_SCALE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof(major_spacings) / sizeof(gavl_time_t); i++)
|
|
|
|
|
{
|
2008-08-07 21:27:41 +02:00
|
|
|
const int64_t division_width = major_spacings[i] / time_scale;
|
2008-06-23 16:42:14 +02:00
|
|
|
|
2008-06-23 22:18:20 +02:00
|
|
|
if(division_width > minDivisionWidth)
|
2008-06-23 16:42:14 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return major_spacings[i];
|
|
|
|
|
}
|
2008-06-23 18:07:57 +02:00
|
|
|
|
2008-06-23 22:01:29 +02:00
|
|
|
void
|
|
|
|
|
TimelineRuler::register_styles() const
|
|
|
|
|
{
|
|
|
|
|
GtkWidgetClass *klass = GTK_WIDGET_CLASS(G_OBJECT_GET_CLASS(gobj()));
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
|
|
|
|
g_param_spec_int("height",
|
2008-06-23 22:18:20 +02:00
|
|
|
"Height of the Ruler Widget",
|
|
|
|
|
"The height of the ruler widget in pixels.",
|
|
|
|
|
0, G_MAXINT, 18, G_PARAM_READABLE));
|
|
|
|
|
|
2008-06-23 22:01:29 +02:00
|
|
|
gtk_widget_class_install_style_property(klass,
|
2008-06-23 22:18:20 +02:00
|
|
|
g_param_spec_int("major_tick_height",
|
|
|
|
|
"Height of Major Ticks",
|
|
|
|
|
"The length of major ticks in pixels.",
|
|
|
|
|
0, G_MAXINT, 18, G_PARAM_READABLE));
|
2008-06-23 22:01:29 +02:00
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
2008-06-23 22:18:20 +02:00
|
|
|
g_param_spec_int("minor_long_tick_height",
|
|
|
|
|
"Height of Long Minor Ticks",
|
|
|
|
|
"The length of long minor ticks in pixels.",
|
|
|
|
|
0, G_MAXINT, 6, G_PARAM_READABLE));
|
2008-06-23 22:01:29 +02:00
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
2008-06-23 22:18:20 +02:00
|
|
|
g_param_spec_int("minor_short_tick_height",
|
|
|
|
|
"Height of Short Minor Ticks",
|
|
|
|
|
"The length of short minor ticks in pixels.",
|
|
|
|
|
0, G_MAXINT, 3, G_PARAM_READABLE));
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
|
|
|
|
g_param_spec_int("annotation_horz_margin",
|
|
|
|
|
"Horizontal margin around annotation text",
|
|
|
|
|
"The horizontal margin around the annotation text in pixels.",
|
|
|
|
|
0, G_MAXINT, 3,
|
|
|
|
|
G_PARAM_READABLE));
|
2008-06-23 22:01:29 +02:00
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
2008-06-23 22:18:20 +02:00
|
|
|
g_param_spec_int("annotation_vert_margin",
|
|
|
|
|
"Vertical margin around annotation text",
|
|
|
|
|
"The vertical margin around the annotation text in pixels.",
|
|
|
|
|
0, G_MAXINT, 0, G_PARAM_READABLE));
|
2008-06-23 22:01:29 +02:00
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
2008-06-23 22:18:20 +02:00
|
|
|
g_param_spec_int("min_division_width",
|
|
|
|
|
"Minimum Division Width",
|
|
|
|
|
"The minimum distance in pixels that two major division may approach.",
|
|
|
|
|
0, G_MAXINT, 100, G_PARAM_READABLE));
|
2008-06-25 21:23:53 +02:00
|
|
|
|
|
|
|
|
gtk_widget_class_install_style_property(klass,
|
|
|
|
|
g_param_spec_int("mouse_chevron_size",
|
|
|
|
|
"Mouse Chevron Size",
|
|
|
|
|
"The height of the mouse chevron in pixels.",
|
|
|
|
|
0, G_MAXINT, 5, G_PARAM_READABLE));
|
2008-06-23 22:01:29 +02:00
|
|
|
}
|
|
|
|
|
|
2008-06-23 18:07:57 +02:00
|
|
|
void
|
|
|
|
|
TimelineRuler::read_styles()
|
|
|
|
|
{
|
|
|
|
|
get_style_property("annotation_horz_margin", annotationHorzMargin);
|
2008-06-23 22:01:29 +02:00
|
|
|
get_style_property("annotation_vert_margin", annotationVertMargin);
|
|
|
|
|
get_style_property("major_tick_height", majorTickHeight);
|
|
|
|
|
get_style_property("minor_long_tick_height", minorLongTickHeight);
|
|
|
|
|
get_style_property("minor_short_tick_height", minorShortTickHeight);
|
2008-06-23 22:18:20 +02:00
|
|
|
get_style_property("min_division_width", minDivisionWidth);
|
2008-06-25 21:23:53 +02:00
|
|
|
get_style_property("mouse_chevron_size", mouseChevronSize);
|
2008-06-23 18:07:57 +02:00
|
|
|
}
|
2008-06-19 00:57:47 +02:00
|
|
|
|
|
|
|
|
} // namespace timeline
|
|
|
|
|
} // namespace widgets
|
|
|
|
|
} // namespace gui
|
|
|
|
|
} // namespace lumiera
|