mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Color and Font in Layout Designer are now with Upp::
This commit is contained in:
parent
fbee663568
commit
a16f20072a
5 changed files with 18 additions and 3 deletions
|
|
@ -90,8 +90,11 @@ String FormatColor(Color c)
|
|||
Color ReadColor(CParser& p)
|
||||
{
|
||||
for(int i = 0; i < __countof(s_colors); i++)
|
||||
if(p.Id(s_colors[i].name))
|
||||
if(p.Id(s_colors[i].name)) {
|
||||
DDUMP(s_colors[i].name);
|
||||
DDUMP(s_colors[i].color);
|
||||
return s_colors[i].color;
|
||||
}
|
||||
p.PassId("Color");
|
||||
p.PassChar('(');
|
||||
int r = p.ReadInt();
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ Rect RectEsc(EscValue v);
|
|||
EscValue EscFont(Font f);
|
||||
Font FontEsc(EscValue v);
|
||||
|
||||
void EatUpp(CParser& p);
|
||||
|
||||
struct ItemProperty : public Ctrl {
|
||||
int level;
|
||||
String name;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ FontDlg::FontDlg()
|
|||
}
|
||||
|
||||
struct FontProperty : public EditorProperty<DataPusher> {
|
||||
virtual String Save() const { return FormatFont(~editor); }
|
||||
virtual String Save() const { return "Upp::" + FormatFont(~editor); }
|
||||
virtual void Read(CParser& p);
|
||||
|
||||
One<FontDlg> fdlg;
|
||||
|
|
@ -113,6 +113,7 @@ struct FontProperty : public EditorProperty<DataPusher> {
|
|||
};
|
||||
|
||||
void FontProperty::Read(CParser& p) {
|
||||
EatUpp(p);
|
||||
Font f = StdFont();
|
||||
if(p.Id("StdFont") || p.Id("StdFontZ"))
|
||||
f.Face(Font::STDFONT);
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ void LayoutItem::CreateProperties(const String& classname, int level)
|
|||
ItemProperty& ip = q >= 0 ? property.Set(q, n) : property.Add(n);
|
||||
ip.level = l;
|
||||
ip.name = r.name;
|
||||
DDUMP(ip.name);
|
||||
if(!IsNull(r.defval))
|
||||
try {
|
||||
CParser p(r.defval);
|
||||
|
|
@ -378,6 +379,7 @@ Image GetTypeIcon(const String& type, int cx, int cy, int i, Color bg)
|
|||
if(p.iconsize[i] != Size(cx, cy)) {
|
||||
p.iconsize[i] = Size(cx, cy);
|
||||
LayoutItem m;
|
||||
DDUMP(type);
|
||||
m.Create(type);
|
||||
Size stdsize = Zsz(m.GetStdSize());
|
||||
if(stdsize.cx == 0 || stdsize.cy == 0)
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ struct BoolProperty : public EditorProperty<Option> {
|
|||
};
|
||||
|
||||
struct ColorProperty : public EditorProperty<ColorPusher> {
|
||||
virtual String Save() const { return FormatColor(~editor); }
|
||||
virtual String Save() const { return "Upp::" + FormatColor(~editor); }
|
||||
virtual void Read(CParser& p);
|
||||
|
||||
void FontChanged();
|
||||
|
|
@ -191,8 +191,15 @@ struct ColorProperty : public EditorProperty<ColorPusher> {
|
|||
static ItemProperty *Create() { return new ColorProperty; }
|
||||
};
|
||||
|
||||
void EatUpp(CParser& p)
|
||||
{
|
||||
p.Id("Upp");
|
||||
p.Char2(':', ':');
|
||||
}
|
||||
|
||||
void ColorProperty::Read(CParser& p)
|
||||
{
|
||||
// EatUpp(p);
|
||||
if(p.Id("Null")) {
|
||||
editor.SetData(Null);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue