]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/surfacedialog.cpp
Wrap GtkAccelGroup
[xonotic/netradiant.git] / radiant / surfacedialog.cpp
index ac02d7fd89136301e56f7afaccf41319eed11cd6..f1597159bd779b686e500c849b5eb19e6d6aa281 100644 (file)
@@ -89,18 +89,18 @@ namespace TexTool
 {
 
 //Shamus: Textool function prototypes
-gboolean size_allocate( GtkWidget *, GtkAllocation *, gpointer );
-gboolean expose( GtkWidget *, GdkEventExpose *, gpointer );
-gboolean button_press( GtkWidget *, GdkEventButton *, gpointer );
-gboolean button_release( GtkWidget *, GdkEventButton *, gpointer );
-gboolean motion( GtkWidget *, GdkEventMotion *, gpointer );
+gboolean size_allocate( ui::Widget, GtkAllocation *, gpointer );
+gboolean expose( ui::Widget, GdkEventExpose *, gpointer );
+gboolean button_press( ui::Widget, GdkEventButton *, gpointer );
+gboolean button_release( ui::Widget, GdkEventButton *, gpointer );
+gboolean motion( ui::Widget, GdkEventMotion *, gpointer );
 void flipX( GtkToggleButton *, gpointer );
 void flipY( GtkToggleButton *, gpointer );
 
 //End Textool function prototypes
 
 //Shamus: Textool globals
-GtkWidget * g_textoolWin;
+ui::Widget g_textoolWin;
 //End Textool globals
 
 void queueDraw(){
@@ -145,7 +145,7 @@ void SurfaceInspector_GridChange();
 
 class SurfaceInspector : public Dialog
 {
-GtkWindow* BuildDialog();
+ui::Window BuildDialog();
 
 NonModalEntry m_textureEntry;
 NonModalSpinner m_hshiftSpinner;
@@ -208,7 +208,7 @@ SurfaceInspector() :
        m_positionTracker.setPosition( c_default_window_pos );
 }
 
-void constructWindow( GtkWindow* main_window ){
+void constructWindow( ui::Window main_window ){
        m_parent = main_window;
        Create();
        AddGridChangeCallback( FreeCaller<SurfaceInspector_GridChange>() );
@@ -217,7 +217,7 @@ void destroyWindow(){
        Destroy();
 }
 bool visible() const {
-       return GTK_WIDGET_VISIBLE( const_cast<GtkWindow*>( GetWidget() ) );
+       return GTK_WIDGET_VISIBLE( GetWidget() );
 }
 void queueDraw(){
        if ( visible() ) {
@@ -245,7 +245,7 @@ inline SurfaceInspector& getSurfaceInspector(){
 }
 }
 
-void SurfaceInspector_constructWindow( GtkWindow* main_window ){
+void SurfaceInspector_constructWindow( ui::Window main_window ){
        getSurfaceInspector().constructWindow( main_window );
 }
 void SurfaceInspector_destroyWindow(){
@@ -258,7 +258,7 @@ void SurfaceInspector_queueDraw(){
 
 namespace
 {
-CopiedString g_selectedShader;
+std::string g_selectedShader;
 TextureProjection g_selectedTexdef;
 ContentsFlagsValue g_selectedFlags;
 size_t g_selectedShaderSize[2];
@@ -312,7 +312,7 @@ void SurfaceInspector_SetCurrent_FromSelected(){
                        g_selectedTexdef.m_brushprimit_texdef.coords[0][2] = float_mod( g_selectedTexdef.m_brushprimit_texdef.coords[0][2], (float)g_selectedShaderSize[0] );
                        g_selectedTexdef.m_brushprimit_texdef.coords[1][2] = float_mod( g_selectedTexdef.m_brushprimit_texdef.coords[1][2], (float)g_selectedShaderSize[1] );
 
-                       CopiedString name;
+                       std::string name;
                        Scene_BrushGetShader_Component_Selected( GlobalSceneGraph(), name );
                        if ( string_not_empty( name.c_str() ) ) {
                                SurfaceInspector_SetSelectedShader( name.c_str() );
@@ -328,7 +328,7 @@ void SurfaceInspector_SetCurrent_FromSelected(){
                        Scene_BrushGetTexdef_Selected( GlobalSceneGraph(), projection );
                        SurfaceInspector_SetSelectedTexdef( projection );
 
-                       CopiedString name;
+                       std::string name;
                        Scene_BrushGetShader_Selected( GlobalSceneGraph(), name );
                        if ( string_empty( name.c_str() ) ) {
                                Scene_PatchGetShader_Selected( GlobalSceneGraph(), name );
@@ -400,7 +400,7 @@ void SurfaceInspector_GridChange(){
 // we move the textures in pixels, not world units. (i.e. increment values are in pixel)
 // depending on the texture scale it doesn't take the same amount of pixels to move of GetGridSize()
 // increment * scale = gridsize
-static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
+static void OnBtnMatchGrid( ui::Widget widget, gpointer data ){
        float hscale, vscale;
        hscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_hscaleIncrement.m_spin ) );
        vscale = static_cast<float>( gtk_spin_button_get_value_as_float( getSurfaceInspector().m_vscaleIncrement.m_spin ) );
@@ -417,7 +417,7 @@ static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
 // or update it because something new has been selected
 // Shamus: It does get called when the SI is hidden, but not when you select something new. ;-)
 void DoSurface( void ){
-       if ( getSurfaceInspector().GetWidget() == 0 ) {
+       if ( !getSurfaceInspector().GetWidget() ) {
                getSurfaceInspector().Create();
 
        }
@@ -441,27 +441,23 @@ void SurfaceInspector_FitTexture(){
        Select_FitTexture( getSurfaceInspector().m_fitHorizontal, getSurfaceInspector().m_fitVertical );
 }
 
-static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
-       Scene_PatchCapTexture_Selected( GlobalSceneGraph() );
+static void OnBtnPatchdetails( ui::Widget widget, gpointer data ){
+       Patch_CapTexture();
 }
 
-static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
-       Scene_PatchNaturalTexture_Selected( GlobalSceneGraph() );
+static void OnBtnPatchnatural( ui::Widget widget, gpointer data ){
+       Patch_NaturalTexture();
 }
 
-static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
-       float fx, fy;
-
-       if ( DoTextureLayout( &fx, &fy ) == eIDOK ) {
-               Scene_PatchTileTexture_Selected( GlobalSceneGraph(), fx, fy );
-       }
+static void OnBtnPatchreset( ui::Widget widget, gpointer data ){
+       Patch_ResetTexture();
 }
 
-static void OnBtnPatchFit( GtkWidget *widget, gpointer data ){
-       Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 );
+static void OnBtnPatchFit( ui::Widget widget, gpointer data ){
+       Patch_FitTexture();
 }
 
-static void OnBtnAxial( GtkWidget *widget, gpointer data ){
+static void OnBtnAxial( ui::Widget widget, gpointer data ){
 //globalOutputStream() << "--> [OnBtnAxial]...\n";
        UndoableCommand undo( "textureDefault" );
        TextureProjection projection;
@@ -490,7 +486,7 @@ static void OnBtnAxial( GtkWidget *widget, gpointer data ){
        Select_SetTexdef( projection );
 }
 
-static void OnBtnFaceFit( GtkWidget *widget, gpointer data ){
+static void OnBtnFaceFit( ui::Widget widget, gpointer data ){
        getSurfaceInspector().exportData();
        SurfaceInspector_FitTexture();
 }
@@ -591,8 +587,8 @@ guint togglebutton_connect_toggled( GtkToggleButton* button, const Callback& cal
        return g_signal_connect_swapped( G_OBJECT( button ), "toggled", G_CALLBACK( callback.getThunk() ), callback.getEnvironment() );
 }
 
-GtkWindow* SurfaceInspector::BuildDialog(){
-       GtkWindow* window = create_floating_window( "Surface Inspector", m_parent );
+ui::Window SurfaceInspector::BuildDialog(){
+       ui::Window window = ui::Window(create_floating_window( "Surface Inspector", m_parent ));
 
        m_positionTracker.connect( window );
 
@@ -603,23 +599,23 @@ GtkWindow* SurfaceInspector::BuildDialog(){
 
        {
                // replaced by only the vbox:
-               GtkWidget* vbox = gtk_vbox_new( FALSE, 5 );
+               ui::Widget vbox = ui::VBox( FALSE, 5 );
                gtk_widget_show( vbox );
                gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( vbox ) );
                gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
 
                {
-                       GtkWidget* hbox2 = gtk_hbox_new( FALSE, 5 );
+                       ui::Widget hbox2 = ui::HBox( FALSE, 5 );
                        gtk_widget_show( hbox2 );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox2 ), FALSE, FALSE, 0 );
 
                        {
-                               GtkWidget* label = gtk_label_new( "Texture" );
+                               ui::Widget label = ui::Label( "Texture" );
                                gtk_widget_show( label );
                                gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_box_pack_start( GTK_BOX( hbox2 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                m_texture = entry;
@@ -630,13 +626,13 @@ GtkWindow* SurfaceInspector::BuildDialog(){
 
 
                {
-                       GtkWidget* table = gtk_table_new( 6, 4, FALSE );
+                       ui::Widget table = ui::Table( 6, 4, FALSE );
                        gtk_widget_show( table );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( table ), FALSE, FALSE, 0 );
                        gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
                        gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
                        {
-                               GtkWidget* label = gtk_label_new( "Horizontal shift" );
+                               ui::Widget label = ui::Label( "Horizontal shift" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
@@ -644,7 +640,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_hshiftIncrement.m_spin = spin;
                                m_hshiftSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
@@ -654,7 +650,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
@@ -662,7 +658,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 0, 1,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -672,7 +668,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                m_hshiftEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Vertical shift" );
+                               ui::Widget label = ui::Label( "Vertical shift" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
@@ -680,7 +676,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_vshiftIncrement.m_spin = spin;
                                m_vshiftSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
@@ -690,7 +686,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
@@ -698,7 +694,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 1, 2,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
@@ -708,7 +704,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                m_vshiftEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Horizontal stretch" );
+                               ui::Widget label = ui::Label( "Horizontal stretch" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
@@ -716,7 +712,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_hscaleIncrement.m_spin = spin;
                                m_hscaleSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
@@ -726,7 +722,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
@@ -734,7 +730,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 2, 3 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 2, 3,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
@@ -744,7 +740,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                m_hscaleEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Vertical stretch" );
+                               ui::Widget label = ui::Label( "Vertical stretch" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
@@ -752,7 +748,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 5 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 5 );
                                m_vscaleIncrement.m_spin = spin;
                                m_vscaleSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
@@ -762,7 +758,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_set_usize( GTK_WIDGET( spin ), 60, -2 );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
@@ -770,7 +766,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 3, 4,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
@@ -780,7 +776,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                m_vscaleEntry.connect( entry );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Rotate" );
+                               ui::Widget label = ui::Label( "Rotate" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
@@ -788,7 +784,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkSpinButton* spin = GTK_SPIN_BUTTON( gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 0 ) ), 0, 2 ) );
+                               GtkSpinButton* spin = ui::SpinButton( ui::Adjustment( 0, -8192, 8192, 2, 8, 0 ), 0, 2 );
                                m_rotateIncrement.m_spin = spin;
                                m_rotateSpinner.connect( spin );
                                gtk_widget_show( GTK_WIDGET( spin ) );
@@ -799,7 +795,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_spin_button_set_wrap( spin, TRUE );
                        }
                        {
-                               GtkWidget* label = gtk_label_new( "Step" );
+                               ui::Widget label = ui::Label( "Step" );
                                gtk_widget_show( label );
                                gtk_misc_set_alignment( GTK_MISC( label ), 0, 0 );
                                gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
@@ -807,7 +803,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                                  (GtkAttachOptions) ( 0 ), 0, 0 );
                        }
                        {
-                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                               GtkEntry* entry = ui::Entry();
                                gtk_widget_show( GTK_WIDGET( entry ) );
                                gtk_table_attach( GTK_TABLE( table ), GTK_WIDGET( entry ), 3, 4, 4, 5,
                                                                  (GtkAttachOptions) ( GTK_FILL ),
@@ -818,7 +814,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                        }
                        {
                                // match grid button
-                               GtkWidget* button = gtk_button_new_with_label( "Match Grid" );
+                               ui::Widget button = ui::Button( "Match Grid" );
                                gtk_widget_show( button );
                                gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
                                                                  (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -828,46 +824,46 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                }
 
                {
-                       GtkWidget* frame = gtk_frame_new( "Texturing" );
+                       ui::Widget frame = ui::Widget(gtk_frame_new( "Texturing" ));
                        gtk_widget_show( frame );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                        {
-                               GtkWidget* table = gtk_table_new( 4, 4, FALSE );
+                               ui::Widget table = ui::Table( 4, 4, FALSE );
                                gtk_widget_show( table );
                                gtk_container_add( GTK_CONTAINER( frame ), table );
                                gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
                                gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
                                gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
                                {
-                                       GtkWidget* label = gtk_label_new( "Brush" );
+                                       ui::Widget label = ui::Label( "Brush" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Patch" );
+                                       ui::Widget label = ui::Label( "Patch" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Width" );
+                                       ui::Widget label = ui::Label( "Width" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* label = gtk_label_new( "Height" );
+                                       ui::Widget label = ui::Label( "Height" );
                                        gtk_widget_show( label );
                                        gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
                                                                          (GtkAttachOptions) ( GTK_FILL ),
                                                                          (GtkAttachOptions) ( 0 ), 0, 0 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Axial" );
+                                       ui::Widget button = ui::Button( "Axial" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -877,7 +873,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Fit" );
+                                       ui::Widget button = ui::Button( "Fit" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -887,7 +883,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "CAP" );
+                                       ui::Widget button = ui::Button( "CAP" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -897,7 +893,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Set..." );
+                                       ui::Widget button = ui::Button( "Set..." );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -907,7 +903,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Natural" );
+                                       ui::Widget button = ui::Button( "Natural" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -917,7 +913,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       GtkWidget* button = gtk_button_new_with_label( "Fit" );
+                                       ui::Widget button = ui::Button( "Fit" );
                                        gtk_widget_show( button );
                                        gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -927,7 +923,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        gtk_widget_set_usize( button, 60, -2 );
                                }
                                {
-                                       GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
+                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
                                        gtk_widget_show( spin );
                                        gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -936,7 +932,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                        AddDialogData( *GTK_SPIN_BUTTON( spin ), m_fitHorizontal );
                                }
                                {
-                                       GtkWidget* spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 0, 1 << 16, 1, 10, 0 ) ), 0, 6 );
+                                       ui::Widget spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
                                        gtk_widget_show( spin );
                                        gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
                                                                          (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@@ -952,12 +948,12 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
                                        gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
                                        {
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 8, 4, FALSE ) );
+                                               GtkTable* table = ui::Table( 8, 4, FALSE );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
@@ -969,7 +965,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                {
                                                        for ( int r = 0; r != 8; ++r )
                                                        {
-                                                               GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( getSurfaceFlagName( c * 8 + r ) ) );
+                                                               GtkCheckButton* check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) );
                                                                gtk_widget_show( GTK_WIDGET( check ) );
                                                                gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -987,13 +983,13 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
                                        //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
                                        gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
                                        {
 
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 8, 4, FALSE ) );
+                                               GtkTable* table = ui::Table( 8, 4, FALSE );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 0 );
@@ -1005,7 +1001,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                                {
                                                        for ( int r = 0; r != 8; ++r )
                                                        {
-                                                               GtkCheckButton* check = GTK_CHECK_BUTTON( gtk_check_button_new_with_label( getContentFlagName( c * 8 + r ) ) );
+                                                               GtkCheckButton* check = ui::CheckButton( getContentFlagName( c * 8 + r ) );
                                                                gtk_widget_show( GTK_WIDGET( check ) );
                                                                gtk_table_attach( table, GTK_WIDGET( check ), c, c + 1, r, r + 1,
                                                                                                  (GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),
@@ -1026,13 +1022,13 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                gtk_widget_show( GTK_WIDGET( frame ) );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), TRUE, TRUE, 0 );
                                {
-                                       GtkVBox* vbox3 = GTK_VBOX( gtk_vbox_new( FALSE, 4 ) );
+                                       GtkVBox* vbox3 = ui::VBox( FALSE, 4 );
                                        gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
                                        gtk_widget_show( GTK_WIDGET( vbox3 ) );
                                        gtk_container_add( GTK_CONTAINER( frame ), GTK_WIDGET( vbox3 ) );
 
                                        {
-                                               GtkEntry* entry = GTK_ENTRY( gtk_entry_new() );
+                                               GtkEntry* entry = ui::Entry();
                                                gtk_widget_show( GTK_WIDGET( entry ) );
                                                gtk_box_pack_start( GTK_BOX( vbox3 ), GTK_WIDGET( entry ), TRUE, TRUE, 0 );
                                                m_valueEntryWidget = entry;
@@ -1045,7 +1041,7 @@ GtkWindow* SurfaceInspector::BuildDialog(){
 #if TEXTOOL_ENABLED
                if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
 // Shamus: Textool goodies...
-                       GtkWidget * frame = gtk_frame_new( "Textool" );
+                       ui::Widget frame = gtk_frame_new( "Textool" );
                        gtk_widget_show( frame );
                        gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( frame ), FALSE, FALSE, 0 );
                        {
@@ -1067,12 +1063,12 @@ GtkWindow* SurfaceInspector::BuildDialog(){
                                g_signal_connect( G_OBJECT( TexTool::g_textoolWin ), "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
                        }
                        {
-                               GtkWidget * hbox = gtk_hbox_new( FALSE, 5 );
+                               ui::Widget hbox = ui::HBox( FALSE, 5 );
                                gtk_widget_show( hbox );
                                gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( hbox ), FALSE, FALSE, 0 );
                                // Checkboxes go here... (Flip X/Y)
-                               GtkWidget * flipX = gtk_check_button_new_with_label( "Flip X axis" );
-                               GtkWidget * flipY = gtk_check_button_new_with_label( "Flip Y axis" );
+                               ui::Widget flipX = ui::CheckButton( "Flip X axis" );
+                               ui::Widget flipY = ui::CheckButton( "Flip Y axis" );
                                gtk_widget_show( flipX );
                                gtk_widget_show( flipY );
                                gtk_box_pack_start( GTK_BOX( hbox ), flipX, FALSE, FALSE, 0 );
@@ -1258,12 +1254,12 @@ void SurfaceInspector::ApplyFlags(){
 }
 
 
-void Face_getTexture( Face& face, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
+void Face_getTexture( Face& face, std::string& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
        shader = face.GetShader();
        face.GetTexdef( projection );
        flags = face.getShader().m_flags;
 }
-typedef Function4<Face&, CopiedString&, TextureProjection&, ContentsFlagsValue&, void, Face_getTexture> FaceGetTexture;
+typedef Function4<Face&, std::string&, TextureProjection&, ContentsFlagsValue&, void, Face_getTexture> FaceGetTexture;
 
 void Face_setTexture( Face& face, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){
        face.SetShader( shader );
@@ -1273,12 +1269,12 @@ void Face_setTexture( Face& face, const char* shader, const TextureProjection& p
 typedef Function4<Face&, const char*, const TextureProjection&, const ContentsFlagsValue&, void, Face_setTexture> FaceSetTexture;
 
 
-void Patch_getTexture( Patch& patch, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
+void Patch_getTexture( Patch& patch, std::string& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
        shader = patch.GetShader();
        projection = TextureProjection( texdef_t(), brushprimit_texdef_t(), Vector3( 0, 0, 0 ), Vector3( 0, 0, 0 ) );
        flags = ContentsFlagsValue( 0, 0, 0, false );
 }
-typedef Function4<Patch&, CopiedString&, TextureProjection&, ContentsFlagsValue&, void, Patch_getTexture> PatchGetTexture;
+typedef Function4<Patch&, std::string&, TextureProjection&, ContentsFlagsValue&, void, Patch_getTexture> PatchGetTexture;
 
 void Patch_setTexture( Patch& patch, const char* shader, const TextureProjection& projection, const ContentsFlagsValue& flags ){
        patch.SetShader( shader );
@@ -1286,7 +1282,7 @@ void Patch_setTexture( Patch& patch, const char* shader, const TextureProjection
 typedef Function4<Patch&, const char*, const TextureProjection&, const ContentsFlagsValue&, void, Patch_setTexture> PatchSetTexture;
 
 
-typedef Callback3<CopiedString&, TextureProjection&, ContentsFlagsValue&> GetTextureCallback;
+typedef Callback3<std::string&, TextureProjection&, ContentsFlagsValue&> GetTextureCallback;
 typedef Callback3<const char*, const TextureProjection&, const ContentsFlagsValue&> SetTextureCallback;
 
 struct Texturable
@@ -1378,7 +1374,7 @@ Texturable Scene_getClosestTexturable( scene::Graph& graph, SelectionTest& test
        return texturable;
 }
 
-bool Scene_getClosestTexture( scene::Graph& graph, SelectionTest& test, CopiedString& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
+bool Scene_getClosestTexture( scene::Graph& graph, SelectionTest& test, std::string& shader, TextureProjection& projection, ContentsFlagsValue& flags ){
        Texturable texturable = Scene_getClosestTexturable( graph, test );
        if ( texturable.getTexture != GetTextureCallback() ) {
                texturable.getTexture( shader, projection, flags );
@@ -1419,7 +1415,7 @@ void TextureBrowser_SetSelectedShader( TextureBrowser& textureBrowser, const cha
 const char* TextureBrowser_GetSelectedShader( TextureBrowser& textureBrowser );
 
 void Scene_copyClosestTexture( SelectionTest& test ){
-       CopiedString shader;
+       std::string shader;
        if ( Scene_getClosestTexture( GlobalSceneGraph(), test, shader, g_faceTextureClipboard.m_projection, g_faceTextureClipboard.m_flags ) ) {
                TextureBrowser_SetSelectedShader( g_TextureBrowser, shader.c_str() );
        }
@@ -1881,14 +1877,14 @@ void focus(){
 //     << extents.maxX << ", " << extents.minY << ", " << extents.maxY << "\n";
 }
 
-gboolean size_allocate( GtkWidget * win, GtkAllocation * a, gpointer ){
+gboolean size_allocate( ui::Widget win, GtkAllocation * a, gpointer ){
        windowSize.x() = a->width;
        windowSize.y() = a->height;
        queueDraw();
        return false;
 }
 
-gboolean expose( GtkWidget * win, GdkEventExpose * e, gpointer ){
+gboolean expose( ui::Widget win, GdkEventExpose * e, gpointer ){
 //     globalOutputStream() << "--> Textool Window was exposed!\n";
 //     globalOutputStream() << "    (window width/height: " << cc << "/" << e->area.height << ")\n";
 
@@ -1987,7 +1983,7 @@ Vector2 trans;
 Vector2 trans2;
 Vector2 dragPoint;  // Defined in terms of window space (+x/-y)
 Vector2 oldTrans;
-gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_press( ui::Widget win, GdkEventButton * e, gpointer ){
 //     globalOutputStream() << "--> Textool button press...\n";
 
        if ( e->button == 1 ) {
@@ -2049,7 +2045,7 @@ gboolean button_press( GtkWidget * win, GdkEventButton * e, gpointer ){
        return false;
 }
 
-gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
+gboolean button_release( ui::Widget win, GdkEventButton * e, gpointer ){
 //     globalOutputStream() << "--> Textool button release...\n";
 
        if ( e->button == 1 ) {
@@ -2111,7 +2107,7 @@ gboolean button_release( GtkWidget * win, GdkEventButton * e, gpointer ){
    c[1] = ((float)(y))/((float)(m_rect.bottom-m_rect.top))*(m_Maxs[1]-m_Mins[1])+m_Mins[1];
    }
  */
-gboolean motion( GtkWidget * win, GdkEventMotion * e, gpointer ){
+gboolean motion( ui::Widget win, GdkEventMotion * e, gpointer ){
 //     globalOutputStream() << "--> Textool motion...\n";
 
        if ( lButtonDown ) {