diff --git a/programs/develop/cedit/CEDIT b/programs/develop/cedit/CEDIT index c16bba475b..7605ad1768 100644 Binary files a/programs/develop/cedit/CEDIT and b/programs/develop/cedit/CEDIT differ diff --git a/programs/develop/cedit/SHORTCUT.TXT b/programs/develop/cedit/SHORTCUT.TXT index a06cc46900..c722ac0c59 100644 --- a/programs/develop/cedit/SHORTCUT.TXT +++ b/programs/develop/cedit/SHORTCUT.TXT @@ -33,7 +33,8 @@ ctrl+S сохранить ctrl+O открыть - ctrl+N создать новый + ctrl+N, + ctrl+T создать новый ctrl+W закрыть файл ctrl+Tab переключиться на следующую вкладку diff --git a/programs/develop/cedit/SRC/CEdit.ob07 b/programs/develop/cedit/SRC/CEdit.ob07 index 36aeedf5f6..3eeca6ef41 100644 --- a/programs/develop/cedit/SRC/CEdit.ob07 +++ b/programs/develop/cedit/SRC/CEdit.ob07 @@ -28,7 +28,7 @@ IMPORT RW, Ini, EB := EditBox, Icons, Tabs, Timer; CONST - HEADER = "CEdit (11-dec-2021)"; + HEADER = "CEdit (17-dec-2021)"; ShellFilter = ""; EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON"; @@ -916,8 +916,10 @@ BEGIN IF nov = NIL THEN error("error opening file") ELSE + T.SetPos(nov, 0, 0); insert(textsCount, nov); - T.SetPos(nov, 0, 0) + Scroll.setValue(hScroll, 0); + Scroll.setValue(vScroll, 0) END ELSE SwitchTab(n) @@ -1814,7 +1816,8 @@ BEGIN |45: key := ORD("X") |46: key := ORD("C") |47: key := ORD("V") - |49: key := -1; + |49, + 20: key := -1; NewFile ELSE key := -1 @@ -2011,6 +2014,10 @@ BEGIN leftButton := FALSE; T.selectWord(text); repaint + ELSIF Tabs.DblClicked(tabs, x + LEFT, y + TOP) THEN + leftButton := FALSE; + NewFile; + repaint END ELSE firstClickX := x; diff --git a/programs/develop/cedit/SRC/CheckBox.ob07 b/programs/develop/cedit/SRC/CheckBox.ob07 index e7494112fb..ab906e0b1d 100644 --- a/programs/develop/cedit/SRC/CheckBox.ob07 +++ b/programs/develop/cedit/SRC/CheckBox.ob07 @@ -24,8 +24,10 @@ IMPORT G := Graph, K := KolibriOS, U := Utils; CONST padding = 4; - fontWidth = K.fontWidth; - fontHeight = K.fontHeight; + fontWidth = K.fontWidth; + fontHeight = K.fontHeight; + bColor = 0FFFFFFH; + fColor = 0008000H; TYPE @@ -43,21 +45,30 @@ TYPE PROCEDURE paint* (chkbox: tCheckBox); VAR canvas: G.tCanvas; + (*r1, r2, g1, g2, b1, b2: BYTE;*) BEGIN canvas := chkbox.canvas; IF canvas # NIL THEN G.SetColor(canvas, K.winColor); G.clear(canvas); - G.SetColor(canvas, 0FFFFFFH); + G.SetColor(canvas, bColor); G.FillRect(canvas, 0, 0, fontHeight - 1, fontHeight - 1); G.SetColor(canvas, K.borderColor); G.Rect(canvas, 0, 0, fontHeight - 1, fontHeight - 1); IF chkbox.value THEN - G.SetColor(canvas, 0008000H); + G.SetColor(canvas, fColor); G.DLine(canvas, 2, 6, 6, -1); G.DLine(canvas, 2, 6, 7, -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; G.SetTextColor(canvas, K.textColor); G.SetBkColor(canvas, K.winColor); diff --git a/programs/develop/cedit/SRC/Graph.ob07 b/programs/develop/cedit/SRC/Graph.ob07 index 5bea947425..d718edd02f 100644 --- a/programs/develop/cedit/SRC/Graph.ob07 +++ b/programs/develop/cedit/SRC/Graph.ob07 @@ -51,6 +51,14 @@ TYPE 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); BEGIN K.sysfunc7(65, canvas.bitmap, canvas.width*65536 + canvas.height, x*65536 + y, 32, 0, 0); diff --git a/programs/develop/cedit/SRC/Icons.ob07 b/programs/develop/cedit/SRC/Icons.ob07 index bef52f202e..b90cb09b42 100644 --- a/programs/develop/cedit/SRC/Icons.ob07 +++ b/programs/develop/cedit/SRC/Icons.ob07 @@ -20,7 +20,7 @@ MODULE Icons; IMPORT - LibImg, K := KolibriOS, SYSTEM; + LibImg, K := KolibriOS, Graph, SYSTEM; CONST fileName = "/rd/1/Icons16.png"; @@ -93,9 +93,7 @@ BEGIN 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 + Graph.getRGB(K.toolbarColor, r, g, b) END; SYSTEM.PUT8(data, b); SYSTEM.PUT8(data + 1, g); diff --git a/programs/develop/cedit/SRC/Tabs.ob07 b/programs/develop/cedit/SRC/Tabs.ob07 index 94507160af..8a2ae6cea0 100644 --- a/programs/develop/cedit/SRC/Tabs.ob07 +++ b/programs/develop/cedit/SRC/Tabs.ob07 @@ -19,7 +19,7 @@ MODULE Tabs; -IMPORT List, K := KolibriOS, RW; +IMPORT List, K := KolibriOS, RW, U := Utils; CONST @@ -42,11 +42,16 @@ TYPE strings: List.tList; first, current: INTEGER; width, height: INTEGER; - x, y: INTEGER + x, y, freeX: INTEGER 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); VAR x2, y2, color: INTEGER; @@ -102,7 +107,7 @@ END Width; PROCEDURE draw* (t: tTabs); VAR - x, y, xmax, n, width: INTEGER; + x, y, xmax, n, width, i: INTEGER; item: List.tItem; scroll: BOOLEAN; BEGIN @@ -111,8 +116,10 @@ BEGIN 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 INC(x, 2*scrWidth); - K.CreateButton(btnID - 1, t.x, t.y, scrWidth, t.height - 1, K.btnColor, "<"); - K.CreateButton(btnID - 2, t.x + scrWidth, t.y, scrWidth, t.height - 1, K.btnColor, ">"); + K.DeleteButton(btnID - 1); + 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 ELSE t.first := 0; @@ -121,6 +128,9 @@ BEGIN xmax := x + t.width - 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 DEC(n) END; @@ -140,12 +150,15 @@ BEGIN WHILE (item # NIL) & (x <= xmax) DO width := tabWidth(item(tItem)); IF x + width - 1 <= xmax THEN - drawTab(t, n, x + 1, y, width, t.height, item(tItem).val, item(tItem).modified) - END; - INC(n); - INC(x, width); - item := item.next - END + drawTab(t, n, x + 1, y, width, t.height, item(tItem).val, item(tItem).modified); + INC(n); + INC(x, width); + item := item.next + ELSE + item := NIL + END + END; + t.freeX := x END draw; diff --git a/programs/develop/cedit/SRC/scroll.ob07 b/programs/develop/cedit/SRC/scroll.ob07 index 07ce6f21ea..e0e52108fa 100644 --- a/programs/develop/cedit/SRC/scroll.ob07 +++ b/programs/develop/cedit/SRC/scroll.ob07 @@ -106,7 +106,7 @@ BEGIN width := scroll.width; height := scroll.height; canvas := scroll.canvas; - G.SetColor(canvas, K.winColor); + G.SetColor(canvas, K.lightColor); G.clear(canvas); G.SetColor(canvas, K.borderColor); G.Rect(canvas, 0, 0, width - 1, height - 1);