コード例 #1
0
bool CRevisionGraphWnd::FetchRevisionData
    ( const CString& path
    , SVNRev pegRevision
    , CProgressDlg* progress
    , ITaskbarList3 * pTaskbarList
    , HWND hWnd)
{
    // (re-)fetch the data
    SVN svn;
    if (svn.GetRepositoryRoot(CTSVNPath(path)) == svn.GetURLFromPath(CTSVNPath(path)))
    {
        m_state.SetLastErrorMessage(CString(MAKEINTRESOURCE(IDS_REVGRAPH_ERR_NOGRAPHFORROOT)));
        return false;
    }

    std::unique_ptr<CFullHistory> newFullHistory (new CFullHistory());

    bool showWCRev
        = m_state.GetOptions()->GetOption<CShowWC>()->IsSelected();
    bool showWCModification
        = m_state.GetOptions()->GetOption<CShowWCModification>()->IsSelected();
    bool result = newFullHistory->FetchRevisionData ( path
                                                    , pegRevision
                                                    , showWCRev
                                                    , showWCModification
                                                    , progress
                                                    , pTaskbarList
                                                    , hWnd);

    m_state.SetLastErrorMessage (newFullHistory->GetLastErrorMessage());

    if (result)
    {
        std::unique_ptr<CFullGraph> newFullGraph (new CFullGraph());

        CFullGraphBuilder builder (*newFullHistory, *newFullGraph);
        builder.Run();

        CFullGraphFinalizer finalizer (*newFullHistory, *newFullGraph);
        finalizer.Run();

        m_state.SetQueryResult ( newFullHistory
                               , newFullGraph
                               , showWCRev || showWCModification);
    }

    return result;
}
コード例 #2
0
void CEditPropExternals::OnBnClickedFindhead()
{
    CProgressDlg progDlg;
    progDlg.ShowModal(m_hWnd, TRUE);
    progDlg.SetTitle(IDS_EDITPROPS_PROG_FINDHEADTITLE);
    progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_EDITPROPS_PROG_FINDHEADROOTS)));
    DWORD count = 0;
    DWORD total = (DWORD)m_externals.size()*4;
    SVN svn;
    svn.SetPromptParentWindow(m_hWnd);
    SVNInfo svnInfo;
    svnInfo.SetPromptParentWindow(m_hWnd);
    for (auto it = m_externals.begin(); it != m_externals.end(); ++it)
    {
        progDlg.SetProgress(count++, total);
        if (progDlg.HasUserCancelled())
            break;
        if (it->root.IsEmpty())
        {
            CTSVNPath p = it->path;
            p.AppendPathString(it->targetDir);
            it->root = svn.GetRepositoryRoot(p);
        }
    }

    progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_EDITPROPS_PROG_FINDHEADREVS)));
    SVNLogHelper logHelper;
    for (auto it = m_externals.begin(); it != m_externals.end(); ++it)
    {
        progDlg.SetProgress(count, total);
        progDlg.SetLine(2, it->url, true);
        if (progDlg.HasUserCancelled())
            break;
        count += 4;
        if (!it->root.IsEmpty())
        {
            auto youngestRev = logHelper.GetYoungestRev(CTSVNPath(it->fullurl));
            if (!youngestRev.IsValid())
                it->headrev = svn.GetHEADRevision(CTSVNPath(it->fullurl), true);
            else
                it->headrev = youngestRev;
        }
    }
    progDlg.Stop();
    m_ExtList.Invalidate();
}
コード例 #3
0
BOOL CEditPropExternals::OnInitDialog()
{
    CResizableStandAloneDialog::OnInitDialog();
    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

    ExtendFrameIntoClientArea(IDC_EXTERNALSLIST);
    m_aeroControls.SubclassControl(this, IDC_ADD);
    m_aeroControls.SubclassControl(this, IDC_EDIT);
    m_aeroControls.SubclassControl(this, IDC_REMOVE);
    m_aeroControls.SubclassControl(this, IDC_FINDHEAD);
    m_aeroControls.SubclassOkCancelHelp(this);

    ATLASSERT(m_pathList.GetCount() == 1);

    SVN svn;
    m_url = CTSVNPath(svn.GetURLFromPath(m_pathList[0]));
    m_repoRoot = CTSVNPath(svn.GetRepositoryRoot(m_pathList[0]));

    m_externals.Add(m_pathList[0], m_PropValue, false);

    DWORD exStyle = LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER;
    m_ExtList.SetExtendedStyle(exStyle);

    SetWindowTheme(m_ExtList.GetSafeHwnd(), L"Explorer", NULL);

    m_ExtList.SetRedraw(false);
    m_ExtList.DeleteAllItems();

    int c = m_ExtList.GetHeaderCtrl()->GetItemCount()-1;
    while (c>=0)
        m_ExtList.DeleteColumn(c--);
    CString temp;
    temp.LoadString(IDS_STATUSLIST_COLFILE);
    m_ExtList.InsertColumn(0, temp);
    temp.LoadString(IDS_STATUSLIST_COLURL);
    m_ExtList.InsertColumn(1, temp);
    temp.LoadString(IDS_EXTERNALS_PEG);
    m_ExtList.InsertColumn(2, temp);
    temp.LoadString(IDS_EXTERNALS_OPERATIVE);
    m_ExtList.InsertColumn(3, temp);
    temp.LoadString(IDS_EXTERNALS_HEADREV);
    m_ExtList.InsertColumn(4, temp);
    m_ExtList.SetItemCountEx((int)m_externals.size());

    CRect rect;
    m_ExtList.GetClientRect(&rect);
    m_ExtList.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
    int cx = (rect.Width()-240-m_ExtList.GetColumnWidth(0));
    m_ExtList.SetColumnWidth(1, cx);
    m_ExtList.SetColumnWidth(2, 80);
    m_ExtList.SetColumnWidth(3, 80);
    m_ExtList.SetColumnWidth(4, 80);

    m_ExtList.SetRedraw(true);

    CString sWindowTitle;
    GetWindowText(sWindowTitle);
    CAppUtils::SetWindowTitle(m_hWnd, m_pathList.GetCommonRoot().GetUIPathString(), sWindowTitle);

    AddAnchor(IDC_EXTERNALSLIST, TOP_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_ADD, BOTTOM_LEFT);
    AddAnchor(IDC_EDIT, BOTTOM_LEFT);
    AddAnchor(IDC_REMOVE, BOTTOM_LEFT);
    AddAnchor(IDC_FINDHEAD, BOTTOM_LEFT);
    AddAnchor(IDOK, BOTTOM_RIGHT);
    AddAnchor(IDCANCEL, BOTTOM_RIGHT);
    AddAnchor(IDHELP, BOTTOM_RIGHT);
    EnableSaveRestore(L"EditPropsExternals");

    return TRUE;
}
コード例 #4
0
void CEditPropExternals::OnContextMenu(CWnd* /*pWnd*/, CPoint point)
{
    int selIndex = m_ExtList.GetSelectionMark();
    if (selIndex < 0)
        return; // nothing selected, nothing to do with a context menu
    int selCount = m_ExtList.GetSelectedCount();
    if (selCount <= 0)
        return; // nothing selected, nothing to do with a context menu

    // if the context menu is invoked through the keyboard, we have to use
    // a calculated position on where to anchor the menu on
    if ((point.x == -1) && (point.y == -1))
    {
        CRect rect;
        m_ExtList.GetItemRect(selIndex, &rect, LVIR_LABEL);
        m_ExtList.ClientToScreen(&rect);
        point = rect.CenterPoint();
    }

    bool haveHead = true;

    POSITION pos = m_ExtList.GetFirstSelectedItemPosition();
    while (pos)
    {
        int index = m_ExtList.GetNextSelectedItem(pos);
        if ((index >= 0)&&(index < (int)m_externals.size()))
        {
            if (m_externals[index].headrev == SVN_INVALID_REVNUM)
            {
                haveHead = false;
                break;
            }
        }
    }

    CIconMenu popup;
    if (popup.CreatePopupMenu())
    {
        if (haveHead)
            popup.AppendMenuIcon(CMD_ADJUST, IDS_EDITPROPS_ADJUST_TO_HEAD);
        else
            popup.AppendMenuIcon(CMD_FETCH_AND_ADJUST, IDS_EDITPROPS_FETCH_AND_ADJUST_TO_HEAD);

        int cmd = popup.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON, point.x, point.y, this, 0);

        switch (cmd)
        {
        case CMD_FETCH_AND_ADJUST:
            {
                SVN svn;
                svn.SetPromptParentWindow(m_hWnd);
                SVNInfo svnInfo;
                svnInfo.SetPromptParentWindow(m_hWnd);
                SVNLogHelper logHelper;
                CProgressDlg progDlg;
                progDlg.ShowModal(m_hWnd, TRUE);
                progDlg.SetTitle(IDS_EDITPROPS_PROG_FINDHEADTITLE);
                progDlg.SetLine(1, CString(MAKEINTRESOURCE(IDS_EDITPROPS_PROG_FINDHEADREVS)));
                DWORD count = 0;
                DWORD total = m_ExtList.GetSelectedCount();
                POSITION p = m_ExtList.GetFirstSelectedItemPosition();
                while (p)
                {
                    int index = m_ExtList.GetNextSelectedItem(p);
                    progDlg.SetProgress(count++, total);
                    if ((index >= 0)&&(index < (int)m_externals.size()))
                    {
                        progDlg.SetLine(2, m_externals[index].url, true);
                        if (m_externals[index].headrev == SVN_INVALID_REVNUM)
                        {
                            if (m_externals[index].root.IsEmpty())
                            {
                                CTSVNPath path_ = m_externals[index].path;
                                path_.AppendPathString(m_externals[index].targetDir);
                                m_externals[index].root = svn.GetRepositoryRoot(path_);
                            }
                            auto fullurl = CTSVNPath(m_externals[index].fullurl);
                            auto youngestRev = logHelper.GetYoungestRev(fullurl);
                            if (!youngestRev.IsValid())
                                m_externals[index].headrev = svn.GetHEADRevision(fullurl, true);
                            else
                                m_externals[index].headrev = youngestRev;
                        }
                    }
                }
                progDlg.Stop();
            }
            // intentional fall through
        case CMD_ADJUST:
            {
                POSITION p = m_ExtList.GetFirstSelectedItemPosition();
                while (p)
                {
                    int index = m_ExtList.GetNextSelectedItem(p);
                    if ((index >= 0)&&(index < (int)m_externals.size()))
                    {
                        if (m_externals[index].headrev != SVN_INVALID_REVNUM)
                        {
                            if (m_externals[index].revision.kind == svn_opt_revision_number)
                            {
                                m_externals[index].revision.value.number = -1;
                                m_externals[index].revision.kind = svn_opt_revision_unspecified;
                            }
                            m_externals[index].pegrevision.value.number = m_externals[index].headrev;
                            m_externals[index].pegrevision.kind = svn_opt_revision_number;
                        }
                    }
                }
                m_ExtList.Invalidate();
            }
            break;
        }
    }
}