diff --git a/ChangeLog b/ChangeLog index 4542d786..275a15b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-03-01 Bart Hakvoort + + * include/Frame_Resizer_Base.h, + include/Frame_Resizer_Extended.h, + src/Dialog_Base_Partition.cc, + src/Dialog_Partition_Copy.cc, + src/Dialog_Partition_New.cc, + src/Dialog_Partition_Resize_Move.cc, + src/Frame_Resizer_Base.cc, + src/Frame_Resizer_Extended.cc: did lots of work on the resizer, it's + behaviour should be more natural and satisfying now. (see also + #331591) + * src/Win_GParted.cc: extended partition was resizable even when it's + busy. fixed. + * src/ntfs.cc: made scan output more readable. + * src/FrameVisualDisk.cc: added FIXME + 2006-02-25 Bart Hakvoort * include/GParted_Core.h, diff --git a/include/Frame_Resizer_Base.h b/include/Frame_Resizer_Base.h index c70636c1..e99505c5 100644 --- a/include/Frame_Resizer_Base.h +++ b/include/Frame_Resizer_Base.h @@ -15,59 +15,55 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef FRAME_RESIZER_BASE +#ifndef FRAME_RESIZER_BASE #define FRAME_RESIZER_BASE #include #include #include -#define BORDER 8 - class Frame_Resizer_Base : public Gtk::Frame { public: - enum ArrowType { ARROW_LEFT = 0, ARROW_RIGHT = 1 }; - - Frame_Resizer_Base( ) ; - ~Frame_Resizer_Base( ) ; - void set_rgb_partition_color( const Gdk::Color & ) ; - void override_default_rgb_unused_color( const Gdk::Color & ) ; + Frame_Resizer_Base() ; + ~Frame_Resizer_Base() ; + + void set_rgb_partition_color( const Gdk::Color & color ) ; + void override_default_rgb_unused_color( const Gdk::Color & color ) ; - void set_x_start( int ) ; - void set_x_end( int ) ; - void set_used( int ); - void set_fixed_start( bool ) ; - void set_used_start( int used_start ) ; + void set_x_start( int x_start ) ; + void set_x_end( int x_end ) ; + void set_used( int used ); + void set_fixed_start( bool fixed_start ) ; void set_size_limits( int min_size, int max_size ) ; - int get_used( ); - int get_x_start( ) ; - int get_x_end( ) ; + int get_used(); + int get_x_start() ; + int get_x_end() ; - virtual void Draw_Partition( ) ; + virtual void Draw_Partition() ; //public signals (emitted upon resize/move) sigc::signal signal_resize; sigc::signal signal_move; protected: - int X_START, USED, UNUSED, X_END, X_START_MOVE, USED_START, MIN_SIZE, MAX_SIZE; + int BORDER, GRIPPER ; + int X_START, USED, UNUSED, X_END, X_START_MOVE, MIN_SIZE, MAX_SIZE; bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ; //signal handlers - void drawingarea_on_realize( ); - bool drawingarea_on_expose( GdkEventExpose * ); - virtual bool drawingarea_on_mouse_motion( GdkEventMotion* ) ; - bool drawingarea_on_button_press_event( GdkEventButton* ) ; - bool drawingarea_on_button_release_event( GdkEventButton* ) ; - bool drawingarea_on_leave_notify( GdkEventCrossing* ) ; + void drawingarea_on_realize(); + bool drawingarea_on_expose( GdkEventExpose * ev ); + virtual bool drawingarea_on_mouse_motion( GdkEventMotion * ev ) ; + bool drawingarea_on_button_press_event( GdkEventButton * ev ) ; + bool drawingarea_on_button_release_event( GdkEventButton * ev ) ; + bool drawingarea_on_leave_notify( GdkEventCrossing * ev ) ; void Draw_Resize_Grip( ArrowType ) ; @@ -78,7 +74,7 @@ protected: Gdk::Color color_used, color_unused, color_arrow, color_background, color_partition, color_arrow_rectangle; - std::vector arrow_points; + std::vector arrow_points; Gdk::Cursor *cursor_resize, *cursor_normal, *cursor_move; @@ -86,7 +82,7 @@ protected: bool fixed_start; //a fixed start disables moving the start and thereby the whole move functionality.. private: - void init( ) ; + void init() ; }; diff --git a/include/Frame_Resizer_Extended.h b/include/Frame_Resizer_Extended.h index d1e9ab48..1287ce98 100644 --- a/include/Frame_Resizer_Extended.h +++ b/include/Frame_Resizer_Extended.h @@ -16,7 +16,7 @@ */ -#ifndef FRAME_RESIZER_EXTENDED +#ifndef FRAME_RESIZER_EXTENDED #define FRAME_RESIZER_EXTENDED #include "../include/Frame_Resizer_Base.h" @@ -24,14 +24,17 @@ class Frame_Resizer_Extended : public Frame_Resizer_Base { public: - Frame_Resizer_Extended( ) ; + Frame_Resizer_Extended() ; + + void set_used_start( int used_start ) ; private: - int UNUSED_BEFORE ; - //overridden signal handler - virtual bool drawingarea_on_mouse_motion( GdkEventMotion* ) ; + int USED_START ; - virtual void Draw_Partition( ) ; + //overridden signal handler + virtual bool drawingarea_on_mouse_motion( GdkEventMotion * ev ) ; + + virtual void Draw_Partition() ; }; -#endif // FRAME_RESIZER_EXTENDED +#endif //FRAME_RESIZER_EXTENDED diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc index 2eb9a012..ffc82d65 100644 --- a/src/Dialog_Base_Partition.cc +++ b/src/Dialog_Base_Partition.cc @@ -31,13 +31,13 @@ Dialog_Base_Partition::Dialog_Base_Partition( ) ORIG_BEFORE = ORIG_SIZE = ORIG_AFTER = -1 ; //pack resizer hbox - this ->get_vbox( ) ->pack_start( hbox_resizer, Gtk::PACK_SHRINK ); + this ->get_vbox() ->pack_start( hbox_resizer, Gtk::PACK_SHRINK ); //add label_minmax - this ->get_vbox( ) ->pack_start( label_minmax, Gtk::PACK_SHRINK ); + this ->get_vbox() ->pack_start( label_minmax, Gtk::PACK_SHRINK ); //pack hbox_main - this ->get_vbox( ) ->pack_start( hbox_main, Gtk::PACK_SHRINK ); + this ->get_vbox() ->pack_start( hbox_main, Gtk::PACK_SHRINK ); //put the vbox with resizer stuff (cool widget and spinbuttons) in the hbox_main hbox_main .pack_start( vbox_resize_move, Gtk::PACK_EXPAND_PADDING ); @@ -51,7 +51,10 @@ Dialog_Base_Partition::Dialog_Base_Partition( ) vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK ); //add spinbutton_before - table_resize.attach( * Utils::mk_label( (Glib::ustring) _( "Free Space Preceding (MiB):") + " \t" ), 0, 1, 0, 1, Gtk::SHRINK ); + table_resize .attach( + * Utils::mk_label( static_cast( _( "Free Space Preceding (MiB):") ) + " \t" ), + 0, 1, 0, 1, + Gtk::SHRINK ); spinbutton_before .set_numeric( true ); spinbutton_before .set_increments( 1, 100 ); @@ -72,29 +75,32 @@ Dialog_Base_Partition::Dialog_Base_Partition( ) table_resize.attach( spinbutton_after, 1, 2, 2, 3, Gtk::FILL ); if ( ! fixed_start ) - before_value = spinbutton_before .get_value( ) ; + before_value = spinbutton_before .get_value() ; //connect signalhandlers of the spinbuttons if ( ! fixed_start ) spinbutton_before .signal_value_changed() .connect( - sigc::bind( sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE ) ) ; + sigc::bind( + sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE ) ) ; spinbutton_size .signal_value_changed() .connect( - sigc::bind( sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE ) ) ; + sigc::bind( + sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE ) ) ; spinbutton_after .signal_value_changed() .connect( - sigc::bind( sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER ) ) ; + sigc::bind( + sigc::mem_fun(*this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER ) ) ; this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); - this ->show_all_children( ) ; + this ->show_all_children() ; } void Dialog_Base_Partition::Set_Resizer( bool extended ) { if ( extended ) - frame_resizer_base = new Frame_Resizer_Extended( ) ; + frame_resizer_base = new Frame_Resizer_Extended() ; else { - frame_resizer_base = new Frame_Resizer_Base( ) ; + frame_resizer_base = new Frame_Resizer_Base() ; frame_resizer_base ->signal_move .connect( sigc::mem_fun( this, &Dialog_Base_Partition::on_signal_move ) ); } @@ -106,18 +112,20 @@ void Dialog_Base_Partition::Set_Resizer( bool extended ) hbox_resizer .pack_start( *frame_resizer_base, Gtk::PACK_EXPAND_PADDING ); - this ->show_all_children( ) ; + this ->show_all_children() ; } -Partition Dialog_Base_Partition::Get_New_Partition( ) +Partition Dialog_Base_Partition::Get_New_Partition() { - if ( ORIG_BEFORE != spinbutton_before .get_value_as_int( ) ) - selected_partition .sector_start = START + spinbutton_before .get_value_as_int( ) * MEBIBYTE ; + if ( ORIG_BEFORE != spinbutton_before .get_value_as_int() ) + selected_partition .sector_start = START + spinbutton_before .get_value_as_int() * MEBIBYTE ; - if ( ORIG_AFTER != spinbutton_after .get_value_as_int( ) ) - selected_partition .sector_end = selected_partition .sector_start + spinbutton_size .get_value_as_int( ) * MEBIBYTE ; + if ( ORIG_AFTER != spinbutton_after .get_value_as_int() ) + selected_partition .sector_end = + selected_partition .sector_start + spinbutton_size .get_value_as_int() * MEBIBYTE ; - //due to loss of precision during calcs from Sector -> MiB and back, it is possible the new partition thinks it's bigger then it can be. Here we solve this. + //due to loss of precision during calcs from Sector -> MiB and back, it is possible + //the new partition thinks it's bigger then it can be. Here we solve this. if ( selected_partition .sector_start < START ) selected_partition .sector_start = START ; if ( selected_partition .sector_end > (START + total_length) ) @@ -131,8 +139,7 @@ Partition Dialog_Base_Partition::Get_New_Partition( ) //set new value of unused.. if ( selected_partition .sectors_used != -1 ) - selected_partition .sectors_unused = - (selected_partition .sector_end - selected_partition .sector_start) - selected_partition .sectors_used ; + selected_partition .sectors_unused = selected_partition .get_length() - selected_partition .sectors_used ; return selected_partition ; } @@ -148,7 +155,8 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type ) case RESIZE_MOVE: image_temp = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) ); hbox_resize_move .pack_start( *image_temp, Gtk::PACK_EXPAND_PADDING ) ; - hbox_resize_move .pack_start( * Utils::mk_label( fixed_start ? _("Resize") : _("Resize/Move") ), Gtk::PACK_EXPAND_PADDING ) ; + hbox_resize_move .pack_start( * Utils::mk_label( fixed_start ? _("Resize") : _("Resize/Move") ), + Gtk::PACK_EXPAND_PADDING ) ; button_resize_move .add( hbox_resize_move ) ; this ->add_action_widget ( button_resize_move, Gtk::RESPONSE_OK ) ; @@ -178,12 +186,12 @@ void Dialog_Base_Partition::on_signal_move( int x_start, int x_end ) if ( x_end == 500 ) { spinbutton_after .set_value( 0 ) ; - spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value( ) ) ; + spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() ) ; } else - spinbutton_after .set_value( TOTAL_MB - spinbutton_before .get_value( ) - spinbutton_size .get_value( ) ) ; + spinbutton_after .set_value( TOTAL_MB - spinbutton_before .get_value() - spinbutton_size .get_value() ) ; - Check_Change( ) ; + Check_Change() ; GRIP = false ; } @@ -204,20 +212,21 @@ void Dialog_Base_Partition::on_signal_resize( int x_start, int x_end, Frame_Resi spinbutton_size .set_value( TOTAL_MB - before_value ) ; } else - spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value( ) ) ; + spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value() ) ; } else if ( arrow == Frame_Resizer_Base::ARROW_LEFT ) //don't touch freespace after, leave it as it is { if ( x_start == 0 ) { spinbutton_before .set_value( 0 ); - spinbutton_size .set_value( TOTAL_MB - spinbutton_after.get_value( ) ) ; + spinbutton_size .set_value( TOTAL_MB - spinbutton_after.get_value() ) ; } else - spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value( ) - spinbutton_after .get_value( ) ) ; + spinbutton_before .set_value( + TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() ) ; } - Check_Change( ) ; + Check_Change() ; GRIP = false ; } @@ -239,12 +248,14 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton ) case SIZE : spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value() ); if ( ! fixed_start ) - spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() ); + spinbutton_before .set_value( + TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() ); break; case AFTER : if ( ! fixed_start ) - spinbutton_before .set_value( TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() ); + spinbutton_before .set_value( + TOTAL_MB - spinbutton_size .get_value() - spinbutton_after .get_value() ); spinbutton_size .set_value( TOTAL_MB - before_value - spinbutton_after .get_value() ) ; @@ -263,7 +274,7 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton ) } } -void Dialog_Base_Partition::Check_Change( ) +void Dialog_Base_Partition::Check_Change() { button_resize_move .set_sensitive( ORIG_BEFORE != spinbutton_before .get_value_as_int() || diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc index 3f4a6bcd..6a482863 100644 --- a/src/Dialog_Partition_Copy.cc +++ b/src/Dialog_Partition_Copy.cc @@ -77,7 +77,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons GRIP = false ; frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ), - Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) +1 ) ; + Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ; //set contents of label_minmax Set_MinMax_Text( @@ -87,7 +87,8 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons //set global selected_partition (see Dialog_Base_Partition::Get_New_Partition ) this ->selected_partition = copied_partition ; this ->selected_partition .inside_extended = selected_partition .inside_extended ; - this ->selected_partition .type = selected_partition .inside_extended ? GParted::TYPE_LOGICAL : GParted::TYPE_PRIMARY ; + this ->selected_partition .type = + selected_partition .inside_extended ? GParted::TYPE_LOGICAL : GParted::TYPE_PRIMARY ; } Partition Dialog_Partition_Copy::Get_New_Partition() diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc index 458ec864..56d53aa0 100644 --- a/src/Dialog_Partition_New.cc +++ b/src/Dialog_Partition_New.cc @@ -227,7 +227,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type ) fs .MAX - cylinder_size : TOTAL_MB * MEBIBYTE ; frame_resizer_base ->set_size_limits( Utils::Round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ), - Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) +1 ) ; + Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ; //set new spinbutton ranges spinbutton_before .set_range( diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc index 28455330..be327b36 100644 --- a/src/Dialog_Partition_Resize_Move.cc +++ b/src/Dialog_Partition_Resize_Move.cc @@ -27,7 +27,7 @@ Dialog_Partition_Resize_Move::Dialog_Partition_Resize_Move( const FS & fs, Secto BUF = cylinder_size * 2 ; } -void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partition, const std::vector & partitions ) +void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partition, const std::vector & partitions ) { GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely @@ -48,19 +48,19 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio frame_resizer_base ->set_rgb_partition_color( selected_partition .color ) ; //store the original values - ORIG_BEFORE = spinbutton_before .get_value_as_int( ) ; - ORIG_SIZE = spinbutton_size .get_value_as_int( ) ; - ORIG_AFTER = spinbutton_after .get_value_as_int( ) ; + ORIG_BEFORE = spinbutton_before .get_value_as_int() ; + ORIG_SIZE = spinbutton_size .get_value_as_int() ; + ORIG_AFTER = spinbutton_after .get_value_as_int() ; GRIP = false ; Set_Confirm_Button( RESIZE_MOVE ) ; - this ->show_all_children( ) ; + this ->show_all_children() ; } -void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector & partitions ) +void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector & partitions ) { - if ( ! selected_partition .error .empty( ) ) + if ( ! selected_partition .error .empty() ) fs .shrink = GParted::FS::NONE ; //see if we need a fixed_start @@ -79,11 +79,11 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector set_x_start( Utils::Round( previous / ( total_length / 500.00 ) ) ) ; - frame_resizer_base ->set_x_end( Utils::Round( (selected_partition .sector_end - selected_partition .sector_start) / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start( ) ) ; + frame_resizer_base ->set_x_end( + Utils::Round( selected_partition .get_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ; frame_resizer_base ->set_used( Utils::Round( selected_partition.sectors_used / ( total_length / 500.00 ) ) ) ; if ( fs .shrink ) @@ -145,7 +146,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector set_size_limits( Utils::Round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ), - Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) +1 ) ; + Utils::Round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ; //set contents of label_minmax Set_MinMax_Text( @@ -153,12 +154,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector & partitions ) +void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector & partitions ) { //calculate total size in MiB's of previous, current and next partition //first find index of partition unsigned int t = 0; - while ( t < partitions .size( ) && partitions[ t ] .type != GParted::TYPE_EXTENDED ) t++ ; + while ( t < partitions .size() && partitions[ t ] .type != GParted::TYPE_EXTENDED ) t++ ; Sector previous, next ; previous = next = 0 ; @@ -172,21 +173,21 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector set_x_start( Utils::Round( previous / ( total_length / 500.00 ) ) ) ; - frame_resizer_base ->set_x_end( Utils::Round( (selected_partition .sector_end - selected_partition .sector_start) / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start( ) ) ; + frame_resizer_base ->set_x_end( Utils::Round( selected_partition .get_length() / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ; //used is a bit different here... we consider start of first logical to end last logical as used space Sector first =0, used =0 ; - for ( unsigned int i = 0 ; i < partitions[ t ] .logicals .size( ) ; i++ ) + for ( unsigned int i = 0 ; i < partitions[ t ] .logicals .size() ; i++ ) { if ( partitions[ t ] .logicals[ i ] .type == GParted::TYPE_LOGICAL ) { @@ -197,7 +198,8 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector set_used_start( Utils::Round( (first - START) / ( total_length / 500.00 ) ) ) ; + dynamic_cast( frame_resizer_base ) -> + set_used_start( Utils::Round( (first - START) / ( total_length / 500.00 ) ) ) ; frame_resizer_base ->set_used( Utils::Round( used / ( total_length / 500.00 ) ) ) ; //set values of spinbutton_before (we assume there is no fixed start.) @@ -219,9 +221,11 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector set_border_width( 5 ) ; diff --git a/src/Frame_Resizer_Base.cc b/src/Frame_Resizer_Base.cc index c35578ee..b7072403 100644 --- a/src/Frame_Resizer_Base.cc +++ b/src/Frame_Resizer_Base.cc @@ -17,30 +17,39 @@ #include "../include/Frame_Resizer_Base.h" -Frame_Resizer_Base::Frame_Resizer_Base( ) +Frame_Resizer_Base::Frame_Resizer_Base() { - this ->fixed_start = false ; - init( ) ; + BORDER = 8 ; + GRIPPER = 10 ; + + fixed_start = false ; + init() ; } -void Frame_Resizer_Base::init( ) +void Frame_Resizer_Base::init() { - drawingarea .set_size_request( 536, 50 ); + drawingarea .set_size_request( 500 + GRIPPER * 2 + BORDER *2, 50 ); - drawingarea .signal_realize( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_realize) ) ; - drawingarea .signal_expose_event( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_expose) ) ; - drawingarea .signal_motion_notify_event( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_mouse_motion) ) ; - drawingarea .signal_button_press_event( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_button_press_event) ) ; - drawingarea .signal_button_release_event( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_button_release_event) ) ; - drawingarea .signal_leave_notify_event( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_leave_notify) ) ; + drawingarea .signal_realize() .connect( + sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_realize) ) ; + drawingarea .signal_expose_event() .connect( + sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_expose) ) ; + drawingarea .signal_motion_notify_event() .connect( + sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_mouse_motion) ) ; + drawingarea .signal_button_press_event() .connect( + sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_button_press_event) ) ; + drawingarea .signal_button_release_event() .connect( + sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_button_release_event) ) ; + drawingarea .signal_leave_notify_event() .connect( + sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_leave_notify) ) ; this ->add( drawingarea ) ; - color_used .set( "#F8F8BA" ); this ->get_colormap( ) ->alloc_color( color_used ) ; - color_unused .set( "white" ); this ->get_colormap( ) ->alloc_color( color_unused ) ; - color_arrow .set( "black" ); this ->get_colormap( ) ->alloc_color( color_arrow ) ; - color_background .set( "darkgrey" ); this ->get_colormap( ) ->alloc_color( color_background ) ; - color_arrow_rectangle .set( "lightgrey" ); this ->get_colormap( ) ->alloc_color( color_arrow_rectangle ) ; + color_used .set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ; + color_unused .set( "white" ); this ->get_colormap() ->alloc_color( color_unused ) ; + color_arrow .set( "black" ); this ->get_colormap() ->alloc_color( color_arrow ) ; + color_background .set( "darkgrey" ); this ->get_colormap() ->alloc_color( color_background ) ; + color_arrow_rectangle .set( "lightgrey" ); this ->get_colormap() ->alloc_color( color_arrow_rectangle ) ; cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ; cursor_normal = new Gdk::Cursor( Gdk::LEFT_PTR ) ; @@ -55,36 +64,36 @@ void Frame_Resizer_Base::init( ) p .set_y( 25 ); arrow_points .push_back( p ) ; p .set_y( 35 ); arrow_points .push_back( p ) ; - this ->show_all_children( ); + this ->show_all_children(); } void Frame_Resizer_Base::set_rgb_partition_color( const Gdk::Color & color ) { - this ->get_colormap( ) ->free_colors( color_partition, 1 ) ; + this ->get_colormap() ->free_colors( color_partition, 1 ) ; this ->color_partition = color ; - this ->get_colormap( ) ->alloc_color( color_partition ) ; + this ->get_colormap() ->alloc_color( color_partition ) ; } void Frame_Resizer_Base::override_default_rgb_unused_color( const Gdk::Color & color ) { - this ->get_colormap( ) ->free_colors( color_unused, 1 ) ; + this ->get_colormap() ->free_colors( color_unused, 1 ) ; this ->color_unused = color ; - this ->get_colormap( ) ->alloc_color( color_unused ) ; + this ->get_colormap() ->alloc_color( color_unused ) ; } void Frame_Resizer_Base::set_x_start( int x_start ) { - this ->X_START = x_start +10;//space for leftgripper + this ->X_START = x_start + GRIPPER ; } void Frame_Resizer_Base::set_x_end( int x_end ) { - this ->X_END = x_end +26 ; //space for leftgripper + 2 * BORDER + this ->X_END = x_end + GRIPPER + BORDER * 2 ; } void Frame_Resizer_Base::set_used( int used ) { - this ->USED = used ; + this ->USED = used ; } void Frame_Resizer_Base::set_fixed_start( bool fixed_start ) @@ -92,39 +101,33 @@ void Frame_Resizer_Base::set_fixed_start( bool fixed_start ) this ->fixed_start = fixed_start ; } -void Frame_Resizer_Base::set_used_start( int used_start ) -{ - if ( used_start <= 0 ) - this ->USED_START = 10; - else - this ->USED_START = used_start +10; -} - void Frame_Resizer_Base::set_size_limits( int min_size, int max_size ) { - this ->MIN_SIZE = min_size + 16 ; - this ->MAX_SIZE = max_size + 16 ; + this ->MIN_SIZE = min_size + BORDER * 2 ; + this ->MAX_SIZE = max_size + BORDER * 2 ; } -int Frame_Resizer_Base::get_used( ) +int Frame_Resizer_Base::get_used() { return USED ; } -int Frame_Resizer_Base::get_x_start( ) +int Frame_Resizer_Base::get_x_start() { - return X_START -10 ; + return X_START - GRIPPER ; } -int Frame_Resizer_Base::get_x_end( ) +int Frame_Resizer_Base::get_x_end() { - return X_END -26 ; + return X_END - GRIPPER - BORDER * 2 ; } -void Frame_Resizer_Base::drawingarea_on_realize( ) +void Frame_Resizer_Base::drawingarea_on_realize() { - 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_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 ); @@ -135,56 +138,171 @@ void Frame_Resizer_Base::drawingarea_on_realize( ) bool Frame_Resizer_Base::drawingarea_on_expose( GdkEventExpose * ev ) { - Draw_Partition( ) ; + Draw_Partition() ; return true; } -bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev ) +bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion * ev ) { if ( GRIP_LEFT || GRIP_RIGHT || GRIP_MOVE ) - { - if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= X_END - USED - BORDER * 2 && (X_END - ev ->x) <= MAX_SIZE && (X_END - ev ->x) >= MIN_SIZE ) + { + if ( GRIP_LEFT ) { - X_START = static_cast ( ev ->x ) ; - signal_resize .emit( X_START -10, X_END -26, ARROW_LEFT ) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + if ( ev ->x > GRIPPER && + (X_END - ev ->x) < MAX_SIZE && + (X_END - ev ->x) > MIN_SIZE ) + { + X_START = static_cast( ev ->x ) ; + + signal_resize .emit( X_START - GRIPPER, X_END - GRIPPER - 2 * BORDER, ARROW_LEFT ) ; + } + else if ( X_END - ev ->x >= MAX_SIZE ) + { + if ( X_END - X_START < MAX_SIZE ) + { + X_START = X_END - MAX_SIZE ; + + if ( X_START < GRIPPER ) + X_START = GRIPPER ; + + //-1 to force the spinbutton to its max. + signal_resize .emit( X_START - GRIPPER -1, + X_END - GRIPPER - BORDER * 2, + ARROW_LEFT ) ; + } + } + else if ( ev ->x <= GRIPPER ) + { + if ( X_START > GRIPPER && X_END - X_START < MAX_SIZE ) + { + X_START = GRIPPER ; + + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2, + ARROW_LEFT ) ; + } + } + else if ( X_END - ev ->x <= MIN_SIZE ) + { + if ( X_END - X_START > MIN_SIZE ) + { + X_START = X_END - MIN_SIZE ; + + //+1 to force the spinbutton to its min. + signal_resize .emit( X_START - GRIPPER +1, + X_END - GRIPPER - BORDER * 2, + ARROW_LEFT ) ; + } + } } - - else if ( GRIP_RIGHT && ev ->x <= 526 && ev ->x >= X_START + USED + BORDER *2 && (ev ->x - X_START) <= MAX_SIZE && (ev ->x - X_START) >= MIN_SIZE ) + + else if ( GRIP_RIGHT ) { - X_END = static_cast ( ev ->x ) ; - signal_resize .emit( X_START -10, X_END -26, ARROW_RIGHT ) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + if ( ev ->x < 500 + GRIPPER + BORDER * 2 && + (ev ->x - X_START) < MAX_SIZE && + (ev ->x - X_START) > MIN_SIZE ) + { + X_END = static_cast( ev ->x ) ; + + signal_resize .emit( X_START - GRIPPER, X_END - GRIPPER - BORDER * 2, ARROW_RIGHT ) ; + } + else if ( ev ->x - X_START >= MAX_SIZE ) + { + if ( X_END - X_START < MAX_SIZE ) + { + X_END = X_START + MAX_SIZE ; + + if ( X_END > 500 + GRIPPER + BORDER * 2 ) + X_END = 500 + GRIPPER + BORDER * 2 ; + + //+1 to force the spinbutton to its min. + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2 +1, + ARROW_RIGHT ) ; + } + } + else if ( ev ->x >= 500 + GRIPPER + BORDER * 2 ) + { + if ( X_END < 500 + GRIPPER + BORDER * 2 && X_END - X_START < MAX_SIZE ) + { + X_END = 500 + GRIPPER + BORDER * 2 ; + + signal_resize .emit( X_START -GRIPPER, + X_END - GRIPPER - BORDER * 2, + ARROW_RIGHT ) ; + } + } + else if ( ev ->x - X_START <= MIN_SIZE ) + { + if ( X_END - X_START > MIN_SIZE ) + { + X_END = X_START + MIN_SIZE ; + + //-1 to force the spinbutton to its min. + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2 -1, + ARROW_RIGHT ) ; + } + } } else if ( GRIP_MOVE ) { - temp_x = X_START + static_cast ( ev ->x - X_START_MOVE ); - temp_y = X_END + static_cast ( ev ->x - X_START_MOVE ); - - if ( temp_x >= 10 && temp_y <= 526 ) + temp_x = X_START + static_cast( ev ->x - X_START_MOVE ); + temp_y = X_END - X_START ; + + if ( temp_x > GRIPPER && temp_x + temp_y < 500 + GRIPPER + BORDER * 2 ) { X_START = temp_x ; - X_END = temp_y ; + X_END = X_START + temp_y ; + } + else if ( temp_x <= GRIPPER ) + { + if ( X_START > GRIPPER ) + { + X_START = GRIPPER ; + X_END = X_START + temp_y ; + } + } + else if ( temp_x + temp_y >= 500 + GRIPPER + BORDER * 2 ) + { + if ( X_END < 500 + GRIPPER + BORDER * 2 ) + { + X_END = 500 + GRIPPER + BORDER * 2 ; + X_START = X_END - temp_y ; + } } - X_START_MOVE = static_cast ( ev ->x ) ; - - signal_move .emit( X_START -10, X_END -26) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) + X_START_MOVE = static_cast( ev ->x ) ; + signal_move .emit( X_START - GRIPPER, X_END - GRIPPER - BORDER * 2 ) ; } - Draw_Partition( ) ; + Draw_Partition() ; } - else { //check if pointer is over a gripper - if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip - drawingarea .get_parent_window( ) ->set_cursor( *cursor_resize ) ; - else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip - drawingarea .get_parent_window( ) ->set_cursor( *cursor_resize ) ; - else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip - drawingarea .get_parent_window( ) ->set_cursor( *cursor_move ) ; - else //normal pointer - drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ; + //left grip + if ( ! fixed_start && + ev ->x >= X_START - GRIPPER && + ev ->x <= X_START && + ev ->y >= 5 && + ev ->y <= 45 ) + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + //right grip + else if ( ev ->x >= X_END && + ev ->x <= X_END + GRIPPER && + ev ->y >= 5 && + ev ->y <= 45 ) + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + //move grip + else if ( ! fixed_start && + ev ->x >= X_START && + ev ->x <= X_END ) + drawingarea .get_parent_window() ->set_cursor( *cursor_move ) ; + //normal pointer + else + drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ; } return true; @@ -192,14 +310,29 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev ) bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev ) { - GRIP_MOVE = false; GRIP_RIGHT = false; GRIP_LEFT = false ; + GRIP_LEFT = GRIP_RIGHT = GRIP_MOVE = false; - if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip + //left grip + if ( ! fixed_start && + ev ->x >= X_START - GRIPPER && + ev ->x <= X_START && + ev ->y >= 5 && + ev ->y <= 45 ) GRIP_LEFT = true ; - else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip + //right grip + else if ( ev ->x >= X_END && + ev ->x <= X_END + GRIPPER && + ev ->y >= 5 && + ev ->y <= 45 ) GRIP_RIGHT = true ; - else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip - { GRIP_MOVE = true ; X_START_MOVE = static_cast ( ev ->x ); } + //move grip + else if ( ! fixed_start && + ev ->x >= X_START && + ev ->x <= X_END ) + { + GRIP_MOVE = true ; + X_START_MOVE = static_cast( ev ->x ); + } return true; } @@ -214,18 +347,18 @@ bool Frame_Resizer_Base::drawingarea_on_button_release_event( GdkEventButton *ev bool Frame_Resizer_Base::drawingarea_on_leave_notify( GdkEventCrossing *ev ) { if ( ev ->mode != GDK_CROSSING_GRAB && ! GRIP_LEFT && ! GRIP_RIGHT && ! GRIP_MOVE ) - drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ; + drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ; return true; } -void Frame_Resizer_Base::Draw_Partition( ) +void Frame_Resizer_Base::Draw_Partition() { UNUSED = X_END - X_START - BORDER * 2 - USED ; if ( UNUSED < 0 ) UNUSED = 0 ; - if ( drawingarea .get_window( ) ) + if ( drawingarea .get_window() ) { //i couldn't find a clear() for a pixmap, that's why ;) gc_pixmap ->set_foreground( color_background ); @@ -255,7 +388,7 @@ void Frame_Resizer_Base::Draw_Partition( ) Draw_Resize_Grip( ARROW_RIGHT ) ; //and draw everything to "real" screen.. - drawingarea .get_window( ) ->draw_drawable( gc_drawingarea, pixmap, 0, 0, 0, 0 ) ; + drawingarea .get_window() ->draw_drawable( gc_drawingarea, pixmap, 0, 0, 0, 0 ) ; } } @@ -264,32 +397,37 @@ void Frame_Resizer_Base::Draw_Resize_Grip( ArrowType arrow_type ) if ( arrow_type == ARROW_LEFT ) { arrow_points[ 0 ] .set_x( X_START ) ; - arrow_points[ 1 ] .set_x( X_START -10 ) ; + arrow_points[ 1 ] .set_x( X_START - GRIPPER ) ; arrow_points[ 2 ] .set_x( X_START ) ; } else { arrow_points[ 0 ] .set_x( X_END ) ; - arrow_points[ 1 ] .set_x( X_END +10 ) ; + arrow_points[ 1 ] .set_x( X_END + GRIPPER ) ; arrow_points[ 2 ] .set_x( X_END ) ; } //attach resize arrows to the partition 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 ) ; + pixmap ->draw_rectangle( gc_pixmap, + false, + arrow_type == ARROW_LEFT ? X_START - GRIPPER : X_END +1, + 5, + 9, + 40 ) ; gc_pixmap ->set_foreground( color_arrow ); pixmap ->draw_polygon( gc_pixmap, true, arrow_points ); } -Frame_Resizer_Base::~Frame_Resizer_Base( ) +Frame_Resizer_Base::~Frame_Resizer_Base() { - this ->get_colormap( ) ->free_colors( color_used, 1 ) ; - this ->get_colormap( ) ->free_colors( color_unused, 1 ) ; - this ->get_colormap( ) ->free_colors( color_arrow, 1 ) ; - this ->get_colormap( ) ->free_colors( color_background, 1 ) ; - this ->get_colormap( ) ->free_colors( color_partition, 1 ) ; - this ->get_colormap( ) ->free_colors( color_arrow_rectangle, 1 ) ; + this ->get_colormap() ->free_colors( color_used, 1 ) ; + this ->get_colormap() ->free_colors( color_unused, 1 ) ; + this ->get_colormap() ->free_colors( color_arrow, 1 ) ; + this ->get_colormap() ->free_colors( color_background, 1 ) ; + this ->get_colormap() ->free_colors( color_partition, 1 ) ; + this ->get_colormap() ->free_colors( color_arrow_rectangle, 1 ) ; if ( cursor_resize ) delete cursor_resize ; diff --git a/src/Frame_Resizer_Extended.cc b/src/Frame_Resizer_Extended.cc index e7ae6af8..eb2745bd 100644 --- a/src/Frame_Resizer_Extended.cc +++ b/src/Frame_Resizer_Extended.cc @@ -17,44 +17,140 @@ #include "../include/Frame_Resizer_Extended.h" -Frame_Resizer_Extended::Frame_Resizer_Extended( ) +Frame_Resizer_Extended::Frame_Resizer_Extended() { } -bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev ) +void Frame_Resizer_Extended::set_used_start( int used_start ) { - if ( ! GRIP_LEFT && ! GRIP_RIGHT ) //no need to check this while resizing - { - //check if pointer is over a gripper - if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip - drawingarea .get_parent_window( ) ->set_cursor( *cursor_resize ) ; - else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip - drawingarea .get_parent_window( ) ->set_cursor( *cursor_resize ) ; - else //normal pointer - drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ; + if ( used_start <= 0 ) + USED_START = GRIPPER ; + else + USED_START = used_start + GRIPPER ; +} + +bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion * ev ) +{ + if ( GRIP_LEFT || GRIP_RIGHT ) + { + if ( GRIP_LEFT ) + { + if ( ev ->x > GRIPPER && + ev->x < X_END - BORDER *2 && + ( ev ->x < USED_START || USED == 0 ) ) + { + X_START = static_cast( ev ->x ) ; + + signal_resize .emit( X_START - GRIPPER, X_END - GRIPPER - BORDER * 2, ARROW_LEFT ) ; + } + else if ( ev ->x <= GRIPPER ) + { + if ( X_START > GRIPPER ) + { + X_START = GRIPPER ; + + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2, + ARROW_LEFT ) ; + } + } + else if ( USED != 0 && ev ->x >= USED_START ) + { + if ( X_START < USED_START ) + { + X_START = USED_START ; + + //+1 to force the spinbutton to its min. + signal_resize .emit( X_START - GRIPPER +1, + X_END - GRIPPER - BORDER * 2, + ARROW_LEFT ) ; + } + } + else if ( USED == 0 && ev ->x >= X_END - BORDER * 2 ) + { + if ( X_START < X_END - BORDER * 2 ) + { + X_START = X_END - BORDER * 2 ; + + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2, + ARROW_LEFT ) ; + } + } + } + else if ( GRIP_RIGHT ) + { + if ( ev ->x < 500 + GRIPPER + BORDER * 2 && + ev ->x > X_START + BORDER *2 && + ( ev ->x > USED_START + USED + BORDER *2 || USED == 0 ) ) + { + X_END = static_cast( ev ->x ) ; + + signal_resize .emit( X_START - GRIPPER, X_END - GRIPPER - BORDER * 2, ARROW_RIGHT ) ; + } + else if ( ev ->x >= 500 + GRIPPER + BORDER * 2 ) + { + if ( X_END < 500 + GRIPPER + BORDER * 2 ) + { + X_END = 500 + GRIPPER + BORDER * 2 ; + + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2, + ARROW_RIGHT ) ; + } + } + else if ( USED != 0 && ev ->x <= USED_START + USED + BORDER *2 ) + { + if ( X_END > USED_START + USED + BORDER *2 ) + { + X_END = USED_START + USED + BORDER *2 ; + + //-1 to force the spinbutton to its min. + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2 -1, ARROW_RIGHT ) ; + } + } + else if ( USED == 0 && ev ->x <= X_START + BORDER *2 ) + { + if ( X_END > X_START + BORDER *2 ) + { + X_END = X_START + BORDER *2 ; + + signal_resize .emit( X_START - GRIPPER, + X_END - GRIPPER - BORDER * 2, + ARROW_RIGHT ) ; + } + } + } + + Draw_Partition() ; } - else if ( GRIP_LEFT || GRIP_RIGHT ) - { - if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= 510 && ev->x <= X_END - BORDER *2 && ( ev ->x <= USED_START || USED == 0 ) ) - { - X_START = static_cast ( ev ->x ) ; - signal_resize .emit( X_START -10, X_END -26, ARROW_LEFT ) ; //-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) - } - - else if ( GRIP_RIGHT && ev ->x <= 526 && ev->x >= X_START + BORDER *2 && ev ->x >= USED_START + USED + BORDER *2 ) - { - X_END = static_cast ( ev ->x ) ; - signal_resize .emit( X_START -10, X_END -26, ARROW_RIGHT ) ;//-10/-26 to get the real value ( this way gripper calculations are invisible outside this class ) - } - - Draw_Partition( ) ; + //check if pointer is over a gripper + else + { + //left grip + if ( ! fixed_start && + ev ->x >= X_START - GRIPPER && + ev ->x <= X_START && + ev ->y >= 5 && + ev ->y <= 45 ) + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + //right grip + else if ( ev ->x >= X_END && + ev ->x <= X_END + GRIPPER && + ev ->y >= 5 && + ev ->y <= 45 ) + drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ; + //normal pointer + else + drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ; } return true ; } -void Frame_Resizer_Extended::Draw_Partition( ) +void Frame_Resizer_Extended::Draw_Partition() { //i couldn't find a clear() for a pixmap, that's why ;) gc_pixmap ->set_foreground( color_background ); @@ -79,5 +175,5 @@ void Frame_Resizer_Extended::Draw_Partition( ) Draw_Resize_Grip( ARROW_RIGHT ) ; //and draw everything to "real" screen.. - drawingarea .get_window( ) ->draw_drawable( gc_drawingarea, pixmap, 0, 0, 0, 0 ) ; + drawingarea .get_window() ->draw_drawable( gc_drawingarea, pixmap, 0, 0, 0, 0 ) ; } diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 6dde9833..96f708a7 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -689,10 +689,11 @@ void Win_GParted::set_valid_operations() ->set_label( _("swapon") ) ; } - //only unmount is allowed - if ( selected_partition .busy && selected_partition .type != GParted::TYPE_EXTENDED ) + //only unmount/swapoff is allowed (if ! extended) + if ( selected_partition .busy ) { - allow_unmount( true ) ; + if ( selected_partition .type != GParted::TYPE_EXTENDED ) + allow_unmount( true ) ; return ; } @@ -1088,7 +1089,7 @@ bool Win_GParted::max_amount_prim_reached() void Win_GParted::activate_resize() { - std::vector partitions = devices[ current_device ] .partitions ; + std::vector partitions = devices[ current_device ] .partitions ; if ( operations .size() ) for (unsigned int t = 0 ; t < operations .size() ; t++ ) diff --git a/src/ntfs.cc b/src/ntfs.cc index 40a506f3..95bebb46 100644 --- a/src/ntfs.cc +++ b/src/ntfs.cc @@ -159,7 +159,8 @@ bool ntfs::Check_Repair( const Partition & partition, std::vector