]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '6134b25a1b87ad94c5a082915064a33ea66b07d7' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:08:48 +0000 (06:08 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:08:48 +0000 (06:08 +0200)
radiant/build.cpp
radiant/mainframe.cpp
radiant/map.cpp
tools/quake3/q3map2/main.c

index 234367516271a9bdade050808122309d3bd5ef6b..5e71e821496cbaba0b3fe77b827e9fe49a08ffc1 100644 (file)
@@ -923,6 +923,9 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
 
                                        auto renderer = ui::CellRendererText(ui::New);
                                        object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE );
+                                       g_object_set( G_OBJECT( renderer ), "wrap-mode", PANGO_WRAP_WORD, NULL );
+                                       //g_object_set( G_OBJECT( renderer ), "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL );
+                                       object_set_int_property( G_OBJECT( renderer ), "wrap-width", 640 );
                                        renderer.connect( "edited", G_CALLBACK( commands_cell_edited ), store );
 
                                        auto column = ui::TreeViewColumn( "", renderer, {{"text", 0}} );
index 5fc764591e9fd16f02996301cb928288996c70fe..37e496a828758b119b47f4453eb6c0f38293a376 100644 (file)
@@ -3390,12 +3390,14 @@ void MainFrame::Create(){
 
        EverySecondTimer_enable();
 
-       if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ) {
+       if ( g_layout_globals.nState & GDK_WINDOW_STATE_MAXIMIZED ||
+               g_layout_globals.nState & GDK_WINDOW_STATE_ICONIFIED ) {
                gtk_window_maximize( window );
        }
        if ( g_layout_globals.nState & GDK_WINDOW_STATE_FULLSCREEN ) {
                gtk_window_fullscreen( window );
        }
+
        if ( !FloatingGroupDialog() ) {
                gtk_paned_set_position( GTK_PANED( m_vSplit ), g_layout_globals.nXYHeight );
 
index 86fd37d42c721f5664248da01bf62b4b55b3adae..40a8e537ea245be317afa1a3649cda06137ada67 100644 (file)
@@ -86,6 +86,7 @@ MapModules& ReferenceAPI_getMapModules();
 #include "autosave.h"
 #include "brushmodule.h"
 #include "brush.h"
+#include "patch.h"
 
 bool g_writeMapComments = true;
 
@@ -794,13 +795,56 @@ void Scene_EntityBreakdown( EntityBreakdown& entitymap ){
        GlobalSceneGraph().traverse( EntityBreakdownWalker( entitymap ) );
 }
 
+class CountStuffWalker : public scene::Graph::Walker
+{
+int& m_patches;
+int& m_ents_ingame;
+int& m_groupents;
+int& m_groupents_ingame;
+public:
+CountStuffWalker( int& patches, int& ents_ingame, int& groupents, int& groupents_ingame )
+       : m_patches( patches ), m_ents_ingame( ents_ingame ), m_groupents( groupents ), m_groupents_ingame( groupents_ingame ){
+}
+bool pre( const scene::Path& path, scene::Instance& instance ) const {
+       Patch* patch = Node_getPatch( path.top() );
+       if( patch != 0 ){
+               ++m_patches;
+       }
+       Entity* entity = Node_getEntity( path.top() );
+       if ( entity != 0 ){
+               if( entity->isContainer() ){
+                       ++m_groupents;
+                       if( !string_equal_nocase( "func_group", entity->getKeyValue( "classname" ) ) &&
+                               !string_equal_nocase( "_decal", entity->getKeyValue( "classname" ) ) ){
+                               ++m_groupents_ingame;
+                               ++m_ents_ingame;
+                       }
+                       return true;
+               }
+               if( !string_equal_nocase_n( "light", entity->getKeyValue( "classname" ), 5 ) &&
+                       !string_equal_nocase( "misc_model", entity->getKeyValue( "classname" ) ) ){
+                       ++m_ents_ingame;
+               }
+       }
+       return true;
+}
+};
+
+void Scene_CountStuff( int& patches, int& ents_ingame, int& groupents, int& groupents_ingame ){
+       GlobalSceneGraph().traverse( CountStuffWalker( patches, ents_ingame, groupents, groupents_ingame ) );
+}
 
 WindowPosition g_posMapInfoWnd( c_default_window_pos );
 
 void DoMapInfo(){
        ModalDialog dialog;
-       ui::Entry brushes_entry{ui::null};
-       ui::Entry entities_entry{ui::null};
+       ui::Widget w_brushes{ui::null};
+       ui::Widget w_patches{ui::null};
+       ui::Widget w_ents{ui::null};
+       ui::Widget w_ents_ingame{ui::null};
+       ui::Widget w_groupents{ui::null};
+       ui::Widget w_groupents_ingame{ui::null};
+
        ui::ListStore EntityBreakdownWalker{ui::null};
 
        ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog );
@@ -813,40 +857,90 @@ void DoMapInfo(){
 
                {
                        auto hbox = create_dialog_hbox( 4 );
-                       vbox.pack_start( hbox, FALSE, TRUE, 0 );
+                       vbox.pack_start( hbox, FALSE, FALSE, 0 );
 
                        {
-                               auto table = create_dialog_table( 2, 2, 4, 4 );
+                               auto table = create_dialog_table( 3, 4, 4, 4 );
                                hbox.pack_start( table, TRUE, TRUE, 0 );
 
                                {
-                                       auto entry = ui::Entry(ui::New);
-                                       entry.show();
-                    table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
-                                       gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE );
-
-                                       brushes_entry = entry;
+                                       auto label = ui::Label( "Total Brushes:" );
+                                       label.show();
+                    table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
                                }
                                {
-                                       auto entry = ui::Entry(ui::New);
-                                       entry.show();
-                    table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
-                                       gtk_editable_set_editable( GTK_EDITABLE(entry), FALSE );
-
-                                       entities_entry = entry;
+                                       auto label = ui::Label( "" );
+                                       label.show();
+                    table.attach(label, {1, 2, 0, 1}, {GTK_FILL | GTK_EXPAND, 0}, {3, 0});
+                                       w_brushes = label;
                                }
                                {
-                                       ui::Widget label = ui::Label( "Total Brushes" );
+                                       auto label = ui::Label( "Total Patches" );
                                        label.show();
-                    table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
+                    table.attach(label, {2, 3, 0, 1}, {GTK_FILL, 0});
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                }
                                {
-                                       ui::Widget label = ui::Label( "Total Entities" );
+                                       auto label = ui::Label( "" );
                                        label.show();
-                    table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0});
+                    table.attach(label, {3, 4, 0, 1}, {GTK_FILL, 0}, {3, 0});
                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
+                                       w_patches = label;
+                               }
+                               {
+                                       auto label = ui::Label( "Total Entities:" );
+                                       label.show();
+                                       table.attach(label, {0, 1, 1, 2}, {GTK_FILL, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                               }
+                               {
+                                       auto label = ui::Label( "" );
+                                       label.show();
+                                       table.attach(label, {1, 2, 1, 2}, {GTK_FILL | GTK_EXPAND, 0}, {3, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                                       w_ents = label;
                                }
+                               {
+                                       auto label = ui::Label( "Ingame Entities:" );
+                                       label.show();
+                                       table.attach(label, {2, 3, 1, 2}, {GTK_FILL, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                               }
+                               {
+                                       auto label = ui::Label( "" );
+                                       label.show();
+                                       table.attach(label, {3, 4, 1, 2}, {GTK_FILL | GTK_EXPAND, 0 }, {3, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                                       w_ents_ingame = label;
+                               }
+                               {
+                                       auto label = ui::Label( "Group Entities:" );
+                                       label.show();
+                                       table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                               }
+                               {
+                                       auto label = ui::Label( "" );
+                                       label.show();
+                                       table.attach(label, {1, 2, 2, 3}, {GTK_FILL | GTK_EXPAND, 0}, {3, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                                       w_groupents = label;
+                               }
+                               {
+                                       auto label = ui::Label( "Ingame Group Entities:" );
+                                       label.show();
+                                       table.attach(label, {2, 3, 2, 3}, {GTK_FILL, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                               }
+                               {
+                                       auto label = ui::Label( "" );
+                                       label.show();
+                                       table.attach(label, {3, 4, 2, 3}, {GTK_FILL | GTK_EXPAND, 0}, {3, 0});
+                                       gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
+                                       w_groupents_ingame = label;
+                               }
+
                        }
                        {
                                auto vbox2 = create_dialog_vbox( 4 );
@@ -859,7 +953,7 @@ void DoMapInfo(){
                        }
                }
                {
-                       ui::Widget label = ui::Label( "Entity breakdown" );
+                       ui::Widget label = ui::Label( "*** Entity breakdown ***" );
                        label.show();
                        vbox.pack_start( label, FALSE, TRUE, 0 );
                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
@@ -869,7 +963,7 @@ void DoMapInfo(){
                        vbox.pack_start( scr, TRUE, TRUE, 0 );
 
                        {
-                               auto store = ui::ListStore::from(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ));
+                               auto store = ui::ListStore::from(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_UINT ));
 
                                auto view = ui::TreeView(ui::TreeModel::from(store._handle));
                                gtk_tree_view_set_headers_clickable(view, TRUE );
@@ -913,11 +1007,39 @@ void DoMapInfo(){
 
        EntityBreakdownWalker.unref();
 
-       char tmp[16];
-       sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
-       brushes_entry.text(tmp);
-       sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) );
-       entities_entry.text(tmp);
+       int n_patches = 0;
+       int n_ents_ingame = 0;
+       int n_groupents = 0;
+       int n_groupents_ingame = 0;
+       Scene_CountStuff( n_patches, n_ents_ingame, n_groupents, n_groupents_ingame );
+       //globalOutputStream() << n_patches << n_ents_ingame << n_groupents << n_groupents_ingame << "\n";
+
+       char *markup;
+
+       markup = g_markup_printf_escaped( "<span style=\"italic\"><b>%u</b></span>  ", Unsigned( g_brushCount.get() ) );
+       gtk_label_set_markup( GTK_LABEL( w_brushes ), markup );
+       g_free( markup );
+
+       markup = g_markup_printf_escaped( "<span style=\"italic\"><b>%i</b></span>  ", n_patches );
+       gtk_label_set_markup( GTK_LABEL( w_patches ), markup );
+       g_free( markup );
+
+       markup = g_markup_printf_escaped( "<span style=\"italic\"><b>%u</b></span>  ", Unsigned( g_entityCount.get() ) );
+       gtk_label_set_markup( GTK_LABEL( w_ents ), markup );
+       g_free( markup );
+
+       markup = g_markup_printf_escaped( "<span style=\"italic\"><b>%i</b></span>  ", n_ents_ingame );
+       gtk_label_set_markup( GTK_LABEL( w_ents_ingame ), markup );
+       g_free( markup );
+
+       markup = g_markup_printf_escaped( "<span style=\"italic\"><b>%i</b></span>  ", n_groupents );
+       gtk_label_set_markup( GTK_LABEL( w_groupents ), markup );
+       g_free( markup );
+
+       markup = g_markup_printf_escaped( "<span style=\"italic\"><b>%i</b></span>  ", n_groupents_ingame );
+       gtk_label_set_markup( GTK_LABEL( w_groupents_ingame ), markup );
+       g_free( markup );
+
 
        modal_dialog_show( window, dialog );
 
index 3b87ee9f4b0c3a11b052e40ddbe92b48f9836968..557cf5d65dacdd15e1a5542c7c46a0374551fbe3 100644 (file)
@@ -2084,6 +2084,9 @@ int main( int argc, char **argv ){
        double start, end;
        extern qboolean werror;
 
+#ifdef WIN32
+       _setmaxstdio(2048);
+#endif
 
        /* we want consistent 'randomness' */
        srand( 0 );