[Wgui-cvs] wgui/src wg_listbox.cpp,1.41,1.42 wg_textbox.cpp,1.22,1.23 wg_tooltip.cpp,1.20,1.21 wg_wi
Status: Beta
Brought to you by:
greenwire
|
From: Rob W. <gre...@us...> - 2004-07-06 05:30:50
|
Update of /cvsroot/wgui/wgui/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19966/src Modified Files: wg_listbox.cpp wg_textbox.cpp wg_tooltip.cpp wg_window.cpp Log Message: New drawing architecture work. Index: wg_window.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_window.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** wg_window.cpp 6 Jul 2004 03:29:02 -0000 1.47 --- wg_window.cpp 6 Jul 2004 05:30:38 -0000 1.48 *************** *** 96,107 **** - CRect CWindow::GetClientRect(void) const - { - CRect ClientRect(m_ClientRect); - ClientRect.ClipTo(m_WindowRect); - return ClientRect; - } - - CWindow* CWindow::GetAncestor(EAncestor eAncestor) const { --- 96,99 ---- *************** *** 165,169 **** { (*iter)->SetVisible(bVisible); ! if ((*iter) == CApplication::Instance()->GetKeyFocus()) { CApplication::Instance()->SetKeyFocus(0); --- 157,161 ---- { (*iter)->SetVisible(bVisible); ! if (!bVisible && (*iter) == CApplication::Instance()->GetKeyFocus()) { CApplication::Instance()->SetKeyFocus(0); Index: wg_listbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_listbox.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** wg_listbox.cpp 30 Jun 2004 22:31:01 -0000 1.41 --- wg_listbox.cpp 6 Jul 2004 05:30:38 -0000 1.42 *************** *** 242,247 **** m_iFocusedItem++; int diff = m_iFocusedItem - m_pVScrollbar->GetValue(); ! CRect ClientRect(GetClientRect()); ! if (m_iItemHeight * (m_pVScrollbar->GetValue() + diff + 1) > (unsigned int) ClientRect.Height()) { m_pVScrollbar->SetValue(m_pVScrollbar->GetValue() + 1); --- 242,246 ---- m_iFocusedItem++; int diff = m_iFocusedItem - m_pVScrollbar->GetValue(); ! if (m_iItemHeight * (m_pVScrollbar->GetValue() + diff + 1) > stdex::safe_static_cast<unsigned int>(m_ClientRect.Height())) { m_pVScrollbar->SetValue(m_pVScrollbar->GetValue() + 1); *************** *** 269,275 **** case SDLK_PAGEDOWN: { - CRect ClientRect(GetClientRect()); int nSize = Size() - 1; ! int nItemsPerPage = ClientRect.Height() / m_iItemHeight; if (m_iFocusedItem + nItemsPerPage < nSize) { --- 268,273 ---- case SDLK_PAGEDOWN: { int nSize = Size() - 1; ! int nItemsPerPage = m_ClientRect.Height() / m_iItemHeight; if (m_iFocusedItem + nItemsPerPage < nSize) { *************** *** 287,292 **** case SDLK_PAGEUP: { ! CRect ClientRect(GetClientRect()); ! int nItemsPerPage = ClientRect.Height() / m_iItemHeight; if (m_iFocusedItem - nItemsPerPage > 0) { --- 285,289 ---- case SDLK_PAGEUP: { ! int nItemsPerPage = m_ClientRect.Height() / m_iItemHeight; if (m_iFocusedItem - nItemsPerPage > 0) { Index: wg_textbox.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_textbox.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** wg_textbox.cpp 30 Jun 2004 22:31:01 -0000 1.22 --- wg_textbox.cpp 6 Jul 2004 05:30:38 -0000 1.23 *************** *** 64,72 **** m_pDblClickTimer = new CTimer(); m_pCursorTimer = new CTimer(this); ! m_ClientRect.Grow(-1); m_pVerticalScrollBar = new CScrollBar( ! CRect(m_ClientRect.Right() - 12, m_ClientRect.Top(), m_ClientRect.Right(), m_ClientRect.Bottom() - 12) , this, CScrollBar::VERTICAL), m_pHorizontalScrollBar = new CScrollBar( ! CRect(m_ClientRect.Left(), m_ClientRect.Bottom() - 12, m_ClientRect.Right() - 12, m_ClientRect.Bottom()) , this, CScrollBar::HORIZONTAL), m_ScrollBarVisibilityMap[CScrollBar::VERTICAL] = SCROLLBAR_VIS_AUTO; m_ScrollBarVisibilityMap[CScrollBar::HORIZONTAL] = SCROLLBAR_VIS_AUTO; --- 64,72 ---- m_pDblClickTimer = new CTimer(); m_pCursorTimer = new CTimer(this); ! m_ClientRect.Grow(-3); m_pVerticalScrollBar = new CScrollBar( ! CRect(m_WindowRect.Width() - 12, 0, m_WindowRect.Width(), m_WindowRect.Height() - 12) - m_ClientRect.TopLeft(), this, CScrollBar::VERTICAL), m_pHorizontalScrollBar = new CScrollBar( ! CRect(0, m_WindowRect.Height() - 12, m_WindowRect.Width() - 12, m_WindowRect.Height()) - m_ClientRect.TopLeft(), this, CScrollBar::HORIZONTAL), m_ScrollBarVisibilityMap[CScrollBar::VERTICAL] = SCROLLBAR_VIS_AUTO; m_ScrollBarVisibilityMap[CScrollBar::HORIZONTAL] = SCROLLBAR_VIS_AUTO; *************** *** 159,163 **** Painter.DrawRect(m_WindowRect.SizeRect(), false, COLOR_BLACK); CPoint FontCenterPoint = m_WindowRect.Center(); - CRect TextRect(m_ClientRect); CRGBColor FontColor = m_bReadOnly ? DEFAULT_DISABLED_LINE_COLOR : DEFAULT_LINE_COLOR; --- 159,162 ---- *************** *** 195,210 **** // move the cursor into view by scrolling if necessary ! int CursorPos = vCharRects[SelStartPoint.YPos()][SelStartPoint.XPos()].Left() + vOffsets[SelStartPoint.YPos()].XPos() + TextRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; if (m_bScrollToCursor) { ! if (CursorPos < TextRect.Left()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() - (TextRect.Left() - CursorPos) / 10 - 1); ! CursorPos = vCharRects[SelStartPoint.YPos()][SelStartPoint.XPos()].Left() + vOffsets[SelStartPoint.YPos()].XPos() + TextRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } ! if (CursorPos > TextRect.Right()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() + (CursorPos - TextRect.Right()) / 10 + 1); ! CursorPos = vCharRects[SelStartPoint.YPos()][SelStartPoint.XPos()].Left() + vOffsets[SelStartPoint.YPos()].XPos() + TextRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } if (SelStartPoint.YPos() < m_pVerticalScrollBar->GetValue()) --- 194,209 ---- // move the cursor into view by scrolling if necessary ! int CursorPos = vCharRects[SelStartPoint.YPos()][SelStartPoint.XPos()].Left() + vOffsets[SelStartPoint.YPos()].XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; if (m_bScrollToCursor) { ! if (CursorPos < m_ClientRect.Left()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() - (m_ClientRect.Left() - CursorPos) / 10 - 1); ! CursorPos = vCharRects[SelStartPoint.YPos()][SelStartPoint.XPos()].Left() + vOffsets[SelStartPoint.YPos()].XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } ! if (CursorPos > m_ClientRect.Right()) { ! m_pHorizontalScrollBar->SetValue(m_pHorizontalScrollBar->GetValue() + (CursorPos - m_ClientRect.Right()) / 10 + 1); ! CursorPos = vCharRects[SelStartPoint.YPos()][SelStartPoint.XPos()].Left() + vOffsets[SelStartPoint.YPos()].XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10; } if (SelStartPoint.YPos() < m_pVerticalScrollBar->GetValue()) *************** *** 224,238 **** for (int CurLine = SelStartPoint.YPos(); CurLine <= SelEndPoint.YPos(); ++CurLine) { ! CPoint TopLeft = TextRect.TopLeft() + CPoint(0, m_iRowHeight * (CurLine - m_pVerticalScrollBar->GetValue())); CRect SelRect(TopLeft, TopLeft + CPoint(vBoundingDimensions[CurLine].XPos(), m_iRowHeight - 2)); if (CurLine == SelStartPoint.YPos()) { ! SelRect.SetLeft(vCharRects[CurLine][SelStartPoint.XPos()].Left() + vOffsets[CurLine].XPos() + TextRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); } if (CurLine == SelEndPoint.YPos()) { ! SelRect.SetRight(vCharRects[CurLine][SelEndPoint.XPos() - 1].Right() + vOffsets[CurLine].XPos() + TextRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); } ! SelRect.ClipTo(TextRect); Painter.DrawRect(SelRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); } --- 223,237 ---- for (int CurLine = SelStartPoint.YPos(); CurLine <= SelEndPoint.YPos(); ++CurLine) { ! CPoint TopLeft = m_ClientRect.TopLeft() + CPoint(0, m_iRowHeight * (CurLine - m_pVerticalScrollBar->GetValue())); CRect SelRect(TopLeft, TopLeft + CPoint(vBoundingDimensions[CurLine].XPos(), m_iRowHeight - 2)); if (CurLine == SelStartPoint.YPos()) { ! SelRect.SetLeft(vCharRects[CurLine][SelStartPoint.XPos()].Left() + vOffsets[CurLine].XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); } if (CurLine == SelEndPoint.YPos()) { ! SelRect.SetRight(vCharRects[CurLine][SelEndPoint.XPos() - 1].Right() + vOffsets[CurLine].XPos() + m_ClientRect.Left() - m_pHorizontalScrollBar->GetValue() * 10); } ! SelRect.ClipTo(m_ClientRect); Painter.DrawRect(SelRect, true, CApplication::Instance()->GetDefaultSelectionColor(), CApplication::Instance()->GetDefaultSelectionColor()); } *************** *** 242,249 **** if (m_SelLength == 0 && SelStartPoint.YPos() >= m_pVerticalScrollBar->GetValue() && m_bDrawCursor) { ! if (CursorPos >= TextRect.Left() && CursorPos <= TextRect.Right()) { ! Painter.DrawVLine(TextRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue()) - 1, ! TextRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue() + 1) - 1, CursorPos, COLOR_BLACK); } } --- 241,248 ---- if (m_SelLength == 0 && SelStartPoint.YPos() >= m_pVerticalScrollBar->GetValue() && m_bDrawCursor) { ! if (CursorPos >= m_ClientRect.Left() && CursorPos <= m_ClientRect.Right()) { ! Painter.DrawVLine(m_ClientRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue()) - 1, ! m_ClientRect.Top() + m_iRowHeight * (SelStartPoint.YPos() - m_pVerticalScrollBar->GetValue() + 1) - 1, CursorPos, COLOR_BLACK); } } *************** *** 251,258 **** // finally, draw the text ! CPoint LineOrigin = TextRect.TopLeft() - CPoint(m_pHorizontalScrollBar->GetValue() * 10, 0); for(std::vector<CRenderedString*>::const_iterator iter = m_vpRenderedString.begin() + m_pVerticalScrollBar->GetValue(); ! iter != m_vpRenderedString.end() && LineOrigin.YPos() < TextRect.Bottom(); ++iter) { ! (*iter)->Draw(m_pSDLSurface, TextRect, LineOrigin, FontColor); LineOrigin.SetY(LineOrigin.YPos() + m_iRowHeight); } --- 250,257 ---- // finally, draw the text ! CPoint LineOrigin = m_ClientRect.TopLeft() - CPoint(m_pHorizontalScrollBar->GetValue() * 10, 0); for(std::vector<CRenderedString*>::const_iterator iter = m_vpRenderedString.begin() + m_pVerticalScrollBar->GetValue(); ! iter != m_vpRenderedString.end() && LineOrigin.YPos() < m_ClientRect.Bottom(); ++iter) { ! (*iter)->Draw(m_pSDLSurface, m_ClientRect, LineOrigin, FontColor); LineOrigin.SetY(LineOrigin.YPos() + m_iRowHeight); } *************** *** 285,289 **** CPoint WindowPoint(ViewToWindow(Point)); ! if (! CWindow::OnMouseButtonDown(Point, Button) && m_bVisible && (GetClientRect().HitTest(WindowPoint) == CRect::RELPOS_INSIDE)) { if (Button == CMouseMessage::LEFT && !m_bReadOnly) --- 284,288 ---- CPoint WindowPoint(ViewToWindow(Point)); ! if (! CWindow::OnMouseButtonDown(Point, Button) && m_bVisible && (m_ClientRect.HitTest(WindowPoint) == CRect::RELPOS_INSIDE)) { if (Button == CMouseMessage::LEFT && !m_bReadOnly) Index: wg_tooltip.cpp =================================================================== RCS file: /cvsroot/wgui/wgui/src/wg_tooltip.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** wg_tooltip.cpp 29 Jun 2004 22:14:20 -0000 1.20 --- wg_tooltip.cpp 6 Jul 2004 05:30:38 -0000 1.21 *************** *** 66,70 **** void CToolTip::ShowTip(const CPoint& DrawPoint) { ! SetWindowRect(m_BoundingRect + DrawPoint); SetVisible(true); Draw(); --- 66,70 ---- void CToolTip::ShowTip(const CPoint& DrawPoint) { ! SetWindowRect(m_pParentWindow->ViewToClient(m_BoundingRect + DrawPoint)); SetVisible(true); Draw(); *************** *** 112,116 **** { // Timer has expired, so it's time to show the tooltip ! ShowTip(ViewToClient(m_LastMousePosition) + CPoint(-6, 18)); bHandled = true; } --- 112,116 ---- { // Timer has expired, so it's time to show the tooltip ! ShowTip(m_LastMousePosition + CPoint(-6, 18)); bHandled = true; } *************** *** 130,134 **** } if (m_pParentWindow->GetWindowRect().SizeRect().HitTest( ! m_pParentWindow->ViewToClient(m_LastMousePosition)) == CRect::RELPOS_INSIDE) { m_pTimer->StartTimer(1000); --- 130,134 ---- } if (m_pParentWindow->GetWindowRect().SizeRect().HitTest( ! m_pParentWindow->ViewToWindow(m_LastMousePosition)) == CRect::RELPOS_INSIDE) { m_pTimer->StartTimer(1000); |