mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: Fixed Inser color UHD layout
git-svn-id: svn://ultimatepp.org/upp/trunk@13431 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c1ff7f34e2
commit
69565f076b
7 changed files with 82 additions and 46 deletions
|
|
@ -257,7 +257,7 @@ Color HSV16toRGB(int h16, int s16, int v16)
|
|||
static void PaintArrowRaw(Draw& draw, const Rect& rc, int y)
|
||||
{
|
||||
Size size = CtrlImg::column_cursor().GetSize();
|
||||
draw.DrawImage(rc.left - size.cx - 2, y - (size.cy >> 1), CtrlImg::column_cursor());
|
||||
draw.DrawImage(rc.left - size.cx - DPI(2), y - (size.cy >> 1), CtrlImg::column_cursor());
|
||||
}
|
||||
|
||||
static void PaintArrow(Draw& draw, const Rect& rc, int pos)
|
||||
|
|
@ -294,21 +294,21 @@ WheelRampCtrl::~WheelRampCtrl()
|
|||
|
||||
void WheelRampCtrl::Layout()
|
||||
{
|
||||
Size size = max(GetSize(), Size(10, 10));
|
||||
Size size = max(GetSize(), DPI(Size(10, 10)));
|
||||
round_step = 1;
|
||||
if(size.cx <= 20)
|
||||
if(size.cx <= DPI(20))
|
||||
column_rect = Null;
|
||||
else
|
||||
{
|
||||
int col_wd = size.cx >> 3;
|
||||
column_rect = Rect(size.cx - col_wd, 0, size.cx, size.cy);
|
||||
column_rect.Deflate(1, 5);
|
||||
size.cx -= col_wd + 8;
|
||||
column_rect.Deflate(1, DPI(5));
|
||||
size.cx -= col_wd + DPI(8);
|
||||
while(round_step < 32768 && round_step * column_rect.Height() <= 65535)
|
||||
round_step <<= 1;
|
||||
}
|
||||
wheel_rect = Rect(size);
|
||||
wheel_rect.Deflate(1, 5);
|
||||
wheel_rect.Deflate(1, DPI(5));
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,17 +15,17 @@ void AlphaCtrl::Paint(Draw& w)
|
|||
DrawFrame(w, 0, isz.cy, sz.cx, sz.cy - isz.cy, SColorText());
|
||||
int h = sz.cy - isz.cy - 2;
|
||||
if(!mask) {
|
||||
w.DrawRect(15, isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(16, isz.cy + 1, 1, h, SColorText());
|
||||
w.DrawRect(17, isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(sz.cx - 17, isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(sz.cx - 16, isz.cy + 1, 1, h, SColorText());
|
||||
w.DrawRect(sz.cx - 15, isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(DPI(15), isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(DPI(16), isz.cy + 1, 1, h, SColorText());
|
||||
w.DrawRect(DPI(17), isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(sz.cx - DPI(17), isz.cy + 1, 1, h, SColorPaper());
|
||||
w.DrawRect(sz.cx - DPI(16), isz.cy + 1, 1, h, SColorText());
|
||||
w.DrawRect(sz.cx - DPI(15), isz.cy + 1, 1, h, SColorPaper());
|
||||
}
|
||||
int a = mask ? maskvalue : alpha;
|
||||
int x = a == 0 ? 8 - isz.cx / 2 :
|
||||
a == 255 ? sz.cx - 8 - isz.cx / 2
|
||||
: 16 + a * (sz.cx - 32) / 255 - isz.cx / 2;
|
||||
int x = a == 0 ? DPI(8) - isz.cx / 2 :
|
||||
a == 255 ? sz.cx - DPI(8) - isz.cx / 2
|
||||
: DPI(16) + a * (sz.cx - DPI(32)) / 255 - isz.cx / 2;
|
||||
w.DrawImage(x, 0, IconDesImg::Alpha());
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +35,13 @@ void AlphaCtrl::DoPoint(Point p)
|
|||
if(mask)
|
||||
maskvalue = p.x < sz.cx / 2 ? 0 : 255;
|
||||
else
|
||||
if(p.x < 16 || sz.cx < 32)
|
||||
if(p.x < DPI(16) || sz.cx < DPI(32))
|
||||
alpha = 0;
|
||||
else
|
||||
if(p.x > sz.cx - 16)
|
||||
if(p.x > sz.cx - DPI(16))
|
||||
alpha = 255;
|
||||
else
|
||||
alpha = 255 * (p.x - 16) / (sz.cx - 32);
|
||||
alpha = 255 * (p.x - DPI(16)) / (sz.cx - DPI(32));
|
||||
Refresh();
|
||||
UpdateActionRefresh();
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ void AlphaCtrl::MakeImage()
|
|||
{
|
||||
Size sz = GetSize();
|
||||
sz.cy -= IconDesImg::Alpha().GetHeight();
|
||||
if(sz.cx <= 32 || sz.cy < 0) {
|
||||
if(sz.cx <= DPI(32) || sz.cy < 0) {
|
||||
img = Null;
|
||||
return;
|
||||
}
|
||||
|
|
@ -79,10 +79,10 @@ void AlphaCtrl::MakeImage()
|
|||
Color c = mask ? Black() : color;
|
||||
for(int i = 1; i < sz.cx; i++) {
|
||||
int a = mask ? i < sz.cx / 2 ? 0 : 255
|
||||
: i < 16 ? 0 : i > sz.cx - 16 ? 255 : min(255, 255 * i / (sz.cx - 32) - 1);
|
||||
: i < DPI(16) ? 0 : i > sz.cx - DPI(16) ? 255 : min(255, 255 * i / (sz.cx - DPI(32)) - 1);
|
||||
int h = sz.cy / 2;
|
||||
sPaintCol(b, i, 0, h, Blend((i & 8) ? White : Black, c, a));
|
||||
sPaintCol(b, i, h, h, Blend((i & 8) ? Black : White, c, a));
|
||||
sPaintCol(b, i, 0, h, Blend((i & DPI(8)) ? White : Black, c, a));
|
||||
sPaintCol(b, i, h, h, Blend((i & DPI(8)) ? Black : White, c, a));
|
||||
}
|
||||
img = b;
|
||||
Refresh();
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ private:
|
|||
void Ramp();
|
||||
void Alpha();
|
||||
void SyncText();
|
||||
int DoLayout(Size sz, bool set);
|
||||
|
||||
public:
|
||||
typedef RGBACtrl CLASSNAME;
|
||||
|
|
@ -83,6 +84,8 @@ public:
|
|||
void Mask(bool b);
|
||||
|
||||
void SubCtrl(Ctrl *c);
|
||||
|
||||
int GetHeight(int cx);
|
||||
|
||||
RGBACtrl();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,22 +41,44 @@ Color RGBACtrl::GetColor(int i) const
|
|||
|
||||
void RGBACtrl::Layout()
|
||||
{
|
||||
Size sz = GetSize();
|
||||
int ah = IconDesImg::Alpha().GetHeight() + 20;
|
||||
DoLayout(GetSize(), true);
|
||||
}
|
||||
|
||||
int RGBACtrl::DoLayout(Size sz, bool set)
|
||||
{
|
||||
int ah = IconDesImg::Alpha().GetHeight() + DPI(20);
|
||||
int th = text.GetStdHeight(text.GetFont());
|
||||
int eh = 4 - 20 - ah - th - 4;
|
||||
int eh = DPI(4 - 20) - ah - th - DPI(4);
|
||||
int rh = min(sz.cx - (sz.cx >> 3), sz.cy - eh);
|
||||
ramp.BottomPos(0, rh).HSizePos();
|
||||
int y = sz.cy - rh - 4 - ah;
|
||||
alpha.TopPos(y, ah).HSizePos(1, 0);
|
||||
text.TopPos((y -= 4 + th), th).HSizePos(1, 0);
|
||||
cbox.cx = (sz.cx - 3) / 18;
|
||||
cbox.cy = minmax(cbox.cx, 4, Zy(16));
|
||||
int ch = 14 * cbox.cy;
|
||||
cs.x = (sz.cx - 18 * cbox.cx) / 2 + 1;
|
||||
cs.y = (y -= ch + 4);
|
||||
if(subctrl)
|
||||
subctrl->TopPos(0, y - 4).HSizePos(1, 0);
|
||||
if(set)
|
||||
ramp.BottomPos(0, rh).HSizePos();
|
||||
int y = sz.cy - rh - DPI(4) - ah;
|
||||
if(set)
|
||||
alpha.TopPos(y, ah).HSizePos(1, 0);
|
||||
y -= DPI(4) + th;
|
||||
if(set)
|
||||
text.TopPos(y, th).HSizePos(1, 0);
|
||||
int cbcy = minmax(cbox.cx, 4, Zy(16));
|
||||
int ch = 14 * cbcy;
|
||||
y -= ch + DPI(4);
|
||||
if(set) {
|
||||
cbox.cx = (sz.cx - 3) / 18;
|
||||
cbox.cy = cbcy;
|
||||
int ch = 14 * cbox.cy;
|
||||
cs.x = (sz.cx - 18 * cbox.cx) / 2 + 1;
|
||||
cs.y = y;
|
||||
}
|
||||
if(subctrl) {
|
||||
if(set)
|
||||
subctrl->TopPos(0, y - DPI(4)).HSizePos(1, 0);
|
||||
y -= DPI(4);
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
int RGBACtrl::GetHeight(int cx)
|
||||
{
|
||||
return 100000 - DoLayout(Size(cx, 100000), false);
|
||||
}
|
||||
|
||||
void RGBACtrl::Paint(Draw& w)
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ class InsertColorDlg : public WithInsertColorLayout<TopWindow> {
|
|||
typedef InsertColorDlg CLASSNAME;
|
||||
|
||||
String r[5];
|
||||
bool canceled;
|
||||
bool canceled = true;
|
||||
|
||||
void Sync();
|
||||
void Select(int i);
|
||||
|
||||
RGBACtrl rgbactrl;
|
||||
|
||||
public:
|
||||
String result;
|
||||
|
|
@ -40,7 +42,7 @@ void InsertColorDlg::Sync()
|
|||
qtf.SetLabel(r[4]);
|
||||
}
|
||||
|
||||
InsertColorDlg::InsertColorDlg() : canceled(true)
|
||||
InsertColorDlg::InsertColorDlg()
|
||||
{
|
||||
CtrlLayoutCancel(*this, "Insert color");
|
||||
rgbactrl <<= THISBACK(Sync);
|
||||
|
|
@ -50,6 +52,16 @@ InsertColorDlg::InsertColorDlg() : canceled(true)
|
|||
hex <<= THISBACK1(Select, 3);
|
||||
qtf <<= THISBACK1(Select, 4);
|
||||
Sync();
|
||||
|
||||
int m = color.GetRect().top;
|
||||
int cx = color.GetRect().left - 2 * m;
|
||||
int cy = rgbactrl.GetHeight(cx);
|
||||
Rect r = GetRect();
|
||||
r.bottom = r.top + cy + 2 * m;
|
||||
rgbactrl.SetRect(m, m, cx, cy);
|
||||
Add(rgbactrl);
|
||||
SetMinSize(r.GetSize());
|
||||
SetRect(r);
|
||||
}
|
||||
|
||||
bool InsertColorDlg::IsCanceled()
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
|
|
@ -716,14 +716,13 @@ LAYOUT(PrintLayout, 164, 128)
|
|||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(84, 72).BottomPosZ(8, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(InsertColorLayout, 432, 520)
|
||||
ITEM(RGBACtrl, rgbactrl, LeftPosZ(4, 276).TopPosZ(4, 512))
|
||||
ITEM(Button, color, SetLabel(t_("Cancel")).LeftPosZ(284, 144).TopPosZ(4, 24))
|
||||
ITEM(Button, rgba, SetLabel(t_("Cancel")).LeftPosZ(284, 144).TopPosZ(32, 24))
|
||||
ITEM(Button, ahex, SetLabel(t_("Cancel")).LeftPosZ(284, 144).TopPosZ(60, 24))
|
||||
ITEM(Button, hex, SetLabel(t_("Cancel")).LeftPosZ(284, 144).TopPosZ(88, 24))
|
||||
ITEM(Button, qtf, SetLabel(t_("Cancel")).LeftPosZ(284, 144).TopPosZ(116, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(284, 144).TopPosZ(492, 24))
|
||||
LAYOUT(InsertColorLayout, 380, 708)
|
||||
ITEM(Button, color, SetLabel(t_("Cancel")).LeftPosZ(232, 144).TopPosZ(4, 24))
|
||||
ITEM(Button, rgba, SetLabel(t_("Cancel")).LeftPosZ(232, 144).TopPosZ(32, 24))
|
||||
ITEM(Button, ahex, SetLabel(t_("Cancel")).LeftPosZ(232, 144).TopPosZ(60, 24))
|
||||
ITEM(Button, hex, SetLabel(t_("Cancel")).LeftPosZ(232, 144).TopPosZ(88, 24))
|
||||
ITEM(Button, qtf, SetLabel(t_("Cancel")).LeftPosZ(232, 144).TopPosZ(116, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(4, 144).BottomPosZ(4, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(AbbreviationsLayout, 664, 476)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue