Esempio n. 1
0
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);
}
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 복구.
}
Esempio n. 3
0
void ImeUIStartComposition( HWND hwnd )
{
    PCONSOLE_TABLE ConTbl;

    ConTbl = SearchConsole(LastConsole);
    if (ConTbl == NULL) {
        DBGPRINT(("CONIME: Error! Cannot found registed Console\n"));
        return;
    }

    //
    // Set fInComposition variables.
    //
    ConTbl->fInComposition = TRUE;

#ifdef DEBUG_MODE
    {
        int i ;
        for (i = FIRSTCOL ; i < MAXCOL ; i++) {
            ConvertLine[i] = UNICODE_SPACE ;
            ConvertLineAtr[i] = 0 ;
        }
    }
#endif
#ifdef DEBUG_INFO
    xPos = FIRSTCOL;
    xPosLast = FIRSTCOL;
    HideCaret( hwnd );
    DisplayConvInformation( hwnd ) ;
    ResetCaret( hwnd );
#endif
}
Esempio n. 4
0
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 );
}
Esempio n. 5
0
	LRESULT RichEdit::ParentWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, 
		UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
		if(msg==WM_NOTIFY && (((LPNMHDR)lParam)->code)== EN_LINK) {
			ENLINK* enLinkInfo = (ENLINK *)lParam;
			if(enLinkInfo->msg == WM_LBUTTONUP || enLinkInfo->msg == WM_RBUTTONUP) {
				LONG utlBeg = enLinkInfo->chrg.cpMin;
				LONG utlEnd = enLinkInfo->chrg.cpMax;
				if(utlEnd - utlBeg > 0) {
					HWND hRichEdit = enLinkInfo->nmhdr.hwndFrom;
					wchar_t* urlString = new wchar_t[utlEnd-utlBeg+1];
					SendMessageW(hRichEdit, EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&enLinkInfo->chrg));
					SendMessageW(hRichEdit, EM_GETSELTEXT, 0, reinterpret_cast<LPARAM>(urlString));
					switch(enLinkInfo->msg) {
					case WM_LBUTTONUP:
						ShellExecuteW(NULL, L"open", urlString, NULL, NULL, SW_SHOWNORMAL);
						break;
					case WM_RBUTTONUP:
						copyToClipboard(hRichEdit, urlString);
						break;
					}
					delete [] urlString;
					SendMessage(hRichEdit, EM_SETSEL, utlEnd, utlEnd);
					HideCaret(hRichEdit);
				}
			}
		}
		return DefSubclassProc(hWnd, msg, wParam, lParam);
	}
Esempio n. 6
0
void ME_MouseMove(ME_TextEditor *editor, int x, int y)
{
  ME_Cursor tmp_cursor;

  if (editor->nSelectionType == stDocument)
      return;
  x += editor->horz_si.nPos;
  y += editor->vert_si.nPos;

  tmp_cursor = editor->pCursors[0];
  /* FIXME: do something with the return value of ME_FindPixelPos */
  ME_FindPixelPos(editor, x, y, &tmp_cursor, &editor->bCaretAtEnd);

  ME_InvalidateSelection(editor);
  editor->pCursors[0] = tmp_cursor;
  ME_ExtendAnchorSelection(editor);

  if (editor->nSelectionType != stPosition &&
      memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor)))
  {
      /* The scroll the cursor towards the other end, since it was the one
       * extended by ME_ExtendAnchorSelection */
      ME_EnsureVisible(editor, &editor->pCursors[1]);
  } else {
      ME_EnsureVisible(editor, &editor->pCursors[0]);
  }

  ME_InvalidateSelection(editor);
  HideCaret(editor->hWnd);
  ME_ShowCaret(editor);
  ME_SendSelChange(editor);
}
Esempio n. 7
0
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 );
	}
}
Esempio n. 8
0
/*
 * MyHideCaret - HideCaret w/o additive effects
 */
void MyHideCaret( window_id wid )
{
    if( caretDisplayed ) {
        HideCaret( wid );
        caretDisplayed = false;
    }

} /* MyHideCaret */
void CChildView::OnKillFocus(CWnd* pNewWnd) 
{
	CWnd ::OnKillFocus(pNewWnd);
	
	// Caret 제거.
	HideCaret();
	DestroyCaret();
}
Esempio n. 10
0
/*---------------------------------------------------------------------------*\
 |                                                                           |
\*---------------------------------------------------------------------------*/
void OnKillFocus(HWND hwnd, HWND hwndNewFocus)
{
    /*
     *  Eliminate caret when we lose keyboard.
     */
    HideCaret(hwnd);
    DestroyCaret();
}
Esempio n. 11
0
void ME_HideCaret(ME_TextEditor *ed)
{
  if(ed->bHaveFocus)
  {
    HideCaret(ed->hWnd);
    DestroyCaret();
  }
}
Esempio n. 12
0
void ME_HideCaret(ME_TextEditor *ed)
{
  if(!ed->bHaveFocus || ME_IsSelection(ed))
  {
    HideCaret(ed->hWnd);
    DestroyCaret();
  }
}
Esempio n. 13
0
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);
}
Esempio n. 14
0
/*
 * MyHideCaret - HideCaret w/o additive effects
 */
void MyHideCaret( window_id id )
{
    if( caretDisplayed ) {
        HideCaret( id );
        caretDisplayed = FALSE;
    }

} /* MyHideCaret */
Esempio n. 15
0
void MyKillCaret( window_id id )
{
    if( !caretKilled ) {
        MyHideCaret( id );
        HideCaret( id );
        caretKilled = TRUE;
    }
}
Esempio n. 16
0
void MyKillCaret( window_id wid )
{
    if( !caretKilled ) {
        MyHideCaret( wid );
        HideCaret( wid );
        caretKilled = true;
    }
}
Esempio n. 17
0
void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow)
{
    /* FIXME: Shift tab should move to the previous cell. */
    ME_Cursor fromCursor, toCursor;
    ME_InvalidateSelection(editor);
    {
        int from, to;
        from = ME_GetCursorOfs(editor, 0);
        to = ME_GetCursorOfs(editor, 1);
        if (from <= to)
        {
            fromCursor = editor->pCursors[0];
            toCursor = editor->pCursors[1];
        } else {
            fromCursor = editor->pCursors[1];
            toCursor = editor->pCursors[0];
        }
    }
    if (!editor->bEmulateVersion10) /* v4.1 */
    {
        if (!ME_IsInTable(toCursor.pRun))
        {
            editor->pCursors[0] = toCursor;
            editor->pCursors[1] = toCursor;
        } else {
            ME_SelectOrInsertNextCell(editor, toCursor.pRun);
        }
    } else { /* v1.0 - 3.0 */
        if (!ME_IsInTable(fromCursor.pRun)) {
            editor->pCursors[0] = fromCursor;
            editor->pCursors[1] = fromCursor;
            /* FIXME: For some reason the caret is shown at the start of the
             *        previous paragraph in v1.0 to v3.0, and bCaretAtEnd only works
             *        within the paragraph for wrapped lines. */
            if (ME_FindItemBack(fromCursor.pRun, diRun))
                editor->bCaretAtEnd = TRUE;
        } else if ((bSelectedRow || !ME_IsInTable(toCursor.pRun))) {
            ME_SelectOrInsertNextCell(editor, fromCursor.pRun);
        } else {
            if (ME_IsSelection(editor) && !toCursor.nOffset)
            {
                ME_DisplayItem *run;
                run = ME_FindItemBack(toCursor.pRun, diRunOrParagraphOrEnd);
                if (run->type == diRun && run->member.run.nFlags & MERF_TAB)
                    ME_SelectOrInsertNextCell(editor, run);
                else
                    ME_SelectOrInsertNextCell(editor, toCursor.pRun);
            } else {
                ME_SelectOrInsertNextCell(editor, toCursor.pRun);
            }
        }
    }
    ME_InvalidateSelection(editor);
    ME_Repaint(editor);
    HideCaret(editor->hWnd);
    ME_ShowCaret(editor);
    ME_SendSelChange(editor);
}
Esempio n. 18
0
//**********************************************************************
//
// 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 );

}
Esempio n. 19
0
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;
		}
	}
}
Esempio n. 20
0
static void hugsprim_HideCaret_38(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsBool res1;
    arg1 = hugs->getPtr();
    res1 = HideCaret(arg1);
    hugs->putBool(res1);
    hugs->returnIO(hugs_root,1);
}
Esempio n. 21
0
void CMagneticView::CaretOff(void)
{
  if (m_bCaret)
  {
    HideCaret();
    DestroyCaret();
    m_bCaret = false;
  }
}
Esempio n. 22
0
// Hide and destroy the caret (probably due to losing focus).
void CScrView::caret_hide()
{
	// Is the caret currently displayed?
	if (caret_level_++ == 0 && caret_mode_ && caret_changes_ && caret_seen_)
	{
		// Hide and destroy it
		HideCaret();
		::DestroyCaret();
	}
}
Esempio n. 23
0
/*----------------------------------------------------------------------------*/
void set_update(HWND hwnd) {

    void checkcomment(int oo, int yn);
    int nextcmt(int);

    static int ac; RECT rect;

    if (caret==3)
        HideCaret(hwnd), caret=1;

    if (edp==NULL) {
        InvalidateRect(hwnd, NULL, FALSE);
        return;
    }

    if (upd) checkcomment(fpga,pgy+2);
    setsb(hwnd);

    if (GetFocus() == hwnd)
        SetCaretPos(zx0+(curx-clft)*zx-My_CaretSize/2, zy0+cury*zy);

    //if (chg_0!=changed()) setwtext();

    rect.top   = rect.left=0;
    rect.right = cwx+FRM;

    switch (upd) {
    case 16:                        // color update
    case 4:                         // scroll up
    case 2:                         // scroll dn
    case 1:                         // update all
        rect.bottom = cwy+FRM;
        break;

    case 8:                         // line update
        if (langflg && ac!=nextcmt(fpos))
        {
            rect.bottom = cwy + FRM;
            break;
        }

        rect.top    = zy0+zy*cury;
        rect.bottom = rect.top+zy;
        InvalidateRect(hwnd, &rect, FALSE);
        rect.top    = 0;

    case 0:
    default:
        rect.bottom=title_h;
    }

    InvalidateRect(hwnd, &rect, FALSE);
    if (langflg) ac=nextcmt(fpos);
    upd=0;
}
Esempio n. 24
0
void DisplayResultString( HWND hwnd, LPWSTR lpwStr )
{

    int         StrLen = lstrlenW( lpwStr );

    CopyMemory(ConvertLine, lpwStr, StrLen*sizeof(WCHAR)) ;
    HideCaret( hwnd );
    DisplayConvInformation( hwnd ) ;
    ResetCaret( hwnd );

    // gImeUIData.uCompLen = 0;

}
Esempio n. 25
0
File: guiwin.c Progetto: mbert/elvis
void gwsetbg(GUIWIN *gw, long bg)
{
    GUI_WINDOW  *gwp = (GUI_WINDOW *)gw;
    RECT        rect;
    HDC		hDC;
    HBRUSH	hBrush;

    /* store the new background color */
    gwp->bg = (COLORREF)bg;

    /* get the window's DC */
    hDC = GetDC (gwp->clientHWnd);
    SetMapMode (hDC, MM_TEXT);

    /* hide caret */
    if (gwp->cursor_type != CURSOR_NONE && gwp->clientHWnd == GetFocus ())
    {
        HideCaret (gwp->clientHWnd);
        gwp->cursor_type = CURSOR_NONE;
    }

    /* The portable part of elvis already knows it needs to redraw the text
     * area, but it doesn't know about blank areas around the outside of the
     * window.  The simplest way to color those areas is to simply fill the
     * whole window.
     */
    rect.left = 0;
    rect.top = 0;
    rect.right = gwp->xsize + gwp->xcsize * 2;
    rect.bottom = gwp->ysize + gwp->ycsize;
#ifdef FEATURE_IMAGE
    if (normalimage && bg == colorinfo[COLOR_FONT_NORMAL].bg)
    {
        gw_erase_rect(hDC, &rect, normalimage, gwp->scrolled);
    }
    else if (idleimage && bg == colorinfo[COLOR_FONT_IDLE].bg)
    {
        gw_erase_rect(hDC, &rect, idleimage, gwp->scrolled);
    }
    else
#endif
    {
        hBrush = CreateSolidBrush(gwp->bg);
        FillRect(hDC, &rect, hBrush);
        DeleteObject(hBrush);
    }

    /* release the window's DC */
    ReleaseDC(gwp->clientHWnd, hDC);
}
Esempio n. 26
0
void CSelection::OnFocusChange( BOOL bSetFocus )
{
    if ( bSetFocus )
    {
        VERIFY( CreateCaret( m_hWnd, NULL, m_cxCaret, m_cyCaret ) );
        UpdateCaretPosition();
        ShowCaret();
    }
    else
    {
        HideCaret();
        DestroyCaret();
    }
}
void QWindowsInputContext::initContext(HWND hwnd)
{
    if (m_compositionContext.hwnd)
        doneContext();
    m_compositionContext.hwnd = hwnd;
    // Create a hidden caret which is kept at the microfocus
    // position in update(). This is important for some
    // Chinese input methods.
    m_compositionContext.haveCaret = CreateCaret(hwnd, 0, 1, 1);
    HideCaret(hwnd);
    update(Qt::ImQueryAll);
    m_compositionContext.isComposing = false;
    m_compositionContext.position = 0;
}
Esempio n. 28
0
	LRESULT RichEdit::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, 
		UINT_PTR uIdSubclass, DWORD_PTR dwRefData) {
		if(msg == WM_LBUTTONUP)
			HideCaret(hWnd);
		else if(msg == WM_RBUTTONDOWN) {
			CHARFORMAT cf;
			memset(&cf, 0, sizeof(CHARFORMAT));
			cf.dwMask = CFM_LINK;
			SendMessage(hWnd, EM_GETCHARFORMAT, SCF_SELECTION, reinterpret_cast<LPARAM>(&cf));
			if(!(cf.dwEffects & CFE_LINK)) {
				DWORD selBeg, selEnd;
				SendMessageW(hWnd, EM_GETSEL, (WPARAM)&selBeg, (LPARAM)&selEnd);
				if(selEnd-selBeg > 0) {
					wchar_t* urlString = new wchar_t[selEnd-selBeg+1];
					SendMessageW(hWnd, EM_GETSELTEXT, 0, reinterpret_cast<LPARAM>(urlString));
					copyToClipboard(hWnd, urlString);
					delete [] urlString;
					SendMessageW(hWnd, EM_SETSEL, selEnd, selEnd);
				}
			}
			HideCaret(hWnd);
		}
		return DefSubclassProc(hWnd, msg, wParam, lParam);
	}
Esempio n. 29
0
void Bejeweled::Click(int x,int y) {
	if(!selectiona) { // start action
		selectiona = grid[x][y];
		selector->SetTranslation(float3(2*x,2*y,0.1));
	} else { // end action
		selectionb = grid[x][y];
		HideCaret();
		if(SwapAllowed(selectiona,selectionb)) {
			Swap(selectiona,selectionb);
		} else {
			SwapSwap(selectiona,selectionb);
		}
		Deselect();
	}
}
Esempio n. 30
-1
	RichEdit::RichEdit(HWND hControl) : wtwUpdate::ui::Control(hControl) {
		if (!hControl)
			return;

		memset(&_defaultCf, 0, sizeof(CHARFORMAT));
#ifndef MY_RICHEDIT_NO_OLE
		_pRichEditOle = NULL; 
		SendMessage(getHwnd(), EM_GETOLEINTERFACE, 0, reinterpret_cast<LPARAM>(&_pRichEditOle));
#endif
		SendMessage(getHwnd(), EM_AUTOURLDETECT, TRUE, 0);

		LRESULT mask = SendMessage(getHwnd(), EM_GETEVENTMASK, 0, 0);
		SendMessage(getHwnd(), EM_SETEVENTMASK, 0, mask | ENM_LINK);

		_defaultCf.cbSize = sizeof(CHARFORMAT);
		_defaultCf.dwMask = CFM_ALL;

		SendMessage(getHwnd(), EM_GETCHARFORMAT, SCF_DEFAULT, reinterpret_cast<LPARAM>(&_defaultCf));
		_defaultCf.dwEffects = CFE_AUTOCOLOR;
		wcscpy_s(_defaultCf.szFaceName, 32, L"Tahoma");
		SendMessage(getHwnd(), EM_SETCHARFORMAT, SCF_DEFAULT, reinterpret_cast<LPARAM>(&_defaultCf));

		SetWindowSubclass(getHwnd(), RichEdit::WndProc,
			0, reinterpret_cast<DWORD_PTR>(this));
		SetWindowSubclass(GetParent(getHwnd()), RichEdit::ParentWndProc,
			0, reinterpret_cast<DWORD_PTR>(this));
		HideCaret(getHwnd());
		_scrolledDown = true;

	}