OSDN Git Service

Upgrade graphic tree from qgit2.3
authorFrank Li <lznuaa@gmail.com>
Sat, 16 May 2009 04:47:26 +0000 (12:47 +0800)
committerFrank Li <lznuaa@gmail.com>
Sat, 16 May 2009 04:47:26 +0000 (12:47 +0800)
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/GitLogListBase.h

index e9a914e..2f8cd2d 100644 (file)
@@ -469,7 +469,7 @@ void CGitLogListBase::DrawTagBranch(HDC hdc,CRect &rect,INT_PTR index)
 }\r
 \r
 void CGitLogListBase::paintGraphLane(HDC hdc, int laneHeight,int type, int x1, int x2,\r
-                                      const COLORREF& col,int top\r
+                                      const COLORREF& col,const COLORREF& activeColor, int top\r
                                                                          )  \r
 {\r
        int h = laneHeight / 2;\r
@@ -649,16 +649,37 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)
 \r
        std::vector<int>& lanes=data->m_Lanes;\r
        UINT laneNum = lanes.size();\r
-       UINT mergeLane = 0;\r
+       UINT activeLane = 0;\r
        for (UINT i = 0; i < laneNum; i++)\r
                if (Lanes::isMerge(lanes[i])) {\r
-                       mergeLane = i;\r
+                       activeLane = i;\r
                        break;\r
                }\r
 \r
        int x1 = 0, x2 = 0;\r
        int maxWidth = rect.Width();\r
        int lw = 3 * rect.Height() / 4; //laneWidth() \r
+\r
+       COLORREF activeColor = m_LineColors[activeLane % Lanes::COLORS_NUM];\r
+       //if (opt.state & QStyle::State_Selected)\r
+       //      activeColor = blend(activeColor, opt.palette.highlightedText().color(), 208);\r
+       \r
+\r
+       for (unsigned int i = 0; i < laneNum && x2 < maxWidth; i++) \r
+       {\r
+\r
+               x1 = x2;\r
+               x2 += lw;\r
+\r
+               int ln = lanes[i];\r
+               if (ln == Lanes::EMPTY)\r
+                       continue;\r
+\r
+               COLORREF color = i == activeLane ? activeColor : m_LineColors[i % Lanes::COLORS_NUM];\r
+               paintGraphLane(hdc, rect.Height(),ln, x1, x2, color,activeColor, rect.top);\r
+       }\r
+\r
+#if 0\r
        for (UINT i = 0; i < laneNum && x2 < maxWidth; i++) {\r
 \r
                x1 = x2;\r
@@ -669,14 +690,15 @@ void CGitLogListBase::DrawGraph(HDC hdc,CRect &rect,INT_PTR index)
                        continue;\r
 \r
                UINT col = (  Lanes:: isHead(ln) ||Lanes:: isTail(ln) || Lanes::isJoin(ln)\r
-                           || ln ==Lanes:: CROSS_EMPTY) ? mergeLane : i;\r
+                           || ln ==Lanes:: CROSS_EMPTY) ? activeLane : i;\r
 \r
                if (ln == Lanes::CROSS) {\r
                        paintGraphLane(hdc, rect.Height(),Lanes::NOT_ACTIVE, x1, x2, m_LineColors[col % Lanes::COLORS_NUM],rect.top);\r
-                       paintGraphLane(hdc, rect.Height(),Lanes::CROSS, x1, x2, m_LineColors[mergeLane % Lanes::COLORS_NUM],rect.top);\r
+                       paintGraphLane(hdc, rect.Height(),Lanes::CROSS, x1, x2, m_LineColors[activeLane % Lanes::COLORS_NUM],rect.top);\r
                } else\r
                        paintGraphLane(hdc, rect.Height(),ln, x1, x2, m_LineColors[col % Lanes::COLORS_NUM],rect.top);\r
        }\r
+#endif\r
 \r
        TRACE(_T("index %d %d\r\n"),index,data->m_Lanes.size());\r
 }\r
index e0af4fd..40cd12e 100644 (file)
@@ -224,7 +224,7 @@ protected:
 \r
        BOOL GetShortName(CString ref, CString &shortname,CString prefix);\r
        void paintGraphLane(HDC hdc,int laneHeight, int type, int x1, int x2,\r
-                                      const COLORREF& col,int top) ; \r
+                                      const COLORREF& col,const COLORREF& activeColor, int top) ; \r
        void DrawLine(HDC hdc, int x1, int y1, int x2, int y2){::MoveToEx(hdc,x1,y1,NULL);::LineTo(hdc,x2,y2);}\r
        /**\r
        * Save column widths to the registry\r