Rev 9180 | Rev 9182 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9180 | Rev 9181 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | CB := Clipboard, Languages, |
26 | CB := Clipboard, Languages, |
27 | ChangeLog, Scroll, |
27 | ChangeLog, Scroll, |
28 | RW, Ini, box_lib, Icons, Tabs, Timer; |
28 | RW, Ini, box_lib, Icons, Tabs, Timer; |
Line 29... | Line 29... | ||
29 | 29 | ||
30 | CONST |
30 | CONST |
Line 31... | Line 31... | ||
31 | header = "CEdit (06-sep-2021)"; |
31 | header = "CEdit (07-sep-2021)"; |
32 | 32 | ||
Line 33... | Line 33... | ||
33 | ShellFilter = ""; |
33 | ShellFilter = ""; |
Line 79... | Line 79... | ||
79 | 79 | ||
80 | TOP = btnTop + toolBtnSize + 10 + Tabs.tabHeight; |
80 | TOP = btnTop + toolBtnSize + 10 + Tabs.tabHeight; |
81 | RIGHT = scrollWidth - 2; |
81 | RIGHT = scrollWidth - 2; |
Line 82... | Line 82... | ||
82 | BOTTOM = scrollWidth + 18; |
82 | BOTTOM = scrollWidth + 18; |
Line 83... | Line 83... | ||
83 | 83 | ||
84 | minWinWidth = 635; minWinHeight = 538; |
84 | minWinWidth = 635; minWinHeight = 550; |
85 | 85 | ||
86 | SEARCH_PADDING = 10; |
86 | SEARCH_PADDING = 10; |
Line 248... | Line 248... | ||
248 | 248 | ||
249 | PROCEDURE resetTimer; |
249 | PROCEDURE resetTimer; |
250 | BEGIN |
250 | BEGIN |
251 | IF EditBox_Focus(FindEdit) OR EditBox_Focus(ReplaceEdit) OR EditBox_Focus(GotoEdit) THEN |
251 | IF EditBox_Focus(FindEdit) OR EditBox_Focus(ReplaceEdit) OR EditBox_Focus(GotoEdit) THEN |
252 | T.hideCursor; |
252 | T.hideCursor; |
253 | Timer.stop |
253 | Timer.kill |
254 | ELSE |
254 | ELSE |
255 | T.showCursor; |
255 | T.showCursor; |
256 | Timer.reset |
256 | Timer.create(mainTID) |
257 | END |
257 | END |
Line 258... | Line 258... | ||
258 | END resetTimer; |
258 | END resetTimer; |
Line 296... | Line 296... | ||
296 | height = 40; |
296 | height = 40; |
297 | borderColor = 808080H; |
297 | borderColor = 808080H; |
298 | VAR |
298 | VAR |
299 | top, left, right, bottom, x, y, width: INTEGER; |
299 | top, left, right, bottom, x, y, width: INTEGER; |
300 | BEGIN |
300 | BEGIN |
301 | Timer.stop; |
301 | Timer.kill; |
302 | width := minWidth + LENGTH(s)*fontWidth; |
302 | width := minWidth + LENGTH(s)*fontWidth; |
303 | left := (canvas.width - width) DIV 2 + LEFT; |
303 | left := (canvas.width - width) DIV 2 + LEFT; |
304 | top := (canvas.height - height) DIV 2 + TOP; |
304 | top := (canvas.height - height) DIV 2 + TOP; |
305 | bottom := top + height - 1; |
305 | bottom := top + height - 1; |
306 | right := left + width - 1; |
306 | right := left + width - 1; |
Line 409... | Line 409... | ||
409 | 409 | ||
410 | 410 | ||
411 | PROCEDURE WriteModified (x, y: INTEGER); |
411 | PROCEDURE WriteModified (x, y: INTEGER); |
412 | BEGIN |
412 | BEGIN |
413 | modified := text.modified; |
413 | modified := text.modified; |
414 | K.DrawRect(x, TOP + canvas.height + scrollWidth - 1, 8*fontWidth, BOTTOM - scrollWidth + 1, K.winColor); |
414 | K.DrawRect(x, TOP + canvas.height + scrollWidth, 8*fontWidth, BOTTOM - scrollWidth + 1, K.winColor); |
415 | IF modified THEN |
415 | IF modified THEN |
416 | K.DrawText866(x, y, K.textColor, "modified") |
416 | K.DrawText866(x, y, K.textColor, "modified") |
Line 429... | Line 429... | ||
429 | K.DrawText(x, y, K.textColor, E.names[text.enc]); |
429 | K.DrawText(x, y, K.textColor, E.names[text.enc]); |
430 | w := LENGTH(RW.eolNames[text.eol])*fontWidth; |
430 | w := LENGTH(RW.eolNames[text.eol])*fontWidth; |
431 | DEC(x, w + 10); |
431 | DEC(x, w + 10); |
432 | K.DrawText(x, y, K.textColor, RW.eolNames[text.eol]); |
432 | K.DrawText(x, y, K.textColor, RW.eolNames[text.eol]); |
433 | y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2; |
433 | y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2; |
434 | K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth - 1, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor); |
434 | K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor); |
435 | K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName); |
435 | K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName); |
436 | WriteModified(width - 8*fontWidth, y) |
436 | WriteModified(width - 8*fontWidth, y) |
437 | END DrawState; |
437 | END DrawState; |
Line 469... | Line 469... | ||
469 | IF search & T.search(text, searchText, cs, whole) THEN END; |
469 | IF search & T.search(text, searchText, cs, whole) THEN END; |
470 | switch := FALSE |
470 | switch := FALSE |
471 | END; |
471 | END; |
472 | T.draw(text); |
472 | T.draw(text); |
473 | y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2; |
473 | y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2; |
474 | K.DrawRect(LEFT, TOP + canvas.height + scrollWidth - 1, 16*fontWidth, BOTTOM - scrollWidth + 1, K.winColor); |
474 | K.DrawRect(LEFT, TOP + canvas.height + scrollWidth, 16*fontWidth, BOTTOM - scrollWidth + 1, K.winColor); |
475 | WritePos(y); |
475 | WritePos(y); |
Line 476... | Line 476... | ||
476 | 476 | ||
477 | IF modified # text.modified THEN |
477 | IF modified # text.modified THEN |
478 | WriteModified(width - 8*fontWidth, y) |
478 | WriteModified(width - 8*fontWidth, y) |
Line 479... | Line 479... | ||
479 | END; |
479 | END; |
480 | 480 | ||
481 | T.getScroll(text, scrollX, scrollY); |
481 | T.getScroll(text, scrollX, scrollY); |
Line 482... | Line 482... | ||
482 | DrawScroll(vScroll, LEFT + canvas.width - 1, TOP - 1, scrollY, text.count - 1); |
482 | DrawScroll(vScroll, LEFT + canvas.width, TOP - 1, scrollY, text.count - 1); |
483 | DrawScroll(hScroll, LEFT, TOP + canvas.height - 1, scrollX, text.maxLength); |
483 | DrawScroll(hScroll, LEFT, TOP + canvas.height, scrollX, text.maxLength); |
484 | 484 | ||
485 | G.DrawCanvas(canvas, LEFT, TOP); |
485 | G.DrawCanvas(canvas, LEFT, TOP); |
Line 503... | Line 503... | ||
503 | END; |
503 | END; |
504 | K.SetWinSize(winWidth, winHeight); |
504 | K.SetWinSize(winWidth, winHeight); |
505 | K.WinSize(winWidth, winHeight); |
505 | K.WinSize(winWidth, winHeight); |
506 | K.ClientSize(cliWidth, cliHeight); |
506 | K.ClientSize(cliWidth, cliHeight); |
507 | G.destroy(canvas); |
507 | G.destroy(canvas); |
508 | canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 1), cliHeight - (TOP + BOTTOM)); |
508 | canvas := G.CreateCanvas(cliWidth - (LEFT + RIGHT + 2), cliHeight - (TOP + BOTTOM + 1)); |
509 | Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, cliWidth - (LEFT + RIGHT + 1), Tabs.tabHeight); |
509 | Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, cliWidth - (LEFT + RIGHT + 2), Tabs.tabHeight); |
510 | G.SetFont(canvas, font); |
510 | G.SetFont(canvas, font); |
511 | T.setCanvas(canvas); |
511 | T.setCanvas(canvas); |
512 | T.resize(canvas.width, canvas.height); |
512 | T.resize(canvas.width, canvas.height); |
513 | Scroll.resize(vScroll, vScroll.width, canvas.height + 1); |
513 | Scroll.resize(vScroll, vScroll.width, canvas.height + 2); |
514 | Scroll.resize(hScroll, canvas.width, hScroll.height); |
514 | Scroll.resize(hScroll, canvas.width + 1, hScroll.height); |
515 | END resize; |
515 | END resize; |
Line 516... | Line 516... | ||
516 | 516 | ||
517 | 517 | ||
Line 609... | Line 609... | ||
609 | confirm := FALSE; |
609 | confirm := FALSE; |
610 | K.ClientSize(width, height); |
610 | K.ClientSize(width, height); |
Line 611... | Line 611... | ||
611 | 611 | ||
612 | K.DrawRect(0, 0, width, TOP, K.winColor); |
612 | K.DrawRect(0, 0, width, TOP, K.winColor); |
613 | K.DrawRect(0, 0, LEFT, height, K.winColor); |
613 | K.DrawRect(0, 0, LEFT, height, K.winColor); |
Line 614... | Line 614... | ||
614 | K.DrawRect(LEFT + canvas.width - 1, TOP + canvas.height - 1, scrollWidth, scrollWidth, K.winColor); |
614 | K.DrawRect(LEFT + canvas.width + 1, TOP + canvas.height, scrollWidth - 1, scrollWidth, K.winColor); |
615 | 615 | ||
616 | drawMainMenu(menuFile, menuFileX, btnFile, "file"); |
616 | drawMainMenu(menuFile, menuFileX, btnFile, "file"); |
617 | drawMainMenu(menuEdit, menuEditX, btnEdit, "edit"); |
617 | drawMainMenu(menuEdit, menuEditX, btnEdit, "edit"); |
Line 696... | Line 696... | ||
696 | 696 | ||
697 | 697 | ||
698 | PROCEDURE stopTimer; |
698 | PROCEDURE stopTimer; |
699 | BEGIN |
699 | BEGIN |
700 | T.hideCursor; |
700 | T.hideCursor; |
701 | Timer.stop; |
- | |
702 | repaint; |
701 | Timer.kill; |
Line 703... | Line 702... | ||
703 | Timer.stop |
702 | repaint |
704 | END stopTimer; |
703 | END stopTimer; |
Line 865... | Line 864... | ||
865 | K.CreateButton(btnYes, left + 10, top + 35, btnWidth, btnHeight, K.btnColor, "yes"); |
864 | K.CreateButton(btnYes, left + 10, top + 35, btnWidth, btnHeight, K.btnColor, "yes"); |
866 | K.CreateButton(btnNo, left + 20 + btnWidth, top + 35, btnWidth, btnHeight, K.btnColor, "no"); |
865 | K.CreateButton(btnNo, left + 20 + btnWidth, top + 35, btnWidth, btnHeight, K.btnColor, "no"); |
867 | END Confirm; |
866 | END Confirm; |
Line 868... | Line -... | ||
868 | - | ||
869 | - | ||
870 | PROCEDURE Exit; |
- | |
871 | BEGIN |
- | |
872 | Timer.kill; |
- | |
873 | K.Exit |
- | |
874 | END Exit; |
- | |
875 | 867 | ||
876 | 868 | ||
877 | PROCEDURE closeFile (conf: BOOLEAN; n: INTEGER); |
869 | PROCEDURE closeFile (conf: BOOLEAN; n: INTEGER); |
878 | VAR |
870 | VAR |
879 | i: INTEGER; |
871 | i: INTEGER; |
Line 890... | Line 882... | ||
890 | DEC(curText) |
882 | DEC(curText) |
891 | END; |
883 | END; |
892 | IF curText >= 0 THEN |
884 | IF curText >= 0 THEN |
893 | Switch(texts[curText]) |
885 | Switch(texts[curText]) |
894 | ELSE |
886 | ELSE |
895 | Exit |
887 | K.Exit |
896 | END; |
888 | END; |
897 | draw_window |
889 | draw_window |
898 | END |
890 | END |
899 | END closeFile; |
891 | END closeFile; |
Line 1256... | Line 1248... | ||
1256 | 1248 | ||
1257 | Menu.setEnabled(subCase, menuUpper, selected); |
1249 | Menu.setEnabled(subCase, menuUpper, selected); |
Line 1258... | Line 1250... | ||
1258 | Menu.setEnabled(subCase, menuLower, selected); |
1250 | Menu.setEnabled(subCase, menuLower, selected); |
1259 | 1251 | ||
1260 | IF menu # NIL THEN |
1252 | IF menu # NIL THEN |
1261 | Timer.stop; |
1253 | Timer.kill; |
1262 | IF Menu.opened(menu) THEN |
1254 | IF Menu.opened(menu) THEN |
1263 | Menu.close(menu) |
1255 | Menu.close(menu) |
1264 | END; |
1256 | END; |
Line 1271... | Line 1263... | ||
1271 | PROCEDURE receiveIPC; |
1263 | PROCEDURE receiveIPC; |
1272 | VAR |
1264 | VAR |
1273 | scrollIPC: BOOLEAN; |
1265 | scrollIPC: BOOLEAN; |
1274 | BEGIN |
1266 | BEGIN |
1275 | scrollIPC := FALSE; |
1267 | scrollIPC := FALSE; |
1276 | - | ||
1277 | IF IPC[0] = Timer.ID THEN |
1268 | IF IPC[0] = Timer.ID THEN |
- | 1269 | IF IPC[4] = Timer.n THEN |
|
1278 | T.toggleCursor; |
1270 | T.toggleCursor; |
1279 | repaint; |
1271 | repaint |
- | 1272 | END; |
|
1280 | IPC[2] := 0 |
1273 | IPC[2] := 0 |
1281 | ELSIF IPC[0] = mainTID THEN |
1274 | ELSIF IPC[0] = mainTID THEN |
1282 | IF IPC[2] = Scroll.ScrollIPC THEN |
1275 | IF IPC[2] = Scroll.ScrollIPC THEN |
1283 | Scroll.change(hScroll); |
1276 | Scroll.change(hScroll); |
1284 | IF hScroll.Dec THEN |
1277 | IF hScroll.Dec THEN |
Line 2126... | Line 2119... | ||
2126 | winWidth := MAX(winWidth, minWinWidth); |
2119 | winWidth := MAX(winWidth, minWinWidth); |
2127 | winHeight := MAX(winHeight, minWinHeight); |
2120 | winHeight := MAX(winHeight, minWinHeight); |
2128 | cliWidth := winWidth; |
2121 | cliWidth := winWidth; |
2129 | cliHeight := winHeight; |
2122 | cliHeight := winHeight; |
2130 | LEFT := searchLeft; |
2123 | LEFT := searchLeft; |
2131 | canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 10), winHeight - (TOP + BOTTOM + 4) - K.SkinHeight()); |
2124 | canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 11), winHeight - (TOP + BOTTOM + 5) - K.SkinHeight()); |
2132 | tabs := Tabs.create(); |
2125 | tabs := Tabs.create(); |
2133 | Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight); |
2126 | Tabs.setArea(tabs, LEFT, TOP - Tabs.tabHeight, canvas.width, Tabs.tabHeight); |
2134 | font1 := G.CreateFont(1, "", {}); |
2127 | font1 := G.CreateFont(1, "", {}); |
2135 | font2 := G.CreateFont(2, "", {}); |
2128 | font2 := G.CreateFont(2, "", {}); |
2136 | font := font1; |
2129 | font := font1; |
Line 2164... | Line 2157... | ||
2164 | filePath := "/rd/1" |
2157 | filePath := "/rd/1" |
2165 | ELSE |
2158 | ELSE |
2166 | text := T.open(fileName, err); |
2159 | text := T.open(fileName, err); |
2167 | IF text = NIL THEN |
2160 | IF text = NIL THEN |
2168 | error("'cedit: error opening file' -E"); |
2161 | error("'cedit: error opening file' -E"); |
2169 | Exit |
2162 | K.Exit |
2170 | ELSE |
2163 | ELSE |
2171 | U.getPath(fileName, filePath) |
2164 | U.getPath(fileName, filePath) |
2172 | END |
2165 | END |
2173 | END; |
2166 | END; |
2174 | OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, ""); |
2167 | OD := OpenDlg.Create(draw_window, OpenDlg.topen, filePath, ""); |
2175 | insert(0, text); |
2168 | insert(0, text); |
2176 | Scroll.create(FALSE, canvas.width, scrollWidth, scrollWidth, scrollWidth, hScroll); |
2169 | Scroll.create(FALSE, canvas.width + 1, scrollWidth, scrollWidth, scrollWidth, hScroll); |
2177 | Scroll.create(TRUE, scrollWidth, canvas.height, scrollWidth, scrollWidth, vScroll); |
2170 | Scroll.create(TRUE, scrollWidth, canvas.height + 1, scrollWidth, scrollWidth, vScroll); |
2178 | T.resize(canvas.width, canvas.height); |
2171 | T.resize(canvas.width, canvas.height); |
2179 | T.SetPos(text, 0, 0); |
2172 | T.SetPos(text, 0, 0); |
2180 | confirm := FALSE; |
2173 | confirm := FALSE; |
2181 | notFound := FALSE; |
2174 | notFound := FALSE; |
2182 | menuFindClicked := FALSE; |
2175 | menuFindClicked := FALSE; |