Fixed wrong size of activity indicator. It is settable now as a fraction

Tue Jul 21 06:32:43 1998  Stefan Jeske  <stefan@gtk.org>

	* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
 	activity indicator. It is settable now as a fraction of the
	total width/height using gtk_progress_bar_set_activity_blocks.
	Renamed gtk_progress_bar_set_number_of_blocks to
	gtk_progress_bar_set_discrete_blocks.
This commit is contained in:
Stefan Jeske 1998-07-21 04:49:01 +00:00 committed by Stefan Jeske
parent 7c30f2a15f
commit dbfe3d3967
11 changed files with 145 additions and 19 deletions

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -1,3 +1,11 @@
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
* gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
activity indicator. It is settable now as a fraction of the
total width/height using gtk_progress_bar_set_activity_blocks.
Renamed gtk_progress_bar_set_number_of_blocks to
gtk_progress_bar_set_discrete_blocks.
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)

View File

@ -93,6 +93,7 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
pbar->activity_pos = 0;
pbar->activity_dir = 1;
pbar->activity_step = 3;
pbar->activity_blocks = 5;
}
@ -157,8 +158,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
{
size = widget->allocation.height -
widget->style->klass->ythickness * 2;
size = MAX (2, widget->allocation.width / pbar->activity_blocks);
if (pbar->activity_dir == 0)
{
@ -184,8 +184,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
}
else
{
size = widget->allocation.width -
widget->style->klass->xthickness * 2;
size = MAX (2, widget->allocation.height / pbar->activity_blocks);
if (pbar->activity_dir == 0)
{
@ -304,6 +303,7 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
{
GtkProgressBar *pbar;
GtkWidget *widget;
gint size;
pbar = GTK_PROGRESS_BAR (progress);
widget = GTK_WIDGET (progress);
@ -313,6 +313,8 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
{
size = MAX (2, widget->allocation.width / pbar->activity_blocks);
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
{
pbar->activity_pos = widget->style->klass->xthickness;
@ -328,6 +330,8 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
}
else
{
size = MAX (2, widget->allocation.height / pbar->activity_blocks);
if (pbar->orientation == GTK_PROGRESS_TOP_TO_BOTTOM)
{
pbar->activity_pos = widget->style->klass->ythickness;
@ -355,6 +359,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
gint x;
gint y;
gfloat percentage;
gint size;
g_return_if_fail (progress != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (progress));
@ -394,13 +399,14 @@ gtk_progress_bar_paint (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
{
size = MAX (2, widget->allocation.width / pbar->activity_blocks);
gdk_draw_rectangle (progress->offscreen_pixmap,
widget->style->bg_gc[GTK_STATE_PRELIGHT],
TRUE,
pbar->activity_pos,
widget->style->klass->ythickness,
widget->allocation.height -
widget->style->klass->ythickness * 2,
size,
widget->allocation.height -
widget->style->klass->ythickness * 2);
@ -409,14 +415,15 @@ gtk_progress_bar_paint (GtkProgress *progress)
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
pbar->activity_pos,
widget->style->klass->ythickness,
widget->allocation.height -
widget->style->klass->ythickness * 2,
size,
widget->allocation.height -
widget->style->klass->ythickness * 2);
return;
}
else
{
size = MAX (2, widget->allocation.height / pbar->activity_blocks);
gdk_draw_rectangle (progress->offscreen_pixmap,
widget->style->bg_gc[GTK_STATE_PRELIGHT],
TRUE,
@ -424,8 +431,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
pbar->activity_pos,
widget->allocation.width -
widget->style->klass->xthickness * 2,
widget->allocation.width -
widget->style->klass->xthickness * 2);
size);
gtk_draw_shadow (widget->style,
progress->offscreen_pixmap,
@ -434,8 +440,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
pbar->activity_pos,
widget->allocation.width -
widget->style->klass->xthickness * 2,
widget->allocation.width -
widget->style->klass->xthickness * 2);
size);
return;
}
}
@ -764,8 +769,8 @@ gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
}
void
gtk_progress_bar_set_number_of_blocks (GtkProgressBar *pbar,
guint blocks)
gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
guint blocks)
{
g_return_if_fail (pbar != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
@ -790,3 +795,15 @@ gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
if (pbar->activity_step != step)
pbar->activity_step = step;
}
void
gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
guint blocks)
{
g_return_if_fail (pbar != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
g_return_if_fail (blocks > 1);
if (pbar->activity_blocks != blocks)
pbar->activity_blocks = blocks;
}

View File

@ -64,6 +64,7 @@ struct _GtkProgressBar
gint activity_pos;
guint activity_step;
guint activity_blocks;
guint activity_dir : 1;
};
@ -80,10 +81,12 @@ void gtk_progress_bar_construct (GtkProgressBar *pbar,
GtkAdjustment *adjustment);
void gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
GtkProgressBarStyle style);
void gtk_progress_bar_set_number_of_blocks (GtkProgressBar *pbar,
void gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
guint blocks);
void gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
guint step);
void gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
guint blocks);
void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
GtkProgressBarOrientation orientation);
void gtk_progress_bar_update (GtkProgressBar *pbar,

View File

@ -5903,6 +5903,7 @@ typedef struct _ProgressData {
GtkWidget *x_align_spin;
GtkWidget *y_align_spin;
GtkWidget *step_spin;
GtkWidget *act_blocks_spin;
GtkWidget *label;
GtkWidget *omenu1;
GtkWidget *omenu3;
@ -6005,7 +6006,7 @@ static void
adjust_blocks (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_set_percentage (GTK_PROGRESS (pdata->pbar), 0);
gtk_progress_bar_set_number_of_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_progress_bar_set_discrete_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pdata->block_spin)));
}
@ -6016,6 +6017,14 @@ adjust_step (GtkAdjustment *adj, ProgressData *pdata)
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pdata->step_spin)));
}
static void
adjust_act_blocks (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (pdata->act_blocks_spin)));
}
static void
adjust_align (GtkAdjustment *adj, ProgressData *pdata)
{
@ -6033,6 +6042,8 @@ toggle_activity_mode (GtkWidget *widget, ProgressData *pdata)
GTK_TOGGLE_BUTTON (widget)->active);
gtk_widget_set_sensitive (pdata->step_spin,
GTK_TOGGLE_BUTTON (widget)->active);
gtk_widget_set_sensitive (pdata->act_blocks_spin,
GTK_TOGGLE_BUTTON (widget)->active);
}
static void
@ -6119,7 +6130,7 @@ create_progress_bar (void)
vbox2 = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
tab = gtk_table_new (6, 2, FALSE);
tab = gtk_table_new (7, 2, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), tab, FALSE, TRUE, 0);
label = gtk_label_new ("Orientation :");
@ -6306,6 +6317,20 @@ create_progress_bar (void)
gtk_box_pack_start (GTK_BOX (hbox), pdata->step_spin, FALSE, TRUE, 0);
gtk_widget_set_sensitive (pdata->step_spin, FALSE);
hbox = gtk_hbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (tab), hbox, 1, 2, 6, 7,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
label = gtk_label_new ("Blocks : ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new (5, 2, 10, 1, 5, 0);
pdata->act_blocks_spin = gtk_spin_button_new (adj, 0, 0);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (adjust_act_blocks), pdata);
gtk_box_pack_start (GTK_BOX (hbox), pdata->act_blocks_spin, FALSE, TRUE,
0);
gtk_widget_set_sensitive (pdata->act_blocks_spin, FALSE);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),

View File

@ -5903,6 +5903,7 @@ typedef struct _ProgressData {
GtkWidget *x_align_spin;
GtkWidget *y_align_spin;
GtkWidget *step_spin;
GtkWidget *act_blocks_spin;
GtkWidget *label;
GtkWidget *omenu1;
GtkWidget *omenu3;
@ -6005,7 +6006,7 @@ static void
adjust_blocks (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_set_percentage (GTK_PROGRESS (pdata->pbar), 0);
gtk_progress_bar_set_number_of_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_progress_bar_set_discrete_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pdata->block_spin)));
}
@ -6016,6 +6017,14 @@ adjust_step (GtkAdjustment *adj, ProgressData *pdata)
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pdata->step_spin)));
}
static void
adjust_act_blocks (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (pdata->act_blocks_spin)));
}
static void
adjust_align (GtkAdjustment *adj, ProgressData *pdata)
{
@ -6033,6 +6042,8 @@ toggle_activity_mode (GtkWidget *widget, ProgressData *pdata)
GTK_TOGGLE_BUTTON (widget)->active);
gtk_widget_set_sensitive (pdata->step_spin,
GTK_TOGGLE_BUTTON (widget)->active);
gtk_widget_set_sensitive (pdata->act_blocks_spin,
GTK_TOGGLE_BUTTON (widget)->active);
}
static void
@ -6119,7 +6130,7 @@ create_progress_bar (void)
vbox2 = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
tab = gtk_table_new (6, 2, FALSE);
tab = gtk_table_new (7, 2, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), tab, FALSE, TRUE, 0);
label = gtk_label_new ("Orientation :");
@ -6306,6 +6317,20 @@ create_progress_bar (void)
gtk_box_pack_start (GTK_BOX (hbox), pdata->step_spin, FALSE, TRUE, 0);
gtk_widget_set_sensitive (pdata->step_spin, FALSE);
hbox = gtk_hbox_new (FALSE, 0);
gtk_table_attach (GTK_TABLE (tab), hbox, 1, 2, 6, 7,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
label = gtk_label_new ("Blocks : ");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
adj = (GtkAdjustment *) gtk_adjustment_new (5, 2, 10, 1, 5, 0);
pdata->act_blocks_spin = gtk_spin_button_new (adj, 0, 0);
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (adjust_act_blocks), pdata);
gtk_box_pack_start (GTK_BOX (hbox), pdata->act_blocks_spin, FALSE, TRUE,
0);
gtk_widget_set_sensitive (pdata->act_blocks_spin, FALSE);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),