# HG changeset patch # User meillo@marmaro.de # Date 1267707257 -3600 # Node ID 5e282003f0c194c0f14445fdf65de59e378d8a4c # Parent 7e1cf00de1df470eb3b80c450cc698ae459ac5c7 minor changes; besser indenting diff -r 7e1cf00de1df -r 5e282003f0c1 callbacks.c --- a/callbacks.c Thu Mar 20 20:01:38 2008 +0100 +++ b/callbacks.c Thu Mar 04 13:54:17 2010 +0100 @@ -7,7 +7,7 @@ int image_width; int image_height; -float inc = 0.1; +float inc = 0.3; /* void update_spin_button_ratio(GtkWidget* spinbutton) { g_print("ratio change: %f\n", ratio); @@ -169,7 +169,7 @@ static GdkPixbuf* pixbuf_new; g_object_unref(pixbuf_new); - pixbuf_new = gdk_pixbuf_scale_simple(image_buffer, image_width, image_height, GDK_INTERP_HYPER); + pixbuf_new = gdk_pixbuf_scale_simple(image_buffer, image_width, image_height, GDK_INTERP_BILINEAR); gtk_image_set_from_pixbuf((GtkImage*) lookup_widget(cropper_window, "image_area"), pixbuf_new); } @@ -227,6 +227,21 @@ void on_cropper_window_create(GtkObject* object, gpointer user_data) { image_width = gdk_pixbuf_get_width(image_buffer); image_height = gdk_pixbuf_get_height(image_buffer); + + /* + image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL); + image_area = gtk_image_new_from_pixbuf(image_buffer); + + int w, h; + GtkWidget* image_a; + + image_a = (GtkWidget*) lookup_widget(cropper_window, "image_area"); + gdk_drawable_get_size (image_a->window, &w, &h); + + image_width = w - 200; + image_height = h - 150; + set_zoom(); + */ } void on_cropper_window_destroy(GtkObject* object, gpointer user_data) { diff -r 7e1cf00de1df -r 5e282003f0c1 interface.c --- a/interface.c Thu Mar 20 20:01:38 2008 +0100 +++ b/interface.c Thu Mar 04 13:54:17 2010 +0100 @@ -72,7 +72,6 @@ GtkWidget *frame1; GtkWidget *vbox7; GtkWidget *nav_container; - GtkWidget *image_area; GtkWidget *hbox16; GtkWidget *hbox17; GtkWidget *crop_zoom_in_button; @@ -356,6 +355,7 @@ /* image_area */ image_buffer = gdk_pixbuf_new_from_file(image_filename, NULL); image_area = gtk_image_new_from_pixbuf(image_buffer); + gtk_widget_set_name(image_area, "image_area"); gtk_widget_show(image_area); gtk_box_pack_start(GTK_BOX(nav_container), image_area, TRUE, TRUE, 0); diff -r 7e1cf00de1df -r 5e282003f0c1 main.c --- a/main.c Thu Mar 20 20:01:38 2008 +0100 +++ b/main.c Thu Mar 04 13:54:17 2010 +0100 @@ -6,32 +6,24 @@ int main (int argc, char *argv[]) { - /* printf("argc: %i\nargv[0]: %s\nargv[1]: %s\nargv[2]: %s\n", argc, argv[0], argv[1], argv[2]); */ - /* commandline option handling */ if (argc == 2) { - if (strcmp(argv[1], "--version") == 0) { - g_print("cropper - a crop frontend for convert\nversion 0.1\nhttp://prog.marmaro.de\n"); - return(0); - } else { - image_filename = argv[1]; - } + image_filename = argv[1]; } else { - g_print("usage: cropper \n cropper --version\n"); - return(1); + g_print("cropper -- a crop frontend to convert\n"); + g_print("usage: cropper IMAGE\n"); + return 1; } + gtk_set_locale(); + gtk_init(&argc, &argv); + add_pixmap_directory("/usr/share/pixmaps"); - gtk_set_locale (); - gtk_init (&argc, &argv); + cropper_window = create_cropper_window(); + gtk_widget_show(cropper_window); + gtk_main (); - add_pixmap_directory ("/usr/share/pixmaps"); - - cropper_window = create_cropper_window (); - gtk_widget_show (cropper_window); - - gtk_main (); - return 0; + return 0; } diff -r 7e1cf00de1df -r 5e282003f0c1 main.h --- a/main.h Thu Mar 20 20:01:38 2008 +0100 +++ b/main.h Thu Mar 04 13:54:17 2010 +0100 @@ -8,6 +8,7 @@ /* from interface.h */ GtkWidget* create_cropper_window(void); +GtkWidget *image_area; GdkPixbuf *image_buffer; #endif diff -r 7e1cf00de1df -r 5e282003f0c1 support.c --- a/support.c Thu Mar 20 20:01:38 2008 +0100 +++ b/support.c Thu Mar 04 13:54:17 2010 +0100 @@ -10,10 +10,10 @@ GtkWidget* lookup_widget(GtkWidget* widget, const gchar* widget_name) { - GtkWidget* parent; + GtkWidget* parent; GtkWidget* found_widget; - for (;;) { + for (;;) { if (GTK_IS_MENU (widget)) { parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); } else { @@ -28,11 +28,11 @@ widget = parent; } - found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), widget_name); - if (!found_widget) { - g_warning ("Widget not found: %s", widget_name); + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), widget_name); + if (!found_widget) { + g_warning ("Widget not found: %s", widget_name); } - return found_widget; + return found_widget; } @@ -40,16 +40,16 @@ /* Use this function to set the directory containing installed pixmaps. */ void add_pixmap_directory(const gchar* directory) { - pixmaps_directories = g_list_prepend (pixmaps_directories, g_strdup (directory)); + pixmaps_directories = g_list_prepend (pixmaps_directories, g_strdup (directory)); } /* This is an internally used function to find pixmap files. */ static gchar* find_pixmap_file(const gchar* filename) { - GList* elem; + GList* elem; - /* We step through each of the pixmaps directory to find it. */ - elem = pixmaps_directories; - while (elem) { + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) { gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, G_DIR_SEPARATOR_S, filename); if (g_file_test (pathname, G_FILE_TEST_EXISTS)) { return pathname; @@ -57,66 +57,66 @@ g_free (pathname); elem = elem->next; } - return NULL; + return NULL; } /* This is an internally used function to create pixmaps. */ GtkWidget* create_pixmap(GtkWidget* widget, const gchar* filename) { - gchar* pathname = NULL; - GtkWidget* pixmap; + gchar* pathname = NULL; + GtkWidget* pixmap; - if (!filename || !filename[0]) { + if (!filename || !filename[0]) { return gtk_image_new (); } - pathname = find_pixmap_file (filename); + pathname = find_pixmap_file (filename); - if (!pathname) { + if (!pathname) { g_warning ("Couldn't find pixmap file: %s", filename); return gtk_image_new (); } - pixmap = gtk_image_new_from_file (pathname); - g_free(pathname); - return pixmap; + pixmap = gtk_image_new_from_file (pathname); + g_free(pathname); + return pixmap; } /* This is an internally used function to create pixmaps. */ GdkPixbuf* create_pixbuf(const gchar* filename) { - gchar* pathname = NULL; - GdkPixbuf* pixbuf; - GError* error = NULL; + gchar* pathname = NULL; + GdkPixbuf* pixbuf; + GError* error = NULL; - if (!filename || !filename[0]) { + if (!filename || !filename[0]) { return NULL; } - pathname = find_pixmap_file(filename); + pathname = find_pixmap_file(filename); - if (!pathname) { + if (!pathname) { g_warning ("Couldn't find pixmap file: %s", filename); return NULL; } - pixbuf = gdk_pixbuf_new_from_file (pathname, &error); - if (!pixbuf) { + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) { fprintf(stderr, "Failed to load pixbuf file: %s: %s\n", pathname, error->message); g_error_free(error); } - g_free(pathname); - return pixbuf; + g_free(pathname); + return pixbuf; } /* This is used to set ATK action descriptions. */ void glade_set_atk_action_description(AtkAction* action, const gchar* action_name, const gchar* description) { - gint n_actions; + gint n_actions; gint i; - n_actions = atk_action_get_n_actions (action); - for (i = 0; i < n_actions; i++) { + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) { if (!strcmp (atk_action_get_name (action, i), action_name)) { atk_action_set_description (action, i, description); }