From 49b31334cf22e6ce4c351417fca80fef37a0e1d8 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Fri, 10 Feb 2006 23:47:02 +0000 Subject: [PATCH] removed legend after discussion with usability guys * removed legend after discussion with usability guys --- ChangeLog | 4 + .../{VBox_VisualDisk.h => FrameVisualDisk.h} | 19 +-- include/Makefile.am | 2 +- include/Win_GParted.h | 4 +- po/POTFILES.in | 1 - ...{VBox_VisualDisk.cc => FrameVisualDisk.cc} | 124 ++++-------------- src/Makefile.am | 2 +- src/Win_GParted.cc | 26 ++-- 8 files changed, 54 insertions(+), 128 deletions(-) rename include/{VBox_VisualDisk.h => FrameVisualDisk.h} (88%) rename src/{VBox_VisualDisk.cc => FrameVisualDisk.cc} (76%) diff --git a/ChangeLog b/ChangeLog index 690bfa0f..fff4673e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-02-11 Bart Hakvoort + + * removed legend after discussion with usability guys + 2006-02-10 Bart Hakvoort * src/TreeView_Detail.cc: finally fixed #169683!! ( party, party! :p ) diff --git a/include/VBox_VisualDisk.h b/include/FrameVisualDisk.h similarity index 88% rename from include/VBox_VisualDisk.h rename to include/FrameVisualDisk.h index af4ad7bd..14072de2 100644 --- a/include/VBox_VisualDisk.h +++ b/include/FrameVisualDisk.h @@ -15,12 +15,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef VBOX_VISUALDISK -#define VBOX_VISUALDISK +#ifndef FRAME_VISUALDISK +#define FRAME_VISUALDISK #include "../include/Partition.h" -#include #include #include @@ -28,11 +27,11 @@ namespace GParted { -class VBox_VisualDisk : public Gtk::VBox +class FrameVisualDisk : public Gtk::Frame { public: - VBox_VisualDisk(); - ~VBox_VisualDisk(); + FrameVisualDisk(); + ~FrameVisualDisk(); void load_partitions( const std::vector & partitions, Sector device_length ); void set_selected( const Partition & partition ) ; @@ -55,10 +54,6 @@ private: void calc_used_unused( std::vector & visual_partitions ) ; void calc_text( std::vector & visual_partitions ) ; - void build_legend( const std::vector & partitions ) ; - void prepare_legend( const std::vector & partitions, std::vector & legend) ; - Gtk::HBox * create_legend_item( GParted::FILESYSTEM fs ) ; - void draw_partitions( const std::vector & visual_partitions ) ; bool set_selected( std::vector & visual_partitions, int x, int y ) ; @@ -122,12 +117,10 @@ private: visual_partition selected_vp ; int TOT_SEP, MIN_SIZE ; - Gtk::Frame *frame ; Gtk::DrawingArea drawingarea; - Gtk::HBox hbox_legend ; Glib::RefPtr gc; Gdk::Color color_used, color_unused, color_text; }; } //GParted -#endif //VBOX_VISUALDISK +#endif //FRAME_VISUALDISK diff --git a/include/Makefile.am b/include/Makefile.am index 01bbaaf4..a9e30a75 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = \ Frame_Resizer_Base.h\ i18n.h\ Partition.h \ - VBox_VisualDisk.h \ + FrameVisualDisk.h \ Dialog_Partition_Info.h\ ext3.h \ Frame_Resizer_Extended.h\ diff --git a/include/Win_GParted.h b/include/Win_GParted.h index 502486b2..49e5af73 100644 --- a/include/Win_GParted.h +++ b/include/Win_GParted.h @@ -19,7 +19,7 @@ #define WIN_GPARTED #include "../include/Device.h" -#include "../include/VBox_VisualDisk.h" +#include "../include/FrameVisualDisk.h" #include "../include/Partition.h" #include "../include/TreeView_Detail.h" #include "../include/Operation.h" @@ -179,7 +179,7 @@ private: Gtk::ProgressBar pulsebar ; Gtk::TreeRow treerow; - VBox_VisualDisk vbox_visual_disk; + FrameVisualDisk frame_visualdisk; TreeView_Detail treeview_detail; //device combo diff --git a/po/POTFILES.in b/po/POTFILES.in index 63d53c7f..2b79b755 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,7 +14,6 @@ src/Operation.cc src/Partition.cc src/TreeView_Detail.cc src/Utils.cc -src/VBox_VisualDisk.cc src/Win_GParted.cc src/ext2.cc src/ext3.cc diff --git a/src/VBox_VisualDisk.cc b/src/FrameVisualDisk.cc similarity index 76% rename from src/VBox_VisualDisk.cc rename to src/FrameVisualDisk.cc index eef0fa8f..2079f58b 100644 --- a/src/VBox_VisualDisk.cc +++ b/src/FrameVisualDisk.cc @@ -15,9 +15,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "../include/VBox_VisualDisk.h" - -#include +#include "../include/FrameVisualDisk.h" #define BORDER 8 #define SEP 5 @@ -26,10 +24,10 @@ namespace GParted { -VBox_VisualDisk::VBox_VisualDisk() +FrameVisualDisk::FrameVisualDisk() { - this ->set_border_width( 10 ); - this ->set_spacing( 5 ); + this ->set_border_width( 5 ) ; + this ->set_shadow_type( Gtk::SHADOW_ETCHED_OUT ) ; //set and allocated some standard colors color_used .set( Utils::Get_Color( GParted::FS_USED ) ); @@ -44,22 +42,16 @@ VBox_VisualDisk::VBox_VisualDisk() //prepare drawingarea and frame and pack them drawingarea .set_events( Gdk::BUTTON_PRESS_MASK ); - drawingarea .signal_realize() .connect( sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_realize) ) ; - drawingarea .signal_expose_event() .connect( sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose) ) ; - drawingarea .signal_button_press_event() .connect( sigc::mem_fun( *this, &VBox_VisualDisk::on_drawingarea_button_press) ) ; + drawingarea .signal_realize() .connect( sigc::mem_fun(*this, &FrameVisualDisk::drawingarea_on_realize) ) ; + drawingarea .signal_expose_event() .connect( sigc::mem_fun(*this, &FrameVisualDisk::drawingarea_on_expose) ) ; + drawingarea .signal_button_press_event() .connect( sigc::mem_fun( *this, &FrameVisualDisk::on_drawingarea_button_press) ) ; drawingarea .set_size_request( -1, HEIGHT ) ; - frame = manage( new Gtk::Frame() ) ; - 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 ); + this ->add( drawingarea ) ; } -void VBox_VisualDisk::load_partitions( const std::vector & partitions, Sector device_length ) +void FrameVisualDisk::load_partitions( const std::vector & partitions, Sector device_length ) { clear() ; @@ -67,27 +59,24 @@ void VBox_VisualDisk::load_partitions( const std::vector & partitions set_static_data( partitions, visual_partitions, device_length ) ; 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 ) ; draw_partitions( visual_partitions ) ; } -void VBox_VisualDisk::clear() +void FrameVisualDisk::clear() { free_colors( visual_partitions ) ; visual_partitions .clear() ; - hbox_legend .children() .clear() ; drawingarea .queue_resize() ; } -int VBox_VisualDisk::get_total_separator_px( const std::vector & partitions ) +int FrameVisualDisk::get_total_separator_px( const std::vector & partitions ) { for ( unsigned int t = 0 ; t < partitions .size() ; t++ ) if ( partitions[ t ] .type == GParted::TYPE_EXTENDED ) @@ -97,7 +86,7 @@ int VBox_VisualDisk::get_total_separator_px( const std::vector & part return ( partitions .size() -1 ) * SEP ; } -void VBox_VisualDisk::set_static_data( const std::vector & partitions, std::vector & visual_partitions, Sector length ) +void FrameVisualDisk::set_static_data( const std::vector & partitions, std::vector & visual_partitions, Sector length ) { Sector p_length ; visual_partition vp ; @@ -129,7 +118,7 @@ void VBox_VisualDisk::set_static_data( const std::vector & partitions } } -int VBox_VisualDisk::calc_length( std::vector & visual_partitions, int length_px ) +int FrameVisualDisk::calc_length( std::vector & visual_partitions, int length_px ) { int calced_length = 0 ; @@ -149,7 +138,7 @@ int VBox_VisualDisk::calc_length( std::vector & visual_partiti return calced_length + (visual_partitions .size() - 1) * SEP ; } -void VBox_VisualDisk::calc_position_and_height( std::vector & visual_partitions, int start, int border ) +void FrameVisualDisk::calc_position_and_height( std::vector & visual_partitions, int start, int border ) { for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) { @@ -166,7 +155,7 @@ void VBox_VisualDisk::calc_position_and_height( std::vector & } } -void VBox_VisualDisk::calc_used_unused( std::vector & visual_partitions ) +void FrameVisualDisk::calc_used_unused( std::vector & visual_partitions ) { for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) { @@ -194,7 +183,7 @@ void VBox_VisualDisk::calc_used_unused( std::vector & visual_p } } -void VBox_VisualDisk::calc_text( std::vector & visual_partitions ) +void FrameVisualDisk::calc_text( std::vector & visual_partitions ) { int length, height ; @@ -221,66 +210,7 @@ void VBox_VisualDisk::calc_text( std::vector & visual_partitio } } -void VBox_VisualDisk::build_legend( const std::vector & partitions ) -{ - std::vector 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 & partitions, std::vector & 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_partitions ) +void FrameVisualDisk::draw_partitions( const std::vector & visual_partitions ) { for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) { @@ -353,7 +283,7 @@ void VBox_VisualDisk::draw_partitions( const std::vector & vis } } -bool VBox_VisualDisk::set_selected( std::vector & visual_partitions, int x, int y ) +bool FrameVisualDisk::set_selected( std::vector & visual_partitions, int x, int y ) { bool found = false ; @@ -376,7 +306,7 @@ bool VBox_VisualDisk::set_selected( std::vector & visual_parti return found ; } -void VBox_VisualDisk::set_selected( std::vector & visual_partitions, const Partition & partition ) +void FrameVisualDisk::set_selected( std::vector & visual_partitions, const Partition & partition ) { for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) { @@ -393,22 +323,22 @@ void VBox_VisualDisk::set_selected( std::vector & visual_parti } } -void VBox_VisualDisk::drawingarea_on_realize() +void FrameVisualDisk::drawingarea_on_realize() { gc = Gdk::GC::create( drawingarea .get_window() ); //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 ) ; 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( event ->x ), static_cast( event ->y ) ) ; draw_partitions( visual_partitions ) ; @@ -423,7 +353,7 @@ bool VBox_VisualDisk::on_drawingarea_button_press( GdkEventButton * event ) return true ; } -void VBox_VisualDisk::on_resize( Gtk::Allocation & allocation ) +void FrameVisualDisk::on_resize( Gtk::Allocation & allocation ) { MIN_SIZE = 20 ; @@ -452,7 +382,7 @@ void VBox_VisualDisk::on_resize( Gtk::Allocation & allocation ) calc_text( visual_partitions ) ; } -void VBox_VisualDisk::free_colors( std::vector & visual_partitions ) +void FrameVisualDisk::free_colors( std::vector & visual_partitions ) { for ( unsigned int t = 0 ; t < visual_partitions .size() ; t++ ) { @@ -463,7 +393,7 @@ void VBox_VisualDisk::free_colors( std::vector & visual_partit } } -VBox_VisualDisk::~VBox_VisualDisk() +FrameVisualDisk::~FrameVisualDisk() { clear() ; diff --git a/src/Makefile.am b/src/Makefile.am index 1d36f956..02fe0679 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,7 +27,7 @@ gparted_SOURCES = \ Partition.cc\ TreeView_Detail.cc\ Utils.cc\ - VBox_VisualDisk.cc\ + FrameVisualDisk.cc\ Win_GParted.cc\ ext2.cc\ ext3.cc\ diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 44b3e593..7ba80599 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -68,11 +68,11 @@ Win_GParted::Win_GParted( const std::vector & user_devices ) init_toolbar( ) ; vbox_main.pack_start( hbox_toolbar, Gtk::PACK_SHRINK ); - //vbox_visual_disk... ( contains the visual represenation of the disks ) - vbox_visual_disk .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 ) ) ; - vbox_visual_disk .signal_popup_menu .connect( sigc::mem_fun( this, &Win_GParted::on_partition_popup_menu ) ); - vbox_main .pack_start( vbox_visual_disk, Gtk::PACK_SHRINK ) ; + //frame_visualdisk... ( contains the visual represenation of the disks ) + frame_visualdisk .signal_partition_selected .connect( sigc::mem_fun( this, &Win_GParted::on_partition_selected ) ) ; + frame_visualdisk .signal_partition_activated .connect( sigc::mem_fun( this, &Win_GParted::on_partition_activated ) ) ; + frame_visualdisk .signal_popup_menu .connect( sigc::mem_fun( this, &Win_GParted::on_partition_popup_menu ) ); + vbox_main .pack_start( frame_visualdisk, Gtk::PACK_SHRINK ) ; //hpaned_main (NOTE: added to vpaned_main) init_hpaned_main( ) ; @@ -476,7 +476,7 @@ void Win_GParted::show_pulsebar( const Glib::ustring & status_message ) combo_devices .set_sensitive( false ) ; menu_partition .set_sensitive( false ) ; treeview_detail .set_sensitive( false ) ; - vbox_visual_disk .set_sensitive( false ) ; + frame_visualdisk .set_sensitive( false ) ; //the actual 'pulsing' while ( pulse ) @@ -500,7 +500,7 @@ void Win_GParted::show_pulsebar( const Glib::ustring & status_message ) combo_devices .set_sensitive( true ) ; menu_partition .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 ) @@ -630,8 +630,8 @@ void Win_GParted::Refresh_Visual( ) } } - //vbox visual - vbox_visual_disk .load_partitions( partitions, devices[ current_device ] .length ) ; + //frame visualdisk + frame_visualdisk .load_partitions( partitions, devices[ current_device ] .length ) ; //treeview details 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()[ 4 ] .set_sensitive( false ) ; toolbar_main .set_sensitive( false ) ; - vbox_visual_disk .set_sensitive( false ) ; + frame_visualdisk .set_sensitive( false ) ; treeview_detail .set_sensitive( false ) ; Fill_Label_Device_Info( true ) ; - vbox_visual_disk .clear() ; + frame_visualdisk .clear() ; treeview_detail .clear() ; //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 ) ; toolbar_main .set_sensitive( true ) ; - vbox_visual_disk .set_sensitive( true ) ; + frame_visualdisk .set_sensitive( true ) ; treeview_detail .set_sensitive( true ) ; refresh_combo_devices() ; @@ -1030,7 +1030,7 @@ void Win_GParted::on_partition_selected( const Partition & partition, bool src_i set_valid_operations() ; if ( src_is_treeview ) - vbox_visual_disk .set_selected( partition ) ; + frame_visualdisk .set_selected( partition ) ; else treeview_detail .set_selected( partition ) ; }