Subversion Repositories Kolibri OS

Rev

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

Rev 9648 Rev 9659
Line 26... Line 26...
26
    CB := Clipboard, Languages,
26
    CB := Clipboard, Languages,
27
    ChangeLog, Scroll, CheckBox,
27
    ChangeLog, Scroll, CheckBox,
28
    RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
28
    RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
Line 29... Line 29...
29
 
29
 
30
CONST
30
CONST
Line 31... Line 31...
31
    HEADER = "CEdit (18-jan-2022)";
31
    HEADER = "CEdit (20-jan-2022)";
32
 
32
 
Line 33... Line 33...
33
    ShellFilter = "";
33
    ShellFilter = "";
Line 352... Line 352...
352
	T.getPos(text, col, line);
352
	T.getPos(text, col, line);
353
	T.getSelCnt(text, chars, lines);
353
	T.getSelCnt(text, chars, lines);
354
	SB.setWidth(canvas.width + scrollWidth);
354
	SB.setWidth(canvas.width + scrollWidth);
355
	SB.setPos(line, col);
355
	SB.setPos(line, col);
356
	SB.setSel(chars, lines);
356
	SB.setSel(chars, lines);
357
	SB.setEnc(RW.eolNames[T.getEol(text)], E.names[T.getEnc(text)]);
357
	SB.setEnc(E.eolNames[T.getEol(text)], E.names[T.getEnc(text)]);
358
	SB.draw(LEFT, height - BOTTOM + scrollWidth - 1);
358
	SB.draw(LEFT, height - BOTTOM + scrollWidth - 1);
359
	Tabs.modify(tabs, getIdx(text), text.modified)
359
	Tabs.modify(tabs, getIdx(text), text.modified)
360
END Status;
360
END Status;
Line 831... Line 831...
831
    CheckBox.create("match case", CS);
831
    CheckBox.create("match case", CS);
832
    CheckBox.create("whole word", WH);
832
    CheckBox.create("whole word", WH);
833
END createSearchForm;
833
END createSearchForm;
Line 834... Line 834...
834
 
834
 
835
 
835
 
836
PROCEDURE EditBox_GetValue (edit: EB.tEditBox; VAR s: ARRAY OF WCHAR);
836
PROCEDURE EditBox_Get (edit: EB.tEditBox; VAR s: ARRAY OF WCHAR);
837
VAR
837
VAR
838
    str: ARRAY EDITBOX_MAXCHARS + 1 OF CHAR;
838
    str: ARRAY EDITBOX_MAXCHARS + 1 OF CHAR;
839
    i: INTEGER;
839
    i: INTEGER;
840
BEGIN
840
BEGIN
841
    EB.getValue(edit, str);
841
    EB.get(edit, str);
842
    i := 0;
842
    i := 0;
843
    WHILE str[i] # 0X DO
843
    WHILE str[i] # 0X DO
844
        s[i] := WCHR(E.cp866[ORD(str[i])]);
844
        s[i] := WCHR(E.cp866[ORD(str[i])]);
845
        INC(i)
845
        INC(i)
846
    END;
846
    END;
Line 847... Line 847...
847
    s[i] := 0X
847
    s[i] := 0X
848
END EditBox_GetValue;
848
END EditBox_Get;
849
 
849
 
Line 925... Line 925...
925
 
925
 
926
PROCEDURE goto;
926
PROCEDURE goto;
927
VAR
927
VAR
928
    gotoVal: INTEGER;
928
    gotoVal: INTEGER;
929
BEGIN
929
BEGIN
930
    EditBox_GetValue(GotoEdit, gotoText);
930
    EditBox_Get(GotoEdit, gotoText);
931
    IF U.str2int(gotoText, gotoVal) & T.goto(text, gotoVal) THEN
931
    IF U.str2int(gotoText, gotoVal) & T.goto(text, gotoVal) THEN
932
    	SetFocus(GotoEdit, FALSE)
932
    	SetFocus(GotoEdit, FALSE)
933
    END
933
    END
Line 955... Line 955...
955
			WHILE (new_searchText[i] # 0X) & (new_searchText[i] # Lines.TAB) DO
955
			WHILE (new_searchText[i] # 0X) & (new_searchText[i] # Lines.TAB) DO
956
				INC(i)
956
				INC(i)
957
			END;
957
			END;
958
			IF new_searchText[i] = 0X THEN
958
			IF new_searchText[i] = 0X THEN
959
				searchText := new_searchText;
959
				searchText := new_searchText;
960
				EB.setValue(FindEdit, searchText);
960
				EB.set(FindEdit, searchText);
961
				notFound := ~T.search(text, searchText, cs, whole);
961
				notFound := ~T.search(text, searchText, cs, whole);
962
			END
962
			END
963
		END
963
		END
964
	END;
964
	END;
965
    IF ~search THEN
965
    IF ~search THEN
Line 1075... Line 1075...
1075
    Menu.setEnabled(subIndent, menuDecInd, selected);
1075
    Menu.setEnabled(subIndent, menuDecInd, selected);
Line 1076... Line 1076...
1076
 
1076
 
1077
    Menu.setEnabled(subCase, menuUpper, selected);
1077
    Menu.setEnabled(subCase, menuUpper, selected);
Line 1078... Line 1078...
1078
    Menu.setEnabled(subCase, menuLower, selected);
1078
    Menu.setEnabled(subCase, menuLower, selected);
1079
 
1079
 
1080
	Menu.option(subEOL, menuCRLF, T.getEol(text) = RW.EOL_CRLF);
1080
	Menu.option(subEOL, menuCRLF, T.getEol(text) = E.EOL_CRLF);
Line 1081... Line 1081...
1081
	Menu.option(subEOL, menuLF,   T.getEol(text) = RW.EOL_LF);
1081
	Menu.option(subEOL, menuLF,   T.getEol(text) = E.EOL_LF);
1082
	Menu.option(subEOL, menuCR,   T.getEol(text) = RW.EOL_CR);
1082
	Menu.option(subEOL, menuCR,   T.getEol(text) = E.EOL_CR);
1083
 
1083
 
1084
    IF menu # NIL THEN
1084
    IF menu # NIL THEN
Line 1207... Line 1207...
1207
    |menuCP866:
1207
    |menuCP866:
1208
    	T.setEnc(text, E.CP866)
1208
    	T.setEnc(text, E.CP866)
1209
    |menuWin1251:
1209
    |menuWin1251:
1210
    	T.setEnc(text, E.W1251)
1210
    	T.setEnc(text, E.W1251)
1211
    |menuLF:
1211
    |menuLF:
1212
    	T.setEol(text, RW.EOL_LF)
1212
    	T.setEol(text, E.EOL_LF)
1213
    |menuCRLF:
1213
    |menuCRLF:
1214
    	T.setEol(text, RW.EOL_CRLF)
1214
    	T.setEol(text, E.EOL_CRLF)
1215
    |menuCR:
1215
    |menuCR:
1216
    	T.setEol(text, RW.EOL_CR)
1216
    	T.setEol(text, E.EOL_CR)
1217
    |menuPipet:
1217
    |menuPipet:
1218
        K.Run("/sys/develop/pipet", "")
1218
        K.Run("/sys/develop/pipet", "")
1219
    |menuMagnify:
1219
    |menuMagnify:
1220
        K.Run("/sys/magnify", "")
1220
        K.Run("/sys/magnify", "")
1221
    |menuBoard:
1221
    |menuBoard:
Line 1342... Line 1342...
1342
PROCEDURE CreateMenuEOL (): Menu.tMenu;
1342
PROCEDURE CreateMenuEOL (): Menu.tMenu;
1343
VAR
1343
VAR
1344
    menu: List.tList;
1344
    menu: List.tList;
1345
BEGIN
1345
BEGIN
1346
    menu := List.create(NIL);
1346
    menu := List.create(NIL);
1347
    Menu.AddMenuItem(menu, menuCRLF, RW.eolNames[RW.EOL_CRLF]);
1347
    Menu.AddMenuItem(menu, menuCRLF, E.eolNames[E.EOL_CRLF]);
1348
    Menu.AddMenuItem(menu, menuLF,   RW.eolNames[RW.EOL_LF]);
1348
    Menu.AddMenuItem(menu, menuLF,   E.eolNames[E.EOL_LF]);
1349
    Menu.AddMenuItem(menu, menuCR,   RW.eolNames[RW.EOL_CR]);
1349
    Menu.AddMenuItem(menu, menuCR,   E.eolNames[E.EOL_CR]);
1350
    RETURN Menu.create(menu)
1350
    RETURN Menu.create(menu)
1351
END CreateMenuEOL;
1351
END CreateMenuEOL;
Line 1352... Line 1352...
1352
 
1352
 
Line 1589... Line 1589...
1589
            IF EditBox_Focus(FindEdit) THEN
1589
            IF EditBox_Focus(FindEdit) THEN
1590
            	IF keyCode = 15 THEN (* Tab *)
1590
            	IF keyCode = 15 THEN (* Tab *)
1591
            		SetFocus(ReplaceEdit, TRUE)
1591
            		SetFocus(ReplaceEdit, TRUE)
1592
            	ELSE
1592
            	ELSE
1593
	                EB.key(FindEdit, key);
1593
	                EB.key(FindEdit, key);
1594
	                EditBox_GetValue(FindEdit, new_searchText);
1594
	                EditBox_Get(FindEdit, new_searchText);
1595
	                IF new_searchText # searchText THEN
1595
	                IF new_searchText # searchText THEN
1596
	                    searchText := new_searchText;
1596
	                    searchText := new_searchText;
1597
	                    notFound := ~T.search(text, searchText, cs, whole)
1597
	                    notFound := ~T.search(text, searchText, cs, whole)
1598
	                END
1598
	                END
1599
                END
1599
                END
1600
            ELSIF EditBox_Focus(ReplaceEdit) THEN
1600
            ELSIF EditBox_Focus(ReplaceEdit) THEN
1601
            	IF keyCode = 15 THEN (* Tab *)
1601
            	IF keyCode = 15 THEN (* Tab *)
1602
            		SetFocus(GotoEdit, TRUE)
1602
            		SetFocus(GotoEdit, TRUE)
1603
            	ELSE
1603
            	ELSE
1604
                	EB.key(ReplaceEdit, key);
1604
                	EB.key(ReplaceEdit, key);
1605
                	EditBox_GetValue(ReplaceEdit, replaceText)
1605
                	EditBox_Get(ReplaceEdit, replaceText)
1606
                END
1606
                END
1607
            ELSIF EditBox_Focus(GotoEdit) THEN
1607
            ELSIF EditBox_Focus(GotoEdit) THEN
1608
            	IF keyCode = 15 THEN (* Tab *)
1608
            	IF keyCode = 15 THEN (* Tab *)
1609
            		SetFocus(FindEdit, TRUE)
1609
            		SetFocus(FindEdit, TRUE)
1610
            	ELSE
1610
            	ELSE
Line 1884... Line 1884...
1884
		IF (width # cliWidth) OR (height # cliHeight) THEN
1884
		IF (width # cliWidth) OR (height # cliHeight) THEN
1885
			cliWidth := width;
1885
			cliWidth := width;
1886
			cliHeight := height;
1886
			cliHeight := height;
1887
			resize;
1887
			resize;
1888
			resized := TRUE
1888
			resized := TRUE
1889
		END;
1889
		END
1890
		K.SetEventsMask({0, 1, 2, 5, 31})
-
 
1891
	ELSE
1890
	ELSE
1892
		SetCaption(text.fileName);
1891
		SetCaption(text.fileName)
1893
		K.SetEventsMask({0, 30, 31})
-
 
1894
	END;
1892
	END;
1895
	draw_window;
1893
	draw_window;
1896
	IF SkinHeight # K.SkinHeight() THEN
1894
	IF SkinHeight # K.SkinHeight() THEN
1897
		SkinHeight := K.SkinHeight();
1895
		SkinHeight := K.SkinHeight();
1898
		Redraw(resized, width, height, cliWidth, cliHeight)
1896
		Redraw(resized, width, height, cliWidth, cliHeight)
Line 1919... Line 1917...
1919
VAR
1917
VAR
1920
    fileName, filePath: RW.tFileName;
1918
    fileName, filePath: RW.tFileName;
1921
    width, height, cliWidth, cliHeight: INTEGER;
1919
    width, height, cliWidth, cliHeight: INTEGER;
1922
    resized: BOOLEAN;
1920
    resized: BOOLEAN;
1923
    firstClickX, firstClickY, time, blink, i: INTEGER;
1921
    firstClickX, firstClickY, time, blink, i: INTEGER;
-
 
1922
    key, scr: INTEGER;
1924
BEGIN
1923
BEGIN
1925
	header := "";
1924
	header := "";
1926
    K.GetSystemColors;
1925
    K.GetSystemColors;
1927
    switch := FALSE;
1926
    switch := FALSE;
1928
    closing := FALSE;
1927
    closing := FALSE;
Line 2045... Line 2044...
2045
		blink := 30
2044
		blink := 30
2046
	END;
2045
	END;
2047
    timerEnabled := TRUE;
2046
    timerEnabled := TRUE;
2048
    CursorTime := K.GetTickCount();
2047
    CursorTime := K.GetTickCount();
2049
    WHILE TRUE DO
2048
    WHILE TRUE DO
-
 
2049
 
2050
    	CurrentTime := K.GetTickCount();
2050
    	CurrentTime := K.GetTickCount();
2051
    	IF (CurrentTime - CursorTime > blink) & (blink > 0) & timerEnabled THEN
2051
    	IF (CurrentTime - CursorTime > blink) & (blink > 0) & timerEnabled & ~K.RolledUp() THEN
2052
    		CursorTime := CurrentTime;
2052
    		CursorTime := CurrentTime;
2053
    		T.toggleCursor;
2053
    		T.toggleCursor;
2054
    		repaint
2054
    		repaint
2055
    	END;
2055
    	END;
Line 2056... Line 2056...
2056
 
2056
 
2057
        CASE K.EventTimeout(10) OF
2057
        CASE K.EventTimeout(10) OF
2058
        |0:
2058
        |0:
-
 
2059
        |1:	Redraw(resized, width, height, cliWidth, cliHeight)
2059
        |1:	Redraw(resized, width, height, cliWidth, cliHeight)
2060
        |2:
-
 
2061
        	key := K.GetKey();
-
 
2062
        	IF ~K.RolledUp() THEN
-
 
2063
        		KeyDown(key)
2060
        |2: KeyDown(K.GetKey())
2064
        	END
-
 
2065
        |3: BtnClick
-
 
2066
        |6:
2061
        |3: BtnClick
2067
        	IF ~K.RolledUp() THEN
-
 
2068
        		MouseEvent(resized, firstClickX, firstClickY, time)
-
 
2069
        	ELSE
-
 
2070
        		scr := K.Scroll()
2062
        |6: MouseEvent(resized, firstClickX, firstClickY, time)
2071
        	END
2063
        END
2072
        END
2064
    END
2073
    END