Lumiera  0.pre.03
»edit your freedom«
timeline-zoom-scale.cpp
Go to the documentation of this file.
1 /*
2  TimelineZoomScale - widget to control timeline zoom scale
3 
4  Copyright (C)
5  2011, Michael R. Fisher <mfisher31@gmail.com>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 * *****************************************************************/
13 
14 
24 //#include "stage/widget/timeline-widget.hpp" /////////////////////////////////////////////////////////////TODO old GTK-2 UI is defunct (3/23)
26 
27 using namespace Gtk;
28 
29 namespace stage {
30 namespace widget {
31 
32 class TimelineWidget;
33 
34 namespace timeline {
35 
60  TimelineZoomScale::TimelineZoomScale()
61  : HBox()
62  , adjustment(Gtk::Adjustment::create(0.5, 0.0, 1.0, 0.000001))
63  , slider()
64  , zoomIn(Stock::ZOOM_IN)
65  , zoomOut(Stock::ZOOM_OUT)
66  , button_step_size(0.03)
67  {
68  /* Setup the Slider Control */
69  slider.set_adjustment (adjustment);
70  slider.set_size_request (123,10);
71  slider.set_digits (6);
72 
73  /* Inverted because smaller values "zoom in" */
74  slider.set_inverted (true);
75 
76  slider.set_draw_value (false);
77 
78  /* Make our connections */
79  zoomIn.signal_clicked().
80  connect (sigc::mem_fun(this, &TimelineZoomScale::on_zoom_in_clicked));
81  zoomOut.signal_clicked().
82  connect (sigc::mem_fun(this, &TimelineZoomScale::on_zoom_out_clicked));
83  adjustment->signal_value_changed().
84  connect (sigc::mem_fun(this, &TimelineZoomScale::on_zoom));
85 
86  /* Add Our Widgets and show them */
87  pack_start (zoomOut,PACK_SHRINK);
88  pack_start (slider,PACK_SHRINK);
89  pack_start (zoomIn,PACK_SHRINK);
90 
91  show_all();
92  }
93 
94 
95  void
96  TimelineZoomScale::wireTimelineState (shared_ptr<TimelineState> currentState
97 // TimelineWidget::TimelineStateChangeSignal stateChangeSignal ////////////TODO defunct
98  )
99  {
100  on_timeline_state_changed (currentState);
101 // stateChangeSignal.connect (
102 // sigc::mem_fun(this, &TimelineZoomScale::on_timeline_state_changed));
103  }
104 
105 
106  void
108  {
109  REQUIRE (newState);
110  timelineState = newState;
111 
112 // adjustment->set_value (getViewWindow().get_smoothed_time_scale());
113  }
114 
115 
116  void
118  {
119  double newValue = adjustment->get_value() - button_step_size;
120  adjustment->set_value(newValue);
121  }
122 
123 
124  void
126  {
127  double newValue = adjustment->get_value() + button_step_size;
128  adjustment->set_value(newValue);
129  }
130 
131 
132  void
134  {
135  zoomSignal.emit (adjustment->get_value());
136  }
137 
138 
139  sigc::signal<void, double>
140  TimelineZoomScale::signal_zoom()
141  {
142  return zoomSignal;
143  }
144 
145 
148  {
149  REQUIRE (timelineState, "lifecycle error");
150  return timelineState->getViewWindow();
151  }
152 
153 
154 }}}// namespace stage::widget::timeline
void on_timeline_state_changed(shared_ptr< TimelineState > newState)
Update the slider position when the timeline state is changed.
void on_zoom_in_clicked()
Event handler for when the zoomIn Button is clicked.
void on_zoom_out_clicked()
Event handler for when the zoomIn Button is clicked.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
TimelineViewWindow & getViewWindow()
access current timeline state
Widget to control timeline zoom scale.
void on_zoom()
Event handler for when the adjustment value is changed.