예제 #1
0
unsigned int __stdcall CDeviceView::ListDevicesThread(void *Param)
{
    CDeviceView *This = (CDeviceView *)Param;

    /* Clear any existing data */
    This->EmptyDeviceView();

    /* Reset the tree root */
    This->m_hTreeRoot = NULL;

    switch (This->m_ListDevices)
    {
    case DevicesByType:
        (VOID)This->ListDevicesByType();
        break;

    case DevicesByConnection:
        (VOID)This->ListDevicesByConnection();
        break;

    case ResourcesByType:
        break;

    case ResourcesByConnection:
        break;
    }
    return 0;
}
예제 #2
0
// gets the thumbnail for the specified view,
// specifiying whether or not we want the selected version
CBitmap *CDeviceUI::GetViewThumbnail(int nView, BOOL bSelected)
{
	CDeviceView *pView = GetView(nView);
	if (pView == NULL)
		return NULL;

	return pView->GetImage(bSelected ? DVI_SELTHUMB : DVI_THUMB);
}
예제 #3
0
unsigned int __stdcall CDeviceView::RefreshThread(void *Param)
{
    RefreshThreadData *ThreadData = (RefreshThreadData *)Param;
    CDeviceView *This = ThreadData->This;

    // Get a copy of the currently selected node
    CNode *LastSelectedNode = This->GetSelectedNode();
    if (LastSelectedNode == nullptr || (LastSelectedNode->GetNodeType() == RootNode))
    {
        LastSelectedNode = new CRootNode(*This->m_RootNode);
    }
    else if (LastSelectedNode->GetNodeType() == ClassNode)
    {
        LastSelectedNode = new CClassNode(*dynamic_cast<CClassNode *>(LastSelectedNode));
    }
    else if (LastSelectedNode->GetNodeType() == DeviceNode)
    {
        LastSelectedNode = new CDeviceNode(*dynamic_cast<CDeviceNode *>(LastSelectedNode));
    }

    // Empty the treeview
    This->EmptyDeviceView();

    // Re-add the root node to the tree
    if (This->AddRootDevice() == false)
        return 0;

    // Refresh the devices only if requested
    if (ThreadData->ScanForChanges)
    {
        This->RefreshDeviceList();
    }

    // display the type of view the user wants
    switch (This->m_ViewType)
    {
        case DevicesByType:
            (void)This->ListDevicesByType();
            break;

        case DevicesByConnection:
            (VOID)This->ListDevicesByConnection();
            break;

        case ResourcesByType:
            break;

        case ResourcesByConnection:
            break;
    }


    This->SelectNode(LastSelectedNode);

    delete ThreadData;

    return 0;
}
예제 #4
0
CDeviceView *CDeviceUI::UserNewView()
{
	CDeviceView *pView = NewView();
	if (!pView)
		return NULL;

	pView->AddWrappedLineOfText(
		(HFONT)m_uig.GetFont(UIE_PICCUSTOMTEXT),
		m_uig.GetTextColor(UIE_PICCUSTOMTEXT),
		m_uig.GetBkColor(UIE_PICCUSTOMTEXT),
		_T("Customize This View"));

	pView->MakeMissingImages();

	Invalidate();

	return pView;
}
예제 #5
0
CDeviceView *CDeviceUI::NewView()
{
	// allocate new view, continuing on if it fails
	CDeviceView *pView = new CDeviceView(*this);
	if (pView == NULL)
		return NULL;

	// add view to array
	m_arpView.SetAtGrow(m_arpView.GetSize(), pView);

	// create view
	pView->Create(m_hWnd, m_ViewRect, FALSE);

	// let the page update to indicate viewness
	NumViewsChanged();

	return pView;
}
예제 #6
0
void CDeviceUI::DoForAllControls(DEVCTRLCALLBACK callback, LPVOID pVoid, BOOL bFixed)
{
	int nv = GetNumViews();
	for (int v = 0; v < nv; v++)
	{
		CDeviceView *pView = GetView(v);
		if (pView == NULL)
			continue;

		int nc = pView->GetNumControls();
		for (int c = 0; c < nc; c++)
		{
			CDeviceControl *pControl = pView->GetControl(c);
			if (pControl == NULL)
				continue;

			callback(pControl, pVoid, bFixed);
		}
	}
}
예제 #7
0
void CDeviceUI::RequireAtLeastOneView()
{
	if (GetNumViews() > 0)
		return;

	CDeviceView *pView = NewView();
	if (!pView)
		return;

	pView->AddWrappedLineOfText(
		(HFONT)m_uig.GetFont(UIE_PICCUSTOMTEXT),
		m_uig.GetTextColor(UIE_PICCUSTOMTEXT),
		m_uig.GetBkColor(UIE_PICCUSTOMTEXT),
		_T("Customize This View"));
	pView->AddWrappedLineOfText(
		(HFONT)m_uig.GetFont(UIE_PICCUSTOM2TEXT),
		m_uig.GetTextColor(UIE_PICCUSTOM2TEXT),
		m_uig.GetBkColor(UIE_PICCUSTOM2TEXT),
		_T("The UI requires at least one view per device"));

	pView->MakeMissingImages();

	SetView(pView);
}