Handle quoting of / with \; properly handle __ in paths, quote " and \n in

Mon Mar 19 15:53:36 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
	handle __ in paths, quote " and \n in gtk_item_factory_dump_items().

	* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
	  gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
	  gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
	  gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
	Change float to double everywhere with the exception of 0<->1.0 alignment
	and GtkCurve.
This commit is contained in:
Owen Taylor 2001-03-19 21:06:38 +00:00 committed by Owen Taylor
parent c5f68d2527
commit 489c376bf4
32 changed files with 447 additions and 245 deletions

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -1,3 +1,15 @@
Mon Mar 19 15:53:36 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkitemfactory.c gtk/testgtk.c: Handle quoting of / with \; properly
handle __ in paths, quote " and \n in gtk_item_factory_dump_items().
* gtk/gtkadjustment.[ch] gtk/gtkclist.c gtk/gtkhruler.c gtk/gtklayout.c
gtk/gtklist.c gtk/gtkprogress.[ch] gtk/gtkprogressbar.[ch] gtk/gtkrange.[ch]
gtk/gtkruler.[ch] gtk/gtkscale.c gtk/gtkscrolledwindow.c gtk/gtkspinbutton.[ch]
gtk/gtktext.c gtk/gtktextview.c gtk/gtkvruler.c gtk/testgtk.c:
Change float to double everywhere with the exception of 0<->1.0 alignment
and GtkCurve.
2001-03-19 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkdrawable-win32.c

View File

@ -105,12 +105,12 @@ gtk_adjustment_init (GtkAdjustment *adjustment)
}
GtkObject*
gtk_adjustment_new (gfloat value,
gfloat lower,
gfloat upper,
gfloat step_increment,
gfloat page_increment,
gfloat page_size)
gtk_adjustment_new (gdouble value,
gdouble lower,
gdouble upper,
gdouble step_increment,
gdouble page_increment,
gdouble page_size)
{
GtkAdjustment *adjustment;
@ -128,7 +128,7 @@ gtk_adjustment_new (gfloat value,
void
gtk_adjustment_set_value (GtkAdjustment *adjustment,
gfloat value)
gdouble value)
{
g_return_if_fail (adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
@ -163,8 +163,8 @@ gtk_adjustment_value_changed (GtkAdjustment *adjustment)
void
gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
gfloat lower,
gfloat upper)
gdouble lower,
gdouble upper)
{
gboolean need_emission;

View File

@ -52,12 +52,12 @@ struct _GtkAdjustment
{
GtkObject parent_instance;
gfloat lower;
gfloat upper;
gfloat value;
gfloat step_increment;
gfloat page_increment;
gfloat page_size;
gdouble lower;
gdouble upper;
gdouble value;
gdouble step_increment;
gdouble page_increment;
gdouble page_size;
};
struct _GtkAdjustmentClass
@ -70,19 +70,19 @@ struct _GtkAdjustmentClass
GtkType gtk_adjustment_get_type (void) G_GNUC_CONST;
GtkObject* gtk_adjustment_new (gfloat value,
gfloat lower,
gfloat upper,
gfloat step_increment,
gfloat page_increment,
gfloat page_size);
GtkObject* gtk_adjustment_new (gdouble value,
gdouble lower,
gdouble upper,
gdouble step_increment,
gdouble page_increment,
gdouble page_size);
void gtk_adjustment_changed (GtkAdjustment *adjustment);
void gtk_adjustment_value_changed (GtkAdjustment *adjustment);
void gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
gfloat lower,
gfloat upper);
gdouble lower,
gdouble upper);
void gtk_adjustment_set_value (GtkAdjustment *adjustment,
gfloat value);
gdouble value);
#ifdef __cplusplus
}

View File

@ -6960,7 +6960,7 @@ static void
move_horizontal (GtkCList *clist,
gint diff)
{
gfloat value;
gdouble value;
if (!clist->hadjustment)
return;
@ -6975,7 +6975,7 @@ move_vertical (GtkCList *clist,
gint row,
gfloat align)
{
gfloat value;
gdouble value;
if (!clist->vadjustment)
return;

View File

@ -141,11 +141,11 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
gint xthickness;
gint ythickness;
gint length, ideal_length;
gfloat lower, upper; /* Upper and lower limits, in ruler units */
gfloat increment; /* Number of pixels per unit */
gdouble lower, upper; /* Upper and lower limits, in ruler units */
gdouble increment; /* Number of pixels per unit */
gint scale; /* Number of units per major unit */
gfloat subd_incr;
gfloat start, end, cur;
gdouble subd_incr;
gdouble start, end, cur;
gchar unit_str[32];
gint digit_height;
gint digit_offset;
@ -199,7 +199,7 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
if ((upper - lower) == 0)
return;
increment = (gfloat) width / (upper - lower);
increment = (gdouble) width / (upper - lower);
/* determine the scale
* We calculate the text size as for the vruler instead of using
@ -221,8 +221,8 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
length = 0;
for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
{
subd_incr = (gfloat) ruler->metric->ruler_scale[scale] /
(gfloat) ruler->metric->subdivide[i];
subd_incr = (gdouble) ruler->metric->ruler_scale[scale] /
(gdouble) ruler->metric->subdivide[i];
if (subd_incr * fabs(increment) <= MINIMUM_INCR)
continue;
@ -287,7 +287,7 @@ gtk_hruler_draw_pos (GtkRuler *ruler)
gint bs_width, bs_height;
gint xthickness;
gint ythickness;
gfloat increment;
gdouble increment;
g_return_if_fail (ruler != NULL);
g_return_if_fail (GTK_IS_HRULER (ruler));
@ -317,7 +317,7 @@ gtk_hruler_draw_pos (GtkRuler *ruler)
ruler->xsrc, ruler->ysrc,
bs_width, bs_height);
increment = (gfloat) width / (ruler->upper - ruler->lower);
increment = (gdouble) width / (ruler->upper - ruler->lower);
x = ROUND ((ruler->position - ruler->lower) * increment) + (xthickness - bs_width) / 2 - 1;
y = (height + bs_height) / 2 + ythickness;

View File

@ -723,6 +723,37 @@ gtk_item_factory_path_from_widget (GtkWidget *widget)
return gtk_object_get_data_by_id (GTK_OBJECT (widget), quark_item_path);
}
static gchar *
item_factory_escape_path (const gchar *path)
{
GString *str = g_string_new (NULL);
while (*path)
{
gchar c = *path;
switch (c)
{
case '\n':
g_string_append (str, "\\n");
break;
case '\r':
g_string_append (str, "\\r");
break;
case '"':
case '\\':
g_string_append_c (str, '\\');
/* Fall through */
default:
g_string_append_c (str, c);
}
path++;
}
return g_string_free (str, FALSE);
}
static void
gtk_item_factory_foreach (gpointer hash_key,
gpointer value,
@ -731,6 +762,7 @@ gtk_item_factory_foreach (gpointer hash_key,
GtkItemFactoryItem *item;
GtkIFDumpData *data;
gchar *string;
gchar *path;
gchar *name;
gchar comment_prefix[2] = "\000\000";
@ -742,14 +774,16 @@ gtk_item_factory_foreach (gpointer hash_key,
comment_prefix[0] = gtk_item_factory_class->cpair_comment_single[0];
path = item_factory_escape_path (hash_key);
name = gtk_accelerator_name (item->accelerator_key, item->accelerator_mods);
string = g_strconcat (item->modified ? "" : comment_prefix,
"(menu-path \"",
hash_key,
path,
"\" \"",
name,
"\")",
NULL);
g_free (path);
g_free (name);
data->print_func (data->func_data, string);
@ -942,6 +976,60 @@ gtk_item_factory_get_item_by_action (GtkItemFactory *ifactory,
return GTK_IS_ITEM (widget) ? widget : NULL;
}
static char *
item_factory_find_separator_r (char *path)
{
gchar *result = NULL;
gboolean escaped = FALSE;
while (*path)
{
if (escaped)
escaped = FALSE;
else
{
if (*path == '\\')
escaped = TRUE;
else if (*path == '/')
result = path;
}
path++;
}
return result;
}
static char *
item_factory_unescape_label (const char *label)
{
char *new = g_malloc (strlen (label) + 1);
char *p = new;
gboolean escaped = FALSE;
while (*label)
{
if (escaped)
{
*p++ = *label;
escaped = FALSE;
}
else
{
if (*label == '\\')
escaped = TRUE;
else
*p++ = *label;
}
label++;
}
*p = '\0';
return new;
}
static gboolean
gtk_item_factory_parse_path (GtkItemFactory *ifactory,
gchar *str,
@ -951,14 +1039,21 @@ gtk_item_factory_parse_path (GtkItemFactory *ifactory,
{
gchar *translation;
gchar *p, *q;
*path = g_strdup (str);
/* FIXME: This does not handle __ correctly !!! */
p = q = *path;
while (*p)
{
if (*p != '_')
if (*p == '_')
{
if (p[1] == '_')
{
p++;
*q++ = '_';
}
}
else
{
*q++ = *p;
}
@ -967,7 +1062,7 @@ gtk_item_factory_parse_path (GtkItemFactory *ifactory,
*q = 0;
*parent_path = g_strdup (*path);
p = strrchr (*parent_path, '/');
p = item_factory_find_separator_r (*parent_path);
if (!p)
{
g_warning ("GtkItemFactory: invalid entry path `%s'", str);
@ -980,13 +1075,13 @@ gtk_item_factory_parse_path (GtkItemFactory *ifactory,
else
translation = str;
p = strrchr (translation, '/');
p = item_factory_find_separator_r (translation);
if (p)
p++;
else
p = translation;
*item = g_strdup (p);
*item = item_factory_unescape_label (p);
return TRUE;
}
@ -1077,7 +1172,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
gchar *ppath, *p;
ppath = g_strdup (entry->path);
p = strrchr (ppath, '/');
p = item_factory_find_separator_r (ppath);
g_return_if_fail (p != NULL);
*p = 0;
pentry.path = ppath;

View File

@ -269,11 +269,12 @@ gtk_layout_move (GtkLayout *layout,
}
static void
gtk_layout_set_adjustment_upper (GtkAdjustment *adj, gfloat upper)
gtk_layout_set_adjustment_upper (GtkAdjustment *adj,
gdouble upper)
{
if (upper != adj->upper)
{
gfloat min = MAX (0., upper - adj->page_size);
gdouble min = MAX (0., upper - adj->page_size);
gboolean value_changed = FALSE;
adj->upper = upper;

View File

@ -582,7 +582,7 @@ gtk_list_motion_notify (GtkWidget *widget,
(x > adj->value + adj->page_size &&
adj->value >= adj->upper - adj->page_size)))
{
gfloat value;
gdouble value;
if (x < adj->value)
value = adj->value + (x - adj->value) / 2 - 1;

View File

@ -348,8 +348,8 @@ gtk_progress_value_changed (GtkAdjustment *adjustment,
static gchar *
gtk_progress_build_string (GtkProgress *progress,
gfloat value,
gfloat percentage)
gdouble value,
gdouble percentage)
{
gchar buf[256] = { 0 };
gchar tmp[256] = { 0 };
@ -493,9 +493,9 @@ gtk_progress_set_adjustment (GtkProgress *progress,
void
gtk_progress_configure (GtkProgress *progress,
gfloat value,
gfloat min,
gfloat max)
gdouble value,
gdouble min,
gdouble max)
{
GtkAdjustment *adj;
gboolean changed = FALSE;
@ -523,7 +523,7 @@ gtk_progress_configure (GtkProgress *progress,
void
gtk_progress_set_percentage (GtkProgress *progress,
gfloat percentage)
gdouble percentage)
{
g_return_if_fail (progress != NULL);
g_return_if_fail (GTK_IS_PROGRESS (progress));
@ -535,7 +535,7 @@ gtk_progress_set_percentage (GtkProgress *progress,
(progress->adjustment->upper - progress->adjustment->lower));
}
gfloat
gdouble
gtk_progress_get_current_percentage (GtkProgress *progress)
{
g_return_val_if_fail (progress != NULL, 0);
@ -548,9 +548,9 @@ gtk_progress_get_current_percentage (GtkProgress *progress)
(progress->adjustment->upper - progress->adjustment->lower));
}
gfloat
gdouble
gtk_progress_get_percentage_from_value (GtkProgress *progress,
gfloat value)
gdouble value)
{
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);
@ -568,7 +568,7 @@ gtk_progress_get_percentage_from_value (GtkProgress *progress,
void
gtk_progress_set_value (GtkProgress *progress,
gfloat value)
gdouble value)
{
g_return_if_fail (progress != NULL);
g_return_if_fail (GTK_IS_PROGRESS (progress));
@ -580,7 +580,7 @@ gtk_progress_set_value (GtkProgress *progress,
gtk_adjustment_set_value (progress->adjustment, value);
}
gfloat
gdouble
gtk_progress_get_value (GtkProgress *progress)
{
g_return_val_if_fail (progress != NULL, 0);
@ -663,7 +663,7 @@ gtk_progress_get_current_text (GtkProgress *progress)
gchar *
gtk_progress_get_text_from_value (GtkProgress *progress,
gfloat value)
gdouble value)
{
g_return_val_if_fail (progress != NULL, 0);
g_return_val_if_fail (GTK_IS_PROGRESS (progress), 0);

View File

@ -93,22 +93,22 @@ void gtk_progress_set_format_string (GtkProgress *progress,
void gtk_progress_set_adjustment (GtkProgress *progress,
GtkAdjustment *adjustment);
void gtk_progress_configure (GtkProgress *progress,
gfloat value,
gfloat min,
gfloat max);
gdouble value,
gdouble min,
gdouble max);
void gtk_progress_set_percentage (GtkProgress *progress,
gfloat percentage);
gdouble percentage);
void gtk_progress_set_value (GtkProgress *progress,
gfloat value);
gfloat gtk_progress_get_value (GtkProgress *progress);
gdouble value);
gdouble gtk_progress_get_value (GtkProgress *progress);
void gtk_progress_set_activity_mode (GtkProgress *progress,
gboolean activity_mode);
gchar* gtk_progress_get_current_text (GtkProgress *progress);
gchar* gtk_progress_get_text_from_value (GtkProgress *progress,
gfloat value);
gfloat gtk_progress_get_current_percentage (GtkProgress *progress);
gfloat gtk_progress_get_percentage_from_value (GtkProgress *progress,
gfloat value);
gdouble value);
gdouble gtk_progress_get_current_percentage (GtkProgress *progress);
gdouble gtk_progress_get_percentage_from_value (GtkProgress *progress,
gdouble value);
#endif /* GTK_DISABLE_DEPRECATED */

View File

@ -138,11 +138,11 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
GTK_ARG_READWRITE,
ARG_DISCRETE_BLOCKS);
gtk_object_add_arg_type ("GtkProgressBar::fraction",
GTK_TYPE_FLOAT,
GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE,
ARG_FRACTION);
gtk_object_add_arg_type ("GtkProgressBar::pulse_step",
GTK_TYPE_FLOAT,
GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE,
ARG_PULSE_STEP);
gtk_object_add_arg_type ("GtkProgressBar::text",
@ -204,10 +204,10 @@ gtk_progress_bar_set_arg (GtkObject *object,
gtk_progress_bar_set_discrete_blocks (pbar, GTK_VALUE_UINT (*arg));
break;
case ARG_FRACTION:
gtk_progress_bar_set_fraction (pbar, GTK_VALUE_FLOAT (*arg));
gtk_progress_bar_set_fraction (pbar, GTK_VALUE_DOUBLE (*arg));
break;
case ARG_PULSE_STEP:
gtk_progress_bar_set_pulse_step (pbar, GTK_VALUE_FLOAT (*arg));
gtk_progress_bar_set_pulse_step (pbar, GTK_VALUE_DOUBLE (*arg));
break;
case ARG_TEXT:
gtk_progress_bar_set_text (pbar, GTK_VALUE_STRING (*arg));
@ -247,10 +247,10 @@ gtk_progress_bar_get_arg (GtkObject *object,
GTK_VALUE_UINT (*arg) = pbar->blocks;
break;
case ARG_FRACTION:
GTK_VALUE_FLOAT (*arg) = gtk_progress_get_current_percentage (GTK_PROGRESS (pbar));
GTK_VALUE_DOUBLE (*arg) = gtk_progress_get_current_percentage (GTK_PROGRESS (pbar));
break;
case ARG_PULSE_STEP:
GTK_VALUE_FLOAT (*arg) = pbar->pulse_fraction;
GTK_VALUE_DOUBLE (*arg) = pbar->pulse_fraction;
break;
case ARG_TEXT:
GTK_VALUE_STRING (*arg) = g_strdup (gtk_progress_bar_get_text (pbar));
@ -377,7 +377,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
gint in_block;
in_block = -1 + (gint)(gtk_progress_get_current_percentage (progress) *
(gfloat)pbar->blocks);
(gdouble)pbar->blocks);
if (pbar->in_block != in_block)
{
@ -515,7 +515,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
gint i;
gint x;
gint y;
gfloat percentage;
gdouble percentage;
gint size;
g_return_if_fail (progress != NULL);
@ -804,7 +804,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
**/
void
gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
gfloat fraction)
gdouble fraction)
{
g_return_if_fail (pbar != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
@ -885,7 +885,7 @@ gtk_progress_bar_set_text (GtkProgressBar *pbar,
**/
void
gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar,
gfloat fraction)
gdouble fraction)
{
g_return_if_fail (pbar != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
@ -897,7 +897,7 @@ gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar,
void
gtk_progress_bar_update (GtkProgressBar *pbar,
gfloat percentage)
gdouble percentage)
{
g_return_if_fail (pbar != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
@ -965,7 +965,7 @@ gtk_progress_bar_get_text (GtkProgressBar *pbar)
*
* Return value: a fraction from 0.0 to 1.0
**/
gfloat
gdouble
gtk_progress_bar_get_fraction (GtkProgressBar *pbar)
{
g_return_val_if_fail (GTK_IS_PROGRESS_BAR (pbar), 0);
@ -981,7 +981,7 @@ gtk_progress_bar_get_fraction (GtkProgressBar *pbar)
*
* Return value: a fraction from 0.0 to 1.0
**/
gfloat
gdouble
gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar)
{
g_return_val_if_fail (GTK_IS_PROGRESS_BAR (pbar), 0);

View File

@ -76,7 +76,7 @@ struct _GtkProgressBar
guint activity_step;
guint activity_blocks;
gfloat pulse_fraction;
gdouble pulse_fraction;
guint activity_dir : 1;
};
@ -121,16 +121,16 @@ void gtk_progress_bar_pulse (GtkProgressBar *pbar);
void gtk_progress_bar_set_text (GtkProgressBar *pbar,
const gchar *text);
void gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
gfloat fraction);
gdouble fraction);
void gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar,
gfloat fraction);
gdouble fraction);
void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
GtkProgressBarOrientation orientation);
G_CONST_RETURN gchar* gtk_progress_bar_get_text (GtkProgressBar *pbar);
gfloat gtk_progress_bar_get_fraction (GtkProgressBar *pbar);
gfloat gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar);
gdouble gtk_progress_bar_get_fraction (GtkProgressBar *pbar);
gdouble gtk_progress_bar_get_pulse_step (GtkProgressBar *pbar);
GtkProgressBarOrientation gtk_progress_bar_get_orientation (GtkProgressBar *pbar);
@ -152,7 +152,7 @@ void gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
void gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
guint blocks);
void gtk_progress_bar_update (GtkProgressBar *pbar,
gfloat percentage);
gdouble percentage);
#endif /* GTK_DISABLE_DEPRECATED */

View File

@ -74,7 +74,7 @@ static void gtk_real_range_draw_trough (GtkRange *range);
static void gtk_real_range_draw_slider (GtkRange *range);
static gint gtk_real_range_timer (GtkRange *range);
static gint gtk_range_scroll (GtkRange *range,
gfloat jump_perc);
gdouble jump_perc);
static void gtk_range_add_timer (GtkRange *range);
static void gtk_range_remove_timer (GtkRange *range);
@ -392,10 +392,10 @@ _gtk_range_slider_update (GtkRange *range)
}
gint
_gtk_range_trough_click (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc)
_gtk_range_trough_click (GtkRange *range,
gint x,
gint y,
gdouble *jump_perc)
{
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
@ -534,10 +534,10 @@ _gtk_range_default_vslider_update (GtkRange *range)
}
gint
_gtk_range_default_htrough_click (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc)
_gtk_range_default_htrough_click (GtkRange *range,
gint x,
gint y,
gdouble *jump_perc)
{
gint ythickness;
gint trough_width;
@ -583,10 +583,10 @@ _gtk_range_default_htrough_click (GtkRange *range,
}
gint
_gtk_range_default_vtrough_click (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc)
_gtk_range_default_vtrough_click (GtkRange *range,
gint x,
gint y,
gdouble *jump_perc)
{
gint xthickness;
gint trough_width;
@ -673,7 +673,7 @@ _gtk_range_default_hmotion (GtkRange *range,
char buffer[64];
sprintf (buffer, "%0.*f", range->digits, range->adjustment->value);
sscanf (buffer, "%f", &range->adjustment->value);
sscanf (buffer, "%lf", &range->adjustment->value);
}
if (old_value != range->adjustment->value)
@ -741,7 +741,7 @@ _gtk_range_default_vmotion (GtkRange *range,
char buffer[64];
sprintf (buffer, "%0.*f", range->digits, range->adjustment->value);
sscanf (buffer, "%f", &range->adjustment->value);
sscanf (buffer, "%lf", &range->adjustment->value);
}
if (old_value != range->adjustment->value)
@ -873,7 +873,7 @@ gtk_range_button_press (GtkWidget *widget,
{
GtkRange *range;
gint trough_part;
gfloat jump_perc;
gdouble jump_perc;
g_return_val_if_fail (GTK_IS_RANGE (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
@ -1027,9 +1027,9 @@ gtk_range_scroll_event (GtkWidget *widget,
if (GTK_WIDGET_REALIZED (range))
{
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
adj->page_increment / 2);
gdouble new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
adj->page_increment / 2);
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);
}
@ -1356,10 +1356,10 @@ gtk_real_range_timer (GtkRange *range)
}
static gint
gtk_range_scroll (GtkRange *range,
gfloat jump_perc)
gtk_range_scroll (GtkRange *range,
gdouble jump_perc)
{
gfloat new_value;
gdouble new_value;
gint return_val;
GtkScrollType scroll_type;

View File

@ -73,10 +73,10 @@ struct _GtkRange
guint32 timer;
gfloat old_value;
gfloat old_lower;
gfloat old_upper;
gfloat old_page_size;
gdouble old_value;
gdouble old_lower;
gdouble old_upper;
gdouble old_page_size;
GtkAdjustment *adjustment;
};
@ -105,7 +105,7 @@ struct _GtkRangeClass
gint (* trough_click) (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc);
gdouble *jump_perc);
gint (* trough_keys) (GtkRange *range,
GdkEventKey *key,
GtkScrollType *scroll,
@ -138,18 +138,18 @@ void _gtk_range_slider_update (GtkRange *range);
gint _gtk_range_trough_click (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc);
gdouble *jump_perc);
void _gtk_range_default_hslider_update (GtkRange *range);
void _gtk_range_default_vslider_update (GtkRange *range);
gint _gtk_range_default_htrough_click (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc);
gdouble *jump_perc);
gint _gtk_range_default_vtrough_click (GtkRange *range,
gint x,
gint y,
gfloat *jump_perc);
gdouble *jump_perc);
void _gtk_range_default_hmotion (GtkRange *range,
gint xdelta,
gint ydelta);

View File

@ -107,13 +107,13 @@ gtk_ruler_class_init (GtkRulerClass *class)
class->draw_ticks = NULL;
class->draw_pos = NULL;
gtk_object_add_arg_type ("GtkRuler::lower", GTK_TYPE_FLOAT,
gtk_object_add_arg_type ("GtkRuler::lower", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_LOWER);
gtk_object_add_arg_type ("GtkRuler::upper", GTK_TYPE_FLOAT,
gtk_object_add_arg_type ("GtkRuler::upper", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_UPPER);
gtk_object_add_arg_type ("GtkRuler::position", GTK_TYPE_FLOAT,
gtk_object_add_arg_type ("GtkRuler::position", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_POSITION);
gtk_object_add_arg_type ("GtkRuler::max_size", GTK_TYPE_FLOAT,
gtk_object_add_arg_type ("GtkRuler::max_size", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_MAX_SIZE);
}
@ -143,20 +143,20 @@ gtk_ruler_set_arg (GtkObject *object,
switch (arg_id)
{
case ARG_LOWER:
gtk_ruler_set_range (ruler, GTK_VALUE_FLOAT (*arg), ruler->upper,
gtk_ruler_set_range (ruler, GTK_VALUE_DOUBLE (*arg), ruler->upper,
ruler->position, ruler->max_size);
break;
case ARG_UPPER:
gtk_ruler_set_range (ruler, ruler->lower, GTK_VALUE_FLOAT (*arg),
gtk_ruler_set_range (ruler, ruler->lower, GTK_VALUE_DOUBLE (*arg),
ruler->position, ruler->max_size);
break;
case ARG_POSITION:
gtk_ruler_set_range (ruler, ruler->lower, ruler->upper,
GTK_VALUE_FLOAT (*arg), ruler->max_size);
GTK_VALUE_DOUBLE (*arg), ruler->max_size);
break;
case ARG_MAX_SIZE:
gtk_ruler_set_range (ruler, ruler->lower, ruler->upper,
ruler->position, GTK_VALUE_FLOAT (*arg));
ruler->position, GTK_VALUE_DOUBLE (*arg));
break;
}
}
@ -171,16 +171,16 @@ gtk_ruler_get_arg (GtkObject *object,
switch (arg_id)
{
case ARG_LOWER:
GTK_VALUE_FLOAT (*arg) = ruler->lower;
GTK_VALUE_DOUBLE (*arg) = ruler->lower;
break;
case ARG_UPPER:
GTK_VALUE_FLOAT (*arg) = ruler->upper;
GTK_VALUE_DOUBLE (*arg) = ruler->upper;
break;
case ARG_POSITION:
GTK_VALUE_FLOAT (*arg) = ruler->position;
GTK_VALUE_DOUBLE (*arg) = ruler->position;
break;
case ARG_MAX_SIZE:
GTK_VALUE_FLOAT (*arg) = ruler->max_size;
GTK_VALUE_DOUBLE (*arg) = ruler->max_size;
break;
default:
arg->type = GTK_TYPE_INVALID;
@ -203,10 +203,10 @@ gtk_ruler_set_metric (GtkRuler *ruler,
void
gtk_ruler_set_range (GtkRuler *ruler,
gfloat lower,
gfloat upper,
gfloat position,
gfloat max_size)
gdouble lower,
gdouble upper,
gdouble position,
gdouble max_size)
{
g_return_if_fail (ruler != NULL);
g_return_if_fail (GTK_IS_RULER (ruler));

View File

@ -73,13 +73,13 @@ struct _GtkRuler
gint slider_size;
/* The upper limit of the ruler (in points) */
gfloat lower;
gdouble lower;
/* The lower limit of the ruler */
gfloat upper;
gdouble upper;
/* The position of the mark on the ruler */
gfloat position;
gdouble position;
/* The maximum size of the ruler */
gfloat max_size;
gdouble max_size;
};
struct _GtkRulerClass
@ -96,8 +96,8 @@ struct _GtkRulerMetric
gchar *abbrev;
/* This should be points_per_unit. This is the size of the unit
* in 1/72nd's of an inch and has nothing to do with screen pixels */
gfloat pixels_per_unit;
gfloat ruler_scale[10];
gdouble pixels_per_unit;
gdouble ruler_scale[10];
gint subdivide[5]; /* five possible modes of subdivision */
};
@ -106,10 +106,10 @@ GtkType gtk_ruler_get_type (void) G_GNUC_CONST;
void gtk_ruler_set_metric (GtkRuler *ruler,
GtkMetricType metric);
void gtk_ruler_set_range (GtkRuler *ruler,
gfloat lower,
gfloat upper,
gfloat position,
gfloat max_size);
gdouble lower,
gdouble upper,
gdouble position,
gdouble max_size);
void gtk_ruler_draw_ticks (GtkRuler *ruler);
void gtk_ruler_draw_pos (GtkRuler *ruler);

View File

@ -274,7 +274,7 @@ gtk_scale_get_value_size (GtkScale *scale,
PangoLayout *layout;
PangoRectangle logical_rect;
gchar buffer[128];
gfloat value;
gdouble value;
gint digits;
gint i, j;

View File

@ -949,7 +949,7 @@ gtk_scrolled_window_scroll_event (GtkWidget *widget,
if (range && GTK_WIDGET_VISIBLE (range))
{
GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
gfloat new_value;
gdouble new_value;
if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_LEFT)
new_value = adj->value - adj->page_increment / 2;

View File

@ -111,15 +111,15 @@ static gint gtk_spin_button_scroll (GtkWidget *widget,
GdkEventScroll *event);
static void gtk_spin_button_activate (GtkEntry *entry);
static void gtk_spin_button_snap (GtkSpinButton *spin_button,
gfloat val);
gdouble val);
static void gtk_spin_button_insert_text (GtkEntry *entry,
const gchar *new_text,
gint new_text_length,
gint *position);
static void gtk_spin_button_real_spin (GtkSpinButton *spin_button,
gfloat step);
gdouble step);
static gint gtk_spin_button_default_input (GtkSpinButton *spin_button,
gfloat *new_val);
gdouble *new_val);
static gint gtk_spin_button_default_output (GtkSpinButton *spin_button);
static gint spin_button_get_shadow_type (GtkSpinButton *spin_button);
@ -199,7 +199,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
GTK_ARG_READWRITE,
ARG_ADJUSTMENT);
gtk_object_add_arg_type ("GtkSpinButton::climb_rate",
GTK_TYPE_FLOAT,
GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE,
ARG_CLIMB_RATE);
gtk_object_add_arg_type ("GtkSpinButton::digits",
@ -223,7 +223,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
GTK_ARG_READWRITE,
ARG_UPDATE_POLICY);
gtk_object_add_arg_type ("GtkSpinButton::value",
GTK_TYPE_FLOAT,
GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE,
ARG_VALUE);
@ -272,7 +272,7 @@ gtk_spin_button_set_arg (GtkObject *object,
case ARG_CLIMB_RATE:
gtk_spin_button_configure (spin_button,
spin_button->adjustment,
GTK_VALUE_FLOAT (*arg),
GTK_VALUE_DOUBLE (*arg),
spin_button->digits);
break;
case ARG_DIGITS:
@ -294,7 +294,7 @@ gtk_spin_button_set_arg (GtkObject *object,
gtk_spin_button_set_update_policy (spin_button, GTK_VALUE_ENUM (*arg));
break;
case ARG_VALUE:
gtk_spin_button_set_value (spin_button, GTK_VALUE_FLOAT (*arg));
gtk_spin_button_set_value (spin_button, GTK_VALUE_DOUBLE (*arg));
break;
default:
break;
@ -316,7 +316,7 @@ gtk_spin_button_get_arg (GtkObject *object,
GTK_VALUE_POINTER (*arg) = spin_button->adjustment;
break;
case ARG_CLIMB_RATE:
GTK_VALUE_FLOAT (*arg) = spin_button->climb_rate;
GTK_VALUE_DOUBLE (*arg) = spin_button->climb_rate;
break;
case ARG_DIGITS:
GTK_VALUE_UINT (*arg) = spin_button->digits;
@ -334,7 +334,7 @@ gtk_spin_button_get_arg (GtkObject *object,
GTK_VALUE_ENUM (*arg) = spin_button->update_policy;
break;
case ARG_VALUE:
GTK_VALUE_FLOAT (*arg) = spin_button->adjustment->value;
GTK_VALUE_DOUBLE (*arg) = spin_button->adjustment->value;
break;
default:
arg->type = GTK_TYPE_INVALID;
@ -932,7 +932,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
if (spin->click_child == GTK_ARROW_UP &&
event->y <= widget->requisition.height / 2)
{
gfloat diff;
gdouble diff;
diff = spin->adjustment->upper - spin->adjustment->value;
if (diff > EPSILON)
@ -941,7 +941,7 @@ gtk_spin_button_button_release (GtkWidget *widget,
else if (spin->click_child == GTK_ARROW_DOWN &&
event->y > widget->requisition.height / 2)
{
gfloat diff;
gdouble diff;
diff = spin->adjustment->value - spin->adjustment->lower;
if (diff > EPSILON)
@ -1152,7 +1152,7 @@ gtk_spin_button_key_press (GtkWidget *widget,
if (event->state & GDK_CONTROL_MASK)
{
gfloat diff = spin->adjustment->upper - spin->adjustment->value;
gdouble diff = spin->adjustment->upper - spin->adjustment->value;
if (diff > EPSILON)
gtk_spin_button_real_spin (spin, diff);
}
@ -1164,7 +1164,7 @@ gtk_spin_button_key_press (GtkWidget *widget,
if (event->state & GDK_CONTROL_MASK)
{
gfloat diff = spin->adjustment->value - spin->adjustment->lower;
gdouble diff = spin->adjustment->value - spin->adjustment->lower;
if (diff > EPSILON)
gtk_spin_button_real_spin (spin, -diff);
}
@ -1196,10 +1196,10 @@ gtk_spin_button_key_release (GtkWidget *widget,
static void
gtk_spin_button_snap (GtkSpinButton *spin_button,
gfloat val)
gdouble val)
{
gfloat inc;
gfloat tmp;
gdouble inc;
gdouble tmp;
inc = spin_button->adjustment->step_increment;
tmp = (val - spin_button->adjustment->lower) / inc;
@ -1310,10 +1310,10 @@ gtk_spin_button_insert_text (GtkEntry *entry,
static void
gtk_spin_button_real_spin (GtkSpinButton *spin_button,
gfloat increment)
gdouble increment)
{
GtkAdjustment *adj;
gfloat new_value = 0.0;
gdouble new_value = 0.0;
g_return_if_fail (spin_button != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
@ -1353,7 +1353,7 @@ gtk_spin_button_real_spin (GtkSpinButton *spin_button,
static gint
gtk_spin_button_default_input (GtkSpinButton *spin_button,
gfloat *new_val)
gdouble *new_val)
{
gchar *err = NULL;
@ -1386,7 +1386,7 @@ gtk_spin_button_default_output (GtkSpinButton *spin_button)
void
gtk_spin_button_configure (GtkSpinButton *spin_button,
GtkAdjustment *adjustment,
gfloat climb_rate,
gdouble climb_rate,
guint digits)
{
g_return_if_fail (spin_button != NULL);
@ -1405,7 +1405,7 @@ gtk_spin_button_configure (GtkSpinButton *spin_button,
GtkWidget *
gtk_spin_button_new (GtkAdjustment *adjustment,
gfloat climb_rate,
gdouble climb_rate,
guint digits)
{
GtkSpinButton *spin;
@ -1491,7 +1491,7 @@ gtk_spin_button_set_digits (GtkSpinButton *spin_button,
}
}
gfloat
gdouble
gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button)
{
g_return_val_if_fail (spin_button != NULL, 0.0);
@ -1503,7 +1503,7 @@ gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button)
gint
gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button)
{
gfloat val;
gdouble val;
g_return_val_if_fail (spin_button != NULL, 0);
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0);
@ -1517,7 +1517,7 @@ gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button)
void
gtk_spin_button_set_value (GtkSpinButton *spin_button,
gfloat value)
gdouble value)
{
g_return_if_fail (spin_button != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
@ -1596,10 +1596,10 @@ gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
void
gtk_spin_button_spin (GtkSpinButton *spin_button,
GtkSpinType direction,
gfloat increment)
gdouble increment)
{
GtkAdjustment *adj;
gfloat diff;
gdouble diff;
g_return_if_fail (spin_button != NULL);
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
@ -1666,7 +1666,7 @@ gtk_spin_button_spin (GtkSpinButton *spin_button,
void
gtk_spin_button_update (GtkSpinButton *spin_button)
{
gfloat val;
gdouble val;
gint error = 0;
gint return_val;

View File

@ -83,8 +83,8 @@ struct _GtkSpinButton
guint32 timer;
guint32 ev_time;
gfloat climb_rate;
gfloat timer_step;
gdouble climb_rate;
gdouble timer_step;
GtkSpinButtonUpdatePolicy update_policy;
@ -104,7 +104,7 @@ struct _GtkSpinButtonClass
GtkEntryClass parent_class;
gint (*input) (GtkSpinButton *spin_button,
gfloat *new_value);
gdouble *new_value);
gint (*output) (GtkSpinButton *spin_button);
};
@ -113,11 +113,11 @@ GtkType gtk_spin_button_get_type (void) G_GNUC_CONST;
void gtk_spin_button_configure (GtkSpinButton *spin_button,
GtkAdjustment *adjustment,
gfloat climb_rate,
gdouble climb_rate,
guint digits);
GtkWidget* gtk_spin_button_new (GtkAdjustment *adjustment,
gfloat climb_rate,
gdouble climb_rate,
guint digits);
void gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
@ -128,12 +128,12 @@ GtkAdjustment* gtk_spin_button_get_adjustment (GtkSpinButton *spin_button);
void gtk_spin_button_set_digits (GtkSpinButton *spin_button,
guint digits);
gfloat gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button);
gdouble gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button);
gint gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button);
void gtk_spin_button_set_value (GtkSpinButton *spin_button,
gfloat value);
gdouble value);
void gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
GtkSpinButtonUpdatePolicy policy);
@ -143,7 +143,7 @@ void gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
void gtk_spin_button_spin (GtkSpinButton *spin_button,
GtkSpinType direction,
gfloat increment);
gdouble increment);
void gtk_spin_button_set_wrap (GtkSpinButton *spin_button,
gboolean wrap);

View File

@ -4225,8 +4225,8 @@ adjust_adj (GtkText* text, GtkAdjustment* adj)
gdk_window_get_size (text->text_area, NULL, &height);
adj->step_increment = MIN (adj->upper, (float) SCROLL_PIXELS);
adj->page_increment = MIN (adj->upper, height - (float) KEY_SCROLL_PIXELS);
adj->step_increment = MIN (adj->upper, SCROLL_PIXELS);
adj->page_increment = MIN (adj->upper, height - KEY_SCROLL_PIXELS);
adj->page_size = MIN (adj->upper, height);
adj->value = MIN (adj->value, adj->upper - adj->page_size);
adj->value = MAX (adj->value, 0.0);
@ -4254,7 +4254,7 @@ set_vertical_scroll_iterator (GtkText* text, LineParams* lp, void* data)
text->first_cut_pixels = 0;
}
text->vadj->value = (float) text->first_onscreen_ver_pixel;
text->vadj->value = text->first_onscreen_ver_pixel;
}
svdata->pixel_height += LINE_HEIGHT (*lp);
@ -4300,13 +4300,13 @@ set_vertical_scroll (GtkText* text)
data.pixel_height = 0;
line_params_iterate (text, &mark, NULL, FALSE, &data, set_vertical_scroll_iterator);
text->vadj->upper = (float) data.pixel_height;
text->vadj->upper = data.pixel_height;
orig_value = (gint) text->vadj->value;
gdk_window_get_size (text->text_area, NULL, &height);
text->vadj->step_increment = MIN (text->vadj->upper, (float) SCROLL_PIXELS);
text->vadj->page_increment = MIN (text->vadj->upper, height - (float) KEY_SCROLL_PIXELS);
text->vadj->step_increment = MIN (text->vadj->upper, SCROLL_PIXELS);
text->vadj->page_increment = MIN (text->vadj->upper, height - KEY_SCROLL_PIXELS);
text->vadj->page_size = MIN (text->vadj->upper, height);
text->vadj->value = MIN (text->vadj->value, text->vadj->upper - text->vadj->page_size);
text->vadj->value = MAX (text->vadj->value, 0.0);
@ -4332,7 +4332,7 @@ set_vertical_scroll (GtkText* text)
static void
scroll_int (GtkText* text, gint diff)
{
gfloat upper;
gdouble upper;
text->vadj->value += diff;

View File

@ -1054,7 +1054,7 @@ gtk_text_view_get_line_at_y (GtkTextView *text_view,
}
static gboolean
set_adjustment_clamped (GtkAdjustment *adj, gfloat val)
set_adjustment_clamped (GtkAdjustment *adj, gdouble val)
{
/* We don't really want to clamp to upper; we want to clamp to
upper - page_size which is the highest value the scrollbar
@ -1343,11 +1343,11 @@ gtk_text_view_flush_scroll (GtkTextView *text_view)
}
static void
gtk_text_view_set_adjustment_upper (GtkAdjustment *adj, gfloat upper)
gtk_text_view_set_adjustment_upper (GtkAdjustment *adj, gdouble upper)
{
if (upper != adj->upper)
{
gfloat min = MAX (0., upper - adj->page_size);
gdouble min = MAX (0., upper - adj->page_size);
gboolean value_changed = FALSE;
adj->upper = upper;
@ -3662,7 +3662,7 @@ static void
gtk_text_view_scroll_pages (GtkTextView *text_view,
gint count)
{
gfloat newval;
gdouble newval;
GtkAdjustment *adj;
gint cursor_x_pos, cursor_y_pos;
GtkTextIter new_insert;

View File

@ -985,7 +985,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
if (tree_view->priv->vadjustment->value + allocation->height > tree_view->priv->height)
gtk_adjustment_set_value (tree_view->priv->vadjustment,
(gfloat) MAX (tree_view->priv->height - allocation->height, 0));
MAX (tree_view->priv->height - allocation->height, 0));
gtk_signal_emit_by_name (GTK_OBJECT (tree_view->priv->vadjustment), "changed");
@ -2494,7 +2494,7 @@ gtk_tree_view_focus (GtkContainer *container,
/* Case 4. We have focus already. Move the cursor. */
if (direction == GTK_DIR_LEFT)
{
gfloat val;
gdouble val;
val = tree_view->priv->hadjustment->value - tree_view->priv->hadjustment->page_size/2;
val = MAX (val, 0.0);
gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->hadjustment), val);
@ -2506,7 +2506,7 @@ gtk_tree_view_focus (GtkContainer *container,
}
if (direction == GTK_DIR_RIGHT)
{
gfloat val;
gdouble val;
val = tree_view->priv->hadjustment->value + tree_view->priv->hadjustment->page_size/2;
val = MIN (tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size, val);
gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->hadjustment), val);

View File

@ -140,11 +140,11 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
gint xthickness;
gint ythickness;
gint length, ideal_length;
gfloat lower, upper; /* Upper and lower limits, in ruler units */
gfloat increment; /* Number of pixels per unit */
gdouble lower, upper; /* Upper and lower limits, in ruler units */
gdouble increment; /* Number of pixels per unit */
gint scale; /* Number of units per major unit */
gfloat subd_incr;
gfloat start, end, cur;
gdouble subd_incr;
gdouble start, end, cur;
gchar unit_str[32];
gint digit_height;
gint digit_offset;
@ -193,7 +193,7 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
if ((upper - lower) == 0)
return;
increment = (gfloat) width / (upper - lower);
increment = (gdouble) width / (upper - lower);
/* determine the scale
* use the maximum extents of the ruler to determine the largest
@ -216,8 +216,8 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
length = 0;
for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
{
subd_incr = (gfloat) ruler->metric->ruler_scale[scale] /
(gfloat) ruler->metric->subdivide[i];
subd_incr = (gdouble) ruler->metric->ruler_scale[scale] /
(gdouble) ruler->metric->subdivide[i];
if (subd_incr * fabs(increment) <= MINIMUM_INCR)
continue;
@ -287,7 +287,7 @@ gtk_vruler_draw_pos (GtkRuler *ruler)
gint bs_width, bs_height;
gint xthickness;
gint ythickness;
gfloat increment;
gdouble increment;
g_return_if_fail (ruler != NULL);
g_return_if_fail (GTK_IS_VRULER (ruler));
@ -317,7 +317,7 @@ gtk_vruler_draw_pos (GtkRuler *ruler)
ruler->xsrc, ruler->ysrc,
bs_width, bs_height);
increment = (gfloat) height / (ruler->upper - ruler->lower);
increment = (gdouble) height / (ruler->upper - ruler->lower);
x = (width + bs_width) / 2 + xthickness;
y = ROUND ((ruler->position - ruler->lower) * increment) + (ythickness - bs_height) / 2 - 1;

View File

@ -1501,7 +1501,7 @@ create_tree_mode_window(void)
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_NUMBER_OF_ITEM, 1.0, 255.0, 1.0,
adj = (GtkAdjustment *) gtk_adjustment_new (DEFAULT_NUMBER_OF_ITEM, 1.0, 255.0, 1.0,
5.0, 0.0);
spinner = gtk_spin_button_new (adj, 0, 0);
gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
@ -1515,7 +1515,7 @@ create_tree_mode_window(void)
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_RECURSION_LEVEL, 0.0, 255.0, 1.0,
adj = (GtkAdjustment *) gtk_adjustment_new (DEFAULT_RECURSION_LEVEL, 0.0, 255.0, 1.0,
5.0, 0.0);
spinner = gtk_spin_button_new (adj, 0, 0);
gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
@ -2969,16 +2969,27 @@ gtk_ifactory_cb (gpointer callback_data,
g_message ("ItemFactory: activated \"%s\"", gtk_item_factory_path_from_widget (widget));
}
static void
dump_accels (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
gtk_item_factory_dump_items (NULL, FALSE, gtk_item_factory_print_func, stdout);
}
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/_Dump \"_Accels\"", NULL, dump_accels, 0 },
{ "/File/\\/Test__Escaping/And\\/\n\tWei\\\\rdly",
NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
@ -3626,8 +3637,8 @@ static gint
spin_button_time_output_func (GtkSpinButton *spin_button)
{
static gchar buf[6];
gfloat hours;
gfloat minutes;
gdouble hours;
gdouble minutes;
hours = spin_button->adjustment->value / 60.0;
minutes = (fabs(floor (hours) - hours) < 1e-5) ? 0.0 : 30;
@ -3639,7 +3650,7 @@ spin_button_time_output_func (GtkSpinButton *spin_button)
static gint
spin_button_month_input_func (GtkSpinButton *spin_button,
gfloat *new_val)
gdouble *new_val)
{
gint i;
static gchar *month[12] = { "January", "February", "March", "April",
@ -3666,7 +3677,7 @@ spin_button_month_input_func (GtkSpinButton *spin_button,
*new_val = 0.0;
return GTK_INPUT_ERROR;
}
*new_val = (gfloat) i;
*new_val = (gdouble) i;
return TRUE;
}
@ -3689,14 +3700,14 @@ spin_button_month_output_func (GtkSpinButton *spin_button)
static gint
spin_button_hex_input_func (GtkSpinButton *spin_button,
gfloat *new_val)
gdouble *new_val)
{
gchar *buf;
gchar *err;
gfloat res;
gdouble res;
buf = gtk_entry_get_text (GTK_ENTRY (spin_button));
res = (gfloat)(strtol(buf, &err, 16));
res = strtol(buf, &err, 16);
*new_val = res;
if (*err)
return GTK_INPUT_ERROR;
@ -7970,7 +7981,7 @@ typedef struct _ProgressData {
gint
progress_timeout (gpointer data)
{
gfloat new_val;
gdouble new_val;
GtkAdjustment *adj;
adj = GTK_PROGRESS (data)->adjustment;
@ -8736,9 +8747,9 @@ static gint
scroll_test_scroll (GtkWidget *widget, GdkEventScroll *event,
GtkAdjustment *adj)
{
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
adj->page_increment / 2);
gdouble new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
adj->page_increment / 2);
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);

View File

@ -1501,7 +1501,7 @@ create_tree_mode_window(void)
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_NUMBER_OF_ITEM, 1.0, 255.0, 1.0,
adj = (GtkAdjustment *) gtk_adjustment_new (DEFAULT_NUMBER_OF_ITEM, 1.0, 255.0, 1.0,
5.0, 0.0);
spinner = gtk_spin_button_new (adj, 0, 0);
gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
@ -1515,7 +1515,7 @@ create_tree_mode_window(void)
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_RECURSION_LEVEL, 0.0, 255.0, 1.0,
adj = (GtkAdjustment *) gtk_adjustment_new (DEFAULT_RECURSION_LEVEL, 0.0, 255.0, 1.0,
5.0, 0.0);
spinner = gtk_spin_button_new (adj, 0, 0);
gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
@ -2969,16 +2969,27 @@ gtk_ifactory_cb (gpointer callback_data,
g_message ("ItemFactory: activated \"%s\"", gtk_item_factory_path_from_widget (widget));
}
static void
dump_accels (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
gtk_item_factory_dump_items (NULL, FALSE, gtk_item_factory_print_func, stdout);
}
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/_Dump \"_Accels\"", NULL, dump_accels, 0 },
{ "/File/\\/Test__Escaping/And\\/\n\tWei\\\\rdly",
NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
@ -3626,8 +3637,8 @@ static gint
spin_button_time_output_func (GtkSpinButton *spin_button)
{
static gchar buf[6];
gfloat hours;
gfloat minutes;
gdouble hours;
gdouble minutes;
hours = spin_button->adjustment->value / 60.0;
minutes = (fabs(floor (hours) - hours) < 1e-5) ? 0.0 : 30;
@ -3639,7 +3650,7 @@ spin_button_time_output_func (GtkSpinButton *spin_button)
static gint
spin_button_month_input_func (GtkSpinButton *spin_button,
gfloat *new_val)
gdouble *new_val)
{
gint i;
static gchar *month[12] = { "January", "February", "March", "April",
@ -3666,7 +3677,7 @@ spin_button_month_input_func (GtkSpinButton *spin_button,
*new_val = 0.0;
return GTK_INPUT_ERROR;
}
*new_val = (gfloat) i;
*new_val = (gdouble) i;
return TRUE;
}
@ -3689,14 +3700,14 @@ spin_button_month_output_func (GtkSpinButton *spin_button)
static gint
spin_button_hex_input_func (GtkSpinButton *spin_button,
gfloat *new_val)
gdouble *new_val)
{
gchar *buf;
gchar *err;
gfloat res;
gdouble res;
buf = gtk_entry_get_text (GTK_ENTRY (spin_button));
res = (gfloat)(strtol(buf, &err, 16));
res = strtol(buf, &err, 16);
*new_val = res;
if (*err)
return GTK_INPUT_ERROR;
@ -7970,7 +7981,7 @@ typedef struct _ProgressData {
gint
progress_timeout (gpointer data)
{
gfloat new_val;
gdouble new_val;
GtkAdjustment *adj;
adj = GTK_PROGRESS (data)->adjustment;
@ -8736,9 +8747,9 @@ static gint
scroll_test_scroll (GtkWidget *widget, GdkEventScroll *event,
GtkAdjustment *adj)
{
gfloat new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
adj->page_increment / 2);
gdouble new_value = adj->value + ((event->direction == GDK_SCROLL_UP) ?
-adj->page_increment / 2:
adj->page_increment / 2);
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);