Exemple #1
0
GSFrame::GSFrame( const wxString& title)
	: wxFrame(NULL, wxID_ANY, title, g_Conf->GSWindow.WindowPos)
	, m_timer_UpdateTitle( this )
{
	SetIcons( wxGetApp().GetIconBundle() );
	SetBackgroundColour( *wxBLACK );

	wxStaticText* label = new wxStaticText( this, wxID_ANY, _("GS Output is Disabled!") );
	m_id_OutputDisabled = label->GetId();
	label->SetFont( pxGetFixedFont( 20, wxFONTWEIGHT_BOLD ) );
	label->SetForegroundColour( *wxWHITE );

	AppStatusEvent_OnSettingsApplied();

	GSPanel* gsPanel = new GSPanel( this );
	gsPanel->Show( !EmuConfig.GS.DisableOutput );
	m_id_gspanel = gsPanel->GetId();

	// TODO -- Implement this GS window status window!  Whee.
	// (main concern is retaining proper client window sizes when closing/re-opening the window).
	//m_statusbar = CreateStatusBar( 2 );

	Bind(wxEVT_CLOSE_WINDOW, &GSFrame::OnCloseWindow, this);
	Bind(wxEVT_MOVE, &GSFrame::OnMove, this);
	Bind(wxEVT_SIZE, &GSFrame::OnResize, this);
	Bind(wxEVT_ACTIVATE, &GSFrame::OnActivate, this);

	Bind(wxEVT_TIMER, &GSFrame::OnUpdateTitle, this, m_timer_UpdateTitle.GetId());
}
Exemple #2
0
void ConsoleLogFrame::ColorArray::SetFont( int fontsize )
{
	const wxFont fixed( pxGetFixedFont( fontsize ) );
	const wxFont fixedB( pxGetFixedFont( fontsize+1, wxFONTWEIGHT_BOLD ) );

	// Standard R, G, B format:
	for (size_t i = 0; i < Color_StrongBlack; ++i)
		m_table[i].SetFont(fixed);

	for (size_t i = Color_StrongBlack; i < ConsoleColors_Count; ++i)
		m_table[i].SetFont(fixedB);

	SetColorScheme_Light();
}
void CtrlRegisterList::OnDraw(wxDC& dc)
{
	wxFont font = pxGetFixedFont(8);
	font.SetPixelSize(wxSize(charWidth,rowHeight-2));
	dc.SetFont(font);

	refreshChangedRegs();

	wxColor colorChanged = wxColor(0xFF0000FF);
	wxColor colorUnchanged = wxColor(0xFF004000);
	wxColor colorNormal = wxColor(0xFF600000);

	int startRow;
	GetViewStart(nullptr,&startRow);
	int endRow = startRow + ceil(float(GetClientSize().y) / rowHeight);

	// draw categories
	int width = GetClientSize().x;
	if (startRow == 0)
	{
		int piece = width /cpu->getRegisterCategoryCount();
		for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
		{
			const char* name = cpu->getRegisterCategoryName(i);

			int x = i*piece;

			if (i == category)
			{
				dc.SetBrush(wxBrush(wxColor(0xFF70FF70)));
				dc.SetPen(wxPen(wxColor(0xFF000000)));
			} else {
				dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
				dc.SetPen(wxPen(wxColor(0xFF000000)));
			}

			if (i == cpu->getRegisterCategoryCount()-1)
				piece += width-piece*cpu->getRegisterCategoryCount()-1;
		
			dc.DrawRectangle(x,0,piece+1,rowHeight);

			// center text
			x += (piece-strlen(name)*charWidth)/2;
			dc.DrawText(wxString(name,wxConvUTF8),x,2);
		}
	}

	// skip the tab row
	startRow = std::max<int>(0,startRow-1);
	endRow = std::min<int>(cpu->getRegisterCount(category)-1,endRow-1);

	int nameStart = 17;
	int valueStart = startPositions[category];

	ChangedReg* changedRegs = changedCategories[category];
	int registerBits = cpu->getRegisterSize(category);
	DebugInterface::RegisterType type = cpu->getRegisterType(category);

	for (int i = startRow; i <= endRow; i++)
	{
		int x = valueStart;
		int y = rowHeight*(i+1);

		wxColor backgroundColor;
		if (currentRows[category] == i)
			backgroundColor = wxColor(0xFFFFCFC8);
		else if (i % 2)
			backgroundColor = wxColor(237, 242, 255, 255);
		else
			backgroundColor = wxColor(0xFFFFFFFF);

		dc.SetBrush(backgroundColor);
		dc.SetPen(backgroundColor);
		dc.DrawRectangle(0, y, width, rowHeight);

		const char* name = cpu->getRegisterName(category,i);
		dc.SetTextForeground(colorNormal);
		dc.DrawText(wxString(name,wxConvUTF8),nameStart,y+2);

		u128 value = cpu->getRegister(category,i);
		ChangedReg& changed = changedRegs[i];

		switch (type)
		{
		case DebugInterface::NORMAL:	// display them in 32 bit parts
			switch (registerBits)
			{
			case 128:
				{
					int startIndex = std::min<int>(3, maxBits / 32 - 1);

					if (resolvePointerStrings && cpu->isAlive()) {
						char *strval = cpu->stringFromPointer(value._u32[0]);
						if (strval) {
							static wxColor clr = wxColor(0xFF228822);
							dc.SetTextForeground(clr);
							dc.DrawText(wxString(strval), width - (32 * charWidth + 12), y + 2);
							startIndex = 0;
						}
					}

					int actualX = width-4-(startIndex+1)*(8*charWidth+2);
					x = std::max<int>(actualX,x);

					if (startIndex != 3)
					{
						bool c = false;
						for (int i = 3; i > startIndex; i--)
							c = c || changed.changed[i];

						if (c)
						{
							dc.SetTextForeground(colorChanged);
							dc.DrawText(L"+",x-charWidth,y+2);
						}
					}

					for (int i = startIndex; i >= 0; i--)
					{
						if (changed.changed[i])
							dc.SetTextForeground(colorChanged);
						else
							dc.SetTextForeground(colorUnchanged);

						drawU32Text(dc,value._u32[i],x,y+2);
						x += charWidth*8+2;
					}
					break;
				}
			case 64:
				{
					if (maxBits < 64 && changed.changed[1])
					{
						dc.SetTextForeground(colorChanged);
						dc.DrawText(L"+",x-charWidth,y+2);
					}

					for (int i = 1; i >= 0; i--)
					{
						if (changed.changed[i])
							dc.SetTextForeground(colorChanged);
						else
							dc.SetTextForeground(colorUnchanged);

						drawU32Text(dc,value._u32[i],x,y+2);
						x += charWidth*8+2;
					}
					break;
				}
			case 32:
				{
					if (changed.changed[0])
						dc.SetTextForeground(colorChanged);
					else
						dc.SetTextForeground(colorUnchanged);

					drawU32Text(dc,value._u32[0],x,y+2);
					break;
				}
			}
			break;
		case DebugInterface::SPECIAL:		// let debug interface format them and just display them
			{
				if (changed.changed[0] || changed.changed[1] || changed.changed[2] || changed.changed[3])
					dc.SetTextForeground(colorChanged);
				else
					dc.SetTextForeground(colorUnchanged);

				dc.DrawText(cpu->getRegisterString(category,i),x,y+2);
				break;
			}
		}
	}
}