[gparted] Rename Dialog_Base_Partition member to new_partition



commit 32a5ace1561f7b304129ab5a06e4f4c57e0af5e6
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue May 26 22:38:42 2015 +0100

    Rename Dialog_Base_Partition member to new_partition
    
    The member variable was named selected_partition.  It is assigned from
    Win_GParted::selected_partition_ptr (which is a pointer to a const
    partition object so is never updated).  This gives connotations that it
    won't be modified.
    
    However it is updated freely as the new resultant partition object is
    prepared before being returned from the dialog, most notable in the
    Get_New_Partition() methods.
    
    Therefore rename from selected_partition to new_partition.

 include/Dialog_Base_Partition.h     |    4 +-
 src/Dialog_Base_Partition.cc        |   66 +++++++++++------------
 src/Dialog_Partition_Copy.cc        |   15 +++---
 src/Dialog_Partition_New.cc         |   36 ++++++------
 src/Dialog_Partition_Resize_Move.cc |   98 +++++++++++++++++-----------------
 5 files changed, 108 insertions(+), 111 deletions(-)
---
diff --git a/include/Dialog_Base_Partition.h b/include/Dialog_Base_Partition.h
index f262443..ea65116 100644
--- a/include/Dialog_Base_Partition.h
+++ b/include/Dialog_Base_Partition.h
@@ -64,8 +64,8 @@ protected:
        double MB_PER_PIXEL ;
        Sector TOTAL_MB ;
        Frame_Resizer_Base *frame_resizer_base;
-       Partition selected_partition ;
-       
+       Partition new_partition;
+
        Sector START; //the first sector of the first relevant partition ( this is either current or current 
-1 )  needed in Get_Resized_Partition()
        Sector total_length ; //total amount of sectors ( this can be up to 3 partitions...)
 
diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc
index 4f4f654..8ff1fcd 100644
--- a/src/Dialog_Base_Partition.cc
+++ b/src/Dialog_Base_Partition.cc
@@ -139,94 +139,92 @@ void Dialog_Base_Partition::Set_Resizer( bool extended )
 Partition Dialog_Base_Partition::Get_New_Partition( Byte_Value sector_size )
 {
        prepare_new_partition( sector_size );
-       return selected_partition;
+       return new_partition;
 }
 
 void Dialog_Base_Partition::prepare_new_partition( Byte_Value sector_size )
 {
        //set sector size of new partition
-       selected_partition .sector_size = sector_size;
-       Sector old_size = selected_partition .get_sector_length() ;
+       new_partition.sector_size = sector_size;
+       Sector old_size = new_partition.get_sector_length();
 
        //FIXME:  Partition size is limited to just less than 1024 TeraBytes due
        //        to the maximum value of signed 4 byte integer.
        if ( ORIG_BEFORE != spinbutton_before .get_value_as_int() )
-               selected_partition .sector_start = START + Sector(spinbutton_before .get_value_as_int()) * 
(MEBIBYTE / sector_size) ;   
+               new_partition.sector_start = START + Sector(spinbutton_before.get_value_as_int()) * (MEBIBYTE 
/ sector_size);
 
        if ( ORIG_AFTER != spinbutton_after .get_value_as_int() )
-               selected_partition .sector_end =
-                       selected_partition .sector_start
+               new_partition.sector_end =
+                       new_partition.sector_start
                        + Sector(spinbutton_size .get_value_as_int()) * (MEBIBYTE / sector_size)
                        - 1 /* one sector short of exact mebibyte multiple */;
 
        //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 -1) ) 
-               selected_partition .sector_end = START + total_length -1 ;
+       if ( new_partition.sector_start < START )
+               new_partition.sector_start = START;
+       if ( new_partition.sector_end > ( START + total_length - 1 ) )
+               new_partition.sector_end = START + total_length - 1;
        
        //grow a bit into small freespace ( < 1MiB ) 
-       if ( (selected_partition .sector_start - START) < (MEBIBYTE / sector_size) )
-               selected_partition .sector_start = START ;
-       if ( ( START + total_length -1 - selected_partition .sector_end ) < (MEBIBYTE / sector_size) )
-               selected_partition .sector_end = START + total_length -1 ;
-       
+       if ( (new_partition.sector_start - START) < (MEBIBYTE / sector_size) )
+               new_partition.sector_start = START;
+       if ( ( START + total_length -1 - new_partition.sector_end ) < (MEBIBYTE / sector_size) )
+               new_partition.sector_end = START + total_length - 1;
+
        //set alignment
        switch ( optionmenu_alignment .get_history() )
        {
-               case  0 :  selected_partition .alignment = ALIGN_CYLINDER;  break;
-               case  1 :  selected_partition .alignment = ALIGN_MEBIBYTE;
+               case  0 :  new_partition.alignment = ALIGN_CYLINDER;  break;
+               case  1 :  new_partition.alignment = ALIGN_MEBIBYTE;
                           {
                               //if partition size is not an integer multiple of MiB
                               //   or the start or end sectors are not MiB aligned,
                               //   and space is available,
                               //   then add 1 MiB to partition so requested size is kept
                               //   after GParted_Core::snap_to_mebibyte method rounding
-                              Sector partition_size = selected_partition .sector_end - selected_partition 
.sector_start + Sector(1) ;
-                              Sector sectors_in_mib = MEBIBYTE / selected_partition .sector_size ;
+                              Sector partition_size = new_partition.sector_end - new_partition.sector_start 
+ Sector(1);
+                              Sector sectors_in_mib = MEBIBYTE / new_partition.sector_size;
                               if (   (   ( ( partition_size % sectors_in_mib ) > 0 )
-                                      || ( ( selected_partition .sector_start % sectors_in_mib ) > 0 )
-                                      || ( ( ( selected_partition .sector_end + Sector(1) ) % sectors_in_mib 
) > 0 )
+                                      || ( ( new_partition.sector_start % sectors_in_mib ) > 0 )
+                                      || ( ( ( new_partition.sector_end + Sector(1) ) % sectors_in_mib ) > 0 
)
                                      )
                                   && ( ( partition_size + sectors_in_mib ) < total_length )
                                  )
-                                  selected_partition .sector_end += sectors_in_mib ;
+                                  new_partition.sector_end += sectors_in_mib;
                           }
                           break;
-               case  2 :  selected_partition .alignment = ALIGN_STRICT;  break;
+               case  2 :  new_partition.alignment = ALIGN_STRICT;  break;
 
-               default :  selected_partition .alignment = ALIGN_MEBIBYTE ;
+               default :  new_partition.alignment = ALIGN_MEBIBYTE;  break;
        }
 
        //update partition usage
-       if ( selected_partition .sectors_used != -1 && selected_partition .sectors_unused != -1 )
+       if ( new_partition.sectors_used != -1 && new_partition.sectors_unused != -1 )
        {
-               Sector new_size = selected_partition .get_sector_length() ;
+               Sector new_size = new_partition.get_sector_length();
                if ( old_size == new_size )
                {
                        //Pasting into new same sized partition or moving partition keeping the same size,
                        //  therefore only block copy operation will be performed maintaining file system 
size.
-                       selected_partition .set_sector_usage(
-                                       selected_partition .sectors_used + selected_partition .sectors_unused,
-                                       selected_partition .sectors_unused ) ;
+                       new_partition.set_sector_usage(
+                                       new_partition.sectors_used + new_partition.sectors_unused,
+                                       new_partition.sectors_unused );
                }
                else
                {
                        //Pasting into new larger partition or (moving and) resizing partition larger or 
smaller,
                        //  therefore block copy followed by file system grow or shrink operations will be
                        //  performed making the file system fill the partition.
-                       selected_partition .set_sector_usage(
-                                       new_size,
-                                       new_size - selected_partition .sectors_used ) ;
+                       new_partition.set_sector_usage( new_size, new_size - new_partition.sectors_used );
                }
        }
 
-       selected_partition .free_space_before = Sector(spinbutton_before .get_value_as_int()) * (MEBIBYTE / 
sector_size) ;
+       new_partition.free_space_before = Sector(spinbutton_before .get_value_as_int()) * (MEBIBYTE / 
sector_size);
 
        //if the original before value has not changed, then set indicator to keep start sector unchanged
        if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() )
-               selected_partition .strict_start = TRUE ;
+               new_partition.strict_start = TRUE;
 }
 
 void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type ) 
diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc
index 7744f66..a8504d8 100644
--- a/src/Dialog_Partition_Copy.cc
+++ b/src/Dialog_Partition_Copy.cc
@@ -98,13 +98,12 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
                       ) ;
 
        // Set member variable used in Dialog_Base_Partition::prepare_new_partition()
-       this ->selected_partition = copied_partition ;
-       this ->selected_partition .device_path = selected_partition .device_path ;
-       this ->selected_partition .inside_extended = selected_partition .inside_extended ;
-       this ->selected_partition .type = 
-               selected_partition .inside_extended ? GParted::TYPE_LOGICAL : GParted::TYPE_PRIMARY ;
+       new_partition = copied_partition;
+       new_partition.device_path     = selected_partition.device_path;
+       new_partition.inside_extended = selected_partition.inside_extended;
+       new_partition.type            = selected_partition.inside_extended ? TYPE_LOGICAL : TYPE_PRIMARY;
        //Handle situation where src sector size is smaller than dst sector size and an additional partial 
dst sector is required.
-       this ->selected_partition .set_sector_usage(
+       new_partition.set_sector_usage(
                        (   ( ( copied_partition .sectors_used + copied_partition .sectors_unused ) * 
copied_partition .sector_size )
                          + ( selected_partition .sector_size - 1 )
                        ) / selected_partition .sector_size,
@@ -121,9 +120,9 @@ Partition Dialog_Partition_Copy::Get_New_Partition( Byte_Value sector_size )
        Dialog_Base_Partition::prepare_new_partition( sector_size );
 
        //set proper name and status for partition
-       selected_partition .status = GParted::STAT_COPY ;
+       new_partition.status = STAT_COPY;
 
-       return selected_partition ;
+       return new_partition;
 }
 
 } //GParted
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index a1ecee1..4d2ce2d 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -39,7 +39,7 @@ void Dialog_Partition_New::Set_Data( const Device & device,
                                      const std::vector<FS> & FILESYSTEMS )
 {
        this ->new_count = new_count;
-       this ->selected_partition = partition;
+       new_partition = partition;
 
        // Copy only supported file systems from GParted_Core FILESYSTEMS vector.  Add
        // FS_CLEARED, FS_UNFORMATTED and FS_EXTENDED at the end.  This decides the order
@@ -144,10 +144,10 @@ void Dialog_Partition_New::Set_Data( const Device & device,
        table_create.attach( filesystem_label_entry, 1, 2, 3, 4, Gtk::FILL );
 
        //set some widely used values...
-       MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( selected_partition ) ;
+       MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( new_partition );
        START = partition.sector_start ;
        total_length = partition.sector_end - partition.sector_start ;
-       TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_sector_length(), this 
->selected_partition .sector_size, UNIT_MIB ) ) ;
+       TOTAL_MB = Utils::round( Utils::sector_to_unit( new_partition.get_sector_length(), 
new_partition.sector_size, UNIT_MIB ) );
        MB_PER_PIXEL = TOTAL_MB / 500.00 ;
        
        //set first enabled file system
@@ -192,19 +192,19 @@ Partition Dialog_Partition_New::Get_New_Partition( Byte_Value sector_size )
        
        /* 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 try to solve this.*/
-       if ( new_start < selected_partition.sector_start )
-               new_start = selected_partition.sector_start ;
-       if  ( new_end > selected_partition.sector_end )
-               new_end = selected_partition.sector_end ;
-       
+       if ( new_start < new_partition.sector_start )
+               new_start = new_partition.sector_start;
+       if  ( new_end > new_partition.sector_end )
+               new_end = new_partition.sector_end;
+
        part_temp .status = GParted::STAT_NEW ;
-       part_temp.Set( selected_partition.device_path,
+       part_temp.Set( new_partition.device_path,
                       String::ucompose( _("New Partition #%1"), new_count ),
-                      new_count, part_type, selected_partition.whole_device,
+                      new_count, part_type, new_partition.whole_device,
                       FILESYSTEMS[optionmenu_filesystem.get_history()].filesystem,
                       new_start, new_end,
                       sector_size,
-                      selected_partition.inside_extended, false );
+                      new_partition.inside_extended, false );
 
        // Retrieve partition name
        part_temp.name = Utils::trim( partition_name_entry.get_text() );
@@ -213,10 +213,10 @@ Partition Dialog_Partition_New::Get_New_Partition( Byte_Value sector_size )
        part_temp.set_filesystem_label( Utils::trim( filesystem_label_entry.get_text() ) );
        
        //grow new partition a bit if freespaces are < 1 MiB
-       if ( (part_temp.sector_start - selected_partition.sector_start) < (MEBIBYTE / sector_size) ) 
-               part_temp.sector_start = selected_partition.sector_start ;
-       if ( (selected_partition.sector_end - part_temp.sector_end) < (MEBIBYTE / sector_size) ) 
-               part_temp.sector_end = selected_partition.sector_end ;
+       if ( (part_temp.sector_start - new_partition.sector_start) < (MEBIBYTE / sector_size) )
+               part_temp.sector_start = new_partition.sector_start;
+       if ( (new_partition.sector_end - part_temp.sector_end) < (MEBIBYTE / sector_size) )
+               part_temp.sector_end = new_partition.sector_end;
        
        //if new is extended...
        if ( part_temp .type == GParted::TYPE_EXTENDED )
@@ -286,8 +286,8 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
                if ( fs .MIN < MEBIBYTE )
                        fs .MIN = MEBIBYTE ;
 
-               if ( selected_partition .get_byte_length() < fs .MIN )
-                       fs .MIN = selected_partition .get_byte_length() ;
+               if ( new_partition.get_byte_length() < fs.MIN )
+                       fs .MIN = new_partition.get_byte_length();
 
                if ( ! fs .MAX || ( fs .MAX > ((TOTAL_MB - MIN_SPACE_BEFORE_MB) * MEBIBYTE) ) )
                        fs .MAX = ((TOTAL_MB - MIN_SPACE_BEFORE_MB) * MEBIBYTE) ;
@@ -345,7 +345,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
                        Gtk::Menu_Helpers::MenuElem( Utils::get_filesystem_string( FILESYSTEMS[ t ] 
.filesystem ) ) ) ;
                menu_filesystem .items() .back() .set_sensitive(
                        ! only_unformatted && FILESYSTEMS[ t ] .create &&
-                       this ->selected_partition .get_byte_length() >= FILESYSTEMS[ t ] .MIN ) ;
+                       new_partition.get_byte_length() >= FILESYSTEMS[t].MIN );
                //use ext4/3/2 as first/second/third choice default file system
                //(Depends on ordering in FILESYSTEMS for preference)
                if ( ( FILESYSTEMS[ t ] .filesystem == FS_EXT2 ||
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index 6f41a28..527932d 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -30,9 +30,9 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio
                                             const std::vector<Partition> & partitions )
 {
        GRIP = true ; //prevents on spinbutton_changed from getting activated prematurely
-       
-       this ->selected_partition = selected_partition ;
-       
+
+       new_partition = selected_partition;
+
        if ( selected_partition .type == GParted::TYPE_EXTENDED )
        {
                Set_Resizer( true ) ;   
@@ -61,28 +61,28 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio
 void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partition> & partitions )
 {
        //little bit of paranoia ;)
-       if ( ! selected_partition .sector_usage_known() &&
-            selected_partition .status != STAT_NEW &&
-            selected_partition .filesystem != FS_LINUX_SWAP )
+       if ( ! new_partition.sector_usage_known() &&
+            new_partition.status != STAT_NEW &&
+            new_partition.filesystem != FS_LINUX_SWAP )
                fs .shrink = GParted::FS::NONE ;
        
        //Disable resizing as it's currently disallowed for the file system in this partition.
        //  (Updates this class's copy of file system support information).
-       if ( GParted_Core::filesystem_resize_disallowed( selected_partition ) )
+       if ( GParted_Core::filesystem_resize_disallowed( new_partition ) )
        {
                fs .shrink = FS::NONE ;
                fs .grow   = FS::NONE ;
        }
 
        // See if we can allow the start of the file system to move
-       if ( fs.move && ! selected_partition.busy && ! selected_partition.whole_device )
+       if ( fs.move && ! new_partition.busy && ! new_partition.whole_device )
        {
-               set_title( String::ucompose( _("Resize/Move %1"), selected_partition .get_path() ) ) ;
+               set_title( String::ucompose( _("Resize/Move %1"), new_partition.get_path() ) );
                frame_resizer_base ->set_fixed_start( false ) ;
        }
        else
        {
-               set_title( String::ucompose( _("Resize %1"), selected_partition .get_path() ) ) ;
+               set_title( String::ucompose( _("Resize %1"), new_partition.get_path() ) );
                this ->fixed_start = true;
                frame_resizer_base ->set_fixed_start( true ) ;
                spinbutton_before .set_sensitive( false ) ;
@@ -92,7 +92,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
        //first find index of partition
        unsigned int t;
        for ( t = 0 ; t < partitions .size() ; t++ )
-               if ( partitions[ t ] == selected_partition )
+               if ( partitions[t] == new_partition )
                        break;
 
        Sector previous, next ;
@@ -104,7 +104,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                START = partitions[t -1] .sector_start ;
        } 
        else
-               START = selected_partition .sector_start ;
+               START = new_partition.sector_start;
        
        if ( t +1 < partitions .size() && partitions[t +1] .type == GParted::TYPE_UNALLOCATED )
        {
@@ -113,8 +113,8 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                //If this is a logical partition and there is extra free space
                //  then check if we need to reserve 1 MiB of space after for
                //  the next logical partition Extended Boot Record.
-               if (   selected_partition .type == TYPE_LOGICAL
-                   && next >= (MEBIBYTE / selected_partition .sector_size)
+               if (   new_partition.type == TYPE_LOGICAL
+                   && next >= (MEBIBYTE / new_partition.sector_size)
                   )
                {
                        //Find maximum sector_end (allocated or unallocated) within list of
@@ -127,8 +127,8 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                        }
 
                        //If not within 1 MiB of the end of the extended partition, then reserve 1 MiB
-                       if ( ( max_sector_end - partitions[t+1] .sector_end ) > ( MEBIBYTE / 
selected_partition .sector_size ) )
-                               next -= MEBIBYTE / selected_partition .sector_size ;
+                       if ( ( max_sector_end - partitions[t+1].sector_end ) > ( MEBIBYTE / 
new_partition.sector_size ) )
+                               next -= MEBIBYTE / new_partition.sector_size;
                }
        }
 
@@ -139,13 +139,13 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                MIN_SPACE_BEFORE_MB = 0 ;
        else
        {
-               if ( START <= (MEBIBYTE / selected_partition .sector_size) )
+               if ( START <= (MEBIBYTE / new_partition.sector_size) )
                        MIN_SPACE_BEFORE_MB = 1 ;
                else
-                       MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( 
selected_partition ) ;
+                       MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( new_partition 
);
        }
-       total_length = previous + selected_partition .get_sector_length() + next;
-       TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, 
UNIT_MIB ) ) ;
+       total_length = previous + new_partition.get_sector_length() + next;
+       TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, new_partition.sector_size, UNIT_MIB ) );
        
        MB_PER_PIXEL = TOTAL_MB / 500.00 ;
                
@@ -153,31 +153,31 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
        frame_resizer_base ->set_x_min_space_before( Utils::round( MIN_SPACE_BEFORE_MB / MB_PER_PIXEL ) ) ;
        frame_resizer_base ->set_x_start( Utils::round( previous / ( total_length / 500.00 ) ) ) ;
        frame_resizer_base ->set_x_end( 
-               Utils::round( selected_partition .get_sector_length() / ( total_length / 500.00 ) ) + 
frame_resizer_base ->get_x_start() ) ;
-       Sector min_resize = selected_partition .estimated_min_size() ;
+               Utils::round( new_partition.get_sector_length() / ( total_length / 500.00 ) ) + 
frame_resizer_base->get_x_start() );
+       Sector min_resize = new_partition.estimated_min_size();
        frame_resizer_base ->set_used( Utils::round( min_resize / ( total_length / 500.00 ) ) ) ;
 
        //set MIN
-       if (   ( fs .shrink && ! selected_partition .busy )
-           || ( fs .online_shrink && selected_partition .busy )
+       if (   ( fs.shrink && ! new_partition.busy )
+           || ( fs.online_shrink && new_partition.busy )
           )
        {
                //since some file systems have lower limits we need to check for this
-               if ( min_resize > (fs .MIN / selected_partition .sector_size) )
-                       fs .MIN = min_resize * selected_partition .sector_size ;
+               if ( min_resize > (fs.MIN / new_partition.sector_size) )
+                       fs.MIN = min_resize * new_partition.sector_size;
 
                //ensure that minimum size is at least one mebibyte
                if ( ! fs .MIN || fs .MIN < MEBIBYTE )
                        fs .MIN = MEBIBYTE ;
        }
        else
-               fs .MIN = selected_partition .get_byte_length() ;
+               fs.MIN = new_partition.get_byte_length();
 
        //set MAX
        if ( fs .grow )
                fs .MAX = (TOTAL_MB - MIN_SPACE_BEFORE_MB) * MEBIBYTE ;
        else
-               fs .MAX = selected_partition .get_byte_length() ;
+               fs.MAX = new_partition.get_byte_length();
 
        //set values of spinbutton_before
        if ( ! fixed_start )
@@ -186,7 +186,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                                            , TOTAL_MB - ceil( fs .MIN / double(MEBIBYTE) )
                                            ) ;
                spinbutton_before .set_value(
-                       Utils::round( Utils::sector_to_unit( previous, selected_partition .sector_size, 
UNIT_MIB ) ) ) ;
+                       Utils::round( Utils::sector_to_unit( previous, new_partition.sector_size, UNIT_MIB ) 
) );
        }
 
        //set values of spinbutton_size 
@@ -194,15 +194,15 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
                                  , ceil( fs .MAX / double(MEBIBYTE) )
                                  ) ;
        spinbutton_size .set_value( 
-               Utils::round( Utils::sector_to_unit( selected_partition .get_sector_length(), 
selected_partition .sector_size, UNIT_MIB ) ) ) ;
+               Utils::round( Utils::sector_to_unit( new_partition.get_sector_length(), 
new_partition.sector_size, UNIT_MIB ) ) );
        
        //set values of spinbutton_after
        Sector after_min = ( ! fs .grow && ! fs .move ) ? next : 0 ;
        spinbutton_after .set_range( 
-               Utils::round( Utils::sector_to_unit( after_min, selected_partition .sector_size, UNIT_MIB ) ),
+               Utils::round( Utils::sector_to_unit( after_min, new_partition.sector_size, UNIT_MIB ) ),
                TOTAL_MB - MIN_SPACE_BEFORE_MB - ceil( fs .MIN / double(MEBIBYTE) ) ) ;
        spinbutton_after .set_value( 
-               Utils::round( Utils::sector_to_unit( next, selected_partition .sector_size, UNIT_MIB ) ) ) ;
+               Utils::round( Utils::sector_to_unit( next, new_partition.sector_size, UNIT_MIB ) ) );
 
        frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBIBYTE) ),
                                              Utils::round( fs .MAX / (MB_PER_PIXEL * MEBIBYTE) ) ) ;
@@ -229,7 +229,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
                START = partitions[t -1] .sector_start ;
        } 
        else
-               START = selected_partition .sector_start ;
+               START = new_partition.sector_start;
        
        //calculate length of next
        if ( t +1 < partitions .size() && partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
@@ -242,32 +242,32 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
        if ( previous <= 0 )
                MIN_SPACE_BEFORE_MB = 0 ;
        else
-               MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( selected_partition ) ;
-       total_length = previous + selected_partition .get_sector_length() + next;
-       TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, selected_partition .sector_size, 
UNIT_MIB ) ) ;
+               MIN_SPACE_BEFORE_MB = Dialog_Base_Partition::MB_Needed_for_Boot_Record( new_partition );
+       total_length = previous + new_partition.get_sector_length() + next;
+       TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, new_partition.sector_size, UNIT_MIB ) );
        MB_PER_PIXEL = TOTAL_MB / 500.00 ;
        
        //calculate proportional length of partition ( in pixels )
        frame_resizer_base ->set_x_min_space_before( Utils::round( MIN_SPACE_BEFORE_MB / MB_PER_PIXEL ) ) ;
        frame_resizer_base ->set_x_start( Utils::round( previous / ( total_length / 500.00 ) ) ) ;
-       frame_resizer_base ->set_x_end( Utils::round( selected_partition .get_sector_length() / ( 
total_length / 500.00 ) ) + frame_resizer_base ->get_x_start() ) ;
+       frame_resizer_base ->set_x_end( Utils::round( new_partition.get_sector_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, last = 0, used =0 ;
-       if ( ! (   selected_partition .logicals .size() == 1
-               && selected_partition .logicals .back() .type == GParted::TYPE_UNALLOCATED
+       if ( ! (   new_partition.logicals.size() == 1
+               && new_partition.logicals.back().type == TYPE_UNALLOCATED
               )
           )
        {
                //logical partitions other than unallocated exist
-               first = selected_partition .sector_end ;
-               last = selected_partition .sector_start ;
+               first = new_partition.sector_end;
+               last = new_partition.sector_start;
                for ( unsigned int i = 0 ; i < partitions[ t ] .logicals .size() ; i++ )
                {
                        if ( partitions[ t ] .logicals[ i ] .type == GParted::TYPE_LOGICAL )
                        {
                                if ( partitions[ t ] .logicals[ i ] .sector_start < first )
-                                       first = partitions[ t ] .logicals[ i ] .sector_start - (MEBIBYTE / 
selected_partition .sector_size) ;
+                                       first = partitions[ t ] .logicals[ i ] .sector_start - (MEBIBYTE / 
new_partition.sector_size);
                                if ( first < 0 )
                                        first = 0 ;
                                if ( partitions[ t ] .logicals[ i ] .sector_end > last )
@@ -283,7 +283,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
                fs .MIN = MEBIBYTE ;
        }
        else 
-               fs .MIN = used * selected_partition .sector_size ;
+               fs.MIN = used * new_partition.sector_size;
 
        //set MAX
        fs .MAX = (TOTAL_MB - MIN_SPACE_BEFORE_MB) * MEBIBYTE ;
@@ -296,15 +296,15 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
        if ( first == 0 ) //no logicals
                spinbutton_before .set_range( MIN_SPACE_BEFORE_MB, TOTAL_MB - MIN_SPACE_BEFORE_MB - ceil( fs 
.MIN / double(MEBIBYTE) ) ) ;
        else
-               spinbutton_before .set_range( MIN_SPACE_BEFORE_MB, Utils::round( Utils::sector_to_unit( first 
- START, selected_partition .sector_size, UNIT_MIB ) ) ) ;
+               spinbutton_before .set_range( MIN_SPACE_BEFORE_MB, Utils::round( Utils::sector_to_unit( first 
- START, new_partition.sector_size, UNIT_MIB ) ) );
        
-       spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, selected_partition 
.sector_size, UNIT_MIB ) ) ) ;
+       spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, 
new_partition.sector_size, UNIT_MIB ) ) );
        
        //set values of spinbutton_size
        spinbutton_size .set_range( ceil( fs .MIN / double(MEBIBYTE) ), TOTAL_MB - MIN_SPACE_BEFORE_MB ) ;
        
        spinbutton_size .set_value(
-               Utils::round( Utils::sector_to_unit( selected_partition .get_sector_length(), 
selected_partition .sector_size, UNIT_MIB ) ) ) ;
+               Utils::round( Utils::sector_to_unit( new_partition.get_sector_length(), 
new_partition.sector_size, UNIT_MIB ) ) );
        
        //set values of spinbutton_after
        if ( first == 0 ) //no logicals
@@ -312,13 +312,13 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
                        0, TOTAL_MB - ceil( fs .MIN / double(MEBIBYTE) ) - MIN_SPACE_BEFORE_MB ) ;
        else
                spinbutton_after .set_range( 
-                       0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, 
selected_partition .sector_size, UNIT_MIB ) ) ) ;
+                       0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, 
new_partition.sector_size, UNIT_MIB ) ) );
        
-       spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, selected_partition 
.sector_size, UNIT_MIB ) ) ) ;
+       spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, new_partition.sector_size, 
UNIT_MIB ) ) );
        
        //set contents of label_minmax
        Set_MinMax_Text( ceil( fs .MIN / double(MEBIBYTE) )
-                      , Utils::round( Utils::sector_to_unit( total_length - (MIN_SPACE_BEFORE_MB * (MEBIBYTE 
/ selected_partition .sector_size)), selected_partition .sector_size, UNIT_MIB ) ) ) ;
+                      , Utils::round( Utils::sector_to_unit( total_length - (MIN_SPACE_BEFORE_MB * (MEBIBYTE 
/ new_partition.sector_size)), new_partition.sector_size, UNIT_MIB ) ) );
 }
 
 } //GParted


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]