Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8848 → Rev 8859

/programs/develop/cedit/CEDIT
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programs/develop/cedit/SRC/CEdit.ob07
28,7 → 28,7
RW, Ini, box_lib, Icons;
 
CONST
header = "CEdit (14-jun-2021)";
header = "CEdit (15-jun-2021)";
 
ShellFilter = "";
EditFilter = "SH|ASM|TXT|INC|OB07|C|CPP|H|PAS|PP|LUA|INI";
78,15 → 78,16
btnTop = MainMenuHeight + 3;
toolBtnSize = 24;
toolbarDelim = 7;
iconPad = (toolBtnSize - Icons.SIZE) DIV 2;
 
TOP = btnTop + toolBtnSize + 7;
RIGHT = scrollWidth - 2;
BOTTOM = scrollWidth + 25;
BOTTOM = scrollWidth + 18;
 
minWinWidth = 635; minWinHeight = 542;
 
SEARCH_PADDING = 10;
searchLeft = 10;
searchLeft = 0;
EditBox_Width = 180;
EDITBOX_MAXCHARS = 500;
 
270,8 → 271,6
 
 
PROCEDURE toolbarIcons;
CONST
iconPad = (toolBtnSize - Icons.SIZE) DIV 2;
VAR
x, color: INTEGER;
BEGIN
329,7 → 328,7
PROCEDURE WriteModified (x, y: INTEGER);
BEGIN
modified := text.modified;
K.DrawRect(x, TOP + canvas.height + scrollWidth - 1, 9*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
K.DrawRect(x, TOP + canvas.height + scrollWidth - 1, 8*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
IF modified THEN
K.DrawText866(x, y, K.textColor, "modified")
END
353,7 → 352,7
WritePos(y);
 
IF modified # text.modified THEN
WriteModified(width - 9*fontWidth, y)
WriteModified(width - 8*fontWidth, y)
END;
 
T.getScroll(text, scrollX, scrollY);
445,8 → 444,6
 
 
PROCEDURE draw_window;
CONST
iconPad = (toolBtnSize - Icons.SIZE) DIV 2;
VAR
width, height, x, y: INTEGER;
 
527,13 → 524,13
INC(x, toolBtnSize + 5 + toolbarDelim);
 
drawToolbarBtn(btnBuild, x);
Icons.draw(icons, 54, x + iconPad, btnTop + iconPad);
INC(x, toolBtnSize + 5);
 
drawToolbarBtn(btnRun, x);
Icons.draw(icons, 53, x + iconPad, btnTop + iconPad);
INC(x, toolBtnSize + 5);
 
toolbarIcons;
 
K.CreateButton(btnUp, LEFT + canvas.width - 1, TOP, scrollWidth - 1, scrollWidth, K.btnColor, 0X);
K.DrawText69(LEFT + canvas.width - 1 + (scrollWidth - 6) DIV 2, TOP + (scrollWidth - 9) DIV 2, K.btnTextColor, 18X);
K.CreateButton(btnDown, LEFT + canvas.width - 1, TOP + canvas.height - scrollWidth - 1, scrollWidth - 1, scrollWidth, K.btnColor, 0X);
549,10 → 546,10
 
y := (btnHeight - fontHeight) DIV 2 + btnTop;
CASE text.enc OF
|E.UTF8: K.DrawText866(width - 6*fontWidth, y, K.textColor, "UTF-8")
|E.UTF8BOM: K.DrawText866(width - 10*fontWidth, y, K.textColor, "UTF-8-BOM")
|E.CP866: K.DrawText866(width - 6*fontWidth, y, K.textColor, "CP866")
|E.W1251: K.DrawText866(width - 13*fontWidth, y, K.textColor, "Windows-1251")
|E.UTF8: K.DrawText866(width - 5*fontWidth, y, K.textColor, "UTF-8")
|E.UTF8BOM: K.DrawText866(width - 9*fontWidth, y, K.textColor, "UTF-8-BOM")
|E.CP866: K.DrawText866(width - 5*fontWidth, y, K.textColor, "CP866")
|E.W1251: K.DrawText866(width - 12*fontWidth, y, K.textColor, "Windows-1251")
END;
IF search THEN
SearchPanel(searchLeft, TOP)
559,9 → 556,9
END;
 
y := height - (BOTTOM - scrollWidth) + (BOTTOM - scrollWidth - 16) DIV 2;
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth - 1, width - LEFT - 25*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
K.DrawRect(LEFT + 16*fontWidth, TOP + canvas.height + scrollWidth - 1, width - LEFT - 24*fontWidth, BOTTOM - scrollWidth + 1, K.winColor);
K.DrawText866(LEFT + 16*fontWidth, y, K.textColor, text.fileName);
WriteModified(width - 9*fontWidth, y);
WriteModified(width - 8*fontWidth, y);
repaint
END;
K.EndDraw
753,7 → 750,7
BEGIN
search := ~search;
IF search THEN
LEFT := searchLeft + EditBox_Width + SEARCH_PADDING*3;
LEFT := searchLeft + EditBox_Width + SEARCH_PADDING*2 + 5;
IF T.search(text, searchText, cs, whole) THEN END
ELSE
LEFT := searchLeft;
1245,7 → 1242,7
winHeight := MAX(winHeight, minWinHeight);
cliWidth := winWidth;
cliHeight := winHeight;
LEFT := 10;
LEFT := searchLeft;
canvas := G.CreateCanvas(winWidth - (LEFT + RIGHT + 10), winHeight - (TOP + BOTTOM + 4) - K.SkinHeight());
font1 := G.CreateFont(1, "", {});
font2 := G.CreateFont(2, "", {});
/programs/develop/cedit/SRC/Icons.ob07
0,0 → 1,127
(*
Copyright 2021 Anton Krotov
 
This file is part of CEdit.
 
CEdit is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
CEdit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with CEdit. If not, see <http://www.gnu.org/licenses/>.
*)
 
MODULE Icons;
 
IMPORT
LibImg, K := KolibriOS, SYSTEM;
 
CONST
fileName = "/rd/1/Icons16.png";
SIZE* = 18;
 
VAR
source: INTEGER;
 
 
PROCEDURE copy (src, dst: INTEGER);
VAR
src_sizeX, src_sizeY, dst_sizeX, dst_sizeY,
src_data, dst_data: INTEGER;
BEGIN
LibImg.GetInf(src, src_sizeX, src_sizeY, src_data);
LibImg.GetInf(dst, dst_sizeX, dst_sizeY, dst_data);
ASSERT(src_sizeX = dst_sizeX);
ASSERT(src_sizeY = dst_sizeY);
SYSTEM.MOVE(src_data, dst_data, src_sizeX*src_sizeY*3)
END copy;
 
 
PROCEDURE load (): INTEGER;
VAR
y: INTEGER;
BEGIN
RETURN LibImg.LoadFromFile(fileName, SIZE, y)
END load;
 
 
PROCEDURE draw* (icons, n, x, y: INTEGER);
VAR
sizeX, sizeY, data: INTEGER;
BEGIN
LibImg.GetInf(icons, sizeX, sizeY, data);
K.DrawImage(data + SIZE*SIZE*3*n, SIZE, SIZE, x, y)
END draw;
 
 
PROCEDURE gray (icons: INTEGER);
VAR
sizeX, sizeY, data, x, y: INTEGER;
b, g, r, gr: BYTE;
BEGIN
LibImg.GetInf(icons, sizeX, sizeY, data);
FOR y := 0 TO sizeY - 1 DO
FOR x := 0 TO sizeX - 1 DO
SYSTEM.GET8(data, b);
SYSTEM.GET8(data + 1, g);
SYSTEM.GET8(data + 2, r);
gr := (r + g + b) DIV 3;
SYSTEM.PUT8(data, gr);
SYSTEM.PUT8(data + 1, gr);
SYSTEM.PUT8(data + 2, gr);
INC(data, 3);
END
END
END gray;
 
 
PROCEDURE iconsBackColor (icons: INTEGER);
VAR
sizeX, sizeY, data, x, y: INTEGER;
b, g, r: BYTE;
BEGIN
LibImg.GetInf(icons, sizeX, sizeY, data);
FOR y := 0 TO sizeY - 1 DO
FOR x := 0 TO sizeX - 1 DO
SYSTEM.GET8(data, b);
SYSTEM.GET8(data + 1, g);
SYSTEM.GET8(data + 2, r);
IF b + g + r = 765 THEN
b := K.toolbarColor MOD 256;
g := K.toolbarColor DIV 256 MOD 256;
r := K.toolbarColor DIV 65536 MOD 256
END;
SYSTEM.PUT8(data, b);
SYSTEM.PUT8(data + 1, g);
SYSTEM.PUT8(data + 2, r);
INC(data, 3);
END
END
END iconsBackColor;
 
 
PROCEDURE get* (VAR icons, grayIcons: INTEGER);
BEGIN
IF source = 0 THEN
source := load();
icons := load();
grayIcons := load()
ELSE
copy(source, icons);
copy(source, grayIcons)
END;
gray(grayIcons);
iconsBackColor(icons);
iconsBackColor(grayIcons)
END get;
 
 
BEGIN
source := 0
END Icons.