Beispiel #1
0
void TwWindow::onResizeEvent( TwResizeEvent* ev)
{
    TwSize<int> newSize = clientRect().size();
    TwSize<int> oldSize = m_rootWidget->size();

    m_renderSurface->resize(newSize);

    m_rootWidget->setBoundRect(clientRect());

    ev->accept();
}
void WebPopupMenuProxyWin::paint(const IntRect& damageRect, HDC hdc)
{
    if (!m_popup)
        return;

    if (!m_DC) {
        m_DC = ::CreateCompatibleDC(::GetDC(m_popup));
        if (!m_DC)
            return;
    }

    if (m_bmp) {
        bool keepBitmap = false;
        BITMAP bitmap;
        if (::GetObject(m_bmp, sizeof(bitmap), &bitmap))
            keepBitmap = bitmap.bmWidth == clientRect().width() && bitmap.bmHeight == clientRect().height();
        if (!keepBitmap) {
            ::DeleteObject(m_bmp);
            m_bmp = 0;
        }
    }

    if (!m_bmp) {
        BitmapInfo bitmapInfo = BitmapInfo::createBottomUp(clientRect().size());
        void* pixels = 0;
        m_bmp = ::CreateDIBSection(m_DC, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0);
        if (!m_bmp)
            return;
        ::SelectObject(m_DC, m_bmp);
    }

    GraphicsContext context(m_DC);

    IntRect translatedDamageRect = damageRect;
    translatedDamageRect.move(IntSize(0, m_scrollOffset * m_itemHeight));
    m_data.m_notSelectedBackingStore->paint(context, damageRect.location(), translatedDamageRect);

    IntRect selectedIndexRectInBackingStore(0, focusedIndex() * m_itemHeight, m_data.m_selectedBackingStore->size().width(), m_itemHeight);
    IntPoint selectedIndexDstPoint = selectedIndexRectInBackingStore.location();
    selectedIndexDstPoint.move(0, -m_scrollOffset * m_itemHeight);

    m_data.m_selectedBackingStore->paint(context, selectedIndexDstPoint, selectedIndexRectInBackingStore);

    if (m_scrollbar)
        m_scrollbar->paint(&context, damageRect);

    HDC localDC = hdc ? hdc : ::GetDC(m_popup);

    ::BitBlt(localDC, damageRect.x(), damageRect.y(), damageRect.width(), damageRect.height(), m_DC, damageRect.x(), damageRect.y(), SRCCOPY);

    if (!hdc)
        ::ReleaseDC(m_popup, localDC);
}
/*
 * Check that receiving shared memory works as expected.
 */
void Ut_MReactionMap::receiveSharedMemory()
{
    QRect clientRect(0, 0, 100, 50);
    uchar *imagePtr;
    uchar *oldImagePtr;
    MReactionMapConnection *testConnection;

    testConnection = MReactionMapConnection::instance();

    // Set 1:1 mapping of coordinates
    reactionMap1->setTransform(QTransform());
    reactionMap1->setTransparentDrawingValue();
    reactionMap1->fillRectangle(clientRect);

    // Get temporary locally allocated image pointer
    oldImagePtr = reactionMap1->getImage();

    // Check that locally created image is as expected
    QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(),
                       clientRect.width(), clientRect.height()), true);

    // Send information about shared memory
    testConnection->setSharedMemoryData(reactionMap1->getPrivatePtr());

    // Get shared memory pointer
    imagePtr = reactionMap1->getImage();

    // Check that shared memory image is the same as locally created was
    QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(),
                       clientRect.width(), clientRect.height()), true);

    // Verify that memory pointers have actually changed
    QVERIFY(oldImagePtr != imagePtr);
}
Beispiel #4
0
void TabView::Split(CMultiSplitPane::SPLITTYPE splitType)
{
	std::wstring strCurrentDirectory(L"");

	std::shared_ptr<ConsoleView> activeConsoleView = GetActiveConsole(_T(__FUNCTION__));

	if( g_settingsHandler->GetBehaviorSettings2().cloneSettings.bUseCurrentDirectory )
	{
		strCurrentDirectory = activeConsoleView->GetConsoleHandler().GetCurrentDirectory();
	}

	if( multisplitClass::defaultFocusPane && multisplitClass::defaultFocusPane->window )
	{
		ConsoleViewCreate consoleViewCreate;
		consoleViewCreate.type = ConsoleViewCreate::CREATE;
		consoleViewCreate.u.userCredentials = nullptr;

		HWND hwndConsoleView = CreateNewConsole(&consoleViewCreate, strCurrentDirectory, wstring(L""), activeConsoleView->GetBasePriority());
		if( hwndConsoleView )
		{
			multisplitClass::SetDefaultFocusPane(multisplitClass::defaultFocusPane->split(
				hwndConsoleView,
				splitType));

			CRect clientRect(0, 0, 0, 0);
			AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
		}
	}
}
/*
 * Check that disconnection from MFeedbackd works as expected
 * when connection simply fails.
 */
void Ut_MReactionMap::disconnect3()
{
    QRect clientRect(0, 0, 100, 50);
    MReactionMapConnection *testConnection;

    testConnection = MReactionMapConnection::instance();

    // Set 1:1 mapping of coordinates
    reactionMap1->setTransform(QTransform());
    reactionMap1->setTransparentDrawingValue();
    reactionMap1->fillRectangle(clientRect);

    // Check that locally created image is as expected
    QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(),
                       clientRect.width(), clientRect.height()), true);

    // Send information about shared memory
    testConnection->setSharedMemoryData(reactionMap1->getPrivatePtr());

    // Disconnect and fail so that reconnection is no longer an option
    testConnection->disconnect(true);

    // Check that image has not changed
    QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(),
                       clientRect.width(), clientRect.height()), true);

    // Check that reaction map was added to connections
    QVERIFY(testConnection->reactionMaps.contains(reactionMap1->getPrivatePtr()) == true);
}
void WebPopupMenuProxyWin::scrollTo(int offset)
{
    ASSERT(m_scrollbar);

    if (!m_popup)
        return;

    if (m_scrollOffset == offset)
        return;

    int scrolledLines = m_scrollOffset - offset;
    m_scrollOffset = offset;

    UINT flags = SW_INVALIDATE;

#ifdef CAN_SET_SMOOTH_SCROLLING_DURATION
    BOOL shouldSmoothScroll = FALSE;
    ::SystemParametersInfo(SPI_GETLISTBOXSMOOTHSCROLLING, 0, &shouldSmoothScroll, 0);
    if (shouldSmoothScroll)
        flags |= MAKEWORD(SW_SMOOTHSCROLL, smoothScrollAnimationDuration);
#endif

    IntRect listRect = clientRect();
    if (m_scrollbar)
        listRect.setWidth(listRect.width() - m_scrollbar->frameRect().width());
    RECT r = listRect;
    ::ScrollWindowEx(m_popup, 0, scrolledLines * m_itemHeight, &r, 0, 0, 0, flags);
    if (m_scrollbar) {
        r = m_scrollbar->frameRect();
        ::InvalidateRect(m_popup, &r, TRUE);
    }
    ::UpdateWindow(m_popup);
}
Beispiel #7
0
BOOL CSysHtmlNotifyDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	ModifyStyleEx( WS_EX_APPWINDOW , WS_EX_TOOLWINDOW) ;

	int cx = GetSystemMetrics(SM_CXSCREEN);  //屏幕宽度
	int cy = GetSystemMetrics(SM_CYSCREEN);  //屏幕高度
	// pSysNotifyDlg->SetWindowPos(NULL,cx - 250,cy - 170,250,170,SWP_SHOWWINDOW);
	RECT rect;
	::SystemParametersInfo(SPI_GETWORKAREA,sizeof(RECT),&rect,0); //工作区域大小
	RECT deskRect;
	::GetWindowRect(::GetDesktopWindow(),&deskRect); //桌面窗口大小
	int startHight = deskRect.bottom - rect.bottom;  //系统状态栏高度

	CRect clientRect(0,0,0,0);
	clientRect.left = cx - SYS_HTML_NOTIFY_WIDTH;
	clientRect.top = cy - startHight - SYS_HTML_NOTIFY_HIGHT;
	clientRect.right = clientRect.left + SYS_HTML_NOTIFY_WIDTH;
	clientRect.bottom = clientRect.top + SYS_HTML_NOTIFY_HIGHT;
	MoveWindow(&clientRect);

	CComVariant var;
	m_htmlSysNotify.CreateFromStatic(IDC_HTML_SYSNOTIFY, this);
	var = (LONG)m_htmlSysNotify.GetSafeHwnd();
	m_pSkinEngine->SetSubSkinProp(GetSafeHwnd(),L"itemHtmlSysNotify",L"hwnd",var);
	InitTheHtml();

	return FALSE;//处理抢焦点问题 

	//return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Beispiel #8
0
void TabView::ResizeView(WORD wID)
{
	if( multisplitClass::defaultFocusPane && multisplitClass::defaultFocusPane->window )
	{
		MutexLock viewMapLock(m_viewsMutex);

		if( m_views.size() > 1 )
		{
			switch( wID )
			{
			case ID_DEC_HORIZ_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::VERTICAL, -ConsoleView::GetCharWidth());
				break;

			case ID_INC_HORIZ_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::VERTICAL, ConsoleView::GetCharWidth());
				break;

			case ID_DEC_VERT_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::HORIZONTAL, -ConsoleView::GetCharHeight());
				break;

			case ID_INC_VERT_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::HORIZONTAL, ConsoleView::GetCharHeight());
				break;
			}

			CRect clientRect(0, 0, 0, 0);
			AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
		}
	}
}
Beispiel #9
0
void GLWdock::draw(GLwindowState &ws, double t){
	typedef Entity::Dockable Dockable;
	int ix;
	if(!docker)
		return;
	GLWrect cr = clientRect();
	glColor4ub(255,255,255,255);
	glwpos2d(cr.x0, cr.y0 + 1 * getFontHeight());
	glwprintf("Resource Units: %.0lf", docker->e->getRU());
	glColor4ub(255,255,0,255);
	int fonth = getFontHeight();
	int iy = 0;

	if(!docker)
		return;
	glColor4ub(255,255,255,255);
	glwpos2d(cr.x0, cr.y0 + (2 + iy++) * fonth);
	glwprintf("Cool: %lg", docker->baycool);
	glwpos2d(cr.x0, cr.y0 + (2 + iy++) * fonth);
	glwprintf("Remain docked: %s", docker->remainDocked ? "Yes" : "No");
	glwpos2d(cr.x0, cr.y0 + (2 + iy++) * fonth);
	glwprintf("Grouping: %s", grouping ? "Yes" : "No");
	glwpos2d(cr.x0, cr.y0 + (2 + iy++) * fonth);
	glwprintf("Docked:");
	glColor4ub(255,255,255,255);

	int mx = ws.mx - cr.x0, my = ws.my - cr.y0;
	/* Mouse cursor highlights */
	if(!modal && 0 < mx && mx < width && (iy - 2 <= my / fonth && my / fonth <= iy - 1 || (1 + iy) * fonth < my)){
		glColor4ub(0,0,255,127);
		glRecti(cr.x0, cr.y0 + (my / fonth) * fonth, cr.x1, cr.y0 + (my / fonth + 1) * fonth);
		glColor4ub(255,255,255,255);
	}

	if(grouping){
		std::map<cpplib::dstring, int> map;

		for(WarField::EntityList::iterator it = docker->el.begin(); it != docker->el.end(); it++) if(*it){
			Entity *e = (*it)->toDockable();
			if(e)
				map[e->dispname()]++;
		}
		for(std::map<cpplib::dstring, int>::iterator it = map.begin(); it != map.end(); it++){
			glwpos2d(cr.x0, cr.y0 + (2 + iy++) * fonth);
			glwprintf("%d X %s", it->second, (const char*)it->first);
		}
	}
	else{
		for(WarField::EntityList::iterator it = docker->el.begin(); it != docker->el.end(); it++) if(*it){
			Entity *e = (*it)->toDockable();
			if(!e)
				continue;
			if(height < (2 + iy) * fonth)
				return;
			glwpos2d(cr.x0, cr.y0 + (2 + iy++) * fonth);
			glwprintf("%d X %s %lg m^3", 1, e->dispname(), e->getHitRadius() * e->getHitRadius() * e->getHitRadius());
		}
	}
}
void CameraControlWindow::setRect(const Rect2D& r) {
    GuiWindow::setRect(r);
    if (drawerButtonPane) {
        float s = 12;
        const Rect2D& r = clientRect();
        drawerButtonPane->setPosition((r.width() - s) / 2.0f, r.height() - s);
    }
}
Beispiel #11
0
void WIN32Window::move(const Point& pos)
{
    Rect clientRect(pos, getClientRect().size());
    Rect windowRect = adjustWindowRect(clientRect);
    MoveWindow(m_window, windowRect.x(), windowRect.y(), windowRect.width(), windowRect.height(), TRUE);
    if(m_hidden)
        ShowWindow(m_window, SW_HIDE);
}
void QFormulatorEditWidget::MovePG( int fUp, int fSel )
{
	RectFde rcf = clientRect();
	SizeFde ofs( 0, 0 );
	CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );
	CFmlDrawEngineQt::DPtoLPEx( ofs, scale(), scale() );
	if( rootNode()->MovePgUpDown( rcf, ofs, fUp, fSel ) == 0 )
		updateFormulatorWidget();
}
LRESULT WebPopupMenuProxyWin::onPrintClient(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled)
{
    handled = true;

    HDC hdc = reinterpret_cast<HDC>(wParam);
    paint(clientRect(), hdc);

    return 0;
}
Beispiel #14
0
void WIN32Window::resize(const Size& size)
{
    if(size.width() < m_minimumSize.width() || size.height() < m_minimumSize.height())
        return;
    Rect clientRect(getClientRect().topLeft(), size);
    Rect windowRect = adjustWindowRect(clientRect);
    MoveWindow(m_window, windowRect.x(), windowRect.y(), windowRect.width(), windowRect.height(), TRUE);
    if(m_hidden)
        ShowWindow(m_window, SW_HIDE);
}
/*
 * Draw on a reaction map, clear it and check that reaction map is actually cleared.
 */
void Ut_MReactionMap::clear()
{
    QRect clientRect(20, 30, 40, 50);

    reactionMap1->setReactiveDrawingValue();
    reactionMap1->fillRectangle(clientRect);

    reactionMap1->clear();
    QCOMPARE(checkArea(reactionMap1, 0, 0, 0, 0, 0), true);
}
Beispiel #16
0
void PopupMenu::show(const IntRect& r, FrameView* v, int index)
{
    ASSERT(client());
    
    calculatePositionAndSize(r, v);
    if (clientRect().isEmpty())
        return;

    OWBAL::ObserverServiceData::createObserverService()->notifyObserver("PopupMenuShow", "", this);
}
void QFormulatorEditWidget::MoveUD( int fUp, int fSelect )
{
	RectFde rcf = clientRect();
	CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );

	PointFde ptf = caretPos();
	SizeFde szf = caretSize();

	if( rootNode()->MoveUpDown( rcf, ptf, szf, fUp, fSelect ) == 0 )
		updateFormulatorWidget();
}
/*
 * Draw a rectangle that is totally out of bounds and see that no rectangle
 * is drawn.
 */
void Ut_MReactionMap::drawInvalidRectangle1()
{
    QRectF clientRect(1000000, 10000000, 1000000, 1000000);

    // Set 1:1 transform
    reactionMap1->setTransform(QTransform());
    reactionMap1->setReactiveDrawingValue();
    reactionMap1->fillRectangle(clientRect);

    QCOMPARE(checkArea(reactionMap1, 0, 0, 0, 0, 0), true);
}
/*
 * Draw a rectangle using the 1:1 transform matrix and check that
 * the resulting reaction map is correct.
 */
void Ut_MReactionMap::drawRectangle2()
{
    QRect clientRect(0, 0, 100, 50);

    // Set 1:1 mapping of coordinates
    reactionMap1->setTransform(QTransform());
    reactionMap1->setTransparentDrawingValue();
    reactionMap1->fillRectangle(clientRect);

    QCOMPARE(checkArea(reactionMap1, 1, clientRect.x(), clientRect.y(),
                       clientRect.width(), clientRect.height()), true);
}
Beispiel #20
0
void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
    static SCH_MARKER* lastMarker = NULL;

    wxString           msg;
    SCH_SHEET_LIST     schematic;
    SCH_SHEET_PATH*    sheetFoundIn = NULL;
    bool               wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0;
    wxRect             clientRect( wxPoint( 0, 0 ), GetClientSize() );
    bool               warpCursor = ( ( event.GetId() == wxEVT_COMMAND_FIND_CLOSE ) ||
                                      !( event.GetFlags() & FR_NO_WARP_CURSOR ) );

    if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
    {
        sheetFoundIn = m_CurrentSheet;
        lastMarker = (SCH_MARKER*) m_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap );
    }
    else
    {
        lastMarker = (SCH_MARKER*) schematic.FindNextItem( SCH_MARKER_T, &sheetFoundIn,
                                                           lastMarker, wrap );
    }

    if( lastMarker != NULL )
    {
        if( *sheetFoundIn != *m_CurrentSheet )
        {
            sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
            *m_CurrentSheet = *sheetFoundIn;
            m_CurrentSheet->UpdateAllScreenReferences();
        }

        sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() );

        RedrawScreen( lastMarker->GetPosition(), warpCursor );

        wxString path = sheetFoundIn->Path();
        wxString units = GetAbbreviatedUnitsLabel();
        double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x,
                                 m_internalUnits );
        double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y,
                                 m_internalUnits );
        msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ),
                    GetChars( path ), x, GetChars( units ), y, GetChars( units) );
        SetStatusText( msg );
    }
    else
    {
        SetStatusText( _( "No more markers were found." ) );
    }
}
void CollisionTypePanel::OnPaint(wxPaintEvent& event)
{
	//Double buffered dest dc
	wxAutoBufferedPaintDC destDC(this);

	//Get renderable client rect
	wxSize clientSize = GetClientSize();
	wxRect clientRect(0, 0, clientSize.x, clientSize.y);

	//Clear dest rect
	destDC.SetBrush(*wxBLACK_BRUSH);
	destDC.DrawRectangle(clientRect);

	//No outline
	destDC.SetPen(wxNullPen);

	const int maxCollisionTypesPerLayer = 16;

	//TODO: Multiple layers
	const int numCollisionLayers = 1;

	float rectSize = (m_orientation == eVertical) ? (clientSize.y / maxCollisionTypesPerLayer) : (clientSize.x / maxCollisionTypesPerLayer);

	wxBitmap bitmap(sIconWidth, sIconHeight, wxBITMAP_SCREEN_DEPTH);
	wxMemoryDC bitmapDC(bitmap);

	for(int i = 0; i < numCollisionLayers; i++)
	{
		for(int j = 0; j < maxCollisionTypesPerLayer; j++)
		{
			int x = (m_orientation == eVertical) ? i : j;
			int y = (m_orientation == eVertical) ? j : i;

			wxBrush brush;
			CollisionType* collisionType = m_project->GetCollisionType(1 << j);
			if(collisionType)
			{
				bitmapDC.DrawBitmap(m_icons[(i * maxCollisionTypesPerLayer) + j], 0, 0);
				destDC.StretchBlit(x * rectSize, y * rectSize, rectSize, rectSize, &bitmapDC, 0, 0, sIconWidth, sIconHeight);
			}
			else
			{
				brush.SetStyle(wxBRUSHSTYLE_CROSSDIAG_HATCH);
				brush.SetColour(wxColour(100, 100, 100, 50));
				destDC.SetBrush(brush);
				destDC.DrawRectangle(x * rectSize, y * rectSize, rectSize, rectSize);
			}
		}
	}
}
/*
 * Draw a rectangle that is partially out of bounds and check that only
 * intersecting rectangle is drawn.
 */
void Ut_MReactionMap::drawInvalidRectangle2()
{
    QRectF clientRect(MfSettings::reactionMapWidth()/2, MfSettings::reactionMapHeight()/2,
                      MfSettings::reactionMapWidth()*2, MfSettings::reactionMapHeight()*2);

    // Set 1:1 transform
    reactionMap1->setTransform(QTransform());
    reactionMap1->setReactiveDrawingValue();
    reactionMap1->fillRectangle(clientRect);

    QCOMPARE(checkArea(reactionMap1, 2,
                       MfSettings::reactionMapWidth()/2, MfSettings::reactionMapHeight()/2,
                       MfSettings::reactionMapWidth()/2, MfSettings::reactionMapHeight()/2), true);
}
Beispiel #23
0
void PopupMenu::invalidateItem(int index)
{
    if (!m_popup)
        return;

    IntRect damageRect(clientRect());
    damageRect.setY(m_itemHeight * (index - m_scrollOffset));
    damageRect.setHeight(m_itemHeight);
    if (m_scrollBar)
        damageRect.setWidth(damageRect.width() - m_scrollBar->frameGeometry().width());

    IntRect r = damageRect;
    //::InvalidateRect(m_popup, &r, TRUE);
}
void WebPopupMenuProxyWin::invalidateItem(int index)
{
    if (!m_popup)
        return;

    IntRect damageRect(clientRect());
    damageRect.setY(m_itemHeight * (index - m_scrollOffset));
    damageRect.setHeight(m_itemHeight);
    if (m_scrollbar)
        damageRect.setWidth(damageRect.width() - m_scrollbar->frameRect().width());

    RECT r = damageRect;
    ::InvalidateRect(m_popup, &r, TRUE);
}
void QFormulatorEditWidget::dropEvent( QDropEvent *event )
{
	if( event->mimeData() && (event->dropAction() == Qt::CopyAction || event->dropAction() == Qt::MoveAction) )
	{
		PointFde ptf( event->pos().x(), event->pos().y() );
		RectFde rcf = clientRect();
		CFmlDrawEngineQt::DPtoLPEx( ptf, scale(), scale() );
		CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );
		if( rootNode()->DrInSelection() == 0 || rootNode()->PtInSelection( rcf, ptf ) == 0 )
		{
			setBlinkingCursorEnabled( true );
			rootNode()->GetDrag().SetEmpty();
			rootNode()->GetSelectInfo().SetEmpty();
			rootNode()->MoveCaret( rcf, ptf, 0 );
			updateFormulatorWidget();
		}
		else
		{
			if( event->dropAction() == Qt::MoveAction && isRemovedSelection() == 0 )
			{
				CFrameNode *pFrameNode = rootNode()->RemoveOrCopySelection( 1 );
				if( pFrameNode )
				{
					delete pFrameNode;
					setRemovedSelection();
				}
			}
			else if( event->dropAction() == Qt::CopyAction )
			{
				rootNode()->GetSelectInfo().SetEmpty();
			}

			int iRet = document()->paste( event->mimeData(), false );

			setBlinkingCursorEnabled( true );
			rootNode()->GetDrag().SetEmpty();
			updateViewDocument();

			if( !hasFocus() ) setFocus();
			if( iRet ) event->acceptProposedAction();
		}
	}
	else
	{
		setBlinkingCursorEnabled( true );
		rootNode()->GetDrag().SetEmpty();
		updateFormulatorWidget();
	}
}
Beispiel #26
0
bool TabView::CloseView(HWND hwnd, bool boolDetach, bool& boolTabClosed)
{
	boolTabClosed = false;

	if( hwnd == 0 )
	{
		if( multisplitClass::defaultFocusPane )
			hwnd = multisplitClass::defaultFocusPane->window;
	}

	if( hwnd )
	{
		MutexLock viewMapLock(m_viewsMutex);
		ConsoleViewMap::iterator iter = m_views.find(hwnd);
		if( iter != m_views.end() )
		{
			if( boolDetach )
				iter->second->GetConsoleHandler().Detach();

			iter->second->DestroyWindow();
			m_views.erase(iter);

#ifdef _DEBUG
			ATLTRACE(L"%p-TabView::CloseView tree\n",
				::GetCurrentThreadId());
			multisplitClass::tree.dump(0, 0);
			ATLTRACE(L"%p-TabView::CloseView defaultFocusPane\n",
				::GetCurrentThreadId());
			if( multisplitClass::defaultFocusPane )
				multisplitClass::defaultFocusPane->dump(0, multisplitClass::defaultFocusPane->parent);
#endif

			if( multisplitClass::defaultFocusPane )
				multisplitClass::SetDefaultFocusPane(multisplitClass::defaultFocusPane->remove());

			if( m_views.empty() )
				boolTabClosed = true;
			else
			{
				CRect clientRect(0, 0, 0, 0);
				AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
			}

			return true;
		}
	}

	return false;
}
void QFormulatorEditWidget::mouseMoveEvent( QMouseEvent *e )
{
	if( e->buttons() == Qt::NoButton )
	{
		PointFde ptf( e->x(), e->y() );
		RectFde rcf = clientRect();
		CFmlDrawEngineQt::DPtoLPEx( ptf, scale(), scale() );
		CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );
		if( ::TestSelection( rcf, rootNode()->GetSelectInfo(), ptf ) == 0 )
			setCursor(Qt::ArrowCursor);
		else
			setCursor(Qt::IBeamCursor);
		return;
	}
	else if( e->buttons() & Qt::LeftButton )
	{
		PointFde ptf( e->x(), e->y() );
		RectFde rcf = clientRect();
		CFmlDrawEngineQt::DPtoLPEx( ptf, scale(), scale() );
		CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );
		if( rootNode()->MoveCaret( rcf, ptf, -1 ) == 0 )
			updateFormulatorWidget();
	}
}
void QFormulatorEditWidget::customEvent_MouseMoveOnParentWindow( QMouseEvent *e )
{
	if( e->buttons() & Qt::LeftButton )
	{
		QPoint pos = e->pos();
		mapFromParent( pos );
		PointFde ptf( pos.x(), pos.y() );
		RectFde rcf = clientRect();
		CFmlDrawEngineQt::DPtoLPEx( ptf, scale(), scale() );
		CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );
		if( rootNode()->MoveCaret( rcf, ptf, -1 ) == 0 )
			updateFormulatorWidget();
	}
	//mouseMoveEvent( e );
}
/*
 * Draw a rectangle using the original transform matrix and check that
 * the resulting reaction map is correct.
 */
void Ut_MReactionMap::drawRectangle1()
{
    QTransform transform;
    QRect reactionMapRect;
    QRect clientRect(20, 30, 40, 50);

    reactionMap1->setReactiveDrawingValue();
    reactionMap1->fillRectangle(clientRect.x(), clientRect.y(),
                                clientRect.width(), clientRect.height());

    transform = reactionMap1->transform();
    reactionMapRect = transform.mapRect(clientRect);
    QCOMPARE(checkArea(reactionMap1, 2, reactionMapRect.x(), reactionMapRect.y(),
                       reactionMapRect.width(), reactionMapRect.height()), true);
}
/*
 * Draw a rectangle with temporary drawing value and check that the rectangle is
 * correct and that the original drawing value is retained.
 */
void Ut_MReactionMap::drawRectangle4()
{
    QTransform transform;
    QRect reactionMapRect;
    QRect clientRect(20, 20, 50, 50);

    reactionMap1->setDrawingValue("foo", "bar");
    reactionMap1->fillRectangle(clientRect, "press", "release");

    transform = reactionMap1->transform();
    reactionMapRect = transform.mapRect(clientRect);
    QCOMPARE(checkArea(reactionMap1, 2, reactionMapRect.x(), reactionMapRect.y(),
                       reactionMapRect.width(), reactionMapRect.height()), true);
    QCOMPARE(reactionMap1->getDrawingValue(), static_cast<quint8>(3));
}