Esempio n. 1
0
void Pdb::Explorer()
{
	VectorMap<String, Value> prev = DataMap(explorer);
	explorer.Clear();
	try {
		String x = ~expexp;
		if(!IsNull(x)) {
			CParser p(x);
			Val v = Exp(p);
			Vis(explorer, "=", prev, Visualise(v));
			if(v.type >= 0 && v.ref == 0 && !v.rvalue)
				Explore(v, prev);
			if(v.ref > 0 && GetRVal(v).address)
				for(int i = 0; i < 20; i++)
					Vis(explorer, Format("[%d]", i), prev, Visualise(DeRef(Compute(v, RValue(i), '+'))));
		}
	}
	catch(CParser::Error e) {
		Visual v;
		v.Cat(e, LtRed);
		explorer.Add("", RawPickToValue(v));
	}
	exback.Enable(exprev.GetCount());
	exfw.Enable(exnext.GetCount());
}
Esempio n. 2
0
	int      Make(Value& v) const {
		GlyphPainter gp;
		gp.move = gp.pos = Null;
		gp.tolerance = gk.tolerance;
		PaintCharacter(gp, Pointf(0, 0), gk.chr, gk.fnt);
		int sz = gp.glyph.GetCount() * 4;
		v = RawPickToValue(pick(gp.glyph));
		return sz;
	}
Esempio n. 3
0
Value Pdb::Vis(const String& key, const VectorMap<String, Value>& prev, Visual rval_ vis,
               bool& ch)
{
	int q = prev.Find(key);
	ch = false;
	for(int i = 0; i < vis.part.GetCount(); i++) {
		VisualPart& p = vis.part[i];
		p.mark = false;
		if(q >= 0 && IsType<Visual>(prev[q])) {
			const Visual& v = ValueTo<Visual>(prev[q]);
			if(v.part.GetCount() == vis.part.GetCount() && v.part[i].text != p.text)
				ch = p.mark = true;
		}
	}
	return RawPickToValue(vis);
}
Esempio n. 4
0
void CheckRawPickValue()
{
	Vector<int> x;
	x.Add(123);
	Value v = RawPickToValue(x);
	ASSERT(v.Is< Vector<int> >());
	const Vector<int>& xx = v.To< Vector<int> >();
	ASSERT(xx.GetCount() == 1);
	ASSERT(xx[0] == 123);

	x.Clear();
	x.Add(321);
	v = RawDeepToValue(x);
	const Vector<int>& x2 = v.To< Vector<int> >();
	ASSERT(x2.GetCount() == 1);
	ASSERT(x2[0] == 321);
	ASSERT(x.GetCount() == 1);
	ASSERT(x[0] == 321);	
}
Esempio n. 5
0
void XMLBarEditor::treeContextAddCb(int mode)
{
	int id = barTree.GetCursor();
	int parentId = 0;
	int childIdx;
	int newId = 0;
	XMLToolBarItem item;
	if(mode > 4)
	{
		item.isSeparator = true;
		mode -= 4;
	}
	String lbl = (item.IsSeparator() ? t_("<SEPARATOR>") : "");
	Value v = RawPickToValue(item);
	switch(mode)
	{
		case 1:
			parentId = barTree.GetParent(id);
			childIdx = barTree.GetChildIndex(parentId, id);
			newId = barTree.Insert(parentId, childIdx, Null, v, lbl);
			break;

		case 2:
			parentId = barTree.GetParent(id);
			childIdx = barTree.GetChildIndex(parentId, id);
			newId = barTree.Insert(parentId, childIdx + 1, Null, v, lbl);
			break;

		case 3:
			newId = barTree.Insert(id, 0, Null, v, "");
			break;

		case 4:
			newId = barTree.Add(id, Null, v, "");
			break;
		
		default:
			NEVER();
	}
	RefreshBar();
	barTree.SetCursor(newId);
	itemPane.label.SetFocus();
}
Esempio n. 6
0
bool Pdb::Tip(const String& exp, CodeEditor::MouseTip& mt)
{
/*	mt.display = &StdDisplay();
	mt.value = exp;
	mt.sz = Size(100, 20);
	return true;*/
	DR_LOG("Pdb::Tip");
	Visual r;
	try {
		CParser p(exp);
		Val v = Exp(p);
		Visualise(r, v, 2);
		if(r.part.GetCount()) {
			mt.sz = r.GetSize() + Size(4, 4);
			mt.value = RawPickToValue(r);
			mt.display = &Single<VisualDisplay>();
			DR_LOG("Pdb::Tip true");
			return true;
		}
	}
	catch(CParser::Error) {}
	DR_LOG("Pdb::Tip false");
	return false;
}