Example #1
0
// we swallow the draw frames mouse moves and process here
void Editor::drawFrameMouseMovedEvent( QMouseEvent* e ){


    POSITION mPos;
    transformPointToPosition(e->pos(), mPos, (mode == remove));

    if ((mPos.x==currPos.x) && (mPos.y==currPos.y) && (mPos.e==currPos.e))
	return;
    currPos = mPos;

    statusChanged();

    switch(mode) {
	case insert: {
		POSITION next;
		next = currPos;
		if (next.e == 100)
			next.e = 0;
		else
			next.e += 1;

		drawCursor(next, canInsert(next));
	break;
	}
	case remove:
    		drawCursor(currPos, 1);
	break;

	case move:

	break;

    }

}
Example #2
0
// we swallow the draw frames mouse clicks and process here
void Editor::drawFrameMousePressEvent( QMouseEvent* e )
{

	POSITION mPos;
	transformPointToPosition(e->pos(), mPos, (mode == remove));

	switch (mode) {
		case remove:
		    if (!theBoard.tileAbove(mPos) && mPos.e < BoardLayout::depth && theBoard.isTileAt(mPos) ) {
			theBoard.deleteTile(mPos);
			numTiles--;
			statusChanged();
			drawFrameMouseMovedEvent(e);
			repaint(false);
		    }
		break;
		case insert: {
		    POSITION n = mPos;
		    if (n.e == 100)
			n.e = 0;
		    else
			n.e += 1;
		    if (canInsert(n)) {
			theBoard.insertTile(n);
			numTiles++;
			statusChanged();
			repaint(false);
		    }
		  }
		break;
		default:
		break;
	}

}
Example #3
0
void Editor::drawFrameMousePressEvent( QMouseEvent* e )
{
    // we swallow the draw frames mouse clicks and process here

    POSITION mPos;
    transformPointToPosition(e->pos(), mPos, (mode == remove));

    switch (mode) {
    case remove:
        if (!theBoard.tileAbove(mPos) && mPos.e < theBoard.m_depth && theBoard.isTileAt(mPos)) {
            theBoard.deleteTile(mPos);
            numTiles--;
            statusChanged();
            drawFrameMouseMovedEvent(e);
            update();
        }

        break;
    case insert: {
        POSITION n = mPos;

        if (n.e == 100) {
            n.e = 0;
        } else {
            n.e += 1;
        }

        if (canInsert(n)) {
            theBoard.insertTile(n);
            clean = false;
            numTiles++;
            statusChanged();
            update();
        }

        break;
    }
    default:
        break;
    }
}
Example #4
0
void Editor::drawFrameMouseMovedEvent(QMouseEvent *e)
{
    // we swallow the draw frames mouse moves and process here

    POSITION mPos;
    transformPointToPosition(e->pos(), mPos, (mode == remove));

    if ((mPos.x==currPos.x) && (mPos.y==currPos.y) && (mPos.e==currPos.e)) {
        return;
    }

    currPos = mPos;

    statusChanged();

    switch(mode) {
    case insert: {
        POSITION next;
        next = currPos;

        if (next.e == 100) {
            next.e = 0;
        } else {
            next.e += 1;
        }

        drawCursor(next, canInsert(next));

        break;
    }
    case remove:
            drawCursor(currPos, 1);

        break;
    case move:
        break;
    }
}