-// PatchDialog class
-
-PatchDialog::PatchDialog (){
- m_strName = "";
- m_fS = 0.0f;
- m_fT = 0.0f;
- m_fX = 0.0f;
- m_fY = 0.0f;
- m_fZ = 0.0f;
- m_nCol = 0;
- m_nRow = 0;
- m_Patch = NULL;
- m_bListenChanged = true;
-}
-
-void PatchDialog::InitDefaultIncrement( texdef_t *tex ){
- tex->SetName( SHADER_NOT_FOUND );
- tex->scale[0] = 0.5f;
- tex->scale[1] = 0.5f;
- tex->rotate = 45;
- tex->shift[0] = 8.0f;
- tex->shift[1] = 8.0f;
-}
-
-// we plug into HideDlg and ShowDlg to maintain the l_bIsActive flag
-void PatchDialog::HideDlg(){
- l_bIsActive = false;
- Dialog::HideDlg();
-}
-
-void PatchDialog::ShowDlg(){
- l_bIsActive = true;
- Dialog::ShowDlg();
-}
-
-void PatchDialog::BuildDialog(){
- GtkWidget *dlg, *vbox, *vbox2, *hbox, *hbox2, *frame, *table, *label;
- GtkWidget *button, *entry, *spin, *combo;
- GtkObject *adj;
- char buf[32];
-
- dlg = m_pWidget;
-
- load_window_pos( dlg, g_PrefsDlg.mWindowInfo.posPatchWnd );
-
- gtk_window_set_title( GTK_WINDOW( dlg ), _( "Patch Properties" ) );
- gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event", GTK_SIGNAL_FUNC( OnDone ), NULL );
- // catch 'Esc' and 'Enter'
- 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 ) );
-
-
- 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 );
-
- hbox = gtk_hbox_new( FALSE, 5 );
- gtk_widget_show( hbox );
- gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, TRUE, 0 );
-
- frame = gtk_frame_new( _( "Details" ) );
- gtk_widget_show( frame );
- gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
-
- vbox2 = gtk_vbox_new( FALSE, 5 );
- gtk_widget_show( vbox2 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
- gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
-
- table = gtk_table_new( 2, 2, FALSE );
- gtk_widget_show( table );
- gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
- gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
- gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
-
- label = gtk_label_new( _( "Row:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( _( "Column:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- combo = gtk_combo_new();
- gtk_widget_show( combo );
- gtk_table_attach( GTK_TABLE( table ), combo, 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( combo, 60, -1 );
- gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
- gtk_signal_connect( GTK_OBJECT( GTK_COMBO( combo )->entry ), "changed",
- GTK_SIGNAL_FUNC( OnSelchangeComboColRow ), this );
- AddDialogData( combo, &m_nRow, DLG_COMBO_INT );
- m_pRowCombo = combo;
-
- combo = gtk_combo_new();
- gtk_widget_show( combo );
- gtk_table_attach( GTK_TABLE( table ), combo, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( combo, 60, -1 );
- gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( combo )->entry ), FALSE );
- gtk_signal_connect( GTK_OBJECT( GTK_COMBO( combo )->entry ), "changed",
- GTK_SIGNAL_FUNC( OnSelchangeComboColRow ), this );
- AddDialogData( combo, &m_nCol, DLG_COMBO_INT );
- m_pColCombo = combo;
-
- table = gtk_table_new( 5, 2, FALSE );
- gtk_widget_show( table );
- gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, TRUE, 0 );
- gtk_table_set_row_spacings( GTK_TABLE( table ), 5 );
- gtk_table_set_col_spacings( GTK_TABLE( table ), 5 );
-
- label = gtk_label_new( _( "X:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( _( "Y:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( _( "Z:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( _( "S:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 3, 4,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- label = gtk_label_new( _( "T:" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 0, 1, 4, 5,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- AddDialogData( entry, &m_fX, DLG_ENTRY_FLOAT );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- AddDialogData( entry, &m_fY, DLG_ENTRY_FLOAT );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 2, 3,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- AddDialogData( entry, &m_fZ, DLG_ENTRY_FLOAT );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 3, 4,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- AddDialogData( entry, &m_fS, DLG_ENTRY_FLOAT );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 1, 2, 4, 5,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- AddDialogData( entry, &m_fT, DLG_ENTRY_FLOAT );
-
- frame = gtk_frame_new( _( "Texturing" ) );
- gtk_widget_show( frame );
- gtk_box_pack_start( GTK_BOX( hbox ), frame, TRUE, TRUE, 0 );
-
- vbox2 = gtk_vbox_new( FALSE, 5 );
- gtk_widget_show( vbox2 );
- gtk_container_add( GTK_CONTAINER( frame ), vbox2 );
- gtk_container_set_border_width( GTK_CONTAINER( vbox2 ), 5 );
-
- label = gtk_label_new( _( "Name:" ) );
- gtk_widget_show( label );
- gtk_box_pack_start( GTK_BOX( vbox2 ), label, TRUE, TRUE, 0 );
- gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
-
- entry = gtk_entry_new();
-// gtk_entry_set_editable (GTK_ENTRY (entry), false);
- gtk_widget_show( entry );
- gtk_box_pack_start( GTK_BOX( vbox2 ), entry, TRUE, TRUE, 0 );
- AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
-
- table = gtk_table_new( 5, 3, FALSE );
- gtk_widget_show( table );
- gtk_box_pack_start( GTK_BOX( vbox2 ), table, TRUE, 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 Step" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
-
- label = gtk_label_new( _( "Vertical Shift Step" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
-
- label = gtk_label_new( _( "Horizontal Stretch Step" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
-
- label = gtk_label_new( _( "Vertical Stretch Step" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 3, 4,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
-
- label = gtk_label_new( _( "Rotate Step" ) );
- gtk_widget_show( label );
- gtk_table_attach( GTK_TABLE( table ), label, 2, 3, 4, 5,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
- g_object_set_data( G_OBJECT( m_pWidget ), "hshift_entry", entry );
- // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
- // so we need to have at least one initialisation somewhere
- sprintf( buf, "%g", l_pPIIncrement->shift[0] );
- gtk_entry_set_text( GTK_ENTRY( entry ), buf );
-
- adj = gtk_adjustment_new( 0, -8192, 8192, 1, 1, 1 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( m_pWidget ), "hshift_adj", adj );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 0, 1,
- (GtkAttachOptions) ( 0 ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 10, -2 );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
- sprintf( buf, "%g", l_pPIIncrement->shift[1] );
- gtk_entry_set_text( GTK_ENTRY( entry ), buf );
-
- adj = gtk_adjustment_new( 0, -8192, 8192, 1, 1, 1 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( m_pWidget ), "vshift_adj", adj );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 1, 2,
- (GtkAttachOptions) ( 0 ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 10, -2 );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
- sprintf( buf, "%g", l_pPIIncrement->scale[0] );
- gtk_entry_set_text( GTK_ENTRY( entry ), buf );
-
- adj = gtk_adjustment_new( 0, -1000, 1000, 1, 1, 1 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( m_pWidget ), "hscale_adj", adj );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 2, 3,
- (GtkAttachOptions) ( 0 ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 10, -2 );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 3, 4,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
- sprintf( buf, "%g", l_pPIIncrement->scale[1] );
- gtk_entry_set_text( GTK_ENTRY( entry ), buf );
-
- adj = gtk_adjustment_new( 0, -1000, 1000, 1, 1, 1 );
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( m_pWidget ), "vscale_adj", adj );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 3, 4,
- (GtkAttachOptions) ( 0 ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 10, -2 );
-
- entry = gtk_entry_new();
- gtk_widget_show( entry );
- gtk_table_attach( GTK_TABLE( table ), entry, 0, 1, 4, 5,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( entry, 50, -2 );
- sprintf( buf, "%g", l_pPIIncrement->rotate );
- gtk_entry_set_text( GTK_ENTRY( entry ), buf );
-
- adj = gtk_adjustment_new( 0, -1000, 1000, 1, 1, 1 ); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
- gtk_signal_connect( adj, "value_changed", GTK_SIGNAL_FUNC( OnSpinChanged ), entry );
- g_object_set_data( G_OBJECT( m_pWidget ), "rotate_adj", adj );
-
- spin = gtk_spin_button_new( GTK_ADJUSTMENT( adj ), 1, 0 );
- gtk_widget_show( spin );
- gtk_table_attach( GTK_TABLE( table ), spin, 1, 2, 4, 5,
- (GtkAttachOptions) ( 0 ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- gtk_widget_set_usize( spin, 10, -2 );
-
- hbox2 = gtk_hbox_new( TRUE, 5 );
- gtk_widget_show( hbox2 );
- gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, TRUE, FALSE, 0 );
-
- button = gtk_button_new_with_label( _( "CAP" ) );
- gtk_widget_show( button );
- gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnPatchdetails ), NULL );
- gtk_widget_set_usize( button, 60, -1 );
-
- button = gtk_button_new_with_label( _( "Set..." ) );
- gtk_widget_show( button );
- gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnPatchreset ), NULL );
- gtk_widget_set_usize( button, 60, -1 );
-
- button = gtk_button_new_with_label( _( "Natural" ) );
- gtk_widget_show( button );
- gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnPatchnatural ), NULL );
- gtk_widget_set_usize( button, 60, -1 );
-
- button = gtk_button_new_with_label( _( "Fit" ) );
- gtk_widget_show( button );
- gtk_box_pack_end( GTK_BOX( hbox2 ), button, TRUE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnPatchfit ), NULL );
- gtk_widget_set_usize( button, 60, -1 );
-
- hbox = gtk_hbox_new( FALSE, 5 );
- gtk_widget_show( hbox );
- gtk_box_pack_start( GTK_BOX( vbox ), hbox, TRUE, FALSE, 0 );
-
- button = gtk_button_new_with_label( _( "Done" ) );
- gtk_widget_show( button );
- gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnDone ), NULL );
- gtk_widget_set_usize( button, 60, -1 );
-
- button = gtk_button_new_with_label( _( "Apply" ) );
- gtk_widget_show( button );
- gtk_box_pack_end( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
- gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnApply ), NULL );
- gtk_widget_set_usize( button, 60, -1 );
+// PatchInspector class
+
+ui::Window PatchInspector::BuildDialog()
+{
+ ui::Window window = ui::Window(create_floating_window("Patch Properties", m_parent));
+
+ m_position_tracker.connect(window);
+
+ global_accel_connect_window(window);
+
+ window_connect_focus_in_clear_focus_widget(window);
+
+
+ {
+ auto vbox = ui::VBox(FALSE, 5);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
+ vbox.show();
+ window.add(vbox);
+ {
+ auto hbox = ui::HBox(FALSE, 5);
+ hbox.show();
+ vbox.pack_start(hbox, TRUE, TRUE, 0);
+ {
+ auto vbox2 = ui::VBox(FALSE, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox2), 0);
+ vbox2.show();
+ hbox.pack_start(vbox2, TRUE, TRUE, 0);
+ {
+ auto frame = ui::Frame("Details");
+ frame.show();
+ vbox2.pack_start(frame, TRUE, TRUE, 0);
+ {
+ auto vbox3 = ui::VBox(FALSE, 5);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox3), 5);
+ vbox3.show();
+ frame.add(vbox3);
+ {
+ auto table = ui::Table(2, 2, FALSE);
+ table.show();
+ vbox3.pack_start(table, TRUE, TRUE, 0);
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+ {
+ auto label = ui::Label("Row:");
+ label.show();
+ table.attach(label, {0, 1, 0, 1},
+ {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)},
+ {0, 0});
+ }
+ {
+ auto label = ui::Label("Column:");
+ label.show();
+ table.attach(label, {1, 2, 0, 1},
+ {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)},
+ {0, 0});
+ }
+ {
+ auto combo = ui::ComboBoxText(ui::New);
+ combo.connect("changed", G_CALLBACK(OnSelchangeComboColRow), this);
+ AddDialogData(combo, m_nRow);
+
+ combo.show();
+ table.attach(combo, {0, 1, 1, 2},
+ {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)},
+ {0, 0});
+ combo.dimensions(60, -1);
+ m_pRowCombo = combo;
+ }
+
+ {
+ auto combo = ui::ComboBoxText(ui::New);
+ combo.connect("changed", G_CALLBACK(OnSelchangeComboColRow), this);
+ AddDialogData(combo, m_nCol);
+
+ combo.show();
+ table.attach(combo, {1, 2, 1, 2},
+ {(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0)},
+ {0, 0});
+ combo.dimensions(60, -1);
+ m_pColCombo = combo;
+ }
+ }
+ auto table = ui::Table(5, 2, FALSE);
+ table.show();
+ vbox3.pack_start(table, TRUE, TRUE, 0);
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+ {
+ auto label = ui::Label("X:");
+ label.show();
+ table.attach(label, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto label = ui::Label("Y:");
+ label.show();
+ table.attach(label, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto label = ui::Label("Z:");
+ label.show();
+ table.attach(label, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto label = ui::Label("S:");
+ label.show();
+ table.attach(label, {0, 1, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto label = ui::Label("T:");
+ label.show();
+ table.attach(label, {0, 1, 4, 5}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+ AddDialogData(entry, m_fX);
+
+ entry.connect("key_press_event", G_CALLBACK(OnDialogKey), 0);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ AddDialogData(entry, m_fY);
+
+ entry.connect("key_press_event", G_CALLBACK(OnDialogKey), 0);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
+ AddDialogData(entry, m_fZ);
+
+ entry.connect("key_press_event", G_CALLBACK(OnDialogKey), 0);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 3, 4}, {GTK_EXPAND | GTK_FILL, 0});
+ AddDialogData(entry, m_fS);
+
+ entry.connect("key_press_event", G_CALLBACK(OnDialogKey), 0);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 4, 5}, {GTK_EXPAND | GTK_FILL, 0});
+ AddDialogData(entry, m_fT);
+
+ entry.connect("key_press_event", G_CALLBACK(OnDialogKey), 0);
+ }
+ }
+ }
+ if (g_pGameDescription->mGameType == "doom3") {
+ auto frame = ui::Frame("Tesselation");
+ frame.show();
+ vbox2.pack_start(frame, TRUE, TRUE, 0);
+ {
+ auto vbox3 = ui::VBox(FALSE, 5);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox3), 5);
+ vbox3.show();
+ frame.add(vbox3);
+ {
+ auto table = ui::Table(3, 2, FALSE);
+ table.show();
+ vbox3.pack_start(table, TRUE, TRUE, 0);
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+ {
+ auto label = ui::Label("Fixed");
+ label.show();
+ table.attach(label, {0, 1, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto check = ui::CheckButton::from(gtk_check_button_new());
+ check.show();
+ table.attach(check, {1, 2, 0, 1}, {GTK_EXPAND | GTK_FILL, 0});
+ m_subdivisions.m_enabled = check;
+ guint handler_id = check.connect("toggled", G_CALLBACK(&Subdivisions::applyGtk),
+ &m_subdivisions);
+ g_object_set_data(G_OBJECT(check), "handler", gint_to_pointer(handler_id));
+ }
+ {
+ auto label = ui::Label("Horizontal");
+ label.show();
+ table.attach(label, {0, 1, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ m_subdivisions.m_horizontal = entry;
+ m_horizontalSubdivisionsEntry.connect(entry);
+ }
+ {
+ auto label = ui::Label("Vertical");
+ label.show();
+ table.attach(label, {0, 1, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {1, 2, 2, 3}, {GTK_EXPAND | GTK_FILL, 0});
+ m_subdivisions.m_vertical = entry;
+ m_verticalSubdivisionsEntry.connect(entry);
+ }
+ }
+ }
+ }
+ }
+ {
+ auto frame = ui::Frame("Texturing");
+ frame.show();
+ hbox.pack_start(frame, TRUE, TRUE, 0);
+ {
+ auto vbox2 = ui::VBox(FALSE, 5);
+ vbox2.show();
+ frame.add(vbox2);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox2), 5);
+ {
+ auto label = ui::Label("Name:");
+ label.show();
+ vbox2.pack_start(label, TRUE, TRUE, 0);
+ gtk_label_set_justify(label, GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ // gtk_editable_set_editable (GTK_ENTRY (entry), false);
+ entry.show();
+ vbox2.pack_start(entry, TRUE, TRUE, 0);
+ AddDialogData(entry, m_strName);
+
+ entry.connect("key_press_event", G_CALLBACK(OnDialogKey), 0);
+ }
+ {
+ auto table = ui::Table(5, 4, FALSE);
+ table.show();
+ vbox2.pack_start(table, TRUE, TRUE, 0);
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+ {
+ auto label = ui::Label("Horizontal Shift Step");
+ label.show();
+ table.attach(label, {2, 4, 0, 1}, {GTK_FILL | GTK_EXPAND, 0});
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ }
+ {
+ auto label = ui::Label("Vertical Shift Step");
+ label.show();
+ table.attach(label, {2, 4, 1, 2}, {GTK_FILL | GTK_EXPAND, 0});
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ }
+ {
+ auto label = ui::Label("Horizontal Stretch Step");
+ label.show();
+ table.attach(label, {2, 3, 2, 3}, {GTK_FILL | GTK_EXPAND, 0});
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ }
+ {
+ auto button = ui::Button("Flip");
+ button.show();
+ table.attach(button, {3, 4, 2, 3}, {GTK_FILL, 0});
+ button.connect("clicked", G_CALLBACK(OnBtnPatchFlipX), 0);
+ button.dimensions(60, -1);
+ }
+ {
+ auto label = ui::Label("Vertical Stretch Step");
+ label.show();
+ table.attach(label, {2, 3, 3, 4}, {GTK_FILL | GTK_EXPAND, 0});
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ }
+ {
+ auto button = ui::Button("Flip");
+ button.show();
+ table.attach(button, {3, 4, 3, 4}, {GTK_FILL, 0});
+ button.connect("clicked", G_CALLBACK(OnBtnPatchFlipY), 0);
+ button.dimensions(60, -1);
+ }
+ {
+ auto label = ui::Label("Rotate Step");
+ label.show();
+ table.attach(label, {2, 4, 4, 5}, {GTK_FILL | GTK_EXPAND, 0});
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 0, 1}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
+ g_object_set_data(G_OBJECT(window), "hshift_entry", (void *) entry);
+ // we fill in this data, if no patch is selected the widgets are unmodified when the inspector is raised
+ // so we need to have at least one initialisation somewhere
+ entry_set_float(entry, g_pi_globals.shift[0]);
+
+ auto adj = ui::Adjustment(0, -8192, 8192, 1, 1, 0);
+ adj.connect("value_changed", G_CALLBACK(OnSpinChanged), (gpointer) entry);
+ g_object_set_data(G_OBJECT(window), "hshift_adj", (gpointer) adj);
+
+ auto spin = ui::SpinButton(adj, 1, 0);
+ spin.show();
+ table.attach(spin, {1, 2, 0, 1}, {0, 0});
+ spin.dimensions(10, -1);
+ gtk_widget_set_can_focus(spin, false);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 1, 2}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
+ entry_set_float(entry, g_pi_globals.shift[1]);
+
+ auto adj = ui::Adjustment(0, -8192, 8192, 1, 1, 0);
+ adj.connect("value_changed", G_CALLBACK(OnSpinChanged), entry);
+ g_object_set_data(G_OBJECT(window), "vshift_adj", (gpointer) adj);
+
+ auto spin = ui::SpinButton(adj, 1, 0);
+ spin.show();
+ table.attach(spin, {1, 2, 1, 2}, {0, 0});
+ spin.dimensions(10, -1);
+ gtk_widget_set_can_focus(spin, false);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 2, 3}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
+ entry_set_float(entry, g_pi_globals.scale[0]);
+
+ auto adj = ui::Adjustment(0, -1000, 1000, 1, 1, 0);
+ adj.connect("value_changed", G_CALLBACK(OnSpinChanged), entry);
+ g_object_set_data(G_OBJECT(window), "hscale_adj", (gpointer) adj);
+
+ auto spin = ui::SpinButton(adj, 1, 0);
+ spin.show();
+ table.attach(spin, {1, 2, 2, 3}, {0, 0});
+ spin.dimensions(10, -1);
+ gtk_widget_set_can_focus(spin, false);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 3, 4}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
+ entry_set_float(entry, g_pi_globals.scale[1]);
+
+ auto adj = ui::Adjustment(0, -1000, 1000, 1, 1, 0);
+ adj.connect("value_changed", G_CALLBACK(OnSpinChanged), entry);
+ g_object_set_data(G_OBJECT(window), "vscale_adj", (gpointer) adj);
+
+ auto spin = ui::SpinButton(adj, 1, 0);
+ spin.show();
+ table.attach(spin, {1, 2, 3, 4}, {0, 0});
+ spin.dimensions(10, -1);
+ gtk_widget_set_can_focus(spin, false);
+ }
+ {
+ auto entry = ui::Entry(ui::New);
+ entry.show();
+ table.attach(entry, {0, 1, 4, 5}, {GTK_FILL, 0});
+ entry.dimensions(50, -1);
+ entry_set_float(entry, g_pi_globals.rotate);
+
+ auto adj = ui::Adjustment(0, -1000, 1000, 1, 1,
+ 0); // NOTE: Arnout - this really should be 360 but can't change it anymore as it could break existing maps
+ adj.connect("value_changed", G_CALLBACK(OnSpinChanged), entry);
+ g_object_set_data(G_OBJECT(window), "rotate_adj", (gpointer) adj);
+
+ auto spin = ui::SpinButton(adj, 1, 0);
+ spin.show();
+ table.attach(spin, {1, 2, 4, 5}, {0, 0});
+ spin.dimensions(10, -1);
+ gtk_widget_set_can_focus(spin, false);
+ }
+ }
+ auto hbox2 = ui::HBox(TRUE, 5);
+ hbox2.show();
+ vbox2.pack_start(hbox2, TRUE, FALSE, 0);
+ {
+ auto button = ui::Button("Auto Cap");
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect("clicked", G_CALLBACK(OnBtnPatchAutoCap), 0);
+ button.dimensions(60, -1);
+ }
+ {
+ auto button = ui::Button("CAP");
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect("clicked", G_CALLBACK(OnBtnPatchdetails), 0);
+ button.dimensions(60, -1);
+ }
+ {
+ auto button = ui::Button("Set...");
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect("clicked", G_CALLBACK(OnBtnPatchreset), 0);
+ button.dimensions(60, -1);
+ }
+ {
+ auto button = ui::Button("Natural");
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect("clicked", G_CALLBACK(OnBtnPatchnatural), 0);
+ button.dimensions(60, -1);
+ }
+ {
+ auto button = ui::Button("Fit");
+ button.show();
+ hbox2.pack_end(button, TRUE, FALSE, 0);
+ button.connect("clicked", G_CALLBACK(OnBtnPatchfit), 0);
+ button.dimensions(60, -1);
+ }
+ }
+ }
+ }
+ }
+
+ return window;