ARB
ED4_text_terminals.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : ED4_text_terminals.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #include <ed4_extern.hxx>
12 
13 #include "ed4_class.hxx"
14 #include "ed4_awars.hxx"
15 #include "ed4_edit_string.hxx"
16 #include "ed4_block.hxx"
17 #include "ed4_nds.hxx"
18 #include "ed4_visualizeSAI.hxx"
19 #include "ed4_ProteinViewer.hxx"
21 #include "ed4_seq_colors.hxx"
22 
23 #include <aw_preset.hxx>
24 #include <aw_awar.hxx>
25 
26 #include <AW_helix.hxx>
27 #include <aw_msg.hxx>
28 #include <aw_root.hxx>
29 
30 #include <st_window.hxx>
31 #include <arbdbt.h>
32 
33 #include <iostream>
34 
35 inline void ensure_buffer(char*& buffer, size_t& buffer_size, size_t needed) {
36  if (needed>buffer_size) {
37  delete [] buffer;
38  buffer_size = needed+10;
39  buffer = new char[buffer_size];
40 
41  memset(buffer, ' ', buffer_size-1);
42  buffer[buffer_size-1] = 0;
43  }
44 }
45 
46 void ED4_consensus_sequence_terminal::draw() {
47  static char *buffer = NULp;
48  static size_t buffer_size = 0;
49 
50  AW_pos x, y;
51  calc_world_coords(&x, &y);
53 
54  PosRange index_range = calc_update_interval();
55  if (index_range.is_empty()) return; // nothing to draw
56 
57  AW_pos text_x = x + CHARACTEROFFSET; // don't change
58  AW_pos text_y = y + SEQ_TERM_TEXT_YOFFSET;
59 
60  buffer_size = 0;
61 
62  if (index_range.is_unlimited()) {
63  e4_assert(MAXSEQUENCECHARACTERLENGTH == 0); // allow missing update interval when no seqdata is present (yet)
64 
65  const char *no_data = "No consensus data";
66  size_t len = strlen(no_data);
67  ensure_buffer(buffer, buffer_size, len+1);
68  memcpy(buffer, no_data, len);
69 
70  index_range = ExplicitRange(index_range, buffer_size-1);
71  }
72  else {
73  const ED4_remap *rm = ED4_ROOT->root_group_man->remap();
74 
75  index_range = rm->clip_screen_range(index_range);
76  if (index_range.is_empty()) return; // nothing to draw
77 
79  index_range = rm->sequence_to_screen(seq_range);
80 
81  char *cons = NULp;
82  if (!seq_range.is_empty()) {
83  cons = GB_give_buffer(seq_range.size()+1);
84  get_char_table().build_consensus_string_to(cons, seq_range, ED4_ROOT->get_consensus_params());
85  }
86 
87  ensure_buffer(buffer, buffer_size, index_range.end()+1);
88 
90  bool only_show_diff = ref->only_show_diff_for(this);
91 
92  for (int pos = index_range.start(); pos <= index_range.end(); ++pos) {
93  int seq_pos = rm->screen_to_sequence(pos);
94  if (seq_pos<0) {
95  buffer[pos] = ' ';
96  }
97  else {
98  char c = cons[seq_pos-seq_range.start()];
99  buffer[pos] = only_show_diff ? ref->convert(c, seq_pos) : c;
100  e4_assert(buffer[pos]);
101  }
102  }
103  }
104 
105  if (buffer_size) {
107  current_device()->text(ED4_G_SEQUENCES, SizedCstr(buffer, index_range.end()+1), text_x, text_y, 0, AW_SCREEN);
109  }
110 }
111 
112 struct ShowHelix_cd {
115 };
116 
117 static bool ED4_show_helix_on_device(AW_device *device, int gc, const char *helixBuffer, size_t helixStart, size_t helixLen, const AW::Position& pos, AW_CL cduser) {
118  ShowHelix_cd *cd = (ShowHelix_cd*)cduser;
119  AW_helix *helix = cd->helix;
120  const ED4_remap *rm = ED4_ROOT->root_group_man->remap();
121  char *buffer = GB_give_buffer(helixLen+1);
122  long i, j, k;
123 
124  helixLen = std::min(rm->get_max_screen_pos(), helixLen);
125 
126  for (k=0; size_t(k)<helixLen; k++) {
127  i = rm->screen_to_sequence(k+helixStart);
128 
129  BI_PAIR_TYPE pairType = helix->pairtype(i);
130  if (pairType == HELIX_NONE) {
131  buffer[k] = ' ';
132  }
133  else {
134  j = helix->opposite_position(i);
135  char pairchar = j<cd->real_sequence_length ? helixBuffer[j] : '.';
136  buffer[k] = helix->get_symbol(helixBuffer[i], pairchar, pairType);
137  }
138  }
139  buffer[helixLen] = 0;
140  return device->text(gc, buffer, pos);
141 }
142 
143 static bool ED4_show_protein_match_on_device(AW_device *device, int gc, const char *pfoldBuffer, size_t pfoldStart, size_t pfoldLen, const AW::Position& pos, AW_CL cl_protstruct) {
151  GB_ERROR error = NULp;
152  // TODO: proper use of ED4_remap?
153  const ED4_remap *rm = ED4_ROOT->root_group_man->remap();
154  char *buffer = GB_give_buffer(pfoldLen+1);
155  if (!buffer) {
156  error = GB_export_error("Out of memory.");
157  }
158  else {
159  error = ED4_pfold_calculate_secstruct_match((const unsigned char *)cl_protstruct,
160  (const unsigned char *)pfoldBuffer,
161  rm->screen_to_sequence(pfoldStart),
162  rm->screen_to_sequence(pfoldStart + pfoldLen),
163  buffer,
165  }
166  if (error) {
167  aw_message(error);
168  return false;
169  }
170 
171  buffer[pfoldLen] = 0;
172  return device->text(gc, buffer, pos);
173 }
174 
175 void ED4_orf_terminal::draw() {
176  // draw aminoacid ORFs below the DNA sequence
177 
178  static int color_is_used[ED4_G_DRAG];
179  static char **colored_strings = NULp;
180  static int len_of_colored_strings = 0;
181 
182  AW_device *device = current_device();
183 
184  // @@@ DRY calculation of index-range to-be-updated (done in several draw functions)
185  AW_pos world_x, world_y;
186  calc_world_coords(&world_x, &world_y);
187  current_ed4w()->world_to_win_coords(&world_x, &world_y);
188 
189  AW_pos text_x = world_x + CHARACTEROFFSET; // don't change
190  AW_pos text_y = world_y + SEQ_TERM_TEXT_YOFFSET;
191 
192  const ED4_remap *rm = ED4_ROOT->root_group_man->remap();
193 
195  {
196  int max_seq_len = aaSeqLen;
197  int max_seq_pos = rm->sequence_to_screen(max_seq_len-1);
198  index_range = ExplicitRange(PosRange(index_range), max_seq_pos);
199  }
200 
201  if (index_range.is_empty()) {
202  // @@@ looks wrong (index_range is empty depending on updated area!)
203  // compare to .@DRAW_WRONG_MESSAGE
204 
205  const char *no_data = "No sequence data";
206 
207  device->text(ED4_G_STANDARD, no_data, text_x, text_y, 0, AW_SCREEN);
208  return; // nothing to draw
209  }
210 
211  if (index_range.end() >= len_of_colored_strings) {
212  len_of_colored_strings = index_range.end() + 256;
213  if (!colored_strings) ARB_calloc(colored_strings, ED4_G_DRAG);
214 
215  for (int i=0; i<ED4_G_DRAG; i++) {
216  freeset(colored_strings[i], ARB_alloc<char>(len_of_colored_strings+1));
217  memset(colored_strings[i], ' ', len_of_colored_strings);
218  colored_strings[i][len_of_colored_strings] = 0;
219  }
220  }
221 
222  int seq_end = rm->screen_to_sequence(index_range.end());
223 
224  // mark all strings as unused
225  memset(color_is_used, 0, sizeof(color_is_used));
226 
228  {
229  const unsigned char *aaSequence_u = (const unsigned char *)aaSequence;
230  const unsigned char *aaColor_u = (const unsigned char *)aaColor;
231 
232  if (iDisplayMode == PV_AA_NAME || iDisplayMode == PV_AA_CODE) {
233  // transform strings, compress if needed
235  ref->expand_to_length(seq_end);
236 
237  char *char_2_char = ED4_ROOT->sequence_colors->char_2_char_aa;
238  char *char_2_gc = ED4_ROOT->sequence_colors->char_2_gc_aa;
239 
240  if (iDisplayMode == PV_AA_NAME) {
241  for (int scr_pos=index_range.start(); scr_pos <= index_range.end(); scr_pos++) {
242  int seq_pos = rm->screen_to_sequence(scr_pos);
243  unsigned char c = aaSequence_u[seq_pos];
244  unsigned char cc = aaColor_u[seq_pos];
245  int gc = char_2_gc[safeCharIndex(cc)];
246 
247  color_is_used[gc] = scr_pos+1;
248  colored_strings[gc][scr_pos] = char_2_char[safeCharIndex(c)];
249  }
250  }
251  else {
252  for (int scr_pos=index_range.start(); scr_pos <= index_range.end(); scr_pos++) {
253  int seq_pos = rm->screen_to_sequence(scr_pos);
254  char c = aaSequence_u[seq_pos];
255  int gc = char_2_gc[safeCharIndex(c)];
256 
257  color_is_used[gc] = scr_pos+1;
258  colored_strings[gc][scr_pos] = char_2_char[safeCharIndex(c)];
259  }
260  }
261  }
262 
263  // paint background
264  if ((iDisplayMode == PV_AA_CODE) || (iDisplayMode == PV_AA_BOX)) {
266  const int real_left = index_range.start();
267  const int real_right = index_range.end();
268  AW_pos x2 = text_x + width*real_left;
269  AW_pos y1 = world_y;
270  AW_pos y2 = text_y+1;
271  AW_pos height = y2-y1+1;
272  int color = ED4_G_STANDARD;
273  char *char_2_gc_aa = ED4_ROOT->sequence_colors->char_2_gc_aa;
274 
275  for (int i = real_left; i <= real_right; i++, x2 += width) {
276  int new_pos = rm->screen_to_sequence(i); // getting the real position of the base in the sequence
277  char base = aaSequence_u[new_pos];
278 
279  if (isupper(base) || (base=='*')) {
280  AW_pos x1 = x2-width; // store current x pos to x1
281  x2 += width*2; // add 2 char width to x2
282  i += 2; // jump two pos
283 
284  int gcChar = char_2_gc_aa[safeCharIndex(base)];
285  if ((gcChar>=0) && (gcChar<ED4_G_DRAG)) {
286  color = gcChar;
287  if (iDisplayMode == PV_AA_BOX) {
288  device->box(color, AW::FillStyle::SOLID, x1, y1, width*3, height);
289  }
290  else {
291  double rad_x = width*1.5;
292  double rad_y = height*0.7;
293  double center_x = x1+rad_x;
294  const int DRAW_DEG = 62;
295 
296  device->arc(ED4_G_SEQUENCES, AW::FillStyle::EMPTY, center_x, y1, rad_x, rad_y, 0, DRAW_DEG);
297  device->arc(ED4_G_SEQUENCES, AW::FillStyle::EMPTY, center_x, y1, rad_x, rad_y, 180, -DRAW_DEG);
298  }
299  }
300  }
301  }
302  }
303  }
304 
305  if ((iDisplayMode == PV_AA_NAME) || (iDisplayMode == PV_AA_CODE)) {
306  device->set_vertical_font_overlap(true);
307  // output strings
308  for (int gc = 0; gc < ED4_G_DRAG; gc++) {
309  if (color_is_used[gc] && (int)strlen(colored_strings[gc]) >= color_is_used[gc]) {
310  device->text(gc, SizedCstr(colored_strings[gc], color_is_used[gc]), text_x, text_y, 0, AW_SCREEN);
311  memset(colored_strings[gc] + index_range.start(), ' ', index_range.size()); // clear string
312  }
313  }
314  device->set_vertical_font_overlap(false);
315  }
316 }
317 
318 void ED4_sequence_terminal::draw() {
319  static int color_is_used[ED4_G_DRAG];
320  static char **colored_strings = NULp;
321  static int len_of_colored_strings = 0;
322 
323 #if defined(TRACE_REFRESH)
324  fprintf(stderr, "ED4_sequence_terminal::draw for id='%s'\n", id); fflush(stderr);
325 #endif
326 
327  AW_device *device = current_device();
328 
329  int max_seq_len;
330  resolve_pointer_to_char_pntr(&max_seq_len);
331  e4_assert(max_seq_len>0);
332 
333  AW_pos world_x, world_y;
334  calc_world_coords(&world_x, &world_y);
335  current_ed4w()->world_to_win_coords(&world_x, &world_y);
336 
337  AW_pos text_x = world_x + CHARACTEROFFSET; // don't change
338  AW_pos text_y = world_y + SEQ_TERM_TEXT_YOFFSET;
339 
340  const ED4_remap *rm = ED4_ROOT->root_group_man->remap();
341 
343  if (index_range.is_empty()) return; // nothing to draw
344 
345  int left = index_range.start(); // @@@ do similar to ED4_orf_terminal::draw here
346  int right = index_range.end();
347 
348  {
349  int max_seq_pos = rm->sequence_to_screen(max_seq_len-1);
350 
351  if (right>max_seq_len) right = max_seq_pos;
352  if (left>right) {
353  // @@@ may be correct here
354  // compare to .@DRAW_WRONG_MESSAGE
355 
356  const char *no_data = "No sequence data";
357 
358  device->text(ED4_G_STANDARD, no_data, text_x, text_y, 0, AW_SCREEN);
359  return; // nothing to draw
360  }
361  }
362 
363  if (right >= len_of_colored_strings) {
364  len_of_colored_strings = right + 256;
365  if (!colored_strings) ARB_calloc(colored_strings, ED4_G_DRAG);
366 
367  for (int i=0; i<ED4_G_DRAG; i++) {
368  freeset(colored_strings[i], (char *)malloc(sizeof(char) * (len_of_colored_strings+1)));
369  memset(colored_strings[i], ' ', len_of_colored_strings);
370  colored_strings[i][len_of_colored_strings] = 0;
371  }
372  }
373 
374  int seq_start = rm->screen_to_sequence(left); // real start of sequence
375  int seq_end = rm->screen_to_sequence(right);
376 
377  // mark all strings as unused
378  memset(color_is_used, 0, sizeof(color_is_used));
379 
380  // transform strings, compress if needed
381  {
383  unsigned char *db_pointer = (unsigned char *)resolve_pointer_to_string_copy();
384 
385  ref->expand_to_length(seq_end);
386 
387  GB_alignment_type aliType = GetAliType();
388  char *char_2_char = (aliType && (aliType==GB_AT_AA)) ? ED4_ROOT->sequence_colors->char_2_char_aa : ED4_ROOT->sequence_colors->char_2_char;
389  char *char_2_gc = (aliType && (aliType==GB_AT_AA)) ? ED4_ROOT->sequence_colors->char_2_gc_aa : ED4_ROOT->sequence_colors->char_2_gc;
390 
391  bool only_show_diff = ref->only_show_diff_for(this);
392  for (int scr_pos=left; scr_pos <= right; scr_pos++) {
393  int seq_pos = rm->screen_to_sequence(scr_pos);
394  int c = db_pointer[seq_pos];
395  int gc = char_2_gc[c];
396 
397  color_is_used[gc] = scr_pos+1;
398  colored_strings[gc][scr_pos] = char_2_char[only_show_diff ? ref->convert(c, seq_pos) : c];
399  }
400 
401  free(db_pointer);
402  }
403 
404  // Set background
405 
406  {
408  ST_ML_Color *statColors = NULp;
409  char *searchColors = results().buildColorString(this, seq_start, seq_end); // defined in ED4_SearchResults class : ED4_search.cxx
410  ED4_species_manager *spec_man = get_parent(LEV_SPECIES)->to_species_manager();
411  int color_group = AW_color_groups_active() ? GBT_get_color_group(spec_man->get_species_pointer()) : 0;
412 
413  PosRange selection;
414  int is_selected = ED4_get_selected_range(this, selection);
415  int is_marked = GB_read_flag(spec_man->get_species_pointer());
416 
417  if (species_name &&
419  (st_ml_node || (st_ml_node = STAT_find_node_by_name(ED4_ROOT->st_ml, this->species_name))))
420  {
421  statColors = STAT_get_color_string(ED4_ROOT->st_ml, NULp, st_ml_node, seq_start, seq_end);
422  }
423 
424  const char *saiColors = NULp;
425 
426  if (species_name &&
428  spec_man->get_type() != ED4_SP_SAI &&
429  (is_marked || ED4_ROOT->visualizeSAI_allSpecies))
430  {
431  saiColors = ED4_getSaiColorString(ED4_ROOT->aw_root, seq_start, seq_end);
432  }
433 
434  if (statColors || searchColors || is_marked || is_selected || color_group || saiColors) {
435  int i;
437  int real_left = left;
438  int real_right = right;
439  AW_pos x2 = text_x + width*real_left;
440  AW_pos old_x = x2;
441  AW_pos y1 = world_y;
442  AW_pos y2 = text_y+1;
443  AW_pos height = y2-y1+1;
444  int old_color = ED4_G_STANDARD;
445  int color = ED4_G_STANDARD;
446 
447  if (is_selected && selection.is_unlimited()) {
448  selection = ExplicitRange(selection, rm->screen_to_sequence(real_right));
449  }
450 
451  for (i = real_left; i <= real_right; i++, x2 += width) {
452  int new_pos = rm->screen_to_sequence(i); // getting the real position of the base in the sequence
453 
454  // Note: if you change background color priorities,
455  // please update help in ../HELP_SOURCE/oldhelp/e4_background_priority.hlp@COLOR_PRIORITY
456 
457  if (searchColors && searchColors[new_pos]) {
458  color = searchColors[new_pos];
459  }
460  else if (is_selected && selection.contains(new_pos)) {
461  color = ED4_G_SELECTED;
462  }
463  else if (statColors) {
464  color = statColors[new_pos] + ED4_G_CBACK_0;
465  if (color > ED4_G_CBACK_9) color = ED4_G_CBACK_9;
466  }
467  else if (saiColors) {
468  color = saiColors[new_pos];
469  if (color < ED4_G_CBACK_0 || color > ED4_G_CBACK_9) color = ED4_G_STANDARD;
470  }
471  else if (is_marked) {
472  color = ED4_G_MARKED;
473  }
474  else if (color_group) {
475  color = ED4_G_FIRST_COLOR_GROUP+color_group-1;
476  }
477  else {
478  color = ED4_G_STANDARD;
479  }
480 
481  if (color != old_color) { // draw till oldcolor
482  if (x2>old_x) {
483  if (old_color!=ED4_G_STANDARD) {
484  device->box(old_color, AW::FillStyle::SOLID, old_x, y1, x2-old_x, height); // paints the search pattern background
485  }
486  }
487  old_x = x2;
488  old_color = color;
489  }
490  }
491 
492  if (x2>old_x) {
493  if (color!=ED4_G_STANDARD) {
494  device->box(color, AW::FillStyle::SOLID, old_x, y1, x2-old_x, height);
495  }
496  }
497  }
498  }
499 
500  device->set_vertical_font_overlap(true);
501 
502  if (shall_display_secstruct_info) {
503  if (ED4_ROOT->helix->is_enabled()) {
504  // output helix
505  int db_len;
506  char *db_pointer = resolve_pointer_to_string_copy(&db_len);
507 
508  e4_assert(size_t(db_len) == ED4_ROOT->helix->size());
509  ShowHelix_cd cd = { ED4_ROOT->helix, max_seq_len };
510  device->text_overlay(ED4_G_HELIX,
511  SizedCstr(db_pointer, db_len),
514  free(db_pointer);
515  }
516 
517  if (ED4_ROOT->protstruct) {
518  // output protein structure match
519  ED4_species_manager *spec_man = get_parent(LEV_SPECIES)->to_species_manager();
520  if (spec_man->get_type() != ED4_SP_SAI && ED4_ROOT->aw_root->awar(PFOLD_AWAR_ENABLE)->read_int()) { // should do a remap
521  int db_len;
522  char *protstruct = resolve_pointer_to_string_copy(&db_len);
523 
524  if (protstruct) {
525  device->text_overlay(ED4_G_HELIX,
526  SizedCstr(protstruct, db_len),
529  free(protstruct);
530  }
531  }
532  }
533  }
534  // output strings
535  {
536  int gc;
537  for (gc = 0; gc < ED4_G_DRAG; gc++) {
538  if (!color_is_used[gc]) continue;
539  device->text(gc, SizedCstr(colored_strings[gc], color_is_used[gc]), text_x, text_y, 0, AW_SCREEN);
540  memset(colored_strings[gc] + left, ' ', right-left+1); // clear string
541  }
542  }
543 
544  device->set_vertical_font_overlap(false);
545 }
546 
547 
548 void ED4_sequence_info_terminal::draw() {
549  AW_pos x, y;
550  calc_world_coords(&x, &y);
552 
553  AW_pos text_x = x + CHARACTEROFFSET; // don't change
554  AW_pos text_y = y+INFO_TERM_TEXT_YOFFSET;
555 
556  char buffer[10];
557  GBDATA *gbdata = data();
558 
559  if (gbdata) {
560  GB_push_transaction(gbdata);
561  buffer[0] = '0' + GB_read_security_write(gbdata);
562  GB_pop_transaction(gbdata);
563  }
564  else {
565  buffer[0] = ' ';
566  }
567  strncpy(&buffer[1], this->id, 8);
568  buffer[9] = 0;
569 
570  if (containing_species_manager()->is_selected()) {
571  current_device()->box(ED4_G_SELECTED, AW::FillStyle::SOLID, x, y, extension.size[WIDTH], text_y-y+1);
572  }
573 
575  current_device()->text(ED4_G_STANDARD, buffer, text_x, text_y, 0, AW_SCREEN);
577 }
578 
579 // ---------------------------
580 // ED4_text_terminal
581 
583  AW_pos x, y;
584  calc_world_coords(&x, &y);
586 
587  AW_pos text_x = x + CHARACTEROFFSET; // don't change
588  AW_pos text_y = y + INFO_TERM_TEXT_YOFFSET;
589 
591 
592  if (is_species_name_terminal()) { // @@@ handle by virtual method (eg. draw_text())
593  GB_CSTR real_name = to_species_name_terminal()->get_displayed_text();
594  int width_of_char;
595  int height_of_char = -1;
596  bool paint_box = inside_species_seq_manager();
597  bool is_marked = false;
598 
599  if (paint_box) {
600  ED4_species_manager *species_man = get_parent(LEV_SPECIES)->to_species_manager();
601  GBDATA *gbd = species_man->get_species_pointer();
602 
603  if (gbd) {
604  GB_transaction ta(gbd);
605  is_marked = GB_read_flag(gbd);
606  }
607 
608  width_of_char = ED4_ROOT->font_group.get_width(ED4_G_STANDARD);
609  height_of_char = ED4_ROOT->font_group.get_height(ED4_G_STANDARD);
610 #define MIN_MARK_BOX_SIZE 8
611  if (width_of_char<MIN_MARK_BOX_SIZE) width_of_char = MIN_MARK_BOX_SIZE;
612  if (height_of_char<MIN_MARK_BOX_SIZE) height_of_char = MIN_MARK_BOX_SIZE;
613 #undef MIN_MARK_BOX_SIZE
614  }
615  else {
616  width_of_char = 0;
617  }
618 
619  if (containing_species_manager()->is_selected()) {
621  }
622  current_device()->text(ED4_G_STANDARD, real_name, text_x+width_of_char, text_y, 0, AW_SCREEN);
623 
624  if (paint_box) {
625  int xsize = (width_of_char*6)/10;
626  int ysize = (height_of_char*6)/10;
627  int xoff = xsize>>1;
628  int yoff = 0;
629  int bx = int(text_x+xoff);
630  int by = int(text_y-(yoff+ysize));
631 
632  current_device()->box(ED4_G_STANDARD, AW::FillStyle::SOLID, bx, by, xsize, ysize);
633  if (!is_marked && xsize>2 && ysize>2) {
634  current_device()->clear_part(bx+1, by+1, xsize-2, ysize-2, AW_ALL_DEVICES);
635  }
636  }
637  }
638  else if (is_flag_header_terminal()) { // @@@ handle by virtual method (eg. draw_text())
639  ED4_flag_header_terminal *header_term = to_flag_header_terminal();
640  const char *header_text = header_term->get_displayed_text();
641 
642  text_y += (SEQ_TERM_TEXT_YOFFSET-INFO_TERM_TEXT_YOFFSET); // @@@ wrong vertical shift? (change fontsize to examine)
643  current_device()->text(ED4_G_FLAG_INFO, SizedCstr(header_text, header_term->get_length()), text_x, text_y, 0, AW_SCREEN);
644  }
645  else {
646  e4_assert(is_pure_text_terminal()); // unhandled terminal type that does not overload draw()
647 
648  char *db_pointer = resolve_pointer_to_string_copy();
649 
650  text_y += (SEQ_TERM_TEXT_YOFFSET-INFO_TERM_TEXT_YOFFSET);
651  current_device()->text(ED4_G_SEQUENCES, db_pointer, text_x, text_y, 0, AW_SCREEN);
652 
653  free(db_pointer);
654  }
656 }
657 
658 ED4_text_terminal::ED4_text_terminal(const ED4_objspec& spec_, GB_CSTR temp_id, AW_pos width, AW_pos height, ED4_manager *temp_parent) :
659  ED4_terminal(spec_, temp_id, width, height, temp_parent)
660 {}
661 
bool column_stat_activated
Definition: ed4_class.hxx:1452
const char * GB_ERROR
Definition: arb_core.h:25
void ensure_buffer(char *&buffer, size_t &buffer_size, size_t needed)
int is_pure_text_terminal() const
Definition: ed4_class.hxx:1085
AW_device * current_device()
Definition: ed4_class.hxx:1396
const char * resolve_pointer_to_char_pntr(int *str_len=NULp) const FINAL_OVERRIDE
AW_helix * helix
Definition: ed4_class.hxx:1444
int screen_to_sequence(int screen_pos) const
bool only_show_diff_for(const ED4_sequence_terminal *term) const
const AW_bitset AW_SCREEN
Definition: aw_device.hxx:34
AW_font_group font_group
Definition: ed4_class.hxx:1464
AW_pos size[2]
Definition: ed4_defs.hxx:261
static char * y[maxsp+1]
CONSTEXPR_INLINE unsigned char safeCharIndex(char c)
Definition: dupstr.h:73
const char * ED4_getSaiColorString(AW_root *awr, int start, int end)
ED4_SearchResults & results() const
Definition: ed4_class.hxx:2002
virtual void clear_part(const AW::Rectangle &rect, AW_bitset filteri)
Definition: AW_device.cxx:317
unsigned char ST_ML_Color
Definition: st_ml.hxx:42
int start() const
Definition: pos_range.h:57
ExplicitRange clip_screen_range(PosRange screen_range) const
Definition: ed4_class.hxx:1769
BI_PAIR_TYPE
Definition: BI_helix.hxx:18
bool is_enabled() const
Definition: AW_helix.hxx:34
long read_int() const
Definition: AW_awar.cxx:187
ED4_text_terminal(const ED4_objspec &spec_, GB_CSTR id, AW_pos width, AW_pos height, ED4_manager *parent)
int get_height(int gc) const
int is_flag_header_terminal() const
Definition: ed4_class.hxx:1092
ED4_reference * reference
Definition: ed4_class.hxx:1440
ED4_root * ED4_ROOT
Definition: ED4_main.cxx:48
size_t opposite_position(size_t pos) const
Definition: BI_helix.hxx:96
size_t get_max_screen_pos() const
Definition: ed4_class.hxx:1731
const AW_bitset AW_ALL_DEVICES
Definition: aw_device.hxx:44
int size() const
Definition: pos_range.h:66
char char_2_char_aa[256]
int get_width(int gc) const
bool is_empty() const
Definition: pos_range.h:69
char * protstruct
Definition: ed4_class.hxx:1448
char buffer[MESSAGE_BUFFERSIZE]
Definition: seq_search.cxx:34
GB_ERROR GB_push_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2482
#define e4_assert(bed)
Definition: ed4_class.hxx:11
const int WIDTH
void world_to_win_coords(AW_pos *xPtr, AW_pos *yPtr) const
Definition: ed4_class.hxx:353
const AW::Position & calc_world_coords() const
Definition: ed4_class.hxx:987
#define PFOLD_AWAR_MATCH_METHOD
Selected method for computing the match quality (see PFOLD_MATCH_METHOD).
#define MIN_MARK_BOX_SIZE
GB_ERROR GB_export_error(const char *error)
Definition: arb_msg.cxx:259
char get_symbol(char left, char right, BI_PAIR_TYPE pair_type)
Definition: AW_helix.cxx:70
double AW_pos
Definition: aw_base.hxx:29
fflush(stdout)
int SEQ_TERM_TEXT_YOFFSET
Definition: ED4_main.cxx:53
int helix_spacing
Definition: ed4_class.hxx:1445
bool inside_species_seq_manager() const
Definition: ed4_class.hxx:1845
int convert(char c, int pos) const
GBDATA * get_gb_main() const
Definition: ed4_class.hxx:1420
int sequence_to_screen(int sequence_pos) const
int GB_read_security_write(GBDATA *gbd)
Definition: arbdb.cxx:1570
int GBT_get_color_group(GBDATA *gb_item)
Definition: ad_colorset.cxx:16
GB_BUFFER GB_give_buffer(size_t size)
Definition: arbdb.cxx:305
char char_2_char[256]
#define AWAR_PROTVIEW_DISPLAY_OPTIONS
static void error(const char *msg)
Definition: mkptypes.cxx:96
void expand_to_length(int len)
char * buildColorString(const ED4_sequence_terminal *seq_terminal, int start, int end)
ED4_root_group_manager * root_group_man
Definition: ed4_class.hxx:1430
static char * header_text
Definition: arb_a2ps.c:321
bool is_unlimited() const
Definition: pos_range.h:75
bool ED4_get_selected_range(ED4_terminal *term, PosRange &range)
Definition: ED4_block.cxx:352
size_t size() const
Definition: BI_helix.hxx:88
#define CHARACTEROFFSET
Definition: ed4_defs.hxx:110
PFOLD_MATCH_METHOD
Defines the methods for match computation. For details refer to ED4_pfold_calculate_secstruct_match()...
int GB_read_flag(GBDATA *gbd)
Definition: arbdb.cxx:2784
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
char char_2_gc[256]
GB_ERROR GB_pop_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2512
const ConsensusBuildParams & get_consensus_params()
ED4_extension extension
Definition: ed4_class.hxx:923
static bool ED4_show_helix_on_device(AW_device *device, int gc, const char *helixBuffer, size_t helixStart, size_t helixLen, const AW::Position &pos, AW_CL cduser)
GB_alignment_type
Definition: arbdb_base.h:61
bool visualizeSAI_allSpecies
Definition: ed4_class.hxx:1455
TYPE * ARB_calloc(size_t nelem)
Definition: arb_mem.h:81
bool visualizeSAI
Definition: ed4_class.hxx:1454
int MAXSEQUENCECHARACTERLENGTH
Definition: ED4_main.cxx:55
#define PFOLD_AWAR_ENABLE
Enable structure match.
BI_PAIR_TYPE pairtype(size_t pos) const
Definition: BI_helix.hxx:101
long AW_CL
Definition: cb.h:21
bool AW_color_groups_active()
Definition: AW_preset.cxx:1163
ED4_window * current_ed4w()
Definition: ed4_class.hxx:1397
ED4_seq_colors * sequence_colors
Definition: ed4_class.hxx:1441
AW_root * aw_root
Definition: ed4_class.hxx:1423
const AW_bitset AW_ALL_DEVICES_UNSCALED
Definition: aw_device.hxx:46
static bool ED4_show_protein_match_on_device(AW_device *device, int gc, const char *pfoldBuffer, size_t pfoldStart, size_t pfoldLen, const AW::Position &pos, AW_CL cl_protstruct)
void aw_message(const char *msg)
Definition: AW_status.cxx:932
bool arc(int gc, AW::FillStyle filled, AW_pos x0, AW_pos y0, AW_pos xradius, AW_pos yradius, int start_degrees, int arc_degrees, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
Definition: aw_device.hxx:493
ED4_species_manager * containing_species_manager() const
Definition: ed4_class.hxx:1829
#define NULp
Definition: cxxforward.h:97
GB_alignment_type GetAliType() FINAL_OVERRIDE
Definition: ed4_class.hxx:1993
const ED4_remap * remap() const
Definition: ed4_class.hxx:1780
int end() const
Definition: pos_range.h:61
void build_consensus_string_to(char *consensus_string, ExplicitRange range, const ConsensusBuildParams &BK) const
Definition: chartable.cxx:386
char * resolve_pointer_to_string_copy(int *str_len=NULp) const FINAL_OVERRIDE
char char_2_gc_aa[256]
AP_tree * STAT_find_node_by_name(ST_ML *st_ml, const char *species_name)
Definition: ST_window.cxx:127
GB_transaction ta(gb_var)
ST_ML_Color * STAT_get_color_string(ST_ML *st_ml, char *species_name, AP_tree *node, int start_ali_pos, int end_ali_pos)
Definition: ST_window.cxx:118
bool box(int gc, AW::FillStyle filled, const AW::Rectangle &rect, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
Definition: aw_device.hxx:471
int INFO_TERM_TEXT_YOFFSET
Definition: ED4_main.cxx:52
GB_ERROR ED4_pfold_calculate_secstruct_match(const unsigned char *structure_sai, const unsigned char *structure_cmp, const int start, const int end, char *result_buffer, PFOLD_MATCH_METHOD match_method)
Compares a protein secondary structure with a primary structure or another secondary structure...
ED4_manager * get_parent(ED4_level lev) const
Definition: ed4_class.hxx:1820
#define min(a, b)
Definition: f2c.h:153
bool text(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment=0.0, AW_bitset filteri=AW_ALL_DEVICES_UNSCALED)
Definition: aw_device.hxx:440
void set_vertical_font_overlap(bool allow)
Definition: aw_device.hxx:258
int is_species_name_terminal() const
Definition: ed4_class.hxx:1079
ST_ML * st_ml
Definition: ed4_class.hxx:1443
bool text_overlay(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment, AW_bitset filteri, TextOverlayCallback toc, AW_CL cduser=0)
Definition: AW_device.cxx:107
Adds support for protein structure prediction, comparison of two protein secondary structures and of ...