VectorMap<String, Value> Pdb::DataMap(const ArrayCtrl& a) { VectorMap<String, Value> r; for(int i = 0; i < a.GetCount(); i++) r.Add(a.Get(i, 0), a.Get(i, 1)); return r; }
VectorMap<String, String> DataMap(const ArrayCtrl& data) { GuiLock __; VectorMap<String, String> m; for(int i = 0; i < data.GetCount(); i++) m.Add(data.Get(i, 0), data.Get(i, 1)); return m; }
void MarkChanged(const VectorMap<String, String>& m, ArrayCtrl& data) { GuiLock __; for(int i = 0; i < data.GetCount(); i++) { int q = m.Find(data.Get(i, 0)); if(q >= 0 && m[q] != data.Get(i, 1)) data.SetDisplay(i, 1, Single<RedDisplay>()); else data.SetDisplay(i, 1, StdDisplay()); } }
// fill a pane with data from a couple of arrays without erasing it first // (avoid re-painting and resetting scroll if not needed) void Gdb_MI2::FillPane(ArrayCtrl &pane, Index<String> const &nam, Vector<String> const &val) { GuiLock __; int oldCount = pane.GetCount(); int newCount = nam.GetCount(); if(newCount < oldCount) for(int i = oldCount - 1; i >= newCount; i--) pane.Remove(i); for(int i = 0; i < min(oldCount, newCount); i++) { pane.Set(i, 0, nam[i]); pane.Set(i, 1, val[i]); } for(int i = oldCount; i < newCount; i++) pane.Add(nam[i], val[i]); SyncWidth(pane); }