Commit Graph

450 Commits

Author SHA1 Message Date
b6db793e6f app: remove the old selection code, the new one works now and is correct 2010-02-21 20:41:17 +01:00
51dc42bdd9 app: use the line's y coords for selection rendering, not the char's
so the selection rectangles have a least the same height.
2010-02-21 20:25:17 +01:00
4ec38099e5 app: render the selection char-by-char
so it's correct for all kinds of mixed text directions. Still looks
like crap because all the rectangles are separate, but should be
logically correct now.
2010-02-21 20:11:13 +01:00
3befe0df59 app: #include "libgimpbase/gimpbase.h" 2010-02-21 17:35:04 +01:00
0908e53148 app: use the new unit conversion functions
and get rid of the brainfuck idea that app/ has to use _gimp_unit_foo()
functions, passing a gimp pointer. Instead, simply use the libgimpbase
API all over the place. Should we ever allow more than one gimp instance,
they will simply have to share one unit database.
2010-02-21 16:46:39 +01:00
41a277f040 Bug 565001 - Text-Tool crashes when edit a 2.4.2 version xcf
Convert the rectangle size from pixels to units before setting it as
box-width and box-height on the text object.
2010-02-21 14:33:33 +01:00
f13204e0a4 app: fix the transition to modified text layer and back
- when the layer becomes modified, completely shut down the text tool
  completely instead of leaving it in some bastard hybrid
  half-attached state.
- when re-editing a modified layer (like after confirming the edit in
  the dialog), push a *drawable* undo, not a drawable_mod undo because
  the latter only refs the layer's tiles and doesn't copy them, so when
  the text layer re-render happens to not change the layer's size, it
  would overwrite the modified pixels without any chance of ever going
  back.

Unrelated:

- in button_press(), fix my recent fix for the condition that triggers a
  mouse-select and set the "seleting" state to FALSE when the
  condition is not met.
- in confirm_response(), don't check if the proxy exists because its
  existence is an invariant.
2010-02-21 12:04:19 +01:00
5150f3c8f6 app: when connecting the text object, also set its text on the buffer
and don't do it in editor_start(), which caused an undo to be pushed.
2010-02-21 02:00:57 +01:00
a6ca7e184c app: more text tool
- drop the layout in gimp_text_tool_halt()
- reinitialize the tool completely when clicking another display
- therefore, have to recreate the layout in button_press() instead
  of bailing out if it doesn't exist
2010-02-21 01:39:38 +01:00
b5b6d37742 app: move the entire mouse-selection apparatus to gimptexttool-editor.[ch] 2010-02-20 23:20:18 +01:00
75f7e25e3a app: don't call update_layout() from buffer_changed()
because the layout gets updated anyway when the model changes, and the
buffer is not the model, its changes are applied to the model.
2010-02-20 22:48:51 +01:00
e91f27a0fd app: simplify selection drawing a lot 2010-02-20 22:11:06 +01:00
42de0453da app: when disconnecting from the text layer, also empty our text buffer
or the remaining text will be added to the next text layer which is
created.
2010-02-20 19:43:17 +01:00
487336fc09 app: remove gimp_text_tool_update_proxy()
and move its code into gimp_text_tool_buffer_changed() which was its
only caller.
2010-02-20 19:31:27 +01:00
c91b026384 app: re-add gimp_text_tool_editor_get_text()
Return the entire buffer and use it in even more places than before to
get rid code duplication.
2010-02-20 19:25:07 +01:00
ec0f3bdcb8 app: buncha more text tool fixes
- hide the generated "empty" menu item in the IM submenu
- pause/resume the text tool around all selection/cursor/buffer changes
  (fixes most drawing artifacts)
2010-02-20 16:18:41 +01:00
4704c18739 app: implement IM preedit using an overlay widget
This has several advantages:

- it's always readable, no matter how sick font/colors are.
- it does not mess up the buffer, which is a model that should not
  contain temporary edit states.
- preediting does not clutter undo.
- it fixes the remaining bugs in the old preediting code because that
  code is completely gone now.
2010-02-20 15:15:53 +01:00
a8a732f753 app: fix IM context reset
- Reset the IM context in much more situations, like on button_press
  and when the text editor is initialized and halted (pretty much what
  GtkTextView does).
- As a consequence, halt the rectangle text tool after the text tool
  in control() because cancelling the IM preedit might cause a
  re-framing of the layer because it resized.
- pause()/resume() the draw tool around gimp_text_tool_halt() so we
  definitely avoid drawing atrifacts when the text tool is shut down
  in the middle of an IM preedit. That pause/resume pair should have
  been there from the beginning actually.
2010-02-19 20:13:25 +01:00
a8548fa7fd app: remove member text_tool->preedit_len
because it is always strlen(text_tool->preedit_string)
2010-02-19 20:13:24 +01:00
99b3af1cd2 app: re-frame the layer on each text change
because just about any text change can also change the text layer size.
2010-02-19 20:13:22 +01:00
5feec1dd9f app: some signal handling/updating fixes that also make undo mostly work
- most importantly, when the text changes and we set the buffer (as
  happens when undoing), block the "changed" signal on the *buffer*
  and not on the proxy (which doesn't even have a "changed"
  signal). This was apparently something that happened during the
  on-canvas editor merging.
- don't update the proxy when the layout changes, that's the wrong way
  around. Instead, update the layout whenever the proxy changes,
  remove lots of calls to update_layout() from the text editor and let
  the "changed" callback on the buffer do its job of updating
  everything.
2010-02-19 20:13:21 +01:00
92ba7b262a app: remove "return" at the end of a void function 2010-02-19 20:13:19 +01:00
21e2462b2c app: only resize the text layer if the rectangle size has actually changed
Like when the user just clicked a handle and didn't actually move it.
2010-02-19 20:13:18 +01:00
9f03c457e1 app: no reason to translate the newly created text layer
because a few lines up we set its offsets correctly before adding it
to the image.
2010-02-19 20:13:17 +01:00
e4d63ce11a app: don't create new text layers on double and triple clicks 2010-02-19 20:13:16 +01:00
c69459f13e app: adapt button_release() to the new realities
Like that we start selecting on the very first click on an unframed
text layer alreadyand that we ignore clicks in dead space which had
unexpected results before. Also update all comments and move them
into the function.
2010-02-19 20:13:14 +01:00
7e3b090c32 app: request and process key_release events
Feed them into the text editor's IM context and into the proxy text
view's key bindings. Fixes input methods (e.g. entering of unicode
sequences seems to work flawlessly now).
2010-02-18 20:50:37 +01:00
e616ebad4d app: move tons of code out of the line iter loop
when drawing the selection and preedit underline (there is no reason
to calculate constants again for each line)
2010-02-18 20:16:11 +01:00
becc85683c app: remove "mark_set" callback
There is no reason to recreate the layout when the cursor or selection
bound move, so remove the entire callback and all the signal
blocking/unblocking.
2010-02-18 19:53:44 +01:00
fa6e9e6653 app: avoid to do things twice when double or triple clicks arrive
In button_press(), don't frame the item again and switch to selecting
mode on double and triple click events, we already did that when
receiving the normal button-press. Also clarify a comment.
2010-02-18 19:44:52 +01:00
051deba82d app: more minor cleanups 2010-02-18 11:47:16 +01:00
2ca9aab14c app: get rid of one indentation level in gimp_text_tool_motion() 2010-02-18 11:34:08 +01:00
5794041ceb app: turn off clipping for the text cursor and the preedit strings
so they are visible also when partly out-of-layer.
2010-02-18 09:27:08 +01:00
468ea629a6 app: use image and rect_tool utility functions instead of duplicating them
and some random cleanups
2010-02-18 09:13:27 +01:00
838f2d567d app: cleanup 2010-02-17 21:39:33 +01:00
8f27ec48c6 app: split the text editor code out to a separate file 2010-02-17 21:24:09 +01:00
31659758d1 app: do the setting of the text box mode properly
- remove the button again.
- add a "box-mode" property to GimpTextOptions and a combo box.
- let the normal options -> proxy -> text mechanism do the setting.
- make sure we update the rectangle in some more situations.
- add utility function gimp_text_tool_frame_item().
2010-02-17 20:28:13 +01:00
2dc577d606 app: clean up the text options notify callback 2010-02-17 16:05:45 +01:00
8574f4c4e8 app: allow to set the text layer back to dynamic resizing
Add a "Dynamic Text Box" button to the tool options which sets the
text box' mode back to dynamically resizing with the text.  This badly
needs UI review but is at least possible now.
2010-02-17 15:50:03 +01:00
9974fe36d1 app: improve cursor movement by positions when there is a selection
Port over the patch I did for GtkTextView and move *to* the end of the
selection and not *from* it when there is a selection and we are
moving by characters.
2010-02-17 13:17:46 +01:00
3efd20de77 app: move gimp_text_tool_set_layer() to the public functions 2010-02-17 13:08:53 +01:00
dd1ec8ff9d app: rename editor related functions
so the on-canvas editor's functions are just called "editor" because
it's the default and the dialog's functions are called "editor_dialog".
2010-02-17 12:03:18 +01:00
94d9dca2a3 app: more text tool fixes
- bail out and don't warn like crazy in draw() when there is no text.
- fix crash in button_press() when clicking a modified text layer
  bring up the confirm dialog and thus didn't set text_tool->text.
- pull setting the right text on text_tool->text_buffer into
  gimp_text_tool_canvas_editor() (fixes editing after confirming a
  modified text layer edit).
- add lots of missing calls to gimp_text_tool_set_layer() so the
  tool will actually start editing.
2010-02-17 11:57:32 +01:00
c2a8f51768 app: lots of text tool fixes
- Add gimp_text_tool_halt() to shut down the tool and call it
  from gimp_tool_control(HALT).
- call control(HALT) when escape is pressed to reset the tool
  (can finally switch to other tools again now).
- fix button_press() to handle clicks on already existing
  text layers well.
- also button_press(): fix the condition that sets the previously
  existing text on the canvas editor so we don't end up with weird
  ui states where displayed and internally used text differ.
- remove some redundant code.
2010-02-16 22:48:27 +01:00
90d7ffde1a app: Make all GimpDialogFactory members private
Add necessary trivial API that allows us to make remaining
GimpDialogFactory instance members private, and make them private.
2009-12-20 20:21:26 +01:00
473b5122ae Move the cursor to the logical end of the selection when cancelling it
gimp_text_tool_move_cursor(): when there is something selected, and
cursor movement does not extend that selection, move the cursor to the
end of the selection that is in moving direction. This it *not*
how GtkTextView behaves, but it should, see bug #50942.
2009-10-15 12:04:09 +02:00
33150b4a1b Use gtk_widget_get_window() instead of widget->window 2009-10-09 21:19:05 +02:00
c5b856f16f Use gimp_display_get_image() instead of display->image 2009-10-06 19:20:44 +02:00
d1ded0617f More gimp_display_get_shell() instead of display->shell 2009-10-05 19:58:03 +02:00
ac98c2c234 Use gimp_display_get_shell() instead of directly accessing it 2009-10-04 19:56:39 +02:00