| 1 | #ifndef SAIPROBEVISUALIZATION_HXX |
|---|
| 2 | #define SAIPROBEVISUALIZATION_HXX |
|---|
| 3 | |
|---|
| 4 | #ifndef __VECTOR__ |
|---|
| 5 | #include <vector> |
|---|
| 6 | #endif |
|---|
| 7 | |
|---|
| 8 | #define MAX(x,y) (((x)>(y)) ? (x) : (y)) |
|---|
| 9 | #define sai_assert(cond) arb_assert(cond) |
|---|
| 10 | |
|---|
| 11 | #define AWAR_SPV_SAI_2_PROBE "sai_visualize/sai_2_probe" |
|---|
| 12 | #define AWAR_SPV_DISP_SAI "sai_visualize/disp_sai" |
|---|
| 13 | #define AWAR_SPV_SAI_COLOR "sai_visualize/probeSai/color_0" |
|---|
| 14 | |
|---|
| 15 | #define AWAR_SPV_DB_FIELD_NAME "sai_visualize/db_field_name" |
|---|
| 16 | #define AWAR_SPV_DB_FIELD_WIDTH "sai_visualize/db_field_width" |
|---|
| 17 | #define AWAR_SPV_ACI_COMMAND "sai_visualize/aci_command" |
|---|
| 18 | #define AWAR_SPV_SELECTED_PROBE "sai_visualize/selected_probe" |
|---|
| 19 | |
|---|
| 20 | #define SAI_CLR_COUNT 10 |
|---|
| 21 | |
|---|
| 22 | enum { |
|---|
| 23 | PROBE, |
|---|
| 24 | PROBE_PREFIX, |
|---|
| 25 | PROBE_SUFFIX |
|---|
| 26 | }; |
|---|
| 27 | |
|---|
| 28 | enum { |
|---|
| 29 | SAI_GC_HIGHLIGHT, SAI_GC_HIGHLIGHT_FONT = SAI_GC_HIGHLIGHT, |
|---|
| 30 | SAI_GC_FOREGROUND, SAI_GC_FOREGROUND_FONT = SAI_GC_FOREGROUND, |
|---|
| 31 | SAI_GC_PROBE, SAI_GC_PROBE_FONT = SAI_GC_PROBE, |
|---|
| 32 | |
|---|
| 33 | SAI_GC_0, SAI_GC_1, SAI_GC_2, SAI_GC_3, SAI_GC_4, |
|---|
| 34 | SAI_GC_5, SAI_GC_6, SAI_GC_7, SAI_GC_8, SAI_GC_9, |
|---|
| 35 | |
|---|
| 36 | SAI_GC_MAX |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | // global data for interaction with probe match result list: |
|---|
| 40 | |
|---|
| 41 | class saiProbeData { |
|---|
| 42 | char *probeTarget; |
|---|
| 43 | size_t probeTargetLen; |
|---|
| 44 | char *headline; // needed for ProbeMatchParser |
|---|
| 45 | |
|---|
| 46 | public: |
|---|
| 47 | |
|---|
| 48 | std::vector<const char*> probeSpecies; |
|---|
| 49 | std::vector<const char*> probeSeq; |
|---|
| 50 | |
|---|
| 51 | saiProbeData() : probeTarget(strdup("<notarget>")), probeTargetLen(0), headline(0) {} |
|---|
| 52 | ~saiProbeData() { |
|---|
| 53 | free(probeTarget); |
|---|
| 54 | free(headline); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | const char *getProbeTarget() const { |
|---|
| 58 | // sai_assert(probeTarget); // always need a target |
|---|
| 59 | return probeTarget; |
|---|
| 60 | } |
|---|
| 61 | size_t getProbeTargetLen() const { |
|---|
| 62 | return probeTargetLen; |
|---|
| 63 | } |
|---|
| 64 | const char *getHeadline() const { return headline; } |
|---|
| 65 | |
|---|
| 66 | void setProbeTarget(const char *target) { |
|---|
| 67 | sai_assert(target); |
|---|
| 68 | free(probeTarget); |
|---|
| 69 | unsigned int len = strlen(target); |
|---|
| 70 | char temp[len];temp[len] = '\0'; |
|---|
| 71 | for( unsigned int i = 0; i < len; i++) { |
|---|
| 72 | temp[i] = toupper(target[i]); // converting the Bases to Upper case |
|---|
| 73 | } |
|---|
| 74 | probeTarget = strdup(temp); |
|---|
| 75 | probeTargetLen = strlen(probeTarget); |
|---|
| 76 | } |
|---|
| 77 | void setHeadline(const char *hline) { |
|---|
| 78 | sai_assert(hline); |
|---|
| 79 | freedup(headline, hline); |
|---|
| 80 | } |
|---|
| 81 | }; |
|---|
| 82 | |
|---|
| 83 | class SAI_graphic: public AWT_nonDB_graphic { |
|---|
| 84 | public: |
|---|
| 85 | GBDATA *gb_main; |
|---|
| 86 | AW_root *aw_root; |
|---|
| 87 | |
|---|
| 88 | SAI_graphic(AW_root *aw_root, GBDATA *gb_main); |
|---|
| 89 | ~SAI_graphic(void); |
|---|
| 90 | |
|---|
| 91 | AW_gc_manager init_devices(AW_window *,AW_device *,AWT_canvas *ntw,AW_CL); |
|---|
| 92 | |
|---|
| 93 | void show(AW_device *device); |
|---|
| 94 | void info(AW_device *device, AW_pos x, AW_pos y, AW_clicked_line *cl, AW_clicked_text *ct); |
|---|
| 95 | void command(AW_device *device, AWT_COMMAND_MODE cmd, int button, AW_key_mod key_modifier, AW_key_code key_code, char key_char, |
|---|
| 96 | AW_event_type type, AW_pos x, AW_pos y, AW_clicked_line *cl, AW_clicked_text *ct); |
|---|
| 97 | void paint(AW_device *device); |
|---|
| 98 | |
|---|
| 99 | }; |
|---|
| 100 | |
|---|
| 101 | AW_window *createSaiProbeMatchWindow(AW_root *awr); |
|---|
| 102 | void transferProbeData(struct saiProbeData *spd); |
|---|
| 103 | |
|---|
| 104 | #else |
|---|
| 105 | #error SaiProbeVisualization.hxx included twice |
|---|
| 106 | #endif |
|---|
| 107 | |
|---|