Ticket #3353: t3353_olist_cell_clipping_v1.patch
File t3353_olist_cell_clipping_v1.patch, 2.1 KB (added by , 9 years ago) |
---|
-
source/gui/COList.cpp
406 406 407 407 DrawText(def, color, leftTopCorner + CPos(0, 4), bz + 0.1f, rect_head); 408 408 xpos += width; 409 409 } 410 410 411 const unsigned int m_ObjectsCount = m_ObjectsDefs.size(); 411 412 for (int i=0; i<(int)pList->m_Items.size(); ++i) 412 413 { 413 414 if (m_ItemsYPositions[i+1] - scroll < 0 || 414 415 m_ItemsYPositions[i] - scroll > rect.GetHeight()) 415 416 continue; 416 417 418 const float rowHeight = m_ItemsYPositions[i+1] - m_ItemsYPositions[i]; 419 417 420 // Clipping area (we'll have to substract the scrollbar) 418 421 CRect cliparea = GetListRect(); 419 422 420 423 if (scrollbar) 421 424 { … … 427 430 cliparea.left < GetScrollBar(0).GetOuterRect().right) 428 431 cliparea.left = GetScrollBar(0).GetOuterRect().right; 429 432 } 430 433 431 434 xpos = 0; 432 for (unsigned int def=0; def < m_ObjectsDefs.size(); ++def)435 for (unsigned int def=0; def < m_ObjectsCount; ++def) 433 436 { 434 DrawText(m_ObjectsDefs.size() * (i+/*Heading*/1) + def, m_ObjectsDefs[def].m_TextColor, rect.TopLeft() + CPos(xpos, -scroll + m_ItemsYPositions[i]), bz+0.1f, cliparea); 437 // Determine text position and width 438 const CPos textPos = rect.TopLeft() + CPos(xpos, -scroll + m_ItemsYPositions[i]); 439 435 440 // Check if it's a decimal value, and if so, assume relative positioning. 441 float width = m_ObjectsDefs[def].m_Width;; 436 442 if (m_ObjectsDefs[def].m_Width < 1 && m_ObjectsDefs[def].m_Width > 0) 437 xpos += m_ObjectsDefs[def].m_Width * m_TotalAvalibleColumnWidth; 438 else 439 xpos += m_ObjectsDefs[def].m_Width; 443 width *= m_TotalAvalibleColumnWidth; 444 445 // Clip text to the column (to prevent drawing text into the neighboring column) 446 CRect cliparea2 = cliparea; 447 cliparea2.right = std::min(cliparea2.right, textPos.x + width); 448 cliparea2.bottom = std::min(cliparea2.bottom, textPos.y + rowHeight); 449 450 DrawText(m_ObjectsCount * (i+/*Heading*/1) + def, m_ObjectsDefs[def].m_TextColor, textPos, bz+0.1f, cliparea2); 451 xpos += width; 440 452 } 441 453 } 442 454 } 443 455 }