mirror of https://github.com/GNOME/gimp.git
Cleaned up and improved the message system:
2003-06-13 Michael Natterer <mitch@gimp.org> Cleaned up and improved the message system: * app/core/gimp.[ch]: added "const gchar *domain" to GimpMessageFunc (a NULL domain means the message is from the GIMP core, everything else is a plug-in). * app/errors.c: pass "domain == NULL" to gimp_message(). * tools/pdbgen/pdb/message.pdb: derive the message domain from the current plug-in's menu_path (evil hack but works reasonably well). * app/pdb/message_cmds.c: regenerated. * app/widgets/gimpwidgets-utils.[ch] (gimp_message_box): added a header showing the message domain and changed the dialog layout to follow the HIG more closely. * app/gui/error-console-dialog.[ch]: removed. * app/widgets/gimperrorconsole.[ch] * app/gui/error-console-commands.[ch] * app/gui/error-console-menu.[ch]: new files containing a re-implementation of the error console dialog. * app/gui/Makefile.am * app/gui/dialogs-constructors.c * app/gui/gui.c * app/gui/menus.c * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/display/gimpprogress.c: added more spacing and removed the separator (more HIG compliant). * plug-ins/[most plug-ins].c: Changed lots of messages and progress strings: - Removed plug-in names from messages since that's automatically covered by "domain" now. - Put all filenames in ''. - Changed "Loading" to "Opening". - Added "..." to all progress messages. - Cleaned up all file open/save error messages to look the same and include g_strerror(errno). - Removed special casing for progress bars and *always* show them, not only if run_mode != GIMP_RUN_NONINTERACTIVE (we can't expect all plug-ins to do this correctly but need to hack the core to sort out unwanted progress bars). Unrelated: - Cleaned up indentation, spacing, #includes, coding style and other stuff while I was at all these files.
This commit is contained in:
parent
9aa41ceceb
commit
5e950b5501
56
ChangeLog
56
ChangeLog
|
@ -1,3 +1,59 @@
|
|||
2003-06-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Cleaned up and improved the message system:
|
||||
|
||||
* app/core/gimp.[ch]: added "const gchar *domain" to
|
||||
GimpMessageFunc (a NULL domain means the message is from the GIMP
|
||||
core, everything else is a plug-in).
|
||||
|
||||
* app/errors.c: pass "domain == NULL" to gimp_message().
|
||||
|
||||
* tools/pdbgen/pdb/message.pdb: derive the message domain from the
|
||||
current plug-in's menu_path (evil hack but works reasonably well).
|
||||
|
||||
* app/pdb/message_cmds.c: regenerated.
|
||||
|
||||
* app/widgets/gimpwidgets-utils.[ch] (gimp_message_box): added a
|
||||
header showing the message domain and changed the dialog layout to
|
||||
follow the HIG more closely.
|
||||
|
||||
* app/gui/error-console-dialog.[ch]: removed.
|
||||
|
||||
* app/widgets/gimperrorconsole.[ch]
|
||||
* app/gui/error-console-commands.[ch]
|
||||
* app/gui/error-console-menu.[ch]: new files containing a
|
||||
re-implementation of the error console dialog.
|
||||
|
||||
* app/gui/Makefile.am
|
||||
* app/gui/dialogs-constructors.c
|
||||
* app/gui/gui.c
|
||||
* app/gui/menus.c
|
||||
* app/widgets/Makefile.am
|
||||
* app/widgets/widgets-types.h: changed accordingly.
|
||||
|
||||
* app/display/gimpprogress.c: added more spacing and removed the
|
||||
separator (more HIG compliant).
|
||||
|
||||
* plug-ins/[most plug-ins].c: Changed lots of messages and
|
||||
progress strings:
|
||||
|
||||
- Removed plug-in names from messages since that's automatically
|
||||
covered by "domain" now.
|
||||
- Put all filenames in ''.
|
||||
- Changed "Loading" to "Opening".
|
||||
- Added "..." to all progress messages.
|
||||
- Cleaned up all file open/save error messages to look the
|
||||
same and include g_strerror(errno).
|
||||
- Removed special casing for progress bars and *always* show them,
|
||||
not only if run_mode != GIMP_RUN_NONINTERACTIVE (we can't expect
|
||||
all plug-ins to do this correctly but need to hack the core to
|
||||
sort out unwanted progress bars).
|
||||
|
||||
Unrelated:
|
||||
|
||||
- Cleaned up indentation, spacing, #includes, coding style and
|
||||
other stuff while I was at all these files.
|
||||
|
||||
2003-06-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gui/file-save-dialog.c (file_save_ok_callback): removed
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
|
||||
#include "error-console-commands.h"
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
error_console_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (console->clear_button))
|
||||
gtk_button_clicked (GTK_BUTTON (console->clear_button));
|
||||
}
|
||||
|
||||
void
|
||||
error_console_save_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (console->save_button))
|
||||
gtk_button_clicked (GTK_BUTTON (console->save_button));
|
||||
}
|
||||
|
||||
void
|
||||
error_console_save_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (console->save_button))
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (console->save_button),
|
||||
GDK_SHIFT_MASK);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ERROR_CONSOLE_COMMANDS_H__
|
||||
#define __ERROR_CONSOLE_COMMANDS_H__
|
||||
|
||||
|
||||
void error_console_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void error_console_save_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void error_console_save_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
|
||||
#endif /* __ERROR_CONSOLE_COMMANDS_H__ */
|
|
@ -885,6 +885,7 @@ gimp_unset_busy (Gimp *gimp)
|
|||
|
||||
void
|
||||
gimp_message (Gimp *gimp,
|
||||
const gchar *domain,
|
||||
const gchar *message)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
@ -895,7 +896,7 @@ gimp_message (Gimp *gimp,
|
|||
case GIMP_ERROR_CONSOLE:
|
||||
if (gimp->gui_message_func)
|
||||
{
|
||||
gimp->gui_message_func (gimp, message);
|
||||
gimp->gui_message_func (gimp, domain, message);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -904,7 +905,7 @@ gimp_message (Gimp *gimp,
|
|||
break;
|
||||
}
|
||||
|
||||
g_printerr ("%s: %s\n", GIMP_OBJECT (gimp)->name, message);
|
||||
g_printerr ("%s: %s\n", domain ? domain : GIMP_OBJECT (gimp)->name, message);
|
||||
}
|
||||
|
||||
GimpImage *
|
||||
|
|
|
@ -30,6 +30,7 @@ typedef GimpObject * (* GimpCreateDisplayFunc) (GimpImage *gimage,
|
|||
typedef void (* GimpSetBusyFunc) (Gimp *gimp);
|
||||
typedef void (* GimpUnsetBusyFunc) (Gimp *gimp);
|
||||
typedef void (* GimpMessageFunc) (Gimp *gimp,
|
||||
const gchar *domain,
|
||||
const gchar *message);
|
||||
|
||||
|
||||
|
@ -184,6 +185,7 @@ void gimp_set_busy_until_idle (Gimp *gimp);
|
|||
void gimp_unset_busy (Gimp *gimp);
|
||||
|
||||
void gimp_message (Gimp *gimp,
|
||||
const gchar *domain,
|
||||
const gchar *message);
|
||||
|
||||
GimpImage * gimp_create_image (Gimp *gimp,
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "widgets/gimpdataeditor.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
#include "widgets/gimpimagedock.h"
|
||||
#include "widgets/gimpimageview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
|
@ -78,7 +79,6 @@
|
|||
#include "device-status-dialog.h"
|
||||
#include "dialogs.h"
|
||||
#include "dialogs-constructors.h"
|
||||
#include "error-console-dialog.h"
|
||||
#include "file-commands.h"
|
||||
#include "file-new-dialog.h"
|
||||
#include "layers-commands.h"
|
||||
|
@ -284,7 +284,7 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
if (view)
|
||||
return NULL;
|
||||
|
||||
view = error_console_create (context->gimp);
|
||||
view = gimp_error_console_new (context->gimp, factory->menu_factory);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
|
|
|
@ -144,8 +144,11 @@ gimp_progress_start (GimpDisplay *gdisp,
|
|||
|
||||
NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
|
||||
gtk_window_set_resizable (GTK_WINDOW (progress->dialog), FALSE);
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (progress->dialog), FALSE);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (progress->dialog)->vbox),
|
||||
vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
@ -154,12 +157,13 @@ gimp_progress_start (GimpDisplay *gdisp,
|
|||
_("Please wait..."));
|
||||
gtk_misc_set_alignment (GTK_MISC (progress->dialog_label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), progress->dialog_label,
|
||||
FALSE, TRUE, 0);
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (progress->dialog_label);
|
||||
|
||||
progress->progressbar = gtk_progress_bar_new ();
|
||||
gtk_widget_set_size_request (progress->progressbar, 150, 20);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), progress->progressbar, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), progress->progressbar,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (progress->progressbar);
|
||||
|
||||
gtk_widget_show (progress->dialog);
|
||||
|
|
|
@ -60,7 +60,7 @@ gimp_message_log_func (const gchar *log_domain,
|
|||
|
||||
if (! console_messages && GIMP_IS_GIMP (gimp))
|
||||
{
|
||||
gimp_message (gimp, message);
|
||||
gimp_message (gimp, NULL, message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@ dialogs_sources = \
|
|||
dialogs.h \
|
||||
dialogs-constructors.c \
|
||||
dialogs-constructors.h \
|
||||
error-console-dialog.c \
|
||||
error-console-dialog.h \
|
||||
file-dialog-utils.c \
|
||||
file-dialog-utils.h \
|
||||
file-new-dialog.c \
|
||||
|
@ -95,6 +93,10 @@ menus_sources = \
|
|||
drawable-commands.h \
|
||||
edit-commands.c \
|
||||
edit-commands.h \
|
||||
error-console-commands.c \
|
||||
error-console-commands.h \
|
||||
error-console-menu.c \
|
||||
error-console-menu.h \
|
||||
file-commands.c \
|
||||
file-commands.h \
|
||||
file-open-menu.c \
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "widgets/gimpdataeditor.h"
|
||||
#include "widgets/gimpdatafactoryview.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
#include "widgets/gimpimagedock.h"
|
||||
#include "widgets/gimpimageview.h"
|
||||
#include "widgets/gimpitemtreeview.h"
|
||||
|
@ -78,7 +79,6 @@
|
|||
#include "device-status-dialog.h"
|
||||
#include "dialogs.h"
|
||||
#include "dialogs-constructors.h"
|
||||
#include "error-console-dialog.h"
|
||||
#include "file-commands.h"
|
||||
#include "file-new-dialog.h"
|
||||
#include "layers-commands.h"
|
||||
|
@ -284,7 +284,7 @@ dialogs_error_console_get (GimpDialogFactory *factory,
|
|||
if (view)
|
||||
return NULL;
|
||||
|
||||
view = error_console_create (context->gimp);
|
||||
view = gimp_error_console_new (context->gimp, factory->menu_factory);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (view), (gpointer *) &view);
|
||||
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
|
||||
#include "error-console-commands.h"
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
error_console_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (console->clear_button))
|
||||
gtk_button_clicked (GTK_BUTTON (console->clear_button));
|
||||
}
|
||||
|
||||
void
|
||||
error_console_save_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (console->save_button))
|
||||
gtk_button_clicked (GTK_BUTTON (console->save_button));
|
||||
}
|
||||
|
||||
void
|
||||
error_console_save_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (console->save_button))
|
||||
gimp_button_extended_clicked (GIMP_BUTTON (console->save_button),
|
||||
GDK_SHIFT_MASK);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ERROR_CONSOLE_COMMANDS_H__
|
||||
#define __ERROR_CONSOLE_COMMANDS_H__
|
||||
|
||||
|
||||
void error_console_clear_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void error_console_save_all_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
void error_console_save_selection_cmd_callback (GtkWidget *widget,
|
||||
gpointer data,
|
||||
guint action);
|
||||
|
||||
|
||||
#endif /* __ERROR_CONSOLE_COMMANDS_H__ */
|
|
@ -1,395 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* errorconsole.c - text window for collecting error messages
|
||||
* Copyright (C) 1998 Nick Fetchak <nuke@bayside.net>
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR _S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "error-console-dialog.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ERRORS_ALL,
|
||||
ERRORS_SELECTION
|
||||
} ErrorScope;
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void error_console_destroy_callback (gpointer data);
|
||||
static gboolean text_clicked_callback (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkMenu *menu);
|
||||
static void error_console_clear_callback (GtkWidget *widget,
|
||||
GtkTextBuffer *buffer);
|
||||
static void error_console_write_all_callback (GtkWidget *widget,
|
||||
GtkTextBuffer *buffer);
|
||||
static void error_console_write_selection_callback (GtkWidget *widget,
|
||||
GtkTextBuffer *buffer);
|
||||
|
||||
static void error_console_create_file_dialog (GtkTextBuffer *buffer,
|
||||
ErrorScope textscope);
|
||||
static void error_console_file_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gboolean error_console_write_file (GtkTextBuffer *text_buffer,
|
||||
const gchar *path,
|
||||
ErrorScope textscope);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static GtkWidget *error_console = NULL;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
error_console_create (Gimp *gimp)
|
||||
{
|
||||
GtkTextBuffer *text_buffer;
|
||||
GtkWidget *text_view;
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (error_console)
|
||||
return error_console;
|
||||
|
||||
text_buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
error_console = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
g_object_set_data (G_OBJECT (error_console), "text-buffer", text_buffer);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (error_console),
|
||||
(GWeakNotify) error_console_destroy_callback,
|
||||
gimp);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (error_console), scrolled_window);
|
||||
gtk_widget_show (scrolled_window);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (_("Clear Console"));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
g_signal_connect (menuitem, "activate",
|
||||
G_CALLBACK (error_console_clear_callback),
|
||||
text_buffer);
|
||||
|
||||
menuitem = gtk_menu_item_new ();
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (_("Write all errors to file..."));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
g_signal_connect (menuitem, "activate",
|
||||
G_CALLBACK (error_console_write_all_callback),
|
||||
text_buffer);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (_("Write selection to file..."));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
g_signal_connect (menuitem, "activate",
|
||||
G_CALLBACK (error_console_write_selection_callback),
|
||||
text_buffer);
|
||||
|
||||
/* The output text widget */
|
||||
text_view = gtk_text_view_new_with_buffer (text_buffer);
|
||||
g_object_unref (text_buffer);
|
||||
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
gtk_widget_show (text_view);
|
||||
|
||||
g_signal_connect (text_view, "button_press_event",
|
||||
G_CALLBACK (text_clicked_callback),
|
||||
menu);
|
||||
|
||||
gimp->message_handler = GIMP_ERROR_CONSOLE;
|
||||
|
||||
return error_console;
|
||||
}
|
||||
|
||||
void
|
||||
error_console_add (Gimp *gimp,
|
||||
const gchar *errormsg)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
if (! error_console)
|
||||
{
|
||||
g_warning ("%s: error_console widget is NULL", G_STRLOC);
|
||||
|
||||
gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
g_message (errormsg);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (errormsg)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter end;
|
||||
|
||||
buffer = g_object_get_data (G_OBJECT (error_console), "text-buffer");
|
||||
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
gtk_text_buffer_place_cursor (buffer, &end);
|
||||
|
||||
gtk_text_buffer_insert_at_cursor (buffer, errormsg, -1);
|
||||
gtk_text_buffer_insert_at_cursor (buffer, "\n", -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
error_console_destroy_callback (gpointer data)
|
||||
{
|
||||
Gimp *gimp;
|
||||
|
||||
gimp = GIMP (data);
|
||||
|
||||
error_console = NULL;
|
||||
|
||||
gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_clicked_callback (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkMenu *menu)
|
||||
{
|
||||
switch (event->button)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
error_console_clear_callback (GtkWidget *widget,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextIter start_iter;
|
||||
GtkTextIter end_iter;
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
||||
|
||||
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
|
||||
}
|
||||
|
||||
static void
|
||||
error_console_write_all_callback (GtkWidget *widget,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
error_console_create_file_dialog (buffer, ERRORS_ALL);
|
||||
}
|
||||
|
||||
static void
|
||||
error_console_write_selection_callback (GtkWidget *widget,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
error_console_create_file_dialog (buffer, ERRORS_SELECTION);
|
||||
}
|
||||
|
||||
static void
|
||||
error_console_create_file_dialog (GtkTextBuffer *buffer,
|
||||
ErrorScope textscope)
|
||||
{
|
||||
GtkFileSelection *filesel;
|
||||
|
||||
if (! gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL) &&
|
||||
textscope == ERRORS_SELECTION)
|
||||
{
|
||||
g_message (_("Cannot save. Nothing is selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
filesel =
|
||||
GTK_FILE_SELECTION (gtk_file_selection_new (_("Save error log to file...")));
|
||||
|
||||
g_object_set_data (G_OBJECT (filesel), "text-buffer",
|
||||
buffer);
|
||||
g_object_set_data (G_OBJECT (filesel), "text-scope",
|
||||
GINT_TO_POINTER (textscope));
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
|
||||
gtk_window_set_wmclass (GTK_WINDOW (filesel), "save_errors", "Gimp");
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (filesel), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (filesel->button_area), 2);
|
||||
|
||||
g_signal_connect_swapped (filesel->cancel_button, "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
filesel);
|
||||
|
||||
g_signal_connect_swapped (filesel, "delete_event",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
filesel);
|
||||
|
||||
g_signal_connect (filesel->ok_button, "clicked",
|
||||
G_CALLBACK (error_console_file_ok_callback),
|
||||
filesel);
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
gimp_help_connect (GTK_WIDGET (filesel),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/error_console.html");
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (filesel));
|
||||
}
|
||||
|
||||
static void
|
||||
error_console_file_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *filesel;
|
||||
const gchar *filename;
|
||||
GtkTextBuffer *buffer;
|
||||
ErrorScope textscope;
|
||||
|
||||
filesel = (GtkWidget *) data;
|
||||
|
||||
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
|
||||
|
||||
buffer = g_object_get_data (G_OBJECT (filesel),
|
||||
"text-buffer");
|
||||
|
||||
textscope = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (filesel),
|
||||
"text-scope"));
|
||||
|
||||
if (! error_console_write_file (buffer, filename, textscope))
|
||||
{
|
||||
g_message (_("Error opening file '%s':\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (filesel);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
error_console_write_file (GtkTextBuffer *text_buffer,
|
||||
const gchar *path,
|
||||
ErrorScope textscope)
|
||||
{
|
||||
GtkTextIter start_iter;
|
||||
GtkTextIter end_iter;
|
||||
gint fd;
|
||||
gint text_length;
|
||||
gint bytes_written;
|
||||
gchar *text_contents;
|
||||
|
||||
fd = open (path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
|
||||
|
||||
if (fd == -1)
|
||||
return FALSE;
|
||||
|
||||
if (textscope == ERRORS_ALL)
|
||||
{
|
||||
gtk_text_buffer_get_bounds (text_buffer, &start_iter, &end_iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_get_selection_bounds (text_buffer, &start_iter, &end_iter);
|
||||
}
|
||||
|
||||
text_contents = gtk_text_buffer_get_text (text_buffer,
|
||||
&start_iter, &end_iter, TRUE);
|
||||
|
||||
text_length = strlen (text_contents);
|
||||
|
||||
if (text_contents && (text_length > 0))
|
||||
{
|
||||
bytes_written = write (fd, text_contents, text_length);
|
||||
|
||||
g_free (text_contents);
|
||||
close (fd);
|
||||
|
||||
if (bytes_written != text_length)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
|
||||
#include "error-console-commands.h"
|
||||
#include "error-console-menu.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
GimpItemFactoryEntry error_console_menu_entries[] =
|
||||
{
|
||||
{ { N_("/Clear Errors"), "",
|
||||
error_console_clear_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_CLEAR },
|
||||
NULL, NULL, NULL },
|
||||
|
||||
{ { "/---", NULL, NULL, 0, "<Separator>", NULL }, NULL, NULL, NULL },
|
||||
|
||||
{ { N_("/Save all Errors to File..."), "",
|
||||
error_console_save_all_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_SAVE_AS },
|
||||
NULL, NULL, NULL },
|
||||
{ { N_("/Save Selection to File..."), "",
|
||||
error_console_save_selection_cmd_callback, 0,
|
||||
"<StockItem>", GTK_STOCK_SAVE_AS },
|
||||
NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
gint n_error_console_menu_entries = G_N_ELEMENTS (error_console_menu_entries);
|
||||
|
||||
|
||||
void
|
||||
error_console_menu_update (GtkItemFactory *factory,
|
||||
gpointer data)
|
||||
{
|
||||
GimpErrorConsole *console;
|
||||
gboolean selection;
|
||||
|
||||
console = GIMP_ERROR_CONSOLE (data);
|
||||
|
||||
selection = gtk_text_buffer_get_selection_bounds (console->text_buffer,
|
||||
NULL, NULL);
|
||||
|
||||
#define SET_SENSITIVE(menu,condition) \
|
||||
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("/Clear Console", TRUE);
|
||||
SET_SENSITIVE ("/Save all Errors to File...", TRUE);
|
||||
SET_SENSITIVE ("/Save Selection to File...", selection);
|
||||
|
||||
#undef SET_SENSITIVE
|
||||
}
|
|
@ -1,9 +1,6 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* errorconsole.h - text window for collecting error messages
|
||||
* Copyright (C) 1998 Nick Fetchak <nuke@bayside.net>
|
||||
*
|
||||
* 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
|
||||
|
@ -19,14 +16,16 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __ERROR_CONSOLE_DIALOG_H__
|
||||
#define __ERROR_CONSOLE_DIALOG_H__
|
||||
#ifndef __ERROR_CONSOLE_MENU_H__
|
||||
#define __ERROR_CONSOLE_MENU_H__
|
||||
|
||||
|
||||
GtkWidget * error_console_create (Gimp *gimp);
|
||||
|
||||
void error_console_add (Gimp *gimp,
|
||||
const gchar *errormsg);
|
||||
extern GimpItemFactoryEntry error_console_menu_entries[];
|
||||
extern gint n_error_console_menu_entries;
|
||||
|
||||
|
||||
#endif /* __ERROR_CONSOLE_DIALOG_H__ */
|
||||
void error_console_menu_update (GtkItemFactory *factory,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __ERROR_CONSOLE_MENU_H__ */
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "widgets/gimpdevices.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimperrorconsole.h"
|
||||
#include "widgets/gimphelp.h"
|
||||
#include "widgets/gimpitemfactory.h"
|
||||
#include "widgets/gimpmenufactory.h"
|
||||
|
@ -53,7 +54,6 @@
|
|||
#include "device-status-dialog.h"
|
||||
#include "dialogs.h"
|
||||
#include "dialogs-commands.h"
|
||||
#include "error-console-dialog.h"
|
||||
#include "gui.h"
|
||||
#include "menus.h"
|
||||
#include "session.h"
|
||||
|
@ -74,6 +74,7 @@ static void gui_threads_leave (Gimp *gimp);
|
|||
static void gui_set_busy (Gimp *gimp);
|
||||
static void gui_unset_busy (Gimp *gimp);
|
||||
static void gui_message (Gimp *gimp,
|
||||
const gchar *domain,
|
||||
const gchar *message);
|
||||
static GimpObject * gui_display_new (GimpImage *gimage,
|
||||
guint scale);
|
||||
|
@ -407,23 +408,31 @@ gui_unset_busy (Gimp *gimp)
|
|||
|
||||
static void
|
||||
gui_message (Gimp *gimp,
|
||||
const gchar *domain,
|
||||
const gchar *message)
|
||||
{
|
||||
switch (gimp->message_handler)
|
||||
if (gimp->message_handler == GIMP_ERROR_CONSOLE)
|
||||
{
|
||||
case GIMP_MESSAGE_BOX:
|
||||
gimp_message_box (message, NULL, NULL);
|
||||
break;
|
||||
GtkWidget *dockable;
|
||||
|
||||
case GIMP_ERROR_CONSOLE:
|
||||
gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
"gimp-error-console", -1);
|
||||
error_console_add (gimp, message);
|
||||
break;
|
||||
dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
|
||||
"gimp-error-console", -1);
|
||||
|
||||
default:
|
||||
break;
|
||||
if (dockable)
|
||||
{
|
||||
GimpErrorConsole *console;
|
||||
|
||||
console = GIMP_ERROR_CONSOLE (GTK_BIN (dockable)->child);
|
||||
|
||||
gimp_error_console_add (console, GIMP_STOCK_WARNING, domain, message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
}
|
||||
|
||||
gimp_message_box (GIMP_STOCK_WARNING, domain, message, NULL, NULL);
|
||||
}
|
||||
|
||||
static GimpObject *
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "colormap-editor-menu.h"
|
||||
#include "dialogs-menu.h"
|
||||
#include "documents-menu.h"
|
||||
#include "error-console-menu.h"
|
||||
#include "file-open-menu.h"
|
||||
#include "file-save-menu.h"
|
||||
#include "file-commands.h"
|
||||
|
@ -225,6 +226,12 @@ menus_init (Gimp *gimp)
|
|||
NULL, qmask_menu_update, TRUE,
|
||||
n_qmask_menu_entries,
|
||||
qmask_menu_entries);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory,
|
||||
"<ErrorConsole>", "error_console",
|
||||
NULL, error_console_menu_update, TRUE,
|
||||
n_error_console_menu_entries,
|
||||
error_console_menu_entries);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "colormap-editor-menu.h"
|
||||
#include "dialogs-menu.h"
|
||||
#include "documents-menu.h"
|
||||
#include "error-console-menu.h"
|
||||
#include "file-open-menu.h"
|
||||
#include "file-save-menu.h"
|
||||
#include "file-commands.h"
|
||||
|
@ -225,6 +226,12 @@ menus_init (Gimp *gimp)
|
|||
NULL, qmask_menu_update, TRUE,
|
||||
n_qmask_menu_entries,
|
||||
qmask_menu_entries);
|
||||
|
||||
gimp_menu_factory_menu_register (global_menu_factory,
|
||||
"<ErrorConsole>", "error_console",
|
||||
NULL, error_console_menu_update, TRUE,
|
||||
n_error_console_menu_entries,
|
||||
error_console_menu_entries);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
@ -29,6 +30,10 @@
|
|||
#include "procedural_db.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "gimp-intl.h"
|
||||
#include "plug-in/plug-in-proc.h"
|
||||
#include "plug-in/plug-in.h"
|
||||
#include "plug-in/plug-ins.h"
|
||||
|
||||
static ProcRecord message_proc;
|
||||
static ProcRecord message_get_handler_proc;
|
||||
|
@ -57,12 +62,56 @@ message_invoker (Gimp *gimp,
|
|||
{
|
||||
if (! g_utf8_validate (message, -1, NULL))
|
||||
{
|
||||
g_warning ("Strings passed to g_message() must be in UTF-8 encoding.");
|
||||
success = FALSE;
|
||||
g_warning ("Strings passed to g_message() must be in UTF-8 encoding.");
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("%s", message);
|
||||
gchar *domain = NULL;
|
||||
|
||||
if (gimp->current_plug_in)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
PlugInProcDef *proc_def = list->data;
|
||||
|
||||
if (&proc_def->db_info == gimp->current_plug_in->proc_rec)
|
||||
{
|
||||
const gchar *progname;
|
||||
|
||||
progname = plug_in_proc_def_get_progname (proc_def);
|
||||
|
||||
if (proc_def->menu_path)
|
||||
{
|
||||
const gchar *path;
|
||||
gchar *ellipses;
|
||||
|
||||
path = dgettext (plug_ins_locale_domain (gimp, progname,
|
||||
NULL),
|
||||
proc_def->menu_path);
|
||||
|
||||
domain = g_path_get_basename (path);
|
||||
|
||||
ellipses = strstr (domain, "...");
|
||||
|
||||
if (ellipses && ellipses == (domain + strlen (domain) - 3))
|
||||
*ellipses = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
domain = g_path_get_basename (progname);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gimp_message (gimp, domain, message);
|
||||
|
||||
g_free (domain);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,8 @@ libappwidgets_a_sources = \
|
|||
gimpeditor.h \
|
||||
gimpenummenu.c \
|
||||
gimpenummenu.h \
|
||||
gimperrorconsole.c \
|
||||
gimperrorconsole.h \
|
||||
gimpfontselection.c \
|
||||
gimpfontselection.h \
|
||||
gimpfontselection-dialog.c \
|
||||
|
|
|
@ -0,0 +1,442 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimperrorconsole.c
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* partly based on errorconsole.c
|
||||
* Copyright (C) 1998 Nick Fetchak <nuke@bayside.net>
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR _S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "gimperrorconsole.h"
|
||||
#include "gimpitemfactory.h"
|
||||
#include "gimpmenufactory.h"
|
||||
#include "gimpwidgets-utils.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static void gimp_error_console_class_init (GimpErrorConsoleClass *klass);
|
||||
static void gimp_error_console_init (GimpErrorConsole *editor);
|
||||
|
||||
static void gimp_error_console_destroy (GtkObject *object);
|
||||
static void gimp_error_console_unmap (GtkWidget *widget);
|
||||
|
||||
static gboolean gimp_error_console_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GimpErrorConsole *console);
|
||||
static void gimp_error_console_clear_clicked (GtkWidget *button,
|
||||
GimpErrorConsole *console);
|
||||
static void gimp_error_console_save_clicked (GtkWidget *button,
|
||||
GimpErrorConsole *console);
|
||||
static void gimp_error_console_save_ext_clicked (GtkWidget *button,
|
||||
GdkModifierType state,
|
||||
GimpErrorConsole *console);
|
||||
static void gimp_error_console_save_ok_clicked (GtkWidget *widget,
|
||||
GimpErrorConsole *console);
|
||||
|
||||
static gboolean gimp_error_console_write_file (GtkTextBuffer *text_buffer,
|
||||
const gchar *path,
|
||||
gboolean selection_only);
|
||||
|
||||
|
||||
static GimpEditorClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_error_console_get_type (void)
|
||||
{
|
||||
static GType view_type = 0;
|
||||
|
||||
if (! view_type)
|
||||
{
|
||||
static const GTypeInfo view_info =
|
||||
{
|
||||
sizeof (GimpErrorConsoleClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_error_console_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpErrorConsole),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_error_console_init,
|
||||
};
|
||||
|
||||
view_type = g_type_register_static (GIMP_TYPE_EDITOR,
|
||||
"GimpErrorConsole",
|
||||
&view_info, 0);
|
||||
}
|
||||
|
||||
return view_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_class_init (GimpErrorConsoleClass *klass)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->destroy = gimp_error_console_destroy;
|
||||
widget_class->unmap = gimp_error_console_unmap;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_init (GimpErrorConsole *console)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
gchar *str;
|
||||
|
||||
console->text_buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
gtk_text_buffer_create_tag (console->text_buffer, "title",
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"scale", PANGO_SCALE_LARGE,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (console->text_buffer, "message",
|
||||
NULL);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (console), scrolled_window);
|
||||
gtk_widget_show (scrolled_window);
|
||||
|
||||
console->text_view = gtk_text_view_new_with_buffer (console->text_buffer);
|
||||
g_object_unref (console->text_buffer);
|
||||
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (console->text_view), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (console->text_view),
|
||||
GTK_WRAP_WORD);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), console->text_view);
|
||||
gtk_widget_show (console->text_view);
|
||||
|
||||
g_signal_connect (console->text_view, "button_press_event",
|
||||
G_CALLBACK (gimp_error_console_button_press),
|
||||
console);
|
||||
|
||||
console->clear_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (console), GTK_STOCK_CLEAR,
|
||||
_("Clear Errors"), NULL,
|
||||
G_CALLBACK (gimp_error_console_clear_clicked),
|
||||
NULL,
|
||||
console);
|
||||
|
||||
str = g_strdup_printf (_("Save all Errors\n"
|
||||
"%s Save Selection"),
|
||||
gimp_get_mod_name_shift ());
|
||||
|
||||
console->save_button =
|
||||
gimp_editor_add_button (GIMP_EDITOR (console), GTK_STOCK_SAVE_AS,
|
||||
str, NULL,
|
||||
G_CALLBACK (gimp_error_console_save_clicked),
|
||||
G_CALLBACK (gimp_error_console_save_ext_clicked),
|
||||
console);
|
||||
|
||||
g_free (str);
|
||||
|
||||
console->filesel = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_destroy (GtkObject *object)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (object);
|
||||
|
||||
if (console->filesel)
|
||||
gtk_widget_destroy (console->filesel);
|
||||
|
||||
console->gimp->message_handler = GIMP_MESSAGE_BOX;
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_unmap (GtkWidget *widget)
|
||||
{
|
||||
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (widget);
|
||||
|
||||
if (console->filesel)
|
||||
gtk_widget_destroy (console->filesel);
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_error_console_new (Gimp *gimp,
|
||||
GimpMenuFactory *menu_factory)
|
||||
{
|
||||
GimpErrorConsole *console;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
|
||||
|
||||
console = g_object_new (GIMP_TYPE_ERROR_CONSOLE, NULL);
|
||||
|
||||
console->gimp = gimp;
|
||||
|
||||
gimp_editor_create_menu (GIMP_EDITOR (console),
|
||||
menu_factory, "<ErrorConsole>", console);
|
||||
|
||||
console->gimp->message_handler = GIMP_ERROR_CONSOLE;
|
||||
|
||||
return GTK_WIDGET (console);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_error_console_add (GimpErrorConsole *console,
|
||||
const gchar *stock_id,
|
||||
const gchar *domain,
|
||||
const gchar *message)
|
||||
{
|
||||
GtkTextIter end;
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *str;
|
||||
|
||||
g_return_if_fail (GIMP_IS_ERROR_CONSOLE (console));
|
||||
g_return_if_fail (stock_id != NULL);
|
||||
g_return_if_fail (message != NULL);
|
||||
|
||||
if (! domain)
|
||||
domain = _("GIMP");
|
||||
|
||||
gtk_text_buffer_get_end_iter (console->text_buffer, &end);
|
||||
|
||||
pixbuf = gtk_widget_render_icon (console->text_view, stock_id,
|
||||
GTK_ICON_SIZE_MENU, NULL);
|
||||
gtk_text_buffer_insert_pixbuf (console->text_buffer, &end, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
gtk_text_buffer_insert (console->text_buffer, &end, " ", -1);
|
||||
|
||||
str = g_strdup_printf (_("%s Message"), domain);
|
||||
gtk_text_buffer_insert_with_tags_by_name (console->text_buffer, &end,
|
||||
str, -1,
|
||||
"title",
|
||||
NULL);
|
||||
g_free (str);
|
||||
|
||||
gtk_text_buffer_insert (console->text_buffer, &end, "\n", -1);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (console->text_buffer, &end,
|
||||
message, -1,
|
||||
"message",
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_insert (console->text_buffer, &end, "\n\n", -1);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
gimp_error_console_button_press (GtkWidget *widget,
|
||||
GdkEventButton *bevent,
|
||||
GimpErrorConsole *console)
|
||||
{
|
||||
if (bevent->button == 3)
|
||||
{
|
||||
gimp_item_factory_popup_with_data (GIMP_EDITOR (console)->item_factory,
|
||||
console, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_clear_clicked (GtkWidget *button,
|
||||
GimpErrorConsole *console)
|
||||
{
|
||||
GtkTextIter start_iter;
|
||||
GtkTextIter end_iter;
|
||||
|
||||
gtk_text_buffer_get_start_iter (console->text_buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (console->text_buffer, &end_iter);
|
||||
|
||||
gtk_text_buffer_delete (console->text_buffer, &start_iter, &end_iter);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_save_clicked (GtkWidget *button,
|
||||
GimpErrorConsole *console)
|
||||
{
|
||||
gimp_error_console_save_ext_clicked (button, 0, console);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_save_ext_clicked (GtkWidget *button,
|
||||
GdkModifierType state,
|
||||
GimpErrorConsole *console)
|
||||
{
|
||||
GtkFileSelection *filesel;
|
||||
|
||||
if (! gtk_text_buffer_get_selection_bounds (console->text_buffer,
|
||||
NULL, NULL) &&
|
||||
(state & GDK_SHIFT_MASK))
|
||||
{
|
||||
g_message (_("Cannot save. Nothing is selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (console->filesel)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (console->filesel));
|
||||
return;
|
||||
}
|
||||
|
||||
console->filesel = gtk_file_selection_new (_("Save Error Log to File"));
|
||||
|
||||
console->save_selection = (state & GDK_SHIFT_MASK) ? TRUE : FALSE;
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (console->filesel),
|
||||
(gpointer *) &console->filesel);
|
||||
|
||||
filesel = GTK_FILE_SELECTION (console->filesel);
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
|
||||
gtk_window_set_wmclass (GTK_WINDOW (filesel), "save_errors", "Gimp");
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (filesel), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (filesel->button_area), 2);
|
||||
|
||||
g_signal_connect_swapped (filesel->cancel_button, "clicked",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
filesel);
|
||||
|
||||
g_signal_connect_swapped (filesel, "delete_event",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
filesel);
|
||||
|
||||
g_signal_connect (filesel->ok_button, "clicked",
|
||||
G_CALLBACK (gimp_error_console_save_ok_clicked),
|
||||
console);
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
gimp_help_connect (GTK_WIDGET (filesel),
|
||||
gimp_standard_help_func,
|
||||
"dialogs/error_console.html");
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (filesel));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_error_console_save_ok_clicked (GtkWidget *widget,
|
||||
GimpErrorConsole *console)
|
||||
{
|
||||
GtkFileSelection *filesel;
|
||||
const gchar *filename;
|
||||
|
||||
filesel = GTK_FILE_SELECTION (console->filesel);
|
||||
|
||||
filename = gtk_file_selection_get_filename (filesel);
|
||||
|
||||
if (! gimp_error_console_write_file (console->text_buffer, filename,
|
||||
console->save_selection))
|
||||
{
|
||||
g_message (_("Error writing file '%s':\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (GTK_WIDGET (filesel));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_error_console_write_file (GtkTextBuffer *text_buffer,
|
||||
const gchar *path,
|
||||
gboolean selection_only)
|
||||
{
|
||||
GtkTextIter start_iter;
|
||||
GtkTextIter end_iter;
|
||||
gint fd;
|
||||
gint text_length;
|
||||
gint bytes_written;
|
||||
gchar *text_contents;
|
||||
|
||||
fd = open (path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
|
||||
|
||||
if (fd == -1)
|
||||
return FALSE;
|
||||
|
||||
if (selection_only)
|
||||
gtk_text_buffer_get_selection_bounds (text_buffer, &start_iter, &end_iter);
|
||||
else
|
||||
gtk_text_buffer_get_bounds (text_buffer, &start_iter, &end_iter);
|
||||
|
||||
text_contents = gtk_text_buffer_get_text (text_buffer,
|
||||
&start_iter, &end_iter, TRUE);
|
||||
|
||||
text_length = strlen (text_contents);
|
||||
|
||||
if (text_contents && (text_length > 0))
|
||||
{
|
||||
bytes_written = write (fd, text_contents, text_length);
|
||||
|
||||
g_free (text_contents);
|
||||
close (fd);
|
||||
|
||||
if (bytes_written != text_length)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimperrorconsole.h
|
||||
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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 Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_ERROR_CONSOLE_H__
|
||||
#define __GIMP_ERROR_CONSOLE_H__
|
||||
|
||||
|
||||
#include "gimpeditor.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_ERROR_CONSOLE (gimp_error_console_get_type ())
|
||||
#define GIMP_ERROR_CONSOLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ERROR_CONSOLE, GimpErrorConsole))
|
||||
#define GIMP_ERROR_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ERROR_CONSOLE, GimpErrorConsoleClass))
|
||||
#define GIMP_IS_ERROR_CONSOLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ERROR_CONSOLE))
|
||||
#define GIMP_IS_ERROR_CONSOLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ERROR_CONSOLE))
|
||||
#define GIMP_ERROR_CONSOLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ERROR_CONSOLE, GimpErrorConsoleClass))
|
||||
|
||||
|
||||
typedef struct _GimpErrorConsoleClass GimpErrorConsoleClass;
|
||||
|
||||
struct _GimpErrorConsole
|
||||
{
|
||||
GimpEditor parent_instance;
|
||||
|
||||
Gimp *gimp;
|
||||
|
||||
GtkTextBuffer *text_buffer;
|
||||
GtkWidget *text_view;
|
||||
|
||||
GtkWidget *clear_button;
|
||||
GtkWidget *save_button;
|
||||
|
||||
GtkWidget *filesel;
|
||||
gboolean save_selection;
|
||||
};
|
||||
|
||||
struct _GimpErrorConsoleClass
|
||||
{
|
||||
GimpEditorClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_error_console_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_error_console_new (Gimp *gimp,
|
||||
GimpMenuFactory *menu_factory);
|
||||
|
||||
void gimp_error_console_add (GimpErrorConsole *console,
|
||||
const gchar *stock_id,
|
||||
const gchar *domain,
|
||||
const gchar *message);
|
||||
|
||||
|
||||
#endif /* __GIMP_ERROR_CONSOLE_H__ */
|
|
@ -52,6 +52,7 @@ struct _MessageBox
|
|||
GtkWidget *mbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *repeat_label;
|
||||
gchar *domain;
|
||||
gchar *message;
|
||||
gint repeat_count;
|
||||
GtkCallback callback;
|
||||
|
@ -64,34 +65,44 @@ struct _MessageBox
|
|||
static GList *message_boxes = NULL;
|
||||
|
||||
void
|
||||
gimp_message_box (const gchar *message,
|
||||
gimp_message_box (const gchar *stock_id,
|
||||
const gchar *domain,
|
||||
const gchar *message,
|
||||
GtkCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
MessageBox *msg_box;
|
||||
GtkWidget *mbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
GList *list;
|
||||
const gchar *stock_id = GIMP_STOCK_WARNING;
|
||||
MessageBox *msg_box;
|
||||
GtkWidget *mbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
GList *list;
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
gchar *str;
|
||||
|
||||
if (!message)
|
||||
return;
|
||||
g_return_if_fail (stock_id != NULL);
|
||||
g_return_if_fail (message != NULL);
|
||||
|
||||
if (! domain)
|
||||
domain = _("GIMP");
|
||||
|
||||
if (g_list_length (message_boxes) > MESSAGE_BOX_MAXIMUM)
|
||||
{
|
||||
g_printerr ("%s: %s\n", prog_name, message);
|
||||
g_printerr ("%s: %s\n", domain, message);
|
||||
return;
|
||||
}
|
||||
|
||||
for (list = message_boxes; list; list = list->next)
|
||||
{
|
||||
msg_box = list->data;
|
||||
if (strcmp (msg_box->message, message) == 0)
|
||||
|
||||
if (strcmp (msg_box->message, message) == 0 &&
|
||||
strcmp (msg_box->domain, domain) == 0)
|
||||
{
|
||||
msg_box->repeat_count++;
|
||||
|
||||
if (msg_box->repeat_count > 1)
|
||||
{
|
||||
gchar *text = g_strdup_printf (_("Message repeated %d times."),
|
||||
|
@ -103,12 +114,22 @@ gimp_message_box (const gchar *message,
|
|||
{
|
||||
GtkWidget *label;
|
||||
|
||||
attrs = pango_attr_list_new ();
|
||||
|
||||
attr = pango_attr_style_new (PANGO_STYLE_OBLIQUE);
|
||||
attr->start_index = 0;
|
||||
attr->end_index = -1;
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
|
||||
label = gtk_label_new (_("Message repeated once."));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
gtk_box_pack_end (GTK_BOX (msg_box->vbox), label,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
pango_attr_list_unref (attrs);
|
||||
|
||||
msg_box->repeat_label = label;
|
||||
}
|
||||
|
||||
|
@ -119,13 +140,12 @@ gimp_message_box (const gchar *message,
|
|||
|
||||
if (g_list_length (message_boxes) == MESSAGE_BOX_MAXIMUM)
|
||||
{
|
||||
g_printerr ("%s: %s\n", prog_name, message);
|
||||
g_printerr ("%s: %s\n", domain, message);
|
||||
message = _("WARNING:\n"
|
||||
"Too many open message dialogs.\n"
|
||||
"Messages are redirected to stderr.");
|
||||
stock_id = GIMP_STOCK_WARNING;
|
||||
}
|
||||
|
||||
|
||||
msg_box = g_new0 (MessageBox, 1);
|
||||
|
||||
mbox = gimp_dialog_new (_("GIMP Message"), "gimp-message",
|
||||
|
@ -138,30 +158,59 @@ gimp_message_box (const gchar *message,
|
|||
|
||||
NULL);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (mbox), FALSE);
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (mbox), FALSE);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (mbox)->vbox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
attrs = pango_attr_list_new ();
|
||||
|
||||
attr = pango_attr_scale_new (PANGO_SCALE_LARGE);
|
||||
attr->start_index = 0;
|
||||
attr->end_index = -1;
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
|
||||
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
|
||||
attr->start_index = 0;
|
||||
attr->end_index = -1;
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
|
||||
str = g_strdup_printf (_("%s Message"), domain);
|
||||
label = gtk_label_new (str);
|
||||
g_free (str);
|
||||
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
pango_attr_list_unref (attrs);
|
||||
|
||||
label = gtk_label_new (message);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
msg_box->mbox = mbox;
|
||||
msg_box->vbox = vbox;
|
||||
msg_box->domain = g_strdup (domain);
|
||||
msg_box->message = g_strdup (message);
|
||||
msg_box->callback = callback;
|
||||
msg_box->data = data;
|
||||
|
||||
message_boxes = g_list_append (message_boxes, msg_box);
|
||||
message_boxes = g_list_prepend (message_boxes, msg_box);
|
||||
|
||||
gtk_widget_show (mbox);
|
||||
}
|
||||
|
@ -184,6 +233,7 @@ gimp_message_box_close_callback (GtkWidget *widget,
|
|||
/* make this box available again */
|
||||
message_boxes = g_list_remove (message_boxes, msg_box);
|
||||
|
||||
g_free (msg_box->domain);
|
||||
g_free (msg_box->message);
|
||||
g_free (msg_box);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#define __GIMP_WIDGETS_UTILS_H__
|
||||
|
||||
|
||||
void gimp_message_box (const gchar *message,
|
||||
void gimp_message_box (const gchar *stock_id,
|
||||
const gchar *domain,
|
||||
const gchar *message,
|
||||
GtkCallback callback,
|
||||
gpointer data);
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ typedef struct _GimpMenuItem GimpMenuItem;
|
|||
typedef struct _GimpEnumMenu GimpEnumMenu;
|
||||
|
||||
typedef struct _GimpEditor GimpEditor;
|
||||
typedef struct _GimpErrorConsole GimpErrorConsole;
|
||||
typedef struct _GimpImageEditor GimpImageEditor;
|
||||
typedef struct _GimpColorEditor GimpColorEditor;
|
||||
typedef struct _GimpColormapEditor GimpColormapEditor;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -1579,7 +1580,6 @@ save_callback (void)
|
|||
{
|
||||
FILE *fp;
|
||||
gchar *savename;
|
||||
gchar *message;
|
||||
|
||||
savename = filename;
|
||||
|
||||
|
@ -1587,14 +1587,11 @@ save_callback (void)
|
|||
|
||||
if (!fp)
|
||||
{
|
||||
message = g_strconcat (_("Error opening: %s"),
|
||||
"\n",
|
||||
_("Could not save."),
|
||||
savename);
|
||||
g_message (message);
|
||||
g_free (message);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
savename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write header out */
|
||||
fputs (FRACTAL_HEADER, fp);
|
||||
fputs ("#**********************************************************************\n", fp);
|
||||
|
@ -1605,7 +1602,9 @@ save_callback (void)
|
|||
save_options (fp);
|
||||
|
||||
if (ferror (fp))
|
||||
g_message (_("Failed to write file\n"));
|
||||
g_message (_("Failed to write '%s':\n%s"),
|
||||
savename, g_strerror (ferror (fp)));
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
|
@ -1992,23 +1991,24 @@ explorer_load (void)
|
|||
|
||||
if (!fp)
|
||||
{
|
||||
g_warning ("Error opening: %s", filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
get_line (load_buf, MAX_LOAD_LINE, fp, 1);
|
||||
|
||||
if (strncmp (FRACTAL_HEADER, load_buf, strlen (load_buf)))
|
||||
{
|
||||
g_message (_("File '%s' is not a FractalExplorer file"), filename);
|
||||
g_message (_("'%s'\nis not a FractalExplorer file"), filename);
|
||||
return;
|
||||
}
|
||||
if (load_options (current_obj,fp))
|
||||
{
|
||||
g_message (_("File '%s' is corrupt.\nLine %d Option section incorrect"),
|
||||
g_message (_("'%s' is corrupt.\nLine %d Option section incorrect"),
|
||||
filename, line_no);
|
||||
return;
|
||||
}
|
||||
|
||||
wvals = current_obj->opts;
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ compute_image (void)
|
|||
|
||||
row = g_new (guchar, obpp * width);
|
||||
|
||||
gimp_progress_init (_("Lighting Effects"));
|
||||
gimp_progress_init (_("Lighting Effects..."));
|
||||
|
||||
/* if (mapvals.antialiasing==FALSE)
|
||||
{ */
|
||||
|
|
|
@ -269,16 +269,16 @@ compute_image (void)
|
|||
switch (mapvals.maptype)
|
||||
{
|
||||
case MAP_PLANE:
|
||||
gimp_progress_init ("Map to object (plane)");
|
||||
gimp_progress_init ("Map to Plane...");
|
||||
break;
|
||||
case MAP_SPHERE:
|
||||
gimp_progress_init ("Map to object (sphere)");
|
||||
gimp_progress_init ("Map to Sphere...");
|
||||
break;
|
||||
case MAP_BOX:
|
||||
gimp_progress_init ("Map to object (box)");
|
||||
gimp_progress_init ("Map to Box...");
|
||||
break;
|
||||
case MAP_CYLINDER:
|
||||
gimp_progress_init ("Map to object (cylinder)");
|
||||
gimp_progress_init ("Map to Cylinder...");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -63,7 +64,7 @@ ReadColorMap (FILE *fd,
|
|||
{
|
||||
if (!ReadOK (fd, rgb, size))
|
||||
{
|
||||
g_message (_("%s: bad colormap"), prog_name);
|
||||
g_message (_("Bad colormap"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -87,25 +88,21 @@ ReadBMP (gchar *name)
|
|||
guchar ColorMap[256][3];
|
||||
gint32 image_ID;
|
||||
guchar magick[2];
|
||||
|
||||
if (interactive_bmp)
|
||||
{
|
||||
temp_buf = g_strdup_printf (_("Loading %s:"), name);
|
||||
gimp_progress_init (temp_buf);
|
||||
g_free (temp_buf);
|
||||
}
|
||||
|
||||
filename = name;
|
||||
fd = fopen (filename, "rb");
|
||||
|
||||
/* Is this a valid File? Should never be used because Gimp tests it. */
|
||||
|
||||
|
||||
if (!fd)
|
||||
{
|
||||
g_message (_("%s: can't open \"%s\""), prog_name, filename);
|
||||
g_message (_("Can't open '%s':\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp_buf = g_strdup_printf (_("Opening '%s'..."), name);
|
||||
gimp_progress_init (temp_buf);
|
||||
g_free (temp_buf);
|
||||
|
||||
/* It is a File. Now is it a Bitmap? Read the shortest possible header */
|
||||
|
||||
if (!ReadOK(fd, magick, 2) || !(!strncmp(magick,"BA",2) ||
|
||||
|
@ -113,7 +110,7 @@ ReadBMP (gchar *name)
|
|||
!strncmp(magick,"PI",2) || !strncmp(magick,"CI",2) ||
|
||||
!strncmp(magick,"CP",2)))
|
||||
{
|
||||
g_message (_("%s: %s is not a valid BMP file"), prog_name, filename);
|
||||
g_message (_("'%s' is not a valid BMP file"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -121,19 +118,19 @@ ReadBMP (gchar *name)
|
|||
{
|
||||
if (!ReadOK(fd, buffer, 12))
|
||||
{
|
||||
g_message (_("%s: %s is not a valid BMP file"), prog_name, filename);
|
||||
g_message (_("'%s' is not a valid BMP file"), filename);
|
||||
return -1;
|
||||
}
|
||||
if (!ReadOK(fd, magick, 2))
|
||||
{
|
||||
g_message (_("%s: %s is not a valid BMP file"), prog_name, filename);
|
||||
g_message (_("'%s' is not a valid BMP file"), filename);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ReadOK(fd, buffer, 12))
|
||||
{
|
||||
g_message (_("%s: %s is not a valid BMP file"), prog_name, filename);
|
||||
g_message (_("'%s' is not a valid BMP file"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -146,7 +143,7 @@ ReadBMP (gchar *name)
|
|||
|
||||
if (!ReadOK(fd, buffer, 4))
|
||||
{
|
||||
g_message(_("%s: %s is not a valid BMP file"), prog_name, filename);
|
||||
g_message (_("'%s' is not a valid BMP file"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -158,7 +155,7 @@ ReadBMP (gchar *name)
|
|||
{
|
||||
if (!ReadOK (fd, buffer, 8))
|
||||
{
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -176,7 +173,7 @@ ReadBMP (gchar *name)
|
|||
{
|
||||
if (!ReadOK (fd, buffer, Bitmap_File_Head.biSize - 4))
|
||||
{
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */
|
||||
|
@ -196,7 +193,7 @@ ReadBMP (gchar *name)
|
|||
{
|
||||
if (!ReadOK (fd, buffer, Bitmap_File_Head.biSize - 4))
|
||||
{
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */
|
||||
|
@ -214,7 +211,7 @@ ReadBMP (gchar *name)
|
|||
}
|
||||
else
|
||||
{
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -232,17 +229,17 @@ ReadBMP (gchar *name)
|
|||
/* Sanity checks */
|
||||
|
||||
if (Bitmap_Head.biHeight == 0 || Bitmap_Head.biWidth == 0) {
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Bitmap_Head.biPlanes != 1) {
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ColormapSize > 256 || Bitmap_Head.biClrUsed > 256) {
|
||||
g_message (_("%s: error reading BMP file header"), prog_name);
|
||||
g_message (_("Error reading BMP file header\nfrom '%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -375,7 +372,7 @@ ReadImage (FILE *fd,
|
|||
}
|
||||
--ypos; /* next line */
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) && ((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -395,7 +392,7 @@ ReadImage (FILE *fd,
|
|||
}
|
||||
--ypos; /* next line */
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) && ((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -416,7 +413,7 @@ ReadImage (FILE *fd,
|
|||
}
|
||||
--ypos; /* next line */
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) && ((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -445,8 +442,7 @@ ReadImage (FILE *fd,
|
|||
xpos = 0;
|
||||
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) &&
|
||||
((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -514,8 +510,7 @@ ReadImage (FILE *fd,
|
|||
xpos = 0;
|
||||
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) &&
|
||||
((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -550,8 +545,7 @@ ReadImage (FILE *fd,
|
|||
gimp_cmap[j++] = cmap[i][2];
|
||||
}
|
||||
|
||||
if (interactive_bmp)
|
||||
gimp_progress_update (1);
|
||||
gimp_progress_update (1);
|
||||
|
||||
gimp_pixel_rgn_init (&pixel_rgn, drawable,
|
||||
0, 0, drawable->width, drawable->height, TRUE, FALSE);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -133,7 +134,7 @@ WriteBMP (gchar *filename,
|
|||
0, 0, drawable->width, drawable->height, FALSE, FALSE);
|
||||
if (gimp_drawable_has_alpha(drawable_ID))
|
||||
{
|
||||
g_message(_("BMP: cannot operate on unknown image types or alpha images"));
|
||||
g_message (_("Cannot operate on unknown image types or alpha images"));
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
|
@ -195,7 +196,8 @@ WriteBMP (gchar *filename,
|
|||
outfile = fopen (filename, "wb");
|
||||
if (!outfile)
|
||||
{
|
||||
g_message (_("Can't open %s"), filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
|
@ -205,12 +207,10 @@ WriteBMP (gchar *filename,
|
|||
0, 0, drawable->width, drawable->height);
|
||||
|
||||
/* And let's begin the progress */
|
||||
if (interactive_bmp)
|
||||
{
|
||||
temp_buf = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp_buf);
|
||||
g_free (temp_buf);
|
||||
}
|
||||
temp_buf = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp_buf);
|
||||
g_free (temp_buf);
|
||||
|
||||
cur_progress = 0;
|
||||
max_progress = drawable->height;
|
||||
|
||||
|
@ -369,8 +369,7 @@ WriteImage (FILE *f,
|
|||
Write (f, &buf[3], spzeile - (width * 3));
|
||||
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) &&
|
||||
((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
|
||||
|
@ -405,8 +404,7 @@ WriteImage (FILE *f,
|
|||
xpos = 0;
|
||||
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) &&
|
||||
((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -520,8 +518,7 @@ WriteImage (FILE *f,
|
|||
laenge += 2;
|
||||
|
||||
cur_progress++;
|
||||
if ((interactive_bmp) &&
|
||||
((cur_progress % 5) == 0))
|
||||
if ((cur_progress % 5) == 0)
|
||||
gimp_progress_update ((gdouble) cur_progress /
|
||||
(gdouble) max_progress);
|
||||
}
|
||||
|
@ -541,8 +538,8 @@ WriteImage (FILE *f,
|
|||
}
|
||||
}
|
||||
}
|
||||
if (interactive_bmp)
|
||||
gimp_progress_update (1);
|
||||
|
||||
gimp_progress_update (1);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -249,11 +250,11 @@ load_image (gchar *file,
|
|||
|
||||
if (fp == NULL)
|
||||
{
|
||||
g_message (_("%s\nis not present or is unreadable"), file);
|
||||
g_message (_("Can't open '%s':\n%s"), file, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
progress = g_strdup_printf (_("Loading %s:"), brief);
|
||||
progress = g_strdup_printf (_("Opening '%s'..."), brief);
|
||||
gimp_progress_init (progress);
|
||||
g_free (progress);
|
||||
|
||||
|
@ -283,7 +284,7 @@ load_image (gchar *file,
|
|||
|
||||
if (image == -1)
|
||||
{
|
||||
g_message (_("CEL Can't create a new image"));
|
||||
g_message (_("Can't create a new image"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -462,18 +463,18 @@ save_image (gchar *file,
|
|||
gint32 image,
|
||||
gint32 layer)
|
||||
{
|
||||
FILE* fp; /* Write file pointer */
|
||||
char *progress; /* Title for progress display */
|
||||
guchar header[32]; /* File header */
|
||||
gint colours, type, /* Number of colours, type of layer */
|
||||
offx, offy; /* Layer offsets */
|
||||
FILE *fp; /* Write file pointer */
|
||||
char *progress; /* Title for progress display */
|
||||
guchar header[32]; /* File header */
|
||||
gint colours, type; /* Number of colours, type of layer */
|
||||
gint offx, offy; /* Layer offsets */
|
||||
|
||||
guchar *buffer, /* Temporary buffer */
|
||||
*line; /* Pixel data */
|
||||
GimpDrawable *drawable; /* Drawable for layer */
|
||||
GimpPixelRgn pixel_rgn; /* Pixel region for layer */
|
||||
guchar *buffer; /* Temporary buffer */
|
||||
guchar *line; /* Pixel data */
|
||||
GimpDrawable *drawable; /* Drawable for layer */
|
||||
GimpPixelRgn pixel_rgn; /* Pixel region for layer */
|
||||
|
||||
int i, j, k; /* Counters */
|
||||
gint i, j, k; /* Counters */
|
||||
|
||||
/* Check that this is an indexed image, fail otherwise */
|
||||
type = gimp_drawable_type (layer);
|
||||
|
@ -493,11 +494,12 @@ save_image (gchar *file,
|
|||
|
||||
if (fp == NULL)
|
||||
{
|
||||
g_message (_("CEL Couldn't write image to\n%s"), file);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
file, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
progress = g_strdup_printf (_("Saving %s:"), brief);
|
||||
progress = g_strdup_printf (_("Saving '%s'..."), brief);
|
||||
gimp_progress_init (progress);
|
||||
g_free (progress);
|
||||
|
||||
|
|
|
@ -2159,9 +2159,11 @@ CML_execute_save_to_file (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((err != 0) && (file == NULL))
|
||||
{
|
||||
g_message (_("Error: could not open \"%s\""), filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -2213,7 +2215,7 @@ CML_execute_save_to_file (GtkWidget *widget,
|
|||
fprintf (file, "Random seed : %d\n", VALS.seed);
|
||||
fclose(file);
|
||||
|
||||
g_message (_("Parameters were Saved to\n\"%s\""), filename);
|
||||
g_message (_("Parameters were Saved to\n'%s'"), filename);
|
||||
|
||||
strncpy (VALS.last_file_name, filename,
|
||||
sizeof (VALS.last_file_name) - 1);
|
||||
|
@ -2386,7 +2388,7 @@ CML_load_parameter_file (const gchar *filename,
|
|||
|
||||
if (!file)
|
||||
{
|
||||
g_message (_("Error: could not open \"%s\""), filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -2414,9 +2416,9 @@ CML_load_parameter_file (const gchar *filename,
|
|||
if (interactive_mode)
|
||||
{
|
||||
if (version < PARAM_FILE_FORMAT_VERSION)
|
||||
g_message (_("Warning: it's an old format file."));
|
||||
g_message (_("Warning: '%s'\nis an old format file."), filename);
|
||||
if (PARAM_FILE_FORMAT_VERSION < version)
|
||||
g_message (_("Warning: Hmmm, it's a parameter file for newer CML_explorer than me."));
|
||||
g_message (_("Warning: '%s'\nis a parameter file for newer CML_explorer than me."), filename);
|
||||
}
|
||||
for (channel_id = 0; flag && (channel_id < 3); channel_id++)
|
||||
{
|
||||
|
|
|
@ -217,9 +217,9 @@ spawn_bz (gchar *filename,
|
|||
FILE *f;
|
||||
gint tfd;
|
||||
|
||||
if (!(f = fopen(filename,"wb")))
|
||||
if (!(f = fopen (filename,"wb")))
|
||||
{
|
||||
g_message ("bz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ spawn_bz (gchar *filename,
|
|||
/* make stdout for this process be the output file */
|
||||
if (dup2 (fileno (f), fileno (stdout)) == -1)
|
||||
{
|
||||
g_message ("bz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
close (tfd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ spawn_bz (gchar *filename,
|
|||
close (tfd);
|
||||
if (*pid == -1)
|
||||
{
|
||||
g_message ("bz: spawn failed: %s\n", g_strerror (errno));
|
||||
g_message ("spawn() failed: %s", g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -262,8 +262,8 @@ save_image (gchar *filename,
|
|||
|
||||
if (NULL == (ext = find_extension (filename)))
|
||||
{
|
||||
g_message (_("bz2: can't open bzip2ed file without a "
|
||||
"sensible extension\n"));
|
||||
g_message (_("Can't open bzip2ed file without a "
|
||||
"sensible extension"));
|
||||
return GIMP_PDB_CALLING_ERROR;
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ save_image (gchar *filename,
|
|||
/* fork off a bzip2 process */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("bz2: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -293,18 +293,18 @@ save_image (gchar *filename,
|
|||
{
|
||||
if (!(f = fopen (filename, "w")))
|
||||
{
|
||||
g_message ("bz2: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
/* make stdout for this process be the output file */
|
||||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||
g_message ("bz2: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
|
||||
/* and bzip2 into it */
|
||||
execlp ("bzip2", "bzip2", "-cf", tmpname, NULL);
|
||||
g_message ("bz2: exec failed: bzip2: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: bzip2: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ save_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("bz2: bzip2 exited abnormally on file %s\n", tmpname);
|
||||
g_message ("bzip2 exited abnormally on file\n'%s'", tmpname);
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -349,8 +349,7 @@ load_image (gchar *filename,
|
|||
|
||||
if (NULL == (ext = find_extension (filename)))
|
||||
{
|
||||
g_message (_("bz2: can't open bzip2ed file without a "
|
||||
"sensible extension\n"));
|
||||
g_message (_("Can't open bzip2ed file without a sensible extension"));
|
||||
*status = GIMP_PDB_CALLING_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
@ -362,7 +361,7 @@ load_image (gchar *filename,
|
|||
/* fork off a bzip2 and wait for it */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("bz2: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -372,18 +371,18 @@ load_image (gchar *filename,
|
|||
FILE *f;
|
||||
if (!(f = fopen (tmpname,"w")))
|
||||
{
|
||||
g_message ("bz2: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
||||
/* make stdout for this child process be the temp file */
|
||||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||
g_message ("bz2: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
|
||||
/* and unzip into it */
|
||||
execlp ("bzip2", "bzip2", "-cfd", filename, NULL);
|
||||
g_message ("bz2: exec failed: bunzip2: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: bunzip2: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
@ -403,7 +402,7 @@ load_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("bz2: bzip2 exited abnormally on file %s\n", filename);
|
||||
g_message ("bzip2 exited abnormally on file\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
|
|
@ -352,7 +352,7 @@ run (gchar *name,
|
|||
layer_list = gimp_image_get_layers (param[1].data.d_int32, &nlayers);
|
||||
if ((layer_list == NULL) || (nlayers <= 0))
|
||||
{
|
||||
g_message (_("Compose: Could not get layers for image %d"),
|
||||
g_message (_("Could not get layers for image %d"),
|
||||
(gint) param[1].data.d_int32);
|
||||
return;
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ compose (const gchar *compose_type,
|
|||
if ((width != (gint)gimp_drawable_width (compose_ID[j])) ||
|
||||
(height != (gint)gimp_drawable_height (compose_ID[j])))
|
||||
{
|
||||
g_message (_("Compose: Drawables have different size"));
|
||||
g_message (_("Drawables have different size"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ compose (const gchar *compose_type,
|
|||
if ((width != (gint)gimp_image_width (compose_ID[j])) ||
|
||||
(height != (gint)gimp_image_height (compose_ID[j])))
|
||||
{
|
||||
g_message (_("Compose: Images have different size"));
|
||||
g_message (_("Images have different size"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ compose (const gchar *compose_type,
|
|||
g32 = gimp_image_get_layers (compose_ID[j], &num_layers);
|
||||
if ((g32 == NULL) || (num_layers <= 0))
|
||||
{
|
||||
g_message (_("Compose: Error in getting layer IDs"));
|
||||
g_message (_("Error in getting layer IDs"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ compose (const gchar *compose_type,
|
|||
incr_src[j] = drawable_src[j]->bpp;
|
||||
if ((incr_src[j] != 1) && (incr_src[j] != 2))
|
||||
{
|
||||
g_message (_("Compose: Image is not a gray image (bpp=%d)"),
|
||||
g_message (_("Image is not a gray image (bpp=%d)"),
|
||||
incr_src[j]);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ spawn_gzip (gchar *filename,
|
|||
|
||||
if (!(f = fopen (filename,"w")))
|
||||
{
|
||||
g_message ("gz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ spawn_gzip (gchar *filename,
|
|||
/* make stdout for this process be the output file */
|
||||
if (dup2 (fileno (f), fileno (stdout)) == -1)
|
||||
{
|
||||
g_message ("gz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
close (tfd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ spawn_gzip (gchar *filename,
|
|||
close (tfd);
|
||||
if (*pid == -1)
|
||||
{
|
||||
g_message ("gz: spawn failed: %s\n", g_strerror (errno));
|
||||
g_message ("spawn failed: %s", g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -316,7 +316,7 @@ save_image (gchar *filename,
|
|||
|
||||
if (NULL == (ext = find_extension (filename)))
|
||||
{
|
||||
g_message (_("gz: no sensible extension, saving as gzip'd xcf\n"));
|
||||
g_message (_("No sensible extension, saving as gzip'd xcf"));
|
||||
ext = ".xcf";
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ save_image (gchar *filename,
|
|||
/* fork off a gzip process */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("gz: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -356,18 +356,18 @@ save_image (gchar *filename,
|
|||
|
||||
if (!(f = fopen (filename, "w")))
|
||||
{
|
||||
g_message ("gz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
||||
/* make stdout for this process be the output file */
|
||||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||
g_message ("gz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
|
||||
/* and gzip into it */
|
||||
execlp ("gzip", "gzip", "-cf", tmpname, NULL);
|
||||
g_message ("gz: exec failed: gzip: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: gzip: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ save_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("gz: gzip exited abnormally on file %s\n", tmpname);
|
||||
g_message ("gzip exited abnormally on file\n'%s'", tmpname);
|
||||
g_free (tmpname);
|
||||
return 0;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ save_image (gchar *filename,
|
|||
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
|
||||
&startupinfo, &processinfo))
|
||||
{
|
||||
g_message ("gz: CreateProcess failed. Minigzip.exe not in the ?\n");
|
||||
g_message ("CreateProcess failed. Minigzip.exe not in the path?");
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ load_image (gchar *filename,
|
|||
|
||||
if (NULL == (ext = find_extension (filename)))
|
||||
{
|
||||
g_message (_("gz: no sensible extension, attempting to load with file magic\n"));
|
||||
g_message (_("No sensible extension, attempting to load with file magic"));
|
||||
}
|
||||
|
||||
/* find a temp name */
|
||||
|
@ -459,7 +459,7 @@ load_image (gchar *filename,
|
|||
/* fork off a g(un)zip and wait for it */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("gz: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -469,7 +469,7 @@ load_image (gchar *filename,
|
|||
FILE *f;
|
||||
if (!(f = fopen (tmpname, "w")))
|
||||
{
|
||||
g_message ("gz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
@ -478,12 +478,12 @@ load_image (gchar *filename,
|
|||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||
{
|
||||
g_free (tmpname);
|
||||
g_message ("gz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
}
|
||||
|
||||
/* and unzip into it */
|
||||
execlp ("gzip", "gzip", "-cfd", filename, NULL);
|
||||
g_message ("gz: exec failed: gunzip: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: gunzip: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ load_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("gz: gzip exited abnormally on file %s\n", filename);
|
||||
g_message ("gzip exited abnormally on file\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -523,7 +523,7 @@ load_image (gchar *filename,
|
|||
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
|
||||
&startupinfo, &processinfo))
|
||||
{
|
||||
g_message ("gz: CreateProcess failed: %d\n", GetLastError ());
|
||||
g_message ("CreateProcess failed: %d", GetLastError ());
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ run (gchar *name,
|
|||
drawable_type = gimp_drawable_type (param[2].data.d_drawable);
|
||||
if ((drawable_type != GIMP_RGB_IMAGE) && (drawable_type != GIMP_RGBA_IMAGE))
|
||||
{
|
||||
g_message ("Decompose: Can only work on RGB images.");
|
||||
g_message ("Can only work on RGB images.");
|
||||
status = GIMP_PDB_CALLING_ERROR;
|
||||
}
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
|
@ -371,14 +371,14 @@ decompose (gint32 image_ID,
|
|||
drawable_src = gimp_drawable_get (drawable_ID);
|
||||
if (drawable_src->bpp < 3)
|
||||
{
|
||||
g_message ("Decompose: Not an RGB image.");
|
||||
g_message ("Not an RGB image.");
|
||||
return (-1);
|
||||
}
|
||||
if ((extract[extract_idx].extract_fun == extract_alpha ||
|
||||
extract[extract_idx].extract_fun == extract_rgba) &&
|
||||
(!gimp_drawable_has_alpha (drawable_ID)))
|
||||
{
|
||||
g_message ("Decompose: No alpha channel available.");
|
||||
g_message ("No alpha channel available.");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ run (gchar *name,
|
|||
|
||||
if (!(bvals.horizontal || bvals.vertical))
|
||||
{
|
||||
g_message ( _("gauss_rle: you must specify either horizontal or vertical (or both)"));
|
||||
g_message ( _("You must specify either horizontal or vertical (or both)"));
|
||||
status = GIMP_PDB_CALLING_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <glib.h> /* Include early for G_OS_WIN32 */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -277,31 +278,33 @@ run (gchar *name,
|
|||
static gint32
|
||||
load_image (gchar *filename)
|
||||
{
|
||||
gchar *temp;
|
||||
gchar *name = NULL;
|
||||
gint fd;
|
||||
BrushHeader bh;
|
||||
guchar *brush_buf = NULL;
|
||||
gint32 image_ID;
|
||||
gint32 layer_ID;
|
||||
GimpDrawable *drawable;
|
||||
GimpPixelRgn pixel_rgn;
|
||||
gint version_extra;
|
||||
gint bn_size;
|
||||
gchar *temp;
|
||||
gchar *name = NULL;
|
||||
gint fd;
|
||||
BrushHeader bh;
|
||||
guchar *brush_buf = NULL;
|
||||
gint32 image_ID;
|
||||
gint32 layer_ID;
|
||||
GimpDrawable *drawable;
|
||||
GimpPixelRgn pixel_rgn;
|
||||
gint version_extra;
|
||||
gint bn_size;
|
||||
GimpImageBaseType base_type;
|
||||
GimpImageType image_type;
|
||||
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
|
||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
if (read (fd, &bh, sizeof (bh)) != sizeof (bh))
|
||||
{
|
||||
close (fd);
|
||||
|
@ -342,7 +345,7 @@ load_image (gchar *filename)
|
|||
name = g_new (gchar, bn_size);
|
||||
if ((read (fd, name, bn_size)) < bn_size)
|
||||
{
|
||||
g_message (_("Error in GIMP brush file \"%s\"."), filename);
|
||||
g_message (_("Error in GIMP brush file\n'%s'"), filename);
|
||||
close (fd);
|
||||
g_free (name);
|
||||
return -1;
|
||||
|
@ -484,6 +487,15 @@ save_image (gchar *filename,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
@ -493,14 +505,6 @@ save_image (gchar *filename,
|
|||
0, 0, drawable->width, drawable->height,
|
||||
FALSE, FALSE);
|
||||
|
||||
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message( _("Unable to open %s"), filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bh.header_size = g_htonl (sizeof (bh) + strlen (info.description) + 1);
|
||||
bh.version = g_htonl (2);
|
||||
bh.width = g_htonl (drawable->width);
|
||||
|
|
|
@ -259,6 +259,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -671,7 +672,7 @@ static int find_unused_ia_colour (guchar *pixels,
|
|||
return ((*colors)-1);
|
||||
}
|
||||
|
||||
g_message (_("GIF: Couldn't simply reduce colors further.\nSaving as opaque.\n"));
|
||||
g_message (_("Couldn't simply reduce colors further.\nSaving as opaque."));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -931,29 +932,27 @@ save_image (gchar *filename,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message (_("GIF: Sorry, can't save RGB images as GIFs - convert to INDEXED\nor GRAY first.\n"));
|
||||
g_message (_("Sorry, can't save RGB images as GIFs - convert to INDEXED\nor GRAY first."));
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
/* init the progress meter */
|
||||
temp_buf = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp_buf);
|
||||
g_free (temp_buf);
|
||||
}
|
||||
|
||||
|
||||
/* open the destination file for writing */
|
||||
outfile = fopen (filename, "wb");
|
||||
if (!outfile)
|
||||
{
|
||||
g_message (_("GIF: can't open %s\n"), filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* init the progress meter */
|
||||
temp_buf = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp_buf);
|
||||
g_free (temp_buf);
|
||||
|
||||
|
||||
/* write the GIFheader */
|
||||
|
||||
if (colors < 256)
|
||||
|
@ -1490,12 +1489,9 @@ BumpPixel (void)
|
|||
*/
|
||||
if (curx == Width)
|
||||
{
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
cur_progress++;
|
||||
if ((cur_progress % 16) == 0)
|
||||
gimp_progress_update ((double) cur_progress / (double) max_progress);
|
||||
}
|
||||
cur_progress++;
|
||||
if ((cur_progress % 16) == 0)
|
||||
gimp_progress_update ((double) cur_progress / (double) max_progress);
|
||||
|
||||
curx = 0;
|
||||
|
||||
|
@ -2358,7 +2354,7 @@ cl_hash (register count_int hsize) /* reset code table */
|
|||
static void
|
||||
writeerr ()
|
||||
{
|
||||
g_message (_("GIF: error writing output file\n"));
|
||||
g_message (_("Error writing output file."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -291,26 +292,23 @@ load_image (gchar *filename)
|
|||
fd = fopen (filename, "rb");
|
||||
if (!fd)
|
||||
{
|
||||
g_message ("GIF: can't open \"%s\"\n", filename);
|
||||
g_message ("Can't open '%s':\n%s", filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
name_buf = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
}
|
||||
name_buf = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
if (!ReadOK (fd, buf, 6))
|
||||
{
|
||||
g_message ("GIF: error reading magic number\n");
|
||||
g_message ("Error reading magic number");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strncmp ((char *) buf, "GIF", 3) != 0)
|
||||
{
|
||||
g_message ("GIF: not a GIF file\n");
|
||||
g_message ("Not a GIF file");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -319,13 +317,13 @@ load_image (gchar *filename)
|
|||
|
||||
if ((strcmp (version, "87a") != 0) && (strcmp (version, "89a") != 0))
|
||||
{
|
||||
g_message ("GIF: bad version number, not '87a' or '89a'\n");
|
||||
g_message ("Bad version number, not '87a' or '89a'");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!ReadOK (fd, buf, 7))
|
||||
{
|
||||
g_message ("GIF: failed to read screen descriptor\n");
|
||||
g_message ("Failed to read screen descriptor");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -341,14 +339,14 @@ load_image (gchar *filename)
|
|||
/* Global Colormap */
|
||||
if (ReadColorMap (fd, GifScreen.BitPixel, GifScreen.ColorMap, &GifScreen.GrayScale))
|
||||
{
|
||||
g_message ("GIF: error reading global colormap\n");
|
||||
g_message ("Error reading global colormap");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (GifScreen.AspectRatio != 0 && GifScreen.AspectRatio != 49)
|
||||
{
|
||||
g_message ("GIF: warning - non-square pixels\n");
|
||||
g_message ("Warning - non-square pixels");
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,7 +357,7 @@ load_image (gchar *filename)
|
|||
{
|
||||
if (!ReadOK (fd, &c, 1))
|
||||
{
|
||||
g_message ("GIF: EOF / read error on image data\n");
|
||||
g_message ("EOF / read error on image data");
|
||||
return image_ID; /* will be -1 if failed on first image! */
|
||||
}
|
||||
|
||||
|
@ -374,7 +372,7 @@ load_image (gchar *filename)
|
|||
/* Extension */
|
||||
if (!ReadOK (fd, &c, 1))
|
||||
{
|
||||
g_message ("GIF: EOF / read error on extension function code\n");
|
||||
g_message ("EOF / read error on extension function code");
|
||||
return image_ID; /* will be -1 if failed on first image! */
|
||||
}
|
||||
DoExtension (fd, c);
|
||||
|
@ -392,7 +390,7 @@ load_image (gchar *filename)
|
|||
|
||||
if (!ReadOK (fd, buf, 9))
|
||||
{
|
||||
g_message ("GIF: couldn't read left/top/width/height\n");
|
||||
g_message ("Couldn't read left/top/width/height");
|
||||
return image_ID; /* will be -1 if failed on first image! */
|
||||
}
|
||||
|
||||
|
@ -404,7 +402,7 @@ load_image (gchar *filename)
|
|||
{
|
||||
if (ReadColorMap (fd, bitPixel, localColorMap, &grayScale))
|
||||
{
|
||||
g_message ("GIF: error reading local colormap\n");
|
||||
g_message ("Error reading local colormap");
|
||||
return image_ID; /* will be -1 if failed on first image! */
|
||||
}
|
||||
image_ID = ReadImage (fd, filename, LM_to_uint (buf[4], buf[5]),
|
||||
|
@ -462,7 +460,7 @@ ReadColorMap (FILE *fd,
|
|||
{
|
||||
if (!ReadOK (fd, rgb, sizeof (rgb)))
|
||||
{
|
||||
g_message ("GIF: bad colormap\n");
|
||||
g_message ("Bad colormap");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -580,7 +578,7 @@ GetDataBlock (FILE *fd,
|
|||
|
||||
if (!ReadOK (fd, &count, 1))
|
||||
{
|
||||
g_message ("GIF: error in getting DataBlock size\n");
|
||||
g_message ("Error in getting DataBlock size");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -588,7 +586,7 @@ GetDataBlock (FILE *fd,
|
|||
|
||||
if ((count != 0) && (!ReadOK (fd, buf, count)))
|
||||
{
|
||||
g_message ("GIF: error in reading DataBlock\n");
|
||||
g_message ("Error in reading DataBlock");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -620,7 +618,7 @@ GetCode (FILE *fd,
|
|||
{
|
||||
if (curbit >= lastbit)
|
||||
{
|
||||
g_message ("GIF: ran off the end of my bits\n");
|
||||
g_message ("Ran off the end of my bits");
|
||||
gimp_quit ();
|
||||
}
|
||||
return -1;
|
||||
|
@ -665,7 +663,7 @@ LZWReadByte (FILE *fd,
|
|||
{
|
||||
if (input_code_size > MAX_LZW_BITS)
|
||||
{
|
||||
g_message("GIF: value out of range for code size (corrupted file?)");
|
||||
g_message("Value out of range for code size (corrupted file?)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -761,7 +759,7 @@ LZWReadByte (FILE *fd,
|
|||
*sp++ = table[1][code];
|
||||
if (code == table[0][code])
|
||||
{
|
||||
g_message ("GIF: circular table entry BIG ERROR\n");
|
||||
g_message ("Circular table entry BIG ERROR");
|
||||
gimp_quit ();
|
||||
}
|
||||
code = table[0][code];
|
||||
|
@ -829,13 +827,13 @@ ReadImage (FILE *fd,
|
|||
*/
|
||||
if (!ReadOK (fd, &c, 1))
|
||||
{
|
||||
g_message ("GIF: EOF / read error on image data\n");
|
||||
g_message ("EOF / read error on image data");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (LZWReadByte (fd, TRUE, c) < 0)
|
||||
{
|
||||
g_message ("GIF: error while reading\n");
|
||||
g_message ("Error while reading");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -936,13 +934,13 @@ ReadImage (FILE *fd,
|
|||
framename_ptr = framename;
|
||||
framename = g_strconcat (framename, " (unknown disposal)", NULL);
|
||||
g_free (framename_ptr);
|
||||
g_message ("GIF: Hmm... Composite type %d. Interesting.\n"
|
||||
g_message ("Hmm... Composite type %d. Interesting.\n"
|
||||
"Please forward this GIF to the "
|
||||
"GIF plugin author!\n (adam@foxbox.org)\n",
|
||||
"GIF plugin author!\n (adam@foxbox.org)",
|
||||
previous_disposal);
|
||||
break;
|
||||
default:
|
||||
g_message ("GIF: Something got corrupted.\n");
|
||||
g_message ("Something got corrupted.");
|
||||
break;
|
||||
}
|
||||
previous_disposal = Gif89.disposal;
|
||||
|
@ -977,7 +975,7 @@ ReadImage (FILE *fd,
|
|||
|
||||
if (!alpha_frame && promote_to_rgb)
|
||||
{
|
||||
g_message ("GIF: Ouchie! Can't handle non-alpha RGB frames.\n Please mail the plugin author. (adam@gimp.org)\n");
|
||||
g_message ("Ouchie! Can't handle non-alpha RGB frames.\n Please mail the plugin author. (adam@gimp.org)");
|
||||
gimp_quit();
|
||||
}
|
||||
|
||||
|
@ -1056,12 +1054,9 @@ ReadImage (FILE *fd,
|
|||
ypos++;
|
||||
}
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
cur_progress++;
|
||||
if ((cur_progress % 16) == 0)
|
||||
gimp_progress_update ((double) cur_progress / (double) max_progress);
|
||||
}
|
||||
cur_progress++;
|
||||
if ((cur_progress % 16) == 0)
|
||||
gimp_progress_update ((double) cur_progress / (double) max_progress);
|
||||
}
|
||||
if (ypos >= height)
|
||||
break;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -620,17 +621,18 @@ gih_load_image (gchar *filename)
|
|||
gchar *paramstring;
|
||||
GimpParasite *pipe_parasite;
|
||||
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
/* The file format starts with a painfully simple text header */
|
||||
|
||||
/* get the name */
|
||||
|
@ -645,7 +647,7 @@ gih_load_image (gchar *filename)
|
|||
|
||||
if (!name)
|
||||
{
|
||||
g_message ("Couldn't read name for brush pipe from file '%s'\n",
|
||||
g_message ("Couldn't read name for brush pipe\nfrom '%s'",
|
||||
filename);
|
||||
close (fd);
|
||||
return -1;
|
||||
|
@ -1219,18 +1221,19 @@ gih_save_image (gchar *filename,
|
|||
imageh = gimp_image_height (image_ID);
|
||||
gimp_tile_cache_size (gimp_tile_height () * imagew * 4);
|
||||
|
||||
msg = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (msg);
|
||||
g_free (msg);
|
||||
|
||||
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message( _("Unable to open %s"), filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
msg = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (msg);
|
||||
g_free (msg);
|
||||
|
||||
parstring = gimp_pixpipe_params_build (&gihparams);
|
||||
|
||||
header = g_strdup_printf ("%s\n%d %s\n",
|
||||
|
|
|
@ -196,7 +196,7 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init ( _("Glass Tile..."));
|
||||
gimp_progress_init (_("Glass Tile..."));
|
||||
gimp_tile_cache_ntiles (2 *
|
||||
(drawable->width / gimp_tile_width () + 1));
|
||||
|
||||
|
@ -210,7 +210,7 @@ run (gchar *name,
|
|||
gimp_set_data ("plug_in_glasstile", >vals,
|
||||
sizeof (GlassValues));
|
||||
gimp_fixme_preview_free (preview);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -126,24 +126,24 @@ query()
|
|||
}
|
||||
|
||||
static void
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals)
|
||||
{
|
||||
static GimpParam values[1];
|
||||
GimpDrawable *drawable;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
static GimpParam values[1];
|
||||
GimpDrawable *drawable;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
INIT_I18N();
|
||||
|
||||
*nreturn_vals = 1;
|
||||
*return_vals = values;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
/* Get the specified drawable */
|
||||
|
@ -153,7 +153,7 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init ( _("Gradient Map..."));
|
||||
gimp_progress_init (_("Gradient Map..."));
|
||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||
|
||||
gradmap (drawable);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -115,22 +116,23 @@ static void run (gchar *name,
|
|||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
|
||||
static gint save_image (gchar *filename,
|
||||
GimpDrawable *drawable);
|
||||
static gint save_dialog (gint32 image_ID);
|
||||
static gboolean save_image (gchar *filename,
|
||||
GimpDrawable *drawable);
|
||||
static gboolean save_dialog (gint32 image_ID);
|
||||
|
||||
static gboolean color_comp (guchar *buffer,
|
||||
guchar *buf2);
|
||||
static gboolean color_comp (guchar *buffer,
|
||||
guchar *buf2);
|
||||
static void save_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
gpointer data);
|
||||
static void gtm_caption_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
gpointer data);
|
||||
static void gtm_cellcontent_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
gpointer data);
|
||||
static void gtm_clwidth_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
gpointer data);
|
||||
static void gtm_clheight_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
gpointer data);
|
||||
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
|
@ -148,11 +150,11 @@ query (void)
|
|||
{
|
||||
static GimpParamDef save_args[] =
|
||||
{
|
||||
{ GIMP_PDB_INT32, "run_mode", "Interactive" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Drawable to save" },
|
||||
{ GIMP_PDB_STRING, "filename", "The name of the file to save the image in" },
|
||||
{ GIMP_PDB_STRING, "raw_filename", "The name of the file to save the image in" }
|
||||
{ GIMP_PDB_INT32, "run_mode", "Interactive" },
|
||||
{ GIMP_PDB_IMAGE, "image", "Input image" },
|
||||
{ GIMP_PDB_DRAWABLE, "drawable", "Drawable to save" },
|
||||
{ GIMP_PDB_STRING, "filename", "The name of the file to save the image in" },
|
||||
{ GIMP_PDB_STRING, "raw_filename", "The name of the file to save the image in" }
|
||||
};
|
||||
|
||||
gimp_install_procedure ("file_GTM_save",
|
||||
|
@ -214,142 +216,184 @@ run (gchar *name,
|
|||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
static gint
|
||||
save_image (gchar *filename,
|
||||
static gboolean
|
||||
save_image (gchar *filename,
|
||||
GimpDrawable *drawable)
|
||||
{
|
||||
int row,col, cols, rows, x, y;
|
||||
int colcount, colspan, rowspan;
|
||||
/* This works only in gcc - not allowed according */
|
||||
/* to ANSI C */
|
||||
/*int palloc[drawable->width][drawable->height];*/
|
||||
int *palloc;
|
||||
guchar *buffer, *buf2;
|
||||
gchar *width, *height;
|
||||
GimpPixelRgn pixel_rgn;
|
||||
char *name;
|
||||
gint row,col, cols, rows, x, y;
|
||||
gint colcount, colspan, rowspan;
|
||||
gint *palloc;
|
||||
guchar *buffer, *buf2;
|
||||
gchar *width, *height;
|
||||
GimpPixelRgn pixel_rgn;
|
||||
gchar *name;
|
||||
FILE *fp;
|
||||
|
||||
FILE *fp, *fopen();
|
||||
palloc = g_new (int, drawable->width * drawable->height);
|
||||
|
||||
palloc = malloc(drawable->width * drawable->height * sizeof(int));
|
||||
fp = fopen (filename, "w");
|
||||
|
||||
if (! fp)
|
||||
{
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gtmvals.fulldoc)
|
||||
{
|
||||
fprintf (fp, "<HTML>\n<HEAD><TITLE>%s</TITLE></HEAD>\n<BODY>\n",
|
||||
filename);
|
||||
fprintf (fp, "<H1>%s</H1>\n",
|
||||
filename);
|
||||
}
|
||||
|
||||
fprintf (fp, "<TABLE BORDER=%d CELLPADDING=%d CELLSPACING=%d>\n",
|
||||
gtmvals.border, gtmvals.cellpadding, gtmvals.cellspacing);
|
||||
|
||||
fp = fopen(filename, "w");
|
||||
if (gtmvals.fulldoc) {
|
||||
fprintf (fp,"<HTML>\n<HEAD><TITLE>%s</TITLE></HEAD>\n<BODY>\n",filename);
|
||||
fprintf (fp,"<H1>%s</H1>\n",filename);
|
||||
}
|
||||
fprintf (fp,"<TABLE BORDER=%d CELLPADDING=%d CELLSPACING=%d>\n",gtmvals.border,gtmvals.cellpadding,gtmvals.cellspacing);
|
||||
if (gtmvals.caption)
|
||||
fprintf (fp,"<CAPTION>%s</CAPTION>\n",gtmvals.captiontxt);
|
||||
fprintf (fp, "<CAPTION>%s</CAPTION>\n",
|
||||
gtmvals.captiontxt);
|
||||
|
||||
name = g_strdup_printf (_("Saving %s:"), filename);
|
||||
name = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
|
||||
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, FALSE);
|
||||
gimp_pixel_rgn_init (&pixel_rgn, drawable,
|
||||
0, 0, drawable->width, drawable->height,
|
||||
FALSE, FALSE);
|
||||
|
||||
cols = drawable->width;
|
||||
rows = drawable->height;
|
||||
buffer = g_new(guchar,drawable->bpp);
|
||||
buf2 = g_new(guchar,drawable->bpp);
|
||||
cols = drawable->width;
|
||||
rows = drawable->height;
|
||||
buffer = g_new (guchar, drawable->bpp);
|
||||
buf2 = g_new (guchar, drawable->bpp);
|
||||
|
||||
width = g_malloc (2);
|
||||
height = g_malloc (2);
|
||||
sprintf (width, " ");
|
||||
sprintf (height, " ");
|
||||
|
||||
if (strcmp (gtmvals.clwidth, "") != 0)
|
||||
{
|
||||
width = g_malloc (strlen (gtmvals.clwidth) + 11);
|
||||
sprintf (width," WIDTH=\"%s\"", gtmvals.clwidth);
|
||||
}
|
||||
|
||||
if (strcmp (gtmvals.clheight, "") != 0)
|
||||
{
|
||||
height = g_malloc (strlen (gtmvals.clheight) + 13);
|
||||
sprintf (height, " HEIGHT=\"%s\" ", gtmvals.clheight);
|
||||
}
|
||||
|
||||
width = malloc (2);
|
||||
height = malloc (2);
|
||||
sprintf(width," ");
|
||||
sprintf(height," ");
|
||||
if (strcmp (gtmvals.clwidth, "") != 0) {
|
||||
width = malloc (strlen (gtmvals.clwidth) + 11);
|
||||
sprintf(width," WIDTH=\"%s\"",gtmvals.clwidth);
|
||||
}
|
||||
if (strcmp (gtmvals.clheight, "") != 0) {
|
||||
height = malloc (strlen (gtmvals.clheight) + 13);
|
||||
sprintf(height," HEIGHT=\"%s\" ",gtmvals.clheight);
|
||||
}
|
||||
|
||||
/* Initialize array to hold ROWSPAN and COLSPAN cell allocation table */
|
||||
|
||||
for (row=0; row < rows; row++)
|
||||
for (col=0; col < cols; col++)
|
||||
palloc[drawable->width * row + col]=1;
|
||||
for (row = 0; row < rows; row++)
|
||||
for (col = 0; col < cols; col++)
|
||||
palloc[drawable->width * row + col] = 1;
|
||||
|
||||
colspan=0;
|
||||
rowspan=0;
|
||||
colspan = 0;
|
||||
rowspan = 0;
|
||||
|
||||
for (y = 0; y < rows; y++) {
|
||||
fprintf (fp," <TR>\n");
|
||||
for (x = 0; x < cols; x++) {
|
||||
gimp_pixel_rgn_get_pixel(&pixel_rgn, buffer, x, y);
|
||||
for (y = 0; y < rows; y++)
|
||||
{
|
||||
fprintf (fp," <TR>\n");
|
||||
|
||||
/* Determine ROWSPAN and COLSPAN */
|
||||
for (x = 0; x < cols; x++)
|
||||
{
|
||||
gimp_pixel_rgn_get_pixel (&pixel_rgn, buffer, x, y);
|
||||
|
||||
if (gtmvals.spantags) {
|
||||
col=x;
|
||||
row=y;
|
||||
colcount=0;
|
||||
colspan=0;
|
||||
rowspan=0;
|
||||
gimp_pixel_rgn_get_pixel(&pixel_rgn, buf2, col, row);
|
||||
|
||||
while (color_comp(buffer,buf2) && palloc[drawable->width * row + col] == 1 && row < drawable->height) {
|
||||
while (color_comp(buffer,buf2) && palloc[drawable->width * row + col] == 1 && col < drawable->width ) {
|
||||
colcount++;
|
||||
col++;
|
||||
gimp_pixel_rgn_get_pixel(&pixel_rgn, buf2, col, row);
|
||||
}
|
||||
|
||||
if (colcount != 0) {
|
||||
row++;
|
||||
rowspan++;
|
||||
}
|
||||
|
||||
if (colcount < colspan || colspan == 0)
|
||||
colspan=colcount;
|
||||
|
||||
col=x;
|
||||
colcount=0;
|
||||
gimp_pixel_rgn_get_pixel(&pixel_rgn, buf2, col, row);
|
||||
}
|
||||
|
||||
if (colspan > 1 || rowspan > 1) {
|
||||
for (row=0; row < rowspan; row++)
|
||||
for (col=0; col < colspan; col++)
|
||||
palloc[drawable->width * (row+y) + (col+x)]=0;
|
||||
palloc[drawable->width * y + x]=2;
|
||||
}
|
||||
}
|
||||
/* Determine ROWSPAN and COLSPAN */
|
||||
|
||||
if (palloc[drawable->width * y + x]==1)
|
||||
fprintf (fp," <TD%s%sBGCOLOR=#%02x%02x%02x>",width,height,buffer[0],buffer[1],buffer[2]);
|
||||
if (gtmvals.spantags)
|
||||
{
|
||||
col = x;
|
||||
row = y;
|
||||
colcount = 0;
|
||||
colspan = 0;
|
||||
rowspan = 0;
|
||||
|
||||
if (palloc[drawable->width * y + x]==2)
|
||||
fprintf (fp," <TD ROWSPAN=\"%d\" COLSPAN=\"%d\"%s%sBGCOLOR=#%02x%02x%02x>",rowspan,colspan,width,height,buffer[0],buffer[1],buffer[2]);
|
||||
gimp_pixel_rgn_get_pixel (&pixel_rgn, buf2, col, row);
|
||||
|
||||
if (palloc[drawable->width * y + x]!=0) {
|
||||
if (gtmvals.tdcomp)
|
||||
fprintf (fp,"%s</TD>\n",gtmvals.cellcontent);
|
||||
else
|
||||
fprintf (fp,"\n %s\n </TD>\n",gtmvals.cellcontent);
|
||||
}
|
||||
while (color_comp (buffer,buf2) &&
|
||||
palloc[drawable->width * row + col] == 1 &&
|
||||
row < drawable->height)
|
||||
{
|
||||
while (color_comp (buffer,buf2) &&
|
||||
palloc[drawable->width * row + col] == 1 &&
|
||||
col < drawable->width )
|
||||
{
|
||||
colcount++;
|
||||
col++;
|
||||
|
||||
gimp_pixel_rgn_get_pixel (&pixel_rgn, buf2, col, row);
|
||||
}
|
||||
|
||||
if (colcount != 0)
|
||||
{
|
||||
row++;
|
||||
rowspan++;
|
||||
}
|
||||
|
||||
if (colcount < colspan || colspan == 0)
|
||||
colspan = colcount;
|
||||
|
||||
col = x;
|
||||
colcount = 0;
|
||||
|
||||
gimp_pixel_rgn_get_pixel (&pixel_rgn, buf2, col, row);
|
||||
}
|
||||
|
||||
if (colspan > 1 || rowspan > 1)
|
||||
{
|
||||
for (row = 0; row < rowspan; row++)
|
||||
for (col = 0; col < colspan; col++)
|
||||
palloc[drawable->width * (row + y) + (col + x)] = 0;
|
||||
|
||||
palloc[drawable->width * y + x] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (palloc[drawable->width * y + x] == 1)
|
||||
fprintf (fp, " <TD%s%sBGCOLOR=#%02x%02x%02x>",
|
||||
width, height, buffer[0], buffer[1], buffer[2]);
|
||||
|
||||
if (palloc[drawable->width * y + x] == 2)
|
||||
fprintf (fp," <TD ROWSPAN=\"%d\" COLSPAN=\"%d\"%s%sBGCOLOR=#%02x%02x%02x>",
|
||||
rowspan, colspan, width, height,
|
||||
buffer[0], buffer[1], buffer[2]);
|
||||
|
||||
if (palloc[drawable->width * y + x] != 0)
|
||||
{
|
||||
if (gtmvals.tdcomp)
|
||||
fprintf (fp, "%s</TD>\n", gtmvals.cellcontent);
|
||||
else
|
||||
fprintf (fp, "\n %s\n </TD>\n", gtmvals.cellcontent);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (fp," </TR>\n");
|
||||
|
||||
gimp_progress_update ((double) y / (double) rows);
|
||||
}
|
||||
fprintf (fp," </TR>\n");
|
||||
gimp_progress_update ((double) y / (double) rows);
|
||||
}
|
||||
|
||||
if (gtmvals.fulldoc)
|
||||
fprintf (fp,"</TABLE></BODY></HTML>\n");
|
||||
else fprintf (fp,"</TABLE>\n");
|
||||
fclose(fp);
|
||||
fprintf (fp, "</TABLE></BODY></HTML>\n");
|
||||
else
|
||||
fprintf (fp, "</TABLE>\n");
|
||||
|
||||
fclose (fp);
|
||||
gimp_drawable_detach (drawable);
|
||||
free(width);
|
||||
free(height);
|
||||
|
||||
free(palloc);
|
||||
g_free (width);
|
||||
g_free (height);
|
||||
|
||||
return 1;
|
||||
g_free (palloc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
save_dialog (image_ID)
|
||||
save_dialog (gint32 image_ID)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *main_vbox;
|
||||
|
|
|
@ -267,7 +267,7 @@ spawn_gzip (gchar *filename,
|
|||
|
||||
if (!(f = fopen (filename,"w")))
|
||||
{
|
||||
g_message ("gz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ spawn_gzip (gchar *filename,
|
|||
/* make stdout for this process be the output file */
|
||||
if (dup2 (fileno (f), fileno (stdout)) == -1)
|
||||
{
|
||||
g_message ("gz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
close (tfd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ spawn_gzip (gchar *filename,
|
|||
close (tfd);
|
||||
if (*pid == -1)
|
||||
{
|
||||
g_message ("gz: spawn failed: %s\n", g_strerror (errno));
|
||||
g_message ("spawn failed: %s", g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -316,7 +316,7 @@ save_image (gchar *filename,
|
|||
|
||||
if (NULL == (ext = find_extension (filename)))
|
||||
{
|
||||
g_message (_("gz: no sensible extension, saving as gzip'd xcf\n"));
|
||||
g_message (_("No sensible extension, saving as gzip'd xcf"));
|
||||
ext = ".xcf";
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ save_image (gchar *filename,
|
|||
/* fork off a gzip process */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("gz: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -356,18 +356,18 @@ save_image (gchar *filename,
|
|||
|
||||
if (!(f = fopen (filename, "w")))
|
||||
{
|
||||
g_message ("gz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
||||
/* make stdout for this process be the output file */
|
||||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||
g_message ("gz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
|
||||
/* and gzip into it */
|
||||
execlp ("gzip", "gzip", "-cf", tmpname, NULL);
|
||||
g_message ("gz: exec failed: gzip: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: gzip: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ save_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("gz: gzip exited abnormally on file %s\n", tmpname);
|
||||
g_message ("gzip exited abnormally on file\n'%s'", tmpname);
|
||||
g_free (tmpname);
|
||||
return 0;
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ save_image (gchar *filename,
|
|||
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
|
||||
&startupinfo, &processinfo))
|
||||
{
|
||||
g_message ("gz: CreateProcess failed. Minigzip.exe not in the ?\n");
|
||||
g_message ("CreateProcess failed. Minigzip.exe not in the path?");
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ load_image (gchar *filename,
|
|||
|
||||
if (NULL == (ext = find_extension (filename)))
|
||||
{
|
||||
g_message (_("gz: no sensible extension, attempting to load with file magic\n"));
|
||||
g_message (_("No sensible extension, attempting to load with file magic"));
|
||||
}
|
||||
|
||||
/* find a temp name */
|
||||
|
@ -459,7 +459,7 @@ load_image (gchar *filename,
|
|||
/* fork off a g(un)zip and wait for it */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("gz: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -469,7 +469,7 @@ load_image (gchar *filename,
|
|||
FILE *f;
|
||||
if (!(f = fopen (tmpname, "w")))
|
||||
{
|
||||
g_message ("gz: fopen failed: %s\n", g_strerror (errno));
|
||||
g_message ("fopen() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
@ -478,12 +478,12 @@ load_image (gchar *filename,
|
|||
if (-1 == dup2 (fileno (f), fileno (stdout)))
|
||||
{
|
||||
g_free (tmpname);
|
||||
g_message ("gz: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
}
|
||||
|
||||
/* and unzip into it */
|
||||
execlp ("gzip", "gzip", "-cfd", filename, NULL);
|
||||
g_message ("gz: exec failed: gunzip: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: gunzip: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit(127);
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ load_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("gz: gzip exited abnormally on file %s\n", filename);
|
||||
g_message ("gzip exited abnormally on file\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -523,7 +523,7 @@ load_image (gchar *filename,
|
|||
TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL,
|
||||
&startupinfo, &processinfo))
|
||||
{
|
||||
g_message ("gz: CreateProcess failed: %d\n", GetLastError ());
|
||||
g_message ("CreateProcess failed: %d", GetLastError ());
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
|
|
@ -353,17 +353,18 @@ pluginCore (piArgs *argp)
|
|||
|
||||
src = g_new (guchar, width * height * bpp);
|
||||
dst = g_new (guchar, width * height * 4);
|
||||
gimp_pixel_rgn_init (&srcPr, drw, sel_x1, sel_y1, width, height, FALSE,
|
||||
FALSE);
|
||||
gimp_pixel_rgn_init (&srcPr, drw, sel_x1, sel_y1, width, height,
|
||||
FALSE, FALSE);
|
||||
|
||||
if (argp->new_layerp)
|
||||
{
|
||||
gimp_pixel_rgn_init (&dstPr, ndrw, sel_x1, sel_y1, width, height, FALSE,
|
||||
FALSE);
|
||||
gimp_pixel_rgn_init (&dstPr, ndrw, sel_x1, sel_y1, width, height,
|
||||
FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_pixel_rgn_init (&dstPr, drw, sel_x1, sel_y1, width, height, TRUE,
|
||||
TRUE);
|
||||
gimp_pixel_rgn_init (&dstPr, drw, sel_x1, sel_y1, width, height,
|
||||
TRUE, TRUE);
|
||||
}
|
||||
|
||||
gimp_pixel_rgn_get_rect (&srcPr, src, sel_x1, sel_y1, width, height);
|
||||
|
@ -373,13 +374,14 @@ pluginCore (piArgs *argp)
|
|||
|
||||
build_tab (argp->mode);
|
||||
|
||||
gimp_progress_init (_("Hot"));
|
||||
gimp_progress_init (_("Hot..."));
|
||||
prog_interval = height / 10;
|
||||
|
||||
for (y = sel_y1; y < sel_y2; y++)
|
||||
{
|
||||
if (y % prog_interval == 0)
|
||||
gimp_progress_update ((double) y / (double) (sel_y2 - sel_y1));
|
||||
|
||||
for (x = sel_x1; x < sel_x2; x++)
|
||||
{
|
||||
if (hotp (r = *(s + 0), g = *(s + 1), b = *(s + 2)))
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -328,38 +329,38 @@ load_image (gchar *filename)
|
|||
void *mapped; /* memory mapped file data */
|
||||
struct stat statbuf; /* must check file size */
|
||||
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
/* open the file */
|
||||
filedes = open (filename, O_RDONLY | _O_BINARY);
|
||||
|
||||
if (filedes == -1)
|
||||
{
|
||||
/* errno is set to indicate the error, but the user won't know :-( */
|
||||
/*gimp_message("hrz filter: can't open file\n");*/
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
/* stat the file to see if it is the right size */
|
||||
fstat (filedes, &statbuf);
|
||||
if (statbuf.st_size != 256*240*3)
|
||||
{
|
||||
g_message ("hrz: file is not HRZ type");
|
||||
g_message (_("'%s' is not a HRZ file"), filename);
|
||||
return -1;
|
||||
}
|
||||
#ifdef HAVE_MMAP
|
||||
mapped = mmap(NULL, 256*240*3, PROT_READ, MAP_PRIVATE, filedes, 0);
|
||||
if (mapped == (void *)(-1))
|
||||
{
|
||||
g_message ("hrz: could not map file");
|
||||
g_message ("Could not map file");
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
mapped = g_malloc(256*240*3);
|
||||
if (read (filedes, mapped, 256*240*3) != 256*240*3)
|
||||
{
|
||||
g_message ("hrz: file read error");
|
||||
g_message ("File read error");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
@ -447,8 +448,8 @@ save_image (gchar *filename,
|
|||
fp = fopen (filename, "wb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
/* Ought to pass errno back... */
|
||||
g_message ("hrz: can't open \"%s\"\n", filename);
|
||||
g_message ("Can't open '%s' for writing:\n%s",
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -457,16 +458,16 @@ save_image (gchar *filename,
|
|||
|
||||
if ((xres != 256) || (yres != 240))
|
||||
{
|
||||
g_message ("hrz: Image must be 256x240 for HRZ format.");
|
||||
g_message (_("Image must be 256x240"));
|
||||
return FALSE;
|
||||
}
|
||||
if (drawable_type == GIMP_INDEXED_IMAGE)
|
||||
{
|
||||
g_message ("hrz: Image must be RGB or GRAY for HRZ format.");
|
||||
g_message (_("Image must be RGB or GRAY"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
|
|
|
@ -769,9 +769,11 @@ iwarp (void)
|
|||
gimp_layer_set_name (animlayers[i], st);
|
||||
g_free (st);
|
||||
destdrawable = gimp_drawable_get (animlayers[i]);
|
||||
st = g_strdup_printf (_("Warping Frame Nr %d ..."), frame_number);
|
||||
|
||||
st = g_strdup_printf (_("Warping Frame No. %d..."), frame_number);
|
||||
gimp_progress_init (st);
|
||||
g_free (st);
|
||||
|
||||
if (animate_deform_value >0.0)
|
||||
iwarp_frame ();
|
||||
gimp_image_add_layer (imageID, animlayers[i], 0);
|
||||
|
@ -780,9 +782,10 @@ iwarp (void)
|
|||
}
|
||||
if (do_animate_ping_pong)
|
||||
{
|
||||
st = g_strdup_printf (_("Warping Frame Nr %d ..."), frame_number);
|
||||
st = g_strdup_printf (_("Warping Frame No. %d..."), frame_number);
|
||||
gimp_progress_init (_("Ping Pong"));
|
||||
g_free (st);
|
||||
|
||||
for (i = 0; i < animate_num_frames; i++)
|
||||
{
|
||||
gimp_progress_update ((gdouble) i / (animate_num_frames - 1));
|
||||
|
|
|
@ -461,7 +461,7 @@ run (gchar *name,
|
|||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
break;
|
||||
}
|
||||
gimp_progress_init( _("Assembling Jigsaw"));
|
||||
gimp_progress_init (_("Assembling Jigsaw..."));
|
||||
if (jigsaw(FALSE) == -1)
|
||||
{
|
||||
status = GIMP_PDB_CALLING_ERROR;
|
||||
|
|
|
@ -133,6 +133,7 @@
|
|||
#include <glib.h> /* We want glib.h first because of some
|
||||
* pretty obscure Win32 compilation issues.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
@ -729,16 +730,13 @@ load_image (gchar *filename,
|
|||
|
||||
if ((infile = fopen (filename, "rb")) == NULL)
|
||||
{
|
||||
g_message (_("can't open \"%s\"\n"), filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
if (runmode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
name = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
}
|
||||
name = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
|
||||
image_ID = -1;
|
||||
/* Establish the setjmp return context for my_error_exit to use. */
|
||||
|
@ -853,7 +851,9 @@ load_image (gchar *filename,
|
|||
/*fallthrough*/
|
||||
|
||||
default:
|
||||
g_message ("don't know how to load JPEGs\nwith %d color channels\nusing colorspace %d (%d)",
|
||||
g_message ("Don't know how to load JPEGs\n"
|
||||
"with %d color channels\n"
|
||||
"using colorspace %d (%d)",
|
||||
cinfo.output_components, cinfo.out_color_space,
|
||||
cinfo.jpeg_color_space);
|
||||
gimp_quit ();
|
||||
|
@ -933,7 +933,7 @@ load_image (gchar *filename,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message ("unknown density unit %d\nassuming dots per inch",
|
||||
g_message ("Unknown density unit %d\nassuming dots per inch",
|
||||
cinfo.density_unit);
|
||||
break;
|
||||
}
|
||||
|
@ -1011,11 +1011,8 @@ load_image (gchar *filename,
|
|||
gimp_pixel_rgn_set_rect (&pixel_rgn, padded_buf ? padded_buf : buf,
|
||||
0, start, drawable->width, scanlines);
|
||||
|
||||
if (runmode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
gimp_progress_update ((gdouble) cinfo.output_scanline /
|
||||
(gdouble) cinfo.output_height);
|
||||
}
|
||||
gimp_progress_update ((gdouble) cinfo.output_scanline /
|
||||
(gdouble) cinfo.output_height);
|
||||
}
|
||||
|
||||
/* Step 7: Finish decompression */
|
||||
|
@ -1200,7 +1197,7 @@ save_image (gchar *filename,
|
|||
|
||||
if (!preview)
|
||||
{
|
||||
name = g_strdup_printf (_("Saving %s:"), filename);
|
||||
name = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
}
|
||||
|
@ -1244,7 +1241,8 @@ save_image (gchar *filename,
|
|||
*/
|
||||
if ((outfile = fopen (filename, "wb")) == NULL)
|
||||
{
|
||||
g_message ("can't open %s\n", filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
jpeg_stdio_dest (&cinfo, outfile);
|
||||
|
@ -1749,9 +1747,9 @@ save_dialog (void)
|
|||
restart);
|
||||
|
||||
gtk_widget_set_sensitive (restart_markers_label,
|
||||
(jsvals.restart ? TRUE : FALSE));
|
||||
jsvals.restart ? TRUE : FALSE);
|
||||
gtk_widget_set_sensitive (restart_markers_scale,
|
||||
(jsvals.restart ? TRUE : FALSE));
|
||||
jsvals.restart ? TRUE : FALSE);
|
||||
|
||||
gtk_widget_show (restart_markers_scale);
|
||||
|
||||
|
@ -1929,9 +1927,9 @@ save_restart_update (GtkAdjustment *adjustment,
|
|||
jsvals.restart = GTK_TOGGLE_BUTTON (toggle)->active ? adjustment->value : 0;
|
||||
|
||||
gtk_widget_set_sensitive (restart_markers_label,
|
||||
(jsvals.restart ? TRUE : FALSE));
|
||||
jsvals.restart ? TRUE : FALSE);
|
||||
gtk_widget_set_sensitive (restart_markers_scale,
|
||||
(jsvals.restart ? TRUE : FALSE));
|
||||
jsvals.restart ? TRUE : FALSE);
|
||||
|
||||
make_preview ();
|
||||
}
|
||||
|
|
|
@ -197,22 +197,22 @@ static void
|
|||
laplace (GimpDrawable *drawable)
|
||||
{
|
||||
GimpPixelRgn srcPR, destPR;
|
||||
gint width, height;
|
||||
gint bytes;
|
||||
gint current;
|
||||
gint gradient;
|
||||
gint max_gradient = 0;
|
||||
gint alpha;
|
||||
gint counter;
|
||||
guchar *dest, *d;
|
||||
guchar *prev_row, *pr;
|
||||
guchar *cur_row, *cr;
|
||||
guchar *next_row, *nr;
|
||||
guchar *tmp;
|
||||
gint row, col;
|
||||
gint x1, y1, x2, y2;
|
||||
gint minval, maxval;
|
||||
gfloat scale = 1.0;
|
||||
gint width, height;
|
||||
gint bytes;
|
||||
gint current;
|
||||
gint gradient;
|
||||
gint max_gradient = 0;
|
||||
gint alpha;
|
||||
gint counter;
|
||||
guchar *dest, *d;
|
||||
guchar *prev_row, *pr;
|
||||
guchar *cur_row, *cr;
|
||||
guchar *next_row, *nr;
|
||||
guchar *tmp;
|
||||
gint row, col;
|
||||
gint x1, y1, x2, y2;
|
||||
gint minval, maxval;
|
||||
gfloat scale = 1.0;
|
||||
|
||||
/* Get the input area. This is the bounding box of the selection in
|
||||
* the image (or the entire image if there is no selection). Only
|
||||
|
@ -222,7 +222,7 @@ laplace (GimpDrawable *drawable)
|
|||
*/
|
||||
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
gimp_progress_init ( _("Laplace..."));
|
||||
gimp_progress_init (_("Laplace..."));
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
|
@ -299,7 +299,7 @@ laplace (GimpDrawable *drawable)
|
|||
laplace_prepare_row (&srcPR, pr, x1, y1 - 1, (x2 - x1));
|
||||
laplace_prepare_row (&srcPR, cr, x1, y1, (x2 - x1));
|
||||
|
||||
gimp_progress_init ( _("Cleanup..."));
|
||||
gimp_progress_init (_("Cleanup..."));
|
||||
scale = (255.0 / (gfloat) max_gradient);
|
||||
counter =0;
|
||||
|
||||
|
|
|
@ -624,7 +624,7 @@ compute_image (void)
|
|||
gimp_pixel_rgn_init (&dest_region, output_drawable,
|
||||
0, 0, width, height, TRUE, TRUE);
|
||||
|
||||
gimp_progress_init (_("Van Gogh (LIC)"));
|
||||
gimp_progress_init (_("Van Gogh (LIC)..."));
|
||||
|
||||
if (licvals.effect_convolve == 0)
|
||||
generatevectors ();
|
||||
|
|
|
@ -358,7 +358,7 @@ save_image (gchar *filename,
|
|||
/* fork off a uuencode process */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("mail: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -366,12 +366,12 @@ save_image (gchar *filename,
|
|||
{
|
||||
if (-1 == dup2 (fileno (mailpipe), fileno (stdout)))
|
||||
{
|
||||
g_message ("mail: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
}
|
||||
|
||||
execlp (UUENCODE, UUENCODE, tmpname, filename, NULL);
|
||||
/* What are we doing here? exec must have failed */
|
||||
g_message ("mail: exec failed: uuencode: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: uuencode: %s", g_strerror (errno));
|
||||
|
||||
/* close the pipe now */
|
||||
pclose (mailpipe);
|
||||
|
@ -385,7 +385,7 @@ save_image (gchar *filename,
|
|||
tfd = dup (fileno (stdout));
|
||||
if (dup2 (fileno (mailpipe), fileno (stdout)) == -1)
|
||||
{
|
||||
g_message ("mail: dup2 failed: %s\n", g_strerror (errno));
|
||||
g_message ("dup2() failed: %s", g_strerror (errno));
|
||||
close (tfd);
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -397,7 +397,7 @@ save_image (gchar *filename,
|
|||
close (tfd);
|
||||
if (pid == -1)
|
||||
{
|
||||
g_message ("mail: spawn failed: %s\n", g_strerror (errno));
|
||||
g_message ("spawn failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ save_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("mail: mail didnt work or something on file %s\n", tmpname);
|
||||
g_message ("mail didnt work or something on file\n'%s'", tmpname);
|
||||
g_free (tmpname);
|
||||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ find_extension (gchar *filename)
|
|||
{
|
||||
if (!ext || ext[1] == 0 || strchr (ext, '/'))
|
||||
{
|
||||
g_message (_("mail: some sort of error with the file extension or lack thereof \n"));
|
||||
g_message (_("some sort of error with the file extension or lack thereof"));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -434,8 +434,7 @@ run (gchar *name,
|
|||
|
||||
plvals.map_mode = 0;
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
gimp_progress_init (_("Adjusting Foreground/Background"));
|
||||
gimp_progress_init (_("Adjusting Foreground/Background..."));
|
||||
|
||||
color_mapping (drawable);
|
||||
break;
|
||||
|
@ -477,8 +476,7 @@ run (gchar *name,
|
|||
break;
|
||||
}
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
gimp_progress_init (_("Mapping colors"));
|
||||
gimp_progress_init (_("Mapping colors..."));
|
||||
|
||||
color_mapping (drawable);
|
||||
|
||||
|
@ -793,17 +791,15 @@ color_mapping (GimpDrawable *drawable)
|
|||
processed++;
|
||||
}
|
||||
}
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
if ((gdouble) processed / (gdouble) total - progress > 0.1)
|
||||
{
|
||||
progress = (gdouble) processed / (gdouble) total;
|
||||
gimp_progress_update (progress);
|
||||
}
|
||||
}
|
||||
|
||||
if ((gdouble) processed / (gdouble) total - progress > 0.1)
|
||||
{
|
||||
progress = (gdouble) processed / (gdouble) total;
|
||||
gimp_progress_update (progress);
|
||||
}
|
||||
}
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
gimp_drawable_flush (drawable);
|
||||
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);
|
||||
|
|
|
@ -154,7 +154,7 @@ run (gchar *name,
|
|||
/* Since a channel might be selected, we must check wheter RGB or not. */
|
||||
if (!gimp_drawable_is_rgb (drawable->drawable_id))
|
||||
{
|
||||
g_message (_("Max RGB: Can only operate on RGB drawables."));
|
||||
g_message (_("Can only operate on RGB drawables."));
|
||||
return;
|
||||
}
|
||||
if (! dialog (drawable))
|
||||
|
@ -229,9 +229,8 @@ main_function (GimpDrawable *drawable,
|
|||
gimp_fixme_preview_update (preview, max_rgb_func, ¶m);
|
||||
}
|
||||
else
|
||||
{ /* normal mode */
|
||||
|
||||
gimp_progress_init ( _("Max RGB: Scanning..."));
|
||||
{
|
||||
gimp_progress_init ( _("Max RGB..."));
|
||||
|
||||
gimp_rgn_iterate2 (drawable, run_mode, max_rgb_func, ¶m);
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ mblur_zoom (void)
|
|||
static void
|
||||
mblur (void)
|
||||
{
|
||||
gimp_progress_init (_("Blurring..."));
|
||||
gimp_progress_init (_("Motion Blurring..."));
|
||||
|
||||
switch (mbvals.mblur_type)
|
||||
{
|
||||
|
|
|
@ -447,7 +447,7 @@ mosaic (GimpDrawable *drawable)
|
|||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
|
||||
/* progress bar for gradient finding */
|
||||
gimp_progress_init ( _("Finding Edges..."));
|
||||
gimp_progress_init (_("Finding Edges..."));
|
||||
|
||||
/* Find the gradients */
|
||||
find_gradients (drawable, std_dev);
|
||||
|
@ -511,7 +511,7 @@ mosaic (GimpDrawable *drawable)
|
|||
0.5 : 1.0 - mvals.tile_spacing / mvals.tile_size;
|
||||
|
||||
/* Progress bar for rendering tiles */
|
||||
gimp_progress_init ( _("Rendering Tiles..."));
|
||||
gimp_progress_init (_("Rendering Tiles..."));
|
||||
|
||||
/* Render the tiles */
|
||||
grid_render (drawable);
|
||||
|
|
|
@ -660,7 +660,7 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init (_("Newsprintifing..."));
|
||||
gimp_progress_init (_("Newsprint..."));
|
||||
|
||||
/* set the tile cache size */
|
||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||
|
|
|
@ -137,7 +137,8 @@ run (gchar *name,
|
|||
gint *nretvals,
|
||||
GimpParam **retvals)
|
||||
{
|
||||
static GimpParam rvals[1];
|
||||
static GimpParam rvals[1];
|
||||
GimpDrawable *drawable;
|
||||
|
||||
piArgs args;
|
||||
|
||||
|
@ -158,7 +159,6 @@ run (gchar *name,
|
|||
|
||||
switch (param[0].data.d_int32)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
case GIMP_RUN_INTERACTIVE:
|
||||
/* XXX: add code here for interactive running */
|
||||
if (args.radius == -1)
|
||||
|
@ -211,11 +211,11 @@ static gint
|
|||
pluginCore (piArgs *argp)
|
||||
{
|
||||
GimpDrawable *drw;
|
||||
GimpPixelRgn srcPr, dstPr;
|
||||
guchar *srcbuf, *dstbuf;
|
||||
guchar *lastrow, *thisrow, *nextrow, *temprow;
|
||||
guint width, height, bpp;
|
||||
gint filtno, y, rowsize, exrowsize, p_update;
|
||||
GimpPixelRgn srcPr, dstPr;
|
||||
guchar *srcbuf, *dstbuf;
|
||||
guchar *lastrow, *thisrow, *nextrow, *temprow;
|
||||
guint width, height, bpp;
|
||||
gint filtno, y, rowsize, exrowsize, p_update;
|
||||
|
||||
drw = gimp_drawable_get (argp->drw);
|
||||
|
||||
|
@ -241,7 +241,7 @@ pluginCore (piArgs *argp)
|
|||
nextrow = thisrow + exrowsize;
|
||||
|
||||
filtno = nlfiltInit (argp->alpha, argp->radius, argp->filter);
|
||||
gimp_progress_init (_("NL Filter"));
|
||||
gimp_progress_init (_("NL Filter..."));
|
||||
|
||||
/* first row */
|
||||
gimp_pixel_rgn_get_row (&srcPr, thisrow, 0, 0, width);
|
||||
|
|
|
@ -116,10 +116,12 @@ run (gchar *name,
|
|||
image_ID = param[1].data.d_image;
|
||||
|
||||
/* Make sure that the drawable is gray or RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->drawable_id) || gimp_drawable_is_gray (drawable->drawable_id))
|
||||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init (_("Normalizing..."));
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
|
||||
|
||||
normalize (drawable);
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
|
@ -128,6 +130,7 @@ run (gchar *name,
|
|||
else if (gimp_drawable_is_indexed (drawable->drawable_id))
|
||||
{
|
||||
indexed_normalize (image_ID);
|
||||
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
gimp_displays_flush ();
|
||||
}
|
||||
|
@ -138,9 +141,9 @@ run (gchar *name,
|
|||
}
|
||||
|
||||
*nreturn_vals = 1;
|
||||
*return_vals = values;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
|
|
@ -205,8 +205,7 @@ query (void)
|
|||
"Eiichi Takamori",
|
||||
"Eiichi Takamori",
|
||||
"May 2000",
|
||||
/* don't translate '<Image>', it's a keyword
|
||||
* of the gtk toolkit */
|
||||
/* don't translate '<Image>' */
|
||||
N_("<Image>/Filters/Light Effects/SuperNova..."),
|
||||
"RGB*, GRAY*",
|
||||
GIMP_PLUGIN,
|
||||
|
@ -257,6 +256,7 @@ run (gchar *name,
|
|||
/* Make sure all the arguments are there! */
|
||||
if (nparams != 9)
|
||||
status = GIMP_PDB_CALLING_ERROR;
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
pvals.xcenter = param[3].data.d_int32;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -152,6 +153,7 @@ run (gchar *name,
|
|||
|
||||
*nreturn_vals = 1;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = GIMP_PDB_STATUS;
|
||||
values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
||||
|
@ -184,8 +186,8 @@ run (gchar *name,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init ("pat", FALSE);
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "PAT",
|
||||
(GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB));
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB);
|
||||
if (export == GIMP_EXPORT_CANCEL)
|
||||
{
|
||||
values[0].data.d_status = GIMP_PDB_CANCEL;
|
||||
|
@ -259,14 +261,17 @@ load_image (gchar *filename)
|
|||
GimpImageBaseType base_type;
|
||||
GimpImageType image_type;
|
||||
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
||||
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
if (read (fd, &ph, sizeof (PatternHeader)) != sizeof (PatternHeader))
|
||||
{
|
||||
|
@ -297,7 +302,7 @@ load_image (gchar *filename)
|
|||
}
|
||||
|
||||
/* Now there's just raw data left. */
|
||||
|
||||
|
||||
/*
|
||||
* Create a new image of the proper size and associate the filename with it.
|
||||
*/
|
||||
|
@ -327,7 +332,8 @@ load_image (gchar *filename)
|
|||
"Loading it anyway...");
|
||||
break;
|
||||
default:
|
||||
g_message ("Unsupported pattern depth: %d\nGIMP Patterns must be GRAY or RGB\n", ph.bytes);
|
||||
g_message ("Unsupported pattern depth: %d\n"
|
||||
"GIMP Patterns must be GRAY or RGB", ph.bytes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -377,7 +383,16 @@ save_image (gchar *filename,
|
|||
GimpPixelRgn pixel_rgn;
|
||||
gchar *temp;
|
||||
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
|
@ -385,11 +400,6 @@ save_image (gchar *filename,
|
|||
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,
|
||||
drawable->height, FALSE, FALSE);
|
||||
|
||||
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1)
|
||||
return FALSE;
|
||||
|
||||
ph.header_size = g_htonl (sizeof (PatternHeader) + strlen (description) + 1);
|
||||
ph.version = g_htonl (1);
|
||||
ph.width = g_htonl (drawable->width);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -294,26 +295,26 @@ load_image (gchar *filename)
|
|||
gint32 image, layer;
|
||||
guchar *dest, cmap[768];
|
||||
|
||||
message = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (message);
|
||||
g_free (message);
|
||||
|
||||
fd = fopen (filename, "rb");
|
||||
if (!fd)
|
||||
{
|
||||
g_message ("PCX: Can't open\n%s", filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
message = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (message);
|
||||
g_free (message);
|
||||
|
||||
if (fread (&pcx_header, 128, 1, fd) == 0)
|
||||
{
|
||||
g_message ("PCX: Can't read header from\n%s", filename);
|
||||
g_message (_("Can't read header from\n'%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pcx_header.manufacturer != 10)
|
||||
{
|
||||
g_message ("%s\nis not a PCX file", filename);
|
||||
g_message (_("'%s'\nis not a PCX file"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -366,7 +367,7 @@ load_image (gchar *filename)
|
|||
}
|
||||
else
|
||||
{
|
||||
g_message ("Unusual PCX flavour, giving up");
|
||||
g_message (_("Unusual PCX flavour, giving up"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -540,7 +541,7 @@ save_image (gchar *filename,
|
|||
height = drawable->height;
|
||||
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||
|
||||
message = g_strdup_printf (_("Saving %s:"), filename);
|
||||
message = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (message);
|
||||
g_free (message);
|
||||
|
||||
|
@ -573,14 +574,14 @@ save_image (gchar *filename,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message ("PCX Can't save this image type\nFlatten your image");
|
||||
g_message (_("Can't save layers with alpha.\nFlatten your image"));
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((fp = fopen(filename, "wb")) == NULL)
|
||||
if ((fp = fopen (filename, "wb")) == NULL)
|
||||
{
|
||||
g_message ("PCX Can't open \n%s", filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -609,9 +610,11 @@ save_image (gchar *filename,
|
|||
fputc (0, fp); fputc (0, fp); fputc (0, fp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_RGB_IMAGE:
|
||||
save_24 (fp, width, height, pixels);
|
||||
break;
|
||||
|
||||
case GIMP_GRAY_IMAGE:
|
||||
save_8 (fp, width, height, pixels);
|
||||
fputc (0x0c, fp);
|
||||
|
@ -620,10 +623,9 @@ save_image (gchar *filename,
|
|||
fputc ((guchar) i, fp); fputc ((guchar) i, fp); fputc ((guchar) i, fp);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_message ("Can't save this image as PCX\nFlatten your image");
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
|
|
@ -44,6 +44,7 @@ static char ident[] = "@(#) GIMP Alias|Wavefront pix image file-plugin v1.0 24-
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -323,20 +324,21 @@ load_image (gchar *filename)
|
|||
GimpImageBaseType imgtype;
|
||||
GimpImageType gdtype;
|
||||
|
||||
/* Set up progress display */
|
||||
progMessage = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (progMessage);
|
||||
g_free (progMessage);
|
||||
|
||||
PIX_DEBUG_PRINT ("Opening file: %s\n", filename);
|
||||
|
||||
/* Open the file */
|
||||
file = fopen (filename, "rb");
|
||||
if (NULL == file)
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Set up progress display */
|
||||
progMessage = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (progMessage);
|
||||
g_free (progMessage);
|
||||
|
||||
/* Read header information */
|
||||
width = get_short (file);
|
||||
height = get_short (file);
|
||||
|
@ -508,10 +510,14 @@ save_image (gchar *filename,
|
|||
/* Open the output file. */
|
||||
file = fopen (filename, "wb");
|
||||
if (!file)
|
||||
return FALSE;
|
||||
{
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set up progress display */
|
||||
progMessage = g_strdup_printf (_("Saving %s:"), filename);
|
||||
progMessage = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (progMessage);
|
||||
g_free (progMessage);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
@ -453,7 +454,7 @@ load_image (gchar * filename) /* I - File to load */
|
|||
|
||||
if (setjmp (pp->jmpbuf))
|
||||
{
|
||||
g_message (_("%s\nPNG error. File corrupted?"), filename);
|
||||
g_message (_("'%s':\nPNG error. File corrupted?"), filename);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
@ -469,18 +470,13 @@ load_image (gchar * filename) /* I - File to load */
|
|||
|
||||
if (fp == NULL)
|
||||
{
|
||||
g_message ("%s\nis not present or is unreadable", filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
png_init_io (pp, fp);
|
||||
|
||||
if (strrchr (filename, '/') != NULL)
|
||||
progress =
|
||||
g_strdup_printf (_("Loading %s:"), strrchr (filename, '/') + 1);
|
||||
else
|
||||
progress = g_strdup_printf (_("Loading %s:"), filename);
|
||||
|
||||
progress = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (progress);
|
||||
g_free (progress);
|
||||
|
||||
|
@ -589,14 +585,14 @@ load_image (gchar * filename) /* I - File to load */
|
|||
layer_type = GIMP_INDEXED_IMAGE;
|
||||
break;
|
||||
default: /* Aie! Unknown type */
|
||||
g_message (_("%s\nPNG unknown color model"), filename);
|
||||
g_message (_("'%s':\nUnknown PNG color model"), filename);
|
||||
return -1;
|
||||
};
|
||||
|
||||
image = gimp_image_new (info->width, info->height, image_type);
|
||||
if (image == -1)
|
||||
{
|
||||
g_message ("Can't allocate new image\n%s", filename);
|
||||
g_message ("'%s'\nCan't allocate new image", filename);
|
||||
gimp_quit ();
|
||||
};
|
||||
|
||||
|
@ -835,7 +831,7 @@ save_image (gchar * filename, /* I - File to save to */
|
|||
|
||||
if (setjmp (pp->jmpbuf))
|
||||
{
|
||||
g_message (_("%s\nPNG error. Couldn't save image"), filename);
|
||||
g_message (_("'%s':\nPNG error. Couldn't save image"), filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -846,17 +842,14 @@ save_image (gchar * filename, /* I - File to save to */
|
|||
fp = fopen (filename, "wb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
g_message (_("%s\nCouldn't create file"), filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_init_io (pp, fp);
|
||||
|
||||
if (strrchr (filename, '/') != NULL)
|
||||
progress = g_strdup_printf (_("Saving %s:"), strrchr (filename, '/') + 1);
|
||||
else
|
||||
progress = g_strdup_printf (_("Saving %s:"), filename);
|
||||
|
||||
progress = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (progress);
|
||||
g_free (progress);
|
||||
|
||||
|
@ -922,7 +915,7 @@ save_image (gchar * filename, /* I - File to save to */
|
|||
respin_cmap (pp, info, remap, image_ID, drawable); /* fix up transparency */
|
||||
break;
|
||||
default:
|
||||
g_message ("%s\nImage type can't be saved as PNG", filename);
|
||||
g_message ("'%s':\nImage type can't be saved as PNG", filename);
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
@ -1178,8 +1171,8 @@ respin_cmap (png_structp pp,
|
|||
{
|
||||
/* Inform the user that we couldn't losslessly save the
|
||||
* transparency & just use the full palette */
|
||||
g_message (_
|
||||
("Couldn't losslessly save transparency, saving opacity instead.\n"));
|
||||
g_message (_("Couldn't losslessly save transparency,\n"
|
||||
"saving opacity instead."));
|
||||
png_set_PLTE (pp, info, (png_colorp) before, colors);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -398,19 +399,19 @@ load_image (gchar *filename)
|
|||
PNMScanner * volatile scan;
|
||||
int ctr;
|
||||
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
/* open the file */
|
||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message (_("PNM: Can't open file %s."), filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
/* allocate the necessary structures */
|
||||
pnminfo = g_new (PNMInfo, 1);
|
||||
|
||||
|
@ -449,7 +450,7 @@ load_image (gchar *filename)
|
|||
}
|
||||
if (!pnminfo->loader)
|
||||
{
|
||||
g_message (_("PNM: File not in a supported format."));
|
||||
g_message (_("File not in a supported format."));
|
||||
longjmp(pnminfo->jmpbuf,1);
|
||||
}
|
||||
|
||||
|
@ -773,19 +774,20 @@ save_image (gchar *filename,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
/* open the file */
|
||||
fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_message ("pnm: can't open \"%s\"", filename);
|
||||
g_message ("Can't open '%s' for writing:\n%s",
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
xres = drawable->width;
|
||||
yres = drawable->height;
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.15 04-Oct-2002";
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -173,10 +174,10 @@ static PSSaveInterface psint =
|
|||
/* Declare some local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
|
||||
static gint32 load_image (gchar *filename);
|
||||
|
@ -644,20 +645,20 @@ ps_set_save_size (PSSaveVals *vals,
|
|||
}
|
||||
|
||||
static void
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals)
|
||||
{
|
||||
static GimpParam values[2];
|
||||
GimpRunMode run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
gint32 image_ID = -1;
|
||||
gint32 drawable_ID = -1;
|
||||
gint32 orig_image_ID = -1;
|
||||
GimpExportReturnType export = GIMP_EXPORT_CANCEL;
|
||||
gint k;
|
||||
static GimpParam values[2];
|
||||
GimpRunMode run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
gint32 image_ID = -1;
|
||||
gint32 drawable_ID = -1;
|
||||
gint32 orig_image_ID = -1;
|
||||
GimpExportReturnType export = GIMP_EXPORT_CANCEL;
|
||||
gint k;
|
||||
|
||||
l_run_mode = run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -871,22 +872,20 @@ load_image (gchar *filename)
|
|||
ifp = fopen (filename, "r");
|
||||
if (ifp == NULL)
|
||||
{
|
||||
g_message (_("PS: can't open file for reading"));
|
||||
return (-1);
|
||||
g_message (_("Can't open '%s':\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
fclose (ifp);
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Interpreting and Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
ifp = ps_open (filename, &plvals, &llx, &lly, &urx, &ury, &is_epsf);
|
||||
if (!ifp)
|
||||
{
|
||||
g_message (_("PS: can't interprete file"));
|
||||
g_message (_("Can't interpret file"));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -984,7 +983,7 @@ save_image (gchar *filename,
|
|||
case GIMP_RGB_IMAGE:
|
||||
break;
|
||||
default:
|
||||
g_message (_("PS: cannot operate on unknown image types"));
|
||||
g_message (_("Cannot operate on unknown image types"));
|
||||
return (FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -993,16 +992,14 @@ save_image (gchar *filename,
|
|||
ofp = fopen (filename, "wb");
|
||||
if (!ofp)
|
||||
{
|
||||
g_message (_("PS: can't open file for writing"));
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
save_ps_header (ofp, filename);
|
||||
|
||||
|
@ -1586,7 +1583,7 @@ skip_ps (FILE *ifp)
|
|||
while (k-- > 0) c = getc (ifp);
|
||||
if (c == EOF) return (-1);
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
}
|
||||
|
||||
|
@ -1700,7 +1697,7 @@ load_ps (gchar *filename,
|
|||
scan_lines++;
|
||||
total_scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)image_height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == image_height))
|
||||
|
@ -1727,7 +1724,7 @@ load_ps (gchar *filename,
|
|||
scan_lines++;
|
||||
total_scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)image_height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == image_height))
|
||||
|
@ -2087,7 +2084,7 @@ save_ps_preview (FILE *ofp,
|
|||
if (out_count != 0)
|
||||
fprintf (ofp, "\n");
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((y % 20) == 0))
|
||||
if ((y % 20) == 0)
|
||||
gimp_progress_update ((double)(y) / (double)height);
|
||||
}
|
||||
|
||||
|
@ -2170,18 +2167,23 @@ save_gray (FILE *ofp,
|
|||
ascii85_nout (nout, packb, ofp);
|
||||
src += width;
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
if (level2)
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
g_free (data);
|
||||
if (packb) g_free (packb);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
@ -2293,21 +2295,26 @@ save_bw (FILE *ofp,
|
|||
compress_packbits (nbsl, scanline, &nout, packb);
|
||||
ascii85_nout (nout, packb, ofp);
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
if (level2)
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
|
||||
g_free (hex_scanline);
|
||||
g_free (scanline);
|
||||
g_free (data);
|
||||
if (packb != NULL) g_free (packb);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
@ -2443,15 +2450,21 @@ save_index (FILE *ofp,
|
|||
}
|
||||
src += width;
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
|
||||
g_free (data);
|
||||
if (packb != NULL) g_free (packb);
|
||||
if (plane != NULL) g_free (plane);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
if (plane)
|
||||
g_free (plane);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
@ -2566,14 +2579,20 @@ save_rgb (FILE *ofp,
|
|||
}
|
||||
src += 3*width;
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
g_free (data);
|
||||
if (packb != NULL) g_free (packb);
|
||||
if (plane != NULL) g_free (plane);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
if (plane)
|
||||
g_free (plane);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.15 04-Oct-2002";
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -173,10 +174,10 @@ static PSSaveInterface psint =
|
|||
/* Declare some local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
|
||||
static gint32 load_image (gchar *filename);
|
||||
|
@ -644,20 +645,20 @@ ps_set_save_size (PSSaveVals *vals,
|
|||
}
|
||||
|
||||
static void
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals)
|
||||
{
|
||||
static GimpParam values[2];
|
||||
GimpRunMode run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
gint32 image_ID = -1;
|
||||
gint32 drawable_ID = -1;
|
||||
gint32 orig_image_ID = -1;
|
||||
GimpExportReturnType export = GIMP_EXPORT_CANCEL;
|
||||
gint k;
|
||||
static GimpParam values[2];
|
||||
GimpRunMode run_mode;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
gint32 image_ID = -1;
|
||||
gint32 drawable_ID = -1;
|
||||
gint32 orig_image_ID = -1;
|
||||
GimpExportReturnType export = GIMP_EXPORT_CANCEL;
|
||||
gint k;
|
||||
|
||||
l_run_mode = run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -871,22 +872,20 @@ load_image (gchar *filename)
|
|||
ifp = fopen (filename, "r");
|
||||
if (ifp == NULL)
|
||||
{
|
||||
g_message (_("PS: can't open file for reading"));
|
||||
return (-1);
|
||||
g_message (_("Can't open '%s':\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
fclose (ifp);
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Interpreting and Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
ifp = ps_open (filename, &plvals, &llx, &lly, &urx, &ury, &is_epsf);
|
||||
if (!ifp)
|
||||
{
|
||||
g_message (_("PS: can't interprete file"));
|
||||
g_message (_("Can't interpret file"));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
@ -984,7 +983,7 @@ save_image (gchar *filename,
|
|||
case GIMP_RGB_IMAGE:
|
||||
break;
|
||||
default:
|
||||
g_message (_("PS: cannot operate on unknown image types"));
|
||||
g_message (_("Cannot operate on unknown image types"));
|
||||
return (FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -993,16 +992,14 @@ save_image (gchar *filename,
|
|||
ofp = fopen (filename, "wb");
|
||||
if (!ofp)
|
||||
{
|
||||
g_message (_("PS: can't open file for writing"));
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
save_ps_header (ofp, filename);
|
||||
|
||||
|
@ -1586,7 +1583,7 @@ skip_ps (FILE *ifp)
|
|||
while (k-- > 0) c = getc (ifp);
|
||||
if (c == EOF) return (-1);
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
}
|
||||
|
||||
|
@ -1700,7 +1697,7 @@ load_ps (gchar *filename,
|
|||
scan_lines++;
|
||||
total_scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)image_height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == image_height))
|
||||
|
@ -1727,7 +1724,7 @@ load_ps (gchar *filename,
|
|||
scan_lines++;
|
||||
total_scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)image_height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == image_height))
|
||||
|
@ -2087,7 +2084,7 @@ save_ps_preview (FILE *ofp,
|
|||
if (out_count != 0)
|
||||
fprintf (ofp, "\n");
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((y % 20) == 0))
|
||||
if ((y % 20) == 0)
|
||||
gimp_progress_update ((double)(y) / (double)height);
|
||||
}
|
||||
|
||||
|
@ -2170,18 +2167,23 @@ save_gray (FILE *ofp,
|
|||
ascii85_nout (nout, packb, ofp);
|
||||
src += width;
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
if (level2)
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
g_free (data);
|
||||
if (packb) g_free (packb);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
@ -2293,21 +2295,26 @@ save_bw (FILE *ofp,
|
|||
compress_packbits (nbsl, scanline, &nout, packb);
|
||||
ascii85_nout (nout, packb, ofp);
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
if (level2)
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
{
|
||||
ascii85_out (128, ofp); /* Write EOD of RunLengthDecode filter */
|
||||
ascii85_done (ofp);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
|
||||
g_free (hex_scanline);
|
||||
g_free (scanline);
|
||||
g_free (data);
|
||||
if (packb != NULL) g_free (packb);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
@ -2443,15 +2450,21 @@ save_index (FILE *ofp,
|
|||
}
|
||||
src += width;
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
|
||||
g_free (data);
|
||||
if (packb != NULL) g_free (packb);
|
||||
if (plane != NULL) g_free (plane);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
if (plane)
|
||||
g_free (plane);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
@ -2566,14 +2579,20 @@ save_rgb (FILE *ofp,
|
|||
}
|
||||
src += 3*width;
|
||||
}
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
ps_end_data (ofp);
|
||||
fprintf (ofp, "showpage\n");
|
||||
g_free (data);
|
||||
if (packb != NULL) g_free (packb);
|
||||
if (plane != NULL) g_free (plane);
|
||||
|
||||
if (packb)
|
||||
g_free (packb);
|
||||
|
||||
if (plane)
|
||||
g_free (plane);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -505,7 +506,7 @@ psd_type_to_gimp_base_type (psd_imagetype psdtype)
|
|||
case PSD_INDEXEDA_IMAGE:
|
||||
case PSD_INDEXED_IMAGE: return(GIMP_INDEXED);
|
||||
default:
|
||||
g_message ("PSD: Error: Can't convert PSD imagetype to GIMP imagetype\n");
|
||||
g_message ("Error: Can't convert PSD imagetype to GIMP imagetype");
|
||||
gimp_quit();
|
||||
return(GIMP_RGB);
|
||||
}
|
||||
|
@ -540,7 +541,7 @@ psd_mode_to_gimp_base_type (gushort psdtype)
|
|||
case 2: return GIMP_INDEXED;
|
||||
case 3: return GIMP_RGB;
|
||||
default:
|
||||
g_message ("PSD: Error: Can't convert PSD mode to GIMP base imagetype\n");
|
||||
g_message ("Error: Can't convert PSD mode to GIMP base imagetype");
|
||||
gimp_quit();
|
||||
return GIMP_RGB;
|
||||
}
|
||||
|
@ -954,7 +955,7 @@ do_layer_record(FILE *fd, guint32 *offset, gint layernum)
|
|||
|
||||
if (strncmp(sig, "8BIM", 4)!=0)
|
||||
{
|
||||
g_message ("PSD: Error - layer blend signature is incorrect. :-(\n");
|
||||
g_message ("Error: layer blend signature is incorrect. :-(");
|
||||
gimp_quit();
|
||||
}
|
||||
|
||||
|
@ -1221,7 +1222,7 @@ seek_to_and_unpack_pixeldata(FILE* fd, gint layeri, gint channeli)
|
|||
break;
|
||||
default: /* *unknown* */
|
||||
IFDBG {printf("\nEEP!\n");fflush(stdout);}
|
||||
g_message ("*** Unknown compression type in channel.\n");
|
||||
g_message ("*** Unknown compression type in channel.");
|
||||
gimp_quit();
|
||||
break;
|
||||
}
|
||||
|
@ -1648,17 +1649,18 @@ load_image(char *name)
|
|||
|
||||
IFDBG printf("------- %s ---------------------------------\n",name);
|
||||
|
||||
name_buf = g_strdup_printf( _("Loading %s:"), name);
|
||||
fd = fopen (name, "rb");
|
||||
if (! fd)
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"), name, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
gimp_progress_init(name_buf);
|
||||
name_buf = g_strdup_printf (_("Opening '%s'..."), name);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
fd = fopen(name, "rb");
|
||||
if (!fd) {
|
||||
printf("%s: can't open \"%s\"\n", prog_name, name);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
read_whole_file(fd);
|
||||
read_whole_file (fd);
|
||||
|
||||
if (psd_image.num_layers > 0) /* PS3-style */
|
||||
{
|
||||
|
@ -2000,8 +2002,6 @@ load_image(char *name)
|
|||
psd_type_to_gimp_type(imagetype),
|
||||
100, GIMP_NORMAL_MODE);
|
||||
|
||||
g_free(name_buf);
|
||||
|
||||
gimp_image_add_layer (image_ID, layer_ID, 0);
|
||||
drawable = gimp_drawable_get (layer_ID);
|
||||
|
||||
|
@ -2050,6 +2050,7 @@ load_image(char *name)
|
|||
if (!cmyk)
|
||||
{
|
||||
gimp_progress_update ((double)1.00);
|
||||
|
||||
if(imagetype==PSD_BITMAP_IMAGE) /* convert bitmap to grayscale */
|
||||
{
|
||||
guchar *monobuf;
|
||||
|
@ -2067,6 +2068,7 @@ load_image(char *name)
|
|||
else
|
||||
{
|
||||
gimp_progress_update ((double)1.00);
|
||||
|
||||
cmykbuf = g_malloc(step * nguchars);
|
||||
decode(PSDheader.imgdatalen, nguchars, temp, cmykbuf, step);
|
||||
|
||||
|
@ -2081,12 +2083,14 @@ load_image(char *name)
|
|||
if (!cmyk)
|
||||
{
|
||||
gimp_progress_update ((double)1.00);
|
||||
|
||||
xfread_interlaced(fd, dest, PSDheader.imgdatalen,
|
||||
"raw image data", step);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_progress_update ((double)1.00);
|
||||
|
||||
cmykbuf = g_malloc(PSDheader.imgdatalen);
|
||||
xfread_interlaced(fd, cmykbuf, PSDheader.imgdatalen,
|
||||
"raw cmyk image data", step);
|
||||
|
@ -2325,8 +2329,10 @@ cmyk2rgb(unsigned char * src, unsigned char * dst,
|
|||
if (alpha)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
|
||||
if ((i % 5) == 0)
|
||||
gimp_progress_update ((double)(2.0*(double)height)/((double)height+(double)i));
|
||||
gimp_progress_update ((double)(2.0*(double)height)/
|
||||
((double)height+(double)i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2366,7 +2372,8 @@ cmykp2rgb(unsigned char * src, unsigned char * dst,
|
|||
*dst++ = *ap++;
|
||||
}
|
||||
if ((i % 5) == 0)
|
||||
gimp_progress_update ((double)(2.0*(double)height)/((double)height+(double)i));
|
||||
gimp_progress_update ((double)(2.0*(double)height)/
|
||||
((double)height+(double)i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,20 @@
|
|||
* BUGS:
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
||||
/* *** DEFINES *** */
|
||||
|
||||
|
@ -66,15 +80,6 @@
|
|||
/* *** END OF DEFINES *** */
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "libgimp/gimp.h"
|
||||
|
||||
|
||||
/* Local types etc
|
||||
*/
|
||||
|
||||
|
@ -596,7 +601,7 @@ gimpBaseTypeToPsdMode (gint gimpBaseType)
|
|||
case GIMP_INDEXED_IMAGE:
|
||||
return 2; /* Indexed */
|
||||
default:
|
||||
g_message ("PSD: Error: Can't convert GIMP base imagetype to PSD mode\n");
|
||||
g_message ("Error: Can't convert GIMP base imagetype to PSD mode");
|
||||
IFDBG printf ("PSD Save: gimpBaseType value is %d, can't convert to PSD mode", gimpBaseType);
|
||||
gimp_quit ();
|
||||
return 3; /* Return RGB by default */
|
||||
|
@ -1513,20 +1518,18 @@ save_image (gchar *filename, gint32 image_id)
|
|||
|
||||
IFDBG printf (" Function: save_image\n");
|
||||
|
||||
name_buf = g_malloc (64 + strlen (filename));
|
||||
IFDBG printf (name_buf, "Saving %s:", filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
IFDBG printf (" Wrote message to GIMP\n");
|
||||
|
||||
fd = fopen (filename, "wb");
|
||||
if (fd == NULL)
|
||||
{
|
||||
IFDBG printf ("PSD Save: can't open \"%s\"\n", filename);
|
||||
return -1;
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
name_buf = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
IFDBG printf (" File \"%s\" has been opened\n", filename);
|
||||
|
||||
get_image_data (fd, image_id);
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include <glib.h> /* We want glib.h first because of some
|
||||
* pretty obscure Win32 compilation issues.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -509,22 +511,22 @@ read_block_header (FILE *f,
|
|||
|| fread (&len, 4, 1, f) < 1
|
||||
|| (major < 4 && fread (total_len, 4, 1, f) < 1))
|
||||
{
|
||||
g_message ("PSP: Error reading block header");
|
||||
g_message ("Error reading block header");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp (buf, "~BK\0", 4) != 0)
|
||||
{
|
||||
IFDBG(3)
|
||||
g_message ("PSP: Invalid block header at %ld", header_start);
|
||||
g_message ("Invalid block header at %ld", header_start);
|
||||
else
|
||||
g_message ("PSP: Invalid block header");
|
||||
g_message ("Invalid block header");
|
||||
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IFDBG(3) g_message ("PSP: %s at %ld", block_name (id), header_start);
|
||||
IFDBG(3) g_message ("%s at %ld", block_name (id), header_start);
|
||||
|
||||
if (major < 4)
|
||||
{
|
||||
|
@ -554,7 +556,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
|
||||
if (init_len < 38 || total_len < 38)
|
||||
{
|
||||
g_message ("PSP: Invalid general image attribute chunk size");
|
||||
g_message ("Invalid general image attribute chunk size");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -574,7 +576,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
|| fread (&ia->active_layer, 4, 1, f) < 1
|
||||
|| fread (&ia->layer_count, 2, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading general image attribute block");
|
||||
g_message ("Error reading general image attribute block");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -589,7 +591,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
ia->compression = GUINT16_FROM_LE (ia->compression);
|
||||
if (ia->compression > PSP_COMP_LZ77)
|
||||
{
|
||||
g_message ("PSP: Unknown compression type %d", ia->compression);
|
||||
g_message ("Unknown compression type %d", ia->compression);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -597,7 +599,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
ia->depth = GUINT16_FROM_LE (ia->depth);
|
||||
if (ia->depth != 24)
|
||||
{
|
||||
g_message ("PSP: Unsupported bit depth %d", ia->depth);
|
||||
g_message ("Unsupported bit depth %d", ia->depth);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -615,7 +617,7 @@ try_fseek (FILE *f,
|
|||
{
|
||||
if (fseek (f, pos, whence) < 0)
|
||||
{
|
||||
g_message ("PSP: Seek error");
|
||||
g_message ("Seek error: %s", g_strerror (errno));
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -648,14 +650,14 @@ read_creator_block (FILE *f,
|
|||
|| fread (&keyword, 2, 1, f) < 1
|
||||
|| fread (&length, 4, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading creator keyword chunk");
|
||||
g_message ("Error reading creator keyword chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp (buf, "~FL\0", 4) != 0)
|
||||
{
|
||||
g_message ("PSP: Invalid keyword chunk header");
|
||||
g_message ("Invalid keyword chunk header");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -671,7 +673,7 @@ read_creator_block (FILE *f,
|
|||
string = g_malloc (length + 1);
|
||||
if (fread (string, length, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading creator keyword data");
|
||||
g_message ("Error reading creator keyword data");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -696,7 +698,7 @@ read_creator_block (FILE *f,
|
|||
case PSP_CRTR_FLD_APP_VER:
|
||||
if (fread (&dword, 4, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading creator keyword data");
|
||||
g_message ("Error reading creator keyword data");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1001,7 +1003,7 @@ read_channel_data (FILE *f,
|
|||
zstream.opaque = f;
|
||||
if (inflateInit (&zstream) != Z_OK)
|
||||
{
|
||||
g_message ("PSP: zlib error");
|
||||
g_message ("zlib error");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1015,7 +1017,7 @@ read_channel_data (FILE *f,
|
|||
zstream.avail_out = npixels;
|
||||
if (inflate (&zstream, Z_FINISH) != Z_STREAM_END)
|
||||
{
|
||||
g_message ("PSP: zlib error");
|
||||
g_message ("zlib error");
|
||||
inflateEnd (&zstream);
|
||||
fclose (f);
|
||||
return -1;
|
||||
|
@ -1081,7 +1083,7 @@ read_layer_block (FILE *f,
|
|||
}
|
||||
if (sub_id != PSP_LAYER_BLOCK)
|
||||
{
|
||||
g_message ("PSP: Invalid layer sub-block %s, should be LAYER",
|
||||
g_message ("Invalid layer sub-block %s, should be LAYER",
|
||||
block_name (sub_id));
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
|
@ -1114,7 +1116,7 @@ read_layer_block (FILE *f,
|
|||
|| fread (&bitmap_count, 2, 1, f) < 1
|
||||
|| fread (&channel_count, 2, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading layer information chunk");
|
||||
g_message ("Error reading layer information chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1143,7 +1145,7 @@ read_layer_block (FILE *f,
|
|||
|| fread (&bitmap_count, 2, 1, f) < 1
|
||||
|| fread (&channel_count, 2, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading layer information chunk");
|
||||
g_message ("Error reading layer information chunk");
|
||||
g_free (name);
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
|
@ -1152,7 +1154,7 @@ read_layer_block (FILE *f,
|
|||
}
|
||||
|
||||
if (type == PSP_LAYER_FLOATING_SELECTION)
|
||||
g_message ("PSP: Floating selection restored as normal layer");
|
||||
g_message ("Floating selection restored as normal layer");
|
||||
|
||||
swab_rect (image_rect);
|
||||
swab_rect (saved_image_rect);
|
||||
|
@ -1164,7 +1166,7 @@ read_layer_block (FILE *f,
|
|||
layer_mode = gimp_layer_mode_from_psp_blend_mode (blend_mode);
|
||||
if ((int) layer_mode == -1)
|
||||
{
|
||||
g_message ("PSP: Unsupported PSP layer blend mode %s "
|
||||
g_message ("Unsupported PSP layer blend mode %s "
|
||||
"for layer %s, setting layer invisible",
|
||||
blend_mode_name (blend_mode), name);
|
||||
layer_mode = GIMP_NORMAL_MODE;
|
||||
|
@ -1175,7 +1177,7 @@ read_layer_block (FILE *f,
|
|||
height = saved_image_rect[3] - saved_image_rect[1];
|
||||
|
||||
IFDBG(2) g_message
|
||||
("PSP: layer: %s %dx%d (%dx%d) @%d,%d opacity %d blend_mode %s "
|
||||
("layer: %s %dx%d (%dx%d) @%d,%d opacity %d blend_mode %s "
|
||||
"%d bitmaps %d channels",
|
||||
name,
|
||||
image_rect[2] - image_rect[0], image_rect[3] - image_rect[1],
|
||||
|
@ -1185,7 +1187,7 @@ read_layer_block (FILE *f,
|
|||
bitmap_count, channel_count);
|
||||
|
||||
IFDBG(2) g_message
|
||||
("PSP: mask %dx%d (%dx%d) @%d,%d",
|
||||
("mask %dx%d (%dx%d) @%d,%d",
|
||||
mask_rect[2] - mask_rect[0],
|
||||
mask_rect[3] - mask_rect[1],
|
||||
saved_mask_rect[2] - saved_mask_rect[0],
|
||||
|
@ -1221,7 +1223,7 @@ read_layer_block (FILE *f,
|
|||
layer_mode);
|
||||
if (layer_ID == -1)
|
||||
{
|
||||
g_message ("PSP: Error creating layer");
|
||||
g_message ("Error creating layer");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1276,7 +1278,7 @@ read_layer_block (FILE *f,
|
|||
|
||||
if (sub_id != PSP_CHANNEL_BLOCK)
|
||||
{
|
||||
g_message ("PSP: Invalid layer sub-block %s, should be CHANNEL",
|
||||
g_message ("Invalid layer sub-block %s, should be CHANNEL",
|
||||
block_name (sub_id));
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
|
@ -1293,7 +1295,7 @@ read_layer_block (FILE *f,
|
|||
|| fread (&bitmap_type, 2, 1, f) < 1
|
||||
|| fread (&channel_type, 2, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading channel information chunk");
|
||||
g_message ("Error reading channel information chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1306,8 +1308,7 @@ read_layer_block (FILE *f,
|
|||
|
||||
if (bitmap_type > PSP_DIB_USER_MASK)
|
||||
{
|
||||
g_message ("PSP: Invalid bitmap type %d "
|
||||
"in channel information chunk",
|
||||
g_message ("Invalid bitmap type %d in channel information chunk",
|
||||
bitmap_type);
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
|
@ -1316,16 +1317,14 @@ read_layer_block (FILE *f,
|
|||
|
||||
if (channel_type > PSP_CHANNEL_BLUE)
|
||||
{
|
||||
g_message ("PSP: Invalid channel type %d "
|
||||
"in channel information chunk",
|
||||
g_message ("Invalid channel type %d in channel information chunk",
|
||||
channel_type);
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IFDBG(2) g_message ("PSP: channel: %s %s %d (%d) bytes "
|
||||
"%d bytespp",
|
||||
IFDBG(2) g_message ("channel: %s %s %d (%d) bytes %d bytespp",
|
||||
bitmap_type_name (bitmap_type),
|
||||
channel_type_name (channel_type),
|
||||
uncompressed_len, compressed_len,
|
||||
|
@ -1401,7 +1400,7 @@ read_tube_block (FILE *f,
|
|||
|| fread (&placement_mode, 4, 1, f) < 1
|
||||
|| fread (&selection_mode, 4, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading tube data chunk");
|
||||
g_message ("Error reading tube data chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1487,20 +1486,23 @@ load_image (gchar *filename)
|
|||
|
||||
f = fopen (filename, "rb");
|
||||
if (f == NULL)
|
||||
return -1;
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read thePSP File Header */
|
||||
if (fread (buf, 32, 1, f) < 1
|
||||
|| fread (&major, 2, 1, f) < 1
|
||||
|| fread (&minor, 2, 1, f) < 1)
|
||||
{
|
||||
g_message ("PSP: Error reading file header");
|
||||
g_message ("Error reading file header");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp (buf, "Paint Shop Pro Image File\n\032\0\0\0\0\0", 32) != 0)
|
||||
{
|
||||
g_message ("PSP: Incorrect file signature");
|
||||
g_message ("Incorrect file signature");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1514,7 +1516,7 @@ load_image (gchar *filename)
|
|||
*/
|
||||
if (major < 3)
|
||||
{
|
||||
g_message ("PSP: Unsupported PSP file format version "
|
||||
g_message ("Unsupported PSP file format version "
|
||||
"%d.%d, only knows 3.0 (and later?)",
|
||||
major, minor);
|
||||
fclose (f);
|
||||
|
@ -1523,13 +1525,13 @@ load_image (gchar *filename)
|
|||
else if (major == 3)
|
||||
; /* OK */
|
||||
else if (major == 4 && minor == 0)
|
||||
g_message ("PSP: Warning: PSP file format version "
|
||||
g_message ("Warning: PSP file format version "
|
||||
"4.0. Support for this format version "
|
||||
"is based on reverse engineering, "
|
||||
"as no documentation has been made available");
|
||||
else
|
||||
{
|
||||
g_message ("PSP: Unsupported PSP file format version %d.%d",
|
||||
g_message ("Unsupported PSP file format version %d.%d",
|
||||
major, minor);
|
||||
fclose (f);
|
||||
return -1;
|
||||
|
@ -1538,7 +1540,7 @@ load_image (gchar *filename)
|
|||
/* Read all the blocks */
|
||||
block_number = 0;
|
||||
|
||||
IFDBG(3) g_message ("PSP: size = %d", (int)st.st_size);
|
||||
IFDBG(3) g_message ("size = %d", (int)st.st_size);
|
||||
while (ftell (f) != st.st_size
|
||||
&& (id = read_block_header (f, &block_init_len,
|
||||
&block_total_len)) != -1)
|
||||
|
@ -1549,7 +1551,7 @@ load_image (gchar *filename)
|
|||
{
|
||||
if (block_number != 0)
|
||||
{
|
||||
g_message ("PSP: Duplicate General Image Attributes block");
|
||||
g_message ("Duplicate General Image Attributes block");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1557,7 +1559,7 @@ load_image (gchar *filename)
|
|||
block_total_len, &ia) == -1)
|
||||
return -1;
|
||||
|
||||
IFDBG(2) g_message ("PSP: %d dpi %dx%d %s",
|
||||
IFDBG(2) g_message ("%d dpi %dx%d %s",
|
||||
(int) ia.resolution,
|
||||
ia.width, ia.height,
|
||||
compression_name (ia.compression));
|
||||
|
@ -1575,7 +1577,7 @@ load_image (gchar *filename)
|
|||
{
|
||||
if (block_number == 0)
|
||||
{
|
||||
g_message ("PSP: Missing General Image Attributes block");
|
||||
g_message ("Missing General Image Attributes block");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1615,13 +1617,13 @@ load_image (gchar *filename)
|
|||
case PSP_LAYER_BLOCK:
|
||||
case PSP_CHANNEL_BLOCK:
|
||||
case PSP_ALPHA_CHANNEL_BLOCK:
|
||||
g_message ("PSP: Sub-block %s should not occur "
|
||||
g_message ("Sub-block %s should not occur "
|
||||
"at main level of file",
|
||||
block_name (id));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_message ("PSP: Unrecognized block id %d", id);
|
||||
g_message ("Unrecognized block id %d", id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1654,7 +1656,7 @@ save_image (gchar *filename,
|
|||
gint32 image_ID,
|
||||
gint32 drawable_ID)
|
||||
{
|
||||
g_message ("PSP: Saving not implemented yet");
|
||||
g_message ("Saving not implemented yet");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -379,7 +379,8 @@ run (gchar *name,
|
|||
case RNDM_PICK: rndm_type_str = "pick"; break;
|
||||
case RNDM_SLUR: rndm_type_str = "slur"; break;
|
||||
}
|
||||
sprintf (prog_label, "%s (%s)", gettext(RNDM_VERSION[rndm_type - 1]),
|
||||
sprintf (prog_label, "%s (%s)...",
|
||||
gettext(RNDM_VERSION[rndm_type - 1]),
|
||||
gettext(rndm_type_str));
|
||||
gimp_progress_init(prog_label);
|
||||
gimp_tile_cache_ntiles(2 * (drawable->width / gimp_tile_width() + 1));
|
||||
|
|
|
@ -223,7 +223,7 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init ( _("Rippling..."));
|
||||
gimp_progress_init (_("Rippling..."));
|
||||
|
||||
/* set the tile cache size */
|
||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||
|
|
|
@ -180,7 +180,7 @@ run (gchar *name,
|
|||
gimp_get_data (PLUG_IN_NAME, &VALS);
|
||||
if (!gimp_drawable_is_rgb (drawable_id))
|
||||
{
|
||||
g_message ("Scatter HSV: RGB drawable is not selected.");
|
||||
g_message ("Cannot operate on non-RGB drawables.");
|
||||
return;
|
||||
}
|
||||
if (! scatter_hsv_dialog ())
|
||||
|
@ -238,7 +238,7 @@ scatter_hsv (gint32 drawable_id)
|
|||
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
|
||||
|
||||
gimp_progress_init (_("Scatter HSV: Scattering..."));
|
||||
gimp_progress_init (_("Scattering HSV..."));
|
||||
|
||||
gimp_rgn_iterate2 (drawable, run_mode, scatter_hsv_func, NULL);
|
||||
|
||||
|
|
|
@ -268,14 +268,14 @@ shoot (void)
|
|||
/* fork off a xwd process */
|
||||
if ((pid = fork ()) < 0)
|
||||
{
|
||||
g_message ("screenshot: fork failed: %s\n", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
else if (pid == 0)
|
||||
{
|
||||
execvp (XWD, xwdargv);
|
||||
/* What are we doing here? exec must have failed */
|
||||
g_message ("screenshot: exec failed: xwd: %s\n", g_strerror (errno));
|
||||
g_message ("exec failed: xwd: %s", g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -283,7 +283,7 @@ shoot (void)
|
|||
pid = spawnvp (P_NOWAIT, XWD, xwdargv);
|
||||
if (pid == -1)
|
||||
{
|
||||
g_message ("screenshot: spawn failed: %s\n", g_strerror (errno));
|
||||
g_message ("spawn failed: %s", g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -296,7 +296,7 @@ shoot (void)
|
|||
/* the tmpfile may have been created even if xwd failed */
|
||||
unlink (tmpname);
|
||||
g_free (tmpname);
|
||||
g_message ("screenshot: xwd didn't work\n");
|
||||
g_message ("xwd didn't work");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init (_("Selective Gaussian Blur"));
|
||||
gimp_progress_init (_("Selective Gaussian Blur..."));
|
||||
|
||||
radius = fabs (bvals.radius) + 1.0;
|
||||
|
||||
|
@ -387,8 +387,9 @@ matrixmult (guchar *src,
|
|||
dest[dix+b] = sum/fact;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(y % 5))
|
||||
gimp_progress_update((double)y / (double)height);
|
||||
gimp_progress_update ((double)y / (double)height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ run (gchar *name,
|
|||
/* Make sure that the drawable is indexed or RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init ( _("Semi-Flatten..."));
|
||||
gimp_progress_init (_("Semi-Flattening..."));
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width ()
|
||||
+ 1));
|
||||
semiflatten (drawable);
|
||||
|
|
|
@ -189,7 +189,7 @@ run (gchar *name,
|
|||
if (gimp_drawable_is_rgb (drawable->drawable_id) ||
|
||||
gimp_drawable_is_gray (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init ( _("Shifting..."));
|
||||
gimp_progress_init (_("Shifting..."));
|
||||
|
||||
/* set the tile cache size */
|
||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||
|
|
|
@ -35,17 +35,17 @@
|
|||
|
||||
|
||||
/* Declare local functions. */
|
||||
static void query (void);
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
static void query (void);
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
|
||||
static gboolean dialog (GimpDrawable *drawable);
|
||||
static gboolean dialog (GimpDrawable *drawable);
|
||||
|
||||
static gint32 doit (GimpDrawable *drawable,
|
||||
gint32 *layer_id);
|
||||
static gint32 doit (GimpDrawable *drawable,
|
||||
gint32 *layer_id);
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
|
@ -175,19 +175,25 @@ run (gchar *name,
|
|||
{
|
||||
if (gimp_drawable_is_rgb (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init (_("Deriving smooth palette..."));
|
||||
gimp_progress_init (_("Deriving Smooth Palette..."));
|
||||
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width + 1) /
|
||||
gimp_tile_width ());
|
||||
|
||||
values[1].data.d_image = doit (drawable, &values[2].data.d_layer);
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
gimp_set_data ("plug_in_smooth_palette", &config, sizeof (config));
|
||||
if (config.show_image)
|
||||
gimp_display_new (values[1].data.d_image);
|
||||
}
|
||||
else
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
}
|
||||
|
||||
values[0].data.d_status = status;
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ solid_noise (GimpDrawable *drawable)
|
|||
|
||||
/* Initialization */
|
||||
solid_noise_init ();
|
||||
gimp_progress_init ( _("Solid Noise..."));
|
||||
gimp_progress_init (_("Solid Noise..."));
|
||||
progress = 0;
|
||||
max_progress = sel_width * sel_height;
|
||||
chns = gimp_drawable_bpp (drawable->drawable_id);
|
||||
|
@ -320,7 +320,8 @@ solid_noise (GimpDrawable *drawable)
|
|||
sel_height, TRUE, TRUE);
|
||||
|
||||
/* One, two, three, go! */
|
||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn); pr != NULL;
|
||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||
pr != NULL;
|
||||
pr = gimp_pixel_rgns_process (pr))
|
||||
{
|
||||
dest_row = dest_rgn.data;
|
||||
|
@ -331,9 +332,14 @@ solid_noise (GimpDrawable *drawable)
|
|||
|
||||
for (col = dest_rgn.x; col < (dest_rgn.x + dest_rgn.w); col++)
|
||||
{
|
||||
val = (guchar) floor (255.0 * noise ((double) (col - sel_x1) / sel_width, (double) (row - sel_y1) / sel_height));
|
||||
val =
|
||||
(guchar) floor (255.0 *
|
||||
noise ((double) (col - sel_x1) / sel_width,
|
||||
(double) (row - sel_y1) / sel_height));
|
||||
|
||||
for (i = 0; i < chns; i++)
|
||||
*dest++ = val;
|
||||
|
||||
if (has_alpha)
|
||||
*dest++ = 255;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ run (gchar *name,
|
|||
}
|
||||
else
|
||||
{
|
||||
/* g_message ("sobel: cannot operate on indexed color images"); */
|
||||
/* g_message ("Cannot operate on indexed color images"); */
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -3037,7 +3037,7 @@ realrender (GimpDrawable *drawable)
|
|||
tx = x2 - x1;
|
||||
ty = y2 - y1;
|
||||
|
||||
gimp_progress_init (_("Rendering..."));
|
||||
gimp_progress_init (_("Rendering Sphere..."));
|
||||
|
||||
for (y = 0; y < ty; y++)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ static char ident[] = "@(#) GIMP SunRaster file-plugin v1.97 20-Dec-00";
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -381,8 +382,8 @@ load_image (gchar *filename)
|
|||
ifp = fopen (filename, "rb");
|
||||
if (!ifp)
|
||||
{
|
||||
g_message (_("Can't open file for reading"));
|
||||
return (-1);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
read_msb_first = 1; /* SUN raster is always most significant byte first */
|
||||
|
@ -431,13 +432,10 @@ load_image (gchar *filename)
|
|||
fseek (ifp, (sizeof (L_SUNFILEHEADER)/sizeof (L_CARD32))
|
||||
*4 + sunhdr.l_ras_maplength, SEEK_SET);
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
switch (sunhdr.l_ras_depth)
|
||||
{
|
||||
|
@ -511,16 +509,14 @@ save_image (gchar *filename,
|
|||
ofp = fopen (filename, "wb");
|
||||
if (!ofp)
|
||||
{
|
||||
g_message (_("Can't open file for writing"));
|
||||
return (FALSE);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
if (drawable_type == GIMP_INDEXED_IMAGE)
|
||||
retval = save_index (ofp,image_ID, drawable_ID, 0, (int)psvals.rle);
|
||||
|
@ -1016,7 +1012,7 @@ load_sun_d1 (gchar *filename,
|
|||
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1107,7 +1103,7 @@ load_sun_d8 (gchar *filename,
|
|||
dest += width;
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1188,7 +1184,7 @@ load_sun_d24 (gchar *filename,
|
|||
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1283,7 +1279,7 @@ load_sun_d32 (gchar *filename,
|
|||
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1423,7 +1419,7 @@ save_index (FILE *ofp,
|
|||
if (linepad) (*write_fun) ((char *)&tmp, linepad, 1, ofp);
|
||||
src += width;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
}
|
||||
|
@ -1436,7 +1432,7 @@ save_index (FILE *ofp,
|
|||
if (linepad) (*write_fun) ((char *)&tmp, linepad, 1, ofp);
|
||||
src += width;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
}
|
||||
|
@ -1527,7 +1523,7 @@ save_rgb (FILE *ofp,
|
|||
for (j = 0; j < linepad; j++)
|
||||
putc (0, ofp);
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
}
|
||||
|
@ -1549,7 +1545,7 @@ save_rgb (FILE *ofp,
|
|||
for (j = 0; j < linepad; j++)
|
||||
rle_putc (0, ofp);
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
# include <sys/times.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -421,17 +422,17 @@ load_image (gchar *filename)
|
|||
fp = fopen (filename, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
g_message (_("TGA: can't open \"%s\"\n"), filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
name_buf = g_strdup_printf( _("Loading %s:"), filename);
|
||||
name_buf = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
if (!fseek (fp, -26L, SEEK_END)) { /* Is file big enough for a footer? */
|
||||
if (fread (footer, sizeof (footer), 1, fp) != 1) {
|
||||
g_message (_("TGA: Cannot read footer from \"%s\"\n"), filename);
|
||||
g_message (_("Cannot read footer from\n'%s'"), filename);
|
||||
return -1;
|
||||
} else if (memcmp (footer + 8, magic, sizeof (magic)) == 0) {
|
||||
|
||||
|
@ -443,7 +444,7 @@ load_image (gchar *filename)
|
|||
if (offset != 0) {
|
||||
if (fseek (fp, offset, SEEK_SET) ||
|
||||
fread (extension, sizeof (extension), 1, fp) != 1) {
|
||||
g_message (_("TGA: Cannot read extension from \"%s\"\n"), filename);
|
||||
g_message (_("Cannot read extension from\n'%s'"), filename);
|
||||
return -1;
|
||||
}
|
||||
/* Eventually actually handle version 2 TGA here */
|
||||
|
@ -455,7 +456,7 @@ load_image (gchar *filename)
|
|||
if (fseek (fp, 0, SEEK_SET) ||
|
||||
fread (header, sizeof (header), 1, fp) != 1)
|
||||
{
|
||||
g_message ("TGA: Cannot read header from \"%s\"\n", filename);
|
||||
g_message ("Cannot read header from\n'%s'", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -514,7 +515,7 @@ load_image (gchar *filename)
|
|||
case TGA_TYPE_MAPPED:
|
||||
if (info.bpp != 8)
|
||||
{
|
||||
g_message ("TGA: Unhandled sub-format in \"%s\"\n", filename);
|
||||
g_message ("Unhandled sub-format in\n'%s'", filename);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
@ -522,48 +523,48 @@ load_image (gchar *filename)
|
|||
if (info.bpp != 15 && info.bpp != 16 && info.bpp != 24
|
||||
&& info.bpp != 32)
|
||||
{
|
||||
g_message ("TGA: Unhandled sub-format in \"%s\"\n", filename);
|
||||
g_message ("Unhandled sub-format in\n'%s'", filename);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case TGA_TYPE_GRAY:
|
||||
if (info.bpp != 8 && (info.alphaBits != 8 || (info.bpp != 16 || info.bpp != 15)))
|
||||
{
|
||||
g_message ("TGA: Unhandled sub-format in \"%s\"\n", filename);
|
||||
g_message ("Unhandled sub-format in\n'%s'", filename);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_message ("TGA: Unknown image type for \"%s\"\n", filename);
|
||||
g_message ("Unknown image type for\n'%s'", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Plausible but unhandled formats */
|
||||
if (info.bytes * 8 != info.bpp && !(info.bytes == 2 && info.bpp == 15))
|
||||
{
|
||||
g_message ("TGA: No support yet for TGA with these parameters\n");
|
||||
g_message ("No support yet for TGA with these parameters");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check that we have a color map only when we need it. */
|
||||
if (info.imageType == TGA_TYPE_MAPPED && info.colorMapType != 1)
|
||||
{
|
||||
g_message ("TGA: indexed image has invalid color map type %d\n",
|
||||
info.colorMapType);
|
||||
g_message ("Indexed image has invalid color map type %d",
|
||||
info.colorMapType);
|
||||
return -1;
|
||||
}
|
||||
else if (info.imageType != TGA_TYPE_MAPPED && info.colorMapType != 0)
|
||||
{
|
||||
g_message ("TGA: non-indexed image has invalid color map type %d\n",
|
||||
info.colorMapType);
|
||||
g_message ("Non-indexed image has invalid color map type %d",
|
||||
info.colorMapType);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Skip the image ID field. */
|
||||
if (info.idLength && fseek (fp, info.idLength, SEEK_CUR))
|
||||
{
|
||||
g_message ("TGA: File is truncated or corrupted \"%s\"\n", filename);
|
||||
g_message ("File '%s'\nis truncated or corrupted", filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -909,7 +910,7 @@ ReadImage (FILE *fp,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_message ("TGA: File is truncated or corrupted \"%s\"\n", filename);
|
||||
g_message ("File '%s'\nis truncated or corrupted", filename);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -952,11 +953,11 @@ ReadImage (FILE *fp,
|
|||
read_line(fp, row, buffer, info, drawable);
|
||||
}
|
||||
|
||||
gimp_progress_update((double) (i + tileheight)
|
||||
/ (double) info->height);
|
||||
gimp_pixel_rgn_set_rect(&pixel_rgn, data, 0,
|
||||
info->height - i - tileheight,
|
||||
info->width, tileheight);
|
||||
gimp_progress_update ((double) (i + tileheight) /
|
||||
(double) info->height);
|
||||
gimp_pixel_rgn_set_rect (&pixel_rgn, data, 0,
|
||||
info->height - i - tileheight,
|
||||
info->width, tileheight);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -971,10 +972,10 @@ ReadImage (FILE *fp,
|
|||
read_line(fp, row, buffer, info, drawable);
|
||||
}
|
||||
|
||||
gimp_progress_update((double) (i + tileheight)
|
||||
/ (double) info->height);
|
||||
gimp_pixel_rgn_set_rect(&pixel_rgn, data, 0, i,
|
||||
info->width, tileheight);
|
||||
gimp_progress_update ((double) (i + tileheight) /
|
||||
(double) info->height);
|
||||
gimp_pixel_rgn_set_rect (&pixel_rgn, data, 0, i,
|
||||
info->width, tileheight);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1001,7 @@ save_image (gchar *filename,
|
|||
gint height;
|
||||
|
||||
FILE *fp;
|
||||
guchar *name_buf;
|
||||
gchar *name_buf;
|
||||
gint tileheight;
|
||||
gint out_bpp = 0;
|
||||
gboolean status = TRUE;
|
||||
|
@ -1020,16 +1021,17 @@ save_image (gchar *filename,
|
|||
width = drawable->width;
|
||||
height = drawable->height;
|
||||
|
||||
name_buf = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init ((gchar *)name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
if ((fp = fopen (filename, "wb")) == NULL)
|
||||
{
|
||||
g_message ("TGA: can't create \"%s\"\n", filename);
|
||||
g_message ("Can't open '%s'\nfor writing: %s",
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
name_buf = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
header[0] = 0; /* No image identifier / description */
|
||||
|
||||
if (dtype == GIMP_INDEXED_IMAGE || dtype == GIMP_INDEXEDA_IMAGE)
|
||||
|
|
|
@ -34,8 +34,10 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <tiffio.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
|
@ -432,15 +434,13 @@ load_image (gchar *filename)
|
|||
|
||||
tif = TIFFOpen (filename, "r");
|
||||
if (!tif) {
|
||||
g_message (_("TIFF: Can't open '%s'"), filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE) {
|
||||
name = g_strdup_printf( _("Loading '%s' ..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
}
|
||||
name = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
|
||||
TIFFGetFieldDefaulted (tif, TIFFTAG_BITSPERSAMPLE, &bps);
|
||||
|
||||
|
@ -454,17 +454,17 @@ load_image (gchar *filename)
|
|||
extra = 0;
|
||||
|
||||
if (!TIFFGetField (tif, TIFFTAG_IMAGEWIDTH, &cols)) {
|
||||
g_message ("TIFF: Can't get image width");
|
||||
g_message ("Can't get image width");
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
if (!TIFFGetField (tif, TIFFTAG_IMAGELENGTH, &rows)) {
|
||||
g_message ("TIFF: Can't get image length");
|
||||
g_message ("Can't get image length");
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
if (!TIFFGetField (tif, TIFFTAG_PHOTOMETRIC, &photomet)) {
|
||||
g_message("TIFF: Can't get photometric\nAssuming min-is-black\n");
|
||||
g_message ("Can't get photometric\nAssuming min-is-black");
|
||||
/* old AppleScan software misses out the photometric tag (and
|
||||
* incidentally assumes min-is-white, but xv assumes min-is-black,
|
||||
* so we follow xv's lead. It's not much hardship to invert the
|
||||
|
@ -515,7 +515,7 @@ load_image (gchar *filename)
|
|||
}
|
||||
|
||||
if ((image = gimp_image_new (cols, rows, image_type)) == -1) {
|
||||
g_message ("TIFF: Can't create a new image");
|
||||
g_message ("Can't create a new image");
|
||||
gimp_quit ();
|
||||
}
|
||||
gimp_image_set_filename (image, filename);
|
||||
|
@ -581,7 +581,7 @@ load_image (gchar *filename)
|
|||
{
|
||||
case RESUNIT_NONE:
|
||||
/* ImageMagick writes files with this silly resunit */
|
||||
g_message ("TIFF warning: resolution units meaningless");
|
||||
g_message ("Warning: resolution units meaningless");
|
||||
break;
|
||||
|
||||
case RESUNIT_INCH:
|
||||
|
@ -595,7 +595,7 @@ load_image (gchar *filename)
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message ("TIFF file error: unknown resolution unit type %d, "
|
||||
g_message ("File error: unknown resolution unit type %d, "
|
||||
"assuming dpi", read_unit);
|
||||
break;
|
||||
}
|
||||
|
@ -603,13 +603,13 @@ load_image (gchar *filename)
|
|||
else
|
||||
{ /* no res unit tag */
|
||||
/* old AppleScan software produces these */
|
||||
g_message ("TIFF warning: resolution specified without any units tag, "
|
||||
g_message ("Warning: resolution specified without any units tag, "
|
||||
"assuming dpi");
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* xres but no yres */
|
||||
g_message ("TIFF warning: no y resolution info, assuming same as x");
|
||||
g_message ("Warning: no y resolution info, assuming same as x");
|
||||
yres = xres;
|
||||
}
|
||||
|
||||
|
@ -640,7 +640,7 @@ load_image (gchar *filename)
|
|||
{
|
||||
if (!TIFFGetField (tif, TIFFTAG_COLORMAP, &redmap, &greenmap, &bluemap))
|
||||
{
|
||||
g_message ("TIFF: Can't get colormaps");
|
||||
g_message ("Can't get colormaps");
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ load_image (gchar *filename)
|
|||
}
|
||||
|
||||
if (bps == 16)
|
||||
g_message (_("TIFF warning:\n"
|
||||
g_message (_("Warning:\n"
|
||||
"The image you are loading has 16 bits per channel. GIMP "
|
||||
"can only handle 8 bit, so it will be converted for you. "
|
||||
"Information will be lost because of this conversion."));
|
||||
|
@ -765,14 +765,14 @@ load_rgba (TIFF *tif, channel_data *channel)
|
|||
channel[0].pixels = (guchar*) buffer;
|
||||
|
||||
if (!TIFFReadRGBAImage(tif, imageWidth, imageLength, buffer, 0))
|
||||
g_message ("TIFF Unsupported layout, no RGBA loader");
|
||||
g_message ("Unsupported layout, no RGBA loader");
|
||||
|
||||
for (row = 0; row < imageLength; ++row) {
|
||||
gimp_pixel_rgn_set_rect(&(channel[0].pixel_rgn),
|
||||
channel[0].pixels + row * imageWidth * 4,
|
||||
0, imageLength -row -1, imageWidth, 1);
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
gimp_progress_update ((gdouble) row / (gdouble) imageLength);
|
||||
|
||||
gimp_progress_update ((gdouble) row / (gdouble) imageLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -804,9 +804,9 @@ load_tiles (TIFF *tif, channel_data *channel,
|
|||
|
||||
for (y = 0; y < imageLength; y += tileLength) {
|
||||
for (x = 0; x < imageWidth; x += tileWidth) {
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
gimp_progress_update (progress + one_row *
|
||||
( (double) x / (double) imageWidth));
|
||||
gimp_progress_update (progress + one_row *
|
||||
( (double) x / (double) imageWidth));
|
||||
|
||||
TIFFReadTile(tif, buffer, x, y, 0, 0);
|
||||
cols= MIN(imageWidth - x, tileWidth);
|
||||
rows= MIN(imageLength - y, tileLength);
|
||||
|
@ -852,8 +852,8 @@ load_lines (TIFF *tif, channel_data *channel,
|
|||
buffer = g_malloc(lineSize * tile_height);
|
||||
if (planar == PLANARCONFIG_CONTIG) {
|
||||
for (y = 0; y < imageLength; y+= tile_height ) {
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
gimp_progress_update ( (double) y / (double) imageLength);
|
||||
gimp_progress_update ( (double) y / (double) imageLength);
|
||||
|
||||
rows = MIN(tile_height, imageLength - y);
|
||||
for (i = 0; i < rows; ++i)
|
||||
TIFFReadScanline(tif, buffer + i * lineSize, y + i, 0);
|
||||
|
@ -873,8 +873,8 @@ load_lines (TIFF *tif, channel_data *channel,
|
|||
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samples);
|
||||
for (s = 0; s < samples; ++s) {
|
||||
for (y = 0; y < imageLength; y+= tile_height ) {
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
gimp_progress_update ( (double) y / (double) imageLength);
|
||||
gimp_progress_update ( (double) y / (double) imageLength);
|
||||
|
||||
rows = MIN(tile_height, imageLength - y);
|
||||
for (i = 0; i < rows; ++i)
|
||||
TIFFReadScanline(tif, buffer + i * lineSize, y + i, s);
|
||||
|
@ -1288,7 +1288,7 @@ read_separate (guchar *source,
|
|||
gint bitsleft = 8, maxval = (1 << bps) - 1;
|
||||
|
||||
if (bps > 8) {
|
||||
g_message ("TIFF: Unsupported layout");
|
||||
g_message ("Unsupported layout");
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
|
@ -1386,15 +1386,14 @@ save_image (gchar *filename,
|
|||
tif = TIFFOpen (filename, "w");
|
||||
if (!tif)
|
||||
{
|
||||
g_print ("Can't write image to\n%s", filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE) {
|
||||
name = g_strdup_printf( _("Saving %s:"), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
}
|
||||
name = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
|
||||
drawable = gimp_drawable_get (layer);
|
||||
drawable_type = gimp_drawable_type (layer);
|
||||
|
@ -1602,13 +1601,12 @@ save_image (gchar *filename,
|
|||
}
|
||||
|
||||
if (!success) {
|
||||
g_message ("TIFF: Failed a scanline write on row %d", row);
|
||||
g_message ("Failed a scanline write on row %d", row);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
gimp_progress_update ((gdouble) row / (gdouble) rows);
|
||||
gimp_progress_update ((gdouble) row / (gdouble) rows);
|
||||
}
|
||||
|
||||
TIFFFlushData (tif);
|
||||
|
@ -1726,7 +1724,7 @@ comment_entry_callback (GtkWidget *widget,
|
|||
/* Temporary kludge for overlength strings - just return */
|
||||
if (len > 240)
|
||||
{
|
||||
g_message (_("TIFF: Your comment string is too long."));
|
||||
g_message (_("Your comment string is too long."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,8 +255,8 @@ unsharp_mask (GimpDrawable *drawable,
|
|||
gint x1, y1, x2, y2;
|
||||
|
||||
/* Get the input */
|
||||
gimp_drawable_mask_bounds(drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
gimp_progress_init(_("Blurring..."));
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
gimp_progress_init (_("Blurring..."));
|
||||
|
||||
width = drawable->width;
|
||||
height = drawable->height;
|
||||
|
@ -343,7 +343,7 @@ unsharp_region (GimpPixelRgn srcPR,
|
|||
gimp_pixel_rgn_set_row(&destPR, dest_row, x1, y1+row, x);
|
||||
|
||||
if (row%5 == 0)
|
||||
gimp_progress_update((gdouble)row/(3*y));
|
||||
gimp_progress_update ((gdouble)row/(3*y));
|
||||
}
|
||||
|
||||
/* allocate column buffers */
|
||||
|
@ -359,10 +359,10 @@ unsharp_region (GimpPixelRgn srcPR,
|
|||
gimp_pixel_rgn_set_col(&destPR, dest_col, x1+col, y1, y);
|
||||
|
||||
if (col%5 == 0)
|
||||
gimp_progress_update((gdouble)col/(3*x) + 0.33);
|
||||
gimp_progress_update ((gdouble)col/(3*x) + 0.33);
|
||||
}
|
||||
|
||||
gimp_progress_init(_("Merging..."));
|
||||
gimp_progress_init (_("Merging..."));
|
||||
|
||||
/* find integer value of threshold */
|
||||
threshold = unsharp_params.threshold;
|
||||
|
@ -394,7 +394,9 @@ unsharp_region (GimpPixelRgn srcPR,
|
|||
}
|
||||
}
|
||||
/* update progress bar every five rows */
|
||||
if (row%5 == 0) gimp_progress_update((gdouble)row/(3*y) + 0.67);
|
||||
if (row%5 == 0)
|
||||
gimp_progress_update ((gdouble)row/(3*y) + 0.67);
|
||||
|
||||
gimp_pixel_rgn_set_row(&destPR, dest_row, x1, y1+row, x);
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ load_image (gchar *filename,
|
|||
|
||||
if (!ext || ext[1] == 0 || strchr(ext, '/'))
|
||||
{
|
||||
g_message ("url: can't open URL without an extension");
|
||||
g_message ("Can't open URL without an extension");
|
||||
*status = GIMP_PDB_CALLING_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ load_image (gchar *filename,
|
|||
#ifndef __EMX__
|
||||
if (pipe (p) != 0)
|
||||
{
|
||||
g_message ("url: pipe() failed: %s", g_strerror (errno));
|
||||
g_message ("pipe() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -168,7 +168,7 @@ load_image (gchar *filename,
|
|||
|
||||
if ((pid = fork()) < 0)
|
||||
{
|
||||
g_message ("url: fork() failed: %s", g_strerror (errno));
|
||||
g_message ("fork() failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -188,7 +188,7 @@ load_image (gchar *filename,
|
|||
#endif
|
||||
|
||||
execlp ("wget", "wget", "-T", TIMEOUT, filename, "-O", tmpname, NULL);
|
||||
g_message ("url: exec() failed: wget: %s", g_strerror (errno));
|
||||
g_message ("exec() failed: wget: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
_exit (127);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ load_image (gchar *filename,
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("url: wget exited abnormally on URL %s", filename);
|
||||
g_message ("wget exited abnormally on URL %s", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -248,7 +248,7 @@ load_image (gchar *filename,
|
|||
/* The second line is the local copy of the file */
|
||||
if (fgets (buf, BUFSIZE, input) == NULL)
|
||||
{
|
||||
g_message ("url: wget exited abnormally on URL\n%s", filename);
|
||||
g_message ("wget exited abnormally on URL\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -263,7 +263,7 @@ load_image (gchar *filename,
|
|||
read_connect:
|
||||
if (fgets (buf, BUFSIZE, input) == NULL)
|
||||
{
|
||||
g_message ("url: wget exited abnormally on URL\n%s", filename);
|
||||
g_message ("wget exited abnormally on URL\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -287,14 +287,14 @@ read_connect:
|
|||
|
||||
if (fgets (buf, BUFSIZE, input) == NULL)
|
||||
{
|
||||
g_message ("url: wget exited abnormally on URL\n%s", filename);
|
||||
g_message ("wget exited abnormally on URL\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
}
|
||||
else if (! connected)
|
||||
{
|
||||
g_message ("url: a network error occured: %s", buf);
|
||||
g_message ("A network error occured: %s", buf);
|
||||
|
||||
DEBUG (buf);
|
||||
|
||||
|
@ -308,7 +308,7 @@ read_connect:
|
|||
/* The fifth line is either the length of the file or an error */
|
||||
if (fgets (buf, BUFSIZE, input) == NULL)
|
||||
{
|
||||
g_message ("url: wget exited abnormally on URL\n%s", filename);
|
||||
g_message ("wget exited abnormally on URL\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -319,7 +319,7 @@ read_connect:
|
|||
}
|
||||
else
|
||||
{
|
||||
g_message ("url: a network error occured: %s", buf);
|
||||
g_message ("A network error occured: %s", buf);
|
||||
|
||||
DEBUG (buf);
|
||||
|
||||
|
@ -332,7 +332,7 @@ read_connect:
|
|||
|
||||
if (sscanf (buf, "Length: %31s", sizestr) != 1)
|
||||
{
|
||||
g_message ("url: could not parse wget's file length message");
|
||||
g_message ("Could not parse wget's file length message");
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -397,7 +397,7 @@ read_connect:
|
|||
|
||||
if (! finished)
|
||||
{
|
||||
g_message ("url: wget exited before finishing downloading URL\n%s",
|
||||
g_message ("wget exited before finishing downloading URL\n'%s'",
|
||||
filename);
|
||||
unlink (tmpname);
|
||||
g_free (tmpname);
|
||||
|
@ -414,7 +414,7 @@ read_connect:
|
|||
|
||||
if (pid == -1)
|
||||
{
|
||||
g_message ("url: spawn failed: %s", g_strerror (errno));
|
||||
g_message ("spawn failed: %s", g_strerror (errno));
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
@ -426,7 +426,7 @@ read_connect:
|
|||
|| !WIFEXITED (process_status)
|
||||
|| (WEXITSTATUS (process_status) != 0))
|
||||
{
|
||||
g_message ("url: wget exited abnormally on URL %s", filename);
|
||||
g_message ("wget exited abnormally on URL\n'%s'", filename);
|
||||
g_free (tmpname);
|
||||
*status = GIMP_PDB_EXECUTION_ERROR;
|
||||
return -1;
|
||||
|
|
|
@ -1907,7 +1907,7 @@ run (gchar *name,
|
|||
/* Make sure that the drawable is gray or RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->drawable_id))
|
||||
{
|
||||
gimp_progress_init ( _("Video/RGB..."));
|
||||
gimp_progress_init (_("Video/RGB..."));
|
||||
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width ()
|
||||
+ 1));
|
||||
video (drawable);
|
||||
|
|
|
@ -458,7 +458,7 @@ value_propagate_body (gint drawable_id)
|
|||
|
||||
best = g_new (guchar, bytes);
|
||||
|
||||
gimp_progress_init (_("Value propagating..."));
|
||||
gimp_progress_init (_("Value Propagating..."));
|
||||
gimp_palette_get_foreground (&foreground);
|
||||
gimp_rgb_get_uchar (&foreground, fore+0, fore+1, fore+2);
|
||||
|
||||
|
|
|
@ -1155,9 +1155,9 @@ diff (GimpDrawable *drawable,
|
|||
|
||||
gimp_displays_flush(); /* make sure layer is visible */
|
||||
|
||||
gimp_progress_init ( _("Smoothing X gradient..."));
|
||||
gimp_progress_init (_("Smoothing X gradient..."));
|
||||
blur16(draw_xd);
|
||||
gimp_progress_init ( _("Smoothing Y gradient..."));
|
||||
gimp_progress_init (_("Smoothing Y gradient..."));
|
||||
blur16(draw_yd);
|
||||
|
||||
g_free (prev_row); /* row buffers allocated at top of fn. */
|
||||
|
@ -1212,7 +1212,7 @@ warp (GimpDrawable *orig_draw,
|
|||
|
||||
/* calculate new X,Y Displacement image maps */
|
||||
|
||||
gimp_progress_init ( _("Finding XY gradient..."));
|
||||
gimp_progress_init (_("Finding XY gradient..."));
|
||||
|
||||
diff(disp_map, &xdlayer, &ydlayer); /* generate x,y differential images (arrays) */
|
||||
|
||||
|
@ -1235,13 +1235,12 @@ warp (GimpDrawable *orig_draw,
|
|||
|
||||
for (warp_iter = 0; warp_iter < dvals.iter; warp_iter++)
|
||||
{
|
||||
if (run_mode != GIMP_RUN_NONINTERACTIVE) {
|
||||
string = g_strdup_printf (_("Flow Step %d..."), warp_iter+1);
|
||||
gimp_progress_init (string);
|
||||
g_free (string);
|
||||
progress = 0;
|
||||
gimp_progress_update (0);
|
||||
}
|
||||
string = g_strdup_printf (_("Flow Step %d..."), warp_iter+1);
|
||||
gimp_progress_init (string);
|
||||
g_free (string);
|
||||
progress = 0;
|
||||
gimp_progress_update (0);
|
||||
|
||||
warp_one(orig_draw, orig_draw, *map_x, *map_y, mag_draw, first_time, warp_iter);
|
||||
|
||||
gimp_drawable_update (orig_draw->drawable_id, x1, y1, (x2 - x1), (y2 - y1));
|
||||
|
|
|
@ -376,7 +376,7 @@ whirl_pinch (void)
|
|||
progress = 0;
|
||||
max_progress = sel_width * sel_height;
|
||||
|
||||
gimp_progress_init (_("Whirling and pinching..."));
|
||||
gimp_progress_init (_("Whirling and Pinching..."));
|
||||
|
||||
whirl = wpvals.whirl * G_PI / 180;
|
||||
radius2 = radius * radius * wpvals.radius;
|
||||
|
|
|
@ -305,7 +305,7 @@ CB_CopyImage (gboolean interactive,
|
|||
|
||||
/* following the slow part ... */
|
||||
if (interactive)
|
||||
gimp_progress_init (_("Copying ..."));
|
||||
gimp_progress_init (_("Copying..."));
|
||||
|
||||
/* speed it up with: */
|
||||
gimp_tile_cache_size (drawable->width * gimp_tile_height () * drawable->bpp);
|
||||
|
|
|
@ -325,7 +325,7 @@ render_blast (GimpDrawable *drawable,
|
|||
}
|
||||
else
|
||||
{
|
||||
gimp_progress_init( _("Rendering Blast..."));
|
||||
gimp_progress_init (_("Rendering Blast..."));
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
|
||||
width = x2 - x1;
|
||||
|
@ -444,7 +444,7 @@ render_wind (GimpDrawable *drawable,
|
|||
}
|
||||
else
|
||||
{
|
||||
gimp_progress_init( _("Rendering Wind..."));
|
||||
gimp_progress_init (_("Rendering Wind..."));
|
||||
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
|
||||
|
||||
bytes = drawable->bpp;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -927,7 +928,7 @@ new_object (ObjectType type,
|
|||
break;
|
||||
}
|
||||
if (i == nobjects)
|
||||
g_message ("WMF: Creating too many objects");
|
||||
g_message ("Creating too many objects");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1116,7 +1117,7 @@ load_image (char *filename)
|
|||
fp = fopen (filename, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
g_message ("WMF: can't open \"%s\"", filename);
|
||||
g_message ("Can't open '%s':%s", filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1126,7 +1127,7 @@ load_image (char *filename)
|
|||
|
||||
if (!ReadOK (fp, buffer, SIZE_WMFHEAD))
|
||||
{
|
||||
g_message ("WMF: Failed to read metafile header");
|
||||
g_message ("Failed to read metafile header");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1138,7 @@ load_image (char *filename)
|
|||
if (!ReadOK (fp, buffer + SIZE_WMFHEAD,
|
||||
SIZE_PLACEABLEMETAHEADER - SIZE_WMFHEAD))
|
||||
{
|
||||
g_message ("WMF: Failed to read placeable metafile header");
|
||||
g_message ("Failed to read placeable metafile header");
|
||||
return -1;
|
||||
}
|
||||
g_memmove (&apm_head.Left, buffer + 6, 2);
|
||||
|
@ -1160,7 +1161,7 @@ load_image (char *filename)
|
|||
#endif
|
||||
if (!ReadOK (fp, buffer, SIZE_WMFHEAD))
|
||||
{
|
||||
g_message ("WMF: Failed to read metafile header");
|
||||
g_message ("Failed to read metafile header");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1187,7 +1188,7 @@ load_image (char *filename)
|
|||
|
||||
if (GUINT16_FROM_LE (wmf_head.Version) != 0x0300)
|
||||
{
|
||||
g_message ("WMF: Metafile has wrong version, got %#x, expected 0x300",
|
||||
g_message ("Metafile has wrong version, got %#x, expected 0x300",
|
||||
GUINT16_FROM_LE (wmf_head.Version));
|
||||
return -1;
|
||||
}
|
||||
|
@ -1201,7 +1202,7 @@ load_image (char *filename)
|
|||
{
|
||||
if (!ReadOK (fp, buffer, SIZE_WMFRECORD))
|
||||
{
|
||||
g_message ("WMF: Failed to read metafile record");
|
||||
g_message ("Failed to read metafile record");
|
||||
return -1;
|
||||
}
|
||||
g_memmove (&record.Size, buffer, 4);
|
||||
|
@ -1273,7 +1274,7 @@ load_image (char *filename)
|
|||
if (ix >= 0)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: RestoreDC with positive argument (%d)?", ix);
|
||||
g_message ("RestoreDC with positive argument (%d)?", ix);
|
||||
return -1;
|
||||
}
|
||||
while (ix++ < 0)
|
||||
|
@ -1281,7 +1282,7 @@ load_image (char *filename)
|
|||
if (canvas->dc_stack == NULL)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: DC stack underflow");
|
||||
g_message ("DC stack underflow");
|
||||
return -1;
|
||||
}
|
||||
gdk_gc_unref (canvas->dc.gc);
|
||||
|
@ -1305,7 +1306,7 @@ load_image (char *filename)
|
|||
if (!gdk_color_alloc (canvas->colormap, &canvas->dc.bg))
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Couldn't allocate color");
|
||||
g_message ("Couldn't allocate color");
|
||||
return -1;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
@ -1332,7 +1333,7 @@ load_image (char *filename)
|
|||
break;
|
||||
default:
|
||||
fclose (fp);
|
||||
g_message ("WMF: Invalid case %d at line %d",
|
||||
g_message ("Invalid case %d at line %d",
|
||||
GINT16_FROM_LE (params[0]), __LINE__);
|
||||
break;
|
||||
}
|
||||
|
@ -1352,7 +1353,7 @@ load_image (char *filename)
|
|||
if (!gdk_color_alloc (canvas->colormap, &canvas->dc.textColor))
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Couldn't allocate color");
|
||||
g_message ("Couldn't allocate color");
|
||||
return -1;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
@ -1475,7 +1476,7 @@ load_image (char *filename)
|
|||
|
||||
default:
|
||||
fclose (fp);
|
||||
g_message ("WMF: Invalid case %d at line %d",
|
||||
g_message ("Invalid case %d at line %d",
|
||||
GUINT16_FROM_LE (params[0]), __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1518,7 +1519,7 @@ load_image (char *filename)
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message ("WMF: Unrecognized pen style %#x",
|
||||
g_message ("Unrecognized pen style %#x",
|
||||
GUINT16_FROM_LE (params[0]));
|
||||
fclose (fp);
|
||||
return -1;
|
||||
|
@ -1542,7 +1543,7 @@ load_image (char *filename)
|
|||
#endif
|
||||
if (!gdk_color_alloc (canvas->colormap, &objp->u.pen.color))
|
||||
{
|
||||
g_message ("WMF: Couldn't allocate color");
|
||||
g_message ("Couldn't allocate color");
|
||||
fclose (fp);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1578,7 +1579,7 @@ load_image (char *filename)
|
|||
canvas = make_canvas (&window, &viewport, have_bbox, &bbox, units_per_in);
|
||||
if (!gdk_color_alloc (canvas->colormap, &objp->u.brush.color))
|
||||
{
|
||||
g_message ("WMF: Couldn't allocate color");
|
||||
g_message ("Couldn't allocate color");
|
||||
fclose (fp);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1735,7 +1736,7 @@ load_image (char *filename)
|
|||
if (objp->u.font.font == NULL)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Cannot load suitable font, not even %s",
|
||||
g_message ("Cannot load suitable font, not even %s",
|
||||
fontname);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1752,14 +1753,14 @@ load_image (char *filename)
|
|||
if (k >= nobjects)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Selecting out of bounds object index");
|
||||
g_message ("Selecting out of bounds object index");
|
||||
return -1;
|
||||
}
|
||||
objp = objects[k];
|
||||
if (objp == NULL)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Selecting NULL object");
|
||||
g_message ("Selecting NULL object");
|
||||
return -1;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
@ -1801,7 +1802,7 @@ load_image (char *filename)
|
|||
|
||||
default:
|
||||
fclose (fp);
|
||||
g_message ("WMF: Unhandled case %d at line %d",
|
||||
g_message ("Unhandled case %d at line %d",
|
||||
objp->type, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1815,20 +1816,20 @@ load_image (char *filename)
|
|||
if (k >= nobjects)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Selecting out of bounds palette index");
|
||||
g_message ("Selecting out of bounds palette index");
|
||||
return -1;
|
||||
}
|
||||
objp = objects[k];
|
||||
if (objp == NULL)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Selecting NULL palette");
|
||||
g_message ("Selecting NULL palette");
|
||||
return -1;
|
||||
}
|
||||
if (objp->type != OBJ_PALETTE)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: SelectPalette selects non-palette");
|
||||
g_message ("SelectPalette selects non-palette");
|
||||
return -1;
|
||||
}
|
||||
/* XXX */
|
||||
|
@ -1847,14 +1848,14 @@ load_image (char *filename)
|
|||
if (k >= nobjects)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Deleting out of bounds object index");
|
||||
g_message ("Deleting out of bounds object index");
|
||||
return -1;
|
||||
}
|
||||
objp = objects[k];
|
||||
if (objp == NULL)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Deleting already deleted object");
|
||||
g_message ("Deleting already deleted object");
|
||||
return -1;
|
||||
}
|
||||
if (objp->type == OBJ_FONT)
|
||||
|
@ -2299,7 +2300,7 @@ load_image (char *filename)
|
|||
default:
|
||||
if (!warned_unhandled)
|
||||
{
|
||||
g_message ("WMF: Unhandled operation %#x.",
|
||||
g_message ("Unhandled operation %#x.",
|
||||
GUINT16_FROM_LE (record.Function));
|
||||
warned_unhandled = TRUE;
|
||||
}
|
||||
|
@ -2331,7 +2332,7 @@ readparams (DWORD size,
|
|||
if (nwords < nparams)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: too small record?");
|
||||
g_message ("Too small record?");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2339,14 +2340,14 @@ readparams (DWORD size,
|
|||
if (nparams > NPARMWORDS)
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: too large record?");
|
||||
g_message ("Too large record?");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nparams > 0 && !ReadOK (fp, params, nparams * sizeof (WORD)))
|
||||
{
|
||||
fclose (fp);
|
||||
g_message ("WMF: Read failed");
|
||||
g_message ("Read failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -731,11 +732,11 @@ load_image (gchar *filename)
|
|||
fp = fopen (filename, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
g_message (_("XBM: cannot open \"%s\"\n"), filename);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
name_buf = g_strdup_printf (_("Loading %s:"), filename);
|
||||
name_buf = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
|
@ -814,25 +815,26 @@ load_image (gchar *filename)
|
|||
|
||||
if (c == EOF)
|
||||
{
|
||||
g_message (_("XBM: cannot read header (ftell == %ld)\n"), ftell (fp));
|
||||
g_message (_("'%s':\nCan't read header (ftell == %ld)"),
|
||||
filename, ftell (fp));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (width == 0)
|
||||
{
|
||||
g_message (_("XBM: no image width specified\n"));
|
||||
g_message (_("'%s':\nNo image width specified"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (height == 0)
|
||||
{
|
||||
g_message (_("XBM: no image height specified\n"));
|
||||
g_message (_("'%s':\nNo image height specified"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (intbits == 0)
|
||||
{
|
||||
g_message (_("XBM: no image data type specified\n"));
|
||||
g_message (_("'%s':\nNo image data type specified"), filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -983,10 +985,6 @@ save_image (gchar *filename,
|
|||
|
||||
bpp = gimp_drawable_bpp (drawable_ID);
|
||||
|
||||
name_buf = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
/* Figure out which color is black, and which is white. */
|
||||
dark = 0;
|
||||
if (colors > 1)
|
||||
|
@ -1005,10 +1003,15 @@ save_image (gchar *filename,
|
|||
fp = fopen (filename, "w");
|
||||
if (!fp)
|
||||
{
|
||||
g_message (_("XBM: cannot create \"%s\"\n"), filename);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
name_buf = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name_buf);
|
||||
g_free (name_buf);
|
||||
|
||||
/* Maybe write the image comment. */
|
||||
#if 0
|
||||
/* DISABLED - see http://bugzilla.gnome.org/show_bug.cgi?id=82763 */
|
||||
|
|
|
@ -331,7 +331,7 @@ load_image (gchar *filename)
|
|||
gchar *name;
|
||||
|
||||
/* put up a progress bar */
|
||||
name = g_strdup_printf (_("Loading %s:"), filename);
|
||||
name = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
|
||||
|
@ -592,7 +592,7 @@ save_image (gchar *filename,
|
|||
{
|
||||
gchar *name;
|
||||
|
||||
name = g_strdup_printf (_("Saving %s:"), filename);
|
||||
name = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ static char ident[] = "@(#) GIMP XWD file-plugin v1.95 02-Jul-2001";
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -375,14 +376,14 @@ load_image (gchar *filename)
|
|||
ifp = fopen (filename, "rb");
|
||||
if (!ifp)
|
||||
{
|
||||
g_message (_("can't open file for reading"));
|
||||
return (-1);
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
read_xwd_header (ifp, &xwdhdr);
|
||||
if (xwdhdr.l_file_version != 7)
|
||||
{
|
||||
g_message(_("can't open file as XWD file"));
|
||||
g_message(_("Can't open file as XWD file"));
|
||||
fclose (ifp);
|
||||
return (-1);
|
||||
}
|
||||
|
@ -401,40 +402,32 @@ load_image (gchar *filename)
|
|||
if (xwdhdr.l_colormap_entries > 0)
|
||||
{
|
||||
xwdcolmap = g_new (L_XWDCOLOR, xwdhdr.l_colormap_entries);
|
||||
if (xwdcolmap == NULL)
|
||||
{
|
||||
g_message (_("can't get memory for colormap"));
|
||||
fclose (ifp);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
read_xwd_cols (ifp, &xwdhdr, xwdcolmap);
|
||||
read_xwd_cols (ifp, &xwdhdr, xwdcolmap);
|
||||
#ifdef XWD_COL_DEBUG
|
||||
{
|
||||
int j;
|
||||
printf ("File %s\n",filename);
|
||||
for (j=0; j < xwdhdr.l_colormap_entries; j++)
|
||||
printf ("Entry 0x%08lx: 0x%04lx, 0x%04lx, 0x%04lx, %d\n",
|
||||
(long)xwdcolmap[j].l_pixel,(long)xwdcolmap[j].l_red,
|
||||
(long)xwdcolmap[j].l_green,(long)xwdcolmap[j].l_blue,
|
||||
(int)xwdcolmap[j].l_flags);
|
||||
}
|
||||
#endif
|
||||
if (xwdhdr.l_file_version != 7)
|
||||
{
|
||||
g_message (_("can't read color entries"));
|
||||
g_free (xwdcolmap);
|
||||
fclose (ifp);
|
||||
return (-1);
|
||||
int j;
|
||||
printf ("File %s\n",filename);
|
||||
for (j=0; j < xwdhdr.l_colormap_entries; j++)
|
||||
printf ("Entry 0x%08lx: 0x%04lx, 0x%04lx, 0x%04lx, %d\n",
|
||||
(long)xwdcolmap[j].l_pixel,(long)xwdcolmap[j].l_red,
|
||||
(long)xwdcolmap[j].l_green,(long)xwdcolmap[j].l_blue,
|
||||
(int)xwdcolmap[j].l_flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (xwdhdr.l_file_version != 7)
|
||||
{
|
||||
g_message (_("can't read color entries"));
|
||||
g_free (xwdcolmap);
|
||||
fclose (ifp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
depth = xwdhdr.l_pixmap_depth;
|
||||
bpp = xwdhdr.l_bits_per_pixel;
|
||||
|
@ -529,16 +522,14 @@ save_image (char *filename,
|
|||
ofp = fopen (filename, "wb");
|
||||
if (!ofp)
|
||||
{
|
||||
g_message (_("can't open file for writing"));
|
||||
return (FALSE);
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
temp = g_strdup_printf (_("Saving '%s'..."), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
if (drawable_type == GIMP_INDEXED_IMAGE)
|
||||
retval = save_index (ofp, image_ID, drawable_ID, 0);
|
||||
|
@ -551,7 +542,7 @@ save_image (char *filename,
|
|||
|
||||
fclose (ofp);
|
||||
|
||||
return (retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1218,7 +1209,7 @@ load_xwd_f2_d1_b1 (char *filename,
|
|||
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1318,7 +1309,7 @@ load_xwd_f2_d8_b8 (char *filename,
|
|||
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1479,7 +1470,7 @@ load_xwd_f2_d16_b16 (char *filename,
|
|||
|
||||
scan_lines++;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1627,7 +1618,7 @@ load_xwd_f2_d24_b32 (char *filename,
|
|||
for (j = 0; j < linepad; j++)
|
||||
getc (ifp);
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1676,7 +1667,7 @@ load_xwd_f2_d24_b32 (char *filename,
|
|||
for (j = 0; j < linepad; j++)
|
||||
getc (ifp);
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double)(i+1) / (double)height);
|
||||
|
||||
if ((scan_lines == tile_height) || ((i+1) == height))
|
||||
|
@ -1931,9 +1922,8 @@ load_xwd_f1_d24_b1 (char *filename,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
gimp_progress_update ((double)(tile_end) / (double)(height));
|
||||
|
||||
gimp_progress_update ((double)(tile_end) / (double)(height));
|
||||
|
||||
gimp_pixel_rgn_set_rect (&pixel_rgn, data, 0, tile_start,
|
||||
width, tile_end-tile_start+1);
|
||||
|
@ -2057,7 +2047,7 @@ save_index (FILE *ofp,
|
|||
if (linepad) fwrite ((char *)&tmp, linepad, 1, ofp);
|
||||
src += width;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
g_free (data);
|
||||
|
@ -2146,7 +2136,7 @@ save_rgb (FILE *ofp,
|
|||
if (linepad) fwrite ((char *)&tmp, linepad, 1, ofp);
|
||||
src += width*3;
|
||||
|
||||
if ((l_run_mode != GIMP_RUN_NONINTERACTIVE) && ((i % 20) == 0))
|
||||
if ((i % 20) == 0)
|
||||
gimp_progress_update ((double) i / (double) height);
|
||||
}
|
||||
g_free (data);
|
||||
|
|
|
@ -213,7 +213,7 @@ do_zcrop (GimpDrawable *drawable,
|
|||
if (((livingcols==0) || (livingrows==0)) ||
|
||||
((livingcols==width) && (livingrows==height)))
|
||||
{
|
||||
g_message (_("ZealousCrop(tm): Nothing to crop."));
|
||||
g_message (_("Nothing to crop."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <glib.h> /* For G_OS_WIN32 */
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -192,7 +193,7 @@ load_image (gchar *filename)
|
|||
int max_rows; /* max. rows allocated */
|
||||
int col, hcol; /* column, highest column ever used */
|
||||
|
||||
name = g_strdup_printf (_("Loading %s:"), filename);
|
||||
name = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||
gimp_progress_init (name);
|
||||
g_free (name);
|
||||
|
||||
|
@ -204,7 +205,13 @@ load_image (gchar *filename)
|
|||
|
||||
init_byte_tab( 0, byte_tab );
|
||||
|
||||
fd = open(filename, O_RDONLY | _O_BINARY );
|
||||
fd = open (filename, O_RDONLY | _O_BINARY);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
hibit = 0;
|
||||
data = 0;
|
||||
|
|
|
@ -31,10 +31,12 @@
|
|||
* Fix bug with gimp_export_image()
|
||||
* (moved it from load to save)
|
||||
*/
|
||||
|
||||
static char ident[] = "@(#) GIMP FITS file-plugin v1.06 21-Nov-99";
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -344,7 +346,7 @@ load_image (gchar *filename)
|
|||
fp = fopen (filename, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
g_message (_("Can't open file for reading"));
|
||||
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||
return (-1);
|
||||
}
|
||||
fclose (fp);
|
||||
|
@ -456,13 +458,14 @@ save_image (gchar *filename,
|
|||
ofp = fits_open (filename, "w");
|
||||
if (!ofp)
|
||||
{
|
||||
g_message (_("Can't open file for writing"));
|
||||
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||
filename, g_strerror (errno));
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (l_run_mode != GIMP_RUN_NONINTERACTIVE)
|
||||
{
|
||||
temp = g_strdup_printf (_("Saving %s:"), filename);
|
||||
temp = g_strdup_printf (_("Saving '%s':"), filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue