Author: Yu Chen <jco...@gmail.com>
Date:   Fri Dec 30 05:41:06 2011 +0800

Cleanup code

---

 synfig-studio/src/gui/preview.cpp |   95 +++++++++++++++++--------------------
 1 files changed, 44 insertions(+), 51 deletions(-)

diff --git a/synfig-studio/src/gui/preview.cpp 
b/synfig-studio/src/gui/preview.cpp
index 0268713..5005a4e 100644
--- a/synfig-studio/src/gui/preview.cpp
+++ b/synfig-studio/src/gui/preview.cpp
@@ -297,16 +297,16 @@ void studio::Preview::frame_finish(const Preview_Target 
*targ)
        icon->set_padding(0,0); \
        icon->show();
 
-Widget_Preview::Widget_Preview()
-:Gtk::Table(5,4,false),
-adj_time_scrub(0,0,1000,0,10,0),
-scr_time_scrub(adj_time_scrub),
-b_loop(/*_("Loop")*/),
-currentindex(0),
-audiotime(0),
-adj_sound(0,0,4),
-l_lasttime("0s"),
-playing(false)
+Widget_Preview::Widget_Preview():
+       Gtk::Table(5, 4, false),
+       adj_time_scrub(0,0,1000,0,10,0),
+       scr_time_scrub(adj_time_scrub),
+       b_loop(/*_("Loop")*/),
+       currentindex(0),
+       audiotime(0),
+       adj_sound(0,0,4),
+       l_lasttime("0s"),
+       playing(false)
 {
        //connect to expose events
        //signal_expose_event().connect(sigc::mem_fun(*this, 
&studio::Widget_Preview::redraw));
@@ -341,21 +341,14 @@ playing(false)
        |sound                                                  |
        */
 
-       Gtk::HBox *hbox = 0;
        Gtk::Button *button = 0;
        Gtk::Image *icon = 0;
 
-       //should set up the dialog using attach etc.
-       attach(draw_area, 0, 1, 0, 1);
-       attach(scr_time_scrub, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
-
        #if 1
 
-       //2nd row
-       hbox = manage(new Gtk::HBox);
+       //2nd row: prevframe play/pause nextframe loop | halt-render re-preview 
erase-all  
+       Gtk::HBox *controller = manage(new Gtk::HBox);
 
-       //prevframe play/pause nextframe buttons
-       
        //prev rendered frame
        Gtk::Button *prev_framebutton;
        Gtk::Image *icon0 = manage(new 
Gtk::Image(Gtk::StockID("synfig-animate_seek_prev_frame"), 
Gtk::ICON_SIZE_BUTTON));
@@ -368,7 +361,7 @@ playing(false)
        prev_framebutton->show();
        
prev_framebutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,&Widget_Preview::seek_frame),
 -1));
 
-       hbox->pack_start(*prev_framebutton, Gtk::PACK_SHRINK, 0);
+       controller->pack_start(*prev_framebutton, Gtk::PACK_SHRINK, 0);
 
        //play pause
        Gtk::Image *icon1 = manage(new 
Gtk::Image(Gtk::StockID("synfig-animate_play"), Gtk::ICON_SIZE_BUTTON));
@@ -380,7 +373,8 @@ playing(false)
        play_pausebutton->set_relief(Gtk::RELIEF_NONE);
        play_pausebutton->show();
        
play_pausebutton->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::on_play_pause_pressed));
-       hbox->pack_start(*play_pausebutton, Gtk::PACK_SHRINK, 0);
+
+       controller->pack_start(*play_pausebutton, Gtk::PACK_SHRINK, 0);
 
        //next rendered frame
        Gtk::Button *next_framebutton;
@@ -394,60 +388,59 @@ playing(false)
        next_framebutton->show();
        
next_framebutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,&Widget_Preview::seek_frame),1));
 
-       hbox->pack_start(*next_framebutton, Gtk::PACK_SHRINK, 0);
+       controller->pack_start(*next_framebutton, Gtk::PACK_SHRINK, 0);
 
-       //space between next frame button and loop button
+       //todo: add a space between next frame button and loop button
         
        button = &b_loop;
        IMAGIFY_BUTTON(button,"synfig-animate_loop",_("Loop"));
-       hbox->pack_start(b_loop,Gtk::PACK_SHRINK,0);
-       //attach(b_loop,0,1,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
+       controller->pack_start(b_loop,Gtk::PACK_SHRINK,0);
 
-       //attack the stop render and erase all buttons to same line...
-       
+       // separator
        Gtk::VSeparator *vsep = manage(new Gtk::VSeparator);
-       hbox->pack_start(*vsep,Gtk::PACK_SHRINK,0);
 
+       controller->pack_start(*vsep,Gtk::PACK_SHRINK,0);
 
+       //halt render
        button = manage(new Gtk::Button(/*_("Halt Render")*/));
        
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::stoprender));
        IMAGIFY_BUTTON(button,Gtk::Stock::STOP,_("Halt Render"));
-       hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
-       //attach(*button,2,3,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
 
+       controller->pack_start(*button,Gtk::PACK_SHRINK,0);
+
+       //re-preview
        button = manage(new Gtk::Button(/*_("Re-Preview")*/));
        
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::repreview));
        IMAGIFY_BUTTON(button,Gtk::Stock::EDIT,_("Re-Preview"));
-       hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
-       //attach(*button,0,2,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
 
+       controller->pack_start(*button,Gtk::PACK_SHRINK,0);
+
+       //erase all
        button = manage(new Gtk::Button(/*_("Erase All")*/));
        
button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::eraseall));
        IMAGIFY_BUTTON(button,Gtk::Stock::CLEAR,_("Erase All"));
-       hbox->pack_start(*button,Gtk::PACK_SHRINK,0);
-       //attach(*button,2,3,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
 
-       hbox->show_all();
-       attach(*hbox,0,1,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
+       controller->pack_start(*button,Gtk::PACK_SHRINK,0);
 
-       //3rd row
-       hbox = manage(new Gtk::HBox);
-       {
-               Gtk::Label *label = manage(new Gtk::Label(_("Last Rendered: 
")));
-               //label->show();
-               hbox->pack_start(*label,Gtk::PACK_SHRINK,10);
-               //attach(*manage(new Gtk::Label(_("Last Rendered: 
"))),0,1,3,4,Gtk::SHRINK,Gtk::SHRINK);
-       }
+       controller->show_all();
+
+       //3rd row: last rendered frame
+       Gtk::HBox *lastrendered = manage(new Gtk::HBox);
+       Gtk::Label *label = manage(new Gtk::Label(_("Last Rendered: ")));
+       lastrendered->pack_start(*label,Gtk::PACK_SHRINK,10);
        //l_lasttime.show();
-       hbox->pack_start(l_lasttime,Gtk::PACK_SHRINK,0);
-       hbox->show_all();
-       attach(*hbox,0,1,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
-       attach(l_lasttime,0,1,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
+       lastrendered->pack_start(l_lasttime,Gtk::PACK_SHRINK,0);
+       lastrendered->show_all();
 
-       //5th row
-       //disp_sound.set_size_request(-1,32);
-       //attach(disp_sound,0,1,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
+       //5th row: sound track
+       disp_sound.set_size_request(-1,32);
 
+       // attach all widgets   
+       attach(draw_area, 0, 1, 0, 1);
+       attach(scr_time_scrub, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
+       attach(*controller,0,1,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
+       attach(*lastrendered,0,1,3,4,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
+//     attach(disp_sound,0,1,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK);
        show_all();
 
        //if(draw_area.get_window()) gc_area = 
Gdk::GC::create(draw_area.get_window());


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to