| 1 | #ifndef awt_dtree_hxx_included |
|---|
| 2 | #define awt_dtree_hxx_included |
|---|
| 3 | |
|---|
| 4 | #define AWAR_DTREE_BASELINEWIDTH "awt/dtree/baselinewidth" |
|---|
| 5 | #define AWAR_DTREE_VERICAL_DIST "awt/dtree/verticaldist" |
|---|
| 6 | #define AWAR_DTREE_AUTO_JUMP "awt/dtree/autojump" |
|---|
| 7 | #define AWAR_DTREE_SHOW_CIRCLE "awt/dtree/show_circle" |
|---|
| 8 | #define AWAR_DTREE_GREY_LEVEL "awt/dtree/greylevel" |
|---|
| 9 | |
|---|
| 10 | void awt_create_dtree_awars(AW_root *aw_root,AW_default def); |
|---|
| 11 | |
|---|
| 12 | #define NT_BOX_WIDTH 3.5 /* pixel/2 ! */ |
|---|
| 13 | #define NT_ROOT_WIDTH 4.5 /* pixel/2 ! */ |
|---|
| 14 | #define NT_SELECTED_WIDTH 5.5 |
|---|
| 15 | #define PH_CLICK_SPREAD 0.10 |
|---|
| 16 | |
|---|
| 17 | #define AWT_TREE(ntw) ((AWT_graphic_tree *)ntw->tree_disp) |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | typedef enum { |
|---|
| 21 | AP_LIST_TREE, |
|---|
| 22 | AP_RADIAL_TREE, |
|---|
| 23 | AP_IRS_TREE, |
|---|
| 24 | AP_NDS_TREE |
|---|
| 25 | } AP_tree_sort; |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | class AWT_graphic_tree : public AWT_graphic { |
|---|
| 29 | protected: |
|---|
| 30 | |
|---|
| 31 | // variables - tree compatibility |
|---|
| 32 | |
|---|
| 33 | AP_tree * tree_proto; |
|---|
| 34 | double y_pos; |
|---|
| 35 | double list_tree_ruler_y; |
|---|
| 36 | double scale; |
|---|
| 37 | AW_pos grey_level; |
|---|
| 38 | // internal command exec. var. |
|---|
| 39 | double rot_orientation; |
|---|
| 40 | double rot_spread; |
|---|
| 41 | AW_clicked_line rot_cl; |
|---|
| 42 | AW_clicked_text rot_ct; |
|---|
| 43 | AW_clicked_line old_rot_cl; |
|---|
| 44 | AP_tree *rot_at; |
|---|
| 45 | |
|---|
| 46 | AW_device *disp_device; // device for rekursiv Funktions |
|---|
| 47 | void scale_text_koordinaten(AW_device *device, int gc, double& x,double& y,double orientation,int flag ); |
|---|
| 48 | |
|---|
| 49 | AW_bitset line_filter,vert_line_filter, text_filter,mark_filter; |
|---|
| 50 | AW_bitset ruler_filter, root_filter; |
|---|
| 51 | int treemodus; |
|---|
| 52 | |
|---|
| 53 | // functions to compute displayinformation |
|---|
| 54 | double show_list_tree_rek(AP_tree * at, double x_father, |
|---|
| 55 | double x_son); |
|---|
| 56 | void show_tree_rek(AP_tree *at, double x_center, |
|---|
| 57 | double y_center,double tree_sprad, |
|---|
| 58 | double tree_orientation, |
|---|
| 59 | double x_root, double y_root, int linewidth); |
|---|
| 60 | void show_nds_list_rek(GBDATA * gb_main); |
|---|
| 61 | |
|---|
| 62 | void NT_scalebox(int gc, double x, double y, int width); |
|---|
| 63 | void NT_emptybox(int gc, double x, double y, int width); |
|---|
| 64 | void NT_rotbox(int gc, double x, double y, int width); |
|---|
| 65 | const char *show_ruler(AW_device *device, int gc); |
|---|
| 66 | void rot_show_triangle( AW_device *device); |
|---|
| 67 | void rot_show_line( AW_device *device ); |
|---|
| 68 | |
|---|
| 69 | void show_irs(AP_tree *at,AW_device *device, int height); |
|---|
| 70 | int draw_slot(int x_offset, GB_BOOL draw_at_tips); // return max_x |
|---|
| 71 | int paint_sub_tree(AP_tree *node, int x_offset, int type); // returns y pos |
|---|
| 72 | |
|---|
| 73 | void unload(); |
|---|
| 74 | char *species_name; |
|---|
| 75 | int baselinewidth; |
|---|
| 76 | int show_circle; |
|---|
| 77 | public: |
|---|
| 78 | // *********** read only variables !!! |
|---|
| 79 | AW_root *aw_root; |
|---|
| 80 | AP_tree_sort tree_sort; |
|---|
| 81 | AP_tree * tree_root; |
|---|
| 82 | AP_tree * tree_root_display; |
|---|
| 83 | AP_tree_root *tree_static; |
|---|
| 84 | GBDATA *gb_main; |
|---|
| 85 | |
|---|
| 86 | AP_FLOAT x_cursor,y_cursor; |
|---|
| 87 | // *********** public section |
|---|
| 88 | AWT_graphic_tree(AW_root *aw_root, GBDATA *gb_main); |
|---|
| 89 | virtual ~AWT_graphic_tree(void); |
|---|
| 90 | |
|---|
| 91 | void init(AP_tree * tree_prot); |
|---|
| 92 | virtual AW_gc_manager init_devices(AW_window *,AW_device *,AWT_canvas *ntw,AW_CL); |
|---|
| 93 | |
|---|
| 94 | virtual void show(AW_device *device); |
|---|
| 95 | virtual void info(AW_device *device, AW_pos x, AW_pos y, |
|---|
| 96 | AW_clicked_line *cl, AW_clicked_text *ct); |
|---|
| 97 | virtual void command(AW_device *device, AWT_COMMAND_MODE cmd, int button, AW_event_type type, |
|---|
| 98 | AW_pos x, AW_pos y, |
|---|
| 99 | AW_clicked_line *cl, AW_clicked_text *ct); |
|---|
| 100 | |
|---|
| 101 | void mark_tree(struct AP_tree *at, int mark); |
|---|
| 102 | int group_tree(struct AP_tree *at, int mode); |
|---|
| 103 | int resort_tree(int mode, struct AP_tree *at = 0 ); |
|---|
| 104 | void create_group(AP_tree * at); |
|---|
| 105 | void toggle_group(AP_tree * at); |
|---|
| 106 | void jump(AP_tree *at, const char *name); |
|---|
| 107 | AP_tree *search(AP_tree *root, const char *name); |
|---|
| 108 | GB_ERROR load(GBDATA *gb_main, const char *name,AW_CL link_to_database, AW_CL insert_delete_cbs); |
|---|
| 109 | GB_ERROR save(GBDATA *gb_main, const char *name,AW_CL cd1, AW_CL cd2); |
|---|
| 110 | int check_update(GBDATA *gb_main); // reload tree if needed |
|---|
| 111 | void update(GBDATA *gb_main); |
|---|
| 112 | void set_tree_type(AP_tree_sort type); |
|---|
| 113 | |
|---|
| 114 | }; |
|---|
| 115 | |
|---|
| 116 | AWT_graphic *NT_generate_tree( AW_root *root,GBDATA *gb_main ); |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | #endif |
|---|