-
-WindowPosition g_posMapInfoWnd(c_default_window_pos);
-
-void DoMapInfo()
-{
- ModalDialog dialog;
- GtkEntry* brushes_entry;
- GtkEntry* entities_entry;
- GtkListStore* EntityBreakdownWalker;
-
- GtkWindow* window = create_dialog_window(MainFrame_getWindow(), "Map Info", G_CALLBACK(dialog_delete_callback), &dialog);
-
- window_set_position(window, g_posMapInfoWnd);
-
- {
- GtkVBox* vbox = create_dialog_vbox(4, 4);
- gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox));
-
- {
- GtkHBox* hbox = create_dialog_hbox(4);
- gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, TRUE, 0);
-
- {
- GtkTable* table = create_dialog_table(2, 2, 4, 4);
- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(table), TRUE, TRUE, 0);
-
- {
- GtkEntry* entry = GTK_ENTRY(gtk_entry_new());
- gtk_widget_show(GTK_WIDGET(entry));
- gtk_table_attach(table, GTK_WIDGET(entry), 1, 2, 0, 1,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_entry_set_editable(entry, FALSE);
-
- brushes_entry = entry;
- }
- {
- GtkEntry* entry = GTK_ENTRY(gtk_entry_new());
- gtk_widget_show(GTK_WIDGET(entry));
- gtk_table_attach(table, GTK_WIDGET(entry), 1, 2, 1, 2,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_entry_set_editable(entry, FALSE);
-
- entities_entry = entry;
- }
- {
- GtkWidget* label = gtk_label_new ("Total Brushes");
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- }
- {
- GtkWidget* label = gtk_label_new ("Total Entities");
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- }
- }
- {
- GtkVBox* vbox2 = create_dialog_vbox(4);
- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(vbox2), FALSE, FALSE, 0);
-
- {
- GtkButton* button = create_dialog_button("Close", G_CALLBACK(dialog_button_ok), &dialog);
- gtk_box_pack_start(GTK_BOX(vbox2), GTK_WIDGET(button), FALSE, FALSE, 0);
- }
- }
- }
- {
- GtkWidget* label = gtk_label_new ("Entity breakdown");
- gtk_widget_show (label);
- gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(label), FALSE, TRUE, 0);
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- }
- {
- GtkScrolledWindow* scr = create_scrolled_window(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4);
- gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET(scr), TRUE, TRUE, 0);
-
- {
- GtkListStore* store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
-
- GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
- gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(view), TRUE);
-
- {
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Entity", renderer, "text", 0, 0);
- gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
- gtk_tree_view_column_set_sort_column_id(column, 0);
- }
-
- {
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Count", renderer, "text", 1, 0);
- gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
- gtk_tree_view_column_set_sort_column_id(column, 1);
- }
-
- gtk_widget_show(view);
-
- gtk_container_add(GTK_CONTAINER(scr), view);
-
- EntityBreakdownWalker = store;
- }
- }
- }
-
- // Initialize fields
-
- {
- EntityBreakdown entitymap;
- Scene_EntityBreakdown(entitymap);
-
- for(EntityBreakdown::iterator i=entitymap.begin(); i != entitymap.end(); ++i)
- {
- char tmp[16];
- sprintf (tmp, "%u", Unsigned((*i).second));
- GtkTreeIter iter;
- gtk_list_store_append(GTK_LIST_STORE(EntityBreakdownWalker), &iter);
- gtk_list_store_set(GTK_LIST_STORE(EntityBreakdownWalker), &iter, 0, (*i).first.c_str(), 1, tmp, -1);
- }
- }
-
- g_object_unref(G_OBJECT(EntityBreakdownWalker));
-
- char tmp[16];
- sprintf (tmp, "%u", Unsigned(g_brushCount.get()));
- gtk_entry_set_text (GTK_ENTRY (brushes_entry), tmp);
- sprintf (tmp, "%u", Unsigned(g_entityCount.get()));
- gtk_entry_set_text (GTK_ENTRY (entities_entry), tmp);
-
- modal_dialog_show(window, dialog);
-
- // save before exit
- window_get_position(window, g_posMapInfoWnd);
-
- gtk_widget_destroy(GTK_WIDGET(window));
+void Scene_EntityBreakdown( EntityBreakdown& entitymap ){
+ GlobalSceneGraph().traverse( EntityBreakdownWalker( entitymap ) );
+}
+
+
+WindowPosition g_posMapInfoWnd( c_default_window_pos );
+
+void DoMapInfo(){
+ ModalDialog dialog;
+ GtkEntry* brushes_entry;
+ GtkEntry* entities_entry;
+ GtkListStore* EntityBreakdownWalker;
+
+ GtkWindow* window = create_dialog_window( MainFrame_getWindow(), "Map Info", G_CALLBACK( dialog_delete_callback ), &dialog );
+
+ window_set_position( window, g_posMapInfoWnd );
+
+ {
+ GtkVBox* vbox = create_dialog_vbox( 4, 4 );
+ gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
+
+ {
+ GtkHBox* hbox = create_dialog_hbox( 4 );
+ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 );
+
+ {
+ GtkTable* table = create_dialog_table( 2, 2, 4, 4 );
+ gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
+
+ {
+ GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ gtk_widget_show( GTK_WIDGET( entry ) );
+ gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_entry_set_editable( entry, FALSE );
+
+ brushes_entry = entry;
+ }
+ {
+ GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+ gtk_widget_show( GTK_WIDGET( entry ) );
+ gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_entry_set_editable( entry, FALSE );
+
+ entities_entry = entry;
+ }
+ {
+ GtkWidget* label = gtk_label_new( "Total Brushes" );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
+ }
+ {
+ GtkWidget* label = gtk_label_new( "Total Entities" );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
+ }
+ }
+ {
+ GtkVBox* vbox2 = create_dialog_vbox( 4 );
+ gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox2 ), FALSE, FALSE, 0 );
+
+ {
+ GtkButton* button = create_dialog_button( "Close", G_CALLBACK( dialog_button_ok ), &dialog );
+ gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
+ }
+ }
+ }
+ {
+ GtkWidget* label = gtk_label_new( "Entity breakdown" );
+ gtk_widget_show( label );
+ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, TRUE, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
+ }
+ {
+ GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4 );
+ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 );
+
+ {
+ GtkListStore* store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING );
+
+ GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
+
+ {
+ GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Entity", renderer, "text", 0, 0 );
+ gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
+ gtk_tree_view_column_set_sort_column_id( column, 0 );
+ }
+
+ {
+ GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Count", renderer, "text", 1, 0 );
+ gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
+ gtk_tree_view_column_set_sort_column_id( column, 1 );
+ }
+
+ gtk_widget_show( view );
+
+ gtk_container_add( GTK_CONTAINER( scr ), view );
+
+ EntityBreakdownWalker = store;
+ }
+ }
+ }
+
+ // Initialize fields
+
+ {
+ EntityBreakdown entitymap;
+ Scene_EntityBreakdown( entitymap );
+
+ for ( EntityBreakdown::iterator i = entitymap.begin(); i != entitymap.end(); ++i )
+ {
+ char tmp[16];
+ sprintf( tmp, "%u", Unsigned( ( *i ).second ) );
+ GtkTreeIter iter;
+ gtk_list_store_append( GTK_LIST_STORE( EntityBreakdownWalker ), &iter );
+ gtk_list_store_set( GTK_LIST_STORE( EntityBreakdownWalker ), &iter, 0, ( *i ).first.c_str(), 1, tmp, -1 );
+ }
+ }
+
+ g_object_unref( G_OBJECT( EntityBreakdownWalker ) );
+
+ char tmp[16];
+ sprintf( tmp, "%u", Unsigned( g_brushCount.get() ) );
+ gtk_entry_set_text( GTK_ENTRY( brushes_entry ), tmp );
+ sprintf( tmp, "%u", Unsigned( g_entityCount.get() ) );
+ gtk_entry_set_text( GTK_ENTRY( entities_entry ), tmp );
+
+ modal_dialog_show( window, dialog );
+
+ // save before exit
+ window_get_position( window, g_posMapInfoWnd );
+
+ gtk_widget_destroy( GTK_WIDGET( window ) );