File: Dialog_Base_Partition.h

package info (click to toggle)
gparted 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,752 kB
  • sloc: cpp: 34,868; sh: 5,073; makefile: 462; sed: 16; ansic: 9
file content (118 lines) | stat: -rw-r--r-- 3,471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef GPARTED_DIALOG_BASE_PARTITION_H
#define GPARTED_DIALOG_BASE_PARTITION_H


#include "Device.h"
#include "Frame_Resizer_Extended.h"
#include "FileSystem.h"
#include "OptionComboBox.h"
#include "Partition.h"

#include <gtkmm/dialog.h>
#include <gtkmm/stock.h>
#include <gtkmm/label.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/grid.h>
#include <gtkmm/box.h>

namespace GParted
{

class Dialog_Base_Partition : public Gtk::Dialog
{
public:
	
	Dialog_Base_Partition(const Device& device);
	~Dialog_Base_Partition( ) ;

	void Set_Resizer( bool extended ) ;
	const Partition & Get_New_Partition();

protected:
	enum SPINBUTTON {
		BEFORE	= 0,
		SIZE	= 1,
		AFTER	= 2
	};	
	
	enum CONFIRMBUTTON {
		RESIZE_MOVE	= 0,
		NEW		= 1,
		PASTE		= 2
	};

	void prepare_new_partition();
	static void snap_to_alignment(const Device& device, Partition& partition);
	static void snap_to_cylinder(const Device& device, Partition& partition);
	static void snap_to_mebibyte(const Device& device, Partition& partition);

	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 * 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...)

	Gtk::Box hbox_main;
	Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
	OptionComboBox combo_alignment;

	sigc::connection before_change_connection, size_change_connection, after_change_connection ;

	//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 ;

	static 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 ;
	const Device& m_device;
	FS fs ;
	FS_Limits fs_limits;  // Working copy of file system min/max size limits

private:
	Dialog_Base_Partition( const Dialog_Base_Partition & src );              // Not implemented copy constructor
	Dialog_Base_Partition & operator=( const Dialog_Base_Partition & rhs );  // Not implemented copy assignment operator

	void Check_Change( ) ;

	Gtk::Box vbox_resize_move;
	Gtk::Label label_minmax ;
	Gtk::Grid grid_resize;
	Gtk::Box hbox_grid;
	Gtk::Box hbox_resizer;
	Gtk::Button button_resize_move ;
};

} //GParted

#endif /* GPARTED_DIALOG_BASE_PARTITION_H */