ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CTortoiseGitBlameView::OnFilePrintPreview)\r
ON_WM_CREATE()\r
ON_WM_SIZE()\r
+ ON_WM_MOUSEMOVE()\r
+ ON_WM_MOUSEHOVER()\r
+ ON_WM_MOUSELEAVE()\r
+ ON_WM_LBUTTONDOWN()\r
+ ON_WM_RBUTTONDOWN()\r
ON_NOTIFY(SCN_PAINTED,0,OnSciPainted)\r
+ ON_NOTIFY(SCN_GETBKCOLOR,0,OnSciGetBkColor)\r
END_MESSAGE_MAP()\r
\r
// CTortoiseGitBlameView construction/destruction\r
\r
CRect rect,rect1;\r
this->GetWindowRect(&rect1);\r
- rect.left=m_blamewidth;\r
+ rect.left=m_blamewidth+LOCATOR_WIDTH;\r
rect.right=rect.Width();\r
rect.top=0;\r
rect.bottom=rect.Height();\r
return;\r
\r
DrawBlame(this->GetDC()->m_hDC);\r
+ DrawLocatorBar(this->GetDC()->m_hDC);\r
// TODO: add draw code for native data here\r
}\r
\r
str.Format(_T("%d.%s"),m_ID[i],m_Authors[i]);\r
\r
//_stprintf_s(buf, MAX_PATH, _T("%8ld "), revs[i]);\r
- rc.top=Y;rc.left=0; \r
+ rc.top=Y;\r
+ rc.left=LOCATOR_WIDTH; \r
rc.bottom=Y+height;\r
- rc.right = rc.left + 100;\r
- ::ExtTextOut(hDC, 0, Y, ETO_CLIPPED, &rc, str, str.GetLength(), 0);\r
+ rc.right = rc.left + m_blamewidth;\r
+ ::ExtTextOut(hDC, LOCATOR_WIDTH, Y, ETO_CLIPPED, &rc, str, str.GetLength(), 0);\r
int Left = m_revwidth;\r
#if 0\r
if (ShowDate)\r
\r
void CTortoiseGitBlameView::DrawLocatorBar(HDC hDC)\r
{\r
-#if 0\r
if (hDC == NULL)\r
return;\r
\r
COLORREF blackColor = GetSysColor(COLOR_WINDOWTEXT);\r
\r
RECT rc;\r
- ::GetClientRect(wLocator, &rc);\r
+ //::GetClientRect(wLocator, &rc);\r
+ this->GetClientRect(&rc);\r
+\r
+ rc.right=LOCATOR_WIDTH;\r
+\r
RECT lineRect = rc;\r
LONG height = rc.bottom-rc.top;\r
LONG currentLine = 0;\r
\r
// draw the colored bar\r
- for (std::vector<LONG>::const_iterator it = revs.begin(); it != revs.end(); ++it)\r
+ for (std::vector<LONG>::const_iterator it = m_ID.begin(); it != m_ID.end(); ++it)\r
{\r
currentLine++;\r
// get the line color\r
}\r
SetBkColor(hDC, cr);\r
lineRect.top = Y;\r
- lineRect.bottom = (currentLine * height / revs.size());\r
+ lineRect.bottom = (currentLine * height / m_ID.size());\r
::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &lineRect, NULL, 0, NULL);\r
Y = lineRect.bottom;\r
}\r
\r
- if (revs.size())\r
+ if (m_ID.size())\r
{\r
// now draw two lines indicating the scroll position of the source view\r
SetBkColor(hDC, blackColor);\r
- lineRect.top = line * height / revs.size();\r
+ lineRect.top = line * height / m_ID.size();\r
lineRect.bottom = lineRect.top+1;\r
::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &lineRect, NULL, 0, NULL);\r
- lineRect.top = (line + linesonscreen) * height / revs.size();\r
+ lineRect.top = (line + linesonscreen) * height / m_ID.size();\r
lineRect.bottom = lineRect.top+1;\r
::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &lineRect, NULL, 0, NULL);\r
}\r
-#endif\r
+\r
}\r
\r
void CTortoiseGitBlameView::StringExpand(LPSTR str)\r
// fall through\r
case WM_LBUTTONDOWN:\r
{\r
- int y = ((int)(short)HIWORD(lParam));\r
- LONG_PTR line = app.SendEditor(SCI_GETFIRSTVISIBLELINE);\r
- LONG_PTR height = app.SendEditor(SCI_TEXTHEIGHT);\r
- line = line + (y/height);\r
- if (line < (LONG)app.revs.size())\r
- {\r
- app.SetSelectedLine(line);\r
- if (app.revs[line] != app.m_selectedrev)\r
- {\r
- app.m_selectedrev = app.revs[line];\r
- app.m_selectedorigrev = app.origrevs[line];\r
- app.m_selectedauthor = app.authors[line];\r
- app.m_selecteddate = app.dates[line];\r
- }\r
- else\r
- {\r
- app.m_selectedauthor.clear();\r
- app.m_selecteddate.clear();\r
- app.m_selectedrev = -2;\r
- app.m_selectedorigrev = -2;\r
- }\r
- ::InvalidateRect(app.wBlame, NULL, FALSE);\r
- }\r
- else\r
- {\r
- app.SetSelectedLine(-1);\r
- }\r
- }\r
break;\r
case WM_SETFOCUS:\r
::SetFocus(app.wBlame);\r
this->m_TextView.InsertText(line,true);\r
}\r
int id=pRevs->m_HashMap[one.Left(40)]; \r
- if(id>=0)\r
+ if(id>=0 && id <GetLogData()->size())\r
{\r
m_ID.push_back(pRevs->size()-id);\r
m_Authors.push_back(pRevs->at(id).m_AuthorName);\r
SendEditor(SCI_SETSCROLLWIDTHTRACKING, TRUE);\r
SendEditor(SCI_SETREADONLY, TRUE);\r
\r
+ m_lowestrev=1;\r
+ m_highestrev=this->GetLogData()->size();\r
\r
this->Invalidate();\r
}\r
\r
+CGitBlameLogList * CTortoiseGitBlameView::GetLogList()\r
+{\r
+ return &(GetDocument()->GetMainFrame()->m_wndOutput.m_LogList);\r
+}\r
+\r
+\r
CLogDataVector * CTortoiseGitBlameView::GetLogData()\r
{\r
return &(GetDocument()->GetMainFrame()->m_wndOutput.m_LogList.m_logEntries);\r
void CTortoiseGitBlameView::OnSciPainted(NMHDR *,LRESULT *)\r
{\r
this->Invalidate();\r
+}\r
+\r
+void CTortoiseGitBlameView::OnLButtonDown(UINT nFlags,CPoint point)\r
+{\r
+\r
+ LONG_PTR line = SendEditor(SCI_GETFIRSTVISIBLELINE);\r
+ LONG_PTR height = SendEditor(SCI_TEXTHEIGHT);\r
+ line = line + (point.y/height);\r
+ \r
+ if (line < (LONG)m_CommitHash.size())\r
+ {\r
+ SetSelectedLine(line);\r
+ if (m_CommitHash[line] != m_SelectedHash)\r
+ {\r
+ m_SelectedHash = m_CommitHash[line];\r
+// app.m_selectedorigrev = app.origrevs[line];\r
+// app.m_selectedauthor = app.authors[line];\r
+// app.m_selecteddate = app.dates[line];\r
+ \r
+ \r
+ this->GetLogList()->SetItemState(this->GetLogList()->GetItemCount()-m_ID[line],\r
+ LVIS_SELECTED,\r
+ LVIS_SELECTED);\r
+ }\r
+ else\r
+ {\r
+ m_SelectedHash.Empty();\r
+// app.m_selecteddate.clear();\r
+// app.m_selectedrev = -2;\r
+// app.m_selectedorigrev = -2;\r
+ }\r
+ //::InvalidateRect( NULL, FALSE);\r
+ this->Invalidate();\r
+ this->m_TextView.Invalidate();\r
+ \r
+ }\r
+ else\r
+ {\r
+ SetSelectedLine(-1);\r
+ }\r
+ \r
+ CView::OnLButtonDown(nFlags,point);\r
+}\r
+\r
+void CTortoiseGitBlameView::OnSciGetBkColor(NMHDR* hdr, LRESULT* result)\r
+{\r
+\r
+ SCNotification *notification=reinterpret_cast<SCNotification *>(hdr);\r
+\r
+ if ((m_colorage)&&(notification->line < (int)m_CommitHash.size()))\r
+ {\r
+ if(m_CommitHash[notification->line] == this->m_SelectedHash )\r
+ notification->lParam = m_selectedauthorcolor;\r
+ else\r
+ notification->lParam = InterColor(DWORD(m_regOldLinesColor), DWORD(m_regNewLinesColor), (m_ID[notification->line]-m_lowestrev)*100/((m_highestrev-m_lowestrev)+1));\r
+ }\r
+\r
+\r
}
\ No newline at end of file