Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
timecode-widget.hpp
Go to the documentation of this file.
1/*
2 TIMECODE-WIDGET.hpp - widget for timecode display / input
3
4 Copyright (C) Ardour.org
5 1999, Paul Davis
6
7 Copyright (C)
8 2010, Stefan Kangas <skangas@skangas.se
9
10  **Lumiera** is free software; you can redistribute it and/or modify it
11  under the terms of the GNU General Public License as published by the
12  Free Software Foundation; either version 2 of the License, or (at your
13  option) any later version. See the file COPYING for further details.
14
15*/
16
17
36#ifndef STAGE_WIDGET_TIMECODE_WIDGET_H
37#define STAGE_WIDGET_TIMECODE_WIDGET_H
38
39#include "stage/gtk-base.hpp"
41
42#include <string>
43
44
45namespace stage {
46namespace widget {
47
48 using lib::time::Time;
51
52 using std::string;
53
54
60 : public Gtk::HBox
61 {
62 public:
69
70
71 TimeCode (string clock_name
72 ,string widget_name
73 ,bool editable
74// , bool is_duration = false
75 );
76
77
78 Mode mode() const { return _mode; }
79
80 void focus();
81
82 void set(Time when, bool force = false);
83 void set_mode(Mode);
84
85 void set_widget_name(string);
86
87 string name() const { return _name; }
88
89 Time current_time (Time position = Time::ZERO) const;
90 Time current_duration (Time position = Time::ZERO) const;
91
92 sigc::signal<void> ValueChanged;
93 sigc::signal<void> ChangeAborted;
94
95 static sigc::signal<void> ModeChanged;
96 // static std::vector<TimeCode*> clocks;
97
98 static bool has_focus() { return _has_focus; }
99
100
101 private:
104 string _name;
105 // bool is_duration;
107
108 Gtk::Menu* ops_menu;
109
111 Gtk::HBox smpte_packer;
112
114 Gtk::HBox minsec_packer;
115
117 Gtk::HBox frames_packer;
118
129
130 Gtk::EventBox audio_frames_ebox;
132
133 Gtk::HBox off_hbox;
134
135 Gtk::EventBox hours_ebox;
136 Gtk::EventBox minutes_ebox;
137 Gtk::EventBox seconds_ebox;
138 Gtk::EventBox frames_ebox;
139
140 Gtk::EventBox ms_hours_ebox;
141 Gtk::EventBox ms_minutes_ebox;
142 Gtk::EventBox ms_seconds_ebox;
143
144 Gtk::Label hours_label;
145 Gtk::Label minutes_label;
146 Gtk::Label seconds_label;
147 Gtk::Label frames_label;
148 Gtk::Label colon1, colon2, colon3;
149
150 Gtk::Label ms_hours_label;
153 Gtk::Label colon4, colon5;
154
155 Gtk::EventBox clock_base;
156 Gtk::Frame clock_frame;
157
161
167
171
174 double drag_y;
176
177 void on_realize();
178
179 bool field_motion_notify_event (GdkEventMotion *ev, Field);
180 bool field_button_press_event (GdkEventButton *ev, Field);
181 bool field_button_release_event (GdkEventButton *ev, Field);
182 bool field_button_scroll_event (GdkEventScroll *ev, Field);
183 bool field_key_press_event (GdkEventKey *ev, Field);
184 bool field_key_release_event (GdkEventKey *ev, Field);
185 bool field_focus_gain_event (GdkEventFocus*, Field);
186 bool field_focus_loss_event (GdkEventFocus*, Field);
187 bool drop_focus_handler (GdkEventFocus *ev);
188
189 void set_smpte (Time, bool);
190 void set_minsec (Time, bool);
191 void set_frames (Time, bool);
192
193 int get_frames (Field, Time pos = Time::ZERO, int dir=1);
194
199
200 void build_ops_menu();
201 void setup_events();
202
204 void set_size_requests();
205
206 static const uint field_length[(int)VFrames+1];
207 static bool _has_focus;
208
209 void set_size_request_to_display_given_text (Gtk::Widget &w, const gchar *text, gint hpadding, gint vpadding);
210 void get_ink_pixel_size (Glib::RefPtr<Pango::Layout> layout, int& width, int& height);
211 };
212
213
214
215}}// stage::widget
216#endif /*STAGE_WIDGET_TIMECODE_WIDGET_H*/
basic constant internal time value.
a mutable time value, behaving like a plain number, allowing copy and re-accessing
Lumiera's internal time value datatype.
static const Time ZERO
Widget for timecode input and display.
sigc::signal< void > ValueChanged
Time current_time(Time position=Time::ZERO) const
Time current_duration(Time position=Time::ZERO) const
bool field_key_release_event(GdkEventKey *ev, Field)
sigc::signal< void > ChangeAborted
bool field_button_scroll_event(GdkEventScroll *ev, Field)
bool drop_focus_handler(GdkEventFocus *ev)
void set_size_request_to_display_given_text(Gtk::Widget &w, const gchar *text, gint hpadding, gint vpadding)
int get_frames(Field, Time pos=Time::ZERO, int dir=1)
void get_ink_pixel_size(Glib::RefPtr< Pango::Layout > layout, int &width, int &height)
bool field_key_press_event(GdkEventKey *ev, Field)
static sigc::signal< void > ModeChanged
bool field_focus_gain_event(GdkEventFocus *, Field)
bool field_motion_notify_event(GdkEventMotion *ev, Field)
bool field_focus_loss_event(GdkEventFocus *, Field)
bool field_button_press_event(GdkEventButton *ev, Field)
void set(Time when, bool force=false)
static const uint field_length[(int) VFrames+1]
bool field_button_release_event(GdkEventButton *ev, Field)
A set of basic GTK includes for the UI.
unsigned int uint
Definition integral.hpp:29
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
a family of time value like entities and their relationships.