/* * Toggle overwrite mode. */ void ToggleOverwrite( LPCLASSDATA lpcd ) { /* * Toggle overwrite mode. */ lpcd->bOverwrite = ! lpcd->bOverwrite; /* * Destroy the caret if we have focus and * the caret type is not fixed at a block cursor. */ if ( Parser->nCaretType != CARET_BLOCK && lpcd->bHasFocus ) { /* * Destroy... */ DisplayCaret( lpcd, FALSE ); DestroyCaret(); } /* * Update status. */ SendStatusMessage( lpcd ); /* * Create the caret if we have focus and * the caret type is not fixed at a block cursor. */ if ( Parser->nCaretType != CARET_BLOCK && lpcd->bHasFocus ) /* * Create the caret. */ CreateTheCaret( lpcd ); }
/****************************************************************** * WCUSER_ShapeCursor * * Sets a new shape for the cursor */ void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL force) { if (force || size != data->curcfg.cursor_size) { if (data->curcfg.cursor_visible && PRIVATE(data)->hWnd == GetFocus()) DestroyCaret(); if (PRIVATE(data)->cursor_bitmap) DeleteObject(PRIVATE(data)->cursor_bitmap); PRIVATE(data)->cursor_bitmap = (HBITMAP)0; if (size != 100) { int w16b; /* number of byets per row, aligned on word size */ BYTE* ptr; int i, j, nbl; w16b = ((data->curcfg.cell_width + 15) & ~15) / 8; ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, w16b * data->curcfg.cell_height); if (!ptr) {WINE_ERR("OOM\n"); return;} nbl = max((data->curcfg.cell_height * size) / 100, 1); for (j = data->curcfg.cell_height - nbl; j < data->curcfg.cell_height; j++) { for (i = 0; i < data->curcfg.cell_width; i++) { ptr[w16b * j + (i / 8)] |= 0x80 >> (i & 7); } } PRIVATE(data)->cursor_bitmap = CreateBitmap(data->curcfg.cell_width, data->curcfg.cell_height, 1, 1, ptr); HeapFree(GetProcessHeap(), 0, ptr); } data->curcfg.cursor_size = size; data->curcfg.cursor_visible = -1; }
void CSelection::ResetCaret( HFONT hFont ) { HDC hDC = GetDC( NULL ); HFONT hOldFont = ( HFONT ) SelectObject( hDC, hFont ); TEXTMETRIC tm; VERIFY( GetTextMetrics( hDC, &tm ) ); SelectObject( hDC, hOldFont ); ReleaseDC( NULL, hDC ); // caret height is the font height m_cyCaret = tm.tmExternalLeading + tm.tmHeight; // insert caret width is the font height / 6 m_cxCaretIns = m_cyCaret / 6; m_cxCaretIns = max( m_cxCaretIns, 2 ); if ( m_pCtrl->OvertypeCaret() && m_pCtrl->InOvertypeMode() ) { m_cxCaret = tm.tmAveCharWidth; } else { m_cxCaret = m_cxCaretIns; } // recreate the caret in the right dimensions if ( ::GetFocus() == m_hWnd ) { VERIFY( DestroyCaret() ); VERIFY( CreateCaret( m_hWnd, NULL, m_cxCaret, m_cyCaret ) ); ::ShowCaret( m_hWnd ); } }
void CHexEdit::OnEditSelectAll() { m_selStart = 0; m_selEnd = m_length; DestroyCaret(); Invalidate(FALSE); }
/* * setCursorOnScreen - set cursor at specified row and column in edit window */ static void setCursorOnScreen( int row, int col ) { window *w; int x, y; int width; int funny; if( BAD_ID( CurrentWindow ) ) { return; } if( EditFlags.Quiet || EditFlags.NoSetCursor ) { return; } funny = getCursorInfo( CurrentWindow, row, col, &x, &width ); w = WINDOW_FROM_ID( CurrentWindow ); y = row * FontHeight( WIN_FONT( w ) ) - cursorHeight; width = (long) width * cursorType.width / 100L; if( cursorWidth != width ) { MyHideCaret( CurrentWindow ); DestroyCaret(); CreateCaret( CurrentWindow, (HBITMAP)NULLHANDLE, width, cursorHeight ); cursorWidth = width; } // adjust position for italic sillyness SetCaretPos( x - funny, y ); MyShowCaret( CurrentWindow ); } /* setCursorOnScreen */
/* * SetCursorOnLine - set cursor at specified column in single line text string */ void SetCursorOnLine( window_id id, int col, char *str, type_style *style ) { window *w; int x, y; int width, height; if( BAD_ID( id ) ) { return; } w = WINDOW_FROM_ID( id ); // y = FontHeight( WIN_FONT( w ) ) - cursorHeight; x = MyTextExtent( id, style, str, col - 1 ); width = MyTextExtent( id, style, str, col ) - x; /* adjust so that Insert cursor is 0 width * Also make the overstrike cursor the height of the insert cursor. */ width = (long) width * cursorType.width / 100L; height = EditVars.InsertCursorType.height; y = FontHeight( WIN_FONT( w ) ) - height; MyHideCaret( id ); DestroyCaret(); // CreateCaret( id, (HBITMAP)NULLHANDLE, width, cursorHeight ); CreateCaret( id, (HBITMAP)NULLHANDLE, width, height ); SetCaretPos( x, y ); MyShowCaret( id ); } /* SetCursorOnLine */
/* * NewCursor - create a new cursor for a window */ void NewCursor( window_id id, cursor_type ct ) { window *w; int height; int width; if( BAD_ID( id ) ) { return; } w = WINDOW_FROM_ID( id ); height = FontHeight( WIN_FONT( w ) ); width = FontAverageWidth( WIN_FONT( w ) ); height = (long) height * ct.height / 100L; width = (long) width * ct.width / 100L; MyHideCaret( id ); DestroyCaret(); cursorHeight = height; cursorWidth = width; if( !haveOldBlinkTime ) { oldBlinkTime = GetCaretBlinkTime(); haveOldBlinkTime = TRUE; } CreateCaret( id, (HBITMAP)NULLHANDLE, cursorWidth, cursorHeight ); SetCursorBlinkRate( EditVars.CursorBlinkRate ); MyShowCaret( id ); cursorType = ct; } /* NewCursor */
void CHexEdit::OnEditSelectAll() { m_selStart = 0; m_selEnd = m_length; DestroyCaret(); RedrawWindow(); }
static void hugsprim_DestroyCaret_41(HugsStackPtr hugs_root) { HsBool res1; res1 = DestroyCaret(); hugs->putBool(res1); hugs->returnIO(hugs_root,1); }
static LRESULT HOTKEY_KillFocus (HOTKEY_INFO *infoPtr) { infoPtr->bFocus = FALSE; DestroyCaret (); return 0; }
void CMagneticView::CaretOff(void) { CMagneticView* pView = CMagneticView::GetView(); if (pView) pView->HideCaret(); DestroyCaret(); }
static inline LRESULT HexEdit_KillFocus (HEXEDIT_INFO *infoPtr, HWND receiveFocus) { infoPtr->bFocus = FALSE; DestroyCaret(); return 0; }
void CKaiView::OnKillFocus (CWnd* pNewWnd) { CView::OnKillFocus(pNewWnd); // TODO: Add your message handler code here BOOL mfcb_ = DestroyCaret(); // MSDN says this is required }
void CChildView::OnKillFocus(CWnd* pNewWnd) { CWnd ::OnKillFocus(pNewWnd); // Caret 제거. HideCaret(); DestroyCaret(); }
/*---------------------------------------------------------------------------*\ | | \*---------------------------------------------------------------------------*/ void OnKillFocus(HWND hwnd, HWND hwndNewFocus) { /* * Eliminate caret when we lose keyboard. */ HideCaret(hwnd); DestroyCaret(); }
void ME_HideCaret(ME_TextEditor *ed) { if(!ed->bHaveFocus || ME_IsSelection(ed)) { ITextHost_TxShowCaret(ed->texthost, FALSE); DestroyCaret(); } }
void ME_HideCaret(ME_TextEditor *ed) { if(ed->bHaveFocus) { HideCaret(ed->hWnd); DestroyCaret(); } }
void ME_HideCaret(ME_TextEditor *ed) { if(!ed->bHaveFocus || ME_IsSelection(ed)) { HideCaret(ed->hWnd); DestroyCaret(); } }
/* * GoodbyeCursor - we are losing focus, so get rid of our cursor */ void GoodbyeCursor( window_id wid ) { if( haveOldBlinkTime ) { SetCaretBlinkTime( oldBlinkTime ); } MyHideCaret( wid ); DestroyCaret(); } /* GoodbyeCursor */
void CMagneticView::CaretOff(void) { if (m_bCaret) { HideCaret(); DestroyCaret(); m_bCaret = false; } }
/* * _ReleaseWindowResources - get rid of any resources */ void _ReleaseWindowResources( LPWDATA w ) { DeleteObject( w->brush ); if( w->hascursor ) { DestroyCaret(); } DeleteMenu( _SubMenuWindows, MSG_WINDOWS+w->handles[0], MF_BYCOMMAND ); } /* _ReleaseWindowResources */
static void CommandLineKey(int id, WPARAM wParam, int keytype) { TCHAR code = (TCHAR)wParam; int len = (int)wcslen(commandLine); if (keytype == KEYCHAR) { if (!commandLineFocus && code == L':') { CreateCaret(g_hWnd, (HBITMAP)NULL, 1, FONTSIZE_CMD); commandLineFocus = 1; commandLine[commandLinePos++] = L':'; commandLine[commandLinePos] = L'\0'; CommandLineSetpos(); ShowCaret(g_hWnd); } else if (commandLineFocus) { if (code == L'\r' || code == VK_ESCAPE) { if(code == L'\r' && LoaderRun(commandLine + 1)) ErrorPrintf(L"CommandLineError: Cannot parse the command"); commandLine[0] = L'\0'; commandLinePos = 0; commandLineFocus = 0; HideCaret(g_hWnd); DestroyCaret(); memset(KeyboardIsDown, 0, sizeof(KeyboardIsDown)); } if (code < L' ' || len == MAX_COMMANDLINEBUFFER) return; MoveMemory(commandLine + commandLinePos + 1, commandLine + commandLinePos, (len - commandLinePos + 1) * sizeof(TCHAR)); commandLine[commandLinePos++] = code; CommandLineSetpos(); } } else if (keytype == KEYDOWN && commandLineFocus) { switch (code) { case VK_LEFT: if (commandLinePos > 1) --commandLinePos; CommandLineSetpos(); break; case VK_RIGHT: if (commandLinePos < len) ++commandLinePos; CommandLineSetpos(); break; case VK_HOME: commandLinePos = 1; break; case VK_END: commandLinePos = len; break; case VK_BACK: if (commandLinePos > 1) { MoveMemory(commandLine + commandLinePos - 1, commandLine + commandLinePos, (len - commandLinePos + 1) * sizeof(TCHAR)); commandLinePos--; } CommandLineSetpos(); break; } } }
/* * GoodbyeCursor - we are losing focus, so get rid of our cursor */ void GoodbyeCursor( HWND hwnd ) { if( haveOldBlinkTime ) { SetCaretBlinkTime( oldBlinkTime ); } MyHideCaret( hwnd ); DestroyCaret(); } /* GoodbyeCursor */
void QWindowsInputContext::doneContext() { if (!m_compositionContext.hwnd) return; if (m_compositionContext.haveCaret) DestroyCaret(); m_compositionContext.hwnd = 0; m_compositionContext.composition.clear(); m_compositionContext.position = 0; m_compositionContext.isComposing = m_compositionContext.haveCaret = false; }
void CHexEdit::SetSel(int s, int e) { DestroyCaret(); m_selStart = s; m_selEnd = e; RedrawWindow(); if(m_editPos.x == 0 && m_bShowAddress) CreateAddressCaret(); else CreateEditCaret(); SetCaretPos(m_editPos); ShowCaret(); }
void CSelection::OnFocusChange( BOOL bSetFocus ) { if ( bSetFocus ) { VERIFY( CreateCaret( m_hWnd, NULL, m_cxCaret, m_cyCaret ) ); UpdateCaretPosition(); ShowCaret(); } else { HideCaret(); DestroyCaret(); } }
void CSelection::OnFocusChange( BOOL bSetFocus ) { if ( bSetFocus ) { ASSERT( IsWindow( m_hWnd ) ); ASSERT( GetFocus() == m_hWnd ); VERIFY( CreateCaret( m_hWnd, NULL, m_cxCaret, m_cyCaret ) ); UpdateCaretPosition(); ShowCaret(); } else { HideCaret(); ASSERT( IsWindow( m_hWnd ) ); DestroyCaret(); } }
WINEXPORT LRESULT CALLBACK CommandWindowProc( HWND hwnd, UINT msg, WPARAM w, LPARAM l ) { PAINTSTRUCT ps; HDC hdc; window_id wid; switch( msg ) { case WM_CREATE: command_window_id = hwnd; SET_WNDINFO( hwnd, (LONG_PTR)&CommandWindow ); break; case WM_SETFOCUS: /* turn on caret */ NewCursor( hwnd, EditVars.NormalCursorType ); break; case WM_KILLFOCUS: /* turn off the caret */ MyHideCaret( hwnd ); DestroyCaret(); wid = (window_id)w; if( !BAD_ID( wid ) && ( wid == root_window_id || GetWindow( wid, GW_OWNER ) == edit_container_id ) ) { /* hmmm... losing focus to one of our own windows - suicide */ if( ReadingAString ) { KeyAdd( VI_KEY( ESC ) ); } } break; case WM_KEYDOWN: if( WindowsKeyPush( w, HIWORD( l ) ) ) { return( 0 ); } break; case WM_PAINT: hdc = BeginPaint( hwnd, &ps ); FillRect( hdc, &ps.rcPaint, ColorBrush( WIN_TEXT_BACKCOLOR( &CommandWindow ) ) ); /* this will cause the command window to redraw itself in readstr.c */ KeyAdd( VI_KEY( ALT_END ) ); EndPaint( hwnd, &ps ); break; case WM_DESTROY: command_window_id = NO_WINDOW; break; } return( DefWindowProc( hwnd, msg, w, l ) ); }
LONG TextViewBase::OnKillFocus(HWND hwndNew) { // if we are making a selection when we lost focus then // stop the selection logic OutputDebugString(L"OnKillFocus\n"); //RECT cliRect;//, zeroRect = {0,0,0,0}; //GetClientRect(this->m_hWnd, &cliRect); //HBRUSH brush = CreateSolidBrush(m_colba); //FillRect(m_hWnd, & cliRect, ); m_bFocused = false; if(m_nSelectionMode != SEL_NONE) { OnLButtonUp(0, 0, 0); } HideCaret(m_hWnd); DestroyCaret(); RefreshWindow(); return 0; }
void CHexEdit::OnMouseMove(UINT nFlags, CPoint point) { if(!m_pData) return; if(nFlags & MK_LBUTTON && m_selStart != 0xffffffff) { CRect rc; GetClientRect(&rc); if(!rc.PtInRect(point)) { if(point.y < 0) { OnVScroll(SB_LINEUP, 0, NULL); point.y = 0; } else if(point.y > rc.Height()) { OnVScroll(SB_LINEDOWN, 0, NULL); point.y = rc.Height() -1; } } // // we are selecting // int seo = m_selEnd; CPoint pt = CalcPos(point.x, point.y); if(pt.x > -1) { m_selEnd = m_currentAddress; if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW) m_selEnd++; } if(IsSelected()) DestroyCaret(); if(seo != m_selEnd) RedrawWindow(); } }