X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=radiant%2Fconsole.cpp;h=2f156dd27de9630087eff3b000f4f2c905eede99;hp=044648f9ff6467e3a882089c7a8a83e7fed43e27;hb=cb5c74a45f6154d14e5c0309c41e7a4eb0f947f1;hpb=e2b92e121264da56e42426150f338c6e2220fc09 diff --git a/radiant/console.cpp b/radiant/console.cpp index 044648f9..2f156dd2 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "gtkutil/accelerator.h" #include "gtkutil/messagebox.h" @@ -91,9 +92,9 @@ void console_populate_popup( GtkTextView* textview, ui::Menu menu, gpointer user menu_separator( menu ); ui::Widget item(ui::MenuItem( "Clear" )); - g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( console_clear ), 0 ); + item.connect( "activate", G_CALLBACK( console_clear ), 0 ); item.show(); - container_add_widget( menu, item ); + menu.add(item); } gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){ @@ -104,7 +105,7 @@ gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){ WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" ); ui::Widget Console_constructWindow( ui::Window toplevel ){ - ui::Widget scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); scr.show(); @@ -114,7 +115,7 @@ ui::Widget Console_constructWindow( ui::Window toplevel ){ gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD ); gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE ); - gtk_container_add( GTK_CONTAINER( scr ), text ); + scr.add(text); text.show(); g_console = text; @@ -124,8 +125,8 @@ ui::Widget Console_constructWindow( ui::Window toplevel ){ //g_consoleWidgetFocusPrinter.connect(g_console); - g_signal_connect( G_OBJECT( g_console ), "populate-popup", G_CALLBACK( console_populate_popup ), 0 ); - g_signal_connect( G_OBJECT( g_console ), "destroy", G_CALLBACK( destroy_set_null ), &g_console ); + g_console.connect( "populate-popup", G_CALLBACK( console_populate_popup ), 0 ); + g_console.connect( "destroy", G_CALLBACK( destroy_set_null ), &g_console ); } gtk_container_set_focus_chain( GTK_CONTAINER( scr ), NULL ); @@ -142,7 +143,7 @@ public: GtkTextBufferOutputStream( GtkTextBuffer* textBuffer, GtkTextIter* iter, GtkTextTag* tag ) : textBuffer( textBuffer ), iter( iter ), tag( tag ){ } std::size_t write( const char* buffer, std::size_t length ){ - gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, 0 ); + gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, NULL ); return length; } }; @@ -173,9 +174,9 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){ const GdkColor yellow = { 0, 0xb0ff, 0xb0ff, 0x0000 }; const GdkColor red = { 0, 0xffff, 0x0000, 0x0000 }; - static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, 0 ); - static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, 0 ); - static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", 0 ); + static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL ); + static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL ); + static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL ); GtkTextTag* tag; switch ( level ) {