Commit Graph

41 Commits

Author SHA1 Message Date
Michael Natterer 2c417801fc app: fix error message in gimp_text_buffer_save() 2018-03-23 14:47:14 +01:00
Michael Natterer 822a7228c4 Bug 794221 - Recently used colors on text don't get added to the color history
Add signal GimpTextBuffer::color-applied which is emitted when text is
inserted or when color is applied to a span of text.

In GimpTextTool, connect to the signal and update the global color
history.

Unrelated: rename gimp_text_tag_get_color() to get_fg_color() and add
boolean return values to get_fg_color() and get_fg_color() which
indicates if a color is set on the tag at all. This ended up unneeded
in the fix but is an improvement regardless.
2018-03-23 14:19:01 +01:00
Massimo Valentini aa8d29deac Bug 767476: Previously bolded font un-bolds on edit, cannot be undone 2016-06-24 12:39:01 +02:00
Jehan cd641fa14f app: create separate tag lists for IME preedit colors.
In particular, I don't want the preedit foreground colors to be
displayed in the text style editor UI. They are only temporary hints
and should not be taken into account as user-chosen style.
2016-06-01 17:44:03 +02:00
Jehan a86b0cf0a2 app: create a different tag for underlined text during preedit.
It still shows up as underlined during preedit, but does not toggle the
underline button in the style editor.
2016-06-01 17:43:56 +02:00
Jehan f1dbd57d49 app: GimpText can be set background colors.
There is nothing in our UI to set background color to text, but this
can be used internally, for instance to display input method's preedit
texts with specific colors.
2016-06-01 17:43:25 +02:00
Massimo Valentini 09c5fcc32b Bug 742775: Crash when editing text with certain fonts 2015-02-03 18:33:12 +01:00
Michael Natterer 849481a861 Clean up code around calls to g_file_replace()
- use G_FILE_CREATE_NONE instead of 0
- don't put "Could not open <file> for writing: <error>" around the
  returned error, the returned message is already verbose
2014-10-04 02:44:54 +02:00
Michael Natterer 14978bfe5d Simplify calls to g_output_stream_write_all()
It returns TRUE only if all bytes were written, so there is no need to
get and check the bytes_written return value.
2014-09-07 20:30:14 +02:00
Michael Natterer dae366bb6e configure.ac, *: require GLib 2.40.0
Remove gimp_output_stream_[v]printf() and use the new functions from
GLib instead. Use memmove() instead of the deprecated g_memmove().
2014-08-12 15:30:19 +02:00
Michael Natterer 0753b5a137 app: port gimp_text_buffer_load() and _save() to GIO 2014-07-03 12:57:18 +02:00
Michael Natterer 9f0e27307e app: change filename in gimp_text_buffer_load() and _save() to GFile 2014-07-02 15:10:53 +02:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01:00
Michael Natterer abd2e78bdf Bug 683011 - Text tool discards text attributes in the on-canvas dialog...
When font, size or color were changed, set the text buffer's current
insert_tags just as we already do for the bold, italic etc. toggle
buttons.  Changed gimp_text_style_editor_list_tags() to also return
the tags for font, size or color.
2012-11-09 23:06:45 +01:00
Massimo Valentini b994280473 Bug 668814: Cannot move cursor right in on canvas editor
One possible way to decrease the incompatibilities
between letter spacing in a tagged gtk_text_buffer
and in an equivalent pango_layout

Remove also a valgrind reported invalid write in
gimptextbuffer.c
2012-02-09 12:36:43 +01:00
Michael Natterer 202124c438 app: implement GObject::constructed() instead of ::constructor() 2011-01-14 09:38:46 +01:00
Michael Natterer 7dbaf348c5 app: fix gimp_text_buffer_get_color_tag()
Change the generated tag names to use #rrggbb notation and compare the
colors on an 8 bit basis to make sure the comparison and the tag names
exist in the same set of values (otherwise the text buffer gets into
an inconsistent state that can even lead to crashes).
2010-10-02 19:53:39 +02:00
Michael Natterer ad819263af Bug 620674 - Adding support for multi-colored text layer
Apply slightly modified patch from Barak Itkin that adds colors for
text spans plus GUI to edit these colors.
2010-09-02 00:20:04 +02:00
Michael Natterer a6b2d102f3 app: add utility functions for getting GtkTextTag properties
and also #define the names of the properties we (ab)use, so we don't
have to use magic strings all over the place, and we don't have to use
g_object_get() either.
2010-04-03 18:04:50 +02:00
Michael Natterer 91cce1c81b app: add size control for text spans, does not work as expected yet 2010-03-28 21:38:31 +02:00
Michael Natterer f766215548 app: add baseline and kerning controls to the style editor overlay
Involves adding GimpTextBuffer API to *set* baseline and kerning (as
opposed to changing it relatively from what it was).
2010-03-04 14:33:19 +01:00
Michael Natterer 9431376f55 app: cosmetic cleanup for readability 2010-03-03 10:53:01 +01:00
Michael Natterer bbd2d521f1 app: rename "spacing" to "kerning" because that's what it does 2010-03-03 10:48:42 +01:00
Michael Natterer 9a9d7489d1 app: make undo compression in the text tool work again
- in GimpText, make "text" and "markup" mutually exclusive, so that
  whenever one is set to non-NULL, the other is cleared automatically.
- add gimp_text_buffer_has_markup() which returns TRUE if any char
  in the buffer is tagged.
- in the text tool, only set "markup" on the text proxy if there is
  actually markup in the buffer, and set "text" otherwise.

This way we don't push "text" *and* "markup" undos on each keystroke,
and undo compression works the way it did before.
2010-03-02 21:54:24 +01:00
Michael Natterer 1ddef5d375 app: redo the buffer's tag-at-iter APIs and fix editor state update 2010-03-02 11:37:57 +01:00
Michael Natterer bea0c7f3d4 app: allow to select fonts on text spans
A bit hackish, will cleanup...
2010-03-02 11:11:06 +01:00
Michael Natterer b19db0dea9 app: don't remove all tags when toggling style buttons and then inserting
Instead, keep a list of tags to explicitely remove around (the list of
unchecked toggles), and remove only these tags, so the tags that have
no widget in the UI are not affected by the insert_tags logic.
2010-03-01 22:39:42 +01:00
Michael Natterer b61dfff04c app: use U+2060 WORD JOINER for manual kerning
What we used before might interact badly with arabic shaping.
2010-03-01 22:12:57 +01:00
Michael Natterer f7382bc33f app: argh, #define ENABLE_SPACING to actually enable spacing... 2010-03-01 19:57:28 +01:00
Michael Natterer f8ac0c61ab app: make manual kerning / character spacing work
Add gimp_text_buffer_get_iter_at_index() which does the reverse thing
than the already existing function gimp_text_buffer_get_iter_index().
Use the new function when cursor-navigation lines. Add "gboolean
layout_index" to both functions, which if TRUE indicates that the
passed in/out index is an index into the PangoLayout's content rather
than the text buffer's. When dealing with layout indices, take into
account the additional characters we insert into the serialized markup
(and thus the layout) for each character that is tagged with spacing.
2010-03-01 16:27:34 +01:00
Michael Natterer 67ccf8c21a app: implement proper manual kerning, but disable it for now
because it breaks the invariant that the pango layout used for
navigating in the on-canvas editor must be a 1:1 view on the text
buffer used for editing. Will have to fix that somehow...
2010-02-28 20:02:30 +01:00
Michael Natterer f135ebb97f app: use a temporary GtkTextBuffer for (de)seriaizing markup
The copy doesn't do anything yet, but this will enable us to do
transformations on the buffer contents before turning them into
markup, and the other way around.
2010-02-28 19:04:00 +01:00
Michael Natterer 783e04013a app: make letter spacing work when there is no selection 2010-02-28 17:56:20 +01:00
Michael Natterer 65216b939d app: group text buffer changes by user actions
Use gtk_text_buffer_begin_user_action() and end_user_action() to group
all text buffer operations triggered by a single editing operation.
Connect to the buffer's "end-user-action" signal instead of to
"changed", "apply-tag" and "remove-tag" separately, so we only update
the text proxy once per user editing.
2010-02-28 17:15:06 +01:00
Michael Natterer d074653c36 app: add letter spacing control using Alt+Left/Right
This is experimental and doesn't work as it should, will have to
change or entirely remove it again :(
2010-02-28 14:16:40 +01:00
Michael Natterer 1e26bb1348 app: support baseline changing via Alt+Up and Alt+Down
Add a list of available baseline tags to GimpTextBuffer and
automatically create baseline tags as needed. They get serialized as
<span rise="value">, so add attribute and value parameters to the
buffer's tag_to_name() and name_to_tag() functions. Properly managing
the rise's amount is a TODO, currently each keystroke changes the
baseline by 1024 pango units, which might be whatever depending on the
output grid.
2010-02-27 18:00:39 +01:00
Michael Natterer 9a53cc11ca app: allow to toggle tags and then write text with that style
instead of using the toggles only to change the style of selected text.

Introduces a list of "insert tags" in GimpTextBuffer that is applied
on newly inserted text if it exists. Clear the list on each content
or cursor/selection change, so we always display wthe style at the
cursor unless the buttons were clicked explicitely.
2010-02-26 19:56:54 +01:00
Michael Natterer 11479d3abd app: use the tags left of the cursor when inserting
and make sure the style editor's buttons are correct at the beginning
and end of spans (take the tags toggled on/off at these positions into
account).
2010-02-26 03:05:57 +01:00
Michael Natterer 6c556698e5 app: add gimp_text_buffer_insert() and use it
Does nothing special yet, but will soon apply the currently active
tags to the inserted text.
2010-02-26 02:34:01 +01:00
Michael Natterer 360f5739da app: add infrastructure for editing pango markup based text styles
- keep around tags for styles in GimpTextBuffer. For now only bold,
  italic, underline and strikethrough.
- add GimpTextStyleEditor, a widget which allows setting tags on
  a GimpTextBuffer's selection.
- add serialize/deserialize code to/from pango markup using
  GtkTextBuffer's rich text (de)serialization infrastructure.
  Doesn't produce or handle <span> yet.
2010-02-26 01:27:05 +01:00
Michael Natterer 0b4bdc5613 app: add GimpTextBuffer, a GtkTextBuffer subclass
Pull all text buffer utility functions as methods and use
GimpTextBuffer all over the place instead of GtkTextBuffer.
Some actually usefuly features coming soon...
2010-02-25 17:41:10 +01:00