Move activity bar offset and size calculations to separate function.
Fri Jun 16 11:49:53 2006 Tim Janik <timj@imendio.com> * fixed #337882 by applying patches from Tommi Komulainen: * gtk/gtkprogressbar.c: (gtk_progress_bar_paint_activity): (gtk_progress_bar_get_activity): Move activity bar offset and size calculations to separate function. (gtk_progress_bar_paint_text): Allow caller to specify offset for the prelight part in addition to width. (gtk_progress_bar_paint): Paint the text also in activity mode, #337882. * gtk/gtkprogressbar.c: (gtk_progress_bar_paint_text): Paint the prelighted text on top of the normal rather than side by side, to simplify painting text in activity mode.
This commit is contained in:
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 16 11:49:53 2006 Tim Janik <timj@imendio.com>
|
||||||
|
|
||||||
|
* fixed #337882 by applying patches from Tommi Komulainen:
|
||||||
|
|
||||||
|
* gtk/gtkprogressbar.c:
|
||||||
|
(gtk_progress_bar_paint_activity):
|
||||||
|
(gtk_progress_bar_get_activity): Move activity bar offset and size
|
||||||
|
calculations to separate function.
|
||||||
|
(gtk_progress_bar_paint_text): Allow caller to specify offset for the
|
||||||
|
prelight part in addition to width.
|
||||||
|
(gtk_progress_bar_paint): Paint the text also in activity mode, #337882.
|
||||||
|
|
||||||
|
* gtk/gtkprogressbar.c: (gtk_progress_bar_paint_text): Paint the
|
||||||
|
prelighted text on top of the normal rather than side by side, to
|
||||||
|
simplify painting text in activity mode.
|
||||||
|
|
||||||
2006-06-16 Matthias Clasen <mclasen@redhat.com>
|
2006-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* modules/printbackends/cups/gtkprintbackendcups.c: Include
|
* modules/printbackends/cups/gtkprintbackendcups.c: Include
|
||||||
|
|||||||
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 16 11:49:53 2006 Tim Janik <timj@imendio.com>
|
||||||
|
|
||||||
|
* fixed #337882 by applying patches from Tommi Komulainen:
|
||||||
|
|
||||||
|
* gtk/gtkprogressbar.c:
|
||||||
|
(gtk_progress_bar_paint_activity):
|
||||||
|
(gtk_progress_bar_get_activity): Move activity bar offset and size
|
||||||
|
calculations to separate function.
|
||||||
|
(gtk_progress_bar_paint_text): Allow caller to specify offset for the
|
||||||
|
prelight part in addition to width.
|
||||||
|
(gtk_progress_bar_paint): Paint the text also in activity mode, #337882.
|
||||||
|
|
||||||
|
* gtk/gtkprogressbar.c: (gtk_progress_bar_paint_text): Paint the
|
||||||
|
prelighted text on top of the normal rather than side by side, to
|
||||||
|
simplify painting text in activity mode.
|
||||||
|
|
||||||
2006-06-16 Matthias Clasen <mclasen@redhat.com>
|
2006-06-16 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* modules/printbackends/cups/gtkprintbackendcups.c: Include
|
* modules/printbackends/cups/gtkprintbackendcups.c: Include
|
||||||
|
|||||||
@ -598,6 +598,30 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_progress_bar_get_activity (GtkProgressBar *pbar,
|
||||||
|
GtkProgressBarOrientation orientation,
|
||||||
|
gint *offset,
|
||||||
|
gint *amount)
|
||||||
|
{
|
||||||
|
GtkWidget *widget = GTK_WIDGET (pbar);
|
||||||
|
|
||||||
|
*offset = pbar->activity_pos;
|
||||||
|
|
||||||
|
switch (orientation)
|
||||||
|
{
|
||||||
|
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
||||||
|
case GTK_PROGRESS_RIGHT_TO_LEFT:
|
||||||
|
*amount = MAX (2, widget->allocation.width / pbar->activity_blocks);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GTK_PROGRESS_TOP_TO_BOTTOM:
|
||||||
|
case GTK_PROGRESS_BOTTOM_TO_TOP:
|
||||||
|
*amount = MAX (2, widget->allocation.height / pbar->activity_blocks);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_progress_bar_paint_activity (GtkProgressBar *pbar,
|
gtk_progress_bar_paint_activity (GtkProgressBar *pbar,
|
||||||
GtkProgressBarOrientation orientation)
|
GtkProgressBarOrientation orientation)
|
||||||
@ -610,18 +634,16 @@ gtk_progress_bar_paint_activity (GtkProgressBar *pbar,
|
|||||||
{
|
{
|
||||||
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
||||||
case GTK_PROGRESS_RIGHT_TO_LEFT:
|
case GTK_PROGRESS_RIGHT_TO_LEFT:
|
||||||
area.x = pbar->activity_pos;
|
gtk_progress_bar_get_activity (pbar, orientation, &area.x, &area.width);
|
||||||
area.y = widget->style->ythickness;
|
area.y = widget->style->ythickness;
|
||||||
area.width = MAX (2, widget->allocation.width / pbar->activity_blocks);
|
|
||||||
area.height = widget->allocation.height - 2 * widget->style->ythickness;
|
area.height = widget->allocation.height - 2 * widget->style->ythickness;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_PROGRESS_TOP_TO_BOTTOM:
|
case GTK_PROGRESS_TOP_TO_BOTTOM:
|
||||||
case GTK_PROGRESS_BOTTOM_TO_TOP:
|
case GTK_PROGRESS_BOTTOM_TO_TOP:
|
||||||
|
gtk_progress_bar_get_activity (pbar, orientation, &area.y, &area.height);
|
||||||
area.x = widget->style->xthickness;
|
area.x = widget->style->xthickness;
|
||||||
area.y = pbar->activity_pos;
|
|
||||||
area.width = widget->allocation.width - 2 * widget->style->xthickness;
|
area.width = widget->allocation.width - 2 * widget->style->xthickness;
|
||||||
area.height = MAX (2, widget->allocation.height / pbar->activity_blocks);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -738,6 +760,7 @@ gtk_progress_bar_paint_discrete (GtkProgressBar *pbar,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
||||||
|
gint offset,
|
||||||
gint amount,
|
gint amount,
|
||||||
GtkProgressBarOrientation orientation)
|
GtkProgressBarOrientation orientation)
|
||||||
{
|
{
|
||||||
@ -781,35 +804,39 @@ gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
|||||||
switch (orientation)
|
switch (orientation)
|
||||||
{
|
{
|
||||||
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
case GTK_PROGRESS_LEFT_TO_RIGHT:
|
||||||
|
if (offset != -1)
|
||||||
|
prelight_clip.x = offset;
|
||||||
prelight_clip.width = amount;
|
prelight_clip.width = amount;
|
||||||
normal_clip.x += amount;
|
|
||||||
normal_clip.width -= amount;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_PROGRESS_RIGHT_TO_LEFT:
|
case GTK_PROGRESS_RIGHT_TO_LEFT:
|
||||||
normal_clip.width -= amount;
|
if (offset != -1)
|
||||||
prelight_clip.x += normal_clip.width;
|
prelight_clip.x = offset;
|
||||||
prelight_clip.width -= normal_clip.width;
|
else
|
||||||
|
prelight_clip.x = rect.x + rect.width - amount;
|
||||||
|
prelight_clip.width = amount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_PROGRESS_TOP_TO_BOTTOM:
|
case GTK_PROGRESS_TOP_TO_BOTTOM:
|
||||||
|
if (offset != -1)
|
||||||
|
prelight_clip.y = offset;
|
||||||
prelight_clip.height = amount;
|
prelight_clip.height = amount;
|
||||||
normal_clip.y += amount;
|
|
||||||
normal_clip.height -= amount;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_PROGRESS_BOTTOM_TO_TOP:
|
case GTK_PROGRESS_BOTTOM_TO_TOP:
|
||||||
normal_clip.height -= amount;
|
if (offset != -1)
|
||||||
prelight_clip.y += normal_clip.height;
|
prelight_clip.y = offset;
|
||||||
prelight_clip.height -= normal_clip.height;
|
else
|
||||||
|
prelight_clip.y = rect.y + rect.height - amount;
|
||||||
|
prelight_clip.height = amount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_layout (widget->style,
|
gtk_paint_layout (widget->style,
|
||||||
progress->offscreen_pixmap,
|
progress->offscreen_pixmap,
|
||||||
GTK_STATE_PRELIGHT,
|
GTK_STATE_NORMAL,
|
||||||
FALSE,
|
FALSE,
|
||||||
&prelight_clip,
|
&normal_clip,
|
||||||
widget,
|
widget,
|
||||||
"progressbar",
|
"progressbar",
|
||||||
x, y,
|
x, y,
|
||||||
@ -817,9 +844,9 @@ gtk_progress_bar_paint_text (GtkProgressBar *pbar,
|
|||||||
|
|
||||||
gtk_paint_layout (widget->style,
|
gtk_paint_layout (widget->style,
|
||||||
progress->offscreen_pixmap,
|
progress->offscreen_pixmap,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_PRELIGHT,
|
||||||
FALSE,
|
FALSE,
|
||||||
&normal_clip,
|
&prelight_clip,
|
||||||
widget,
|
widget,
|
||||||
"progressbar",
|
"progressbar",
|
||||||
x, y,
|
x, y,
|
||||||
@ -864,6 +891,15 @@ gtk_progress_bar_paint (GtkProgress *progress)
|
|||||||
if (progress->activity_mode)
|
if (progress->activity_mode)
|
||||||
{
|
{
|
||||||
gtk_progress_bar_paint_activity (pbar, orientation);
|
gtk_progress_bar_paint_activity (pbar, orientation);
|
||||||
|
|
||||||
|
if (GTK_PROGRESS (pbar)->show_text)
|
||||||
|
{
|
||||||
|
gint offset;
|
||||||
|
gint amount;
|
||||||
|
|
||||||
|
gtk_progress_bar_get_activity (pbar, orientation, &offset, &amount);
|
||||||
|
gtk_progress_bar_paint_text (pbar, offset, amount, orientation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -884,7 +920,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
|
|||||||
gtk_progress_bar_paint_continuous (pbar, amount, orientation);
|
gtk_progress_bar_paint_continuous (pbar, amount, orientation);
|
||||||
|
|
||||||
if (GTK_PROGRESS (pbar)->show_text)
|
if (GTK_PROGRESS (pbar)->show_text)
|
||||||
gtk_progress_bar_paint_text (pbar, amount, orientation);
|
gtk_progress_bar_paint_text (pbar, -1, amount, orientation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_progress_bar_paint_discrete (pbar, orientation);
|
gtk_progress_bar_paint_discrete (pbar, orientation);
|
||||||
|
|||||||
Reference in New Issue
Block a user