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
00061 extern "C" unsigned long lux_openwin(int , int , int , int );
00062 extern "C" int lux_set_window_name(unsigned long, char*);
00063 extern "C" int lux_setup_region(unsigned long, float,float,float,float );
00064 extern "C" int lux_clear_current_region(unsigned long);
00065 extern "C" int lux_setup_axis(unsigned long, float,float,float,float );
00066 extern "C" int lux_draw_linef(unsigned long,float,float,float,float);
00067 extern "C" int lux_draw_pointf(unsigned long,float,float);
00068 extern "C" int lux_draw_rectanglef(unsigned long,float,float,float,float);
00069 extern "C" int lux_draw_arcf(unsigned long,float,float,float,float,float,float);
00070 extern "C" int lux_fill_arcf(unsigned long,float,float,float,float,float,float);
00071 extern "C" int lux_draw_axis(unsigned long);
00072 extern "C" int lux_getevent();
00073 extern "C" int lux_exit();
00074 extern "C" int lux_set_color(unsigned long, long);
00075 extern "C" int lux_set_window_bgcolor(unsigned long, long);
00076 extern "C" int lux_set_bgcolor(unsigned long, long);
00077 extern "C" unsigned long lux_rgb_pixel(unsigned long, float, float,float);
00078 extern "C" unsigned long lux_lookup_color(unsigned long, char*);
00079 extern "C" int lux_draw_string(unsigned long, float, float, float,
00080 char*, char);
00081 extern "C" int lux_draw_vstring(unsigned long, float, float, float,
00082 char*, char);
00083 extern "C" int lux_draw_image_string(unsigned long, float, float, float,
00084 char*, char);
00085 extern "C" int lux_check_keypress(unsigned long,char);
00086 extern "C" int lux_check_buttonpress(unsigned long);
00087 extern "C" unsigned long lux_open_dialog(int, int, int, int);
00088 extern "C" int lux_set_item(unsigned long, int, int, int, int,
00089 int, int, char*);
00090 extern "C" int lux_draw_palette(unsigned long);
00091 extern "C" int lux_get_itemvalue(unsigned long, int, int, int, char*);
00092 extern "C" int lux_update_itemvalue(unsigned long, int, int, int, char*);
00093 extern "C" int lux_clear_window(unsigned long);
00094 extern "C" int lux_reset_window(unsigned long);
00095 extern "C" int lux_update_fg(unsigned long);
00096 extern "C" int lux_show_dialog(unsigned long);
00097 extern "C" int lux_reconvert_rcoord(unsigned long, int, int, float*, float*);
00098 extern "C" int lux_set_linestyle(unsigned long, int);
00099 extern "C" int lux_set_noupdate(unsigned long);
00100 extern "C" int lux_next_keypress(unsigned long, char*, char*, char*, char*);
00101
00102
00103
00104 extern "C" int get_mouse_position(unsigned long, float*, float*);
00105 extern "C" void set_default_font(char*);
00106 extern "C" void lux_pause(int);
00107
00108 #define background_color 0
00109 #define default_color 1
00110 #define bound_single 2
00111 #define bound_binary 3
00112 #define unbound_single 4
00113 #define unbound_binary 5
00114
00115
00116
00117 #define N_COLORS 16
00118
00119
00120
00121 #define NV_COLOR1 "black"
00122 #define NV_COLOR2 "red"
00123 #define NV_COLOR3 "limegreen"
00124 #define NV_COLOR4 "blue"
00125 #define NV_COLOR5 "gold"
00126 #define NV_COLOR6 "magenta"
00127 #define NV_COLOR7 "dark goldenrod"
00128 #define NV_COLOR8 "lightpink"
00129 #define NV_COLOR9 "aquamarine"
00130 #define NV_COLORa "cyan"
00131 #define NV_COLORb "lightgrey"
00132 #define NV_COLORc "turquoise"
00133 #define NV_COLORd "gold"
00134 #define NV_COLORe "thistle"
00135 #define NV_COLORf "beige"
00136 #define NV_COLORg "plum"
00137
00138 #define RV_COLOR1 "white"
00139 #define RV_COLOR2 "red"
00140 #define RV_COLOR3 "green"
00141 #define RV_COLOR4 "lightblue"
00142 #define RV_COLOR5 "yellow"
00143 #define RV_COLOR6 "magenta"
00144 #define RV_COLOR7 "orange"
00145 #define RV_COLOR8 "pink"
00146 #define RV_COLOR9 "aquamarine"
00147 #define RV_COLORa "cyan"
00148 #define RV_COLORb "lightgrey"
00149 #define RV_COLORc "turquoise"
00150 #define RV_COLORd "gold"
00151 #define RV_COLORe "thistle"
00152 #define RV_COLORf "beige"
00153 #define RV_COLORg "plum"
00154
00155 #define TAB " "
00156
00157
00158
00159 #define FAC3D 1.75
00160
00161 #define ZOOM ROOT2
00162 #define PFAC 1.1892
00163
00164 enum {colorenergy=1, tracking, graph3dim,
00165 xminimum, xmaximum, yminimum, ymaximum,
00166 basepointsize, pointscalemode, lmax3D,
00167 theta3D, phi3D,
00168 DelayTime, dtheta3D, color,
00169 Origin, Xorigin, Yorigin, Zorigin,
00170 View2D, view2D, originstar, OriginStar};
00171 enum {ok=1, ok_keep, cancel};
00172
00173
00174
00175 void initialize_graphics(float, bool,
00176 unsigned long&, unsigned long&, unsigned long&,
00177 unsigned long*, unsigned long*,
00178 int&, int&, int&);
00179 void project3d(float, float, float, float&, float&,
00180 float, float, float, float,
00181 float, float, float, float&);
00182 void project3d(float, float, float, float&, float&,
00183 float, float, float, float);
00184
00185 void draw3d_axis(unsigned long, float, float, float, float, float);
00186 void draw2d_axis(unsigned long, float, float, float, float, int);
00187 void update_with_delay(unsigned long, float);
00188
00189 void show_instructions(unsigned long, float, char*, int);
00190 void show_instructions(unsigned long, float, char*, int, int);
00191
00192 void show_main_instructions(unsigned long, float, int, int);
00193 local void format_and_show_instructions(unsigned long, float,
00194 unsigned long*, int, int,
00195 char*, int, int);
00196 void show_color_scheme(unsigned long, unsigned long*, unsigned long*,
00197 float, char, bool, int);
00198 void init_colors(unsigned long, unsigned long*, unsigned long*, bool);
00199 void set_limits(float*, float, int, float&, float&, int, float&, float&);
00200 void set_hrd_limits(float*, float, int, float&, float&, int, float&, float&);
00201 float interp_to_x(float, float, float, float, float);
00202 float interp_to_y(float, float, float, float, float);
00203
00204
00205
00206
00207
00208 #define SMALL_DOT_SIZE (lmax3d/60.0)
00209
00210
00211
00212 #define _R_(i) ((int)( ((float)i)*r_factor + 0.5 ))
00213
00214