From 367e13e880e09d6161ca7dc4062efcb0c2b2ca2a Mon Sep 17 00:00:00 2001 From: Garux Date: Sat, 9 Jun 2018 22:04:23 +0300 Subject: [PATCH] * map objects counts statusbar icons * omit textures/ prefix in texture clipboard status --- radiant/mainframe.cpp | 59 +++++++++++++++------- radiant/mainframe.h | 8 +-- radiant/qe3.cpp | 17 ++++--- radiant/texwindow.cpp | 2 +- setup/data/tools/bitmaps/status_brush.png | Bin 0 -> 237 bytes setup/data/tools/bitmaps/status_entiy.png | Bin 0 -> 422 bytes 6 files changed, 55 insertions(+), 31 deletions(-) create mode 100644 setup/data/tools/bitmaps/status_brush.png create mode 100644 setup/data/tools/bitmaps/status_entiy.png diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 3d6ac88a..98778508 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -2556,16 +2556,21 @@ GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){ 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] ){ GtkTable* table = GTK_TABLE( gtk_table_new( 1, c_status__count, FALSE ) ); 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_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 ); pStatusLabel[c_status_command] = GTK_WIDGET( label ); } @@ -2574,23 +2579,39 @@ GtkWidget* create_main_statusbar( GtkWidget *pStatusLabel[c_status__count] ){ { GtkFrame* frame = GTK_FRAME( gtk_frame_new( 0 ) ); 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 ); - - 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 " ); - - GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) ); - if( i == c_status_texture ) - gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_START ); + 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_label_set_ellipsize( label, PANGO_ELLIPSIZE_END ); + gtk_table_attach_defaults( table, GTK_WIDGET( frame ), i, i + 1, 0, 1 ); - 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 ) ); - pStatusLabel[i] = GTK_WIDGET( label ); + 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 ) + gtk_widget_set_tooltip_text( GTK_WIDGET( frame ), "G: Grid size\nF: map Format\nC: camera Clip scale\nL: texture Lock " ); + else + gtk_label_set_ellipsize( label, i == c_status_texture? PANGO_ELLIPSIZE_START : PANGO_ELLIPSIZE_END ); + gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( label ) ); + pStatusLabel[i] = GTK_WIDGET( label ); + } } return GTK_WIDGET( table ); @@ -3336,7 +3357,7 @@ const char* ( *GridStatus_getTexdefTypeIdLabel )(); void MainFrame::SetGridStatus(){ StringOutputStream status( 64 ); - const char* lock = ( GridStatus_getTextureLockEnabled() ) ? "ON" : "OFF"; + const char* lock = ( GridStatus_getTextureLockEnabled() ) ? "ON " : "OFF "; status << ( GetSnapGridSize() > 0 ? "G:" : "g:" ) << GridStatus_getGridSize() << " F:" << GridStatus_getTexdefTypeIdLabel() << " C:" << GridStatus_getFarClipDistance() diff --git a/radiant/mainframe.h b/radiant/mainframe.h index f11bf779..2a175006 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -42,9 +42,11 @@ typedef struct _GtkWindow GtkWindow; const int c_status_command = 0; const int c_status_position = 1; const int c_status_brushcount = 2; -const int c_status_texture = 3; -const int c_status_grid = 4; -const int c_status__count = 5; +const int c_status_patchcount = 3; +const int c_status_entitycount = 4; +const int c_status_texture = 5; +const int c_status_grid = 6; +const int c_status__count = 7; class MainFrame { diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 633381e0..8831d2cc 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -124,15 +124,16 @@ SimpleCounter g_patchCount; SimpleCounter g_entityCount; void QE_brushCountChange(){ - char buffer[128]; - if( GlobalSelectionSystem().countSelected() == 0 ) - sprintf( buffer, "Brushes: %u Patches: %u Entities: %u", Unsigned( g_brushCount.get() ), Unsigned( g_patchCount.get() ), Unsigned( g_entityCount.get() ) ); - else{ - std::size_t brushes, patches, entities; - GlobalSelectionSystem().countSelectedStuff( brushes, patches, entities ); - sprintf( buffer, "Brushes: %u Patches: %u Entities: %u", Unsigned( brushes ), Unsigned( patches ), Unsigned( entities ) ); + std::size_t counts[3] = { g_brushCount.get(), g_patchCount.get(), g_entityCount.get() }; + if( GlobalSelectionSystem().countSelected() != 0 ) + GlobalSelectionSystem().countSelectedStuff( counts[0], counts[1], counts[2] ); + for ( int i = 0; i < 3; ++i ){ + char buffer[32]; + buffer[0] = '\0'; + 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() ); diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 2118901f..fc0a9a0f 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -395,7 +395,7 @@ void TextureBrowser_SetStatus( TextureBrowser& textureBrowser, const char* name IShader* shader = QERApp_Shader_ForName( name ); qtexture_t* q = shader->getTexture(); 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(); g_pParentWnd->SetStatusText( c_status_texture, strTex.c_str() ); } diff --git a/setup/data/tools/bitmaps/status_brush.png b/setup/data/tools/bitmaps/status_brush.png new file mode 100644 index 0000000000000000000000000000000000000000..b3b84c677052cf7164050b9fd3e24c4482e9efc9 GIT binary patch literal 237 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`3dtTpz6=aistgPb%?u1b{{!il z3=E|P3=FRl7#OT(FffScPl`Y422{&g;1OBOz`zESXM4$Ld_MLtP*AGGHKHUqKdq!Z zu_%=xATcwqM9KLZB*NPZ!4!3;*Ol|Nq-FyE3FOsLoJ2n{fSb z4to{z6Y)6`)3pP68rs+=IDHj6@nB*agJz>=h=S5_5jTd#-j8?-bv7E_iE+@dOy-vF bG8SfF$WPhHkQS5$G?>BD)z4*}Q$iB}wA4hf literal 0 HcmV?d00001 diff --git a/setup/data/tools/bitmaps/status_entiy.png b/setup/data/tools/bitmaps/status_entiy.png new file mode 100644 index 0000000000000000000000000000000000000000..2f084a47ae1f93a0d63ffb81b332d818bd2fba54 GIT binary patch literal 422 zcmV;X0a^ZuP)N2bPDNB8 zb~7$DE-^4L^m3s900AONL_t(IPu-F~OT$1Ihu`-uEeHiE7D4Ri5Elp6egm-z!L%Y2 z|D?Hqlaq_1Q$K{RIyvazEQk))-JzR{2x5GaL8~OGgOdjjB$wa&+K48?oc=MTsraquaNxU3SqNcvM!^X!g0}vZd%_Yu^dP&5loA;hvZRTtXHU2YkrkjkzZ{gG0E0YnTyj>q#akE>1Mo zQ^H>(mKN_**#v??Cg>Ngo(hf&4-!H6xrO}pQ^9_rz^>Xlf@j$)>AB)jQ^& Q>i_@%07*qoM6N<$f(|XK$N&HU literal 0 HcmV?d00001