mirror of https://github.com/GNOME/gimp.git
removed doubly pasted code. Changed error/progress messages to use the
2003-11-11 Michael Natterer <mitch@gimp.org> * plug-ins/common/dicom.c: removed doubly pasted code. Changed error/progress messages to use the "standard" string many plug-ins use. Added error message if opening for wriring fails. Minor cleanups.
This commit is contained in:
parent
d08c259feb
commit
7110a5bd4c
|
@ -1,3 +1,10 @@
|
||||||
|
2003-11-11 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/common/dicom.c: removed doubly pasted code. Changed
|
||||||
|
error/progress messages to use the "standard" string many plug-ins
|
||||||
|
use. Added error message if opening for wriring fails. Minor
|
||||||
|
cleanups.
|
||||||
|
|
||||||
2003-11-11 Sven Neumann <sven@gimp.org>
|
2003-11-11 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* plug-ins/common/Makefile.am
|
* plug-ins/common/Makefile.am
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -137,8 +138,6 @@ query (void)
|
||||||
G_N_ELEMENTS (save_args), 0,
|
G_N_ELEMENTS (save_args), 0,
|
||||||
save_args, NULL);
|
save_args, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gimp_install_procedure ("file_dicom_load",
|
gimp_install_procedure ("file_dicom_load",
|
||||||
"loads files of the dicom file format",
|
"loads files of the dicom file format",
|
||||||
"Load a file in the DICOM standard format."
|
"Load a file in the DICOM standard format."
|
||||||
|
@ -170,13 +169,14 @@ static void
|
||||||
run (const gchar *name,
|
run (const gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
const GimpParam *param,
|
const GimpParam *param,
|
||||||
gint* nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals)
|
GimpParam **return_vals)
|
||||||
{
|
{
|
||||||
static GimpParam values[2];
|
static GimpParam values[2];
|
||||||
GimpRunMode run_mode;
|
GimpRunMode run_mode;
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
gint32 image_ID, drawable_ID;
|
gint32 image_ID;
|
||||||
|
gint32 drawable_ID;
|
||||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||||
|
|
||||||
INIT_I18N ();
|
INIT_I18N ();
|
||||||
|
@ -209,19 +209,14 @@ run (const gchar *name,
|
||||||
image_ID = param[1].data.d_int32;
|
image_ID = param[1].data.d_int32;
|
||||||
drawable_ID = param[2].data.d_int32;
|
drawable_ID = param[2].data.d_int32;
|
||||||
|
|
||||||
/* eventually export the image */
|
|
||||||
image_ID = param[1].data.d_int32;
|
|
||||||
drawable_ID = param[2].data.d_int32;
|
|
||||||
|
|
||||||
/* eventually export the image */
|
|
||||||
switch (run_mode)
|
switch (run_mode)
|
||||||
{
|
{
|
||||||
case GIMP_RUN_INTERACTIVE:
|
case GIMP_RUN_INTERACTIVE:
|
||||||
case GIMP_RUN_WITH_LAST_VALS:
|
case GIMP_RUN_WITH_LAST_VALS:
|
||||||
gimp_ui_init ("dicom", FALSE);
|
gimp_ui_init ("dicom", FALSE);
|
||||||
export = gimp_export_image (&image_ID, &drawable_ID, "DICOM",
|
export = gimp_export_image (&image_ID, &drawable_ID, "DICOM",
|
||||||
(GIMP_EXPORT_CAN_HANDLE_RGB |
|
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||||
GIMP_EXPORT_CAN_HANDLE_GRAY ));
|
GIMP_EXPORT_CAN_HANDLE_GRAY);
|
||||||
if (export == GIMP_EXPORT_CANCEL)
|
if (export == GIMP_EXPORT_CANCEL)
|
||||||
{
|
{
|
||||||
values[0].data.d_status = GIMP_PDB_CANCEL;
|
values[0].data.d_status = GIMP_PDB_CANCEL;
|
||||||
|
@ -286,7 +281,7 @@ load_image (const gchar *filename)
|
||||||
guint8 *pix_buf = NULL;
|
guint8 *pix_buf = NULL;
|
||||||
gboolean toggle_endian = FALSE;
|
gboolean toggle_endian = FALSE;
|
||||||
|
|
||||||
temp = g_strdup_printf (_("Loading %s:"), filename);
|
temp = g_strdup_printf (_("Opening '%s'..."), filename);
|
||||||
gimp_progress_init (temp);
|
gimp_progress_init (temp);
|
||||||
g_free (temp);
|
g_free (temp);
|
||||||
|
|
||||||
|
@ -295,12 +290,12 @@ load_image (const gchar *filename)
|
||||||
|
|
||||||
if (!DICOM)
|
if (!DICOM)
|
||||||
{
|
{
|
||||||
g_message (_("Can't open file '%s'."), filename);
|
g_message (_("Can't open '%s':\n%s"), filename, g_strerror (errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate the necessary structures */
|
/* allocate the necessary structures */
|
||||||
dicominfo = (DicomInfo *) g_malloc (sizeof (DicomInfo));
|
dicominfo = g_new0 (DicomInfo, 1);
|
||||||
|
|
||||||
/* Parse the file */
|
/* Parse the file */
|
||||||
fread (buf, 1, 128, DICOM); /* skip past buffer */
|
fread (buf, 1, 128, DICOM); /* skip past buffer */
|
||||||
|
@ -642,6 +637,14 @@ save_image (const gchar *filename,
|
||||||
/* Open the output file. */
|
/* Open the output file. */
|
||||||
DICOM = fopen (filename, "wb");
|
DICOM = fopen (filename, "wb");
|
||||||
|
|
||||||
|
if (!DICOM)
|
||||||
|
{
|
||||||
|
g_message (_("Can't open '%s' for writing:\n%s"),
|
||||||
|
filename, g_strerror (errno));
|
||||||
|
gimp_drawable_detach (drawable);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Print dicom header */
|
/* Print dicom header */
|
||||||
{
|
{
|
||||||
guint8 val = 0;
|
guint8 val = 0;
|
||||||
|
|
Loading…
Reference in New Issue