converts point from documsnt to window coordinates, returns true if success
| 2193 | |
| 2194 | /// converts point from documsnt to window coordinates, returns true if success |
| 2195 | bool LVDocView::docToWindowPoint(lvPoint & pt) { |
| 2196 | LVLock lock(getMutex()); |
| 2197 | CHECK_RENDER("docToWindowPoint()") |
| 2198 | // TODO: implement coordinate conversion here |
| 2199 | if (getViewMode() == DVM_SCROLL) { |
| 2200 | // SCROLL mode |
| 2201 | pt.y -= _pos; |
| 2202 | pt.x += m_pageMargins.left; |
| 2203 | return true; |
| 2204 | } else { |
| 2205 | // PAGES mode |
| 2206 | int page = getCurPage(); |
| 2207 | if (page >= 0 && page < m_pages.length() && pt.y >= m_pages[page]->start) { |
| 2208 | int index = -1; |
| 2209 | if (pt.y <= (m_pages[page]->start + m_pages[page]->height)) { |
| 2210 | index = 0; |
| 2211 | } else if (getVisiblePageCount() == 2 && page + 1 < m_pages.length() && |
| 2212 | pt.y <= (m_pages[page + 1]->start + m_pages[page + 1]->height)) { |
| 2213 | index = 1; |
| 2214 | } |
| 2215 | if (index >= 0) { |
| 2216 | int x = pt.x + m_pageRects[index].left + m_pageMargins.left; |
| 2217 | if (x < m_pageRects[index].right - m_pageMargins.right) { |
| 2218 | pt.x = x; |
| 2219 | pt.y = pt.y + getPageHeaderHeight() + m_pageMargins.top - m_pages[page + index]->start; |
| 2220 | return true; |
| 2221 | } |
| 2222 | } |
| 2223 | } |
| 2224 | return false; |
| 2225 | } |
| 2226 | #if CR_INTERNAL_PAGE_ORIENTATION==1 |
| 2227 | pt = rotatePoint( pt, false ); |
| 2228 | #endif |
| 2229 | return false; |
| 2230 | } |
| 2231 | |
| 2232 | /// returns xpointer for specified window point |
| 2233 | ldomXPointer LVDocView::getNodeByPoint(lvPoint pt) { |
no test coverage detected