gimprc_cmds.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /* The GIMP -- an image manipulation program
  2. * Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. /* NOTE: This file is autogenerated by pdbgen.pl. */
  19. #include "config.h"
  20. #include "procedural_db.h"
  21. #include "gimprc.h"
  22. static ProcRecord gimprc_query_proc;
  23. static ProcRecord gimprc_set_proc;
  24. static ProcRecord get_monitor_resolution_proc;
  25. void
  26. register_gimprc_procs (void)
  27. {
  28. procedural_db_register (&gimprc_query_proc);
  29. procedural_db_register (&gimprc_set_proc);
  30. procedural_db_register (&get_monitor_resolution_proc);
  31. }
  32. static Argument *
  33. gimprc_query_invoker (Argument *args)
  34. {
  35. gboolean success = TRUE;
  36. Argument *return_args;
  37. gchar *token;
  38. gchar *value = NULL;
  39. token = (gchar *) args[0].value.pdb_pointer;
  40. if (token == NULL)
  41. success = FALSE;
  42. if (success)
  43. {
  44. success = (value = gimprc_find_token (token)) != NULL;
  45. if (!success) /* custom ones failed, try the standard ones */
  46. success = (value = gimprc_value_to_str(token)) != NULL;
  47. }
  48. return_args = procedural_db_return_args (&gimprc_query_proc, success);
  49. if (success)
  50. return_args[1].value.pdb_pointer = g_strdup (value);
  51. return return_args;
  52. }
  53. static ProcArg gimprc_query_inargs[] =
  54. {
  55. {
  56. PDB_STRING,
  57. "token",
  58. "The token to query for"
  59. }
  60. };
  61. static ProcArg gimprc_query_outargs[] =
  62. {
  63. {
  64. PDB_STRING,
  65. "value",
  66. "The value associated with the queried token"
  67. }
  68. };
  69. static ProcRecord gimprc_query_proc =
  70. {
  71. "gimp_gimprc_query",
  72. "Queries the gimprc file parser for information on a specified token.",
  73. "This procedure is used to locate additional information contained in the gimprc file considered extraneous to the operation of the GIMP. Plug-ins that need configuration information can expect it will be stored in the user gimprc file and can use this procedure to retrieve it. This query procedure will return the value associated with the specified token. This corresponds _only_ to entries with the format: (<token> <value>). The value must be a string. Entries not corresponding to this format will cause warnings to be issued on gimprc parsing a nd will not be queryable.",
  74. "Spencer Kimball & Peter Mattis",
  75. "Spencer Kimball & Peter Mattis",
  76. "1997",
  77. PDB_INTERNAL,
  78. 1,
  79. gimprc_query_inargs,
  80. 1,
  81. gimprc_query_outargs,
  82. { { gimprc_query_invoker } }
  83. };
  84. static Argument *
  85. gimprc_set_invoker (Argument *args)
  86. {
  87. gboolean success = TRUE;
  88. gchar *token;
  89. gchar *value;
  90. token = (gchar *) args[0].value.pdb_pointer;
  91. if (token == NULL)
  92. success = FALSE;
  93. value = (gchar *) args[1].value.pdb_pointer;
  94. if (value == NULL)
  95. success = FALSE;
  96. if (success)
  97. save_gimprc_strings(token, value);
  98. return procedural_db_return_args (&gimprc_set_proc, success);
  99. }
  100. static ProcArg gimprc_set_inargs[] =
  101. {
  102. {
  103. PDB_STRING,
  104. "token",
  105. "The token to modify"
  106. },
  107. {
  108. PDB_STRING,
  109. "value",
  110. "The value to set the token to"
  111. }
  112. };
  113. static ProcRecord gimprc_set_proc =
  114. {
  115. "gimp_gimprc_set",
  116. "Sets a gimprc token to a value and saves it in the gimprc.",
  117. "This procedure is used to add or change additional information in the gimprc file that is considered extraneous to the operation of the GIMP. Plug-ins that need configuration information can use this function to store it, and gimp_gimprc_query to retrieve it. This will accept _only_ parameters in the format of (<token> <value>), where <token> and <value> must be strings. Entries not corresponding to this format will be eaten and no action will be performed. If the gimprc can not be written for whatever reason, gimp will complain loudly and the old gimprc will be saved in gimprc.old.",
  118. "Seth Burgess",
  119. "Seth Burgess",
  120. "1999",
  121. PDB_INTERNAL,
  122. 2,
  123. gimprc_set_inargs,
  124. 0,
  125. NULL,
  126. { { gimprc_set_invoker } }
  127. };
  128. static Argument *
  129. get_monitor_resolution_invoker (Argument *args)
  130. {
  131. gboolean success = TRUE;
  132. Argument *return_args;
  133. gdouble xres;
  134. gdouble yres;
  135. xres = monitor_xres;
  136. yres = monitor_yres;
  137. success = TRUE;
  138. return_args = procedural_db_return_args (&get_monitor_resolution_proc, success);
  139. if (success)
  140. {
  141. return_args[1].value.pdb_float = xres;
  142. return_args[2].value.pdb_float = yres;
  143. }
  144. return return_args;
  145. }
  146. static ProcArg get_monitor_resolution_outargs[] =
  147. {
  148. {
  149. PDB_FLOAT,
  150. "xres",
  151. "X resolution"
  152. },
  153. {
  154. PDB_FLOAT,
  155. "yres",
  156. "Y resolution"
  157. }
  158. };
  159. static ProcRecord get_monitor_resolution_proc =
  160. {
  161. "gimp_get_monitor_resolution",
  162. "Get the monitor resolution as specified in the Preferences.",
  163. "Returns the resolution of the monitor in pixels/inch. This value is taken from the Preferences (or the X-Server if this is set in the Preferences) and there's no guarantee for the value to be reasonable.",
  164. "Spencer Kimball & Peter Mattis",
  165. "Spencer Kimball & Peter Mattis",
  166. "1995-1996",
  167. PDB_INTERNAL,
  168. 0,
  169. NULL,
  170. 2,
  171. get_monitor_resolution_outargs,
  172. { { get_monitor_resolution_invoker } }
  173. };