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