mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 19:00:12 +00:00
scale: Fix mark positions
Someone else will have to fix the css.
This commit is contained in:
parent
4eba9442df
commit
995903e971
@ -432,7 +432,7 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
indicator_alloc.x = indicator_width / 2;
|
||||
indicator_alloc.x = (allocation->width - indicator_width) / 2;
|
||||
if (mark->position == GTK_POS_TOP)
|
||||
indicator_alloc.y = allocation->y + allocation->height - indicator_height;
|
||||
else
|
||||
@ -446,7 +446,7 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
||||
indicator_alloc.x = allocation->x + allocation->width - indicator_width;
|
||||
else
|
||||
indicator_alloc.x = allocation->x;
|
||||
indicator_alloc.y = indicator_height / 2;
|
||||
indicator_alloc.y = (allocation->height - indicator_height) / 2;
|
||||
indicator_alloc.width = indicator_width;
|
||||
indicator_alloc.height = indicator_height;
|
||||
}
|
||||
@ -479,31 +479,6 @@ gtk_scale_allocate_mark (GtkGizmo *gizmo,
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
find_next_pos (GtkWidget *widget,
|
||||
GSList *list,
|
||||
gint *marks,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
GSList *m;
|
||||
gint i;
|
||||
int width, height;
|
||||
|
||||
for (m = list->next, i = 1; m; m = m->next, i++)
|
||||
{
|
||||
GtkScaleMark *mark = m->data;
|
||||
|
||||
if (mark->position == pos)
|
||||
return marks[i];
|
||||
}
|
||||
|
||||
gtk_widget_get_content_size (widget, &width, &height);
|
||||
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
|
||||
return width;
|
||||
else
|
||||
return height;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
||||
const GtkAllocation *allocation,
|
||||
@ -515,20 +490,12 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
||||
GtkScalePrivate *priv = scale->priv;
|
||||
GtkOrientation orientation;
|
||||
int *marks;
|
||||
int min_pos_before, min_pos_after;
|
||||
int min_sep = 4;
|
||||
int i;
|
||||
int min_pos, max_pos;
|
||||
GSList *m;
|
||||
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (scale));
|
||||
_gtk_range_get_stop_positions (GTK_RANGE (scale), &marks);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
min_pos_before = min_pos_after = allocation->x;
|
||||
else
|
||||
min_pos_before = min_pos_after = allocation->y;
|
||||
|
||||
for (m = priv->marks, i = 0; m; m = m->next, i++)
|
||||
{
|
||||
GtkScaleMark *mark = m->data;
|
||||
@ -552,32 +519,7 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
||||
mark_alloc.width = mark_size;
|
||||
mark_alloc.height = allocation->height;
|
||||
|
||||
if (mark->position == GTK_POS_TOP)
|
||||
{
|
||||
min_pos = min_pos_before;
|
||||
max_pos = find_next_pos (GTK_WIDGET (scale),
|
||||
m, marks + i, GTK_POS_TOP) - min_sep + allocation->x;
|
||||
}
|
||||
else
|
||||
{
|
||||
min_pos = min_pos_after;
|
||||
max_pos = find_next_pos (GTK_WIDGET (scale),
|
||||
m, marks + i, GTK_POS_BOTTOM) - min_sep + allocation->x;
|
||||
}
|
||||
|
||||
mark_alloc.x -= mark_size / 2;
|
||||
|
||||
if (mark_alloc.x < min_pos)
|
||||
mark_alloc.x = min_pos;
|
||||
if (mark_alloc.x + mark_size > max_pos)
|
||||
mark_alloc.x = max_pos - mark_size;
|
||||
if (mark_alloc.x < 0)
|
||||
mark_alloc.x = 0;
|
||||
|
||||
if (mark->position == GTK_POS_TOP)
|
||||
min_pos_before = mark_alloc.x + mark_size + min_sep;
|
||||
else
|
||||
min_pos_after = mark_alloc.x + mark_size + min_sep;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -586,32 +528,7 @@ gtk_scale_allocate_marks (GtkGizmo *gizmo,
|
||||
mark_alloc.width = allocation->width;
|
||||
mark_alloc.height = mark_size;
|
||||
|
||||
if (mark->position == GTK_POS_TOP)
|
||||
{
|
||||
min_pos = min_pos_before;
|
||||
max_pos = find_next_pos (GTK_WIDGET (scale),
|
||||
m, marks + i, GTK_POS_TOP) - min_sep + allocation->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
min_pos = min_pos_after;
|
||||
max_pos = find_next_pos (GTK_WIDGET (scale),
|
||||
m, marks + i, GTK_POS_BOTTOM) - min_sep + allocation->y;
|
||||
}
|
||||
|
||||
mark_alloc.y -= mark_size / 2;
|
||||
|
||||
if (mark_alloc.y < min_pos)
|
||||
mark_alloc.y = min_pos;
|
||||
if (mark_alloc.y + mark_size > max_pos)
|
||||
mark_alloc.y = max_pos - mark_size;
|
||||
if (mark_alloc.y < 0)
|
||||
mark_alloc.y = 0;
|
||||
|
||||
if (mark->position == GTK_POS_TOP)
|
||||
min_pos_before = mark_alloc.y + mark_size + min_sep;
|
||||
else
|
||||
min_pos_after = mark_alloc.y + mark_size + min_sep;
|
||||
}
|
||||
|
||||
gtk_widget_size_allocate_with_baseline (mark->widget, &mark_alloc, baseline);
|
||||
@ -648,7 +565,7 @@ gtk_scale_size_allocate (GtkWidget *widget,
|
||||
&marks_height, NULL,
|
||||
NULL, NULL);
|
||||
marks_rect = range_rect;
|
||||
marks_rect.y -= marks_height;
|
||||
marks_rect.y = 0;
|
||||
marks_rect.height = marks_height;
|
||||
gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
|
||||
gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
|
||||
|
@ -2986,8 +2986,8 @@ scale {
|
||||
(top, left, right),
|
||||
(bottom, right, left) {
|
||||
&.#{$marks_class} {
|
||||
margin-#{$marks_margin}: $_marks_distance;
|
||||
margin-#{$marks_pos}: -($_marks_distance + $_marks_length);
|
||||
//margin-#{$marks_margin}: $_marks_distance;
|
||||
//margin-#{$marks_pos}: -($_marks_distance + $_marks_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3006,6 +3006,7 @@ scale {
|
||||
|
||||
&.horizontal {
|
||||
indicator {
|
||||
background-color: currentColor;
|
||||
min-height: $_marks_length;
|
||||
min-width: 1px;
|
||||
}
|
||||
@ -3015,6 +3016,7 @@ scale {
|
||||
|
||||
&.vertical {
|
||||
indicator {
|
||||
background-color: currentColor;
|
||||
min-height: 1px;
|
||||
min-width: $_marks_length;
|
||||
}
|
||||
@ -3309,7 +3311,6 @@ progressbar {
|
||||
trough.empty progress { all: unset; } // makes the progress indicator disappear, when the fraction is 0
|
||||
}
|
||||
|
||||
|
||||
/*************
|
||||
* Level Bar *
|
||||
*************/
|
||||
|
@ -1251,14 +1251,6 @@ scale value { color: alpha(currentColor,0.55); }
|
||||
|
||||
scale marks { color: alpha(currentColor,0.55); }
|
||||
|
||||
scale marks.top { margin-bottom: 6px; margin-top: -12px; }
|
||||
|
||||
scale marks.bottom { margin-top: 6px; margin-bottom: -12px; }
|
||||
|
||||
scale marks.top { margin-right: 6px; margin-left: -12px; }
|
||||
|
||||
scale marks.bottom { margin-left: 6px; margin-right: -12px; }
|
||||
|
||||
scale.fine-tune marks.top { margin-bottom: 6px; margin-top: -9px; }
|
||||
|
||||
scale.fine-tune marks.bottom { margin-top: 6px; margin-bottom: -9px; }
|
||||
@ -1267,11 +1259,11 @@ scale.fine-tune marks.top { margin-right: 6px; margin-left: -9px; }
|
||||
|
||||
scale.fine-tune marks.bottom { margin-left: 6px; margin-right: -9px; }
|
||||
|
||||
scale.horizontal indicator { min-height: 6px; min-width: 1px; }
|
||||
scale.horizontal indicator { background-color: currentColor; min-height: 6px; min-width: 1px; }
|
||||
|
||||
scale.horizontal.fine-tune indicator { min-height: 3px; }
|
||||
|
||||
scale.vertical indicator { min-height: 1px; min-width: 6px; }
|
||||
scale.vertical indicator { background-color: currentColor; min-height: 1px; min-width: 6px; }
|
||||
|
||||
scale.vertical.fine-tune indicator { min-width: 3px; }
|
||||
|
||||
|
@ -1271,14 +1271,6 @@ scale value { color: alpha(currentColor,0.55); }
|
||||
|
||||
scale marks { color: alpha(currentColor,0.55); }
|
||||
|
||||
scale marks.top { margin-bottom: 6px; margin-top: -12px; }
|
||||
|
||||
scale marks.bottom { margin-top: 6px; margin-bottom: -12px; }
|
||||
|
||||
scale marks.top { margin-right: 6px; margin-left: -12px; }
|
||||
|
||||
scale marks.bottom { margin-left: 6px; margin-right: -12px; }
|
||||
|
||||
scale.fine-tune marks.top { margin-bottom: 6px; margin-top: -9px; }
|
||||
|
||||
scale.fine-tune marks.bottom { margin-top: 6px; margin-bottom: -9px; }
|
||||
@ -1287,11 +1279,11 @@ scale.fine-tune marks.top { margin-right: 6px; margin-left: -9px; }
|
||||
|
||||
scale.fine-tune marks.bottom { margin-left: 6px; margin-right: -9px; }
|
||||
|
||||
scale.horizontal indicator { min-height: 6px; min-width: 1px; }
|
||||
scale.horizontal indicator { background-color: currentColor; min-height: 6px; min-width: 1px; }
|
||||
|
||||
scale.horizontal.fine-tune indicator { min-height: 3px; }
|
||||
|
||||
scale.vertical indicator { min-height: 1px; min-width: 6px; }
|
||||
scale.vertical indicator { background-color: currentColor; min-height: 1px; min-width: 6px; }
|
||||
|
||||
scale.vertical.fine-tune indicator { min-width: 3px; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user