libgimpprint API Reference: include/gimp-print/vars.h Source File

Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

# include/gimp-print/vars.h

Go to the documentation of this file.

    00001 /*
    00002  * "$id: vars.h,v 1.3.4.4 2004/03/09 03:00:25 rlk Exp $"
    00003  *
    00004  *   libgimpprint stp_vars_t core functions.
    00005  *
    00006  *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
    00007  *      Robert Krawitz (rlk@alum.mit.edu)
    00008  *
    00009  *   This program is free software; you can redistribute it and/or modify it
    00010  *   under the terms of the GNU General Public License as published by the Free
    00011  *   Software Foundation; either version 2 of the License, or (at your option)
    00012  *   any later version.
    00013  *
    00014  *   This program is distributed in the hope that it will be useful, but
    00015  *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    00016  *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    00017  *   for more details.
    00018  *
    00019  *   You should have received a copy of the GNU General Public License
    00020  *   along with this program; if not, write to the Free Software
    00021  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00022  */
    00023
    00029 #ifndef GIMP_PRINT_VARS_H
    00030 #define GIMP_PRINT_VARS_H
    00031
    00032 #include <gimp-print/array.h>
    00033 #include <gimp-print/curve.h>
    00034 #include <gimp-print/string-list.h>
    00035
    00036 #ifdef __cplusplus
    00037 extern "C" {
    00038 #endif
    00039
    00055 struct stp_vars;
    00057 typedef struct stp_vars stp_vars_t;
    00058
    00064 typedef enum
    00065 {
    00066   STP_PARAMETER_TYPE_STRING_LIST,
    00067   STP_PARAMETER_TYPE_INT,
    00068   STP_PARAMETER_TYPE_BOOLEAN,
    00069   STP_PARAMETER_TYPE_DOUBLE,
    00070   STP_PARAMETER_TYPE_CURVE,
    00071   STP_PARAMETER_TYPE_FILE,
    00072   STP_PARAMETER_TYPE_RAW,
    00073   STP_PARAMETER_TYPE_ARRAY,
    00074   STP_PARAMETER_TYPE_DIMENSION,
    00075   STP_PARAMETER_TYPE_INVALID
    00076 } stp_parameter_type_t;
    00077
    00083 typedef enum
    00084 {
    00085   STP_PARAMETER_CLASS_FEATURE,
    00086   STP_PARAMETER_CLASS_OUTPUT,
    00087   STP_PARAMETER_CLASS_CORE,
    00088   STP_PARAMETER_CLASS_INVALID
    00089 } stp_parameter_class_t;
    00090
    00095 typedef enum
    00096 {
    00097   STP_PARAMETER_LEVEL_BASIC,
    00098   STP_PARAMETER_LEVEL_ADVANCED,
    00099   STP_PARAMETER_LEVEL_ADVANCED1,
    00100   STP_PARAMETER_LEVEL_ADVANCED2,
    00101   STP_PARAMETER_LEVEL_ADVANCED3,
    00102   STP_PARAMETER_LEVEL_ADVANCED4,
    00103   STP_PARAMETER_LEVEL_INTERNAL,
    00104   STP_PARAMETER_LEVEL_EXTERNAL,
    00105   STP_PARAMETER_LEVEL_INVALID
    00106 } stp_parameter_level_t;
    00107
    00114 typedef enum
    00115 {
    00116   STP_PARAMETER_INACTIVE,
    00117   STP_PARAMETER_DEFAULTED,
    00118   STP_PARAMETER_ACTIVE
    00119 } stp_parameter_activity_t;
    00120
    00121 /*
    00122  * Other parameter types
    00123  */
    00124
    00126 typedef struct
    00127 {
    00128   size_t bytes;
    00129   const void *data;
    00130 } stp_raw_t;
    00131
    00133 typedef struct
    00134 {
    00135   double lower;
    00136   double upper;
    00137 } stp_double_bound_t;
    00138
    00140 typedef struct
    00141 {
    00142   int lower;
    00143   int upper;
    00144 } stp_int_bound_t;
    00145
    00147 typedef struct
    00148 {
    00149   const char *name;
    00150   const char *text;
    00151   const char *category;
    00152   const char *help;
    00153   stp_parameter_type_t p_type;
    00154   stp_parameter_class_t p_class;
    00155   stp_parameter_level_t p_level;
    00156   unsigned char is_mandatory;
    00157   unsigned char is_active;
    00158   unsigned char channel;
    00159   unsigned char verify_this_parameter;
    00160   unsigned char read_only;
    00161   union
    00162   {
    00163     stp_curve_t *curve;
    00164     stp_double_bound_t dbl;
    00165     stp_int_bound_t integer;
    00166     stp_int_bound_t dimension;
    00167     stp_string_list_t *str;
    00168     stp_array_t *array;
    00169   } bounds;
    00170   union
    00171   {
    00172     stp_curve_t *curve;
    00173     double dbl;
    00174     int dimension;
    00175     int integer;
    00176     int boolean;
    00177     const char *str;
    00178     stp_array_t *array;
    00179   } deflt;
    00180 } stp_parameter_t;
    00181
    00183 typedef void *stp_parameter_list_t;
    00185 typedef const void *stp_const_parameter_list_t;
    00186
    00196 typedef void (*stp_outfunc_t) (void *data, const char *buffer, size_t bytes);
    00197
    00198
    00199 /****************************************************************
    00200 *                                                               *
    00201 * BASIC PRINTER SETTINGS                                        *
    00202 *                                                               *
    00203 ****************************************************************/
    00204
    00209 extern stp_vars_t *stp_vars_create(void);
    00210
    00218 extern void stp_vars_copy(stp_vars_t *dest, const stp_vars_t *source);
    00219
    00227 extern stp_vars_t *stp_vars_create_copy(const stp_vars_t *source);
    00228
    00234 extern void stp_vars_destroy(stp_vars_t *v);
    00235
    00241 extern void stp_set_driver(stp_vars_t *v, const char *val);
    00242
    00249 extern void stp_set_driver_n(stp_vars_t *v, const char *val, int bytes);
    00250
    00255 extern const char *stp_get_driver(const stp_vars_t *v);
    00256
    00262 extern void stp_set_color_conversion(stp_vars_t *v, const char *val);
    00263
    00270 extern void stp_set_color_conversion_n(stp_vars_t *v, const char *val, int bytes);
    00271
    00276 extern const char *stp_get_color_conversion(const stp_vars_t *v);
    00277
    00278 /*
    00279  * Set/get the position and size of the image
    00280  */
    00281
    00287 extern void stp_set_left(stp_vars_t *v, int val);
    00288
    00293 extern int stp_get_left(const stp_vars_t *v);
    00294
    00300 extern void stp_set_top(stp_vars_t *v, int val);
    00301
    00306 extern int stp_get_top(const stp_vars_t *v);
    00307
    00313 extern void stp_set_width(stp_vars_t *v, int val);
    00314
    00319 extern int stp_get_width(const stp_vars_t *v);
    00320
    00326 extern void stp_set_height(stp_vars_t *v, int val);
    00327
    00332 extern int stp_get_height(const stp_vars_t *v);
    00333
    00334 /*
    00335  * For custom page widths, these functions may be used.
    00336  */
    00337
    00343 extern void stp_set_page_width(stp_vars_t *v, int val);
    00344
    00349 extern int stp_get_page_width(const stp_vars_t *v);
    00350
    00356 extern void stp_set_page_height(stp_vars_t *v, int val);
    00357
    00362 extern int stp_get_page_height(const stp_vars_t *v);
    00363
    00371 extern void stp_set_outfunc(stp_vars_t *v, stp_outfunc_t val);
    00372
    00378 extern stp_outfunc_t stp_get_outfunc(const stp_vars_t *v);
    00379
    00387 extern void stp_set_errfunc(stp_vars_t *v, stp_outfunc_t val);
    00388
    00394 extern stp_outfunc_t stp_get_errfunc(const stp_vars_t *v);
    00395
    00403 extern void stp_set_outdata(stp_vars_t *v, void *val);
    00404
    00410 extern void *stp_get_outdata(const stp_vars_t *v);
    00411
    00419 extern void stp_set_errdata(stp_vars_t *v, void *val);
    00420
    00426 extern void *stp_get_errdata(const stp_vars_t *v);
    00427
    00434 extern void stp_merge_printvars(stp_vars_t *user, const stp_vars_t *print);
    00435
    00436
    00437 /****************************************************************
    00438 *                                                               *
    00439 * PARAMETER MANAGEMENT                                          *
    00440 *                                                               *
    00441 ****************************************************************/
    00442
    00452 extern stp_parameter_list_t stp_get_parameter_list(const stp_vars_t *v);
    00453
    00460 extern size_t stp_parameter_list_count(stp_const_parameter_list_t list);
    00461
    00469 extern const stp_parameter_t *
    00470 stp_parameter_find(stp_const_parameter_list_t list, const char *name);
    00471
    00480 extern const stp_parameter_t *
    00481 stp_parameter_list_param(stp_const_parameter_list_t list, size_t item);
    00482
    00488 extern void stp_parameter_list_destroy(stp_parameter_list_t list);
    00489
    00494 extern stp_parameter_list_t stp_parameter_list_create(void);
    00495
    00501 extern void stp_parameter_list_add_param(stp_parameter_list_t list,
    00502                                          const stp_parameter_t *item);
    00503
    00512 extern stp_parameter_list_t
    00513 stp_parameter_list_copy(stp_const_parameter_list_t list);
    00514
    00521 extern void
    00522 stp_parameter_list_append(stp_parameter_list_t list,
    00523                           stp_const_parameter_list_t append);
    00524
    00533 extern void
    00534 stp_describe_parameter(const stp_vars_t *v, const char *name,
    00535                        stp_parameter_t *description);
    00536
    00543 extern void stp_parameter_description_destroy(stp_parameter_t *description);
    00544
    00552 extern const stp_parameter_t *
    00553 stp_parameter_find_in_settings(const stp_vars_t *v, const char *name);
    00554
    00561 extern void stp_set_string_parameter(stp_vars_t *v, const char *parameter,
    00562                                      const char *value);
    00563
    00571 extern void stp_set_string_parameter_n(stp_vars_t *v, const char *parameter,
    00572                                        const char *value, size_t bytes);
    00573
    00580 extern void stp_set_file_parameter(stp_vars_t *v, const char *parameter,
    00581                                    const char *value);
    00582
    00590 extern void stp_set_file_parameter_n(stp_vars_t *v, const char *parameter,
    00591                                      const char *value, size_t bytes);
    00592
    00599 extern void stp_set_float_parameter(stp_vars_t *v, const char *parameter,
    00600                                     double value);
    00601
    00608 extern void stp_set_int_parameter(stp_vars_t *v, const char *parameter,
    00609                                   int value);
    00610
    00617 extern void stp_set_dimension_parameter(stp_vars_t *v, const char *parameter,
    00618                                         int value);
    00619
    00626 extern void stp_set_boolean_parameter(stp_vars_t *v, const char *parameter,
    00627                                       int value);
    00628
    00635 extern void stp_set_curve_parameter(stp_vars_t *v, const char *parameter,
    00636                                     const stp_curve_t *value);
    00637
    00644 extern void stp_set_array_parameter(stp_vars_t *v, const char *parameter,
    00645                                     const stp_array_t *value);
    00646
    00654 extern void stp_set_raw_parameter(stp_vars_t *v, const char *parameter,
    00655                                   const void *value, size_t bytes);
    00656
    00663 extern void stp_scale_float_parameter(stp_vars_t *v, const char *parameter,
    00664                                       double scale);
    00665
    00675 extern void stp_set_default_string_parameter(stp_vars_t *v,
    00676                                              const char *parameter,
    00677                                              const char *value);
    00678
    00689 extern void stp_set_default_string_parameter_n(stp_vars_t *v,
    00690                                                const char *parameter,
    00691                                                const char *value, size_t bytes);
    00692
    00702 extern void stp_set_default_file_parameter(stp_vars_t *v,
    00703                                            const char *parameter,
    00704                                            const char *value);
    00705
    00716 extern void stp_set_default_file_parameter_n(stp_vars_t *v,
    00717                                              const char *parameter,
    00718                                              const char *value, size_t bytes);
    00719
    00729 extern void stp_set_default_float_parameter(stp_vars_t *v,
    00730                                             const char *parameter,
    00731                                             double value);
    00732
    00742 extern void stp_set_default_int_parameter(stp_vars_t *v,
    00743                                           const char *parameter,
    00744                                           int value);
    00745
    00755 extern void stp_set_default_dimension_parameter(stp_vars_t *v,
    00756                                                 const char *parameter,
    00757                                                 int value);
    00758
    00768 extern void stp_set_default_boolean_parameter(stp_vars_t *v,
    00769                                               const char *parameter,
    00770                                               int value);
    00771
    00781 extern void stp_set_default_curve_parameter(stp_vars_t *v,
    00782                                             const char *parameter,
    00783                                             const stp_curve_t *value);
    00784
    00794 extern void stp_set_default_array_parameter(stp_vars_t *v,
    00795                                             const char *parameter,
    00796                                             const stp_array_t *value);
    00797
    00808 extern void stp_set_default_raw_parameter(stp_vars_t *v,
    00809                                           const char *parameter,
    00810                                           const void *value, size_t bytes);
    00811
    00818 extern const char *stp_get_string_parameter(const stp_vars_t *v,
    00819                                             const char *parameter);
    00820
    00827 extern const char *stp_get_file_parameter(const stp_vars_t *v,
    00828                                           const char *parameter);
    00829
    00836 extern double stp_get_float_parameter(const stp_vars_t *v,
    00837                                             const char *parameter);
    00838
    00845 extern int stp_get_int_parameter(const stp_vars_t *v,
    00846                                  const char *parameter);
    00847
    00854 extern int stp_get_dimension_parameter(const stp_vars_t *v,
    00855                                        const char *parameter);
    00856
    00863 extern int stp_get_boolean_parameter(const stp_vars_t *v,
    00864                                      const char *parameter);
    00865
    00872 extern const stp_curve_t *stp_get_curve_parameter(const stp_vars_t *v,
    00873                                                   const char *parameter);
    00874
    00881 extern const stp_array_t *stp_get_array_parameter(const stp_vars_t *v,
    00882                                                   const char *parameter);
    00883
    00890 extern const stp_raw_t *stp_get_raw_parameter(const stp_vars_t *v,
    00891                                               const char *parameter);
    00892
    00899 extern void stp_clear_string_parameter(stp_vars_t *v, const char *parameter);
    00900
    00907 extern void stp_clear_file_parameter(stp_vars_t *v, const char *parameter);
    00908
    00914 extern void stp_clear_float_parameter(stp_vars_t *v, const char *parameter);
    00915
    00921 extern void stp_clear_int_parameter(stp_vars_t *v, const char *parameter);
    00922
    00928 extern void stp_clear_dimension_parameter(stp_vars_t *v, const char *parameter);
    00929
    00935 extern void stp_clear_boolean_parameter(stp_vars_t *v, const char *parameter);
    00936
    00943 extern void stp_clear_curve_parameter(stp_vars_t *v, const char *parameter);
    00944
    00951 extern void stp_clear_array_parameter(stp_vars_t *v, const char *parameter);
    00952
    00959 extern void stp_clear_raw_parameter(stp_vars_t *v, const char *parameter);
    00960
    00968 extern void stp_set_string_parameter_active(const stp_vars_t *v,
    00969                                             const char *parameter,
    00970                                             stp_parameter_activity_t active);
    00971
    00979 extern void stp_set_file_parameter_active(const stp_vars_t *v,
    00980                                           const char *parameter,
    00981                                           stp_parameter_activity_t active);
    00982
    00990 extern void stp_set_float_parameter_active(const stp_vars_t *v,
    00991                                          const char *parameter,
    00992                                          stp_parameter_activity_t active);
    00993
    01001 extern void stp_set_int_parameter_active(const stp_vars_t *v,
    01002                                          const char *parameter,
    01003                                          stp_parameter_activity_t active);
    01004
    01012 extern void stp_set_dimension_parameter_active(const stp_vars_t *v,
    01013                                                const char *parameter,
    01014                                                stp_parameter_activity_t active);
    01015
    01023 extern void stp_set_boolean_parameter_active(const stp_vars_t *v,
    01024                                              const char *parameter,
    01025                                              stp_parameter_activity_t active);
    01026
    01034 extern void stp_set_curve_parameter_active(const stp_vars_t *v,
    01035                                            const char *parameter,
    01036                                            stp_parameter_activity_t active);
    01037
    01045 extern void stp_set_array_parameter_active(const stp_vars_t *v,
    01046                                            const char *parameter,
    01047                                            stp_parameter_activity_t active);
    01048
    01056 extern void stp_set_raw_parameter_active(const stp_vars_t *v,
    01057                                          const char *parameter,
    01058                                          stp_parameter_activity_t active);
    01059
    01066 extern int stp_check_string_parameter(const stp_vars_t *v, const char *parameter,
    01067                                       stp_parameter_activity_t active);
    01068
    01075 extern int stp_check_file_parameter(const stp_vars_t *v, const char *parameter,
    01076                                     stp_parameter_activity_t active);
    01077
    01084 extern int stp_check_float_parameter(const stp_vars_t *v, const char *parameter,
    01085                                      stp_parameter_activity_t active);
    01086
    01093 extern int stp_check_int_parameter(const stp_vars_t *v, const char *parameter,
    01094                                    stp_parameter_activity_t active);
    01095
    01102 extern int stp_check_dimension_parameter(const stp_vars_t *v, const char *parameter,
    01103                                          stp_parameter_activity_t active);
    01104
    01111 extern int stp_check_boolean_parameter(const stp_vars_t *v, const char *parameter,
    01112                                        stp_parameter_activity_t active);
    01113
    01120 extern int stp_check_curve_parameter(const stp_vars_t *v, const char *parameter,
    01121                                      stp_parameter_activity_t active);
    01122
    01129 extern int stp_check_array_parameter(const stp_vars_t *v, const char *parameter,
    01130                                      stp_parameter_activity_t active);
    01131
    01138 extern int stp_check_raw_parameter(const stp_vars_t *v, const char *parameter,
    01139                                    stp_parameter_activity_t active);
    01140
    01147 extern stp_parameter_activity_t
    01148 stp_get_string_parameter_active(const stp_vars_t *v, const char *parameter);
    01149
    01156 extern stp_parameter_activity_t
    01157 stp_get_file_parameter_active(const stp_vars_t *v, const char *parameter);
    01158
    01165 extern stp_parameter_activity_t
    01166 stp_get_float_parameter_active(const stp_vars_t *v, const char *parameter);
    01167
    01174 extern stp_parameter_activity_t
    01175 stp_get_int_parameter_active(const stp_vars_t *v, const char *parameter);
    01176
    01183 extern stp_parameter_activity_t
    01184 stp_get_dimension_parameter_active(const stp_vars_t *v, const char *parameter);
    01185
    01192 extern stp_parameter_activity_t
    01193 stp_get_boolean_parameter_active(const stp_vars_t *v, const char *parameter);
    01194
    01201 extern stp_parameter_activity_t
    01202 stp_get_curve_parameter_active(const stp_vars_t *v, const char *parameter);
    01203
    01210 extern stp_parameter_activity_t
    01211 stp_get_array_parameter_active(const stp_vars_t *v, const char *parameter);
    01212
    01219 extern stp_parameter_activity_t
    01220 stp_get_raw_parameter_active(const stp_vars_t *v, const char *parameter);
    01221
    01222
    01223
    01224 /****************************************************************
    01225 *                                                               *
    01226 * INFORMATIONAL QUERIES                                         *
    01227 *                                                               *
    01228 ****************************************************************/
    01229
    01242 extern void stp_get_media_size(const stp_vars_t *v, int *width, int *height);
    01243
    01267 extern void stp_get_imageable_area(const stp_vars_t *v, int *left, int *right,
    01268                                    int *bottom, int *top);
    01269
    01280 extern void
    01281 stp_get_size_limit(const stp_vars_t *v, int *max_width, int *max_height,
    01282                    int *min_width, int *min_height);
    01283
    01284
    01292 extern void stp_describe_resolution(const stp_vars_t *v, int *x, int *y);
    01293
    01302 extern int stp_verify(stp_vars_t *v);
    01303
    01312 extern const stp_vars_t *stp_default_settings(void);
    01313
    01314 typedef void *(*stp_copy_data_func_t)(void *);
    01315 typedef void (*stp_free_data_func_t)(void *);
    01316
    01317 typedef enum
    01318 {
    01319   PARAMETER_BAD,
    01320   PARAMETER_OK,
    01321   PARAMETER_INACTIVE
    01322 } stp_parameter_verify_t;
    01323
    01324 extern void stp_allocate_component_data(stp_vars_t *v,
    01325                                         const char *name,
    01326                                         stp_copy_data_func_t copyfunc,
    01327                                         stp_free_data_func_t freefunc,
    01328                                         void *data);
    01329 extern void stp_destroy_component_data(stp_vars_t *v, const char *name);
    01330
    01331 struct stp_compdata;
    01332 typedef struct stp_compdata compdata_t;
    01333
    01334 extern void *stp_get_component_data(const stp_vars_t *v, const char *name);
    01335
    01336 extern stp_parameter_verify_t stp_verify_parameter(const stp_vars_t *v,
    01337                                                    const char *parameter,
    01338                                                    int quiet);
    01339 extern int stp_get_verified(const stp_vars_t *v);
    01340 extern void stp_set_verified(stp_vars_t *v, int value);
    01341
    01342 extern void stp_copy_options(stp_vars_t *vd, const stp_vars_t *vs);
    01343
    01344 extern void
    01345 stp_fill_parameter_settings(stp_parameter_t *desc,
    01346                             const stp_parameter_t *param);
    01347
    01350 #ifdef __cplusplus
    01351   }
    01352 #endif
    01353
    01354 #endif /* GIMP_PRINT_VARS_H */
    01355 /*
    01356  * End of "$Id: vars_8h-source.html,v 1.1.1.2 2004/12/22 23:49:22 jlovell Exp $".
    01357  */