removed legend after discussion with usability guys

* removed legend after discussion with usability guys
This commit is contained in:
Bart Hakvoort 2006-02-10 23:47:02 +00:00
parent f6731706f8
commit 49b31334cf
8 changed files with 54 additions and 128 deletions

View File

@ -1,3 +1,7 @@
2006-02-11 Bart Hakvoort <hakvoort@cvs.gnome.org>
* removed legend after discussion with usability guys
2006-02-10 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-02-10 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/TreeView_Detail.cc: finally fixed #169683!! ( party, party! :p ) * src/TreeView_Detail.cc: finally fixed #169683!! ( party, party! :p )

View File

@ -15,12 +15,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef VBOX_VISUALDISK #ifndef FRAME_VISUALDISK
#define VBOX_VISUALDISK #define FRAME_VISUALDISK
#include "../include/Partition.h" #include "../include/Partition.h"
#include <gtkmm/box.h>
#include <gtkmm/frame.h> #include <gtkmm/frame.h>
#include <gtkmm/drawingarea.h> #include <gtkmm/drawingarea.h>
@ -28,11 +27,11 @@
namespace GParted namespace GParted
{ {
class VBox_VisualDisk : public Gtk::VBox class FrameVisualDisk : public Gtk::Frame
{ {
public: public:
VBox_VisualDisk(); FrameVisualDisk();
~VBox_VisualDisk(); ~FrameVisualDisk();
void load_partitions( const std::vector<Partition> & partitions, Sector device_length ); void load_partitions( const std::vector<Partition> & partitions, Sector device_length );
void set_selected( const Partition & partition ) ; void set_selected( const Partition & partition ) ;
@ -55,10 +54,6 @@ private:
void calc_used_unused( std::vector<visual_partition> & visual_partitions ) ; void calc_used_unused( std::vector<visual_partition> & visual_partitions ) ;
void calc_text( std::vector<visual_partition> & visual_partitions ) ; void calc_text( std::vector<visual_partition> & visual_partitions ) ;
void build_legend( const std::vector<Partition> & partitions ) ;
void prepare_legend( const std::vector<Partition> & partitions, std::vector<GParted::FILESYSTEM> & legend) ;
Gtk::HBox * create_legend_item( GParted::FILESYSTEM fs ) ;
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 ) ;
@ -122,12 +117,10 @@ private:
visual_partition selected_vp ; visual_partition selected_vp ;
int TOT_SEP, MIN_SIZE ; int TOT_SEP, MIN_SIZE ;
Gtk::Frame *frame ;
Gtk::DrawingArea drawingarea; Gtk::DrawingArea drawingarea;
Gtk::HBox hbox_legend ;
Glib::RefPtr<Gdk::GC> gc; Glib::RefPtr<Gdk::GC> gc;
Gdk::Color color_used, color_unused, color_text; Gdk::Color color_used, color_unused, color_text;
}; };
} //GParted } //GParted
#endif //VBOX_VISUALDISK #endif //FRAME_VISUALDISK

View File

@ -7,7 +7,7 @@ EXTRA_DIST = \
Frame_Resizer_Base.h\ Frame_Resizer_Base.h\
i18n.h\ i18n.h\
Partition.h \ Partition.h \
VBox_VisualDisk.h \ FrameVisualDisk.h \
Dialog_Partition_Info.h\ Dialog_Partition_Info.h\
ext3.h \ ext3.h \
Frame_Resizer_Extended.h\ Frame_Resizer_Extended.h\

View File

@ -19,7 +19,7 @@
#define WIN_GPARTED #define WIN_GPARTED
#include "../include/Device.h" #include "../include/Device.h"
#include "../include/VBox_VisualDisk.h" #include "../include/FrameVisualDisk.h"
#include "../include/Partition.h" #include "../include/Partition.h"
#include "../include/TreeView_Detail.h" #include "../include/TreeView_Detail.h"
#include "../include/Operation.h" #include "../include/Operation.h"
@ -179,7 +179,7 @@ private:
Gtk::ProgressBar pulsebar ; Gtk::ProgressBar pulsebar ;
Gtk::TreeRow treerow; Gtk::TreeRow treerow;
VBox_VisualDisk vbox_visual_disk; FrameVisualDisk frame_visualdisk;
TreeView_Detail treeview_detail; TreeView_Detail treeview_detail;
//device combo //device combo

View File

@ -14,7 +14,6 @@ src/Operation.cc
src/Partition.cc src/Partition.cc
src/TreeView_Detail.cc src/TreeView_Detail.cc
src/Utils.cc src/Utils.cc
src/VBox_VisualDisk.cc
src/Win_GParted.cc src/Win_GParted.cc
src/ext2.cc src/ext2.cc
src/ext3.cc src/ext3.cc

View File

@ -15,9 +15,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "../include/VBox_VisualDisk.h" #include "../include/FrameVisualDisk.h"
#include <gtkmm/image.h>
#define BORDER 8 #define BORDER 8
#define SEP 5 #define SEP 5
@ -26,10 +24,10 @@
namespace GParted namespace GParted
{ {
VBox_VisualDisk::VBox_VisualDisk() FrameVisualDisk::FrameVisualDisk()
{ {
this ->set_border_width( 10 ); this ->set_border_width( 5 ) ;
this ->set_spacing( 5 ); this ->set_shadow_type( Gtk::SHADOW_ETCHED_OUT ) ;
//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 ) );
@ -44,22 +42,16 @@ VBox_VisualDisk::VBox_VisualDisk()
//prepare drawingarea and frame and pack them //prepare drawingarea and frame and pack them
drawingarea .set_events( Gdk::BUTTON_PRESS_MASK ); drawingarea .set_events( Gdk::BUTTON_PRESS_MASK );
drawingarea .signal_realize() .connect( sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_realize) ) ; drawingarea .signal_realize() .connect( sigc::mem_fun(*this, &FrameVisualDisk::drawingarea_on_realize) ) ;
drawingarea .signal_expose_event() .connect( sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose) ) ; drawingarea .signal_expose_event() .connect( sigc::mem_fun(*this, &FrameVisualDisk::drawingarea_on_expose) ) ;
drawingarea .signal_button_press_event() .connect( sigc::mem_fun( *this, &VBox_VisualDisk::on_drawingarea_button_press) ) ; drawingarea .signal_button_press_event() .connect( sigc::mem_fun( *this, &FrameVisualDisk::on_drawingarea_button_press) ) ;
drawingarea .set_size_request( -1, HEIGHT ) ; drawingarea .set_size_request( -1, HEIGHT ) ;
frame = manage( new Gtk::Frame() ) ; this ->add( drawingarea ) ;
frame ->add( drawingarea );
frame ->set_shadow_type( Gtk::SHADOW_ETCHED_OUT ) ;
this ->pack_start( *frame, Gtk::PACK_EXPAND_WIDGET ) ;
//pack hbox which holds the legend
this ->pack_start( hbox_legend );
} }
void VBox_VisualDisk::load_partitions( const std::vector<Partition> & partitions, Sector device_length ) void FrameVisualDisk::load_partitions( const std::vector<Partition> & partitions, Sector device_length )
{ {
clear() ; clear() ;
@ -67,27 +59,24 @@ void VBox_VisualDisk::load_partitions( const std::vector<Partition> & partitions
set_static_data( partitions, visual_partitions, device_length ) ; set_static_data( partitions, visual_partitions, device_length ) ;
drawingarea .queue_resize() ; drawingarea .queue_resize() ;
build_legend( partitions ) ;
} }
void VBox_VisualDisk::set_selected( const Partition & partition ) void FrameVisualDisk::set_selected( const Partition & partition )
{ {
set_selected( visual_partitions, partition ) ; set_selected( visual_partitions, partition ) ;
draw_partitions( visual_partitions ) ; draw_partitions( visual_partitions ) ;
} }
void VBox_VisualDisk::clear() void FrameVisualDisk::clear()
{ {
free_colors( visual_partitions ) ; free_colors( visual_partitions ) ;
visual_partitions .clear() ; visual_partitions .clear() ;
hbox_legend .children() .clear() ;
drawingarea .queue_resize() ; drawingarea .queue_resize() ;
} }
int VBox_VisualDisk::get_total_separator_px( const std::vector<Partition> & partitions ) int FrameVisualDisk::get_total_separator_px( const std::vector<Partition> & partitions )
{ {
for ( unsigned int t = 0 ; t < partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED ) if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
@ -97,7 +86,7 @@ int VBox_VisualDisk::get_total_separator_px( const std::vector<Partition> & part
return ( partitions .size() -1 ) * SEP ; return ( partitions .size() -1 ) * SEP ;
} }
void VBox_VisualDisk::set_static_data( const std::vector<Partition> & partitions, std::vector<visual_partition> & visual_partitions, Sector length ) void FrameVisualDisk::set_static_data( const std::vector<Partition> & partitions, std::vector<visual_partition> & visual_partitions, Sector length )
{ {
Sector p_length ; Sector p_length ;
visual_partition vp ; visual_partition vp ;
@ -129,7 +118,7 @@ void VBox_VisualDisk::set_static_data( const std::vector<Partition> & partitions
} }
} }
int VBox_VisualDisk::calc_length( std::vector<visual_partition> & visual_partitions, int length_px ) int FrameVisualDisk::calc_length( std::vector<visual_partition> & visual_partitions, int length_px )
{ {
int calced_length = 0 ; int calced_length = 0 ;
@ -149,7 +138,7 @@ int VBox_VisualDisk::calc_length( std::vector<visual_partition> & visual_partiti
return calced_length + (visual_partitions .size() - 1) * SEP ; return calced_length + (visual_partitions .size() - 1) * SEP ;
} }
void VBox_VisualDisk::calc_position_and_height( std::vector<visual_partition> & visual_partitions, int start, int border ) void FrameVisualDisk::calc_position_and_height( std::vector<visual_partition> & visual_partitions, int start, int border )
{ {
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
{ {
@ -166,7 +155,7 @@ void VBox_VisualDisk::calc_position_and_height( std::vector<visual_partition> &
} }
} }
void VBox_VisualDisk::calc_used_unused( std::vector<visual_partition> & visual_partitions ) void FrameVisualDisk::calc_used_unused( std::vector<visual_partition> & visual_partitions )
{ {
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
{ {
@ -194,7 +183,7 @@ void VBox_VisualDisk::calc_used_unused( std::vector<visual_partition> & visual_p
} }
} }
void VBox_VisualDisk::calc_text( std::vector<visual_partition> & visual_partitions ) void FrameVisualDisk::calc_text( std::vector<visual_partition> & visual_partitions )
{ {
int length, height ; int length, height ;
@ -221,66 +210,7 @@ void VBox_VisualDisk::calc_text( std::vector<visual_partition> & visual_partitio
} }
} }
void VBox_VisualDisk::build_legend( const std::vector<Partition> & partitions ) void FrameVisualDisk::draw_partitions( const std::vector<visual_partition> & visual_partitions )
{
std::vector<GParted::FILESYSTEM> legend ;
prepare_legend( partitions, legend ) ;
frame = manage( new Gtk::Frame() ) ;
hbox_legend .pack_start( *frame, Gtk::PACK_EXPAND_PADDING );
Gtk::HBox * hbox = manage( new Gtk::HBox( false, 15 ) );
hbox ->set_border_width( 3 ) ;
frame ->add( *hbox ) ;
bool hide_used_unused = true;
for ( unsigned int t = 0 ; t < legend .size() ; t++ )
{
hbox ->pack_start( * create_legend_item( legend[ t ] ), Gtk::PACK_SHRINK ) ;
if ( legend[ t ] != GParted::FS_UNALLOCATED && legend[ t ] != GParted::FS_EXTENDED && legend[ t ] != GParted::FS_LINUX_SWAP )
hide_used_unused = false ;
}
if ( ! hide_used_unused )
{
frame = manage( new Gtk::Frame() ) ;
hbox_legend .pack_start( *frame, Gtk::PACK_EXPAND_PADDING );
hbox = manage( new Gtk::HBox( false, 15 ) );
hbox ->set_border_width( 3 ) ;
frame ->add( *hbox ) ;
hbox ->pack_start( * create_legend_item( GParted::FS_USED ), Gtk::PACK_SHRINK ) ;
hbox ->pack_start( * create_legend_item( GParted::FS_UNUSED ), Gtk::PACK_SHRINK ) ;
}
hbox_legend .show_all_children() ;
}
void VBox_VisualDisk::prepare_legend( const std::vector<Partition> & partitions, std::vector<GParted::FILESYSTEM> & legend )
{
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
{
if ( std::find( legend .begin(), legend .end(), partitions[ t ] .filesystem ) == legend .end() )
legend .push_back( partitions[ t ] .filesystem );
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
prepare_legend( partitions[ t ] .logicals, legend ) ;
}
}
Gtk::HBox * VBox_VisualDisk::create_legend_item( GParted::FILESYSTEM fs )
{
Gtk::HBox * hbox = manage( new Gtk::HBox( false, 5 ) ) ;
hbox ->pack_start( * manage( new Gtk::Image( Utils::get_color_as_pixbuf( fs, 16, 16 ) ) ), Gtk::PACK_SHRINK );
hbox ->pack_start( * Utils::mk_label( Utils::Get_Filesystem_String( fs ) ), Gtk::PACK_SHRINK );
return hbox ;
}
void VBox_VisualDisk::draw_partitions( const std::vector<visual_partition> & visual_partitions )
{ {
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
{ {
@ -353,7 +283,7 @@ void VBox_VisualDisk::draw_partitions( const std::vector<visual_partition> & vis
} }
} }
bool VBox_VisualDisk::set_selected( std::vector<visual_partition> & visual_partitions, int x, int y ) bool FrameVisualDisk::set_selected( std::vector<visual_partition> & visual_partitions, int x, int y )
{ {
bool found = false ; bool found = false ;
@ -376,7 +306,7 @@ bool VBox_VisualDisk::set_selected( std::vector<visual_partition> & visual_parti
return found ; return found ;
} }
void VBox_VisualDisk::set_selected( std::vector<visual_partition> & visual_partitions, const Partition & partition ) void FrameVisualDisk::set_selected( std::vector<visual_partition> & visual_partitions, const Partition & partition )
{ {
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
{ {
@ -393,22 +323,22 @@ void VBox_VisualDisk::set_selected( std::vector<visual_partition> & visual_parti
} }
} }
void VBox_VisualDisk::drawingarea_on_realize() void FrameVisualDisk::drawingarea_on_realize()
{ {
gc = Gdk::GC::create( drawingarea .get_window() ); gc = Gdk::GC::create( drawingarea .get_window() );
//connect here to prevent premature signalling (only relevant at startup) //connect here to prevent premature signalling (only relevant at startup)
drawingarea .signal_size_allocate() .connect( sigc::mem_fun( *this, &VBox_VisualDisk::on_resize ) ) ; drawingarea .signal_size_allocate() .connect( sigc::mem_fun( *this, &FrameVisualDisk::on_resize ) ) ;
} }
bool VBox_VisualDisk::drawingarea_on_expose( GdkEventExpose * event ) bool FrameVisualDisk::drawingarea_on_expose( GdkEventExpose * event )
{ {
draw_partitions( visual_partitions ) ; draw_partitions( visual_partitions ) ;
return true ; return true ;
} }
bool VBox_VisualDisk::on_drawingarea_button_press( GdkEventButton * event ) bool FrameVisualDisk::on_drawingarea_button_press( GdkEventButton * event )
{ {
set_selected( visual_partitions, static_cast<int>( event ->x ), static_cast<int>( event ->y ) ) ; set_selected( visual_partitions, static_cast<int>( event ->x ), static_cast<int>( event ->y ) ) ;
draw_partitions( visual_partitions ) ; draw_partitions( visual_partitions ) ;
@ -423,7 +353,7 @@ bool VBox_VisualDisk::on_drawingarea_button_press( GdkEventButton * event )
return true ; return true ;
} }
void VBox_VisualDisk::on_resize( Gtk::Allocation & allocation ) void FrameVisualDisk::on_resize( Gtk::Allocation & allocation )
{ {
MIN_SIZE = 20 ; MIN_SIZE = 20 ;
@ -452,7 +382,7 @@ void VBox_VisualDisk::on_resize( Gtk::Allocation & allocation )
calc_text( visual_partitions ) ; calc_text( visual_partitions ) ;
} }
void VBox_VisualDisk::free_colors( std::vector<visual_partition> & visual_partitions ) void FrameVisualDisk::free_colors( std::vector<visual_partition> & visual_partitions )
{ {
for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ )
{ {
@ -463,7 +393,7 @@ void VBox_VisualDisk::free_colors( std::vector<visual_partition> & visual_partit
} }
} }
VBox_VisualDisk::~VBox_VisualDisk() FrameVisualDisk::~FrameVisualDisk()
{ {
clear() ; clear() ;

View File

@ -27,7 +27,7 @@ gparted_SOURCES = \
Partition.cc\ Partition.cc\
TreeView_Detail.cc\ TreeView_Detail.cc\
Utils.cc\ Utils.cc\
VBox_VisualDisk.cc\ FrameVisualDisk.cc\
Win_GParted.cc\ Win_GParted.cc\
ext2.cc\ ext2.cc\
ext3.cc\ ext3.cc\

View File

@ -68,11 +68,11 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
init_toolbar( ) ; init_toolbar( ) ;
vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK ); vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK );
//vbox_visual_disk... ( contains the visual represenation of the disks ) //frame_visualdisk... ( contains the visual represenation of the disks )
vbox_visual_disk .signal_partition_selected .connect( sigc::mem_fun( this, &Win_GParted::on_partition_selected ) ) ; frame_visualdisk .signal_partition_selected .connect( sigc::mem_fun( this, &Win_GParted::on_partition_selected ) ) ;
vbox_visual_disk .signal_partition_activated .connect( sigc::mem_fun( this, &Win_GParted::on_partition_activated ) ) ; frame_visualdisk .signal_partition_activated .connect( sigc::mem_fun( this, &Win_GParted::on_partition_activated ) ) ;
vbox_visual_disk .signal_popup_menu .connect( sigc::mem_fun( this, &Win_GParted::on_partition_popup_menu ) ); frame_visualdisk .signal_popup_menu .connect( sigc::mem_fun( this, &Win_GParted::on_partition_popup_menu ) );
vbox_main .pack_start( vbox_visual_disk, Gtk::PACK_SHRINK ) ; vbox_main .pack_start( frame_visualdisk, Gtk::PACK_SHRINK ) ;
//hpaned_main (NOTE: added to vpaned_main) //hpaned_main (NOTE: added to vpaned_main)
init_hpaned_main( ) ; init_hpaned_main( ) ;
@ -476,7 +476,7 @@ void Win_GParted::show_pulsebar( const Glib::ustring & status_message )
combo_devices .set_sensitive( false ) ; combo_devices .set_sensitive( false ) ;
menu_partition .set_sensitive( false ) ; menu_partition .set_sensitive( false ) ;
treeview_detail .set_sensitive( false ) ; treeview_detail .set_sensitive( false ) ;
vbox_visual_disk .set_sensitive( false ) ; frame_visualdisk .set_sensitive( false ) ;
//the actual 'pulsing' //the actual 'pulsing'
while ( pulse ) while ( pulse )
@ -500,7 +500,7 @@ void Win_GParted::show_pulsebar( const Glib::ustring & status_message )
combo_devices .set_sensitive( true ) ; combo_devices .set_sensitive( true ) ;
menu_partition .set_sensitive( true ) ; menu_partition .set_sensitive( true ) ;
treeview_detail .set_sensitive( true ) ; treeview_detail .set_sensitive( true ) ;
vbox_visual_disk .set_sensitive( true ) ; frame_visualdisk .set_sensitive( true ) ;
} }
void Win_GParted::Fill_Label_Device_Info( bool clear ) void Win_GParted::Fill_Label_Device_Info( bool clear )
@ -630,8 +630,8 @@ void Win_GParted::Refresh_Visual( )
} }
} }
//vbox visual //frame visualdisk
vbox_visual_disk .load_partitions( partitions, devices[ current_device ] .length ) ; frame_visualdisk .load_partitions( partitions, devices[ current_device ] .length ) ;
//treeview details //treeview details
treeview_detail .load_partitions( partitions ) ; treeview_detail .load_partitions( partitions ) ;
@ -886,12 +886,12 @@ void Win_GParted::menu_gparted_refresh_devices( )
menubar_main .items()[ 3 ] .set_sensitive( false ) ; menubar_main .items()[ 3 ] .set_sensitive( false ) ;
menubar_main .items()[ 4 ] .set_sensitive( false ) ; menubar_main .items()[ 4 ] .set_sensitive( false ) ;
toolbar_main .set_sensitive( false ) ; toolbar_main .set_sensitive( false ) ;
vbox_visual_disk .set_sensitive( false ) ; frame_visualdisk .set_sensitive( false ) ;
treeview_detail .set_sensitive( false ) ; treeview_detail .set_sensitive( false ) ;
Fill_Label_Device_Info( true ) ; Fill_Label_Device_Info( true ) ;
vbox_visual_disk .clear() ; frame_visualdisk .clear() ;
treeview_detail .clear() ; treeview_detail .clear() ;
//hmzz, this is really paranoid, but i think it's the right thing to do ;) //hmzz, this is really paranoid, but i think it's the right thing to do ;)
@ -914,7 +914,7 @@ void Win_GParted::menu_gparted_refresh_devices( )
menubar_main .items()[ 4 ] .set_sensitive( true ) ; menubar_main .items()[ 4 ] .set_sensitive( true ) ;
toolbar_main .set_sensitive( true ) ; toolbar_main .set_sensitive( true ) ;
vbox_visual_disk .set_sensitive( true ) ; frame_visualdisk .set_sensitive( true ) ;
treeview_detail .set_sensitive( true ) ; treeview_detail .set_sensitive( true ) ;
refresh_combo_devices() ; refresh_combo_devices() ;
@ -1030,7 +1030,7 @@ void Win_GParted::on_partition_selected( const Partition & partition, bool src_i
set_valid_operations() ; set_valid_operations() ;
if ( src_is_treeview ) if ( src_is_treeview )
vbox_visual_disk .set_selected( partition ) ; frame_visualdisk .set_selected( partition ) ;
else else
treeview_detail .set_selected( partition ) ; treeview_detail .set_selected( partition ) ;
} }