00001
00007 #ifndef __SIMGUI_H_INCLUDED__
00008 #define __SIMGUI_H_INCLUDED__
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014
00015 void gui_start(void);
00016 void gui_set_config_file(const char *fname);
00017 void gui_set_init_file(const char *fname);
00018
00019
00020 void gui_strtrim(char *cstr,const char *fstr,int len);
00021 void gui_strfill(char *fstr,const char *cstr,int len);
00022
00023
00024 typedef void (*gui_runfn)(int);
00025 typedef void (*gui_cleanupfn)(void);
00026 typedef void (*gui_scanfn)(int);
00027 typedef void (*gui_plotfn)(void);
00028 typedef void (*gui_convfn)(int n,float *out,float *in1,float *in2,float *in3);
00029
00030 void gui_register_run_entry(gui_runfn fn,const char *name);
00031 void gui_register_runmenu_entry(gui_runfn fn,const char *name);
00032 void gui_register_run_background(gui_runfn fn,const char *name);
00033 void gui_register_run_cleanup(gui_cleanupfn fn,const char *name);
00034 void gui_set_autorun(const char *name,int forcedlgs);
00035 void gui_register_scanner(gui_scanfn fn,const char *name);
00036 void gui_register_datamenu_entry(gui_scanfn fn,const char *name);
00037 void gui_register_function(gui_convfn fn,int nargs,const char *name);
00038 void gui_register_plot(gui_plotfn fn,const char *name);
00039 void gui_register_commandplot(gui_plotfn fn,const char *name);
00040 void gui_debug_to_console(void);
00041 void gui_register_help_file(const char *title,const char *fname);
00042 void gui_register_help_text(const char *title,const char *htext,int txtln);
00043 #ifdef _MSC_VER
00044 void gui_register_winhelp_file(const char *title,const char *fname);
00045 #endif
00046 void gui_set_protection_mode(int mode);
00047
00048
00049 #define GUI_NO_MENU_APPEND "## - nomenu - ##"
00050
00051
00052 #define GUI_DEFAULT_PROTECTION 0
00053 #define GUI_DEVELOPER_PROTECTION 1
00054 #define GUI_END_USER_PROTECTION 2
00055
00056
00057 void gui_setup_database(const char *dbname,const char *xvname);
00058 void gui_clear_data(const char *name,const char *dbname);
00059 void gui_erase_data(const char *name,const char *dbname,int start,int count);
00060 void gui_insert_data(const char *name,const char *dbname,int start,const float *data,int count);
00061 void gui_replace_data(const char *name,const char *dbname,int start,const float *data,int count);
00062 void gui_append_data(const char *name,const char *dbname,const float *data,int count);
00063 void gui_read_data(const char *name,const char *dbname,int start,float *data,int count);
00064 int gui_data_size(const char *name,const char *dbname);
00065 void gui_clear_database(const char *dbname);
00066 void gui_erase_database(const char *dbname,int pts_to_remove);
00067 void gui_inherit_plots(const char *DBfrom,const char *DBto);
00068 void gui_remove_plots(const char *DBname);
00069 void gui_set_database_limits(const char *dbname,int maxlen,int maxplt);
00070 void gui_set_var_description(const char *name,const char *desc);
00071 void gui_set_dbase_description(const char *dbname,const char *desc);
00072 int gui_database_length_limit(const char *dbname);
00073 int gui_database_plot_limit(const char *dbname);
00074 const char *gui_var_description(const char *name);
00075 const char *gui_dbase_description(const char *name);
00076 const float *gui_get_data(const char *name,const char *dbname);
00077
00078
00079 void gui_update(void);
00080 void gui_update_plots(void);
00081 void gui_update_selected_plots(int dodata,int dosubr);
00082 void gui_plot_changed(const char *name);
00083 void gui_add_plot_data(const char *name,const float *data,int items);
00084 void gui_get_run_classification(char *name);
00085 void gui_set_run_classification(const char *name);
00086 void gui_runerror(const char *msg,...);
00087 void gui_runmessage(const char *msg,...);
00088 void gui_abort_run(void);
00089 void gui_stop_background(void);
00090 void gui_wait_for_event(int tout_msec);
00091
00092
00093 void gui_define_control(const char *name,double minval,double maxval,double initval);
00094 double gui_get_control_value(const char *name);
00095 void gui_set_control_value(const char *name,double value);
00096 void gui_set_control_limits(const char *name,double minval,double maxval);
00097 void gui_define_icontrol(const char *name,int minval,int maxval,int initval);
00098 int gui_get_icontrol_value(const char *name);
00099 void gui_set_icontrol_value(const char *name,int value);
00100 void gui_set_icontrol_limits(const char *name,int minval,int maxval);
00101 void gui_define_adjuster(const char *name,double add,double mult,double init);
00102 double gui_get_adjuster_value(const char *name);
00103 void gui_set_adjuster_value(const char *name,double value);
00104 void gui_set_adjuster_params(const char *name,double add,double mult);
00105 void gui_define_iadjuster(const char *name,int add,int mult,int init);
00106 int gui_get_iadjuster_value(const char *name);
00107 void gui_set_iadjuster_value(const char *name,int value);
00108 void gui_set_iadjuster_params(const char *name,int add,int mult);
00109 void gui_define_radio(const char *name,const char *buttons);
00110 int gui_get_radio_value(const char *name);
00111 void gui_set_radio_value(const char *name,int which);
00112 void gui_define_label(const char *name);
00113 const char *gui_get_label_value(const char *name);
00114 void gui_set_label_value(const char *name,char *text);
00115 void gui_define_button(const char *name);
00116 int gui_get_button_value(const char *name);
00117 void gui_set_button_value(const char *name,int depress);
00118 void gui_define_toggle(const char *name);
00119 int gui_get_toggle_value(const char *name);
00120 void gui_set_toggle_value(const char *name,int depress);
00121 int gui_show_control_group(const char *grpname,int visible);
00122
00123 #define GUI_RADIO_SEPARATOR "/-.-/"
00124 #define GUI_CONTROL_RADIO_SEPAR GUI_RADIO_SEPARATOR
00125 #define GUI_CONTROL_GROUP_SEPAR "::.::"
00126
00127
00128 void plot_open_curve_2d(void);
00129 void plot_add_curve_points_2d(int count,const float *xdata,const float *ydata);
00130 void plot_add_curve_separator_2d(void);
00131 void plot_set_curve_title_2d(const char *title);
00132 void plot_set_curve_style_2d(int style);
00133 void plot_set_curve_line_type_2d(int type);
00134 void plot_set_curve_point_type_2d(int type);
00135 void plot_close_curve_2d(void);
00136 int plot_window_index(void);
00137 char *gui_get_plot_info(void);
00138 void gui_set_plot_info(const char *info);
00139 void gui_plot_command(const char *cmd);
00140 void gui_plot_3d(const char *cmd,const char *key,int nx,int ny,int offset,float *x,float *y, float *z);
00141 void gui_plot_3d_p(const char *cmd,const char *key,int nx,int ny,float *x,float *y, float **z);
00142 int gui_get_current_page(void);
00143 void gui_set_current_page(int pg);
00144
00145
00146 #define PLOT_STYLE_DEFAULT 0
00147 #define PLOT_STYLE_LINES 1
00148 #define PLOT_STYLE_POINTS 2
00149 #define PLOT_STYLE_IMPULSES 3
00150 #define PLOT_STYLE_LINESPNTS 4
00151 #define PLOT_STYLE_DOTS 5
00152 #define PLOT_STYLE_ERRORBARS 6
00153 #define PLOT_STYLE_BOXES 7
00154 #define PLOT_STYLE_BOXERROR 8
00155 #define PLOT_STYLE_STEPS 9
00156
00157
00158 #define PLOT_PTYPE_DEFAULT (-1)
00159 #define PLOT_PTYPE_DIAMOND 0
00160 #define PLOT_PTYPE_PLUS 1
00161 #define PLOT_PTYPE_BOX 2
00162 #define PLOT_PTYPE_CROSS 3
00163 #define PLOT_PTYPE_TRIANGLE 4
00164 #define PLOT_PTYPE_STAR 5
00165
00166
00167 #define PLOT_LTYPE_BORDER (-2)
00168 #define PLOT_LTYPE_GRID (-1)
00169 #define PLOT_LTYPE_DEFAULT (-1)
00170 #define PLOT_LTYPE_GREEN 0
00171 #define PLOT_LTYPE_CYAN 1
00172 #define PLOT_LTYPE_RED 2
00173 #define PLOT_LTYPE_MAGENTA 3
00174 #define PLOT_LTYPE_YELLOW 4
00175 #define PLOT_LTYPE_ORANGE 5
00176 #define PLOT_LTYPE_DGREEN 6
00177 #define PLOT_LTYPE_DCYAN 7
00178 #define PLOT_LTYPE_DRED 8
00179 #define PLOT_LTYPE_DMAGENTA 9
00180 #define PLOT_LTYPE_DYELLOW 10
00181 #define PLOT_LTYPE_DORANGE 11
00182
00183
00184 typedef struct {
00185 int maxx,maxy;
00186 int fntw,fnth;
00187 int xtic,ytic;
00188 void (*move)(int x,int y);
00189 void (*line)(int x,int y);
00190 void (*linetype)(int ltype);
00191 void (*text)(int x,int y,char *txt);
00192 int (*textangle)(int ang);
00193 int (*textjustify)(int just);
00194 } gui_plot_win_info;
00195
00196 int gui_begin_plot(gui_plot_win_info *info);
00197 void gui_finish_plot(void);
00198
00199
00200 #define GUI_PLOT_TEXT_ANGLE_HORIZONTAL 0
00201 #define GUI_PLOT_TEXT_ANGLE_VERTICAL 1
00202 #define GUI_PLOT_TEXT_JUSTIFY_LEFT 0
00203 #define GUI_PLOT_TEXT_JUSTIFY_CENTER 1
00204 #define GUI_PLOT_TEXT_JUSTIFY_RIGHT 2
00205
00206
00207 typedef struct {
00208 const char *prompt;
00209 char *reply;
00210 int maxrsize;
00211 } gui_askentry;
00212
00213 int gui_ask(
00214 int force,
00215 const char *title,
00216 const char *prompt,char *reply,int maxrsize,
00217 ...
00218 );
00219
00220 int gui_askn(int force,const char *title,int n,gui_askentry *fields);
00221 void gui_inform(const char *msg,...);
00222 int gui_confirm_yes_no(const char *msg,...);
00223 int gui_confirm_ok_cancel(const char *msg,...);
00224 int gui_confirm_yes_no_cancel(const char *msg,...);
00225 void gui_message(const char *msg,...);
00226 void gui_error(const char *msg,...);
00227 void gui_beep(void);
00228
00229
00230 #define GUI_ASK_LONGSTR "LS"
00231 #define GUI_ASK_SHORTSTR "SS"
00232 #define GUI_ASK_VERYSHORTSTR "VS"
00233 #define GUI_ASK_FILENAME "FN"
00234 #define GUI_ASK_INTEGER "IN"
00235 #define GUI_ASK_FLOAT "FL"
00236 #define GUI_ASK_YESNO "YN"
00237 #define GUI_ASK_RADIO "RD"
00238 #define GUI_ASK_RADIO_H "HR"
00239 #define GUI_ASK_DATASET "DS"
00240 #define GUI_ASK_VARIABLE "VR"
00241 #define GUI_ASK_SET_AND_VAR "SV"
00242
00243
00244 #define GUI_ASK_NOLOOKUP "@@"
00245
00246
00247 #define GUI_ASK_RADIO_SEPAR GUI_RADIO_SEPARATOR
00248
00249
00250 typedef struct {
00251 int npoints;
00252 int maxpnts;
00253 float *xpoints;
00254 float *ypoints;
00255 char *title;
00256 float special;
00257 int nattrbs;
00258 char **prompts;
00259 char ***attribs;
00260 } gui_curve;
00261
00262 typedef struct {
00263 int ncurves;
00264 int maxcrvs;
00265 gui_curve **curves;
00266 } gui_curveset;
00267
00268 typedef gui_curve *(*gui_curve_genfn)(gui_curve *incurve);
00269
00270 typedef int (*gui_curveset_verifyfn)(
00271 gui_curveset *cset,
00272 char *title,
00273 char *msgbuf
00274 );
00275 typedef int (*gui_multi_cset_verifyfn)(
00276 int n,
00277 gui_curveset *csets[],
00278 char *titles[],
00279 char *msgbuf
00280 );
00281
00282 gui_curve *gui_alloc_curve(int maxpoints,char *crvtitle);
00283 gui_curveset *gui_alloc_curveset(int maxcurves);
00284
00285 void gui_set_attribute(gui_curve *crv,int pt,int attr,const char *attrval);
00286 char *gui_attribute_value(gui_curve *crv,int pt,int attr);
00287
00288 void gui_free_curve(gui_curve *crv);
00289 void gui_free_curveset(gui_curveset *cset);
00290
00291 gui_curveset *gui_edit_curveset(
00292 char *title,
00293 char *specname,
00294 gui_curveset *origset,
00295 char *ptitle,
00296 char *pxlabel,
00297 char *pylabel,
00298 gui_curve_genfn curvefitgen,
00299 gui_curve_genfn origfitgen,
00300 gui_curveset_verifyfn verify
00301 );
00302
00303 int gui_edit_multi_cset(
00304 char *title,
00305 char *specname,
00306 int nsets,
00307 gui_curveset *origsets[],
00308 char *ptitles[],
00309 char *pxlabels[],
00310 char *pylabels[],
00311 gui_curve_genfn curvefitgens[],
00312 gui_curve_genfn origfitgens[],
00313 gui_multi_cset_verifyfn verify,
00314 gui_curveset *outsets[]
00315 );
00316
00317
00318 void gui_register_itis(void);
00319 void gui_set_itis_host(char *host,char *port);
00320
00321 #ifdef __cplusplus
00322 }
00323 #endif
00324
00325 #endif
00326