[gnome-photos] tool-crop: Update crop presets
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] tool-crop: Update crop presets
- Date: Fri, 4 Mar 2016 07:57:12 +0000 (UTC)
commit 1ba4cee6b258dacefbcdac4ed91a7cbf9e0b5c14
Author: Umang Jain <mailumangjain gmail com>
Date: Wed Mar 2 15:36:55 2016 +0530
tool-crop: Update crop presets
https://bugzilla.gnome.org/show_bug.cgi?id=762942
src/photos-tool-crop.c | 64 ++++++-----------------------------------------
1 files changed, 9 insertions(+), 55 deletions(-)
---
diff --git a/src/photos-tool-crop.c b/src/photos-tool-crop.c
index 66af08b..8fb3873 100644
--- a/src/photos-tool-crop.c
+++ b/src/photos-tool-crop.c
@@ -102,8 +102,7 @@ typedef enum
{
PHOTOS_TOOL_CROP_ASPECT_RATIO_ANY,
PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS,
- PHOTOS_TOOL_CROP_ASPECT_RATIO_ORIGINAL,
- PHOTOS_TOOL_CROP_ASPECT_RATIO_SCREEN
+ PHOTOS_TOOL_CROP_ASPECT_RATIO_ORIGINAL
} PhotosToolCropAspectRatioType;
typedef struct _PhotosToolCropConstraint PhotosToolCropConstraint;
@@ -130,11 +129,14 @@ enum
static PhotosToolCropConstraint CONSTRAINTS[] =
{
{ PHOTOS_TOOL_CROP_ASPECT_RATIO_ANY, N_("Free"), 0, 0 },
- { PHOTOS_TOOL_CROP_ASPECT_RATIO_ORIGINAL, N_("Original Size"), 0, 0 },
- { PHOTOS_TOOL_CROP_ASPECT_RATIO_SCREEN, N_("Screen"), 0, 0 },
- { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("Golden ratio"), 100000, 161803},
- { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("Square"), 1, 1 },
- { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("A paper sizes"), 297, 420 }
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_ORIGINAL, N_("Original"), 0, 0 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("1×1 (Square)"), 1, 1 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("10×8 / 5×4"), 4, 5 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("4×3 / 8×6 (1024×768)"), 3, 4 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("7×5"), 5, 7 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("3×2 / 6×4"), 2, 3 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("16×10 (1280×800)"), 10, 16 },
+ { PHOTOS_TOOL_CROP_ASPECT_RATIO_BASIS, N_("16×9 (1920×1080)"), 9, 16 }
};
static const gdouble CROP_MIN_SIZE = 16.0;
@@ -161,19 +163,6 @@ photos_tool_crop_calculate_aspect_ratio (PhotosToolCrop *self, guint constraint)
ret_val = (gdouble) self->bbox_source.width / self->bbox_source.height;
break;
- case PHOTOS_TOOL_CROP_ASPECT_RATIO_SCREEN:
- {
- GdkScreen *screen;
- gint height;
- gint width;
-
- screen = gdk_screen_get_default ();
- height = gdk_screen_get_height (screen);
- width = gdk_screen_get_width (screen);
- ret_val = (gdouble) width / height;
- break;
- }
-
default:
g_assert_not_reached ();
}
@@ -817,19 +806,10 @@ photos_tool_crop_list_box_update (PhotosToolCrop *self, GtkListBoxRow *active_ro
for (i = 0; (row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->list_box), i)) != NULL; i++)
{
- GtkStyleContext *context;
GtkWidget *image;
- GtkWidget *ratio_label;
image = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "image"));
gtk_widget_set_visible (image, row == active_row);
-
- ratio_label = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "ratio-label"));
- context = gtk_widget_get_style_context (ratio_label);
- if (row == active_row)
- gtk_style_context_remove_class (context, "dim-label");
- else
- gtk_style_context_add_class (context, "dim-label");
}
}
@@ -962,33 +942,17 @@ static void
photos_tool_crop_activate (PhotosTool *tool, PhotosBaseItem *item, PhotosImageView *view)
{
PhotosToolCrop *self = PHOTOS_TOOL_CROP (tool);
- GtkListBoxRow *row;
gboolean got_bbox_source;
gdouble height = -1.0;
gdouble width = -1.0;
gdouble x = -1.0;
gdouble y = -1.0;
- gint i;
got_bbox_source = photos_base_item_get_bbox_source (item, &self->bbox_source);
g_return_if_fail (got_bbox_source);
self->view = GTK_WIDGET (view);
- for (i = 0; (row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->list_box), i)) != NULL; i++)
- {
- GtkWidget *ratio_label;
- gchar *ratio_text;
- gdouble constraint_aspect_ratio;
-
- constraint_aspect_ratio = photos_tool_crop_calculate_aspect_ratio (self, i + 1);
- /* Translators: this is the aspect ratio of the crop tool */
- ratio_text = g_strdup_printf (_("%.2f"), constraint_aspect_ratio);
- ratio_label = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "ratio-label"));
- gtk_label_set_text (GTK_LABEL (ratio_label), ratio_text);
- g_free (ratio_text);
- }
-
if (photos_base_item_operation_get (item,
"gegl:crop",
"height", &height,
@@ -1221,11 +1185,9 @@ photos_tool_crop_init (PhotosToolCrop *self)
for (i = 1; i < G_N_ELEMENTS (CONSTRAINTS); i++)
{
- GtkStyleContext *context;
GtkWidget *grid;
GtkWidget *image;
GtkWidget *label;
- GtkWidget *ratio_label;
GtkWidget *row;
row = gtk_list_box_row_new ();
@@ -1247,15 +1209,7 @@ photos_tool_crop_init (PhotosToolCrop *self)
gtk_image_set_pixel_size (GTK_IMAGE (image), 16);
gtk_container_add (GTK_CONTAINER (grid), image);
- ratio_label = gtk_label_new (NULL);
- gtk_widget_set_halign (ratio_label, GTK_ALIGN_END);
- gtk_widget_set_hexpand (ratio_label, TRUE);
- context = gtk_widget_get_style_context (ratio_label);
- gtk_style_context_add_class (context, "dim-label");
- gtk_container_add (GTK_CONTAINER (grid), ratio_label);
-
g_object_set_data (G_OBJECT (row), "image", image);
- g_object_set_data (G_OBJECT (row), "ratio-label", ratio_label);
}
photos_tool_crop_set_active (self, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]