finally got around to fix this annoying 'flickering' while using the
* include/Frame_Resizer_Base.h, include/Frame_Resizer_Extended.h, src/Frame_Resizer_Base.cc, src/Frame_Resizer_Extended.cc: finally got around to fix this annoying 'flickering' while using the resizer :)
This commit is contained in:
parent
e093c745bf
commit
d375f5bf4e
|
@ -1,3 +1,10 @@
|
|||
2005-01-25 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/Frame_Resizer_Base.h,
|
||||
include/Frame_Resizer_Extended.h,
|
||||
src/Frame_Resizer_Base.cc,
|
||||
src/Frame_Resizer_Extended.cc: finally got around to fix this annoying 'flickering' while using the resizer :)
|
||||
|
||||
2005-01-23 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* src/GParted_Core.cc: write actually used libpartedversion to stdout on startup. (usefull for debugging)
|
||||
|
|
|
@ -53,8 +53,7 @@ public:
|
|||
|
||||
virtual void Draw_Partition( ) ;
|
||||
|
||||
|
||||
//public signal (emitted upon resize/move)
|
||||
//public signals (emitted upon resize/move)
|
||||
sigc::signal<void,int,int, ArrowType> signal_resize;
|
||||
sigc::signal<void,int,int> signal_move;
|
||||
|
||||
|
@ -73,7 +72,9 @@ protected:
|
|||
void Draw_Resize_Grip( ArrowType ) ;
|
||||
|
||||
Gtk::DrawingArea drawingarea ;
|
||||
Glib::RefPtr<Gdk::GC> gc;
|
||||
Glib::RefPtr<Gdk::GC> gc_drawingarea ;
|
||||
Glib::RefPtr<Gdk::Pixmap> pixmap ;
|
||||
Glib::RefPtr<Gdk::GC> gc_pixmap ;
|
||||
|
||||
Gdk::Color color_used, color_unused, color_arrow, color_background, color_partition, color_arrow_rectangle;
|
||||
|
||||
|
|
|
@ -26,14 +26,12 @@ class Frame_Resizer_Extended : public Frame_Resizer_Base
|
|||
public:
|
||||
Frame_Resizer_Extended( ) ;
|
||||
|
||||
|
||||
private:
|
||||
int UNUSED_BEFORE ;
|
||||
//overridden signal handler
|
||||
virtual bool drawingarea_on_mouse_motion( GdkEventMotion* ) ;
|
||||
|
||||
virtual void Draw_Partition( ) ;
|
||||
|
||||
};
|
||||
|
||||
#endif // FRAME_RESIZER_EXTENDED
|
||||
|
|
|
@ -123,9 +123,9 @@ int Frame_Resizer_Base::get_x_end( )
|
|||
|
||||
void Frame_Resizer_Base::drawingarea_on_realize( )
|
||||
{
|
||||
gc = Gdk::GC::create( drawingarea .get_window( ) );
|
||||
|
||||
drawingarea .get_window( ) ->set_background( color_background );
|
||||
gc_drawingarea = Gdk::GC::create( drawingarea .get_window( ) );
|
||||
pixmap = Gdk::Pixmap::create( drawingarea .get_window( ), drawingarea .get_allocation( ). get_width( ), drawingarea. get_allocation( ). get_height( ) );
|
||||
gc_pixmap = Gdk::GC::create( pixmap );
|
||||
|
||||
drawingarea .add_events( Gdk::POINTER_MOTION_MASK );
|
||||
drawingarea .add_events( Gdk::BUTTON_PRESS_MASK );
|
||||
|
@ -207,7 +207,7 @@ bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev )
|
|||
|
||||
bool Frame_Resizer_Base::drawingarea_on_button_release_event( GdkEventButton *ev )
|
||||
{
|
||||
GRIP_LEFT = false ; GRIP_RIGHT = false ; GRIP_MOVE = false;
|
||||
GRIP_LEFT = GRIP_RIGHT = GRIP_MOVE = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -228,30 +228,35 @@ void Frame_Resizer_Base::Draw_Partition( )
|
|||
|
||||
if ( drawingarea .get_window( ) )
|
||||
{
|
||||
drawingarea .get_window( ) ->clear( ) ;
|
||||
//i couldn't find a clear() for a pixmap, that's why ;)
|
||||
gc_pixmap ->set_foreground( color_background );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, 0, 0, 536, 50 );
|
||||
|
||||
//the two rectangles on each side of the partition
|
||||
gc ->set_foreground( color_arrow_rectangle );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, 0, 0, 10, 50 );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, 526, 0, 10, 50 );
|
||||
gc_pixmap ->set_foreground( color_arrow_rectangle );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, 0, 0, 10, 50 );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, 526, 0, 10, 50 );
|
||||
|
||||
//partition
|
||||
gc ->set_foreground( color_partition );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, X_START, 0, X_END - X_START, 50 );
|
||||
gc_pixmap ->set_foreground( color_partition );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, X_START, 0, X_END - X_START, 50 );
|
||||
|
||||
//used
|
||||
gc ->set_foreground( color_used );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, X_START +BORDER, BORDER, USED, 34 );
|
||||
gc_pixmap ->set_foreground( color_used );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, X_START +BORDER, BORDER, USED, 34 );
|
||||
|
||||
//unused
|
||||
gc ->set_foreground( color_unused );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, X_START +BORDER +USED, BORDER, UNUSED, 34 );
|
||||
gc_pixmap ->set_foreground( color_unused );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, X_START +BORDER +USED, BORDER, UNUSED, 34 );
|
||||
|
||||
//resize grips
|
||||
if ( ! fixed_start )
|
||||
Draw_Resize_Grip( ARROW_LEFT ) ;
|
||||
|
||||
Draw_Resize_Grip( ARROW_RIGHT ) ;
|
||||
|
||||
//and draw everything to "real" screen..
|
||||
drawingarea .get_window( ) ->draw_drawable( gc_drawingarea, pixmap, 0, 0, 0, 0 ) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,15 +276,11 @@ void Frame_Resizer_Base::Draw_Resize_Grip( ArrowType arrow_type )
|
|||
}
|
||||
|
||||
//attach resize arrows to the partition
|
||||
gc ->set_foreground( color_arrow_rectangle );
|
||||
gc_pixmap ->set_foreground( color_arrow_rectangle );
|
||||
pixmap ->draw_rectangle( gc_pixmap, false, arrow_type == ARROW_LEFT ? X_START -10 : X_END +1, 5, 9, 40 ) ;
|
||||
|
||||
if ( arrow_type == ARROW_LEFT )
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, false, X_START -10 , 5, 9, 40 );
|
||||
else
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, false, X_END +1, 5, 9, 40 );
|
||||
|
||||
gc ->set_foreground( color_arrow );
|
||||
drawingarea .get_window( ) ->draw_polygon( gc , true, arrow_points );
|
||||
gc_pixmap ->set_foreground( color_arrow );
|
||||
pixmap ->draw_polygon( gc_pixmap, true, arrow_points );
|
||||
}
|
||||
|
||||
Frame_Resizer_Base::~Frame_Resizer_Base( )
|
||||
|
|
|
@ -56,23 +56,28 @@ bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
|||
|
||||
void Frame_Resizer_Extended::Draw_Partition( )
|
||||
{
|
||||
drawingarea .get_window( ) ->clear( ) ;
|
||||
//i couldn't find a clear() for a pixmap, that's why ;)
|
||||
gc_pixmap ->set_foreground( color_background );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, 0, 0, 536, 50 );
|
||||
|
||||
//the two rectangles on each side of the partition
|
||||
gc ->set_foreground( color_arrow_rectangle );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, 0, 0, 10, 50 );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, 526, 0, 10, 50 );
|
||||
gc_pixmap ->set_foreground( color_arrow_rectangle );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, 0, 0, 10, 50 );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, 526, 0, 10, 50 );
|
||||
|
||||
//used
|
||||
gc ->set_foreground( color_used );
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, true, USED_START + BORDER, BORDER, USED, 34 );
|
||||
gc_pixmap ->set_foreground( color_used );
|
||||
pixmap ->draw_rectangle( gc_pixmap, true, USED_START + BORDER, BORDER, USED, 34 );
|
||||
|
||||
//partition
|
||||
gc ->set_foreground( color_partition );
|
||||
gc_pixmap ->set_foreground( color_partition );
|
||||
for( short t = 0; t < 9 ; t++ )
|
||||
drawingarea .get_window( ) ->draw_rectangle( gc, false, X_START +t, t, X_END - X_START -t*2, 50 - t*2 );
|
||||
pixmap ->draw_rectangle( gc_pixmap, false, X_START +t, t, X_END - X_START -t*2, 50 - t*2 );
|
||||
|
||||
//resize grips
|
||||
Draw_Resize_Grip( ARROW_LEFT ) ;
|
||||
Draw_Resize_Grip( ARROW_RIGHT ) ;
|
||||
|
||||
//and draw everything to "real" screen..
|
||||
drawingarea .get_window( ) ->draw_drawable( gc_drawingarea, pixmap, 0, 0, 0, 0 ) ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue