Example #1
0
bool
ZoneRoadGenerator::GetListOfRoadSegmentsThatIntersectWithArea_( const BaseArea& area, Vector< Pair< RoadNode*, RoadNode* > >& listToFill )
{
	Assert( isZoneRoadGridInitialized_ );

	for( uint32 y = area.GetMin().y; y <= area.GetMax().y; ++y )
	{
		for( uint32 x = area.GetMin().x; x <= area.GetMax().x; ++x )
		{
			Vector< Pair< RoadNode*, RoadNode* > >* mapLocation = GetDataFromRoadMap( x, y );
			if(  mapLocation != NULL )
			{
				// check of z levels to make sure area can intersect with road
				for( uint32 i = 0; i < mapLocation->GetCount(); ++i )
				{
					// Note- STODO: this does not check if the line segment truly intersects with the area in all cases for vertically diagonal road segments.
					Pair< RoadNode*, RoadNode* >& pair = mapLocation->GetElement( i );
					if( (pair.first->z >= area.GetMin().z && pair.first->z <= area.GetMax().z) ||
						(pair.second->z >= area.GetMin().z && pair.second->z <= area.GetMax().z) )
					{
						listToFill.InsertBack( pair );
					}
				}
			}
		}
	}

	return listToFill.GetCount() > 0;
}
Example #2
0
static void CalcHash(Vector<HashBase>& hash, const Vector<String>& file, int limit)
{
	{ // 1st row
		HashBase& first = hash.Add();
		for(int i = 0; i < file.GetCount(); i++)
			first.Add(GetHashValue(file[i]));
	}
	static const int prime[] =
	{
		3,  5,  7,   11,  13,  17,  19,  21,
		23, 29, 31,  37,  41,  43,  47,  51,
		53, 61, 67,  71,  73,  79,  83,  87,
		89, 97, 101, 103, 107, 109, 113, 117,
	};
	const int *pp = prime;
	for(int l = 1; l < limit; l <<= 1) {
		HashBase& nhash = hash.Add();
		const HashBase& ohash = hash[hash.GetCount() - 2];
		int pri = *pp++;
		int t;
		for(t = l; t < ohash.GetCount(); t++)
			nhash.Add(ohash[t - l] + pri * ohash[t]);
		for(t -= l; t < ohash.GetCount(); t++)
			nhash.Add(ohash[t]);
	}
}
Example #3
0
void Draw::DrawPolyPolyline(const Vector<Point>& vertices, const Vector<int>& counts,
                            int width, Color color, Color doxor)
{
	DrawPolyPolyline(vertices.Begin(), vertices.GetCount(),
		             counts.Begin(), counts.GetCount(),
		             width, color, doxor);
}
Example #4
0
void FormEdit::OpenObjectProperties(const Vector<int>& indexes)
{
	if (!_View.IsLayout())
		return;

	String temp = _TempObjectName;
	_TempObjectName.Clear();
	_ItemList.EndEdit(false, false, false);
	int row = _ItemList.GetCurrentRow();
	if (row >= 0 && !temp.IsEmpty())
	{
		_View.GetCurrentLayout()->GetObjects()[row].Set("Variable", temp);
		_ItemList.Set(row, 1, temp);
	}
	_LayoutList.EndEdit();

	if (indexes.GetCount() == 1)
	{
		FormObject* pI = _View.GetObject(indexes[0]);
		if (!pI) return;

		_ItemProperties._Options.EndEdit();
		_ItemProperties.Generate(pI, indexes[0]);
	}

	if (indexes.GetCount() == 0)
	{
		_ItemProperties._Options.EndEdit();
		_ItemProperties._Headers.Clear();
		_ItemProperties._Options.Clear();
	}

	UpdateItemList();
}
Example #5
0
void FlushCode(Vector<String>& code)
{
	while(code.GetCount() && TrimBoth(code[0]).GetCount() == 0)
		code.Remove(0);
	while(code.GetCount() && TrimBoth(code.Top()).GetCount() == 0)
		code.Drop();
	
	bool tabs = true;
	for(auto l : code)
		if(l.GetCount() && *l != '\t') {
			tabs = false;
			break;
		}
	if(tabs)
		for(auto& l : code)
			if(l.GetCount())
				l.Remove(0);
	
	if(code.GetCount() == 0)
		return;
	OUT("============= CODE");
	OUT(Join(code, "\r\n"));

	qtf << "&[s4; \1" << Join(code, "\n") << "\1&]&";
	code.Clear();
}
Example #6
0
void Navigator::Navigate()
{
	if(navigating)
		return;
	navigating = true;
	int ii = list.GetCursor();
	if(theide && ii >= 0 && ii < litem.GetCount()) {
		int ln = GetCurrentLine() + 1;
		const NavItem& m = *litem[ii];
		if(m.kind == KIND_LINE || IsNull(search)) {
			theide->GotoPos(Null, m.line);
			if(m.kind == KIND_LINE) { // Go to line - restore file view
				search.Clear();
				Search();
				navigating = false;
			}
			SyncCursor();
		}
		else {
			Vector<NavLine> l = GetNavLines(m);
			int q = l.GetCount() - 1;
			for(int i = 0; i < l.GetCount(); i++)
				if(GetSourceFilePath(l[i].file) == NormalizeSourcePath(theide->editfile) && l[i].line == ln) {
					q = (i + l.GetCount() + 1) % l.GetCount();
					break;
				}
			if(q >= 0 && q < l.GetCount()) {
				String path = GetSourceFilePath(l[q].file);
				if(!theide->GotoDesignerFile(path, m.nest, m.name, l[q].line))
					theide->GotoPos(path, l[q].line);
			}
		}
	}
	navigating = false;
}
Example #7
0
void Draw::DrawPolygons(const Vector<Point>& vertices, const Vector<int>& polygon_counts,
                    Color color, int width, Color outline, uint64 pattern, Color doxor)
{
	DrawPolygons(vertices.Begin(), vertices.GetCount(),
                 polygon_counts.Begin(), polygon_counts.GetCount(),
                 color, width, outline, pattern, doxor);
}
Example #8
0
void Ide::ExportProject(const String& ep, bool all, bool gui, bool deletedir)
{
	SaveFile(false);
	::Workspace wspc;
	wspc.Scan(main);
	Index<String> used;
	HdependClearDependencies();
	for(int i = 0; i < wspc.GetCount(); i++) {
		const Package& p = wspc.GetPackage(i);
		String pn = wspc[i];
		for(int j = 0; j < p.GetCount(); j++) {
			const Package::File& f = p[j];
			if(!f.separator) {
				String p = SourcePath(pn, f);
				used.FindAdd(p);
				Vector<String> d = HdependGetDependencies(p);
				for(int q = 0; q < d.GetCount(); q++)
					used.FindAdd(d[q]);
				for(int q = 0; q < f.depends.GetCount(); q++)
					used.FindAdd(SourcePath(pn, f.depends[q].text));
			}
		}
	}
	if(FileExists(ep)) {
		if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&"
		                "Do you want to delete it?")) return;
		FileDelete(ep);
	}
	if(deletedir && DirectoryExists(ep)) {
		if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&"
		                "Do you want to replace it?")) return;
		DeleteFolderDeep(ep);
	}

	Progress pi("Exporting project");
	pi.SetTotal(wspc.GetCount());
	for(int i = 0; i < wspc.GetCount(); i++) {
		if(gui && pi.StepCanceled())
			return;
		CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
	}
	Vector<String> upp = GetUppDirs();
	for(int i = 0; i < upp.GetCount(); i++) {
		if(gui && pi.StepCanceled())
			return;
		String d = upp[i];
		FindFile ff(AppendFileName(d, "*"));
		while(ff) {
			if(ff.IsFile()) {
				String fn = ff.GetName();
				String path = AppendFileName(d, fn);
				if(all || used.Find(path) >= 0)
					CopyFile(AppendFileName(ep, fn), path, true);
			}
			ff.Next();
		}
		CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
	}
	ExportMakefile(ep);
}
Example #9
0
TextComparator::TextComparator(const Vector<String>& f1, const Vector<String>& f2)
: file1(f1), file2(f2)
{
	int limit = min(f1.GetCount(), f2.GetCount());
	CalcHash(hash1, f1, limit);
	CalcHash(hash2, f2, limit);
}
Example #10
0
void HeaderCtrl::Distribute(const Vector<int>& sci, double delta)
{
	Vector<int> ci(sci, 1);
	int szcx = GetSize().cx;
	if(szcx == 0)
		return;
	double rs = Denominator();
	double eps = max(1.0e-6, rs / 1.0e6);
	double epsr = max(1.0e-4, rs / 1.0e4);
	bool checkmin = SumMin(0) < szcx;
	for(;;) {
		double psm = 0;
		for(int i = 0; i < ci.GetCount(); i++)
			psm += col[ci[i]].ratio;
		if(fabs(psm) < eps)
			return;
		double q = 1 + delta / psm;
		double x = 0;
		Vector<int> nci;
		for(int i = 0; i < ci.GetCount(); i++) {
			Column& c = col[ci[i]];
			c.ratio *= q;
			if(c.ratio < epsr)
				c.ratio = epsr;
			else
			if(c.ratio < c.min * rs / szcx && checkmin) {
				c.ratio = c.min * rs / szcx;
				if(delta > 0)
					nci.Add(ci[i]);
			}
			else
			if(c.ratio > c.max * rs / szcx) {
				c.ratio = c.max * rs / szcx;
				if(delta < 0)
					nci.Add(ci[i]);
			}
			else
				nci.Add(ci[i]);
			x += c.ratio;
		}

		delta = (psm + delta) - x;

		if(fabs(delta) < eps)
			break;
		ci = pick(nci);
		if(ci.GetCount() == 0) {
			double psm = 0;
			for(int i = 0; i < sci.GetCount(); i++)
				psm += col[sci[i]].ratio;
			if(fabs(psm) < eps)
				return;
			double q = 1 + delta / psm;
			for(int i = 0; i < sci.GetCount(); i++)
				col[sci[i]].ratio *= q;
			return;
		}
	}
}
Example #11
0
void PaintingPainter::DashOp(const Vector<double>& dash, double start)
{
	Put(PAINTING_DASH);
	Put32(dash.GetCount());
	for(int i = 0; i < dash.GetCount(); i++)
		Putf(dash[i]);
	Putf(start);
}
Example #12
0
bool operator==(const Vector<RichPara::Tab>& a, const Vector<RichPara::Tab>& b)
{
	if(a.GetCount() != b.GetCount()) return false;
	for(int i = 0; i < a.GetCount(); i++)
		if(a[i].pos != b[i].pos || a[i].align != b[i].align || a[i].fillchar != b[i].fillchar)
			return false;
	return true;
}
Example #13
0
static bool sCmp(const Vector<Value>& a, const Vector<Value>& b)
{
	if(&a == &b) return true;
	if(a.GetCount() != b.GetCount()) return false;
	for(int i = 0; i < a.GetCount(); i++)
		if(a[i] != b[i]) return false;
	return true;
}
Example #14
0
void MainConfigDlg::FlagDlg()
{
	WithConfLayout<TopWindow> cfg;
	CtrlLayoutOKCancel(cfg, "Configuration flags");
	cfg.Sizeable().MaximizeBox();
	Vector<String> flg = SplitFlags0(String(fe));
	Vector<String> accepts = wspc.GetAllAccepts(0);
	Sort(accepts, GetLanguageInfo());
	enum { CC_SET, CC_NAME, CC_PACKAGES, CC_COUNT };
	cfg.accepts.AddColumn("Set").Ctrls(sSetOption).HeaderTab().Fixed(40);
	cfg.accepts.AddColumn("Flag", 1);
	cfg.accepts.AddColumn("Packages", 2);
	cfg.accepts.SetCount(accepts.GetCount());
	for(int i = 0; i < accepts.GetCount(); i++) {
		String acc = accepts[i];
		Vector<String> pkg;
		for(int p = 0; p < wspc.GetCount(); p++)
			if(FindIndex(wspc.package[p].accepts, acc) >= 0)
				pkg.Add(wspc[p]);
		Sort(pkg, GetLanguageInfo());
		cfg.accepts.Set(i, CC_NAME, accepts[i]);
		cfg.accepts.Set(i, CC_PACKAGES, Join(pkg, ","));
	}

	cfg.other.SetFilter(FlagFilterM);
	cfg.dll <<= cfg.gui <<= cfg.mt <<= cfg.sse2 <<= 0;
	String other;
	for(int i = 0; i < flg.GetCount(); i++) {
		String f = flg[i];
		if(!SetSw(f, cfg.dll, "DLL")
		   && !SetSw(f, cfg.gui, "GUI")
		   && !SetSw(f, cfg.mt, "MT")
		   && !SetSw(f, cfg.sse2, "SSE2")) {
			int x = (*f == '.' ? cfg.accepts.Find(f.Mid(1), CC_NAME) : -1);
			if(x >= 0)
				cfg.accepts.Set(x, CC_SET, true);
			else {
				if(!other.IsEmpty())
					other << ' ';
				other << f;
			}
		}
	}
	cfg.other <<= other;
	if(cfg.Run() == IDOK) {
		String flags;
		flags
			<< GetSw(cfg.dll, "DLL")
		    << GetSw(cfg.gui, "GUI")
		    << GetSw(cfg.mt, "MT")
			<< GetSw(cfg.sse2, "SSE2");
		for(int i = 0; i < cfg.accepts.GetCount(); i++)
			if(cfg.accepts.Get(i, CC_SET))
				flags << '.' << cfg.accepts.Get(i, CC_NAME) << ' ';
		flags << cfg.other.GetText().ToString();
		fe = Join(SplitFlags0(flags), " ").ToWString();
	}
}
Example #15
0
void RichQtfParser::FlushStyles()
{
	for(int i = 0; i < styleid.GetCount(); i++)
		if(stylenext[i] >= 0 && stylenext[i] < styleid.GetCount()) {
			RichStyle s = target.GetStyle(styleid[i]);
			s.next = styleid[stylenext[i]];
			target.SetStyle(styleid[i], s);
		}
}
Example #16
0
void DndTest::Paint(Draw &w)
{
	w.DrawRect(GetSize(), SColorPaper());
	if(files.GetCount())
		for(int i = 0; i < files.GetCount(); i++)
			w.DrawText(2, 2 + i * Draw::GetStdFontCy(), files[i]);
	else
		w.DrawText(2, 2, "None");
}
Example #17
0
String GetUppDir() {
	Vector<String> s = GetUppDirs();
#ifdef PLATFORM_WIN32
	return s.GetCount() == 0 ? GetFileFolder(GetExeFilePath()) : s[0];
#endif
#ifdef PLATFORM_POSIX
	return s.GetCount() == 0 ? GetHomeDirectory() : s[0];
#endif
}
Example #18
0
String CreateQtf(const String& item, const String& name, const CppItem& m, const String& lang, bool onlyhdr = false)
{
	String qtf;
	bool str = m.kind == STRUCT || m.kind == STRUCTTEMPLATE;
	if(!str)
		qtf << "[s4 &]";
	String st = str ? "[s2;" : "[s1;";
	String k = st + ':' + DeQtf(item) + ": ";
	if(m.IsTemplate() && str) {
		int q = 0;
		int w = 0;
		while(q < m.natural.GetLength()) {
			if(m.natural[q] == '<')
				w++;
			if(m.natural[q] == '>') {
				w--;
				if(w == 0) {
					q++;
					break;
				}
			}
			q++;
		}
		qtf << "[s2:noref: " << DecoratedItem(name, m, m.natural.Mid(0, q)) << "&][s2 " << k;
		if(q < m.natural.GetLength()) {
			while((byte)m.natural[q] <= 32)
				q++;
			qtf << DecoratedItem(name, m, m.natural.Mid(q));
		}
	}
	else
		qtf << k << DecoratedItem(name, m, m.natural);

	qtf << "&]";
	if(onlyhdr)
		return qtf;
	qtf << "[s3%" << lang << " ";
	String d;
	Vector<String> t = Split(m.tname, ';');
	for(int i = 0; i < t.GetCount(); i++) {
		if(i)
			d << ' ';
		d << "[%-*@g " << DeQtf(t[i]) << "]";
	}
	d.Clear();
	d << "[%" << lang << " ";
	Vector<String> p = Split(m.pname, ';');
	if(!str)
		for(int i = 0; i < p.GetCount(); i++)
			d << " [%-*@r " << DeQtf(p[i]) << "]";
	if(!str && p.GetCount())
		qtf << d << " .";
	qtf << "&]";
	qtf << "[s7 &]";
	return qtf;
}
Example #19
0
void FileTabs::InsertFiles(int ix, const Vector<String> &files, const Vector<Image> &img, bool make_active)
{
	if (!files.GetCount()) return;
	bool useimg = img.GetCount() == files.GetCount();
	for (int i = files.GetCount() - 1; i > 0; i--) {
		TabBar::InsertKey0(ix, files[i].ToWString(), GetFileName(files[i]), 
			useimg ? img[i] : NativePathIcon(files[i]), GetFileGroup(files[i]));	
	}
	InsertFile(ix, files[0].ToWString(), useimg ? img[0] : NativePathIcon(files[0]), make_active);
}
Example #20
0
File: t.cpp Project: pedia/raidget
void ZoneAlloc::Clear()
{
	for(int i = 0; i < zsmall.GetCount(); i++)
		delete[] zsmall[i];
	for(int i = 0; i < zbig.GetCount(); i++)
		delete[] zbig[i];
	zsmall.Clear();
	zbig.Clear();
	ptr = lim = NULL;
}
Example #21
0
Vector<int> HelpWindow::ScPositions(const Vector<int>& p)
{
	Vector<int> r;
	for(int i = 0; i < p.GetCount(); i++) {
		int y = max(0, view.GetZoom() * view.Get().GetCaret(p[i], view.GetPage()).top - GetSize().cy / 2);
		int ii = FindLowerBound(r, y);
		if(ii == r.GetCount() || r[ii] != y)
			r.Insert(ii, y);
	}
	return r;
}
Example #22
0
String DecoratedItem(const String& name, const CppItem& m, const char *natural, int pari)
{
	String qtf = "[%00-00K ";
	Vector<ItemTextPart> n = ParseItemNatural(name, m, natural);
	if(pari < 0) {
		if(m.virt)
			qtf << "[@B virtual] ";
		if(m.kind == CLASSFUNCTION || m.kind == CLASSFUNCTIONTEMPLATE)
			qtf << "[@B static] ";
	}
	Vector<String> qt = Split(m.qptype, sSplitT, false);
	Vector<String> tt = Split(m.qtype, sSplitT, false);
	for(int i = 0; i < n.GetCount(); i++) {
		ItemTextPart& p = n[i];
		qtf << "[";
		if(p.pari == pari)
			qtf << "$C";
		switch(p.type) {
		case ITEM_PNAME:
			qtf << "*";
		case ITEM_NUMBER:
			qtf << "@r";
			break;
		case ITEM_TNAME:
			qtf << "*@g";
			break;
		case ITEM_NAME:
			qtf << "*";
			break;
		case ITEM_UPP:
			qtf << "@c";
			break;
		case ITEM_CPP_TYPE:
		case ITEM_CPP:
			qtf << "@B";
			break;
		default:
			int q = p.type - ITEM_PTYPE;
			if(q >= 0 && q < qt.GetCount() && IsCodeRefType(qt[q]) && pari < 0)
				qtf << "_^" << qt[q] << '^';
			q = p.type - ITEM_TYPE;
			if(q >= 0 && q < tt.GetCount() && IsCodeRefType(tt[q]) && pari < 0)
				qtf << "_^" << tt[q] << '^';
			break;
		}
		qtf << ' ';
		qtf << NaturalDeQtf(String(~m.natural + p.pos, p.len));
		qtf << ']';
	}
	return qtf + "]";
}
Example #23
0
bool Player::AddCmd(const Vector<String> &cmd, bool play)
{
    int cnt = cmd.GetCount();
    if(cnt > 0)
    {
        SetShellPlaylist();
        for(int i = 0; i < cmd.GetCount(); i++)
            AddFile(true, cmd[i]);
        if(play)
            StopPlay();
        return true;
    }
    return false;
}
Example #24
0
String Nest::PackagePath0(const String& name)
{
	String uppfile = NativePath(name);
	if(IsFullPath(uppfile)) return NormalizePath(uppfile);
	Vector<String> d = GetUppDirs();
	String p;
	for(int i = 0; i < d.GetCount(); i++) {
		p = NormalizePath(AppendFileName(AppendFileName(d[i], uppfile),
		                  GetFileName(uppfile)) + ".upp");
		if(FileExists(p)) return p;
	}
	return d.GetCount() ? NormalizePath(AppendFileName(AppendFileName(d[0], uppfile),
		                                GetFileName(uppfile)) + ".upp") : "";
}
Example #25
0
int  TopWindow::Run(bool appmodal)
{
	GuiLock __;
	LLOG("TopWindow::Run() <- " << typeid(*this).name());
	LLOG("Focus = " << UPP::Name(GetFocusCtrl()));
	if(!IsOpen())
		Open();
	if(!IsVisible()) Show();
	bool pinloop = inloop;
	int  pexitcode = exitcode;
	exitcode = Null;
	Vector<Ctrl *> es;
	if(appmodal)
		es = GetTopCtrls();
	else {
		Vector<Ctrl *> ws = GetTopCtrls();
		for(int i = 0; i < ws.GetCount(); i++)
			if(ws[i]->InLoop())
				es.Add(ws[i]);
		Ctrl *mw = GetMainWindow();
		if(mw) GatherWindowTree(mw, ws, es);
	}
	Vector< Ptr<Ctrl> > disabled = DisableCtrls(es, this);
#ifdef _DEBUG
	for(int d = 0; d < disabled.GetCount(); d++)
		LLOG("DisableCtrls[" << d << "] = " << UPP::Name(disabled[d]));
	LLOG("Running EventLoop in " << UPP::Name(this));
#endif
	EventLoop(this);
#ifdef _DEBUG
	LLOG("Finished EventLoop in " << UPP::Name(this));
	for(int e = 0; e < disabled.GetCount(); e++)
		LLOG("EnableCtrls[" << e << "] = " << UPP::Name(disabled[e]));
#endif
	EnableCtrls(disabled);
	if(IsNull(exitcode)) {
		WhenClose();
		if(IsNull(exitcode))
			DefaultBreak();
	}
	int q = exitcode;
	inloop = pinloop;
	exitcode = pexitcode;		
	LLOG("TopWindow::Run() = " << q << " -> " << typeid(*this).name());
#ifdef GUI_WIN
	LLOG("Focus = " << UPP::Name(GetFocusCtrl()) << ", raw " << (void *)::GetFocus());
#endif
	return q;
}
TEST(Vector, PopFirst) {
  const int kMaxCount = 500;
  Vector<int> v;
  for (int n = 0; n < kMaxCount; ++n)
    v.PushBack(n * 100);

  for (int n = 0; n < kMaxCount; ++n) {
    int first = v.PopFirst();
    TEST_TEXT << "Checking " << n << "-th PopFirst()";
    EXPECT_EQ(n * 100, first);
    EXPECT_EQ(kMaxCount - 1 - n, v.GetCount());
  }
  EXPECT_EQ(0u, v.GetCount());
  EXPECT_TRUE(v.IsEmpty());
}
Example #27
0
int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
	int ii = q;
	if(ii < 0 || ii >= item.GetCount())
		return 0;
	const NavItem& m = *item[ii];
	bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);

	int x = r.left;
	int ry = r.top + r.GetHeight() / 2;
	int y = ry - Draw::GetStdFontCy() / 2;

	if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) {
		w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
		                                    : SColorFace);
		if(m.kind == KIND_FILE)
			return PaintFileName(w, r, m.type, ink);
		String h = FormatNest(m.type);
		w.DrawText(x, y, h, StdFont().Bold(), ink);
		return GetTextSize(h, StdFont().Bold()).cx;
	}
	
	w.DrawRect(r, paper);
	if(m.kind == KIND_LINE) {
		w.DrawText(x, y, m.type, StdFont().Bold(), ink);
		return GetTextSize(m.type, StdFont().Bold()).cx;
	}

	PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor);

	x += Zx(15);
	Vector<ItemTextPart> n = ParseItemNatural(m.name, m.natural, m.ptype, m.pname, m.type,
	                                          m.tname, m.ctname, ~m.natural + m.at);
	int starti = 0;
	for(int i = 0; i < n.GetCount(); i++)
		if(n[i].type == ITEM_NAME) {
			starti = i;
			break;
		}
	PaintText(w, x, y, m.natural, n, starti, n.GetCount(), focuscursor, ink, false);
	if(starti) {
		const char *h = " : ";
		w.DrawText(x, y, h, BrowserFont(), SColorText);
		x += GetTextSize(h, BrowserFont()).cx;
	}
	PaintText(w, x, y, m.natural, n, 0, starti, focuscursor, ink, false);
	return x;
}
Example #28
0
VisGenDlg::VisGenDlg(LayoutData& layout, const Vector<int>& cursor)
:	layout(layout)
{
	type <<= 0;
	CtrlLayoutOKCancel(*this, "Code generator");
	type <<= THISBACK(Type);

	// needs to be before Refresh to maintain the proper order of action
	toupper1 << [=] { tolower1 <<= false; initcaps1 <<= false; };
	tolower1 << [=] { toupper1 <<= false; initcaps1 <<= false; };
	initcaps1 << [=] { toupper1 <<= false; tolower1 <<= false; };

	toupper2 << [=] { tolower2 <<= false; initcaps2 <<= false; };
	tolower2 << [=] { toupper2 <<= false; initcaps2 <<= false; };
	initcaps2 << [=] { toupper2 <<= false; tolower2 <<= false; };

	for(Ctrl *q = GetFirstChild(); q; q = q->GetNext())
		if(dynamic_cast<Option *>(q))
			*q << [=] { Refresh(); };
			
	name << [=] { Refresh(); };
	

	Refresh();
	view.Highlight("cpp");
	view.HideBar();
	view.SetFont(CourierZ(12));
	if(cursor.GetCount())
		sel <<= cursor;
	else
		for(int i = 0; i < layout.item.GetCount(); i++)
			sel.Add(i);
}
Example #29
0
void Print(Draw& w, const RichText& text, const Rect& page, const Vector<int>& pg)
{
	LLOG("Print");
	int lpage = text.GetHeight(page).page;
	PrintPageDraw pw(w);
	Size sz = w.GetPageMMs();
	Size pgsz = page.Size();
	int x = (6000 * sz.cx / 254 - pgsz.cx) / 2;
	int y = (6000 * sz.cy / 254 - pgsz.cy) / 2;
	for(int pi = 0; pi < pg.GetCount(); pi++) {
		int i = pg[pi];
		w.StartPage();
		w.Offset(x, y);
		pw.SetPage(i);
		PaintInfo paintinfo;
		paintinfo.top = PageY(i, 0);
		paintinfo.bottom = PageY(i + 1, 0);
		paintinfo.indexentry = Null;
		if(text.IsPrintNoLinks())
			paintinfo.hyperlink = Null;
		text.Paint(pw, page, paintinfo);
		w.End();
		String footer = text.GetFooter();
		if(!IsNull(footer) && lpage) {
			String n = Format(footer, i + 1, lpage + 1);
			Size nsz = GetTextSize(n, Arial(90).Italic());
			pw.Page(i).DrawText(
				x + pgsz.cx - nsz.cx, y + pgsz.cy + 100,
				n, Arial(90).Italic());
		}
		w.EndPage();
	}
}
Example #30
0
void Table::RectLines(int zoom, Draw& w, int x, int y, int i, const Vector<Line>& line,
					   Vector<ValueRect>& vr) const {
	for(int j = line.GetCount() - 1; j >= 0; j--) {
		y -= line[j].height;
		RectLine(zoom, w, x, y, i + j, line[j], vr);
	}
}