mirror of https://github.com/GNOME/gimp.git
app: enable image new's resolution chain button only if xres == yres
This commit is contained in:
parent
a8592e7352
commit
3abb84022a
|
@ -192,11 +192,7 @@ image_new_dialog_set (GtkWidget *widget,
|
|||
template = gimp_image_new_get_last_template (dialog->context->gimp,
|
||||
image);
|
||||
|
||||
/* make sure the resolution values are copied first (see bug #546924) */
|
||||
gimp_config_sync (G_OBJECT (template), G_OBJECT (dialog->template),
|
||||
GIMP_TEMPLATE_PARAM_COPY_FIRST);
|
||||
gimp_config_sync (G_OBJECT (template), G_OBJECT (dialog->template),
|
||||
0);
|
||||
image_new_template_changed (dialog->context, template, dialog);
|
||||
|
||||
g_object_unref (template);
|
||||
}
|
||||
|
@ -246,11 +242,23 @@ image_new_template_changed (GimpContext *context,
|
|||
GimpTemplate *template,
|
||||
ImageNewDialog *dialog)
|
||||
{
|
||||
gchar *comment;
|
||||
GimpTemplateEditor *editor;
|
||||
GtkWidget *chain;
|
||||
gdouble xres, yres;
|
||||
gchar *comment;
|
||||
|
||||
if (!template)
|
||||
if (! template)
|
||||
return;
|
||||
|
||||
editor = GIMP_TEMPLATE_EDITOR (dialog->editor);
|
||||
chain = gimp_template_editor_get_resolution_chain (editor);
|
||||
|
||||
xres = gimp_template_get_resolution_x (template);
|
||||
yres = gimp_template_get_resolution_y (template);
|
||||
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain),
|
||||
ABS (xres - yres) < GIMP_MIN_RESOLUTION);
|
||||
|
||||
comment = (gchar *) gimp_template_get_comment (template);
|
||||
|
||||
if (! comment || ! strlen (comment))
|
||||
|
|
|
@ -64,6 +64,7 @@ struct _GimpTemplateEditorPrivate
|
|||
GtkWidget *pixel_label;
|
||||
GtkWidget *more_label;
|
||||
GtkWidget *resolution_se;
|
||||
GtkWidget *chain_button;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(editor) \
|
||||
|
@ -140,7 +141,6 @@ gimp_template_editor_constructed (GObject *object)
|
|||
GtkWidget *height;
|
||||
GtkWidget *xres;
|
||||
GtkWidget *yres;
|
||||
GtkWidget *chainbutton;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
|
@ -359,20 +359,20 @@ gimp_template_editor_constructed (GObject *object)
|
|||
FALSE);
|
||||
|
||||
/* the resolution chainbutton */
|
||||
chainbutton = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se), chainbutton,
|
||||
1, 2, 0, 2);
|
||||
gtk_widget_show (chainbutton);
|
||||
private->chain_button = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
|
||||
gtk_table_attach_defaults (GTK_TABLE (private->resolution_se),
|
||||
private->chain_button, 1, 2, 0, 2);
|
||||
gtk_widget_show (private->chain_button);
|
||||
|
||||
gimp_prop_coordinates_connect (G_OBJECT (template),
|
||||
"xresolution", "yresolution",
|
||||
"resolution-unit",
|
||||
private->resolution_se, chainbutton,
|
||||
private->resolution_se, private->chain_button,
|
||||
1.0, 1.0);
|
||||
|
||||
focus_chain = g_list_prepend (focus_chain,
|
||||
GIMP_SIZE_ENTRY (private->resolution_se)->unitmenu);
|
||||
focus_chain = g_list_prepend (focus_chain, chainbutton);
|
||||
focus_chain = g_list_prepend (focus_chain, private->chain_button);
|
||||
focus_chain = g_list_prepend (focus_chain, yres);
|
||||
focus_chain = g_list_prepend (focus_chain, xres);
|
||||
|
||||
|
@ -557,6 +557,22 @@ gimp_template_editor_get_size_se (GimpTemplateEditor *editor)
|
|||
return GET_PRIVATE (editor)->size_se;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_template_editor_get_resolution_se (GimpTemplateEditor *editor)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
|
||||
|
||||
return GET_PRIVATE (editor)->resolution_se;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_template_editor_get_resolution_chain (GimpTemplateEditor *editor)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_TEMPLATE_EDITOR (editor), NULL);
|
||||
|
||||
return GET_PRIVATE (editor)->chain_button;
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ GimpTemplate * gimp_template_editor_get_template (GimpTemplateEditor *editor);
|
|||
void gimp_template_editor_show_advanced (GimpTemplateEditor *editor,
|
||||
gboolean expanded);
|
||||
GtkWidget * gimp_template_editor_get_size_se (GimpTemplateEditor *editor);
|
||||
GtkWidget * gimp_template_editor_get_resolution_se
|
||||
(GimpTemplateEditor *editor);
|
||||
GtkWidget * gimp_template_editor_get_resolution_chain
|
||||
(GimpTemplateEditor *editor);
|
||||
|
||||
|
||||
#endif /* __GIMP_TEMPLATE_EDITOR_H__ */
|
||||
|
|
Loading…
Reference in New Issue