The fixes from 12-09 unearthed a number of long forgotten issues and

* The fixes from 12-09 unearthed a number of long forgotten issues and annoyances. Hopefully they're all resolved now.
This commit is contained in:
Bart Hakvoort 2004-12-12 14:57:04 +00:00
parent 50ddc1fb76
commit e3a9b2d14c
9 changed files with 135 additions and 155 deletions

View File

@ -1,26 +1,30 @@
2004-12-12 Bart Hakvoort <gparted@users.sf.net>
* The fixes from 12-09 unearthed a number of long forgotten issues and annoyances. Hopefully they're all resolved now.
2004-12-09 Bart Hakvoort <gparted@users.sf.net> 2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* Fixed a bunch of issues with min. and max. sizes of filesystems. * Fixed a bunch of issues with min. and max. sizes of filesystems.
2004-12-10 Gil Osher <dolfin@rpg.org.il> 2004-12-10 Gil Osher <dolfin@rpg.org.il>
* configure.in: Added 'he' (Hebrew) to ALL_LINGUAS. * configure.in: Added 'he' (Hebrew) to ALL_LINGUAS.
2004-12-09 Bart Hakvoort <gparted@users.sf.net> 2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* src/fat16: use mkdosfs -F16 instead of libparted to create fat16 filesystems * src/fat16: use mkdosfs -F16 instead of libparted to create fat16 filesystems
2004-12-09 Bart Hakvoort <gparted@users.sf.net> 2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* src/ext2.cc, * src/ext2.cc,
src/ext3.cc, src/ext3.cc,
src/ntfs.cc, src/ntfs.cc,
src/reiserfs.cc: added LANG=C to the commands which read the used space of a filesystem. This prevent errors with some locales. src/reiserfs.cc: added LANG=C to the commands which read the used space of a filesystem. This prevent errors with some locales.
2004-12-09 Bart Hakvoort <gparted@users.sf.net> 2004-12-09 Bart Hakvoort <gparted@users.sf.net>
* added MIN and MAX to filesystemstruct to set min. and max sizes of a filesystem. So instead of checking per filesystem * added MIN and MAX to filesystemstruct to set min. and max sizes of a filesystem. So instead of checking per filesystem
i now simply check the fs.MIN or fs.MAX. this results in less and cleaner code. Also this will come in handy when adding i now simply check the fs.MIN or fs.MAX. this results in less and cleaner code. Also this will come in handy when adding
support for new filesystems. (This also fixed several minor bugs with filesystemsizes and gained some improvement in resizer support for new filesystems. (This also fixed several minor bugs with filesystemsizes and gained some improvement in resizer
performance) performance)
@ -36,9 +40,9 @@
* README: updated description to reflect current situation. * README: updated description to reflect current situation.
2004-12-07 Amanpreet Singh Alam <amanpreetalam@yahoo.com> 2004-12-07 Amanpreet Singh Alam <amanpreetalam@yahoo.com>
*configure.in: pa is aeed ALL_LINGUAS * configure.in: pa is aeed ALL_LINGUAS
2004-12-03 Bart Hakvoort <gparted@users.sf.net> 2004-12-03 Bart Hakvoort <gparted@users.sf.net>

View File

@ -80,7 +80,6 @@ protected:
std::vector<FS> FILESYSTEMS ; std::vector<FS> FILESYSTEMS ;
bool fixed_start, GRIP ; bool fixed_start, GRIP ;
double before_value ; double before_value ;
int x_start, x_end ;
FS fs ; FS fs ;
private: private:

View File

@ -45,6 +45,7 @@ public:
void set_used( int ); void set_used( int );
void set_fixed_start( bool ) ; void set_fixed_start( bool ) ;
void set_used_start( int used_start ) ; void set_used_start( int used_start ) ;
void set_size_limits( int min_size, int max_size ) ;
int get_used(); int get_used();
int get_x_start() ; int get_x_start() ;
@ -58,7 +59,7 @@ public:
sigc::signal<void,int,int> signal_move; sigc::signal<void,int,int> signal_move;
protected: protected:
int X_START, USED, UNUSED, X_END, X_START_MOVE, USED_START; int X_START, USED, UNUSED, X_END, X_START_MOVE, USED_START, MIN_SIZE, MAX_SIZE;
bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ; bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ;
//signal handlers //signal handlers

View File

@ -30,13 +30,13 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
this ->set_resizable( false ); this ->set_resizable( false );
//pack resizer hbox //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 //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 //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 //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); hbox_main .pack_start( vbox_resize_move, Gtk::PACK_EXPAND_PADDING);
@ -77,18 +77,18 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
//connect signalhandlers of the spinbuttons //connect signalhandlers of the spinbuttons
if ( ! fixed_start ) if ( ! fixed_start )
spinbutton_before .signal_value_changed().connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE) ) ; spinbutton_before .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), BEFORE) ) ;
spinbutton_size .signal_value_changed().connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE) ) ; spinbutton_size .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), SIZE) ) ;
spinbutton_after .signal_value_changed().connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER) ) ; spinbutton_after .signal_value_changed( ) .connect( sigc::bind<SPINBUTTON>( sigc::mem_fun( *this, &Dialog_Base_Partition::on_spinbutton_value_changed), AFTER) ) ;
//pack warning about small differences in values.. //pack warning about small differences in values..
this ->get_vbox() ->pack_start( * mk_label( "\n <i>" + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "</i>" ), Gtk::PACK_SHRINK ); this ->get_vbox( ) ->pack_start( * mk_label( "\n <i>" + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "</i>" ), Gtk::PACK_SHRINK );
this ->get_vbox() ->pack_start( * mk_label( "" ), Gtk::PACK_SHRINK ); //filler :-P this ->get_vbox( ) ->pack_start( * mk_label( "" ), Gtk::PACK_SHRINK ); //filler :-P
this->add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); 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 ) void Dialog_Base_Partition::Set_Resizer( bool extended )
@ -111,7 +111,7 @@ void Dialog_Base_Partition::Set_Resizer( bool extended )
hbox_resizer .pack_start( *frame_resizer_base, Gtk::PACK_EXPAND_PADDING ); 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()
@ -188,57 +188,41 @@ void Dialog_Base_Partition::on_signal_move( int x_start, int x_end )
else 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() ) ;
this ->x_start = x_start ; Check_Change( ) ;
this ->x_end = x_end ;
Check_Change() ;
GRIP = false ; GRIP = false ;
} }
void Dialog_Base_Partition::on_signal_resize( int x_start, int x_end, Frame_Resizer_Base::ArrowType arrow) void Dialog_Base_Partition::on_signal_resize( int x_start, int x_end, Frame_Resizer_Base::ArrowType arrow )
{ {
GRIP = true ; GRIP = true ;
if ( ( x_end - x_start ) * MB_PER_PIXEL < fs .MIN || ( fs .MAX && ( x_end - x_start ) * MB_PER_PIXEL > fs .MAX ) )
{
frame_resizer_base ->set_x_start( this ->x_start );
frame_resizer_base ->set_x_end( this ->x_end );
frame_resizer_base ->Draw_Partition( ) ;
GRIP = false ;
return ;
}
spinbutton_size .set_value( ( x_end - x_start ) * MB_PER_PIXEL ) ; spinbutton_size .set_value( ( x_end - x_start ) * MB_PER_PIXEL ) ;
fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value() ; fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value( ) ;
if ( arrow == Frame_Resizer_Base::ARROW_RIGHT ) //don't touch freespace before, leave it as it is if ( arrow == Frame_Resizer_Base::ARROW_RIGHT ) //don't touch freespace before, leave it as it is
{ {
if ( x_end == 500 ) if ( x_end == 500 )
{ {
spinbutton_after .set_value(0 ) ; spinbutton_after .set_value( 0 ) ;
spinbutton_size .set_value( TOTAL_MB - before_value ) ; spinbutton_size .set_value( TOTAL_MB - before_value ) ;
} }
else 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 else if ( arrow == Frame_Resizer_Base::ARROW_LEFT ) //don't touch freespace after, leave it as it is
{ {
if ( x_start == 0 ) if ( x_start == 0 )
{ {
spinbutton_before .set_value( 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 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( ) ) ;
} }
this ->x_start = x_start ; Check_Change( ) ;
this ->x_end = x_end ;
Check_Change() ;
GRIP = false ; GRIP = false ;
} }
@ -247,24 +231,24 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
{ {
if ( ! GRIP ) if ( ! GRIP )
{ {
fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value() ; fixed_start ? before_value = 0 : before_value = spinbutton_before .get_value( ) ;
//Balance the spinbuttons //Balance the spinbuttons
switch ( spinbutton ) switch ( spinbutton )
{ {
case BEFORE : spinbutton_after.set_value( TOTAL_MB - spinbutton_size.get_value() - before_value) ; case BEFORE : spinbutton_after .set_value( TOTAL_MB - spinbutton_size .get_value( ) - before_value) ;
spinbutton_size.set_value( TOTAL_MB - before_value - spinbutton_after.get_value( ) ) ; spinbutton_size .set_value( TOTAL_MB - before_value - spinbutton_after .get_value( ) ) ;
break; break;
case SIZE : spinbutton_after.set_value( TOTAL_MB - before_value - spinbutton_size.get_value() ); case SIZE : spinbutton_after .set_value( TOTAL_MB - before_value - spinbutton_size .get_value( ) );
if ( ! fixed_start ) 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; break;
case AFTER : if ( ! fixed_start ) 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( ) ) ; spinbutton_size .set_value( TOTAL_MB - before_value - spinbutton_after .get_value( ) ) ;
break; break;
} }
@ -272,16 +256,13 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
//And apply the changes to the visual view... //And apply the changes to the visual view...
if ( ! fixed_start ) if ( ! fixed_start )
frame_resizer_base ->set_x_start( (int) (spinbutton_before .get_value() / MB_PER_PIXEL + 0.5) ) ; frame_resizer_base ->set_x_start( (int) ( spinbutton_before .get_value( ) / MB_PER_PIXEL + 0.5 ) ) ;
frame_resizer_base ->set_x_end( (int) ( 500 - ( (double) spinbutton_after .get_value() / MB_PER_PIXEL ) + 0.5 ) ) ; frame_resizer_base ->set_x_end( (int) ( 500 - ( (double) spinbutton_after .get_value( ) / MB_PER_PIXEL ) + 0.5 ) ) ;
this ->x_start = frame_resizer_base ->get_x_start() ; frame_resizer_base ->Draw_Partition( ) ;
this ->x_end = frame_resizer_base ->get_x_end() ;
frame_resizer_base ->Draw_Partition() ; Check_Change( ) ;
Check_Change() ;
} }
} }

View File

@ -50,24 +50,25 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
frame_resizer_base ->set_x_end( ( Round( (double) (copied_partition .sector_end - copied_partition .sector_start) / ( (double)total_length/500) )) ) ; frame_resizer_base ->set_x_end( ( Round( (double) (copied_partition .sector_end - copied_partition .sector_start) / ( (double)total_length/500) )) ) ;
frame_resizer_base ->set_used( frame_resizer_base ->get_x_end( ) ) ; frame_resizer_base ->set_used( frame_resizer_base ->get_x_end( ) ) ;
//used to store current positions (see Dialog_Base_Partition::on_signal_resize) if ( ! fs .MAX )
this ->x_start = frame_resizer_base ->get_x_start( ) ; fs .MAX = TOTAL_MB ;
this ->x_end = frame_resizer_base ->get_x_end( ) ;
//set values of spinbutton_before //set values of spinbutton_before
spinbutton_before .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB( ) -1 ) ;//mind the -1 !! spinbutton_before .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB( ) -1 ) ;//mind the -1 !!
spinbutton_before .set_value( 0 ) ; spinbutton_before .set_value( 0 ) ;
//set values of spinbutton_size //set values of spinbutton_size
spinbutton_size .set_range( copied_partition .Get_Length_MB( ) +1, fs .MAX ? fs .MAX : TOTAL_MB ) ; spinbutton_size .set_range( copied_partition .Get_Length_MB( ) +1, fs .MAX ) ;
spinbutton_size .set_value( copied_partition .Get_Length_MB( ) ) ; spinbutton_size .set_value( copied_partition .Get_Length_MB( ) ) ;
//set values of spinbutton_after //set values of spinbutton_after
spinbutton_after .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB( ) -1 ) ; spinbutton_after .set_range( 0, TOTAL_MB - copied_partition .Get_Length_MB( ) -1 ) ;
spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB( ) ) ; spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB( ) ) ;
frame_resizer_base ->set_size_limits( (int) (fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( copied_partition .Get_Length_MB( ) +1, fs .MAX ? fs .MAX : TOTAL_MB ) ; Set_MinMax_Text( copied_partition .Get_Length_MB( ) +1, fs .MAX ) ;
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition ) //set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
this ->selected_partition = copied_partition ; this ->selected_partition = copied_partition ;

View File

@ -27,13 +27,7 @@ Dialog_Partition_New::Dialog_Partition_New( )
Set_Resizer( false ) ; Set_Resizer( false ) ;
Set_Confirm_Button( NEW ) ; Set_Confirm_Button( NEW ) ;
//set partition color //set used (in pixels)...
color_temp .set( Get_Color( "ext2" ) ) ;
frame_resizer_base ->set_rgb_partition_color( color_temp ) ;
//set the resizer..
frame_resizer_base ->set_x_start( 0 ) ;
frame_resizer_base ->set_x_end( 500 ) ;
frame_resizer_base ->set_used( 0 ) ; frame_resizer_base ->set_used( 0 ) ;
} }
@ -46,49 +40,49 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
this ->FILESYSTEMS .back( ) .filesystem = _("Unformatted") ; this ->FILESYSTEMS .back( ) .filesystem = _("Unformatted") ;
this ->FILESYSTEMS .back( ) .create = true ; this ->FILESYSTEMS .back( ) .create = true ;
FS fs ; fs.filesystem = "extended" ; FS fs_tmp ; fs_tmp .filesystem = "extended" ;
this ->FILESYSTEMS .push_back( fs ) ; this ->FILESYSTEMS .push_back( fs_tmp ) ;
//add table with selection menu;s... //add table with selection menu's...
table_create .set_border_width( 10 ) ; table_create .set_border_width( 10 ) ;
table_create.set_row_spacings( 5 ) ; table_create .set_row_spacings( 5 ) ;
hbox_main .pack_start( table_create, Gtk::PACK_SHRINK ); hbox_main .pack_start( table_create, Gtk::PACK_SHRINK );
/*TO TRANSLATORS: used as label for a list of choices. Create as: <optionmenu with choices> */ /*TO TRANSLATORS: used as label for a list of choices. Create as: <optionmenu with choices> */
table_create.attach( * mk_label( (Glib::ustring) _("Create as:") + "\t" ), 0, 1, 0, 1, Gtk::FILL); table_create.attach( * mk_label( (Glib::ustring) _("Create as:") + "\t" ), 0, 1, 0, 1, Gtk::FILL);
//fill partitiontype menu //fill partitiontype menu
menu_type.items().push_back(Gtk::Menu_Helpers::MenuElem( _("Primary Partition") ) ) ; menu_type .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Primary Partition") ) ) ;
menu_type.items().push_back(Gtk::Menu_Helpers::MenuElem( _("Logical Partition") ) ) ; menu_type .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Logical Partition") ) ) ;
menu_type.items().push_back(Gtk::Menu_Helpers::MenuElem( _("Extended Partition") ) ) ; menu_type .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("Extended Partition") ) ) ;
//determine which PartitionType is allowed //determine which PartitionType is allowed
if ( partition.inside_extended ) if ( partition .inside_extended )
{ {
menu_type.items()[0] .set_sensitive( false ); menu_type .items( )[ 0 ] .set_sensitive( false );
menu_type.items()[2] .set_sensitive( false ); menu_type .items( )[ 2 ] .set_sensitive( false );
menu_type.set_active( 1 ); menu_type .set_active( 1 );
} }
else else
{ {
menu_type.items()[1] .set_sensitive( false ); menu_type .items( )[ 1 ] .set_sensitive( false );
if ( any_extended ) if ( any_extended )
menu_type.items()[2] .set_sensitive( false ); menu_type .items( )[ 2 ] .set_sensitive( false );
} }
optionmenu_type.set_menu( menu_type ); optionmenu_type .set_menu( menu_type );
optionmenu_type.set_size_request( 160, -1 ); //160 is the ideal width for this table column, (when one widget is set, the rest wil take this width as well) optionmenu_type .set_size_request( 160, -1 ); //160 is the ideal width for this table column, (when one widget is set, the rest wil take this width as well)
optionmenu_type.signal_changed().connect( sigc::bind<bool>(sigc::mem_fun(*this, &Dialog_Partition_New::optionmenu_changed), true) ); optionmenu_type .signal_changed( ) .connect( sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), true ) );
table_create.attach( optionmenu_type, 1,2,0,1,Gtk::FILL); table_create .attach( optionmenu_type, 1, 2, 0, 1, Gtk::FILL );
//filesystems to choose from //filesystems to choose from
table_create.attach( * mk_label( (Glib::ustring) _("Filesystem:") + "\t" ), 0,1,1,2,Gtk::FILL); table_create.attach( * mk_label( (Glib::ustring) _("Filesystem:") + "\t" ), 0, 1, 1, 2, Gtk::FILL );
Build_Filesystems_Menu( only_unformatted ) ; Build_Filesystems_Menu( only_unformatted ) ;
optionmenu_filesystem .set_menu( menu_filesystem ); optionmenu_filesystem .set_menu( menu_filesystem );
optionmenu_filesystem .signal_changed().connect( sigc::bind<bool>(sigc::mem_fun(*this, &Dialog_Partition_New::optionmenu_changed), false) ); optionmenu_filesystem .signal_changed( ) .connect( sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), false ) );
table_create.attach( optionmenu_filesystem, 1,2,1,2,Gtk::FILL); table_create .attach( optionmenu_filesystem, 1, 2, 1, 2, Gtk::FILL );
//set some widely used values... //set some widely used values...
START = partition.sector_start ; START = partition.sector_start ;
@ -96,26 +90,17 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
TOTAL_MB = this ->selected_partition .Get_Length_MB() ; TOTAL_MB = this ->selected_partition .Get_Length_MB() ;
MB_PER_PIXEL = (double) TOTAL_MB / 500 ; MB_PER_PIXEL = (double) TOTAL_MB / 500 ;
//set spinbuttons initial values( seems a bit redundant )
GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely
spinbutton_before .set_range( 0, TOTAL_MB -1 ) ;
spinbutton_before .set_value( 0 ) ;
spinbutton_size .set_range( 1, TOTAL_MB ) ;
spinbutton_size .set_value( TOTAL_MB ) ;
spinbutton_after .set_range( 0, TOTAL_MB -1 ) ;
spinbutton_after .set_value( 0 ) ;
GRIP = false ;
//set first enabled filesystem //set first enabled filesystem
optionmenu_filesystem .set_history( first_creatable_fs ) ; optionmenu_filesystem .set_history( first_creatable_fs ) ;
optionmenu_changed( false ) ; optionmenu_changed( false ) ;
//set spinbuttons initial values
spinbutton_after .set_value( 0 ) ;
spinbutton_size .set_value( fs .MAX ) ;
spinbutton_before .set_value( 0 ) ;
//euhrm, this wil only happen when there's a very small free space (usually the effect of a bad partitionmanager) //euhrm, this wil only happen when there's a very small free space (usually the effect of a bad partitionmanager)
if ( selected_partition .Get_Length_MB( ) < cylinder_size ) if ( TOTAL_MB < cylinder_size )
frame_resizer_base ->set_sensitive( false ) ; frame_resizer_base ->set_sensitive( false ) ;
this ->show_all_children( ) ; this ->show_all_children( ) ;
@ -198,9 +183,8 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
fs .MAX = ( fs .MAX && ( fs .MAX - cylinder_size ) < TOTAL_MB ) ? fs .MAX - cylinder_size : TOTAL_MB ; fs .MAX = ( fs .MAX && ( fs .MAX - cylinder_size ) < TOTAL_MB ) ? fs .MAX - cylinder_size : TOTAL_MB ;
//needed vor upper limit check (see also Dialog_Base_Partition::on_signal_resize ) frame_resizer_base ->set_size_limits( (int) (fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
selected_partition .filesystem = fs .filesystem ;
//set new spinbutton ranges //set new spinbutton ranges
spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ; spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_size .set_range( fs .MIN, fs .MAX ) ; spinbutton_size .set_range( fs .MIN, fs .MAX ) ;

View File

@ -51,10 +51,6 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio
//set partition color //set partition color
frame_resizer_base ->set_rgb_partition_color( selected_partition .color ) ; frame_resizer_base ->set_rgb_partition_color( selected_partition .color ) ;
//set some initial values... ( i believe i only use these for fat16 checks.. *sigh* )
this ->x_start = frame_resizer_base ->get_x_start( ) ;
this ->x_end = frame_resizer_base ->get_x_end( ) ;
//store the original values //store the original values
ORIG_BEFORE = spinbutton_before .get_value_as_int( ) ; ORIG_BEFORE = spinbutton_before .get_value_as_int( ) ;
ORIG_SIZE = spinbutton_size .get_value_as_int( ) ; ORIG_SIZE = spinbutton_size .get_value_as_int( ) ;
@ -116,33 +112,41 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
frame_resizer_base ->set_used( Round( (double) selected_partition.sectors_used / ( (double)total_length/500) ) ) ; frame_resizer_base ->set_used( Round( (double) selected_partition.sectors_used / ( (double)total_length/500) ) ) ;
//since some filesystems have upper and lower limits we need to check for this //since some filesystems have upper and lower limits we need to check for this
long LOWER = ( selected_partition .Get_Used_MB( ) < fs .MIN ) ? fs .MIN : selected_partition .Get_Used_MB( ) ; if ( selected_partition .Get_Used_MB( ) > fs .MIN )
fs .MIN = selected_partition .Get_Used_MB( ) ;
LOWER += BUF ;
//in certain (rare) cases LOWER is a bit too high... //if fs. MIN is 0 here (means used == 0 as well) it's safe to have BUF / 2
if ( LOWER > selected_partition .Get_Length_MB( ) ) fs .MIN += fs .MIN ? BUF : BUF/2 ;
LOWER = selected_partition .Get_Length_MB( ) ;
//in certain (rare) cases fs .MIN is a bit too high...
if ( fs .MIN > selected_partition .Get_Length_MB( ) )
fs .MIN = selected_partition .Get_Length_MB( ) ;
if ( ! fs .MAX )
fs .MAX = TOTAL_MB ;
if ( fs .MAX > TOTAL_MB )
fs .MAX = TOTAL_MB ;
long UPPER = fs .MAX ? fs .MAX : Sector_To_MB( total_length ) ;
//set values of spinbutton_before //set values of spinbutton_before
if ( ! fixed_start ) if ( ! fixed_start )
{ {
spinbutton_before .set_range( 0, Sector_To_MB( total_length ) - LOWER ) ; spinbutton_before .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_before .set_value( Sector_To_MB( previous ) ) ; spinbutton_before .set_value( Sector_To_MB( previous ) ) ;
} }
//set values of spinbutton_size //set values of spinbutton_size
spinbutton_size .set_range( LOWER, UPPER ) ; spinbutton_size .set_range( fs .MIN, fs .MAX ) ;
spinbutton_size .set_value( selected_partition .Get_Length_MB( ) ) ; spinbutton_size .set_value( selected_partition .Get_Length_MB( ) ) ;
//set values of spinbutton_after //set values of spinbutton_after
spinbutton_after .set_range( 0, Sector_To_MB( total_length ) - LOWER ) ; spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ;
spinbutton_after .set_value( Sector_To_MB( next ) ) ; spinbutton_after .set_value( Sector_To_MB( next ) ) ;
frame_resizer_base ->set_size_limits( (int) (fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( LOWER, UPPER ) ; Set_MinMax_Text( fs .MIN, fs .MAX ) ;
} }
@ -195,7 +199,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
//set values of spinbutton_before (we assume there is no fixed start.) //set values of spinbutton_before (we assume there is no fixed start.)
if ( first == 0 ) //no logicals if ( first == 0 ) //no logicals
spinbutton_before .set_range( 0, TOTAL_MB - 1 ) ; spinbutton_before .set_range( 0, TOTAL_MB - BUF/2 ) ;
else else
spinbutton_before .set_range( 0, Sector_To_MB (first - START) ) ; spinbutton_before .set_range( 0, Sector_To_MB (first - START) ) ;
@ -203,23 +207,22 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
//set values of spinbutton_size //set values of spinbutton_size
if ( first == 0 ) //no logicals if ( first == 0 ) //no logicals
spinbutton_size .set_range( 1, TOTAL_MB ) ; spinbutton_size .set_range( BUF/2, TOTAL_MB ) ;
else else
spinbutton_size .set_range( Sector_To_MB( used ), TOTAL_MB ) ; spinbutton_size .set_range( Sector_To_MB( used ), TOTAL_MB ) ;
spinbutton_size .set_value( selected_partition .Get_Length_MB() ) ; spinbutton_size .set_value( selected_partition .Get_Length_MB( ) ) ;
//set values of spinbutton_after //set values of spinbutton_after
if ( first == 0 ) //no logicals if ( first == 0 ) //no logicals
spinbutton_after .set_range( 0, TOTAL_MB -1 ) ; spinbutton_after .set_range( 0, TOTAL_MB - BUF/2 ) ;
else else
spinbutton_after .set_range( 0, Sector_To_MB( total_length + START - first - used) ) ; spinbutton_after .set_range( 0, Sector_To_MB( total_length + START - first - used) ) ;
spinbutton_after .set_value( Sector_To_MB( next ) ) ; spinbutton_after .set_value( Sector_To_MB( next ) ) ;
//set contents of label_minmax //set contents of label_minmax
Set_MinMax_Text( Sector_To_MB( used ) +1, Sector_To_MB( total_length ) ) ; Set_MinMax_Text( first == 0 ? BUF/2 : Sector_To_MB( used ), Sector_To_MB( total_length ) ) ;
} }

View File

@ -20,27 +20,27 @@
Frame_Resizer_Base::Frame_Resizer_Base() Frame_Resizer_Base::Frame_Resizer_Base()
{ {
this ->fixed_start = false ; this ->fixed_start = false ;
init() ; init( ) ;
} }
void Frame_Resizer_Base::init() void Frame_Resizer_Base::init()
{ {
drawingarea.set_size_request( 536, 50 ); drawingarea .set_size_request( 536, 50 );
drawingarea.signal_realize().connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_realize) ) ; 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_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_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_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_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_leave_notify_event( ) .connect( sigc::mem_fun(*this, &Frame_Resizer_Base::drawingarea_on_leave_notify) ) ;
this ->add( drawingarea ) ; this ->add( drawingarea ) ;
color_used.set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ; color_used .set( "#F8F8BA" ); this ->get_colormap( ) ->alloc_color( color_used ) ;
color_unused.set( "white" ); this ->get_colormap() ->alloc_color( color_unused ) ; color_unused .set( "white" ); this ->get_colormap( ) ->alloc_color( color_unused ) ;
color_arrow.set( "black" ); this ->get_colormap() ->alloc_color( color_arrow ) ; color_arrow .set( "black" ); this ->get_colormap( ) ->alloc_color( color_arrow ) ;
color_background.set( "darkgrey" ); this ->get_colormap() ->alloc_color( color_background ) ; 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_arrow_rectangle .set( "lightgrey" ); this ->get_colormap( ) ->alloc_color( color_arrow_rectangle ) ;
cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ; cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ;
cursor_normal = new Gdk::Cursor( Gdk::LEFT_PTR ) ; cursor_normal = new Gdk::Cursor( Gdk::LEFT_PTR ) ;
@ -48,13 +48,14 @@ void Frame_Resizer_Base::init()
GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false; GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false;
X_END = 0; X_END = 0;
set_size_limits( 0, 500 ) ;
Gdk::Point p;
p.set_y( 15); arrow_points.push_back( p ) ;
p.set_y( 25); arrow_points.push_back( p ) ;
p.set_y( 35); arrow_points.push_back( p ) ;
this ->show_all_children(); Gdk::Point p;
p .set_y( 15 ); arrow_points .push_back( p ) ;
p .set_y( 25 ); arrow_points .push_back( p ) ;
p .set_y( 35 ); arrow_points .push_back( p ) ;
this ->show_all_children( );
} }
@ -100,6 +101,12 @@ void Frame_Resizer_Base::set_used_start( int used_start )
this ->USED_START = used_start +10; 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 ;
}
int Frame_Resizer_Base::get_used() int Frame_Resizer_Base::get_used()
{ {
return USED ; return USED ;
@ -152,13 +159,13 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev )
//here's where the real work is done ;-) //here's where the real work is done ;-)
if ( GRIP_LEFT || GRIP_RIGHT || GRIP_MOVE) if ( GRIP_LEFT || GRIP_RIGHT || GRIP_MOVE)
{ {
if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= X_END - USED - BORDER * 2 ) 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 )
{ {
X_START =(int) ev -> x ; X_START =(int) 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 ) 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 >= X_START + USED + BORDER *2 && ev ->x <= 526 ) 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 )
{ {
X_END = (int) ev ->x ; X_END = (int) 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 ) 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 )

View File

@ -172,7 +172,7 @@ void GParted_Core::set_device_partitions( Device & device, bool deep_scan )
{ {
Set_Used_Sectors( partition_temp ) ; Set_Used_Sectors( partition_temp ) ;
//the 'Unknow' filesystem warning overrules this one //the 'Unknown' filesystem warning overrules this one
if ( partition_temp .sectors_used == -1 && partition_temp .error .empty( ) ) if ( partition_temp .sectors_used == -1 && partition_temp .error .empty( ) )
{ {
partition_temp .error = _("Unable to read the contents of this filesystem!") ; partition_temp .error = _("Unable to read the contents of this filesystem!") ;