예제 #1
0
void ScatterCtrl::Paint(Draw& w)
{
    GuiLock __;
    if (IsNull(highlight_0) && highlighting) {
        highlighting = false;
        KillTimeCallback();
    }
    if (!IsNull(highlight_0) && !highlighting) {
        highlighting = true;
        SetTimeCallback(-200, THISBACK(TimerCallback));
    }
    TimeStop t;
    lastRefresh0_ms = GetTickCount();
    if (IsEnabled()) {
        if (mode == MD_DRAW) {
            ScatterCtrl::SetDrawing(w, GetSize(), 1);
            PlotTexts(w, GetSize(), 1);
        } else {
            ImageBuffer ib(GetSize());
            BufferPainter bp(ib, mode);
            ScatterCtrl::SetDrawing(bp, GetSize(), 1);
            w.DrawImage(0, 0, ib);
            PlotTexts(w, GetSize(), 1);
        }
        if (HasFocus()) {
            w.DrawLine(0, 0, GetSize().cx, 0, 2, LtGray());
            w.DrawLine(0, 0, 0, GetSize().cy, 2, LtGray());
            int delta = -2;
#ifdef PLATFORM_WIN32
            delta = 0;
#endif
            w.DrawLine(GetSize().cx+delta, 0, GetSize().cx+delta, GetSize().cy, 2, LtGray());
            w.DrawLine(0, GetSize().cy+delta, GetSize().cx, GetSize().cy+delta, 2, LtGray());
        }
    }
    lastRefresh_ms = t.Elapsed();
}
예제 #2
0
// construct a polygonal Marker
Marker::Marker(Vector<Point> const &pts)
{
	kind = PolyMarker;
	borderThickness = 2;
	borderColor = Blue;
	borderLineType = 0;
	fillColor = WhiteGray();
	selBorderThickness = 2;
	selBorderColor = LtBlue;
	selBorderLineType = 0;
	selFillColor = LtGray();
	closed = true;
	points <<= pts;
	
} // END Constructor class Marker
예제 #3
0
// construct a rectangular Marker
Marker::Marker(Point const &p1, Point const &p2)
{
	kind = RectMarker;
	borderThickness = 2;
	borderColor = Blue;
	borderLineType = 0;
	fillColor = WhiteGray();
	selBorderThickness = 2;
	selBorderColor = LtBlue;
	selBorderLineType = 0;
	selFillColor = LtGray();
	closed = true;
	points.Add(Point(min(p1.x, p2.x), min(p1.y, p2.y)));
	points.Add(Point(max(p1.x, p2.x), max(p1.y, p2.y)));
	
} // END Constructor class Marker
예제 #4
0
파일: Img.cpp 프로젝트: ultimatepp/mirror
void IdeImgView::Paint(Draw& w)
{
	Size sz = GetSize();
	String t = (img_sz != img.GetSize() ? "Resized from: " : "Image size: ");
	t << Format("%d x %d", img_sz.cx, img_sz.cy);
	int tcy = Draw::GetStdFontCy();
	w.DrawRect(0, 0, sz.cx, tcy, SColorFace());
	w.DrawText(5, 0, t, StdFont(), SColorText());
	int ii = 0;
	for(int x = 0; x < sz.cx; x += 16) {
		int jj = ii;
		for(int y = tcy; y < sz.cy; y += 16)
			w.DrawRect(x, y, 16, 16, jj++ & 1 ? LtGray() : WhiteGray());
		ii++;
	}
	w.DrawImage(5, 5 + tcy, img);
}
예제 #5
0
NAMESPACE_UPP

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// constructors
Marker::Marker()
{
	kind = EmptyMarker;
	borderThickness = 2;
	borderColor = Blue;
	borderLineType = 0;
	fillColor = WhiteGray();
	selBorderThickness = 2;
	selBorderColor = LtBlue;
	selBorderLineType = 0;
	selFillColor = LtGray();
	closed = false;

} // END Constructor class Marker
예제 #6
0
파일: ConnState.cpp 프로젝트: radtek/lister
//==============================================================================================
/*static*/ Color ConnState::ConvertStateToColor(EnumConnState enumConnState) {
	
	switch (enumConnState) {
		case NOCON_NEVER: return Gray();
		case NOCON_WASSUCC: return Green();
		case NOCON_WASFAIL: return Red();
		case NOCON_UNDEF: return LtGray();
		case NOCON_MISCONFIG: return Magenta();
		case CONNECTING_START: return LtYellow();
		case CONNECTING_YAWN: return Yellow();
		case CONNECTING_2NDTRY: return LtMagenta();
		case CONNECTING_3RDTRY: return White();
		case CONNECTING_TIMEOUT: return Cyan();
		case CON_SUCCEED: return LtGreen();
		case CON_FAIL: return LtRed();
		case CON_STALE: return LtBlue();
	}
	
	return Black();
}
예제 #7
0
void FormView::Paint(Draw& w)
{
	if (!IsLayout())
	{
		w.DrawRect(GetRect(), White());
		return;
	}

	Rect r = Zoom(GetPageRect());

	DrawGrid(w);
	DrawRect(w, r, 1, LtBlue());

	w.DrawRect(0, 0, r.left, 3000, White());
	w.DrawRect(r.right + 1, 0, 3000, 3000, White());
	w.DrawRect(r.left, 0, 5000, r.top, White());
	w.DrawRect(r.left, r.bottom + 1, 3000, 3000, White());

//	if (_showInfo)
//	{
//		r.SetSize( Zoom(Size(804, 604)) );
//		DrawRect(w, r.Offseted( Zoom(Size(-2, -2)) ), 1, LtMagenta());
//		r = Zoom(GetPageRect());
//	}

	if (GetObjectCount() > 0 && _showInfo == 2)
	{
		Rect b = Zoom(GetObjectsRect()).Offseted(1, 1);
		b.SetSize( b.GetSize() + Size(-2, -2) );
		DrawRect(w, b, 1, Yellow());
	}

	Vector<int> sel = GetSelected();

	bool coloring = GetBool("View.Coloring");
	int ci = 0;
	if (sel.GetCount() > 0)
	{
		if (sel.GetCount() == 1)
		{
			for (int i = 0; i < GetObjectCount(); ++i)
			{
				if (ci++ == _colors.GetCount() - 1) ci = 0;

				if (coloring && i != sel[0])
					DrawObject(w, i, _colors[ci], false);
				else
					DrawObject(w, i, (!coloring && (i == sel[0])) ? _colors[ci] : LtGray(),
						i == sel[0]);
			}
		}
		else
		{
			for (int i = 0; i < GetObjectCount(); ++i)
			{
				if (ci++ == _colors.GetCount() - 1) ci = 0;

				bool found = false;
				for (int j = 0; j < sel.GetCount(); ++j)
					if ( i == sel[j])
					{
						found = true;
						break;
					}
				if (coloring && !found)
					DrawObject(w, i, _colors[ci], false);
				else
					DrawObject(w, i, (!coloring && found) ? _colors[ci] : LtGray(), false);
			}

			Size g = GetGridSize();
			Rect s = GetSelectionRect().Offseted(-g.cx / 2, -g.cy / 2);
			s.SetSize(s.GetSize() + Size(g.cx, g.cy));

			Vector<int> sel = GetSelected();

			bool a1 = true;	// allow horz align
			bool a2 = true;	// allow vert align
			dword f1;		// first horz align
			dword f2;		// first vert align
	
			for (int i = 0; i < sel.GetCount(); ++i)
			{
				FormObject *pI = GetObject(sel[i]);
				if (!pI) continue;

				if (i == 0) { f1 = pI->GetHAlign(); f2 = pI->GetVAlign(); }

				if (f1 != pI->GetHAlign()) { a1 = false; }
				if (f2 != pI->GetVAlign()) { a2 = false; }
			}

			DrawSprings(w, Zoom(s), f1, f2, a1, a2, a1, a2, false);
			DrawRect(w, Zoom(s), 1, LtRed());

			s = GetSelectionRect().Offseted(-g.cx, -g.cy);
			s.SetSize(s.GetSize() + Size(g.cx * 2, g.cy * 2));

			DrawGroupTools(w, Zoom(s));
		}
		return;
	}

	for (int i = 0; i < GetObjectCount(); ++i)
	{
		if (ci++ == _colors.GetCount() - 1) ci = 0;
		DrawObject(w, i, coloring ? _colors[ci] : LtGray());
	}

	if (sel.GetCount() == 0)
		w.DrawImage(r.right, r.bottom, FormViewImg::SizerBR());
}
예제 #8
0
void FormView::DrawObject(Draw& w, int id, const Color& c, bool springs)
{
	if (!IsLayout())
		return;

	FormObject *pI = GetObject(id);
	if (!pI) return;

	Rect offseted = Offseted(pI->GetRect());
	offseted = Zoom(offseted);

	if (_showInfo == 2)	
		w.DrawRect(offseted, c);

	String type = pI->Get("Type");
	if (type == "Label")
		DrawRect(w, offseted.Offseted(-1, 0), 1, LtGray());

	if (pI->IsSelected() && springs)
	{
		DrawSprings(w, offseted, pI->GetHAlign(), pI->GetVAlign());
		w.DrawImage(offseted.right, offseted.bottom, FormViewImg::SizerBR());
		DrawRect(w, offseted, 1, LtRed());
	}
	else if (pI->IsSelected() && !springs)
		DrawRect(w, Point(offseted.left, offseted.top),
			Size(offseted.Width(), offseted.Height()), 1, LtRed());
	else if (_showInfo == 2 || pI->GetBool("OutlineDraw"))
		DrawRect(w, offseted, 1, Black());

	if (pI->GetBool("OutlineDraw"))
	{
		Rect l = offseted.Offseted( ZoomX(3), ZoomY(3) );
		l = Rect( l.TopLeft(), l.GetSize() - Size(ZoomX(6), ZoomY(6)) );
		DrawRect(w, l, 1, LtCyan());
	}

	String temp = pI->Get("Variable");
	Size t = GetTextSize( temp, _Font );
	int cx = t.cx;

	int y = offseted.BottomCenter().y - t.cy - ZoomY(3);

	if (_showInfo > 0)
	{
		if (offseted.Width() > t.cx + 15)
		{
			int x1 = ZoomX(pI->GetRect().right) - DeZoomX(2) - 4 - t.cx + ZoomX(X(0));
			w.DrawRect( x1 - 2, y, t.cx + 3, t.cy, White());
//			DrawRect(w, Point(x1 - 2, y), Size(t.cx + 3, t.cy), 1, LtGray());
			w.DrawText( x1, y, temp, _Font, LtBlue);
		}

		temp = AsString(id) + " " + type;
		t = GetTextSize(temp, _Font);
		Size s = GetTextSize(AsString(id), _Font);

		if (offseted.Width() - cx > t.cx + 10)
		{
			w.DrawRect( offseted.left + ZoomX(5) - 2, y, t.cx + 3, t.cy, White());
//			DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(t.cx + 3, t.cy),
//				1, LtGray());
			w.DrawText( offseted.left + ZoomX(5), y, temp, _Font, Gray());
		}
		else if (offseted.Width() > s.cx + 5)
		{
			w.DrawRect( offseted.left + ZoomX(5) - 2, y, s.cx + 3, s.cy, White());
//			DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(s.cx + 3, s.cy),
//				1, LtGray());
			w.DrawText( offseted.left + ZoomX(5), y, AsString(id), _Font, Gray());
		}
	}
}
예제 #9
0
void Tab10::Init()
{
	CtrlLayout(*this);	
	SizePos();
	
	sy[0] = 18; sy[1] = 29; sy[2] = 23; sy[3] = 25; sy[4] = 20;
	sx[0] = 10; sx[1] = 20; sx[2] = 30; sx[3] = 40; sx[4] = 50;
	scatter.AddSeries(sx, sy, 5).Legend("Series").PlotStyle<MyPlot>().MarkStyle<MyMark>().Stroke(3, LtGreen()).Fill(LtGray());
	
	scatter.SetRange(60, 50).SetMajorUnits(10, 10);
	scatter.ShowInfo().ShowContextMenu();
}