Quantum Fog  0.9.3
QFog_constants.h
1 #pragma once
2 
3 const USHORT pix_per_in = 72;
4 const USHORT max_ushort = 65535;
5 const LONG max_long = 0x7FFFFFFF;
6 const DOUBLE my_pi = 3.14159265358979323846;
7 const DOUBLE nat_log_of_2 = .69314718056;
8 //With Symantec 8 compiler, use my_endline='\r'
9 //The ansi endl is used with cout only, I think.
10 //It forces the text preceeding endl to be printed immediately on the console.
11 const CHAR my_endline = '\n';
12 
13 const USHORT max_file_path_len = 1024;
14 
15 //we allow the user to write "-0." + 12 other characters for a total of 15 characters
16 const DOUBLE amps_floor = 1e-11;
17 const DOUBLE probs_floor = 1e-11;
18 enum COORD_SYSTEM {polar_cs, rect_cs};
19 
20 
21 #pragma mark ---------used only with macgui--------
22 #ifdef _mac_gui_app //''''''''''''''''''''''''''''''''''''''''''''\\.
23 
24 
25 #pragma mark --general constants:--
26 
27 const Rect the_zero_rect = {0x0000, 0x0000, 0x0000, 0x0000};
28 
29 const OSType my_creator_id = 'QFog';
30 const OSType my_file_type_id = 'QNet';
31 
32 //undel_reco = long record of selection, used to del and then undel
33 //paste_reco = short record of selection, used to copy and then paste
34 enum NET_STREAM_TYPE {open_reco, paste_reco, undel_reco};
35 
36 #pragma mark --version constants:--
37 /*
38 from <MacTypes.h>*************************
39 struct NumVersion {
40  UInt8 majorRev;//1st part of version number in BCD
41  UInt8 minorAndBugRev;//2nd & 3rd part of version number share a byte
42  UInt8 stage;//stage code: dev, alpha, beta, final
43  UInt8 nonRelRev;//revision level of non-released version
44 };
45 
46  developStage = 0x20,
47  alphaStage = 0x40
48  betaStage = 0x60,
49  finalStage = 0x80,
50 */
51 const SInt32 k_vers_100 = 0x01008001; // 1.0.0, fin, release 1
52 const SInt32 k_vers_150 = 0x01508001; // 1.5.0, fin, release 1
53 const SInt32 k_vers_160 = 0x01608000; // 1.6.0, fin, release 0
54 const SInt32 k_vers_200 = 0x02008000; // 2.0.0, fin, release 0
55 const SInt32 k_vers_app = k_vers_200;
56 
57 #pragma mark --uaction related--
58 const USHORT max_num_of_act_types = 2;
59 //mview
60 const USHORT mview_num_of_act_types = 1;
61 const USHORT mview_del = 0;
62 //etable
63 const USHORT etable_num_of_act_types = 2;
64 const USHORT etable_del = 0;
65 const USHORT etable_paste = 1;
66 
67 
68 // SInt32: PaneIDT, CommandT, MessageT
69 // SInt16: ResIDT
70 
71  //rid = resource (object) id
72 #pragma mark --toolbox resources--
73 #pragma mark 'ALRT' rids
74  const ResIDT gen_alert_rid = 129;
75  const ResIDT cannot_undo_alert_rid = 131;
76 #pragma mark 'cicn' rids
77  const ResIDT fog_horn_icon_rid = 128;
78 
79 #pragma mark 'CURS' rids
80  const ResIDT pointing_hand_rid = 200;
81  const ResIDT open_hand_rid = 205;
82  const ResIDT closed_hand_rid = 206;
83  const ResIDT explosion_rid = 207;
84  const ResIDT clockwise_rot_rid = 211;
85  const ResIDT paint_brush_rid = 212;
86  const ResIDT eye_dropper_rid = 213;
87  const ResIDT bow_and_arrow_rid = 215;
88  const ResIDT arrow_source_rid = 216;
89 
90  const ResIDT bi_node_and_pointing_hand_rid = 400;
91 
92 #pragma mark 'ICN#' rids
93  const ResIDT qbit_rot_icon_rid = 200;
94  const ResIDT sg_magnet_icon_rid = 201;
95 
96 #pragma mark 'inc#' rids
97  // tools:
98  const ResIDT selection_tool_rid = 1110;
99  const ResIDT drag_tool_rid = 1120;
100  const ResIDT open_tool_rid = 1130;
101  const ResIDT rotation_tool_rid = 1140;
102  const ResIDT paint_tool_rid = 1150;
103  const ResIDT copy_color_tool_rid = 1160;
104  const ResIDT arrow_tool_rid = 1170;
105  const ResIDT arrow_source_tool_rid = 1180;
106 
107  const ResIDT beam_spl_tool_rid = 1190;
108  const ResIDT custom_node_tool_rid = 1200;
109  const ResIDT determ_node_tool_rid = 1210;
110  const ResIDT pol_rot_tool_rid = 1220;
111  const ResIDT pol_tool_rid = 1230;
112  const ResIDT qbit_rot_tool_rid = 1240;
113  const ResIDT sg_magnet_tool_rid = 1250;
114 
115  const ResIDT bi_nd_selector_tool_rid = 1300;
116 
117 #pragma mark 'MENU' rids
118  const ResIDT project_menu_rid = 255;
119 
120 #pragma mark 'ppat' rids
121  const ResIDT pol_rot_pat_rid = 200;
122  const ResIDT pol_pat_rid = 250;
123 
124 #pragma mark 'PICT' rids
125  const ResIDT ggate_pict_rid = 128;
126 
127 #pragma mark 'snd ' rids
128  const ResIDT fog_horn_snd_rid = 3001;
129 
130 #pragma mark 'STR#' rids
131  const ResIDT my_redo_rid = 250;
132  const ResIDT my_undo_rid = 251;
133  const ResIDT undel_ind = 1;
134  const ResIDT uncut_ind = 2;
135  const ResIDT unpaste_ind = 3;
136 
137 #pragma mark --PP specific resources--
138 #pragma mark 'Txtr' rids
139  //old fonts (see Fonts.h and Think Ref.)
140  //systemFont = 0 (Chicago or Charcoal 12-pt, bold looking, as in menus)
141  //applFont = 1 (Geneva 12-pt)
142  //Aliasing makes Geneva look very bad in Carbon MacOSX so I won't use it anymore;
143  //will use Verdana instead.
144  //MacOSX systemFont is Lucida Grande bold?
145  //MacOSX applFont is Lucida Grande plain?
146 
147  const ResIDT sysFont12_rid = 201;
148  const ResIDT sysFont12_c_rid = 202;
149  const ResIDT node_txt_rid = sysFont12_c_rid;
150  const ResIDT sysFont12_ul_rid = 203;
151 
152  const ResIDT Verdana9_rid = 300;
153  const ResIDT Verdana12_rid = 311;
154 
155 #pragma mark 'PPob' rids
156  //ata = about this application
157  const ResIDT ata_window_rid = 1000;
158  const ResIDT ata_fog_horn_but_rid = 1002;
159  //main
160  const ResIDT main_window_rid = 1050;
161  const ResIDT main_scroller_rid = 1051;
162  const ResIDT mview_rid = 1052;
163  const ResIDT main_wind_cap_rid = 1053;
164  //pal = palette
165  const ResIDT pal_rid = 1100;
166  const ResIDT pal_icon_table_rid = 1101;
167  const ResIDT pal_swatch_rid = 1151;
168  const ResIDT pal_nd_tool_popup_rid = 1190;
169  // 1110- 1300 reserved for tool static caption rids
170  //printing
171  const ResIDT printout_rid = 1400;
172  const ResIDT placeholder_rid = 1401;
173  //other_fsize = other font size
174  const ResIDT other_fsize_window_rid = 1500;
175  const ResIDT other_fsize_efield_rid = 1504;
176  //ds = drawing size
177  const ResIDT ds_window_rid = 1600;
178  const ResIDT ds_horiz_efield_rid = 1606;
179  const ResIDT ds_vert_efield_rid = 1607;
180  const ResIDT ds_page_setup_but_rid= 1608;
181  //tf = text files
182  const ResIDT tf_folder_but_rid= 1703;
183  const ResIDT tf_folder_cap_rid= 1704;
184  const ResIDT tf_prefix_efield_rid= 1705;
185 
186  const ResIDT tf_window_rid= 1700;
187  const ResIDT tf_ecases_cbox_rid= 1711;//cbox=check box
188  const ResIDT tf_nd_probs_cbox_rid= 1712;
189  const ResIDT tf_bi_nd_probs_cbox_rid= 1713;
190  const ResIDT tf_stories_cbox_rid= 1714;
191 
192  //af = amplitudes filter
193  const ResIDT af_wind_rid= 1780;
194  const ResIDT af_des_finesse_efield_rid= 1783;
195  const ResIDT af_cur_finesse_cap_rid= 1784;
196  //pi= prior information
197  const ResIDT pi_wind_rid= 1800;
198  //1800=small pi_wind, 1801=large pi_wind
199  //so pane rid 1801 in use.
200  const ResIDT pi_owner_cap_rid= 1805;
201  const ResIDT pi_nd_efield_rid= 1811;
202  const ResIDT pi_nd_popup_rid= 1812;
203  const ResIDT pi_first_nd_but_rid= 1813;
204  const ResIDT pi_next_nd_but_rid= 1814;
205  const ResIDT pi_reorder_nds_but_rid= 1815;
206  const ResIDT pi_first_in_st_but_rid= 1830;
207  const ResIDT pi_prev_in_st_but_rid= 1831;
208  const ResIDT pi_next_in_st_but_rid= 1832;
209  const ResIDT pi_parents_table_rid= 1836;
210  const ResIDT pi_reorder_in_nds_but_rid= 1837;
211  const ResIDT pi_all_act_but_rid= 1842;
212  const ResIDT pi_none_act_but_rid= 1843;
213  const ResIDT pi_polar_radio_rid= 1844;
214  const ResIDT pi_rect_radio_rid= 1845;
215  const ResIDT pi_rad_re_cap_rid= 1848;
216  const ResIDT pi_ang_im_cap_rid= 1849;
217  const ResIDT pi_amps_table_rid= 1851;
218  const ResIDT pi_reorder_nd_sts_but_rid= 1852;
219  const ResIDT pi_num_of_rows_cap_rid= 1860;
220  const ResIDT pi_num_of_rows_but_rid= 1861;
221  const ResIDT pi_total_prob_but_rid= 1870;
222  const ResIDT pi_total_prob_cap_rid= 1871;
223  const ResIDT pi_gen_st_names_but_rid= 1881;
224  const ResIDT pi_gen_amps_but_rid= 1882;
225  //bi_nd = bi-nodes of interest
226  const ResIDT bi_nd_wind_rid = 1900;
227  const ResIDT bi_nd_list_box_rid = 1910;
228  const ResIDT bi_nd_check_box_rid = 1920;
229  const ResIDT bi_nd_owner_cap_rid = 1940;
230  //nd_probs = node probs
231  const ResIDT nd_probs_wind_rid= 2000;
232  const ResIDT nd_probs_owner_cap_rid= 2001;
233  const ResIDT nd_probs_popup_rid= 2010;
234  const ResIDT nd_probs_first_but_rid= 2011;
235  const ResIDT nd_probs_next_but_rid= 2012;
236  const ResIDT nd_probs_info_cap_rid= 2016;
237  const ResIDT nd_probs_table_rid= 2021;
238  //bi_nd_probs = bi-nodes probs
239  const ResIDT bi_nd_probs_wind_rid= 2100;
240  const ResIDT bi_nd_probs_owner_cap_rid= 2101;
241  const ResIDT bi_nd_probs_popup_rid= 2110;
242  const ResIDT bi_nd_probs_first_but_rid= 2111;
243  const ResIDT bi_nd_probs_next_but_rid= 2112;
244  const ResIDT bi_nd_probs_state_cap_rid= 2115;
245  const ResIDT bi_nd_probs_info_cap_rid= 2117;
246  const ResIDT bi_nd_probs_scroller_rid= 2120;
247  const ResIDT bi_nd_probs_table_rid= 2121;
248  const ResIDT bi_nd_probs_lmargin_rid= 2122;
249  const ResIDT bi_nd_probs_tmargin_rid= 2123;
250  //sto = stories
251  const ResIDT sto_wind_rid= 2200;
252  const ResIDT sto_wind_owner_cap_rid= 2201;
253  const ResIDT sto_wind_cs_cap_rid= 2203;
254  const ResIDT sto_wind_popup_rid= 2204;
255  const ResIDT sto_wind_polar_radio_rid= 2211;
256  const ResIDT sto_wind_rect_radio_rid= 2212;
257  const ResIDT sto_wind_first_but_rid= 2213;
258  const ResIDT sto_wind_next_but_rid= 2214;
259  //det= deterministic node
260  const ResIDT det_wind_rid= 2300;
261  const ResIDT det_nd_type_popup_rid= 2311;
262  const ResIDT det_host_view_rid= 2312;
263  const ResIDT cnot_pane_rid= 2320;
264  const ResIDT cnot_pa1_radio_rid= 2322;
265  const ResIDT cnot_pa2_radio_rid= 2323;
266  const ResIDT cnot_0fires_radio_rid= 2325;
267  const ResIDT cnot_1fires_radio_rid= 2326;
268  const ResIDT marg_pane_rid= 2340;
269  const ResIDT marg_pos_efield_rid= 2342;
270  const ResIDT marg_len_efield_rid= 2344;
271  const ResIDT pshifter_pane_rid= 2360;
272  const ResIDT pshifter_theta_efield_rid= 2362;
273  const ResIDT pshifter_check_box_rid= 2364;
274  //sg_magnet = Stern Gerlach magnet
275  const ResIDT sg_magnet_window_rid= 2400;
276  const ResIDT sg_magnet_theta_efield_rid= 2413;
277  const ResIDT sg_magnet_phi_efield_rid= 2415;
278  const ResIDT sg_magnet_table_rid= 2426;
279  //bs = beam splitter
280  const ResIDT bs_window_rid= 2500;
281  const ResIDT bs_tau_mag_sq_efield_rid= 2512;
282  const ResIDT bs_tau_ang_efield_rid= 2514;
283  const ResIDT bs_rho_ang_efield_rid= 2516;
284  const ResIDT bs_max_n_sum_efield_rid= 2518;
285  //pol = polarizer
286  const ResIDT pol_window_rid= 2600;
287  const ResIDT pol_efield_rid= 2612;
288  //pol_rot = polarization rotator
289  const ResIDT pol_rot_window_rid= 2700;
290  const ResIDT pol_rot_efield_rid= 2712;
291  //qbit_rot = qbit rotation
292  const ResIDT qbit_rot_window_rid= 2800;
293  const ResIDT qbit_rot_theta0_efield_rid= 2820;
294  const ResIDT qbit_rot_theta1_efield_rid= 2821;
295  const ResIDT qbit_rot_theta2_efield_rid= 2822;
296  const ResIDT qbit_rot_theta3_efield_rid= 2823;
297  //rows = number of rows
298  const ResIDT rows_wind_rid= 4000;
299  const ResIDT rows_wind_ok_but_rid= 4001;
300  const ResIDT rows_wind_cancel_but_rid= 4002;
301  const ResIDT rows_wind_efield_rid= 4003;
302  //q = queue
303  const ResIDT q_wind_rid= 4100;
304  const ResIDT q_abc_but_rid= 4103;
305  const ResIDT qtable_rid= 4112;
306  //gn = generate names
307  const ResIDT gn_wind_rid= 4200;
308  const ResIDT gn_num_of_comps_efield_rid= 4212;
309  const ResIDT gn_min_char_efield_rid= 4222;
310  const ResIDT gn_max_char_efield_rid= 4224;
311  const ResIDT gn_commas_check_box_rid = 4231;
312  //pv = preview
313  const ResIDT pv_window_rid = 4300;
314  const ResIDT pv_total_prob_rid = 4310;
315  const ResIDT pv_num_of_stories_rid = 4311;
316  //dynamically allocated panes
317  const PaneIDT first_nd_efield_rid = 10001;
318  const PaneIDT first_pi_pa_st_popup_PPob_rid = 20001;
319  //permission dialog
320  const ResIDT per_dial_rid = 4400;
321  const ResIDT per_dial_cap_rid = 4410;
322 
323 
324 #pragma mark 'RidL' rids
325  const ResIDT pal_ridl = pal_rid;
326  const ResIDT pi_wind_ridl = pi_wind_rid;
327  const ResIDT bi_nd_wind_ridl = bi_nd_wind_rid;
328  const ResIDT nd_probs_wind_ridl = nd_probs_wind_rid;
329  const ResIDT bi_nd_probs_wind_ridl = bi_nd_probs_wind_rid;
330  const ResIDT sto_wind_ridl = sto_wind_rid;
331 
332 #pragma mark commands
333 
334  const CommandT cmd_import = 2001;
335  const CommandT cmd_import_nd_sts = 20011;
336  const CommandT cmd_import_amps = 20012;
337 
338  const CommandT cmd_export = 2002;
339  const CommandT cmd_export_topology = 20021;
340  const CommandT cmd_export_nd_sts = 20022;
341  const CommandT cmd_export_amps = 20023;
342 
343  const CommandT cmd_drawing_size= 3001;
344  const CommandT cmd_grid_lines= 3002;
345  const CommandT cmd_choose_color= 3003;
346  const CommandT cmd_filter_out_small_amps= 3005;
347 
348  const CommandT cmd_preview= 4002;
349  const CommandT cmd_text_files= 4003;
350  const CommandT cmd_do_one_ecase_at_a_time= 4004;
351  const CommandT cmd_illustrate_stories= 4005;
352 
353  const CommandT cmd_initial_run_state= 5001;
354  const CommandT cmd_go_forward= 5002;
355 
356  const CommandT cmd_active_project= 6001;
357  const CommandT cmd_show_main_wind= 6002;
358  const CommandT cmd_show_palette= 6003;
359  const CommandT cmd_show_pi_wind= 6004;
360  const CommandT cmd_show_bi_nd_wind= 6005;
361  const CommandT cmd_show_nd_probs_wind= 6006;
362  const CommandT cmd_show_bi_nd_probs_wind= 6007;
363  const CommandT cmd_show_stories_wind= 6008;
364 
365  const CommandT cmd_close_all_non_main_winds = 6100;
366  const CommandT cmd_doc_SetModified = 6101;
367 
368 #pragma mark messages
369  //ata = about this application
370  const MessageT msg_ata_fog_horn_but= ata_fog_horn_but_rid;
371  //pal = palette
372  const MessageT msg_pal_nd_tool_popup = pal_nd_tool_popup_rid;
373  //tf = text files
374  const MessageT msg_tf_folder_but= tf_folder_but_rid;
375  //mv = main view
376  const MessageT msg_mv_nd_efield= mview_rid;
377  //pi = prior info
378  const MessageT msg_pi_refresh_num_of_rows_cap= pi_amps_table_rid;
379  const MessageT msg_pi_nd_efield= pi_nd_efield_rid;
380  const MessageT msg_pi_nd_popup= pi_nd_popup_rid;
381  const MessageT msg_pi_first_nd_but= pi_first_nd_but_rid;
382  const MessageT msg_pi_next_nd_but= pi_next_nd_but_rid;
383  const MessageT msg_pi_reorder_nds_but= pi_reorder_nds_but_rid;
384  const MessageT msg_pi_reorder_in_nds_but= pi_reorder_in_nds_but_rid;
385  const MessageT msg_pi_reorder_nd_sts_but= pi_reorder_nd_sts_but_rid;
386  const MessageT msg_pi_first_in_st_but= pi_first_in_st_but_rid;
387  const MessageT msg_pi_prev_in_st_but= pi_prev_in_st_but_rid;
388  const MessageT msg_pi_next_in_st_but= pi_next_in_st_but_rid;
389  const MessageT msg_pi_all_act_but= pi_all_act_but_rid;
390  const MessageT msg_pi_none_act_but= pi_none_act_but_rid;
391  const MessageT msg_pi_polar_radio= pi_polar_radio_rid;
392  const MessageT msg_pi_clear_total_prob_cap= pi_total_prob_cap_rid;
393  const MessageT msg_pi_total_prob_but = pi_total_prob_but_rid;
394  const MessageT msg_pi_num_of_rows_but= pi_num_of_rows_but_rid;
395  const MessageT msg_pi_gen_st_names_but= pi_gen_st_names_but_rid;
396  const MessageT msg_pi_gen_amps_but= pi_gen_amps_but_rid;
397  //bi_nd = bi-nodes of interest
398  const MessageT msg_bi_nd_check_box = bi_nd_check_box_rid;
399  //nd_probs = node probs
400  const MessageT msg_nd_probs_popup= nd_probs_popup_rid;
401  const MessageT msg_nd_probs_first_but= nd_probs_first_but_rid;
402  const MessageT msg_nd_probs_next_but= nd_probs_next_but_rid;
403  //bi_nd_probs = bi-nodes probs
404  const MessageT msg_bi_nd_probs_popup= bi_nd_probs_popup_rid;
405  const MessageT msg_bi_nd_probs_first_but= bi_nd_probs_first_but_rid;
406  const MessageT msg_bi_nd_probs_next_but= bi_nd_probs_next_but_rid;
407  //sto = stories
408  const MessageT msg_sto_wind_popup= sto_wind_popup_rid;
409  const MessageT msg_sto_wind_polar_radio= sto_wind_polar_radio_rid;
410  const MessageT msg_sto_wind_first_but= sto_wind_first_but_rid;
411  const MessageT msg_sto_wind_next_but= sto_wind_next_but_rid;
412  //det= deterministic node
413  const MessageT msg_det_nd_type_popup = det_nd_type_popup_rid;
414  //q = queue
415  const MessageT msg_q_abc_but = q_abc_but_rid;
416 
417 
418 #endif //_mac_gui_app \\............................................//
419 
420