Introduce GIMP_DIALOG_VISIBILITY_HIDDEN because it is a bit
counter-intuitive to call gtk_widget_hide() on a dialog and then set
GIMP_DIALOG_VISIBILITY_VISIBLE on it. No change in program flow has
been (deliberately) introduced.
Tag assignment has been redesigned according to Peter Sikking's
recommendations. When multiple resources are selected, common tags
to all of them are listed in tag asignment widget. On assignment
it is detected which tags were added and removed from common tag set
and the selected resources are updated accordingly (instead of
replacing their previous tags).
Implemented infrastructure for multiple selection support.
GimpContainerTreeView actually provides such functionality.
All other GimpContainerViews should work as before.
Need to call gimp_text_tool_ensure_layou() in gimp_text_tool_draw()
explicitely now, because we don't redundantly call the
get_cursor_rect() function any more when there is a selection.
Update Windows->Toolbox menu entry depending on if toolbox exists. If
an existing toolbox will be raised, set "Toolbox". If it will create a
new toolbox, set "New Toolbox". We need this special treatment since
there can be only one toolbox, so "New Toolbox" will remove any
toolbox docks from Recently Closed Docks. If we would just have
"Toolbox" it could be misinterpreted as "get me the toolbox I just
closed".
Only remove a dock in the book-removed callback to dock columns if the
dock has the dock column as parent. It won't during destruction for
example. This fixes the test case
/gimp-ui/restore-recently-closed-multi-column-dock.
Generalize gimp_ui_find_non_toolbox_dock_window() by renaming it to
gimp_ui_find_dock_window() and adding a parameter with a function that
will be used to find the toolbox.
There can only be one toolbox around, so if a new is created, make
sure to remove any toolbox entries from Recenly Closed Docks so a
toolbox can't be created that way.
Add a helper function gimp_dock_window_should_add_to_recent() which
properly handles the toolbox with regards to what dock windows that
should be added to the list of recently closed docks.
- request "click" releases instead of trying to detect them ourselves,
but keep a minimum reasonable text layer size anyway (reduce it from
20 to 3 pixels though).
- ignore RELEASE_CANCEL when selecting, we can't undo that yet.
- properly handle RELEASE_CANCEL when creating new lext layers (don't
leave a dead overlay style editor around).
so we also correctly handle non-text and non-markup changes (e.g. via
tool options). This is not exactly the right place to call
block_drawing(), but all places which change change the actual content
(and thus un-sync buffer and layout cursor posotions) already block
drawing before the actual buffer change happens.
instead of duplicating GimpTextLayout's positioning logic in two
different incomplete ways. Also gets rid of the unrelated offset
return values of gimp_text_tool_editor_get_cursor_rect().
Since the order of docks in a dock window is arbitrary, it can never
be correct to only care about the first dock. Remove
gimp_dock_window_get_dock() and correct that code that made use of
it. (The function itself was introduced when there could only be one
dock per dock window.)
Earlier I claimed that drawing would work now because we make sure
that buffer and layout are always in sync. This was nonsense. In fact,
we constantly ran into the sutiation where the buffer was modified,
and we were drawing with the previous layout. It's unclear why this
didn't cause drawing artifacts, but it did cause e.g. the cursor
temporarily jumping to the next position while editing in the middle
of text (especially visible at line ends).
Several underlying problems existed: first, we now modify the buffer
from outside the text tool (from GimpTextStyleEditor) where we can't
pause the tool; second, proxy changes are handled asymetrically
(property changes are queued and processed all together in an idle
function) so we can't pause/resume drawing across the entire operation
because it has many beginnings and only one end.
Therefore:
- add gimp_text_tool_block_drawing()/unblock_drawing(), where block()
can be called as many times as needed, and a single unblock()
enables drawing again. block() also clears the layout, because it
served its purpose (it was just used to pause drawing, and we know
the buffer will change, so kill it).
- connect to GtkTextBuffer::begin-user-action and call block() from
the callback, so we undraw stuff and kill the cached layout before
any buffer change happens.
- call unblock() at the end of gimp_text_tool_apply() because then
the text and the buffer are in sync again, the tool is undrawn and
we can safely create the layout again to draw our stuff.
- also call block()/unblock() from some other places, like when a
new text layer is created.
- get rid of *all* calls to draw_tool_pause()/resume() around buffer
modifications, they are not needed any longer.
- add calls to begin/end_user_action() where they were missing.
In gimp_text_tool_connect(), set either text *or* markup on the
buffer, or the latter will always override the former (now that text
and markup are mutually exclusive in GimpText).
Move toolbox special casing into
gimp_dialog_factory_dialog_new_internal() and on the fly fix problems
with double toolboxes appearing and sometimes not appearing.
- 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.
Add gimp_markup_extract_text() which does just what it says (includes
code stolen from gmarkup.c), and use it if the layer's text object
doesn't have any text set.
In the drop callbacks, don't check if the GimpContainerView's container
contains the dropped item, it might be in a sub-container. Instead,
simply checking if the GimpContainerView knows the item is sufficient
(and also much simpler than a recursive container serach).
- Add signal GimpText::changed() and emit it from
GObject::dispatch_properties_changed() after all notifications have
been emitted, so "changed" is emitted only once for any number of
properties set within a g_object_freeze/thaw_notify() pair.
- Connect GimpTextLayer to "changed" instead of "notify" so we aviod
lots of expensive re-rendering when multiple properties are set
at once.
- Connect GimpTextTool to "notify" *and* "changed", and move some
common code to the "changed" callback (e.g. we don't need to
re-frame the item for each set property).
so all hovering is undrawn. oper_update() is called with proximity ==
FALSE when the pointer leaves the canvas, either to the outside or
into an overlay widget, so this is exactly the right thing to do (and
is probably missing from a lot of other tools too).
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.
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.
Instead of including dialogs/dialogs.h everywhere, introduce
gimp_dialog_factory_get_singleton(). The dialog factory singleton is
still initialized by dialogs.c though.
Right now the assumption is that we never will have another dialog
factory instance around. There were so many problems before when we
had four of them, so let's just keep one of them around.
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...
We only have one dialog factory now, and
gimp_dialog_factory_from_name() doesn't provide compile-time type
safety, so use global_dialog_factory directly instead.
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.
because we will soon use temporary buffers to turn stuff into markup
and back, and these temporary buffers won't have their tags registered
like the original GimpTextBuffer does.
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.
Don't use gimp_image_window_keep_canvas_pos() only for docks, use it
for all widgets in the display shell: the rulers, the menu bar, the
statusbar and the scrollbars. It is not really necessary for the two
latter ones because they are below and/or to the right of the canvas,
but we include them for completeness. Plus, they might get moved
around some day...
If we don't check if a state has already been applied in a toggle
action, we will apply it twice. The first time when it is toggled, the
second time when we get notified about a change in the underlying
property (which we caused ourselves).