Author: Yu Chen <[email protected]>
Date:   Tue Feb  7 13:02:47 2012 +0800

Enable preview window scrollable

---

 synfig-studio/src/gui/preview.cpp |   10 +++++++++-
 synfig-studio/src/gui/preview.h   |   19 ++++++++++---------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/synfig-studio/src/gui/preview.cpp 
b/synfig-studio/src/gui/preview.cpp
index a4c6637..9a60d9a 100644
--- a/synfig-studio/src/gui/preview.cpp
+++ b/synfig-studio/src/gui/preview.cpp
@@ -312,6 +312,12 @@ Widget_Preview::Widget_Preview():
        //signal_expose_event().connect(sigc::mem_fun(*this, 
&studio::Widget_Preview::redraw));
 
        //manage all the change in values etc...
+
+       //1st row: preview content
+       preview_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+       //pack preview content into scrolled window
+       preview_window.add(draw_area);
+
        
adj_time_scrub.signal_value_changed().connect(sigc::mem_fun(*this,&Widget_Preview::slider_move));
        
scr_time_scrub.signal_event().connect(sigc::mem_fun(*this,&Widget_Preview::scroll_move_event));
        
draw_area.signal_expose_event().connect(sigc::mem_fun(*this,&Widget_Preview::redraw));
@@ -461,7 +467,7 @@ Widget_Preview::Widget_Preview():
        disp_sound.set_size_request(-1,32);
 
        // attach all widgets   
-       attach(draw_area, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, 
Gtk::EXPAND|Gtk::FILL, 0);
+       attach(preview_window, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, 
Gtk::EXPAND|Gtk::FILL, 0);
        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);
@@ -627,6 +633,8 @@ bool studio::Widget_Preview::redraw(GdkEventExpose */*heh*/)
 
        pxnew = px->scale_simple(nw, nh, Gdk::INTERP_NEAREST);
 
+       draw_area.set_size_request(nw, nh);
+
        //synfig::info("Now to draw to the window...");
        //copy to window
        Glib::RefPtr<Gdk::Window>       wind = draw_area.get_window();
diff --git a/synfig-studio/src/gui/preview.h b/synfig-studio/src/gui/preview.h
index 5b1218e..0e720a0 100644
--- a/synfig-studio/src/gui/preview.h
+++ b/synfig-studio/src/gui/preview.h
@@ -172,13 +172,13 @@ class Widget_Preview : public Gtk::Table
 //     Gtk::HScrollbar         scr_time_scrub;
        Gtk::HScale             scr_time_scrub;
        Gtk::ToggleButton       b_loop;
-//     Gtk::ComboBoxEntry      zoom_preview;
+       Gtk::ScrolledWindow     preview_window;
        //Glib::RefPtr<Gdk::GC>         gc_area;
        Glib::RefPtr<Gdk::Pixbuf>       currentbuf;
-       int                                                     currentindex;
-       //double                                                timeupdate;
-       double                                          timedisp;
-       double                                          audiotime;
+       int                             currentindex;
+       //double                        timeupdate;
+       double                          timedisp;
+       double                          audiotime;
 
        //sound stuff
        etl::handle<AudioContainer>     audio;
@@ -188,12 +188,12 @@ class Widget_Preview : public Gtk::Table
 
        //preview encapsulation
        etl::handle<Preview>    preview;
-       sigc::connection                prevchanged;
+       sigc::connection        prevchanged;
 
-       Widget_Sound                    disp_sound;
-       Gtk::Adjustment                 adj_sound;
+       Widget_Sound            disp_sound;
+       Gtk::Adjustment         adj_sound;
 
-       Gtk::Label                              l_lasttime;
+       Gtk::Label              l_lasttime;
 
        //only for internal stuff, doesn't set anything
        bool    playing;
@@ -259,6 +259,7 @@ public:
        void set_loop_flag(bool b) {return b_loop.set_active(b);}
 
 protected:
+
        class ModelColumns : public Gtk::TreeModel::ColumnRecord
        {
        public:


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to