Commit Graph

215 Commits

Author SHA1 Message Date
Daniel Boles
8308ce1e61 Scale: Fix documentation of digits per last revert
Revert doc changes that were for the behavioural change just reverted.

Add a clarifying note that, under the original behaviour, :digits only
rounds the Adjustment if :draw-value is TRUE at the time of the change.

https://bugzilla.gnome.org/show_bug.cgi?id=781605
https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-04-26 12:32:07 +01:00
Matthias Clasen
197355e15a Revert "Scale: Always sync ::digits to Range::round-digits"
This reverts commit 4a6bd134bd.

This change in behavior broke various things.

https://bugzilla.gnome.org/show_bug.cgi?id=781605
2017-04-26 07:30:19 -04:00
Daniel Boles
830eb623e7 Scale: Fix erroneously removed : in a signal doc 2017-02-22 08:54:27 +00:00
Daniel Boles
3e28b1fc64 Scale: Fix signal documentation syntax
Oops, sorry. Thanks to Cristoph Reiter for correcting me on this.
2017-02-19 10:14:01 +00:00
Daniel Boles
5c9a100fe8 Scale: Improve docs of format-value property 2017-02-19 09:12:38 +00:00
Daniel Boles
ebca0c6ebf Scale: Improve docs of prop digits in other places
There were places still implying that it was only used for display.
2017-02-19 08:39:31 +00:00
Daniel Boles
97fe47bbd9 Scale: consistent #Class:signal-or-property syntax
Use : everywhere, not a mixture of : and ::
2017-02-19 08:39:30 +00:00
Daniel Boles
494a38504b scale: Really fix documentation of set_digits()
This previously only mentioned its effect on the displayed value, and
even after the previous commit, its rounding of the actual value upon
change still reads like too much of an afterthought. Worse, it wasn’t
mentioned at all in the doc for the @digits parameter. Change this to
emphasise rounding always occurs and the displayed value is secondary.
2017-01-19 00:45:32 +00:00
Daniel Boles
0776bd438b scale: doc: set_digits doesn’t round retroactively
Whether it should is an open question, but for now, the documentation
should clearly indicate that currently rounding is only applied upon
changes to the value, not to the existing value when ::digits changes.
This is already clear in the doc for the underlying Range::round-digits.

https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-01-19 00:17:56 +00:00
Daniel Boles
d9dd312752 Scale: Always sync ::digits to Range::round-digits
The documents state that gtk_scale_set_digits() “causes the value of the
adjustment to be rounded off to this number of digits, so the retrieved
value matches the value the user saw.” Note the lack of any condition.

But in fact, if draw-value was false, rounding was disabled on the base
Range, so values that weren’t displayed weren’t rounded. This made the
docs wrong and made an apparently cosmetic detail alter functionality.

Fix by ensuring the number of digits set on Scale is always propagated
along to gtk_range_set_round_digits(), thus rounding to it in all cases
when the value changes, regardless of whether the value is displayed.

This doesn’t address the other idea from Bugzilla: that changing the
number of digits should clamp the _existing_ value if it’s more precise.
This contradicts digits docs in the base Range, but the above from Scale
can be read as implying it’ll happen. For now, that’s an open question.

https://bugzilla.gnome.org/show_bug.cgi?id=358970
2017-01-19 00:17:56 +00:00
Benjamin Otte
6055028c96 snapshot: Rename append APIs
Instead of having gtk_snapshot_append_foo_node(), just have
gtk_snapshot_append_foo(). Nobody needs to know that this internally
uses nodes.
2017-01-13 04:46:09 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
81297857cc snapshot: Convert Range, Scale, ColorScale
And of course Scrollbar, but that one does no drawing itself.
2016-12-20 18:01:11 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
999d45b4e8 Remove various unused style properties 2016-10-16 18:17:21 +02:00
Timm Bäder
efffa3b6bd range: Remove min slider size setter/getter 2016-10-16 18:17:21 +02:00
Matthias Clasen
07e9b399d5 scale: Document interaction between rounding and autoscrolling
This is a bit of a gotcha, so better document it.
2016-08-24 12:58:54 -04:00
Ignacio Casal Quinteiro
b0f793c8e7 Use g_snprintf instead of snprintf.
snprintf is not compatible with msvc.
2016-08-10 12:45:39 +02:00
Chun-wei Fan
cd44f6d875 Fix build of commit f23e99b
Commit f23e99b made use of snprintf(), which is not universally available.
Fix this by using g_snprintf().
2016-06-27 11:53:30 +08:00
Matthias Clasen
f23e99b063 scale, spinbutton: Avoid -0.0
This is a very longstanding bug; time to finally put it to rest.

https://bugzilla.gnome.org/show_bug.cgi?id=118959
2016-06-07 23:04:40 -04:00
Matthias Clasen
7f06f2818a Ensure that GtkRange allocates enough space for the value
This is a long-standing problem of GtkScale.

https://bugzilla.gnome.org/show_bug.cgi?id=766372
https://bugzilla.gnome.org/show_bug.cgi?id=578626
https://bugzilla.gnome.org/show_bug.cgi?id=79229
2016-06-07 21:28:44 -04:00
Matthias Clasen
3f3c1768c9 scale: Also queue a resize if font changes
As Benjamin pointed out, what AFFECTS_FONT can also affect size,
but the implication is not automatic, so queue a resize manually.
2016-06-03 10:49:29 -04:00
Matthias Clasen
fd9f7babf6 scale: Apply css style to text
Use the new functions we have to apply CSS styles to the
value and marks text from their respective subnodes.
2016-06-03 00:30:59 -04:00
Matthias Clasen
4151cb1202 scale: Use more succinct names for style classes
Use .marks-before/after to indicate the presence of marks.
As Lapo points out, compatibility with the previous names
is not really that important, since everything else changed
around it.

https://bugzilla.gnome.org/show_bug.cgi?id=766440
2016-05-19 09:44:48 -04:00
Matthias Clasen
fa9f22eec4 scale: Bring back marks-related style classes
It turns out that it is too hard (and in some cases, impossible)
to get this information from node positioning, so bring back the
.scale-has-marks-above/below style classes on the main node.

This should allow us to fix the 'pointy sliders'.

https://bugzilla.gnome.org/show_bug.cgi?id=766440
2016-05-18 12:59:39 -04:00
Matthias Clasen
38f71172f8 scale: Avoid a crash
gtk_scale_get_layout was not careful enough, leading to a crash
when opening the inspector on a scale.
2016-05-15 14:18:09 -04:00
Timm Bäder
327777a291 Scale: Set the correct value alignment
We're measuring both the width of the minimal and the maximal value for
the value gadget, but only give the value the minimal width for its
current value, resultnig in an always left-aligned value.

Fix this by assigning the width of the value gadget to the value layout
and letting pango align the text inside the layout.

https://bugzilla.gnome.org/show_bug.cgi?id=766120
2016-05-10 21:24:50 +02:00
Timm Bäder
20592a7935 scale: Remove double nullable annotation
Being both (allow-none) and (nullable) at the same time is a bit much.
Was from 591e7f5ef8.
2016-05-10 12:53:42 +02:00
Matthias Clasen
27210f523b scale: Fix mark positioning at the left/top edge
We were failing to take the widget allocation.x/y into account
when deciding whether we need to push in the mark.

https://bugzilla.gnome.org/show_bug.cgi?id=765922
2016-05-05 15:17:56 -04:00
Cosimo Cecchi
26f9dc6508 scale: fix marks node position for scales with value
We should only count the value node as the first/last one if its
position matches.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi
6efc06ef5c scale: remove impossible case
We only create the gadget when the markup is not empty, so we don't
need to check again here.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi
b989910293 scale: cache pango layouts for mark labels
Constantly creating pango layouts while drawing means that animations
will be slow. Instead, cache the pango layout in the mark structure.
2016-03-26 22:43:53 -07:00
Timm Bäder
985121813e scale: Fix value height calculation
if (orientation) doesn't make a lot of sense but C doesn't complain and
instead evaluates orientation to TRUE for GTK_ORIENTATION_VERTICAL
(since that's 1), thus inverting the value sizes.
2016-03-16 10:20:17 +01:00
Cosimo Cecchi
d9db329496 scale: trivial code cleanup 2016-03-06 11:10:44 -08:00
Cosimo Cecchi
f294bdc803 scale: deprecate value-spacing style property
Nothing uses it now.
2016-03-06 11:10:44 -08:00
Cosimo Cecchi
a9b50b6f69 scale: port scale values to gadgets
And add a default color like it was before.
This also fixes other issues with scale values interacting with scale
mark labels, which were buggy at least since 3.18.
2016-03-06 11:09:46 -08:00
Cosimo Cecchi
b1144a73de scale: don't add scale label for empty markup
This is a regression from the gadget port.
2016-03-02 11:17:08 -08:00
Matthias Clasen
577783a19d scale: Don't leave css nodes behind
We create and destroy gadgets inside the scale hierarchy here,
and if we don't explicitly remove their CSS nodes from the parent,
they stick around.
2016-03-01 15:58:21 -05:00
Cosimo Cecchi
5a83787dc0 Update CSS nodes documentation 2016-02-29 10:45:14 -08:00
Cosimo Cecchi
bb55a1a958 scale: add gadgets for indicator/label in scale marks
This will allow us to theme them indepdendently, and specify a size for
the indicator from the theme.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
7bd3d87eeb scale: add a gadget for every mark
We want to add another gadget for the mark indicator. This will allow us
to do so.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
cdd7a7bdcd scale: implement rendering for marks gadgets
This completes the conversion of scale marks to gadgets.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
1a8eb9fefa scale: implement size allocate for mark gadgets
This allows to move the mark sections around with e.g. margins.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
562a501f3b scale: port marks size request to gadgets 2016-02-29 10:45:14 -08:00
Cosimo Cecchi
2f420d0e14 scale: use gadgets instead of nodes for mark containers
The gadget is not yet allocated though.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
b73d274d55 scale: rename function arguments
To make them clearer. No functional change here.
2016-02-29 10:45:14 -08:00
Cosimo Cecchi
8d5d16ae56 scale: remove unused argument
It's always GTK_POS_TOP.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
424f17c0fb range: don't use gtk_range_set_min_slider_size()
The way this method is used from the GtkRange subclasses doesn't really
work well when the slider properties change as a consequence of e.g. a
style class being applied (e.g. the fine-tune style class).

In fact, there's no need to read the minimum slider size out of band,
and we can obtain the same result in a way that always work by setting a
private property on GtkRange.
2016-02-29 10:45:13 -08:00
Cosimo Cecchi
a9ea544f3d scale: always add marks at the beginning or the end
Marks are always either the first or the last child of the scale.
2016-02-29 10:45:13 -08:00