bool CGUIListContainer::OnAction(const CAction &action) { switch (action.GetID()) { case ACTION_PAGE_UP: { if (GetOffset() == 0) { // already on the first page, so move to the first item SetCursor(0); } else { // scroll up to the previous page Scroll( -m_itemsPerPage); } return true; } break; case ACTION_PAGE_DOWN: { if (GetOffset() == (int)m_items.size() - m_itemsPerPage || (int)m_items.size() < m_itemsPerPage) { // already at the last page, so move to the last item. SetCursor(m_items.size() - GetOffset() - 1); } else { // scroll down to the next page Scroll(m_itemsPerPage); } return true; } break; // smooth scrolling (for analog controls) case ACTION_SCROLL_UP: { m_analogScrollCount += action.GetAmount() * action.GetAmount(); bool handled = false; while (m_analogScrollCount > 0.4) { handled = true; m_analogScrollCount -= 0.4f; if (GetOffset() > 0 && GetCursor() <= m_itemsPerPage / 2) { Scroll(-1); } else if (GetCursor() > 0) { SetCursor(GetCursor() - 1); } } return handled; } break; case ACTION_SCROLL_DOWN: { m_analogScrollCount += action.GetAmount() * action.GetAmount(); bool handled = false; while (m_analogScrollCount > 0.4) { handled = true; m_analogScrollCount -= 0.4f; if (GetOffset() + m_itemsPerPage < (int)m_items.size() && GetCursor() >= m_itemsPerPage / 2) { Scroll(1); } else if (GetCursor() < m_itemsPerPage - 1 && GetOffset() + GetCursor() < (int)m_items.size() - 1) { SetCursor(GetCursor() + 1); } } return handled; } break; } return CGUIBaseContainer::OnAction(action); }
void CGUIPanelContainer::Render() { if (!m_layout || !m_focusedLayout) return; int offset = (int)(m_scroller.GetValue() / m_layout->Size(m_orientation)); int cacheBefore, cacheAfter; GetCacheOffsets(cacheBefore, cacheAfter); if (g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height)) { CPoint origin = CPoint(m_posX, m_posY) + m_renderOffset; float pos = (m_orientation == VERTICAL) ? origin.y : origin.x; float end = (m_orientation == VERTICAL) ? m_posY + m_height : m_posX + m_width; pos += (offset - cacheBefore) * m_layout->Size(m_orientation) - m_scroller.GetValue(); end += cacheAfter * m_layout->Size(m_orientation); float focusedPos = 0; int focusedCol = 0; CGUIListItemPtr focusedItem; int current = (offset - cacheBefore) * m_itemsPerRow; int col = 0; while (pos < end && m_items.size()) { if (current >= (int)m_items.size()) break; if (current >= 0) { CGUIListItemPtr item = m_items[current]; bool focused = (current == GetOffset() * m_itemsPerRow + GetCursor()) && m_bHasFocus; // render our item if (focused) { focusedPos = pos; focusedCol = col; focusedItem = item; } else { if (m_orientation == VERTICAL) RenderItem(origin.x + col * m_layout->Size(HORIZONTAL), pos, item.get(), false); else RenderItem(pos, origin.y + col * m_layout->Size(VERTICAL), item.get(), false); } } // increment our position if (col < m_itemsPerRow - 1) col++; else { pos += m_layout->Size(m_orientation); col = 0; } current++; } // and render the focused item last (for overlapping purposes) if (focusedItem) { if (m_orientation == VERTICAL) RenderItem(origin.x + focusedCol * m_layout->Size(HORIZONTAL), focusedPos, focusedItem.get(), true); else RenderItem(focusedPos, origin.y + focusedCol * m_layout->Size(VERTICAL), focusedItem.get(), true); } g_graphicsContext.RestoreClipRegion(); } CGUIControl::Render(); }
static LRESULT CALLBACK GROUP_GroupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PROGGROUP* group; INT iItem; LVITEMW lvItem; POINT pt; group = (PROGGROUP*)GetWindowLongPtrW(hWnd, 0); switch (uMsg) { case WM_NCCREATE: { LPCREATESTRUCTW pcs = (LPCREATESTRUCTW)lParam; LPMDICREATESTRUCTW pMDIcs = (LPMDICREATESTRUCTW)pcs->lpCreateParams; group = (PROGGROUP*)pMDIcs->lParam; SetWindowLongPtrW(hWnd, 0, (LONG_PTR)group); if (group->bIsCommonGroup) { DefMDIChildProcW(hWnd, WM_SETICON, ICON_BIG, (LPARAM)CopyImage(Globals.hCommonGroupIcon, IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_COPYFROMRESOURCE)); DefMDIChildProcW(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)CopyImage(Globals.hCommonGroupIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE)); } else { DefMDIChildProcW(hWnd, WM_SETICON, ICON_BIG, (LPARAM)CopyImage(Globals.hPersonalGroupIcon, IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_COPYFROMRESOURCE)); DefMDIChildProcW(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)CopyImage(Globals.hPersonalGroupIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE)); } break; } case WM_NCDESTROY: SetWindowLongPtrW(hWnd, 0, 0); break; case WM_CREATE: { DWORD dwStyle; RECT rect; GetClientRect(hWnd, &rect); group->hListView = CreateWindowW(WC_LISTVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_OVERLAPPED, 0, 0, rect.right - rect.left, rect.bottom - rect.top, hWnd, NULL, Globals.hInstance, NULL); dwStyle = (GetWindowLongPtrW(group->hListView, GWL_STYLE) | LVS_SHOWSELALWAYS) & ~LVS_AUTOARRANGE; SetWindowLongPtrW(group->hListView, GWL_STYLE, dwStyle); dwStyle = SendMessageA(group->hListView, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) | LVS_EX_BORDERSELECT; SendMessageA(group->hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_SNAPTOGRID, dwStyle); InitUxTheme(); SetWindowTheme(group->hListView, L"Explorer", NULL); group->hListLarge = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_COLOR24 | ILC_MASK, 1, 1); SendMessageA(group->hListView, LVM_SETIMAGELIST, 0, (LPARAM)group->hListLarge); SendMessageA(group->hListView, LVM_SETICONSPACING, 0, MAKELPARAM(80, 64)); break; } case WM_DESTROY: { SendMessageA(group->hListView, LVM_SETIMAGELIST, 0, 0); ImageList_Destroy(group->hListLarge); DestroyWindow(group->hListView); break; } case WM_SIZE: { RECT rect; rect.left = 0; rect.top = 0; rect.right = LOWORD(lParam); rect.bottom = HIWORD(lParam); AdjustWindowRectEx(&rect, GetWindowLongPtrW(group->hListView, GWL_STYLE), FALSE, GetWindowLongPtrW(group->hListView, GWL_EXSTYLE)); MoveWindow(group->hListView, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); break; } case WM_CLOSE: SendMessageW(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); break; case WM_SYSCOMMAND: if (wParam == SC_CLOSE) wParam = SC_MINIMIZE; break; case WM_CHILDACTIVATE: case WM_NCLBUTTONDOWN: Globals.hActiveGroup = (PROGGROUP*)GetWindowLongPtrW(hWnd, 0); Globals.hActiveGroup->hActiveProgram = NULL; break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case NM_CLICK: { iItem = ((LPNMITEMACTIVATE)lParam)->iItem; if (iItem == -1) { group->hActiveProgram = NULL; break; } lvItem.mask = LVIF_PARAM; lvItem.iItem = iItem; SendMessageW(group->hListView, LVM_GETITEMW, 0, (LPARAM)&lvItem); group->hActiveProgram = (PROGRAM*)lvItem.lParam; break; } case NM_DBLCLK: { iItem = ((LPNMITEMACTIVATE)lParam)->iItem; if (iItem == -1) break; lvItem.mask = LVIF_PARAM; lvItem.iItem = iItem; SendMessageW(group->hListView, LVM_GETITEMW, 0, (LPARAM)&lvItem); /* ... or use group->hActiveProgram */ PROGRAM_ExecuteProgram((PROGRAM*)lvItem.lParam); break; } case LVN_BEGINDRAG: { POINT ptMin; BOOL bFirst = TRUE; for (iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED); iItem != -1; iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, iItem, LVNI_SELECTED)) { if (bFirst) { group->hDragImageList = (HIMAGELIST)SendMessageA(group->hListView, LVM_CREATEDRAGIMAGE, iItem, (LPARAM)&pt); ptMin = pt; bFirst = FALSE; } else { HIMAGELIST hOneImageList, hTempImageList; hOneImageList = (HIMAGELIST)SendMessageA(group->hListView, LVM_CREATEDRAGIMAGE, iItem, (LPARAM)&pt); hTempImageList = ImageList_Merge(group->hDragImageList, 0, hOneImageList, 0, pt.x - ptMin.x, pt.y - ptMin.y); ImageList_Destroy(group->hDragImageList); ImageList_Destroy(hOneImageList); group->hDragImageList = hTempImageList; ptMin.x = min(ptMin.x, pt.x); ptMin.y = min(ptMin.y, pt.y); } } // pt = ((LPNMLISTVIEW)lParam)->ptAction; pt.x = ((LPNMLISTVIEW)lParam)->ptAction.x; pt.y = ((LPNMLISTVIEW)lParam)->ptAction.y; group->ptStart = pt; pt.x -= ptMin.x; pt.y -= ptMin.y; ImageList_BeginDrag(group->hDragImageList, 0, pt.x, pt.y); MapWindowPoints(group->hListView, Globals.hMDIWnd, &pt, 1); ImageList_DragEnter(Globals.hMDIWnd, pt.x, pt.y); group->bDragging = TRUE; group->hOldCursor = GetCursor(); SetCapture(group->hWnd); break; } } break; case WM_MOUSEMOVE: if (group->bDragging) { pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); MapWindowPoints(group->hWnd, Globals.hMDIWnd, &pt, 1); ImageList_DragMove(pt.x, pt.y); } break; case WM_LBUTTONUP: if (group->bDragging) { // LVHITTESTINFO lvhti; POINT ptHit; group->bDragging = FALSE; ImageList_DragLeave(Globals.hMDIWnd); ImageList_EndDrag(); ImageList_Destroy(group->hDragImageList); ReleaseCapture(); SetCursor(group->hOldCursor); ptHit.x = GET_X_LPARAM(lParam); ptHit.y = GET_Y_LPARAM(lParam); MapWindowPoints(group->hWnd, group->hListView, &ptHit, 1); for (iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED); iItem != -1; iItem = SendMessageA(group->hListView, LVM_GETNEXTITEM, iItem, LVNI_SELECTED)) { SendMessageA(group->hListView, LVM_GETITEMPOSITION, iItem, (LPARAM)&pt); pt.x += ptHit.x - group->ptStart.x; pt.y += ptHit.y - group->ptStart.y; SendMessageA(group->hListView, LVM_SETITEMPOSITION, iItem, MAKELPARAM(pt.x, pt.y)); } } break; } return DefMDIChildProcW(hWnd, uMsg, wParam, lParam); }
int CGUIPanelContainer::GetCurrentRow() const { return m_itemsPerRow > 0 ? GetCursor() / m_itemsPerRow : 0; }
int CGUIPanelContainer::GetCurrentColumn() const { return GetCursor() % m_itemsPerRow; }
/* * Look at all the records and parse keys for addresses and private keys */ bool WalletUtilityDB::parseKeys(bool dumppriv, std::string masterPass) { DBErrors result = DB_LOAD_OK; std::string strType; bool first = true; try { Dbc* pcursor = GetCursor(); if (!pcursor) { LogPrintf("Error getting wallet database cursor\n"); result = DB_CORRUPT; } if (dumppriv) { while (result == DB_LOAD_OK && true) { CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int result = ReadAtCursor(pcursor, ssKey, ssValue); if (result == DB_NOTFOUND) { break; } else if (result != 0) { LogPrintf("Error reading next record from wallet database\n"); result = DB_CORRUPT; break; } ssKey >> strType; if (strType == "mkey") { updateMasterKeys(ssKey, ssValue); } } pcursor->close(); pcursor = GetCursor(); } while (result == DB_LOAD_OK && true) { CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int ret = ReadAtCursor(pcursor, ssKey, ssValue); if (ret == DB_NOTFOUND) { std::cout << " ]" << std::endl; first = true; break; } else if (ret != DB_LOAD_OK) { LogPrintf("Error reading next record from wallet database\n"); result = DB_CORRUPT; break; } ssKey >> strType; if (strType == "key" || strType == "ckey") { std::string strAddr = getAddress(ssKey); std::string strKey = ""; if (dumppriv && strType == "key") strKey = getKey(ssKey, ssValue); if (dumppriv && strType == "ckey") { if (masterPass == "") { std::cout << "Encrypted wallet, please provide a password. See help below" << std::endl; show_help(); result = DB_LOAD_FAIL; break; } strKey = getCryptedKey(ssKey, ssValue, masterPass); } if (strAddr != "") { if (first) std::cout << "[ "; else std::cout << ", "; } if (dumppriv) { std::cout << "{\"addr\" : \"" + strAddr + "\", " << "\"pkey\" : \"" + strKey + "\"}" << std::flush; } else { std::cout << "\"" + strAddr + "\""; } first = false; } } pcursor->close(); } catch (DbException &e) { std::cout << "DBException caught " << e.get_errno() << std::endl; } catch (std::exception &e) { std::cout << "Exception caught " << std::endl; } if (result == DB_LOAD_OK) return true; else return false; }
int32 Get_Cursor() { return (int32)GetCursor(); }
uint32_t CPUBuffer::GetCurrentElementNumber() const { uint32_t pointerDiff = static_cast<uint32_t>(GetCursor() - Data()); ASSERT(pointerDiff % GetElementSize() == 0, ()); return pointerDiff / GetElementSize(); }
void CGUIBaseContainer::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) { // update our auto-scrolling as necessary UpdateAutoScrolling(currentTime); ValidateOffset(); if (m_bInvalidated) UpdateLayout(); if (!m_layout || !m_focusedLayout) return; UpdateScrollOffset(currentTime); int offset = (int)floorf(m_scroller.GetValue() / m_layout->Size(m_orientation)); int cacheBefore, cacheAfter; GetCacheOffsets(cacheBefore, cacheAfter); // Free memory not used on screen if ((int)m_items.size() > m_itemsPerPage + cacheBefore + cacheAfter) FreeMemory(CorrectOffset(offset - cacheBefore, 0), CorrectOffset(offset + m_itemsPerPage + 1 + cacheAfter, 0)); CPoint origin = CPoint(m_posX, m_posY) + m_renderOffset; float pos = (m_orientation == VERTICAL) ? origin.y : origin.x; float end = (m_orientation == VERTICAL) ? m_posY + m_height : m_posX + m_width; // we offset our draw position to take into account scrolling and whether or not our focused // item is offscreen "above" the list. float drawOffset = (offset - cacheBefore) * m_layout->Size(m_orientation) - m_scroller.GetValue(); if (GetOffset() + GetCursor() < offset) drawOffset += m_focusedLayout->Size(m_orientation) - m_layout->Size(m_orientation); pos += drawOffset; end += cacheAfter * m_layout->Size(m_orientation); int current = offset - cacheBefore; while (pos < end && m_items.size()) { int itemNo = CorrectOffset(current, 0); if (itemNo >= (int)m_items.size()) break; bool focused = (current == GetOffset() + GetCursor()); if (itemNo >= 0) { CGUIListItemPtr item = m_items[itemNo]; // render our item if (m_orientation == VERTICAL) ProcessItem(origin.x, pos, item, focused, currentTime, dirtyregions); else ProcessItem(pos, origin.y, item, focused, currentTime, dirtyregions); } // increment our position pos += focused ? m_focusedLayout->Size(m_orientation) : m_layout->Size(m_orientation); current++; } // when we are scrolling up, offset will become lower (integer division, see offset calc) // to have same behaviour when scrolling down, we need to set page control to offset+1 UpdatePageControl(offset + (m_scroller.IsScrollingDown() ? 1 : 0)); m_lastRenderTime = currentTime; CGUIControl::Process(currentTime, dirtyregions); }
int CGUIBaseContainer::GetSelectedItem() const { return CorrectOffset(GetOffset(), GetCursor()); }
void CGUIBaseContainer::Render() { if (!m_layout || !m_focusedLayout) return; int offset = (int)floorf(m_scroller.GetValue() / m_layout->Size(m_orientation)); int cacheBefore, cacheAfter; GetCacheOffsets(cacheBefore, cacheAfter); if (g_graphicsContext.SetClipRegion(m_posX, m_posY, m_width, m_height)) { CPoint origin = CPoint(m_posX, m_posY) + m_renderOffset; float pos = (m_orientation == VERTICAL) ? origin.y : origin.x; float end = (m_orientation == VERTICAL) ? m_posY + m_height : m_posX + m_width; // we offset our draw position to take into account scrolling and whether or not our focused // item is offscreen "above" the list. float drawOffset = (offset - cacheBefore) * m_layout->Size(m_orientation) - m_scroller.GetValue(); if (GetOffset() + GetCursor() < offset) drawOffset += m_focusedLayout->Size(m_orientation) - m_layout->Size(m_orientation); pos += drawOffset; end += cacheAfter * m_layout->Size(m_orientation); float focusedPos = 0; CGUIListItemPtr focusedItem; int current = offset - cacheBefore; while (pos < end && m_items.size()) { int itemNo = CorrectOffset(current, 0); if (itemNo >= (int)m_items.size()) break; bool focused = (current == GetOffset() + GetCursor()); if (itemNo >= 0) { CGUIListItemPtr item = m_items[itemNo]; // render our item if (focused) { focusedPos = pos; focusedItem = item; } else { if (m_orientation == VERTICAL) RenderItem(origin.x, pos, item.get(), false); else RenderItem(pos, origin.y, item.get(), false); } } // increment our position pos += focused ? m_focusedLayout->Size(m_orientation) : m_layout->Size(m_orientation); current++; } // render focused item last so it can overlap other items if (focusedItem) { if (m_orientation == VERTICAL) RenderItem(origin.x, focusedPos, focusedItem.get(), true); else RenderItem(focusedPos, origin.y, focusedItem.get(), true); } g_graphicsContext.RestoreClipRegion(); } CGUIControl::Render(); }
void LineEdit::Paint0(Draw& w) { LTIMING("LineEdit::Paint0"); int sell, selh; GetSelection(sell, selh); if(!IsEnabled()) sell = selh = 0; Rect rect; bool rectsel = IsRectSelection(); if(IsRectSelection()) rect = GetRectSelection(); Size sz = GetSize(); Size fsz = GetFontSize(); Point sc = sb; int ll = min(line.GetCount(), sz.cy / fsz.cy + sc.y + 1); int y = 0; sc.y = minmax(sc.y, 0, line.GetCount() - 1); cpos = GetPos(sc.y); cline = sc.y; sell -= cpos; selh -= cpos; int pos = cpos; int fascent = font.Info().GetAscent(); int cursorline = GetLine(cursor); Highlight ih; ih.ink = color[IsShowEnabled() ? INK_NORMAL : INK_DISABLED]; ih.paper = color[IsReadOnly() && showreadonly || !IsShowEnabled() ? PAPER_READONLY : PAPER_NORMAL]; if(nobg) ih.paper = Null; ih.font = font; ih.chr = 0; for(int i = sc.y; i < ll; i++) { Color showcolor = color[WHITESPACE]; WString tx = line[i]; bool warn_whitespace = false; if(warnwhitespace && !IsSelection()) { int pos = GetCursor(); int linei = GetLinePos(pos); if(linei != i || pos < tx.GetCount()) { int wkind = 0; bool empty = true; for(const wchar *s = tx; *s; s++) { if(*s == '\t') { if(wkind == ' ') { warn_whitespace = true; break; } wkind = '\t'; } else if(*s == ' ') wkind = ' '; else if(*s > ' ') { empty = false; wkind = 0; } } if(wkind && !empty) warn_whitespace = true; if(warn_whitespace) showcolor = color[WARN_WHITESPACE]; } } bool do_highlight = tx.GetCount() < 100000; int len = tx.GetLength(); if(w.IsPainting(0, y, sz.cx, fsz.cy)) { LTIMING("PaintLine"); Vector<Highlight> hl; int ln; if(do_highlight) { hl.SetCount(len + 1, ih); for(int q = 0; q < tx.GetCount(); q++) hl[q].chr = tx[q]; LTIMING("HighlightLine"); HighlightLine(i, hl, pos); ln = hl.GetCount() - 1; } else ln = tx.GetCount(); int lgp = -1; for(int pass = 0; pass < 2; pass++) { int gp = 0; int scx = fsz.cx * sc.x; sOptimizedRectRenderer rw(w); if(ln >= 0) { int q = 0; int x = 0; int scx2 = scx - max(2, tabsize) * fsz.cx; while(q < ln && x < scx2) { // Skip part before left border wchar chr = do_highlight ? hl[q++].chr : tx[q++]; if(chr == '\t') { gp = (gp + tabsize) / tabsize * tabsize; x = fsz.cx * gp; } else if(IsCJKIdeograph(chr)) { x += 2 * fsz.cx; gp += 2; } else { x += fsz.cx; gp++; } } sOptimizedTextRenderer tw(w); while(q < ln) { if(q == tx.GetCount()) lgp = gp; Highlight h; if(do_highlight) h = hl[q]; else { h = ih; h.chr = tx[q]; } int pos = min(q, len); // Highligting can add chars at the end of line if(rectsel ? i >= rect.top && i <= rect.bottom && gp >= rect.left && gp < rect.right : pos >= sell && pos < selh) { h.paper = color[PAPER_SELECTED]; h.ink = color[INK_SELECTED]; } int x = gp * fsz.cx - scx; if(h.chr == '\t') { int ngp = (gp + tabsize) / tabsize * tabsize; int l = ngp - gp; LLOG("Highlight -> tab[" << q << "] paper = " << h.paper); if(pass == 0 && x >= -fsz.cy * tabsize) { rw.DrawRect(x, y, fsz.cx * l, fsz.cy, h.paper); if((showtabs || warn_whitespace) && h.paper != SColorHighlight && q < tx.GetLength()) { rw.DrawRect(x + 2, y + fsz.cy / 2, l * fsz.cx - 4, 1, showcolor); rw.DrawRect(ngp * fsz.cx - scx - 3, y + 3, 1, fsz.cy - 6, showcolor); } if(bordercolumn > 0 && bordercolumn >= gp && bordercolumn < gp + l) rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor); } q++; gp = ngp; } else if(h.chr == ' ') { LLOG("Highlight -> space[" << q << "] paper = " << h.paper); if(pass == 0 && x >= -fsz.cy) { rw.DrawRect(x, y, fsz.cx, fsz.cy, h.paper); if((showspaces || warn_whitespace) && h.paper != SColorHighlight && q < tx.GetLength()) { int n = fsz.cy / 10 + 1; rw.DrawRect(x + fsz.cx / 2, y + fsz.cy / 2, n, n, showcolor); } if(bordercolumn > 0 && bordercolumn >= gp && bordercolumn < gp + 1) rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor); } q++; gp++; } else { bool cjk = IsCJKIdeograph(h.chr); LLOG("Highlight -> paper[" << q << "] = " << h.paper); int xx = x + (gp + 1 + cjk) * fsz.cx; if(max(x, 0) < min(xx, sz.cx) && fsz.cx >= -fsz.cy) { if(pass == 0) { rw.DrawRect(x, y, (cjk + 1) * fsz.cx, fsz.cy, h.paper); if(bordercolumn > 0 && bordercolumn >= gp && bordercolumn < gp + 1 + cjk) rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor); } else tw.DrawChar(x + (h.flags & SHIFT_L ? -fsz.cx / 6 : h.flags & SHIFT_R ? fsz.cx / 6 : 0), y + fascent - h.font.GetAscent(), h.chr, (cjk + 1) * fsz.cx, h.font, h.ink); } q++; gp += 1 + cjk; if(x > sz.cx) break; } } } if(pass == 0) { int gpx = gp * fsz.cx - scx; rw.DrawRect(gpx, y, sz.cx - gpx, fsz.cy, !rectsel && sell <= len && len < selh ? color[PAPER_SELECTED] : (do_highlight ? hl.Top() : ih).paper); if(bordercolumn > 0 && bordercolumn >= gp) rw.DrawRect((bordercolumn - sc.x) * fsz.cx, y, 1, fsz.cy, bordercolor); } if(pass == 0 && (showlines || warn_whitespace)) { int yy = 2 * fsz.cy / 3; int x = (lgp >= 0 ? lgp : gp) * fsz.cx - scx; rw.DrawRect(x, y + yy, fsz.cx / 2, 1, showcolor); if(fsz.cx > 2) rw.DrawRect(x + 1, y + yy - 1, 1, 3, showcolor); if(fsz.cx > 5) rw.DrawRect(x + 2, y + yy - 2, 1, 5, showcolor); rw.DrawRect(x + fsz.cx / 2, y + yy / 2, 1, yy - yy / 2, showcolor); } if(pass == 0 && !IsNull(hline) && sell == selh && i == cursorline) { rw.DrawRect(0, y, sz.cx, 1, hline); rw.DrawRect(0, y + fsz.cy - 1, sz.cx, 1, hline); } if(pass == 0 && rectsel && rect.left == rect.right && i >= rect.top && i <= rect.bottom) rw.DrawRect(rect.left * fsz.cx - scx, y, 2, fsz.cy, Blend(color[PAPER_SELECTED], color[PAPER_NORMAL])); } } y += fsz.cy; sell -= len + 1; selh -= len + 1; pos += len + 1; } w.DrawRect(0, y, sz.cx, sz.cy - y, color[IsReadOnly() && showreadonly || !IsShowEnabled() ? PAPER_READONLY : PAPER_NORMAL]); DrawTiles(w, DropCaret(), CtrlImg::checkers()); }