From: TimePath Date: Sun, 6 Aug 2017 11:05:40 +0000 (+1000) Subject: Prevent implicit Widget construction X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0110e3a8f3ab54c17a1785e17c7246adf8e13a46;p=xonotic%2Fnetradiant.git Prevent implicit Widget construction --- diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index 3629abd8..28939546 100644 --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@ -63,7 +63,7 @@ const char* PLUGIN_NAME = "bobToolz"; static const char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge"; // globals -ui::Widget g_pRadiantWnd; +ui::Widget g_pRadiantWnd{ui::null}; static const char *PLUGIN_ABOUT = "bobToolz for SDRadiant\n" "by digibob (digibob@splashdamage.com)\n" diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index fb9c1806..52f4f70a 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -34,17 +34,17 @@ ---------------------------------*/ typedef struct { - ui::Widget cbTexChange; - ui::Widget editTexOld, editTexNew; + ui::Widget cbTexChange{ui::null}; + ui::Widget editTexOld{ui::null}, editTexNew{ui::null}; - ui::Widget cbScaleHor, cbScaleVert; - ui::Widget editScaleHor, editScaleVert; + ui::Widget cbScaleHor{ui::null}, cbScaleVert{ui::null}; + ui::Widget editScaleHor{ui::null}, editScaleVert{ui::null}; - ui::Widget cbShiftHor, cbShiftVert; - ui::Widget editShiftHor, editShiftVert; + ui::Widget cbShiftHor{ui::null}, cbShiftVert{ui::null}; + ui::Widget editShiftHor{ui::null}, editShiftVert{ui::null}; - ui::Widget cbRotation; - ui::Widget editRotation; + ui::Widget cbRotation{ui::null}; + ui::Widget editRotation{ui::null}; }dlg_texReset_t; dlg_texReset_t dlgTexReset; @@ -209,7 +209,7 @@ bool ValidateTextInt( const char* pData, const char* error_title, int* value ){ */ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMessageBoxType type ){ - ui::Widget w, vbox, hbox; + ui::Widget w{ui::null}; EMessageBoxReturn ret; int loop = 1; @@ -222,7 +222,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess g_object_set_data( G_OBJECT( window ), "ret", &ret ); gtk_widget_realize( window ); - vbox = ui::VBox( FALSE, 10 ); + auto vbox = ui::VBox( FALSE, 10 ); window.add(vbox); gtk_widget_show( vbox ); @@ -235,7 +235,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 2 ); gtk_widget_show( w ); - hbox = ui::HBox( FALSE, 10 ); + auto hbox = ui::HBox( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); @@ -1044,10 +1044,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ } EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ - ui::Widget w, hbox; - - ui::Entry text1, text2, text3; - ui::Widget check1, check2; + ui::Widget w{ui::null}; EMessageBoxReturn ret; int loop = 1; @@ -1073,13 +1070,13 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- vbox ---- - hbox = ui::HBox( FALSE, 10 ); + auto hbox = ui::HBox( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); // ---- hbox ---- - text1 = ui::Entry( 256 ); + auto text1 = ui::Entry( 256 ); gtk_entry_set_text( text1, "25" ); gtk_box_pack_start( GTK_BOX( hbox ), text1, FALSE, FALSE, 2 ); gtk_widget_show( text1 ); @@ -1097,7 +1094,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- hbox ---- - text2 = ui::Entry( 256 ); + auto text2 = ui::Entry( 256 ); gtk_entry_set_text( text2, "3" ); gtk_box_pack_start( GTK_BOX( hbox ), text2, FALSE, FALSE, 2 ); gtk_widget_show( text2 ); @@ -1120,7 +1117,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ // ---- hbox ---- - text3 = ui::Entry( 256 ); + auto text3 = ui::Entry( 256 ); gtk_entry_set_text( text3, "-800" ); gtk_box_pack_start( GTK_BOX( hbox ), text3, FALSE, FALSE, 2 ); gtk_widget_show( text3 ); @@ -1136,11 +1133,11 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_widget_show( w ); - check1 = ui::CheckButton( "No Dynamic Update" ); + auto check1 = ui::CheckButton( "No Dynamic Update" ); gtk_box_pack_start( GTK_BOX( vbox ), check1, FALSE, FALSE, 0 ); gtk_widget_show( check1 ); - check2 = ui::CheckButton( "Show Bounding Lines" ); + auto check2 = ui::CheckButton( "Show Bounding Lines" ); gtk_box_pack_start( GTK_BOX( vbox ), check2, FALSE, FALSE, 0 ); gtk_widget_show( check2 ); @@ -1219,7 +1216,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ } EMessageBoxReturn DoCTFColourChangeBox(){ - ui::Widget w, hbox; + ui::Widget w{ui::null}; EMessageBoxReturn ret; int loop = 1; @@ -1244,7 +1241,7 @@ EMessageBoxReturn DoCTFColourChangeBox(){ // ---- vbox ---- - hbox = ui::HBox( FALSE, 10 ); + auto hbox = ui::HBox( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 ); gtk_widget_show( hbox ); @@ -1289,7 +1286,7 @@ EMessageBoxReturn DoCTFColourChangeBox(){ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ Str texSelected; - ui::Widget w, hbox; + ui::Widget w{ui::null}; EMessageBoxReturn ret; int loop = 1; @@ -1313,7 +1310,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ // ---- vbox ---- - hbox = ui::HBox( FALSE, 10 ); + auto hbox = ui::HBox( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); @@ -1620,12 +1617,12 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ Str texSelected; - ui::Widget w, hbox; + ui::Widget w{ui::null}; - ui::Widget radiusX, radiusY; - ui::Widget angleStart, angleEnd; - ui::Widget heightStart, heightEnd; - ui::Widget numPoints; + ui::Widget radiusX{ui::null}, radiusY{ui::null}; + ui::Widget angleStart{ui::null}, angleEnd{ui::null}; + ui::Widget heightStart{ui::null}, heightEnd{ui::null}; + ui::Widget numPoints{ui::null}; EMessageBoxReturn ret; int loop = 1; @@ -1649,7 +1646,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ // ---- vbox ---- - hbox = ui::HBox( FALSE, 10 ); + auto hbox = ui::HBox( FALSE, 10 ); gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 2 ); gtk_widget_show( hbox ); @@ -1886,8 +1883,8 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ // ailmanki // add a simple input for the MakeChain thing.. EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ - ui::Widget w; - ui::Entry textlinkNum, textlinkName; + ui::Widget w{ui::null}; + ui::Entry textlinkNum{ui::null}, textlinkName{ui::null}; EMessageBoxReturn ret; int loop = 1; diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp index c08ce71a..e06040d3 100644 --- a/contrib/brushexport/interface.cpp +++ b/contrib/brushexport/interface.cpp @@ -104,21 +104,21 @@ create_w_plugplug2( void ){ gtk_widget_show( label1 ); gtk_box_pack_start( GTK_BOX( vbox2 ), label1, FALSE, FALSE, 0 ); - auto scrolledwindow1 = ui::ScrolledWindow(); + auto scrolledwindow1 = ui::ScrolledWindow(ui::New); gtk_widget_set_name( scrolledwindow1, "scrolledwindow1" ); scrolledwindow1.show(); gtk_box_pack_start( GTK_BOX( vbox2 ), scrolledwindow1, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scrolledwindow1 ), GTK_SHADOW_IN ); - auto t_materialist = ui::TreeView(); + auto t_materialist = ui::TreeView(ui::New); gtk_widget_set_name( t_materialist, "t_materialist" ); t_materialist.show(); scrolledwindow1.add(t_materialist); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( t_materialist ), FALSE ); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( t_materialist ), FALSE ); - ed_materialname = ui::Entry(); + ed_materialname = ui::Entry(ui::New); gtk_widget_set_name( ed_materialname, "ed_materialname" ); gtk_widget_show( ed_materialname ); gtk_box_pack_start( GTK_BOX( vbox2 ), ed_materialname, FALSE, FALSE, 0 ); @@ -202,7 +202,7 @@ void CreateWindow( void ){ GtkTreeViewColumn* col = gtk_tree_view_column_new(); gtk_tree_view_column_set_title( col, "materials" ); gtk_tree_view_append_column( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), col ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), -1, "", renderer, "text", 0, NULL ); // list store diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index 391c1e6f..7599690d 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -329,7 +329,7 @@ void DoConfigDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); polyscheck.connect( "toggled", G_CALLBACK( OnPoly ), NULL ); - auto zlist = ui::ComboBoxText(); + auto zlist = ui::ComboBoxText(ui::New); gtk_widget_show( zlist ); gtk_box_pack_start( GTK_BOX( vbox2 ), zlist, TRUE, FALSE, 0 ); diff --git a/contrib/prtview/LoadPortalFileDialog.cpp b/contrib/prtview/LoadPortalFileDialog.cpp index f6f024c8..9a5348f1 100644 --- a/contrib/prtview/LoadPortalFileDialog.cpp +++ b/contrib/prtview/LoadPortalFileDialog.cpp @@ -97,7 +97,7 @@ int DoLoadPortalFileDialog(){ dlg.add(vbox); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - entry = ui::Entry(); + entry = ui::Entry(ui::New); gtk_widget_show( entry ); gtk_editable_set_editable( GTK_EDITABLE( entry ), FALSE ); gtk_box_pack_start( GTK_BOX( vbox ), entry, FALSE, FALSE, 0 ); diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index 606f505e..fcac228a 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -468,7 +468,7 @@ void accel_group_remove_accelerator( GtkAccelGroup* group, Accelerator accelerat } } -ui::AccelGroup global_accel = ui::AccelGroup(); +ui::AccelGroup global_accel{ui::New}; GClosure* global_accel_group_add_accelerator( Accelerator accelerator, const Callback& callback ){ if ( !global_accel_enabled() ) { diff --git a/libs/gtkutil/dialog.cpp b/libs/gtkutil/dialog.cpp index 9e272a15..88ca8d32 100644 --- a/libs/gtkutil/dialog.cpp +++ b/libs/gtkutil/dialog.cpp @@ -203,13 +203,13 @@ PathEntry PathEntry_new(){ auto hbox = ui::HBox( FALSE, 0 ); gtk_widget_show( GTK_WIDGET( hbox ) ); - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); gtk_entry_set_has_frame( entry, FALSE ); gtk_widget_show( GTK_WIDGET( entry ) ); gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); // browse button - auto button = ui::Button(); + auto button = ui::Button(ui::New); button_set_icon( button, "ellipsis.bmp" ); gtk_widget_show( GTK_WIDGET( button ) ); gtk_box_pack_end( GTK_BOX( hbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 ); diff --git a/libs/gtkutil/menu.cpp b/libs/gtkutil/menu.cpp index 51e156e9..6d71b23e 100644 --- a/libs/gtkutil/menu.cpp +++ b/libs/gtkutil/menu.cpp @@ -57,7 +57,7 @@ ui::MenuItem new_sub_menu_item_with_mnemonic( const char* mnemonic ){ auto item = ui::MenuItem( mnemonic, true ); item.show(); - auto sub_menu = ui::Menu(); + auto sub_menu = ui::Menu(ui::New); gtk_menu_item_set_submenu( item, sub_menu ); return item; diff --git a/libs/gtkutil/messagebox.cpp b/libs/gtkutil/messagebox.cpp index 97c77ee8..97b8db54 100644 --- a/libs/gtkutil/messagebox.cpp +++ b/libs/gtkutil/messagebox.cpp @@ -67,7 +67,7 @@ EMessageBoxReturn gtk_MessageBox( ui::Widget parent, const char* text, const cha gtk_window_deiconify( parentWindow ); } - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); auto vbox = create_dialog_vbox( 8, 8 ); diff --git a/libs/gtkutil/paned.cpp b/libs/gtkutil/paned.cpp index a09df803..1ad28d4e 100644 --- a/libs/gtkutil/paned.cpp +++ b/libs/gtkutil/paned.cpp @@ -62,14 +62,14 @@ PanedState g_vpaned1 = { 0.5f, -1, }; PanedState g_vpaned2 = { 0.5f, -1, }; ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widget botleft, ui::Widget botright ){ - auto hsplit = ui::HPaned(); + auto hsplit = ui::HPaned(ui::New); hsplit.show(); hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_hpaned ); hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_hpaned ); { - auto vsplit = ui::VPaned(); + auto vsplit = ui::VPaned(ui::New); gtk_paned_add1( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); gtk_widget_show( GTK_WIDGET( vsplit ) ); @@ -80,7 +80,7 @@ ui::HPaned create_split_views( ui::Widget topleft, ui::Widget topright, ui::Widg gtk_paned_add2( GTK_PANED( vsplit ), GTK_WIDGET( create_framed_widget( topright ) ) ); } { - auto vsplit = ui::VPaned(); + auto vsplit = ui::VPaned(ui::New); gtk_paned_add2( GTK_PANED( hsplit ), GTK_WIDGET( vsplit ) ); gtk_widget_show( GTK_WIDGET( vsplit ) ); diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index bbeed5b9..6986d6d9 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -137,7 +137,7 @@ void window_remove_minmax( ui::Window window ){ ui::ScrolledWindow create_scrolled_window( ui::Policy hscrollbar_policy, ui::Policy vscrollbar_policy, int border ){ - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); gtk_widget_show( GTK_WIDGET( scr ) ); gtk_scrolled_window_set_policy( scr, (GtkPolicyType) hscrollbar_policy, (GtkPolicyType) vscrollbar_policy ); gtk_scrolled_window_set_shadow_type( scr, GTK_SHADOW_IN ); diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index 7aaccfa2..5461cda4 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -36,7 +36,7 @@ namespace ui { } } - Widget root; + Widget root{ui::null}; #define IMPL(T, F) template<> _IMPL(T, F) #define _IMPL(T, F) struct verify { using self = T; static self test(self it) { return self(F(it)); } } @@ -57,7 +57,7 @@ namespace ui { IMPL(Widget, GTK_WIDGET); - Widget::Widget() : Widget(nullptr) + Widget::Widget(ui::New_t) : Widget(nullptr) {} alert_response IWidget::alert(std::string text, std::string title, alert_type type, alert_icon icon) @@ -187,7 +187,7 @@ namespace ui { IMPL(Button, GTK_BUTTON); - Button::Button() : Button(GTK_BUTTON(gtk_button_new())) + Button::Button(ui::New_t) : Button(GTK_BUTTON(gtk_button_new())) {} Button::Button(const char *label) : Button(GTK_BUTTON(gtk_button_new_with_label(label))) @@ -202,7 +202,7 @@ namespace ui { IMPL(CheckButton, GTK_CHECK_BUTTON); - CheckButton::CheckButton() : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new())) + CheckButton::CheckButton(ui::New_t) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new())) {} CheckButton::CheckButton(const char *label) : CheckButton(GTK_CHECK_BUTTON(gtk_check_button_new_with_label(label))) @@ -210,7 +210,7 @@ namespace ui { IMPL(MenuItem, GTK_MENU_ITEM); - MenuItem::MenuItem() : MenuItem(GTK_MENU_ITEM(gtk_menu_item_new())) + MenuItem::MenuItem(ui::New_t) : MenuItem(GTK_MENU_ITEM(gtk_menu_item_new())) {} MenuItem::MenuItem(const char *label, bool mnemonic) : MenuItem( @@ -219,17 +219,17 @@ namespace ui { IMPL(TearoffMenuItem, GTK_TEAROFF_MENU_ITEM); - TearoffMenuItem::TearoffMenuItem() : TearoffMenuItem(GTK_TEAROFF_MENU_ITEM(gtk_tearoff_menu_item_new())) + TearoffMenuItem::TearoffMenuItem(ui::New_t) : TearoffMenuItem(GTK_TEAROFF_MENU_ITEM(gtk_tearoff_menu_item_new())) {} IMPL(ComboBoxText, GTK_COMBO_BOX_TEXT); - ComboBoxText::ComboBoxText() : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new())) + ComboBoxText::ComboBoxText(ui::New_t) : ComboBoxText(GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new())) {} IMPL(ScrolledWindow, GTK_SCROLLED_WINDOW); - ScrolledWindow::ScrolledWindow() : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr))) + ScrolledWindow::ScrolledWindow(ui::New_t) : ScrolledWindow(GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(nullptr, nullptr))) {} void IScrolledWindow::overflow(Policy x, Policy y) @@ -249,17 +249,17 @@ namespace ui { IMPL(HPaned, GTK_HPANED); - HPaned::HPaned() : HPaned(GTK_HPANED(gtk_hpaned_new())) + HPaned::HPaned(ui::New_t) : HPaned(GTK_HPANED(gtk_hpaned_new())) {} IMPL(VPaned, GTK_VPANED); - VPaned::VPaned() : VPaned(GTK_VPANED(gtk_vpaned_new())) + VPaned::VPaned(ui::New_t) : VPaned(GTK_VPANED(gtk_vpaned_new())) {} IMPL(Menu, GTK_MENU); - Menu::Menu() : Menu(GTK_MENU(gtk_menu_new())) + Menu::Menu(ui::New_t) : Menu(GTK_MENU(gtk_menu_new())) {} IMPL(Table, GTK_TABLE); @@ -271,7 +271,7 @@ namespace ui { IMPL(TextView, GTK_TEXT_VIEW); - TextView::TextView() : TextView(GTK_TEXT_VIEW(gtk_text_view_new())) + TextView::TextView(ui::New_t) : TextView(GTK_TEXT_VIEW(gtk_text_view_new())) {} void ITextView::text(char const *str) @@ -280,7 +280,7 @@ namespace ui { gtk_text_buffer_set_text(buffer, str, -1); } - TreeView::TreeView() : TreeView(GTK_TREE_VIEW(gtk_tree_view_new())) + TreeView::TreeView(ui::New_t) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new())) {} TreeView::TreeView(TreeModel model) : TreeView(GTK_TREE_VIEW(gtk_tree_view_new_with_model(model))) @@ -298,15 +298,15 @@ namespace ui { IMPL(Image, GTK_IMAGE); - Image::Image() : Image(GTK_IMAGE(gtk_image_new())) + Image::Image(ui::New_t) : Image(GTK_IMAGE(gtk_image_new())) {} IMPL(Entry, GTK_ENTRY); - Entry::Entry() : Entry(GTK_ENTRY(gtk_entry_new())) + Entry::Entry(ui::New_t) : Entry(GTK_ENTRY(gtk_entry_new())) {} - Entry::Entry(std::size_t max_length) : Entry() + Entry::Entry(std::size_t max_length) : Entry(ui::New) { gtk_entry_set_max_length(this, static_cast(max_length)); } @@ -347,7 +347,7 @@ namespace ui { IMPL(CellRendererText, GTK_CELL_RENDERER_TEXT); - CellRendererText::CellRendererText() : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new())) + CellRendererText::CellRendererText(ui::New_t) : CellRendererText(GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new())) {} IMPL(TreeViewColumn, GTK_TREE_VIEW_COLUMN); @@ -363,7 +363,7 @@ namespace ui { IMPL(AccelGroup, GTK_ACCEL_GROUP); - AccelGroup::AccelGroup() : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new())) + AccelGroup::AccelGroup(ui::New_t) : AccelGroup(GTK_ACCEL_GROUP(gtk_accel_group_new())) {} IMPL(ListStore, GTK_LIST_STORE); @@ -375,7 +375,7 @@ namespace ui { // IMPL(TreePath, GTK_TREE_PATH); - TreePath::TreePath() : TreePath(gtk_tree_path_new()) + TreePath::TreePath(ui::New_t) : TreePath(gtk_tree_path_new()) {} TreePath::TreePath(const char *path) : TreePath(gtk_tree_path_new_from_string(path)) diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 53241ec2..c6a3bb1f 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -166,6 +166,7 @@ namespace ui { } extern struct Null {} null; + extern struct New_t {} New; class Object : public details::Convertible, @@ -208,6 +209,7 @@ namespace ui { using native = T *; \ explicit name(native h) : super(reinterpret_cast(h)) {} \ explicit name(Null n) : name((native) nullptr) {} \ + explicit name(New_t); \ static name from(void *ptr) { return name((native) ptr); } \ ctors \ }; \ @@ -223,7 +225,6 @@ namespace ui { ); WRAP(Editable, Object, _GtkEditable, (), - explicit Editable(); , void editable(bool value); ); @@ -240,7 +241,6 @@ namespace ui { }; WRAP(Widget, Object, _GtkWidget, (), - explicit Widget(); , alert_response alert( std::string text, @@ -321,7 +321,6 @@ namespace ui { ); WRAP(Button, Bin, _GtkButton, (), - explicit Button(); explicit Button(const char *label); , ); @@ -332,7 +331,6 @@ namespace ui { ); WRAP(CheckButton, ToggleButton, _GtkCheckButton, (), - explicit CheckButton(); explicit CheckButton(const char *label); , ); @@ -346,7 +344,6 @@ namespace ui { ); WRAP(MenuItem, Item, _GtkMenuItem, (), - explicit MenuItem(); explicit MenuItem(const char *label, bool mnemonic = false); , ); @@ -360,7 +357,6 @@ namespace ui { ); WRAP(TearoffMenuItem, MenuItem, _GtkTearoffMenuItem, (), - explicit TearoffMenuItem(); , ); @@ -369,7 +365,6 @@ namespace ui { ); WRAP(ComboBoxText, ComboBox, _GtkComboBoxText, (), - explicit ComboBoxText(); , ); @@ -390,7 +385,6 @@ namespace ui { ); WRAP(ScrolledWindow, Bin, _GtkScrolledWindow, (), - explicit ScrolledWindow(); , void overflow(Policy x, Policy y); ); @@ -414,12 +408,10 @@ namespace ui { ); WRAP(HPaned, Paned, _GtkHPaned, (), - explicit HPaned(); , ); WRAP(VPaned, Paned, _GtkVPaned, (), - explicit VPaned(); , ); @@ -432,7 +424,6 @@ namespace ui { ); WRAP(Menu, MenuShell, _GtkMenu, (), - explicit Menu(); , ); @@ -442,7 +433,6 @@ namespace ui { ); WRAP(TextView, Container, _GtkTextView, (), - explicit TextView(); , void text(char const *str); ); @@ -453,7 +443,6 @@ namespace ui { class TreeModel; WRAP(TreeView, Widget, _GtkTreeView, (), - explicit TreeView(); TreeView(TreeModel model); , ); @@ -469,12 +458,10 @@ namespace ui { ); WRAP(Image, Widget, _GtkImage, (), - explicit Image(); , ); WRAP(Entry, Widget, _GtkEntry, (IEditable, ICellEditable), - explicit Entry(); explicit Entry(std::size_t max_length); , char const *text(); @@ -514,7 +501,6 @@ namespace ui { ); WRAP(CellRendererText, CellRenderer, _GtkCellRendererText, (), - explicit CellRendererText(); , ); @@ -528,7 +514,6 @@ namespace ui { ); WRAP(AccelGroup, Object, _GtkAccelGroup, (), - explicit AccelGroup(); , ); @@ -548,7 +533,6 @@ namespace ui { // GBoxed WRAP(TreePath, Object, _GtkTreePath, (), - explicit TreePath(); explicit TreePath(const char *path); , ); diff --git a/radiant/build.cpp b/radiant/build.cpp index 05ca5645..6820981b 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -840,7 +840,7 @@ gboolean commands_key_press( ui::Widget widget, GdkEventKey* event, ui::ListStor ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectList ){ ui::Window window = MainFrame_getWindow().create_dialog_window("Build Menu", G_CALLBACK(dialog_delete_callback ), &modal, -1, 400 ); - ui::Widget buildView; + ui::Widget buildView{ui::null}; { auto table1 = create_dialog_table( 2, 2, 4, 4, 4 ); @@ -874,7 +874,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) )); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); renderer.connect("edited", G_CALLBACK( project_cell_edited ), &projectList ); @@ -911,7 +911,7 @@ ui::Window BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) )); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); object_set_boolean_property( G_OBJECT( renderer ), "editable", TRUE ); renderer.connect( "edited", G_CALLBACK( commands_cell_edited ), store ); diff --git a/radiant/commands.cpp b/radiant/commands.cpp index 027b0dc3..cf9c68ce 100644 --- a/radiant/commands.cpp +++ b/radiant/commands.cpp @@ -392,7 +392,7 @@ void DoCommandListDlg(){ return accelerator_window_key_press(widget, event, dialogptr); }, &dialog); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); auto hbox = create_dialog_hbox( 4, 4 ); @@ -411,13 +411,13 @@ void DoCommandListDlg(){ gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "Command", renderer, {{"text", 0}, {"weight-set", 2}, {"weight", 3}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); } { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 1}, {"weight-set", 2}, {"weight", 3}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); } @@ -473,7 +473,7 @@ public: GtkButton* clearbutton = create_dialog_button( "Clear", (GCallback) accelerator_clear_button_clicked, &dialog ); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( clearbutton ), FALSE, FALSE, 0 ); - ui::Widget spacer = ui::Image(); + ui::Widget spacer = ui::Image(ui::New); spacer.show(); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( spacer ), TRUE, TRUE, 0 ); diff --git a/radiant/console.cpp b/radiant/console.cpp index 68c22ea1..11295779 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -97,20 +97,20 @@ void console_populate_popup( ui::TextView textview, ui::Menu menu, gpointer user } gboolean destroy_set_null( ui::Window widget, ui::Widget* p ){ - *p = ui::Widget(); + *p = ui::Widget{ui::null}; return FALSE; } WidgetFocusPrinter g_consoleWidgetFocusPrinter( "console" ); ui::Widget Console_constructWindow( ui::Window toplevel ){ - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.overflow(ui::Policy::AUTOMATIC, ui::Policy::AUTOMATIC); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); scr.show(); { - auto text = ui::TextView(); + auto text = ui::TextView(ui::New); 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 ); diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 6e558bb9..8133cdb0 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -48,7 +48,7 @@ ui::Entry DialogEntry_new(){ - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_widget_set_size_request( GTK_WIDGET( entry ), 64, -1 ); return entry; @@ -470,7 +470,7 @@ void Dialog::addCombo( ui::Widget vbox, const char* name, StringArrayRange value auto alignment = ui::Alignment( 0.0, 0.5, 0.0, 0.0 ); alignment.show(); { - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); for ( StringArrayRange::Iterator i = values.first; i != values.last; ++i ) { diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index cffa9358..1266e9c6 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -65,7 +65,7 @@ #include "groupdialog.h" ui::Entry numeric_entry_new(){ - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); entry.dimensions(64, -1); return entry; @@ -122,7 +122,7 @@ public: BooleanAttribute( const char* key ) : m_key( key ), m_check( ui::null ){ - auto check = ui::CheckButton(); + auto check = ui::CheckButton(ui::New); check.show(); m_check = check; @@ -167,7 +167,7 @@ StringAttribute( const char* key ) : m_key( key ), m_entry( ui::null ), m_nonModal( ApplyCaller( *this ), UpdateCaller( *this ) ){ - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); entry.dimensions(50, -1); @@ -662,7 +662,7 @@ ListAttribute( const char* key, const ListAttributeType& type ) : m_combo( 0 ), m_nonModal( ApplyCaller( *this ) ), m_type( type ){ - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); for ( ListAttributeType::const_iterator i = type.begin(); i != type.end(); ++i ) { @@ -702,20 +702,20 @@ typedef MemberCaller UpdateCaller; namespace { -ui::Widget g_entity_split1; -ui::Widget g_entity_split2; +ui::Widget g_entity_split1{ui::null}; +ui::Widget g_entity_split2{ui::null}; int g_entitysplit1_position; int g_entitysplit2_position; bool g_entityInspector_windowConstructed = false; GtkTreeView* g_entityClassList; -ui::TextView g_entityClassComment; +ui::TextView g_entityClassComment{ui::null}; GtkCheckButton* g_entitySpawnflagsCheck[MAX_FLAGS]; -ui::Entry g_entityKeyEntry; -ui::Entry g_entityValueEntry; +ui::Entry g_entityKeyEntry{ui::null}; +ui::Entry g_entityValueEntry{ui::null}; ui::ListStore g_entlist_store{ui::null}; ui::ListStore g_entprops_store{ui::null}; @@ -1297,14 +1297,14 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ vbox.connect( "destroy", G_CALLBACK( EntityInspector_destroyWindow ), 0 ); { - ui::Widget split1 = ui::VPaned(); + ui::Widget split1 = ui::VPaned(ui::New); gtk_box_pack_start( GTK_BOX( vbox ), split1, TRUE, TRUE, 0 ); split1.show(); g_entity_split1 = split1; { - ui::Widget split2 = ui::VPaned(); + ui::Widget split2 = ui::VPaned(ui::New); gtk_paned_add1( GTK_PANED( split1 ), split2 ); split2.show(); @@ -1312,7 +1312,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { // class list - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.show(); gtk_paned_add1( GTK_PANED( split2 ), scr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); @@ -1328,7 +1328,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ view.connect( "key_press_event", G_CALLBACK( EntityClassList_keypress ), 0 ); { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "Key", renderer, {{"text", 0}} ); gtk_tree_view_append_column( view, column ); } @@ -1349,14 +1349,14 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.show(); gtk_paned_add2( GTK_PANED( split2 ), scr ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN ); { - auto text = ui::TextView(); + auto text = ui::TextView(ui::New); gtk_widget_set_size_request( GTK_WIDGET( text ), 0, -1 ); // allow shrinking gtk_text_view_set_wrap_mode( text, GTK_WRAP_WORD ); gtk_text_view_set_editable( text, FALSE ); @@ -1368,7 +1368,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - ui::Widget split2 = ui::VPaned(); + ui::Widget split2 = ui::VPaned(ui::New); gtk_paned_add2( GTK_PANED( split1 ), split2 ); split2.show(); @@ -1396,7 +1396,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ { // key/value list - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.show(); gtk_box_pack_start( GTK_BOX( vbox2 ), scr, TRUE, TRUE, 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); @@ -1410,13 +1410,13 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); } { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 1}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); } @@ -1445,7 +1445,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ gtk_table_set_col_spacings( table, 5 ); { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -1456,7 +1456,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -1506,7 +1506,7 @@ ui::Widget EntityInspector_constructWindow( ui::Window toplevel ){ } { - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.show(); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index 239aef06..8b6a4690 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -296,10 +296,10 @@ void EntityList_constructWindow( ui::Window main_window ){ window.add(scr); { - ui::Widget view = ui::TreeView(); + ui::Widget view = ui::TreeView(ui::New); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = gtk_tree_view_column_new(); gtk_tree_view_column_pack_start( column, renderer, TRUE ); gtk_tree_view_column_set_cell_data_func( column, renderer, entitylist_treeviewcolumn_celldatafunc, 0, 0 ); diff --git a/radiant/feedback.cpp b/radiant/feedback.cpp index e1c3c48c..44e9dd71 100644 --- a/radiant/feedback.cpp +++ b/radiant/feedback.cpp @@ -293,7 +293,7 @@ void CDbgDlg::Push( ISAXHandler *pHandler ){ ui::Window CDbgDlg::BuildDialog(){ auto window = MainFrame_getWindow().create_floating_window("Q3Map debug window" ); - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.show(); window.add(scr); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); @@ -306,7 +306,7 @@ ui::Window CDbgDlg::BuildDialog(){ gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "", renderer, {{"text", 0}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); } diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 49efe49e..c7e2aca6 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -128,8 +128,8 @@ FindTextureDialog::~FindTextureDialog(){ } ui::Window FindTextureDialog::BuildDialog(){ - ui::Widget vbox, hbox, table, label; - ui::Widget button; + ui::Widget vbox{ui::null}, hbox{ui::null}, table{ui::null}, label{ui::null}; + ui::Widget button{ui::null}; ui::Entry entry{ui::null}; auto dlg = ui::Window(create_floating_window( "Find / Replace Texture(s)", m_parent )); @@ -163,7 +163,7 @@ ui::Window FindTextureDialog::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); - entry = ui::Entry(); + entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -173,7 +173,7 @@ ui::Window FindTextureDialog::BuildDialog(){ AddDialogData( *GTK_ENTRY(entry), m_strFind ); GlobalTextureEntryCompletion::instance().connect( entry ); - entry = ui::Entry(); + entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), diff --git a/radiant/groupdialog.cpp b/radiant/groupdialog.cpp index 7a301ce8..eae85380 100644 --- a/radiant/groupdialog.cpp +++ b/radiant/groupdialog.cpp @@ -47,8 +47,8 @@ class GroupDlg { public: -ui::Widget m_pNotebook; -ui::Window m_window; +ui::Widget m_pNotebook{ui::null}; +ui::Window m_window{ui::null}; GroupDlg(); void Create( ui::Window parent ); diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index f39487a5..3d65f8a6 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -154,8 +154,8 @@ inline void path_copy_clean( char* destination, const char* source ){ struct GameCombo { - ui::ComboBoxText game_select; - ui::Entry fsgame_entry; + ui::ComboBoxText game_select{ui::null}; + ui::Entry fsgame_entry{ui::null}; }; gboolean OnSelchangeComboWhatgame( ui::Widget widget, GameCombo* combo ){ @@ -239,7 +239,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); } { - dialog.game_combo.game_select = ui::ComboBoxText(); + dialog.game_combo.game_select = ui::ComboBoxText(ui::New); gtk_combo_box_text_append_text( dialog.game_combo.game_select, globalGameComboConfiguration().basegame ); if ( globalGameComboConfiguration().known[0] != '\0' ) { @@ -264,7 +264,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table2, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -281,7 +281,7 @@ ui::Window ProjectSettingsDialog_construct( ProjectSettingsDialog& dialog, Modal (GtkAttachOptions) ( 0 ), 0, 0 ); gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); gtk_combo_box_text_append_text( combo, globalMappingMode().sp_mapping_mode ); gtk_combo_box_text_append_text( combo, globalMappingMode().mp_mapping_mode ); @@ -372,7 +372,7 @@ void DoSides( int type, int axis ){ auto window = MainFrame_getWindow().create_dialog_window("Arbitrary sides", G_CALLBACK(dialog_delete_callback ), &dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); { @@ -384,7 +384,7 @@ void DoSides( int type, int axis ){ gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( entry ), FALSE, FALSE, 0 ); sides_entry = entry; @@ -566,7 +566,7 @@ void DoAbout(){ auto sc_extensions = create_scrolled_window( ui::Policy::AUTOMATIC, ui::Policy::ALWAYS, 4 ); frame.add(sc_extensions); { - auto text_extensions = ui::TextView(); + auto text_extensions = ui::TextView(ui::New); gtk_text_view_set_editable( GTK_TEXT_VIEW( text_extensions ), FALSE ); sc_extensions.add(text_extensions); text_extensions.text(reinterpret_cast(glGetString(GL_EXTENSIONS))); @@ -594,12 +594,12 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ ModalDialog dialog; ModalDialogButton ok_button( dialog, eIDOK ); ModalDialogButton cancel_button( dialog, eIDCANCEL ); - ui::Entry x; - ui::Entry y; + ui::Entry x{ui::null}; + ui::Entry y{ui::null}; auto window = MainFrame_getWindow().create_modal_dialog_window("Patch texture layout", dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); { @@ -638,7 +638,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -647,7 +647,7 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ x = entry; } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -705,8 +705,8 @@ EMessageBoxReturn DoTextureLayout( float *fx, float *fy ){ // Text Editor dialog // master window widget -static ui::Widget text_editor; -static ui::Widget text_widget; // slave, text widget from the gtk editor +static ui::Widget text_editor{ui::null}; +static ui::Widget text_widget{ui::null}; // slave, text widget from the gtk editor static gint editor_delete( ui::Widget widget, gpointer data ){ if ( widget.alert( "Close the shader editor ?", "Radiant", ui::alert_type::YESNO, ui::alert_icon::Question ) == ui::alert_response::NO ) { @@ -741,36 +741,34 @@ static void editor_close( ui::Widget widget, gpointer data ){ } static void CreateGtkTextEditor(){ - ui::Widget vbox, hbox, button, text; - auto dlg = ui::Window( ui::window_type::TOP ); dlg.connect( "delete_event", G_CALLBACK( editor_delete ), 0 ); gtk_window_set_default_size( GTK_WINDOW( dlg ), 600, 300 ); - vbox = ui::VBox( FALSE, 5 ); + auto vbox = ui::VBox( FALSE, 5 ); vbox.show(); dlg.add(vbox); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - auto scr = ui::ScrolledWindow(); + auto scr = ui::ScrolledWindow(ui::New); scr.show(); gtk_box_pack_start( GTK_BOX( vbox ), scr, TRUE, TRUE, 0 ); 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 ); - text = ui::TextView(); + auto text = ui::TextView(ui::New); scr.add(text); text.show(); g_object_set_data( G_OBJECT( dlg ), "text", (gpointer) text ); gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), TRUE ); - hbox = ui::HBox( FALSE, 5 ); + auto hbox = ui::HBox( FALSE, 5 ); hbox.show(); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, TRUE, 0 ); - button = ui::Button( "Close" ); + auto button = ui::Button( "Close" ); button.show(); gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 ); button.connect( "clicked", @@ -853,13 +851,13 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos ){ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){ ModalDialog dialog; - ui::Entry intensity_entry; + ui::Entry intensity_entry{ui::null}; ModalDialogButton ok_button( dialog, eIDOK ); ModalDialogButton cancel_button( dialog, eIDCANCEL ); ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Light intensity", dialog, -1, -1 ); - auto accel_group = ui::AccelGroup(); + auto accel_group = ui::AccelGroup(ui::New); window.add_accel_group( accel_group ); { @@ -874,7 +872,7 @@ EMessageBoxReturn DoLightIntensityDlg( int *intensity ){ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); @@ -926,7 +924,7 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){ auto window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 ); - auto accel_group = ui::AccelGroup(); + auto accel_group = ui::AccelGroup(ui::New); window.add_accel_group( accel_group ); { @@ -942,7 +940,7 @@ EMessageBoxReturn DoShaderTagDlg( CopiedString* tag, const char* title ){ gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( label ), FALSE, FALSE, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); @@ -985,7 +983,7 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const auto window = MainFrame_getWindow().create_modal_dialog_window(title, dialog, -1, -1 ); - auto accel_group = ui::AccelGroup(); + auto accel_group = ui::AccelGroup(ui::New); window.add_accel_group( accel_group ); { diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index acb6da12..76ad6e16 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -98,11 +98,10 @@ ui::ToggleToolButton toolbar_append_toggle_button( ui::Toolbar toolbar, const ch // File dialog bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){ - ui::Widget dlg; GdkColor clr = { 0, guint16(color[0] * 65535), guint16(color[1] * 65535), guint16(color[2] * 65535) }; ModalDialog dialog; - dlg = ui::Widget(gtk_color_selection_dialog_new( title )); + auto dlg = ui::Widget(gtk_color_selection_dialog_new( title )); gtk_color_selection_set_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &clr ); dlg.connect( "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog ); GtkWidget *ok_button, *cancel_button; diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index 2e01ca05..3195f8d3 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -957,13 +957,13 @@ void OpenBugReportURL(){ } -ui::Widget g_page_console; +ui::Widget g_page_console{ui::null}; void Console_ToggleShow(){ GroupDialog_showPage( g_page_console ); } -ui::Widget g_page_entity; +ui::Widget g_page_entity{ui::null}; void EntityInspector_ToggleShow(){ GroupDialog_showPage( g_page_entity ); @@ -1877,10 +1877,10 @@ void fill_view_xz_front_menu( ui::Menu menu ){ } -ui::Widget g_toggle_z_item; -ui::Widget g_toggle_console_item; -ui::Widget g_toggle_entity_item; -ui::Widget g_toggle_entitylist_item; +ui::Widget g_toggle_z_item{ui::null}; +ui::Widget g_toggle_console_item{ui::null}; +ui::Widget g_toggle_entity_item{ui::null}; +ui::Widget g_toggle_entitylist_item{ui::null}; ui::MenuItem create_view_menu( MainFrame::EViewStyle style ){ // View menu @@ -2511,7 +2511,7 @@ ui::Window MainFrame_getWindow() std::vector g_floating_windows; -MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusTextCaller( *this ) ){ +MainFrame::MainFrame() : m_idleRedrawStatusText( RedrawStatusTextCaller( *this ) ){ m_pXYWnd = 0; m_pCamWnd = 0; m_pZWnd = 0; @@ -2519,9 +2519,8 @@ MainFrame::MainFrame() : m_window( 0 ), m_idleRedrawStatusText( RedrawStatusText m_pXZWnd = 0; m_pActiveXY = 0; - for ( int n = 0; n < c_count_status; n++ ) - { - m_pStatusLabel[n] = ui::Label(ui::null); + for (auto &n : m_pStatusLabel) { + n = ui::Label{ui::null}; } m_bSleeping = false; @@ -2758,7 +2757,7 @@ void MainFrame::Create(){ } gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 ); - ui::Widget main_statusbar = create_main_statusbar( m_pStatusLabel ); + ui::Widget main_statusbar = create_main_statusbar(reinterpret_cast(m_pStatusLabel)); gtk_box_pack_end( GTK_BOX( vbox ), main_statusbar, FALSE, TRUE, 2 ); GroupDialog_constructWindow( window ); @@ -2791,7 +2790,7 @@ void MainFrame::Create(){ if ( CurrentStyle() == eRegular || CurrentStyle() == eRegularLeft ) { { - ui::Widget vsplit = ui::VPaned(); + ui::Widget vsplit = ui::VPaned(ui::New); m_vSplit = vsplit; gtk_box_pack_start( GTK_BOX( vbox ), vsplit, TRUE, TRUE, 0 ); vsplit.show(); @@ -2801,7 +2800,7 @@ void MainFrame::Create(){ gtk_paned_pack2( GTK_PANED( vsplit ), console_window, FALSE, TRUE ); { - ui::Widget hsplit = ui::HPaned(); + ui::Widget hsplit = ui::HPaned(ui::New); hsplit.show(); m_hSplit = hsplit; gtk_paned_add1( GTK_PANED( vsplit ), hsplit ); @@ -2812,7 +2811,7 @@ void MainFrame::Create(){ ui::Widget xy_window = ui::Widget(GTK_WIDGET( create_framed_widget( m_pXYWnd->GetWidget() ) )); { - ui::Widget vsplit2 = ui::VPaned(); + ui::Widget vsplit2 = ui::VPaned(ui::New); vsplit2.show(); m_vSplit2 = vsplit2; diff --git a/radiant/mainframe.h b/radiant/mainframe.h index 27d09c01..2c003af4 100644 --- a/radiant/mainframe.h +++ b/radiant/mainframe.h @@ -59,7 +59,7 @@ enum EViewStyle MainFrame(); ~MainFrame(); -ui::Window m_window; +ui::Window m_window{ui::null}; CopiedString m_command_status; CopiedString m_position_status; @@ -72,9 +72,9 @@ void Create(); void SaveWindowInfo(); void Shutdown(); -ui::Widget m_vSplit; -ui::Widget m_hSplit; -ui::Widget m_vSplit2; +ui::Widget m_vSplit{ui::null}; +ui::Widget m_hSplit{ui::null}; +ui::Widget m_vSplit2{ui::null}; XYWnd* m_pXYWnd; XYWnd* m_pYZWnd; @@ -85,7 +85,7 @@ XYWnd* m_pActiveXY; bool m_bSleeping; -ui::Widget m_pStatusLabel[c_count_status]; +void *m_pStatusLabel[c_count_status]; EViewStyle m_nCurrentStyle; diff --git a/radiant/map.cpp b/radiant/map.cpp index 42f8a706..33dcebe9 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -763,8 +763,8 @@ WindowPosition g_posMapInfoWnd( c_default_window_pos ); void DoMapInfo(){ ModalDialog dialog; - ui::Entry brushes_entry; - ui::Entry entities_entry; + ui::Entry brushes_entry{ui::null}; + ui::Entry entities_entry{ui::null}; ui::ListStore EntityBreakdownWalker{ui::null}; ui::Window window = MainFrame_getWindow().create_dialog_window("Map Info", G_CALLBACK(dialog_delete_callback ), &dialog ); @@ -784,7 +784,7 @@ void DoMapInfo(){ gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 ); { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -794,7 +794,7 @@ void DoMapInfo(){ brushes_entry = entry; } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -847,14 +847,14 @@ void DoMapInfo(){ gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE ); { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "Entity", renderer, {{"text", 0}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_column_set_sort_column_id( column, 0 ); } { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "Count", renderer, {{"text", 1}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); gtk_tree_view_column_set_sort_column_id( column, 1 ); @@ -2036,12 +2036,12 @@ static void GetSelectionIndex( int *ent, int *brush ){ void DoFind(){ ModalDialog dialog; - ui::Entry entity; - ui::Entry brush; + ui::Entry entity{ui::null}; + ui::Entry brush{ui::null}; ui::Window window = MainFrame_getWindow().create_dialog_window("Find Brush", G_CALLBACK(dialog_delete_callback ), &dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); { @@ -2065,7 +2065,7 @@ void DoFind(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -2074,7 +2074,7 @@ void DoFind(){ entity = entry; } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index 0d8b2276..da5e2283 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -607,7 +607,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); } { - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( *GTK_COMBO_BOX(combo), m_nRow ); @@ -620,7 +620,7 @@ ui::Window PatchInspector::BuildDialog(){ } { - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); combo.connect( "changed", G_CALLBACK( OnSelchangeComboColRow ), this ); AddDialogData( *GTK_COMBO_BOX(combo), m_nCol ); @@ -673,7 +673,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 0, 1, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -683,7 +683,7 @@ ui::Window PatchInspector::BuildDialog(){ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -693,7 +693,7 @@ ui::Window PatchInspector::BuildDialog(){ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -703,7 +703,7 @@ ui::Window PatchInspector::BuildDialog(){ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 3, 4, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -713,7 +713,7 @@ ui::Window PatchInspector::BuildDialog(){ entry.connect( "key_press_event", G_CALLBACK( OnDialogKey ), 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 4, 5, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -764,7 +764,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 1, 2, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -780,7 +780,7 @@ ui::Window PatchInspector::BuildDialog(){ (GtkAttachOptions)( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 1, 2, 2, 3, (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ), @@ -809,7 +809,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); // gtk_editable_set_editable (GTK_ENTRY (entry), false); entry.show(); gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); @@ -882,7 +882,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 0, 1, (GtkAttachOptions)( GTK_FILL ), @@ -906,7 +906,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_can_focus( spin, false ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 1, 2, (GtkAttachOptions)( GTK_FILL ), @@ -927,7 +927,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_can_focus( spin, false ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 2, 3, (GtkAttachOptions)( GTK_FILL ), @@ -948,7 +948,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_can_focus( spin, false ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 3, 4, (GtkAttachOptions)( GTK_FILL ), @@ -969,7 +969,7 @@ ui::Window PatchInspector::BuildDialog(){ gtk_widget_set_can_focus( spin, false ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( table, GTK_WIDGET( entry ), 0, 1, 4, 5, (GtkAttachOptions)( GTK_FILL ), diff --git a/radiant/patchmanip.cpp b/radiant/patchmanip.cpp index 6d6a5c4d..9c85927f 100644 --- a/radiant/patchmanip.cpp +++ b/radiant/patchmanip.cpp @@ -850,7 +850,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, ui::Window window = MainFrame_getWindow().create_dialog_window("Patch density", G_CALLBACK(dialog_delete_callback ), &dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); window.add_accel_group( accel ); { @@ -877,7 +877,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, } { - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); #define D_ITEM( x ) if ( x >= mincols && ( !maxcols || x <= maxcols ) ) gtk_combo_box_text_append_text( combo, # x ) D_ITEM( 3 ); D_ITEM( 5 ); @@ -903,7 +903,7 @@ void DoNewPatchDlg( EPatchPrefab prefab, int minrows, int mincols, int defrows, width = combo; } { - auto combo = ui::ComboBoxText(); + auto combo = ui::ComboBoxText(ui::New); #define D_ITEM( x ) if ( x >= minrows && ( !maxrows || x <= maxrows ) ) gtk_combo_box_text_append_text( combo, # x ) D_ITEM( 3 ); D_ITEM( 5 ); @@ -969,15 +969,15 @@ EMessageBoxReturn DoCapDlg( ECapDialog* type ){ ModalDialog dialog; ModalDialogButton ok_button( dialog, eIDOK ); ModalDialogButton cancel_button( dialog, eIDCANCEL ); - ui::Widget bevel; - ui::Widget ibevel; - ui::Widget endcap; - ui::Widget iendcap; - ui::Widget cylinder; + ui::Widget bevel{ui::null}; + ui::Widget ibevel{ui::null}; + ui::Widget endcap{ui::null}; + ui::Widget iendcap{ui::null}; + ui::Widget cylinder{ui::null}; ui::Window window = MainFrame_getWindow().create_modal_dialog_window( "Cap", dialog ); - auto accel_group = ui::AccelGroup(); + auto accel_group = ui::AccelGroup(ui::New); window.add_accel_group( accel_group ); { diff --git a/radiant/pluginmenu.cpp b/radiant/pluginmenu.cpp index e2af3b97..69e5c084 100644 --- a/radiant/pluginmenu.cpp +++ b/radiant/pluginmenu.cpp @@ -43,7 +43,7 @@ void plugin_activated( ui::Widget widget, gpointer data ){ #include void PlugInMenu_Add( ui::Menu plugin_menu, IPlugIn* pPlugIn ){ - ui::Widget item, parent; + ui::Widget item{ui::null}, parent{ui::null}; ui::Menu menu{ui::null}, subMenu{ui::null}; const char *menuText, *menuCommand; std::stack menuStack; @@ -54,7 +54,7 @@ void PlugInMenu_Add( ui::Menu plugin_menu, IPlugIn* pPlugIn ){ std::size_t nCount = pPlugIn->getCommandCount(); if ( nCount > 0 ) { - menu = ui::Menu(); + menu = ui::Menu(ui::New); if ( g_Layout_enableDetachableMenus.m_value ) { menu_tearoff( menu ); } @@ -80,7 +80,7 @@ void PlugInMenu_Add( ui::Menu plugin_menu, IPlugIn* pPlugIn ){ item.show(); menu.add(item); - subMenu = ui::Menu(); + subMenu = ui::Menu(ui::New); gtk_menu_item_set_submenu( GTK_MENU_ITEM( item ), subMenu ); menuStack.push( menu ); menu = subMenu; diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index ba5e75cb..6c556238 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -547,7 +547,7 @@ static void treeSelection( GtkTreeSelection* selection, gpointer data ){ GtkTreeModel* model; GtkTreeIter selected; if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) { - ui::Widget prefpage; + ui::Widget prefpage{ui::null}; gtk_tree_model_get( model, &selected, 1, (gpointer*)&prefpage, -1 ); dlg->showPrefPage( prefpage ); } @@ -715,7 +715,7 @@ ui::Window PrefsDlg::BuildDialog(){ hbox.show(); { - auto sc_win = ui::ScrolledWindow(); + auto sc_win = ui::ScrolledWindow(ui::New); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( sc_win ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); gtk_box_pack_start( GTK_BOX( hbox ), sc_win, FALSE, FALSE, 0 ); sc_win.show(); @@ -736,7 +736,7 @@ ui::Window PrefsDlg::BuildDialog(){ gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE ); { - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); GtkTreeViewColumn* column = ui::TreeViewColumn( "Preferences", renderer, {{"text", 0}} ); gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column ); } diff --git a/radiant/preferences.h b/radiant/preferences.h index 8ece483f..0f6804f7 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -328,7 +328,7 @@ std::list mGames; public: -ui::Widget m_notebook; +ui::Widget m_notebook{ui::null}; virtual ~PrefsDlg(){ g_string_free( m_rc_path, true ); diff --git a/radiant/select.cpp b/radiant/select.cpp index 5a36f5a4..20c6f730 100644 --- a/radiant/select.cpp +++ b/radiant/select.cpp @@ -912,7 +912,7 @@ void DoRotateDlg(){ if ( !g_rotate_dialog.window ) { g_rotate_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary rotation", G_CALLBACK(rotatedlg_delete ), &g_rotate_dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); g_rotate_dialog.window.add_accel_group( accel ); { @@ -1016,9 +1016,9 @@ void DoRotateDlg(){ struct ScaleDialog { - ui::Entry x; - ui::Entry y; - ui::Entry z; + ui::Entry x{ui::null}; + ui::Entry y{ui::null}; + ui::Entry z{ui::null}; ui::Window window{ui::null}; }; @@ -1065,7 +1065,7 @@ void DoScaleDlg(){ if ( !g_scale_dialog.window ) { g_scale_dialog.window = MainFrame_getWindow().create_dialog_window("Arbitrary scale", G_CALLBACK(scaledlg_delete ), &g_scale_dialog ); - auto accel = ui::AccelGroup(); + auto accel = ui::AccelGroup(ui::New); g_scale_dialog.window.add_accel_group( accel ); { @@ -1096,7 +1096,7 @@ void DoScaleDlg(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.text("1.0"); entry.show(); gtk_table_attach( table, entry, 1, 2, 0, 1, @@ -1106,7 +1106,7 @@ void DoScaleDlg(){ g_scale_dialog.x = entry; } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.text("1.0"); entry.show(); gtk_table_attach( table, entry, 1, 2, 1, 2, @@ -1116,7 +1116,7 @@ void DoScaleDlg(){ g_scale_dialog.y = entry; } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.text("1.0"); entry.show(); gtk_table_attach( table, entry, 1, 2, 2, 3, diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 24e35890..b6437186 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -174,7 +174,7 @@ Increment m_vshiftIncrement; Increment m_hscaleIncrement; Increment m_vscaleIncrement; Increment m_rotateIncrement; -ui::Entry m_texture; +ui::Entry m_texture{ui::null}; SurfaceInspector() : m_textureEntry( ApplyShaderCaller( *this ), UpdateCaller( *this ) ), @@ -609,7 +609,7 @@ ui::Window SurfaceInspector::BuildDialog(){ gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_box_pack_start( GTK_BOX( hbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); m_texture = entry; @@ -652,7 +652,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 0, 1, (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), @@ -688,7 +688,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 1, 2, (GtkAttachOptions) ( GTK_FILL ), @@ -724,7 +724,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 2, 3 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 2, 3, (GtkAttachOptions) ( GTK_FILL ), @@ -760,7 +760,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 3, 4, (GtkAttachOptions) ( GTK_FILL ), @@ -797,7 +797,7 @@ ui::Window SurfaceInspector::BuildDialog(){ (GtkAttachOptions) ( 0 ), 0, 0 ); } { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 4, 5, (GtkAttachOptions) ( GTK_FILL ), @@ -1022,7 +1022,7 @@ ui::Window SurfaceInspector::BuildDialog(){ frame.add(vbox3); { - auto entry = ui::Entry(); + auto entry = ui::Entry(ui::New); entry.show(); gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 ); m_valueEntryWidget = entry; diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index 6961bf39..03b141ae 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -258,19 +258,19 @@ CopiedString shader; ui::Window m_parent{ui::null}; ui::GLArea m_gl_widget{ui::null}; -ui::Widget m_texture_scroll; -ui::Widget m_treeViewTree; -ui::Widget m_treeViewTags; +ui::Widget m_texture_scroll{ui::null}; +ui::Widget m_treeViewTree{ui::null}; +ui::Widget m_treeViewTags{ui::null}; ui::Frame m_tag_frame{ui::null}; ui::ListStore m_assigned_store{ui::null}; ui::ListStore m_available_store{ui::null}; -ui::Widget m_assigned_tree; -ui::Widget m_available_tree; -ui::Widget m_scr_win_tree; -ui::Widget m_scr_win_tags; -ui::Widget m_tag_notebook; +ui::Widget m_assigned_tree{ui::null}; +ui::Widget m_available_tree{ui::null}; +ui::Widget m_scr_win_tree{ui::null}; +ui::Widget m_scr_win_tags{ui::null}; +ui::Widget m_tag_notebook{ui::null}; ui::Button m_search_button{ui::null}; -ui::Widget m_shader_info_item; +ui::Widget m_shader_info_item{ui::null}; std::set m_all_tags; ui::ListStore m_all_tags_list{ui::null}; @@ -738,7 +738,7 @@ void visit( const char* name ){ void TextureBrowser_SetHideUnused( TextureBrowser& textureBrowser, bool hideUnused ); -ui::Widget g_page_textures; +ui::Widget g_page_textures{ui::null}; void TextureBrowser_toggleShow(){ GroupDialog_showPage( g_page_textures ); @@ -1587,13 +1587,13 @@ void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeV } void TextureBrowser_createTreeViewTree(){ - g_TextureBrowser.m_treeViewTree = ui::TreeView(); + g_TextureBrowser.m_treeViewTree = ui::TreeView(ui::New); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), FALSE ); g_TextureBrowser.m_treeViewTree.connect( "row-activated", (GCallback) TreeView_onRowActivated, NULL ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), -1, "", renderer, "text", 0, NULL ); TextureBrowser_constructTreeStore(); @@ -1604,7 +1604,7 @@ void TextureBrowser_renameTag(); void TextureBrowser_deleteTag(); void TextureBrowser_createContextMenu( ui::Widget treeview, GdkEventButton *event ){ - ui::Widget menu = ui::Menu(); + ui::Widget menu = ui::Menu(ui::New); ui::Widget menuitem = ui::MenuItem( "Add tag" ); menuitem.connect( "activate", (GCallback)TextureBrowser_addTag, treeview ); @@ -1643,14 +1643,14 @@ gboolean TreeViewTags_onButtonPressed( ui::Widget treeview, GdkEventButton *even } void TextureBrowser_createTreeViewTags(){ - g_TextureBrowser.m_treeViewTags = ui::TreeView(); + g_TextureBrowser.m_treeViewTags = ui::TreeView(ui::New); gtk_tree_view_set_enable_search( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE ); g_TextureBrowser.m_treeViewTags.connect( "button-press-event", (GCallback)TreeViewTags_onButtonPressed, NULL ); gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), FALSE ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), -1, "", renderer, "text", 0, NULL ); TextureBrowser_constructTreeStoreTags(); @@ -1940,7 +1940,7 @@ void TextureBrowser_constructTagNotebook(){ void TextureBrowser_constructSearchButton(){ ui::Widget image = ui::Widget(gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR )); - g_TextureBrowser.m_search_button = ui::Button(); + g_TextureBrowser.m_search_button = ui::Button(ui::New); g_TextureBrowser.m_search_button.connect( "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL ); gtk_widget_set_tooltip_text(g_TextureBrowser.m_search_button, "Search with selected tags"); g_TextureBrowser.m_search_button.add(image); @@ -2008,21 +2008,21 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_parent = toplevel; ui::Widget table = ui::Table( 3, 3, FALSE ); - ui::Widget frame_table; + ui::Widget frame_table{ui::null}; ui::Widget vbox = ui::VBox( FALSE, 0 ); gtk_table_attach( GTK_TABLE( table ), vbox, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); vbox.show(); - ui::Widget menu_bar; + ui::Widget menu_bar{ui::null}; { // menu bar menu_bar = ui::Widget(gtk_menu_bar_new()); - auto menu_view = ui::Menu(); + auto menu_view = ui::Menu(ui::New); auto view_item = TextureBrowser_constructViewMenu( menu_view ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( view_item ), menu_view ); gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), view_item ); - auto menu_tools = ui::Menu(); + auto menu_tools = ui::Menu(ui::New); auto tools_item = TextureBrowser_constructToolsMenu( menu_tools ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools_item ), menu_tools ); gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tools_item ); @@ -2031,7 +2031,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ menu_bar.show(); } { // Texture TreeView - g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(); + g_TextureBrowser.m_scr_win_tree = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tree ), 0 ); // vertical only scrolling for treeview @@ -2085,13 +2085,13 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ TextureBrowser_buildTagList(); } { // tag menu bar - auto menu_tags = ui::Menu(); + auto menu_tags = ui::Menu(ui::New); auto tags_item = TextureBrowser_constructTagsMenu( menu_tags ); gtk_menu_item_set_submenu( GTK_MENU_ITEM( tags_item ), menu_tags ); gtk_menu_shell_append( GTK_MENU_SHELL( menu_bar ), tags_item ); } { // Tag TreeView - g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow(); + g_TextureBrowser.m_scr_win_tags = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( g_TextureBrowser.m_scr_win_tags ), 0 ); // vertical only scrolling for treeview @@ -2127,7 +2127,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ g_TextureBrowser.m_tag_frame.add(frame_table); } { // assigned tag list - ui::Widget scrolled_win = ui::ScrolledWindow(); + ui::Widget scrolled_win = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); @@ -2136,7 +2136,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_assigned_store ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) )); g_TextureBrowser.m_assigned_store.unref(); @@ -2156,7 +2156,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 0, 1, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } { // available tag list - ui::Widget scrolled_win = ui::ScrolledWindow(); + ui::Widget scrolled_win = ui::ScrolledWindow(ui::New); gtk_container_set_border_width( GTK_CONTAINER( scrolled_win ), 0 ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); @@ -2164,7 +2164,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ GtkTreeSortable* sortable = GTK_TREE_SORTABLE( g_TextureBrowser.m_available_store ); gtk_tree_sortable_set_sort_column_id( sortable, TAG_COLUMN, GTK_SORT_ASCENDING ); - auto renderer = ui::CellRendererText(); + auto renderer = ui::CellRendererText(ui::New); g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) )); g_TextureBrowser.m_available_store.unref(); @@ -2184,8 +2184,8 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_table_attach( GTK_TABLE( frame_table ), scrolled_win, 2, 3, 1, 3, GTK_FILL, GTK_FILL, 0, 0 ); } { // tag arrow buttons - auto m_btn_left = ui::Button(); - auto m_btn_right = ui::Button(); + auto m_btn_left = ui::Button(ui::New); + auto m_btn_right = ui::Button(ui::New); auto m_arrow_left = ui::Widget(gtk_arrow_new( GTK_ARROW_LEFT, GTK_SHADOW_OUT )); auto m_arrow_right = ui::Widget(gtk_arrow_new( GTK_ARROW_RIGHT, GTK_SHADOW_OUT )); m_btn_left.add(m_arrow_left); diff --git a/radiant/treemodel.cpp b/radiant/treemodel.cpp index 9e1f20cf..d5a7a54a 100644 --- a/radiant/treemodel.cpp +++ b/radiant/treemodel.cpp @@ -881,7 +881,7 @@ static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTree ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" ); GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph; - GtkTreePath* path = ui::TreePath(); + GtkTreePath* path = ui::TreePath(ui::New); for ( GraphTreeNode* node = ( *graph_iterator_read_tree_iter( iter ) ).second; node != graph; node = node->m_parent ) { diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index 454387bd..61a7a021 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -1112,7 +1112,7 @@ void pushMenu( const CopiedString& name ){ item.show(); m_stack.back().first.add(item); - auto submenu = ui::Menu(); + auto submenu = ui::Menu(ui::New); gtk_menu_item_set_submenu( item, GTK_WIDGET( submenu ) ); m_stack.push_back( MenuPair( submenu, name ) ); @@ -1155,7 +1155,7 @@ void XYWnd::OnContextMenu(){ } if ( !m_mnuDrop ) { // first time, load it up - auto menu = m_mnuDrop = ui::Menu(); + auto menu = m_mnuDrop = ui::Menu(ui::New); EntityClassMenuInserter inserter( menu ); GlobalEntityClassManager().forEach( inserter );