2004-02-14 Michael Natterer <mitch@gimp.org>
Fixed lots of QuickMask brokenness by letting the image adjust
its qmask_state automatically:
* app/core/gimpimage-qmask.h: #define GIMP_IMAGE_QMASK_NAME "Qmask".
Use the define in all files below.
* app/core/gimpimage.[ch]: split gimp_image_drawable_add,_remove()
into separate handlers for layers and channels. Added a
"name_changed" handler for all channels. In the channel "add",
"remove" and "name_changed" handlers, check if it was a channel
named "Qmask" that was added, removed or renamed and call
gimp_image_set_qmask_state() accordingly.
* app/core/core-enums.[ch]
* app/core/gimpimage-undo-push.[ch]
* app/core/gimpundo.c: removed all Qmask undo code because the image
does the right thing without undo interaction now.
* app/core/gimpimage-qmask.c (gimp_image_set_qmask_state): set
gimage->qmask_state early so we can return early when called
recursively. Removed calls to gimp_image_undo_push_image_qmask().
Returned "removed" callback (it was utterly broken the way it was
implemented).
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_qmask_toggled): check if the image's
qmask state needs to be changed before changing it.
* app/xcf/xcf-load.c (xcf_load_channel): removed code which
recognized the qmask. GimpImage does this automatically now.
* app/gui/qmask-commands.c: cleanup.
* app/widgets/gimpimagedock.c (gimp_image_dock_constructor):
destroy the "/Select/By Color" and "/Select/Toggle QuickMask" menu
items.
* app/widgets/image-menu.c (image_menu_update): changed accordingly.
2004-02-13 Manish Singh <yosh@gimp.org>
* app/base/temp-buf.c (temp_buf_get_memsize)
* core/gimpviewable.c (gimp_viewable_get_memsize): Add some casts
to gsize for ints to prevent overflows.
* app/base/tile-manager.c (tile_manager_get_memsize): Same as above,
except cast to gint64.
2004-02-13 Simon Budig <simon@gimp.org>
* app/core/gimpimage-guides.[ch]: make a similar fix as in my
last commit for snapping the guides.
* app/tools/gimpmovetool.c: use the fixed version.
2004-02-13 Simon Budig <simon@gimp.org>
* app/core/gimpimage-snap.[ch]: make the snapping width a
parameter of the snapping functions.
* app/display/gimpdisplayshell.c: make sure that the snapping
width always is 5 pixels in the view coordinates.
Fixes bug #134285
2004-02-13 Michael Natterer <mitch@gimp.org>
Fixed GimpData's default "writable" and "deletable" behaviour:
* app/core/gimpdata.c (gimp_data_init): default to writable and
deletable == TRUE (something that has no filename was never loaded
from disk and can't be undeletable or read-only).
Fixes bug #134274.
* app/core/gimpdata.[ch]: added new function
gimp_data_make_internal() which frees the filename and sets the
data's flags accordingly.
* app/core/gimp-gradients.c (gimp_gradients_add_gradient)
* app/core/gimpbrush.c (gimp_brush_get_standard)
* app/core/gimpgradient.c (gimp_gradient_get_standard)
* app/core/gimppalette.c (gimp_palette_get_standard)
* app/core/gimppattern.c (gimp_pattern_get_standard): use the
new function for internal data objects.
* app/core/gimpdata.c (gimp_data_save, gimp_data_delete_from_disk)
* app/core/gimpdatafactory.c (gimp_data_factory_save_single):
bail out with g_return_if_fail() is the data is not writable
or deletable.
* app/widgets/gimpdataeditor.c
* app/widgets/gimpdatafactoryview.c: changed accordingly.
2004-02-12 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-convert.c (gimp_image_convert): call
gimp_image_colormap_changed() after installing the colormap.
* app/tools/gimphistogramoptions.h: fixed typedef of
GimpHistogramOptionsClass.
2004-02-12 Michael Natterer <mitch@gimp.org>
Make sure that non-indexed images never have a colormap.
Fixes bug #121033.
* app/core/gimpimage-colormap.c (gimp_image_set_colormap): set
image->cmap to NULL when called with a NULL colormap.
* app/core/gimpimage-undo-push.c: made colormap undo/redo aware
of NULL colormaps.
* app/core/gimpimage-convert.c (gimp_image_convert): remove the
colormap using gimp_image_set_colormap() instead of freeing it
manually.
* app/widgets/gimpcolormapeditor.c: always check if the image
is INDEXED *and* has a colormap before accessing the colormap.
(need this new check because the fixed behaviour of colormap undo
produces undo groups which, when being popped, make the image have
no colormap while still being INDEXED in the small time frame
between the emission of "colormap_changed" and "mode_changed").
2004-02-10 Sven Neumann <sven@gimp.org>
* themes/Default/images/Makefile.am (CORE_IMAGES): use the
question stock icon instead of the warning one.
* app/core/gimpviewable.c (gimp_viewable_get_dummy_preview):
return a question icon as dummy preview.
2004-02-10 Michael Natterer <mitch@gimp.org>
* app/core/gimpviewable.[ch]: added new function
gimp_viewable_get_dummy_preview() which currently returns a
completely white and opaque TempBuf of the requested size. Added
this useless function because this is the place where to implement
a nicer preview if someone volunteers.
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/image.pdb: use the new function if
gimp->config->layer_previews is FALSE instead of returning no
preview at all. Fixes bug #112012.
Cleaned up the preview functions a bit and raised
the limit for drawable previews from 128x128 to 256x256.
* app/pdb/drawable_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpdrawable_pdb.c: regenerated.
2004-02-07 Hans Breuer <hans@breuer.org>
* gimpdefs.msc : new file to keep common definitions for the msc build
* **/makefile.msc : use common defintions, e.g. GIMP_VER
* Makefile.am : add the former to EXTRA_DIST
2004-02-07 Pedro Gimeno <pggimeno@wanadoo.es>
* app/core/gimpimage-convert.c (median_cut_pass2_no_dither_rgb):
Corrected position for alpha_pix in the case of grayscale images
with custom or mono palette and no dither. Fixes bug #133642.
(median_cut_pass2_fixed_dither_rgb): Ditto for fixed dither
(Positioned Color Dither).
2004-02-05 Michael Natterer <mitch@gimp.org>
Disallow editing of data objects which have no save functionality.
Also fixed the misassumption that "deletable" is always equal to
"writable". Fixes bug #133456.
* app/core/gimpdata.[ch]: added a "deletable" property which is
always equal to "writable" except when the data class does not
implement GimpData::save() (then deletable may be TRUE but
writable is always FALSE).
* app/gui/brushes-menu.c
* app/gui/gradients-menu.c
* app/gui/palettes-menu.c
* app/gui/patterns-menu.c
* app/widgets/gimpdatafactoryview.c: look at data->deletable when
setting the sensitivity of the "Delete" buttons and menu items.
* app/widgets/gimpdatafactoryview.c
(gimp_data_factory_view_tree_name_edited): rename the data
only if it's writable and restore the old name otherwise.
* app/widgets/gimpdataeditor.c: no need to look at data->internal
for figuring if the data is editable, data->editable is enough.
All files above: s/writeable/writable/g
* app/widgets/gimpbrusheditor.c (gimp_brush_editor_set_data):
simplified.
2004-02-05 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-crop.c: removed trailing whitespace.
* app/gui/debug-commands.[ch]
* app/gui/toolbox-menu.c: renamed ENABLE_DEBUG_ENTRIES to
ENABLE_DEBUG_MENU and #define it to be equal to GIMP_UNSTABLE.
2004-02-01 Michael Natterer <mitch@gimp.org>
Disallow to rename the layer mask. Instead, always name the mask
"<layer name> mask". Fixes bug #133112 along with some other
unreported ones.
* app/core/gimpitem.[ch]: added a boolean return value indicating
success to GimpItem::rename().
(gimp_item_real_rename): push an undo step only if the item is
attached.
* app/core/gimplayer.c (gimp_layer_rename): refuse renaming if
the layer is a floating selection floated from a channel
(renaming a layer's floating selection makes a new layer out
of the floating selection).
(gimp_layer_duplicate): use gimp_layer_add_mask() to attach the
mask's duplicate. Fixes mask refcount brokenness for duplicated
layer masks.
(gimp_layer_name_changed): new function. Automatically renames the
layer mask when the layer's name changes.
* app/core/gimplayermask.c (gimp_layer_mask_rename): new function
which refuses renaming.
(gimp_layer_mask_name_changed): skip the unique name voodoo
GimpItem does by not chaining up.
(gimp_layer_mask_set_layer): change the mask's name whenever it is
attached to a layer.
* app/text/gimptextlayer.c (gimp_text_layer_rename): fiddle with
text_layer->auto_rename only if renaming was successful.
* app/widgets/gimpitemtreeview.c (gimp_item_tree_view_name_edited):
restore the old name if renaming failed.
* tools/pdbgen/pdb/drawable.pdb (set_name): return an execution
error if renaming failed.
* app/pdb/drawable_cmds.c: regenerated.
2004-01-31 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-convert.[ch]: use gboolean instead of gint
for "alpha_dither" and "remove_dups" in all public and private
functions. Properly prototyped private functions. Minor cleanup.
* app/gui/convert-dialog.c: pass FALSE instead of 0.
* tools/pdbgen/pdb/convert.pdb: ditto. Also cleaned up a bit: use
generated checks and documentation for enums, removed duplicate
check for enum range (spotted by Kevin Cozens).
* app/pdb/convert_cmds.c
* libgimp/gimpconvert_pdb.c: regenerated.
2004-01-29 Simon Budig <simon@gimp.org>
* app/display/gimpdisplayshell.[ch]: Store the zoom factor as
float, not as a ratio.
* app/display/gimpdisplayshell-scale.[ch]: change the API to
expose the Float instead a weirdly encoded integer. Implement
functions to get a ratio from the scale factor. Implement a set
as presets as discussed on the mailinglist. Changed Zoom->Other
dialog to enable entering a float.
* app/display/gimpdisplayshell-title.c
* app/display/gimpnavigationview.c
* app/gui/image-menu.c
* app/gui/info-window.c
* app/tools/gimpmagnifytool.c: changed accordingly.
* app/core/gimp.[ch]
* app/display/gimpdisplay.[ch]
* app/gui/gui-vtable.c
* app/widgets/widgets-enums.h: Made the various display-creating
functions accept a float for the scale. Introduce a new
GimpZoomType: GIMP_ZOOM_TO. Generally adjust the API to use
floats instead of weird integers.
* app/core/gimp-edit.c
* app/core/gimptemplate.c
* app/display/gimpdisplayshell-callbacks.c
* app/file/file-open.c
* app/gui/image-commands.c
* app/gui/view-commands.[ch]
* tools/pdbgen/pdb/display.pdb
* app/widgets/gimpimageview.c
* app/widgets/gimptoolbox-dnd.c: changed accordingly
* app/pdb/display_cmds.c: regenerated
2004-01-29 Michael Natterer <mitch@gimp.org>
* app/core/gimpcontext.[ch]: removed the last artefact of context
signal handling from 1.2:
GimpContext used to connect to e.g. the current brush's
"invalidate_preview" and "name_changed" signals and emitted
"brush_changed" when the callback was invoked. This was needed to
make 1.2 work, but is conceptually broken with the real model <->
view approach implemented in the current code.
This change also optimizes things quite a bit because lots of
signal emissions are saved.
Added utility function which finds a container's current object
after a freeze/thaw.
* app/widgets/gimpcontainerview.[ch]: added new virtual function
GimpContainerView::rename_item(). Connect to "name_changed" of the
corrent container's children and invoke rename_item() accordingly.
* app/widgets/gimpcontainertreeview.[ch]: removed name_changed
handler and implement GimpContainerView::rename_item().
* app/widgets/gimpcontainergridview.c: ditto. the grid view was
still relying on the removed GimpContext behaviour for updating
the label showing the sleected item's name.
2004-01-29 Michael Natterer <mitch@gimp.org>
GimpData code review:
* app/core/gimpdata.c (gimp_data_init): default to
writable = FALSE and dirty = TRUE.
* app/core/gimpbrushgenerated.[ch]: added "const gchar *name" to
gimp_brush_generated_new().
* app/core/gimpbrush.c
* app/core/gimpbrushgenerated.c
* app/core/gimpbrushpipe.c
* app/core/gimpgradient.c
* app/core/gimppalette.c
* app/core/gimppattern.c: set all standard datas to clean and
internal, check for g_path_is_absolute() in all load functions,
pass the data's name as construct property to g_object_new()
instead of calling gimp_object_set_name() after creation, fixed
some UTF-8 handling, spacing, indentation, coding style, general
cleanup.
2004-01-28 Michael Natterer <mitch@gimp.org>
Added infrastructure to make sure we don't write to the global
brush, pattern etc. directories. Needed to make this configurable
because we can't rely on the global directories being read-only,
having certain names or being otherwise detectable at runtime in a
sane way. Fixes bug #132214.
* libgimpbase/gimpdatafiles.[ch]: added "const gchar *dirname" to
the GimpDataFileData struct so callbacks don't need to call
g_path_get_dirname() for each file.
* libgimpwidgets/gimpfileentry.c: made it work with non UTF-8
encoded filenames.
* libgimpwidgets/gimppatheditor.[ch]: ditto. Added GUI and API for
setting/getting a second "writable_path". The widget makes sure
that the writable_path is always a subset of the path.
* app/config/gimpconfig-utils.[ch]: added new function
gimp_config_build_writable_path().
* app/config/gimpcoreconfig.[ch]: added separate properties for
the writable brush, pattern, gradient, palette and font paths.
* app/config/gimprc-blurbs.h: added (still empty) blurbs for the
new properties.
* app/core/gimpdata.[ch] (gimp_data_set_filename): added parameter
"gboolean writable". Set data->writable to FALSE by default. If
"writable" is passed as TRUE, still check if we can write to the
file before setting data->writable to TRUE.
(gimp_data_create_filename): changed "data_path" parameter to
"dest_dir" and assume dest_dir is writable.
(gimp_data_duplicate): set data->dirty to TRUE to make sure
duplicated things will be saved.
* app/core/gimpbrush.c
* app/core/gimpbrushgenerated.c
* app/core/gimpbrushpipe.c
* app/core/gimpgradient.c
* app/core/gimppalette.c
* app/core/gimppattern.c: don't set the data's filename and don't
touch data->dirty in the _load() functions because that's done by
the data factory now. Don't touch data->dirty in the _duplicate()
functions because that's done by gimp_data_duplicate() itself now.
* app/core/gimpdatafactory.[ch] (gimp_data_factory_new): added
"writable_property_name" and remember it.
Added utility function gimp_data_factory_get_save_dir() which
determines the directory to save new datas to.
Added public function gimp_data_factory_data_save_single() which
saves a single data object.
Make sure new things get saved to the first writable directory
as specified in preferences.
* app/core/gimp.c (gimp_real_initialize): pass the writable_paths'
property names to gimp_data_factory_new().
* app/widgets/gimpdataeditor.c (gimp_data_editor_save_dirty): use
gimp_data_factory_data_save_single() instead of implementing
saving here.
* app/widgets/gimppropwidgets.[ch] (gimp_prop_path_editor_new):
added "const gchar *writable_property_name" parameter (can be
NULL).
Added the needed callbacks to handle the writable_path and made
the path_editor and file_entry code aware of non UTF-8 filename
encodings. Some general cleanup.
* app/gui/preferences-dialog.c: changed accordingly.
2004-01-28 Simon Budig <simon@gimp.org>
Argh, this is getting silly.
* app/core/gimpscanconvert.c: Fix dumb bug I introduced
while fixing bug #132036. Instead of always closing a
polyline to the first point of the vpath close to the
first point of the current polyline
I'll close#132036 for the third time now, feel free to
reopen it when bugs appear...
2004-01-27 Michael Natterer <mitch@gimp.org>
* themes/Default/images/Makefile.am
* themes/Default/images/stock-layer-mask-16.png
* themes/Default/images/stock-layer-mask-24.png
* themes/Default/images/stock-layer-mask-32.png
* themes/Default/images/stock-layer-mask-48.png
* themes/Default/images/stock-selection-border-16.png
* libgimpwidgets/gimpstock.[ch]: added forgotten layer mask and
new "border selection" icons from Jimmac (-32 and -48 ones to be
updated, they are currently copies of the channel icons).
* app/core/gimplayermask.c (gimp_layer_mask_class_init)
* app/gui/image-menu.c (image_menu_entries): use them.
2004-01-26 Simon Budig <simon@gimp.org>
* app/core/gimpscanconvert.c: use the modern libart way
to uncross/rewind a libart SVP. This time really fixes
bug #132036 (please test it though...).
2004-01-26 Michael Natterer <mitch@gimp.org>
* plug-ins/script-fu/scripts/unsharp-mask.scm: add the layer to
the image before pasting to it. Fixes bug #132504.
Fixed the underlying problem: make it impossible to attach
floating selections to drawables which are not currently part of
the image's layer or channel stacks.
Also cleaned up image <-> floating_sel interaction:
* app/core/gimplayer-floating-sel.[ch] (floating_sel_attach):
added assertion that the drawable is part of the image (see below).
Don't call gimp_image_floating_selection_changed(), it's emitted
by gimp_image_add_layer() now.
(floating_sel_remove)
(floating_sel_anchor): don't emit "floating_selection_changed",
it's emitted by gimp_image_remove_layer() now.
(floating_sel_anchor): removed the fix for bug #132162 because
gimp_image_remove_layer() behaves correctly now (see below).
Renamed floating_sel_reset() to floating_sel_activate_drawable().
Added g_return_if_fail() all over the place.
* app/core/gimpimage.[ch]: added new function gimp_image_owns_item()
which return TRUE if the passed item is part of the image.
(gimp_image_add_layer): emit "floating_selection_changed" here if
needed.
(gimp_image_remove_layer): emit "floating_selection_changed" if
needed, don't try to activate a layer if we called
floating_sel_activate_drawable().
This is the real fix for bug #132162.
* app/core/gimpimage-undo-push.c (undo_pop_layer): apply the same
fixes as to gimp_image_add,remove_layer(). Don't call
gimp_drawable_invalidate_preview() on the previously active layer
because that's done by gimp_image_set_active_layer() now.
* app/xcf/xcf-load.c: remember the "floating_sel_drawable" in the
XcfInfo struct and attach it *after* all layers and channels are
loaded to avoid attaching the floating selection to an
out-of-image drawable.
* app/core/gimp-edit.c (gimp_edit_paste)
* app/core/gimpdrawable-transform.c (gimp_drawable_transform_affine,
gimp_drawable_transform_flip, gimp_drawable_transform_rotate)
* app/core/gimpselection.c (gimp_selection_float)
* app/text/gimptext-compat.c (text_render): added checks for
gimp_image_owns_item() in all functions which can produce
floating selections.
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/floating_sel.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/transform_tools.pdb: added checks for
gimp_item_owns_image() and return an execution error if invoked
with a drawable which is not part of the image.
* app/pdb/edit_cmds.c
* app/pdb/floating_sel_cmds.c
* app/pdb/selection_cmds.c
* app/pdb/text_tool_cmds.c
* app/pdb/transform_tools_cmds.c: regenerated.
2004-01-26 Manish Singh <yosh@gimp.org>
* app/core/gimpdrawable-blend.c (gradient_fill_region): use memcpy
instead of casted assignment for storing HSV values in rbd.fg/bg,
for C99 aliasing compliance.
* app/xcf/xcf-load.c (xcf_load_layer_mask): use a GimpChannel *
explictly for xcf_load_channel_props, for the above reason.
* app/xcf/xcf-save.c (xcf_save_prop): use a temporary guint32 for
saving property types, for the above reason.
* app/core/gimpparasitelist.c (gimp_parasite_list_deserialize): plug
a memory leak, since data is copied on parasite creation.
2004-01-23 Michael Natterer <mitch@gimp.org>
* app/app_procs.c
* app/errors.c
* app/main.c
* app/config/gimpconfigwriter.c
* app/core/gimpdata.c
* app/core/gimpdatafactory.c
* app/gui/user-install-dialog.c
* app/plug-in/plug-ins.c
* app/vectors/gimpvectors-import.c: some more gimp_filename_to_utf8().
* libgimp/gimp.c
* libgimpmodule/gimpmodule.c
* libgimpmodule/gimpmoduledb.c: use it here, too, now that is in
libgimpbase.
2004-01-22 Michael Natterer <mitch@gimp.org>
* app/core/gimplayer-floating-sel.c (floating_sel_anchor):
explicitly activate the drawable the floating selection was
attached to (function was relying on implicit voodoo that
happened 1.2). Fixes bug #132162.
2004-01-22 Michael Natterer <mitch@gimp.org>
* app/core/gimpitem.[ch]: added "gboolean use_default_values"
to GimpItem::stroke().
* app/core/gimpselection.c: changed accordingly.
* app/core/gimpchannel.c
* app/vectors/gimpvectors.c: if use_default_values is TRUE, don't
use the GimpPaintOptions passed in the GimpPaintInfo, but create a
new one.
* app/gui/stroke-dialog.c: pass FALSE so the values as set in the
tool options are used.
* tools/pdbgen/pdb/edit.pdb
* tools/pdbgen/pdb/paths.pdb: pass TRUE so tool options settings
don't affect PDB stroke calls. Fixes part 2 of bug #132145.
* app/pdb/edit_cmds.c
* app/pdb/paths_cmds.c: regenerated.
2004-01-21 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-transform.c: use RINT() instead of ROUND()
to calculate the coordinates of the transformed tiles to avoid
off-by-one errors when affine-transforming, flipping and rotating
drawables with negative offsets.
Fixes the off-by-one part of bug #132089.
2004-01-21 Michael Natterer <mitch@gimp.org>
* app/core/gimpdrawable-transform.c (gimp_drawable_transform_paste):
call gimp_drawable_invalidate_boundary() because the drawable's
size may have changed. Fixes bug #132077. Removed call to
floating_sel_invalidate() which is now redundant.
2004-01-21 Simon Budig <simon@gimp.org>
* app/core/gimpscanconvert.c: removed the call to
art_vpath_perturb, since it apparently is responsible for the
artefacts described in bug #132036. I don't really understand
why these artefacts were happening in the first place, because
in theory art_vpath_perturb should not do any harm.
Also properly close closed polygons.
Hopefully fixes#132036, please test this.
2004-01-19 Sven Neumann <sven@gimp.org>
* app/*/*.c: include "libgimpbase/gimpbase.h" where needed; removed
now unnecessary inclusions of "file/file-utils.h".
2004-01-19 Sven Neumann <sven@gimp.org>
* app/file/file-utils.[ch]: removed file_utils_filename_to_utf8() ...
* libgimpbase/gimputils.[ch]: ... and added it here as
gimp_filename_to_utf8(). Added some docs that promise less than
the current implementation holds so that we can change the
implementation later.
* app/*/*.c: use gimp_filename_to_utf8() where
file_utils_filenames_to_utf8() has been used before.
* libgimpbase/gimpbase.def: changed accordingly.
* configure.in: reset GIMP_INTERFACE_AGE.
2004-01-18 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.c (gimp_image_add_layer,remove_layer): in the
spirit of the fix for bug #131721 below, don't try to figure
manually if "alpha_changed" needs to be emitted but simply compare
the old and new values of gimp_image_has_alpha().
* app/gui/preferences-dialog.c (prefs_dialog_new): follow
"foo-window-type" -> "foo-window-hint" change.
2004-01-18 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.[ch] (gimp_image_get_color): also return the
color's alpha byte if it has alpha, not only the converted RGB
values. Return OPAQUE_OPACITY for drawables without alpha.
Fixes bug #131706.
* app/core/gimpdrawable.c (gimp_drawable_get_color_at)
* app/core/gimpimage-contiguous-region.c
(gimp_image_contiguous_region_by_color)
* app/core/gimpimage-projection.c (gimp_image_projection_get_color_at)
* app/core/gimpimagemap.c (gimp_image_map_get_color_at)
* app/paint/gimpclone.c (gimp_clone_line_image): removed separate
handling of the alpha byte from all users of gimp_image_get_color().
2004-01-18 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.c (gimp_image_set_active_layer): don't allow
to select anything but the floating selection. Fixes bug #128025.
(gimp_image_set_active_layer,channel,vectors): allow to pass NULL
to unselect the active item. Removed the silly feature that
passing some random item of another image would select the first
item in the list (was unused anyway).
(gimp_image_unset_active_channel): use gimp_image_set_active_channel()
now that it accepts NULL.
(gimp_image_add_layer,channel,vectors): cleaned up / simplified.
(gimp_image_remove_layer,channel,vectors): cleanup,
simplification, use gimp_image_set_active_layer,channel,vectors()
now that they accept NULL, make sure the item next to the removed
item becomes the active one (and not the first in the list, which
was a severe usability problem in the dialogs).
* app/core/gimpimage-undo-push.c (undo_pop_layer,channel): pass
NULL to the set_active functions, cleanup.
* app/core/gimpimage-duplicate.c: attach the floating selection
before setting the active layer. Code relied on broken
gimp_image_set_active_layer() behaviour before.
* app/core/gimplayer-floating-sel.c: no need to set
gimage->floating_sel before calling gimp_image_add_layer(). The
weird GUI mentioned in the comment existed in 1.2 only.
* app/display/gimpdisplayshell-layer-select.c (layer_select_advance):
don't assume that setting the active_layer always succeeds.
* tools/pdbgen/pdb/image.pdb: behave as the documentation says
and return an execution error if setting the active layer or
channel failed.
Unrelated:
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/layer.pdb: removed leftover cruft from the old
guchar based color API.
* tools/pdbgen/pdb/channel.pdb: simplified code which handles the
channel's color.
* app/pdb/channel_cmds.c
* app/pdb/image_cmds.c: regenerated.
2004-01-18 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-undo-push.c (undo_pop_layer): removed broken
code which tried to figure manually whether "alpha_changed" should
be emitted. Instead, simply compare the return values of
gimp_image_has_alpha() before and after adding/removing the
layer. Fixes bug #131721.
2004-01-17 Henrik Brix Andersen <brix@gimp.org>
Finally fixed bug #125864:
* app/core/gimpimage-guides.c (gimp_image_find_guide): iterate
over the entire list of guides to determine the closest one.
* app/core/gimpimage-snap.c: use gdoubles instead of gints for
dist and mindist variables to make sure grid and guides with 1px
spacings work as expected.
2004-01-15 Michael Natterer <mitch@gimp.org>
Fixed bug #78732 (don't paste off screen):
* app/display/gimpdisplayshell-transform.[ch]: added new function
gimp_display_shell_untransform_viewport() which returns the
visible rectangle of the image in image coordinates.
* app/core/gimp-edit.[ch] (gimp_edit_paste): added viewport
parameters and changed positioning of the pasted layer as follows:
- if there is a selection, center on the selection (just as before).
- if there is no viewport, center on the active drawable.
- if the viewport intersects with the active drawable, center
on the intersection.
- if the viewport does *not* intersect with the active drawable,
center on the active drawable (off-screen, but better than pasting
something that will be invisible due to floating selection clipping).
- if there is no active drawable, center on the viewport.
- if there is no active drawable and no viewport, center on the image.
* app/widgets/gimpbufferview.c (gimp_buffer_view_paste_clicked)
(gimp_buffer_view_paste_into_clicked)
* app/display/gimpdisplayshell-dnd.c (gimp_display_shell_drop_buffer)
* app/gui/edit-commands.c (edit_paste_cmd_callback)
(edit_paste_into_cmd_callback): ask the shell for the viewport
and pass it to gimp_edit_paste().
* app/display/gimpdisplayshell-dnd.c
(gimp_display_shell_drop_drawable): center the created layer on
the viewport.
* app/tools/gimpmovetool.c (gimp_move_tool_button_release): use
gimp_display_shell_untransform_viewport() (its code was taken from
here).
* tools/pdbgen/pdb/edit.pdb: pass "no viewport" to gimp_edit_paste().
* app/pdb/edit_cmds.c: regenerated.
2004-01-15 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage.c: moved initialization of the
gimage->visible[] and gimage->active[] arrays from
gimp_image_new() to gimp_image_init(). Use gimp_rgba_set()
to initialize gimage->qmask_color.
2004-01-14 Dave Neary <bolsh@gimp.org>
* app/core/gimpimage.c: get the type of the drawable, not the
image, when transforming a TempBuf, making dragging & dropping
patterns on layer masks work correctly. Fixes bug #131146.
2004-01-14 Michael Natterer <mitch@gimp.org>
Some code review:
* app/core/gimpimage.c: named the gint paramater in all
colormap_changed related functions to "color_index", fixed typo in
parasite undo description, moved some variables to local scopes,
changed the layer raise/lower functions to look like the channel
and vector ones, cosmetics.
* app/core/gimpimage-colorhash.c: removed trailing whitespace,
initialize / reset more stuff to 0, cosmetics.
2004-01-14 Tor Lillqvist <tml@iki.fi>
* app/file/file-utils.[ch]: Add new function
file_utils_filename_to_utf8(), which is to be used when converting
file names (which are kept in the on-disk encoding) to UTF-8 for
passing to GTK, or to g_print() etc.
* app/*/*.c: Call file_utils_filename_to_utf8(). Should fix most
of the warnings generated by non-UTF8 pathnames. See #130118.
* libgimpbase/gimpenv.b: Document that gimp_directory() etc return
strings in the on-disk encoding.
* libgimpmodule/gimpmodule.c: Convert filenames to UTF-8 (using
g_filename_to_utf8()) before passing to g_print().
2004-01-13 Michael Natterer <mitch@gimp.org>
* app/base/gimphistogram.[ch]: renamed gimp_histogram_nchannels()
to gimp_histogram_n_channels().
* app/core/gimpdrawable-histogram.c: removed silly double negation
logic. Cleanup.
* app/widgets/gimphistogrameditor.c
* app/widgets/gimphistogramview.c: adjust the GimpHistogramChannel
for GRAYA images to make sure we pick alpha from the right slot.
* app/tools/gimpcurvestool.c
* app/tools/gimplevelstool.c: removed the same hack here and call
gimp_histogram_view_set_channel() with the correct enum value.
* tools/pdbgen/pdb/color.pdb (levels, curves, histogram): fiddle
with enum values here too so GRAY* drawables produce the correct
results.
Fixed precondition checks and set "success" in a uniform way all
over the place.
Use gimp_drawable_calculate_histogram() instead of duplicating its
code here.
(started with a patch from Pedro Gimeno. Fixes bug #109078)
* app/pdb/color_cmds.c: regenerated.