forked from KolibriOS/kolibrios
CEdit: added ctrl+T (new tab); small GUI changes
git-svn-id: svn://kolibrios.org@9431 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
8c8771e04d
commit
2689ca976d
Binary file not shown.
@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
ctrl+S сохранить
|
ctrl+S сохранить
|
||||||
ctrl+O открыть
|
ctrl+O открыть
|
||||||
ctrl+N создать новый
|
ctrl+N,
|
||||||
|
ctrl+T создать новый
|
||||||
ctrl+W закрыть файл
|
ctrl+W закрыть файл
|
||||||
ctrl+Tab переключиться на следующую вкладку
|
ctrl+Tab переключиться на следующую вкладку
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ IMPORT
|
|||||||
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
|
RW, Ini, EB := EditBox, Icons, Tabs, Timer;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
HEADER = "CEdit (11-dec-2021)";
|
HEADER = "CEdit (17-dec-2021)";
|
||||||
|
|
||||||
ShellFilter = "";
|
ShellFilter = "";
|
||||||
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
|
||||||
@ -916,8 +916,10 @@ BEGIN
|
|||||||
IF nov = NIL THEN
|
IF nov = NIL THEN
|
||||||
error("error opening file")
|
error("error opening file")
|
||||||
ELSE
|
ELSE
|
||||||
|
T.SetPos(nov, 0, 0);
|
||||||
insert(textsCount, nov);
|
insert(textsCount, nov);
|
||||||
T.SetPos(nov, 0, 0)
|
Scroll.setValue(hScroll, 0);
|
||||||
|
Scroll.setValue(vScroll, 0)
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
SwitchTab(n)
|
SwitchTab(n)
|
||||||
@ -1814,7 +1816,8 @@ BEGIN
|
|||||||
|45: key := ORD("X")
|
|45: key := ORD("X")
|
||||||
|46: key := ORD("C")
|
|46: key := ORD("C")
|
||||||
|47: key := ORD("V")
|
|47: key := ORD("V")
|
||||||
|49: key := -1;
|
|49,
|
||||||
|
20: key := -1;
|
||||||
NewFile
|
NewFile
|
||||||
ELSE
|
ELSE
|
||||||
key := -1
|
key := -1
|
||||||
@ -2011,6 +2014,10 @@ BEGIN
|
|||||||
leftButton := FALSE;
|
leftButton := FALSE;
|
||||||
T.selectWord(text);
|
T.selectWord(text);
|
||||||
repaint
|
repaint
|
||||||
|
ELSIF Tabs.DblClicked(tabs, x + LEFT, y + TOP) THEN
|
||||||
|
leftButton := FALSE;
|
||||||
|
NewFile;
|
||||||
|
repaint
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
firstClickX := x;
|
firstClickX := x;
|
||||||
|
@ -26,6 +26,8 @@ CONST
|
|||||||
padding = 4;
|
padding = 4;
|
||||||
fontWidth = K.fontWidth;
|
fontWidth = K.fontWidth;
|
||||||
fontHeight = K.fontHeight;
|
fontHeight = K.fontHeight;
|
||||||
|
bColor = 0FFFFFFH;
|
||||||
|
fColor = 0008000H;
|
||||||
|
|
||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
@ -43,21 +45,30 @@ TYPE
|
|||||||
PROCEDURE paint* (chkbox: tCheckBox);
|
PROCEDURE paint* (chkbox: tCheckBox);
|
||||||
VAR
|
VAR
|
||||||
canvas: G.tCanvas;
|
canvas: G.tCanvas;
|
||||||
|
(*r1, r2, g1, g2, b1, b2: BYTE;*)
|
||||||
BEGIN
|
BEGIN
|
||||||
canvas := chkbox.canvas;
|
canvas := chkbox.canvas;
|
||||||
IF canvas # NIL THEN
|
IF canvas # NIL THEN
|
||||||
G.SetColor(canvas, K.winColor);
|
G.SetColor(canvas, K.winColor);
|
||||||
G.clear(canvas);
|
G.clear(canvas);
|
||||||
G.SetColor(canvas, 0FFFFFFH);
|
G.SetColor(canvas, bColor);
|
||||||
G.FillRect(canvas, 0, 0, fontHeight - 1, fontHeight - 1);
|
G.FillRect(canvas, 0, 0, fontHeight - 1, fontHeight - 1);
|
||||||
G.SetColor(canvas, K.borderColor);
|
G.SetColor(canvas, K.borderColor);
|
||||||
G.Rect(canvas, 0, 0, fontHeight - 1, fontHeight - 1);
|
G.Rect(canvas, 0, 0, fontHeight - 1, fontHeight - 1);
|
||||||
IF chkbox.value THEN
|
IF chkbox.value THEN
|
||||||
G.SetColor(canvas, 0008000H);
|
G.SetColor(canvas, fColor);
|
||||||
G.DLine(canvas, 2, 6, 6, -1);
|
G.DLine(canvas, 2, 6, 6, -1);
|
||||||
G.DLine(canvas, 2, 6, 7, -1);
|
G.DLine(canvas, 2, 6, 7, -1);
|
||||||
G.DLine(canvas, 7, 13, 9, 1);
|
G.DLine(canvas, 7, 13, 9, 1);
|
||||||
G.DLine(canvas, 7, 13, 10, 1)
|
G.DLine(canvas, 7, 13, 10, 1);
|
||||||
|
(*G.getRGB(bColor, r1, g1, b1);
|
||||||
|
G.getRGB(fColor, r2, g2, b2);
|
||||||
|
G.SetColor(canvas, (b1 + b2) DIV 2 + ((g1 + g2) DIV 2)*256 + ((r1 + r2) DIV 2)*65536);
|
||||||
|
*)
|
||||||
|
G.DLine(canvas, 2, 6, 8, -1);
|
||||||
|
G.DLine(canvas, 7, 13, 11, 1);
|
||||||
|
G.DLine(canvas, 2, 6, 5, -1);
|
||||||
|
G.DLine(canvas, 7, 13, 8, 1);
|
||||||
END;
|
END;
|
||||||
G.SetTextColor(canvas, K.textColor);
|
G.SetTextColor(canvas, K.textColor);
|
||||||
G.SetBkColor(canvas, K.winColor);
|
G.SetBkColor(canvas, K.winColor);
|
||||||
|
@ -51,6 +51,14 @@ TYPE
|
|||||||
END;
|
END;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE getRGB* (color: INTEGER; VAR r, g, b: BYTE);
|
||||||
|
BEGIN
|
||||||
|
b := color MOD 256;
|
||||||
|
g := color DIV 256 MOD 256;
|
||||||
|
r := color DIV 65536 MOD 256
|
||||||
|
END getRGB;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE DrawCanvas* (canvas: tCanvas; x, y: INTEGER);
|
PROCEDURE DrawCanvas* (canvas: tCanvas; x, y: INTEGER);
|
||||||
BEGIN
|
BEGIN
|
||||||
K.sysfunc7(65, canvas.bitmap, canvas.width*65536 + canvas.height, x*65536 + y, 32, 0, 0);
|
K.sysfunc7(65, canvas.bitmap, canvas.width*65536 + canvas.height, x*65536 + y, 32, 0, 0);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
MODULE Icons;
|
MODULE Icons;
|
||||||
|
|
||||||
IMPORT
|
IMPORT
|
||||||
LibImg, K := KolibriOS, SYSTEM;
|
LibImg, K := KolibriOS, Graph, SYSTEM;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
fileName = "/rd/1/Icons16.png";
|
fileName = "/rd/1/Icons16.png";
|
||||||
@ -93,9 +93,7 @@ BEGIN
|
|||||||
SYSTEM.GET8(data + 1, g);
|
SYSTEM.GET8(data + 1, g);
|
||||||
SYSTEM.GET8(data + 2, r);
|
SYSTEM.GET8(data + 2, r);
|
||||||
IF b + g + r = 765 THEN
|
IF b + g + r = 765 THEN
|
||||||
b := K.toolbarColor MOD 256;
|
Graph.getRGB(K.toolbarColor, r, g, b)
|
||||||
g := K.toolbarColor DIV 256 MOD 256;
|
|
||||||
r := K.toolbarColor DIV 65536 MOD 256
|
|
||||||
END;
|
END;
|
||||||
SYSTEM.PUT8(data, b);
|
SYSTEM.PUT8(data, b);
|
||||||
SYSTEM.PUT8(data + 1, g);
|
SYSTEM.PUT8(data + 1, g);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
MODULE Tabs;
|
MODULE Tabs;
|
||||||
|
|
||||||
IMPORT List, K := KolibriOS, RW;
|
IMPORT List, K := KolibriOS, RW, U := Utils;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
|
|
||||||
@ -42,11 +42,16 @@ TYPE
|
|||||||
strings: List.tList;
|
strings: List.tList;
|
||||||
first, current: INTEGER;
|
first, current: INTEGER;
|
||||||
width, height: INTEGER;
|
width, height: INTEGER;
|
||||||
x, y: INTEGER
|
x, y, freeX: INTEGER
|
||||||
|
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
|
||||||
|
PROCEDURE DblClicked* (t: tTabs; x, y: INTEGER): BOOLEAN;
|
||||||
|
RETURN (x > t.freeX) & U.between(t.y, y, t.y + t.height - 1)
|
||||||
|
END DblClicked;
|
||||||
|
|
||||||
|
|
||||||
PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR; modified: BOOLEAN);
|
PROCEDURE drawTab (t: tTabs; id, x, y, width, height: INTEGER; s: ARRAY OF CHAR; modified: BOOLEAN);
|
||||||
VAR
|
VAR
|
||||||
x2, y2, color: INTEGER;
|
x2, y2, color: INTEGER;
|
||||||
@ -102,7 +107,7 @@ END Width;
|
|||||||
|
|
||||||
PROCEDURE draw* (t: tTabs);
|
PROCEDURE draw* (t: tTabs);
|
||||||
VAR
|
VAR
|
||||||
x, y, xmax, n, width: INTEGER;
|
x, y, xmax, n, width, i: INTEGER;
|
||||||
item: List.tItem;
|
item: List.tItem;
|
||||||
scroll: BOOLEAN;
|
scroll: BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -111,8 +116,10 @@ BEGIN
|
|||||||
K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + (2*scrWidth + 2), t.height + (curTabHeight - tabHeight) - 1, K.winColor);
|
K.DrawRect(x, y - (curTabHeight - tabHeight), t.width + (2*scrWidth + 2), t.height + (curTabHeight - tabHeight) - 1, K.winColor);
|
||||||
IF Width(t, 0, t.strings.count - 1) > t.width THEN
|
IF Width(t, 0, t.strings.count - 1) > t.width THEN
|
||||||
INC(x, 2*scrWidth);
|
INC(x, 2*scrWidth);
|
||||||
K.CreateButton(btnID - 1, t.x, t.y, scrWidth, t.height - 1, K.btnColor, "<");
|
K.DeleteButton(btnID - 1);
|
||||||
K.CreateButton(btnID - 2, t.x + scrWidth, t.y, scrWidth, t.height - 1, K.btnColor, ">");
|
K.DeleteButton(btnID - 2);
|
||||||
|
K.CreateButton(btnID - 1, t.x, y, scrWidth, t.height - 1, K.btnColor, "<");
|
||||||
|
K.CreateButton(btnID - 2, t.x + scrWidth, y, scrWidth, t.height - 1, K.btnColor, ">");
|
||||||
scroll := TRUE
|
scroll := TRUE
|
||||||
ELSE
|
ELSE
|
||||||
t.first := 0;
|
t.first := 0;
|
||||||
@ -121,6 +128,9 @@ BEGIN
|
|||||||
xmax := x + t.width - 1;
|
xmax := x + t.width - 1;
|
||||||
|
|
||||||
n := t.strings.count - 1;
|
n := t.strings.count - 1;
|
||||||
|
FOR i := 0 TO n DO
|
||||||
|
K.DeleteButton(i + btnID)
|
||||||
|
END;
|
||||||
WHILE (n >= 0) & (Width(t, n, t.strings.count - 1) <= t.width) DO
|
WHILE (n >= 0) & (Width(t, n, t.strings.count - 1) <= t.width) DO
|
||||||
DEC(n)
|
DEC(n)
|
||||||
END;
|
END;
|
||||||
@ -140,12 +150,15 @@ BEGIN
|
|||||||
WHILE (item # NIL) & (x <= xmax) DO
|
WHILE (item # NIL) & (x <= xmax) DO
|
||||||
width := tabWidth(item(tItem));
|
width := tabWidth(item(tItem));
|
||||||
IF x + width - 1 <= xmax THEN
|
IF x + width - 1 <= xmax THEN
|
||||||
drawTab(t, n, x + 1, y, width, t.height, item(tItem).val, item(tItem).modified)
|
drawTab(t, n, x + 1, y, width, t.height, item(tItem).val, item(tItem).modified);
|
||||||
END;
|
|
||||||
INC(n);
|
INC(n);
|
||||||
INC(x, width);
|
INC(x, width);
|
||||||
item := item.next
|
item := item.next
|
||||||
|
ELSE
|
||||||
|
item := NIL
|
||||||
END
|
END
|
||||||
|
END;
|
||||||
|
t.freeX := x
|
||||||
END draw;
|
END draw;
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ BEGIN
|
|||||||
width := scroll.width;
|
width := scroll.width;
|
||||||
height := scroll.height;
|
height := scroll.height;
|
||||||
canvas := scroll.canvas;
|
canvas := scroll.canvas;
|
||||||
G.SetColor(canvas, K.winColor);
|
G.SetColor(canvas, K.lightColor);
|
||||||
G.clear(canvas);
|
G.clear(canvas);
|
||||||
G.SetColor(canvas, K.borderColor);
|
G.SetColor(canvas, K.borderColor);
|
||||||
G.Rect(canvas, 0, 0, width - 1, height - 1);
|
G.Rect(canvas, 0, 0, width - 1, height - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user