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>
|
||||
|
||||
* app/core/gimpimage-rotate.c (gimp_image_rotate): fixed offset of
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
# include <windows.h>
|
||||
# undef RGB
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
@ -100,6 +101,7 @@ typedef enum {
|
|||
GIMP_DEBUG_QUERY = 1 << 2,
|
||||
GIMP_DEBUG_INIT = 1 << 3,
|
||||
GIMP_DEBUG_RUN = 1 << 4,
|
||||
GIMP_DEBUG_QUIT = 1 << 5,
|
||||
|
||||
GIMP_DEBUG_DEFAULT = (GIMP_DEBUG_RUN | GIMP_DEBUG_FATAL_WARNINGS)
|
||||
} GimpDebugFlag;
|
||||
|
@ -176,35 +178,19 @@ static const GDebugKey gimp_debug_keys[] = {
|
|||
{"query", GIMP_DEBUG_QUERY},
|
||||
{"init", GIMP_DEBUG_INIT},
|
||||
{"run", GIMP_DEBUG_RUN},
|
||||
{"quit", GIMP_DEBUG_QUIT},
|
||||
{"on", GIMP_DEBUG_DEFAULT}
|
||||
};
|
||||
|
||||
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;
|
||||
void set_gimp_PLUG_IN_INFO (const GimpPlugInInfo *p)
|
||||
{
|
||||
PLUG_IN_INFO = *p;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
gimp_main (int argc,
|
||||
char *argv[])
|
||||
gimp_main (const GimpPlugInInfo *info,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
gchar *basename;
|
||||
const gchar *env_string;
|
||||
|
@ -213,8 +199,6 @@ gimp_main (int argc,
|
|||
#ifdef G_OS_WIN32
|
||||
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
|
||||
* by buggy NT C runtime, or something. I don't know why this happens
|
||||
* on NT (including w2k), but not on w95/98.
|
||||
|
@ -223,31 +207,43 @@ gimp_main (int argc,
|
|||
for (i = 1; i < argc; 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]);
|
||||
for (j = 1; j <= i; j++)
|
||||
{
|
||||
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;
|
||||
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]);
|
||||
|
||||
for (j = 1; j <= i; j++)
|
||||
{
|
||||
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
|
||||
|
||||
g_assert (info != NULL);
|
||||
|
||||
PLUG_IN_INFO = *info;
|
||||
|
||||
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]);
|
||||
|
@ -408,6 +404,9 @@ gimp_main (int argc,
|
|||
static void
|
||||
gimp_close (void)
|
||||
{
|
||||
if (gimp_debug_flags & GIMP_DEBUG_QUIT)
|
||||
gimp_debug_stop ();
|
||||
|
||||
if (PLUG_IN_INFO.quit_proc)
|
||||
(* PLUG_IN_INFO.quit_proc) ();
|
||||
|
||||
|
|
|
@ -163,8 +163,6 @@ struct _GimpParam
|
|||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
|
||||
|
||||
/* 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
|
||||
* application.
|
||||
|
@ -175,54 +173,38 @@ void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
|
|||
# endif
|
||||
# endif
|
||||
|
||||
# define MAIN() \
|
||||
static int \
|
||||
win32_gimp_main (int argc, char **argv) \
|
||||
{ \
|
||||
set_gimp_PLUG_IN_INFO_PTR(&PLUG_IN_INFO); \
|
||||
return gimp_main (argc, argv); \
|
||||
} \
|
||||
\
|
||||
struct HINSTANCE__; \
|
||||
int _stdcall \
|
||||
WinMain (struct HINSTANCE__ *hInstance, \
|
||||
struct HINSTANCE__ *hPrevInstance, \
|
||||
char *lpszCmdLine, \
|
||||
int nCmdShow) \
|
||||
{ \
|
||||
return win32_gimp_main (__argc, __argv); \
|
||||
} \
|
||||
\
|
||||
int \
|
||||
main (int argc, char *argv[]) \
|
||||
{ \
|
||||
return win32_gimp_main (argc, argv); \
|
||||
# define MAIN() \
|
||||
struct HINSTANCE__; \
|
||||
int _stdcall \
|
||||
WinMain (struct HINSTANCE__ *hInstance, \
|
||||
struct HINSTANCE__ *hPrevInstance, \
|
||||
char *lpszCmdLine, \
|
||||
int nCmdShow) \
|
||||
{ \
|
||||
return gimp_main (&PLUG_IN_INFO, __argc, __argv); \
|
||||
} \
|
||||
\
|
||||
int \
|
||||
main (int argc, char *argv[]) \
|
||||
{ \
|
||||
return gimp_main (&PLUG_IN_INFO, argc, argv); \
|
||||
}
|
||||
#else
|
||||
#ifndef __EMX__
|
||||
# define MAIN() \
|
||||
int \
|
||||
main (int argc, char *argv[]) \
|
||||
{ \
|
||||
return gimp_main (argc, argv); \
|
||||
# define MAIN() \
|
||||
int \
|
||||
main (int argc, char *argv[]) \
|
||||
{ \
|
||||
return gimp_main (&PLUG_IN_INFO, 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
|
||||
|
||||
|
||||
/* The main procedure that should be called with the
|
||||
* 'argc' and 'argv' that are passed to "main".
|
||||
/* The main procedure that should be called with the PLUG_IN_INFO structure
|
||||
* and the 'argc' and 'argv' that are passed to "main".
|
||||
*/
|
||||
gint gimp_main (gint argc,
|
||||
gchar *argv[]);
|
||||
gint gimp_main (const GimpPlugInInfo *info,
|
||||
gint argc,
|
||||
gchar *argv[]);
|
||||
|
||||
/* Forcefully causes the gimp library to exit and
|
||||
* 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;
|
||||
* passed around as user data. */
|
||||
struct mnglib_userdata_t
|
||||
|
@ -1536,3 +1535,5 @@ GimpPlugInInfo PLUG_IN_INFO =
|
|||
query,
|
||||
run
|
||||
};
|
||||
|
||||
MAIN ()
|
||||
|
|
|
@ -543,15 +543,8 @@ MAIN()
|
|||
#else
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc != 2) {
|
||||
|
||||
/* Is this needed anymore? */
|
||||
#ifdef __EMX__
|
||||
set_gimp_PLUG_IN_INFO(&PLUG_IN_INFO);
|
||||
#endif
|
||||
|
||||
return gimp_main(argc, argv);
|
||||
}
|
||||
if (argc != 2)
|
||||
return gimp_main (&PLUG_IN_INFO, argc, argv);
|
||||
|
||||
standalone = argv[1];
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "pygimp.h"
|
||||
#include <sysmodule.h>
|
||||
#include <structmember.h>
|
||||
|
||||
/* maximum bits per pixel ... */
|
||||
#define MAX_BPP 4
|
||||
|
@ -190,14 +189,7 @@ pygimp_main(PyObject *self, PyObject *args)
|
|||
for (i = 0; i < argc; i++)
|
||||
argv[i] = g_strdup(PyString_AsString(PyList_GetItem(av, i)));
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
extern void set_gimp_PLUG_IN_INFO_PTR(GimpPlugInInfo *);
|
||||
set_gimp_PLUG_IN_INFO_PTR(&PLUG_IN_INFO);
|
||||
}
|
||||
#endif
|
||||
|
||||
gimp_main(argc, argv);
|
||||
gimp_main(&PLUG_IN_INFO, argc, argv);
|
||||
|
||||
if (argv != NULL) {
|
||||
for (i = 0; i < argc; i++)
|
||||
|
@ -213,12 +205,22 @@ pygimp_main(PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
pygimp_quit(PyObject *self)
|
||||
{
|
||||
|
||||
gimp_quit();
|
||||
Py_INCREF(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 *
|
||||
pygimp_set_data(PyObject *self, PyObject *args)
|
||||
{
|
||||
|
@ -804,6 +806,7 @@ id2display(PyObject *self, PyObject *args)
|
|||
static struct PyMethodDef gimp_methods[] = {
|
||||
{"main", (PyCFunction)pygimp_main, METH_VARARGS},
|
||||
{"quit", (PyCFunction)pygimp_quit, METH_NOARGS},
|
||||
{"message", (PyCFunction)pygimp_message, METH_VARARGS},
|
||||
{"set_data", (PyCFunction)pygimp_set_data, METH_VARARGS},
|
||||
{"get_data", (PyCFunction)pygimp_get_data, METH_VARARGS},
|
||||
{"progress_init", (PyCFunction)pygimp_progress_init, METH_VARARGS},
|
||||
|
|
Loading…
Reference in New Issue