OSDN Git Service

Use unified Version Choose Code
authorFrank Li <lznuaa@gmail.com>
Thu, 25 Dec 2008 05:08:05 +0000 (13:08 +0800)
committerFrank Li <lznuaa@gmail.com>
Thu, 25 Dec 2008 05:08:05 +0000 (13:08 +0800)
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/ChooseVersion.h [new file with mode: 0644]
src/TortoiseProc/CreateBranchTagDlg.cpp
src/TortoiseProc/ExportDlg.cpp
src/TortoiseProc/ExportDlg.h
src/TortoiseProc/GitSwitchDlg.cpp
src/TortoiseProc/GitSwitchDlg.h
src/TortoiseProc/TortoiseProc.vcproj
src/TortoiseProc/TortoiseProc.vcproj.FSL.B20596.user
src/TortoiseProc/resource.h

index 9c1a634..64590c0 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
diff --git a/src/TortoiseProc/ChooseVersion.h b/src/TortoiseProc/ChooseVersion.h
new file mode 100644 (file)
index 0000000..f39e99c
--- /dev/null
@@ -0,0 +1,101 @@
+#pragma once\r
+#include "afxwin.h"\r
+\r
+class CChooseVersion\r
+{\r
+private:\r
+       CWnd *  m_pWin;\r
+protected:\r
+       CHistoryCombo m_ChooseVersioinBranch;  \r
+       CHistoryCombo m_ChooseVersioinTags;    \r
+       CHistoryCombo m_ChooseVersioinVersion; \r
+\r
+       afx_msg void OnBnClickedChooseRadio() \r
+       {\r
+               this->m_ChooseVersioinTags.EnableWindow(FALSE);                                                                                                 \r
+               this->m_ChooseVersioinBranch.EnableWindow(FALSE);                                       \r
+               this->m_ChooseVersioinVersion.EnableWindow(FALSE);                              \r
+               int radio=m_pWin->GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);\r
+               switch (radio)                                                                                  \r
+               {                                                                                                                       \r
+               case IDC_RADIO_HEAD:                                                                            \r
+                       break;                                                                                                  \r
+               case IDC_RADIO_BRANCH:                                                                          \r
+                       this->m_ChooseVersioinBranch.EnableWindow(TRUE);                                                \r
+                       break;                                                                                                  \r
+               case IDC_RADIO_TAGS:                                                                            \r
+                       this->m_ChooseVersioinTags.EnableWindow(TRUE);                                          \r
+                       break;                                                                                                  \r
+               case IDC_RADIO_VERSION:                                                                         \r
+                       this->m_ChooseVersioinVersion.EnableWindow(TRUE);                                               \r
+               break;          \r
+               }\r
+       }\r
+       void UpdateRevsionName()\r
+       {                                                                                                                                                       \r
+               int radio=m_pWin->GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);              \r
+               switch (radio)                                                                                                                  \r
+               {                                                                                                                                               \r
+               case IDC_RADIO_HEAD:                                                                                                    \r
+                       this->m_VersionName=_T("HEAD");                                                                                 \r
+                       break;                                                                                                                          \r
+               case IDC_RADIO_BRANCH:                                                                                                  \r
+                       this->m_VersionName=m_ChooseVersioinBranch.GetString();                                                                 \r
+                       break;                                                                                                                          \r
+               case IDC_RADIO_TAGS:                                                                                                    \r
+                       this->m_VersionName=m_ChooseVersioinTags.GetString();                                                                   \r
+                       break;                                                                                                                          \r
+               case IDC_RADIO_VERSION:                                                                                                 \r
+                       this->m_VersionName=m_ChooseVersioinVersion.GetString();                                                                        \r
+                       break;  \r
+               }\r
+       }                       \r
+       void SetDefaultChoose(int id)\r
+       {\r
+               m_pWin->CheckRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION,id);\r
+               OnBnClickedChooseRadio();\r
+       }\r
+\r
+       void Init()\r
+       {\r
+               CStringList list;\r
+               g_Git.GetTagList(list);\r
+               m_ChooseVersioinTags.AddString(list);\r
+\r
+               list.RemoveAll();\r
+               int current;\r
+               g_Git.GetBranchList(list,&current,CGit::BRANCH_ALL);\r
+               m_ChooseVersioinBranch.AddString(list);\r
+               m_ChooseVersioinBranch.SetCurSel(current);\r
+       }\r
+public:                                        \r
+       CString m_VersionName;\r
+       CChooseVersion(CWnd *win)\r
+       {\r
+               m_pWin=win;\r
+       };\r
+\r
+};\r
+\r
+\r
+#define CHOOSE_VERSION_DDX \\r
+       DDX_Control(pDX, IDC_COMBOBOXEX_BRANCH,         m_ChooseVersioinBranch); \\r
+       DDX_Control(pDX, IDC_COMBOBOXEX_TAGS,           m_ChooseVersioinTags);     \\r
+       DDX_Control(pDX, IDC_COMBOBOXEX_VERSION,        m_ChooseVersioinVersion);\r
+\r
+#define CHOOSE_VERSION_EVENT\\r
+       ON_BN_CLICKED(IDC_RADIO_HEAD,           OnBnClickedChooseRadioHost)\\r
+       ON_BN_CLICKED(IDC_RADIO_BRANCH,         OnBnClickedChooseRadioHost)\\r
+       ON_BN_CLICKED(IDC_RADIO_TAGS,           OnBnClickedChooseRadioHost)\\r
+       ON_BN_CLICKED(IDC_RADIO_VERSION,        OnBnClickedChooseRadioHost)\r
+\r
+#define CHOOSE_VERSION_ADDANCHOR                                                               \\r
+       {                                                                                                                       \\r
+               AddAnchor(IDC_COMBOBOXEX_BRANCH, TOP_LEFT, TOP_RIGHT);  \\r
+               AddAnchor(IDC_COMBOBOXEX_TAGS, TOP_LEFT, TOP_RIGHT);    \\r
+               AddAnchor(IDC_COMBOBOXEX_VERSION, TOP_LEFT, TOP_RIGHT); \\r
+               AddAnchor(IDC_GROUP_BASEON, TOP_LEFT, TOP_RIGHT);               \\r
+       }       \r
+\r
+#define CHOOSE_EVENT_RADIO() \\r
+       afx_msg void OnBnClickedChooseRadioHost(){OnBnClickedChooseRadio();}\r
index 565456c..3a54fbb 100644 (file)
@@ -51,9 +51,10 @@ BOOL CCreateBranchTagDlg::OnInitDialog()
        AddAnchor(IDC_COMBOBOXEX_BRANCH, TOP_LEFT, TOP_RIGHT);\r
        AddAnchor(IDC_COMBOBOXEX_TAGS, TOP_LEFT, TOP_RIGHT);\r
        AddAnchor(IDC_COMBOBOXEX_VERSION, TOP_LEFT, TOP_RIGHT);\r
+       AddAnchor(IDC_GROUP_BASEON, TOP_LEFT, TOP_RIGHT);\r
 \r
        AddAnchor(IDC_GROUP_BRANCH, TOP_LEFT, TOP_RIGHT);\r
-       AddAnchor(IDC_GROUP_BASEON, TOP_LEFT, TOP_RIGHT);\r
+       \r
        AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);\r
 \r
        AddAnchor(IDOK,BOTTOM_RIGHT);\r
index f4f2a26..7858f24 100644 (file)
@@ -29,7 +29,8 @@
 IMPLEMENT_DYNAMIC(CExportDlg, CResizableStandAloneDialog)\r
 CExportDlg::CExportDlg(CWnd* pParent /*=NULL*/)\r
        : CResizableStandAloneDialog(CExportDlg::IDD, pParent)\r
-       , Revision(_T("HEAD"))\r
+       , CChooseVersion(this)\r
+       , m_Revision(_T("HEAD"))\r
        , m_strExportDirectory(_T(""))\r
        , m_sExportDirOrig(_T(""))\r
        , m_bNoExternals(FALSE)\r
@@ -46,28 +47,21 @@ CExportDlg::~CExportDlg()
 void CExportDlg::DoDataExchange(CDataExchange* pDX)\r
 {\r
        CResizableStandAloneDialog::DoDataExchange(pDX);\r
-//     DDX_Control(pDX, IDC_URLCOMBO, m_URLCombo);\r
-       DDX_Control(pDX, IDC_REVISION_NUM, m_editRevision);\r
-//     DDX_Control(pDX, IDC_BROWSE, m_butBrowse);\r
-       DDX_Text(pDX, IDC_REVISION_NUM, m_sRevision);\r
        DDX_Text(pDX, IDC_CHECKOUTDIRECTORY, m_strExportDirectory);\r
-//     DDX_Check(pDX, IDC_NOEXTERNALS, m_bNoExternals);\r
        DDX_Control(pDX, IDC_CHECKOUTDIRECTORY, m_cCheckoutEdit);\r
-//     DDX_Control(pDX, IDC_EOLCOMBO, m_eolCombo);\r
-//     DDX_Control(pDX, IDC_DEPTH, m_depthCombo);\r
+\r
+       CHOOSE_VERSION_DDX;\r
+\r
 }\r
 \r
 \r
 BEGIN_MESSAGE_MAP(CExportDlg, CResizableStandAloneDialog)\r
        ON_REGISTERED_MESSAGE(WM_REVSELECTED, OnRevSelected)\r
-       ON_BN_CLICKED(IDC_BROWSE, OnBnClickedBrowse)\r
        ON_BN_CLICKED(IDC_CHECKOUTDIRECTORY_BROWSE, OnBnClickedCheckoutdirectoryBrowse)\r
        ON_EN_CHANGE(IDC_CHECKOUTDIRECTORY, OnEnChangeCheckoutdirectory)\r
        ON_BN_CLICKED(IDHELP, OnBnClickedHelp)\r
-       ON_BN_CLICKED(IDC_SHOW_LOG, OnBnClickedShowlog)\r
-       ON_EN_CHANGE(IDC_REVISION_NUM, &CExportDlg::OnEnChangeRevisionNum)\r
-       ON_CBN_SELCHANGE(IDC_EOLCOMBO, &CExportDlg::OnCbnSelchangeEolcombo)\r
-       ON_CBN_EDITCHANGE(IDC_URLCOMBO, &CExportDlg::OnCbnEditchangeUrlcombo)\r
+\r
+       CHOOSE_VERSION_EVENT\r
 END_MESSAGE_MAP()\r
 \r
 BOOL CExportDlg::OnInitDialog()\r
@@ -77,78 +71,23 @@ BOOL CExportDlg::OnInitDialog()
        m_sExportDirOrig = m_strExportDirectory;\r
        m_bAutoCreateTargetName = !PathIsDirectoryEmpty(m_sExportDirOrig);\r
 \r
-//     AdjustControlSize(IDC_NOEXTERNALS);\r
-       AdjustControlSize(IDC_REVISION_HEAD);\r
-       AdjustControlSize(IDC_REVISION_N);\r
-\r
        AddAnchor(IDC_REPOGROUP, TOP_LEFT, TOP_RIGHT);\r
-//     AddAnchor(IDC_REPOLABEL, TOP_LEFT);\r
-//     AddAnchor(IDC_URLCOMBO, TOP_LEFT, TOP_RIGHT);\r
-//     AddAnchor(IDC_BROWSE, TOP_RIGHT);\r
        AddAnchor(IDC_EXPORT_CHECKOUTDIR, TOP_LEFT);\r
        AddAnchor(IDC_CHECKOUTDIRECTORY, TOP_LEFT, TOP_RIGHT);\r
-//     AddAnchor(IDC_CHECKOUTDIRECTORY_BROWSE, TOP_RIGHT);\r
-//     AddAnchor(IDC_DEPTH, TOP_LEFT, TOP_RIGHT);\r
-//     AddAnchor(IDC_NOEXTERNALS, TOP_LEFT);\r
-//     AddAnchor(IDC_EOLLABEL, TOP_LEFT);\r
-//     AddAnchor(IDC_EOLCOMBO, TOP_LEFT);\r
-\r
-       AddAnchor(IDC_REVISIONGROUP, TOP_LEFT, BOTTOM_RIGHT);\r
-       AddAnchor(IDC_REVISION_HEAD, TOP_LEFT);\r
-       AddAnchor(IDC_REVISION_N, TOP_LEFT);\r
-       AddAnchor(IDC_REVISION_NUM, TOP_LEFT);\r
-       AddAnchor(IDC_SHOW_LOG, TOP_LEFT);\r
 \r
        AddAnchor(IDOK, BOTTOM_RIGHT);\r
        AddAnchor(IDCANCEL, BOTTOM_RIGHT);\r
        AddAnchor(IDHELP, BOTTOM_RIGHT);\r
 \r
-       //m_URLCombo.SetURLHistory(TRUE);\r
-       //m_URLCombo.LoadHistory(_T("Software\\TortoiseSVN\\History\\repoURLS"), _T("url"));\r
-       //m_URLCombo.SetCurSel(0);\r
-\r
-       if (!m_URL.IsEmpty())\r
-       {\r
-               m_URLCombo.SetWindowText(m_URL);\r
-       }\r
-\r
-//     m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_INFINITE)));\r
-//     m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_IMMEDIATE)));\r
-//     m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_FILES)));\r
-//     m_depthCombo.AddString(CString(MAKEINTRESOURCE(IDS_SVN_DEPTH_EMPTY)));\r
-//     m_depthCombo.SetCurSel(0);\r
-\r
-       // set radio buttons according to the revision\r
-       SetRevision(Revision);\r
-\r
-       m_editRevision.SetWindowText(_T(""));\r
-\r
-       if (!m_URL.IsEmpty())\r
-               m_URLCombo.SetWindowText(m_URL);\r
+       CHOOSE_VERSION_ADDANCHOR;\r
+       Init();\r
+       SetDefaultChoose(IDC_RADIO_HEAD);\r
 \r
        m_tooltips.Create(this);\r
        m_tooltips.AddTool(IDC_CHECKOUTDIRECTORY, IDS_CHECKOUT_TT_DIR);\r
-//     m_tooltips.AddTool(IDC_EOLCOMBO, IDS_EXPORT_TT_EOL);\r
 \r
        SHAutoComplete(GetDlgItem(IDC_CHECKOUTDIRECTORY)->m_hWnd, SHACF_FILESYSTEM);\r
 \r
-       // fill the combobox with the choices of eol styles\r
-       //m_eolCombo.AddString(_T("default"));\r
-       //m_eolCombo.AddString(_T("CRLF"));\r
-       //m_eolCombo.AddString(_T("LF"));\r
-       //m_eolCombo.AddString(_T("CR"));\r
-       //m_eolCombo.SelectString(0, _T("default"));\r
-\r
-       if (Revision==_T("HEAD"))\r
-       {\r
-               // if the revision is not HEAD, change the radio button and\r
-               // fill in the revision in the edit box\r
-               CString temp;\r
-               temp.Format(_T("%s"), Revision);\r
-               m_editRevision.SetWindowText(temp);\r
-               CheckRadioButton(IDC_REVISION_HEAD, IDC_REVISION_N, IDC_REVISION_N);\r
-       }\r
-\r
        if ((m_pParentWnd==NULL)&&(hWndExplorer))\r
                CenterWindow(CWnd::FromHandle(hWndExplorer));\r
        EnableSaveRestore(_T("ExportDlg"));\r
@@ -161,110 +100,21 @@ void CExportDlg::OnOK()
                return; // don't dismiss dialog (error message already shown by MFC framework)\r
 \r
        // check it the export path is a valid windows path\r
-#if 0\r
-       CTSVNPath ExportDirectory;\r
-       if (::PathIsRelative(m_strExportDirectory))\r
-       {\r
-               ExportDirectory = CTSVNPath(sOrigCWD);\r
-               ExportDirectory.AppendPathString(_T("\\") + m_strExportDirectory);\r
-               m_strExportDirectory = ExportDirectory.GetWinPathString();\r
-       }\r
-       else\r
-               ExportDirectory = CTSVNPath(m_strExportDirectory);\r
-       if (!ExportDirectory.IsValidOnWindows())\r
-       {\r
-               ShowBalloon(IDC_CHECKOUTDIRECTORY, IDS_ERR_NOVALIDPATH);\r
-               return;\r
-       }\r
-#endif\r
-       // check if the specified revision is valid\r
-       if (GetCheckedRadioButton(IDC_REVISION_HEAD, IDC_REVISION_N) == IDC_REVISION_HEAD)\r
-       {\r
-               Revision = _T("HEAD");\r
-       }\r
-       else\r
-               Revision = m_sRevision;\r
+       UpdateRevsionName();\r
 \r
-#if 0\r
-       if (!Revision.IsValid())\r
+       if (m_VersionName.IsEmpty())\r
        {\r
                ShowBalloon(IDC_REVISION_NUM, IDS_ERR_INVALIDREV);\r
                return;\r
        }\r
-#endif\r
+\r
        bool bAutoCreateTargetName = m_bAutoCreateTargetName;\r
        m_bAutoCreateTargetName = false;\r
 \r
        m_URLCombo.SaveHistory();\r
        m_URL = m_URLCombo.GetString();\r
 \r
-       // we need an url to export from - local paths won't work\r
-#if 0\r
-       if (!SVN::PathIsURL(CTSVNPath(m_URL)))\r
-       {\r
-               ShowBalloon(IDC_URLCOMBO, IDS_ERR_MUSTBEURL, IDI_ERROR);\r
-               m_bAutoCreateTargetName = bAutoCreateTargetName;\r
-               return;\r
-       }\r
 \r
-       if (m_strExportDirectory.IsEmpty())\r
-       {\r
-               m_bAutoCreateTargetName = bAutoCreateTargetName;\r
-               return;\r
-       }\r
-\r
-       // if the export directory does not exist, where should we export to?\r
-       // We ask if the directory should be created...\r
-       if (!PathFileExists(m_strExportDirectory))\r
-       {\r
-               CString temp;\r
-               temp.Format(IDS_WARN_FOLDERNOTEXIST, (LPCTSTR)m_strExportDirectory);\r
-               if (CMessageBox::Show(this->m_hWnd, temp, _T("TortoiseSVN"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
-               {\r
-                       CPathUtils::MakeSureDirectoryPathExists(m_strExportDirectory);\r
-               }\r
-               else\r
-               {\r
-                       m_bAutoCreateTargetName = bAutoCreateTargetName;\r
-                       return;\r
-               }\r
-       }\r
-\r
-       // if the directory we should export to is not empty, show a warning:\r
-       // maybe the user doesn't want to overwrite the existing files.\r
-       if (!PathIsDirectoryEmpty(m_strExportDirectory))\r
-       {\r
-               CString message;\r
-               message.Format(CString(MAKEINTRESOURCE(IDS_WARN_FOLDERNOTEMPTY)),(LPCTSTR)m_strExportDirectory);\r
-               if (CMessageBox::Show(this->m_hWnd, message, _T("TortoiseSVN"), MB_YESNO | MB_ICONQUESTION) != IDYES)\r
-               {\r
-                       m_bAutoCreateTargetName = bAutoCreateTargetName;\r
-                       return;\r
-               }\r
-       }\r
-       m_eolCombo.GetWindowText(m_eolStyle);\r
-       if (m_eolStyle.Compare(_T("default"))==0)\r
-               m_eolStyle.Empty();\r
-\r
-       switch (m_depthCombo.GetCurSel())\r
-       {\r
-       case 0:\r
-               m_depth = svn_depth_infinity;\r
-               break;\r
-       case 1:\r
-               m_depth = svn_depth_immediates;\r
-               break;\r
-       case 2:\r
-               m_depth = svn_depth_files;\r
-               break;\r
-       case 3:\r
-               m_depth = svn_depth_empty;\r
-               break;\r
-       default:\r
-               m_depth = svn_depth_empty;\r
-               break;\r
-       }\r
-#endif\r
        UpdateData(FALSE);\r
        CResizableStandAloneDialog::OnOK();\r
 }\r
@@ -272,20 +122,7 @@ void CExportDlg::OnOK()
 void CExportDlg::OnBnClickedBrowse()\r
 {\r
        m_tooltips.Pop();       // hide the tooltips\r
-#if 0\r
-       SVNRev rev;\r
-       UpdateData();\r
-       if (GetCheckedRadioButton(IDC_REVISION_HEAD, IDC_REVISION_N) == IDC_REVISION_HEAD)\r
-       {\r
-               rev = SVNRev::REV_HEAD;\r
-       }\r
-       else\r
-               rev = SVNRev(m_sRevision);\r
-       if (!rev.IsValid())\r
-               rev = SVNRev::REV_HEAD;\r
-       CAppUtils::BrowseRepository(m_URLCombo, this, rev);\r
-       SetRevision(rev);\r
-#endif\r
+\r
 }\r
 \r
 void CExportDlg::OnBnClickedCheckoutdirectoryBrowse()\r
@@ -330,26 +167,7 @@ void CExportDlg::OnBnClickedHelp()
 void CExportDlg::OnBnClickedShowlog()\r
 {\r
        m_tooltips.Pop();       // hide the tooltips\r
-#if 0\r
-       UpdateData(TRUE);\r
-       m_URL = m_URLCombo.GetString();\r
-       if ((m_pLogDlg)&&(m_pLogDlg->IsWindowVisible()))\r
-               return;\r
-       AfxGetApp()->DoWaitCursor(1);\r
-       //now show the log dialog for working copy\r
-       if (!m_URL.IsEmpty())\r
-       {\r
-               delete m_pLogDlg;\r
-               m_pLogDlg = new CLogDlg();\r
-               m_pLogDlg->SetParams(CTSVNPath(m_URL), SVNRev::REV_HEAD, SVNRev::REV_HEAD, 1, (int)(DWORD)CRegDWORD(_T("Software\\TortoiseSVN\\NumberOfLogs"), 100));\r
-               m_pLogDlg->m_wParam = 1;\r
-               m_pLogDlg->SetSelect(true);\r
-               m_pLogDlg->m_pNotifyWindow = this;\r
-               m_pLogDlg->Create(IDD_LOGMESSAGE, this);\r
-               m_pLogDlg->ShowWindow(SW_SHOW);\r
-       }\r
-       AfxGetApp()->DoWaitCursor(-1);\r
-#endif\r
+\r
 }\r
 \r
 LPARAM CExportDlg::OnRevSelected(WPARAM /*wParam*/, LPARAM lParam)\r
index 14308fe..8da3961 100644 (file)
 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
 //\r
 #pragma once\r
+#include "afxwin.h"\r
 #include "GitRev.h"\r
 #include "StandAloneDlg.h"\r
 #include "HistoryCombo.h"\r
 #include "FileDropEdit.h"\r
 #include "LogDlg.h"\r
 #include "Tooltip.h"\r
-#include "afxwin.h"\r
-\r
+#include "ChooseVersion.h"\r
 \r
 /**\r
  * \ingroup TortoiseProc\r
  * Prompts the user for required information for an export command. The information\r
  * is the module name and the repository url. \r
  */\r
-class CExportDlg : public CResizableStandAloneDialog\r
+class CExportDlg : public CResizableStandAloneDialog, public CChooseVersion\r
 {\r
        DECLARE_DYNAMIC(CExportDlg)\r
 \r
@@ -68,11 +68,14 @@ protected:
        CString                 m_sExportDirOrig;\r
        bool                    m_bAutoCreateTargetName;\r
        CComboBox               m_depthCombo;\r
+\r
+       CHOOSE_EVENT_RADIO()    ;\r
+\r
 public:\r
        CHistoryCombo   m_URLCombo;\r
        CString                 m_URL;\r
        CString                 m_eolStyle;\r
-       CString                 Revision;\r
+       CString                 m_Revision;\r
        BOOL                    m_bNoExternals;\r
        CButton                 m_butBrowse;\r
        CEdit                   m_editRevision;\r
index 770bc41..71d70e2 100644 (file)
@@ -2,10 +2,11 @@
 //\r
 \r
 #include "stdafx.h"\r
+#include "Git.h"\r
 #include "TortoiseProc.h"\r
 #include "GitSwitchDlg.h"\r
 \r
-#include "Git.h"\r
+\r
 #include "Messagebox.h"\r
 \r
 // CGitSwitchDlg dialog\r
@@ -14,6 +15,7 @@ IMPLEMENT_DYNAMIC(CGitSwitchDlg, CResizableStandAloneDialog)
 \r
 CGitSwitchDlg::CGitSwitchDlg(CWnd* pParent /*=NULL*/)\r
        : CResizableStandAloneDialog(CGitSwitchDlg::IDD, pParent)\r
+       ,CChooseVersion(this)\r
 {\r
        m_bBranch=FALSE;\r
 }\r
@@ -25,9 +27,7 @@ CGitSwitchDlg::~CGitSwitchDlg()
 void CGitSwitchDlg::DoDataExchange(CDataExchange* pDX)\r
 {\r
        CDialog::DoDataExchange(pDX);\r
-       DDX_Control(pDX, IDC_COMBOBOXEX_BRANCH, this->m_Branch);\r
-       DDX_Control(pDX, IDC_COMBOBOXEX_TAGS, this->m_Tags);\r
-       DDX_Control(pDX, IDC_COMBOBOXEX_VERSION, this->m_Version);\r
+       CHOOSE_VERSION_DDX;\r
                                \r
        DDX_Check(pDX,IDC_CHECK_FORCE,this->m_bForce);\r
        DDX_Check(pDX,IDC_CHECK_TRACK,this->m_bTrack);\r
@@ -38,9 +38,8 @@ void CGitSwitchDlg::DoDataExchange(CDataExchange* pDX)
 \r
 \r
 BEGIN_MESSAGE_MAP(CGitSwitchDlg, CResizableStandAloneDialog)\r
-       ON_BN_CLICKED(IDC_RADIO_BRANCH, &CGitSwitchDlg::OnBnClickedRadio)\r
-       ON_BN_CLICKED(IDC_RADIO_TAGS, &CGitSwitchDlg::OnBnClickedRadio)\r
-       ON_BN_CLICKED(IDC_RADIO_VERSION, &CGitSwitchDlg::OnBnClickedRadio)\r
+\r
+       CHOOSE_VERSION_EVENT\r
        ON_BN_CLICKED(IDC_CHECK_BRANCH, &CGitSwitchDlg::OnBnClickedCheckBranch)\r
        ON_BN_CLICKED(IDOK, &CGitSwitchDlg::OnBnClickedOk)\r
        ON_CBN_SELCHANGE(IDC_COMBOBOXEX_BRANCH, &CGitSwitchDlg::OnCbnSelchangeComboboxexBranch)\r
@@ -50,11 +49,6 @@ BOOL CGitSwitchDlg::OnInitDialog()
 {\r
        CResizableStandAloneDialog::OnInitDialog();\r
 \r
-       AddAnchor(IDC_COMBOBOXEX_BRANCH, TOP_LEFT, TOP_RIGHT);\r
-       AddAnchor(IDC_COMBOBOXEX_TAGS, TOP_LEFT, TOP_RIGHT);\r
-       AddAnchor(IDC_COMBOBOXEX_VERSION, TOP_LEFT, TOP_RIGHT);\r
-\r
-       AddAnchor(IDC_GROUP_BASEON, TOP_LEFT, TOP_RIGHT);\r
        AddAnchor(IDC_GROUP_OPTION, TOP_LEFT, TOP_RIGHT);\r
 \r
        AddAnchor(IDC_EDIT_BRANCH, TOP_LEFT, TOP_RIGHT);\r
@@ -63,26 +57,10 @@ BOOL CGitSwitchDlg::OnInitDialog()
        AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
 \r
 \r
-       AddAnchor(IDC_BUTTON_SHOW,TOP_RIGHT);\r
-       \r
-\r
+       CHOOSE_VERSION_ADDANCHOR;\r
+       Init();\r
+       SetDefaultChoose(IDC_RADIO_BRANCH);\r
 \r
-       CheckRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION,IDC_RADIO_BRANCH);\r
-\r
-       CStringList list;\r
-       g_Git.GetTagList(list);\r
-       m_Tags.AddString(list);\r
-\r
-       list.RemoveAll();\r
-       int current;\r
-       g_Git.GetBranchList(list,&current,CGit::BRANCH_ALL);\r
-       m_Branch.AddString(list);\r
-       m_Branch.SetCurSel(current);\r
-\r
-       m_Version.LoadHistory(_T("Software\\TortoiseGit\\History\\VersionHash"), _T("hash"));\r
-       m_Version.SetCurSel(0);\r
-\r
-       OnBnClickedRadio();\r
        OnBnClickedCheckBranch();\r
        this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
 \r
@@ -92,30 +70,13 @@ BOOL CGitSwitchDlg::OnInitDialog()
 }\r
 // CCreateBranchTagDlg message handlers\r
 \r
-void CGitSwitchDlg::OnBnClickedRadio()\r
+void CGitSwitchDlg::OnBnClickedChooseRadioHost()\r
 {\r
        // TODO: Add your control notification handler code here\r
-       this->m_Branch.EnableWindow(FALSE);\r
-       this->m_Tags.EnableWindow(FALSE);\r
-       this->m_Version.EnableWindow(FALSE);\r
-       int radio=GetCheckedRadioButton(IDC_RADIO_HEAD,IDC_RADIO_VERSION);\r
-       \r
-       switch (radio)\r
-       {\r
-       case IDC_RADIO_BRANCH:\r
-               this->m_Branch.EnableWindow(TRUE);\r
-               break;\r
-       case IDC_RADIO_TAGS:\r
-               this->m_Tags.EnableWindow(TRUE);                \r
-               break;\r
-       case IDC_RADIO_VERSION:\r
-               this->m_Version.EnableWindow(TRUE);\r
-               break;\r
-       }\r
+       OnBnClickedChooseRadio();\r
        OnCbnSelchangeComboboxexBranch();\r
        OnBnClickedCheckBranch();\r
        \r
-\r
 }\r
 \r
 void CGitSwitchDlg::OnBnClickedOk()\r
@@ -123,30 +84,8 @@ void CGitSwitchDlg::OnBnClickedOk()
        // TODO: Add your control notification handler code here\r
        this->UpdateData(TRUE);\r
        \r
-       int radio=GetCheckedRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION);\r
-       switch (radio)\r
-       {\r
-       case IDC_RADIO_BRANCH:\r
-               this->m_Base=m_Branch.GetString();\r
-               break;\r
-       case IDC_RADIO_TAGS:\r
-               this->m_Base=m_Tags.GetString();\r
-               this->m_bTrack=FALSE;\r
-               break;\r
-       case IDC_RADIO_VERSION:\r
-               this->m_Base=m_Version.GetString();\r
-               this->m_bTrack=FALSE;\r
-               break;\r
-       }\r
-       if(m_bBranch)\r
-       {\r
-               if(this->m_NewBranch.Trim().IsEmpty())\r
-               {\r
-                       CMessageBox::Show(NULL,_T("Branch can't empty"),_T("TortoiseGit"),MB_OK);\r
-                       return;\r
-               }\r
-       }\r
-       this->m_Version.SaveHistory();\r
+       \r
+       //this->m_Version.SaveHistory();\r
 \r
        OnOK();\r
 }\r
@@ -154,23 +93,23 @@ void CGitSwitchDlg::OnBnClickedCheckBranch()
 {\r
        // TODO: Add your control notification handler code here\r
        this->UpdateData(TRUE);\r
-       \r
+       this->UpdateRevsionName();\r
+       GetDlgItem(IDC_EDIT_BRANCH)->SetWindowTextW(CString(_T("Branch_"))+this->m_VersionName);\r
+\r
+#if 0  \r
        int radio=GetCheckedRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION);\r
        if(radio==IDC_RADIO_TAGS || radio==IDC_RADIO_VERSION)\r
        {\r
                this->m_bBranch=TRUE;\r
                this->UpdateData(FALSE);\r
-               if(radio==IDC_RADIO_TAGS)\r
-                       GetDlgItem(IDC_EDIT_BRANCH)->SetWindowTextW(CString(_T("Branch_"))+m_Tags.GetString());\r
-               if(radio==IDC_RADIO_VERSION)\r
-                       GetDlgItem(IDC_EDIT_BRANCH)->SetWindowTextW(CString(_T("Branch_"))+m_Version.GetString());\r
-\r
+               this->UpdateRevsionName();\r
+               \r
        }else\r
        {\r
                this->m_bBranch=FALSE;\r
                this->UpdateData(FALSE);\r
        }\r
-\r
+#endif\r
        this->GetDlgItem(IDC_EDIT_BRANCH)->EnableWindow(this->m_bBranch);\r
 }\r
 \r
@@ -178,7 +117,7 @@ void CGitSwitchDlg::OnCbnSelchangeComboboxexBranch()
 {\r
        // TODO: Add your control notification handler code here\r
        int radio=GetCheckedRadioButton(IDC_RADIO_BRANCH,IDC_RADIO_VERSION);\r
-       if(this->m_Branch.GetString().Left(6)==_T("origin") && radio==IDC_RADIO_BRANCH )\r
+       if(this->m_ChooseVersioinBranch.GetString().Left(6)==_T("origin") && radio==IDC_RADIO_BRANCH )\r
                this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(TRUE);\r
        else\r
                this->GetDlgItem(IDC_CHECK_TRACK)->EnableWindow(FALSE);\r
index 7a7925c..e4bd45d 100644 (file)
@@ -3,9 +3,10 @@
 #include "StandAloneDlg.h"\r
 #include "HistoryCombo.h"\r
 \r
+#include "ChooseVersion.h"\r
 // CGitSwitchDlg dialog\r
 \r
-class CGitSwitchDlg : public CResizableStandAloneDialog\r
+class CGitSwitchDlg : public CResizableStandAloneDialog,public CChooseVersion\r
 {\r
        DECLARE_DYNAMIC(CGitSwitchDlg)\r
 \r
@@ -25,12 +26,9 @@ public:
 protected:\r
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
        virtual BOOL OnInitDialog();\r
-       void OnBnClickedRadio();\r
        void OnBnClickedOk();\r
 \r
-       CHistoryCombo m_Branch;\r
-       CHistoryCombo m_Tags;\r
-       CHistoryCombo m_Version;\r
+       afx_msg void OnBnClickedChooseRadioHost();\r
 \r
        DECLARE_MESSAGE_MAP()\r
 public:\r
index 31d1088..0e34756 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\open.ico"\r
+                               RelativePath=".\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\open.ico"\r
+                               RelativePath="..\Resources\open.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\saveas.ico"\r
+                               RelativePath=".\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\saveas.ico"\r
+                               RelativePath="..\Resources\saveas.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath=".\ChooseVersion.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\CloneDlg.cpp"\r
                                >\r
                        </File>\r
                                RelativePath=".\SVNProgressDlg.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\SwitchLocalBranchPage.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SwitchTagPage.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\SwitchTagPage.h"\r
+                               >\r
+                       </File>\r
                </Filter>\r
                <Filter\r
                        Name="Git"\r
index 4104e04..77fc5ca 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings\r
                                Command="$(TargetPath)"\r
                                WorkingDirectory="D:\Profiles\b20596\tortoisegit"\r
-                               CommandArguments="/command:export /path:&quot;D:\\Profiles\\b20596\\buildtest\\TortoiseGit&quot;"\r
+                               CommandArguments="/command:switch /path:&quot;D:\\Profiles\\b20596\\buildtest\\TortoiseGit&quot;"\r
                                Attach="false"\r
                                DebuggerType="3"\r
                                Remote="1"\r
index 039b2c9..c9fdf42 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ