Commit 20d61977 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

added a simple image editor

parent ca765a8a
2002-10-28 Paolo Bacchilega <paolo.bacch@tin.it>
* added a simple image editor.
2002-10-12 Paolo Bacchilega <paolo.bacch@tin.it>
* src/gthumb-window.c (hide_sidebar_idle, file_button_press_cb):
make double-clicking on a thumbnail hide the sidebar. Use a
timeout to avoid that the viewer gets the button press event.
* src/dlg-image-prop.c (dlg_image_prop_new):
* src/gthumb.glade: define the image properties window as a window
not as a dialog.
* libgthumb/preferences.h:
* libgthumb/file-list.c (file_list_update_thumbs):
* libgthumb/thumb-loader.c (thumb_loader_init): add a gconf key
for the max file size over which thumbnails are not generated.
* libgthumb/thumb-loader.c (thumb_loader_start): emit DONE instead
of ERROR when the file size exceeds the limit.
2002-10-09 Paolo Bacchilega <paolo.bacch@tin.it>
* src/dlg-catalog.c (dlg_move_to_catalog_directory)
(dlg_add_to_catalog): center dialog on parent.
* src/dlg-image-prop.c:
* src/gthumb.glade: make the properties dialog navigable with the
keyword.
2002-10-08 Paolo Bacchilega <paolo.bacch@tin.it>
* src/commands-impl.c (folder_rename): remove the VFS monitor before
renaming a folder.
2002-10-07 Paolo Bacchilega <paolo.bacch@tin.it>
* src/gthumb-ui.xml: add stock icon to the Go_Stop command.
* src/gthumb-window.c (stop__step5, window_update_sensitivity):
update the Go_Stop command sensitivity when appropriate.
* src/gthumb-window.c (item_toggled_handler, window_new)
* src/gthumb-window.h: add notifications for
PREF_UI_TOOLBAR_VISIBLE and PREF_UI_STATUSBAR_VISIBLE preferences.
2002-10-06 Paolo Bacchilega <paolo.bacch@tin.it>
* libgthumb/catalog-png-exporter.c (paint_frame): remove special dirs
from the destination directory before getting the relative path.
2002-10-05 Paolo Bacchilega <paolo.bacch@tin.it>
* Ported to gconf.
......
......@@ -11,3 +11,5 @@
#undef HAVE_RENDER
#undef HAVE_LIBEXIF
#undef HAVE_LIBJPEG
#undef HAVE_PROGRESSIVE_JPEG
#undef HAVE_LIBTIFF
......@@ -30,6 +30,9 @@ gthumb_image_viewer_SOURCES = \
gthumb_image_viewer_LDADD = \
$(COMPONENT_LIBS) \
$(JPEG_LIBS) \
$(PNG_LIBS) \
$(TIFF_LIBS) \
$(RENDER_LIBS) \
$(top_builddir)/libgthumb/libgthumb.a
......
......@@ -28,6 +28,7 @@
#include "gthumb-init.h"
#include "image-viewer.h"
#include "viewer-control.h"
#include "pixbuf-utils.h"
#include "print-callbacks.h"
#include "viewer-nautilus-view.h"
......@@ -38,7 +39,14 @@ verb_rotate (BonoboUIComponent *component,
const char *cname)
{
ViewerControl *control = callback_data;
image_viewer_alter (control->priv->viewer, ALTER_ROTATE_90);
ImageViewer *viewer = control->priv->viewer;
GdkPixbuf *src_pixbuf;
GdkPixbuf *dest_pixbuf;
src_pixbuf = image_viewer_get_current_pixbuf (viewer);
dest_pixbuf = _gdk_pixbuf_copy_rotate_90 (src_pixbuf, FALSE);
image_viewer_set_pixbuf (viewer, dest_pixbuf);
g_object_unref (dest_pixbuf);
}
......@@ -48,7 +56,14 @@ verb_rotate_180 (BonoboUIComponent *component,
const char *cname)
{
ViewerControl *control = callback_data;
image_viewer_alter (control->priv->viewer, ALTER_ROTATE_180);
ImageViewer *viewer = control->priv->viewer;
GdkPixbuf *src_pixbuf;
GdkPixbuf *dest_pixbuf;
src_pixbuf = image_viewer_get_current_pixbuf (viewer);
dest_pixbuf = _gdk_pixbuf_copy_mirror (src_pixbuf, TRUE, TRUE);
image_viewer_set_pixbuf (viewer, dest_pixbuf);
g_object_unref (dest_pixbuf);
}
......@@ -58,7 +73,14 @@ verb_flip (BonoboUIComponent *component,
const char *cname)
{
ViewerControl *control = callback_data;
image_viewer_alter (control->priv->viewer, ALTER_FLIP);
ImageViewer *viewer = control->priv->viewer;
GdkPixbuf *src_pixbuf;
GdkPixbuf *dest_pixbuf;
src_pixbuf = image_viewer_get_current_pixbuf (viewer);
dest_pixbuf = _gdk_pixbuf_copy_mirror (src_pixbuf, FALSE, TRUE);
image_viewer_set_pixbuf (viewer, dest_pixbuf);
g_object_unref (dest_pixbuf);
}
......@@ -68,7 +90,14 @@ verb_mirror (BonoboUIComponent *component,
const char *cname)
{
ViewerControl *control = callback_data;
image_viewer_alter (control->priv->viewer, ALTER_MIRROR);
ImageViewer *viewer = control->priv->viewer;
GdkPixbuf *src_pixbuf;
GdkPixbuf *dest_pixbuf;
src_pixbuf = image_viewer_get_current_pixbuf (viewer);
dest_pixbuf = _gdk_pixbuf_copy_mirror (src_pixbuf, TRUE, FALSE);
image_viewer_set_pixbuf (viewer, dest_pixbuf);
g_object_unref (dest_pixbuf);
}
......@@ -78,7 +107,15 @@ verb_black_white (BonoboUIComponent *component,
const char *cname)
{
ViewerControl *control = callback_data;
image_viewer_alter (control->priv->viewer, ALTER_GRAY);
ImageViewer *viewer = control->priv->viewer;
GdkPixbuf *src_pixbuf;
GdkPixbuf *dest_pixbuf;
src_pixbuf = image_viewer_get_current_pixbuf (viewer);
dest_pixbuf = gdk_pixbuf_copy (src_pixbuf);
_gdk_pixbuf_desaturate (dest_pixbuf, dest_pixbuf);
image_viewer_set_pixbuf (viewer, dest_pixbuf);
g_object_unref (dest_pixbuf);
}
......
......@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT(gthumb, 1.104.1)
AC_INIT(gthumb, 1.104.2)
AC_CONFIG_SRCDIR(src/main.c)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
......@@ -132,6 +132,10 @@ AC_MSG_CHECKING(for libjpeg)
if test "$jpeg_ok" = yes; then
JPEG_LIBS='-ljpeg'
AC_DEFINE(HAVE_LIBJPEG)
AC_CHECK_LIB(jpeg, jpeg_simple_progression,
AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1,
[Define to 1 if jpeglib supports progressive JPEG.]),
AC_MSG_WARN(JPEG library does not support progressive saving.))
else
AC_MSG_WARN([*** Internal jpegtran will not be built (JPEG library not found) ***])
fi
......@@ -140,6 +144,28 @@ AC_MSG_CHECKING(for libjpeg)
AC_SUBST(JPEG_LIBS)
#
# Checks for libtiff
#
tiff_ok=no
AC_MSG_CHECKING(for libtiff)
if test -z "$TIFF_LIBS"; then
AC_CHECK_LIB(tiff, TIFFWriteScanline,
[AC_CHECK_HEADER(tiffio.h,
tiff_ok=yes,
tiff_ok=no)],
AC_MSG_WARN([*** (TIFF library not found) ***]), -lm)
if test "$tiff_ok" = yes; then
TIFF_LIBS='-ltiff -ljpeg -lz'
AC_DEFINE(HAVE_LIBTIFF)
else
AC_MSG_WARN([*** (TIFF library not found) ***])
fi
fi
AC_SUBST(TIFF_LIBS)
#
# Checks for Xft/XRender
#
......@@ -243,7 +269,8 @@ Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
Have Render: ${have_render}
Have EXIF: ${have_libexif}
Internal JPEGTRAN: ${jpeg_ok}
Have libexif: ${have_libexif}
Have libjpeg: ${jpeg_ok}
Have libtiff: ${tiff_ok}
"
......@@ -4,4 +4,4 @@ gthumb
can_open_multiple_files=true
expects_uris=false
requires_terminal=false
mime_types=x-directory/normal,image/jpeg,image/gif,image/png,image/tiff,image/x-bmp,image/x-png,image/xpm
mime_types=x-directory/normal,image/jpeg,image/gif,image/png,image/tiff,image/x-bmp,image/x-png,image/xpm,image/x-tga
......@@ -42,6 +42,7 @@ HEADER_FILES = \
gthumb-init.h \
gthumb-info-bar.h \
gthumb-slide.h \
gthumb-stock.h \
gthumb-text-item.h \
gtk-utils.h \
image-list.h \
......@@ -88,6 +89,7 @@ libgthumb_a_SOURCES = \
gthumb-init.c \
gthumb-info-bar.c \
gthumb-slide.c \
gthumb-stock.c \
gthumb-text-item.c \
gtk-utils.c \
image-list.c \
......
......@@ -1592,6 +1592,7 @@ paint_frame (CatalogPngExporter *ce,
GnomeVFSFileSize temp;
char *line;
char *rel_path;
char *dest_dir;
switch (ce->frame_style) {
case FRAME_STYLE_NONE:
......@@ -1662,7 +1663,10 @@ paint_frame (CatalogPngExporter *ce,
if (! ce->write_image_map || (ce->imap_handle == NULL))
return;
rel_path = get_path_relative_to_dir (filename, ce->directory);
dest_dir = remove_special_dirs_from_path (ce->directory);
rel_path = get_path_relative_to_dir (filename, dest_dir);
g_free (dest_dir);
line = g_strdup_printf ("<AREA SHAPE=\"RECT\" COORDS=\"%d,%d,%d,%d\" HREF=\"%s\">\n",
frame_rect->x,
frame_rect->y,
......
......@@ -37,7 +37,7 @@
#include "image-list.h"
#include "thumb-loader.h"
#include "typedefs.h"
#include "icons/img_unknown.xpm"
#include "icons/pixbufs.h"
#define THUMB_BORDER 19
......@@ -139,9 +139,16 @@ set_unknown_icon (FileList *file_list, gint pos)
static void
update_thumb_in_clist (FileList *file_list)
{
GdkPixbuf *pixbuf;
pixbuf = thumb_loader_get_pixbuf (file_list->thumb_loader);
if (pixbuf == NULL)
return;
image_list_set_image_pixbuf (IMAGE_LIST (file_list->ilist),
file_list->thumb_pos,
thumb_loader_get_pixbuf (file_list->thumb_loader));
pixbuf);
}
......@@ -242,7 +249,7 @@ file_list_new ()
file_list->interrupt_done_data = NULL;
if (unknown_pixbuf == NULL)
unknown_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) img_unknown_xpm);
unknown_pixbuf = gdk_pixbuf_new_from_inline (-1, unknown_48_rgba, FALSE, NULL);
else
g_object_ref (G_OBJECT (unknown_pixbuf));
......@@ -610,6 +617,13 @@ add_list__get_file_info_done_cb (GnomeVFSAsyncHandle *handle,
if (gfi_data->filtered != NULL) {
image_list_freeze (IMAGE_LIST (ilist));
for (scan = file_list->list; scan; scan = scan->next) {
FileData *fd = scan->data;
fd->thumb = TRUE;
fd->error = FALSE;
}
for (scan = gfi_data->filtered; scan; scan = scan->next) {
FileData *fd = scan->data;
int pos;
......@@ -1418,11 +1432,27 @@ file_list_set_thumbs_size (FileList *file_list,
/* -- -- */
static void
file_list_update_current_thumb (FileList *file_list)
{
if (path_is_file (file_list->thumb_fd->path)) {
thumb_loader_set_path (file_list->thumb_loader,
file_list->thumb_fd->path);
thumb_loader_start (file_list->thumb_loader);
} else /* Error: the file does not exists. */
g_signal_emit_by_name (G_OBJECT (file_list->thumb_loader),
"error",
0,
file_list);
}
void
file_list_update_thumb (FileList *file_list,
int pos)
{
FileData *fd;
FileData *fd;
if (! file_list->enable_thumbs)
return;
......@@ -1431,9 +1461,13 @@ file_list_update_thumb (FileList *file_list,
file_data_update (fd);
fd->error = FALSE;
fd->thumb = FALSE;
file_list->thumb_pos = pos;
/* file_list->thumbs_num++; */
file_list->thumb_fd = fd;
file_list->doing_thumbs = TRUE;
file_list_update_next_thumb (file_list);
/* file_list->doing_thumbs = FALSE; FIXME */
file_list_update_current_thumb (file_list);
}
......@@ -1441,23 +1475,31 @@ void
file_list_update_thumb_list (FileList *file_list,
GList *list)
{
FileData *fd;
ImageList *ilist;
GList *scan;
ImageList *ilist;
if (! file_list->enable_thumbs)
return;
for (scan = file_list->list; scan; scan = scan->next) {
FileData *fd = scan->data;
fd->thumb = TRUE;
fd->error = FALSE;
}
ilist = IMAGE_LIST (file_list->ilist);
for (scan = list; scan; scan = scan->next) {
char *path = scan->data;
int pos = GPOINTER_TO_INT (scan->data);
char *path = scan->data;
FileData *fd;
int pos;
pos = file_list_pos_from_path (file_list, path);
if (pos == -1)
continue;
fd = image_list_get_image_data (ilist, pos);
file_data_update (fd);
fd->error = FALSE;
fd->thumb = FALSE;
......@@ -1551,15 +1593,22 @@ file_list_update_next_thumb (FileList *file_list)
file_list->thumbs_num++;
file_list->thumb_fd = fd;
file_list_update_current_thumb (file_list);
/* FIXME */
#if 0
if (path_is_file (file_list->thumb_fd->path)) {
thumb_loader_set_path (file_list->thumb_loader,
file_list->thumb_fd->path);
thumb_loader_start (file_list->thumb_loader);
} else /* Error: the file does not exists. */
g_signal_emit_by_name (G_OBJECT (file_list->thumb_loader),
"error",
0,
file_list);
#endif
}
......@@ -1571,6 +1620,8 @@ file_list_update_thumbs (FileList *file_list)
if (! file_list->enable_thumbs)
return;
thumb_loader_set_max_file_size (THUMB_LOADER (file_list->thumb_loader), eel_gconf_get_integer (PREF_THUMBNAIL_LIMIT));
for (scan = file_list->list; scan; scan = scan->next) {
FileData *fd = scan->data;
fd->thumb = FALSE;
......
......@@ -1274,7 +1274,7 @@ remove_special_dirs_from_path (const char *path)
pathv = g_strsplit (path, "/", 0);
/* start from 1 to remove the first / that will be readded later. */
/* start from 1 to remove the first / that will be re-added later. */
for (i = 1; pathv[i] != NULL; i++) {
if (strcmp (pathv[i], ".") == 0) {
/* nothing to do. */
......
......@@ -231,6 +231,39 @@ eel_gconf_get_string (const char *key)
}
void
eel_gconf_set_locale_string (const char *key,
const char *string_value)
{
char *utf8;
utf8 = g_locale_to_utf8 (string_value, -1, 0, 0, 0);
if (utf8 != NULL) {
eel_gconf_set_string (key, utf8);
g_free (utf8);
}
}
char *
eel_gconf_get_locale_string (const char *key)
{
char *utf8;
char *result;
utf8 = eel_gconf_get_string (key);
if (utf8 == NULL)
return NULL;
result = g_locale_from_utf8 (utf8, -1, 0, 0, 0);
g_free (utf8);
return result;
}
void
eel_gconf_set_string_list (const char *key,
const GSList *slist)
......@@ -274,6 +307,50 @@ eel_gconf_get_string_list (const char *key)
}
GSList *
eel_gconf_get_locale_string_list (const char *key)
{
GSList *utf8_slist, *slist, *scan;
utf8_slist = eel_gconf_get_string_list (key);
slist = NULL;
for (scan = utf8_slist; scan; scan = scan->next) {
char *utf8 = scan->data;
char *locale = g_locale_from_utf8 (utf8, -1, 0, 0, 0);
slist = g_slist_prepend (slist, locale);
}
g_slist_foreach (utf8_slist, (GFunc) g_free, NULL);
g_slist_free (utf8_slist);
return g_slist_reverse (slist);
}
void
eel_gconf_set_locale_string_list (const char *key,
const GSList *string_list_value)
{
GSList *utf8_slist;
const GSList *scan;
utf8_slist = NULL;
for (scan = string_list_value; scan; scan = scan->next) {
char *locale = scan->data;
char *utf8 = g_locale_to_utf8 (locale, -1, 0, 0, 0);
utf8_slist = g_slist_prepend (utf8_slist, utf8);
}
utf8_slist = g_slist_reverse (utf8_slist);
eel_gconf_set_string_list (key, utf8_slist);
g_slist_foreach (utf8_slist, (GFunc) g_free, NULL);
g_slist_free (utf8_slist);
}
gboolean
eel_gconf_is_default (const char *key)
{
......
......@@ -74,11 +74,21 @@ char * eel_gconf_get_string (const char *key);
void eel_gconf_set_string (const char *key,
const char *string_value);
char * eel_gconf_get_locale_string (const char *key);
void eel_gconf_set_locale_string (const char *key,
const char *string_value);
GSList * eel_gconf_get_string_list (const char *key);
void eel_gconf_set_string_list (const char *key,
const GSList *string_list_value);
GSList * eel_gconf_get_locale_string_list(const char *key);
void eel_gconf_set_locale_string_list(const char *key,
const GSList *string_list_value);
gboolean eel_gconf_is_default (const char *key);
gboolean eel_gconf_monitor_add (const char *directory);
......
......@@ -26,19 +26,19 @@
#include "catalog.h"
#include "file-utils.h"
#include "gthumb-init.h"
#include "gthumb-stock.h"
#include "preferences.h"
#include "image-viewer.h"
#include "image-list.h"
#include "typedefs.h"
Preferences preferences;
Preferences preferences;
static void
ensure_directories_exist ()
{
gchar *path;
char *path;
path = g_strconcat (g_get_home_dir (),
"/",
......@@ -59,9 +59,9 @@ ensure_directories_exist ()
void
gthumb_init ()
{
/* initialize preferences. */
ensure_directories_exist ();
preferences_init ();
gthumb_stock_init ();
}
......
......@@ -24,8 +24,8 @@
#include <gdk/gdk.h>
#define FRAME_WIDTH 3
#define FRAME_SHADOW_OFFSET 6
#define IMAGE_SHADOW_OFFSET 10
#define FRAME_SHADOW_OFFSET 4
#define IMAGE_SHADOW_OFFSET 8
#define INOUT_SHADOW_OFFSET 3
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2001 The Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <gtk/gtk.h>
#include "gthumb-stock.h"
#include "icons/pixbufs.h"
static struct {
const