1 | /* ----------------------------------------------------------------- |
---|
2 | * Module: TESTBED/TB_main.cxx |
---|
3 | * |
---|
4 | * Description: demonstration of the use of AWT and WINDOW libraries, as |
---|
5 | * a testbed for the vectorfont functions |
---|
6 | * |
---|
7 | * Integration Notes: use the callback in TB_extern.cxx for your own stuff |
---|
8 | * |
---|
9 | * ----------------------------------------------------------------- |
---|
10 | */ |
---|
11 | |
---|
12 | /* |
---|
13 | * $Header$ |
---|
14 | * |
---|
15 | * $Log$ |
---|
16 | * Revision 1.1 2000/11/23 09:41:16 westram |
---|
17 | * Initial revision |
---|
18 | * |
---|
19 | * Revision 1.2 1995/03/13 16:53:19 jakobi |
---|
20 | * *** empty log message *** |
---|
21 | * |
---|
22 | */ |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | #include <stdio.h> |
---|
27 | #include <stdlib.h> |
---|
28 | #include <malloc.h> |
---|
29 | |
---|
30 | |
---|
31 | #include <arbdb.h> |
---|
32 | #include <arbdbt.h> |
---|
33 | |
---|
34 | // WINDOW stuff |
---|
35 | #include <aw_root.hxx> |
---|
36 | #include <aw_device.hxx> |
---|
37 | #include <aw_window.hxx> |
---|
38 | #include <aw_awars.hxx> |
---|
39 | |
---|
40 | // AWT stuff, canvas, etc, for use of higher level graphics |
---|
41 | #include <awt_canvas.hxx> |
---|
42 | #include <awt_nds.hxx> |
---|
43 | #include <awt_tree.hxx> |
---|
44 | #include <awt_dtree.hxx> |
---|
45 | |
---|
46 | // my own stuff |
---|
47 | #define EXTERNAL |
---|
48 | #include "tb_extern.hxx" |
---|
49 | |
---|
50 | // necessary black magic for X |
---|
51 | // required dummy for linker; must be defined in first object to linker |
---|
52 | // extern "C" { int XtAppInitialize(); } ; void aw_never_called_main(void) { XtAppInitialize(); }? |
---|
53 | AW_HEADER_MAIN; |
---|
54 | |
---|
55 | // required dummy for AWT, even if you don't use trees... |
---|
56 | void AD_map_viewer(gb_data_base_type *dummy) |
---|
57 | { |
---|
58 | AWUSE(dummy); |
---|
59 | } |
---|
60 | |
---|
61 | // necessary for AWT and other stuff, just NULL it |
---|
62 | GBDATA *gb_main; |
---|
63 | |
---|
64 | int main(int argc, char **argv) |
---|
65 | { |
---|
66 | AW_root *aw_root; |
---|
67 | AW_default aw_default; |
---|
68 | AW_window *aww; |
---|
69 | |
---|
70 | // db is *not* used, so we don't care about transactions |
---|
71 | // for getting an non-empty db for getting an empty tree for getting the canvas ... |
---|
72 | /* |
---|
73 | gb_main = GB_open(argv[1],"rw"); |
---|
74 | if (!gb_main) { |
---|
75 | aw_message(GB_get_error()); |
---|
76 | exit(0); |
---|
77 | } |
---|
78 | */ |
---|
79 | |
---|
80 | // keep db stuff happy |
---|
81 | gb_main=NULL; |
---|
82 | |
---|
83 | // get new root object |
---|
84 | aw_initstatus(); |
---|
85 | aw_root = new AW_root; |
---|
86 | |
---|
87 | // init awars |
---|
88 | aw_default = aw_root->open_default(".arb_prop/testawt.arb"); |
---|
89 | aw_root->init_variables(aw_default); |
---|
90 | aw_root->init("ARB_TB"); |
---|
91 | |
---|
92 | // set the parameters for testing zoomtext (as awars) |
---|
93 | aw_root->create_string("tmp/LeftFooter",NULL, aw_default,""); |
---|
94 | aw_root->create_string("tbd_string",&tbd_string,aw_default,"Ursprung"); |
---|
95 | aw_root->create_int("tbd_gc",&tbd_gc,aw_default,AWT_GC_CURSOR); |
---|
96 | aw_root->create_int("tbd_function",&tbd_function,aw_default,0); |
---|
97 | aw_root->create_int("tbd_bitset",&tbd_bitset,aw_default,0); |
---|
98 | aw_root->create_int("tbd_cl2",&tbd_cl2,aw_default,0); |
---|
99 | aw_root->create_int("tbd_cl1",&tbd_cl1,aw_default,0); |
---|
100 | aw_root->create_float("tbd_x",&tbd_x,aw_default,0.0); |
---|
101 | aw_root->create_float("tbd_y",&tbd_y,aw_default,0.0); |
---|
102 | aw_root->create_float("tbd_x0",&tbd_x0,aw_default,0.0); |
---|
103 | aw_root->create_float("tbd_y0",&tbd_y0,aw_default,0.0); |
---|
104 | aw_root->create_float("tbd_x1",&tbd_x1,aw_default,1.0); |
---|
105 | aw_root->create_float("tbd_y1",&tbd_y1,aw_default,1.0); |
---|
106 | aw_root->create_float("tbd_height",&tbd_height,aw_default,.1); |
---|
107 | aw_root->create_float("tbd_alignment",&tbd_alignment,aw_default,0.0); |
---|
108 | aw_root->create_float("tbd_alignmentx",&tbd_alignmentx,aw_default,0.0); |
---|
109 | aw_root->create_float("tbd_alignmenty",&tbd_alignmenty,aw_default,0.0); |
---|
110 | aw_root->create_float("tbd_rotation",&tbd_rotation,aw_default,0.0); |
---|
111 | |
---|
112 | // open the main window |
---|
113 | aww = create_tb_main_window(aw_root); |
---|
114 | aww->show(); |
---|
115 | |
---|
116 | // and go to the loop |
---|
117 | aw_root->main_loop(); |
---|
118 | |
---|
119 | return 0; |
---|
120 | } |
---|