Core, CtrlLib, Ide: Resolved issue with SColors in Layout widget properties

git-svn-id: svn://ultimatepp.org/upp/trunk@14002 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-02-13 14:38:43 +00:00
parent a793418172
commit 7dd1764ee7
13 changed files with 202 additions and 161 deletions

View file

@ -58,7 +58,6 @@ public:
Color() { SetNull(); }
Color(int r, int g, int b) { color = RGB(r, g, b); }
Color(int n, int) { color = 0x80000000 | n; }
Color(const Nuller&) { SetNull(); }
@ -71,6 +70,9 @@ public:
Color(Color (*fn)()) { color = (*fn)().color; }
static Color FromRaw(dword co) { Color c; c.color = co; return c; }
static Color Special(int n) { Color c; c.color = 0x80000000 | n; return c; }
int GetSpecial() const { return color & 0x80000000 ? color & 0x7fffffff : -1; }
#ifdef PLATFORM_WIN32
operator COLORREF() const { return (COLORREF) Get(); }

View file

@ -47,6 +47,7 @@ serialization etc.).&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(Color`(`*`)`(`)`):%- [* Color]([* Color]_(`*[*@3 fn])())&]
[s6;%- `[deprecated`]&]
[s2; This constructor allows using a pointer to a function returning
Colors instead of Colors in many places. Global functions returning
Color are needed instead of global Color constants on many platforms,
@ -58,12 +59,6 @@ libraries.&]
[s5;:Color`:`:Color`(RGBA`):%- [* Color]([_^RGBA^ RGBA]_[*@3 rgba])&]
[s2; Conversion from a RGBA structure [%-*@3 rgba].&]
[s3; &]
[s4;%- &]
[s5;:Color`:`:Color`(int`,int`):%- [* Color]([@(0.0.255) int]_[*@3 n],
[@(0.0.255) int])&]
[s2; Constructs a Color from an integer representation of that colors
RGB code.&]
[s3; &]
[s0;%- &]
[ {{10000F(128)G(128)@1 [s0; [* Public Member List]]}}&]
[s3; &]
@ -128,6 +123,18 @@ word]_[*@3 co])&]
[s7; [*/ Return value]-|Color.&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Color`:`:Special`(int`):%- [@(0.0.255) static] [_^Upp`:`:Color^ Color]_[* Speci
al]([@(0.0.255) int]_[*@3 n])&]
[s2; Creates special color [%-*@3 n]. Special colors are application
defined, sort of `"escape`" color in situation where something
else has to be stored in Color, e.g. index of some color palette.&]
[s3;%- &]
[s4;%- &]
[s5;:Upp`:`:Color`:`:GetSpecial`(`)const:%- [@(0.0.255) int]_[* GetSpecial]()_[@(0.0.255) c
onst]&]
[s2; Returns special color value or `-1 if Color is not special.&]
[s3;%- &]
[s4;%- &]
[s5;:Color`:`:operator COLORREF`(`)const:%- [* operator_COLORREF]()_[@(0.0.255) const]&]
[s6;%- Win32 specific.&]
[s2; Return COLORREF for Color.&]

View file

@ -18,6 +18,7 @@ pkg_config((LINUX | FREEBSD) !X11) "gtk+-3.0 libnotify";
file
Core readonly separator,
ToDo.txt,
CtrlCore.h options(BUILDER_OPTION) PCH,
MKeys.h,
stdids.h,
@ -84,7 +85,6 @@ file
X11DHCtrl.cpp,
X11Event.i,
Gtk readonly separator,
gtk3-todo.txt,
Gtk.h,
GtkAfter.h,
GtkKeys.h,
@ -106,7 +106,6 @@ file
GtkDnD.cpp,
GtkApp.cpp,
Cocoa readonly separator,
ToDo.txt,
Coco.h,
CocoCode.h,
CocoAfter.h,

View file

@ -6,6 +6,9 @@
- ClassicCtrlsImg
- FileChooser
- Win32 menu checkbox
- Win32 - always use dark mode, always use UHD
NTH:
@ -18,3 +21,85 @@ DONE:
- Option box focus issue
- Remove menu slide effect
- U++ menu has some issues
gtk3 DONE:
- Resizing delay
- Refresh issue
- Test & Fix filesel & fileselector
- Combobox push is weird
- right scrollbar
- Test grip resize
- toolbar button highlight
- correct checks in menu
- uword cannot be resized smaller
- Scrollbar margins (better fit for slider)i
- Scrollbar Correct minsize, barsize...
- FileSelector
- Mint-Y disabled color is wrong
- Mint-Y tooltip color is wrong
- .iml cursors in UHD are wrong (e.g. header <-|->)
- cxZ Uword - wrong caret
- Combobox appearance issues (minor, round corners broken on the left)
- spinbuttons in UWord
- read-only dropchoice left colorGUI
- ColorPopup background
- Fix IsPainting
- Header synthetise
- Resizing fix black
- Slider thumb
- Remove DDUMPs
- TabBar synthetise
- Problem with theide menu
- LabelBox
- GtkStyleBool("has-backward-stepper")
- DropChoice read only active edge
- Scale must not be same as UHD
- makefile pkg-config support
- Test with 3.8
- TraditionalOk ugly scrollbars (centre image)
- Blue Menta ugly scrollbars (round)
- CleanTheme for X11
- libgtk-3-dev to buildrequires
- Test dark theme
- Test rect theme
- Check FileSel
- a lot of work in Redmond
- check CtrlCore/Ctrl.tpp
- tooltip issue
- test DateTimeCtrl in dark mode
- 3.8 theme
- PopupInfo issue
- FileSel icons for Video etc
- ColumnList selected item background (Mint-X)
- disabled color in Breeze-Dark
- Problem with hot3 in scrollbar horizontal (check in SD)
- Problem with radio buttons in StdStyle - perhaps too big?
- OpenGL
- GtkWnd warnings
- GtkDnD warnings
- DnD Sample size UHD
- ide menu in X11 ch
- TrayIconGtk warnings
- Disabled empty combobox (FileSel::SelectDir) does not look nice
- Error state (red) EditField cosmetics
- Pushbutton push does not look nice
- DropChoice<EditString>::Error problem
- DarkCold: problem slight problem with scrollbars
- Improve scrollbars button borders
- Scrollbars disabled monocolor
- spinbutton cosmetics
- ide missing vertical line
- DropChoice STDSIZE (.TopPosZ(10))
- LeftRoundness with DropChoice (DropChoiceRdO)
- Improve progress?
- EditDate / EditTime problems
- Ide split buttons look unexpected
- Issue with editfield text clipping in the right
- Possible issue with Capture (e.g. ide about box)
- WithDropChoice ch issue (again...)
- Problem with multibutton is back again
- Redmond scrollbars width
- Improve focus visuals

View file

@ -1,80 +0,0 @@
DONE:
- Resizing delay
- Refresh issue
- Test & Fix filesel & fileselector
- Combobox push is weird
- right scrollbar
- Test grip resize
- toolbar button highlight
- correct checks in menu
- uword cannot be resized smaller
- Scrollbar margins (better fit for slider)i
- Scrollbar Correct minsize, barsize...
- FileSelector
- Mint-Y disabled color is wrong
- Mint-Y tooltip color is wrong
- .iml cursors in UHD are wrong (e.g. header <-|->)
- cxZ Uword - wrong caret
- Combobox appearance issues (minor, round corners broken on the left)
- spinbuttons in UWord
- read-only dropchoice left colorGUI
- ColorPopup background
- Fix IsPainting
- Header synthetise
- Resizing fix black
- Slider thumb
- Remove DDUMPs
- TabBar synthetise
- Problem with theide menu
- LabelBox
- GtkStyleBool("has-backward-stepper")
- DropChoice read only active edge
- Scale must not be same as UHD
- makefile pkg-config support
- Test with 3.8
- TraditionalOk ugly scrollbars (centre image)
- Blue Menta ugly scrollbars (round)
- CleanTheme for X11
- libgtk-3-dev to buildrequires
- Test dark theme
- Test rect theme
- Check FileSel
- a lot of work in Redmond
- check CtrlCore/Ctrl.tpp
- tooltip issue
- test DateTimeCtrl in dark mode
- 3.8 theme
- PopupInfo issue
- FileSel icons for Video etc
- ColumnList selected item background (Mint-X)
- disabled color in Breeze-Dark
- Problem with hot3 in scrollbar horizontal (check in SD)
- Problem with radio buttons in StdStyle - perhaps too big?
- OpenGL
- GtkWnd warnings
- GtkDnD warnings
- DnD Sample size UHD
- ide menu in X11 ch
- TrayIconGtk warnings
- Disabled empty combobox (FileSel::SelectDir) does not look nice
- Error state (red) EditField cosmetics
- Pushbutton push does not look nice
- DropChoice<EditString>::Error problem
- DarkCold: problem slight problem with scrollbars
- Improve scrollbars button borders
- Scrollbars disabled monocolor
- spinbutton cosmetics
- ide missing vertical line
- DropChoice STDSIZE (.TopPosZ(10))
- LeftRoundness with DropChoice (DropChoiceRdO)
- Improve progress?
- EditDate / EditTime problems
- Ide split buttons look unexpected
- Issue with editfield text clipping in the right
- Possible issue with Capture (e.g. ide about box)
- WithDropChoice ch issue (again...)
- Problem with multibutton is back again
- Redmond scrollbars width
- Improve focus visuals

View file

@ -462,6 +462,10 @@ CH_STYLE(SpinButtons, Style, StyleOnSides)
{
Assign(SpinButtons::StyleDefault());
onsides = true;
for(int i = 0; i < 4; i++) {
inc.look[i] = Button::StyleEdge().look[i];
dec.look[i] = Button::StyleLeftEdge().look[i];
}
}
void SpinButtons::FrameLayout(Rect& r)

View file

@ -432,6 +432,11 @@ void ChHostSkin()
Win32Look(s.dec.look, 4, XP_SPIN, SPNP_DOWN);
s.width = FrameButtonWidth();
}
{
SpinButtons::Style& s = SpinButtons::StyleOnSides().Write();
Win32Look(s.inc.look, 4, XP_SCROLLBAR, SBP_ARROWBTN, ABS_UPNORMAL);
Win32Look(s.dec.look, 4, XP_SCROLLBAR, SBP_ARROWBTN, ABS_DOWNNORMAL);
}
{
MultiButton::Style& s = MultiButton::StyleDefault().Write();
s.usetrivial = true;

View file

@ -4,47 +4,46 @@ namespace Upp {
static struct {
const char *name;
ColorF color;
Color color;
}
s_colors[] = {
{ "Black", &Black },
{ "Red", &Red },
{ "Green", &Green },
{ "Brown", &Brown },
{ "Blue", &Blue },
{ "Magenta", &Magenta },
{ "Cyan", &Cyan },
{ "Gray", &Gray },
{ "LtGray", &LtGray },
{ "LtRed", &LtRed },
{ "LtGreen", &LtGreen },
{ "LtYellow", &LtYellow },
{ "LtBlue", &LtBlue },
{ "LtMagenta", &LtMagenta },
{ "LtCyan", &LtCyan },
{ "Yellow", &Yellow },
{ "WhiteGray", &WhiteGray },
{ "White", &White },
{ "SBlack", Color::Special(0) },
{ "SRed", Color::Special(1) },
{ "SGreen", Color::Special(2) },
{ "SBrown", Color::Special(3) },
{ "SBlue", Color::Special(4) },
{ "SMagenta", Color::Special(5) },
{ "SCyan", Color::Special(6) },
{ "SGray", Color::Special(7) },
{ "SLtGray", Color::Special(8) },
{ "SLtRed", Color::Special(9) },
{ "SLtGreen", Color::Special(10) },
{ "SLtYellow", Color::Special(11) },
{ "SLtBlue", Color::Special(12) },
{ "SLtMagenta", Color::Special(13) },
{ "SLtCyan", Color::Special(14) },
{ "SYellow", Color::Special(15) },
{ "SWhiteGray", Color::Special(16) },
{ "SWhite", Color::Special(17) },
//deprecated: (TODO)
{ "SBlack", &Black },
{ "SRed", &Red },
{ "SGreen", &Green },
{ "SBrown", &Brown },
{ "SBlue", &Blue },
{ "SMagenta", &Magenta },
{ "SCyan", &Cyan },
{ "SGray", &Gray },
{ "SLtGray", &LtGray },
{ "SLtRed", &LtRed },
{ "SLtGreen", &LtGreen },
{ "SLtYellow", &LtYellow },
{ "SLtBlue", &LtBlue },
{ "SLtMagenta", &LtMagenta },
{ "SLtCyan", &LtCyan },
{ "SYellow", &Yellow },
{ "SWhiteGray", &WhiteGray },
{ "SWhite", &White },
{ "Black", Black },
{ "Red", Red },
{ "Green", Green },
{ "Brown", Brown },
{ "Blue", Blue },
{ "Magenta", Magenta },
{ "Cyan", Cyan },
{ "Gray", Gray },
{ "LtGray", LtGray },
{ "LtRed", LtRed },
{ "LtGreen", LtGreen },
{ "LtYellow", LtYellow },
{ "LtBlue", LtBlue },
{ "LtMagenta", LtMagenta },
{ "LtCyan", LtCyan },
{ "Yellow", Yellow },
{ "WhiteGray", WhiteGray },
{ "White", White },
};
Color ColorPopUp::hint[18];
@ -72,12 +71,18 @@ void ColorPopUp::Hint(Color c)
hint[0] = c;
}
Color RealizeColor(Color c)
{
int i = c.GetSpecial();
return i >= 0 && i < 18 ? s_colors[i + 18].color : c;
}
String FormatColor(Color c)
{
if(IsNull(c))
return "Null";
for(int i = 0; i < __countof(s_colors); i++)
if((*s_colors[i].color)() == c)
if(s_colors[i].color == c)
return s_colors[i].name;
return Format("Color(%d, %d, %d)", c.GetR(), c.GetG(), c.GetB());
}
@ -86,7 +91,7 @@ Color ReadColor(CParser& p)
{
for(int i = 0; i < __countof(s_colors); i++)
if(p.Id(s_colors[i].name))
return (*s_colors[i].color)();
return s_colors[i].color;
p.PassId("Color");
p.PassChar('(');
int r = p.ReadInt();
@ -110,7 +115,7 @@ Color ColorPopUp::GetColor(int i) const
if(!scolors)
i += 18;
if(i < 36)
return *s_colors[i].color;
return s_colors[i].color;
i -= 36;
if(i < 18)
return GrayColor(255 * (i + 1) / 20);
@ -206,9 +211,10 @@ void ColorPopUp::Paint(Draw& w)
return;
}
DrawFilledFrame(w, x + DPI(1), y, DPI(14), DPI(14), SColorText, GetColor(i));
Color c = RealizeColor(GetColor(i));
DrawFilledFrame(w, x + DPI(1), y, DPI(14), DPI(14), SColorText, c);
if(i < 18 && scolors)
DrawFrame(w, x + DPI(2), y + DPI(1), DPI(12), DPI(12), Blend(SColorLight, SColorHighlight));
w.DrawRect(x + DPI(2) + DPI(6), y + DPI(1), DPI(6), DPI(12), DarkThemeCached(c));
if(i == colori) {
if(GetMouseLeft())

View file

@ -16,15 +16,25 @@ void ColorPusher::Paint(Draw& w)
if(color == VoidColor)
w.DrawText(max(2, (sz.cx - GetTextSize(nulltext, StdFont()).cx) / 2), ty,
voidtext, StdFont(), SColorText());
else
if(withtext || withhex) {
w.DrawRect(2, 2, sz.cy - 4, sz.cy - 4, color);
DrawFrame(w, 1, 1, sz.cy - 2, sz.cy - 2, SColorText);
w.DrawText(sz.cy + 2, ty, withhex ? ColorToHtml(color) : FormatColor(color), StdFont(), SColorText());
}
else {
w.DrawRect(2, 2, sz.cx - 4, sz.cy - 4, color);
DrawFrame(w, 1, 1, sz.cx - 2, sz.cy - 2, SColorText);
auto DrawColor = [&](int x, int y, int cx, int cy) {
if(color.GetSpecial() >= 0) {
Color c = RealizeColor(color);
w.DrawRect(x, y, cx / 2, cy, c);
w.DrawRect(x + cx / 2, y, cx - cx / 2, cy, DarkTheme(c));
}
else
w.DrawRect(x, y, cx, cy, color);
};
if(withtext || withhex) {
DrawColor(2, 2, sz.cy - 4, sz.cy - 4);
DrawFrame(w, 1, 1, sz.cy - 2, sz.cy - 2, SColorText);
w.DrawText(sz.cy + 2, ty, withhex ? ColorToHtml(color) : FormatColor(color), StdFont(), SColorText());
}
else {
DrawColor(2, 2, sz.cx - 4, sz.cy - 4);
DrawFrame(w, 1, 1, sz.cx - 2, sz.cy - 2, SColorText);
}
}
if(HasFocus())
DrawFocus(w, GetSize());

View file

@ -273,5 +273,6 @@ public:
String FormatColor(Color c);
Color ReadColor(CParser& p);
Color RealizeColor(Color c);
#endif//__TCtrlLib_DlgColor__

View file

@ -365,8 +365,8 @@ void SColorShadow_Write(Color c);
void SColorLtFace_Write(Color c);
void SColorDkShadow_Write(Color c);
inline Color InvertColor() { return Color(255, 0); } // Special color that with DrawRect actually inverts the rectangle
inline Color DefaultInk() { return Color(254, 0); } // SColorText on screen, Black on other outputs
inline Color InvertColor() { return Color::Special(255); } // Special color that with DrawRect actually inverts the rectangle
inline Color DefaultInk() { return Color::Special(254); } // SColorText on screen, Black on other outputs
extern bool dark_theme__;

View file

@ -17,7 +17,7 @@ struct RichPara;
class RichTable;
class RichTxt;
inline Color VoidColor() { return Color(223, 0); } // Used for mixed/no change in Get/SetCellFormat
inline Color VoidColor() { return Color::Special(223); } // Used for mixed/no change in Get/SetCellFormat
struct Zoom {
int m, d;

View file

@ -42,6 +42,8 @@ Image GetUscImage(const String& id)
EscValue EscColor(Color c)
{
EscValue v;
if(c.GetSpecial() >= 0)
c = AdjustIfDark(RealizeColor(c));
if(!IsNull(c)) {
v.MapSet("r", c.GetR());
v.MapSet("g", c.GetG());
@ -285,24 +287,24 @@ void LayLib()
global.Add("LtBlue", EscColor(LtBlue));
global.Add("LtMagenta", EscColor(LtMagenta));
global.Add("LtCyan", EscColor(LtCyan));
global.Add("SBlack", EscColor(Black));
global.Add("SGray", EscColor(Gray));
global.Add("SLtGray", EscColor(LtGray));
global.Add("SWhiteGray", EscColor(WhiteGray));
global.Add("SWhite", EscColor(White));
global.Add("SRed", EscColor(Red));
global.Add("SGreen", EscColor(Green));
global.Add("SBrown", EscColor(Brown));
global.Add("SBlue", EscColor(Blue));
global.Add("SMagenta", EscColor(Magenta));
global.Add("SCyan", EscColor(Cyan));
global.Add("SYellow", EscColor(Yellow));
global.Add("SLtRed", EscColor(LtRed));
global.Add("SLtGreen", EscColor(LtGreen));
global.Add("SLtYellow", EscColor(LtYellow));
global.Add("SLtBlue", EscColor(LtBlue));
global.Add("SLtMagenta", EscColor(LtMagenta));
global.Add("SLtCyan", EscColor(LtCyan));
global.Add("SBlack", EscColor(SBlack));
global.Add("SGray", EscColor(SGray));
global.Add("SLtGray", EscColor(SLtGray));
global.Add("SWhiteGray", EscColor(SWhiteGray));
global.Add("SWhite", EscColor(SWhite));
global.Add("SRed", EscColor(SRed));
global.Add("SGreen", EscColor(SGreen));
global.Add("SBrown", EscColor(SBrown));
global.Add("SBlue", EscColor(SBlue));
global.Add("SMagenta", EscColor(SMagenta));
global.Add("SCyan", EscColor(SCyan));
global.Add("SYellow", EscColor(SYellow));
global.Add("SLtRed", EscColor(SLtRed));
global.Add("SLtGreen", EscColor(SLtGreen));
global.Add("SLtYellow", EscColor(SLtYellow));
global.Add("SLtBlue", EscColor(SLtBlue));
global.Add("SLtMagenta", EscColor(SLtMagenta));
global.Add("SLtCyan", EscColor(SLtCyan));
global.Add("IntNull", (int)Null);
global.Add("DblNullLim", DOUBLE_NULL_LIM);