Exemplo n.º 1
0
void RangeDrawer::TerrainCoordClicked(const float &tx, const float &ty, const bool &shift_down) {
    
    const int x = TerrainX2QuadX(tx), y = TerrainY2QuadY(ty);
    
    switch (markMode) {
    
        case MARK_CONTROL_POINT:
            if (!mouseIsDown) { // Mouse was recently pressed
                mouseDownIsMarking = !marked[y][x]; // if (x,y) was marked, only mark until mouse release
                markedWithShift->Reset();
            }
            mouseIsDown = true;
            
            if (!shift_down) {
                
                markedWithShift->Reset();
                mouseDownIsMarking ? Mark(x, y) : Unmark(x, y);
                
            } else {
                
                markedWithShift->Mark(x, y);
                for ( int y=markedWithShift->y_min; y<=markedWithShift->y_max; y++) {
                    for ( int x=markedWithShift->x_min; x<=markedWithShift->x_max; x++) {
                        mouseDownIsMarking ? Mark(x, y) : Unmark(x, y);
                    }
                }
            }
            break;
            
        case MARK_TEE:
            UnmarkAll();
            if (teeMarked) {
                // Mark and unmark previous tee position for change to be registered and vertex to be reset
                Mark(teeMarkPos.x, teeMarkPos.y);
                Unmark(teeMarkPos.x, teeMarkPos.y);
            }
            teeMarked = true;
            teeMarkPos = { x, y };
            teeTerrainPos = glm::vec2(tx, ty);
            SetMarkChanged();
            break;
        
        case MARK_TARGET:
            UnmarkAll();
            if (targetMarked) {
                // Mark and unmark previous tee position for change to be registered and vertex to be reset
                Mark(targetMarkPos.x, targetMarkPos.y);
                Unmark(targetMarkPos.x, targetMarkPos.y);
            }
            targetMarked = true;
            targetMarkPos = { x, y };
            targetTerrainPos = glm::vec2(tx, ty);
            SetMarkChanged();
            break;
        
        case NONE:
            // do nothing
            break;
    }
}
Exemplo n.º 2
0
int EList::ExecCommand(int Command, ExState &State) {
    int W = 1;
    int H = 1;

    if (View && View->MView && View->MView->Win) {
        View->MView->ConQuerySize(&W, &H);
        H--;
    }
    FixPos();
    switch (Command) {
    case ExMoveLeft:
        return MoveLeft();
    case ExMoveRight:
        return MoveRight();
    case ExMoveUp:
        return MoveUp();
    case ExMoveDown:
        return MoveDown();
    case ExMovePageUp:
        return MovePageUp();
    case ExMovePageDown:
        return MovePageDown();
    case ExScrollLeft:
        return ScrollLeft(8);
    case ExScrollRight:
        return ScrollRight(8);
    case ExMovePageStart:
        return MovePageStart();
    case ExMovePageEnd:
        return MovePageEnd();
    case ExMoveFileStart:
        return MoveFileStart();
    case ExMoveFileEnd:
        return MoveFileEnd();
    case ExMoveLineStart:
        return MoveLineStart();
    case ExMoveLineEnd:
        return MoveLineEnd();
    case ExRescan:
        RescanList();
        return ErOK;
    case ExActivate:
        return Activate();
    case ExListMark:
        return Mark();
    case ExListUnmark:
        return Unmark();
    case ExListToggleMark:
        return ToggleMark();
    case ExListMarkAll:
        return MarkAll();
    case ExListUnmarkAll:
        return UnmarkAll();
    case ExListToggleMarkAll:
        return ToggleMarkAll();
    }
    return EModel::ExecCommand(Command, State);
}