-void SurfaceDlg::ShowDlg(){
- Dialog::ShowDlg();
- if ( GetWidget() == NULL ) {
- Create();
- }
- g_surfwin = GetWidget();
-}
-void SurfaceDlg::HideDlg(){
- g_surfwin = NULL;
- Dialog::HideDlg();
-}
-
-GtkWidget* SurfaceDlg::GetWidget(){
- return g_SurfaceTable.m_pfnGet_SI_Module_Widget();
-}
-
-// set default values for increments (shift scale and rot)
-// this is called by the prefs code if can't find the values
-void SurfaceDlg::InitDefaultIncrement( texdef_t *tex ){
- tex->SetName( "foo" );
- tex->shift[0] = 8;
- tex->shift[1] = 8;
- tex->scale[0] = 0.25;
- tex->scale[1] = 0.25;
- tex->rotate = 10;
-}
-
-void SurfaceDlg::BuildDialog(){
- GtkWidget *dlg, *vbox, *hbox2, *frame, *table, *label;
- GtkWidget *button, *entry, *spin;
-
- dlg = m_pWidget;
-
- load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posSurfaceWnd );
-
- gtk_window_set_title( GTK_WINDOW( dlg ), _( "Surface inspector" ) );
- //g_signal_connect (G_OBJECT (dlg), "delete_event", G_CALLBACK (OnCancel), NULL);
- // we catch 'Enter' and interpret is as OnDone
- gtk_signal_connect( GTK_OBJECT( dlg ), "key_press_event", GTK_SIGNAL_FUNC( OnDialogKey ), NULL );
- gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
-
- // replaced by only the vbox:
- vbox = gtk_vbox_new( FALSE, 5 );
- gtk_widget_show( vbox );
- gtk_container_add( GTK_CONTAINER( dlg ), vbox );
- gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
-
- hbox2 = gtk_hbox_new( FALSE, 5 );
- gtk_widget_show( hbox2 );
- gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
-
- label = gtk_label_new( _( "Texture" ) );
- gtk_widget_show( label );
- gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, TRUE, 0 );
-
- entry = gtk_entry_new();
- gtk_signal_connect( GTK_OBJECT( entry ), "key_press_event", GTK_SIGNAL_FUNC( OnTextureKey ), NULL );
- gtk_widget_show( entry );
- gtk_box_pack_start( GTK_BOX( hbox2 ), entry, TRUE, TRUE, 0 );
- g_object_set_data( G_OBJECT( m_pWidget ), "texture", entry );
-
-// table = gtk_table_new (5, 4, FALSE);
- table = gtk_table_new( 6, 4, FALSE );
- gtk_widget_show( table );
- gtk_box_pack_start( GTK_BOX( vbox ), table, FALSE, TRUE, 0 );
- gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
- gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 8 ) ), 0, 0 );
- g_object_set_data( G_OBJECT( dlg ), "hshift", spin );
- gtk_signal_connect( GTK_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value_changed",
- GTK_SIGNAL_FUNC( OnUpdate ), NULL );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- entry = gtk_entry_new();
- g_object_set_data( G_OBJECT( dlg ), "hshift_inc", entry );
- gtk_signal_connect( GTK_OBJECT( entry ), "changed",
- GTK_SIGNAL_FUNC( OnIncrementChanged ), NULL );
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -8192, 8192, 2, 8, 8 ) ), 0, 0 );
- g_object_set_data( G_OBJECT( dlg ), "vshift", spin );
- gtk_signal_connect( GTK_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value_changed",
- GTK_SIGNAL_FUNC( OnUpdate ), NULL );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- entry = gtk_entry_new();
- g_object_set_data( G_OBJECT( dlg ), "vshift_inc", entry );
- gtk_signal_connect( GTK_OBJECT( entry ), "changed",
- GTK_SIGNAL_FUNC( OnIncrementChanged ), NULL );
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 10 ) ), 0, 0 );
- g_object_set_data( G_OBJECT( dlg ), "hscale", spin );
- gtk_signal_connect( GTK_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value_changed",
- GTK_SIGNAL_FUNC( OnUpdate ), NULL );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 2, 3 );
-
- entry = gtk_entry_new();
- g_object_set_data( G_OBJECT( dlg ), "hscale_inc", entry );
- gtk_signal_connect( GTK_OBJECT( entry ), "changed",
- GTK_SIGNAL_FUNC( OnIncrementChanged ), NULL );
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 2, 3 );
- gtk_widget_set_usize( entry, 50, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -1000, 1000, 1, 10, 10 ) ), 0, 0 );
- g_object_set_data( G_OBJECT( dlg ), "vscale", spin );
- gtk_signal_connect( GTK_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value_changed",
- GTK_SIGNAL_FUNC( OnUpdate ), NULL );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- entry = gtk_entry_new();
- g_object_set_data( G_OBJECT( dlg ), "vscale_inc", entry );
- gtk_signal_connect( GTK_OBJECT( entry ), "changed",
- GTK_SIGNAL_FUNC( OnIncrementChanged ), NULL );
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 3, 4,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 0, -360, 360, 1, 10, 10 ) ), 1, 0 );
- g_object_set_data( G_OBJECT( dlg ), "rotate", spin );
- gtk_signal_connect( GTK_OBJECT( gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ) ), "value_changed",
- GTK_SIGNAL_FUNC( OnUpdate ), NULL );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
- gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( spin ), TRUE );
-
- label = gtk_label_new( _( "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,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- entry = gtk_entry_new();
- g_object_set_data( G_OBJECT( dlg ), "rotate_inc", entry );
- gtk_signal_connect( GTK_OBJECT( entry ), "changed",
- GTK_SIGNAL_FUNC( OnIncrementChanged ), NULL );
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 3, 4, 4, 5,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
-
- // match grid button
- button = gtk_button_new_with_label( _( "Match Grid" ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 2, 4, 5, 6,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnMatchGrid ), NULL );
-
- frame = gtk_frame_new( _( "Texturing" ) );
- gtk_widget_show( frame );
- gtk_box_pack_start( GTK_BOX( vbox ), frame, FALSE, TRUE, 0 );
-
- table = gtk_table_new( 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 );
-
- label = gtk_label_new( "Brush" );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( "Patch" );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( "Width" );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( _( "Height" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 3, 4, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- button = gtk_button_new_with_label( _( "Axial" ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnAxial ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "Fit" ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnFaceFit ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "CAP" ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 0, 1, 3, 4,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnPatchdetails ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "Set..." ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 1, 2, 3, 4,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnPatchreset ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "Natural" ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 2, 3, 3, 4,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnPatchnatural ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "Fit" ) );
- gtk_widget_show( button );
- gtk_table_attach( GTK_TABLE( table ), button, 3, 4, 3, 4,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnBtnPatchFit ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ) ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 2, 3, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
- AddDialogData( spin, &m_nWidth, DLG_SPIN_INT );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ) ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 3, 4, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 60, -2 );
- AddDialogData( spin, &m_nHeight, DLG_SPIN_INT );
-
- hbox2 = gtk_hbox_new( FALSE, 5 );
- gtk_widget_show( hbox2 );
- gtk_box_pack_start( GTK_BOX( vbox ), hbox2, FALSE, TRUE, 0 );
-
- button = gtk_button_new_with_label( _( "Done" ) );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnDone ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "Apply" ) );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnApply ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- button = gtk_button_new_with_label( _( "Cancel" ) );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnCancel ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
-
- // that's a bit of trashy stuff from Textool-v2 branch
-#ifdef _DEBUG
- // FIXME: testing only, scaling in BP mode
- button = gtk_button_new_with_label( _( "Test" ) );
- gtk_widget_show( button );
- gtk_box_pack_start( GTK_BOX( hbox2 ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked",
- GTK_SIGNAL_FUNC( OnTest ), NULL );
- gtk_widget_set_usize( button, 60, -2 );
+ {
+ auto frame = ui::Frame( "Texturing" );
+ frame.show();
+ vbox.pack_start( frame, FALSE, FALSE, 0 );
+ {
+ auto table = ui::Table(4, 4, FALSE);
+ table.show();
+ frame.add(table);
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+ gtk_container_set_border_width( GTK_CONTAINER( table ), 5 );
+ {
+ ui::Widget label = ui::Label( "Brush" );
+ label.show();
+ table.attach(label, {0, 1, 0, 1}, {GTK_FILL, 0});
+ }
+ {
+ ui::Widget label = ui::Label( "Patch" );
+ label.show();
+ table.attach(label, {0, 1, 2, 3}, {GTK_FILL, 0});
+ }
+ {
+ ui::Widget label = ui::Label( "Width" );
+ label.show();
+ table.attach(label, {2, 3, 0, 1}, {GTK_FILL, 0});
+ }
+ {
+ ui::Widget label = ui::Label( "Height" );
+ label.show();
+ table.attach(label, {3, 4, 0, 1}, {GTK_FILL, 0});
+ }
+ {
+ ui::Widget button = ui::Button( "Axial" );
+ button.show();
+ table.attach(button, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ button.connect( "clicked",
+ G_CALLBACK( OnBtnAxial ), 0 );
+ button.dimensions(60, -1);
+ }
+ {
+ ui::Widget button = ui::Button( "Fit" );
+ button.show();
+ table.attach(button, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ button.connect( "clicked",
+ G_CALLBACK( OnBtnFaceFit ), 0 );
+ button.dimensions(60, -1);
+ }
+ {
+ ui::Widget button = ui::Button( "CAP" );
+ button.show();
+ table.attach(button, {0, 1, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
+ button.connect( "clicked",
+ G_CALLBACK( OnBtnPatchdetails ), 0 );
+ button.dimensions(60, -1);
+ }
+ {
+ ui::Widget button = ui::Button( "Set..." );
+ button.show();
+ table.attach(button, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
+ button.connect( "clicked",
+ G_CALLBACK( OnBtnPatchreset ), 0 );
+ button.dimensions(60, -1);
+ }
+ {
+ ui::Widget button = ui::Button( "Natural" );
+ button.show();
+ table.attach(button, {2, 3, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
+ button.connect( "clicked",
+ G_CALLBACK( OnBtnPatchnatural ), 0 );
+ button.dimensions(60, -1);
+ }
+ {
+ ui::Widget button = ui::Button( "Fit" );
+ button.show();
+ table.attach(button, {3, 4, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
+ button.connect( "clicked",
+ G_CALLBACK( OnBtnPatchFit ), 0 );
+ button.dimensions(60, -1);
+ }
+ {
+ auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+ spin.show();
+ table.attach(spin, {2, 3, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ spin.dimensions(60, -1);
+ AddDialogData( spin, m_fitHorizontal );
+ }
+ {
+ auto spin = ui::SpinButton( ui::Adjustment( 1, 0, 1 << 16, 1, 10, 0 ), 0, 6 );
+ spin.show();
+ table.attach(spin, {3, 4, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ spin.dimensions(60, -1);
+ AddDialogData( spin, m_fitVertical );
+ }
+ }
+ }
+ if ( !string_empty( g_pGameDescription->getKeyValue( "si_flags" ) ) ) {
+ {
+ auto frame = ui::Frame( "Surface Flags" );
+ frame.show();
+ vbox.pack_start( frame, TRUE, TRUE, 0 );
+ {
+ auto vbox3 = ui::VBox( FALSE, 4 );
+ //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
+ vbox3.show();
+ frame.add(vbox3);
+ {
+ auto table = ui::Table( 8, 4, FALSE );
+ table.show();
+ vbox3.pack_start( table, TRUE, TRUE, 0 );
+ gtk_table_set_row_spacings( table, 0 );
+ gtk_table_set_col_spacings( table, 0 );
+
+ GtkCheckButton** p = m_surfaceFlags;
+
+ for (unsigned int c = 0; c != 4; ++c)
+ {
+ for (unsigned int r = 0; r != 8; ++r)
+ {
+ auto check = ui::CheckButton( getSurfaceFlagName( c * 8 + r ) );
+ check.show();
+ table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0});
+ *p++ = check;
+ guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) );
+ g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
+ }
+ }
+ }
+ }
+ }
+ {
+ auto frame = ui::Frame( "Content Flags" );
+ frame.show();
+ vbox.pack_start( frame, TRUE, TRUE, 0 );
+ {
+ auto vbox3 = ui::VBox( FALSE, 4 );
+ //gtk_container_set_border_width(GTK_CONTAINER(vbox3), 4);
+ vbox3.show();
+ frame.add(vbox3);
+ {
+
+ auto table = ui::Table( 8, 4, FALSE );
+ table.show();
+ vbox3.pack_start( table, TRUE, TRUE, 0 );
+ gtk_table_set_row_spacings( table, 0 );
+ gtk_table_set_col_spacings( table, 0 );
+
+ GtkCheckButton** p = m_contentFlags;
+
+ for (unsigned int c = 0; c != 4; ++c)
+ {
+ for (unsigned int r = 0; r != 8; ++r)
+ {
+ auto check = ui::CheckButton( getContentFlagName( c * 8 + r ) );
+ check.show();
+ table.attach(check, {c, c + 1, r, r + 1}, {GTK_EXPAND | GTK_FILL, 0});
+ *p++ = check;
+ guint handler_id = togglebutton_connect_toggled( check, ApplyFlagsCaller( *this ) );
+ g_object_set_data( G_OBJECT( check ), "handler", gint_to_pointer( handler_id ) );
+ }
+ }
+
+ // not allowed to modify detail flag using Surface Inspector
+ gtk_widget_set_sensitive( ui::CheckButton::from(m_contentFlags[BRUSH_DETAIL_FLAG]), FALSE );
+ }
+ }
+ }
+ {
+ auto frame = ui::Frame( "Value" );
+ frame.show();
+ vbox.pack_start( frame, TRUE, TRUE, 0 );
+ {
+ auto vbox3 = ui::VBox( FALSE, 4 );
+ gtk_container_set_border_width( GTK_CONTAINER( vbox3 ), 4 );
+ vbox3.show();
+ frame.add(vbox3);
+
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ vbox3.pack_start( entry, TRUE, TRUE, 0 );
+ m_valueEntryWidget = entry;
+ m_valueEntry.connect( entry );
+ }
+ }
+ }
+ }
+
+#if TEXTOOL_ENABLED
+ if ( g_bp_globals.m_texdefTypeId == TEXDEFTYPEID_BRUSHPRIMITIVES ) {
+// Shamus: Textool goodies...
+ ui::Widget frame = ui::Frame( "Textool" );
+ frame.show();
+ vbox.pack_start( frame , FALSE, FALSE, 0 );
+ {
+ //Prolly should make this a member or global var, so the SI can draw on it...
+ TexTool::g_textoolWin = glwidget_new( FALSE );
+ // --> Dunno, but this stuff may be necessary... (Looks like it!)
+ g_object_ref( TexTool::g_textoolWin );
+ gtk_widget_set_events( TexTool::g_textoolWin, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK );
+ gtk_widget_set_can_focus( TexTool::g_textoolWin, true );
+ // <-- end stuff...
+ TexTool::g_textoolWin.show();
+ TexTool::g_textoolWin.dimensions( -1, 240 ); //Yeah!
+ frame.add(TexTool::g_textoolWin);
+
+ TexTool::g_textoolWin.connect( "size_allocate", G_CALLBACK( TexTool::size_allocate ), NULL );
+ TexTool::g_textoolWin.connect( "expose_event", G_CALLBACK( TexTool::expose ), NULL );
+ TexTool::g_textoolWin.connect( "button_press_event", G_CALLBACK( TexTool::button_press ), NULL );
+ TexTool::g_textoolWin.connect( "button_release_event", G_CALLBACK( TexTool::button_release ), NULL );
+ TexTool::g_textoolWin.connect( "motion_notify_event", G_CALLBACK( TexTool::motion ), NULL );
+ }
+ {
+ ui::Widget hbox = ui::HBox( FALSE, 5 );
+ hbox.show();
+ vbox.pack_start( hbox , FALSE, FALSE, 0 );
+ // Checkboxes go here... (Flip X/Y)
+ ui::Widget flipX = ui::CheckButton( "Flip X axis" );
+ ui::Widget flipY = ui::CheckButton( "Flip Y axis" );
+ flipX.show();
+ flipY.show();
+ hbox.pack_start( flipX, FALSE, FALSE, 0 );
+ hbox.pack_start( flipY, FALSE, FALSE, 0 );
+
+//Instead of this, we probably need to create a vbox to put into the frame, then the
+//window, then the hbox. !!! FIX !!!
+// frame.add(hbox);
+
+//Hmm. Do we really need g_object_set_data? Mebbe not... And we don't! :-)
+// g_object_set_data(G_OBJECT(flipX), "handler", gint_to_pointer(flipX.connect("toggled", G_CALLBACK(TexTool::flipX), 0)));
+// g_object_set_data(G_OBJECT(flipY), "handler", gint_to_pointer(flipY.connect("toggled", G_CALLBACK(TexTool::flipY), 0)));
+//Instead, just do:
+ flipX.connect( "toggled", G_CALLBACK( TexTool::flipX ), NULL );
+ flipY.connect( "toggled", G_CALLBACK( TexTool::flipY ), NULL );
+ }
+ }