source: tags/initial/TEST/D_main.cxx

Last change on this file was 2, checked in by oldcode, 23 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1#include <stdio.h>
2
3
4#include <arbdb.h>
5//#include <arbdbt.h>
6#include <aw_root.hxx>
7#include <aw_device.hxx>
8#include <aw_window.hxx>
9
10#include <awt.hxx>
11#include <awt_canvas.hxx>
12#include <aw_preset.hxx>
13#include <awt_preset.hxx>
14
15
16#include "d_classes.hxx"
17#include "d_main.hxx"
18#include "d_awt_graphic_designer.hxx"
19AW_HEADER_MAIN;
20
21void AD_map_viewer(GBDATA* gbd){return;};
22GBDATA *gb_main;
23
24
25AW_window *create_main_window(AW_root *aw_root) {
26
27        AW_gc_manager aw_gc_manager = 0;
28        AW_window_menu_modes *awm = new AW_window_menu_modes();
29        awm->init(aw_root,"DESIGNER", 800,600,0,0);
30        AWT_canvas *ntw = new AWT_canvas(gb_main,awm,(AWT_graphic *)new AWT_graphic_designer(), aw_gc_manager);
31        awm->create_menu(       0,      "File", "F",    "xxx.hlp",      0 );
32        awm->insert_menu_topic( 0,      "Quit", "Q",    "quit.hlp",     0, (AW_CB)quit_cb, 0, 0);
33        awm->insert_separator();
34        awm->insert_menu_topic(0,"Colors and Fonts ...", "C","colors.hlp",0, 
35                                AW_POPUP, (AW_CL)AW_create_gc_window, (AW_CL)aw_gc_manager );
36        awm->insert_menu_topic(0, "Print View to Printer ...",  "P","print.hlp",0,(AW_CB)AWT_create_print_window, (AW_CL)ntw,   0 );
37
38        awm->create_mode( 0, "zoom.bitmap", "mode_pzoom.hlp", 0, (AW_CB)nt_mode_event, 
39                        (AW_CL)ntw,
40                        (AW_CL)AWT_MODE_ZOOM
41                        );
42        awm->create_mode( 0, "lzoom.bitmap", "mode_lzoom.hlp", 0, (AW_CB)nt_mode_event, 
43                        (AW_CL)ntw,
44                        (AW_CL)AWT_MODE_LZOOM
45                        );
46
47        awm->set_info_area_height( 0 );
48        awm->set_bottom_area_height( 0 );
49
50        return (AW_window *)awm;
51}
52
53void quit_cb(AW_window *aww) {
54        exit(0);
55}
56
57
58
59int main(int argc, char **argv) {
60class Element *root;
61class Element *tmp_elem;
62int     number = 5;
63
64
65        AW_root *aw_root;
66        AW_default aw_default;
67
68        char *db_server =":";
69
70//      aw_initstatus();
71
72        aw_root = new AW_root;
73        aw_default = aw_root->open_default(".designer");
74        aw_root->init_variables(aw_default);
75        aw_root->init("DESIGNER");
76
77//***********************************************************
78
79        root = new Element;
80
81        printf("start\n");
82
83        root->set_contents(1);
84        root->print_contents();
85
86        tmp_elem = root->add_son()->set_contents(11)->print_contents();
87        tmp_elem->add_son()->set_contents(111)->print_contents();
88        tmp_elem->add_son()->set_contents(112)->print_contents();
89        tmp_elem->add_son()->set_contents(113)->print_contents();
90
91        tmp_elem = root->add_son()->set_contents(2)->print_contents();
92        tmp_elem->add_son()->set_contents(121)->print_contents();
93        tmp_elem->add_son()->set_contents(122)->print_contents()->add_son()->set_contents(1221)->print_contents();
94
95        tmp_elem = root->add_son()->set_contents(3)->print_contents();
96        tmp_elem->add_son()->set_contents(131)->print_contents();
97        tmp_elem->add_son()->set_contents(132)->print_contents();
98        tmp_elem->add_son()->set_contents(133)->print_contents();
99
100        root->get_number_of_sons(number);
101        printf("Number of sons:%i\n",number);
102
103//      root->print_contents_recursive(0);
104
105        root->calculate_sizes();
106
107        root->dump_recursive();
108
109        printf("ende\n");
110
111//***********************************************************
112
113        AW_window_menu_modes *awm = (AW_window_menu_modes*)create_main_window(aw_root);
114        awm->show();                   
115
116        aw_root->awar_string( "tmp/LeftFooter", "");
117
118        aw_root->main_loop();
119
120
121}
122
123
124void
125nt_mode_event( AW_window *aws, AWT_canvas *ntw, AWT_COMMAND_MODE mode)
126{
127        AWUSE(aws);
128        char *text;
129        static int story = 0;
130
131        switch(mode){
132        case AWT_MODE_MARK:
133                text="MARK MODE    LEFT: mark subtree   RIGHT: unmark subtree";
134                break;
135        case AWT_MODE_GROUP:
136                text="GROUP MODE   LEFT: group/ungroup group  RIGHT: group/ungroup subtree";
137                break;
138        case AWT_MODE_ZOOM:
139                text="ZOOM MODE    LEFT: press and drag to zoom   RIGHT: zoom out one step";
140                break;
141        case AWT_MODE_LZOOM:
142                text="LOGICAL ZOOM MODE   LEFT: show subtree  RIGHT: go up one step";
143                break;
144        case AWT_MODE_MOD:
145                text="MODIFY MODE   LEFT: select node  RIGHT: assign info to internal node";
146                break;
147        case AWT_MODE_LINE:
148                text="LINE MODE    LEFT: reduce linewidth  RIGHT: increase linewidth";
149                break;
150        case AWT_MODE_ROT:
151                text="ROTATE MODE   LEFT: Select branch and drag to rotate  RIGHT: -";
152                break;
153        case AWT_MODE_SPREAD:
154                text="SPREAD MODE   LEFT: decrease angles  RIGHT: increase angles";
155                break;
156        case AWT_MODE_SWAP:
157                text="SWAP MODE    LEFT: swap branches  RIGHT: -";
158                break;
159        case AWT_MODE_LENGTH:
160                text="BRANCH LENGTH MODE   LEFT: Select branch and drag to change length  RIGHT: -";
161                break;
162        case AWT_MODE_MOVE:
163                text="MOVE MODE   LEFT: select subtree to move and drag to new destination  RIGHT: -";
164                break;
165        case AWT_MODE_NNI:
166                text="NEAREST NEIGHBOUR INTERCHANGE OPTIMIZER  LEF: select subtree  RIGHT: whole tree";
167                break;
168        case AWT_MODE_KERNINGHAN:
169                text="KERNIGHAN LIN OPTIMIZER   LEFT: select subtree RIGHT: whole tree";
170                break;
171        case AWT_MODE_OPTIMIZE:
172                text="NNI & KL OPTIMIZER   LEFT: select subtree  RIGHT:whole tree";
173                break;
174        case AWT_MODE_SETROOT:
175                text="SET ROOT MODE   LEFT: set root  RIGHT: -";
176                break;
177        case AWT_MODE_RESET:
178                text="RESET MODE   LEFT: reset rotation  MIDDLE: reset angles  RIGHT: reset linewidth";
179                break;
180        case AWT_MODE_JUMP:
181                story++;
182                if(story>9){
183                        story = 1;
184                }
185                switch(story){
186                case 1:
187                        text="STORY MODE:   Allow a few seconds please: This is a short story about";
188                        break;
189                case 2:
190                        text="STORY MODE:   The Making of ARB...";
191                        break;
192                case 3:
193                        text="STORY MODE:   In the first day there was the idea.";
194                        break;
195                case 4:
196                        text="STORY MODE:   In the second day there was the wild discussion.";
197                        break;
198                case 5:
199                        text="STORY MODE:   In the forth day there was an almost working version!";
200                        break;
201                case 6:
202                        text="STORY MODE:   In the fifth day there was an almost working version!!";
203                        break;
204                case 7:
205                        text="STORY MODE:   In the sixth day there was an almost working version!!!";
206                        break;
207                case 8:
208                        text="STORY MODE:   In the seventh day there finally was    >>>> ARB NTREE <<<<";
209                        break;
210                case 9:
211                        text="STORY MODE:   Yeahh, that was it how it was :)";
212                        break;
213
214                default:
215                        text="STORY MODE:   uuups, what's this ???";
216                        break;
217                }
218               
219        default:
220                text="No help for this mode available";
221                break;
222        }
223
224        ntw->awr->awar("tmp/LeftFooter")->write_string( text);
225        ntw->set_mode(mode);
226}
Note: See TracBrowser for help on using the repository browser.