home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / modules / gimpmodregister.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-06  |  3.1 KB  |  128 lines

  1. /*
  2.  * This program is free software; you can redistribute it and/or modify
  3.  * it under the terms of the GNU General Public License as published by
  4.  * the Free Software Foundation; either version 2 of the License, or
  5.  * (at your option) any later version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful,
  8.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  * GNU General Public License for more details.
  11.  *
  12.  * You should have received a copy of the GNU General Public License
  13.  * along with this program; if not, write to the Free Software
  14.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15.  *
  16.  *
  17.  */
  18. #ifdef __EMX__
  19.  
  20. #include "config.h"
  21.  
  22. #include <stdio.h>
  23. #include <gtk/gtk.h>
  24. #include <gdk/gdk.h>
  25. #include <libgimp/gimpmodule.h>
  26. #include <math.h>
  27. #include "gimpmodregister.h"
  28.  
  29. struct main_funcs_struc *gimp_main_funcs = NULL;
  30.  
  31. gpointer get_main_func(gchar *name)
  32. {
  33.   struct main_funcs_struc *x;
  34.   if (gimp_main_funcs == NULL)
  35.     return NULL;
  36.   for (x = gimp_main_funcs; x->name; x++)
  37.   {
  38.     if (!strcmp(x->name, name))
  39.       return (gpointer) x->func;
  40.   }
  41. }
  42.  
  43. GimpColorSelectorID
  44. mod_color_selector_register (const char *name,
  45.                  const char *help_page,
  46.                  GimpColorSelectorMethods *methods)
  47. {
  48.     GimpColorSelectorID id;
  49.     color_reg_func reg_func;
  50.     
  51.     reg_func = (color_reg_func) get_main_func("gimp_color_selector_register");
  52.     if (!reg_func)
  53.     return 0;
  54.     id = (*reg_func) (name, help_page, methods);
  55.     return (id);
  56. }
  57.  
  58. G_MODULE_EXPORT gboolean
  59. mod_color_display_register (const char              *name,
  60.                      GimpColorDisplayMethods *methods)
  61. {
  62.     gboolean  retval;
  63.     display_reg_func reg_func;
  64.     
  65.     reg_func = (display_reg_func) get_main_func("gimp_color_display_register");
  66.     if (!reg_func)
  67.     return 0;
  68.     retval = (*reg_func) (name, methods);
  69.     return (retval);
  70.  
  71. }
  72.  
  73. gboolean
  74. mod_color_selector_unregister (GimpColorSelectorID id,
  75.                    void (*callback)(void *data),
  76.                    void *data)
  77. {
  78.     color_unreg_func unreg_func;
  79.     gboolean status;
  80.     
  81.     unreg_func = (color_unreg_func) get_main_func("gimp_color_selector_unregister");
  82.     if (unreg_func)
  83.     {
  84.     status = (*unreg_func) (id, callback, data);
  85.     }
  86.     else
  87.     status = FALSE;
  88.     return (status);
  89. }
  90.  
  91. G_MODULE_EXPORT gboolean
  92. mod_color_display_unregister (const char *name)
  93. {
  94.     display_unreg_func unreg_func;
  95.     gboolean status;
  96.     
  97.     unreg_func = (display_unreg_func) get_main_func("gimp_color_display_unregister");
  98.     if (unreg_func)
  99.     {
  100.     status = (*unreg_func) (name);
  101.     }
  102.     else
  103.     status = FALSE;
  104.     return (status);
  105. }
  106.  
  107. void mod_dialog_register (GtkWidget *dialog)
  108. {
  109.     dialog_reg_func reg_func;
  110.     
  111.     reg_func = (dialog_reg_func) get_main_func("dialog_register");
  112.     if (!reg_func)
  113.     return;
  114.     (*reg_func) (dialog);
  115. }
  116.  
  117. void mod_dialog_unregister (GtkWidget *dialog)
  118. {
  119.     dialog_reg_func reg_func;
  120.     
  121.     reg_func = (dialog_reg_func) get_main_func("dialog_unregister");
  122.     if (!reg_func)
  123.     return;
  124.     (*reg_func) (dialog);
  125. }
  126.  
  127. #endif
  128.