Example #1
0
unsigned int WINAPI ConsoleListener::RunThread(void *lpParam)
{
	setCurrentThreadName("ConsoleThread");
	ConsoleListener *consoleLog = (ConsoleListener *)lpParam;
	consoleLog->LogWriterThread();
	return 0;
}
Example #2
0
void CFrame::ResizeConsole()
{
#ifdef _WIN32
	// Get the console parent window
	wxWindow * Win = FindWindowById(IDM_CONSOLEWINDOW);
	if (!Win) return;

	const int wxBorder = 2, Border = 4,
		  MenuBar = 30, ScrollBar = 19;

	// Get the client size
	int X = Win->GetSize().GetX();
	int Y = Win->GetSize().GetY();
	int InternalWidth = X - wxBorder*2 - ScrollBar;
	int InternalHeight = Y - wxBorder*2;
	int WindowWidth = InternalWidth + Border*2 +
		/*max out the width in the word wrap mode*/ 100;
	int WindowHeight = InternalHeight + MenuBar;
	// Resize buffer
	ConsoleListener* Console = LogManager::GetInstance()->GetConsoleListener();
	Console->PixelSpace(0,0, InternalWidth, InternalHeight, false);
	// Move the window to hide the border
	MoveWindow(GetConsoleWindow(), -Border-wxBorder, -MenuBar-wxBorder,
			WindowWidth + 100, WindowHeight, true);
#endif
}
Example #3
0
void CFrame::ToggleConsole(bool bShow)
{
#ifdef _WIN32
	GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(bShow);

	if (bShow)
	{
		// If the console doesn't exist, we create it
		if (!GetConsoleWindow())
		{
			ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
			Console->Open();
		}
		else
		{
			ShowWindow(GetConsoleWindow(), SW_SHOW);
		}

		// Create the parent window if it doesn't exist
		wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
		if (!ConsoleParent) ConsoleParent = new wxPanel(this, IDM_CONSOLEWINDOW,
				wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("Console"));

		wxWindow *ConsoleWin = new wxWindow();
		ConsoleWin->SetHWND((WXHWND)GetConsoleWindow());
		ConsoleWin->AdoptAttributesFromHWND();
		ConsoleWin->Reparent(ConsoleParent);

		ConsoleParent->Enable();
		const int nbIndex = IDM_CONSOLEWINDOW - IDM_LOGWINDOW;
		DoAddPage(ConsoleParent,
				g_pCodeWindow ? g_pCodeWindow->iNbAffiliation[nbIndex] : 0,
				g_pCodeWindow ? bFloatWindow[nbIndex] : false);
	}
	else // Hide
	{
		if(GetConsoleWindow())
			ShowWindow(GetConsoleWindow(), SW_HIDE); // WIN32

		wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
		if (ConsoleParent)
			ConsoleParent->Disable();

		// Then close the page
		DoRemovePage(ConsoleParent, true);
	}

	// Hide or Show the pane
	if (!g_pCodeWindow)
		TogglePane();
#endif
}
Example #4
0
CFrame::CFrame(wxFrame* parent,
		wxWindowID id,
		const wxString& title,
		const wxPoint& pos,
		const wxSize& size,
		bool _UseDebugger,
		bool _BatchMode,
		bool ShowLogWindow,
		long style)
	: CRenderFrame(parent, id, title, pos, size, style)
	, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
	, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
	, m_GameListCtrl(NULL), m_Panel(NULL)
	, m_RenderFrame(NULL), m_RenderParent(NULL)
	, m_LogWindow(NULL), m_LogConfigWindow(NULL)
	, m_FifoPlayerDlg(NULL), UseDebugger(_UseDebugger)
	, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
	, m_bGameLoading(false)
{
	for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
		bFloatWindow[i] = false;

	if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;

	// Give it a console early to show potential messages from this onward
	ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
	if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();

	// Start debugging maximized
	if (UseDebugger) this->Maximize(true);
	// Debugger class
	if (UseDebugger)
	{
		g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
		LoadIniPerspectives();
		g_pCodeWindow->Load();
	}

	// Create toolbar bitmaps
	InitBitmaps();

	// Give it a status bar
	SetStatusBar(CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR));
	if (!SConfig::GetInstance().m_InterfaceStatusbar)
		GetStatusBar()->Hide();

	// Give it a menu bar
	CreateMenu();

	// ---------------
	// Main panel
	// This panel is the parent for rendering and it holds the gamelistctrl
	m_Panel = new CPanel(this, IDM_MPANEL);

	m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
			wxDefaultPosition, wxDefaultSize,
			wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);

	wxBoxSizer *sizerPanel = new wxBoxSizer(wxHORIZONTAL);
	sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
	m_Panel->SetSizer(sizerPanel);
	// ---------------

	// Manager
	m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);

	m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
			.Name(_T("Pane 0")).Caption(_T("Pane 0")).PaneBorder(false)
			.CaptionVisible(false).Layer(0).Center().Show());
	if (!g_pCodeWindow)
		m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
				.Name(_T("Pane 1")).Caption(_("Logging")).CaptionVisible(true)
				.Layer(0).FloatingSize(wxSize(600, 350)).CloseButton(true).Hide());
	AuiFullscreen = m_Mgr->SavePerspective();

	// Create toolbar
	RecreateToolbar();
	if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false);

	m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
	m_LogWindow->Hide();
	m_LogWindow->Disable();

	g_TASInputDlg = new TASInputDlg(this);
	Movie::SetInputManip(TASManipFunction);

	State::SetOnAfterLoadCallback(OnAfterLoadCallback);

	// Setup perspectives
	if (g_pCodeWindow)
	{
		// Load perspective
		DoLoadPerspective();
	}
	else
	{
		if (SConfig::GetInstance().m_InterfaceLogWindow)
			ToggleLogWindow(true);
		if (SConfig::GetInstance().m_InterfaceLogConfigWindow)
			ToggleLogConfigWindow(true);
		if (SConfig::GetInstance().m_InterfaceConsole)
			ToggleConsole(true);
	}

	// Show window
	Show();

	// Commit
	m_Mgr->Update();

	#ifdef _WIN32
		SetToolTip(wxT(""));
		GetToolTip()->SetAutoPop(25000);
	#endif

	#if defined(HAVE_XRANDR) && HAVE_XRANDR
		m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()),
				X11Utils::XWindowFromHandle(GetHandle()));
	#endif

	// -------------------------
	// Connect event handlers

	m_Mgr->Bind(wxEVT_AUI_RENDER, &CFrame::OnManagerResize, this);
	// ----------

	// Update controls
	UpdateGUI();
}
Example #5
0
unsigned int WINAPI ConsoleListener::RunThread(void *lpParam)
{
	ConsoleListener *consoleLog = (ConsoleListener *)lpParam;
	consoleLog->LogWriterThread();
	return 0;
}