source: tags/svn.1.5.4/PROBE_DESIGN/SaiProbeVisualization.hxx

Last change on this file was 7623, checked in by westram, 14 years ago
  • merge from dev [7450] [7452] [7456] [7457] [7458] [7459] [7460] [7461] [7464] [7465] [7466] [7467] [7468] [7469] [7482]
    • tweaked compiler options
      • activated -Weffc++
        • postfilter warnings where Scott Meyers' advices are too general.
          • base classes should not always have virtual destructors, since that renders tiny classes useless and
          • members should not always be initialized via initialization list, since that often violates the DRY principle
        • fix gcc's inability to detect that Noncopyable implements a private copy-ctor and op=
        • this slows down complete ARB recompilation by ~5%
    • added -Wold-style-cast (inactive)
    • removed -Wno-non-template-friend added in [7447]
  • postcompile.pl
    • added option —original to show unmodified compiler output
  • declared op= for classes which had a copy-ctor
  • moved op= macros to arbtools.h
  • derived classes containing pointers from Noncopyable (use Noncopyable virtually) or
  • made them copyable if needed (awt_mask_item, KnownDB, Code, AWT_registered_itemtype, GEN_gene, PosGene, PartialSequence, PlugIn, Range, Convaln_exception)
  • other related changes
    • user mask destruction working now
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
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
15#define MAX(x, y) (((x)>(y)) ?  (x) : (y))
16#define sai_assert(cond) arb_assert(cond)
17
18#define AWAR_SPV_SAI_2_PROBE "sai_visualize/sai_2_probe"
19#define AWAR_SPV_DISP_SAI    "sai_visualize/disp_sai"
20#define AWAR_SPV_SAI_COLOR   "sai_visualize/probeSai/color_0"
21
22#define AWAR_SPV_DB_FIELD_NAME   "sai_visualize/db_field_name"
23#define AWAR_SPV_DB_FIELD_WIDTH  "sai_visualize/db_field_width"
24#define AWAR_SPV_ACI_COMMAND     "sai_visualize/aci_command"
25#define AWAR_SPV_SELECTED_PROBE  "sai_visualize/selected_probe"
26
27#define SAI_CLR_COUNT 10
28
29enum {
30    PROBE,
31    PROBE_PREFIX,
32    PROBE_SUFFIX
33};
34
35enum {
36    SAI_GC_HIGHLIGHT,  SAI_GC_HIGHLIGHT_FONT  = SAI_GC_HIGHLIGHT,
37    SAI_GC_FOREGROUND, SAI_GC_FOREGROUND_FONT = SAI_GC_FOREGROUND,
38    SAI_GC_PROBE,      SAI_GC_PROBE_FONT      = SAI_GC_PROBE,
39
40    SAI_GC_0,  SAI_GC_1,  SAI_GC_2,  SAI_GC_3,  SAI_GC_4,
41    SAI_GC_5,  SAI_GC_6,  SAI_GC_7,  SAI_GC_8,  SAI_GC_9,
42
43    SAI_GC_MAX
44};
45
46// global data for interaction with probe match result list:
47
48class saiProbeData : virtual Noncopyable {
49    char   *probeTarget;
50    size_t  probeTargetLen;
51    char   *headline;           // needed for ProbeMatchParser
52
53public:
54
55    std::vector<const char*> probeSpecies;
56    std::vector<const char*> probeSeq;
57
58    saiProbeData() : probeTarget(strdup("<notarget>")), probeTargetLen(0), headline(0) {}
59    ~saiProbeData() {
60        free(probeTarget);
61        free(headline);
62    }
63
64    const char *getProbeTarget() const {
65        sai_assert(probeTarget); // always need a target
66        return probeTarget;
67    }
68    size_t getProbeTargetLen() const {
69        return probeTargetLen;
70    }
71    const char *getHeadline() const { return headline; }
72
73    void setProbeTarget(const char *target) {
74        sai_assert(target);
75        free(probeTarget);
76        unsigned int len = strlen(target);
77        char temp[len]; temp[len] = '\0';
78        for (unsigned int i = 0; i < len; i++) {
79            temp[i] = toupper(target[i]);  // converting the Bases to Upper case
80        }
81        probeTarget    = strdup(temp);
82        probeTargetLen = strlen(probeTarget);
83    }
84    void setHeadline(const char *hline) {
85        sai_assert(hline);
86        freedup(headline, hline);
87    }
88};
89
90class SAI_graphic : public AWT_nonDB_graphic, virtual Noncopyable {
91public:
92    GBDATA     *gb_main;
93    AW_root    *aw_root;
94
95    SAI_graphic(AW_root *aw_root, GBDATA *gb_main);
96    ~SAI_graphic();
97
98    AW_gc_manager init_devices(AW_window *, AW_device *, AWT_canvas *ntw, AW_CL);
99
100    void show(AW_device *device);
101    void info(AW_device *device, AW_pos x, AW_pos y, AW_clicked_line *cl, AW_clicked_text *ct);
102    void command(AW_device *device, AWT_COMMAND_MODE cmd, int button, AW_key_mod key_modifier, AW_key_code key_code, char key_char,
103                 AW_event_type type, AW_pos x, AW_pos y, AW_clicked_line *cl, AW_clicked_text *ct);
104    void paint(AW_device *device);
105
106};
107
108AW_window *createSaiProbeMatchWindow(AW_root *awr, GBDATA *gb_main);
109void transferProbeData(saiProbeData *spd);
110
111#else
112#error SaiProbeVisualization.hxx included twice
113#endif
114
Note: See TracBrowser for help on using the repository browser.