示例#1
0
void ddScrollBarHandle::invokeStart(hdMouseEvent &event, hdDrawingView *view)
{
	int idx = view->getIdx();
	int y = event.GetPosition().y;
	anchorY = y;
	if( (y > (getDisplayBox(idx).GetPosition().y + 2)) && (y <  (getDisplayBox(idx).GetPosition().y + 2 + 6)) )  //6 image height
		table->columnsWindowUp(idx);

	if( (y > (getDisplayBox(idx).GetPosition().y + getDisplayBox(idx).height - 2 - downBitmap.GetHeight()) ) && (y < (getDisplayBox(idx).GetPosition().y + getDisplayBox(idx).height - 2) ) )
		table->columnsWindowDown(idx);
	view->notifyChanged();
}
示例#2
0
void hdButtonHandle::draw(wxBufferedDC &context, hdDrawingView *view)
{
	wxPoint copy = getDisplayBox(view->getIdx()).GetPosition();
	view->CalcScrolledPosition(copy.x, copy.y, &copy.x, &copy.y);
	if(buttonIcon.IsOk())
		context.DrawBitmap(buttonIcon, copy.x, copy.y, true);
}
hdPoint hdStickyRectangleConnector::getAnchor(int posIdx)
{
	hdGeometry g;

	hdRect rect = getDisplayBox().gethdRect(posIdx);  //hack to avoid linux bug
	return g.edgePointFromAngle(rect, angle);
}
void hdStickyRectangleConnector::updateAnchor(int posIdx, hdPoint p)
{
	hdGeometry g;

	hdRect rect = getDisplayBox().gethdRect(posIdx);  //hack to avoid linux bug
	angle = g.angleFromPoint(rect, p);
}
wxhdPoint wxhdStickyRectangleConnector::getAnchor()
{
	wxhdGeometry g;

	wxhdRect rect = getDisplayBox();  //hack to avoid linux bug	
	return g.edgePointFromAngle(rect, angle);
}
void wxhdStickyRectangleConnector::updateAnchor(wxhdPoint p)
{
	wxhdGeometry g;

	wxhdRect rect = getDisplayBox();  //hack to avoid linux bug
	angle = g.angleFromPoint(rect, p);
}
示例#7
0
hdPoint hdChopBoxConnector::findStart(int posIdx, hdLineConnection *connFigure)
{
	if(!connFigure)
	{
		point = getDisplayBox().center(posIdx);
		return point;
	}

	if(connFigure->pointCount(posIdx) < 2)
	{
		point = getDisplayBox().center(posIdx);
		return point;
	}

	hdIFigure *start = connFigure->getStartConnector()->getOwner();
	point = connFigure->pointAt(posIdx, 1);
	point = chop(posIdx, start, point);
	return point;
}
示例#8
0
hdPoint hdChopBoxConnector::findEnd(int posIdx, hdLineConnection *connFigure)
{
	if(!connFigure)
	{
		return getDisplayBox().center(posIdx);
	}
	hdIFigure *end = connFigure->getEndConnector()->getOwner();
	point = connFigure->pointAt(posIdx, connFigure->pointCount(posIdx) - 2);
	point = chop(posIdx, end, point);
	return point;
}
void ddPolyLineHandle::draw(wxBufferedDC& context, ddDrawingView *view)
{
    //DD-TODO: set graphic style
    ddRect copy = getDisplayBox();
    view->CalcScrolledPosition(copy.x,copy.y,&copy.x,&copy.y);

    double middle=copy.width/2;
    context.DrawCircle(
        wxPoint(copy.x+middle,copy.y+middle),
        wxCoord(middle)
    );
    //DD-TODO: improve this draw
}
示例#10
0
hdPoint hdChopBoxConnector::chop(int posIdx, hdIFigure *target, hdPoint point)
{
	if(target && target->containsPoint(posIdx, point.x, point.y))
	{
		point = target->displayBox().center(posIdx);
		return point;
	}
	else if(!target)
	{
		point = hdPoint(0, 0);
		return point;
	}

	hdGeometry g;

	rect = getDisplayBox().gethdRect(posIdx);  //hack to avoid linux bug
	double angle = g.angleFromPoint(rect, point);
	point = g.edgePointFromAngle(rect, angle);
	return point;
}
示例#11
0
void hdPolyLineHandle::draw(wxBufferedDC &context, hdDrawingView *view)
{
	//A Handle at polyline figure without a respetive flexibility point at line
	//Hack to allow handles of polylines reuse between different versions of same line.
	if(getOwner() && indx < (((hdPolyLineFigure *) getOwner())->countPointsAt(view->getIdx()) - 1) ) //indx 0 is first, count first is 1
	{
		hdRect copy = getDisplayBox(view->getIdx());
		view->CalcScrolledPosition(copy.x, copy.y, &copy.x, &copy.y);

		/* Uncomment this for testing purposes of handles in a polyline figure
		wxString pos = wxString::Format(_("%d"),indx);
		double middle2 = copy.width / 2;
		context.DrawText(pos,copy.x + middle2+3, copy.y + middle2);
		*/

		double middle = copy.width / 2;
		context.DrawCircle(
		    wxPoint(copy.x + middle, copy.y + middle),
		    wxCoord(middle)
		);
	}
}
示例#12
0
void ddScrollBarHandle::draw(wxBufferedDC &context, hdDrawingView *view)
{
	int idx = view->getIdx();
	context.SetBrush(*wxWHITE_BRUSH);
	wxPoint copy = getDisplayBox(idx).GetPosition();
	view->CalcScrolledPosition(copy.x, copy.y, &copy.x, &copy.y);
	context.DrawRectangle(copy.x, copy.y, getDisplayBox(idx).width, getDisplayBox(idx).height);
	context.DrawBitmap(upBitmap, copy.x + 1, copy.y + 2, true);
	context.DrawBitmap(downBitmap, copy.x + 1, copy.y + getDisplayBox(idx).height - 2 - downBitmap.GetHeight(), true);

	barSize.SetHeight((getDisplayBox(idx).height - 12) * 0.45);
	barSize.SetWidth(getDisplayBox(idx).width - 4);

	int divBy = (table->getTotalColumns() - table->getColumnsWindow());
	if(divBy <= 0)
		divBy = table->getColumnsWindow();
	int colOffset = barSize.GetHeight() / divBy;
	int verticalPosBar = 3 + copy.y + downBitmap.GetHeight() + colOffset * table->getTopColWindowIndex();
	if(table->getColumnsWindow() > 1)
		context.DrawRectangle(wxPoint(copy.x + 2, verticalPosBar), barSize);

}
hdPoint hdLocatorConnector::findEnd(int posIdx, hdLineConnection *connection)
{
	return getDisplayBox(posIdx).center();
}
bool hdLocatorConnector::containsPoint(int posIdx, int x, int y)
{
	return getDisplayBox(posIdx).Contains(x, y);
}