コード例 #1
0
void KisScratchPad::slotMouseMove(KoPointerEvent *event)
{
    if (m_toolMode == PAINTING) {
        doStroke(event);
        event->accept();
    }
    else if (m_toolMode == PANNING) {
        doPan(event);
        event->accept();
    }
    else if (m_toolMode == PICKING) {
        pick(event);
        event->accept();
    }
}
コード例 #2
0
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f) 
	: QMainWindow(parent, f)
{
    setupUi(this);
    //initialize Experiment Manager
    treeWidget->setColumnCount(3);
    QStringList header;//EP Header
    header << "Name" << "Iteration" << "Step";
    treeWidget->setHeaderLabels(header);//assign headers

    //connect the signal related to the top bars
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(openSelect()));
    connect(actionOpen_2, SIGNAL(clicked()), this, SLOT(openSelect()));
    connect(actionSave, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(actionSave_1, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(actionSave_2, SIGNAL(clicked()), this, SLOT(saveFile()));
    connect(actionAnimator, SIGNAL(clicked()), this, SLOT(OpenAnimatorWindow()));
    connect(actionZoom_1, SIGNAL(clicked()), this, SLOT(doZoom()));
    connect(actionZoom, SIGNAL(triggered()), this, SLOT(doZoom()));
    connect(actionSlice, SIGNAL(triggered()), this, SLOT(doSlice()));
    connect(actionSlice_1, SIGNAL(clicked()), this, SLOT(doSlice()));
    connect(actionPan, SIGNAL(triggered()), this, SLOT(doPan()));
    connect(actionRotate, SIGNAL(triggered()), this, SLOT(doRotate()));

    //connect vel
    connect(treeWidget, SIGNAL(itemDoubleClicked ( QTreeWidgetItem*, int ) ), this, SLOT(openModel(QTreeWidgetItem*)));

    //vswork connect widgets to references
    vswork.setTree(treeWidget);

    //Initialize custom cursor pointers
    QBitmap zoomB("zoom.png");
    QBitmap rotateB("rotate.jpeg");
    QBitmap sliceB("slice.png");
    zoomCursor = QCursor(zoomB, -1, -1);
    rotateCursor = QCursor(rotateB, -1, -1);
    sliceCursor = QCursor(sliceB, -1, -1);
 }
コード例 #3
0
ファイル: graphwidget.cpp プロジェクト: johnmave126/Animator
void GraphWidget::draw()
{
	if (!valid()) {
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		glViewport(0, 0, w(), h());

		glClearColor(GRID_BACKGROUND_INTENSITY, GRID_BACKGROUND_INTENSITY, GRID_BACKGROUND_INTENSITY, 0.0);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	}

	glClear(GL_COLOR_BUFFER_BIT);

	glColor3d(0,0,0);
	glBegin(GL_POLYGON);
		glVertex2d( -w(), -h()  );
		glVertex2d( -w(),  h()  );
		glVertex2d(  w(),  h()  );
		glVertex2d(  w(), -h()  );
	glEnd();

/************************************************************************************/

	//The grid.. We're copying this from rulerwindow class.
	//Really to two should have a single reference function.
	double dRangeX = rightTime() - leftTime();
	double dRangeY = (rightTime() - leftTime());
	int iWindowWidth = w();
	int iWindowHeight = h();
	const int k_iAvgLongMarkLen = 15;

	int iLongMarkCountX = iWindowWidth / k_iAvgLongMarkLen;
	int iLongMarkCountY = iWindowHeight / k_iAvgLongMarkLen;

	if (iLongMarkCountX > 0 && iWindowWidth > 0) {
		// Computer the long mark length so that it's 10^i where i is an integer
		double dLongMarkLengthX = dRangeX / (double)iLongMarkCountX;
		double dLongMarkLengthPowX = log10(dLongMarkLengthX);
		int iLongMarkLengthPowX = (int)ceil(dLongMarkLengthPowX);
		dLongMarkLengthX = pow(10.0, (double)iLongMarkLengthPowX);

		double dLongMarkLengthY = dRangeY / (double)iLongMarkCountY;
		double dLongMarkLengthPowY = log10(dLongMarkLengthY);
		int iLongMarkLengthPowY = (int)ceil(dLongMarkLengthPowY);
		dLongMarkLengthY = pow(10.0, (double)iLongMarkLengthPowY);


		int iStartX = (int)ceil(leftTime() / dLongMarkLengthX);

		int iMarkX, iMarkY;
		double x,y;

		glColor3d(1,1,1);
		glPointSize(0.5);
		glBegin(GL_POINTS);

			do {
				iMarkX = 2*(int)(((double)iStartX * dLongMarkLengthX - leftTime()) / dRangeX * (double)iWindowWidth + 0.5) - w();
				x = (double)iMarkX / w();
				
				int iStartY = (int)ceil(leftTime() / dLongMarkLengthY);
				do{
					iMarkY = 2*(int)(((double)iStartY * dLongMarkLengthY - leftTime()) / dRangeY * (double)iWindowHeight + 0.5) - h();
					y = (double)iMarkY / h();

					glVertex2d(x,y);

					++iStartY;
				} while (iMarkY < iWindowHeight);
				
				++iStartX;
			} while (iMarkX < iWindowWidth);
		glEnd();
	}

/************************************************************************************/
	
	if (m_bHasEvent) {
		m_bHasEvent = false;

		switch (m_iEventToDo) {
			case LEFT_MOUSE_DOWN:
				selectAddCtrlPt(m_iMouseX, m_iMouseY);
				break;
			case LEFT_MOUSE_DRAG:
				dragCtrlPt(m_iMouseX, m_iMouseY);
				break;
			case LEFT_MOUSE_UP:
				break;

			case ALT_LEFT_DOWN:
				startCtrlPtSelection(m_iMouseX, m_iMouseY);
				break;
			case ALT_LEFT_DRAG:
				doCtrlPtSelection(m_iMouseX, m_iMouseY);
				break;
			case ALT_LEFT_UP:
				endCtrlPtSelection(m_iMouseX, m_iMouseY);
				break;

			case CTRL_LEFT_DOWN:
				selectCurrCurve(m_iMouseX, m_iMouseY);
				break;

			case SHIFT_LEFT_DOWN:
				removeCtrlPt(m_iMouseX, m_iMouseY);
				break;

			case RIGHT_MOUSE_DOWN:
				break;
			case RIGHT_MOUSE_DRAG:
				doZoom(m_iMouseDX, m_iMouseDY);
				break;
			case RIGHT_MOUSE_UP:
				break;

			case SHIFT_RIGHT_DOWN:
				break;
			case SHIFT_RIGHT_DRAG:
				m_bPanning = true;
				doPan(m_iMouseDX, m_iMouseDY);
				break;
			case SHIFT_RIGHT_UP:
				m_bPanning = false;
				break;

			case CTRL_RIGHT_DOWN:
				startZoomSelection(m_iMouseX, m_iMouseY);
				break;
			case CTRL_RIGHT_DRAG:
				doZoomSelection(m_iMouseX, m_iMouseY);
				break;
			case CTRL_RIGHT_UP:
				endZoomSelection(m_iMouseX, m_iMouseY);
				break;

			default:
				break;
		}

		do_callback();
	}
	drawTimeBar();
	drawActiveCurves();
	drawZoomSelectionMap();
	drawSelectionRect();
}