removed sleep( 1 ). This isn't needed anymore now the layout is scanned
* src/GParted_Core.cc: removed sleep( 1 ). This isn't needed anymore now the layout is scanned before the re-readtest. (saves seconds at scantime :) ) * replaced C-style typeconversion with static_casts throughout the project.
This commit is contained in:
parent
fb4af15865
commit
fa255c48de
|
@ -1,4 +1,9 @@
|
||||||
2005-01-11 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2005-01-19 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* src/GParted_Core.cc: removed sleep( 1 ). This isn't needed anymore now the layout is scanned before the re-readtest. (saves seconds at scantime :) )
|
||||||
|
* replaced C-style typeconversion with static_casts throughout the project.
|
||||||
|
|
||||||
|
2005-01-18 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* include/Utils.h: used static_cast<> instead of C-style type conversion.
|
* include/Utils.h: used static_cast<> instead of C-style type conversion.
|
||||||
* src/Makefile.am: install gparted binary in bin/ instead of sbin/ (as soon as i've time i want to implement a read-only modus)
|
* src/Makefile.am: install gparted binary in bin/ instead of sbin/ (as soon as i've time i want to implement a read-only modus)
|
||||||
|
|
|
@ -41,7 +41,6 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
||||||
//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);
|
||||||
|
|
||||||
|
|
||||||
//fill table
|
//fill table
|
||||||
table_resize .set_border_width( 5 ) ;
|
table_resize .set_border_width( 5 ) ;
|
||||||
table_resize .set_row_spacings( 5 ) ;
|
table_resize .set_row_spacings( 5 ) ;
|
||||||
|
@ -71,7 +70,6 @@ Dialog_Base_Partition::Dialog_Base_Partition( )
|
||||||
spinbutton_after .set_increments( 1, 100 );
|
spinbutton_after .set_increments( 1, 100 );
|
||||||
table_resize.attach( spinbutton_after, 1, 2, 2, 3, Gtk::FILL);
|
table_resize.attach( spinbutton_after, 1, 2, 2, 3, Gtk::FILL);
|
||||||
|
|
||||||
|
|
||||||
if ( ! fixed_start )
|
if ( ! fixed_start )
|
||||||
before_value = spinbutton_before .get_value() ;
|
before_value = spinbutton_before .get_value() ;
|
||||||
|
|
||||||
|
@ -161,7 +159,6 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
|
||||||
case PASTE : this->add_button( Gtk::Stock::PASTE,Gtk::RESPONSE_OK );
|
case PASTE : this->add_button( Gtk::Stock::PASTE,Gtk::RESPONSE_OK );
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog_Base_Partition::Set_MinMax_Text( long min, long max )
|
void Dialog_Base_Partition::Set_MinMax_Text( long min, long max )
|
||||||
|
@ -256,9 +253,9 @@ 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( Round( spinbutton_before .get_value( ) / MB_PER_PIXEL ) ) ;
|
||||||
|
|
||||||
frame_resizer_base ->set_x_end( (int) ( 500 - ( (double) spinbutton_after .get_value( ) / MB_PER_PIXEL ) + 0.5 ) ) ;
|
frame_resizer_base ->set_x_end( 500 - Round( spinbutton_after .get_value( ) / MB_PER_PIXEL ) ) ;
|
||||||
|
|
||||||
frame_resizer_base ->Draw_Partition( ) ;
|
frame_resizer_base ->Draw_Partition( ) ;
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,15 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
START = selected_partition .sector_start ;
|
START = selected_partition .sector_start ;
|
||||||
total_length = selected_partition .sector_end - selected_partition .sector_start ;
|
total_length = selected_partition .sector_end - selected_partition .sector_start ;
|
||||||
TOTAL_MB = selected_partition .Get_Length_MB( ) ;
|
TOTAL_MB = selected_partition .Get_Length_MB( ) ;
|
||||||
MB_PER_PIXEL = (double) TOTAL_MB / 500 ;
|
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
long COPIED_LENGTH_MB = copied_partition .Get_Length_MB( ) ;
|
long COPIED_LENGTH_MB = copied_partition .Get_Length_MB( ) ;
|
||||||
|
|
||||||
//now calculate proportional length of partition
|
//now calculate proportional length of partition
|
||||||
frame_resizer_base ->set_x_start( 0 ) ;
|
frame_resizer_base ->set_x_start( 0 ) ;
|
||||||
int x_end = Round( COPIED_LENGTH_MB / ( (double)TOTAL_MB/500 ) ) ; //> 500 px only possible with xfs...
|
int x_end = Round( COPIED_LENGTH_MB / ( TOTAL_MB/500.00 ) ) ; //> 500 px only possible with xfs...
|
||||||
frame_resizer_base ->set_x_end( x_end > 500 ? 500 : x_end ) ;
|
frame_resizer_base ->set_x_end( x_end > 500 ? 500 : x_end ) ;
|
||||||
frame_resizer_base ->set_used( Round( copied_partition .Get_Used_MB( ) / ( (double)TOTAL_MB/500) ) ) ;
|
frame_resizer_base ->set_used( Round( copied_partition .Get_Used_MB( ) / ( TOTAL_MB/500.00) ) ) ;
|
||||||
|
|
||||||
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
|
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
|
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
|
||||||
GRIP = false ;
|
GRIP = false ;
|
||||||
|
|
||||||
frame_resizer_base ->set_size_limits( (int) ( fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
|
frame_resizer_base ->set_size_limits( static_cast<int> (fs .MIN / MB_PER_PIXEL), static_cast<int> (fs .MAX / MB_PER_PIXEL) +1 ) ;
|
||||||
|
|
||||||
//set contents of label_minmax
|
//set contents of label_minmax
|
||||||
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
|
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
|
||||||
|
|
|
@ -103,8 +103,8 @@ void Dialog_Partition_Info::init_drawingarea( )
|
||||||
|
|
||||||
//calculate proportional width of used and unused
|
//calculate proportional width of used and unused
|
||||||
used = unused = 0 ;
|
used = unused = 0 ;
|
||||||
used = (int) ( ( (375 - BORDER *2) / ( (double) (partition .sector_end - partition .sector_start) / partition .sectors_used ) )+0.5 ) ;
|
used = Round( (375 - BORDER *2) / ( static_cast<double> (partition .sector_end - partition .sector_start) / partition .sectors_used ) ) ;
|
||||||
unused = 375 - used - (BORDER *2) ;
|
unused = 375 - used - BORDER *2 ;
|
||||||
|
|
||||||
//allocate some colors
|
//allocate some colors
|
||||||
color_used.set( "#F8F8BA" ); this ->get_colormap( ) ->alloc_color( color_used ) ;
|
color_used.set( "#F8F8BA" ); this ->get_colormap( ) ->alloc_color( color_used ) ;
|
||||||
|
@ -117,7 +117,6 @@ void Dialog_Partition_Info::init_drawingarea( )
|
||||||
|
|
||||||
//set text of pangolayout
|
//set text of pangolayout
|
||||||
pango_layout = drawingarea .create_pango_layout ( partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB( ) ) ) ;
|
pango_layout = drawingarea .create_pango_layout ( partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB( ) ) ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog_Partition_Info::Display_Info( )
|
void Dialog_Partition_Info::Display_Info( )
|
||||||
|
@ -140,7 +139,7 @@ void Dialog_Partition_Info::Display_Info( )
|
||||||
if ( partition.sectors_used != -1 )
|
if ( partition.sectors_used != -1 )
|
||||||
{
|
{
|
||||||
//calculate relative diskusage
|
//calculate relative diskusage
|
||||||
int percent_used = (int) ( (double) partition.Get_Used_MB( ) / partition .Get_Length_MB( ) *100 +0.5 ) ;
|
int percent_used = Round( static_cast<double> (partition .Get_Used_MB( ) ) / partition .Get_Length_MB( ) *100 ) ;
|
||||||
|
|
||||||
//used
|
//used
|
||||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Used:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL ) ;
|
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Used:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL ) ;
|
||||||
|
@ -218,14 +217,12 @@ Glib::ustring Dialog_Partition_Info::Find_Status( )
|
||||||
else if ( partition .filesystem == "linux-swap" )
|
else if ( partition .filesystem == "linux-swap" )
|
||||||
return _("Active") ;
|
return _("Active") ;
|
||||||
|
|
||||||
|
|
||||||
//try to find the mountpoint in /proc/mounts
|
//try to find the mountpoint in /proc/mounts
|
||||||
//get realpath
|
//get realpath
|
||||||
char real_path[ 4096 ] ;
|
char real_path[ 4096 ] ;
|
||||||
realpath( partition .partition .c_str( ), real_path );
|
realpath( partition .partition .c_str( ), real_path );
|
||||||
Glib::ustring mountpoint, partition_real_path = real_path ; //because root partition is listed as /dev/root we need te compare against te real path..
|
Glib::ustring mountpoint, partition_real_path = real_path ; //because root partition is listed as /dev/root we need te compare against te real path..
|
||||||
|
|
||||||
|
|
||||||
std::ifstream file_mounts( "/proc/mounts" ) ;
|
std::ifstream file_mounts( "/proc/mounts" ) ;
|
||||||
std::string line ;
|
std::string line ;
|
||||||
|
|
||||||
|
@ -241,8 +238,6 @@ Glib::ustring Dialog_Partition_Info::Find_Status( )
|
||||||
|
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file_mounts .close( ) ;
|
file_mounts .close( ) ;
|
||||||
|
@ -252,7 +247,6 @@ Glib::ustring Dialog_Partition_Info::Find_Status( )
|
||||||
mountpoint = "/" ;
|
mountpoint = "/" ;
|
||||||
|
|
||||||
return String::ucompose( _("Mounted on %1"), mountpoint ) ;
|
return String::ucompose( _("Mounted on %1"), mountpoint ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog_Partition_Info::~Dialog_Partition_Info( )
|
Dialog_Partition_Info::~Dialog_Partition_Info( )
|
||||||
|
@ -263,5 +257,4 @@ Dialog_Partition_Info::~Dialog_Partition_Info( )
|
||||||
this ->get_colormap( ) ->free_colors( color_partition, 1 ) ;
|
this ->get_colormap( ) ->free_colors( color_partition, 1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -88,7 +88,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
|
||||||
START = partition.sector_start ;
|
START = partition.sector_start ;
|
||||||
total_length = partition.sector_end - partition.sector_start ;
|
total_length = partition.sector_end - partition.sector_start ;
|
||||||
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 = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
//set first enabled filesystem
|
//set first enabled filesystem
|
||||||
optionmenu_filesystem .set_history( first_creatable_fs ) ;
|
optionmenu_filesystem .set_history( first_creatable_fs ) ;
|
||||||
|
@ -183,7 +183,7 @@ 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 ;
|
||||||
|
|
||||||
frame_resizer_base ->set_size_limits( (int) (fs .MIN / MB_PER_PIXEL), (int) (fs .MAX / MB_PER_PIXEL) +1 ) ;
|
frame_resizer_base ->set_size_limits( static_cast<int> (fs .MIN / MB_PER_PIXEL), static_cast<int> (fs .MAX / MB_PER_PIXEL) +1 ) ;
|
||||||
|
|
||||||
//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 ) ;
|
||||||
|
@ -227,6 +227,4 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -101,12 +101,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
||||||
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
||||||
TOTAL_MB = Sector_To_MB( total_length ) ;
|
TOTAL_MB = Sector_To_MB( total_length ) ;
|
||||||
|
|
||||||
MB_PER_PIXEL = (double) TOTAL_MB / 500 ;
|
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
//now calculate proportional length of partition
|
//now calculate proportional length of partition
|
||||||
frame_resizer_base ->set_x_start( Round( (double) previous / ( (double)total_length/500) ) ) ;
|
frame_resizer_base ->set_x_start( Round( previous / ( total_length / 500.00 ) ) ) ;
|
||||||
frame_resizer_base ->set_x_end( ( Round( (double) (selected_partition.sector_end - selected_partition.sector_start) / ( (double)total_length/500) )) + frame_resizer_base ->get_x_start() ) ;
|
frame_resizer_base ->set_x_end( Round( (selected_partition .sector_end - selected_partition .sector_start) / ( total_length / 500.00 ) ) + frame_resizer_base ->get_x_start( ) ) ;
|
||||||
frame_resizer_base ->set_used( Round( (double) selected_partition.sectors_used / ( (double)total_length/500) ) ) ;
|
frame_resizer_base ->set_used( Round( selected_partition.sectors_used / ( total_length / 500.00 ) ) ) ;
|
||||||
|
|
||||||
if ( fs .shrink )
|
if ( fs .shrink )
|
||||||
{
|
{
|
||||||
|
@ -141,13 +141,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
||||||
spinbutton_after .set_range( 0, TOTAL_MB - fs .MIN ) ;
|
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 ) ;
|
frame_resizer_base ->set_size_limits( static_cast<int> (fs .MIN / MB_PER_PIXEL), static_cast<int> (fs .MAX / MB_PER_PIXEL) +1 ) ;
|
||||||
|
|
||||||
//set contents of label_minmax
|
//set contents of label_minmax
|
||||||
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
|
Set_MinMax_Text( fs .MIN, fs .MAX ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Partition> & partitions )
|
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Partition> & partitions )
|
||||||
{
|
{
|
||||||
//calculate total size in MB's of previous, current and next partition
|
//calculate total size in MB's of previous, current and next partition
|
||||||
|
@ -173,11 +172,11 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
||||||
//now we have enough data to calculate some important values..
|
//now we have enough data to calculate some important values..
|
||||||
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
||||||
TOTAL_MB = Sector_To_MB( total_length ) ;
|
TOTAL_MB = Sector_To_MB( total_length ) ;
|
||||||
MB_PER_PIXEL = (double) TOTAL_MB / 500 ;
|
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
|
||||||
|
|
||||||
//calculate proportional length of partition ( in pixels )
|
//calculate proportional length of partition ( in pixels )
|
||||||
frame_resizer_base ->set_x_start( Round( (double) previous / ( (double)total_length/500) ) ) ;
|
frame_resizer_base ->set_x_start( Round( previous / ( total_length / 500.00 ) ) ) ;
|
||||||
frame_resizer_base ->set_x_end( ( Round( (double) (selected_partition.sector_end - selected_partition.sector_start) / ( (double)total_length/500) ) ) + frame_resizer_base ->get_x_start() ) ;
|
frame_resizer_base ->set_x_end( Round( (selected_partition .sector_end - selected_partition .sector_start) / ( 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
|
//used is a bit different here... we consider start of first logical to end last logical as used space
|
||||||
Sector first =0, used =0 ;
|
Sector first =0, used =0 ;
|
||||||
|
@ -192,8 +191,8 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_resizer_base ->set_used_start( Round( (double) (first - START) / ( (double)total_length/500) ) ) ;
|
frame_resizer_base ->set_used_start( Round( (first - START) / ( total_length / 500.00 ) ) ) ;
|
||||||
frame_resizer_base ->set_used( Round( (double) used / ( (double)total_length/500) ) ) ;
|
frame_resizer_base ->set_used( Round( used / ( total_length / 500.00 ) ) ) ;
|
||||||
|
|
||||||
//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
|
||||||
|
@ -223,5 +222,4 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
||||||
Set_MinMax_Text( first == 0 ? BUF/2 : Sector_To_MB( used ), Sector_To_MB( total_length ) ) ;
|
Set_MinMax_Text( first == 0 ? BUF/2 : Sector_To_MB( used ), Sector_To_MB( total_length ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../include/Dialog_Progress.h"
|
#include "../include/Dialog_Progress.h"
|
||||||
|
#include <iostream>
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ Dialog_Progress::Dialog_Progress( int count_operations, Glib::RefPtr<Gtk::TextBu
|
||||||
|
|
||||||
this ->count_operations = count_operations ;
|
this ->count_operations = count_operations ;
|
||||||
current_operation_number = 0 ;
|
current_operation_number = 0 ;
|
||||||
fraction = (double) 1 / count_operations ;
|
fraction = 1.00 / count_operations ;
|
||||||
|
|
||||||
Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
Glib::ustring str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||||
str_temp += _( "Applying pending operations" ) ;
|
str_temp += _( "Applying pending operations" ) ;
|
||||||
|
@ -94,7 +94,7 @@ void Dialog_Progress::Set_Operation( )
|
||||||
|
|
||||||
if ( TIME_LEFT > 0 )
|
if ( TIME_LEFT > 0 )
|
||||||
{
|
{
|
||||||
fraction_current = (double) 1 / TIME_LEFT ;
|
fraction_current = 1.00 / TIME_LEFT ;
|
||||||
conn = Glib::signal_timeout( ) .connect( sigc::mem_fun( *this, &Dialog_Progress::Show_Progress ), 1000 );
|
conn = Glib::signal_timeout( ) .connect( sigc::mem_fun( *this, &Dialog_Progress::Show_Progress ), 1000 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -138,7 +138,6 @@ void Dialog_Progress::signal_textbuffer_insert( const Gtk::TextBuffer::iterator
|
||||||
textview_details .scroll_to( temp, 0 ) ;
|
textview_details .scroll_to( temp, 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Dialog_Progress::~Dialog_Progress()
|
Dialog_Progress::~Dialog_Progress()
|
||||||
{
|
{
|
||||||
conn .disconnect( ) ;
|
conn .disconnect( ) ;
|
||||||
|
|
|
@ -58,7 +58,6 @@ void Frame_Resizer_Base::init()
|
||||||
this ->show_all_children( );
|
this ->show_all_children( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Frame_Resizer_Base::set_rgb_partition_color( const Gdk::Color & color )
|
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 ) ;
|
||||||
|
@ -155,26 +154,25 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
||||||
drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ;
|
drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//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 && (X_END - ev ->x) <= MAX_SIZE && (X_END - ev ->x) >= MIN_SIZE )
|
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 = static_cast<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 <= 526 && ev ->x >= X_START + USED + BORDER *2 && (ev ->x - X_START) <= MAX_SIZE && (ev ->x - X_START) >= MIN_SIZE )
|
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 = static_cast<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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( GRIP_MOVE )
|
else if ( GRIP_MOVE )
|
||||||
{
|
{
|
||||||
temp_x = X_START + ((int) ev ->x - X_START_MOVE);
|
temp_x = X_START + static_cast<int> ( ev ->x - X_START_MOVE );
|
||||||
temp_y = X_END + ( (int) ev ->x - X_START_MOVE);
|
temp_y = X_END + static_cast<int> ( ev ->x - X_START_MOVE );
|
||||||
|
|
||||||
if ( temp_x >= 10 && temp_y <= 526 )
|
if ( temp_x >= 10 && temp_y <= 526 )
|
||||||
{
|
{
|
||||||
|
@ -182,7 +180,7 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
||||||
X_END = temp_y ;
|
X_END = temp_y ;
|
||||||
}
|
}
|
||||||
|
|
||||||
X_START_MOVE = (int) ev ->x ;
|
X_START_MOVE = static_cast<int> ( 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 )
|
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 )
|
||||||
}
|
}
|
||||||
|
@ -191,7 +189,6 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev )
|
bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev )
|
||||||
|
@ -203,7 +200,7 @@ bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev )
|
||||||
else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip
|
else if ( ev ->x >= X_END && ev ->x <= X_END + 10 && ev ->y >= 5 && ev ->y <= 45 ) //right grip
|
||||||
GRIP_RIGHT = true ;
|
GRIP_RIGHT = true ;
|
||||||
else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip
|
else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip
|
||||||
{ GRIP_MOVE = true ; X_START_MOVE = (int)ev ->x; }
|
{ GRIP_MOVE = true ; X_START_MOVE = static_cast<int> ( ev ->x ); }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +253,6 @@ void Frame_Resizer_Base::Draw_Partition( )
|
||||||
|
|
||||||
Draw_Resize_Grip( ARROW_RIGHT ) ;
|
Draw_Resize_Grip( ARROW_RIGHT ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Frame_Resizer_Base::Draw_Resize_Grip( ArrowType arrow_type )
|
void Frame_Resizer_Base::Draw_Resize_Grip( ArrowType arrow_type )
|
||||||
|
@ -284,10 +280,8 @@ void Frame_Resizer_Base::Draw_Resize_Grip( ArrowType arrow_type )
|
||||||
|
|
||||||
gc ->set_foreground( color_arrow );
|
gc ->set_foreground( color_arrow );
|
||||||
drawingarea .get_window( ) ->draw_polygon( gc , true, arrow_points );
|
drawingarea .get_window( ) ->draw_polygon( gc , 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_used, 1 ) ;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
Frame_Resizer_Extended::Frame_Resizer_Extended( )
|
Frame_Resizer_Extended::Frame_Resizer_Extended( )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
||||||
|
@ -35,22 +34,23 @@ bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev )
|
||||||
drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ;
|
drawingarea .get_parent_window( ) ->set_cursor( *cursor_normal ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GRIP_LEFT || GRIP_RIGHT )
|
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 ) )
|
if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= 510 && ev->x <= X_END - BORDER *2 && ( ev ->x <= USED_START || USED == 0 ) )
|
||||||
{
|
{
|
||||||
X_START =(int) ev -> x ;
|
X_START = static_cast<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 <= 526 && ev->x >= X_START + BORDER *2 && ev ->x >= USED_START + USED + BORDER *2 )
|
else if ( GRIP_RIGHT && ev ->x <= 526 && ev->x >= X_START + BORDER *2 && ev ->x >= USED_START + USED + BORDER *2 )
|
||||||
{
|
{
|
||||||
X_END = (int) ev ->x ;
|
X_END = static_cast<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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw_Partition( ) ;
|
Draw_Partition( ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,5 +75,4 @@ void Frame_Resizer_Extended::Draw_Partition()
|
||||||
//resize grips
|
//resize grips
|
||||||
Draw_Resize_Grip( ARROW_LEFT ) ;
|
Draw_Resize_Grip( ARROW_LEFT ) ;
|
||||||
Draw_Resize_Grip( ARROW_RIGHT ) ;
|
Draw_Resize_Grip( ARROW_RIGHT ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,10 +113,7 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
||||||
set_device_partitions( temp_device ) ;
|
set_device_partitions( temp_device ) ;
|
||||||
|
|
||||||
if ( temp_device .highest_busy )
|
if ( temp_device .highest_busy )
|
||||||
{
|
|
||||||
temp_device .readonly = ! ped_disk_commit_to_os( disk ) ;
|
temp_device .readonly = ! ped_disk_commit_to_os( disk ) ;
|
||||||
sleep( 1 ) ;//this sucks, but it seems that after the commit test, the paths are removed and added again (which takes time..)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//harddisk without disklabel
|
//harddisk without disklabel
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,7 +35,6 @@ Operation::Operation( const Device & device, const Partition & partition_origina
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Glib::ustring Operation::Get_String( )
|
Glib::ustring Operation::Get_String( )
|
||||||
{
|
{
|
||||||
Glib::ustring temp ;
|
Glib::ustring temp ;
|
||||||
|
@ -93,7 +92,6 @@ Glib::ustring Operation::Get_String( )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Operation::Apply_Operation_To_Visual( std::vector<Partition> & partitions )
|
void Operation::Apply_Operation_To_Visual( std::vector<Partition> & partitions )
|
||||||
{
|
{
|
||||||
switch ( operationtype )
|
switch ( operationtype )
|
||||||
|
@ -153,7 +151,7 @@ void Operation::Insert_Unallocated( std::vector<Partition> & partitions, Sector
|
||||||
|
|
||||||
int Operation::Get_Index_Original( std::vector<Partition> & partitions )
|
int Operation::Get_Index_Original( std::vector<Partition> & partitions )
|
||||||
{
|
{
|
||||||
for ( int t = 0 ; t < (int)partitions .size( ) ; t++ )
|
for ( int t = 0 ; t < static_cast<int> ( partitions .size( ) ) ; t++ )
|
||||||
if ( partition_original .sector_start >= partitions[ t ] .sector_start && partition_original .sector_end <= partitions[ t ] .sector_end )
|
if ( partition_original .sector_start >= partitions[ t ] .sector_start && partition_original .sector_end <= partitions[ t ] .sector_end )
|
||||||
{
|
{
|
||||||
//remove unallocated space preceding the original partition
|
//remove unallocated space preceding the original partition
|
||||||
|
@ -161,7 +159,7 @@ int Operation::Get_Index_Original( std::vector<Partition> & partitions )
|
||||||
partitions .erase( partitions .begin( ) + --t );
|
partitions .erase( partitions .begin( ) + --t );
|
||||||
|
|
||||||
//remove unallocated space following the original partition
|
//remove unallocated space following the original partition
|
||||||
if ( t +1 < (int)partitions .size( ) && partitions[ t +1 ] .type == GParted::UNALLOCATED )
|
if ( t +1 < static_cast<int> ( partitions .size( ) ) && partitions[ t +1 ] .type == GParted::UNALLOCATED )
|
||||||
partitions .erase( partitions .begin( ) + t +1 );
|
partitions .erase( partitions .begin( ) + t +1 );
|
||||||
|
|
||||||
return t ;
|
return t ;
|
||||||
|
|
|
@ -46,13 +46,13 @@ VBox_VisualDisk::VBox_VisualDisk( const std::vector<Partition> & partitions, con
|
||||||
|
|
||||||
|
|
||||||
//since disksegments have minimal sizes ( unallocated 15 and partitions 20 pixels ) i do some checking to prevent the visual disk from growing to much
|
//since disksegments have minimal sizes ( unallocated 15 and partitions 20 pixels ) i do some checking to prevent the visual disk from growing to much
|
||||||
Sector sectors_per_pixel = Round( (double) device_length / 750 ) ;
|
Sector sectors_per_pixel = Round( device_length / 750.00 ) ;
|
||||||
|
|
||||||
double width, extra_pixels = 0 ;
|
double extra_pixels = 0 ;
|
||||||
|
|
||||||
for ( unsigned int t = 0; t < partitions .size( ) ; t++ )
|
for ( unsigned int t = 0; t < partitions .size( ) ; t++ )
|
||||||
{
|
{
|
||||||
width = (double) (partitions[ t ] .sector_end - partitions[ t ] .sector_start) / sectors_per_pixel ;
|
double width = static_cast<double> (partitions[ t ] .sector_end - partitions[ t ] .sector_start) / sectors_per_pixel ;
|
||||||
|
|
||||||
if ( (partitions[ t ] .type == GParted::PRIMARY || partitions[ t ] .type == GParted::LOGICAL) && width < 20 )
|
if ( (partitions[ t ] .type == GParted::PRIMARY || partitions[ t ] .type == GParted::LOGICAL) && width < 20 )
|
||||||
extra_pixels += (20 - width) ;
|
extra_pixels += (20 - width) ;
|
||||||
|
@ -121,11 +121,10 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
||||||
hbox_extended ->pack_start( *( visual_partitions .back( ) ->drawingarea ), Gtk::PACK_SHRINK ) ;
|
hbox_extended ->pack_start( *( visual_partitions .back( ) ->drawingarea ), Gtk::PACK_SHRINK ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
visual_partitions .back( ) ->length = (int) (SCREEN_WIDTH / (double) ( device_length / (double) ( partition .sector_end - partition .sector_start) ) );
|
visual_partitions .back( ) ->length = static_cast<int> ( SCREEN_WIDTH / ( device_length / static_cast<double> (partition .sector_end - partition .sector_start) ) );
|
||||||
if ( visual_partitions .back( ) ->length < 20 )//we need a min. size. Otherwise some small partitions wouldn't be visible
|
if ( visual_partitions .back( ) ->length < 20 )//we need a min. size. Otherwise some small partitions wouldn't be visible
|
||||||
visual_partitions .back( ) ->length = ( partition .type == GParted::UNALLOCATED ) ? 15 : 20 ;
|
visual_partitions .back( ) ->length = ( partition .type == GParted::UNALLOCATED ) ? 15 : 20 ;
|
||||||
|
|
||||||
|
@ -143,8 +142,7 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
||||||
if ( partition .type == GParted::UNALLOCATED )
|
if ( partition .type == GParted::UNALLOCATED )
|
||||||
visual_partitions .back( ) ->used = -1;
|
visual_partitions .back( ) ->used = -1;
|
||||||
else
|
else
|
||||||
visual_partitions .back( ) ->used = (int) ( (visual_partitions .back( ) ->length - (BORDER *2)) / (double) ( ( partition .sector_end - partition .sector_start) / (double)partition .sectors_used ) ) ;
|
visual_partitions .back( ) ->used = static_cast<int> ( (visual_partitions .back( ) ->length - (BORDER *2)) / ( static_cast<double> (partition .sector_end - partition .sector_start) / partition .sectors_used ) );
|
||||||
|
|
||||||
|
|
||||||
visual_partitions.back( ) ->color_fs = partition .color;
|
visual_partitions.back( ) ->color_fs = partition .color;
|
||||||
this ->get_colormap( ) ->alloc_color( visual_partitions .back( ) ->color_fs );
|
this ->get_colormap( ) ->alloc_color( visual_partitions .back( ) ->color_fs );
|
||||||
|
@ -250,7 +248,6 @@ void VBox_VisualDisk::Set_Selected( const Partition & partition )
|
||||||
if ( temp >= 0 ) //prevent segfault at firsttime selection
|
if ( temp >= 0 ) //prevent segfault at firsttime selection
|
||||||
drawingarea_on_expose( NULL, visual_partitions[ temp ] ) ;
|
drawingarea_on_expose( NULL, visual_partitions[ temp ] ) ;
|
||||||
|
|
||||||
|
|
||||||
if ( partition.type == GParted::EXTENDED )
|
if ( partition.type == GParted::EXTENDED )
|
||||||
return; //extended can not be selected in visualdisk (yet )
|
return; //extended can not be selected in visualdisk (yet )
|
||||||
|
|
||||||
|
@ -264,10 +261,8 @@ void VBox_VisualDisk::Set_Selected( const Partition & partition )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void VBox_VisualDisk::drawingarea_on_realize( Visual_Partition* vp )
|
void VBox_VisualDisk::drawingarea_on_realize( Visual_Partition* vp )
|
||||||
{
|
{
|
||||||
vp ->gc = Gdk::GC::create( vp ->drawingarea ->get_window( ) );
|
vp ->gc = Gdk::GC::create( vp ->drawingarea ->get_window( ) );
|
||||||
|
@ -325,10 +320,6 @@ VBox_VisualDisk::~VBox_VisualDisk( )
|
||||||
this ->get_colormap( ) ->free_colors( color_used, 1 ) ;
|
this ->get_colormap( ) ->free_colors( color_used, 1 ) ;
|
||||||
this ->get_colormap( ) ->free_colors( color_unused, 1 ) ;
|
this ->get_colormap( ) ->free_colors( color_unused, 1 ) ;
|
||||||
this ->get_colormap( ) ->free_colors( color_text, 1 ) ;
|
this ->get_colormap( ) ->free_colors( color_text, 1 ) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -995,7 +995,7 @@ void Win_GParted::activate_delete( )
|
||||||
if ( selected_partition .status == GParted::STAT_NEW )
|
if ( selected_partition .status == GParted::STAT_NEW )
|
||||||
{
|
{
|
||||||
//remove all operations done on this new partition (this includes creation)
|
//remove all operations done on this new partition (this includes creation)
|
||||||
for ( int t = 0 ; t < (int) operations .size( ) ; t++ ) //I removed the unsigned because t will be negative at times...
|
for ( int t = 0 ; t < static_cast<int> ( operations .size( ) ) ; t++ ) //I removed the unsigned because t will be negative at times...
|
||||||
if ( operations[ t ] .partition_new .partition == selected_partition .partition )
|
if ( operations[ t ] .partition_new .partition == selected_partition .partition )
|
||||||
operations.erase( operations .begin( ) + t-- ) ;
|
operations.erase( operations .begin( ) + t-- ) ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue