cosmetics (mostly tabfixes)

* almost all files: cosmetics (mostly tabfixes)
This commit is contained in:
Bart Hakvoort 2004-10-01 21:09:19 +00:00
parent db243c870d
commit a1dfbee2b3
17 changed files with 221 additions and 231 deletions

View file

@ -1,3 +1,7 @@
2004-10-01 Bart Hakvoort <gparted@users.sf.net>
* almost all files: cosmetics (mostly tabfixes)
2004-10-01 Bart Hakvoort <gparted@users.sf.net>
* src/Dialog_Partition_New.cc: marked 3 strings for translation.

View file

@ -85,14 +85,14 @@ private:
bool Resize_Extended( const Partition & partition, PedTimer *timer) ;
std::vector<Partition> device_partitions;
Sector length;
Sector length;
long heads ;
long sectors ;
long cylinders ;
Glib::ustring model;
Glib::ustring path;
Glib::ustring realpath;
Glib::ustring disktype;
Glib::ustring model;
Glib::ustring path;
Glib::ustring realpath;
Glib::ustring disktype;
//private variables
PedDevice *device ;

View file

@ -38,7 +38,7 @@ public:
private:
void Show_Credits() ;
void Show_Credits() ;
Gtk::Label *label_temp ;
Gtk::Button button_credits;

View file

@ -44,15 +44,15 @@ public:
protected:
enum SPINBUTTON {
BEFORE = 0,
SIZE = 1,
AFTER = 2
BEFORE = 0,
SIZE = 1,
AFTER = 2
};
enum CONFIRMBUTTON {
RESIZE_MOVE = 0,
NEW = 1,
PASTE = 2
RESIZE_MOVE = 0,
NEW = 1,
PASTE = 2
};
void Set_Confirm_Button( CONFIRMBUTTON button_type ) ;

View file

@ -30,11 +30,11 @@ class Frame_Resizer_Base : public Gtk::Frame, virtual public sigc::trackable
public:
enum ArrowType {
ARROW_LEFT = 0,
ARROW_RIGHT = 1
ARROW_LEFT = 0,
ARROW_RIGHT = 1
};
Frame_Resizer_Base( ) ;
Frame_Resizer_Base( ) ;
~Frame_Resizer_Base() ;
void set_rgb_partition_color( const Gdk::Color & ) ;
@ -46,8 +46,6 @@ public:
void set_fixed_start( bool ) ;
void set_used_start( int used_start ) ;
int get_used();
int get_x_start() ;
int get_x_end() ;
@ -64,8 +62,8 @@ protected:
bool GRIP_LEFT, GRIP_RIGHT, GRIP_MOVE ;
//signal handlers
void drawingarea_on_realize( );
bool drawingarea_on_expose( GdkEventExpose * );
void drawingarea_on_realize( );
bool drawingarea_on_expose( GdkEventExpose * );
virtual bool drawingarea_on_mouse_motion( GdkEventMotion* ) ;
bool drawingarea_on_button_press_event( GdkEventButton* ) ;
bool drawingarea_on_button_release_event( GdkEventButton* ) ;

View file

@ -21,14 +21,10 @@
#include "../include/Frame_Resizer_Base.h"
class Frame_Resizer_Extended : public Frame_Resizer_Base
class Frame_Resizer_Extended : public Frame_Resizer_Base
{
public:
Frame_Resizer_Extended( ) ;
Frame_Resizer_Extended( ) ;
private:
@ -38,12 +34,6 @@ private:
virtual void Draw_Partition() ;
};
#endif // FRAME_RESIZER_EXTENDED

View file

@ -29,11 +29,11 @@ namespace GParted
{
enum OperationType {
DELETE = 0,
CREATE = 1,
RESIZE_MOVE = 2,
CONVERT = 3,
COPY = 4
DELETE = 0,
CREATE = 1,
RESIZE_MOVE = 2,
CONVERT = 3,
COPY = 4
};
class Operation
@ -46,7 +46,7 @@ public:
//this new list can be used to change the visual representation. For real writing to disk, see Apply_To_Disk()
std::vector<Partition> Apply_Operation_To_Visual( std::vector<Partition> & partitions );
void Apply_To_Disk( PedTimer * );
void Apply_To_Disk( PedTimer * timer );
//public variables
Device *device, *source_device; //source_device is only used in copy operations

View file

@ -75,10 +75,10 @@ inline Glib::ustring num_to_str( Sector number )
enum PartitionType {
PRIMARY = 0,
LOGICAL = 1,
EXTENDED = 2,
UNALLOCATED = 3
PRIMARY = 0,
LOGICAL = 1,
EXTENDED = 2,
UNALLOCATED = 3
};
enum PartitionStatus {
@ -89,18 +89,18 @@ enum PartitionStatus {
/*
enum FileSystem {
ext2 = 0,
ext3 = 1,
ext2 = 0,
ext3 = 1,
linux_swap = 2,
reiserfs = 3,
hfs = 4,
jfs = 5,
hp_ufs = 6,
sun_ufs = 7,
xfs = 8,
fat16 = 9,
fat32 = 10,
ntfs = 11
reiserfs = 3,
hfs = 4,
jfs = 5,
hp_ufs = 6,
sun_ufs = 7,
xfs = 8,
fat16 = 9,
fat32 = 10,
ntfs = 11
};
*/
class Partition
@ -110,15 +110,15 @@ public:
~Partition() ;
//simple Set-functions. only for convenience, since most members are public
void Set( const Glib::ustring & partition,
const int partition_number,
const PartitionType type,
const Glib::ustring & filesystem,
const Sector & sector_start,
const Sector & sector_end,
const Sector & sectors_used,
const bool inside_extended,
const bool busy ) ;
void Set( const Glib::ustring & partition,
const int partition_number,
const PartitionType type,
const Glib::ustring & filesystem,
const Sector & sector_start,
const Sector & sector_end,
const Sector & sectors_used,
const bool inside_extended,
const bool busy ) ;
void Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended );

View file

@ -76,14 +76,14 @@ private:
//convenience functions
void allow_new( bool b ) { menu_popup.items()[0].set_sensitive( b ); toolbar_main.get_nth_item(0) ->set_sensitive( b ); }
void allow_delete( bool b ) { menu_popup.items()[1].set_sensitive( b ); toolbar_main.get_nth_item(1) ->set_sensitive( b ); }
void allow_resize( bool b ) { menu_popup.items()[3].set_sensitive( b ); toolbar_main.get_nth_item(3) ->set_sensitive( b ); }
void allow_copy( bool b ) { menu_popup.items()[5].set_sensitive( b ); toolbar_main.get_nth_item(5) ->set_sensitive( b ); }
void allow_paste( bool b ) { menu_popup.items()[6].set_sensitive( b ); toolbar_main.get_nth_item(6) ->set_sensitive( b ); }
void allow_convert( bool b ) { menu_popup.items()[8].set_sensitive( b ); }
void allow_undo( bool b ) { toolbar_main.get_nth_item(8) ->set_sensitive( b ); }
void allow_apply( bool b ) { toolbar_main.get_nth_item(9) ->set_sensitive( b ); }
void allow_new( bool b ) { menu_popup.items()[0].set_sensitive( b ); toolbar_main.get_nth_item(0) ->set_sensitive( b ); }
void allow_delete( bool b ) { menu_popup.items()[1].set_sensitive( b ); toolbar_main.get_nth_item(1) ->set_sensitive( b ); }
void allow_resize( bool b ) { menu_popup.items()[3].set_sensitive( b ); toolbar_main.get_nth_item(3) ->set_sensitive( b ); }
void allow_copy( bool b ) { menu_popup.items()[5].set_sensitive( b ); toolbar_main.get_nth_item(5) ->set_sensitive( b ); }
void allow_paste( bool b ) { menu_popup.items()[6].set_sensitive( b ); toolbar_main.get_nth_item(6) ->set_sensitive( b ); }
void allow_convert( bool b ) { menu_popup.items()[8].set_sensitive( b ); }
void allow_undo( bool b ) { toolbar_main.get_nth_item(8) ->set_sensitive( b ); }
void allow_apply( bool b ) { toolbar_main.get_nth_item(9) ->set_sensitive( b ); }
//signal handlers
void close_operationslist() ;
@ -96,7 +96,7 @@ private:
void menu_help_contents();
void menu_help_about();
void mouse_click( GdkEventButton*, const Partition & );
void mouse_click( GdkEventButton*, const Partition & );
void activate_resize();
void activate_copy();

View file

@ -118,20 +118,20 @@ Device::Device( const Glib::ustring & device_path )
{
ped_exception_set_handler( PedException_Handler ) ;
this ->realpath = device_path ; //this one is used by open_device_and_disk
this ->realpath = device_path ; //this one is used by open_device_and_disk
this ->length = 0;//lazy check.. if something goes wrong while reading the device, length will stay zero and i will know it ( see Win_GParted::Find_Devices )
if ( ! open_device_and_disk() )
return ;
this ->model = device ->model ;
this ->path = get_sym_path( device ->path ) ;
this ->disktype = disk ->type ->name ;
this ->heads = device ->bios_geom.heads ;
this ->model = device ->model ;
this ->path = get_sym_path( device ->path ) ;
this ->disktype = disk ->type ->name ;
this ->heads = device ->bios_geom.heads ;
this ->sectors = device ->bios_geom.sectors ;
this ->cylinders = device ->bios_geom.cylinders ;
this ->length = heads * sectors * cylinders ;
this ->cylinders= device ->bios_geom.cylinders ;
this ->length = heads * sectors * cylinders ;
//get valid flags for this device
for ( PedPartitionFlag flag = ped_partition_flag_next ( (PedPartitionFlag) 0 ) ; flag ; flag = ped_partition_flag_next ( flag ) )
@ -154,55 +154,54 @@ void Device::Read_Disk_Layout()
switch( c_partition ->type )
{
//NORMAL (PRIMARY)
case 0 : if ( c_partition ->fs_type )
temp = c_partition ->fs_type ->name ;
else
{temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; }
case 0 : if ( c_partition ->fs_type )
temp = c_partition ->fs_type ->name ;
else
{temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; }
partition_temp.Set( os.str(),c_partition ->num , GParted::PRIMARY, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , false, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
device_partitions.push_back( partition_temp );
break;
partition_temp.Set( os.str(),c_partition ->num , GParted::PRIMARY, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , false, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
device_partitions.push_back( partition_temp );
break;
//LOGICAL
case 1: if ( c_partition ->fs_type )
temp = c_partition ->fs_type ->name ;
else
{temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; }
temp = c_partition ->fs_type ->name ;
else
{temp = "unknown" ; this ->error = (Glib::ustring) _( "Unable to detect filesystem! Possible reasons are:" ) + "\n-" + (Glib::ustring) _( "The filesystem is damaged" ) + "\n-" + (Glib::ustring) _( "The filesystem is unknown to libparted" ) + "\n-" + (Glib::ustring) _( "There is no filesystem available (unformatted)" ) ; }
partition_temp.Set( os.str(), c_partition ->num, GParted::LOGICAL, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , true, ped_partition_is_busy( c_partition ) );
partition_temp.Set( os.str(), c_partition ->num, GParted::LOGICAL, temp, c_partition ->geom .start, c_partition ->geom .end, Get_Used_Sectors( c_partition , os.str() ) , true, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
device_partitions.push_back( partition_temp );
break;
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
device_partitions.push_back( partition_temp );
break;
//EXTENDED
case 2: partition_temp.Set( os.str(), c_partition ->num, GParted::EXTENDED, "extended", c_partition ->geom .start, c_partition ->geom .end , -1, false, ped_partition_is_busy( c_partition ) );
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
device_partitions.push_back( partition_temp );
break;
partition_temp .flags = Get_Flags( c_partition ) ;
partition_temp .error = this ->error ;
device_partitions.push_back( partition_temp );
break;
//FREESPACE OUTSIDE EXTENDED
case 4: if ( (c_partition ->geom .end - c_partition ->geom .start) > MEGABYTE )
{
partition_temp.Set_Unallocated( c_partition ->geom .start , c_partition ->geom .end, false );
device_partitions.push_back( partition_temp );
}
{
partition_temp.Set_Unallocated( c_partition ->geom .start , c_partition ->geom .end, false );
device_partitions.push_back( partition_temp );
}
break ;
break ;
//FREESPACE INSIDE EXTENDED
case 5: if ( (c_partition ->geom .end - c_partition ->geom .start) > MEGABYTE )
{
partition_temp.Set_Unallocated( c_partition ->geom .start , c_partition ->geom .end, true );
device_partitions.push_back( partition_temp );
}
{
partition_temp.Set_Unallocated( c_partition ->geom .start , c_partition ->geom .end, true );
device_partitions.push_back( partition_temp );
}
break ;
break ;
//METADATA (do nothing)
default: break;
}
@ -211,7 +210,7 @@ void Device::Read_Disk_Layout()
this ->error = ""; error_message = ""; os.str("");
//next partition (if any)
c_partition = ped_disk_next_partition ( disk, c_partition ) ;
c_partition = ped_disk_next_partition ( disk, c_partition ) ;
}
}
@ -237,8 +236,8 @@ int Device::Create_Empty_Partition( const Partition & new_partition, PedConstrai
//create new partition
switch ( new_partition .type )
{
case 0 : type = PED_PARTITION_NORMAL; break;
case 1 : type = PED_PARTITION_LOGICAL; break;
case 0 : type = PED_PARTITION_NORMAL; break;
case 1 : type = PED_PARTITION_LOGICAL; break;
case 2 : type = PED_PARTITION_EXTENDED; break;
default : type = PED_PARTITION_FREESPACE; break ; //will never happen ;)
}
@ -346,11 +345,11 @@ bool Device::Set_Partition_Filesystem( const Partition & new_partition, PedTimer
bool Device::Copy_Partition( Device *source_device, const Partition & source_partition, PedTimer * timer)
{
PedPartition *c_part_src = NULL;
PedFileSystem *src_fs = NULL;
PedPartition *c_part = NULL;
PedFileSystem *dst_fs = NULL;
PedFileSystemType* dst_fs_type = NULL;
PedPartition *c_part_src = NULL;
PedFileSystem *src_fs = NULL;
PedPartition *c_part = NULL;
PedFileSystem *dst_fs = NULL;
PedFileSystemType *dst_fs_type = NULL;
//prepare source for reading
if ( source_device ->Get_Path() == this ->path )
@ -496,7 +495,7 @@ Sector Device::Get_Used_Sectors( PedPartition *c_partition, const Glib::ustring
/* This is quite an unreliable process, atm i try two different methods, but since both are far from perfect the results are
* questionable.
* - first i try geometry.get_used() in libpartedpp, i implemented this function to check the minimal size when resizing a partition. Disadvantage
* of this method is the fact it won't work on mounted filesystems. Besides that, its SLOW
* of this method is the fact it won't work on mounted filesystems. Besides that, its SLOW
* - if the former method fails ( result is -1 ) i'll try to read the output from the df command ( df -k --sync <partition path> )
* - if this fails the filesystem on the partition is ( more or less ) unknown to the operating system and therefore the unused sectors cannot be calcualted
* - as soon as i have my internetconnection back i should ask people with more experience on this stuff for advice !

View file

@ -153,25 +153,24 @@ void Dialog_Base_Partition::Set_Confirm_Button( CONFIRMBUTTON button_type )
{
switch( 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") ) ) ;
else
label_temp = manage( new Gtk::Label( _("Resize/Move") ) ) ;
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") ) ) ;
else
label_temp = manage( new Gtk::Label( _("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 ) ;
button_resize_move .add( hbox_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 ) ;
button_resize_move .add( hbox_resize_move ) ;
this ->add_action_widget ( button_resize_move,Gtk::RESPONSE_OK ) ;
button_resize_move .set_sensitive( false ) ;
break ;
this ->add_action_widget ( button_resize_move,Gtk::RESPONSE_OK ) ;
button_resize_move .set_sensitive( false ) ;
break ;
case PASTE : this->add_button( Gtk::Stock::PASTE,Gtk::RESPONSE_OK );
break ;
case PASTE : this->add_button( Gtk::Stock::PASTE,Gtk::RESPONSE_OK );
break ;
}
}
@ -273,20 +272,20 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton
switch ( spinbutton )
{
case BEFORE : spinbutton_after.set_value( TOTAL_MB - spinbutton_size.get_value() - before_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;
case SIZE : spinbutton_after.set_value( TOTAL_MB - before_value - spinbutton_size.get_value() );
if ( ! fixed_start )
spinbutton_before .set_value( TOTAL_MB - spinbutton_size.get_value() - spinbutton_after.get_value() );
break;
case SIZE : spinbutton_after.set_value( TOTAL_MB - before_value - spinbutton_size.get_value() );
if ( ! fixed_start )
spinbutton_before .set_value( TOTAL_MB - spinbutton_size.get_value() - spinbutton_after.get_value() );
break;
case AFTER : if ( ! fixed_start )
spinbutton_before .set_value( TOTAL_MB - spinbutton_size.get_value() - spinbutton_after.get_value() );
break;
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;
break;
}
@ -307,10 +306,10 @@ void Dialog_Base_Partition::on_spinbutton_value_changed( SPINBUTTON spinbutton
void Dialog_Base_Partition::Check_Change()
{
if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() &&
ORIG_SIZE == spinbutton_size .get_value_as_int() &&
ORIG_AFTER == spinbutton_after .get_value_as_int()
)
if ( ORIG_BEFORE == spinbutton_before .get_value_as_int() &&
ORIG_SIZE == spinbutton_size .get_value_as_int() &&
ORIG_AFTER== spinbutton_after .get_value_as_int()
)
button_resize_move .set_sensitive( false ) ;
else
button_resize_move .set_sensitive( true ) ;

View file

@ -114,13 +114,13 @@ void Dialog_Partition_Info::init_drawingarea()
unused = 375 - used - (BORDER *2) ;
//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 ) ;
partition .type == GParted::EXTENDED ? color_unused.set( "darkgrey" ) : color_unused.set( "white" ) ;
this ->get_colormap() ->alloc_color( color_unused ) ;
color_text.set( "black" ); this ->get_colormap() ->alloc_color( color_text ) ;
color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ;
color_text.set( "black" ); this ->get_colormap() ->alloc_color( color_text ) ;
color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ;
//set text of pangolayout
os << partition .partition <<"\n" << String::ucompose( _("%1 MB"), partition .Get_Length_MB() ) ;

View file

@ -82,7 +82,7 @@ void Dialog_Progress::Set_Progress_Current_Operation( )
progressbar_current.set_fraction( fraction_current );
if ( time_left > 59 && time_left < 120 )
progressbar_current.set_text( String::ucompose( _("about %1 minute and %2 seconds left"), time_left/60, time_left % 60 ) ) ;
progressbar_current.set_text( String::ucompose( _("about %1 minute and %2 seconds left"), time_left/60, time_left % 60 ) ) ;
else
progressbar_current.set_text( String::ucompose( _("about %1 minutes and %2 seconds left"), time_left/60, time_left % 60 ) ) ;
progressbar_current.set_text( String::ucompose( _("about %1 minutes and %2 seconds left"), time_left/60, time_left % 60 ) ) ;
}

View file

@ -36,18 +36,18 @@ void Frame_Resizer_Base::init()
this ->add( drawingarea ) ;
color_used.set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ;
color_unused.set( "white" ); this ->get_colormap() ->alloc_color( color_unused ) ;
color_arrow.set( "black" ); this ->get_colormap() ->alloc_color( color_arrow ) ;
color_background.set( "darkgrey" ); this ->get_colormap() ->alloc_color( color_background ) ;
color_used.set( "#F8F8BA" ); this ->get_colormap() ->alloc_color( color_used ) ;
color_unused.set( "white" ); this ->get_colormap() ->alloc_color( color_unused ) ;
color_arrow.set( "black" ); this ->get_colormap() ->alloc_color( color_arrow ) ;
color_background.set( "darkgrey" ); this ->get_colormap() ->alloc_color( color_background ) ;
color_arrow_rectangle.set( "lightgrey" ); this ->get_colormap() ->alloc_color( color_arrow_rectangle ) ;
cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ;
cursor_normal = new Gdk::Cursor( Gdk::LEFT_PTR ) ;
cursor_move = new Gdk::Cursor( Gdk::FLEUR ) ;
cursor_resize = new Gdk::Cursor( Gdk::SB_H_DOUBLE_ARROW ) ;
cursor_normal = new Gdk::Cursor( Gdk::LEFT_PTR ) ;
cursor_move = new Gdk::Cursor( Gdk::FLEUR ) ;
GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false;
X_END = 0;
GRIP_MOVE = GRIP_LEFT = GRIP_RIGHT = false;
X_END = 0;
Gdk::Point p;
p.set_y( 15); arrow_points.push_back( p ) ;
@ -138,9 +138,9 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev )
if ( ! GRIP_LEFT && ! GRIP_RIGHT && ! GRIP_MOVE ) //no need to check this while resizing or moving
{
//check if pointer is over a gripper
if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip
if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
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
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip
drawingarea .get_parent_window() ->set_cursor( *cursor_move ) ;
@ -155,7 +155,7 @@ bool Frame_Resizer_Base::drawingarea_on_mouse_motion( GdkEventMotion *ev )
if ( GRIP_LEFT && ev ->x >= 10 && ev ->x <= X_END - USED - BORDER * 2 )
{
X_START =(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 >= X_START + USED + BORDER *2 && ev ->x <= 526 )
@ -191,9 +191,9 @@ bool Frame_Resizer_Base::drawingarea_on_button_press_event( GdkEventButton *ev )
{
GRIP_MOVE = false; GRIP_RIGHT = false; GRIP_LEFT = false ;
if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip
if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip
GRIP_LEFT = true ;
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 ;
else if ( ! fixed_start && ev ->x >= X_START && ev ->x <= X_END ) //move grip
{ GRIP_MOVE = true ; X_START_MOVE = (int)ev ->x; }

View file

@ -27,9 +27,9 @@ bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev )
if ( ! GRIP_LEFT && ! GRIP_RIGHT ) //no need to check this while resizing
{
//check if pointer is over a gripper
if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip
if ( ! fixed_start && ev ->x >= X_START -10 && ev ->x <= X_START && ev ->y >= 5 && ev ->y <= 45 ) //left grip
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
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
drawingarea .get_parent_window() ->set_cursor( *cursor_resize ) ;
else //normal pointer
drawingarea .get_parent_window() ->set_cursor( *cursor_normal ) ;
@ -40,13 +40,13 @@ bool Frame_Resizer_Extended::drawingarea_on_mouse_motion( GdkEventMotion *ev )
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 ;
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 )
{
X_END = (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() ;

View file

@ -27,14 +27,14 @@ Partition::Partition( )
}
void Partition::Set( const Glib::ustring & partition,
const int partition_number,
const PartitionType type,
const Glib::ustring & filesystem,
const Sector & sector_start,
const Sector & sector_end,
const Sector & sectors_used,
const bool inside_extended,
const bool busy )
const int partition_number,
const PartitionType type,
const Glib::ustring & filesystem,
const Sector & sector_start,
const Sector & sector_end,
const Sector & sectors_used,
const bool inside_extended,
const bool busy )
{
this->partition = partition;
this->partition_number = partition_number;
@ -61,29 +61,29 @@ void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool in
Glib::ustring Partition::Get_Color( const Glib::ustring & filesystem )
{ // very ugly, but somehow i can't figure out a more efficient way. must be lack of sleep or so... :-)
//purple teints
if ( filesystem == "ext2" ) return "#9DB8D2" ;
else if ( filesystem == "ext3" ) return "#7590AE";
if ( filesystem == "ext2" ) return "#9DB8D2" ;
else if ( filesystem == "ext3" ) return "#7590AE";
//brown
else if ( filesystem == "linux-swap" ) return "#C1665A" ;
else if ( filesystem == "linux-swap" ) return "#C1665A" ;
//greenisch stuff..
else if ( filesystem == "fat16" ) return "green" ;
else if ( filesystem == "fat32" ) return "#18D918";
else if ( filesystem == "ntfs" ) return "#42E5AC";
else if ( filesystem == "fat16" ) return "green" ;
else if ( filesystem == "fat32" ) return "#18D918";
else if ( filesystem == "ntfs" ) return "#42E5AC";
//blue
else if ( filesystem == "reiserfs" ) return "blue" ;
else if ( filesystem == "reiserfs" ) return "blue" ;
//libparted can only detect these, i decided to "yellow them" :^)
else if ( filesystem == "HFS" ) return "yellow" ;
else if ( filesystem == "JFS" ) return "yellow" ;
else if ( filesystem == "UFS" ) return "yellow" ;
else if ( filesystem == "XFS" ) return "yellow" ;
else if ( filesystem == "HFS" ) return "yellow" ;
else if ( filesystem == "JFS" ) return "yellow" ;
else if ( filesystem == "UFS" ) return "yellow" ;
else if ( filesystem == "XFS" ) return "yellow" ;
//darkgrey and ligthblue
else if ( filesystem == "unallocated" ) return "darkgrey" ;
else if ( filesystem == "extended" ) return "#7DFCFE" ;
else if ( filesystem == "unallocated" ) return "darkgrey" ;
else if ( filesystem == "extended" ) return "#7DFCFE" ;
//unknown filesystem ( damaged, or simply unknown )
else return "black";
@ -91,7 +91,7 @@ Glib::ustring Partition::Get_Color( const Glib::ustring & filesystem )
void Partition::Update_Number( int new_number )
{ //of course this fails when we have devicenames with numbers over 99
partition_number >= 10 ? partition = partition.substr( 0, partition.length() - 2 ) : partition = partition.substr( 0, partition.length() - 1 ) ;
partition_number >= 10 ? partition = partition.substr( 0, partition.length() -2 ) : partition = partition.substr( 0, partition.length() -1 ) ;
partition_number = new_number;
std::ostringstream os;

View file

@ -110,7 +110,7 @@ void Win_GParted::init_toolbar()
//NEW and DELETE
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::NEW));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_new) ); toolbar_main.append(*toolbutton);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_new) ); toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Create a new partition in the selected unallocated space") );
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::DELETE));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_delete) ); toolbar_main.append(*toolbutton);
@ -126,19 +126,19 @@ void Win_GParted::init_toolbar()
//COPY and PASTE
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::COPY));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_copy) ); toolbar_main.append(*toolbutton);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_copy) ); toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Copy the selected partition to the clipboard") );
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::PASTE));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_paste) ); toolbar_main.append(*toolbutton);
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_paste) ); toolbar_main.append(*toolbutton);
toolbutton ->set_tooltip(tooltips, _("Paste the partition from the clipboard") );
toolbar_main.append( *(Gtk::manage(new Gtk::SeparatorToolItem)) );
//UNDO and APPLY
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false );
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false );
toolbutton ->set_tooltip(tooltips, _("Undo last operation") );
toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::APPLY));
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false );
toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) ); toolbar_main.append(*toolbutton); toolbutton ->set_sensitive( false );
toolbutton ->set_tooltip(tooltips, _("Apply all operations") );
//initizialize and pack optionmenu_devices
@ -425,7 +425,7 @@ bool Win_GParted::on_delete_event(GdkEventAny *event)
void Win_GParted::Add_Operation( OperationType operationtype, const Partition & new_partition)
{
Operation operation( devices[ current_device ] , devices[ source_device ] , selected_partition, new_partition, operationtype );
Operation operation( devices[ current_device ], devices[ source_device ], selected_partition, new_partition, operationtype );
operations.push_back( operation );
@ -436,7 +436,7 @@ void Win_GParted::Add_Operation( OperationType operationtype, const Partition &
if ( operations.size() == 1 ) //first operation, open operationslist
{
int x,y; this ->get_size( x, y );
int x,y; this ->get_size( x, y );
y -= 300;
for ( int t=vpaned_main.get_position() ; t > y ; t-=3 )
@ -469,16 +469,16 @@ void Win_GParted::Refresh_Visual( )
treerow[ treeview_operations_columns.operation_description ] = operations[t] .str_operation ;
switch ( operations[t].operationtype )
{
case GParted::DELETE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU);
break;
case GParted::CREATE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU);
break;
case GParted::RESIZE_MOVE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU);
break;
case GParted::CONVERT : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
break;
case GParted::COPY : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
break;
case GParted::DELETE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::DELETE, Gtk::ICON_SIZE_MENU);
break;
case GParted::CREATE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU);
break;
case GParted::RESIZE_MOVE : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_MENU);
break;
case GParted::CONVERT : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::CONVERT, Gtk::ICON_SIZE_MENU);
break;
case GParted::COPY : treerow[ treeview_operations_columns.operation_icon ] =render_icon(Gtk::Stock::COPY, Gtk::ICON_SIZE_MENU);
break;
}
}
@ -507,15 +507,15 @@ void Win_GParted::Refresh_Visual( )
switch ( partitions[t].type )
{
case GParted::PRIMARY : primary_count++;
break;
case GParted::EXTENDED : any_extended = true;
primary_count++;
break;
break;
case GParted::EXTENDED : any_extended = true;
primary_count++;
break;
case GParted::LOGICAL : any_logic = true;
if ( partitions[t].busy && partitions[t].partition_number > highest_logic_busy )
highest_logic_busy = partitions[t].partition_number ;
break;
default : break;
if ( partitions[t].busy && partitions[t].partition_number > highest_logic_busy )
highest_logic_busy = partitions[t].partition_number ;
break;
default : break;
}
}
@ -535,7 +535,7 @@ void Win_GParted::Refresh_Visual( )
//treeview details
treeview_detail .Load_Partitions( partitions ) ;
allow_new( false ); allow_delete( false );allow_resize( false );allow_copy( false );allow_paste( false );
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false ); allow_paste( false );
}
bool Win_GParted::Quit_Check_Operations()
@ -594,12 +594,12 @@ void Win_GParted::Set_Valid_Operations()
allow_convert( true ) ;
//find out if resizing/moving and copying is possible
if ( selected_partition.filesystem == "ext2" ||
selected_partition.filesystem == "ext3" ||
selected_partition.filesystem == "fat16" ||
selected_partition.filesystem == "fat32" ||
selected_partition.filesystem == "linux-swap"
)
if ( selected_partition.filesystem == "ext2" ||
selected_partition.filesystem == "ext3" ||
selected_partition.filesystem == "fat16" ||
selected_partition.filesystem == "fat32" ||
selected_partition.filesystem == "linux-swap"
)
{
allow_resize( true ) ;
@ -618,7 +618,7 @@ void Win_GParted::Set_Valid_Operations()
if ( ! any_logic ) //deletion is only allowed when there are nog logical partitions inside.
allow_delete( true ) ;
allow_resize( true );
allow_resize( true );
}
}
@ -636,7 +636,7 @@ void Win_GParted::close_operationslist()
{
treeview_detail .columns_autosize() ; //seemed a nice place for it..
int x,y; this ->get_size( x, y );
int x,y; this ->get_size( x, y );
y -= 210 ; //height of whole app - menubar - visualdisk - statusbar ....
for ( int t=vpaned_main.get_position() ; t < y ; t+=3 )
{
@ -685,7 +685,7 @@ void Win_GParted::menu_gparted_refresh_devices()
//check if current_device is still available (think about hotpluggable shit like usbdevices)
if ( current_device >= devices .size() )
current_device = 0 ;
current_device = 0 ;
//rebuild visualdisk and treeview
Refresh_Visual( );