コード例 #1
0
static void ShowCursor(void)
{
    CreateCaret(CrtWindow, 0, CharSize.x, 2);
    SetCaretPos((_Cursor.x - _Origin.x) * CharSize.x,
                (_Cursor.y - _Origin.y) * CharSize.y + CharAscent);
    ShowCaret(CrtWindow);
}
コード例 #2
0
ファイル: winmisc.c プロジェクト: Azarien/open-watcom-v2
/*
 * _DisplayCursor - show the current cursor position
 */
void _DisplayCursor( LPWDATA w )
{
    HDC                 dc;
    SIZE                size;

    dc = GetDC( w->hwnd );
    SelectObject( dc, _FixedFont );
    #ifdef _MBCS
        #ifdef __NT__
            GetTextExtentPoint32( dc, w->tmpbuff->data,
                                  FAR_mbsnbcnt( (LPBYTE)w->tmpbuff->data,w->buffoff+w->curr_pos),
                                  &size );
        #else
            GetTextExtentPoint( dc, w->tmpbuff->data,
                                FAR_mbsnbcnt( (LPBYTE)w->tmpbuff->data, w->buffoff + w->curr_pos),
                                &size );
        #endif
    #else
        #ifdef __NT__
            GetTextExtentPoint32( dc, w->tmpbuff->data, w->buffoff+w->curr_pos,
                                  &size );
        #else
            GetTextExtentPoint( dc, w->tmpbuff->data, w->buffoff+w->curr_pos,
                                &size );
        #endif
    #endif
    SetCaretPos( size.cx+1, (w->LastLineNumber-w->TopLineNumber)*w->ychar );
    ReleaseDC( w->hwnd, dc );
    ShowCaret( w->hwnd );

} /* _DisplayCursor */
コード例 #3
0
ファイル: caret.c プロジェクト: x2on/NiLogViewer
void DisplayCaret( LPCLASSDATA lpcd, BOOL bShow )
{
	/*
	 *	Only when we have the focus.
	 */
	if ( lpcd->bHasFocus == FALSE )
		return;

	/*
	 *	Anything changed?
	 */
	if ( bShow != lpcd->bCaretVisible )
	{
		/*
		 *	Change it.
		 */
		if (( lpcd->bCaretVisible = bShow ) == TRUE )
		{
			int cy = ( Parser->nCaretType == CARET_HORIZONTAL && ! lpcd->bOverwrite ) ? Parser->szCharSize.cy - ( 2 * GetSystemMetrics( SM_CYBORDER )) : 0;
			SetCaretPos( GetMarginWidth( lpcd ) + GetLineMarginWidth( lpcd ) + (( GetCaretOffset( lpcd, lpcd->ptCaretPos.x ) - lpcd->ptViewPos.x ) * Parser->szCharSize.cx ), ( lpcd->ptCaretPos.y - lpcd->ptViewPos.y ) * Parser->szCharSize.cy + cy );
			ShowCaret( lpcd->hWnd );
		}
		else
			HideCaret( lpcd->hWnd );
	}

	/*
	 *	Send caret position message.
	 */
	SendCaretMessage( lpcd );
}
コード例 #4
0
void CHexEdit::OnLButtonDown(UINT nFlags, CPoint point) 
{
	SetFocus();
	if(!m_pData)
		return;
	CPoint pt = CalcPos(point.x, point.y);
	if(pt.x > -1)//点合法
	{
		m_editPos = pt;
		pt.x *= m_nullWidth;
		pt.y *= m_lineHeight;
		
		if(pt.x == 0 && m_bShowAddress)
			CreateAddressCaret();
		else
			CreateEditCaret();
		
		
		if(nFlags & MK_SHIFT)//按下SHIFT
			m_selEnd = m_currentAddress;
		else
		{
			m_selStart= m_currentAddress;
			m_selEnd = m_selStart;
			//if(DragDetect(m_hWnd,point))//按下左键时拖动
            if(DragDetect(point))//按下左键时拖动
				SetCapture();
		}
		SetCaretPos(pt);
		ShowCaret();
		Invalidate(FALSE);
	}


}
コード例 #5
0
ファイル: main.c プロジェクト: leavittx/notepad
/***********************************************************************
 *          NOTEPAD_SetFocus
 *
 *  WM_SETFOCUS window message handle function
 *
 *  ARGUMENTS:
 *    - handle of window:
 *         HWND hWnd
 *    - (not used):
 *         HWND lostFocusWnd
 *  RETURNS: none
 */
static void NOTEPAD_OnSetFocus(HWND hWnd, HWND lostFocusWnd)
{
    CreateCaret(hWnd, NULL, 0, Globals.CharH);
    //SetCaretPos(marginX + caretXpos * tm.tmAveCharWidth, caretYpos * tm.tmHeight + marginY);
    SendMessage(Globals.hMainWnd, WM_KEYDOWN, 0, 0); // Restore caret position
    ShowCaret(hWnd);
}
コード例 #6
0
void CChildView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	if ( nChar == VK_RETURN ) //return 키
	{
		pCaret.y += cyChar;
		pCaret.x = 0;
		SetCaretPos( pCaret );
		return ;
	}
	CClientDC dc(this);
	CFont* old = (CFont*)dc.SelectStockObject( SYSTEM_FIXED_FONT );

	// 출력전에 caret 감추기.
	HideCaret();

	char msg[] = { nChar }; // 1개의 문자를 문자열로 바꾸기.
	dc.TextOut( pCaret.x, pCaret.y, msg, 1);

	pCaret.x += cxChar;
	SetCaretPos( pCaret );

	ShowCaret(); // 출력후 다시 Caret를 보여 준다.

	dc.SelectObject( old); // dc 복구.
}
コード例 #7
0
ファイル: Fader.cpp プロジェクト: jerlich/rt-fsm
void	FaderSetPosition( HWND hFader, int nPos )
/////////////////////////////////////////////////////////////////////////////
{
	PFADERINFO		pFI;
	HDC				hDC;

	pFI = (PFADERINFO)GetWindowLong( hFader, GWL_USERDATA );
	if( !pFI ) 
		return;

	if( !pFI->nMax )
		return;

	pFI->nPos = nPos;

	if( pFI->bHasFocus )
		HideCaret( hFader );
	
	hDC = GetDC( hFader );
	// MoveKnob updates pFI->nBitmapPos
	MoveKnob( hDC, (pFI->nMax - pFI->nPos) * (pFI->nWindowY - pFI->bmFader.bmHeight) / pFI->nMax, pFI );
	ReleaseDC( hFader, hDC );

	if( pFI->bHasFocus )
	{
		SetCaretPos( pFI->nBitmapX + 2, pFI->nBitmapPos + (CARET_OFFSET/2) );
		ShowCaret( hFader );
	}
}
コード例 #8
0
ファイル: main.cpp プロジェクト: aehaynes/otskok-impuls
void wlog(const char* buffer){
		char* buf;
	    int hloglen=GetWindowTextLength(hlog)+1;
	    int slen=strlen(buffer)+1;
		if(slen<30000){
		        buf= new char[2];//hloglen+slen+1];
		        buf = (char*)Mrealloc(buf,hloglen+slen+1);
				memset(buf,0,hloglen+slen+1);
				if((hloglen+slen)<30000)GetWindowText(hlog,buf,hloglen);
				else{
					char* tmpbuf=new char[2];tmpbuf = (char*)Mrealloc(tmpbuf,hloglen+1);GetWindowText(hlog,&tmpbuf[0],hloglen);
					//int oldsize;oldsize=sizeof(globallog);
					globallog = (char*)Mrealloc(globallog,hloglen+globallogsize+1);
					memcpy(&globallog[globallogsize],tmpbuf,hloglen-1);globallogsize+=hloglen;
				}
				lstrcat(buf,buffer);
				SetWindowText(hlog, buf);
				Edit_Scroll(hlog,Edit_GetLineCount(hlog),0);
				int wlen=GetWindowTextLength(hlog);
				Edit_SetSel(hlog,wlen-1,wlen);
				Edit_SetSel(hlog,wlen,wlen);
				SetFocus(hlog);
				ShowCaret(hlog);
				delete[] buf;
		}
}
コード例 #9
0
ファイル: caret.c プロジェクト: NVIDIA/winex_lgpl
void ME_LButtonDown(ME_TextEditor *editor, int x, int y)
{
  ME_Cursor tmp_cursor;
  int is_selection = 0;
  
  editor->nUDArrowX = -1;
  
  y += ME_GetYScrollPos(editor);

  tmp_cursor = editor->pCursors[0];
  is_selection = ME_IsSelection(editor);

  ME_FindPixelPos(editor, x, y, &editor->pCursors[0], &editor->bCaretAtEnd);
  
  if (GetKeyState(VK_SHIFT)>=0)
  {
    editor->pCursors[1] = editor->pCursors[0];
  }
  else
  {
    if (!is_selection) {
      editor->pCursors[1] = tmp_cursor;
      is_selection = 1;
    }
  }
  ME_InvalidateSelection(editor);
  HideCaret(editor->hWnd);
  ME_MoveCaret(editor);
  ShowCaret(editor->hWnd);
  ME_ClearTempStyle(editor);
  ME_SendSelChange(editor);
}
コード例 #10
0
ファイル: user.c プロジェクト: NVIDIA/winex_lgpl
/******************************************************************
 *		WCUSER_PosCursor
 *
 * Set a new position for the cursor
 */
static void	WCUSER_PosCursor(const struct inner_data* data)
{
    if (PRIVATE(data)->hWnd != GetFocus() || !data->curcfg.cursor_visible) return;

    SetCaretPos((data->cursor.X - data->curcfg.win_pos.X) * data->curcfg.cell_width,
		(data->cursor.Y - data->curcfg.win_pos.Y) * data->curcfg.cell_height);
    ShowCaret(PRIVATE(data)->hWnd);
}
コード例 #11
0
ファイル: cursor.c プロジェクト: Azarien/open-watcom-v2
/*
 * MyShowCaret - ShowCaret w/o additive effects
 */
void MyShowCaret( window_id wid )
{
    if( !caretDisplayed && !caretKilled ) {
        ShowCaret( wid );
        caretDisplayed = true;
    }

} /* MyShowCaret */
コード例 #12
0
/*
 * MyShowCaret - ShowCaret w/o additive effects
 */
void MyShowCaret( window_id id )
{
    if( !caretDisplayed && !caretKilled ) {
        ShowCaret( id );
        caretDisplayed = TRUE;
    }

} /* MyShowCaret */
コード例 #13
0
ファイル: cursor.c プロジェクト: Azarien/open-watcom-v2
void MyRaiseCaret( window_id wid )
{
    if( caretKilled ) {
        ShowCaret( wid );
        caretKilled = false;
        MyShowCaret( wid );
    }
}
コード例 #14
0
void MyRaiseCaret( window_id id )
{
    if( caretKilled ) {
        ShowCaret( id );
        caretKilled = FALSE;
        MyShowCaret( id );
    }
}
コード例 #15
0
ファイル: txthost.c プロジェクト: RareHare/reactos
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
{
    ITextHostImpl *This = impl_from_ITextHost(iface);
    if (fShow)
        return ShowCaret(This->hWnd);
    else
        return HideCaret(This->hWnd);
}
コード例 #16
0
void CHexEditor::OnLButtonDown(UINT nFlags, CPoint point) 
{
	SetFocus();
	if(!m_pData)
		return;

	if(nFlags & MK_SHIFT)
	{
		m_selStart = m_currentAddress;
	}
	CPoint pt = CalcPos(point.x, point.y);
	if(pt.x > -1)
	{
		m_editPos = pt;
		pt.x *= m_nullWidth;
		pt.y *= m_lineHeight;
		
		if(pt.x == 0 && m_bShowAddress)
			CreateAddressCaret();
		else
			CreateEditCaret();

		SetCaretPos(pt);
		if(nFlags & MK_SHIFT)
		{
			m_selEnd = m_currentAddress;
			if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
				m_selEnd++;
			RedrawWindow();
		}
	}
	if(!(nFlags & MK_SHIFT))
	{
#ifdef _VS6_USED
		if(DragDetect(this->m_hWnd, point))
#else
		if(DragDetect(point))
#endif
		{
			m_selStart = m_currentAddress;
			m_selEnd   = m_selStart;
			SetCapture();
		}
		else
		{
			BOOL bsel = m_selStart != 0xffffffff;

			m_selStart = 0xffffffff;
			m_selEnd   = 0xffffffff;
			if(bsel)
				RedrawWindow();
		}
	}
	if(!IsSelected())
	{
		ShowCaret();
	}
}
コード例 #17
0
ファイル: ImeUI.C プロジェクト: nizihabi/sdk71examples
//**********************************************************************
//
// void ImeUIClearData()
//
// Handler routine of WM_IME_SELECT message.
//
//**********************************************************************
void ImeUIClearData( 
    HWND hwnd )
{

    RECT            rect;           
    int             i;
   
    SetWindowText( hwnd, szSteTitle );

    //
    // If user switches to other IME, here we destroy all candidate
    // windows which has been opened and erase all composition
    // chars if any.
    //

    for( i = 0; i < MAX_LISTCAND; i++ )
    {
        if ( gImeUIData.hListCand[ i ] )
        {
            //
            // The i-th candidate list has already been displayed,
            // destroy it and free memory which stores candidate
            // strings.
            //

            DestroyWindow( gImeUIData.hListCand[ i] );
            GlobalFree( gImeUIData.hListCandMem[ i ] );

            gImeUIData.hListCand[ i ] =
            gImeUIData.hListCandMem[ i ] = NULL;

        }
    }

    //
    // Update client area.
    //

    GetClientRect( hwnd, &rect );

    InvalidateRect( hwnd, &rect, FALSE );


    //
    // Reset IMEUI's global data.
    //

    gImeUIData.uCompLen = gImeUIData.ImeState = 0;

    //
    // Reset caret to the original position.
    //

    HideCaret( hwnd );
    ResetCaret( hwnd );
    ShowCaret( hwnd );

}
コード例 #18
0
ファイル: Window.c プロジェクト: xpika/winhugs
static void hugsprim_ShowCaret_39(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsBool res1;
    arg1 = hugs->getPtr();
    res1 = ShowCaret(arg1);
    hugs->putBool(res1);
    hugs->returnIO(hugs_root,1);
}
コード例 #19
0
ファイル: commonui.cpp プロジェクト: sunziping2016/Escape
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;
		}
	}
}
コード例 #20
0
ファイル: CARET.CPP プロジェクト: venkatarajasekhar/repo
/*---------------------------------------------------------------------------*\
 |                                                                           |
\*---------------------------------------------------------------------------*/
void OnSetFocus(HWND hwnd, HWND hwndOldFocus)
{
    /*
     *  Set up caret when we get keyboard.
     */
    CreateCaret(hwnd, NULL, cxIcon, cyIcon);
    SetCaretPos(xCaret, yCaret);
    ShowCaret(hwnd);
}
コード例 #21
0
void TextDisplay::RemoveStyle (int l1, int i1, int l2, int i2, int style) {
    for (int l = l1; l <= l2; ++l) {
        int first = (l == l1) ? i1 : -10000;
        int last = (l == l2) ? i2 : 10000;
        Line(l, true)->RemoveStyle(this, l, first, last, style);
    }
    if (l1 <= caretline && l2 >= caretline) {
        ShowCaret();
    }
}
コード例 #22
0
ファイル: DComView.cpp プロジェクト: cdesjardins/DCom
void CDComView::OnSetFocus(CWnd* pOldWnd)
{
    CMainFrame *pMainFrm = (CMainFrame *)AfxGetMainWnd();
    CScrollView::OnSetFocus(pOldWnd);
    if (pMainFrm)
    {
        CreateSolidCaret(1, pMainFrm->GetLineDimentions("a", 1).cy);
    }
    ShowCaret();
}
コード例 #23
0
void CChildView::OnSetFocus(CWnd* pOldWnd) 
{
	CWnd ::OnSetFocus(pOldWnd);
	
	// 캐럿을 생성 한다.(12page)
	CreateSolidCaret(10, 20);

	SetCaretPos( pCaret );
	
	ShowCaret();
}
コード例 #24
0
ファイル: TextViewBase.cpp プロジェクト: aronsoyol/MnView
LONG TextViewBase::OnSetFocus(HWND hwndOld)
{
	//CreateCaret(m_hWnd, (HBITMAP)NULL, m_nCaretWidth, m_nLineHeight);
	m_bFocused = true;
	CreateMyCaret();
	RepositionCaret();

	ShowCaret(m_hWnd);
	RefreshWindow();
	return 0;
}
コード例 #25
0
ファイル: hotkey.c プロジェクト: AlexSteel/wine
static LRESULT
HOTKEY_SetFocus (HOTKEY_INFO *infoPtr)
{
    infoPtr->bFocus = TRUE;

    CreateCaret (infoPtr->hwndSelf, NULL, 1, infoPtr->nHeight);
    SetCaretPos (infoPtr->CaretPos, GetSystemMetrics(SM_CYBORDER));
    ShowCaret (infoPtr->hwndSelf);

    return 0;
}
コード例 #26
0
void COcxHxeditCtrl::OnSetFocus(CWnd* pOldWnd) 
{
	COleControl::OnSetFocus(pOldWnd);
	
	// TODO: Add your message handler code here
	ShowCaret();
	//获得焦点是装载钩子
	if (m_pwdStatue)
		SetHook(true);
	
}
コード例 #27
0
ファイル: hexedit.c プロジェクト: howard5888/wineT
static inline LRESULT
HexEdit_SetFocus (HEXEDIT_INFO *infoPtr, HWND lostFocus)
{
    infoPtr->bFocus = TRUE;

    CreateCaret(infoPtr->hwndSelf, NULL, 1, infoPtr->nHeight);
    HexEdit_UpdateCaret(infoPtr);
    ShowCaret(infoPtr->hwndSelf);

    return 0;
}
コード例 #28
0
ファイル: wingdi.c プロジェクト: EPiCS/reconos_v2
BOOL WINAPI 
EndPaint(HWND hwnd, CONST PAINTSTRUCT *lpPaint)
{
	ReleaseDC(hwnd, lpPaint->hdc);
#if UPDATEREGIONS
	/* don't clear update region until done dragging*/
	if(mwERASEMOVE && !dragwp)
		GdSetRectRegion(hwnd->update, 0, 0, 0, 0);
#endif
	ShowCaret(hwnd);
	return TRUE;
}
コード例 #29
0
ファイル: HexEdit.cpp プロジェクト: Garfield-Chen/openlibs
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();
}
コード例 #30
0
ファイル: HexEdit.cpp プロジェクト: Garfield-Chen/openlibs
void CHexEdit::OnSetFocus(CWnd* pOldWnd) 
{
	if(m_pData && !IsSelected())
	{
		if(m_editPos.x == 0 && m_bShowAddress)
			CreateAddressCaret();
		else
			CreateEditCaret();
		SetCaretPos(m_editPos);
		ShowCaret();
	}
	CWnd::OnSetFocus(pOldWnd);
}