void CDComView::OnSetFocus(CWnd* pOldWnd) { CMainFrame *pMainFrm = (CMainFrame *)AfxGetMainWnd(); CScrollView::OnSetFocus(pOldWnd); if (pMainFrm) { CreateSolidCaret(1, pMainFrm->GetLineDimentions("a", 1).cy); } ShowCaret(); }
void CChildView::OnSetFocus(CWnd* pOldWnd) { CWnd ::OnSetFocus(pOldWnd); // 캐럿을 생성 한다.(12page) CreateSolidCaret(10, 20); SetCaretPos( pCaret ); ShowCaret(); }
void CHexViewView::showCaret() { if(!m_caretVisible) { CreateSolidCaret(2, CARETHEIGHT); ShowCaret(); m_caretVisible = true; } m_caret.y = minMax(m_caret.y, 0, m_maxCaret.y); m_caret.x = minMax(m_caret.x, 0, m_maxCaret.x); bool redraw = false; if(m_lineCount && (m_lastLineSize < m_lineSize) && (m_topLine + m_caret.y == m_lineCount-1)) { if(m_lineOffset > m_maxLastLineOffset) { m_lineOffset = m_maxLastLineOffset; isNewSelection(); redraw = true; } else { m_caret.x = minMax(m_caret.x, 0, m_lastLineSize - m_lineOffset); redraw = isNewSelection(); } } else { redraw = isNewSelection(); } m_lastCurrentAddr = getCurrentAddr(); m_lastSelection = getSelection(); if(redraw) { repaint(); return; } CPoint p(m_caret.x * m_byteSize.cx + m_contentRect.left + m_digitIndex*m_charSize.cx, m_caret.y * m_byteSize.cy + m_contentRect.top); SetCaretPos(p); m_keepSelection = false; /* const String tmp = format(_T("%s bytes. Addr:%s. Lsize:%d[%d]. Lcount:%I64u, Psize(%d,%d), Scroll(%d,%I64u),max(%d,%I64u)[%d], Caret(%d,%d),max:(%d,%d), Anchor:%I64d, Mark:%s, %s") ,format1000(m_docSize ).cstr() ,format1000(getCurrentAddr()).cstr() ,m_lineSize, m_lastLineSize ,m_lineCount ,m_pageSize.cx, m_pageSize.cy ,m_lineOffset , m_topLine , m_maxLineOffset, m_maxTopLine, m_maxLastLineOffset ,m_caret.x , m_caret.y , m_maxCaret.x , m_maxCaret.y ,m_anchor ,getSelection().toString().cstr() ,m_shift ? _T("shift") : EMPTYSTRING); theApp.GetMainWnd()->SetWindowText(tmp.cstr()); */ }
void CMagneticView::CaretOn(void) { if (GetFocus() == this) { if (!m_bCaret) { TEXTMETRIC FontInfo; m_pTextDC->GetTextMetrics(&FontInfo); int iFontHeight = (int)(FontInfo.tmHeight*1.1); // Turn the caret on CreateSolidCaret(2,iFontHeight); ShowCaret(); m_bCaret = true; } } }
// Turn on the display of the caret (see caret_hide) void CScrView::caret_show() { // Is the caret enabled? if (--caret_level_ == 0 && caret_mode_ && caret_changes_) { CSizeAp size = caret_size(); CPoint scroll = ConvertToDP(scrollpos_); // scroll pos in dev coords CPoint caret = ConvertToDP(caretpos_); // caret pos in dev coords // We have to handle hiding of the caret ourselves because CWnd::SetCaretPos can't // handle big numbers and may show the cursor in the wrong spot with big files, and // we don't want the cursor appearing in the borders (notably the ruler). if (abs(scrollpos_.x - caretpos_.x) < win_width_ + size.cx && // this will need fixing if we put something in bdr_left_ caretpos_.y >= scrollpos_.y && caretpos_.y <= scrollpos_.y + win_height_ - size.cy) { // Create a solid caret (device coords) CSize dev_size; dev_size.cx = size.cx; dev_size.cy = int(size.cy); { CClientDC dc(this); OnPrepareDC(&dc); dc.LPtoDP(&dev_size); } CreateSolidCaret(dev_size.cx, dev_size.cy); caret_seen_ = TRUE; // Caret has been displayed // Set the caret location in device coords DoSetCaretPos(CPoint(caret.x - scroll.x + bdr_left_, int(caret.y - scroll.y) + bdr_top_)); // Display it (may be "on" but not visible within display area) ShowCaret(); } else { // Hide and destroy it caret_seen_ = FALSE; HideCaret(); ::DestroyCaret(); } } }
void CHexEdit::CreateEditCaret() { DestroyCaret(); CreateSolidCaret(m_nullWidth, m_lineHeight); }
void CHexEdit::CreateAddressCaret() { DestroyCaret(); CreateSolidCaret(m_nullWidth * (m_bAddressIsWide ? 8 : 4), m_lineHeight); }
void SuperBoxInput::OnSetFocus(HWND hwnd) { CreateSolidCaret(2, textSize.cy); ::SetCaretPos(textSize.cx * value.size(), 0); ShowCaret(); }