]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/patchdialog.cpp
remember last opened folder
[xonotic/netradiant.git] / radiant / patchdialog.cpp
index daa79f65e5337bb8ec6850345f8777ae44a53867..73639e5463756bf4b3686d29b0b48d7662d5b71f 100644 (file)
@@ -376,29 +376,27 @@ void Scene_PatchTileTexture_Selected( scene::Graph& graph, float s, float t ){
 }
 
 static void OnBtnPatchdetails( GtkWidget *widget, gpointer data ){
-       UndoableCommand command( "patchCapTexture" );
-
-       Scene_PatchCapTexture_Selected( GlobalSceneGraph() );
+       Patch_CapTexture();
 }
 
 static void OnBtnPatchfit( GtkWidget *widget, gpointer data ){
-       UndoableCommand command( "patchFitTexture" );
-
-       Scene_PatchTileTexture_Selected( GlobalSceneGraph(), 1, 1 );
+       Patch_FitTexture();
 }
 
 static void OnBtnPatchnatural( GtkWidget *widget, gpointer data ){
-       UndoableCommand command( "patchNaturalTexture" );
-
-       Scene_PatchNaturalTexture_Selected( GlobalSceneGraph() );
+       Patch_NaturalTexture();
 }
 
 static void OnBtnPatchreset( GtkWidget *widget, gpointer data ){
-       float fx, fy;
-       if ( DoTextureLayout( &fx, &fy ) == eIDOK ) {
-               UndoableCommand command( "patchTileTexture" );
-               Scene_PatchTileTexture_Selected( GlobalSceneGraph(), fx, fy );
-       }
+       Patch_ResetTexture();
+}
+
+static void OnBtnPatchFlipX( GtkWidget *widget, gpointer data ){
+       Patch_FlipTextureX();
+}
+
+static void OnBtnPatchFlipY( GtkWidget *widget, gpointer data ){
+       Patch_FlipTextureY();
 }
 
 struct PatchRotateTexture
@@ -457,6 +455,10 @@ void Scene_PatchTranslateTexture_Selected( scene::Graph& graph, float s, float t
        Scene_forEachVisibleSelectedPatch( PatchTranslateTexture( s, t ) );
 }
 
+static void OnBtnPatchAutoCap( GtkWidget *widget, gpointer data ){
+       Patch_AutoCapTexture();
+}
+
 static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){
        texdef_t td;
 
@@ -825,7 +827,7 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                g_signal_connect( G_OBJECT( entry ), "key_press_event", G_CALLBACK( OnDialogKey ), 0 );
                                        }
                                        {
-                                               GtkTable* table = GTK_TABLE( gtk_table_new( 5, 3, FALSE ) );
+                                               GtkTable* table = GTK_TABLE( gtk_table_new( 5, 4, FALSE ) );
                                                gtk_widget_show( GTK_WIDGET( table ) );
                                                gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( table ), TRUE, TRUE, 0 );
                                                gtk_table_set_row_spacings( table, 5 );
@@ -833,16 +835,16 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                {
                                                        GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Shift Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 0, 1,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 0, 1,
+                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
                                                {
                                                        GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Shift Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 1, 2,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 1, 2,
+                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
@@ -850,23 +852,41 @@ GtkWindow* PatchInspector::BuildDialog(){
                                                        GtkLabel* label = GTK_LABEL( gtk_label_new( "Horizontal Stretch Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 2, 3,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
+                                               {
+                                                       GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Flip" ) );
+                                                       gtk_widget_show( GTK_WIDGET( button ) );
+                                                       gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 2, 3,
+                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                                                       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipX ), 0 );
+                                                       gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               }
                                                {
                                                        GtkLabel* label = GTK_LABEL( gtk_label_new( "Vertical Stretch Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
                                                        gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 3, 4,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
+                                               {
+                                                       GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Flip" ) );
+                                                       gtk_widget_show( GTK_WIDGET( button ) );
+                                                       gtk_table_attach( table, GTK_WIDGET( button ), 3, 4, 3, 4,
+                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                                                         (GtkAttachOptions)( 0 ), 0, 0 );
+                                                       g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchFlipY ), 0 );
+                                                       gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                               }
                                                {
                                                        GtkLabel* label = GTK_LABEL( gtk_label_new( "Rotate Step" ) );
                                                        gtk_widget_show( GTK_WIDGET( label ) );
-                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 3, 4, 5,
-                                                                                         (GtkAttachOptions)( GTK_FILL ),
+                                                       gtk_table_attach( table, GTK_WIDGET( label ), 2, 4, 4, 5,
+                                                                                         (GtkAttachOptions)( GTK_FILL|GTK_EXPAND ),
                                                                                          (GtkAttachOptions)( 0 ), 0, 0 );
                                                        gtk_misc_set_alignment( GTK_MISC( label ), 0, 0.5 );
                                                }
@@ -982,6 +1002,13 @@ GtkWindow* PatchInspector::BuildDialog(){
                                        GtkHBox* hbox2 = GTK_HBOX( gtk_hbox_new( TRUE, 5 ) );
                                        gtk_widget_show( GTK_WIDGET( hbox2 ) );
                                        gtk_box_pack_start( GTK_BOX( vbox2 ), GTK_WIDGET( hbox2 ), TRUE, FALSE, 0 );
+                                       {
+                                               GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "Auto Cap" ) );
+                                               gtk_widget_show( GTK_WIDGET( button ) );
+                                               gtk_box_pack_end( GTK_BOX( hbox2 ), GTK_WIDGET( button ), TRUE, FALSE, 0 );
+                                               g_signal_connect( G_OBJECT( button ), "clicked", G_CALLBACK( OnBtnPatchAutoCap ), 0 );
+                                               gtk_widget_set_usize( GTK_WIDGET( button ), 60, -1 );
+                                       }
                                        {
                                                GtkButton* button = GTK_BUTTON( gtk_button_new_with_label( "CAP" ) );
                                                gtk_widget_show( GTK_WIDGET( button ) );