[gthumb] crop tool: added a new grid mode to view the center lines of the current selection



commit d4a8873c9cc738e117b8b4ca9fa2156642efaf06
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Jan 17 21:38:20 2011 +0100

    crop tool: added a new grid mode to view the center lines of the current selection
    
    [new feature]

 extensions/file_tools/gth-file-tool-crop.c |    6 +++++-
 gthumb/gth-image-selector.c                |   18 +++++++++++++-----
 gthumb/gth-image-selector.h                |    3 ++-
 3 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-crop.c b/extensions/file_tools/gth-file-tool-crop.c
index bb9a4fe..3b18f94 100644
--- a/extensions/file_tools/gth-file-tool-crop.c
+++ b/extensions/file_tools/gth-file-tool-crop.c
@@ -422,7 +422,11 @@ gth_file_tool_crop_get_options (GthFileTool *base)
 	gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("ratio_h_spinbutton")), MAX (eel_gconf_get_integer (PREF_CROP_ASPECT_RATIO_HEIGHT, 1), 1));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("invert_ratio_checkbutton")), eel_gconf_get_boolean (PREF_CROP_ASPECT_RATIO_INVERT, FALSE));
 
-	self->priv->grid_type_combobox = _gtk_combo_box_new_with_texts (_("None"), _("Rule of Thirds"), _("Golden Sections"), NULL);
+	self->priv->grid_type_combobox = _gtk_combo_box_new_with_texts (_("None"),
+									_("Rule of Thirds"),
+									_("Golden Sections"),
+									_("Center Lines"),
+									NULL);
 	gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->grid_type_combobox), eel_gconf_get_enum (PREF_CROP_GRID_TYPE, GTH_TYPE_GRID_TYPE, GTH_GRID_THIRDS));
 	gtk_widget_show (self->priv->grid_type_combobox);
 	gtk_box_pack_start (GTK_BOX (GET_WIDGET ("grid_type_combobox_box")), self->priv->grid_type_combobox, FALSE, FALSE, 0);
diff --git a/gthumb/gth-image-selector.c b/gthumb/gth-image-selector.c
index 7b236c4..a11ce54 100644
--- a/gthumb/gth-image-selector.c
+++ b/gthumb/gth-image-selector.c
@@ -652,12 +652,16 @@ paint_selection (GthImageSelector *self,
 
 		if (self->priv->grid_type == GTH_GRID_THIRDS) {
 			x_delta = selection_area.width / 3;
-			y_delta = selection_area.height /3;
+			y_delta = selection_area.height / 3;
 		}
 		else if (self->priv->grid_type == GTH_GRID_GOLDEN) {
 			x_delta = selection_area.width * GOLDER_RATIO_FACTOR;
 			y_delta = selection_area.height * GOLDER_RATIO_FACTOR;
 		}
+		else if (self->priv->grid_type == GTH_GRID_CENTER) {
+			x_delta = selection_area.width / 2;
+			y_delta = selection_area.height / 2;
+		}
 
 		grid_x1 = grid_x0 + x_delta;
 		grid_x2 = grid_x3 - x_delta;
@@ -667,14 +671,18 @@ paint_selection (GthImageSelector *self,
 		cairo_move_to (cr, grid_x1 + 0.5, grid_y0 + 0.5);
 		cairo_line_to (cr, grid_x1 + 0.5, grid_y3 + 0.5);
 
-		cairo_move_to (cr, grid_x2 + 0.5, grid_y0 + 0.5);
-		cairo_line_to (cr, grid_x2 + 0.5, grid_y3 + 0.5);
+		if (x_delta < selection_area.width / 2) {
+			cairo_move_to (cr, grid_x2 + 0.5, grid_y0 + 0.5);
+			cairo_line_to (cr, grid_x2 + 0.5, grid_y3 + 0.5);
+		}
 
 		cairo_move_to (cr, grid_x0 + 0.5, grid_y1 + 0.5);
 		cairo_line_to (cr, grid_x3 + 0.5, grid_y1 + 0.5);
 
-		cairo_move_to (cr, grid_x0 + 0.5, grid_y2 + 0.5);
-		cairo_line_to (cr, grid_x3 + 0.5, grid_y2 + 0.5);
+		if (y_delta < selection_area.height / 2) {
+			cairo_move_to (cr, grid_x0 + 0.5, grid_y2 + 0.5);
+			cairo_line_to (cr, grid_x3 + 0.5, grid_y2 + 0.5);
+		}
 	}
 
 	cairo_rectangle (cr,
diff --git a/gthumb/gth-image-selector.h b/gthumb/gth-image-selector.h
index 887445b..2d794f4 100644
--- a/gthumb/gth-image-selector.h
+++ b/gthumb/gth-image-selector.h
@@ -48,7 +48,8 @@ typedef enum {
 typedef enum {
 	GTH_GRID_NONE = 0,
 	GTH_GRID_THIRDS,
-	GTH_GRID_GOLDEN
+	GTH_GRID_GOLDEN,
+	GTH_GRID_CENTER
 } GthGridType;
 
 struct _GthImageSelector



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]