* map objects counts statusbar icons

* omit textures/ prefix in texture clipboard status
This commit is contained in:
Garux 2018-06-09 22:04:23 +03:00
parent fd1e14864a
commit 367e13e880
6 changed files with 55 additions and 31 deletions

View File

@ -2556,16 +2556,21 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
return toolbar; return toolbar;
} }
GtkLabel* create_main_statusbar_label(){
GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
return label;
}
GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_status__count] ){ GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_status__count] ){
GtkTable* table = GTK_TABLE( gtk_table_new( 1, c_status__count, FALSE ) ); GtkTable* table = GTK_TABLE( gtk_table_new( 1, c_status__count, FALSE ) );
gtk_widget_show( GTK_WIDGET( table ) ); gtk_widget_show( GTK_WIDGET( table ) );
{ {
GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) ); GtkLabel* label = create_main_statusbar_label();
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END ); gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_table_attach_defaults( table, GTK_WIDGET( label ), 0, 1, 0, 1 ); gtk_table_attach_defaults( table, GTK_WIDGET( label ), 0, 1, 0, 1 );
pStatusLabel[c_status_command] = GTK_WIDGET( label ); pStatusLabel[c_status_command] = GTK_WIDGET( label );
} }
@ -2574,24 +2579,40 @@ GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_status__count] ){
{ {
GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) ); GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) );
gtk_widget_show( GTK_WIDGET( frame ) ); gtk_widget_show( GTK_WIDGET( frame ) );
gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 );
gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN ); gtk_frame_set_shadow_type( frame, GTK_SHADOW_IN );
if( i == c_status_grid || i == c_status_brushcount )
gtk_table_attach( table, GTK_WIDGET( frame ), i, i + 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0 );
else
gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 );
if( i == c_status_brushcount ){
GtkWidget* hbox = gtk_hbox_new( FALSE, 0 );
gtk_container_add( GTK_CONTAINER( frame ), hbox );
gtk_widget_show( hbox );
const char* imgs[3] = { "status_brush.png", "patch_wireframe.png", "status_entiy.png" };
for( ; i < c_status_brushcount + 3; ++i ){
GtkImage* image = new_local_image( imgs[i - c_status_brushcount] );
gtk_widget_show( GTK_WIDGET( image ) );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( image ), FALSE, FALSE, 0 );
GtkLabel* label = create_main_statusbar_label();
gtk_label_set_width_chars( label, 5 );
gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, TRUE, 0 );
pStatusLabel[i] = GTK_WIDGET( label );
}
--i;
}
else{
GtkLabel* label = create_main_statusbar_label();
if( i == c_status_grid ) if( i == c_status_grid )
gtk_widget_set_tooltip_text( GTK_WIDGET( frame ), "G: Grid size\nF: map Format\nC: camera Clip scale\nL: texture Lock " ); gtk_widget_set_tooltip_text( GTK_WIDGET( frame ), "G: Grid size\nF: map Format\nC: camera Clip scale\nL: texture Lock " );
GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
if( i == c_status_texture )
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_START );
else else
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END ); gtk_label_set_ellipsize( label, i == c_status_texture? PANGO_ELLIPSIZE_START : PANGO_ELLIPSIZE_END );
gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
gtk_misc_set_padding( GTK_MISC( label ), 4, 2 );
gtk_widget_show( GTK_WIDGET( label ) );
gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) ); gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) );
pStatusLabel[i] = GTK_WIDGET( label ); pStatusLabel[i] = GTK_WIDGET( label );
} }
}
return GTK_WIDGET( table ); return GTK_WIDGET( table );
} }

View File

@ -42,9 +42,11 @@ typedef struct _GtkWindow GtkWindow;
const int c_status_command = 0; const int c_status_command = 0;
const int c_status_position = 1; const int c_status_position = 1;
const int c_status_brushcount = 2; const int c_status_brushcount = 2;
const int c_status_texture = 3; const int c_status_patchcount = 3;
const int c_status_grid = 4; const int c_status_entitycount = 4;
const int c_status__count = 5; const int c_status_texture = 5;
const int c_status_grid = 6;
const int c_status__count = 7;
class MainFrame class MainFrame
{ {

View File

@ -124,15 +124,16 @@ SimpleCounter g_patchCount;
SimpleCounter g_entityCount; SimpleCounter g_entityCount;
void QE_brushCountChange(){ void QE_brushCountChange(){
char buffer[128]; std::size_t counts[3] = { g_brushCount.get(), g_patchCount.get(), g_entityCount.get() };
if( GlobalSelectionSystem().countSelected() == 0 ) if( GlobalSelectionSystem().countSelected() != 0 )
sprintf( buffer, "Brushes: %u Patches: %u Entities: %u", Unsigned( g_brushCount.get() ), Unsigned( g_patchCount.get() ), Unsigned( g_entityCount.get() ) ); GlobalSelectionSystem().countSelectedStuff( counts[0], counts[1], counts[2] );
else{ for ( int i = 0; i < 3; ++i ){
std::size_t brushes, patches, entities; char buffer[32];
GlobalSelectionSystem().countSelectedStuff( brushes, patches, entities ); buffer[0] = '\0';
sprintf( buffer, "Brushes: %u Patches: %u Entities: %u", Unsigned( brushes ), Unsigned( patches ), Unsigned( entities ) ); if( counts[i] != 0 )
sprintf( buffer, "%zu", counts[i] );
g_pParentWnd->SetStatusText( c_status_brushcount + i, buffer );
} }
g_pParentWnd->SetStatusText( c_status_brushcount, buffer );
} }
IdleDraw g_idle_scene_counts_update = IdleDraw( FreeCaller<QE_brushCountChange>() ); IdleDraw g_idle_scene_counts_update = IdleDraw( FreeCaller<QE_brushCountChange>() );

View File

@ -395,7 +395,7 @@ void TextureBrowser_SetStatus( TextureBrowser& textureBrowser, const char* name
IShader* shader = QERApp_Shader_ForName( name ); IShader* shader = QERApp_Shader_ForName( name );
qtexture_t* q = shader->getTexture(); qtexture_t* q = shader->getTexture();
StringOutputStream strTex( 256 ); StringOutputStream strTex( 256 );
strTex << name << " W: " << Unsigned( q->width ) << " H: " << Unsigned( q->height ); strTex << ( string_equal_prefix_nocase( name, "textures/" )? name + 9 : name ) << " W: " << Unsigned( q->width ) << " H: " << Unsigned( q->height );
shader->DecRef(); shader->DecRef();
g_pParentWnd->SetStatusText( c_status_texture, strTex.c_str() ); g_pParentWnd->SetStatusText( c_status_texture, strTex.c_str() );
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B