34 callback_installer(callback_installer_),
35 window_nr(window_nr_),
71 #if defined(DEBUG) && 0
72 fprintf(stderr,
"GEN_graphic::show\n");
75 gen_root->
paint(device);
88 switch (event.
cmd()) {
120 int res = device->
text(gc,
cstr, x, y);
128 increase_selected_range(wrect);
134 int res = device->
line(gc, x0, y0, x1, y1);
153 if (curr_gene_name == gene->Name()) {
181 if (error_reason.length()) {
186 clear_selected_range();
195 double w0 = 2.0*
M_PI/double(length);
203 while (curr != end) {
204 int draw_gc, text_gc;
205 if (
getDrawGcs(curr, paint_what, gene_name, draw_gc, text_gc)) {
206 double w = w0*curr->StartPos()-mp2;
207 double sinw = sin(w);
208 double cosw = cos(w);
209 int len = curr->Length();
211 int xi =
int(cosw*inside+0.5);
212 int yi =
int(sinw*inside+0.5);
213 int xo = xi+
int(cosw*outside*len+0.5);
214 int yo = yi+int(sinw*outside*len+0.5);
218 smart_text(device, text_gc, curr->NodeInfo().c_str(), xo+20, yo);
220 smart_line(device, draw_gc, xi, yi, xo, yo);
222 int sa = int(sinw*arrow_size+0.5);
223 int ca = int(cosw*arrow_size+0.5);
225 if (curr->Complement()) {
228 smart_line(device, draw_gc, xi, yi, xa, ya);
233 smart_line(device, draw_gc, xo, yo, xa, ya);
243 int arrow_x =
int(factor_x*arrow_size);
244 int arrow_y =
int(factor_y*arrow_size);
249 while (curr != end) {
250 int draw_gc, text_gc;
251 if (
getDrawGcs(curr, paint_what, gene_name, draw_gc, text_gc)) {
252 int y =
int(curr->StartPos()*factor_y+0.5);
253 int x2 =
int(curr->Length()*factor_x+0.5);
257 smart_text(device, text_gc, curr->NodeInfo().c_str(), x2+20,
y);
259 smart_line(device, draw_gc, 0, y, x2, y);
260 if (curr->Complement()) {
261 smart_line(device, draw_gc, 0, y, arrow_x, y-arrow_y);
264 smart_line(device, draw_gc, x2, y, x2-arrow_x, y-arrow_y);
276 int height_of_line = line_height+line_space;
278 int xRight =
int(display_width*width_factor+0.5);
279 int arrowMid = line_height/2;
284 while (curr != end) {
285 int draw_gc, text_gc;
286 if (
getDrawGcs(curr, paint_what, gene_name, draw_gc, text_gc)) {
287 int line1 = curr->StartPos()/display_width;
288 int line2 = curr->EndPos() / display_width;
289 int x1 =
int((curr->StartPos()-line1*display_width)*width_factor+0.5);
290 int x2 =
int((curr->EndPos() -line2*display_width)*width_factor+0.5);
291 int y1 = line1*height_of_line;
292 int y1o = y1-line_height;
295 if (line1 == line2) {
296 smart_line(device, draw_gc, x1, y1, x1, y1o);
297 smart_line(device, draw_gc, x2, y1, x2, y1o);
298 smart_line(device, draw_gc, x1, y1, x2, y1);
299 smart_line(device, draw_gc, x1, y1o, x2, y1o);
300 if (show_all_nds || text_gc !=
GEN_GC_DEFAULT) smart_text(device, text_gc, curr->NodeInfo().c_str(), x1+2, y1-2);
302 if (curr->Complement()) {
303 smart_line(device, draw_gc, x2, y1o, x2-arrowMid, y1o+arrowMid);
304 smart_line(device, draw_gc, x2, y1, x2-arrowMid, y1o+arrowMid);
307 smart_line(device, draw_gc, x1, y1o, x1+arrowMid, y1o+arrowMid);
308 smart_line(device, draw_gc, x1, y1, x1+arrowMid, y1o+arrowMid);
312 int y2 = line2*height_of_line;
313 int y2o = y2-line_height;
316 smart_line(device, draw_gc, x1, y1, x1, y1o);
317 smart_line(device, draw_gc, x1, y1, xRight, y1);
318 smart_line(device, draw_gc, x1, y1o, xRight, y1o);
319 if (show_all_nds || text_gc !=
GEN_GC_DEFAULT) smart_text(device, text_gc, curr->NodeInfo().c_str(), x1+2, y1-2);
322 smart_line(device, draw_gc, x2, y2, x2, y2o);
323 smart_line(device, draw_gc, xLeft, y2, x2, y2);
324 smart_line(device, draw_gc, xLeft, y2o, x2, y2o);
325 if (show_all_nds || text_gc !=
GEN_GC_DEFAULT) smart_text(device, text_gc, curr->NodeInfo().c_str(), xLeft+2, y2-2);
327 if (curr->Complement()) {
328 smart_line(device, draw_gc, x2, y2o, x2-arrowMid, y2o+arrowMid);
329 smart_line(device, draw_gc, x2, y2, x2-arrowMid, y2o+arrowMid);
332 smart_line(device, draw_gc, x1, y1o, x1+arrowMid, y1o+arrowMid);
333 smart_line(device, draw_gc, x1, y1, x1+arrowMid, y1o+arrowMid);
345 void GEN_graphic::delete_gen_root(
AWT_canvas *scr,
bool just_forget_callbacks) {
359 bool just_forget_callbacks =
false;
366 just_forget_callbacks =
true;
370 delete_gen_root(scr, just_forget_callbacks);
378 gen_root =
new GEN_root(organism_name, gene_name, gb_main, aw_root,
this);
AW::Vector transform(const AW::Vector &vec) const
void show(AW_device *device) OVERRIDE
bool getDrawGcs(GEN_iterator &gene, PaintWhat what, const string &curr_gene_name, int &draw_gc, int &text_gc)
void handle_command(AW_device *device, AWT_graphic_event &event) OVERRIDE
return string(buffer, length)
#define AWAR_LOCAL_GENE_NAME(window_nr)
void request_zoom_reset()
void paint(AW_device *device)
AW_root * get_aw_root() const
void set_GeneName(const std::string &gene_name_)
void check_for_DB_update(GBDATA *gbdummy) OVERRIDE
#define AWAR_GENMAP_BOOK_BASES_PER_LINE
void GEN_popup_gene_infowindow(AW_root *aw_root, GBDATA *gb_main)
void set_standard_default_padding()
#define AWAR_GENMAP_VERTICAL_FACTOR_Y
GBDATA * GEN_find_organism(GBDATA *gb_main, const char *name)
#define AWAR_GENMAP_ARROW_SIZE
#define AWAR_GENMAP_RADIAL_INSIDE
AW_MouseButton button() const
AW_gc_manager * AW_manage_GC(AW_window *aww, const char *gc_base_name, AW_device *device, int base_drag, AW_GCM_AREA area, const GcChangedCallback &changecb, const char *default_background_color,...)
bool flags_writeable() const
const AW_font_limits & get_font_limits(int gc, char c) const
#define AWAR_GENMAP_DISPLAY_TYPE(window_nr)
#define AWAR_GENMAP_RADIAL_OUTSIDE
void reinit_gen_root(AWT_canvas *scr, bool force_reinit)
void set_display_style(GEN_DisplayStyle type)
int get_string_size(int gc, long textlen) const
const double & ypos() const
const char * get_gc_base_name() const
const std::string & OrganismName() const
const std::string & Name() const
int GBT_get_color_group(GBDATA *gb_item)
bool line(int gc, const AW::LineVector &Line, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
AW::Vector rtransform(const AW::Vector &vec) const
#define AWAR_LOCAL_ORGANISM_NAME(window_nr)
int GB_read_flag(GBDATA *gbd)
#define AWAR_GENMAP_SHOW_ALL_NDS
char * read_string() const
AW_awar * awar(const char *awar)
GEN_gene_set::iterator GEN_iterator
#define AWAR_GENMAP_BOOK_LINE_HEIGHT
bool AW_color_groups_active()
AWT_COMMAND_MODE cmd() const
#define AWAR_GENMAP_BOOK_WIDTH_FACTOR
AWT_graphic_exports exports
#define AWAR_GENMAP_BOOK_LINE_SPACE
GEN_DisplayStyle get_display_style() const
void(* GEN_graphic_cb_installer)(CbInstallMode install, AWT_canvas *, GEN_graphic *)
AW_event_type type() const
const double & xpos() const
int & get_modifying_flag_ref()
GB_ERROR write_string(const char *aw_string)
AW_gc_manager * init_devices(AW_window *, AW_device *, AWT_canvas *scr) OVERRIDE
GB_transaction ta(gb_var)
const std::string & GeneName() const
GEN_graphic(AW_root *aw_root, GBDATA *gb_main, GEN_graphic_cb_installer callback_installer_, int window_nr_)
bool text(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment=0.0, AW_bitset filteri=AW_ALL_DEVICES_UNSCALED)
void AWT_GC_changed_cb(GcChange whatChanged, AWT_canvas *scr)
#define AWAR_GENMAP_VERTICAL_FACTOR_X