Subversion Repositories Kolibri OS

Rev

Rev 9560 | Rev 9659 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9560 Rev 9599
Line 24... Line 24...
24
    G := Graph,
24
    G := Graph,
25
    U := Utils,
25
    U := Utils,
26
    RW, Search,
26
    RW, Search,
27
    E := Encodings,
27
    E := Encodings,
28
    CB := Clipboard,
28
    CB := Clipboard,
29
    K := KolibriOS,
-
 
30
    ChangeLog, File,
29
    ChangeLog, File,
31
    Lang := Languages;
30
    Lang := Languages;
Line 32... Line 31...
32
 
31
 
Line 73... Line 72...
73
        curLine: tLine;
72
        curLine: tLine;
74
        lang*: INTEGER;
73
        lang*: INTEGER;
75
        enc, eol: INTEGER;
74
        enc, eol: INTEGER;
76
        table: Search.IdxTable;
75
        table: Search.IdxTable;
77
        foundList: List.tList;
76
        foundList: List.tList;
78
        idxData: Search.tBuffer;
-
 
79
        foundSel: INTEGER;
77
        foundSel: INTEGER;
80
        searchText: tString;
78
        searchText: tString;
81
        chLog*: ChangeLog.tLog;
79
        chLog*: ChangeLog.tLog;
82
        maxLength*: INTEGER;
80
        maxLength*: INTEGER;
83
        fileName*: RW.tFileName
81
        fileName*: RW.tFileName
Line 816... Line 814...
816
    END
814
    END
817
    RETURN i
815
    RETURN i
818
END leadingSpaces;
816
END leadingSpaces;
Line 819... Line 817...
819
 
817
 
820
 
818
 
821
PROCEDURE plain (text: tText; eot: BOOLEAN): CB.tBuffer;
819
PROCEDURE plain (text: tText): CB.tBuffer;
822
VAR
820
VAR
823
    buf: CB.tBuffer;
821
    buf: CB.tBuffer;
824
    size: INTEGER;
822
    size: INTEGER;
Line 832... Line 830...
832
        NextLine(line);
830
        NextLine(line);
833
        IF line # NIL THEN
831
        IF line # NIL THEN
834
            INC(size, CB.lenEOL)
832
            INC(size, CB.lenEOL)
835
        END
833
        END
836
    END;
834
    END;
837
    IF eot THEN
-
 
838
        INC(size, 2)
-
 
839
    END;
-
 
840
    buf := CB.create(size);
835
    buf := CB.create(size + 2);
841
    line := text.first(tLine);
836
    line := text.first(tLine);
842
    WHILE line # NIL DO
837
    WHILE line # NIL DO
843
        CB.append(buf, line, 0, line.length - 1);
838
        CB.append(buf, line, 0, line.length - 1);
844
        NextLine(line);
839
        NextLine(line);
845
        IF line # NIL THEN
840
        IF line # NIL THEN
846
            CB.eol(buf)
841
            CB.eol(buf)
847
        END
842
        END
848
    END;
843
    END;
849
    IF eot THEN
844
    CB.appends(buf, 0X, 0, 0);
850
        CB.appends(buf, 0X + 0X, 0, 1)
845
    CB.appends(buf, 0X, 0, 0)
851
    END
-
 
852
    RETURN buf
846
    RETURN buf
853
END plain;
847
END plain;
Line 854... Line 848...
854
 
848
 
855
 
849
 
856
PROCEDURE search* (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN): BOOLEAN;
850
PROCEDURE search* (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN): BOOLEAN;
857
VAR
851
VAR
858
    pos: List.tItem;
852
	pos: List.tItem;
859
    res: BOOLEAN;
853
	res: BOOLEAN;
-
 
854
	plainText, idxData: Search.tBuffer;
860
    plainText: Search.tBuffer;
855
BEGIN
-
 
856
	res := TRUE;
861
BEGIN
857
	plainText := NIL;
862
    plainText := NIL;
858
	idxData := NIL;
863
    WHILE text.foundList.count # 0 DO
859
	WHILE text.foundList.count # 0 DO
864
        pos := List.pop(text.foundList);
860
		pos := List.pop(text.foundList);
865
        DISPOSE(pos)
861
		DISPOSE(pos)
Line 869... Line 865...
869
    text.searchText := s;
865
	text.searchText := s;
870
    IF ~cs THEN
866
	IF ~cs THEN
871
        U.upcase16(text.searchText)
867
		U.upcase16(text.searchText)
872
    END;
868
	END;
873
    IF text.searchText # "" THEN
869
	IF text.searchText # "" THEN
874
        plainText := plain(text, TRUE);
870
		plainText := plain(text);
875
        text.idxData := Search.index(plainText, text.table, cs);
871
		idxData := Search.index(plainText, text.table, cs);
876
        Search.find(plainText, text.table, text.searchText, whole, text.foundList);
872
		Search.find(plainText, text.table, text.searchText, whole, text.foundList);
877
        res := text.foundList.count > 0
873
		res := text.foundList.count > 0
878
    ELSE
-
 
879
        res := TRUE
-
 
880
    END;
874
	END;
881
    CB.destroy(plainText);
875
	CB.destroy(plainText);
882
    CB.destroy(text.idxData);
876
	CB.destroy(idxData);
883
    text.search := FALSE;
877
	text.search := FALSE;
884
    text.foundSel := 0
878
	text.foundSel := 0
885
    RETURN res
879
	RETURN res
886
END search;
880
END search;
Line 1535... Line 1529...
1535
        INC(cnt, line.length + (lenEOL + ORD(U.OS = "KOS")));
1529
        INC(cnt, line.length + (lenEOL + ORD(U.OS = "KOS")));
1536
        NextLine(line);
1530
        NextLine(line);
1537
        DEC(n)
1531
        DEC(n)
1538
    END;
1532
    END;
Line 1539... Line 1533...
1539
 
1533
 
Line 1540... Line 1534...
1540
    buffer := CB.create(cnt);
1534
    buffer := CB.create(cnt + 2); (* +2 wchars EOT *)
1541
 
1535
 
1542
    n := selEnd.Y - selBeg.Y;
1536
    n := selEnd.Y - selBeg.Y;
1543
    line := first;
1537
    line := first;
Line 2341... Line 2335...
2341
        END
2335
        END
2342
    END;
2336
    END;
Line 2343... Line 2337...
2343
 
2337
 
2344
    IF drawCursor THEN
2338
    IF drawCursor THEN
2345
        cursor(text)
2339
        cursor(text)
2346
    END;
-
 
2347
    G.SetColor(canvas, K.borderColor);
-
 
2348
    G.VLine(canvas, 0, 0, size.Y - 1);
2340
    END
Line 2349... Line 2341...
2349
END draw;
2341
END draw;
2350
 
2342
 
Line 2378... Line 2370...
2378
    text.search := TRUE;
2370
    text.search := TRUE;
2379
    text.cs := FALSE;
2371
    text.cs := FALSE;
2380
    text.whole := FALSE;
2372
    text.whole := FALSE;
2381
    text.numbers := TRUE;
2373
    text.numbers := TRUE;
2382
    text.guard := TRUE;
2374
    text.guard := TRUE;
2383
    text.idxData := NIL;
-
 
2384
    text.edition := NIL;
2375
    text.edition := NIL;
2385
    text.foundList := List.create(NIL);
2376
    text.foundList := List.create(NIL);
2386
    text.searchText := "";
2377
    text.searchText := "";
2387
    text.foundSel := 0;
2378
    text.foundSel := 0;
2388
    text.CurX := -1;
2379
    text.CurX := -1;