Ejemplo n.º 1
0
bool Interactor2DMeasure::ProcessMouseMoveEvent( QMouseEvent* event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;

  if ( m_bDrawing )
  {
    UpdateCursor( event, view );
    int posX = event->x();
    int posY = event->y();

//    LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( m_strLayerTypeName.c_str() );
//    LayerVolumeBase* mri = ( LayerVolumeBase* )lc->GetActiveLayer();

    if ( m_region )
    {
      if ( m_nAction == MM_Line )
      {
        ((Region2DLine*)m_region)->SetPoint2( posX, posY );
      }
      else if ( m_nAction == MM_Spline || m_nAction == MM_Polyline )
      {
        ((Region2DPolyline*)m_region)->UpdatePoint( -1, posX, posY );
      }
      else if ( m_nAction == MM_Rectangle )
      {
        ((Region2DRectangle*)m_region)->SetBottomRight( posX, posY );
      }
      view->RequestRedraw();
    }

    return false;
  }
  else if ( m_bEditing )
  {
    UpdateCursor( event, view );
    int offsetX = event->x() - m_nMousePosX;
    int offsetY = event->y() - m_nMousePosY;
    if ( m_region )
    {
      m_nMousePosX = event->x();
      m_nMousePosY = event->y();
      if ( m_nPointIndex >= 0 )
      {
        m_region->UpdatePoint( m_nPointIndex, m_nMousePosX, m_nMousePosY );
      }
      else
      {
        m_region->Offset( offsetX, offsetY );
      }
      view->RequestRedraw();
    }

    return false;
  }
  else
  {
    return Interactor2D::ProcessMouseMoveEvent( event, renderview );
  }
}
Ejemplo n.º 2
0
// _SetMode
void
PathManipulator::_SetMode(uint32 mode)
{
	if (fMode != mode) {
//printf("switching mode: %s -> %s\n", string_for_mode(fMode), string_for_mode(mode));
		fMode = mode;

		if (fMode == TRANSFORM_POINTS) {
			_SetTransformBox(new TransformPointsBox(fCanvasView,
													this,
													fPath,
													fSelection->Items(),
													fSelection->CountItems()));
//			fCanvasView->Perform(new EnterTransformPointsCommand(this,
//														  fSelection->Items(),
//														  fSelection->CountItems()));
		} else {
			if (fTransformBox)
				_SetTransformBox(NULL);
		}

		if (BWindow* window = fCanvasView->Window()) {
			window->PostMessage(MSG_UPDATE_SHAPE_UI);
		}
		UpdateCursor();
	}
}
Ejemplo n.º 3
0
bool UITextEditor::Finalise(void)
{
    if (m_template)
        return true;

    if (!m_textWidget)
    {
        UIWidget *text = FindChildByName("text");
        if (text && text->Type() == UIText::kUITextType)
            m_textWidget = static_cast<UIText*>(text);
    }

    if (!m_cursor && m_textWidget)
    {
        m_cursor = FindChildByName("cursor", true);
        if (m_cursor)
        {
            connect(this, SIGNAL(Selected()),   m_cursor, SLOT(Show()));
            connect(this, SIGNAL(Deselected()), m_cursor, SLOT(Hide()));
            if (!m_selected)
                m_cursor->Hide();
        }
    }

    UpdateCursor();

    return UIWidget::Finalise();
}
Ejemplo n.º 4
0
void CChildView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
  if (theApp.m_map.IsEmpty()) goto mend;
  UpdateCursor();
mend:	
	CWnd ::OnKeyUp(nChar, nRepCnt, nFlags);
}
Ejemplo n.º 5
0
void NEO::Screen::ColocarCursor(uint8_t x, uint8_t y)
{
	cursor_x=x;
	cursor_y=y;
	
	UpdateCursor();
}
Ejemplo n.º 6
0
bool Interactor2DVolumeEdit::ProcessKeyDownEvent( QKeyEvent* event, RenderView* renderview )
{
  UpdateCursor( event, renderview );

  RenderView2D* view = ( RenderView2D* )renderview;
  if ( event->modifiers() & Qt::AltModifier && event->key() == Qt::Key_H )
  {
    Contour2D* c2d = view->GetContour2D();
    c2d->SetVisible( !c2d->IsVisible() );
    view->RequestRedraw();
    return false;
  }
  else if (event->modifiers() & Qt::ShiftModifier && event->key() == Qt::Key_C)
  {
    m_bColorPicking = true;
    return false;
  }
  else if (event->key() == Qt::Key_Escape)
  {
    m_bColorPicking = false;
    return false;
  }

  if ( !m_bEditing )
  {
    return Interactor2D::ProcessKeyDownEvent( event, renderview );
  }
  else
  {
    return false;
  }
}
Ejemplo n.º 7
0
Archivo: tkPointer.c Proyecto: aosm/tcl
int
XGrabPointer(
    Display *display,
    Window grab_window,
    Bool owner_events,
    unsigned int event_mask,
    int pointer_mode,
    int keyboard_mode,
    Window confine_to,
    Cursor cursor,
    Time time)
{
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    display->request++;
    tsdPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(display, grab_window);
    tsdPtr->restrictWinPtr = NULL;
    TkpSetCapture(tsdPtr->grabWinPtr);
    if (TkPositionInTree(tsdPtr->lastWinPtr, tsdPtr->grabWinPtr)
	    != TK_GRAB_IN_TREE) {
	UpdateCursor(tsdPtr->grabWinPtr);
    }
    return GrabSuccess;
}
Ejemplo n.º 8
0
/**
 * @brief Sets the cursor via software
 * @param x The position of X
 * @param y The position of y
 * */
void ND::Screen::SetCursor(uint8_t x, uint8_t y)
{
	cursor_x=x;
	cursor_y=y;
	
	UpdateCursor();
}
Ejemplo n.º 9
0
/// @todo Implement
void
Console::Erase(EraseDirection d, bool line)
{
	const uint16_t attr = GetAttr(0);
	if (line) {
		switch(d) {
			case FORWARD:
				break;
			case BACKWARD:
				break;
			case BOTH:
				break;
		}
	} else {
		switch(d) {
			case FORWARD:
				break;
			case BACKWARD:
				break;
			case BOTH: {
				_canvas.Fill(attr);
				_cursor = _canvas.Buffer();
				UpdateCursor();

				Invalidate();
				break;
			}
		}
	}
}
Ejemplo n.º 10
0
void
Console::PrintChar (char c)
{
	if (AnsiEscFilter(c)) {
		UpdateCursor();
		return;
	}
	switch(c) {
		case '\n': PutNewLine(); break;
		case '\t': PutTab(); break;
		case '\r': PutReturn(); break;
		case '\b': PutBackspace(); break;
		default: PutChar(c); break;
	}
	UpdateCursor();
}
Ejemplo n.º 11
0
bool Interactor2DVolumeEdit::ProcessMouseUpEvent( QMouseEvent* event, RenderView* renderview )
{
// RenderView2D* view = ( RenderView2D* )renderview;
  UpdateCursor( event, renderview );

  if ( m_bEditing )
  {
    m_nMousePosX = event->x();
    m_nMousePosY = event->y();

    if ( event->button() != Qt::LeftButton ||
         (m_nAction != EM_Polyline && m_nAction != EM_Livewire ) ||
         m_dPolylinePoints.size() == 0 )
    {
      m_bEditing = false;
    }

    LayerCollection* lc = MainWindow::GetMainWindow()->GetLayerCollection( m_strLayerTypeName );
    LayerVolumeBase* mri = ( LayerVolumeBase* )lc->GetActiveLayer();
//   mri->SendBroadcast( "LayerEdited", mri );

    return false;
  }
  else
  {
    return Interactor2D::ProcessMouseUpEvent( event, renderview );
  }
}
Ejemplo n.º 12
0
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
void
HostMain(void)
{
    switch(iUSBState)
    {
        //
        // This state is entered when the mouse is first detected.
        //
        case eStateMouseInit:
        {
            //
            // Initialize the newly connected mouse.
            //
            USBHMouseInit(g_psMouseInstance);

            //
            // Proceed to the mouse connected state.
            //
            iUSBState = eStateMouseConnected;

            //
            // Update the status on the screen.
            //
            UpdateStatus(0, 0, true);

            //
            // Update the cursor on the screen.
            //
            UpdateCursor(GrContextDpyWidthGet(&g_sContext) / 2,
                         GrContextDpyHeightGet(&g_sContext)/ 2);

            break;
        }
        case eStateMouseConnected:
        {
            //
            // Nothing is currently done in the main loop when the mouse
            // is connected.
            //
            break;
        }
        case eStateNoDevice:
        {
            //
            // The mouse is not connected so nothing needs to be done here.
            //
            break;
        }
        default:
        {
            break;
        }
    }

    //
    // Periodically call the main loop for the Host controller driver.
    //
    USBHCDMain();
}
Ejemplo n.º 13
0
bool Interactor2DNavigate::ProcessMouseUpEvent( QMouseEvent* event, RenderView* renderview )
{
  UpdateCursor( event, renderview );

  m_bEditing = false;

  return Interactor2D::ProcessMouseUpEvent( event, renderview );
}
Ejemplo n.º 14
0
  void MoveCursor() {
    if (cursor >= _tcslen(buffer))
      buffer[cursor + 1] = 0;

    lettercursor = FindEntryLetter(ToUpperASCII(buffer[cursor]));

    UpdateCursor();
  }
Ejemplo n.º 15
0
void CDragVirtualListCtrl::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (m_Dragging) {
		UpdateCursor(point);
		AutoScroll(point);
	}
	CListCtrl::OnMouseMove(nFlags, point);
}
Ejemplo n.º 16
0
void EditFrame::SetGeomMode(EnumGeomMode geomMode)
{
	if(m_GeomMode != geomMode)
	{
		m_GeomMode = geomMode;
		UpdateCursor();
	}
}
Ejemplo n.º 17
0
LRESULT Win32Window::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	if(inputManager && inputManager->ProcessWindowMessage(uMsg, wParam, lParam))
		return 0;

	switch(uMsg)
	{
	case WM_ACTIVATE:
		{
			unsigned state = LOWORD(wParam);
			bool active = (state == WA_ACTIVE || state == WA_CLICKACTIVE);
			// update activity flag
			this->active = active;
			// update mouse lock
			UpdateMouseLock();
			// update cursor visibility
			UpdateCursorVisible();
		}
		return 0;
	case WM_MOVE:
		UpdateMouseLock();
		return 0;
	case WM_SIZE:
		clientWidth = LOWORD(lParam);
		clientHeight = HIWORD(lParam);
		if(presenter)
			presenter->Resize(clientWidth, clientHeight);
		UpdateMouseLock();
		return 0;
	case WM_SETCURSOR:
		if(LOWORD(lParam) == HTCLIENT)
		{
			UpdateCursor();
			return 0;
		}
		break;
	case WM_DPICHANGED:
		{
			dpiScale = float(LOWORD(wParam)) / float(USER_DEFAULT_SCREEN_DPI);
			const RECT* rect = (const RECT*)lParam;
			SetWindowPos(hWnd, NULL, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, SWP_NOACTIVATE | SWP_NOZORDER);
		}
		break;
	case WM_CLOSE:
		Close();
		return 0;
	case WM_DESTROY:
		hWnd = 0;
		ClipCursor(NULL);
		if(own)
			PostQuitMessage(0);
		return 0;
	}

	if(prevWndProc)
		return CallWindowProc(prevWndProc, hWnd, uMsg, wParam, lParam);
	return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
Ejemplo n.º 18
0
bool Interactor2DMeasure::ProcessMouseUpEvent( QMouseEvent* event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;
  UpdateCursor( event, renderview );

  if ( m_bDrawing )
  {
    if ( ( m_nAction == MM_Spline || m_nAction == MM_Polyline ) && m_region )
    {
      return false;
    }

    if ( m_nMousePosX != event->x() || m_nMousePosY != event->y() )
    {
      m_nMousePosX = event->x();
      m_nMousePosY = event->y();

      //    if ( event->LeftUp() )

//     LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );
//     LayerVolumeBase* mri = ( LayerVolumeBase* )lc->GetActiveLayer();
//     mri->SendBroadcast( "LayerEdited", mri );
      if ( m_region )
      {
        if ( m_nAction == MM_Line )
        {
          ((Region2DLine*)m_region)->SetPoint2( m_nMousePosX, m_nMousePosY );
        }
        else if ( m_nAction == MM_Rectangle )
        {
          ((Region2DRectangle*)m_region)->SetBottomRight( m_nMousePosX, m_nMousePosY );
        }
      }
    }
    else
    {
      if ( m_region && m_nAction != MM_Polyline && m_nAction != MM_Spline )
      {
        view->DeleteRegion( m_region );
        m_region = NULL;
      }
    }

    m_bEditing = false;
    m_bDrawing = false;
    return false;
  }
  else if ( m_bEditing )
  {
    m_bEditing = false;
    m_bDrawing = false;
    return false;
  }
  else
  {
    return Interactor2D::ProcessMouseUpEvent( event, renderview );
  }
}
Ejemplo n.º 19
0
bool Interactor2DRegionEdit::ProcessKeyDownEvent( wxKeyEvent& event, RenderView* renderview )
{
  UpdateCursor( event, renderview );

  if ( !m_bEditing )
    return Interactor2D::ProcessKeyDownEvent( event, renderview );
  else
    return false;
}
Ejemplo n.º 20
0
EditFrame::EditFrame(QWidget *pWidget)
	: QWidget(pWidget)
	, m_GeomMode(GEOM_MODE_MOVE)
	, m_MouseDown(false)
	, m_Selected(false)
{
	setMouseTracking(true);
	UpdateCursor();
}
Ejemplo n.º 21
0
void EditFrame::SetMouseDown(bool b)
{
	if(m_MouseDown != b)
	{
		m_MouseDown = b;
		UpdateCursor();
		emit grabbed(m_MouseDown ? this : 0);
	}
}
Ejemplo n.º 22
0
void rvGEWorkspace::UpdateCursor ( void )
{
	if ( mDragType == rvGESelectionMgr::HT_NONE )
	{
		POINT	point;
		idVec2	cursor;

		GetCursorPos ( &point );
		cursor.Set ( point.x, point.y );
		WindowToWorkspace ( cursor );

		UpdateCursor ( cursor.x, cursor.y );
	}
	else
	{
		UpdateCursor ( mDragType );
	}
}
void OverlayControl::MouseDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	if (!ActiveOverlay)
		return;

	//	Left or right button clicked -- select the element under cursor.
	RECT clipRect, clientRect;
	GetWindowRect(hwnd, &clipRect);
	GetClientRect(hwnd, &clientRect);

	//	Save original mouse position.
	GetCursorPosition(hwnd, &clickAnchor);

	//	Element could be activated only if no element active AND user doesn't click 
	//	within the active element.
	if (!ActiveOverlay->ActiveElement || 
		!ActiveOverlay->HitTestElement(ActiveOverlay->ActiveElement, &clientRect, &clickAnchor, &hitTestAnchor))
	{
		//	Find overlay element under cursor.
		OverlayElement *element = ActiveOverlay->FindElementFromPoint(&clientRect, &clickAnchor, &hitTestAnchor);
		ActivateElement(hwnd, element);
	}

	if (!ActiveOverlay->ActiveElement)
	{
		ResetCursor();
	}

	if (0 != (wParam & MK_LBUTTON))
	{
		if (ActiveOverlay->ActiveElement)
		{
			ActiveOverlay->ActiveElement->GetRect(&clientRect, &elementRectAnchor);

			//	Show that we're about to drag the object.
			UpdateCursor(hitTestAnchor);

			//	Capture the mouse.
			SetCapture(hwnd);
			ClipCursor(&clipRect);
		}

		return;
	}

	if (0 != (wParam & MK_RBUTTON))
	{
		//	Show popup menu.
		POINT pt;
		GetCursorPos(&pt);

		__raise RightMouseButtonClicked(ActiveOverlay->ActiveElement, &pt);

		return;
	}
}
Ejemplo n.º 24
0
/*******************************************************************
* OpenDribbleFile: Function will display the common file dialog and
*    will open a dribble file.
******************************************************************/
void OpenDribbleFile ( HWND hMain, WORD wParam )
{  extern HANDLE hInst;
   OPENFILENAME ofn;
   char File[256], FileTitle[256], Filter[256];
   UINT i, cbString;
   char Replace;
   HMENU hMenu = GetMenu(hMain);

   if ( !DribbleActive() )
   {  File[0] = '\0';
      memset ( &ofn,0, sizeof (OPENFILENAME));
      ofn.lpstrTitle = "Select CLIPS Dribble File";
      if ((cbString = LoadString ( (HINSTANCE) hInst, IDS_DRIBBLE, Filter, sizeof (Filter))) == 0 )
         return;

      Replace = Filter[cbString-1];
      for (i=0; Filter[i] != '\0'; i++)
         if ( Filter[i] == Replace)
	    Filter[i] = '\0';

      ofn.lStructSize = sizeof ( OPENFILENAME );
      ofn.hwndOwner = hMain;
      ofn.lpstrFilter = Filter;
      ofn.nFilterIndex = 1;
      ofn.lpstrFile = File;
      ofn.nMaxFile = sizeof (File );
      ofn.lpstrFileTitle = FileTitle;
      ofn.nMaxFileTitle = sizeof (FileTitle);
      ofn.lpstrInitialDir = NULL;
      ofn.Flags = OFN_OVERWRITEPROMPT;

      if ( GetSaveFileName ( &ofn ) )
      {  UpdateCursor ( WAIT_CURSOR );
         ModifyMenu (hMenu, wParam, MF_BYCOMMAND, wParam, "Turn Dribble Off");
         DribbleOn ( ofn.lpstrFile );
      }
   }
   else
   {  UpdateCursor ( WAIT_CURSOR );
      ModifyMenu (hMenu, wParam, MF_BYCOMMAND, wParam, "Turn Dribble On...");
      DribbleOff( );
   }
}
Ejemplo n.º 25
0
static void
MoveCursor()
{
    if (cursor >= _tcslen(edittext))
        edittext[cursor + 1] = 0;

    lettercursor = FindEntryLetter(ToUpperASCII(edittext[cursor]));

    UpdateCursor();
}
Ejemplo n.º 26
0
size_t TextTerminal::Print(const char* string, size_t stringlen)
{
	ScopedLock lock(&termlock);
	TextBuffer* textbuf = textbufhandle->Acquire();
	for ( size_t i = 0; i < stringlen; i++ )
		PutChar(textbuf, string[i]);
	UpdateCursor(textbuf);
	textbufhandle->Release(textbuf);
	return stringlen;
}
Ejemplo n.º 27
0
static bool
FormKeyDown(unsigned key_code)
{
    switch (key_code) {
    case KEY_UP:
    case KEY_LEFT:
        if ((key_code == KEY_LEFT) ^ IsAltair()) {
            if (cursor < 1)
                return true; // min width

            cursor--;
            MoveCursor();
            return true;
        } else {
            lettercursor--;
            UpdateCursor();
            return true;
        }

    case KEY_DOWN:
    case KEY_RIGHT:
        if ((key_code == KEY_RIGHT) ^ IsAltair()) {
            if (cursor + 2 >= max_width)
                return true; // max width

            cursor++;
            MoveCursor();
            return true;
        } else {
            lettercursor++;
            UpdateCursor();
            return true;
        }
    case KEY_RETURN:
        wf->SetModalResult(mrOK);
        return true;

    default:
        return false;
    }
}
Ejemplo n.º 28
0
/**
 * @brief Puts the char on screen
 * @param c The character to write
 * */
void ND::Screen::PutChar(char c)
{
	uint8_t  attributeByte = (backColour << 4) | (foreColour & 0x0F);
	uint16_t attribute = attributeByte << 8;
	uint16_t *location;
	if (c == 0x08 && cursor_x)
	{
		cursor_x--;
	}else if(c == '\r')
	{
		cursor_x=0;
	}else if(c == '\n')
	{
		cursor_x=0;
		cursor_y++;
	}
	if(c >= ' ') /* Printable character */
	{
		location = vidmem + (cursor_y*80 + cursor_x);
		*location = c | attribute;
		cursor_x++;
	}
	if(cursor_x >= 80) /* New line, please*/
	{
		cursor_x = 0;
		cursor_y++;
	}

	
	/* Scroll if needed*/
	uint8_t attributeByte2 = (0 /*black*/ << 4) | (15 /*white*/ & 0x0F);
	uint16_t blank = 0x20 /* space */ | (attributeByte2 << 8);
	if(cursor_y >= 25)
	{
       int i;
       for (i = 0*80; i < 24*80; i++)
       {
           vidmem[i] = vidmem[i+80];
       }

       // The last line should now be blank. Do this by writing
       // 80 spaces to it.
       for (i = 24*80; i < 25*80; i++)
       {
           vidmem[i] = blank;
       }
       // The cursor should now be on the last line.
       cursor_y = 24;
   }
	/* Update cursor */
	UpdateCursor();
}
Ejemplo n.º 29
0
void NEO::Screen::ColocarChar(char c)
{
	uint8_t  attributeByte = (colordefondo << 4) | (colordetexto & 0x0F);
	uint16_t attribute = attributeByte << 8;
	uint16_t *localizacion;
	if (c == 0x08 && cursor_x)
	{
		cursor_x--;
	}else if(c == '\r')
	{
		cursor_x=0;
	}else if(c == '\n')
	{
		cursor_x=0;
		cursor_y++;
	}
	if(c >= ' ') 
	{
		localizacion = memvid + (cursor_y*80 + cursor_x);
		*localizacion = c | attribute;
		cursor_x++;
	}
	if(cursor_x >= 80) 
	{
		cursor_x = 0;
		cursor_y++;
	}

	
	//funcion de scroll

	uint8_t attributeByte2 = (0 /*negro*/ << 4) | (15 /*blanco*/ & 0x0F);
	uint16_t blank = 0x20 /* espacio */ | (attributeByte2 << 8);
	if(cursor_y >= 25)
	{
       int i;
       for (i = 0*80; i < 24*80; i++)
       {
           memvid[i] = memvid[i+80];
       }

      
       for (i = 24*80; i < 25*80; i++)
       {
           memvid[i] = blank;
       }
       
       cursor_y = 24;
   }
	
	UpdateCursor();
}
bool LandscapeEditorBase::Input(DAVA::UIEvent *touch)
{
	Vector2 point;
	bool isIntersect = GetLandscapePoint(touch->point, point);
    
    point.x = (float32)((int32)point.x);
    point.y = (float32)((int32)point.y);
    
	landscapePoint = point;
	UpdateCursor();
	
    if(INVALID_TOUCH_ID == touchID || touchID == touch->tid)
    {
        if(UIEvent::BUTTON_1 == touch->tid)
        {
            inverseDrawingEnabled = IsKeyModificatorPressed(DVKEY_ALT);
            
            if(UIEvent::PHASE_BEGAN == touch->phase)
            {
                touchID = touch->tid;
                if(isIntersect)
                {
                    prevDrawPos = Vector2(-100, -100);
                    InputAction(touch->phase, isIntersect);
                }
                return true;
            }
            else if(UIEvent::PHASE_DRAG == touch->phase)
            {
                InputAction(touch->phase, isIntersect);
                if(!isIntersect)
                {
                    prevDrawPos = Vector2(-100, -100);
                }
                return true;
            }
            else if(UIEvent::PHASE_ENDED == touch->phase || UIEvent::PHASE_CANCELLED == touch->phase)
            {
                touchID = INVALID_TOUCH_ID;
                
                if(isIntersect)
                {
                    InputAction(touch->phase, isIntersect);
                    prevDrawPos = Vector2(-100, -100);
                }
                return true;
            }
        }
    }

    return false;
}