gparted/include/Dialog_Base_Partition.h
Curtis Gedak e62a23b5b5 Add partition alignment option to align to MiB (#617409)
Make align to MiB the default setting instead of align to cylinder.

Migrate logic for alignment to cylinder into its own method
snap_to_cylinder, and place common logic in snap_to_alignment.

Add alignment checks for situations where space is needed for Master
Boot Record or Extended Boot Record.

Adjust ranges on spin buttons according to required boot record space.

Copy fix for off by one sector (#596552) from
Dialog_Partition_New::Get_New_Partition to
Dialog_Base_Partition::Get_New_Partition

Enhance resize / move logic for checking locations of nearby logical
partitions to not depend on the partition ordering.

Note: This commit does not include limiting graphic movement according
to required boot record space.
2010-05-20 10:00:14 -06:00

111 lines
3 KiB
C++

/* Copyright (C) 2004 Bart
* Copyright (C) 2008, 2009, 2010 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef DIALOG_BASE_PARTITION
#define DIALOG_BASE_PARTITION
#include "../include/Frame_Resizer_Extended.h"
#include "../include/Partition.h"
#include <gtkmm/dialog.h>
#include <gtkmm/stock.h>
#include <gtkmm/label.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/table.h>
#include <gtkmm/box.h>
#include <gtkmm/tooltips.h>
#include <gtkmm/optionmenu.h>
namespace GParted
{
class Dialog_Base_Partition : public Gtk::Dialog
{
public:
Dialog_Base_Partition( ) ;
~Dialog_Base_Partition( ) ;
void Set_Resizer( bool extended ) ;
Partition Get_New_Partition( Byte_Value sector_size ) ;
protected:
enum SPINBUTTON {
BEFORE = 0,
SIZE = 1,
AFTER = 2
};
enum CONFIRMBUTTON {
RESIZE_MOVE = 0,
NEW = 1,
PASTE = 2
};
void Set_Confirm_Button( CONFIRMBUTTON button_type ) ;
void Set_MinMax_Text( Sector min, Sector max ) ;
double MB_PER_PIXEL ;
Sector TOTAL_MB ;
Frame_Resizer_Base *frame_resizer_base;
Partition selected_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...)
Gtk::HBox hbox_main ;
Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
Gtk::OptionMenu optionmenu_alignment ;
Gtk::Menu menu_alignment ;
//used to enable/disable OKbutton...
int ORIG_BEFORE, ORIG_SIZE, ORIG_AFTER ;
//used to reserve space for Master or Extended Boot Record (1 MiB)
int MIN_SPACE_BEFORE_MB ;
int MB_Needed_for_Boot_Record( const Partition & partition ) ;
//signal handlers
void on_signal_move( int, int );
void on_signal_resize( int, int, Frame_Resizer_Base::ArrowType );
void on_spinbutton_value_changed( SPINBUTTON ) ;
bool fixed_start, GRIP ;
double before_value ;
FS fs ;
short BUF ; //used in resize and copy ( safety reasons )
private:
void Check_Change( ) ;
Gtk::VBox vbox_resize_move;
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
#endif //DIALOG_BASE_PARTITION