]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '804c20949d43175179489ecbb1305752cfa17217' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 26 May 2020 15:26:39 +0000 (17:26 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 26 May 2020 15:26:39 +0000 (17:26 +0200)
radiant/build.cpp
radiant/mainframe.cpp
radiant/map.cpp
tools/quake3/q3map2/main.c

index 3a524a76465f7fa727d966f19eab7f445b7a820f..ffee739fd4fcb586cb32e8274c55403f7701c86e 100644 (file)
@@ -892,6 +892,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 784e9c4552f389891c144e9a1f9d201c89193f8c..894a82e327ecfef9e1b154d931a12aefcee133ec 100644 (file)
@@ -3254,12 +3254,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 b545c32be11581aa945abfa88ffaa66dfca3adc5..fa19512d7f29680c2ec02ed4de455e203af7e14c 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 139a242a0ca5fafde3bec1f9aa298b009c04e352..4e1cd3e88f25708409a09d1a7666516eed1acc5f 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 );