GridCtrl and DropGrid fixes..

git-svn-id: svn://ultimatepp.org/upp/trunk@740 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2009-01-09 19:55:41 +00:00
parent ef86ef3a52
commit 542f82e1b3
10 changed files with 336 additions and 230 deletions

View file

@ -129,9 +129,9 @@ void DropGrid::Drop()
Rect rs = GetScreenRect();
int width = rs.Width();
int resize_height = list.GetResizePanelHeight();
int list_height = max(list.GetHeight(), GridCtrl::GD_ROW_HEIGHT + GridCtrl::GD_HDR_HEIGHT * header);
int list_height = max(list.GetHeight(), list.GD_ROW_HEIGHT + list.GD_HDR_HEIGHT * header);
int height = list_height + 4 + resize_height;
int drop_height = drop_lines * GridCtrl::GD_ROW_HEIGHT + header * GridCtrl::GD_HDR_HEIGHT + 4 + resize_height;
int drop_height = drop_lines * list.GD_ROW_HEIGHT + header * list.GD_HDR_HEIGHT + 4 + resize_height;
if(!display_all && height > drop_height)
height = drop_height;
@ -192,26 +192,27 @@ void DropGrid::Paint(Draw& w)
else
clear.Hide();
w.DrawRect(sz, SColorPaper());
//w.DrawRect(sz, SColorPaper());
GridDisplay &disp = display ? *display : list.GetDisplay();
bool hf = HasFocus();
bool isnull = rowid < 0;
Color fg = hf ? SColorHighlightText() : IsEnabled() ? SColorText() : SColorDisabled();
Color bg = !IsEnabled() ? SColorFace
Color bg = !IsEnabled() ? EditField::StyleDefault().disabled //SColorFace
: notnull && isnull ? Blend(SColorPaper, Color(255, 0, 0), /*hf ? 55 :*/ 32)
: hf ? SColorHighlight() : SColorPaper();
const int d = 1;
const int d = 0;
if(isnull)
w.DrawRect(d, d, sz.cx - d * 2, sz.cy - d * 2, bg);
else
{
Font fnt(StdFont());
Paint0(w, 1, 1, d, d, sz.cx - d * 2, sz.cy - d * 2, Format0(Null, rowid), 0, fg, bg/*SColorPaper()*/, fnt);
Paint0(w, 1, 1, d, d, sz.cx - d * 2, sz.cy - d * 2, Format0(Null, rowid), 0, fg, bg, fnt);
}
if(hf)
DrawFocus(w, d - 1, d - 1, sz.cx - (d - 1) * 2, sz.cy - (d - 1) * 2);
DrawFocus(w, d - 0, d - 0, sz.cx - (d - 0) * 2, sz.cy - (d - 0) * 2);
}
@ -542,6 +543,12 @@ void DropGrid::SetData(const Value& v)
ClearValue();
}
DropGrid& DropGrid::SearchHideRows(bool b)
{
list.SearchHideRows(b);
return *this;
}
void DropGrid::DoAction(int row, bool action, bool chg)
{
int rid = list.GetRowId(row);

View file

@ -19,7 +19,7 @@ class DropGrid : public Convert, public GridDisplay, public Ctrl
BTN_PLUS,
BTN_CLEAN
};
private:
class PopUpGrid : public GridCtrl
{
private:
@ -121,9 +121,11 @@ class DropGrid : public Convert, public GridDisplay, public Ctrl
DropGrid& NullAction(bool b = true);
DropGrid& ClearButton(bool b = true);
DropGrid& NoDrop(bool b = true);
DropGrid& SetData();
DropGrid& SearchHideRows(bool b = true);
GridCtrl::ItemRect& AddColumn(const char *name, int width = GridCtrl::GD_COL_WIDTH, bool idx = false);
GridCtrl::ItemRect& AddColumn(Id id, const char *name, int width = GridCtrl::GD_COL_WIDTH, bool idx = false);
GridCtrl::ItemRect& AddColumn(const char *name, int width = -1, bool idx = false);
GridCtrl::ItemRect& AddColumn(Id id, const char *name, int width = -1, bool idx = false);
GridCtrl::ItemRect& AddIndex(const char *name = NULL);
GridCtrl::ItemRect& AddIndex(Id id);
@ -211,7 +213,7 @@ class DropGrid : public Convert, public GridDisplay, public Ctrl
Callback WhenLeftDown;
GridCtrl::ItemRect& AddRow(int n = 1, int size = GridCtrl::GD_ROW_HEIGHT);
GridCtrl::ItemRect& AddRow(int n = 1, int size = -1);
DropGrid& Add() { AddRow(); return *this; }
//$-DropCtrl& Add(const Value& [, const Value& ]...);

View file

@ -116,13 +116,16 @@ GridCtrl::ItemRect& GridCtrl::ItemRect::FixedAuto()
return Min(n).Max(n);
}
GridCtrl::ItemRect& GridCtrl::ItemRect::Edit(Ctrl &ctrl)
GridCtrl::ItemRect& GridCtrl::ItemRect::Edit(Ctrl &ctrl, bool b)
{
ctrl.Hide();
ctrl.SetFrame(BlackFrame());
//ctrl.SetFrame(NullFrame());
(*edits)[id].ctrl = &ctrl;
parent->holder.AddChild(&ctrl);
if(b)
{
ctrl.Hide();
ctrl.SetFrame(BlackFrame());
//ctrl.SetFrame(NullFrame());
(*edits)[id].ctrl = &ctrl;
parent->holder.AddChild(&ctrl);
}
return *this;
}
@ -223,14 +226,15 @@ void GridCtrl::ItemRect::Serialize(Stream &s)
static void MakeOption(One<Ctrl>& ctrl)
{
ctrl.Create<Option>();
ctrl.Create<Option>().ShowLabel(false);
ctrl->SetData(0);
ctrl->WantFocus();
}
GridCtrl::ItemRect& GridCtrl::ItemRect::Option()
{
return Ctrls(MakeOption).CtrlAlignHorzCenter(CtrlsImg::O0().GetSize().cx);
// return Ctrls(MakeOption).CtrlAlignHorzCenter(CtrlsImg::O0().GetSize().cx);
return Ctrls(MakeOption).CtrlAlignHorzPos().CtrlAlignVertPos();
}
GridCtrl::Item& GridCtrl::Item::Editable(bool b)

View file

@ -7,11 +7,6 @@ NAMESPACE_UPP
#define TFILE <GridCtrl/GridCtrl.t>
#include <Core/t.h>
int GridCtrl::GD_COL_WIDTH;
int GridCtrl::GD_ROW_HEIGHT;
int GridCtrl::GD_HDR_HEIGHT;
int GridCtrl::GD_IND_WIDTH;
GridCtrl::GridCtrl() : holder(*this)
{
sortCol = -1;
@ -158,6 +153,7 @@ GridCtrl::GridCtrl() : holder(*this)
full_row_resizing = false;
chameleon = false;
summary_row = false;
update_summary = true;
mouse_move = false;
row_modified = 0;
@ -502,6 +498,7 @@ void GridCtrl::StdMenuBar(Bar &bar)
}
isitem = true;
}
if(appending)
{
bar.Add(t_("Append"), StdAppend)
@ -511,6 +508,7 @@ void GridCtrl::StdMenuBar(Bar &bar)
isitem = true;
}
if(duplicating)
{
bar.Add(c, t_("Duplicate"), THISBACK(DoDuplicate))
@ -628,7 +626,7 @@ void GridCtrl::ClipboardMenu(Bar &bar)
void GridCtrl::PasteAsMenu(Bar &bar)
{
bool c = IsCursor();
bool s = IsClipboardAvailable();
bool s = IsClipboardAvailable() && !fixed_paste;
bar.Add(t_("appended"), THISBACK(DoPasteAppendedRows)).Key(K_CTRL_E).Enable(s);
bar.Add(t_("inserted"), THISBACK(DoPasteInsertedRows)).Key(K_CTRL_I).Enable(c && s);
}
@ -886,11 +884,13 @@ void GridCtrl::Paste(int mode)
PasteCallbacks(new_row);
}
}
if(lc >= 0 && lr >= 0)
{
SetCursor0(lc, lr);
sby.Set(vitems[curpos.y].nBottom() - GetSize().cy);
}
ClearSelection();
}
@ -1093,6 +1093,9 @@ void GridCtrl::Paint(Draw &w)
hi.sortcol,
sortOrder.GetCount(),
true);
it.rcx = gd->real_size.cx;
it.rcy = gd->real_size.cy;
}
if(summary_row && i == 0)
@ -1104,18 +1107,33 @@ void GridCtrl::Paint(Draw &w)
Item &it = summary[hi.id];
GridDisplay * gd = it.display ? it.display : display;
dword style = hi.halign;
dword style = en | hi.halign;
if(chameleon)
style |= GD::CHAMELEON;
String s;
if(hi.sop != SOP_NONE && !hi.sopfrm.IsEmpty() && !IsNull(it.val))
s = Format(hi.sopfrm, it.val);
s = IsString(it.val) ? it.val : StdConvert().Format(it.val);
else
s = IsString(it.val) ? it.val : StdConvert().Format(it.val);
gd->SetLeftImage(Null);
gd->PaintFixed(w, jj == firstcol, i == 0, x, y, cx, cy, s,
style | en, stdfont, false, false, 0, -1, 0, true);
//gd->PaintFixed(w, jj == firstcol, i == 0, x, y, cx, cy, s,
// style | en, stdfont, false, false, 0, -1, 0, true);
Color fg = Black;
Color bg = Blend(Blue, White, 240);
w.DrawRect(x, y, cx, 1, Gray);
Font fnt(stdfont);
if(style & GD::READONLY)
{
bg = Blend(bg, SGray(), 40);
fg = Blend(fg, SGray(), 200);
}
gd->Paint(w, x, y + 1, cx, cy - 1, s, style, fg, bg, fnt.Bold(), false, 0, 0);
it.rcx = gd->real_size.cx;
it.rcy = gd->real_size.cy;
}
}
@ -1185,6 +1203,9 @@ void GridCtrl::Paint(Draw &w)
GetConvertedColumn(id, it.val),
style | en, stdfont,
indicator, false, 0, -1, 0, false);
it.rcx = gd->real_size.cx;
it.rcy = gd->real_size.cy;
}
}
@ -1203,10 +1224,16 @@ void GridCtrl::Paint(Draw &w)
if(chameleon)
style |= GD::CHAMELEON;
gd->PaintFixed(w, firstx, true, x, y, cx, cy,
GetConvertedColumn(id, it.val),
style | en, stdfont,
false, false, 0, -1, 0, false);
// gd->PaintFixed(w, firstx, true, x, y, cx, cy,
// GetConvertedColumn(id, it.val),
// style | en, stdfont,
// false, false, 0, -1, 0, false);
//
Color fg = Black;
Color bg = Blend(Blue, White, 240);
w.DrawRect(x, y, cx, 1, Gray);
Font fnt(stdfont);
gd->Paint(w, x, y + 1, cx, cy - 1, GetConvertedColumn(id, it.val), style | en, fg, bg, fnt.Bold(), false, 0, 0);
}
}
@ -1275,7 +1302,7 @@ void GridCtrl::Paint(Draw &w)
int id = hi.id;
dword style = (select_row ? vi.style : it.style) | hi.balign;
dword style = en | (select_row ? vi.style : it.style) | hi.balign;
dword istyle = it.style;
if(hitems[j].wrap)
@ -1353,6 +1380,12 @@ void GridCtrl::Paint(Draw &w)
if(!IsNull(cfg)) fg = cfg;
if(!IsNull(cbg)) bg = cbg;
}
if(style & GD::READONLY)
{
bg = Blend(bg, SGray(), 40);
fg = Blend(fg, SGray(), 200);
}
Value val;
if(IsType<AttrText>(it.val))
@ -1392,7 +1425,7 @@ void GridCtrl::Paint(Draw &w)
gd->row = i - fixed_cols;
gd->parent = this;
gd->Paint(w, x, y, cx, cy,
val, style | en,
val, style,
fg, bg, fnt, it.style & GD::FOUND, it.fs, it.fe);
it.rcx = gd->real_size.cx;
@ -1522,6 +1555,9 @@ GridCtrl::ItemRect& GridCtrl::InsertColumn(int pos, const char *name, int size,
GridCtrl::ItemRect& GridCtrl::AddColumn(const char *name, int size, bool idx)
{
ItemRect::aliases = &aliases;
if(size < 0)
size = GD_COL_WIDTH;
if(total_rows > 1)
for(int i = 1; i < total_rows; ++i)
@ -1750,9 +1786,9 @@ void GridCtrl::MouseMove(Point p, dword keyflags)
if(live_cursor)
{
if(IsMouseBody(p))
SetCursor0(p, true, true);
SetCursor0(p, CU_MOUSE | CU_HIGHLIGHT);
else
SetCursor0(-1, -1, false, true);
SetCursor0(-1, -1, CU_HIGHLIGHT);
}
if(HasCapture())
@ -1761,7 +1797,7 @@ void GridCtrl::MouseMove(Point p, dword keyflags)
{
if(keyflags & K_SHIFT)
{
if(SetCursor0(p, true))
if(SetCursor0(p, CU_MOUSE))
{
DoShiftSelect();
selecting = true;
@ -1775,7 +1811,7 @@ void GridCtrl::MouseMove(Point p, dword keyflags)
if(select && (keyflags & K_CTRL))
{
if(SetCursor0(p, true))
if(SetCursor0(p, CU_MOUSE))
{
DoCtrlSelect();
selecting = true;
@ -1848,9 +1884,12 @@ void GridCtrl::MouseMove(Point p, dword keyflags)
}
else if(!IsPopUp())
{
int c = GetMouseCol(p);
int r = GetMouseRow(p);
bool fc = p.x < fixed_width;
bool fr = p.y < fixed_height;
int c = GetMouseCol(p, !fc, fc);
int r = GetMouseRow(p, !fr, fr);
bool new_cell = false;
if(r != oldSplitRow)
@ -1873,7 +1912,7 @@ void GridCtrl::MouseMove(Point p, dword keyflags)
Item& it = GetItem(r, c);
if(it.rcx > 0 || it.rcy > 0)
{
popup.text = GetStdConvertedColumn(c, it.val);
popup.text = r == 0 ? it.val : GetStdConvertedColumn(c, it.val);
Point p = GetMousePos();
Point p0 = GetMouseViewPos();
int x = hitems[c].npos + p.x - p0.x - 1 - sbx.Get();
@ -1930,19 +1969,10 @@ void GridCtrl::LeftDown(Point p, dword keyflags)
bool is_shift = keyflags & K_SHIFT;
bool is_ctrl = keyflags & K_CTRL;
CurState cs = SetCursor0(p, true);
CurState cs = SetCursor0(p, CU_MOUSE | CU_HIDECTRLS);
bool state_change = cs.IsValid() && !cs.IsNew() && (is_ctrl || is_shift);
if(cs.IsAccepted())
{
if(edit_mode == GE_CELL || (edit_mode == GE_ROW && (cs.IsNewRow() || !cs.IsValid())))
{
UpdateCtrls(UC_HIDE | UC_CTRLS | UC_OLDCUR);
if(!one_click_edit || !cs.IsValid())
WhenEndEdit();
}
}
else if(!state_change)
if(!cs.IsAccepted() && !state_change)
return;
if(cs || state_change)
@ -2153,6 +2183,7 @@ void GridCtrl::LeftDouble(Point p, dword keyflags)
if(!IsCtrl(curpos))
{
popup.Close();
#ifdef LOG_CALLBACKS
LGR(2, "WhenLeftDouble()");
#endif
@ -2177,10 +2208,8 @@ void GridCtrl::RightDown(Point p, dword keyflags)
if(!EndEdit())
return;
if(!SetCursor0(p, true).IsAccepted())
if(!SetCursor0(p, CU_MOUSE).IsAccepted())
return;
//UpdateCtrls(UC_HIDE | UC_CTRLS);
}
RebuildToolBar();
@ -2214,7 +2243,7 @@ void GridCtrl::State(int reason)
else if(reason == CLOSE)
{
if(live_cursor)
SetCursor0(-1, -1, false, true);
SetCursor0(-1, -1, CU_HIGHLIGHT);
}
else if(reason == ENABLE)
{
@ -2252,12 +2281,12 @@ void GridCtrl::ChildAction(Ctrl *child, int event)
{
if(event == LEFTDOWN || event == RIGHTDOWN)
{
LG(2, "got event :%x child: %x", event, child);
//LG(2, "got event :%x child: %x", event, child);
Point cp = GetCtrlPos(child);
if(cp.x < 0 || cp.y < 0)
return;
SetCursor0(cp, false);
SetCursor0(cp);
UpdateCtrls(UC_SHOW | UC_FOCUS | UC_CTRLS_OFF);
WhenCtrlAction();
}
@ -2267,13 +2296,13 @@ void GridCtrl::ChildAction(Ctrl *child, int event)
void GridCtrl::ChildMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags)
{
ChildAction(child, event);
return Ctrl::ChildMouseEvent(child, event, p, zdelta, keyflags);
Ctrl::ChildMouseEvent(child, event, p, zdelta, keyflags);
}
void GridCtrl::ChildFrameMouseEvent(Ctrl *child, int event, Point p, int zdelta, dword keyflags)
{
ChildAction(child, event);
return Ctrl::ChildFrameMouseEvent(child, event, p, zdelta, keyflags);
Ctrl::ChildFrameMouseEvent(child, event, p, zdelta, keyflags);
}
void GridCtrl::DragAndDrop(Point p, PasteClip& d)
@ -2438,7 +2467,7 @@ void GridCtrl::Scroll()
}
}
if(live_cursor)
SetCursor0(GetMousePos() - GetScreenRect().TopLeft(), true, true);
SetCursor0(GetMousePos() - GetScreenRect().TopLeft(), CU_MOUSE | CU_HIGHLIGHT);
}
@ -2977,12 +3006,12 @@ void GridCtrl::UpdateHolder(bool force)
}
}
GridCtrl::CurState GridCtrl::SetCursor0(int x, int y, bool mouse, bool highlight, int dirx, int diry, bool ctrlmode)
GridCtrl::CurState GridCtrl::SetCursor0(int x, int y, int opt, int dirx, int diry)
{
return SetCursor0(Point(x, y), mouse, highlight, dirx, diry, ctrlmode);
return SetCursor0(Point(x, y), opt, dirx, diry);
}
GridCtrl::CurState GridCtrl::SetCursor0(Point p, bool mouse, bool highlight, int dirx, int diry, bool ctrlmode)
GridCtrl::CurState GridCtrl::SetCursor0(Point p, int opt, int dirx, int diry)
{
CurState cs;
if(!row_changing)
@ -2994,6 +3023,11 @@ GridCtrl::CurState GridCtrl::SetCursor0(Point p, bool mouse, bool highlight, int
cancel_cursor = false;
return cs;
}
bool mouse = opt & CU_MOUSE;
bool highlight = opt & CU_HIGHLIGHT;
bool ctrlmode = opt & CU_CTRLMODE;
bool hidectrls = opt & CU_HIDECTRLS;
Point tmpcur;
@ -3165,7 +3199,15 @@ GridCtrl::CurState GridCtrl::SetCursor0(Point p, bool mouse, bool highlight, int
return cs;
}
else
{
cs.accepted = true;
if(hidectrls && (edit_mode == GE_CELL || (edit_mode == GE_ROW && (isnewrow || !newvalid))))
{
UpdateCtrls(UC_HIDE | UC_CTRLS | UC_OLDCUR);
if(!one_click_edit || !newvalid)
WhenEndEdit();
}
}
oldvalid = IsValidCursorAll(oldcur);
}
@ -3848,6 +3890,8 @@ void GridCtrl::SetItemCursor(Point p, bool b, bool highlight)
GridCtrl& GridCtrl::Indicator(bool b, int size)
{
if(size < 0)
size = GD_IND_WIDTH;
indicator = b;
fixed_width += (size + 1) * (b ? 1 : -1);
SetColWidth(0, b ? size : 0);
@ -4102,39 +4146,41 @@ bool GridCtrl::GetCtrlsData(bool samerow, bool doall, bool updates)
return false;
Value v = focused_ctrl->GetData();
if(v.IsError())
v = Null;
bool was_modified = it.modified;
it.modified = edit_mode == GE_CELL ? it.val != v
: rowbkp[focused_ctrl_id] != v;
it.val = v;
if(!v.IsError())
if(it.modified)
{
bool was_modified = it.modified;
it.modified = edit_mode == GE_CELL ? it.val != v : rowbkp[focused_ctrl_id] != v;
if(it.modified)
if(!was_modified)
row_modified++;
//it.val = v;
if(updates)
{
if(!was_modified)
row_modified++;
it.val = v;
if(updates)
#ifdef LOG_CALLBACKS
LGR(2, "WhenUpdateCell()");
LGR(2, Format("[row: %d, colid: %d]", curid.y, focused_ctrl_id));
LGR(2, Format("[oldval : %s]", AsString(rowbkp[focused_ctrl_id])));
LGR(2, Format("[newval : %s]", AsString(v)));
#endif
WhenUpdateCell();
if(cancel_update_cell)
{
#ifdef LOG_CALLBACKS
LGR(2, "WhenUpdateCell()");
LGR(2, Format("[row: %d, colid: %d]", curid.y, focused_ctrl_id));
LGR(2, Format("[oldval : %s]", AsString(rowbkp[focused_ctrl_id])));
LGR(2, Format("[newval : %s]", AsString(v)));
#endif
WhenUpdateCell();
if(cancel_update_cell)
{
it.val = rowbkp[focused_ctrl_id];
it.modified = false;
if(edit_mode == GE_CELL)
rowbkp[focused_ctrl_id] = it.val;
cancel_update_cell = false;
row_modified--;
}
it.val = rowbkp[focused_ctrl_id];
it.modified = false;
if(edit_mode == GE_CELL)
rowbkp[focused_ctrl_id] = it.val;
cancel_update_cell = false;
row_modified--;
}
}
}
@ -4486,6 +4532,9 @@ void GridCtrl::SyncCtrls(int row)
void GridCtrl::SyncSummary()
{
if(!summary)
return;
if(WhenUpdateSummary)
{
WhenUpdateSummary();
@ -4494,7 +4543,7 @@ void GridCtrl::SyncSummary()
{
for(int i = fixed_cols; i < total_cols; i++)
{
Value t;
Value t = 0;
int idx = hitems[i].id;
@ -4514,14 +4563,16 @@ void GridCtrl::SyncSummary()
{
int idy = vitems[j].id;
const Value& v = items[idy][idx].val;
Value v = items[idy][idx].val;
if(IsNull(v))
continue;
++n;
if(j == fixed_rows)
ProcessSummaryValue(v);
if(j == fixed_rows && (sop == SOP_MIN || sop == SOP_MAX))
t = v;
if(IsNumber(v))
@ -4538,7 +4589,7 @@ void GridCtrl::SyncSummary()
break;
case SOP_SUM:
case SOP_AVG:
t = double(t) + double(v);
t = double(t) + double(v);
}
}
}
@ -4554,6 +4605,13 @@ void GridCtrl::SyncSummary()
RefreshSummary();
}
void GridCtrl::UpdateSummary(bool b)
{
update_summary = b;
if(b)
SyncSummary();
}
bool GridCtrl::HasCtrls()
{
return edit_ctrls || genr_ctrls;
@ -4956,7 +5014,7 @@ bool GridCtrl::Key(dword key, int)
}
return false;
case K_CTRL_W:
//WriteClipboardText(GetColumnWidths());
WriteClipboardText(GetColumnWidths());
return true;
default:
if(searching && !ctrls && Search(key))
@ -5233,7 +5291,7 @@ void GridCtrl::SwapDown(int cnt)
void GridCtrl::MouseLeave()
{
if(live_cursor)
SetCursor0(-1, -1, false, true);
SetCursor0(-1, -1, CU_HIGHLIGHT);
UpdateHighlighting(GS_BORDER, Point(0, 0));
}
@ -5628,12 +5686,14 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
Size sz = GetSize();
int sy = -1;
int opt = ctrls ? CU_CTRLMODE : 0;
switch(jump)
{
case GO_BEGIN:
{
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, firstVisRow, false, false, 0, 1, ctrls))
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, firstVisRow, opt, 0, 1))
return false;
sy = 0;
@ -5641,7 +5701,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
}
case GO_END:
{
if(!SetCursor0((curpos.x < 0 || goleft) ? firstVisCol : curpos.x, lastVisRow, false, false, 0, -1, ctrls))
if(!SetCursor0((curpos.x < 0 || goleft) ? firstVisCol : curpos.x, lastVisRow, opt, 0, -1))
return false;
if(goleft)
GoCursorLeftRight();
@ -5654,7 +5714,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
{
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x,
curpos.y < 0 ? firstVisRow : curpos.y + 1,
0, 0, 0, 1, ctrls))
opt, 0, 1))
return false;
int b = vitems[curpos.y].nBottom(sby);
@ -5669,7 +5729,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
{
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x,
curpos.y < 0 ? firstVisRow : curpos.y - 1,
0, 0, 0, -1, ctrls))
opt, 0, -1))
return false;
int t = vitems[curpos.y].nTop(sby + fixed_height);
@ -5683,7 +5743,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
{
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x - 1,
curpos.y < 0 ? firstVisRow : curpos.y,
0, 0, -1, 0, ctrlmode))
opt, -1, 0))
return false;
break;
@ -5692,7 +5752,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
{
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x + 1,
curpos.y < 0 ? firstVisRow : curpos.y,
0, 0, 1, 0, ctrlmode))
ctrlmode ? CU_CTRLMODE : 0, 1, 0))
return false;
break;
@ -5716,7 +5776,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
c = found ? i : firstVisRow;
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, c, 0, 0, 0, 1, ctrls))
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, c, opt, 0, 1))
return false;
if(scroll && resize_row_mode == 0)
@ -5752,7 +5812,7 @@ bool GridCtrl::Go0(int jump, bool scroll, bool goleft, bool ctrlmode)
c = found ? i : lastVisRow;
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, c, 0, 0, 0, -1, ctrls))
if(!SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, c, opt, 0, -1))
return false;
if(scroll && resize_row_mode == 0)
@ -6007,8 +6067,10 @@ void GridCtrl::Repaint(bool do_recalc_cols /* = false*/, bool do_recalc_rows /*
UpdateSizes();
UpdateSb();
UpdateHolder();
UpdateSummary();
UpdateCtrls();
SyncCtrls();
RebuildToolBar();
doscroll = true;
Refresh();
}
@ -6113,6 +6175,9 @@ bool GridCtrl::EndEdit(bool accept, bool doall, bool remove_row)
void GridCtrl::Insert0(int row, int cnt /* = 1*/, bool recalc /* = true*/, bool refresh /* = true*/, int size /* = GD_ROW_HEIGHT*/)
{
int id;
if(size < 0)
size = GD_ROW_HEIGHT;
if(row < total_rows)
{
@ -6205,8 +6270,8 @@ bool GridCtrl::Remove0(int row, int cnt /* = 1*/, bool recalc /* = true*/, bool
#ifdef LOG_CALLBACKS
LGR(2, "WhenRemoveRow()");
LGR(2, Format("[row: %d]", rowidx));
WhenRemoveRow();
#endif
WhenRemoveRow();
}
if(cancel_remove)
@ -6249,11 +6314,14 @@ bool GridCtrl::Remove0(int row, int cnt /* = 1*/, bool recalc /* = true*/, bool
if(rid == ctrlid.y)
UpdateCtrls(UC_HIDE | UC_CTRLS);
bool removed = false;
if(!remove_hides)
{
total_rows--;
vitems.Remove(rowidx);
items.Remove(id);
removed = true;
}
if(rid == curpos.y)
@ -6267,6 +6335,9 @@ bool GridCtrl::Remove0(int row, int cnt /* = 1*/, bool recalc /* = true*/, bool
{
oldcur.x = oldcur.y = -1;
}
if(removed)
WhenRemovedRow();
}
if(IsEmpty())
@ -6285,7 +6356,7 @@ bool GridCtrl::Remove0(int row, int cnt /* = 1*/, bool recalc /* = true*/, bool
RefreshFrom(row);
if(x >= 0 && y >= 0)
SetCursor0(x, max(fixed_rows, min(total_rows - 1, y)), false, false, 0, -1);
SetCursor0(x, max(fixed_rows, min(total_rows - 1, y)), 0, 0, -1);
if(!valid_cursor)
RebuildToolBar();
@ -6299,6 +6370,9 @@ bool GridCtrl::Remove0(int row, int cnt /* = 1*/, bool recalc /* = true*/, bool
int GridCtrl::Append0(int cnt, int size, bool refresh)
{
if(size < 0)
size = GD_ROW_HEIGHT;
vitems.AddN(cnt);
items.AddN(cnt);
@ -6857,7 +6931,7 @@ void GridCtrl::DoRemove()
UpdateSb();
Refresh();
curpos.y = -1;
SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, max(fixed_rows, min(total_rows - 1, y)), false, false, 0, -1);
SetCursor0(curpos.x < 0 ? firstVisCol : curpos.x, max(fixed_rows, min(total_rows - 1, y)), 0, 0, -1);
shiftpos = curpos;
}
}
@ -7019,6 +7093,7 @@ int GridCtrl::ShowMatchedRows(const WString &f)
ShowRows(true);
return 0;
}
if(!search_immediate && search_highlight)
{
@ -7569,6 +7644,25 @@ void GridCtrl::UpdateHighlighting(int mode, Point p)
RefreshRow(0, 0, 1);
}
String GridCtrl::GetColumnWidths()
{
String s;
for(int i = fixed_cols; i < total_cols; i++)
{
s += AsString(hitems[i].nsize);
if(i < total_cols - 1)
s += " ";
}
return s;
}
void GridCtrl::ColumnWidths(const char* s)
{
Vector<String> w = UPP::Split(s, ' ');
for(int i = 0; i < min(w.GetCount(), GetColumnCount()); i++)
hitems[i + fixed_cols].Width(atoi(w[i]));
}
#ifdef flagGRIDSQL
void GridCtrl::FieldLayout(FieldOperator& f)
{
@ -7595,25 +7689,6 @@ SqlSet GridCtrl::GetColumnList(bool skip_hidden) const
return s;
}
String GridCtrl::GetColumnWidths()
{
String s;
for(int i = fixed_cols; i < total_cols; i++)
{
s += AsString(hitems[i].nsize);
if(i < total_cols - 1)
s += " ";
}
return s;
}
void GridCtrl::ColumnWidths(const char* s)
{
Vector<String> w = UPP::Split(s, ' ');
for(int i = 0; i < min(w.GetCount(), GetColumnCount()); i++)
hitems[i + fixed_cols].Width(atoi(w[i]));
}
#endif

View file

@ -256,10 +256,10 @@ class GridCtrl : public Ctrl
public:
static int GD_COL_WIDTH;
static int GD_ROW_HEIGHT;
static int GD_HDR_HEIGHT;
static int GD_IND_WIDTH;
int GD_COL_WIDTH;
int GD_ROW_HEIGHT;
int GD_HDR_HEIGHT;
int GD_IND_WIDTH;
enum GridOrder
{
@ -299,6 +299,14 @@ class GridCtrl : public Ctrl
UC_OLDCUR = BIT(12)
};
enum GridCursorState
{
CU_MOUSE = BIT(0),
CU_HIGHLIGHT = BIT(1),
CU_CTRLMODE = BIT(2),
CU_HIDECTRLS = BIT(3)
};
enum GridSummaryOperation
{
SOP_NONE = 0,
@ -622,9 +630,9 @@ class GridCtrl : public Ctrl
ItemRect& Max(int n);
ItemRect& Fixed(int n);
ItemRect& FixedAuto();
ItemRect& Edit(Ctrl &ctrl);
ItemRect& Edit(Ctrl &ctrl, bool b = true);
template<typename T>
ItemRect& EditConvert(T &ctrl) { return Edit(ctrl).SetConvert(ctrl); }
ItemRect& EditConvert(T &ctrl, bool b = true) { return Edit(ctrl, b).SetConvert(ctrl); }
template<typename T>
ItemRect& EditConvertDisplay(T &ctrl) { return Edit(ctrl).SetConvert(ctrl).SetDisplay(ctrl); }
ItemRect& EditInsert(bool b = true);
@ -827,6 +835,7 @@ class GridCtrl : public Ctrl
bool chameleon:1;
bool summary_row:1;
bool update_summary:1;
bool search_hide:1;
bool search_highlight:1;
@ -925,7 +934,7 @@ class GridCtrl : public Ctrl
int join_group;
int sync_flag;
int paint_flag;
int paint_flag;
/* Points */
@ -1023,7 +1032,7 @@ class GridCtrl : public Ctrl
GridCtrl& ResizeColMode(int m = 0);
GridCtrl& ResizeRowMode(int m = 0);
GridCtrl& Indicator(bool b = true, int size = GD_IND_WIDTH);
GridCtrl& Indicator(bool b = true, int size = -1);
GridCtrl& GridColor(Color fg = SColorShadow);
GridCtrl& FocusColor(Color fg = SColorHighlightText, Color bg = SColorHighlight);
@ -1076,7 +1085,7 @@ class GridCtrl : public Ctrl
GridCtrl& FullRowResizing(bool b = true) { full_row_resizing = b; return *this; }
GridCtrl& Chameleon(bool b = true) { chameleon = b; return *this; }
GridCtrl& SummaryRow(bool b = true) { summary_row = b; return *this; }
GridCtrl& SearchOffset(int offset) { find_offset = offset; return *this; }
GridCtrl& SearchMoveCursor(bool b = true) { search_move_cursor = b; return *this; }
GridCtrl& SearchImmediate(bool b = true) { search_immediate = b; return *this; }
@ -1133,10 +1142,10 @@ class GridCtrl : public Ctrl
/* Methods */
ItemRect& InsertColumn(int pos, const char *name = NULL, int size = GD_COL_WIDTH, bool idx = false);
ItemRect& AddColumn(const Id id, const char *name = NULL, int size = GD_COL_WIDTH, bool idx = false);
ItemRect& AddColumn(const String& name, int size = GD_COL_WIDTH, bool idx = false);
ItemRect& AddColumn(const char *name = NULL, int size = GD_COL_WIDTH, bool idx = false);
ItemRect& InsertColumn(int pos, const char *name = NULL, int size = -1, bool idx = false);
ItemRect& AddColumn(const Id id, const char *name = NULL, int size = -1, bool idx = false);
ItemRect& AddColumn(const String& name, int size = -1, bool idx = false);
ItemRect& AddColumn(const char *name = NULL, int size = -1, bool idx = false);
void RemoveColumn(int n, int count = 1);
@ -1149,7 +1158,7 @@ class GridCtrl : public Ctrl
ItemRect& AddIndex(const char *name) { return AddColumn(name, 0, true); }
ItemRect& AddIndex(String &name) { return AddColumn(name, 0, true); }
ItemRect& AddRow(int n = 1, int size = GD_ROW_HEIGHT);
ItemRect& AddRow(int n = 1, int size = -1);
GridCtrl& Add() { AddRow(); return *this; }
//$-GridCtrl& Add(const Value& [, const Value& ]...);
@ -1251,7 +1260,7 @@ class GridCtrl : public Ctrl
void SetFixedRows(int n = 1);
void SetFixedCols(int n = 1);
static int GetStdRowHeight() { return GD_ROW_HEIGHT; }
int GetStdRowHeight() { return GD_ROW_HEIGHT; }
void RefreshRow(int n = -1, bool relative = true, bool fixed = false);
void RefreshCol(int n = -1, bool relative = true, bool fixed = false);
@ -1289,7 +1298,7 @@ class GridCtrl : public Ctrl
bool EndEdit(bool accept = true, bool doall = false, bool remove_row = true);
bool CancelEdit(bool remove_row = true) { return EndEdit(false, false, remove_row); }
int Append(int cnt = 1, bool refresh = true, int height = GD_ROW_HEIGHT);
int Append(int cnt = 1, bool refresh = true, int height = -1);
void Insert(int i, int cnt = 1);
void Remove(int i = -1, int cnt = 1);
void RemoveFirst(int cnt = 1);
@ -1385,7 +1394,7 @@ class GridCtrl : public Ctrl
int GetFixedCount() const;
int GetTotalCount() const;
void SetRowCount(int n, int size = GD_ROW_HEIGHT);
void SetRowCount(int n, int size = -1);
void SetColCount(int n, int size = 100);
void Select(int n, int cnt = 1);
@ -1510,6 +1519,8 @@ class GridCtrl : public Ctrl
operator SqlSet() const { return GetColumnList(); }
SqlSet GetColumnList(bool skip_hidden = false) const;
#endif
void UpdateSummary(bool b = true);
private:
@ -1517,8 +1528,8 @@ class GridCtrl : public Ctrl
bool Go0(int jump, bool scroll = true, bool goleft = false, bool ctrlmode = false);
CurState SetCursor0(Point p, bool mouse = false, bool highlight = false, int dirx = 0, int diry = 0, bool ctrlmode = false);
CurState SetCursor0(int x, int y, bool mouse = false, bool highlight = false, int dirx = 0, int diry = 0, bool ctrlmode = false);
CurState SetCursor0(Point p, int opt = 0, int dirx = 0, int diry = 0);
CurState SetCursor0(int x, int y, int opt = 0, int dirx = 0, int diry = 0);
int SetCursor0(int n);
bool IsValidCursor(const Point &p, int fc, int lc, int fr, int lr) const;
@ -1529,10 +1540,10 @@ class GridCtrl : public Ctrl
void SetItemCursor(Point p, bool b, bool highlight);
void Insert0(int row, int cnt = 1, bool recalc = true, bool refresh = true, int size = GD_ROW_HEIGHT);
void Insert0(int row, int cnt = 1, bool recalc = true, bool refresh = true, int size = -1);
bool Remove0(int row, int cnt = 1, bool recalc = true, bool refresh = true, bool whens = true);
void Duplicate0(int row, int cnt = 1, bool recalc = true, bool refresh = true);
int Append0(int cnt = 1, int size = GD_ROW_HEIGHT, bool refresh = true);
int Append0(int cnt = 1, int size = -1, bool refresh = true);
void GoCursorLeftRight();
@ -1675,6 +1686,7 @@ class GridCtrl : public Ctrl
Callback WhenInsertRow;
Callback WhenUpdateRow;
Callback WhenRemoveRow;
Callback WhenRemovedRow;
Callback WhenDuplicateRow;
Callback WhenCancelNewRow;
@ -1702,6 +1714,8 @@ class GridCtrl : public Ctrl
Callback StdEdit;
Callback WhenSort;
Callback1<Value&> ProcessSummaryValue;
Callback3<int, int, Value&> WhenPasteCell;
};

View file

@ -26,6 +26,7 @@ IMAGE_ID(VHdr3)
IMAGE_ID(VHdr4)
IMAGE_ID(VHdr5)
IMAGE_ID(VHdr6)
IMAGE_ID(VHdr7)
IMAGE_ID(VHdr5H)
IMAGE_ID(BodyVertHigh)
IMAGE_ID(BodyVertHigh2)
@ -102,70 +103,72 @@ IMAGE_DATA(203,196,254,37,143,235,198,227,197,114,241,58,243,211,50,81,60,19,91,
IMAGE_END_DATA(1504, 19)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,89,125,108,83,215,21,119,104,66,66,128,1,77,36,132,180,22,146,110,100,13,45,137,139,50,24,101,137,210)
IMAGE_DATA(45,130,17,53,99,34,13,205,64,77,87,178,14,210,106,136,173,12,193,31,211,84,1,75,209,196,178,148,46,154,54,137)
IMAGE_DATA(109,210,164,106,141,82,181,154,4,91,85,81,218,44,210,130,214,16,72,128,124,57,182,99,59,254,254,140,237,216,142,243)
IMAGE_DATA(219,61,215,123,142,159,243,108,191,23,103,8,77,61,209,79,206,189,231,252,206,185,239,190,123,239,59,247,94,213,6,85)
IMAGE_DATA(177,170,64,181,74,37,71,192,68,150,97,122,62,150,234,71,224,11,80,234,39,153,175,212,15,146,68,162,106,73,237,201)
IMAGE_DATA(166,95,31,164,143,69,15,43,163,63,82,217,45,21,203,233,35,219,103,89,142,62,125,88,125,200,233,15,37,241,147,177)
IMAGE_DATA(148,246,100,195,79,246,147,77,159,38,248,73,47,57,170,13,241,255,221,118,11,146,97,55,233,97,156,28,133,126,124,104)
IMAGE_DATA(1,99,139,49,52,208,207,33,114,232,178,77,195,105,53,49,24,225,176,24,96,51,79,193,62,173,135,205,164,131,213,168)
IMAGE_DATA(133,89,63,193,49,173,27,135,81,59,10,19,11,100,212,220,135,97,226,30,166,24,200,49,115,88,20,119,232,241,4,112)
IMAGE_DATA(103,104,20,67,195,99,24,190,59,142,187,247,38,112,111,68,131,145,81,45,70,199,116,24,27,215,99,92,51,133,137,73)
IMAGE_DATA(3,52,90,35,180,186,105,232,166,204,208,27,44,152,50,90,97,48,217,96,156,182,163,255,230,45,114,252,104,220,177,86)
IMAGE_DATA(171,133,94,175,135,193,96,128,201,100,194,244,244,52,44,22,11,108,54,27,28,14,7,156,78,39,220,110,55,188,94,47)
IMAGE_DATA(102,102,102,16,8,4,16,12,6,17,10,133,16,137,68,16,141,70,49,63,63,47,110,45,85,134,153,114,150,25,5,152)
IMAGE_DATA(241,140,63,0,175,111,6,110,143,23,14,151,27,54,135,11,22,155,3,211,22,106,21,181,208,12,237,148,9,26,157,1)
IMAGE_DATA(227,147,122,140,78,232,112,127,108,18,119,71,38,254,31,28,207,205,205,113,231,161,112,152,7,8,6,103,89,63,198,130)
IMAGE_DATA(248,102,252,240,240,64,62,184,220,30,56,93,30,216,157,177,128,86,187,3,22,43,5,181,195,100,182,138,135,216,140,199)
IMAGE_DATA(133,100,120,28,86,216,205,70,88,77,218,5,24,23,67,59,49,202,33,114,232,247,185,65,240,121,157,240,185,29,240,186)
IMAGE_DATA(108,28,30,167,21,110,135,101,209,120,182,153,117,176,48,103,28,134,201,216,152,205,83,21,138,102,162,212,236,148,168,135)
IMAGE_DATA(68,125,242,178,36,85,39,23,153,98,164,111,243,3,120,40,37,156,229,121,168,71,84,185,82,15,33,39,32,245,72,222)
IMAGE_DATA(34,135,146,81,50,63,137,60,110,190,106,181,84,192,84,196,228,96,169,234,229,142,45,57,241,30,110,93,190,248,117,43)
IMAGE_DATA(153,44,114,199,182,236,224,169,13,51,7,80,254,246,114,89,120,25,193,149,12,5,249,179,46,41,120,170,167,145,122,58)
IMAGE_DATA(37,13,145,246,191,146,253,73,72,170,247,38,119,221,201,52,73,228,249,95,37,115,99,43,163,241,74,122,81,138,39,103)
IMAGE_DATA(48,203,213,203,153,44,242,135,79,250,25,46,150,2,213,138,84,228,116,67,74,90,191,132,245,246,97,215,41,153,212,114)
IMAGE_DATA(222,98,250,120,27,18,51,171,208,60,12,174,8,198,44,33,197,32,30,241,181,142,48,130,97,150,107,179,92,50,234,247)
IMAGE_DATA(203,6,217,19,143,248,195,198,89,94,118,119,255,21,182,206,14,217,32,123,226,17,255,214,212,44,162,62,31,172,111,253)
IMAGE_DATA(82,49,136,71,252,155,218,32,251,223,11,243,47,126,174,24,196,35,126,223,120,0,81,175,7,166,159,189,17,135,32,153)
IMAGE_DATA(234,136,71,252,79,70,252,152,243,184,49,245,122,91,28,137,34,85,22,64,60,226,255,99,120,6,115,110,23,116,175,180)
IMAGE_DATA(136,32,37,201,54,196,35,254,223,6,125,152,115,57,161,57,244,194,34,36,138,148,158,120,196,239,249,220,139,8,219,171)
IMAGE_DATA(141,125,247,121,17,164,36,217,134,120,196,127,183,223,131,136,195,142,251,117,207,197,145,40,82,101,1,196,35,254,159,251)
IMAGE_DATA(220,136,216,109,24,126,246,27,113,8,146,169,142,120,196,255,195,103,46,68,216,254,243,206,215,119,40,6,241,136,223,245)
IMAGE_DATA(73,204,199,224,246,109,24,172,120,74,62,152,61,241,136,223,249,177,147,207,161,177,151,95,194,160,122,123,28,183,158,46)
IMAGE_DATA(199,192,147,91,49,80,94,134,193,202,167,69,58,2,217,19,143,248,239,222,244,96,202,25,65,152,237,241,130,108,175,29)
IMAGE_DATA(212,233,56,102,141,70,132,216,62,59,100,54,35,200,246,223,66,61,7,179,35,123,226,17,223,236,157,67,247,191,189,248)
IMAGE_DATA(245,71,14,197,32,30,241,69,11,146,143,45,40,147,108,97,25,102,11,140,82,16,143,248,247,237,97,216,66,81,201,1)
IMAGE_DATA(150,73,136,71,252,62,182,24,112,241,76,0,247,174,203,7,217,51,33,254,117,205,127,125,244,189,175,28,76,136,127,117)
IMAGE_DATA(36,24,243,113,237,79,202,193,132,248,31,220,13,196,124,188,215,185,0,65,100,212,17,255,189,219,254,152,238,247,111,46)
IMAGE_DATA(32,81,164,202,9,118,196,255,203,231,51,49,93,231,27,98,72,137,132,13,241,175,244,251,98,250,55,143,46,70,162,164)
IMAGE_DATA(208,19,255,119,125,222,152,205,169,38,49,164,68,194,134,248,151,63,245,196,244,63,254,206,2,18,69,170,156,96,71,252)
IMAGE_DATA(142,235,238,152,174,117,207,2,4,145,81,71,252,95,125,236,138,233,94,170,82,14,38,196,191,248,145,51,230,163,169,28)
IMAGE_DATA(56,180,77,62,200,158,9,241,223,250,187,35,230,163,253,7,64,243,182,5,52,110,5,14,148,2,223,123,2,120,177,92)
IMAGE_DATA(172,35,144,61,19,226,191,125,195,141,63,14,6,48,63,79,201,132,63,1,33,254,145,159,159,139,48,4,146,116,12,209)
IMAGE_DATA(40,231,17,127,196,30,193,59,159,185,209,126,205,161,24,196,35,254,255,44,67,138,206,206,34,204,86,86,185,32,251,196)
IMAGE_DATA(12,137,202,163,205,135,48,240,181,175,202,6,217,19,79,200,144,178,249,242,8,25,82,54,95,64,33,67,202,230,75,44)
IMAGE_DATA(100,72,217,100,4,66,134,148,77,102,178,156,25,82,54,153,154,144,33,101,147,49,10,25,82,54,153,171,144,33,101,147)
IMAGE_DATA(65,11,25,82,54,153,188,144,33,205,71,34,112,191,223,3,123,215,59,113,216,46,119,198,118,15,111,255,6,246,223,94)
IMAGE_DATA(22,233,8,100,79,188,196,12,105,46,204,224,241,196,65,49,132,93,76,98,125,28,161,240,242,102,72,95,74,189,231,229)
IMAGE_DATA(210,250,195,163,248,102,245,179,41,241,147,159,158,92,180,55,172,171,251,22,14,31,62,140,11,23,46,224,204,153,51,56)
IMAGE_DATA(117,234,20,78,158,60,137,179,103,207,162,173,173,13,199,142,29,67,69,229,118,17,79,253,140,26,7,15,30,196,149,43)
IMAGE_DATA(87,248,149,203,197,139,23,185,143,115,231,206,241,114,119,119,55,215,151,148,150,196,121,143,63,254,24,246,239,223,143,230)
IMAGE_DATA(230,102,12,13,13,33,28,14,195,199,58,176,167,167,135,115,232,10,194,106,181,162,161,161,1,197,197,69,156,183,110,221)
IMAGE_DATA(58,212,214,214,162,190,190,30,123,247,238,69,99,99,35,52,26,13,231,210,213,14,113,232,234,231,192,129,3,168,169,169)
IMAGE_DATA(193,202,149,43,177,105,211,38,168,213,106,94,222,189,123,55,118,238,220,201,209,209,209,193,237,9,196,165,114,105,105,41)
IMAGE_DATA(183,207,201,201,225,241,136,191,102,205,26,172,93,187,22,235,215,175,71,93,93,29,143,71,215,76,116,237,68,191,58,150)
IMAGE_DATA(254,82,27,87,172,88,193,33,60,223,170,85,5,200,203,203,67,110,110,46,250,250,250,248,21,85,239,63,123,209,212,244)
IMAGE_DATA(2,110,220,184,193,203,3,183,6,176,101,203,22,110,147,216,159,20,171,184,184,24,223,102,239,226,195,15,63,64,3,91)
IMAGE_DATA(88,106,159,171,65,211,161,70,92,189,118,21,173,173,71,241,204,14,53,247,159,252,254,168,253,101,101,91,177,191,126,31)
IMAGE_DATA(94,108,110,66,235,171,175,160,237,181,31,225,213,99,173,188,252,124,67,61,242,243,243,37,207,4,212,234,74,20,20,20)
IMAGE_DATA(164,4,141,135,140,131,142,26,249,229,199,54,165,196,107,175,31,95,20,188,172,236,43,216,183,111,31,218,219,219,249,128)
IMAGE_DATA(59,113,226,4,142,31,63,142,211,167,79,163,165,165,5,71,142,28,65,126,129,248,97,11,87,23,98,207,158,61,124,192)
IMAGE_DATA(144,92,186,116,137,251,56,127,254,60,47,83,39,147,94,149,116,108,85,81,81,193,95,36,221,115,9,210,219,219,43,90)
IMAGE_DATA(5,171,170,170,68,7,45,37,37,37,168,172,172,68,121,121,57,170,171,171,37,87,224,93,187,118,97,243,230,205,241,67)
IMAGE_DATA(151,194,194,66,94,222,184,113,35,138,138,138,56,186,186,186,68,28,42,171,50,28,236,148,149,149,73,198,75,104,163,228)
IMAGE_DATA(81,162,153,237,211,72,140,38,35,155,52,53,160,123,83,18,127,208,159,246,192,104,43,123,23,253,253,255,66,21,251,50)
IMAGE_DATA(151,60,177,153,13,188,106,220,190,115,155,13,220,70,172,94,91,152,246,172,180,162,242,41,54,104,107,209,212,124,16,45)
IMAGE_DATA(47,127,31,205,71,154,120,121,71,85,101,202,131,168,194,194,130,180,231,180,52,30,190,88,233,190,88,233,30,252,74,151)
IMAGE_DATA(167,202,73,230,65,244,155,151,250,162,70,138,148,92,39,231,188,54,149,93,90,249,15,92,234,59,54,0,0,0,0,0)
IMAGE_END_DATA(2112, 32)
IMAGE_DATA(120,156,237,89,127,76,148,231,29,63,28,8,162,78,29,44,198,100,173,66,59,217,176,21,168,97,58,235,32,116,35,58)
IMAGE_DATA(73,153,139,20,203,52,165,171,172,83,218,204,184,213,25,253,99,89,26,117,212,44,142,81,91,178,108,137,221,146,37,205)
IMAGE_DATA(74,104,218,44,209,173,105,172,43,35,25,102,69,20,84,126,29,247,251,247,239,131,59,238,142,227,179,231,251,220,222,227)
IMAGE_DATA(222,187,247,142,247,229,152,113,73,191,228,147,227,121,158,239,231,251,125,126,191,223,231,121,84,27,84,197,170,2,213,42)
IMAGE_DATA(149,28,1,19,89,138,153,249,88,170,29,129,47,64,169,157,100,190,82,59,72,18,137,172,37,213,39,155,126,125,144,54)
IMAGE_DATA(82,26,43,163,63,210,233,45,21,203,105,35,219,182,44,71,159,62,172,54,228,244,135,18,255,201,88,74,125,178,225,39)
IMAGE_DATA(219,201,166,79,19,236,100,150,28,213,134,248,255,30,135,21,201,112,152,116,48,78,141,65,55,49,188,128,241,84,12,15)
IMAGE_DATA(14,112,136,12,186,237,102,184,108,38,6,35,156,86,3,236,22,61,28,102,29,236,38,45,108,70,13,44,186,73,14,179)
IMAGE_DATA(118,2,70,205,24,76,204,145,81,125,31,134,201,123,208,51,144,97,102,176,40,110,208,235,13,224,206,240,24,134,71,198)
IMAGE_DATA(49,114,119,2,119,239,77,226,222,168,26,163,99,26,140,141,107,49,62,161,195,132,90,143,201,41,3,212,26,35,52,90)
IMAGE_DATA(51,180,122,11,116,6,43,244,70,27,12,38,59,140,102,7,6,110,222,34,195,95,138,27,214,104,52,208,233,116,48,24)
IMAGE_DATA(12,48,153,76,48,155,205,176,90,173,176,219,237,112,58,157,112,185,92,240,120,60,240,249,124,152,158,158,70,32,16,64)
IMAGE_DATA(48,24,68,40,20,66,36,18,65,52,26,197,252,252,188,184,182,148,25,102,133,179,76,41,192,148,167,103,2,240,249,167)
IMAGE_DATA(225,241,250,224,116,123,96,119,186,97,181,59,97,182,82,173,168,134,22,104,244,38,168,181,6,76,76,233,48,54,169,197)
IMAGE_DATA(253,241,41,220,29,157,252,255,52,252,229,5,195,115,115,208,235,180,48,232,117,28,70,131,30,38,163,129,195,108,50,114)
IMAGE_DATA(88,204,38,88,45,102,14,155,213,2,187,205,202,225,176,219,56,156,14,59,92,78,7,199,228,196,120,106,205,231,152,19)
IMAGE_DATA(170,125,40,28,230,45,8,6,103,217,64,197,90,225,159,158,129,151,183,196,15,183,199,11,151,219,11,135,43,214,34,155)
IMAGE_DATA(195,9,171,141,90,229,128,201,98,19,207,225,105,175,27,201,240,58,89,141,44,70,216,76,154,5,24,83,161,153,28,227)
IMAGE_DATA(16,25,156,241,123,64,240,251,92,240,123,156,240,185,237,28,94,151,13,30,167,53,101,193,216,45,90,88,153,49,14,195)
IMAGE_DATA(84,108,81,228,169,10,69,75,93,98,101,67,34,31,18,249,201,251,158,84,158,92,44,230,35,115,157,31,64,163,148,112)
IMAGE_DATA(150,167,81,95,80,229,74,53,66,142,67,234,145,188,20,131,146,94,22,111,137,60,110,190,106,181,148,195,116,196,100,103)
IMAGE_DATA(233,242,229,206,45,57,254,30,238,178,124,241,112,43,89,44,114,231,182,108,231,233,21,23,119,160,124,244,114,153,123,25)
IMAGE_DATA(206,149,76,5,249,171,46,201,121,186,214,72,181,78,73,69,164,237,175,100,127,18,146,110,220,228,238,59,139,45,18,121)
IMAGE_DATA(246,87,201,60,57,203,168,188,146,94,148,226,201,153,204,114,203,229,44,22,249,211,39,243,10,23,75,129,106,69,58,114)
IMAGE_DATA(166,41,37,93,190,132,253,246,97,47,83,178,168,229,140,98,102,127,27,18,35,171,208,60,12,238,8,198,173,33,197,32)
IMAGE_DATA(30,241,53,206,48,130,97,22,204,179,88,50,58,51,35,27,164,79,60,226,143,24,103,121,218,211,243,23,216,187,58,101)
IMAGE_DATA(131,244,137,71,252,91,250,89,68,253,126,216,222,248,149,98,16,143,248,55,53,65,246,191,15,150,95,254,66,49,136,71)
IMAGE_DATA(252,254,137,0,162,62,47,76,63,127,45,14,65,22,203,35,30,241,63,25,157,193,156,215,3,253,171,237,113,36,138,84)
IMAGE_DATA(90,0,241,136,255,247,145,105,204,121,220,208,190,212,42,130,148,36,235,16,143,248,127,29,242,99,206,237,130,250,208,115)
IMAGE_DATA(41,72,20,169,114,226,17,191,247,51,31,34,236,48,56,254,189,103,69,144,146,100,29,226,17,255,221,1,47,34,236,16)
IMAGE_DATA(115,191,254,153,56,18,69,42,45,128,120,196,255,83,191,7,17,118,32,26,121,250,155,113,8,178,88,30,241,136,255,135)
IMAGE_DATA(79,221,136,176,3,238,157,111,236,80,12,226,17,191,251,147,152,141,161,237,219,48,84,241,132,124,48,125,226,17,191,235)
IMAGE_DATA(99,23,95,67,227,47,190,128,161,170,237,113,220,122,178,28,131,95,223,138,193,242,50,12,85,62,41,42,35,144,62,241)
IMAGE_DATA(136,255,238,77,47,244,174,8,194,236,140,23,100,135,249,160,86,203,49,107,52,34,196,14,242,33,139,5,65,118,192,23)
IMAGE_DATA(242,57,152,30,233,19,143,248,22,223,28,122,254,237,195,111,62,114,42,6,241,136,47,218,144,252,108,67,153,98,27,203)
IMAGE_DATA(8,219,96,148,130,120,196,191,239,8,195,30,138,74,78,176,197,132,120,196,239,103,155,1,23,239,36,112,239,186,124,144)
IMAGE_DATA(62,19,226,95,87,255,215,70,255,251,202,193,132,248,87,71,131,49,27,215,254,168,28,76,136,255,193,221,64,204,198,123)
IMAGE_DATA(93,11,16,68,70,30,241,223,187,61,19,43,251,253,235,11,72,20,169,116,130,30,241,255,252,217,116,172,172,235,53,49)
IMAGE_DATA(164,68,66,135,248,87,6,252,177,242,215,143,166,34,81,210,148,19,255,119,253,190,152,206,169,102,49,164,68,66,135,248)
IMAGE_DATA(151,255,225,141,149,255,228,187,11,72,20,169,116,130,30,241,59,175,123,98,101,109,123,22,32,136,140,60,226,255,250,99)
IMAGE_DATA(119,172,236,133,106,229,96,66,252,139,31,185,98,54,154,203,129,67,219,228,131,244,153,16,255,141,191,57,99,54,58,126)
IMAGE_DATA(8,180,108,91,64,211,86,224,64,41,240,253,199,128,231,203,197,101,4,210,103,66,252,55,111,120,240,206,80,0,243,243)
IMAGE_DATA(20,76,204,36,32,196,63,242,243,115,17,134,64,82,25,67,52,202,121,196,31,117,68,240,214,167,30,116,92,115,42,6)
IMAGE_DATA(241,136,255,63,139,144,162,179,179,8,179,157,85,46,72,63,49,66,162,244,88,203,33,12,126,237,171,178,65,250,196,19)
IMAGE_DATA(34,164,108,190,60,66,132,148,205,23,80,136,144,178,249,18,11,17,82,54,17,129,16,33,101,19,153,44,103,132,148,77)
IMAGE_DATA(164,38,68,72,217,68,140,66,132,148,77,228,42,68,72,217,68,208,66,132,148,77,36,47,68,72,243,145,8,60,239,247)
IMAGE_DATA(194,209,253,86,28,246,203,93,177,211,195,155,191,133,227,237,203,162,50,2,233,19,47,49,66,154,11,51,120,189,113,144)
IMAGE_DATA(15,225,20,147,152,31,71,40,188,188,17,210,23,211,159,121,185,180,253,232,40,190,85,243,116,90,252,244,103,39,83,206)
IMAGE_DATA(134,245,245,223,198,225,195,135,113,225,194,5,156,57,115,6,167,78,157,194,201,147,39,113,246,236,89,180,183,183,227,216)
IMAGE_DATA(177,99,168,168,220,46,226,85,61,85,133,131,7,15,226,202,149,43,252,77,231,226,197,139,220,198,185,115,231,120,186,167)
IMAGE_DATA(167,135,151,151,148,150,196,121,143,62,250,8,246,239,223,143,150,150,22,12,15,15,35,28,14,195,207,58,176,183,183,151)
IMAGE_DATA(115,232,9,194,102,179,161,177,177,17,197,197,69,156,183,110,221,58,212,213,213,161,161,161,1,123,247,238,69,83,83,19)
IMAGE_DATA(212,106,53,231,210,219,17,113,232,109,233,192,129,3,168,173,173,197,202,149,43,177,105,211,38,84,85,85,241,244,238,221)
IMAGE_DATA(187,177,115,231,78,142,206,206,78,174,79,32,46,165,75,75,75,185,126,78,78,14,247,71,252,53,107,214,96,237,218,181)
IMAGE_DATA(88,191,126,61,234,235,235,185,63,122,199,162,119,45,250,213,178,240,151,234,184,98,197,10,14,161,125,171,86,21,32,47)
IMAGE_DATA(47,15,185,185,185,232,239,239,231,111,96,125,255,236,67,115,243,115,184,113,227,6,79,15,222,26,196,150,45,91,184,78)
IMAGE_DATA(98,127,146,175,226,226,98,124,135,141,197,135,31,126,128,70,182,177,212,61,83,139,230,67,77,184,122,237,42,218,218,142)
IMAGE_DATA(226,169,29,85,220,126,242,248,81,253,203,202,182,98,127,195,62,60,223,210,140,182,151,95,66,251,43,63,198,203,199,218)
IMAGE_DATA(120,250,217,198,6,228,231,231,75,222,9,84,85,85,162,160,160,32,45,104,62,44,58,233,168,146,95,121,100,83,90,188)
IMAGE_DATA(242,234,241,20,231,101,101,143,99,223,190,125,232,232,232,224,19,238,196,137,19,56,126,252,56,78,159,62,141,214,214,86)
IMAGE_DATA(28,57,114,4,249,5,226,198,22,174,46,196,158,61,123,248,132,33,185,116,233,18,183,113,254,252,121,158,166,78,166,114)
IMAGE_DATA(85,210,181,85,69,69,5,31,72,122,231,18,164,175,175,79,180,11,86,87,87,139,46,90,74,74,74,80,89,89,137,242)
IMAGE_DATA(242,114,212,212,212,72,238,192,187,118,237,194,230,205,155,227,151,46,133,133,133,60,189,113,227,70,20,21,21,113,116,119)
IMAGE_DATA(119,139,56,148,86,45,114,177,83,86,86,38,233,47,161,142,146,87,137,22,118,78,35,49,154,140,108,209,212,130,30,102)
IMAGE_DATA(73,102,130,51,25,47,140,182,178,177,24,24,248,23,170,217,151,185,228,177,205,108,226,213,224,246,157,219,108,226,54,97)
IMAGE_DATA(245,218,194,140,119,165,21,149,79,176,73,91,135,230,150,131,104,125,241,7,104,57,210,204,211,59,170,43,211,94,68,21)
IMAGE_DATA(22,22,100,188,167,165,249,240,249,78,247,249,78,247,224,119,186,60,85,78,50,15,162,223,188,244,15,53,82,164,228,60)
IMAGE_DATA(57,247,181,233,244,50,202,127,0,9,173,137,86,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
IMAGE_END_DATA(2176, 33)

View file

@ -18,7 +18,8 @@ static Image (*vhdr[])() =
GridImg::VHdr3,
GridImg::VHdr4,
GridImg::VHdr5,
GridImg::VHdr6
GridImg::VHdr6,
GridImg::VHdr7
};
void GridDisplay::SetDefault()
@ -39,12 +40,6 @@ void GridDisplay::Paint(Draw &w, int x, int y, int cx, int cy, const Value &val,
{
if(cx == 0 || cy == 0) return;
if(style & GD::READONLY)
{
bg = Blend(bg, SGray(), 40);
fg = Blend(fg, SGray(), 200);
}
Color mg = bg;
int al = style & GD::ALIGN ? style & GD::ALIGN : align;
@ -145,6 +140,7 @@ void GridDisplay::PaintFixed(Draw &w, bool firstx, bool firsty, int x, int y, in
}
Color dark(76, 83, 92);
//Color dark(155, 154, 153);
Color bright(White);
if(!firstx) w.DrawRect(x, y, 1, cy, bright);

View file

@ -3,7 +3,7 @@
NAMESPACE_UPP
LineEdit *dlog = NULL;
DropList *dlev = NULL;
int dlev = 0;
static int pos = 0;
@ -29,9 +29,10 @@ void LogCon(int level, const char *fmt, ...)
void LogGui(const char *fmt, ...)
{
if(!dlog || !dlev || int(~(*dlev)) > 0)
if(!dlog || dlev > 0)
return;
pos = dlog->GetLength();
char buffer[1024];
va_list argptr;
va_start(argptr, fmt);
@ -47,9 +48,10 @@ void LogGui(const char *fmt, ...)
void LogGui(int level, const char *fmt, ...)
{
if(!dlog || !dlev || level < int(~(*dlev)))
if(!dlog || level < dlev)
return;
pos = dlog->GetLength();
char buffer[1024];
va_list argptr;
va_start(argptr, fmt);

View file

@ -45,7 +45,7 @@ inline int32 Round(double a)
#define LGR LogGui
extern LineEdit *dlog;
extern DropList *dlev;
extern int dlev;
void LogGui(const char *fmt, ...);
void LogGui(int level, const char *fmt, ...);

View file

@ -278,5 +278,8 @@
+ summary row
- toolbar wasn't rebuilded after right mouse click on row
- to WhenEndEdit() was passed new cursor position instead of old
- small refactoring