Rev 9913 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9913 | Rev 9915 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | lenEOL = CB.lenEOL; |
38 | lenEOL = CB.lenEOL; |
Line 39... | Line 39... | ||
39 | 39 | ||
40 | mark_width = 2; |
40 | mark_width = 2; |
41 | pad_left = mark_width + 3; |
41 | pad_left = mark_width + 3; |
42 | pad_top = 1; |
42 | pad_top = 1; |
Line 43... | Line 43... | ||
43 | inter = 2; |
43 | LineSpacing* = 2; |
Line 44... | Line 44... | ||
44 | 44 | ||
Line 72... | Line 72... | ||
72 | edition*: tGuard; |
72 | edition*: tGuard; |
73 | curLine: tLine; |
73 | curLine: tLine; |
74 | lang*: INTEGER; |
74 | lang*: INTEGER; |
75 | enc, eol: INTEGER; |
75 | enc, eol: INTEGER; |
76 | foundList: List.tList; |
76 | foundList: List.tList; |
77 | foundSel: INTEGER; |
77 | foundSel*, foundCur*, foundCnt*: INTEGER; |
78 | searchText: tString; |
78 | searchText: tString; |
79 | LinesVector: Lines.tVector; |
79 | LinesVector: Lines.tVector; |
80 | chLog*: ChangeLog.tLog; |
80 | chLog*: ChangeLog.tLog; |
81 | maxLength*: INTEGER; |
81 | maxLength*: INTEGER; |
82 | fileName*: RW.tFileName |
82 | fileName*: RW.tFileName |
Line 2387... | Line 2387... | ||
2387 | scrollX := text.scroll.X; |
2387 | scrollX := text.scroll.X; |
2388 | scrollY := text.scroll.Y; |
2388 | scrollY := text.scroll.Y; |
2389 | IF ~((scrollY > cursor.Y) OR (scrollY + textsize.Y + 1 <= cursor.Y) OR |
2389 | IF ~((scrollY > cursor.Y) OR (scrollY + textsize.Y + 1 <= cursor.Y) OR |
2390 | (scrollX > cursor.X) OR (scrollX + textsize.X <= cursor.X)) THEN |
2390 | (scrollX > cursor.X) OR (scrollX + textsize.X <= cursor.X)) THEN |
2391 | x := (cursor.X - scrollX)*charWidth + padding.left; |
2391 | x := (cursor.X - scrollX)*charWidth + padding.left; |
2392 | y1 := (cursor.Y - scrollY)*charHeight + padding.top + (inter DIV 2 + 1); |
2392 | y1 := (cursor.Y - scrollY)*charHeight + padding.top + (LineSpacing DIV 2 + 1); |
2393 | y2 := y1 + charHeight - (inter + 2); |
2393 | y2 := y1 + charHeight - (LineSpacing + 2); |
2394 | G.notVLine(canvas, x, y1, y2); |
2394 | G.notVLine(canvas, x, y1, y2); |
2395 | G.notVLine(canvas, x - 1, y1, y2) |
2395 | G.notVLine(canvas, x - 1, y1, y2) |
2396 | END |
2396 | END |
2397 | END |
2397 | END |
2398 | END cursor; |
2398 | END cursor; |
Line 2407... | Line 2407... | ||
2407 | Len := MIN(Len, textsize.X - pos + 1); |
2407 | Len := MIN(Len, textsize.X - pos + 1); |
2408 | SetColor(colors.seltext, colors.selback); |
2408 | SetColor(colors.seltext, colors.selback); |
2409 | pos := MAX((selBeg - text.scroll.X), 0); |
2409 | pos := MAX((selBeg - text.scroll.X), 0); |
2410 | x := pos*charWidth + padding.left; |
2410 | x := pos*charWidth + padding.left; |
2411 | G.SetColor(canvas, colors.selback); |
2411 | G.SetColor(canvas, colors.selback); |
- | 2412 | G.FillRect(canvas, x - 1, y - LineSpacing DIV 2, |
|
2412 | G.FillRect(canvas, x - 1, y - inter DIV 2, x + Len*charWidth, y - inter DIV 2 + charHeight); |
2413 | x + Len*charWidth, y - LineSpacing DIV 2 + charHeight); |
2413 | G.TextOut(canvas, pos*charWidth + padding.left, y, Lines.getPChar(line, firstCharIdx), Len, colors.seltext) |
2414 | G.TextOut(canvas, pos*charWidth + padding.left, y, Lines.getPChar(line, firstCharIdx), Len, colors.seltext) |
2414 | END drawSelect; |
2415 | END drawSelect; |
Line 2415... | Line 2416... | ||
2415 | 2416 | ||
Line 2483... | Line 2484... | ||
2483 | setPadding(numWidth*wNum + pad_left, padding.top); |
2484 | setPadding(numWidth*wNum + pad_left, padding.top); |
2484 | ELSE |
2485 | ELSE |
2485 | setPadding(pad_left + wNum*2, padding.top) |
2486 | setPadding(pad_left + wNum*2, padding.top) |
2486 | END; |
2487 | END; |
2487 | getSelect(text, selBeg, selEnd); |
2488 | getSelect(text, selBeg, selEnd); |
2488 | y := padding.top + inter DIV 2; |
2489 | y := padding.top + LineSpacing DIV 2; |
2489 | n := text.scroll.Y; |
2490 | n := text.scroll.Y; |
2490 | firstLine := getLine2(text, n); |
2491 | firstLine := getLine2(text, n); |
Line 2491... | Line 2492... | ||
2491 | 2492 | ||
2492 | IF text.smallMove THEN |
2493 | IF text.smallMove THEN |
2493 | line := text.curLine; |
2494 | line := text.curLine; |
2494 | cnt := textsize.Y; |
2495 | cnt := textsize.Y; |
2495 | y := y + charHeight*(text.cursor.Y - text.scroll.Y); |
2496 | y := y + charHeight*(text.cursor.Y - text.scroll.Y); |
2496 | G.SetColor(canvas, colors.back); |
2497 | G.SetColor(canvas, colors.back); |
- | 2498 | G.FillRect(canvas, padding.left - 2, y - LineSpacing DIV 2, |
|
2497 | G.FillRect(canvas, padding.left - 2, y - inter DIV 2, size.X - 1, y - inter DIV 2 + charHeight); |
2499 | size.X - 1, y - LineSpacing DIV 2 + charHeight); |
2498 | n := text.cursor.Y |
2500 | n := text.cursor.Y |
2499 | ELSE |
2501 | ELSE |
2500 | line := firstLine; |
2502 | line := firstLine; |
2501 | cnt := 0 |
2503 | cnt := 0 |
Line 2502... | Line 2504... | ||
2502 | END; |
2504 | END; |
2503 | 2505 | ||
2504 | WHILE (line # NIL) & (cnt <= textsize.Y) DO |
2506 | WHILE (line # NIL) & (cnt <= textsize.Y) DO |
2505 | backColor := colors.back; |
2507 | backColor := colors.back; |
2506 | IF (line = text.curLine) & ~selected(text) THEN |
2508 | IF (line = text.curLine) & ~selected(text) THEN |
- | 2509 | G.SetColor(canvas, colors.curline); |
|
2507 | G.SetColor(canvas, colors.curline); |
2510 | G.FillRect(canvas, padding.left - 2, y - LineSpacing DIV 2, |
2508 | G.FillRect(canvas, padding.left - 2, y - inter DIV 2, size.X - 1, y - inter DIV 2 + charHeight); |
2511 | size.X - 1, y - LineSpacing DIV 2 + charHeight); |
2509 | backColor := colors.curline |
2512 | backColor := colors.curline |
2510 | END; |
2513 | END; |
2511 | SetColor(colors.text, backColor); |
2514 | SetColor(colors.text, backColor); |
Line 2522... | Line 2525... | ||
2522 | ELSIF (selBeg.Y = n) & (selEnd.Y # n) THEN |
2525 | ELSIF (selBeg.Y = n) & (selEnd.Y # n) THEN |
2523 | drawSelect(text, line, selBeg.X, line.length, y) |
2526 | drawSelect(text, line, selBeg.X, line.length, y) |
2524 | ELSIF (selBeg.Y # n) & (selEnd.Y = n) THEN |
2527 | ELSIF (selBeg.Y # n) & (selEnd.Y = n) THEN |
2525 | drawSelect(text, line, 0, selEnd.X, y) |
2528 | drawSelect(text, line, 0, selEnd.X, y) |
2526 | END; |
2529 | END; |
2527 | mark(line, y - inter DIV 2); |
2530 | mark(line, y - LineSpacing DIV 2); |
2528 | NextLine(line); |
2531 | NextLine(line); |
2529 | INC(y, charHeight); |
2532 | INC(y, charHeight); |
2530 | INC(n); |
2533 | INC(n); |
2531 | INC(cnt) |
2534 | INC(cnt) |
2532 | END; |
2535 | END; |
Line 2533... | Line 2536... | ||
2533 | 2536 | ||
2534 | G.SetColor(canvas, colors.numback); |
2537 | G.SetColor(canvas, colors.numback); |
2535 | G.FillRect(canvas, 0, 0, padding.left - pad_left (*+ 1*), size.Y - 1); |
2538 | G.FillRect(canvas, 0, 0, padding.left - pad_left (*+ 1*), size.Y - 1); |
2536 | line := firstLine; |
2539 | line := firstLine; |
2537 | SetColor(colors.numtext, colors.numback); |
2540 | SetColor(colors.numtext, colors.numback); |
2538 | y := padding.top + inter DIV 2; |
2541 | y := padding.top + LineSpacing DIV 2; |
2539 | n := MIN(text.scroll.Y + textsize.Y + 1, text.count); |
2542 | n := MIN(text.scroll.Y + textsize.Y + 1, text.count); |
2540 | FOR i := text.scroll.Y + 1 TO n DO |
2543 | FOR i := text.scroll.Y + 1 TO n DO |
2541 | IF lineNumbers THEN |
2544 | IF lineNumbers THEN |
2542 | IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN |
2545 | IF (i MOD 10 = 0) OR (i - 1 = text.cursor.Y) OR line.label THEN |
2543 | U.int2str(i, s); |
2546 | U.int2str(i, s); |
2544 | G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s)) |
2547 | G.TextOut2(canvas, (numWidth - U.lg10(i) - 1)*wNum - wNum DIV 2, y, s, LENGTH(s)) |
2545 | ELSE |
2548 | ELSE |
2546 | G.SetColor(canvas, colors.numtext); |
2549 | G.SetColor(canvas, colors.numtext); |
- | 2550 | G.HLine(canvas, y - LineSpacing DIV 2 + charHeight DIV 2, |
|
2547 | G.HLine(canvas, y - inter DIV 2 + charHeight DIV 2, xNum - wNum DIV (1 + ORD(i MOD 5 # 0)), xNum) |
2551 | xNum - wNum DIV (1 + ORD(i MOD 5 # 0)), xNum) |
2548 | END |
2552 | END |
2549 | END; |
2553 | END; |
2550 | IF line.label THEN |
2554 | IF line.label THEN |
2551 | FOR x := wNum DIV 2 TO (padding.left - pad_left) - wNum DIV 2 DO |
2555 | FOR x := wNum DIV 2 TO (padding.left - pad_left) - wNum DIV 2 DO |
2552 | G.notVLine(canvas, x, y, y + charHeight - (inter + 1)); |
2556 | G.notVLine(canvas, x, y, y + charHeight - (LineSpacing + 1)); |
2553 | G.xorVLine(canvas, x, y, y + charHeight - (inter + 1)) |
2557 | G.xorVLine(canvas, x, y, y + charHeight - (LineSpacing + 1)) |
2554 | END |
2558 | END |
2555 | END; |
2559 | END; |
2556 | NextLine(line); |
2560 | NextLine(line); |
2557 | INC(y, charHeight) |
2561 | INC(y, charHeight) |
Line 2567... | Line 2571... | ||
2567 | 2571 | ||
2568 | i := 0; |
2572 | i := 0; |
2569 | p := text.foundList.first(Search.tPos); |
2573 | p := text.foundList.first(Search.tPos); |
2570 | pos := Search.next(p, i); |
2574 | pos := Search.next(p, i); |
2571 | WHILE pos # -1 DO |
2575 | WHILE pos # -1 DO |
2572 | y := padding.top + inter DIV 2; |
2576 | y := padding.top + LineSpacing DIV 2; |
2573 | IF text.smallMove THEN |
2577 | IF text.smallMove THEN |
2574 | y := y + charHeight*(text.cursor.Y - text.scroll.Y) |
2578 | y := y + charHeight*(text.cursor.Y - text.scroll.Y) |
2575 | END; |
2579 | END; |
2576 | IF (firstLine.pos <= pos) & (pos <= lastLine.pos + lastLine.length) THEN |
2580 | IF (firstLine.pos <= pos) & (pos <= lastLine.pos + lastLine.length) THEN |
Line 2585... | Line 2589... | ||
2585 | END; |
2589 | END; |
2586 | x := (pos - line.pos - text.scroll.X)*charWidth + padding.left; |
2590 | x := (pos - line.pos - text.scroll.X)*charWidth + padding.left; |
2587 | n := LENGTH(text.searchText)*charWidth; |
2591 | n := LENGTH(text.searchText)*charWidth; |
2588 | WHILE n > 0 DO |
2592 | WHILE n > 0 DO |
2589 | IF x >= padding.left THEN |
2593 | IF x >= padding.left THEN |
2590 | G.notVLine(canvas, x, y, y + charHeight - inter) |
2594 | G.notVLine(canvas, x, y, y + charHeight - LineSpacing) |
2591 | END; |
2595 | END; |
2592 | INC(x); |
2596 | INC(x); |
2593 | DEC(n) |
2597 | DEC(n) |
2594 | END |
2598 | END |
2595 | END; |
2599 | END; |
Line 2599... | Line 2603... | ||
2599 | 2603 | ||
Line 2600... | Line 2604... | ||
2600 | text.smallMove := FALSE; |
2604 | text.smallMove := FALSE; |
2601 | 2605 | ||
2602 | IF text.foundSel > 0 THEN |
2606 | IF text.foundSel > 0 THEN |
2603 | x := (text.cursor.X - text.scroll.X)*charWidth + padding.left; |
2607 | x := (text.cursor.X - text.scroll.X)*charWidth + padding.left; |
2604 | y := (text.cursor.Y - text.scroll.Y)*charHeight + padding.top + inter DIV 2; |
2608 | y := (text.cursor.Y - text.scroll.Y)*charHeight + padding.top + LineSpacing DIV 2; |
2605 | n := text.foundSel*charWidth; |
2609 | n := text.foundSel*charWidth; |
2606 | WHILE n > 0 DO |
2610 | WHILE n > 0 DO |
2607 | IF x >= padding.left THEN |
2611 | IF x >= padding.left THEN |
2608 | G.xorVLine(canvas, x, y, y + charHeight - inter) |
2612 | G.xorVLine(canvas, x, y, y + charHeight - LineSpacing) |
2609 | END; |
2613 | END; |
2610 | INC(x); |
2614 | INC(x); |
2611 | DEC(n) |
2615 | DEC(n) |
Line 2687... | Line 2691... | ||
2687 | 2691 | ||
2688 | PROCEDURE setCanvas* (_canvas: G.tCanvas); |
2692 | PROCEDURE setCanvas* (_canvas: G.tCanvas); |
2689 | BEGIN |
2693 | BEGIN |
2690 | canvas := _canvas; |
2694 | canvas := _canvas; |
2691 | charWidth := _canvas.font.width; |
2695 | charWidth := _canvas.font.width; |
2692 | charHeight := _canvas.font.height + inter |
2696 | charHeight := _canvas.font.height + LineSpacing |
Line 2693... | Line 2697... | ||
2693 | END setCanvas; |
2697 | END setCanvas; |
2694 | 2698 | ||
Line 2764... | Line 2768... | ||
2764 | PROCEDURE findNext* (text: tText; prev: BOOLEAN): BOOLEAN; |
2768 | PROCEDURE findNext* (text: tText; prev: BOOLEAN): BOOLEAN; |
2765 | VAR |
2769 | VAR |
2766 | cursorPos, x, y, X, Y, Len: INTEGER; |
2770 | cursorPos, x, y, X, Y, Len: INTEGER; |
2767 | line: tLine; |
2771 | line: tLine; |
2768 | res: BOOLEAN; |
2772 | res: BOOLEAN; |
2769 | pos, i, pos0: INTEGER; |
2773 | pos, i, pos0, first, last, num, cnt: INTEGER; |
2770 | p: Search.tPos; |
2774 | p: Search.tPos; |
2771 | BEGIN |
2775 | BEGIN |
2772 | X := text.cursor.X; |
2776 | X := text.cursor.X; |
2773 | Y := text.cursor.Y; |
2777 | Y := text.cursor.Y; |
2774 | text.cursor.X := MIN(text.cursor.X, text.curLine.length); |
2778 | text.cursor.X := MIN(text.cursor.X, text.curLine.length); |
2775 | cursorPos := text.curLine.pos + text.cursor.X - ORD(prev) - ORD(~prev & (text.foundSel = 0)); |
2779 | cursorPos := text.curLine.pos + text.cursor.X - ORD(prev) - ORD(~prev & (text.foundSel = 0)); |
2776 | pos0 := -1; |
2780 | pos0 := -1; |
- | 2781 | ||
- | 2782 | cnt := 0; |
|
- | 2783 | IF text.foundList.count # 0 THEN |
|
- | 2784 | p := text.foundList.first(Search.tPos); |
|
- | 2785 | first := p.pos[0]; |
|
- | 2786 | WHILE p # NIL DO |
|
- | 2787 | INC(cnt, p.cnt); |
|
- | 2788 | p := p.next(Search.tPos) |
|
- | 2789 | END; |
|
- | 2790 | p := text.foundList.last(Search.tPos); |
|
- | 2791 | last := p.pos[p.cnt - 1] |
|
- | 2792 | ELSE |
|
- | 2793 | first := -1; |
|
- | 2794 | last := -1 |
|
- | 2795 | END; |
|
- | 2796 | text.foundCnt := cnt; |
|
- | 2797 | ||
- | 2798 | num := 1; |
|
2777 | i := 0; |
2799 | i := 0; |
2778 | p := text.foundList.first(Search.tPos); |
2800 | p := text.foundList.first(Search.tPos); |
2779 | pos := Search.next(p, i); |
2801 | pos := Search.next(p, i); |
2780 | WHILE (pos # -1) & (pos <= cursorPos) DO |
2802 | WHILE (pos # -1) & (pos <= cursorPos) DO |
2781 | pos0 := pos; |
2803 | pos0 := pos; |
2782 | pos := Search.next(p, i) |
2804 | pos := Search.next(p, i); |
- | 2805 | INC(num) |
|
2783 | END; |
2806 | END; |
2784 | IF prev THEN |
2807 | IF prev THEN |
2785 | pos := pos0 |
2808 | pos := pos0; |
- | 2809 | DEC(num) |
|
2786 | END; |
2810 | END; |
- | 2811 | ||
- | 2812 | IF pos = -1 THEN |
|
- | 2813 | IF prev THEN |
|
- | 2814 | pos := last; |
|
- | 2815 | num := cnt |
|
- | 2816 | ELSE |
|
- | 2817 | pos := first; |
|
- | 2818 | num := 1 |
|
- | 2819 | END |
|
- | 2820 | END; |
|
- | 2821 | ||
2787 | res := pos # -1; |
2822 | res := pos # -1; |
2788 | IF res THEN |
2823 | IF res THEN |
2789 | y := 0; |
2824 | y := 0; |
2790 | line := text.first(tLine); |
2825 | line := text.first(tLine); |
2791 | WHILE (line.pos <= pos) & (line.next # NIL) DO |
2826 | WHILE (line.pos <= pos) & (line.next # NIL) DO |
Line 2804... | Line 2839... | ||
2804 | text.scroll.X := MAX(x + Len - textsize.X + 3, 0) |
2839 | text.scroll.X := MAX(x + Len - textsize.X + 3, 0) |
2805 | ELSIF x < text.scroll.X THEN |
2840 | ELSIF x < text.scroll.X THEN |
2806 | text.scroll.X := MAX(x - 3, 0) |
2841 | text.scroll.X := MAX(x - 3, 0) |
2807 | END; |
2842 | END; |
2808 | SetPos(text, x, y); |
2843 | SetPos(text, x, y); |
2809 | text.foundSel := Len |
2844 | text.foundSel := Len; |
- | 2845 | text.foundCur := num |
|
2810 | ELSE |
2846 | ELSE |
2811 | SetPos(text, X, Y) |
2847 | SetPos(text, X, Y); |
- | 2848 | text.foundCur := 0 |
|
2812 | END |
2849 | END |
2813 | RETURN res |
2850 | RETURN res |
2814 | END findNext; |
2851 | END findNext; |