ide: fixed some gtk3 introduced color issues

git-svn-id: svn://ultimatepp.org/upp/trunk@13861 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-01-11 19:51:32 +00:00
parent d8c52b1d32
commit d6ccfcda3e
4 changed files with 33 additions and 5 deletions

View file

@ -25,6 +25,26 @@ s_colors[] = {
{ "Yellow", &Yellow },
{ "WhiteGray", &WhiteGray },
{ "White", &White },
//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 },
};
Color ColorPopUp::hint[18];
@ -82,14 +102,16 @@ ColorPopUp::~ColorPopUp() {}
int ColorPopUp::GetColorCount() const
{
return 18 + 2 * 18 + hints * 18 + 216;
return 18 + scolors * 18 + 2 * 18 + hints * 18 + 216;
}
Color ColorPopUp::GetColor(int i) const
{
if(i < 18)
if(!scolors)
i += 18;
if(i < 36)
return *s_colors[i].color;
i -= 18;
i -= 36;
if(i < 18)
return GrayColor(255 * (i + 1) / 20);
if(hints) {
@ -185,6 +207,8 @@ void ColorPopUp::Paint(Draw& w)
}
DrawFilledFrame(w, x + DPI(1), y, DPI(14), DPI(14), SColorText, GetColor(i));
if(i < 18 && scolors)
DrawFrame(w, x + DPI(2), y + DPI(1), DPI(12), DPI(12), Blend(SColorLight, SColorHighlight));
if(i == colori) {
if(GetMouseLeft())
@ -373,6 +397,7 @@ ColorPopUp::ColorPopUp()
norampwheel = false;
notnull = false;
withvoid = false;
scolors = false;
animating = false;
hints = false;
open = false;

View file

@ -165,6 +165,7 @@ private:
int colori;
bool notnull;
bool scolors;
bool norampwheel;
bool animating;
bool hints;
@ -195,6 +196,7 @@ public:
Color Get() const;
ColorPopUp& NotNull(bool b = true) { notnull = b; return *this; }
ColorPopUp& SColors(bool b = true) { scolors = b; return *this; }//Deprecated, BUT NEEDED IN THEIDE
ColorPopUp& NullText(const char *s) { nulltext = s; Refresh(); return *this; }
ColorPopUp& WithVoid(bool b = true) { withvoid = b; Refresh(); return *this; }
ColorPopUp& VoidText(const char *s) { voidtext = s; Refresh(); return *this; }
@ -237,6 +239,7 @@ public:
ColorPusher& NotNull(bool b = true) { colors.NotNull(b); return *this; }
ColorPusher& WithVoid(bool b = true) { colors.WithVoid(b); return *this; }
ColorPusher& VoidText(const char *s) { voidtext = s; colors.VoidText(s); Refresh(); return *this; }
ColorPusher& SColors(bool b = true) { colors.SColors(b); return *this; }
ColorPusher& WithText() { withtext = true; Refresh(); return *this; }
ColorPusher& WithHex() { withhex = true; Refresh(); return *this; }
ColorPusher& Track(bool b = true) { track = b; return *this; }

View file

@ -185,7 +185,7 @@ struct ColorProperty : public EditorProperty<ColorPusher> {
ColorProperty() {
Add(editor.HSizePosZ(100, 2).TopPos(2));
editor.WithText().NullText("Null").Track();
editor.WithText().SColors().NullText("Null").Track();
}
static ItemProperty *Create() { return new ColorProperty; }

View file

@ -29,7 +29,7 @@ struct OptionHeaderDisplay : Display {
w.Clipoff(r.left + Zx(5), r.top, r.Width() - Zx(10), r.Height());
int tcy = GetTLTextHeight(txt, StdFont().Bold());
DrawTLText(w, 0, max((r.Height() - tcy) / 2, 0), r.Width(), txt,
StdFont().Bold(), SColorInfoText);
StdFont().Bold(), SColorText());
w.End();
}
virtual Size GetStdSize(const Value& q) const