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>
* 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.
*/
#ifndef VBOX_VISUALDISK
#define VBOX_VISUALDISK
#ifndef FRAME_VISUALDISK
#define FRAME_VISUALDISK
#include "../include/Partition.h"
#include <gtkmm/box.h>
#include <gtkmm/frame.h>
#include <gtkmm/drawingarea.h>
@ -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<Partition> & partitions, Sector device_length );
void set_selected( const Partition & partition ) ;
@ -55,10 +54,6 @@ private:
void calc_used_unused( 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 ) ;
bool set_selected( std::vector<visual_partition> & 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<Gdk::GC> gc;
Gdk::Color color_used, color_unused, color_text;
};
} //GParted
#endif //VBOX_VISUALDISK
#endif //FRAME_VISUALDISK

View File

@ -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\

View File

@ -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

View File

@ -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

View File

@ -15,9 +15,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "../include/VBox_VisualDisk.h"
#include <gtkmm/image.h>
#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<Partition> & partitions, Sector device_length )
void FrameVisualDisk::load_partitions( const std::vector<Partition> & partitions, Sector device_length )
{
clear() ;
@ -67,27 +59,24 @@ void VBox_VisualDisk::load_partitions( const std::vector<Partition> & 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<Partition> & partitions )
int FrameVisualDisk::get_total_separator_px( const std::vector<Partition> & 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<Partition> & part
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 ;
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 ;
@ -149,7 +138,7 @@ int VBox_VisualDisk::calc_length( std::vector<visual_partition> & visual_partiti
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++ )
{
@ -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++ )
{
@ -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 ;
@ -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 )
{
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 )
void FrameVisualDisk::draw_partitions( const std::vector<visual_partition> & visual_partitions )
{
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 ;
@ -376,7 +306,7 @@ bool VBox_VisualDisk::set_selected( std::vector<visual_partition> & visual_parti
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++ )
{
@ -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() );
//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<int>( event ->x ), static_cast<int>( 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_partition> & visual_partitions )
void FrameVisualDisk::free_colors( std::vector<visual_partition> & visual_partitions )
{
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() ;

View File

@ -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\

View File

@ -68,11 +68,11 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & 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 ) ;
}