Commit Graph

272 Commits

Author SHA1 Message Date
Matthias Clasen
7c5e1c6195 gtk: Rename some private headers
Improve the consistency of our private header
naming, by add 'private' to a bunch of them.
2022-10-05 23:01:28 -04:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Elliott Sales de Andrade
4cbfb69f74 Document irreversibility of gtk_text_buffer_set_text
If you've begun a user action and call `gtk_text_buffer_set_text`, you
get an unexpected warning:
```
Gtk-WARNING **: Cannot begin irreversible action while in user action
```
which can be fixed by doing the delete/insert yourself. But this is not
documented as occurring, so document it.
2022-09-04 02:47:57 -04:00
Emmanuele Bassi
d030c92d63 Move private function out of the AT-SPI a11y backend
The textbuffer test is calling into a function defined by the AT-SPI
accessibility backend. As of commit 4ddf1b70 we only build and run the
test on Linux, but the function in question isn't really
accessibility-related: it's just a serialization function.
2022-08-04 23:34:41 +01:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Matthias Clasen
3e7618fef7 textbuffer: Try harder to fix pasting
It turns out we can't just use the size returned
by the memory stream as-is, since it may contain
unfilled garbage at the end, which utf8 validation
will choke on. So, cut it off at the first '\0'
we find.
2021-11-30 21:42:19 -05:00
Matthias Clasen
5b1b75b055 textbuffer: Fix pasting text
The memory stolen from a memory outputstream
isn't guaranteed to be 0-terminated, so don't
make that assumption.

Fixes: #4357
2021-11-30 20:37:25 -05:00
Matthias Clasen
ad3dad1965 Initial support for new Pango attributes
This is still missing the GtkTextTag hookup,
but it fixes the build.
2021-09-01 10:32:45 -04:00
Matthias Clasen
b9cad7cc54 textview: Implement new pango attributes
Implement the word and sentence attributes.
2021-08-25 14:57:13 -04:00
Matthias Clasen
417b3f9c6b Implement text transforms for GtkTextView
Add a property to GtkTextTag and do all the
legwork to translate it to the Pango attribute.
2021-08-22 15:57:50 -04:00
Matthias Clasen
ba95ef63da Drop PANGO_VERSION_CHECK checks
We require Pango 1.49 now.
2021-08-22 15:26:23 -04:00
Matthias Clasen
2cc06f60c5 textview: Set line height from markup
Note that we ignore the absolute-line-height
attribute for now.
2021-08-22 15:15:50 -04:00
Matthias Clasen
5feba67a3d Handle new pango attribute type
Update all the places where we switch over
PangoAttrType to handle PANGO_ATTR_TEXT_TRANSFORM,
and do nothing for now - text-transform support
will land in 4.6.
2021-08-22 11:04:28 -04:00
Matthias Clasen
528ebfabf0 Handle the new line height pango attribute
Update all the places where we switch over PangoAttributeType
to handle (and ignore, for now) the new line height attribute.
2021-08-10 08:22:52 -04:00
Bilal Elmoussaoui
8ebdd256a5 docs: fix broken links 2021-05-27 00:18:23 +00:00
Matthias Clasen
ffbfafb189 textbuffer: Add some docs for undo
Mention what is undoable and what isn't.
2021-05-26 14:36:16 -04:00
Matthias Clasen
994a38c7ad textbuffer: Improve the docs
Add getter/setter annotations.
2021-05-26 14:36:16 -04:00
Christian Hergert
6179886b14 textbuffer: ensure user actions are propagated to history
This was an oversight when porting the GtkTextHistory into GTK. We simply
need to bind the GtkTextBuffer action into the text history for grouping
to work correctly.

Fixes #3977
2021-05-26 10:11:33 -07:00
Matthias Clasen
f5f8f83e3e textbuffer: Cosmetic docs changes 2021-05-22 17:25:27 -04:00
Matthias Clasen
91f7b9663f gtk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Avinash Sonawane
622bb9186e docs: Cover corner-case of @line_number = total lines in buffer 2021-03-30 17:00:33 +05:30
Matthias Clasen
720f6e7a17 textbuffer: Convert docs 2021-03-11 16:37:36 +00:00
Emmanuele Bassi
e8b6e6cad0 docs: Clean up the first paragraph for various symbols
The documentation engine will use the first paragraph as the summary for
a type or constant.
2021-03-11 16:37:30 +00:00
Benjamin Otte
77f9efa747 textbuffer: Remove unused properties
The getters and setters were removed in
f53848c360 but the pspecs were forgotten.
2020-11-17 19:04:39 +01:00
Benjamin Otte
0fdb33e82a textbuffer: Don't serialize the \0 byte
... when converting to text/plain.
2020-10-07 22:14:18 +02:00
Matthias Clasen
ac79c0e799 textbuffer: Improve some get_iter apis
Make these functions return FALSE if they did not
return the exact position that was requested.

Adapt tests.

Based on a patch by Sebastien Wilmet

Fixes: #506
2020-10-03 14:29:07 -04:00
Matthias Clasen
a799c86edb textbuffer: Elaborate docs
Explain a bit more what gtk_text_buffer_get_content_provider()
is for.

Fixes: #3202
2020-09-28 20:51:13 -04:00
Timm Bäder
12cc178756 textbuffer: Don't try to inset NULL text from clipboard
That used to generate a critical error message.

Also free() the data.
2020-09-24 19:08:22 +02:00
Matthias Clasen
6b708e9b60 textbuffer: Redo insert markup a little bit
Redo the tag insertion function to avoid quadratic
behavior, and at the same time, fix handling of
alpha for color attributes.

Update the copy of this function in gtk4-demo
as well.
2020-09-19 14:17:28 -04:00
Matthias Clasen
ea887959bd textbuffer: Some more insert_with_attributes speedup
There is no need for use to collect tags in an array;
we can just insert them into the text buffer right away.
2020-08-13 12:36:39 -04:00
Matthias Clasen
88dcd2597a Speed up gtk_text_buffer_insert_markup
Instead of blindly creating new tags for every attribute,
reuse existing tags. For the syntax highlighting of the
ui file of the cursors demo, this gets us down from
20.000 tags to 6.
2020-08-12 22:51:59 -04:00
Matthias Clasen
5673310364 textbuffer: Fix a leak
gtk_text_buffer_insert_markup was leaking all the tags
that it inserts.
2020-08-07 15:26:11 -04:00
Matthias Clasen
4340f75304 textbuffer: Fix a test failure
The previous change to gtktextbuffer.c was breaking
the textiter testcase.
2020-08-02 17:23:26 -04:00
Matthias Clasen
0add626822 textbuffer: Be careful with tags when copying
We can only insert tags in the buffer if they come
from the same GtkTextTagTable as the buffer uses.
If that is not the case, paste the text without tags.

Fixes: #2991
2020-08-02 13:54:06 -04:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
b251893030 Drop pango version checks
We are requiring pango 1.45.0 now, so no need to
Keep these ifdefs in the code any longer.
2020-06-06 21:32:55 -04:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Matthias Clasen
b4c79bad34 Assorted documentation fixes 2020-04-20 00:38:58 -04:00
Matthias Clasen
9259efb5d7 Make overline support conditional
The ci image does not have Pango 1.45, so for the
time being, make the overline support conditional
on Pango being new enough.
2020-03-21 01:18:54 -04:00
Matthias Clasen
795ef5b4e3 textbuffer: Parse overline and hyphenation attributes
When inserting Pango markup into a text buffer, translate
Pango attributes for overlines and hyphenation control
into the corresponding text tag properties.
2020-03-20 23:58:23 -04:00
Emmanuele Bassi
35ac7de140 Match argument name between declaration and definition
Otherwise the documentation and the introspection data will complain.
2020-02-13 14:53:25 +00:00
Alexander Larsson
8282698201 textview: Use paintables instead of textures, and fix the support
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
2020-02-06 17:47:56 +01:00
Robert Ancell
b2ca947934 textbuffer: Add missing public API documentation.
This API was added in a52757874e.
2020-01-13 12:19:43 +13:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
a52757874e textbuffer: Add a content provider api
We need a content provider for the selection,
to implement DND, and the text buffer already
has one. Just add an api to get it.
2020-01-08 18:48:19 -05:00
Matthias Clasen
d6dc5da6db textbuffer: Minor doc fixes
Fix parameter name mismatches.
2019-12-12 17:31:13 -05:00