- Timestamp:
- 10/12/11 12:24:52 (6 months ago)
- Location:
- branches/e4fix/EDIT4
- Files:
-
- 6 modified
-
ED4_block.cxx (modified) (1 diff)
-
ED4_cursor.cxx (modified) (23 diffs)
-
ED4_no_class.cxx (modified) (14 diffs)
-
ED4_terminal.cxx (modified) (1 diff)
-
ED4_window.cxx (modified) (1 diff)
-
ed4_class.hxx (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/e4fix/EDIT4/ED4_block.cxx
r8275 r8293 211 211 for (CursorPositions::iterator ab = at_base.begin(); ab != at_base.end(); ++ab) { 212 212 ED4_window *win = ab->first; 213 win->cursor.jump_base_pos( win->aww,ab->second, ED4_JUMP_KEEP_VISIBLE); // restore cursor at same base213 win->cursor.jump_base_pos(ab->second, ED4_JUMP_KEEP_VISIBLE); // restore cursor at same base 214 214 215 215 #if defined(DEBUG) -
branches/e4fix/EDIT4/ED4_cursor.cxx
r8286 r8293 300 300 x = del_mark; 301 301 302 ED4_window *win = window();303 302 win->world_to_win_coords(&x, &y); 304 303 … … 363 362 364 363 #define EXPAND_SIZE 0 365 if ( current_device()->reduceClipBorders(ymin-EXPAND_SIZE, ymax+1+EXPAND_SIZE, xmin-EXPAND_SIZE, xmax+1+EXPAND_SIZE)) {364 if (window()->get_device()->reduceClipBorders(ymin-EXPAND_SIZE, ymax+1+EXPAND_SIZE, xmin-EXPAND_SIZE, xmax+1+EXPAND_SIZE)) { 366 365 // refresh terminal 367 366 int old_allowed_to_draw = allowed_to_draw; … … 376 375 377 376 378 ED4_cursor::ED4_cursor() 379 { 377 ED4_cursor::ED4_cursor(ED4_window *win_) : win(win_) { 380 378 init(); 381 379 allowed_to_draw = 1; … … 384 382 ctype = (ED4_CursorType)(ED4_ROOT->aw_root->awar(ED4_AWAR_CURSOR_TYPE)->read_int()%ED4_CURSOR_TYPES); 385 383 } 386 void ED4_cursor::init() // used by ED4_terminal-d-tor387 { 384 void ED4_cursor::init() { 385 // used by ED4_terminal-d-tor 388 386 owner_of_cursor = NULL; 389 387 cursor_abs_x = 0; 390 388 screen_position = 0; 391 389 } 392 ED4_cursor::~ED4_cursor() 393 { 390 ED4_cursor::~ED4_cursor() { 394 391 delete cursor_shape; 395 392 } 396 393 397 ED4_window *ED4_cursor::window() const { 398 ED4_window *win; 399 for (win=ED4_ROOT->first_window; win; win=win->next) { 400 if (&win->cursor==this) { 401 break; 402 } 403 } 404 e4_assert(win); 405 return win; 406 } 407 408 int ED4_cursor::get_sequence_pos() const 409 { 394 int ED4_cursor::get_sequence_pos() const { 410 395 ED4_remap *remap = ED4_ROOT->root_group_man->remap(); 411 396 size_t max_scrpos = remap->get_max_screen_pos(); … … 437 422 if (terminal) { 438 423 if (seq_pos == -1) seq_pos = cursor->get_sequence_pos(); 439 cursor->set_to_terminal( current_aww(),terminal, seq_pos, jump_type);424 cursor->set_to_terminal(terminal, seq_pos, jump_type); 440 425 return true; 441 426 } … … 825 810 void ED4_cursor::updateAwars() 826 811 { 827 AW_root *aw_root = ED4_ROOT->aw_root; 828 ED4_window *win = current_ed4w(); 829 int seq_pos = get_sequence_pos(); 812 AW_root *aw_root = ED4_ROOT->aw_root; 813 int seq_pos = get_sequence_pos(); 830 814 831 815 if (ED4_update_global_cursor_awars_allowed) { … … 947 931 return cursor_abs_x - coords->window_left_clip_point; 948 932 } 949 void ED4_cursor::set_screen_relative_pos( AW_window *aww,int scroll_to_relpos) {933 void ED4_cursor::set_screen_relative_pos(int scroll_to_relpos) { 950 934 int curr_rel_pos = get_screen_relative_pos(); 951 935 int scroll_amount = curr_rel_pos-scroll_to_relpos; … … 955 939 956 940 if (scroll_amount != 0) { 941 AW_window *aww = window()->aww; 957 942 aww->set_horizontal_scrollbar_position(aww->slider_pos_horizontal + scroll_amount); 958 943 #if defined(TRACE_JUMPS) … … 964 949 965 950 966 void ED4_cursor::jump_screen_pos( AW_window *aww,int screen_pos, ED4_CursorJumpType jump_type) {951 void ED4_cursor::jump_screen_pos(int screen_pos, ED4_CursorJumpType jump_type) { 967 952 if (!owner_of_cursor) { 968 953 aw_message("First you have to place the cursor"); … … 984 969 985 970 ED4_terminal *term = owner_of_cursor->to_terminal(); 986 term->scroll_into_view(aww); // correct y-position of terminal 971 ED4_window *ed4w = window(); 972 973 term->scroll_into_view(ed4w); // correct y-position of terminal 987 974 988 975 int cursor_diff = screen_pos-screen_position; … … 991 978 } 992 979 993 int terminal_pixel_length = aww->get_device(AW_MIDDLE_AREA)->get_string_size(ED4_G_SEQUENCES, 0, owner_of_cursor->to_text_terminal()->get_length());980 int terminal_pixel_length = ed4w->get_device()->get_string_size(ED4_G_SEQUENCES, 0, owner_of_cursor->to_text_terminal()->get_length()); 994 981 int length_of_char = ED4_ROOT->font_group.get_width(ED4_G_SEQUENCES); 995 982 int abs_x_new = cursor_abs_x+cursor_diff*length_of_char; // position in terminal … … 999 986 } 1000 987 1001 ED4_LocalWinContext uses(aww); 1002 ED4_coords *coords = ¤t_ed4w()->coords; 988 ED4_coords *coords = &ed4w->coords; 1003 989 1004 990 int screen_width = coords->window_right_clip_point-coords->window_left_clip_point; … … 1046 1032 scroll_amount = (scroll_amount/length_of_char)*length_of_char; // align to char-size 1047 1033 if (scroll_amount != 0) { 1034 AW_window *aww = ed4w->aww; 1048 1035 aww->set_horizontal_scrollbar_position(aww->slider_pos_horizontal + scroll_amount); 1049 1036 #if defined(TRACE_JUMPS) … … 1065 1052 } 1066 1053 1067 void ED4_cursor::jump_sequence_pos( AW_window *aww,int seq_pos, ED4_CursorJumpType jump_type) {1054 void ED4_cursor::jump_sequence_pos(int seq_pos, ED4_CursorJumpType jump_type) { 1068 1055 int screen_pos = ED4_ROOT->root_group_man->remap()->sequence_to_screen_clipped(seq_pos); 1069 jump_screen_pos( aww,screen_pos, jump_type);1070 } 1071 1072 void ED4_cursor::jump_base_pos( AW_window *aww,int base_pos, ED4_CursorJumpType jump_type) {1056 jump_screen_pos(screen_pos, jump_type); 1057 } 1058 1059 void ED4_cursor::jump_base_pos(int base_pos, ED4_CursorJumpType jump_type) { 1073 1060 int seq_pos = base2sequence_position(base_pos); 1074 jump_sequence_pos( aww,seq_pos, jump_type);1061 jump_sequence_pos(seq_pos, jump_type); 1075 1062 } 1076 1063 … … 1123 1110 1124 1111 if (result == ED4_R_OK) { 1125 AW_pos x_dummy, y_world; 1126 AW_window *aww = current_aww(); 1127 1112 AW_pos x_dummy, y_world; 1113 1128 1114 owner_of_cursor->calc_world_coords(&x_dummy, &y_world); 1129 1115 … … 1171 1157 1172 1158 if (target_terminal) { 1173 set_to_terminal( aww,target_terminal->to_terminal(), seq_pos, ED4_JUMP_KEEP_VISIBLE);1159 set_to_terminal(target_terminal->to_terminal(), seq_pos, ED4_JUMP_KEEP_VISIBLE); 1174 1160 } 1175 1161 } … … 1240 1226 switch (owner_of_cursor->get_area_level(0)) { 1241 1227 case ED4_A_TOP_AREA: { 1242 ED4_window *win = window();1243 1228 visible = 1244 1229 owner_of_cursor->is_visible(win, x1, 0, ED4_D_HORIZONTAL) || … … 1256 1241 } 1257 1242 1258 void ED4_terminal::scroll_into_view( AW_window *aww) { // scroll y-position only1259 ED4_LocalWinContext uses( aww);1243 void ED4_terminal::scroll_into_view(ED4_window *ed4w) { // scroll y-position only 1244 ED4_LocalWinContext uses(ed4w); 1260 1245 1261 1246 AW_pos termw_x, termw_y; … … 1300 1285 1301 1286 if (scroll) { 1287 AW_window *aww = ed4w->aww; 1288 1302 1289 int pic_ysize = int(aww->get_scrolled_picture_height()); 1303 1290 int slider_pos_yrange = pic_ysize - win_ysize; … … 1311 1298 } 1312 1299 1313 void ED4_cursor::set_to_terminal(AW_window *aww, ED4_terminal *terminal, int seq_pos, ED4_CursorJumpType jump_type) 1314 { 1300 void ED4_cursor::set_to_terminal(ED4_terminal *terminal, int seq_pos, ED4_CursorJumpType jump_type) { 1315 1301 if (seq_pos == -1) seq_pos = get_sequence_pos(); 1316 1302 1317 1303 if (owner_of_cursor == terminal) { 1318 jump_sequence_pos( aww,seq_pos, jump_type);1304 jump_sequence_pos(seq_pos, jump_type); 1319 1305 } 1320 1306 else { 1321 1307 if (owner_of_cursor) { 1322 1308 if (get_sequence_pos() != seq_pos) { 1323 jump_sequence_pos( aww,seq_pos, jump_type); // position to wanted column -- scrolls horizontally1309 jump_sequence_pos(seq_pos, jump_type); // position to wanted column -- scrolls horizontally 1324 1310 } 1325 1311 } … … 1329 1315 1330 1316 if (!is_partly_visible()) { 1331 #if defined(DEBUG) && 0 1332 printf("Cursor not visible in set_to_terminal (was drawn outside screen)\n"); 1333 #endif // DEBUG 1334 jump_sequence_pos(aww, seq_pos, jump_type); 1317 jump_sequence_pos(seq_pos, jump_type); 1335 1318 } 1336 1319 } … … 1354 1337 } 1355 1338 1356 target_terminal->scroll_into_view(current_ aww());1339 target_terminal->scroll_into_view(current_ed4w()); 1357 1340 1358 1341 AW_pos termw_x, termw_y; … … 1651 1634 if (pairType != HELIX_NONE) { 1652 1635 int pairing_pos = helix->opposite_position(seq_pos); 1653 cursor->jump_sequence_pos( aww,pairing_pos, ED4_JUMP_KEEP_POSITION);1636 cursor->jump_sequence_pos(pairing_pos, ED4_JUMP_KEEP_POSITION); 1654 1637 } 1655 1638 else { -
branches/e4fix/EDIT4/ED4_no_class.cxx
r8290 r8293 219 219 220 220 if (move_cursor) { 221 current_cursor().jump_sequence_pos( current_aww(),new_work_info.out_seq_position, ED4_JUMP_KEEP_VISIBLE);221 current_cursor().jump_sequence_pos(new_work_info.out_seq_position, ED4_JUMP_KEEP_VISIBLE); 222 222 move_cursor = 0; 223 223 } … … 228 228 } 229 229 230 static void executeKeystroke(AW_ window *aww, AW_event *event, int repeatCount) {230 static void executeKeystroke(AW_event *event, int repeatCount) { 231 231 e4_assert(repeatCount>0); 232 232 … … 307 307 error = edit_string->edit(work_info); 308 308 309 cursor->jump_sequence_pos( aww,work_info->out_seq_position, ED4_JUMP_KEEP_VISIBLE);309 cursor->jump_sequence_pos(work_info->out_seq_position, ED4_JUMP_KEEP_VISIBLE); 310 310 311 311 work_info->string = 0; … … 329 329 // ED4_ROOT->main_manager->Show(); // original version 330 330 331 cursor->jump_sequence_pos( aww,work_info->out_seq_position, work_info->cursor_jump);331 cursor->jump_sequence_pos(work_info->out_seq_position, work_info->cursor_jump); 332 332 } 333 333 … … 358 358 359 359 void ED4_remote_event(AW_event *faked_event) { // keystrokes forwarded from SECEDIT 360 executeKeystroke( current_aww(),faked_event, 1);360 executeKeystroke(faked_event, 1); 361 361 } 362 362 … … 388 388 } 389 389 else { // other key => execute now 390 executeKeystroke( aww,&lastEvent, repeatCount);390 executeKeystroke(&lastEvent, repeatCount); 391 391 lastEvent = event; 392 392 repeatCount = 1; … … 398 398 // sth goes wrong with OSX -> always execute keystroke 399 399 // Xfree 4.3 has problems as well, so repeat counting is disabled completely 400 executeKeystroke( aww,&lastEvent, repeatCount);400 executeKeystroke(&lastEvent, repeatCount); 401 401 repeatCount = 0; 402 402 #else … … 404 404 405 405 if (nextEventType!=KEY_RELEASED) { // no key waiting => execute now 406 executeKeystroke( aww,&lastEvent, repeatCount);406 executeKeystroke(&lastEvent, repeatCount); 407 407 repeatCount = 0; 408 408 } … … 415 415 416 416 if (nextEventType!=KEY_PRESSED && repeatCount) { // no key follows => execute keystrokes (if any) 417 executeKeystroke( aww,&lastEvent, repeatCount);417 executeKeystroke(&lastEvent, repeatCount); 418 418 repeatCount = 0; 419 419 } … … 657 657 if (pos != -1) { 658 658 ED4_cursor *cursor = ¤t_cursor(); 659 cursor->jump_sequence_pos( current_aww(),pos, ED4_JUMP_CENTERED);659 cursor->jump_sequence_pos(pos, ED4_JUMP_CENTERED); 660 660 awar->write_int(-1); 661 661 } … … 734 734 } 735 735 else { 736 cursor->jump_sequence_pos( aww,pos, ED4_JUMP_CENTERED);736 cursor->jump_sequence_pos(pos, ED4_JUMP_CENTERED); 737 737 } 738 738 } … … 754 754 } 755 755 else { 756 cursor->jump_sequence_pos( aww,pos, ED4_JUMP_CENTERED);756 cursor->jump_sequence_pos(pos, ED4_JUMP_CENTERED); 757 757 } 758 758 } … … 1422 1422 1423 1423 void ED4_compression_changed_cb(AW_root *awr) { 1424 ED4_remap_mode mode = (ED4_remap_mode)awr->awar(ED4_AWAR_COMPRESS_SEQUENCE_TYPE)->read_int();1425 int percent = awr->awar(ED4_AWAR_COMPRESS_SEQUENCE_PERCENT)->read_int();1426 GB_transaction t ransaction_var(GLOBAL_gb_main);1424 ED4_remap_mode mode = (ED4_remap_mode)awr->awar(ED4_AWAR_COMPRESS_SEQUENCE_TYPE)->read_int(); 1425 int percent = awr->awar(ED4_AWAR_COMPRESS_SEQUENCE_PERCENT)->read_int(); 1426 GB_transaction ta(GLOBAL_gb_main); 1427 1427 1428 1428 if (ED4_ROOT->root_group_man) { … … 1440 1440 device->set_clipall(); // draw nothing 1441 1441 1442 ED4_expose_recalculations(); 1443 1444 cursor.jump_sequence_pos( aww,seq_pos, ED4_JUMP_KEEP_POSITION);1445 cursor.set_screen_relative_pos( aww,rel_pos);1442 ED4_expose_recalculations(); // @@@ do not perform for all windows 1443 1444 cursor.jump_sequence_pos(seq_pos, ED4_JUMP_KEEP_POSITION); 1445 cursor.set_screen_relative_pos(rel_pos); 1446 1446 1447 1447 ED4_expose_cb(aww, 0, 0); // does pop_clip_scale + refresh -
branches/e4fix/EDIT4/ED4_terminal.cxx
r8289 r8293 762 762 763 763 764 ED4_terminal::~ED4_terminal() 765 { 766 if (selection_info) { 767 delete selection_info; 768 } 764 ED4_terminal::~ED4_terminal() { 765 delete selection_info; 769 766 ED4_cursor& cursor = current_cursor(); 770 767 if (this == cursor.owner_of_cursor) { -
branches/e4fix/EDIT4/ED4_window.cxx
r8275 r8293 403 403 } 404 404 405 ED4_window::ED4_window(AW_window *window) { 406 aww = window; 407 next = 0; 408 slider_pos_horizontal = 0; 409 slider_pos_vertical = 0; 410 411 id = ++no_of_windows; 405 ED4_window::ED4_window(AW_window *window) 406 : aww(window), 407 next(NULL), 408 slider_pos_horizontal(0), 409 slider_pos_vertical(0), 410 id(++no_of_windows), 411 is_hidden(false), 412 cursor(this) 413 { 412 414 coords.clear(); 413 is_hidden = false;414 415 415 416 sprintf(awar_path_for_cursor, AWAR_EDIT_SEQ_POSITION, id); -
branches/e4fix/EDIT4/ed4_class.hxx
r8289 r8293 605 605 606 606 class ED4_cursor : virtual Noncopyable { 607 ED4_index cursor_abs_x; // absolute (to terminal) x-position of cursor (absolute world coordinate of edit window) 607 ED4_window *win; 608 ED4_index cursor_abs_x; // absolute (to terminal) x-position of cursor (absolute world coordinate of edit window) 608 609 int screen_position; // number of displayed characters leading the cursor 609 mutable ED4_base_position base_position; // # of bases left of cursor610 mutable ED4_base_position base_position; // # of bases left of cursor 610 611 ED4_CursorType ctype; 611 612 ED4_CursorShape *cursor_shape; … … 649 650 void invalidate_base_position() { base_position.invalidate(); } 650 651 651 void jump_screen_pos( AW_window *aww,int screen_pos, ED4_CursorJumpType jump_type);652 void jump_sequence_pos( AW_window *aww,int sequence_pos, ED4_CursorJumpType jump_type);653 void jump_base_pos( AW_window *aww,int base_pos, ED4_CursorJumpType jump_type);652 void jump_screen_pos(int screen_pos, ED4_CursorJumpType jump_type); 653 void jump_sequence_pos(int sequence_pos, ED4_CursorJumpType jump_type); 654 void jump_base_pos(int base_pos, ED4_CursorJumpType jump_type); 654 655 655 656 int get_screen_relative_pos(); 656 void set_screen_relative_pos( AW_window *aww,int scroll_to_relpos);657 658 void set_to_terminal( AW_window *aww,ED4_terminal *terminal, int seq_pos, ED4_CursorJumpType jump_type);657 void set_screen_relative_pos(int scroll_to_relpos); 658 659 void set_to_terminal(ED4_terminal *terminal, int seq_pos, ED4_CursorJumpType jump_type); 659 660 660 661 void announce_deletion(ED4_base *object) { … … 665 666 void init(); 666 667 667 ED4_window *window() const ;668 669 ED4_cursor( );668 ED4_window *window() const { return win; } 669 670 ED4_cursor(ED4_window *win); 670 671 ~ED4_cursor(); 671 672 }; … … 674 675 ED4_window(const ED4_window&); // copy-constructor not allowed 675 676 public: 676 AW_window *aww; // Points to Window677 AW_window *aww; // Points to Window 677 678 ED4_window *next; 678 679 int slider_pos_horizontal; 679 680 int slider_pos_vertical; 680 681 ED4_scrolled_rectangle scrolled_rect; 681 int id; // unique id in window-list682 int id; // unique id in window-list 682 683 ED4_coords coords; 683 static int no_of_windows; 684 685 static int no_of_windows; 684 686 685 687 char awar_path_for_cursor[50]; // position in current sequence, range = [1;len] … … 1352 1354 GB_ERROR write_sequence(const char *seq, int seq_len); 1353 1355 1354 void scroll_into_view( AW_window *aww);1356 void scroll_into_view(ED4_window *ed4w); 1355 1357 inline bool setCursorTo(ED4_cursor *cursor, int seq_pos, bool unfoldGroups, ED4_CursorJumpType jump_type); 1356 1358
