コード例 #1
0
ファイル: DeviceView.cpp プロジェクト: Strongc/reactos
bool
CDeviceView::EnableSelectedDevice(
    _In_ bool Enable,
    _Out_ bool &NeedsReboot
    )
{
    CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
    if (Node == nullptr) return false;

    if (Enable == false)
    {
        CAtlStringW str;
        if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE))
        {
            if (MessageBoxW(m_hMainWnd,
                str,
                Node->GetDisplayName(),
                MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
            {
                return false;
            }
        }
    }

    return Node->EnableDevice(Enable, NeedsReboot);
}
コード例 #2
0
bool wxSpinTreeCtrl::SelectNode(spin::ReferencedNode* pNode)
{
    // there should always be at least one node (the scene root). If not, return
    // because this is a problem.
    if (GetCount() == 0)
        return false;

    // if pNode is NULL, we select the scene root
    if (! pNode)
    {
        SelectItem(GetRootItem());
        UpdatePropGrid();
    }

    // if the node is already selected, don't do anything
    if (pNode == GetSelectedNode())
        return true;

    wxTreeItemId id = GetTreeItem(pNode);
    if (id)
    {
        SelectItem(id);
        UpdatePropGrid();
        return true;
    }
    // couldn't find the node, so return false
    return false;
}
コード例 #3
0
void CFairyPackerView::OnEditAddfolder()
{
    // TODO: 在此添加命令处理程序代码
    // 选择一个目标文件夹
    TCHAR szPath[MAX_PATH];
    ZeroMemory( szPath,sizeof(szPath) );

    BROWSEINFO bi;
    bi.hwndOwner = m_hWnd;
    bi.pidlRoot = NULL;
    bi.pszDisplayName = szPath;
    bi.lpszTitle = _T("请选择需要要添加的目录:");
    bi.ulFlags = 0;
    bi.lpfn = NULL;
    bi.lParam = 0;
    bi.iImage = 0;

    //弹出选择目录对话框
    LPITEMIDLIST lp = SHBrowseForFolder(&bi);
    if( !(lp && SHGetPathFromIDList(lp, szPath)) )
        return;

    AString addToDir = "";
    CFairyExplorer* exp = &GetDocument()->m_Explorer;
    CFairyExplorer::PKNode* pNode = GetSelectedNode();
    if( pNode && pNode->bIsDirectory )
        addToDir = pNode->strName;

    UINT fileCount = exp->GetDiskFileCount( F_UnicodeToUTF8(szPath) );
    FFilePairList params;
    params.push_back( std::make_pair(F_UnicodeToUTF8(szPath), addToDir) );
    ProcessOperation( FAIRY_OP_ADDFILE,exp,fileCount,params );
    m_pDocument->UpdateAllViews( NULL );
}
コード例 #4
0
void CFairyPackerView::OnEditAddfile()
{
    // TODO: 在此添加命令处理程序代码
    static std::vector<TCHAR> tmpBuf;
    tmpBuf.resize( 1000 * (MAX_PATH + 1) + 1 );
    CFileDialog dlg( TRUE,NULL,NULL,OFN_ALLOWMULTISELECT );
    dlg.GetOFN().lpstrFile = &tmpBuf[0];
    dlg.GetOFN().nMaxFile = 1000 * (MAX_PATH + 1) + 1;
    if( dlg.DoModal() != IDOK ) return;

    AString addToDir = "";
    CFairyExplorer* exp = &GetDocument()->m_Explorer;
    CFairyExplorer::PKNode* node = GetSelectedNode();
    if( node != NULL && node->bIsDirectory )
        addToDir = node->strName;

    int fileCount = 0;
    FFilePairList params;
    POSITION pos = dlg.GetStartPosition();
    while( pos )
    {
        CString filename = dlg.GetNextPathName(pos);
        fileCount += exp->GetDiskFileCount( F_UnicodeToUTF8((const TCHAR*)filename) );
        params.push_back( std::make_pair(F_UnicodeToUTF8((const TCHAR*)filename), addToDir) );
    }

    ProcessOperation( FAIRY_OP_ADDFILE,exp,fileCount,params );
    m_pDocument->UpdateAllViews(NULL);
}
コード例 #5
0
void wxSpinTreeCtrl::OnSpinSelectionChange(wxTreeEvent & WXUNUSED(event))
{
    spin::ReferencedNode *n = GetSelectedNode();
    if (n)
    {
        //std::cout << "got tree selection: " << n->getID() << std::endl;
    }
    else std::cout << "got tree selection, but couldn't find spin node" << std::endl;
    UpdatePropGrid();
}
コード例 #6
0
void wxSpinTreeCtrl::UpdatePropGrid()
{
    if (!spinPropGrid)
    {
        std::cout << "wxSpinTreeCtrl: Oops. SpinPropGrid does not exist. Cannot populate the property editor." << std::endl;
        return;
    }

    spin::ReferencedNode *n = GetSelectedNode();
    if (n) spinPropGrid->SetNode(n);
    else spinPropGrid->SetNode(NULL); // This will empty the propgrid editor
}
コード例 #7
0
ファイル: DeviceView.cpp プロジェクト: Strongc/reactos
void
CDeviceView::DisplayPropertySheet()
{
    CNode *Node = GetSelectedNode();
    if (Node && Node->HasProperties())
    {
        DevicePropertiesExW(m_hTreeView,
                            NULL,
                            Node->GetDeviceId(),
                            1,//DPF_EXTENDED,
                            FALSE);
    }
}
コード例 #8
0
ファイル: DeviceView.cpp プロジェクト: Strongc/reactos
bool
CDeviceView::CreateActionMenu(
    _In_ HMENU OwnerMenu,
    _In_ bool MainMenu
    )
{
    CNode *Node = GetSelectedNode();
    if (Node)
    {
        BuildActionMenuForNode(OwnerMenu, Node, MainMenu);
        return true;
    }

    return false;
}
コード例 #9
0
void QTransferFunction::SelectNextNode(void)
{
	if (!m_pSelectedNode)
		return;

	int Index = m_Nodes.indexOf(*GetSelectedNode());

	if (Index < 0)
		return;

	// Compute new index
	const int NewIndex = qMin(m_Nodes.size() - 1, qMax(0, Index + 1));

	// Set selected node
	SetSelectedNode(&m_Nodes[NewIndex]);
}
コード例 #10
0
void CFairyPackerView::OnUpdateEditDelete(CCmdUI *pCmdUI)
{
    // TODO: 在此添加命令更新用户界面处理程序代码
    CListCtrl& lc = GetListCtrl();

    if( GetDocument()->m_Explorer.IsOpen() &&
        !GetDocument()->m_Explorer.IsReadonly() &&
        GetSelectedNode() != NULL )
    {
        pCmdUI->Enable( TRUE );
    }
    else
    {
        pCmdUI->Enable( FALSE );
    }
}
コード例 #11
0
ファイル: DeviceView.cpp プロジェクト: Strongc/reactos
bool
CDeviceView::UpdateSelectedDevice(
    _Out_ bool &NeedsReboot
    )
{
    CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
    if (Node == nullptr) return false;

    DWORD dwReboot;
    if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot))
    {
        NeedsReboot = false;
        return true;
    }

    return false;
}
コード例 #12
0
void wxSpinTreeCtrl::removeNode(const char *id)
{
    // if the node to be removed is currently selected, then select NULL (root)
    spin::ReferencedNode* n = GetSelectedNode();
    if (n && strcmp(n->id->s_name,id)==0)
    {
        SelectNode(NULL);
    }
    // We need to find the node based on the string id provided:
    wxTreeItemId nodeInTree = GetTreeItem(id);
    if (nodeInTree)
    {
        Freeze();
        Delete(nodeInTree);
        Thaw();
    }
}
コード例 #13
0
ファイル: DeviceView.cpp プロジェクト: Strongc/reactos
LRESULT
CDeviceView::OnContextMenu(
    _In_ LPARAM lParam
    )
{
    HTREEITEM hSelected = TreeView_GetSelection(m_hTreeView);

    RECT rc;
    if (TreeView_GetItemRect(m_hTreeView,
                             hSelected,
                             &rc,
                             TRUE))
    {
        POINT pt;
        if (GetCursorPos(&pt) &&
            ScreenToClient(m_hTreeView, &pt) &&
            PtInRect(&rc, pt))
        {
            CNode *Node = GetSelectedNode();
            if (Node)
            {
                // Create the context menu
                HMENU hContextMenu = CreatePopupMenu();

                // Add the actions for this node
                BuildActionMenuForNode(hContextMenu, Node, false);

                INT xPos = GET_X_LPARAM(lParam);
                INT yPos = GET_Y_LPARAM(lParam);

                // Display the menu
                TrackPopupMenuEx(hContextMenu,
                                 TPM_RIGHTBUTTON,
                                 xPos,
                                 yPos,
                                 m_hMainWnd,
                                 NULL);

                DestroyMenu(hContextMenu);
            }
        }
    }

    return 0;
}
コード例 #14
0
ファイル: DeviceView.cpp プロジェクト: Strongc/reactos
bool
CDeviceView::UninstallSelectedDevice(
    )
{
    CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode());
    if (Node == nullptr) return false;

    CAtlStringW str;
    if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL))
    {
        if (MessageBoxW(m_hMainWnd,
            str,
            Node->GetDisplayName(),
            MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES)
        {
            return false;
        }
    }

    return Node->UninstallDevice();
}