Subversion Repositories Kolibri OS

Rev

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

Rev 8848 Rev 8859
Line 26... Line 26...
26
    CB := Clipboard, Languages,
26
    CB := Clipboard, Languages,
27
    ChangeLog, Scroll,
27
    ChangeLog, Scroll,
28
    RW, Ini, box_lib, Icons;
28
    RW, Ini, box_lib, Icons;
Line 29... Line 29...
29
 
29
 
30
CONST
30
CONST
Line 31... Line 31...
31
    header = "CEdit (14-jun-2021)";
31
    header = "CEdit (15-jun-2021)";
32
 
32
 
Line 33... Line 33...
33
    ShellFilter = "";
33
    ShellFilter = "";
Line 76... Line 76...
76
    btnHeight = 25;
76
    btnHeight = 25;
77
    btnWidth = 75;
77
    btnWidth = 75;
78
    btnTop = MainMenuHeight + 3;
78
    btnTop = MainMenuHeight + 3;
79
    toolBtnSize = 24;
79
    toolBtnSize = 24;
80
    toolbarDelim = 7;
80
    toolbarDelim = 7;
-
 
81
    iconPad = (toolBtnSize - Icons.SIZE) DIV 2;
Line 81... Line 82...
81
 
82
 
82
    TOP = btnTop + toolBtnSize + 7;
83
    TOP = btnTop + toolBtnSize + 7;
83
    RIGHT = scrollWidth - 2;
84
    RIGHT = scrollWidth - 2;
Line 84... Line 85...
84
    BOTTOM = scrollWidth + 25;
85
    BOTTOM = scrollWidth + 18;
Line 85... Line 86...
85
 
86
 
86
    minWinWidth = 635; minWinHeight = 542;
87
    minWinWidth = 635; minWinHeight = 542;
87
 
88
 
88
    SEARCH_PADDING = 10;
89
    SEARCH_PADDING = 10;
Line 89... Line 90...
89
    searchLeft = 10;
90
    searchLeft = 0;
90
    EditBox_Width = 180;
91
    EditBox_Width = 180;
Line 268... Line 269...
268
    END
269
    END
269
END Replaced;
270
END Replaced;
Line 270... Line 271...
270
 
271
 
271
 
-
 
272
PROCEDURE toolbarIcons;
-
 
273
CONST
272
 
274
    iconPad = (toolBtnSize - Icons.SIZE) DIV 2;
273
PROCEDURE toolbarIcons;
275
VAR
274
VAR
276
    x, color: INTEGER;
275
    x, color: INTEGER;
277
BEGIN
276
BEGIN
Line 327... Line 326...
327
 
326
 
328
 
327
 
329
PROCEDURE WriteModified (x, y: INTEGER);
328
PROCEDURE WriteModified (x, y: INTEGER);
330
BEGIN
329
BEGIN
331
    modified := text.modified;
330
    modified := text.modified;
332
    K.DrawRect(x, TOP + canvas.height + scrollWidth - 1, 9*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
331
    K.DrawRect(x, TOP + canvas.height + scrollWidth - 1, 8*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
333
    IF modified THEN
332
    IF modified THEN
334
        K.DrawText866(x, y, K.textColor, "modified")
333
        K.DrawText866(x, y, K.textColor, "modified")
Line 351... Line 350...
351
        y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
350
        y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
352
        K.DrawRect(LEFT, TOP + canvas.height + scrollWidth - 1, 16*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
351
        K.DrawRect(LEFT, TOP + canvas.height + scrollWidth - 1, 16*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
353
        WritePos(y);
352
        WritePos(y);
Line 354... Line 353...
354
 
353
 
355
        IF modified # text.modified THEN
354
        IF modified # text.modified THEN
356
            WriteModified(width - 9*fontWidth, y)
355
            WriteModified(width - 8*fontWidth, y)
Line 357... Line 356...
357
        END;
356
        END;
358
 
357
 
359
        T.getScroll(text, scrollX, scrollY);
358
        T.getScroll(text, scrollX, scrollY);
Line 443... Line 442...
443
    K.CreateButton(btnGoto, left, top + 380, btnWidth, btnHeight, K.btnColor, "go");
442
    K.CreateButton(btnGoto, left, top + 380, btnWidth, btnHeight, K.btnColor, "go");
444
END SearchPanel;
443
END SearchPanel;
Line 445... Line 444...
445
 
444
 
446
 
-
 
447
PROCEDURE draw_window;
-
 
448
CONST
445
 
449
    iconPad = (toolBtnSize - Icons.SIZE) DIV 2;
446
PROCEDURE draw_window;
Line 450... Line 447...
450
VAR
447
VAR
Line 525... Line 522...
525
 
522
 
526
        drawToolbarBtn(btnLower, x);
523
        drawToolbarBtn(btnLower, x);
Line 527... Line 524...
527
        INC(x, toolBtnSize + 5 + toolbarDelim);
524
        INC(x, toolBtnSize + 5 + toolbarDelim);
528
 
-
 
529
        drawToolbarBtn(btnBuild, x);
525
 
Line 530... Line 526...
530
        Icons.draw(icons, 54, x + iconPad, btnTop + iconPad);
526
        drawToolbarBtn(btnBuild, x);
531
        INC(x, toolBtnSize + 5);
-
 
532
 
527
        INC(x, toolBtnSize + 5);
Line -... Line 528...
-
 
528
 
-
 
529
        drawToolbarBtn(btnRun, x);
533
        drawToolbarBtn(btnRun, x);
530
        INC(x, toolBtnSize + 5);
534
        Icons.draw(icons, 53, x + iconPad, btnTop + iconPad);
531
 
535
        INC(x, toolBtnSize + 5);
532
        toolbarIcons;
536
 
533
 
Line 547... Line 544...
547
        K.PutPixel(LEFT + canvas.width + scrollWidth - 2, TOP, K.winColor);
544
        K.PutPixel(LEFT + canvas.width + scrollWidth - 2, TOP, K.winColor);
548
        K.PutPixel(LEFT, TOP + canvas.height + scrollWidth - 2, K.winColor);
545
        K.PutPixel(LEFT, TOP + canvas.height + scrollWidth - 2, K.winColor);
Line 549... Line 546...
549
 
546
 
550
        y := (btnHeight - fontHeight) DIV 2 + btnTop;
547
        y := (btnHeight - fontHeight) DIV 2 + btnTop;
551
        CASE text.enc OF
548
        CASE text.enc OF
552
        |E.UTF8:    K.DrawText866(width -  6*fontWidth, y, K.textColor, "UTF-8")
549
        |E.UTF8:    K.DrawText866(width -  5*fontWidth, y, K.textColor, "UTF-8")
553
        |E.UTF8BOM: K.DrawText866(width - 10*fontWidth, y, K.textColor, "UTF-8-BOM")
550
        |E.UTF8BOM: K.DrawText866(width -  9*fontWidth, y, K.textColor, "UTF-8-BOM")
554
        |E.CP866:   K.DrawText866(width -  6*fontWidth, y, K.textColor, "CP866")
551
        |E.CP866:   K.DrawText866(width -  5*fontWidth, y, K.textColor, "CP866")
555
        |E.W1251:   K.DrawText866(width - 13*fontWidth, y, K.textColor, "Windows-1251")
552
        |E.W1251:   K.DrawText866(width - 12*fontWidth, y, K.textColor, "Windows-1251")
556
        END;
553
        END;
557
        IF search THEN
554
        IF search THEN
558
            SearchPanel(searchLeft, TOP)
555
            SearchPanel(searchLeft, TOP)
Line 559... Line 556...
559
        END;
556
        END;
560
 
557
 
561
        y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
558
        y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
562
        K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth - 1, width - LEFT - 25*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
559
        K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth - 1, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
563
        K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
560
        K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
564
        WriteModified(width - 9*fontWidth, y);
561
        WriteModified(width - 8*fontWidth, y);
565
        repaint
562
        repaint
566
    END;
563
    END;
Line 751... Line 748...
751
 
748
 
752
PROCEDURE Search;
749
PROCEDURE Search;
753
BEGIN
750
BEGIN
754
    search := ~search;
751
    search := ~search;
755
    IF search THEN
752
    IF search THEN
756
        LEFT := searchLeft + EditBox_Width + SEARCH_PADDING*3;
753
        LEFT := searchLeft + EditBox_Width + SEARCH_PADDING*2 + 5;
757
        IF T.search(text, searchText, cs, whole) THEN END
754
        IF T.search(text, searchText, cs, whole) THEN END
758
    ELSE
755
    ELSE
759
        LEFT := searchLeft;
756
        LEFT := searchLeft;
760
        IF T.search(text, "", FALSE, FALSE) THEN END
757
        IF T.search(text, "", FALSE, FALSE) THEN END
Line 1243... Line 1240...
1243
    winHeight := winHeight - (128 + 30);
1240
    winHeight := winHeight - (128 + 30);
1244
    winWidth := MAX(winWidth, minWinWidth);
1241
    winWidth := MAX(winWidth, minWinWidth);
1245
    winHeight := MAX(winHeight, minWinHeight);
1242
    winHeight := MAX(winHeight, minWinHeight);
1246
    cliWidth := winWidth;
1243
    cliWidth := winWidth;
1247
    cliHeight := winHeight;
1244
    cliHeight := winHeight;
1248
    LEFT := 10;
1245
    LEFT := searchLeft;
1249
    canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 10), winHeight - (TOP + BOTTOM + 4) - K.SkinHeight());
1246
    canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 10), winHeight - (TOP + BOTTOM + 4) - K.SkinHeight());
1250
    font1 := G.CreateFont(1, "", {});
1247
    font1 := G.CreateFont(1, "", {});
1251
    font2 := G.CreateFont(2, "", {});
1248
    font2 := G.CreateFont(2, "", {});
1252
    font := font1;
1249
    font := font1;
1253
    G.SetFont(canvas, font);
1250
    G.SetFont(canvas, font);