Skip to content

Commit

Permalink
* map objects counts statusbar icons
Browse files Browse the repository at this point in the history
	* omit textures/ prefix in texture clipboard status
  • Loading branch information
Garux committed Jun 9, 2018
1 parent fd1e148 commit 367e13e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 30 deletions.
57 changes: 39 additions & 18 deletions radiant/mainframe.cpp
Expand Up @@ -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 );
}
Expand All @@ -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 || 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_grid )
gtk_widget_set_tooltip_text( GTK_WIDGET( frame ), "G: Grid size\nF: map Format\nC: camera Clip scale\nL: texture Lock " );
if( i == c_status_brushcount ){
GtkWidget* hbox = gtk_hbox_new( FALSE, 0 );
gtk_container_add( GTK_CONTAINER( frame ), hbox );
gtk_widget_show( hbox );

GtkLabel* label = GTK_LABEL( gtk_label_new( "Label" ) );
if( i == c_status_texture )
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_START );
else
gtk_label_set_ellipsize( label, PANGO_ELLIPSIZE_END );
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 );

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 );
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 );
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 5 additions & 3 deletions radiant/mainframe.h
Expand Up @@ -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
{
Expand Down
17 changes: 9 additions & 8 deletions radiant/qe3.cpp
Expand Up @@ -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<QE_brushCountChange>() );
Expand Down
2 changes: 1 addition & 1 deletion radiant/texwindow.cpp
Expand Up @@ -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() );
}
Expand Down
Binary file added setup/data/tools/bitmaps/status_brush.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added setup/data/tools/bitmaps/status_entiy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 367e13e

Please sign in to comment.