Commit Graph

232 Commits

Author SHA1 Message Date
Timm Bäder
9f3f640c0d widget: Remove gtk_widget_get_border_allocation 2017-08-14 12:22:39 +02:00
Timm Bäder
5f859a1f24 widget: Remove gtk_widget_get_content_allocation
Replace it where we still need something similar, e.g. in
gtk_widget_translate_coordinates
2017-08-14 12:22:39 +02:00
Timm Bäder
30d6b08271 scale: Allocate the value next to the slider
... when vertical. Also fixes usage of the uninitialized value_alloc.y.
2017-08-01 11:36:03 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
995903e971 scale: Fix mark positions
Someone else will have to fix the css.
2017-07-19 21:27:15 -04:00
Timm Bäder
ed5b7fedb8 scale: Remove custom indicator drawing
it's a css node so we can simply use the background instead of the
foreground color in the theme.
2017-07-19 21:27:15 -04:00
Timm Bäder
5bb355f06f scale: Fix mark indicator allocations 2017-07-19 21:27:15 -04:00
Timm Bäder
3dc6d240b3 Fix a few allocation coordinates & sizes 2017-07-19 21:27:15 -04:00
Timm Bäder
1c5eec92fe range: Fix slider allocation 2017-07-19 21:27:14 -04:00
Timm Bäder
3babd184c0 scale: Fix css node ordering and expected results
Add :dir(ltr) where expected, i.e. everywhere we now have a widget but
had a gadget before.
Also, fix the expected output to expect mark subnodes in the order
specified in the GtkScale does, i.e.

├── mark
    ├── [label]
    ╰── indicator

for marks at the top of the scale and

├── mark
    ├── indicator
    ╰── [label]

For marks at the bottom of the scale.
2017-07-19 21:27:13 -04:00
Timm Bäder
5204fd5ea1 scale: Replace all gadgets with widgets 2017-07-19 21:27:13 -04:00
Timm Bäder
6e74975e41 range: make the slider a gadget 2017-07-19 21:27:12 -04:00
Timm Bäder
90cc401f1a range: Remove contents gadget
It's not needed anymore since the range only has one child gadget: the
trough.
2017-07-19 21:27:12 -04:00
Timm Bäder
1d782b8930 scale: Fix value position
by not using the range's gadget which is not allocated to any position
anymore.
2017-07-19 21:27:12 -04:00
Timm Bäder
c3ffad1fb3 gtkscale: Properly initialize the clip 2017-07-19 21:27:12 -04:00
Daniel Boles
e0a741c8ee Scale: Improve documentation of set_has_origin()
Properly format the property name, and avoid saying scale so many times.
2017-05-02 12:39:04 +01:00
Daniel Boles
4d88dc44b6 Scale: Explain how to round value when !draw-value
Scale:digits is (now, again) ineffective if Scale:draw-value is FALSE.
To get rounding in that case, the base Range:round-digits must be used.
2017-05-02 12:39:04 +01:00
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