Commit Graph

68 Commits

Author SHA1 Message Date
Niels De Graef 76e380244b libgimpwidgets: Use g_object_notify_by_pspec for ruler
`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, we should try to use
`g_object_notify_by_pspec()` instead.
2020-12-29 22:14:19 +01:00
Jacob Boerema b3f3120e32 libgimpwidgets, app: silence warnings about State 0 for GimpRuler and GtkScrolledWindow doesn't match state 128 set via gtk_style_context_set_state ()
When run with GIMP_DEBUG=Gtk we get a lot of debug warnings for GimpRuler and once in a while for GtkScrolledWindow that State 0
doesn't match state 128 set via gtk_style_context_set_state (). This happens because we didn't enter the current state flags of
the widget but 0 and apparently Gtk isn't happy about that.

Let's fix this by using the actual state flags by calling gtk_widget_get_state_flags.
2020-12-28 14:05:09 -05:00
Niels De Graef db0493aa0d gir: Add more (out) annotations
This will change the API for some bindings, so we probably want to do it
before a release.
2020-05-03 17:57:23 +02:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Jehan f7fbdc89b1 libgimpwidgets: add a bunch of (transfer) values. 2019-07-31 23:48:32 +02:00
Jehan e512f0f1b7 libgimpwidgets: fix "warning: excess elements in array initializer".
Just fixing stupid bugs in my previous commit. These are fixed array
sizes.
2019-06-23 19:07:32 +02:00
Jehan 2b22dffc49 Issue #230: ruler subdivision is wrong for inches.
Make better subvision, as well as ruler steps, based on what seems to be
the common trends for rulers of these 3 units (inch, foot and yard), but
also based on common conversion needs.

Main changes are:
- Always subdivide inches by 2, down to 1/256, and get rid of the gap
  where inches division jumped from 1/16 to 1/192 (which is not even a
  multiple of 2).
- Add the 72 steps to inch ruler (1 fathom).
- Replace the 2 feet by a 3 feet (1 yard) step.
- Use base-10 steps for yard (there don't seem to be bigger units in the
  imperial/US measurement system which needs specific steps).
- Add the 1/36 yard (= 1 inch) division.
- Below 1/12 feet and 1/36 yard, divide by multiples of 2 (inch-style).
2019-06-23 16:40:34 +02:00
Jehan 57b2ba9c48 libgimpwidgets: enable inch/feet/yard binary subdivisions.
It looks like it's not perfect yet. Nevertheless if we leave it disabled
forever, it won't ever get better! For now at least enabled on master
only.
2019-06-23 15:11:34 +02:00
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Michael Natterer 4f0a87ffa6 app, libgimpwidgets, themes: fix some themeing
Add CSS names using gtk_widget_class_set_css_name(), remove styling in
code and instead do it properly in CSS, so far in the System theme.
All horribly incomplete but a start.
2018-05-20 21:06:30 +02:00
Michael Henning 2ef224237e libgimpwidgets: Separate ruler text layer from background.
Also fix failing to clear backing_store at the same time.
2018-05-20 21:06:29 +02:00
Michael Henning 69497c84a6 libgimpwidgets: Draw marker in correct position on ruler.
With gtk+3, the cairo context is offset by allocation.x/y for us,
so we no longer need to add that factor in while drawing.
2018-05-20 21:06:29 +02:00
Michael Natterer f689ef7b16 libgimpwidgets: implement GtkWidget::style_updated() instead of style_set() 2018-05-20 21:06:28 +02:00
Michael Natterer 052ab454ae libgimpwidgets: port GimpRuler to GtkStyleContext 2018-05-20 21:06:27 +02:00
Michael Natterer 694e5ac9f6 libgimpwidgets: port to the new size request API 2018-05-20 21:06:27 +02:00
Michael Natterer 60036c9385 libgimpwidgets: port the ruler to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Lionel N 827d747fae Bug 400448 - ruler subdivision is wrong for inches
Add ruler subdivisions for feet and yards, the code is still disabled.
2018-02-27 23:27:00 +01:00
Michael Natterer e93f458026 libgimpwidgets: change disabled code in GimpRuler to avoid a warning 2018-02-22 09:48:03 +01:00
Michael Natterer fd37737fe4 Bug 400448 - ruler subdivision is wrong for inches
This commit changes nothing, but contains disabled proof-of-concept
code to use different ruler subdivisions depending on the ruler's
unit.
2018-02-12 12:20:32 +01:00
Michael Natterer 582c6edd54 libgimp*: use some g_clear_object() and g_clear_pointer() 2017-09-03 15:14:51 +02:00
Michael Natterer f9ee38ea33 libgimp: add blurbs to all object properties for the docs
and some minor doc fixes.
2017-06-06 21:19:17 +02:00
Ell 2cb26a040a libgimpwidgets: invalidate the rulers' backdrop when the widget style is changed
... in particular, when swithcing themes.

Otherwise, the rulers keep their old, mismatched, style, until the
ticks are updated.
2017-02-27 05:03:59 -05:00
Michael Natterer e909b77969 Bug 771851 - Vertical ruler shows artifacts if the status bar isn't showing
gimp_ruler_draw_pos(): when remembering the just drawn rectangle's
position, don't just unconditionally overwrite the previous position's
rectangle. Instead, if the previous position's rectangle has not been
cleared yet (has a non-zero size), remember the union of old and new
rectangle.

Why this only happened to the vertical ruler with statusbar off is
beyond my mind, it should have always produced artifacts.

Unrelated: make sure the idle function is removed if we decide to
immediately redraw in gimp_ruler_set_position().
2016-09-22 23:10:10 +02:00
Timm Bäder 53f34ebc0b Chain up in some size-allocate implementations
The default implementation does just the right thing for most widgets.
2016-09-09 21:31:09 +02:00
Michael Natterer 64a93c6051 libgimpwidgets: merge a small GimpRuler optimization from gtk3-port
In size_allocate(), call gimp_ruler_make_pixmap() only if the widget
was resized, not only moved around.
2016-09-09 10:02:53 +02:00
Michael Natterer f2d581a536 Bug 761170 - Warnings building with clang
Fix a bunch of clang warnings.
2016-02-12 22:49:47 +01:00
Michael Natterer f6df750714 libgimpwidgets: minor formatting changes in gimpruler.c
to make rebasing this file in gtk3-port a little less painful.
2015-09-27 13:45:13 +02:00
Michael Henning 8c02b360fb libgimpwidgets: Disconnect ruler's idle handler in dispose
As discussed on irc, this is more appropriate than finalize because
we shouldn't be making any gtk calls after dispose.
2015-09-06 17:41:09 -04:00
Michael Henning 3233a70bae libgimpwidgets: Avoid updating the rulers too often.
Ever since 72617e42b, whenever the user generated a lot of mouse
input, we would constantly queue redraws to the rulers. These redraws
had a higher idle priority than updating the canvas, so we would
rarely get around to canvas updates, which made certain tools
(painting with dynamics, the blend tool) feel very unresponsive.

This fixes it by only redrawing the rulers if the mouse has moved
far from the last location, or if there are no idle handlers with
a priority above LOW.
2015-09-06 17:18:12 -04:00
Michael Henning 72617e42b4 Bug 736411 - Ruler updates cause slowdown when painting
We now avoid drawing rulers in the position property setter and use
gtk's region invalidation instead. Previously, we were basically
redrawing the ruler inside the mouse event handler, which is pure evil.
2015-08-13 11:41:18 -04:00
Michael Natterer affef350e7 libgimpwidgets: fix registration of GimpRuler's "unit" property
Install it with the PROP_UNIT id not PROP_LOWER (probably a copy &
paste mess). Spotted by John Cuppit.
2015-06-14 22:57:46 +02:00
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Massimo Valentini 20863440fb Bug 736411 - Ruler updates cause slowdown when painting
Reuse the cairo_t from expose() in gimp_ruler_draw_pos() instead of
creating a new one.
2015-01-10 23:37:31 +01:00
Massimo Valentini 67525c0d47 Bug 688305: drag and drop for guides broken 2012-11-15 19:02:42 +01:00
Michael Natterer 59ea89234f app: GimpRuler: clip position marker drawing to the ruler's allocation
so we don't overdraw when drawing out of expose.
2011-04-20 00:31:59 +02:00
Michael Natterer c215677876 libgimpwidgets: turn GimpRuler into a no-window widget
and use an input-only window for events.
2011-04-10 02:00:40 +02:00
Mikael Magnusson 3eb096b239 Revert "libgimpwidgets: avoid using a function only available since GTK+ 2.22"
We depend on GTK+ 2.24 now.

This reverts commit 0e55c5e4d8.
2011-04-06 20:19:09 +02:00
Michael Natterer 24ee3370b8 Depend on GTK+ >= 2.24.3, cairo >= 1.20.1, gdk-pixbuf >= 2.22.1
and completely separate configure and sanity checks for gdk-pixbuf
from GTK+, because it's now distributed as a separate package. Remove
all sorts of conditional compiling based on GDK_CHECK_VERSION() and
CAIRO_VERSION.
2011-04-06 19:58:24 +02:00
Michael Natterer 4fd56d9640 libgimpwidgets: don't pass around uninitialized memory in GimpRuler 2011-02-06 11:20:07 +01:00
Michael Natterer 3ef31e4cc8 libgimpwidgets: use new GdkWindow API only when available 2011-01-23 00:30:58 +01:00
Michael Natterer d155be622d libgimpwidgets: fix ruler motion event tracking on offscreen overlays
Add a list of "track widgets" to GimpRuler and connect to their
motion-notify-event. Correctly translate the motion event's x/y to the
ruler's coordinate system when updating the marker.
2011-01-20 20:26:35 +01:00
Mikael Magnusson 0e55c5e4d8 libgimpwidgets: avoid using a function only available since GTK+ 2.22 2010-12-18 00:31:56 +01:00
Mikael Magnusson 2471f37660 libgimpwidgets: port the ruler from deprecated gdk to cairo
Backported from the gtk3-port branch.
2010-12-17 22:59:49 +01:00
Michael Natterer 1f7ff98c45 libgimpwidgets: move docs from template files to inline comments
but leave the template file for gimpstock there because its contents
would be too much for gimpstock.h.
2010-07-05 18:01:28 +02:00
Michael Natterer a2c70822d4 Use accessors from GTK+ 2.20 instead of using sealed members directly 2010-04-19 19:21:07 +02:00
Michael Natterer 1aeb315ecf undef GTK_DISABLE_DEPRECATED in many places which undef GSEAL_ENABLE
because the widget flag access macros (e.g. GTK_WIDGET_REALIZED) are
now deprecated in GTK+ master.
2010-03-06 23:14:29 +01:00
Sven Neumann 42e31b1cc8 libgimpwidgets: clean up comment
Rephrase a comment so that it does not cause a false positive when
looking for deprecated GDK symbols.
2009-11-09 19:07:54 +01:00
Michael Natterer fcd346a227 Build with GSEAL_ENABLE with a few exceptions
Use the new accessors in GTK+ 2.18 and #undef GSEAL_ENABLE where
accessors are missing or where I'm not quite sure how to fix the
stuff yet.
2009-10-17 18:51:48 +02:00