Пример #1
0
/* Add a rectangle to this path. */
CStatus
CPath_AddRectangle(CPath  *_this,
                   CFloat  x,
                   CFloat  y,
                   CFloat  width,
                   CFloat  height)
{
	/* ensure we have a this pointer */
	CStatus_Require((_this != 0), CStatus_ArgumentNull);

	/* add the rectangle */
	{
		/* declarations */
		CPointF *p;
		CByte   *t;

		/* calculate edges */
		const CFloat right  = (x + width);
		const CFloat bottom = (y + height);

		/* perform standard startup procedures for new figure additions */
		_BeginNew(_this, 4, p, t, x, y);

		/* add the remaining rectangle sides */
		_LineTo(p, t, right, y);
		_LineTo(p, t, right, bottom);
		_LineToClose(p, t, x, bottom);
	}

	/* return successfully */
	return CStatus_OK;
}
Пример #2
0
/* Add a line to the current figure. */
CStatus
CPath_AddLine(CPath  *_this,
              CFloat  x1,
              CFloat  y1,
              CFloat  x2,
              CFloat  y2)
{
	/* ensure we have a this pointer */
	CStatus_Require((_this != 0), CStatus_ArgumentNull);

	/* add the line */
	{
		/* declarations */
		CPointF *p;
		CByte   *t;

		/* perform standard startup procedures for path segment additions */
		_BeginAdd(_this, 2, p, t, x1, y1);

		/* complete the line */
		_LineTo(p,  t, x2, y2);
	}

	/* return successfully */
	return CStatus_OK;
}
Пример #3
0
BOOL gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd)
{
    p_LineTo _LineTo = LineTo_[IBPP(hdc->bitsPerPixel)];

    if (_LineTo == NULL)
        return FALSE;

    return _LineTo(hdc, nXEnd, nYEnd);
}
Пример #4
0
int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd)
{
	p_LineTo _LineTo = LineTo_[IBPP(hdc->bitsPerPixel)];

	if (_LineTo != NULL)
		return _LineTo(hdc, nXEnd, nYEnd);
	else
		return 0;
}
Пример #5
0
/* Add a polygon to this path. */
CStatus
CPath_AddPolygon(CPath   *_this,
                 CPointF *points,
                 CUInt32  count)
{
	/* ensure we have a this pointer */
	CStatus_Require((_this != 0), CStatus_ArgumentNull);

	/* ensure we have a point list pointer */
	CStatus_Require((points != 0), CStatus_ArgumentNull);

	/* ensure we have the required minimum number of points */
	CStatus_Require((count >= 3), CStatus_Argument_NeedAtLeast3Points);

	/* add the polygon */
	{
		/* declarations */
		CPointF *p;
		CByte   *t;

		/* get the last point pointer */
		const CPointF *last = (points + count - 1);

		/* ignore redundant last points */
		if(CPoint_X(*points) == CPoint_X(*last) &&
		   CPoint_Y(*points) == CPoint_Y(*last))
		{
			--last;
			--count;
		}

		/* perform standard startup procedures for new figure additions */
		_BeginNew
			(_this,             count,
			 p,                 t,
			 CPoint_X(*points), CPoint_Y(*points++));

		/* add the polygon edges */
		while(points != last)
		{
			_LineTo
				(p,                 t,
				 CPoint_X(*points), CPoint_Y(*points++));
		}

		/* complete the polygon */
		_LineToClose
			(p,                 t,
			 CPoint_X(*points), CPoint_Y(*points));
	}

	/* return successfully */
	return CStatus_OK;
}
Пример #6
0
int LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd)
{
	pLineTo_16bpp _LineTo;
	int rop2 = gdi_GetROP2(hdc) - 1;

	_LineTo = LineTo_ROP2_16bpp[rop2];

	if (_LineTo != NULL)
		return _LineTo(hdc, nXEnd, nYEnd);
	else
		return 0;
}
Пример #7
0
BOOL LineTo_16bpp(HGDI_DC hdc, int nXEnd, int nYEnd)
{
	pLineTo_16bpp _LineTo;
	int rop2 = gdi_GetROP2(hdc) - 1;

	_LineTo = LineTo_ROP2_16bpp[rop2];

	if (_LineTo == NULL)
		return FALSE;

	return _LineTo(hdc, nXEnd, nYEnd);
}
Пример #8
0
/* Add a sequence of connected line segments to the current figure. */
CStatus
CPath_AddLines(CPath   *_this,
               CPointF *points,
               CUInt32  count)
{
	/* ensure we have a this pointer */
	CStatus_Require((_this != 0), CStatus_ArgumentNull);

	/* ensure we have a point list pointer */
	CStatus_Require((points != 0), CStatus_ArgumentNull);

	/* ensure we have the required minimum number of points */
	CStatus_Require((count >= 2), CStatus_Argument_NeedAtLeast2Points);

	/* add the lines */
	{
		/* declarations */
		CPointF *p;
		CByte   *t;

		/* get the end of input pointer */
		const CPointF *const end = (points + count);

		/* perform standard startup procedures for path segment additions */
		_BeginAdd
			(_this,             count,
			 p,                 t,
			 CPoint_X(*points), CPoint_Y(*points++));

		/* add the line segments */
		while(points != end)
		{
			_LineTo
				(p,                 t,
				 CPoint_X(*points), CPoint_Y(*points++));
		}
	}

	/* return successfully */
	return CStatus_OK;
}
Пример #9
0
void CCodeView::OnPaint(wxPaintEvent& event)
{
	// --------------------------------------------------------------------
	// General settings
	// -------------------------
	wxPaintDC dc(this);
	wxRect rc = GetClientRect();

	dc.SetFont(DebuggerFont);

	wxCoord w,h;
	dc.GetTextExtent(_T("0WJyq"),&w,&h);

	if (h > rowHeight)
		rowHeight = h;

	dc.GetTextExtent(_T("W"),&w,&h);
	int charWidth = w;

	struct branch
	{
		int src, dst, srcAddr;
	};

	branch branches[256];
	int numBranches = 0;
	// TODO: Add any drawing code here...
	int width   = rc.width;
	int numRows = (rc.height / rowHeight) / 2 + 2;
	// ------------

	// --------------------------------------------------------------------
	// Colors and brushes
	// -------------------------
	dc.SetBackgroundMode(wxTRANSPARENT); // the text background
	const wxChar* bgColor = _T("#ffffff");
	wxPen nullPen(bgColor);
	wxPen currentPen(_T("#000000"));
	wxPen selPen(_T("#808080")); // gray
	nullPen.SetStyle(wxTRANSPARENT);
	currentPen.SetStyle(wxSOLID);
	wxBrush currentBrush(_T("#FFEfE8")); // light gray
	wxBrush pcBrush(_T("#70FF70")); // green
	wxBrush bpBrush(_T("#FF3311")); // red

	wxBrush bgBrush(bgColor);
	wxBrush nullBrush(bgColor);
	nullBrush.SetStyle(wxTRANSPARENT);

	dc.SetPen(nullPen);
	dc.SetBrush(bgBrush);
	dc.DrawRectangle(0, 0, 16, rc.height);
	dc.DrawRectangle(0, 0, rc.width, 5);
	// ------------

	// --------------------------------------------------------------------
	// Walk through all visible rows
	// -------------------------
	for (int i = -numRows; i <= numRows; i++)
	{
		unsigned int address = curAddress + i * align;

		int rowY1 = rc.height / 2 + rowHeight * i - rowHeight / 2;
		int rowY2 = rc.height / 2 + rowHeight * i + rowHeight / 2;

		wxString temp = wxString::Format(_T("%08x"), address);
		u32 col = debugger->GetColor(address);
		wxBrush rowBrush(wxColor(col >> 16, col >> 8, col));
		dc.SetBrush(nullBrush);
		dc.SetPen(nullPen);
		dc.DrawRectangle(0, rowY1, 16, rowY2 - rowY1 + 2);

		if (selecting && (address == selection))
			dc.SetPen(selPen);
		else
			dc.SetPen(i == 0 ? currentPen : nullPen);

		if (address == debugger->GetPC())
			dc.SetBrush(pcBrush);
		else
			dc.SetBrush(rowBrush);

		dc.DrawRectangle(16, rowY1, width, rowY2 - rowY1 + 1);
		dc.SetBrush(currentBrush);
		if (!plain)
		{
			dc.SetTextForeground(_T("#600000")); // the address text is dark red
			dc.DrawText(temp, 17, rowY1);
			dc.SetTextForeground(_T("#000000"));
		}

		// If running
		if (debugger->IsAlive())
		{
			char dis[256];
			debugger->Disassemble(address, dis, 256);
			char* dis2 = strchr(dis, '\t');
			char desc[256] = "";

			// If we have a code
			if (dis2)
			{
				*dis2 = 0;
				dis2++;
				// look for hex strings to decode branches
				const char* mojs = strstr(dis2, "0x8");
				if (mojs)
				{
					for (int k = 0; k < 8; k++)
					{
						bool found = false;
						for (int j = 0; j < 22; j++)
						{
							if (mojs[k + 2] == "0123456789ABCDEFabcdef"[j])
								found = true;
						}
						if (!found)
						{
							mojs = nullptr;
							break;
						}
					}
				}
				if (mojs)
				{
					int offs;
					sscanf(mojs + 2, "%08x", &offs);
					branches[numBranches].src = rowY1 + rowHeight / 2;
					branches[numBranches].srcAddr = address / align;
					branches[numBranches++].dst = (int)(rowY1 + ((s64)(u32)offs - (s64)(u32)address) * rowHeight / align + rowHeight / 2);
					sprintf(desc, "-->%s", debugger->GetDescription(offs).c_str());
					dc.SetTextForeground(_T("#600060")); // the -> arrow illustrations are purple
				}
				else
				{
					dc.SetTextForeground(_T("#000000"));
				}

				dc.DrawText(StrToWxStr(dis2), 17 + 17*charWidth, rowY1);
				// ------------
			}

			// Show blr as its' own color
			if (strcmp(dis, "blr"))
				dc.SetTextForeground(_T("#007000")); // dark green
			else
				dc.SetTextForeground(_T("#8000FF")); // purple

			dc.DrawText(StrToWxStr(dis), 17 + (plain ? 1*charWidth : 9*charWidth), rowY1);

			if (desc[0] == 0)
			{
				strcpy(desc, debugger->GetDescription(address).c_str());
			}

			if (!plain)
			{
				dc.SetTextForeground(_T("#0000FF")); // blue

				//char temp[256];
				//UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE);
				if (strlen(desc))
				{
					dc.DrawText(StrToWxStr(desc), 17 + 35 * charWidth, rowY1);
				}
			}

			// Show red breakpoint dot
			if (debugger->IsBreakpoint(address))
			{
				dc.SetBrush(bpBrush);
				dc.DrawRectangle(2, rowY1 + 1, 11, 11);
			}
		}
	} // end of for
	// ------------

	// --------------------------------------------------------------------
	// Colors and brushes
	// -------------------------
	dc.SetPen(currentPen);

	for (int i = 0; i < numBranches; i++)
	{
		int x = 17 + 49 * charWidth + (branches[i].srcAddr % 9) * 8;
		_MoveTo(x-2, branches[i].src);

		if (branches[i].dst < rc.height + 400 && branches[i].dst > -400)
		{
			_LineTo(dc, x+2, branches[i].src);
			_LineTo(dc, x+2, branches[i].dst);
			_LineTo(dc, x-4, branches[i].dst);

			_MoveTo(x, branches[i].dst - 4);
			_LineTo(dc, x-4, branches[i].dst);
			_LineTo(dc, x+1, branches[i].dst+5);
		}
		//else
		//{
			// This can be re-enabled when there is a scrollbar or
			// something on the codeview (the lines are too long)

			//_LineTo(dc, x+4, branches[i].src);
			//_MoveTo(x+2, branches[i].dst-4);
			//_LineTo(dc, x+6, branches[i].dst);
			//_LineTo(dc, x+1, branches[i].dst+5);
		//}

		//_LineTo(dc, x, branches[i].dst+4);
		//_LineTo(dc, x-2, branches[i].dst);
	}
	// ------------
}
Пример #10
0
/* Add a sequence of rectangles to this path. */
CStatus
CPath_AddRectangles(CPath       *_this,
                    CRectangleF *rects,
                    CUInt32      count)
{
	/* ensure we have a this pointer */
	CStatus_Require((_this != 0), CStatus_ArgumentNull);

	/* ensure we have a rectangle list pointer */
	CStatus_Require((rects != 0), CStatus_ArgumentNull);

	/* bail out now if there's nothing to add */
	CStatus_Require((count != 0), CStatus_OK);

	/* add the rectangles */
	{
		/* declarations */
		CPointF *p;
		CByte   *t;
		CFloat   left;
		CFloat   top;
		CFloat   right;
		CFloat   bottom;

		/* get the end of input pointer */
		const CRectangleF *const end = (rects + count);

		/* get the rectangle edges */
		left   = CRectangle_X(*rects);
		top    = CRectangle_Y(*rects);
		right  = left + CRectangle_Width(*rects);
		bottom = top + CRectangle_Height(*rects++);

		/* perform standard startup procedures for new figure additions */
		_BeginNew
			(_this, (count * 4),
			 p,     t,
			 left,  top);

		/* complete the first rectangle */
		_LineTo(p, t, right, top);
		_LineTo(p, t, right, bottom);
		_LineToClose(p, t, left, bottom);

		/* add the remaining rectangles */
		while(rects != end)
		{
			/* get the rectangle edges */
			left   = CRectangle_X(*rects);
			top    = CRectangle_Y(*rects);
			right  = left + CRectangle_Width(*rects);
			bottom = top + CRectangle_Height(*rects++);

			/* add the rectangle */
			_MoveTo(p, t, left, top);
			_LineTo(p, t, right, top);
			_LineTo(p, t, right, bottom);
			_LineToClose(p, t, left, bottom);
		}
	}

	/* return successfully */
	return CStatus_OK;
}