another change to highlighting of selected partition. deal properly with
* include/DrawingAreaVisualDisk.h, src/DrawingAreaVisualDisk.cc: another change to highlighting of selected partition. * include/Partition.h, src/Win_GParted.cc: deal properly with just formatted partitions * src/Operation.cc: added FIXME
This commit is contained in:
parent
85e9ddbf48
commit
4e57356c34
|
@ -1,3 +1,12 @@
|
||||||
|
2006-03-18 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* include/DrawingAreaVisualDisk.h,
|
||||||
|
src/DrawingAreaVisualDisk.cc: another change to highlighting of
|
||||||
|
selected partition.
|
||||||
|
* include/Partition.h,
|
||||||
|
src/Win_GParted.cc: deal properly with just formatted partitions
|
||||||
|
* src/Operation.cc: added FIXME
|
||||||
|
|
||||||
2006-03-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2006-03-17 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* src/GParted_Core.cc: moved comment to correct position
|
* src/GParted_Core.cc: moved comment to correct position
|
||||||
|
|
|
@ -55,7 +55,6 @@ private:
|
||||||
void calc_text( std::vector<visual_partition> & visual_partitions ) ;
|
void calc_text( std::vector<visual_partition> & visual_partitions ) ;
|
||||||
|
|
||||||
void draw_partition( const visual_partition & vp ) ;
|
void draw_partition( const visual_partition & vp ) ;
|
||||||
void draw_selection_effects( const visual_partition & vp ) ;
|
|
||||||
void draw_partitions( const std::vector<visual_partition> & visual_partitions ) ;
|
void draw_partitions( const std::vector<visual_partition> & visual_partitions ) ;
|
||||||
|
|
||||||
bool set_selected( std::vector<visual_partition> & visual_partitions, int x, int y ) ;
|
bool set_selected( std::vector<visual_partition> & visual_partitions, int x, int y ) ;
|
||||||
|
|
|
@ -37,9 +37,10 @@ enum PartitionType {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PartitionStatus {
|
enum PartitionStatus {
|
||||||
STAT_REAL = 1,
|
STAT_REAL = 0,
|
||||||
STAT_NEW = 2,
|
STAT_NEW = 1,
|
||||||
STAT_COPY = 3
|
STAT_COPY = 2,
|
||||||
|
STAT_FORMATTED = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,9 @@
|
||||||
#include "../include/DrawingAreaVisualDisk.h"
|
#include "../include/DrawingAreaVisualDisk.h"
|
||||||
|
|
||||||
#define MAIN_BORDER 5
|
#define MAIN_BORDER 5
|
||||||
#define BORDER 6
|
#define BORDER 4
|
||||||
#define SEP 5
|
#define SEP 5
|
||||||
#define HEIGHT 70 + 2 * MAIN_BORDER
|
#define HEIGHT 70 + 2 * MAIN_BORDER
|
||||||
#define SHADOW 4
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
@ -30,13 +29,13 @@ DrawingAreaVisualDisk::DrawingAreaVisualDisk()
|
||||||
{
|
{
|
||||||
//set and allocated some standard colors
|
//set and allocated some standard colors
|
||||||
color_used .set( Utils::Get_Color( GParted::FS_USED ) );
|
color_used .set( Utils::Get_Color( GParted::FS_USED ) );
|
||||||
this ->get_colormap() ->alloc_color( color_used ) ;
|
get_colormap() ->alloc_color( color_used ) ;
|
||||||
|
|
||||||
color_unused .set( Utils::Get_Color( GParted::FS_UNUSED ) );
|
color_unused .set( Utils::Get_Color( GParted::FS_UNUSED ) );
|
||||||
this ->get_colormap() ->alloc_color( color_unused ) ;
|
get_colormap() ->alloc_color( color_unused ) ;
|
||||||
|
|
||||||
color_text .set( "black" );
|
color_text .set( "black" );
|
||||||
this ->get_colormap() ->alloc_color( color_text ) ;
|
get_colormap() ->alloc_color( color_text ) ;
|
||||||
|
|
||||||
set_events( Gdk::BUTTON_PRESS_MASK );
|
set_events( Gdk::BUTTON_PRESS_MASK );
|
||||||
|
|
||||||
|
@ -96,12 +95,12 @@ void DrawingAreaVisualDisk::set_static_data( const std::vector<Partition> & part
|
||||||
partitions[ t ] .sectors_used / static_cast<double>( partitions[ t ] .get_length() ) ;
|
partitions[ t ] .sectors_used / static_cast<double>( partitions[ t ] .get_length() ) ;
|
||||||
|
|
||||||
visual_partitions .back() .color = partitions[ t ] .color;
|
visual_partitions .back() .color = partitions[ t ] .color;
|
||||||
this ->get_colormap() ->alloc_color( visual_partitions .back() .color );
|
get_colormap() ->alloc_color( visual_partitions .back() .color );
|
||||||
|
|
||||||
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||||
set_static_data( partitions[ t ] .logicals,
|
set_static_data( partitions[ t ] .logicals,
|
||||||
visual_partitions .back() .logicals,
|
visual_partitions .back() .logicals,
|
||||||
partitions[ t ] .sector_end - partitions[ t ] .sector_start ) ;
|
partitions[ t ] .get_length() ) ;
|
||||||
else
|
else
|
||||||
visual_partitions .back() .pango_layout = create_pango_layout(
|
visual_partitions .back() .pango_layout = create_pango_layout(
|
||||||
partitions[ t ] .get_path() + "\n" + Utils::format_size( partitions[ t ] .get_length() ) ) ;
|
partitions[ t ] .get_path() + "\n" + Utils::format_size( partitions[ t ] .get_length() ) ) ;
|
||||||
|
@ -248,100 +247,28 @@ void DrawingAreaVisualDisk::draw_partition( const visual_partition & vp )
|
||||||
vp .y_text,
|
vp .y_text,
|
||||||
vp .pango_layout ) ;
|
vp .pango_layout ) ;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
//selection
|
||||||
void DrawingAreaVisualDisk::draw_selection_effects( const visual_partition & vp )
|
if ( vp .selected )
|
||||||
{
|
|
||||||
gc ->set_foreground( color_text );
|
|
||||||
|
|
||||||
//bottom shadow
|
|
||||||
get_window() ->draw_rectangle( gc,
|
|
||||||
true,
|
|
||||||
vp .x_start + SHADOW,
|
|
||||||
vp .y_start + vp .height,
|
|
||||||
vp .length,
|
|
||||||
SHADOW ) ;
|
|
||||||
|
|
||||||
//righthand shadow
|
|
||||||
get_window() ->draw_rectangle( gc,
|
|
||||||
true,
|
|
||||||
vp .x_start + vp .length,
|
|
||||||
vp .y_start + SHADOW,
|
|
||||||
SHADOW,
|
|
||||||
vp .height ) ;
|
|
||||||
|
|
||||||
|
|
||||||
//if selected contains logicals we need to add more shadows and color
|
|
||||||
if ( vp .logicals .size() > 0 )
|
|
||||||
{
|
{
|
||||||
//inner shadows
|
gc ->set_foreground( color_used ) ;
|
||||||
for ( unsigned int t = 0 ; t < vp .logicals .size() ; t++ )
|
|
||||||
{
|
|
||||||
//top shadows
|
|
||||||
get_window() ->draw_rectangle( gc,
|
|
||||||
true,
|
|
||||||
vp .logicals[ t ] .x_start - SHADOW,
|
|
||||||
vp .logicals[ t ] .y_start - SHADOW,
|
|
||||||
vp .logicals[ t ] .length,
|
|
||||||
SHADOW ) ;
|
|
||||||
|
|
||||||
//lefthand shadows
|
|
||||||
get_window() ->draw_rectangle( gc,
|
|
||||||
true,
|
|
||||||
vp .logicals[ t ] .x_start - SHADOW,
|
|
||||||
vp .logicals[ t ] .y_start,
|
|
||||||
SHADOW,
|
|
||||||
vp .logicals[ t ] .height - SHADOW ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//create extra 'extended' to create the illusion of floating above the logicals
|
|
||||||
gc ->set_foreground( vp .color );
|
|
||||||
|
|
||||||
//bottomline..
|
|
||||||
get_window() ->draw_rectangle( gc,
|
get_window() ->draw_rectangle( gc,
|
||||||
true,
|
false,
|
||||||
vp .x_start + BORDER + SHADOW,
|
vp .x_start + BORDER/2 ,
|
||||||
vp .y_start + vp .height - BORDER,
|
vp .y_start + BORDER/2 ,
|
||||||
vp .length - BORDER * 2,
|
vp .length - BORDER,
|
||||||
SHADOW ) ;
|
vp .height - BORDER ) ;
|
||||||
|
|
||||||
//small rectangles on the righthandside of each logical..
|
|
||||||
for ( unsigned int t = 0 ; t < vp .logicals .size() ; t++ )
|
|
||||||
get_window() ->draw_rectangle( gc,
|
|
||||||
true,
|
|
||||||
vp .logicals[ t ] .x_start + vp .logicals[ t ] .length - SHADOW,
|
|
||||||
vp .logicals[ t ] .y_start,
|
|
||||||
SHADOW,
|
|
||||||
vp .logicals[ t ] .height - SHADOW ) ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingAreaVisualDisk::draw_partitions( const std::vector<visual_partition> & visual_partitions )
|
void DrawingAreaVisualDisk::draw_partitions( const std::vector<visual_partition> & visual_partitions )
|
||||||
{
|
{
|
||||||
visual_partition vp ;
|
|
||||||
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
|
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
|
||||||
{
|
{
|
||||||
vp = visual_partitions[ t ] ;
|
draw_partition( visual_partitions[ t ] ) ;
|
||||||
|
|
||||||
if ( vp .selected )
|
if ( visual_partitions[ t ] .logicals .size() > 0 )
|
||||||
{
|
draw_partitions( visual_partitions[ t ] .logicals ) ;
|
||||||
vp .x_start -= SHADOW ;
|
|
||||||
vp .y_start -= SHADOW ;
|
|
||||||
vp .x_used_start -= SHADOW ;
|
|
||||||
vp .x_unused_start -= SHADOW ;
|
|
||||||
vp .y_used_unused_start -= SHADOW ;
|
|
||||||
|
|
||||||
vp .x_text -= SHADOW ;
|
|
||||||
vp .y_text -= SHADOW ;
|
|
||||||
}
|
|
||||||
|
|
||||||
draw_partition( vp ) ;
|
|
||||||
|
|
||||||
if ( vp .logicals .size() > 0 )
|
|
||||||
draw_partitions( vp .logicals ) ;
|
|
||||||
|
|
||||||
if ( vp .selected )
|
|
||||||
draw_selection_effects( vp ) ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,6 +319,10 @@ void DrawingAreaVisualDisk::on_realize()
|
||||||
Gtk::DrawingArea::on_realize() ;
|
Gtk::DrawingArea::on_realize() ;
|
||||||
|
|
||||||
gc = Gdk::GC::create( get_window() );
|
gc = Gdk::GC::create( get_window() );
|
||||||
|
gc ->set_line_attributes( 2,
|
||||||
|
Gdk::LINE_ON_OFF_DASH,
|
||||||
|
Gdk::CAP_BUTT,
|
||||||
|
Gdk::JOIN_MITER ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrawingAreaVisualDisk::on_expose_event( GdkEventExpose * event )
|
bool DrawingAreaVisualDisk::on_expose_event( GdkEventExpose * event )
|
||||||
|
@ -487,7 +418,7 @@ void DrawingAreaVisualDisk::free_colors( std::vector<visual_partition> & visual_
|
||||||
{
|
{
|
||||||
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
|
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
|
||||||
{
|
{
|
||||||
this ->get_colormap() ->free_colors( visual_partitions[ t ] .color, 1 ) ;
|
get_colormap() ->free_colors( visual_partitions[ t ] .color, 1 ) ;
|
||||||
|
|
||||||
if ( visual_partitions[ t ] .logicals .size() > 0 )
|
if ( visual_partitions[ t ] .logicals .size() > 0 )
|
||||||
free_colors( visual_partitions[ t ] .logicals ) ;
|
free_colors( visual_partitions[ t ] .logicals ) ;
|
||||||
|
@ -499,9 +430,9 @@ DrawingAreaVisualDisk::~DrawingAreaVisualDisk()
|
||||||
clear() ;
|
clear() ;
|
||||||
|
|
||||||
//free the allocated colors
|
//free the allocated colors
|
||||||
this ->get_colormap() ->free_colors( color_used, 1 ) ;
|
get_colormap() ->free_colors( color_used, 1 ) ;
|
||||||
this ->get_colormap() ->free_colors( color_unused, 1 ) ;
|
get_colormap() ->free_colors( color_unused, 1 ) ;
|
||||||
this ->get_colormap() ->free_colors( color_text, 1 ) ;
|
get_colormap() ->free_colors( color_text, 1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
|
@ -258,6 +258,13 @@ void Operation::Apply_Delete_To_Visual( std::vector<Partition> & partitions )
|
||||||
|
|
||||||
void Operation::Apply_Create_To_Visual( std::vector<Partition> & partitions )
|
void Operation::Apply_Create_To_Visual( std::vector<Partition> & partitions )
|
||||||
{
|
{
|
||||||
|
//FIXME (segfault): gdb bt suggest this function. steps to reproduce on 'voyager':
|
||||||
|
//-shrink /dev/hda5
|
||||||
|
//-create a small partition in the middle of the new unallocated space
|
||||||
|
//-grow /dev/hda5 again
|
||||||
|
//-grow the new partition
|
||||||
|
//perform steps in sequence without applying
|
||||||
|
|
||||||
if ( ! partition_original .inside_extended )
|
if ( ! partition_original .inside_extended )
|
||||||
{
|
{
|
||||||
partitions[ Get_Index_Original( partitions ) ] = partition_new ;
|
partitions[ Get_Index_Original( partitions ) ] = partition_new ;
|
||||||
|
|
|
@ -1355,7 +1355,8 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
||||||
selected_partition .sector_end,
|
selected_partition .sector_end,
|
||||||
selected_partition .inside_extended,
|
selected_partition .inside_extended,
|
||||||
false ) ;
|
false ) ;
|
||||||
|
|
||||||
|
part_temp .status = GParted::STAT_FORMATTED ;
|
||||||
|
|
||||||
//if selected_partition is NEW we simply remove the NEW operation from the list and
|
//if selected_partition is NEW we simply remove the NEW operation from the list and
|
||||||
//add it again with the new filesystem
|
//add it again with the new filesystem
|
||||||
|
|
Loading…
Reference in New Issue