00001
00002 #include <strstream.h>
00003 #include "stdinc.h"
00004
00005 #define HALF_ROOT2 0.707106781186547524400844362105 // Root2/2
00006 #define ROOT2 1.414213562373095048801688724210 // sqrt(2)
00007
00008 #define GRAPH_WINDOW 1
00009 #define POPUP_WINDOW 2
00010 #define DIALOG_WINDOW 3
00011 #define BUTTON_WINDOW 4
00012 #define INPUT_WINDOW 5
00013 #define TEXT_WINDOW 6
00014
00015 #define NO_TYPE 0
00016 #define OK_BUTTON 1
00017 #define CANCEL_BUTTON 2
00018 #define CHECK_BUTTON 3
00019 #define OK_KEEP_BUTTON 4
00020
00021
00022
00023
00024 #define lux_openwin LUX_openwin
00025 #define lux_setup_region LUX_setup_region
00026 #define lux_clear_current_region LUX_clear_current_region
00027 #define lux_setup_axis LUX_setup_axis
00028 #define lux_draw_linef LUX_draw_linef
00029 #define lux_draw_pointf LUX_draw_pointf
00030 #define lux_draw_rectanglef LUX_draw_rectanglef
00031 #define lux_draw_arcf LUX_draw_arcf
00032 #define lux_fill_arcf LUX_fill_arcf
00033 #define lux_draw_axis LUX_draw_axis
00034 #define lux_getevent LUX_getevent
00035 #define lux_exit LUX_quick_exit // Note!
00036 #define lux_set_color LUX_set_color
00037 #define lux_lookup_color LUX_lookup_color
00038 #define lux_rgb_pixel LUX_rgb_pixel
00039 #define lux_draw_vstring LUX_draw_vstring
00040 #define lux_draw_string LUX_draw_string
00041 #define lux_draw_image_string LUX_draw_image_string
00042 #define lux_check_keypress LUX_check_keypress
00043 #define lux_check_buttonpress LUX_check_buttonpress
00044 #define lux_open_dialog LUX_open_dialog
00045 #define lux_draw_palette LUX_draw_palette
00046 #define lux_set_item LUX_set_item
00047 #define lux_get_itemvalue LUX_get_itemvalue
00048 #define lux_update_itemvalue LUX_update_itemvalue
00049 #define lux_clear_window LUX_clear_window
00050 #define lux_reset_window LUX_reset_window
00051 #define lux_update_fg LUX_update_fg
00052 #define lux_show_dialog LUX_show_dialog
00053 #define lux_reconvert_rcoord LUX_reconvert_rcoord
00054 #define lux_set_linestyle LUX_set_linestyle
00055 #define lux_set_window_name LUX_set_window_name
00056 #define lux_set_window_bgcolor LUX_set_window_bgcolor
00057 #define lux_set_bgcolor LUX_set_bgcolor
00058 #define lux_set_noupdate LUX_set_noupdate
00059 #define lux_next_keypress LUX_next_keypress
00060 #define lux_set_nobuffer LUX_set_nobuffer
00061
00062 extern "C" unsigned long lux_openwin(int , int , int , int );
00063 extern "C" int lux_set_window_name(unsigned long, char*);
00064 extern "C" int lux_setup_region(unsigned long, float,float,float,float );
00065 extern "C" int lux_clear_current_region(unsigned long);
00066 extern "C" int lux_setup_axis(unsigned long, float,float,float,float );
00067 extern "C" int lux_draw_linef(unsigned long,float,float,float,float);
00068 extern "C" int lux_draw_pointf(unsigned long,float,float);
00069 extern "C" int lux_draw_rectanglef(unsigned long,float,float,float,float);
00070 extern "C" int lux_draw_arcf(unsigned long,float,float,float,float,float,float);
00071 extern "C" int lux_fill_arcf(unsigned long,float,float,float,float,float,float);
00072 extern "C" int lux_draw_axis(unsigned long);
00073 extern "C" int lux_getevent();
00074 extern "C" int lux_exit();
00075 extern "C" int lux_set_color(unsigned long, long);
00076 extern "C" int lux_set_window_bgcolor(unsigned long, long);
00077 extern "C" int lux_set_bgcolor(unsigned long, long);
00078 extern "C" unsigned long lux_rgb_pixel(unsigned long, float, float,float);
00079 extern "C" unsigned long lux_lookup_color(unsigned long, char*);
00080 extern "C" int lux_draw_string(unsigned long, float, float, float,
00081 char*, char);
00082 extern "C" int lux_draw_vstring(unsigned long, float, float, float,
00083 char*, char);
00084 extern "C" int lux_draw_image_string(unsigned long, float, float, float,
00085 char*, char);
00086 extern "C" int lux_check_keypress(unsigned long,char);
00087 extern "C" int lux_check_buttonpress(unsigned long);
00088 extern "C" unsigned long lux_open_dialog(int, int, int, int);
00089 extern "C" int lux_set_item(unsigned long, int, int, int, int,
00090 int, int, char*);
00091 extern "C" int lux_draw_palette(unsigned long);
00092 extern "C" int lux_get_itemvalue(unsigned long, int, int, int, char*);
00093 extern "C" int lux_update_itemvalue(unsigned long, int, int, int, char*);
00094 extern "C" int lux_clear_window(unsigned long);
00095 extern "C" int lux_reset_window(unsigned long);
00096 extern "C" int lux_update_fg(unsigned long);
00097 extern "C" int lux_show_dialog(unsigned long);
00098 extern "C" int lux_reconvert_rcoord(unsigned long, int, int, float*, float*);
00099 extern "C" int lux_set_linestyle(unsigned long, int);
00100 extern "C" int lux_set_noupdate(unsigned long);
00101 extern "C" int lux_next_keypress(unsigned long, char*, char*, char*, char*);
00102 extern "C" void lux_set_nobuffer();
00103
00104
00105
00106 extern "C" int get_mouse_position(unsigned long, float*, float*);
00107 extern "C" void set_default_font(char*);
00108 extern "C" void lux_pause(int);
00109 extern "C" int lux_get_display_width();
00110 extern "C" int lux_get_display_height();
00111
00112 #define background_color 0
00113 #define default_color 1
00114 #define bound_single 2
00115 #define bound_binary 3
00116 #define unbound_single 4
00117 #define unbound_binary 5
00118
00119
00120
00121 #define N_COLORS 16
00122
00123
00124
00125 #define NV_COLOR1 "black"
00126 #define NV_COLOR2 "red"
00127 #define NV_COLOR3 "limegreen"
00128 #define NV_COLOR4 "blue"
00129 #define NV_COLOR5 "gold"
00130 #define NV_COLOR6 "magenta"
00131 #define NV_COLOR7 "dark goldenrod"
00132 #define NV_COLOR8 "lightpink"
00133 #define NV_COLOR9 "aquamarine"
00134 #define NV_COLORa "cyan"
00135 #define NV_COLORb "lightgrey"
00136 #define NV_COLORc "turquoise"
00137 #define NV_COLORd "gold"
00138 #define NV_COLORe "thistle"
00139 #define NV_COLORf "beige"
00140 #define NV_COLORg "plum"
00141
00142 #define RV_COLOR1 "white"
00143 #define RV_COLOR2 "red"
00144 #define RV_COLOR3 "green"
00145 #define RV_COLOR4 "lightblue"
00146 #define RV_COLOR5 "yellow"
00147 #define RV_COLOR6 "magenta"
00148 #define RV_COLOR7 "orange"
00149 #define RV_COLOR8 "pink"
00150 #define RV_COLOR9 "aquamarine"
00151 #define RV_COLORa "cyan"
00152 #define RV_COLORb "lightgrey"
00153 #define RV_COLORc "turquoise"
00154 #define RV_COLORd "gold"
00155 #define RV_COLORe "thistle"
00156 #define RV_COLORf "beige"
00157 #define RV_COLORg "plum"
00158
00159 #define TAB " "
00160
00161
00162
00163 #define FAC3D 1.75
00164
00165 #define ZOOM ROOT2
00166 #define PFAC 1.1892
00167
00168 enum {colorenergy=1, tracking, graph3dim,
00169 xminimum, xmaximum, yminimum, ymaximum,
00170 basepointsize, pointscalemode, lmax3D,
00171 theta3D, phi3D,
00172 DelayTime, dtheta3D, color,
00173 Origin, Xorigin, Yorigin, Zorigin,
00174 View2D, view2D, originstar, OriginStar};
00175 enum {ok=1, ok_keep, cancel};
00176
00177
00178
00179 void initialize_graphics(float, bool,
00180 unsigned long&, unsigned long&, unsigned long&,
00181 unsigned long*, unsigned long*,
00182 int&, int&, int&);
00183 void project3d(float, float, float, float&, float&,
00184 float, float, float, float,
00185 float, float, float, float&);
00186 void project3d(float, float, float, float&, float&,
00187 float, float, float, float);
00188
00189 void draw3d_axis(unsigned long, float, float, float, float, float);
00190 void draw2d_axis(unsigned long, float, float, float, float, int);
00191 void update_with_delay(unsigned long, float);
00192
00193 void show_instructions(unsigned long, float, char*, int);
00194 void show_instructions(unsigned long, float, char*, int, int);
00195
00196 void show_main_instructions(unsigned long, float, int, int, bool,
00197 int, int, int, int, int);
00198 local void format_and_show_instructions(unsigned long, float,
00199 unsigned long*, int, int,
00200 char*, int, int);
00201 void show_color_scheme(unsigned long, unsigned long*, unsigned long*,
00202 float, char, bool, int);
00203 void init_colors(unsigned long, unsigned long*, unsigned long*, bool);
00204 void set_limits(float*, float, int, float&, float&, int, float&, float&);
00205 float interp_to_x(float, float, float, float, float);
00206 float interp_to_y(float, float, float, float, float);
00207
00208
00209
00210
00211
00212 #define SMALL_DOT_SIZE (lmax3d/60.0)
00213
00214
00215
00216 #define _R_(i) ((int)( ((float)i)*r_factor + 0.5 ))
00217
00218