- gtk_widget_show( GTK_WIDGET( combo ) );
- gtk_table_attach( table, GTK_WIDGET( combo ), 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
-
- height = combo;
- }
- }
-
- {
- GtkVBox* vbox = create_dialog_vbox( 4 );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
- {
- GtkButton* button = create_dialog_button( "OK", G_CALLBACK( dialog_button_ok ), &dialog );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_grab_focus( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
- }
- {
- GtkButton* button = create_dialog_button( "Cancel", G_CALLBACK( dialog_button_cancel ), &dialog );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
- }
- }
- }
-
- // Initialize dialog
- gtk_combo_box_set_active( width, ( defcols - mincols ) / 2 );
- gtk_combo_box_set_active( height, ( defrows - minrows ) / 2 );
-
- if ( modal_dialog_show( window, dialog ) == eIDOK ) {
- int w = gtk_combo_box_get_active( width ) * 2 + mincols;
- int h = gtk_combo_box_get_active( height ) * 2 + minrows;
-
- Scene_PatchConstructPrefab( GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader( GlobalTextureBrowser() ), prefab, GlobalXYWnd_getCurrentViewType(), w, h );
- }
-
- gtk_widget_destroy( GTK_WIDGET( window ) );
-}
-
-
-
-
-EMessageBoxReturn DoCapDlg( ECapDialog* type ){
- ModalDialog dialog;
- ModalDialogButton ok_button( dialog, eIDOK );
- ModalDialogButton cancel_button( dialog, eIDCANCEL );
- GtkWidget* bevel;
- GtkWidget* ibevel;
- GtkWidget* endcap;
- GtkWidget* iendcap;
- GtkWidget* cylinder;
-
- GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Cap", dialog );
-
- GtkAccelGroup *accel_group = gtk_accel_group_new();
- gtk_window_add_accel_group( window, accel_group );
-
- {
- GtkHBox* hbox = create_dialog_hbox( 4, 4 );
- gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
-
- {
- // Gef: Added a vbox to contain the toggle buttons
- GtkVBox* radio_vbox = create_dialog_vbox( 4 );
- gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( radio_vbox ) );
-
- {
- GtkTable* table = GTK_TABLE( gtk_table_new( 5, 2, FALSE ) );
- gtk_widget_show( GTK_WIDGET( table ) );
- gtk_box_pack_start( GTK_BOX( radio_vbox ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
- gtk_table_set_row_spacings( table, 5 );
- gtk_table_set_col_spacings( table, 5 );
-
- {
- GtkImage* image = new_local_image( "cap_bevel.bmp" );
- gtk_widget_show( GTK_WIDGET( image ) );
- gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 0, 1,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- }
- {
- GtkImage* image = new_local_image( "cap_endcap.bmp" );
- gtk_widget_show( GTK_WIDGET( image ) );
- gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 1, 2,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- }
- {
- GtkImage* image = new_local_image( "cap_ibevel.bmp" );
- gtk_widget_show( GTK_WIDGET( image ) );
- gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 2, 3,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- }
- {
- GtkImage* image = new_local_image( "cap_iendcap.bmp" );
- gtk_widget_show( GTK_WIDGET( image ) );
- gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 3, 4,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- }
- {
- GtkImage* image = new_local_image( "cap_cylinder.bmp" );
- gtk_widget_show( GTK_WIDGET( image ) );
- gtk_table_attach( table, GTK_WIDGET( image ), 0, 1, 4, 5,
- (GtkAttachOptions) ( GTK_FILL ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- }
-
- GSList* group = 0;
- {
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Bevel" );
- gtk_widget_show( button );
- gtk_table_attach( table, button, 1, 2, 0, 1,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
-
- bevel = button;
- }
- {
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Endcap" );
- gtk_widget_show( button );
- gtk_table_attach( table, button, 1, 2, 1, 2,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
-
- endcap = button;
- }
- {
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Bevel" );
- gtk_widget_show( button );
- gtk_table_attach( table, button, 1, 2, 2, 3,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
-
- ibevel = button;
- }
- {
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Inverted Endcap" );
- gtk_widget_show( button );
- gtk_table_attach( table, button, 1, 2, 3, 4,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
-
- iendcap = button;
- }
- {
- GtkWidget* button = gtk_radio_button_new_with_label( group, "Cylinder" );
- gtk_widget_show( button );
- gtk_table_attach( table, button, 1, 2, 4, 5,
- (GtkAttachOptions) ( GTK_FILL | GTK_EXPAND ),
- (GtkAttachOptions) ( 0 ), 0, 0 );
- group = gtk_radio_button_group( GTK_RADIO_BUTTON( button ) );
-
- cylinder = button;
- }
- }
- }
-
- {
- GtkVBox* vbox = create_dialog_vbox( 4 );
- gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), FALSE, FALSE, 0 );
- {
- GtkButton* button = create_modal_dialog_button( "OK", ok_button );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- widget_make_default( GTK_WIDGET( button ) );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Return, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
- }
- {
- GtkButton* button = create_modal_dialog_button( "Cancel", cancel_button );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
- gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel_group, GDK_Escape, (GdkModifierType)0, GTK_ACCEL_VISIBLE );
- }
- }
- }
-
- // Initialize dialog
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( bevel ), TRUE );
-
- EMessageBoxReturn ret = modal_dialog_show( window, dialog );
- if ( ret == eIDOK ) {
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( bevel ) ) ) {
- *type = PATCHCAP_BEVEL;
- }
- else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( endcap ) ) ) {
- *type = PATCHCAP_ENDCAP;
- }
- else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( ibevel ) ) ) {
- *type = PATCHCAP_INVERTED_BEVEL;
- }
- else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( iendcap ) ) ) {
- *type = PATCHCAP_INVERTED_ENDCAP;
- }
- else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( cylinder ) ) ) {
- *type = PATCHCAP_CYLINDER;
- }
- }
-
- gtk_widget_destroy( GTK_WIDGET( window ) );
-
- return ret;
+ combo.show();
+ table.attach(combo, {1, 2, 1, 2}, {GTK_EXPAND | GTK_FILL, 0});
+ }
+ }
+
+ {
+ auto vbox = create_dialog_vbox(4);
+ hbox.pack_start(vbox, TRUE, TRUE, 0);
+ {
+ auto button = create_dialog_button("OK", G_CALLBACK(dialog_button_ok), &dialog);
+ vbox.pack_start(button, FALSE, FALSE, 0);
+ widget_make_default(button);
+ gtk_widget_grab_focus(button);
+ gtk_widget_add_accelerator(button, "clicked", accel, GDK_KEY_Return, (GdkModifierType) 0,
+ (GtkAccelFlags) 0);
+ }
+ {
+ auto button = create_dialog_button("Cancel", G_CALLBACK(dialog_button_cancel), &dialog);
+ vbox.pack_start(button, FALSE, FALSE, 0);
+ gtk_widget_add_accelerator(button, "clicked", accel, GDK_KEY_Escape, (GdkModifierType) 0,
+ (GtkAccelFlags) 0);
+ }
+ }
+ }
+
+ // Initialize dialog
+ gtk_combo_box_set_active(width, (defcols - mincols) / 2);
+ gtk_combo_box_set_active(height, (defrows - minrows) / 2);
+
+ if (modal_dialog_show(window, dialog) == eIDOK) {
+ int w = gtk_combo_box_get_active(width) * 2 + mincols;
+ int h = gtk_combo_box_get_active(height) * 2 + minrows;
+
+ Scene_PatchConstructPrefab(GlobalSceneGraph(), PatchCreator_getBounds(),
+ TextureBrowser_GetSelectedShader(GlobalTextureBrowser()), prefab,
+ GlobalXYWnd_getCurrentViewType(), w, h);
+ }
+
+ window.destroy();
+}
+
+
+EMessageBoxReturn DoCapDlg(ECapDialog *type)
+{
+ ModalDialog dialog;
+ ModalDialogButton ok_button(dialog, eIDOK);
+ ModalDialogButton cancel_button(dialog, eIDCANCEL);
+ ui::Widget bevel{ui::null};
+ ui::Widget ibevel{ui::null};
+ ui::Widget endcap{ui::null};
+ ui::Widget iendcap{ui::null};
+ ui::Widget cylinder{ui::null};
+
+ ui::Window window = MainFrame_getWindow().create_modal_dialog_window("Cap", dialog);
+
+ auto accel_group = ui::AccelGroup(ui::New);
+ window.add_accel_group(accel_group);
+
+ {
+ auto hbox = create_dialog_hbox(4, 4);
+ window.add(hbox);
+
+ {
+ // Gef: Added a vbox to contain the toggle buttons
+ auto radio_vbox = create_dialog_vbox(4);
+ hbox.add(radio_vbox);
+
+ {
+ auto table = ui::Table(5, 2, FALSE);
+ table.show();
+ radio_vbox.pack_start(table, TRUE, TRUE, 0);
+ gtk_table_set_row_spacings(table, 5);
+ gtk_table_set_col_spacings(table, 5);
+
+ {
+ auto image = new_local_image("cap_bevel.png");
+ image.show();
+ table.attach(image, {0, 1, 0, 1}, {GTK_FILL, 0});
+ }
+ {
+ auto image = new_local_image("cap_endcap.png");
+ image.show();
+ table.attach(image, {0, 1, 1, 2}, {GTK_FILL, 0});
+ }
+ {
+ auto image = new_local_image("cap_ibevel.png");
+ image.show();
+ table.attach(image, {0, 1, 2, 3}, {GTK_FILL, 0});
+ }
+ {
+ auto image = new_local_image("cap_iendcap.png");
+ image.show();
+ table.attach(image, {0, 1, 3, 4}, {GTK_FILL, 0});
+ }
+ {
+ auto image = new_local_image("cap_cylinder.png");
+ image.show();
+ table.attach(image, {0, 1, 4, 5}, {GTK_FILL, 0});
+ }
+
+ GSList *group = 0;
+ {
+ ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label(group, "Bevel"));
+ button.show();
+ table.attach(button, {1, 2, 0, 1}, {GTK_FILL | GTK_EXPAND, 0});
+ group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
+
+ bevel = button;
+ }
+ {
+ ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label(group, "Endcap"));
+ button.show();
+ table.attach(button, {1, 2, 1, 2}, {GTK_FILL | GTK_EXPAND, 0});
+ group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
+
+ endcap = button;
+ }
+ {
+ ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label(group, "Inverted Bevel"));
+ button.show();
+ table.attach(button, {1, 2, 2, 3}, {GTK_FILL | GTK_EXPAND, 0});
+ group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
+
+ ibevel = button;
+ }
+ {
+ ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label(group, "Inverted Endcap"));
+ button.show();
+ table.attach(button, {1, 2, 3, 4}, {GTK_FILL | GTK_EXPAND, 0});
+ group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
+
+ iendcap = button;
+ }
+ {
+ ui::Widget button = ui::Widget::from(gtk_radio_button_new_with_label(group, "Cylinder"));
+ button.show();
+ table.attach(button, {1, 2, 4, 5}, {GTK_FILL | GTK_EXPAND, 0});
+ group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
+
+ cylinder = button;
+ }
+ }
+ }
+
+ {
+ auto vbox = create_dialog_vbox(4);
+ hbox.pack_start(vbox, FALSE, FALSE, 0);
+ {
+ auto button = create_modal_dialog_button("OK", ok_button);
+ vbox.pack_start(button, FALSE, FALSE, 0);
+ widget_make_default(button);
+ gtk_widget_add_accelerator(button, "clicked", accel_group, GDK_KEY_Return, (GdkModifierType) 0,
+ GTK_ACCEL_VISIBLE);
+ }
+ {
+ auto button = create_modal_dialog_button("Cancel", cancel_button);
+ vbox.pack_start(button, FALSE, FALSE, 0);
+ gtk_widget_add_accelerator(button, "clicked", accel_group, GDK_KEY_Escape, (GdkModifierType) 0,
+ GTK_ACCEL_VISIBLE);
+ }
+ }
+ }
+
+ // Initialize dialog
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bevel), TRUE);
+
+ EMessageBoxReturn ret = modal_dialog_show(window, dialog);
+ if (ret == eIDOK) {
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(bevel))) {
+ *type = PATCHCAP_BEVEL;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(endcap))) {
+ *type = PATCHCAP_ENDCAP;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ibevel))) {
+ *type = PATCHCAP_INVERTED_BEVEL;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(iendcap))) {
+ *type = PATCHCAP_INVERTED_ENDCAP;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cylinder))) {
+ *type = PATCHCAP_CYLINDER;
+ }
+ }
+
+ window.destroy();
+
+ return ret;