예제 #1
0
파일: MainWindow.cpp 프로젝트: bsns/flinux
LRESULT MainWindow::OnNewClient(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
{
	uint32_t pid = (uint32_t)wParam;
	WCHAR text[256];
	wsprintfW(text, L"PID: %d\n", pid);
	HTREEITEM item = m_processTree.InsertItem(TVIF_TEXT, text, 0, 0, TVIS_BOLD, TVIS_BOLD, 0, NULL, NULL);
	m_processTree.SetItemData(item, (DWORD_PTR)pid);
	std::unique_ptr<Client> client = std::make_unique<Client>();
	client->pid = pid;
	client->item = item;
	InitLogViewer(client->logViewer);
	if (m_splitter.GetSplitterPane(SPLIT_PANE_RIGHT) == m_defaultLogViewer)
		SetCurrentLogViewer(client->logViewer);
	m_clients.push_back(std::move(client));
	return 0;
}
예제 #2
0
LRESULT MainWindow::OnNewClient(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
{
	uint32_t pid = (uint32_t)wParam;
	uint32_t tid = (uint32_t)lParam;
	/* Find the place to insert item */
	WCHAR text[256];
	wsprintfW(text, L"PID: %d, TID: %d\n", pid, tid);
	int parentId = -1;
	HTREEITEM item = NULL;
	for (int i = (int)m_clients.size() - 1; i >= 0; i--)
	{
		Client *parent = m_clients[i].front().get();
		if (parent->pid == pid)
		{
			Client *after = m_clients[i].back().get();
			item = m_processTree.InsertItem(TVIF_TEXT, text, 0, 0, TVIS_BOLD, TVIS_BOLD, 0, parent->item, after->item);
			parentId = i;
			break;
		}
	}
	if (!item)
	{
		item = m_processTree.InsertItem(TVIF_TEXT, text, 0, 0, TVIS_BOLD, TVIS_BOLD, 0, NULL, NULL);
		m_clients.emplace_back();
		parentId = (int)m_clients.size() - 1;
	}
	std::unique_ptr<Client> client = std::make_unique<Client>();
	client->pid = pid;
	client->tid = tid;
	client->item = item;
	m_processTree.SetItemData(client->item, (DWORD_PTR)client.get());
	InitLogViewer(client->logViewer);
	if (m_splitter.GetSplitterPane(SPLIT_PANE_RIGHT) == m_defaultLogViewer)
		SetCurrentLogViewer(client->logViewer);
	m_clients[parentId].push_back(std::move(client));
	m_processTree.Invalidate();
	return 0;
}
예제 #3
0
LRESULT MainWindow::OnCreate(LPCREATESTRUCT cs)
{
	m_processTree.Create(*this, rcDefault, NULL,
		WS_CHILD | WS_VISIBLE | WS_VSCROLL | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS,
		WS_EX_CLIENTEDGE);

	m_splitter.Create(*this, rcDefault, NULL, WS_CHILD | WS_VISIBLE);
	m_logViewerFont.CreateFontW(18, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
		OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FF_DONTCARE, L"Consolas");
	InitLogViewer(m_defaultLogViewer);
	m_defaultLogViewer.SetWindowTextW(L"No Foreign Linux client connected.");

	m_splitter.SetSplitterPanes(m_processTree, m_defaultLogViewer);

	m_hWndClient = m_splitter;
	UpdateLayout();

	m_splitter.SetSplitterPos(240);
	m_splitter.SetSplitterExtendedStyle(0);
	m_splitter.m_bFullDrag = FALSE;

	m_logServer.Start(*this);
	return 0;
}