| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : DI_view_matrix.cxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #include "di_view_matrix.hxx" |
|---|
| 12 | #include "di_matr.hxx" |
|---|
| 13 | #include "dist.hxx" |
|---|
| 14 | |
|---|
| 15 | #include <aw_awars.hxx> |
|---|
| 16 | #include <aw_preset.hxx> |
|---|
| 17 | #include <aw_msg.hxx> |
|---|
| 18 | #include <aw_root.hxx> |
|---|
| 19 | |
|---|
| 20 | #include <awt_canvas.hxx> |
|---|
| 21 | |
|---|
| 22 | #include <arb_algo.h> |
|---|
| 23 | |
|---|
| 24 | #define AWAR_MATRIX "matrix/" |
|---|
| 25 | #define AWAR_MATRIX_PADDING AWAR_MATRIX "padding" |
|---|
| 26 | #define AWAR_MATRIX_SHOWZERO AWAR_MATRIX "show_zero" |
|---|
| 27 | #define AWAR_MATRIX_DIGITS AWAR_MATRIX "show_digits" |
|---|
| 28 | #define AWAR_MATRIX_NAMECHARS_TOP AWAR_MATRIX "namechars_top" |
|---|
| 29 | #define AWAR_MATRIX_NAMECHARS_LEFT AWAR_MATRIX "namechars_left" |
|---|
| 30 | |
|---|
| 31 | static void vertical_change_cb (AW_window *aww, DI_dmatrix *dis) { dis->monitor_vertical_scroll_cb(aww); } |
|---|
| 32 | static void horizontal_change_cb(AW_window *aww, DI_dmatrix *dis) { dis->monitor_horizontal_scroll_cb(aww); } |
|---|
| 33 | |
|---|
| 34 | static void redisplay_needed(AW_window *, DI_dmatrix *dis) { |
|---|
| 35 | dis->display(true); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | static void reinit_needed(AW_root *, AW_CL cl_dis) { |
|---|
| 39 | DI_dmatrix *dis = (DI_dmatrix*)cl_dis; |
|---|
| 40 | dis->init(); |
|---|
| 41 | dis->display(false); |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | static void resize_needed(AW_window *, DI_dmatrix *dis) { |
|---|
| 45 | dis->init(); |
|---|
| 46 | dis->resized(); |
|---|
| 47 | dis->display(false); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | DI_dmatrix::DI_dmatrix() { |
|---|
| 51 | memset((char *) this, 0, sizeof(DI_dmatrix)); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | void DI_dmatrix::init (DI_MATRIX *matrix) { |
|---|
| 55 | di_matrix = matrix; |
|---|
| 56 | DI_MATRIX *m = get_matrix(); |
|---|
| 57 | |
|---|
| 58 | AW_root *awr = awm->get_root(); |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | leadZero = awr->awar(AWAR_MATRIX_SHOWZERO)->read_int(); |
|---|
| 62 | digits = awr->awar(AWAR_MATRIX_DIGITS)->read_int(); |
|---|
| 63 | |
|---|
| 64 | sprintf(format_string, "%%%i.%if", digits+2, digits); |
|---|
| 65 | |
|---|
| 66 | // calculate cell width and height |
|---|
| 67 | { |
|---|
| 68 | cell_width = 0; |
|---|
| 69 | cell_height = 0; |
|---|
| 70 | |
|---|
| 71 | int max_chars[DI_G_LAST+1]; |
|---|
| 72 | memset(max_chars, 0, sizeof(*max_chars)*(DI_G_LAST+1)); |
|---|
| 73 | |
|---|
| 74 | max_chars[DI_G_STANDARD] = leadZero+2; // standard cell contains "0.0", "1.0" or "---" |
|---|
| 75 | max_chars[DI_G_BELOW_DIST] = leadZero+1+digits; // size of numeric distance |
|---|
| 76 | max_chars[DI_G_ABOVE_DIST] = max_chars[DI_G_BELOW_DIST]; |
|---|
| 77 | max_chars[DI_G_NAMES] = awr->awar(AWAR_MATRIX_NAMECHARS_TOP)->read_int(); |
|---|
| 78 | |
|---|
| 79 | for (DI_gc gc=DI_G_STANDARD; gc<=DI_G_LAST; gc = DI_gc(int(gc)+1)) { |
|---|
| 80 | if (max_chars[gc]) { |
|---|
| 81 | const AW_font_limits& lim = device->get_font_limits(gc, 0); |
|---|
| 82 | |
|---|
| 83 | cell_width = std::max(cell_width, lim.width*max_chars[gc]); |
|---|
| 84 | cell_height = std::max(cell_height, int(lim.height)); |
|---|
| 85 | } |
|---|
| 86 | } |
|---|
| 87 | // ensure cell-dimensions are > 0 |
|---|
| 88 | AW_awar *pad_awar = awr->awar(AWAR_MATRIX_PADDING); |
|---|
| 89 | cell_padd = pad_awar->read_int(); |
|---|
| 90 | |
|---|
| 91 | if (cell_padd<0) { |
|---|
| 92 | bool update = false; |
|---|
| 93 | if (-cell_padd >= cell_width) { |
|---|
| 94 | cell_padd = -cell_width+1; |
|---|
| 95 | update = true; |
|---|
| 96 | } |
|---|
| 97 | if (-cell_padd >= cell_height) { |
|---|
| 98 | cell_padd = -cell_height+1; |
|---|
| 99 | update = true; |
|---|
| 100 | } |
|---|
| 101 | if (update) pad_awar->write_int(cell_padd); |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | cell_width += cell_padd; |
|---|
| 105 | cell_height += cell_padd; |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | { |
|---|
| 109 | const AW_font_limits& lim = device->get_font_limits(DI_G_NAMES, 0); |
|---|
| 110 | |
|---|
| 111 | off_dx = awr->awar(AWAR_MATRIX_NAMECHARS_LEFT)->read_int() * lim.width + 1 + cell_padd; |
|---|
| 112 | off_dy = lim.height + cell_height; // off_dy corresponds to "lower" y of cell |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | if (m) { |
|---|
| 116 | total_cells_horiz=m->nentries; |
|---|
| 117 | total_cells_vert=m->nentries; |
|---|
| 118 | } |
|---|
| 119 | set_scrollbar_steps(cell_width, cell_height, 50, 50); |
|---|
| 120 | resized(); // initialize window_size dependent parameters |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | DI_MATRIX *DI_dmatrix::get_matrix() { |
|---|
| 124 | if (di_matrix) return di_matrix; |
|---|
| 125 | return GLOBAL_MATRIX.get(); |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | void DI_dmatrix::resized() { |
|---|
| 129 | const AW_font_limits& lim = device->get_font_limits(DI_G_STANDARD, 0); |
|---|
| 130 | |
|---|
| 131 | DI_MATRIX *m = get_matrix(); |
|---|
| 132 | long n = 0; |
|---|
| 133 | |
|---|
| 134 | if (m) n = m->nentries; |
|---|
| 135 | |
|---|
| 136 | const AW_screen_area& squ = device->get_area_size(); |
|---|
| 137 | screen_width = squ.r-squ.l; |
|---|
| 138 | screen_height = squ.b-squ.t; |
|---|
| 139 | |
|---|
| 140 | long horiz_paint_size, vert_paint_size; |
|---|
| 141 | AW_screen_area rect; // @@@ used uninitialized if !m |
|---|
| 142 | if (m) { |
|---|
| 143 | horiz_paint_size = (squ.r-lim.width-off_dx)/cell_width; |
|---|
| 144 | vert_paint_size = (squ.b-off_dy)/cell_height; |
|---|
| 145 | horiz_page_size = (n > horiz_paint_size) ? horiz_paint_size : n; |
|---|
| 146 | vert_page_size = (n > vert_paint_size) ? vert_paint_size : n; |
|---|
| 147 | |
|---|
| 148 | rect.l = 0; |
|---|
| 149 | rect.t = 0; |
|---|
| 150 | rect.r = (int)((n-horiz_page_size)*cell_width+squ.r); |
|---|
| 151 | rect.b = (int)((n-vert_page_size)*cell_height+squ.b); |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | horiz_page_start = 0; |
|---|
| 155 | horiz_last_view_start = 0; |
|---|
| 156 | vert_page_start = 0; |
|---|
| 157 | vert_last_view_start = 0; |
|---|
| 158 | |
|---|
| 159 | device->reset(); // clip_size == device_size |
|---|
| 160 | device->clear(-1); |
|---|
| 161 | device->set_right_clip_border((int)(off_dx+cell_width*horiz_page_size)); |
|---|
| 162 | device->reset(); // reset shift_x and shift_y |
|---|
| 163 | awm->set_vertical_scrollbar_position(0); |
|---|
| 164 | awm->set_horizontal_scrollbar_position(0); |
|---|
| 165 | awm->tell_scrolled_picture_size(rect); |
|---|
| 166 | awm->calculate_scrollbars(); |
|---|
| 167 | if (!awm->is_shown() && m) { |
|---|
| 168 | awm->show(); |
|---|
| 169 | } |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | enum ClickAction { |
|---|
| 173 | CLICK_SELECT_SPECIES = 1, |
|---|
| 174 | CLICK_SET_MINMAX, |
|---|
| 175 | }; |
|---|
| 176 | |
|---|
| 177 | #define MINMAX_GRANULARITY 10000L |
|---|
| 178 | #define ROUNDUP 0.00005 // in order to round to 4 digits |
|---|
| 179 | |
|---|
| 180 | void DI_dmatrix::scroll_to(int sxpos, int sypos) { |
|---|
| 181 | sxpos = force_in_range(0, sxpos, int(awm->get_scrolled_picture_width())-screen_width); |
|---|
| 182 | sypos = force_in_range(0, sypos, int(awm->get_scrolled_picture_height())-screen_height); |
|---|
| 183 | |
|---|
| 184 | awm->set_horizontal_scrollbar_position(sxpos); |
|---|
| 185 | awm->set_vertical_scrollbar_position(sypos); |
|---|
| 186 | |
|---|
| 187 | monitor_vertical_scroll_cb(awm); |
|---|
| 188 | monitor_horizontal_scroll_cb(awm); |
|---|
| 189 | } |
|---|
| 190 | |
|---|
| 191 | void DI_dmatrix::scroll_cells(int cells_x, int cells_y) { |
|---|
| 192 | scroll_to(awm->slider_pos_horizontal + cells_x*cell_width, |
|---|
| 193 | awm->slider_pos_vertical + cells_y*cell_height); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | void DI_dmatrix::handle_move(AW_event& event) { |
|---|
| 197 | static int clickx, clicky; // original click pos |
|---|
| 198 | static int startx, starty; // original slider position |
|---|
| 199 | |
|---|
| 200 | if (event.type == AW_Mouse_Press) { |
|---|
| 201 | clickx = event.x; |
|---|
| 202 | clicky = event.y; |
|---|
| 203 | |
|---|
| 204 | startx = awm->slider_pos_horizontal; |
|---|
| 205 | starty = awm->slider_pos_vertical; |
|---|
| 206 | } |
|---|
| 207 | else if (event.type == AW_Mouse_Drag || event.type == AW_Mouse_Release) { |
|---|
| 208 | int x_screen_diff = clickx - event.x; |
|---|
| 209 | int y_screen_diff = clicky - event.y; |
|---|
| 210 | |
|---|
| 211 | scroll_to(startx + x_screen_diff, starty + y_screen_diff); |
|---|
| 212 | } |
|---|
| 213 | } |
|---|
| 214 | |
|---|
| 215 | static void motion_cb(AW_window *aww, AW_CL cl_dmatrix, AW_CL) { |
|---|
| 216 | AW_event event; |
|---|
| 217 | aww->get_event(&event); |
|---|
| 218 | |
|---|
| 219 | DI_dmatrix *dmatrix = reinterpret_cast<DI_dmatrix*>(cl_dmatrix); |
|---|
| 220 | if (event.button == AW_BUTTON_MIDDLE) { |
|---|
| 221 | dmatrix->handle_move(event); |
|---|
| 222 | } |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | static void input_cb(AW_window *aww, AW_CL cl_dmatrix, AW_CL) { |
|---|
| 226 | AW_event event; |
|---|
| 227 | aww->get_event(&event); |
|---|
| 228 | |
|---|
| 229 | DI_dmatrix *dmatrix = reinterpret_cast<DI_dmatrix*>(cl_dmatrix); |
|---|
| 230 | |
|---|
| 231 | if (event.button == AW_WHEEL_UP || event.button == AW_WHEEL_DOWN) { |
|---|
| 232 | if (event.type == AW_Mouse_Press) { |
|---|
| 233 | bool horizontal = event.keymodifier & AW_KEYMODE_ALT; |
|---|
| 234 | int direction = event.button == AW_WHEEL_UP ? -1 : 1; |
|---|
| 235 | dmatrix->scroll_cells(horizontal*direction, !horizontal*direction); |
|---|
| 236 | } |
|---|
| 237 | } |
|---|
| 238 | else if (event.button == AW_BUTTON_MIDDLE) { |
|---|
| 239 | dmatrix->handle_move(event); |
|---|
| 240 | } |
|---|
| 241 | else { |
|---|
| 242 | AW_device_click *click_device = aww->get_click_device(AW_MIDDLE_AREA, event.x, event.y, 20, 20, 0); |
|---|
| 243 | |
|---|
| 244 | click_device->set_filter(AW_CLICK); |
|---|
| 245 | click_device->reset(); |
|---|
| 246 | |
|---|
| 247 | { |
|---|
| 248 | AW_device *oldMatrixDevice = dmatrix->device; |
|---|
| 249 | |
|---|
| 250 | dmatrix->device = click_device; |
|---|
| 251 | dmatrix->display(false); // detect clicked element |
|---|
| 252 | dmatrix->device = oldMatrixDevice; |
|---|
| 253 | } |
|---|
| 254 | |
|---|
| 255 | if (event.type == AW_Mouse_Press) { |
|---|
| 256 | AW_clicked_text clicked_text; |
|---|
| 257 | AW_clicked_line clicked_line; |
|---|
| 258 | click_device->get_clicked_text(&clicked_text); |
|---|
| 259 | click_device->get_clicked_line(&clicked_line); |
|---|
| 260 | |
|---|
| 261 | AW_CL cd1, cd2; |
|---|
| 262 | if (AW_getBestClick(&clicked_line, &clicked_text, &cd1, &cd2)) { |
|---|
| 263 | ClickAction action = static_cast<ClickAction>(cd1); |
|---|
| 264 | |
|---|
| 265 | if (action == CLICK_SELECT_SPECIES) { |
|---|
| 266 | long idx = long(cd2); |
|---|
| 267 | DI_MATRIX *matrix = dmatrix->get_matrix(); |
|---|
| 268 | if (idx >= matrix->nentries) { |
|---|
| 269 | aw_message(GBS_global_string("Illegal idx %li [allowed: 0-%li]", idx, matrix->nentries)); |
|---|
| 270 | } |
|---|
| 271 | else { |
|---|
| 272 | DI_ENTRY *entry = matrix->entries[idx]; |
|---|
| 273 | const char *species_name = entry->name; |
|---|
| 274 | |
|---|
| 275 | aww->get_root()->awar(AWAR_SPECIES_NAME)->write_string(species_name); |
|---|
| 276 | } |
|---|
| 277 | } |
|---|
| 278 | else if (action == CLICK_SET_MINMAX) { |
|---|
| 279 | AW_root *aw_root = aww->get_root(); |
|---|
| 280 | AW_awar *awar_bound = 0; |
|---|
| 281 | |
|---|
| 282 | switch (event.button) { |
|---|
| 283 | case AW_BUTTON_LEFT: awar_bound = aw_root->awar(AWAR_DIST_MIN_DIST); break; |
|---|
| 284 | case AW_BUTTON_RIGHT: awar_bound = aw_root->awar(AWAR_DIST_MAX_DIST); break; |
|---|
| 285 | default: break; |
|---|
| 286 | } |
|---|
| 287 | |
|---|
| 288 | if (awar_bound) { |
|---|
| 289 | double val = double(cd2)/MINMAX_GRANULARITY; |
|---|
| 290 | awar_bound->write_float(val); |
|---|
| 291 | } |
|---|
| 292 | } |
|---|
| 293 | } |
|---|
| 294 | } |
|---|
| 295 | } |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | void DI_dmatrix::display(bool clear) { |
|---|
| 299 | // draw matrix |
|---|
| 300 | |
|---|
| 301 | long x, y, xpos, ypos; |
|---|
| 302 | GB_transaction dummy(GLOBAL_gb_main); |
|---|
| 303 | |
|---|
| 304 | if (!device) return; |
|---|
| 305 | |
|---|
| 306 | DI_MATRIX *m = get_matrix(); |
|---|
| 307 | if (!m) { |
|---|
| 308 | if (awm) awm->hide(); |
|---|
| 309 | return; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | if (clear) device->clear(-1); |
|---|
| 313 | device->set_offset(AW::Vector(off_dx, off_dy)); |
|---|
| 314 | xpos = 0; |
|---|
| 315 | |
|---|
| 316 | char *selSpecies = 0; |
|---|
| 317 | if (awm) selSpecies = awm->get_root()->awar(AWAR_SPECIES_NAME)->read_string(); |
|---|
| 318 | |
|---|
| 319 | int name_display_width_top; |
|---|
| 320 | int name_display_width_left; |
|---|
| 321 | { |
|---|
| 322 | const AW_font_limits& lim = device->get_font_limits(DI_G_NAMES, 0); |
|---|
| 323 | |
|---|
| 324 | name_display_width_top = (cell_width-1)/lim.width; |
|---|
| 325 | name_display_width_left = (off_dx-1)/lim.width; |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | int BUFLEN = std::max(200, std::max(name_display_width_left, name_display_width_top)); |
|---|
| 329 | char buf[BUFLEN]; |
|---|
| 330 | |
|---|
| 331 | int sel_x_pos = -1; |
|---|
| 332 | |
|---|
| 333 | // device->set_line_attributes(DI_G_RULER, 1, AW_SOLID); // @@@ try AW_DOTTED here (need merges from dev!) |
|---|
| 334 | |
|---|
| 335 | for (x = horiz_page_start; |
|---|
| 336 | x < (horiz_page_start + horiz_page_size) && (x < total_cells_horiz); |
|---|
| 337 | x++) |
|---|
| 338 | { |
|---|
| 339 | ypos = 0; |
|---|
| 340 | for (y = vert_page_start; |
|---|
| 341 | y < (vert_page_start + vert_page_size) && (y < total_cells_vert); |
|---|
| 342 | y++) |
|---|
| 343 | { |
|---|
| 344 | bool is_identity = (x == y); |
|---|
| 345 | |
|---|
| 346 | // lower(!) left corner of cell: |
|---|
| 347 | AW_pos cellx = xpos*cell_width; |
|---|
| 348 | AW_pos celly = ypos*cell_height; |
|---|
| 349 | |
|---|
| 350 | if (is_identity) { |
|---|
| 351 | device->text(DI_G_STANDARD, "---"+(1-leadZero), cellx, celly); |
|---|
| 352 | } |
|---|
| 353 | else { |
|---|
| 354 | double val2 = m->matrix->get(x, y); |
|---|
| 355 | AW_click_cd cd(device, CLICK_SET_MINMAX, val2*MINMAX_GRANULARITY+1); |
|---|
| 356 | |
|---|
| 357 | if (val2>=min_view_dist && val2<=max_view_dist) { // display ruler |
|---|
| 358 | int maxw = cell_width-cell_padd; |
|---|
| 359 | |
|---|
| 360 | int h = cell_height - cell_padd-1; |
|---|
| 361 | |
|---|
| 362 | int hbox, hruler; |
|---|
| 363 | if (cell_padd >= 0) { |
|---|
| 364 | hbox = h*2/3; |
|---|
| 365 | hruler = h-hbox; |
|---|
| 366 | } |
|---|
| 367 | else { |
|---|
| 368 | hbox = h; |
|---|
| 369 | hruler = 0; |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | int y1 = celly - h; |
|---|
| 373 | int y2 = y1+hbox; |
|---|
| 374 | int y3 = y2+hruler/2; |
|---|
| 375 | int y4 = y2+hruler; |
|---|
| 376 | int x2 = cellx; |
|---|
| 377 | |
|---|
| 378 | double len = ((val2-min_view_dist)/(max_view_dist-min_view_dist)) * maxw; |
|---|
| 379 | if (len >= 0) { |
|---|
| 380 | device->box(DI_G_RULER_DISPLAY, true, x2, y1, int(len+0.5), hbox); |
|---|
| 381 | } |
|---|
| 382 | else { |
|---|
| 383 | device->text(DI_G_STANDARD, "???", cellx, celly); |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | if (hruler) { // do not paint ruler if cell_padd is negative |
|---|
| 387 | double v; |
|---|
| 388 | int cnt; |
|---|
| 389 | int maxx = x2+maxw-1; |
|---|
| 390 | for (v = x2, cnt = 0; v < x2 + maxw; v += maxw * .24999, ++cnt) { |
|---|
| 391 | int xr = std::min(int(v+0.5), maxx); |
|---|
| 392 | device->line(DI_G_RULER, xr, (cnt&1) ? y3 : y2, xr, y4); |
|---|
| 393 | } |
|---|
| 394 | device->line(DI_G_RULER, x2, y4, maxx, y4); |
|---|
| 395 | } |
|---|
| 396 | } |
|---|
| 397 | else { |
|---|
| 398 | DI_gc gc; |
|---|
| 399 | if (val2 == 0.0) { |
|---|
| 400 | strcpy(buf, "0.0"); |
|---|
| 401 | gc = DI_G_STANDARD; |
|---|
| 402 | } |
|---|
| 403 | else if (val2 == 1.0) { |
|---|
| 404 | strcpy(buf, leadZero ? "1.0" : " 1"); |
|---|
| 405 | gc = DI_G_STANDARD; |
|---|
| 406 | } |
|---|
| 407 | else { |
|---|
| 408 | sprintf(buf, format_string, val2); |
|---|
| 409 | gc = val2<min_view_dist ? DI_G_BELOW_DIST : DI_G_ABOVE_DIST; |
|---|
| 410 | } |
|---|
| 411 | device->text(gc, leadZero ? buf : buf+1, cellx, celly); |
|---|
| 412 | } |
|---|
| 413 | } |
|---|
| 414 | ypos++; |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | // display horizontal (top) speciesnames: |
|---|
| 418 | strcpy(buf, m->entries[x]->name); |
|---|
| 419 | if (selSpecies && strcmp(buf, selSpecies) == 0) sel_x_pos = xpos; // remember x-position for selected species |
|---|
| 420 | buf[name_display_width_top] = 0; // cut group-names if too long |
|---|
| 421 | |
|---|
| 422 | AW_click_cd cd(device, CLICK_SELECT_SPECIES, x); |
|---|
| 423 | device->text(DI_G_NAMES, buf, xpos * cell_width, cell_height - off_dy); |
|---|
| 424 | |
|---|
| 425 | xpos++; |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | device->set_offset(AW::Vector(off_dx, 0)); |
|---|
| 429 | |
|---|
| 430 | AW::Rectangle area(device->get_area_size(), AW::INCLUSIVE_OUTLINE); |
|---|
| 431 | |
|---|
| 432 | // highlight selected species (vertically) |
|---|
| 433 | if (sel_x_pos != -1) { |
|---|
| 434 | AW_pos linex1 = sel_x_pos*cell_width - cell_padd/2-1; |
|---|
| 435 | AW_pos linex2 = linex1+cell_width; |
|---|
| 436 | AW_pos height = area.height(); |
|---|
| 437 | device->line(DI_G_STANDARD, linex1, 0, linex1, height); |
|---|
| 438 | device->line(DI_G_STANDARD, linex2, 0, linex2, height); |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | device->set_offset(AW::Vector(0, off_dy)); |
|---|
| 442 | |
|---|
| 443 | // display vertical (left) speciesnames |
|---|
| 444 | ypos = 0; |
|---|
| 445 | int sel_y_pos = -1; |
|---|
| 446 | for (y = vert_page_start; y < vert_page_start + vert_page_size; y++) { |
|---|
| 447 | strcpy(buf, m->entries[y]->name); |
|---|
| 448 | if (selSpecies && strcmp(buf, selSpecies) == 0) sel_y_pos = ypos; // remember x-position for selected species |
|---|
| 449 | buf[name_display_width_left] = 0; // cut group-names if too long |
|---|
| 450 | AW_click_cd cd(device, CLICK_SELECT_SPECIES, y); |
|---|
| 451 | device->text(DI_G_NAMES, buf, 0, ypos * cell_height); |
|---|
| 452 | ypos++; |
|---|
| 453 | } |
|---|
| 454 | |
|---|
| 455 | // highlight selected species (horizontally) |
|---|
| 456 | if (sel_y_pos != -1) { |
|---|
| 457 | AW_pos liney2 = sel_y_pos*cell_height + cell_padd/2+1; |
|---|
| 458 | AW_pos liney1 = liney2-cell_height; |
|---|
| 459 | AW_pos width = area.width(); |
|---|
| 460 | device->line(DI_G_STANDARD, 0, liney1, width, liney1); |
|---|
| 461 | device->line(DI_G_STANDARD, 0, liney2, width, liney2); |
|---|
| 462 | } |
|---|
| 463 | |
|---|
| 464 | device->set_offset(AW::Vector(0, 0)); |
|---|
| 465 | #undef BUFLEN |
|---|
| 466 | } |
|---|
| 467 | |
|---|
| 468 | void DI_dmatrix::set_scrollbar_steps(long width_h, long width_v, long page_h, long page_v) |
|---|
| 469 | { |
|---|
| 470 | char buffer[200]; |
|---|
| 471 | |
|---|
| 472 | sprintf(buffer, "window/%s/scroll_width_horizontal", awm->window_defaults_name); |
|---|
| 473 | awm->get_root()->awar(buffer)->write_int(width_h); |
|---|
| 474 | sprintf(buffer, "window/%s/scroll_width_vertical", awm->window_defaults_name); |
|---|
| 475 | awm->get_root()->awar(buffer)->write_int(width_v); |
|---|
| 476 | sprintf(buffer, "window/%s/horizontal_page_increment", awm->window_defaults_name); |
|---|
| 477 | awm->get_root()->awar(buffer)->write_int(page_h); |
|---|
| 478 | sprintf(buffer, "window/%s/vertical_page_increment", awm->window_defaults_name); |
|---|
| 479 | awm->get_root()->awar(buffer)->write_int(page_v); |
|---|
| 480 | } |
|---|
| 481 | |
|---|
| 482 | #if defined(WARN_TODO) |
|---|
| 483 | #warning test scrolling again with fixed box_impl() |
|---|
| 484 | #endif |
|---|
| 485 | |
|---|
| 486 | #if defined(DEBUG) && 0 |
|---|
| 487 | #define DEBUG_GC DI_G_STANDARD |
|---|
| 488 | #endif |
|---|
| 489 | |
|---|
| 490 | void DI_dmatrix::monitor_vertical_scroll_cb(AW_window *aww) { // draw area |
|---|
| 491 | if (!device) return; |
|---|
| 492 | |
|---|
| 493 | int old_vert_page_start = vert_page_start; |
|---|
| 494 | |
|---|
| 495 | vert_last_view_start = aww->slider_pos_vertical; |
|---|
| 496 | vert_page_start = aww->slider_pos_vertical/cell_height; |
|---|
| 497 | |
|---|
| 498 | int diff = vert_page_start-old_vert_page_start; // amount of rows to scroll |
|---|
| 499 | if (diff) { |
|---|
| 500 | int diff_pix = abs(diff)*cell_height; |
|---|
| 501 | int top_y = off_dy-cell_height; |
|---|
| 502 | bool clear = false; |
|---|
| 503 | int keep_cells = vert_page_size-abs(diff); |
|---|
| 504 | int keep_pix = keep_cells*cell_height; |
|---|
| 505 | |
|---|
| 506 | if (diff>0 && diff<vert_page_size) { // scroll some positions up |
|---|
| 507 | device->move_region(0, top_y+diff_pix, screen_width, keep_pix, 0, top_y); |
|---|
| 508 | device->clear_part (0, top_y+keep_pix, screen_width, diff_pix, AW_SCREEN); |
|---|
| 509 | #if defined(DEBUG_GC) |
|---|
| 510 | device->box (DEBUG_GC, true, 0, top_y+keep_pix, screen_width, diff_pix); |
|---|
| 511 | #endif |
|---|
| 512 | device->push_clip_scale(); |
|---|
| 513 | device->set_top_clip_border(top_y+keep_pix, true); |
|---|
| 514 | } |
|---|
| 515 | else if (diff>-vert_page_size && diff<0) { // scroll some positions down |
|---|
| 516 | device->move_region(0, top_y, screen_width, keep_pix, 0, top_y+diff_pix); |
|---|
| 517 | device->clear_part (0, top_y, screen_width, diff_pix, AW_SCREEN); |
|---|
| 518 | #if defined(DEBUG_GC) |
|---|
| 519 | device->box (DEBUG_GC, true, 0, top_y, screen_width, diff_pix); |
|---|
| 520 | #endif |
|---|
| 521 | device->push_clip_scale(); |
|---|
| 522 | device->set_bottom_clip_border(top_y+diff_pix, true); |
|---|
| 523 | } |
|---|
| 524 | else { // repaint |
|---|
| 525 | device->push_clip_scale(); |
|---|
| 526 | clear = true; |
|---|
| 527 | } |
|---|
| 528 | |
|---|
| 529 | display(clear); |
|---|
| 530 | device->pop_clip_scale(); |
|---|
| 531 | } |
|---|
| 532 | } |
|---|
| 533 | |
|---|
| 534 | void DI_dmatrix::monitor_horizontal_scroll_cb(AW_window *aww) { // draw area |
|---|
| 535 | if (!device) return; |
|---|
| 536 | |
|---|
| 537 | int old_horiz_page_start = horiz_page_start; |
|---|
| 538 | |
|---|
| 539 | horiz_last_view_start = aww->slider_pos_horizontal; |
|---|
| 540 | horiz_page_start = aww->slider_pos_horizontal/cell_width; |
|---|
| 541 | |
|---|
| 542 | int diff = horiz_page_start-old_horiz_page_start; // amount of columns to scroll |
|---|
| 543 | |
|---|
| 544 | if (diff) { |
|---|
| 545 | bool clear = false; |
|---|
| 546 | int diff_pix = abs(diff)*cell_width; |
|---|
| 547 | int keep_cells = horiz_page_size-abs(diff); |
|---|
| 548 | int keep_pix = keep_cells*cell_width; |
|---|
| 549 | |
|---|
| 550 | if (diff>0 && diff<horiz_page_size) { // scroll some positions left |
|---|
| 551 | device->move_region(off_dx+diff_pix, 0, keep_pix, screen_height, off_dx, 0); |
|---|
| 552 | device->clear_part (off_dx+keep_pix, 0, diff_pix, screen_height, AW_SCREEN); |
|---|
| 553 | #if defined(DEBUG_GC) |
|---|
| 554 | device->box(DEBUG_GC, true, off_dx+keep_pix, 0, diff_pix, screen_height); |
|---|
| 555 | #endif |
|---|
| 556 | device->push_clip_scale(); |
|---|
| 557 | device->set_left_clip_border(keep_pix, true); |
|---|
| 558 | } |
|---|
| 559 | else if (diff>-horiz_page_size && diff<0) { // scroll some positions right |
|---|
| 560 | device->move_region(off_dx, 0, keep_pix, screen_height, off_dx+diff_pix, 0); |
|---|
| 561 | device->clear_part (off_dx, 0, diff_pix, screen_height, AW_SCREEN); |
|---|
| 562 | #if defined(DEBUG_GC) |
|---|
| 563 | device->box(DEBUG_GC, true, off_dx, 0, diff_pix, screen_height); |
|---|
| 564 | #endif |
|---|
| 565 | device->push_clip_scale(); |
|---|
| 566 | device->set_right_clip_border(off_dx+diff_pix, true); |
|---|
| 567 | } |
|---|
| 568 | else { // repaint |
|---|
| 569 | device->push_clip_scale(); |
|---|
| 570 | clear = true; |
|---|
| 571 | } |
|---|
| 572 | |
|---|
| 573 | display(clear); |
|---|
| 574 | device->pop_clip_scale(); |
|---|
| 575 | } |
|---|
| 576 | } |
|---|
| 577 | |
|---|
| 578 | static bool update_display_on_dist_change = true; |
|---|
| 579 | |
|---|
| 580 | static void di_view_set_max_d(AW_window *aww, AW_CL cl_max_d, AW_CL /* clmatr */) { |
|---|
| 581 | double max_d = cl_max_d*0.01; |
|---|
| 582 | AW_root *aw_root = aww->get_root(); |
|---|
| 583 | |
|---|
| 584 | { |
|---|
| 585 | LocallyModify<bool> flag(update_display_on_dist_change, false); |
|---|
| 586 | aw_root->awar(AWAR_DIST_MIN_DIST)->write_float(0.0); |
|---|
| 587 | } |
|---|
| 588 | aw_root->awar(AWAR_DIST_MAX_DIST)->write_float(max_d); |
|---|
| 589 | } |
|---|
| 590 | |
|---|
| 591 | static void di_view_set_distances(AW_root *awr, AW_CL cl_setmax, AW_CL cl_dmatrix) { |
|---|
| 592 | // cl_dmatrix: 0 -> set min and fix max, 1 -> set max and fix min, 2 -> set both |
|---|
| 593 | DI_dmatrix *dmatrix = (DI_dmatrix *)cl_dmatrix; |
|---|
| 594 | double max_dist = awr->awar(AWAR_DIST_MAX_DIST)->read_float(); |
|---|
| 595 | double min_dist = awr->awar(AWAR_DIST_MIN_DIST)->read_float(); |
|---|
| 596 | |
|---|
| 597 | { |
|---|
| 598 | LocallyModify<bool> flag(update_display_on_dist_change, false); |
|---|
| 599 | |
|---|
| 600 | switch (cl_setmax) { |
|---|
| 601 | case 2: // both |
|---|
| 602 | dmatrix->set_slider_max(max_dist); |
|---|
| 603 | // fall-through |
|---|
| 604 | case 0: // set min and fix max |
|---|
| 605 | dmatrix->set_slider_min(min_dist); |
|---|
| 606 | if (min_dist>max_dist) awr->awar(AWAR_DIST_MAX_DIST)->write_float(min_dist); |
|---|
| 607 | break; |
|---|
| 608 | case 1: // set max and fix min |
|---|
| 609 | dmatrix->set_slider_max(max_dist); |
|---|
| 610 | if (min_dist>max_dist) awr->awar(AWAR_DIST_MIN_DIST)->write_float(max_dist); |
|---|
| 611 | break; |
|---|
| 612 | |
|---|
| 613 | default: |
|---|
| 614 | di_assert(0); |
|---|
| 615 | break; |
|---|
| 616 | } |
|---|
| 617 | } |
|---|
| 618 | if (update_display_on_dist_change) dmatrix->display(true); |
|---|
| 619 | } |
|---|
| 620 | |
|---|
| 621 | static void di_change_dist(AW_window *aww, AW_CL cl_mode) { |
|---|
| 622 | AW_root *awr = aww->get_root(); |
|---|
| 623 | const char *awar_name; |
|---|
| 624 | |
|---|
| 625 | di_assert(cl_mode>=0 && cl_mode<=3); |
|---|
| 626 | |
|---|
| 627 | if (cl_mode<2) { // change min |
|---|
| 628 | awar_name = AWAR_DIST_MIN_DIST; |
|---|
| 629 | } |
|---|
| 630 | else { // change max |
|---|
| 631 | awar_name = AWAR_DIST_MAX_DIST; |
|---|
| 632 | } |
|---|
| 633 | |
|---|
| 634 | double dist = awr->awar(awar_name)->read_float(); |
|---|
| 635 | double increment = 0.01; |
|---|
| 636 | |
|---|
| 637 | if (cl_mode%2) increment = -increment; // decrement value |
|---|
| 638 | dist += increment; |
|---|
| 639 | if (!(dist<0)) awr->awar(awar_name)->write_float(dist); |
|---|
| 640 | } |
|---|
| 641 | |
|---|
| 642 | static void di_bind_dist_awars(AW_root *aw_root, DI_dmatrix *dmatrix) { |
|---|
| 643 | aw_root->awar_float(AWAR_DIST_MIN_DIST)->add_callback(di_view_set_distances, 0, (AW_CL)dmatrix); |
|---|
| 644 | aw_root->awar_float(AWAR_DIST_MAX_DIST)->add_callback(di_view_set_distances, 1, (AW_CL)dmatrix); |
|---|
| 645 | } |
|---|
| 646 | |
|---|
| 647 | static void create_matrix_awars(AW_root *awr, DI_dmatrix *dmatrix) { |
|---|
| 648 | awr->awar_int(AWAR_MATRIX_PADDING, 4)->add_callback(reinit_needed, (AW_CL)dmatrix); |
|---|
| 649 | awr->awar_int(AWAR_MATRIX_SHOWZERO, 1)->add_callback(reinit_needed, (AW_CL)dmatrix); |
|---|
| 650 | awr->awar_int(AWAR_MATRIX_DIGITS, 4)->add_callback(reinit_needed, (AW_CL)dmatrix); |
|---|
| 651 | awr->awar_int(AWAR_MATRIX_NAMECHARS_TOP, 8)->add_callback(reinit_needed, (AW_CL)dmatrix); |
|---|
| 652 | awr->awar_int(AWAR_MATRIX_NAMECHARS_LEFT, 10)->add_callback(reinit_needed, (AW_CL)dmatrix); |
|---|
| 653 | } |
|---|
| 654 | |
|---|
| 655 | static AW_window *create_matrix_settings_window(AW_root *awr) { |
|---|
| 656 | AW_window_simple *aws = new AW_window_simple; |
|---|
| 657 | aws->init(awr, "MATRIX_SETTINGS", "Matrix settings"); |
|---|
| 658 | |
|---|
| 659 | aws->auto_space(10, 10); |
|---|
| 660 | |
|---|
| 661 | aws->callback((AW_CB0)AW_POPDOWN); |
|---|
| 662 | aws->create_button("CLOSE", "CLOSE", "C"); |
|---|
| 663 | |
|---|
| 664 | aws->callback(AW_POPUP_HELP, (AW_CL)"matrix_settings.hlp"); |
|---|
| 665 | aws->create_button("HELP", "HELP"); |
|---|
| 666 | |
|---|
| 667 | aws->label_length(21); |
|---|
| 668 | |
|---|
| 669 | aws->at_newline(); |
|---|
| 670 | aws->label("Padding (pixels)"); |
|---|
| 671 | aws->create_input_field(AWAR_MATRIX_PADDING, 3); |
|---|
| 672 | |
|---|
| 673 | aws->at_newline(); |
|---|
| 674 | aws->label("Show leading zero"); |
|---|
| 675 | aws->create_toggle(AWAR_MATRIX_SHOWZERO); |
|---|
| 676 | |
|---|
| 677 | aws->at_newline(); |
|---|
| 678 | aws->label("Precision (digits)"); |
|---|
| 679 | aws->create_input_field(AWAR_MATRIX_DIGITS, 2); |
|---|
| 680 | |
|---|
| 681 | aws->at_newline(); |
|---|
| 682 | aws->label("Min. namechars (top)"); |
|---|
| 683 | aws->create_input_field(AWAR_MATRIX_NAMECHARS_TOP, 3); |
|---|
| 684 | |
|---|
| 685 | aws->at_newline(); |
|---|
| 686 | aws->label("Min. namechars (left)"); |
|---|
| 687 | aws->create_input_field(AWAR_MATRIX_NAMECHARS_LEFT, 3); |
|---|
| 688 | |
|---|
| 689 | aws->window_fit(); |
|---|
| 690 | return aws; |
|---|
| 691 | } |
|---|
| 692 | |
|---|
| 693 | static void selected_species_changed_cb(AW_root*, AW_CL cl_maxtrix_window, AW_CL cl_dmatrix) { |
|---|
| 694 | DI_dmatrix *dmatrix = (DI_dmatrix*)cl_dmatrix; |
|---|
| 695 | if (dmatrix) { |
|---|
| 696 | AW_window *awm = reinterpret_cast<AW_window*>(cl_maxtrix_window); |
|---|
| 697 | redisplay_needed(awm, dmatrix); |
|---|
| 698 | } |
|---|
| 699 | } |
|---|
| 700 | |
|---|
| 701 | AW_window *DI_create_view_matrix_window(AW_root *awr, DI_dmatrix *dmatrix, save_matrix_params *sparam) { |
|---|
| 702 | di_bind_dist_awars(awr, dmatrix); |
|---|
| 703 | create_matrix_awars(awr, dmatrix); |
|---|
| 704 | |
|---|
| 705 | AW_window_menu *awm = new AW_window_menu(); |
|---|
| 706 | awm->init(awr, "SHOW_MATRIX", "ARB_SHOW_MATRIX", 800, 600); |
|---|
| 707 | |
|---|
| 708 | dmatrix->device = awm->get_device(AW_MIDDLE_AREA); |
|---|
| 709 | dmatrix->awm = awm; |
|---|
| 710 | |
|---|
| 711 | AW_awar *awar_sel = awr->awar(AWAR_SPECIES_NAME); |
|---|
| 712 | awar_sel->add_callback(selected_species_changed_cb, (AW_CL)awm, (AW_CL)dmatrix); |
|---|
| 713 | |
|---|
| 714 | awm->set_vertical_change_callback ((AW_CB2)vertical_change_cb, (AW_CL)dmatrix, 0); |
|---|
| 715 | awm->set_horizontal_change_callback((AW_CB2)horizontal_change_cb, (AW_CL)dmatrix, 0); |
|---|
| 716 | |
|---|
| 717 | awm->set_resize_callback(AW_MIDDLE_AREA, (AW_CB2)resize_needed, (AW_CL)dmatrix, 0); |
|---|
| 718 | awm->set_expose_callback(AW_MIDDLE_AREA, (AW_CB2)redisplay_needed, (AW_CL)dmatrix, 0); |
|---|
| 719 | awm->set_input_callback (AW_MIDDLE_AREA, (AW_CB) input_cb, (AW_CL)dmatrix, 0); |
|---|
| 720 | awm->set_motion_callback(AW_MIDDLE_AREA, (AW_CB) motion_cb, (AW_CL)dmatrix, 0); |
|---|
| 721 | |
|---|
| 722 | AW_gc_manager preset_window = |
|---|
| 723 | AW_manage_GC(awm, dmatrix->device, DI_G_STANDARD, DI_G_LAST, AW_GCM_DATA_AREA, |
|---|
| 724 | (AW_CB)resize_needed, (AW_CL)dmatrix, 0, |
|---|
| 725 | false, |
|---|
| 726 | "#D0D0D0", |
|---|
| 727 | "#Standard$#000000", |
|---|
| 728 | "#Names$#000000", |
|---|
| 729 | "+-Ruler$#555", "-Display$#00AA55", |
|---|
| 730 | "#BelowDist$#008732", |
|---|
| 731 | "#AboveDist$#DB008D", |
|---|
| 732 | NULL); |
|---|
| 733 | |
|---|
| 734 | awm->create_menu("File", "F"); |
|---|
| 735 | awm->insert_menu_topic("save_matrix", "Save Matrix to File", "S", "save_matrix.hlp", AWM_ALL, AW_POPUP, (AW_CL)DI_create_save_matrix_window, (AW_CL)sparam); |
|---|
| 736 | awm->insert_menu_topic("close", "Close", "C", 0, AWM_ALL, (AW_CB)AW_POPDOWN, (AW_CL)0, 0); |
|---|
| 737 | |
|---|
| 738 | awm->create_menu("Range", "R"); |
|---|
| 739 | awm->insert_menu_topic("deselect_range", "Deselect range", "D", 0, AWM_ALL, di_view_set_max_d, 0, (AW_CL)dmatrix); |
|---|
| 740 | awm->insert_menu_topic("show_dist_species", "Species range [ <= 2% ]", "S", 0, AWM_ALL, di_view_set_max_d, 2, (AW_CL)dmatrix); |
|---|
| 741 | awm->insert_menu_topic("show_dist_genus", "Genus range [ <= 5% ]", "G", 0, AWM_ALL, di_view_set_max_d, 5, (AW_CL)dmatrix); |
|---|
| 742 | awm->insert_menu_topic("show_dist_010", "Range [ <= 10% ]", "1", 0, AWM_ALL, di_view_set_max_d, 10, (AW_CL)dmatrix); |
|---|
| 743 | awm->insert_menu_topic("show_dist_025", "Range [ <= 25% ]", "2", 0, AWM_ALL, di_view_set_max_d, 25, (AW_CL)dmatrix); |
|---|
| 744 | awm->insert_menu_topic("show_dist_050", "Range [ <= 50% ]", "5", 0, AWM_ALL, di_view_set_max_d, 50, (AW_CL)dmatrix); |
|---|
| 745 | awm->insert_menu_topic("show_dist_100", "Whole range [ 0-100% ]", "0", 0, AWM_ALL, di_view_set_max_d, 100, (AW_CL)dmatrix); |
|---|
| 746 | |
|---|
| 747 | awm->create_menu("Properties", "P"); |
|---|
| 748 | awm->insert_menu_topic("matrix_settings", "Settings ...", "S", "matrix_settings.hlp", AWM_ALL, AW_POPUP, (AW_CL)create_matrix_settings_window, (AW_CL)0); |
|---|
| 749 | awm->insert_menu_topic("matrix_colors", "Colors and Fonts ...", "C", "neprops_data.hlp", AWM_ALL, AW_POPUP, (AW_CL)AW_create_gc_window, (AW_CL)preset_window); |
|---|
| 750 | |
|---|
| 751 | int x, y; |
|---|
| 752 | awm->get_at_position(&x, &y); |
|---|
| 753 | awm->button_length(3); |
|---|
| 754 | |
|---|
| 755 | #define FIELD_XSIZE 160 |
|---|
| 756 | #define BUTTON_XSIZE 25 |
|---|
| 757 | |
|---|
| 758 | awm->label("Dist min:"); |
|---|
| 759 | awm->create_input_field(AWAR_DIST_MIN_DIST, 7); |
|---|
| 760 | x += FIELD_XSIZE; |
|---|
| 761 | |
|---|
| 762 | awm->at_x(x); |
|---|
| 763 | awm->callback(di_change_dist, 0); |
|---|
| 764 | awm->create_button("PLUS_MIN", "+"); |
|---|
| 765 | x += BUTTON_XSIZE; |
|---|
| 766 | |
|---|
| 767 | awm->at_x(x); |
|---|
| 768 | awm->callback(di_change_dist, 1); |
|---|
| 769 | awm->create_button("MINUS_MIN", "-"); |
|---|
| 770 | x += BUTTON_XSIZE; |
|---|
| 771 | |
|---|
| 772 | awm->at_x(x); |
|---|
| 773 | awm->label("Dist max:"); |
|---|
| 774 | awm->create_input_field(AWAR_DIST_MAX_DIST, 7); |
|---|
| 775 | x += FIELD_XSIZE; |
|---|
| 776 | |
|---|
| 777 | awm->at_x(x); |
|---|
| 778 | awm->callback(di_change_dist, 2); |
|---|
| 779 | awm->create_button("PLUS_MAX", "+"); |
|---|
| 780 | x += BUTTON_XSIZE; |
|---|
| 781 | |
|---|
| 782 | awm->at_x(x); |
|---|
| 783 | awm->callback(di_change_dist, 3); |
|---|
| 784 | awm->create_button("MINUS_MAX", "-"); |
|---|
| 785 | x += BUTTON_XSIZE; |
|---|
| 786 | |
|---|
| 787 | awm->set_info_area_height(40); |
|---|
| 788 | |
|---|
| 789 | dmatrix->init(dmatrix->di_matrix); |
|---|
| 790 | |
|---|
| 791 | di_view_set_distances(awm->get_root(), 2, AW_CL(dmatrix)); |
|---|
| 792 | |
|---|
| 793 | return awm; |
|---|
| 794 | } |
|---|