Commit Graph

3101 Commits

Author SHA1 Message Date
Michael Natterer 02b8eea086 app: restrict sample point drawing to the exposed region
With the same limitation as for guides in the last commit.
2010-05-02 15:58:51 +02:00
Michael Natterer 6e4be79bef app: restrict grid and guide drawing to the exposed region
Doesn't really clip yet for guide drawing, but at least doesn't bother
to draw them when they are outside the expose region's bounding box.
2010-05-02 15:40:11 +02:00
Alexia Death 06c1b290d0 app: Add tool preset editor to controll what elements get applied
I had to remove the asserrt in tool preset constructor, because with it
it wasnt possible to initalize an empty model object for the editor.
At init time the gimp object passed to the constructor is not yet available.
2010-04-24 17:55:54 +03:00
Michael Natterer 8d3a5099f8 app: turn a g_warning() into a g_return_if_fail() 2010-04-22 17:17:02 +02:00
Michael Natterer 5b28d04674 app: queue the draw timeout only if paused_count reaches zero 2010-04-22 17:15:08 +02:00
Michael Natterer 2f5d2bc85f Bug 616342 - gimp crashes on startup if you have a contextrc file from 2.6
Remove the draw timeout in GObject::dispose() to be safe.
2010-04-22 16:45:44 +02:00
Michael Natterer 56e4585f70 app: finally apply tool presets when one is seleced
currently respects the fact that FG/BG are always global and the
global brush,pattern,... settings from gimprc. This should probably
not change, but rather be overridable on a per-preset basis as
suggested.
2010-04-21 20:56:49 +02:00
Michael Natterer 94181ce538 app: don't overwrite all tool options' "tool" and "paint-info"
with bogus values from contextrc, we want them to always match the
tool option's type.
2010-04-21 20:43:27 +02:00
Michael Natterer d47aa2ba52 app: change to the preset's tool when a tool preset is selected
but don't set any tool options yet because that is a lot more tricky.
2010-04-20 20:11:37 +02:00
Michael Natterer 547c92d0f6 Bug 541586 - Tool options not saved/loaded correctly?
Don't overwrite the entire context part of all tool options with
values from contextrc, or we will end up with one tool option set to a
non-default values affecting all other tool options that were at their
default value in the next gimp session.
2010-04-18 12:47:18 +02:00
Michael Natterer 93645e9083 app: cosmetic cleanup 2010-04-01 22:29:08 +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 d66b6134a0 app: micro cleanups 2010-03-20 22:25:58 +01:00
Alexia Death 69e28668a1 app: Tune redraw limit to sane bounds 2010-03-19 23:25:22 +02:00
Michael Natterer 08193e8b56 Limit the draw tool's redraw framerate to about 29 FPS using a timeout 2010-03-19 21:08:41 +01:00
Alexia Death 054bd341bd app: fix incomplete revert 2010-03-19 21:21:01 +02:00
Alexia Death 1e8ec625df Revert "app: Fix the code that disables outline to be a bit neater"
This reverts commit 58d82dcadc.
2010-03-19 21:21:01 +02:00
Alexia Death 656eb53aad Revert "app: Do not show brush outline when painting"
This reverts commit 031dc8e68a.
2010-03-19 21:21:01 +02:00
Michael Natterer f9e68fe0ee Fix undo when going back from a modified text layer to an editable one
My earlier change to using gimp_drawable_push_undo() here was a very
bad idea. Go back to using gimp_image_undo_push_drawable_mod(), but
make use of its new tile-copying feature so the problem that made me
do the earlier change is fixed too. See comments in the changed code.
2010-03-18 10:32:52 +01:00
Øyvind Kolås 63824d7153 app: use a blacklist instead of whitelist for gegl op categories
The set of core GEGL ops that GIMP does not want to see falls into a
well defined set of categories. Blacklisting allows freedom in choosing
new and better categorisation for GEGL ops.
2010-03-17 23:48:18 +00:00
Alexia Death 58d82dcadc app: Fix the code that disables outline to be a bit neater 2010-03-17 00:36:19 +02:00
Alexia Death 031dc8e68a app: Do not show brush outline when painting
It takes resourses and jsut gets in the way of seeing the real brush
2010-03-16 23:48:56 +02:00
Alexia Death bd2f852ac1 app: make off-canvas changes have effect on brush outline 2010-03-16 21:53:34 +02:00
Alexia Death 44a5a34d7e app: Make brush boundaries dynamic aswell 2010-03-15 02:55:15 +02:00
Alexia Death e85220f8f9 app: Add an option to explicity turn off airbrush rate
This was decided in a discussion with guiguru on irc
some time ago. However, one element is missing. The
rate slider needs to be disabled when motion only is
enabled, because it has no effect.
2010-03-14 17:28:08 +02:00
Alexia Death 861179b452 app: Rename so-called airbrush pressure to Flow
Top reasons for this are, that pressure is already
used as input for dynamcs and the fact that flow of
paint makes much more sense.
2010-03-14 17:23:49 +02:00
Michael Natterer 3e3613bef7 app: allow for more fine-grained baseline and kerning adjustments
In theory for now, by changing the parameters of
GimpTextProxy::change_baseline() and ::change_kerning()
from gint to gdouble.
2010-03-08 21:57:29 +01:00
Michael Natterer 98a2b0210f app: fix crash introduced by layout offset refactoring
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.
2010-03-07 17:34:49 +01:00
Michael Natterer a5409e2872 app: allow to pick text layers with the text tool
When the button_press is not in the currently edited text layer, and
not on any rectangle handle, try to pick a text layer.
2010-03-07 12:41:15 +01:00
Michael Natterer 6650693d29 app: move gimp_image_pick_layer() to its own file
and add a (still unused) text layer picking function.
2010-03-07 01:55:31 +01:00
Michael Natterer cda52f946c app: minor code cleanup (add local variable to improve readability) 2010-03-07 01:19:32 +01:00
Michael Natterer 2e5de8f6ab app: pass the cursor's PangoRectangle to gimp_draw_tool_draw_text_cursor()
and let the drawing function decide everything instead of doing some
cursor extents fiddling in the text tool.
2010-03-07 01:15:04 +01:00
Michael Natterer b9405d046a app: fix some corner cases in gimp_text_tool_button_release()
- 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).
2010-03-07 00:53:32 +01:00
Michael Natterer a077d618ea app: no need any more to block drawing before non-text changes to the proxy 2010-03-07 00:21:51 +01:00
Michael Natterer 44f6d074a3 app: call gimp_text_tool_block_drawing() in proxy_notify()
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.
2010-03-07 00:15:32 +01:00
Michael Natterer 2934095816 app: use gimp_text_layout_get_offsets()
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().
2010-03-07 00:11:05 +01:00
Michael Natterer e9f85b3afc app: block text buffer signals around copying to the clipboard
so the copying doesn't produce an undo step. Same fix as applied
earlier in button_press().
2010-03-05 10:53:09 +01:00
Michael Natterer 076948b4b7 app: don't leave drawing blocked in the error case 2010-03-05 10:50:50 +01:00
Michael Natterer 5284c9c836 app: fix text tool drawing for good this time (hopefully)
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.
2010-03-04 23:47:23 +01:00
Michael Natterer e54a05f78f app: get rid of gimp_text_tool_idle_apply()
and make gimp_text_tool_apply() itself the idle function. Might seem
like a bad idea, but is needed by an upcoming drawing refactoring.
2010-03-04 23:10:23 +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 080f1a6ce4 app: fix editing text layers which don't contain markup
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).
2010-03-03 01:15:27 +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 9c4864e789 app: optimize away redundant and expensive text layer re-rendering
- 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).
2010-03-02 17:44:31 +01:00
Michael Natterer 6d4f2c3431 Bug 565001 - Text-Tool crashes when edit a 2.4.2 version xcf
Need to convert to text->box_unit, not text->unit.
2010-03-02 15:24:17 +01:00
Michael Natterer 1fb61b8515 app: make sure mouse-selecting doesn't push an undo step
GtkTextBuffer emits "end-user-action" after something has been copied
to the clipboard. Work around that bug.
2010-03-02 13:04:37 +01:00
Michael Natterer 78ea82df1f app: simplify mouse selection by using iters instead of indices
This also removes the evil code dupication added yesterday, and is
generally less and cleaner code.
2010-03-02 12:23:29 +01:00
Michael Natterer aeac58089b app: add a font selector to the text style editor
Selects fonts just fine, but has no effect on the text yet.
2010-03-02 00:12:27 +01:00
Michael Natterer f214b4f9b7 app: oper_update(): if we are not in proximity, set the function to DEAD
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).
2010-03-01 23:34:52 +01:00
Michael Natterer 8a1a19fc32 app: argh forgot one more place
Time for a refactoring that pulls the forgotten code into one common
place.
2010-03-01 21:39:26 +01:00