added convenience function. Also fixed a small bug with incorrect labelvalue of fat16 upper limit
This commit is contained in:
parent
72f91cbc39
commit
05ee2f2254
|
@ -1,3 +1,11 @@
|
|||
2004-10-0i2 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* include/Dialog_Base_Partition.h,
|
||||
src/Dialog_Base_Partition.cc: added void Set_MinMax_Text( long min, long max )
|
||||
* src/Dialog_Partition_Copy.cc: fix incorrect upper limit for fat16 in label
|
||||
* src/Dialog_Partition_New.cc: make use of this function, instead of accessing the label directly
|
||||
* src/Dialog_Partition_Resize_Move.cc: fix incorrect upper limit for fat16 in label
|
||||
|
||||
2004-10-0i2 Bart Hakvoort <gparted@users.sf.net>
|
||||
|
||||
* removed all stringstreams from the project (they were possibly responsible for rare chrashes in certain locales)
|
||||
|
|
|
@ -56,6 +56,7 @@ protected:
|
|||
};
|
||||
|
||||
void Set_Confirm_Button( CONFIRMBUTTON button_type ) ;
|
||||
void Set_MinMax_Text( long min, long max ) ;
|
||||
|
||||
double MB_PER_PIXEL ;
|
||||
long TOTAL_MB ;
|
||||
|
@ -66,7 +67,6 @@ protected:
|
|||
Sector total_length ; //total amount of sectors ( this can be up to 3 partitions...)
|
||||
|
||||
Gtk::HBox hbox_main ;
|
||||
Gtk::Label label_minmax ;
|
||||
Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
|
||||
|
||||
//used to enable/disable OKbutton...
|
||||
|
@ -82,15 +82,17 @@ protected:
|
|||
int x_start, x_end ;
|
||||
|
||||
private:
|
||||
void Check_Change() ;
|
||||
|
||||
void Check_Change() ;
|
||||
|
||||
Gtk::VBox vbox_resize_move;
|
||||
Gtk::Label *label_temp;
|
||||
Gtk::Label label_minmax ;
|
||||
Gtk::Table table_resize;
|
||||
Gtk::HBox hbox_table, hbox_resizer, hbox_resize_move;
|
||||
Gtk::Tooltips tooltips;
|
||||
Gtk::Button button_resize_move ;
|
||||
Gtk::Image *image_temp ;
|
||||
|
||||
Glib::ustring str_temp ;
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -51,26 +51,21 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
|||
vbox_resize_move .pack_start( hbox_table, Gtk::PACK_SHRINK );
|
||||
|
||||
//add spinbutton_before
|
||||
label_temp = manage( new Gtk::Label( (Glib::ustring) _( "Free Space Preceding (MB) :") + " \t" ) ) ;
|
||||
table_resize.attach( *label_temp, 0, 1, 0, 1, Gtk::SHRINK);
|
||||
table_resize.attach( * mk_label( (Glib::ustring) _( "Free Space Preceding (MB) :") + " \t" ), 0, 1, 0, 1, Gtk::SHRINK);
|
||||
|
||||
spinbutton_before .set_numeric( true );
|
||||
spinbutton_before .set_increments( 1, 100 );
|
||||
table_resize.attach( spinbutton_before, 1, 2, 0, 1, Gtk::FILL);
|
||||
|
||||
//add spinbutton_size
|
||||
label_temp = manage( new Gtk::Label( _( "New Size (MB) :") ) ) ;
|
||||
label_temp ->set_alignment( Gtk::ALIGN_LEFT );
|
||||
table_resize.attach( *label_temp, 0, 1, 1, 2 );
|
||||
table_resize.attach( * mk_label( _( "New Size (MB) :" ) ), 0, 1, 1, 2 );
|
||||
|
||||
spinbutton_size .set_numeric( true );
|
||||
spinbutton_size .set_increments( 1, 100 );
|
||||
table_resize.attach( spinbutton_size, 1, 2, 1, 2, Gtk::FILL);
|
||||
|
||||
//add spinbutton_after
|
||||
label_temp = manage( new Gtk::Label( _( "Free Space Following (MB) :") ) ) ;
|
||||
label_temp ->set_alignment( Gtk::ALIGN_LEFT );
|
||||
table_resize.attach( *label_temp, 0, 1, 2, 3 ) ;
|
||||
table_resize.attach( * mk_label( _( "Free Space Following (MB) :") ), 0, 1, 2, 3 ) ;
|
||||
|
||||
spinbutton_after .set_numeric( true );
|
||||
spinbutton_after .set_increments( 1, 100 );
|
||||
|
@ -87,11 +82,8 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
|||
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) ) ;
|
||||
|
||||
//pack label which warns about small differences in values..
|
||||
label_temp = manage( new Gtk::Label( ) );
|
||||
label_temp ->set_markup( "\n <i>" + (Glib::ustring) _( "NOTE: values on disk may differ slightly from the values entered here.") + "</i>" );
|
||||
label_temp ->set_alignment( Gtk::ALIGN_LEFT ) ;
|
||||
this ->get_vbox() ->pack_start( *label_temp, Gtk::PACK_SHRINK );
|
||||
//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( *( manage( new Gtk::Label( "") ) ), Gtk::PACK_SHRINK ); //filler :-P
|
||||
|
||||
|
@ -156,13 +148,13 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
|
|||
case NEW : this->add_button( Gtk::Stock::ADD,Gtk::RESPONSE_OK );
|
||||
break ;
|
||||
case RESIZE_MOVE: if ( selected_partition.filesystem == "ext2" || selected_partition.filesystem == "ext3" )
|
||||
label_temp = manage( new Gtk::Label( _("Resize") ) ) ;
|
||||
str_temp = _("Resize") ;
|
||||
else
|
||||
label_temp = manage( new Gtk::Label( _("Resize/Move") ) ) ;
|
||||
str_temp = _("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( *label_temp, Gtk::PACK_EXPAND_PADDING ) ;
|
||||
hbox_resize_move .pack_start( * mk_label( str_temp ), Gtk::PACK_EXPAND_PADDING ) ;
|
||||
button_resize_move .add( hbox_resize_move ) ;
|
||||
|
||||
this ->add_action_widget ( button_resize_move,Gtk::RESPONSE_OK ) ;
|
||||
|
@ -175,6 +167,13 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
|
|||
|
||||
}
|
||||
|
||||
void Dialog_Base_Partition::Set_MinMax_Text( long min, long max )
|
||||
{
|
||||
str_temp = String::ucompose( _("Minimum Size: %1 MB"), min ) + "\t\t" ;
|
||||
str_temp += String::ucompose( _("Maximum Size: %1 MB"), max ) ;
|
||||
label_minmax .set_text( str_temp ) ;
|
||||
}
|
||||
|
||||
void Dialog_Base_Partition::on_signal_move( int x_start, int x_end )
|
||||
{
|
||||
GRIP = true ;
|
||||
|
@ -261,7 +260,7 @@ void Dialog_Base_Partition::on_signal_resize( int x_start, int x_end, Frame_Resi
|
|||
GRIP = false ;
|
||||
}
|
||||
|
||||
void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
|
||||
void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton )
|
||||
{
|
||||
if ( ! GRIP )
|
||||
{
|
||||
|
@ -283,7 +282,7 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton
|
|||
case AFTER : if ( ! fixed_start )
|
||||
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;
|
||||
}
|
||||
|
@ -291,7 +290,7 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton
|
|||
|
||||
//And apply the changes to the visual view...
|
||||
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 ) ) ;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void Dialog_Partition_Copy::Set_Data( Partition & selected_partition, Partition
|
|||
spinbutton_before .set_value( 0 ) ;
|
||||
|
||||
//set values of spinbutton_size (check for fat16 maxsize of 1023 MB)
|
||||
double UPPER;
|
||||
long UPPER;
|
||||
if ( copied_partition.filesystem == "fat16" && Sector_To_MB( total_length ) > 1023 )
|
||||
UPPER = 1023 ;
|
||||
else
|
||||
|
@ -65,9 +65,7 @@ void Dialog_Partition_Copy::Set_Data( Partition & selected_partition, Partition
|
|||
spinbutton_after .set_value( TOTAL_MB - copied_partition .Get_Length_MB() ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), copied_partition .Get_Length_MB() +1 ) + "\t\t" ;
|
||||
str_temp += String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
|
||||
label_minmax.set_text( str_temp ) ;
|
||||
Set_MinMax_Text( copied_partition .Get_Length_MB() +1, UPPER ) ;
|
||||
|
||||
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
|
||||
this ->selected_partition = copied_partition ;
|
||||
|
|
|
@ -108,9 +108,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
|
|||
GRIP = false ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), 1 ) +"\t\t" ;
|
||||
str_temp += String::ucompose( _("Maximum Size: %1 MB"), TOTAL_MB ) ;
|
||||
label_minmax.set_text( str_temp ) ;
|
||||
Set_MinMax_Text( 1, TOTAL_MB ) ;
|
||||
|
||||
this ->show_all_children() ;
|
||||
}
|
||||
|
@ -195,9 +193,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
|||
spinbutton_after .set_range( 0, TOTAL_MB - MIN ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), MIN ) + "\t\t" ;
|
||||
str_temp += String::ucompose( _("Maximum Size: %1 MB"), MAX ) ;
|
||||
label_minmax.set_text( str_temp ) ;
|
||||
Set_MinMax_Text( MIN, MAX ) ;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
|
||||
//set values of spinbutton_size
|
||||
//since some filesystems have upper and lower limits we need to check for this
|
||||
double LOWER, UPPER;
|
||||
long LOWER, UPPER;
|
||||
if ( selected_partition.filesystem == "fat16" && selected_partition .Get_Used_MB() < 32 )
|
||||
LOWER = 32 +1 ;
|
||||
else if ( selected_partition.filesystem == "fat32" && selected_partition .Get_Used_MB() < 256 )
|
||||
|
@ -137,9 +137,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
|||
spinbutton_after .set_value( Sector_To_MB( next ) ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), LOWER ) + "\t\t" ;
|
||||
str_temp += String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
|
||||
label_minmax.set_text( str_temp ) ;
|
||||
Set_MinMax_Text( LOWER, UPPER ) ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -225,9 +223,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
|||
spinbutton_after .set_value( Sector_To_MB( next ) ) ;
|
||||
|
||||
//set contents of label_minmax
|
||||
Glib::ustring str_temp = String::ucompose( _("Minimum Size: %1 MB"), Sector_To_MB( used ) +1 ) + "\t\t" ;
|
||||
str_temp += String::ucompose( _("Maximum Size: %1 MB"), Sector_To_MB( total_length ) ) ;
|
||||
label_minmax.set_text( str_temp ) ;
|
||||
Set_MinMax_Text( Sector_To_MB( used ) +1, Sector_To_MB( total_length ) ) ;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue