]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/patchdialog.cpp
Implement buffer operations
[xonotic/netradiant.git] / radiant / patchdialog.cpp
index 70cf3f8c6b4904ec7fab6e7bb6ea1cd739482011..1faadd93ff00473673bb91a6bac84adb84491b91 100644 (file)
@@ -160,7 +160,7 @@ public:
 ui::CheckButton m_enabled;
 ui::Entry m_horizontal;
 ui::Entry m_vertical;
-Subdivisions() : m_enabled( (GtkCheckButton *) 0 ), m_horizontal( nullptr ), m_vertical( nullptr ){
+Subdivisions() : m_enabled( (GtkCheckButton *) 0 ), m_horizontal( ui::null ), m_vertical( ui::null ){
 }
 void update(){
        PatchFixedSubdivisions subdivisions;
@@ -176,8 +176,8 @@ void update(){
        }
        else
        {
-               gtk_entry_set_text( m_horizontal, "" );
-               gtk_entry_set_text( m_vertical, "" );
+               m_horizontal.text("");
+               m_vertical.text("");
                gtk_widget_set_sensitive( GTK_WIDGET( m_horizontal ), FALSE );
                gtk_widget_set_sensitive( GTK_WIDGET( m_vertical ), FALSE );
        }
@@ -226,8 +226,8 @@ float m_fZ;
    float       m_fVShift; */
 int m_nCol;
 int m_nRow;
-ui::ComboBoxText m_pRowCombo{nullptr};
-ui::ComboBoxText m_pColCombo{nullptr};
+ui::ComboBoxText m_pRowCombo{ui::null};
+ui::ComboBoxText m_pColCombo{ui::null};
 std::size_t m_countRows;
 std::size_t m_countCols;
 
@@ -256,7 +256,7 @@ PatchInspector() :
 }
 
 bool visible(){
-       return gtk_widget_get_visible( GetWidget() );
+       return GetWidget().visible();
 }
 
 //  void UpdateInfo();
@@ -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 ),
@@ -1079,8 +1079,8 @@ void PatchInspector::GetPatchInfo(){
                        m_countRows = m_Patch->getHeight();
                        for ( std::size_t i = 0; i < m_countRows; ++i )
                        {
-                               char buffer[16];
-                               sprintf( buffer, "%u", Unsigned( i ) );
+                               auto buffer = u::buffer<16>();
+                               buffer.sprintf( "%u", Unsigned( i ) );
                                gtk_combo_box_text_append_text( m_pRowCombo, buffer );
                        }
 
@@ -1098,8 +1098,8 @@ void PatchInspector::GetPatchInfo(){
                        m_countCols = m_Patch->getWidth();
                        for ( std::size_t i = 0; i < m_countCols; ++i )
                        {
-                               char buffer[16];
-                               sprintf( buffer, "%u", Unsigned( i ) );
+                               auto buffer = u::buffer<16>();
+                               buffer.sprintf( "%u", Unsigned( i ) );
                                gtk_combo_box_text_append_text( m_pColCombo, buffer );
                        }