cropper

diff callbacks.c @ 2:e359bea4c8ac

added code for ratio swap; new names for ratio operations; added main.h; some more
author meillo@marmaro.de
date Tue, 04 Dec 2007 23:20:51 +0100
parents 80535e4deaa4
children 6aaba3a61563
line diff
     1.1 --- a/callbacks.c	Tue Dec 04 20:23:25 2007 +0100
     1.2 +++ b/callbacks.c	Tue Dec 04 23:20:51 2007 +0100
     1.3 @@ -1,43 +1,38 @@
     1.4  #include <gtk/gtk.h>
     1.5  
     1.6 +#include "main.h"
     1.7  #include "callbacks.h"
     1.8  #include "interface.h"
     1.9  #include "support.h"
    1.10  
    1.11  
    1.12 -void on_none1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.13 +
    1.14 +void on_ratio_none_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.15 +	ratio = 0;
    1.16 +}
    1.17 +
    1.18 +
    1.19 +void on_ratio_square_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.20 +	ratio = 1;
    1.21 +}
    1.22 +
    1.23 +
    1.24 +void on_ratio_4x3_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.25 +	ratio = 4/3;
    1.26 +}
    1.27 +
    1.28 +
    1.29 +void on_ratio_3x2_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.30 +	ratio = 3/2;
    1.31 +}
    1.32 +
    1.33 +
    1.34 +void on_ratio_custom_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.35  
    1.36  }
    1.37  
    1.38  
    1.39 -void on_square1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.40  
    1.41 -}
    1.42 -
    1.43 -
    1.44 -void on_4x3__book__dvd_1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.45 -
    1.46 -}
    1.47 -
    1.48 -
    1.49 -void on_4x6__postcard_1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.50 -
    1.51 -}
    1.52 -
    1.53 -
    1.54 -void on_5x1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.55 -
    1.56 -}
    1.57 -
    1.58 -
    1.59 -void on_8x1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.60 -
    1.61 -}
    1.62 -
    1.63 -
    1.64 -void on_custom1_activate (GtkMenuItem* menuitem, gpointer user_data) {
    1.65 -
    1.66 -}
    1.67  
    1.68  
    1.69  void on_ratio_w_spinbutton_value_changed (GtkSpinButton* spinbutton, gpointer user_data) {
    1.70 @@ -50,11 +45,6 @@
    1.71  }
    1.72  
    1.73  
    1.74 -void on_ratio_swap_button_clicked (GtkButton* button, gpointer user_data) {
    1.75 -
    1.76 -}
    1.77 -
    1.78 -
    1.79  void on_ratio_h_spinbutton_change_value (GtkSpinButton* spinbutton, GtkScrollType scroll, gpointer user_data) {
    1.80  
    1.81  }
    1.82 @@ -65,12 +55,23 @@
    1.83  }
    1.84  
    1.85  
    1.86 +void on_ratio_swap_button_clicked (GtkButton* button, gpointer user_data) {
    1.87 +	gint h;
    1.88 +	
    1.89 +	h = gtk_spin_button_get_value_as_int(lookup_widget(cropper_window, "ratio_w_spinbutton"));
    1.90 +	gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_w_spinbutton"), gtk_spin_button_get_value(lookup_widget(cropper_window, "ratio_h_spinbutton")));
    1.91 +	gtk_spin_button_set_value(lookup_widget(cropper_window, "ratio_h_spinbutton"), h);
    1.92 +}
    1.93 +
    1.94 +
    1.95 +
    1.96 +
    1.97 +
    1.98  gboolean on_cropper_window_delete_event (GtkWidget* widget, GdkEvent *event, gpointer user_data) {
    1.99 -	g_print("thanks for using the program - visit http://prog.marmaro.de\n");
   1.100 +	/* g_print("thanks for using the program - visit http://prog.marmaro.de\n"); */
   1.101  	return FALSE;
   1.102  }
   1.103  
   1.104 -
   1.105  void on_cropper_window_destroy (GtkObject* object, gpointer user_data) {
   1.106  	gtk_main_quit();
   1.107  }