X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=src%2FTortoiseProc%2FCommitDlg.cpp;h=e1779b1a46b4f6375675175f85d26e7e865779ed;hb=fee64220d1bb410902e98837e37306e488c54e7b;hp=91987a5a5150c4a0823aecaea33c7d74623be6e4;hpb=f7bd22d1f6c96a64cc35cc064b1ee10aa6f37629;p=tortoisegit%2FTortoiseGitJp.git diff --git a/src/TortoiseProc/CommitDlg.cpp b/src/TortoiseProc/CommitDlg.cpp index 91987a5..e1779b1 100644 --- a/src/TortoiseProc/CommitDlg.cpp +++ b/src/TortoiseProc/CommitDlg.cpp @@ -82,12 +82,14 @@ void CCommitDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_SPLITTER, m_wndSplitter); DDX_Check(pDX, IDC_KEEPLISTS, m_bKeepChangeList); DDX_Check(pDX,IDC_COMMIT_AMEND,m_bCommitAmend); + DDX_Control(pDX,IDC_VIEW_PATCH,m_ctrlShowPatch); } BEGIN_MESSAGE_MAP(CCommitDlg, CResizableStandAloneDialog) ON_BN_CLICKED(IDC_SELECTALL, OnBnClickedSelectall) ON_BN_CLICKED(IDHELP, OnBnClickedHelp) ON_BN_CLICKED(IDC_SHOWUNVERSIONED, OnBnClickedShowunversioned) + ON_NOTIFY(SCN_UPDATEUI, IDC_LOGMESSAGE, OnScnUpdateUI) // ON_BN_CLICKED(IDC_HISTORY, OnBnClickedHistory) ON_BN_CLICKED(IDC_BUGTRAQBUTTON, OnBnClickedBugtraqbutton) ON_EN_CHANGE(IDC_LOGMESSAGE, OnEnChangeLogmessage) @@ -104,6 +106,8 @@ BEGIN_MESSAGE_MAP(CCommitDlg, CResizableStandAloneDialog) ON_BN_CLICKED(IDC_COMMIT_AMEND, &CCommitDlg::OnBnClickedCommitAmend) ON_BN_CLICKED(IDC_WHOLE_PROJECT, &CCommitDlg::OnBnClickedWholeProject) ON_STN_CLICKED(IDC_BUGIDLABEL, &CCommitDlg::OnStnClickedBugidlabel) + ON_COMMAND(ID_FOCUS_MESSAGE,&CCommitDlg::OnFocusMessage) + ON_STN_CLICKED(IDC_VIEW_PATCH, &CCommitDlg::OnStnClickedViewPatch) END_MESSAGE_MAP() BOOL CCommitDlg::OnInitDialog() @@ -118,6 +122,8 @@ BOOL CCommitDlg::OnInitDialog() m_regKeepChangelists = CRegDWORD(_T("Software\\TortoiseGit\\KeepChangeLists"), FALSE); m_bKeepChangeList = m_regKeepChangelists; + m_hAccel = LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_ACC_COMMITDLG)); + // GitConfig config; // m_bWholeProject = config.KeepLocks(); @@ -225,6 +231,7 @@ BOOL CCommitDlg::OnInitDialog() // AddAnchor(IDC_HISTORY, TOP_LEFT); AddAnchor(IDC_LOGMESSAGE, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_SIGNOFF, TOP_RIGHT); + AddAnchor(IDC_VIEW_PATCH,TOP_RIGHT); AddAnchor(IDC_LISTGROUP, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_SPLITTER, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT); @@ -232,6 +239,7 @@ BOOL CCommitDlg::OnInitDialog() AddAnchor(IDC_SELECTALL, BOTTOM_LEFT); AddAnchor(IDC_EXTERNALWARNING, BOTTOM_RIGHT); AddAnchor(IDC_STATISTICS, BOTTOM_LEFT, BOTTOM_RIGHT); + AddAnchor(IDC_TEXT_INFO, TOP_RIGHT); AddAnchor(IDC_WHOLE_PROJECT, BOTTOM_LEFT); AddAnchor(IDC_KEEPLISTS, BOTTOM_LEFT); AddAnchor(IDOK, BOTTOM_RIGHT); @@ -298,6 +306,8 @@ BOOL CCommitDlg::OnInitDialog() //this->m_bCommitAmend=FALSE; //this->UpdateData(FALSE); + this->m_ctrlShowPatch.SetURL(CString()); + return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } @@ -506,10 +516,11 @@ void CCommitDlg::OnOK() cmd.Format(_T("git.exe commit %s -F \"%s\""),amend, tempfile); CProgressDlg progress; + progress.m_bBufferAll=true; // improve show speed when there are many file added. progress.m_GitCmd=cmd; progress.m_bShowCommand = FALSE; // don't show the commit command progress.m_PreText = out; // show any output already generated in log window - progress.m_changeAbortButtonOnSuccessTo = "Push"; + progress.m_changeAbortButtonOnSuccessTo = _T("&Push"); DWORD userResponse = progress.DoModal(); if(progress.m_GitStatus) @@ -517,7 +528,7 @@ void CCommitDlg::OnOK() bCloseCommitDlg = false; this->Refresh(); } - else if(userResponse == IDCANCEL) + else if(userResponse == IDC_PROGRESS_BUTTON1) { //User pressed 'Push' button after successful commit. m_bPushAfterCommit=true; @@ -806,9 +817,11 @@ UINT CCommitDlg::StatusThread() void CCommitDlg::OnCancel() { m_bCancelled = true; + m_pathwatcher.Stop(); + if (m_bBlock) return; - m_pathwatcher.Stop(); + if (m_bThreadRunning) { InterlockedExchange(&m_bRunThread, FALSE); @@ -860,6 +873,14 @@ BOOL CCommitDlg::PreTranslateMessage(MSG* pMsg) { if (!m_bBlock) m_tooltips.RelayEvent(pMsg); + + if (m_hAccel) + { + int ret = TranslateAccelerator(m_hWnd, m_hAccel, pMsg); + if (ret) + return TRUE; + } + if (pMsg->message == WM_KEYDOWN) { switch (pMsg->wParam) @@ -1262,6 +1283,11 @@ void CCommitDlg::InsertMenuItems(CMenu& mPopup, int& nCmd) sMenuItemText.LoadString(IDS_COMMITDLG_POPUP_PASTELASTMESSAGE); m_nPopupPasteLastMessage = nCmd++; mPopup.AppendMenu(MF_STRING | MF_ENABLED, m_nPopupPasteLastMessage, sMenuItemText); + + sMenuItemText.LoadString(IDS_COMMITDLG_POPUP_LOGHISTORY); + m_nPopupRecentMessage = nCmd++; + mPopup.AppendMenu(MF_STRING | MF_ENABLED, m_nPopupRecentMessage, sMenuItemText); + } } @@ -1309,6 +1335,12 @@ bool CCommitDlg::HandleMenuItemClick(int cmd, CSciEdit * pSciEdit) pSciEdit->InsertText(logmsg); return true; } + + if(cmd == m_nPopupRecentMessage ) + { + OnBnClickedHistory(); + return true; + } return false; } @@ -1342,7 +1374,7 @@ void CCommitDlg::OnBnClickedHistory() m_tooltips.Pop(); // hide the tooltips if (m_pathList.GetCount() == 0) return; -#if 0 + CHistoryDlg historyDlg; historyDlg.SetHistory(m_History); if (historyDlg.DoModal() != IDOK) @@ -1364,7 +1396,7 @@ void CCommitDlg::OnBnClickedHistory() UpdateOKButton(); GetDlgItem(IDC_LOGMESSAGE)->SetFocus(); -#endif + } void CCommitDlg::OnBnClickedBugtraqbutton() @@ -1542,12 +1574,19 @@ void CCommitDlg::DoSize(int delta) RemoveAnchor(IDC_COMMIT_AMEND); RemoveAnchor(IDC_LISTGROUP); RemoveAnchor(IDC_FILELIST); + RemoveAnchor(IDC_TEXT_INFO); + RemoveAnchor(IDC_VIEW_PATCH); + CSplitterControl::ChangeHeight(&m_cLogMessage, delta, CW_TOPALIGN); CSplitterControl::ChangeHeight(GetDlgItem(IDC_MESSAGEGROUP), delta, CW_TOPALIGN); CSplitterControl::ChangeHeight(&m_ListCtrl, -delta, CW_BOTTOMALIGN); CSplitterControl::ChangeHeight(GetDlgItem(IDC_LISTGROUP), -delta, CW_BOTTOMALIGN); CSplitterControl::ChangePos(GetDlgItem(IDC_SIGNOFF),0,delta); CSplitterControl::ChangePos(GetDlgItem(IDC_COMMIT_AMEND),0,delta); + CSplitterControl::ChangePos(GetDlgItem(IDC_TEXT_INFO),0,delta); + CSplitterControl::ChangePos(GetDlgItem(IDC_VIEW_PATCH),0,delta); + + AddAnchor(IDC_VIEW_PATCH,TOP_RIGHT); AddAnchor(IDC_MESSAGEGROUP, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_LOGMESSAGE, TOP_LEFT, TOP_RIGHT); AddAnchor(IDC_SPLITTER, TOP_LEFT, TOP_RIGHT); @@ -1555,6 +1594,7 @@ void CCommitDlg::DoSize(int delta) AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_SIGNOFF,TOP_RIGHT); AddAnchor(IDC_COMMIT_AMEND,TOP_LEFT); + AddAnchor(IDC_TEXT_INFO,TOP_RIGHT); ArrangeLayout(); // adjust the minimum size of the dialog to prevent the resizing from // moving the list control too far down. @@ -1654,3 +1694,29 @@ void CCommitDlg::OnStnClickedBugidlabel() { // TODO: Add your control notification handler code here } + +void CCommitDlg::OnFocusMessage() +{ + m_cLogMessage.SetFocus(); +} + +void CCommitDlg::OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult) +{ + SCNotification *pHead =(SCNotification *)pNMHDR; + + int pos=this->m_cLogMessage.Call(SCI_GETCURRENTPOS); + int line=this->m_cLogMessage.Call(SCI_LINEFROMPOSITION,pos); + int column=this->m_cLogMessage.Call(SCI_GETCOLUMN,pos); + + CString str; + str.Format(_T("%d/%d"),line+1,column+1); + this->GetDlgItem(IDC_TEXT_INFO)->SetWindowText(str); + + if(*pResult) + *pResult=0; +} +void CCommitDlg::OnStnClickedViewPatch() +{ + // TODO: Add your control notification handler code here + this->m_ctrlShowPatch.SetWindowText(_T("Hide Patch<<")); +}