Alter the font size of the timeslider
authorCarlos Lopez <carlos@pcnuevo.(none)>
Wed, 22 Jul 2009 20:53:43 +0000 (22:53 +0200)
committerCarlos Lopez <carlos@pcnuevo.(none)>
Wed, 22 Jul 2009 20:53:43 +0000 (22:53 +0200)
synfig-studio/trunk/src/gtkmm/canvasview.cpp
synfig-studio/trunk/src/gtkmm/dock_timetrack.cpp
synfig-studio/trunk/src/gtkmm/widget_timeslider.cpp

index 6e40ea1..53a6ccc 100644 (file)
@@ -966,13 +966,11 @@ CanvasView::create_time_bar()
        //Widget_Timeslider *time_scroll = manage(new Widget_Timeslider);
        timeslider->set_time_adjustment(&time_adjustment());
        timeslider->set_bounds_adjustment(&time_window_adjustment());
-       //timeslider->set_size_request(-1,12);
        //layout_table->attach(*timeslider, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL);
        //Setup the keyframe list widget
        widget_kf_list->set_time_adjustment(&time_adjustment());
        widget_kf_list->set_canvas_interface(canvas_interface());
        widget_kf_list->show();
-       widget_kf_list->set_size_request(-1,8);
 
        tooltips.set_tip(*time_window_scroll,_("Moves the time window"));
        tooltips.set_tip(*timeslider,_("Changes the current time"));
@@ -1042,12 +1040,21 @@ CanvasView::create_time_bar()
 
        timebar = Gtk::manage(new class Gtk::Table(5, 4, false));
 
+       //Adjust both widgets to be the same as the
+       int header_height = 0;
+       if(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT"))
+               header_height = atoi(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT"));
+       if (header_height < 3)
+               header_height = 24;
+       timeslider->set_size_request(-1,header_height-header_height/3+1);
+       widget_kf_list->set_size_request(-1,header_height/3+1);
+
        //Attach widgets to the timebar
        //timebar->attach(*manage(disp_audio), 1, 5, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
        timebar->attach(*current_time_widget, 0, 1, 0, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
        timebar->attach(*framedial, 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK);
-       timebar->attach(*timeslider, 1, 3, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL);
-       timebar->attach(*widget_kf_list, 1, 3, 0, 1, Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL);
+       timebar->attach(*timeslider, 1, 3, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::SHRINK);
+       timebar->attach(*widget_kf_list, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
        timebar->attach(*time_window_scroll, 1, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
        timebar->attach(*keyframedial, 3, 4, 0, 2, Gtk::SHRINK, Gtk::SHRINK);
        timebar->attach(*animatebutton, 4, 5, 0, 2, Gtk::SHRINK, Gtk::SHRINK);
index 1255cd2..7a6139a 100644 (file)
@@ -509,7 +509,7 @@ Dock_Timetrack::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_v
                vscrollbar_->set_adjustment(*tree_view->get_vadjustment());
                hscrollbar_->set_adjustment(canvas_view->time_window_adjustment());
                table_=new Gtk::Table(2,3);
-               table_->attach(*widget_timeslider_, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
+               table_->attach(*widget_timeslider_, 0, 1, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::SHRINK);
                table_->attach(*widget_kf_list_, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
                table_->attach(*tree_view, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
                table_->attach(*hscrollbar_, 0, 1, 3, 4, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK);
index 1687371..ed5d63c 100644 (file)
@@ -576,6 +576,16 @@ bool Widget_Timeslider::redraw(bool /*doublebuffer*/)
 
                        //gc->set_rgb_fg_color(Gdk::Color("#000000"));
                        layout->set_text(timecode);
+                       Pango::AttrList attr_list;
+                       // Aproximately a font size of 8 pixels.
+                       // Pango::SCALE = 1024
+                       // create_attr_size waits a number in 1000th of pixels.
+                       // Should be user customizable in the future. Now it is fixed to 10
+                       Pango::AttrInt pango_size(Pango::Attribute::create_attr_size(Pango::SCALE*10));
+                       pango_size.set_start_index(0);
+                       pango_size.set_end_index(64);
+                       attr_list.change(pango_size);
+                       layout->set_attributes(attr_list);
                        window->draw_layout(gc,xpx+2,0,layout);
                }else
                {