More unit/resolution stuff (most if it from Michael).

--Sven
This commit is contained in:
Sven Neumann 1999-03-03 17:48:29 +00:00
parent 151c624be1
commit 77f4d4abec
28 changed files with 394 additions and 163 deletions

View File

@ -1,3 +1,19 @@
Wed Mar 3 18:38:31 MET 1999 Sven Neumann <sven@gimp.org>
More unit/resolution stuff (most of it from Michael).
* app/gimpimage.c: use defaults from gimprc
* app/gdisplay.c: a new format_string for coordinates
* blend.c
* crop.c
* edit_selection.c
* rect_select.c: use the new format when displaying sizes
in the statusbar
* file_new_dialog.c: cleaned up the advanced/simple cases
Wed Mar 3 17:59:09 MET 1999 Sven Neumann <sven@gimp.org>
* gimprc.5.in

View File

@ -711,10 +711,28 @@ blend_motion (Tool *tool,
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id);
g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"),
abs(blend_tool->endx - blend_tool->startx),
abs(blend_tool->endy - blend_tool->starty));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector);
if (gdisp->dot_for_dot)
{
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx),
", ",
abs(blend_tool->endy - blend_tool->starty));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx) * unit_factor /
gdisp->gimage->xresolution,
", ",
abs(blend_tool->endy - blend_tool->starty) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id,
vector);
/* redraw the current tool */
draw_core_resume (blend_tool->core, tool);

View File

@ -711,10 +711,28 @@ blend_motion (Tool *tool,
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id);
g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"),
abs(blend_tool->endx - blend_tool->startx),
abs(blend_tool->endy - blend_tool->starty));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector);
if (gdisp->dot_for_dot)
{
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx),
", ",
abs(blend_tool->endy - blend_tool->starty));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx) * unit_factor /
gdisp->gimage->xresolution,
", ",
abs(blend_tool->endy - blend_tool->starty) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id,
vector);
/* redraw the current tool */
draw_core_resume (blend_tool->core, tool);

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -1015,7 +1015,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
if (gdisp->dot_for_dot)
{
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str, t_x, t_y);
gdisp->cursor_format_str, "", t_x, ", ", t_y);
}
else /* show real world units */
{
@ -1023,9 +1023,10 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str,
"",
(float)t_x * unit_factor / gdisp->gimage->xresolution,
(float)t_y * unit_factor / gdisp->gimage->yresolution,
gimp_unit_get_symbol (gdisp->gimage->unit));
", ",
(float)t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
}
@ -1064,25 +1065,27 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
if (gdisp->dot_for_dot)
{
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%d, %%d");
"%%s%%d%%s%%d");
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
gdisp->gimage->width, gdisp->gimage->height);
"", gdisp->gimage->width, ", ", gdisp->gimage->height);
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%.%df, %%.%df %%s",
"%%s%%.%df%%s%%.%df %s",
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_digits (gdisp->gimage->unit));
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_symbol (gdisp->gimage->unit));
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
"",
(float)gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(float)gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution,
gimp_unit_get_symbol (gdisp->gimage->unit));
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer );

View File

@ -405,11 +405,28 @@ crop_motion (Tool *tool,
crop->function == RESIZING_LEFT || crop->function == RESIZING_RIGHT)
{
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id);
g_snprintf (size, STATUSBAR_SIZE, _("Crop: %d x %d"),
(crop->tx2 - crop->tx1), (crop->ty2 - crop->ty1));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, size);
if (gdisp->dot_for_dot)
{
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(crop->tx2 - crop->tx1), " x ", (crop->ty2 - crop->ty1));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(float)(crop->tx2 - crop->tx1) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)(crop->ty2 - crop->ty1) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id,
size);
}
draw_core_resume (crop->core, tool);
}

View File

@ -264,7 +264,6 @@ file_new_cmd_callback (GtkWidget *widget,
GtkWidget *frame;
GtkWidget *radio_box;
gboolean advanced_options = FALSE;
GtkWidget *advanced_button;
GSList *group;
if(!new_dialog_run)
@ -312,7 +311,7 @@ file_new_cmd_callback (GtkWidget *widget,
vals->res_unit = last_res_unit;
}
if (vals->xresolution != vals->yresolution)
if (ABS (vals->xresolution - vals->yresolution) > 1e-5)
advanced_options = TRUE;
if (vals->type == INDEXED)
@ -419,8 +418,6 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0);
if (!advanced_options)
gtk_widget_show (vals->simple_res);
/* the advanced resolution stuff
(not shown by default, but used to keep track of all the variables) */
@ -444,7 +441,8 @@ file_new_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
_("pixels per "), 2, 3, 0.0);
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
if (ABS (vals->xresolution - vals->yresolution) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry),
vals->couple_resolutions, 1, 3, 3, 4);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed",
@ -453,29 +451,20 @@ file_new_cmd_callback (GtkWidget *widget,
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry,
TRUE, TRUE, 0);
if (advanced_options)
if (advanced_options != FALSE)
{
gtk_widget_show (vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
} else {
gtk_widget_show (vals->simple_res);
button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (button);
}
/* This code is commented out since it seems to be overkill...
* vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
* gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
* gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
* gtk_widget_show (vals->change_size);
*/
if (advanced_options)
advanced_button = gtk_button_new_with_label (_("Advanced options <<"));
else
advanced_button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), advanced_button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (advanced_button);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new(FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);

View File

@ -1015,7 +1015,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
if (gdisp->dot_for_dot)
{
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str, t_x, t_y);
gdisp->cursor_format_str, "", t_x, ", ", t_y);
}
else /* show real world units */
{
@ -1023,9 +1023,10 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str,
"",
(float)t_x * unit_factor / gdisp->gimage->xresolution,
(float)t_y * unit_factor / gdisp->gimage->yresolution,
gimp_unit_get_symbol (gdisp->gimage->unit));
", ",
(float)t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
}
@ -1064,25 +1065,27 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
if (gdisp->dot_for_dot)
{
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%d, %%d");
"%%s%%d%%s%%d");
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
gdisp->gimage->width, gdisp->gimage->height);
"", gdisp->gimage->width, ", ", gdisp->gimage->height);
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%.%df, %%.%df %%s",
"%%s%%.%df%%s%%.%df %s",
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_digits (gdisp->gimage->unit));
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_symbol (gdisp->gimage->unit));
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
"",
(float)gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(float)gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution,
gimp_unit_get_symbol (gdisp->gimage->unit));
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer );

View File

@ -345,9 +345,28 @@ edit_selection_motion (Tool *tool,
#endif
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"),
(edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy));
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, offset);
if (gdisp->dot_for_dot)
{
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),
(edit_select.x - edit_select.origx),
", ",
(edit_select.y - edit_select.origy));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),
(edit_select.x - edit_select.origx) * unit_factor /
gdisp->gimage->xresolution,
", ",
(edit_select.y - edit_select.origy) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id,
offset);
draw_core_resume (edit_select.core, tool);
}

View File

@ -264,7 +264,6 @@ file_new_cmd_callback (GtkWidget *widget,
GtkWidget *frame;
GtkWidget *radio_box;
gboolean advanced_options = FALSE;
GtkWidget *advanced_button;
GSList *group;
if(!new_dialog_run)
@ -312,7 +311,7 @@ file_new_cmd_callback (GtkWidget *widget,
vals->res_unit = last_res_unit;
}
if (vals->xresolution != vals->yresolution)
if (ABS (vals->xresolution - vals->yresolution) > 1e-5)
advanced_options = TRUE;
if (vals->type == INDEXED)
@ -419,8 +418,6 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0);
if (!advanced_options)
gtk_widget_show (vals->simple_res);
/* the advanced resolution stuff
(not shown by default, but used to keep track of all the variables) */
@ -444,7 +441,8 @@ file_new_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
_("pixels per "), 2, 3, 0.0);
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
if (ABS (vals->xresolution - vals->yresolution) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry),
vals->couple_resolutions, 1, 3, 3, 4);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed",
@ -453,29 +451,20 @@ file_new_cmd_callback (GtkWidget *widget,
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry,
TRUE, TRUE, 0);
if (advanced_options)
if (advanced_options != FALSE)
{
gtk_widget_show (vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
} else {
gtk_widget_show (vals->simple_res);
button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (button);
}
/* This code is commented out since it seems to be overkill...
* vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
* gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
* gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
* gtk_widget_show (vals->change_size);
*/
if (advanced_options)
advanced_button = gtk_button_new_with_label (_("Advanced options <<"));
else
advanced_button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), advanced_button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (advanced_button);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new(FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);

View File

@ -1015,7 +1015,7 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
if (gdisp->dot_for_dot)
{
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str, t_x, t_y);
gdisp->cursor_format_str, "", t_x, ", ", t_y);
}
else /* show real world units */
{
@ -1023,9 +1023,10 @@ gdisplay_update_cursor (GDisplay *gdisp, int x, int y)
g_snprintf (buffer, CURSOR_STR_LENGTH,
gdisp->cursor_format_str,
"",
(float)t_x * unit_factor / gdisp->gimage->xresolution,
(float)t_y * unit_factor / gdisp->gimage->yresolution,
gimp_unit_get_symbol (gdisp->gimage->unit));
", ",
(float)t_y * unit_factor / gdisp->gimage->yresolution);
}
gtk_label_set (GTK_LABEL (gdisp->cursor_label), buffer);
}
@ -1064,25 +1065,27 @@ gdisplay_resize_cursor_label (GDisplay *gdisp)
if (gdisp->dot_for_dot)
{
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%d, %%d");
"%%s%%d%%s%%d");
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
gdisp->gimage->width, gdisp->gimage->height);
"", gdisp->gimage->width, ", ", gdisp->gimage->height);
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (gdisp->cursor_format_str, sizeof(gdisp->cursor_format_str),
"%%.%df, %%.%df %%s",
"%%s%%.%df%%s%%.%df %s",
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_digits (gdisp->gimage->unit));
gimp_unit_get_digits (gdisp->gimage->unit),
gimp_unit_get_symbol (gdisp->gimage->unit));
g_snprintf (buffer, sizeof(buffer), gdisp->cursor_format_str,
"",
(float)gdisp->gimage->width * unit_factor /
gdisp->gimage->xresolution,
", ",
(float)gdisp->gimage->height * unit_factor /
gdisp->gimage->yresolution,
gimp_unit_get_symbol (gdisp->gimage->unit));
gdisp->gimage->yresolution);
}
cursor_label_width =
gdk_string_width ( gtk_widget_get_style(gdisp->cursor_label)->font, buffer );

View File

@ -31,6 +31,7 @@
#include "undo.h"
#include "gimpsignal.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
@ -168,9 +169,9 @@ static void gimp_image_init (GimpImage *gimage)
gimage->comp_preview = NULL;
gimage->parasites = parasite_list_new();
gimp_matrix_identity(gimage->transform);
gimage->xresolution = 72.0; /* maybe should be rc-supplied default? */
gimage->yresolution = 72.0;
gimage->unit = UNIT_PIXEL;
gimage->xresolution = default_xresolution;
gimage->yresolution = default_yresolution;
gimage->unit = default_units;
gimage->save_proc= NULL;
}

View File

@ -264,7 +264,6 @@ file_new_cmd_callback (GtkWidget *widget,
GtkWidget *frame;
GtkWidget *radio_box;
gboolean advanced_options = FALSE;
GtkWidget *advanced_button;
GSList *group;
if(!new_dialog_run)
@ -312,7 +311,7 @@ file_new_cmd_callback (GtkWidget *widget,
vals->res_unit = last_res_unit;
}
if (vals->xresolution != vals->yresolution)
if (ABS (vals->xresolution - vals->yresolution) > 1e-5)
advanced_options = TRUE;
if (vals->type == INDEXED)
@ -419,8 +418,6 @@ file_new_cmd_callback (GtkWidget *widget,
gtk_signal_connect (GTK_OBJECT (vals->simple_res), "value_changed",
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->simple_res, TRUE, TRUE, 0);
if (!advanced_options)
gtk_widget_show (vals->simple_res);
/* the advanced resolution stuff
(not shown by default, but used to keep track of all the variables) */
@ -444,7 +441,8 @@ file_new_cmd_callback (GtkWidget *widget,
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (vals->resolution_sizeentry),
_("pixels per "), 2, 3, 0.0);
vals->couple_resolutions = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
if (ABS (vals->xresolution - vals->yresolution) < 1e-5)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (vals->couple_resolutions), TRUE);
gtk_table_attach_defaults (GTK_TABLE (vals->resolution_sizeentry),
vals->couple_resolutions, 1, 3, 3, 4);
gtk_signal_connect (GTK_OBJECT (vals->resolution_sizeentry), "value_changed",
@ -453,29 +451,20 @@ file_new_cmd_callback (GtkWidget *widget,
(GtkSignalFunc)file_new_resolution_callback, vals);
gtk_box_pack_start (GTK_BOX (vbox2), vals->resolution_sizeentry,
TRUE, TRUE, 0);
if (advanced_options)
if (advanced_options != FALSE)
{
gtk_widget_show (vals->resolution_sizeentry);
gtk_widget_show (vals->couple_resolutions);
} else {
gtk_widget_show (vals->simple_res);
button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (button);
}
/* This code is commented out since it seems to be overkill...
* vals->change_size = gtk_check_button_new_with_label (_("Change image size with resolution changes"));
* gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vals->change_size), TRUE);
* gtk_box_pack_start (GTK_BOX (vbox2), vals->change_size, TRUE, TRUE, 0);
* gtk_widget_show (vals->change_size);
*/
if (advanced_options)
advanced_button = gtk_button_new_with_label (_("Advanced options <<"));
else
advanced_button = gtk_button_new_with_label (_("Advanced options >>"));
gtk_box_pack_start (GTK_BOX (vbox2), advanced_button,
FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
(GtkSignalFunc)file_new_advanced_res_callback, vals);
gtk_widget_show (advanced_button);
/* hbox containing the Image type and fill type frames */
hbox = gtk_hbox_new(FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);

View File

@ -605,8 +605,25 @@ rect_select_motion (Tool *tool,
}
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id);
g_snprintf (size, STATUSBAR_SIZE, _("Selection: %d x %d"), abs(rect_sel->w), abs(rect_sel->h));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, size);
if (gdisp->dot_for_dot)
{
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "), abs(rect_sel->w), " x ", abs(rect_sel->h));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "),
(float)abs(rect_sel->w) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)abs(rect_sel->h) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id,
size);
draw_core_resume (rect_sel->core, tool);
}

View File

@ -711,10 +711,28 @@ blend_motion (Tool *tool,
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id);
g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"),
abs(blend_tool->endx - blend_tool->startx),
abs(blend_tool->endy - blend_tool->starty));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector);
if (gdisp->dot_for_dot)
{
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx),
", ",
abs(blend_tool->endy - blend_tool->starty));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx) * unit_factor /
gdisp->gimage->xresolution,
", ",
abs(blend_tool->endy - blend_tool->starty) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id,
vector);
/* redraw the current tool */
draw_core_resume (blend_tool->core, tool);

View File

@ -405,11 +405,28 @@ crop_motion (Tool *tool,
crop->function == RESIZING_LEFT || crop->function == RESIZING_RIGHT)
{
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id);
g_snprintf (size, STATUSBAR_SIZE, _("Crop: %d x %d"),
(crop->tx2 - crop->tx1), (crop->ty2 - crop->ty1));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, size);
if (gdisp->dot_for_dot)
{
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(crop->tx2 - crop->tx1), " x ", (crop->ty2 - crop->ty1));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(float)(crop->tx2 - crop->tx1) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)(crop->ty2 - crop->ty1) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id,
size);
}
draw_core_resume (crop->core, tool);
}

View File

@ -345,9 +345,28 @@ edit_selection_motion (Tool *tool,
#endif
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"),
(edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy));
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, offset);
if (gdisp->dot_for_dot)
{
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),
(edit_select.x - edit_select.origx),
", ",
(edit_select.y - edit_select.origy));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),
(edit_select.x - edit_select.origx) * unit_factor /
gdisp->gimage->xresolution,
", ",
(edit_select.y - edit_select.origy) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id,
offset);
draw_core_resume (edit_select.core, tool);
}

View File

@ -711,10 +711,28 @@ blend_motion (Tool *tool,
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id);
g_snprintf (vector, STATUSBAR_SIZE, _("Blend: %d, %d"),
abs(blend_tool->endx - blend_tool->startx),
abs(blend_tool->endy - blend_tool->starty));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id, vector);
if (gdisp->dot_for_dot)
{
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx),
", ",
abs(blend_tool->endy - blend_tool->starty));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (vector, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Blend: "),
abs(blend_tool->endx - blend_tool->startx) * unit_factor /
gdisp->gimage->xresolution,
", ",
abs(blend_tool->endy - blend_tool->starty) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), blend_tool->context_id,
vector);
/* redraw the current tool */
draw_core_resume (blend_tool->core, tool);

View File

@ -405,11 +405,28 @@ crop_motion (Tool *tool,
crop->function == RESIZING_LEFT || crop->function == RESIZING_RIGHT)
{
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), crop->context_id);
g_snprintf (size, STATUSBAR_SIZE, _("Crop: %d x %d"),
(crop->tx2 - crop->tx1), (crop->ty2 - crop->ty1));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id, size);
if (gdisp->dot_for_dot)
{
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(crop->tx2 - crop->tx1), " x ", (crop->ty2 - crop->ty1));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Crop: "),
(float)(crop->tx2 - crop->tx1) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)(crop->ty2 - crop->ty1) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), crop->context_id,
size);
}
draw_core_resume (crop->core, tool);
}

View File

@ -345,9 +345,28 @@ edit_selection_motion (Tool *tool,
#endif
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"),
(edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy));
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id, offset);
if (gdisp->dot_for_dot)
{
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),
(edit_select.x - edit_select.origx),
", ",
(edit_select.y - edit_select.origy));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (offset, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Move: "),
(edit_select.x - edit_select.origx) * unit_factor /
gdisp->gimage->xresolution,
", ",
(edit_select.y - edit_select.origy) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id,
offset);
draw_core_resume (edit_select.core, tool);
}

View File

@ -605,8 +605,25 @@ rect_select_motion (Tool *tool,
}
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id);
g_snprintf (size, STATUSBAR_SIZE, _("Selection: %d x %d"), abs(rect_sel->w), abs(rect_sel->h));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, size);
if (gdisp->dot_for_dot)
{
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "), abs(rect_sel->w), " x ", abs(rect_sel->h));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "),
(float)abs(rect_sel->w) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)abs(rect_sel->h) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id,
size);
draw_core_resume (rect_sel->core, tool);
}

View File

@ -605,8 +605,25 @@ rect_select_motion (Tool *tool,
}
gtk_statusbar_pop (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id);
g_snprintf (size, STATUSBAR_SIZE, _("Selection: %d x %d"), abs(rect_sel->w), abs(rect_sel->h));
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id, size);
if (gdisp->dot_for_dot)
{
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "), abs(rect_sel->w), " x ", abs(rect_sel->h));
}
else /* show real world units */
{
float unit_factor = gimp_unit_get_factor (gdisp->gimage->unit);
g_snprintf (size, STATUSBAR_SIZE, gdisp->cursor_format_str,
_("Selection: "),
(float)abs(rect_sel->w) * unit_factor /
gdisp->gimage->xresolution,
" x ",
(float)abs(rect_sel->h) * unit_factor /
gdisp->gimage->yresolution);
}
gtk_statusbar_push (GTK_STATUSBAR (gdisp->statusbar), rect_sel->context_id,
size);
draw_core_resume (rect_sel->core, tool);
}