gimprc.c replaced usage of fixed buffers with dynamic ones, using
* gimprc.c * gradient.c: replaced usage of fixed buffers with dynamic ones, using g_strdup_printf and friends. -Yosh
This commit is contained in:
@ -1,3 +1,11 @@
|
||||
Sun Jan 9 14:58:18 PST 2000 Manish Singh <yosh@gimp.org>
|
||||
|
||||
Applied Patch by Daniel Egger, slightly modified.
|
||||
|
||||
* gimprc.c
|
||||
* gradient.c: replaced usage of fixed buffers with dynamic ones,
|
||||
using g_strdup_printf and friends.
|
||||
|
||||
Sun Jan 9 23:47:35 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/script-fu-console.c: fixed a problem that
|
||||
|
||||
41
app/gimprc.c
41
app/gimprc.c
@ -386,33 +386,33 @@ static GList *parse_add_directory_tokens (void)
|
||||
void
|
||||
parse_gimprc (void)
|
||||
{
|
||||
char libfilename[MAXPATHLEN];
|
||||
char filename[MAXPATHLEN];
|
||||
gchar *personal_gimprc;
|
||||
gchar *libfilename;
|
||||
gchar *filename;
|
||||
|
||||
parse_add_directory_tokens ();
|
||||
|
||||
strcpy (libfilename, gimp_system_rc_file ());
|
||||
if (alternate_system_gimprc != NULL)
|
||||
strncpy (libfilename, alternate_system_gimprc, MAXPATHLEN);
|
||||
libfilename = g_strdup (alternate_system_gimprc);
|
||||
else
|
||||
libfilename = g_strdup (gimp_system_rc_file ());
|
||||
|
||||
app_init_update_status(_("Resource configuration"), libfilename, -1);
|
||||
parse_gimprc_file (libfilename);
|
||||
|
||||
if (alternate_gimprc != NULL)
|
||||
strncpy (filename, alternate_gimprc, MAXPATHLEN);
|
||||
filename = g_strdup (alternate_gimprc);
|
||||
else
|
||||
{
|
||||
personal_gimprc = gimp_personal_rc_file ("gimprc");
|
||||
strncpy (filename, personal_gimprc, MAXPATHLEN);
|
||||
g_free (personal_gimprc);
|
||||
}
|
||||
filename = gimp_personal_rc_file ("gimprc");
|
||||
|
||||
if (filename[0] != '\0' && strcmp (filename, libfilename) != 0)
|
||||
if (g_strcasecmp (filename, libfilename) != 0)
|
||||
{
|
||||
app_init_update_status(NULL, filename, -1);
|
||||
parse_gimprc_file (filename);
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
g_free (libfilename);
|
||||
|
||||
if (!image_title_format)
|
||||
image_title_format = g_strdup(DEFAULT_IMAGE_TITLE_FORMAT);
|
||||
}
|
||||
@ -457,22 +457,25 @@ parse_absolute_gimprc_file (char *filename)
|
||||
}
|
||||
|
||||
gboolean
|
||||
parse_gimprc_file (char *filename)
|
||||
parse_gimprc_file (gchar *filename)
|
||||
{
|
||||
char rfilename[MAXPATHLEN];
|
||||
gchar *rfilename;
|
||||
gboolean parsed;
|
||||
|
||||
if (!g_path_is_absolute (filename))
|
||||
{
|
||||
if (g_get_home_dir () != NULL)
|
||||
{
|
||||
g_snprintf (rfilename, sizeof (rfilename),
|
||||
"%s" G_DIR_SEPARATOR_S "%s",
|
||||
g_get_home_dir (), filename);
|
||||
filename = rfilename;
|
||||
rfilename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s",
|
||||
g_get_home_dir (), filename);
|
||||
parsed = parse_absolute_gimprc_file (rfilename);
|
||||
g_free (rfilename);
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
|
||||
return (parse_absolute_gimprc_file (filename));
|
||||
parsed = parse_absolute_gimprc_file (filename);
|
||||
return parsed;
|
||||
}
|
||||
|
||||
static GList *
|
||||
|
||||
@ -2038,14 +2038,14 @@ static void
|
||||
ed_scrollbar_update (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
gchar str[256];
|
||||
gchar *str;
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
str = g_strdup_printf (_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
|
||||
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_UPDATE_CONTROL);
|
||||
}
|
||||
@ -2279,7 +2279,7 @@ prev_set_hint (gint x)
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
@ -2291,13 +2291,14 @@ prev_set_hint (gint x)
|
||||
|
||||
gimp_rgb_to_hsv_double (&h, &s, &v);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
str = g_strdup_printf (_("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2307,7 +2308,7 @@ prev_set_foreground (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2315,15 +2316,15 @@ prev_set_foreground (gint x)
|
||||
gimp_context_set_foreground (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2331,7 +2332,7 @@ prev_set_background (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2339,15 +2340,15 @@ prev_set_background (gint x)
|
||||
gimp_context_set_background (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2891,7 +2892,7 @@ control_motion (gint x)
|
||||
grad_segment_t *seg;
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
gchar *str = NULL;
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
@ -2909,7 +2910,7 @@ control_motion (gint x)
|
||||
g_editor->control_sel_r,
|
||||
seg, pos);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->left);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->left);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2918,7 +2919,7 @@ control_motion (gint x)
|
||||
pos = control_calc_g_pos (x);
|
||||
seg->middle = BOUNDS (pos, seg->left + EPSILON, seg->right - EPSILON);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->middle);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->middle);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2936,8 +2937,8 @@ control_motion (gint x)
|
||||
|
||||
g_editor->control_last_gx += delta;
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
str = g_strdup_printf (_("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2948,6 +2949,9 @@ control_motion (gint x)
|
||||
break;
|
||||
}
|
||||
|
||||
if (str)
|
||||
g_free (str);
|
||||
|
||||
curr_gradient->dirty = TRUE;
|
||||
|
||||
if (g_editor->instant_update)
|
||||
@ -4119,7 +4123,7 @@ cpopup_update_saved_color (int n,
|
||||
double b,
|
||||
double a)
|
||||
{
|
||||
char str[256];
|
||||
gchar *str;
|
||||
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->left_load_color_boxes[n + 3]),
|
||||
r, g, b, a);
|
||||
@ -4130,14 +4134,15 @@ cpopup_update_saved_color (int n,
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->right_save_color_boxes[n]),
|
||||
r, g, b, a);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
str = g_strdup_printf (_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_save_labels[n]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_save_labels[n]), str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
g_editor->saved_colors[n].r = r;
|
||||
g_editor->saved_colors[n].g = g;
|
||||
g_editor->saved_colors[n].b = b;
|
||||
|
||||
@ -2038,14 +2038,14 @@ static void
|
||||
ed_scrollbar_update (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
gchar str[256];
|
||||
gchar *str;
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
str = g_strdup_printf (_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
|
||||
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_UPDATE_CONTROL);
|
||||
}
|
||||
@ -2279,7 +2279,7 @@ prev_set_hint (gint x)
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
@ -2291,13 +2291,14 @@ prev_set_hint (gint x)
|
||||
|
||||
gimp_rgb_to_hsv_double (&h, &s, &v);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
str = g_strdup_printf (_("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2307,7 +2308,7 @@ prev_set_foreground (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2315,15 +2316,15 @@ prev_set_foreground (gint x)
|
||||
gimp_context_set_foreground (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2331,7 +2332,7 @@ prev_set_background (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2339,15 +2340,15 @@ prev_set_background (gint x)
|
||||
gimp_context_set_background (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2891,7 +2892,7 @@ control_motion (gint x)
|
||||
grad_segment_t *seg;
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
gchar *str = NULL;
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
@ -2909,7 +2910,7 @@ control_motion (gint x)
|
||||
g_editor->control_sel_r,
|
||||
seg, pos);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->left);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->left);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2918,7 +2919,7 @@ control_motion (gint x)
|
||||
pos = control_calc_g_pos (x);
|
||||
seg->middle = BOUNDS (pos, seg->left + EPSILON, seg->right - EPSILON);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->middle);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->middle);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2936,8 +2937,8 @@ control_motion (gint x)
|
||||
|
||||
g_editor->control_last_gx += delta;
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
str = g_strdup_printf (_("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2948,6 +2949,9 @@ control_motion (gint x)
|
||||
break;
|
||||
}
|
||||
|
||||
if (str)
|
||||
g_free (str);
|
||||
|
||||
curr_gradient->dirty = TRUE;
|
||||
|
||||
if (g_editor->instant_update)
|
||||
@ -4119,7 +4123,7 @@ cpopup_update_saved_color (int n,
|
||||
double b,
|
||||
double a)
|
||||
{
|
||||
char str[256];
|
||||
gchar *str;
|
||||
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->left_load_color_boxes[n + 3]),
|
||||
r, g, b, a);
|
||||
@ -4130,14 +4134,15 @@ cpopup_update_saved_color (int n,
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->right_save_color_boxes[n]),
|
||||
r, g, b, a);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
str = g_strdup_printf (_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_save_labels[n]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_save_labels[n]), str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
g_editor->saved_colors[n].r = r;
|
||||
g_editor->saved_colors[n].g = g;
|
||||
g_editor->saved_colors[n].b = b;
|
||||
|
||||
@ -2038,14 +2038,14 @@ static void
|
||||
ed_scrollbar_update (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
gchar str[256];
|
||||
gchar *str;
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
str = g_strdup_printf (_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
|
||||
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_UPDATE_CONTROL);
|
||||
}
|
||||
@ -2279,7 +2279,7 @@ prev_set_hint (gint x)
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
@ -2291,13 +2291,14 @@ prev_set_hint (gint x)
|
||||
|
||||
gimp_rgb_to_hsv_double (&h, &s, &v);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
str = g_strdup_printf (_("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2307,7 +2308,7 @@ prev_set_foreground (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2315,15 +2316,15 @@ prev_set_foreground (gint x)
|
||||
gimp_context_set_foreground (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2331,7 +2332,7 @@ prev_set_background (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2339,15 +2340,15 @@ prev_set_background (gint x)
|
||||
gimp_context_set_background (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2891,7 +2892,7 @@ control_motion (gint x)
|
||||
grad_segment_t *seg;
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
gchar *str = NULL;
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
@ -2909,7 +2910,7 @@ control_motion (gint x)
|
||||
g_editor->control_sel_r,
|
||||
seg, pos);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->left);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->left);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2918,7 +2919,7 @@ control_motion (gint x)
|
||||
pos = control_calc_g_pos (x);
|
||||
seg->middle = BOUNDS (pos, seg->left + EPSILON, seg->right - EPSILON);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->middle);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->middle);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2936,8 +2937,8 @@ control_motion (gint x)
|
||||
|
||||
g_editor->control_last_gx += delta;
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
str = g_strdup_printf (_("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2948,6 +2949,9 @@ control_motion (gint x)
|
||||
break;
|
||||
}
|
||||
|
||||
if (str)
|
||||
g_free (str);
|
||||
|
||||
curr_gradient->dirty = TRUE;
|
||||
|
||||
if (g_editor->instant_update)
|
||||
@ -4119,7 +4123,7 @@ cpopup_update_saved_color (int n,
|
||||
double b,
|
||||
double a)
|
||||
{
|
||||
char str[256];
|
||||
gchar *str;
|
||||
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->left_load_color_boxes[n + 3]),
|
||||
r, g, b, a);
|
||||
@ -4130,14 +4134,15 @@ cpopup_update_saved_color (int n,
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->right_save_color_boxes[n]),
|
||||
r, g, b, a);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
str = g_strdup_printf (_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_save_labels[n]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_save_labels[n]), str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
g_editor->saved_colors[n].r = r;
|
||||
g_editor->saved_colors[n].g = g;
|
||||
g_editor->saved_colors[n].b = b;
|
||||
|
||||
@ -2038,14 +2038,14 @@ static void
|
||||
ed_scrollbar_update (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
gchar str[256];
|
||||
gchar *str;
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
str = g_strdup_printf (_("Zoom factor: %d:1 Displaying [%0.6f, %0.6f]"),
|
||||
g_editor->zoom_factor, adjustment->value,
|
||||
adjustment->value + adjustment->page_size);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
|
||||
ed_update_editor (GRAD_UPDATE_PREVIEW | GRAD_UPDATE_CONTROL);
|
||||
}
|
||||
@ -2279,7 +2279,7 @@ prev_set_hint (gint x)
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gdouble h, s, v;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
|
||||
@ -2291,13 +2291,14 @@ prev_set_hint (gint x)
|
||||
|
||||
gimp_rgb_to_hsv_double (&h, &s, &v);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
str = g_strdup_printf (_("Position: %0.6f "
|
||||
"RGB (%0.3f, %0.3f, %0.3f) "
|
||||
"HSV (%0.3f, %0.3f, %0.3f) "
|
||||
"Opacity: %0.3f"),
|
||||
xpos, r, g, b, h * 360.0, s, v, a);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2307,7 +2308,7 @@ prev_set_foreground (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2315,15 +2316,15 @@ prev_set_foreground (gint x)
|
||||
gimp_context_set_foreground (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Foreground color set to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2331,7 +2332,7 @@ prev_set_background (gint x)
|
||||
{
|
||||
gdouble xpos;
|
||||
gdouble r, g, b, a;
|
||||
gchar str[512];
|
||||
gchar *str;
|
||||
|
||||
xpos = control_calc_g_pos (x);
|
||||
gradient_get_color_at (curr_gradient, xpos, &r, &g, &b, &a);
|
||||
@ -2339,15 +2340,15 @@ prev_set_background (gint x)
|
||||
gimp_context_set_background (gimp_context_get_user (),
|
||||
r * 255.0, g * 255.0, b * 255.0);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
str = g_strdup_printf (_("Background color to RGB (%d, %d, %d) <-> "
|
||||
"(%0.3f, %0.3f, %0.3f)"),
|
||||
(int) (r * 255.0),
|
||||
(int) (g * 255.0),
|
||||
(int) (b * 255.0),
|
||||
r, g, b);
|
||||
|
||||
ed_set_hint (str);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
/*****/
|
||||
@ -2891,7 +2892,7 @@ control_motion (gint x)
|
||||
grad_segment_t *seg;
|
||||
gdouble pos;
|
||||
gdouble delta;
|
||||
gchar str[256];
|
||||
gchar *str = NULL;
|
||||
|
||||
seg = g_editor->control_drag_segment;
|
||||
|
||||
@ -2909,7 +2910,7 @@ control_motion (gint x)
|
||||
g_editor->control_sel_r,
|
||||
seg, pos);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->left);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->left);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2918,7 +2919,7 @@ control_motion (gint x)
|
||||
pos = control_calc_g_pos (x);
|
||||
seg->middle = BOUNDS (pos, seg->left + EPSILON, seg->right - EPSILON);
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Handle position: %0.6f"), seg->middle);
|
||||
str = g_strdup_printf (_("Handle position: %0.6f"), seg->middle);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2936,8 +2937,8 @@ control_motion (gint x)
|
||||
|
||||
g_editor->control_last_gx += delta;
|
||||
|
||||
g_snprintf (str, sizeof (str), _("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
str = g_strdup_printf (_("Distance: %0.6f"),
|
||||
g_editor->control_last_gx - g_editor->control_orig_pos);
|
||||
ed_set_hint (str);
|
||||
|
||||
break;
|
||||
@ -2948,6 +2949,9 @@ control_motion (gint x)
|
||||
break;
|
||||
}
|
||||
|
||||
if (str)
|
||||
g_free (str);
|
||||
|
||||
curr_gradient->dirty = TRUE;
|
||||
|
||||
if (g_editor->instant_update)
|
||||
@ -4119,7 +4123,7 @@ cpopup_update_saved_color (int n,
|
||||
double b,
|
||||
double a)
|
||||
{
|
||||
char str[256];
|
||||
gchar *str;
|
||||
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->left_load_color_boxes[n + 3]),
|
||||
r, g, b, a);
|
||||
@ -4130,14 +4134,15 @@ cpopup_update_saved_color (int n,
|
||||
cpopup_render_color_box (GTK_PREVIEW (g_editor->right_save_color_boxes[n]),
|
||||
r, g, b, a);
|
||||
|
||||
g_snprintf (str, sizeof (str),
|
||||
_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
str = g_strdup_printf (_("RGBA (%0.3f, %0.3f, %0.3f, %0.3f)"), r, g, b, a);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->left_save_labels[n]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_load_labels[n + 3]), str);
|
||||
gtk_label_set_text (GTK_LABEL (g_editor->right_save_labels[n]), str);
|
||||
|
||||
g_free (str);
|
||||
|
||||
g_editor->saved_colors[n].r = r;
|
||||
g_editor->saved_colors[n].g = g;
|
||||
g_editor->saved_colors[n].b = b;
|
||||
|
||||
Reference in New Issue
Block a user