mirror of https://github.com/GNOME/gimp.git
gimp_main now takes a GimpPlugInInfo *, and PLUG_IN_INFO is now a static
2003-05-23 Manish Singh <yosh@gimp.org> * libgimp/gimp.[ch]: gimp_main now takes a GimpPlugInInfo *, and PLUG_IN_INFO is now a static variable set from that. This removes all the special casing for the Win32 and OS/2 ports around this. Also added a debugging hook for quit procs. * plug-ins/common/mng.c: moved MAIN() to the end so PLUG_IN_INFO is declared. * plug-ins/gimpressionist/gimpressionist.c: pass &PLUG_IN_INFO to gimp_main. * plug-ins/pygimp/gimpmodule.c: Here too. Also add a message function.
This commit is contained in:
parent
7ade1c7251
commit
f6fb0ffff8
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2003-05-23 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
|
* libgimp/gimp.[ch]: gimp_main now takes a GimpPlugInInfo *,
|
||||||
|
and PLUG_IN_INFO is now a static variable set from that. This
|
||||||
|
removes all the special casing for the Win32 and OS/2 ports around
|
||||||
|
this. Also added a debugging hook for quit procs.
|
||||||
|
|
||||||
|
* plug-ins/common/mng.c: moved MAIN() to the end so PLUG_IN_INFO is
|
||||||
|
declared.
|
||||||
|
|
||||||
|
* plug-ins/gimpressionist/gimpressionist.c: pass &PLUG_IN_INFO
|
||||||
|
to gimp_main.
|
||||||
|
|
||||||
|
* plug-ins/pygimp/gimpmodule.c: Here too. Also add a message
|
||||||
|
function.
|
||||||
|
|
||||||
2003-05-24 Sven Neumann <sven@gimp.org>
|
2003-05-24 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpimage-rotate.c (gimp_image_rotate): fixed offset of
|
* app/core/gimpimage-rotate.c (gimp_image_rotate): fixed offset of
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# undef RGB
|
# undef RGB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,6 +101,7 @@ typedef enum {
|
||||||
GIMP_DEBUG_QUERY = 1 << 2,
|
GIMP_DEBUG_QUERY = 1 << 2,
|
||||||
GIMP_DEBUG_INIT = 1 << 3,
|
GIMP_DEBUG_INIT = 1 << 3,
|
||||||
GIMP_DEBUG_RUN = 1 << 4,
|
GIMP_DEBUG_RUN = 1 << 4,
|
||||||
|
GIMP_DEBUG_QUIT = 1 << 5,
|
||||||
|
|
||||||
GIMP_DEBUG_DEFAULT = (GIMP_DEBUG_RUN | GIMP_DEBUG_FATAL_WARNINGS)
|
GIMP_DEBUG_DEFAULT = (GIMP_DEBUG_RUN | GIMP_DEBUG_FATAL_WARNINGS)
|
||||||
} GimpDebugFlag;
|
} GimpDebugFlag;
|
||||||
|
@ -176,35 +178,19 @@ static const GDebugKey gimp_debug_keys[] = {
|
||||||
{"query", GIMP_DEBUG_QUERY},
|
{"query", GIMP_DEBUG_QUERY},
|
||||||
{"init", GIMP_DEBUG_INIT},
|
{"init", GIMP_DEBUG_INIT},
|
||||||
{"run", GIMP_DEBUG_RUN},
|
{"run", GIMP_DEBUG_RUN},
|
||||||
|
{"quit", GIMP_DEBUG_QUIT},
|
||||||
{"on", GIMP_DEBUG_DEFAULT}
|
{"on", GIMP_DEBUG_DEFAULT}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const guint gimp_ndebug_keys = sizeof (gimp_debug_keys) / sizeof (GDebugKey);
|
static const guint gimp_ndebug_keys = sizeof (gimp_debug_keys) / sizeof (GDebugKey);
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
|
||||||
static GimpPlugInInfo *PLUG_IN_INFO_PTR;
|
|
||||||
#define PLUG_IN_INFO (*PLUG_IN_INFO_PTR)
|
|
||||||
void
|
|
||||||
set_gimp_PLUG_IN_INFO_PTR (GimpPlugInInfo *p)
|
|
||||||
{
|
|
||||||
PLUG_IN_INFO_PTR = p;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifndef __EMX__
|
|
||||||
extern GimpPlugInInfo PLUG_IN_INFO;
|
|
||||||
#else
|
|
||||||
static GimpPlugInInfo PLUG_IN_INFO;
|
static GimpPlugInInfo PLUG_IN_INFO;
|
||||||
void set_gimp_PLUG_IN_INFO (const GimpPlugInInfo *p)
|
|
||||||
{
|
|
||||||
PLUG_IN_INFO = *p;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
gimp_main (int argc,
|
gimp_main (const GimpPlugInInfo *info,
|
||||||
char *argv[])
|
int argc,
|
||||||
|
char *argv[])
|
||||||
{
|
{
|
||||||
gchar *basename;
|
gchar *basename;
|
||||||
const gchar *env_string;
|
const gchar *env_string;
|
||||||
|
@ -213,8 +199,6 @@ gimp_main (int argc,
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
gint i, j, k;
|
gint i, j, k;
|
||||||
|
|
||||||
g_assert (PLUG_IN_INFO_PTR != NULL);
|
|
||||||
|
|
||||||
/* Check for exe file name with spaces in the path having been split up
|
/* Check for exe file name with spaces in the path having been split up
|
||||||
* by buggy NT C runtime, or something. I don't know why this happens
|
* by buggy NT C runtime, or something. I don't know why this happens
|
||||||
* on NT (including w2k), but not on w95/98.
|
* on NT (including w2k), but not on w95/98.
|
||||||
|
@ -223,31 +207,43 @@ gimp_main (int argc,
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
k = strlen (argv[i]);
|
k = strlen (argv[i]);
|
||||||
if (k > 10)
|
|
||||||
if (g_ascii_strcasecmp (argv[i] + k - 4, ".exe") == 0)
|
|
||||||
{
|
|
||||||
/* Found the end of the executable name, most probably.
|
|
||||||
* Splice the parts of the name back together.
|
|
||||||
*/
|
|
||||||
GString *s;
|
|
||||||
|
|
||||||
s = g_string_new (argv[0]);
|
if (k > 10)
|
||||||
for (j = 1; j <= i; j++)
|
{
|
||||||
{
|
if (g_ascii_strcasecmp (argv[i] + k - 4, ".exe") == 0)
|
||||||
s = g_string_append_c (s, ' ');
|
{
|
||||||
s = g_string_append (s, argv[j]);
|
/* Found the end of the executable name, most probably.
|
||||||
}
|
* Splice the parts of the name back together.
|
||||||
argv[0] = s->str;
|
*/
|
||||||
/* Move rest of argv down */
|
GString *s;
|
||||||
for (j = 1; j < argc - i; j++)
|
|
||||||
argv[j] = argv[j + i];
|
s = g_string_new (argv[0]);
|
||||||
argv[argc - i] = NULL;
|
|
||||||
argc -= i;
|
for (j = 1; j <= i; j++)
|
||||||
break;
|
{
|
||||||
|
s = g_string_append_c (s, ' ');
|
||||||
|
s = g_string_append (s, argv[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
argv[0] = s->str;
|
||||||
|
|
||||||
|
/* Move rest of argv down */
|
||||||
|
for (j = 1; j < argc - i; j++)
|
||||||
|
argv[j] = argv[j + i];
|
||||||
|
|
||||||
|
argv[argc - i] = NULL;
|
||||||
|
argc -= i;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_assert (info != NULL);
|
||||||
|
|
||||||
|
PLUG_IN_INFO = *info;
|
||||||
|
|
||||||
if ((argc != 6) || (strcmp (argv[1], "-gimp") != 0))
|
if ((argc != 6) || (strcmp (argv[1], "-gimp") != 0))
|
||||||
{
|
{
|
||||||
g_printerr ("%s is a gimp plug-in and must be run by the gimp to be used\n", argv[0]);
|
g_printerr ("%s is a gimp plug-in and must be run by the gimp to be used\n", argv[0]);
|
||||||
|
@ -408,6 +404,9 @@ gimp_main (int argc,
|
||||||
static void
|
static void
|
||||||
gimp_close (void)
|
gimp_close (void)
|
||||||
{
|
{
|
||||||
|
if (gimp_debug_flags & GIMP_DEBUG_QUIT)
|
||||||
|
gimp_debug_stop ();
|
||||||
|
|
||||||
if (PLUG_IN_INFO.quit_proc)
|
if (PLUG_IN_INFO.quit_proc)
|
||||||
(* PLUG_IN_INFO.quit_proc) ();
|
(* PLUG_IN_INFO.quit_proc) ();
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,6 @@ struct _GimpParam
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
||||||
void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
|
|
||||||
|
|
||||||
/* Define WinMain() because plug-ins are built as GUI applications. Also
|
/* Define WinMain() because plug-ins are built as GUI applications. Also
|
||||||
* define a main() in case some plug-in still is built as a console
|
* define a main() in case some plug-in still is built as a console
|
||||||
* application.
|
* application.
|
||||||
|
@ -175,54 +173,38 @@ void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define MAIN() \
|
# define MAIN() \
|
||||||
static int \
|
struct HINSTANCE__; \
|
||||||
win32_gimp_main (int argc, char **argv) \
|
int _stdcall \
|
||||||
{ \
|
WinMain (struct HINSTANCE__ *hInstance, \
|
||||||
set_gimp_PLUG_IN_INFO_PTR(&PLUG_IN_INFO); \
|
struct HINSTANCE__ *hPrevInstance, \
|
||||||
return gimp_main (argc, argv); \
|
char *lpszCmdLine, \
|
||||||
} \
|
int nCmdShow) \
|
||||||
\
|
{ \
|
||||||
struct HINSTANCE__; \
|
return gimp_main (&PLUG_IN_INFO, __argc, __argv); \
|
||||||
int _stdcall \
|
} \
|
||||||
WinMain (struct HINSTANCE__ *hInstance, \
|
\
|
||||||
struct HINSTANCE__ *hPrevInstance, \
|
int \
|
||||||
char *lpszCmdLine, \
|
main (int argc, char *argv[]) \
|
||||||
int nCmdShow) \
|
{ \
|
||||||
{ \
|
return gimp_main (&PLUG_IN_INFO, argc, argv); \
|
||||||
return win32_gimp_main (__argc, __argv); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
int \
|
|
||||||
main (int argc, char *argv[]) \
|
|
||||||
{ \
|
|
||||||
return win32_gimp_main (argc, argv); \
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifndef __EMX__
|
# define MAIN() \
|
||||||
# define MAIN() \
|
int \
|
||||||
int \
|
main (int argc, char *argv[]) \
|
||||||
main (int argc, char *argv[]) \
|
{ \
|
||||||
{ \
|
return gimp_main (&PLUG_IN_INFO, argc, argv); \
|
||||||
return gimp_main (argc, argv); \
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
# define MAIN() \
|
|
||||||
int \
|
|
||||||
main (int argc, char *argv[]) \
|
|
||||||
{ \
|
|
||||||
set_gimp_PLUG_IN_INFO(&PLUG_IN_INFO); \
|
|
||||||
return gimp_main (argc, argv); \
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* The main procedure that should be called with the
|
/* The main procedure that should be called with the PLUG_IN_INFO structure
|
||||||
* 'argc' and 'argv' that are passed to "main".
|
* and the 'argc' and 'argv' that are passed to "main".
|
||||||
*/
|
*/
|
||||||
gint gimp_main (gint argc,
|
gint gimp_main (const GimpPlugInInfo *info,
|
||||||
gchar *argv[]);
|
gint argc,
|
||||||
|
gchar *argv[]);
|
||||||
|
|
||||||
/* Forcefully causes the gimp library to exit and
|
/* Forcefully causes the gimp library to exit and
|
||||||
* close down its connection to main gimp application.
|
* close down its connection to main gimp application.
|
||||||
|
|
|
@ -156,7 +156,6 @@ struct mng_data_t mng_data = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MAIN ()
|
|
||||||
/* The output FILE pointer which is used by libmng;
|
/* The output FILE pointer which is used by libmng;
|
||||||
* passed around as user data. */
|
* passed around as user data. */
|
||||||
struct mnglib_userdata_t
|
struct mnglib_userdata_t
|
||||||
|
@ -1536,3 +1535,5 @@ GimpPlugInInfo PLUG_IN_INFO =
|
||||||
query,
|
query,
|
||||||
run
|
run
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MAIN ()
|
||||||
|
|
|
@ -543,15 +543,8 @@ MAIN()
|
||||||
#else
|
#else
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if(argc != 2) {
|
if (argc != 2)
|
||||||
|
return gimp_main (&PLUG_IN_INFO, argc, argv);
|
||||||
/* Is this needed anymore? */
|
|
||||||
#ifdef __EMX__
|
|
||||||
set_gimp_PLUG_IN_INFO(&PLUG_IN_INFO);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return gimp_main(argc, argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
standalone = argv[1];
|
standalone = argv[1];
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include "pygimp.h"
|
#include "pygimp.h"
|
||||||
#include <sysmodule.h>
|
#include <sysmodule.h>
|
||||||
#include <structmember.h>
|
|
||||||
|
|
||||||
/* maximum bits per pixel ... */
|
/* maximum bits per pixel ... */
|
||||||
#define MAX_BPP 4
|
#define MAX_BPP 4
|
||||||
|
@ -190,14 +189,7 @@ pygimp_main(PyObject *self, PyObject *args)
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
argv[i] = g_strdup(PyString_AsString(PyList_GetItem(av, i)));
|
argv[i] = g_strdup(PyString_AsString(PyList_GetItem(av, i)));
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
gimp_main(&PLUG_IN_INFO, argc, argv);
|
||||||
{
|
|
||||||
extern void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
|
|
||||||
set_gimp_PLUG_IN_INFO_PTR(&PLUG_IN_INFO);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gimp_main(argc, argv);
|
|
||||||
|
|
||||||
if (argv != NULL) {
|
if (argv != NULL) {
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
|
@ -213,12 +205,22 @@ pygimp_main(PyObject *self, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygimp_quit(PyObject *self)
|
pygimp_quit(PyObject *self)
|
||||||
{
|
{
|
||||||
|
|
||||||
gimp_quit();
|
gimp_quit();
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
pygimp_message(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
char *msg;
|
||||||
|
if (!PyArg_ParseTuple(args, "s:message", &msg))
|
||||||
|
return NULL;
|
||||||
|
gimp_message(msg);
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
return Py_None;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygimp_set_data(PyObject *self, PyObject *args)
|
pygimp_set_data(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -804,6 +806,7 @@ id2display(PyObject *self, PyObject *args)
|
||||||
static struct PyMethodDef gimp_methods[] = {
|
static struct PyMethodDef gimp_methods[] = {
|
||||||
{"main", (PyCFunction)pygimp_main, METH_VARARGS},
|
{"main", (PyCFunction)pygimp_main, METH_VARARGS},
|
||||||
{"quit", (PyCFunction)pygimp_quit, METH_NOARGS},
|
{"quit", (PyCFunction)pygimp_quit, METH_NOARGS},
|
||||||
|
{"message", (PyCFunction)pygimp_message, METH_VARARGS},
|
||||||
{"set_data", (PyCFunction)pygimp_set_data, METH_VARARGS},
|
{"set_data", (PyCFunction)pygimp_set_data, METH_VARARGS},
|
||||||
{"get_data", (PyCFunction)pygimp_get_data, METH_VARARGS},
|
{"get_data", (PyCFunction)pygimp_get_data, METH_VARARGS},
|
||||||
{"progress_init", (PyCFunction)pygimp_progress_init, METH_VARARGS},
|
{"progress_init", (PyCFunction)pygimp_progress_init, METH_VARARGS},
|
||||||
|
|
Loading…
Reference in New Issue