OSDN Git Service

Sync Dialog branch select basic work.
authorFrank Li <lznuaa@gmail.com>
Sun, 19 Jul 2009 15:00:06 +0000 (23:00 +0800)
committerFrank Li <lznuaa@gmail.com>
Sun, 19 Jul 2009 15:00:06 +0000 (23:00 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/SyncDlg.cpp
src/TortoiseProc/SyncDlg.h
src/TortoiseProc/TortoiseProc.vcproj
src/TortoiseProc/resource.h

index 0ed1f0e..3be546c 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index 8a52e21..2ba67e9 100644 (file)
@@ -33,7 +33,7 @@ CSyncDlg::CSyncDlg(CWnd* pParent /*=NULL*/)
        : CResizableStandAloneDialog(CSyncDlg::IDD, pParent)\r
        , m_bAutoLoadPuttyKey(FALSE)\r
 {\r
-\r
+       m_pTooltip=&this->m_tooltips;\r
 }\r
 \r
 CSyncDlg::~CSyncDlg()\r
@@ -44,8 +44,6 @@ void CSyncDlg::DoDataExchange(CDataExchange* pDX)
 {\r
        CDialog::DoDataExchange(pDX);\r
        DDX_Check(pDX, IDC_CHECK_PUTTY_KEY, m_bAutoLoadPuttyKey);\r
-       DDX_Control(pDX, IDC_COMBOBOXEX_LOCAL_BRANCH, m_ctrlLocalBranch);\r
-       DDX_Control(pDX, IDC_COMBOBOXEX_REMOTE_BRANCH, m_ctrlRemoteBranch);\r
        DDX_Control(pDX, IDC_COMBOBOXEX_URL, m_ctrlURL);\r
        DDX_Control(pDX, IDC_BUTTON_TABCTRL, m_ctrlDumyButton);\r
        DDX_Control(pDX, IDC_BUTTON_PULL, m_ctrlPull);\r
@@ -53,6 +51,8 @@ void CSyncDlg::DoDataExchange(CDataExchange* pDX)
        DDX_Control(pDX, IDC_STATIC_STATUS, m_ctrlStatus);\r
        DDX_Control(pDX, IDC_PROGRESS_SYNC, m_ctrlProgress);\r
        DDX_Control(pDX, IDC_ANIMATE_SYNC, m_ctrlAnimate);\r
+\r
+       BRANCH_COMBOX_DDX;\r
 }\r
 \r
 \r
@@ -61,6 +61,8 @@ BEGIN_MESSAGE_MAP(CSyncDlg, CResizableStandAloneDialog)
        ON_BN_CLICKED(IDC_BUTTON_PUSH, &CSyncDlg::OnBnClickedButtonPush)\r
        ON_BN_CLICKED(IDC_BUTTON_APPLY, &CSyncDlg::OnBnClickedButtonApply)\r
        ON_BN_CLICKED(IDC_BUTTON_EMAIL, &CSyncDlg::OnBnClickedButtonEmail)\r
+       ON_BN_CLICKED(IDC_BUTTON_MANAGE, &CSyncDlg::OnBnClickedButtonManage)\r
+       BRANCH_COMBOX_EVENT\r
 END_MESSAGE_MAP()\r
 \r
 \r
@@ -93,9 +95,23 @@ BOOL CSyncDlg::OnInitDialog()
 {\r
        CResizableStandAloneDialog::OnInitDialog();\r
 \r
-       AddAnchor(IDC_STATIC_REMOTE_BRANCH,TOP_RIGHT);\r
-       AddAnchor(IDC_COMBOBOXEX_REMOTE_BRANCH,TOP_RIGHT);\r
-       AddAnchor(IDC_BUTTON_REMOTE_BRANCH,TOP_RIGHT);\r
+       //Create Tabctrl\r
+       CWnd *pwnd=this->GetDlgItem(IDC_BUTTON_TABCTRL);\r
+       CRect rectDummy;\r
+       pwnd->GetWindowRect(&rectDummy);\r
+       this->ScreenToClient(rectDummy);\r
+\r
+       if (!m_ctrlTabCtrl.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, IDC_SYNC_TAB))\r
+       {\r
+               TRACE0("Failed to create output tab window\n");\r
+               return FALSE;      // fail to create\r
+       }\r
+       m_ctrlTabCtrl.SetResizeMode(CMFCTabCtrl::RESIZE_NO);\r
+\r
+       this->m_tooltips.Create(this);\r
+\r
+       AddAnchor(IDC_SYNC_TAB,TOP_LEFT,BOTTOM_RIGHT);\r
+\r
        AddAnchor(IDC_GROUP_INFO,TOP_LEFT,TOP_RIGHT);\r
        AddAnchor(IDC_COMBOBOXEX_URL,TOP_LEFT,TOP_RIGHT);\r
        AddAnchor(IDC_BUTTON_MANAGE,TOP_RIGHT);\r
@@ -108,6 +124,13 @@ BOOL CSyncDlg::OnInitDialog()
        AddAnchor(IDHELP,BOTTOM_RIGHT);\r
        AddAnchor(IDC_STATIC_STATUS,BOTTOM_LEFT);\r
        AddAnchor(IDC_ANIMATE_SYNC,TOP_RIGHT);\r
+       \r
+       BRANCH_COMBOX_ADD_ANCHOR();\r
+\r
+       CString WorkingDir=g_Git.m_CurrentDir;\r
+       WorkingDir.Replace(_T(':'),_T('_'));\r
+       m_RegKeyRemoteBranch = CString(_T("Software\\TortoiseGit\\History\\SyncBranch\\"))+WorkingDir;\r
+\r
 \r
        this->AddOthersToAnchor();\r
        // TODO:  Add extra initialization here\r
@@ -120,7 +143,7 @@ BOOL CSyncDlg::OnInitDialog()
        this->m_ctrlPull.AddEntry(CString(_T("&Fetch")));\r
        this->m_ctrlPull.AddEntry(CString(_T("Fetch&&Rebase")));\r
 \r
-       CString WorkingDir=g_Git.m_CurrentDir;\r
+       \r
        WorkingDir.Replace(_T(':'),_T('_'));\r
 \r
        CString regkey ;\r
@@ -139,6 +162,20 @@ BOOL CSyncDlg::OnInitDialog()
 \r
        EnableSaveRestore(_T("SyncDlg"));\r
 \r
+       this->LoadBranchInfo();\r
        return TRUE;  // return TRUE unless you set the focus to a control\r
        // EXCEPTION: OCX Property Pages should return FALSE\r
 }\r
+\r
+void CSyncDlg::OnBnClickedButtonManage()\r
+{\r
+       // TODO: Add your control notification handler code here\r
+       CAppUtils::LaunchRemoteSetting();\r
+}\r
+\r
+BOOL CSyncDlg::PreTranslateMessage(MSG* pMsg)\r
+{\r
+       // TODO: Add your specialized code here and/or call the base class\r
+       m_tooltips.RelayEvent(pMsg);\r
+       return __super::PreTranslateMessage(pMsg);\r
+}\r
index bf3c94b..a2222a7 100644 (file)
 #include "HistoryCombo.h"\r
 #include "MenuButton.h"\r
 #include "registry.h"\r
+#include "Balloon.h"\r
+#include "BranchCombox.h"\r
 // CSyncDlg dialog\r
+#define IDC_SYNC_TAB 0x1000000\r
 \r
-class CSyncDlg : public CResizableStandAloneDialog\r
+class CSyncDlg : public CResizableStandAloneDialog,public CBranchCombox\r
 {\r
        DECLARE_DYNAMIC(CSyncDlg)\r
 \r
@@ -40,16 +43,25 @@ public:
 \r
 protected:\r
        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+       BRANCH_COMBOX_EVENT_HANDLE();\r
 \r
        CRegDWORD m_regPullButton;\r
        CRegDWORD m_regPushButton;\r
-\r
+       CMFCTabCtrl m_ctrlTabCtrl;\r
+       CBalloon                        m_tooltips;\r
+       \r
+       void SetRemote(CString remote)\r
+       {\r
+               if(!remote.IsEmpty())\r
+               {\r
+                       this->m_ctrlURL.AddString(remote);\r
+               }\r
+       }\r
        DECLARE_MESSAGE_MAP()\r
 public:\r
        BOOL m_bAutoLoadPuttyKey;\r
-       CComboBoxEx m_ctrlLocalBranch;\r
-       CComboBoxEx m_ctrlRemoteBranch;\r
-       CComboBoxEx m_ctrlURL;\r
+       \r
+       CHistoryCombo m_ctrlURL;\r
        CButton m_ctrlDumyButton;\r
        CMenuButton m_ctrlPull;\r
        CMenuButton m_ctrlPush;\r
@@ -61,4 +73,6 @@ public:
        CProgressCtrl m_ctrlProgress;\r
        CAnimateCtrl m_ctrlAnimate;\r
        virtual BOOL OnInitDialog();\r
+       afx_msg void OnBnClickedButtonManage();\r
+       virtual BOOL PreTranslateMessage(MSG* pMsg);\r
 };\r
index e980a58..95e9e42 100644 (file)
                        Name="Utility Dialogs"\r
                        >\r
                        <File\r
+                               RelativePath=".\BranchCombox.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\ChangedDlg.cpp"\r
                                >\r
                        </File>\r
index 6e47101..50bf2eb 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ