Esempio n. 1
0
//restore action from checked button
void QG_CadToolBarInfo::restoreAction()
{
	if(!(actionHandler && bDist)) return;
	//clear all action
    if ( bDist ->isChecked() ) {
        actionHandler->slotInfoDist();
        return;
    }
    if ( bDist2 ->isChecked() ) {
        actionHandler->slotInfoDist2();
        return;
    }
    if ( bAngle ->isChecked() ) {
        actionHandler->slotInfoAngle();
        return;
    }
    if ( bTotalLength ->isChecked() ) {
        actionHandler->slotInfoTotalLength();
        return;
    }
    if ( bArea ->isChecked() ) {
        actionHandler->slotInfoArea();
        return;
    }
    //default to measure point to point distance
    //bDist->setChecked(true);
    //actionHandler->slotInfoDist();
	m_pHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
	if(currentAction != nullptr) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 2
0
void QG_CadToolBar::showPreviousToolBar(bool cleanup) {
    // cleanup mouse hint when showing previous tool bar, bug#3480121
    RS_DIALOGFACTORY->updateMouseWidget("","",false);
    if(cleanup){
        if(actionHandler != NULL) {
            RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
            if(currentAction != NULL) {
                currentAction->finish(false); //finish the action, but do not update toolBar
            }
        }
        if(toolbars.size()>1){
            if(toolbars.last() != NULL) toolbars.last() ->setVisible(false);
            toolbars.pop_back();
            toolbarIDs.pop_back();
        }
        //        std::cout<<"QG_CadToolBar::showPreviousToolBar(true): toolbars.size()="<<toolbars.size()<<std::endl;
        showToolBar(toolbarIDs.last());
    }else{
        hideSubToolBars();
        //        std::cout<<"QG_CadToolBar::showPreviousToolBar(false): toolbars.size()="<<toolbars.size()<<std::endl;
        if(toolbars.size()>1){
            //            std::cout<<"QG_CadToolBar::showPreviousToolBar(false): hide:"<<toolbarIDs[toolbars.size()-1]<<std::endl;
            if(toolbars.last()== NULL) toolbars.last()->setVisible(false);
            toolbars.pop_back();
            toolbarIDs.pop_back();

        }

        //        std::cout<<"QG_CadToolBar::showPreviousToolBar(false): toolbars.size()="<<toolbars.size()<<std::endl;
        showSubToolBar();
    }
}
Esempio n. 3
0
//restore action from checked button
void QG_CadToolBarEllipses::restoreAction()
{
	if(!(actionHandler && bEllipseAxes)) return;
	if ( bEllipseAxes ->isChecked() ) {
        actionHandler->slotDrawEllipseAxis();
        return;
    }
    if ( bEllipseArcAxes ->isChecked() ) {
        actionHandler->slotDrawEllipseArcAxis();
        return;
    }
    if ( bEllipseFociPoint ->isChecked() ) {
        actionHandler->slotDrawEllipseFociPoint();
        return;
    }
    if ( bEllipse4Points ->isChecked() ) {
        actionHandler->slotDrawEllipse4Points();
        return;
    }
    if ( bEllipseCenter3Points ->isChecked() ) {
        actionHandler->slotDrawEllipseCenter3Points();
        return;
    }
    if ( bEllipseInscribe ->isChecked() ) {
        actionHandler->slotDrawEllipseInscribe();
        return;
    }
    //clear all action
	m_pHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
	if(currentAction ) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 4
0
//restore action from checked button
void QG_CadToolBarArcs::restoreAction()
{
	if(!(actionHandler&&bArc)) return;
    if ( bArc ->isChecked() ) {
        actionHandler->slotDrawArc();
        return;
    }
    if ( bArc3P ->isChecked() ) {
        actionHandler->slotDrawArc3P();
        return;
    }
    if ( bArcParallel ->isChecked() ) {
        actionHandler->slotDrawArcParallel();
        return;
    }
    if ( bArcTangential ->isChecked() ) {
        actionHandler->slotDrawArcTangential();
        return;
    }
    //clear all action
	m_pHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
	if(currentAction != nullptr) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 5
0
void QG_CadToolBar::showPreviousToolBar(bool cleanup) {
	// cleanup mouse hint when showing previous tool bar, bug#3480121
	RS_DIALOGFACTORY->updateMouseWidget();
//	for(auto p: activeToolbars){
//		qDebug()<<"QG_CadToolBar::showPreviousToolBar():begin "<<p->rtti();
//	}
	if(cleanup){
		if(actionHandler) {
			RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
			if(currentAction && currentAction->rtti() != RS2::ActionDefault) {
				currentAction->finish(false); //finish the action, but do not update toolBar
			}
		}
		if(activeToolbars.size()>1){
			if(activeToolbars.back()) activeToolbars.back() ->setVisible(false);
			activeToolbars.pop_back();
		}
		//        std::cout<<"QG_CadToolBar::showPreviousToolBar(true): toolbars.size()="<<toolbars.size()<<std::endl;
		showToolBar(activeToolbars.back()->rtti());
	}else{
		hideSubToolBars();
		//        std::cout<<"QG_CadToolBar::showPreviousToolBar(false): toolbars.size()="<<toolbars.size()<<std::endl;
		if(activeToolbars.size()>1){
			//            std::cout<<"QG_CadToolBar::showPreviousToolBar(false): hide:"<<toolbarIDs[toolbars.size()-1]<<std::endl;
			if (!activeToolbars.back()) activeToolbars.back()->setVisible(false);
			activeToolbars.pop_back();
		}

		//        std::cout<<"QG_CadToolBar::showPreviousToolBar(false): toolbars.size()="<<toolbars.size()<<std::endl;
		showSubToolBar();
	}
//	for(auto p: activeToolbars){
//		qDebug()<<"QG_CadToolBar::showPreviousToolBar():end "<<p->rtti();
//	}
}
Esempio n. 6
0
//clear current action
void QG_CadToolBarMain::finishCurrentAction()
{
    if(actionHandler==NULL) return;
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
    if(currentAction != NULL) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 7
0
void QG_CadToolBar::finishCurrentAction(bool resetToolBar)
{
	if(!actionHandler) return;
	RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
	if(currentAction) {
		currentAction->finish(resetToolBar); //finish the action, but do not update toolBar
	}
}
Esempio n. 8
0
//restore action from checked button
void QG_CadToolBarCircles::restoreAction()
{
	if(!(actionHandler && bCircle)) return;
    if ( bCircle ->isChecked() ) {
        actionHandler->slotDrawCircle();
        return;
    }
    if ( bCircleCR ->isChecked() ) {
        actionHandler->slotDrawCircleCR();
        return;
    }
    if ( bCircle2P ->isChecked() ) {
        actionHandler->slotDrawCircle2P();
        return;
    }
    if ( bCircle2PR ->isChecked() ) {
        actionHandler->slotDrawCircle2PR();
        return;
    }
    if ( bCircle3P ->isChecked() ) {
        actionHandler->slotDrawCircle3P();
        return;
    }
    if ( bCircleParallel ->isChecked() ) {
        actionHandler->slotDrawCircleParallel();
        return;
    }
    if ( bCircleInscribe ->isChecked() ) {
        actionHandler->slotDrawCircleInscribe();
        return;
    }
    if ( bCircleTan2 ->isChecked() ) {
        actionHandler->slotDrawCircleTan2();
        return;
    }
    if ( bCircleTan3 ->isChecked() ) {
        actionHandler->slotDrawCircleTan3();
        return;
    }
    if(bCircleTan2_1P->isChecked()){
        actionHandler->slotDrawCircleTan2_1P();
        return;
    }
    if(bCircleTan1_2P->isChecked()){
        actionHandler->slotDrawCircleTan1_2P();
        return;
    }
    //clear all action
	m_pHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
	if(currentAction != nullptr) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 9
0
/**
 * @return Available commands of the application or the current action.
 */
RS_StringList QG_ActionHandler::getAvailableCommands() {
    RS_ActionInterface* currentAction = getCurrentAction();

    if (currentAction!=NULL) {
        return currentAction->getAvailableCommands();
    } else {
        RS_StringList cmd;
        cmd += "line";
        cmd += "rectangle";
        return cmd;
    }
}
Esempio n. 10
0
//restore action from checked button
void QG_CadToolBarSplines::restoreAction()
{
    if(actionHandler==NULL) return;
    if ( bSpline ->isChecked() ) {
        actionHandler->slotDrawSpline();
        return;
    }
    if(bSplineInt->isChecked()){
        actionHandler->slotDrawSplinePoints();
        return;
    }
    bHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
    if(currentAction != NULL) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 11
0
//restore action from checked button
void QG_CadToolBarPolylines::restoreAction()
{
	if(!(actionHandler && bPolyline)) return;
	if ( bPolyline ->isChecked() ) {
        actionHandler->slotDrawPolyline();
        return;
    }
    if ( bPolylineAdd ->isChecked() ) {
        actionHandler->slotPolylineAdd();
        return;
    }
    if ( bPolylineAppend ->isChecked() ) {
        actionHandler->slotPolylineAppend();
        return;
    }
    if ( bPolylineDel ->isChecked() ) {
        actionHandler->slotPolylineDel();
        return;
    }
    if ( bPolylineDelBetween ->isChecked() ) {
        actionHandler->slotPolylineDelBetween();
        return;
    }
    if ( bPolylineTrim ->isChecked() ) {
        actionHandler->slotPolylineTrim();
        return;
    }
    if ( bPolylineEquidistant ->isChecked() ) {
        actionHandler->slotPolylineEquidistant();
        return;
    }
    if ( bPolylineSegment ->isChecked() ) {
        actionHandler->slotPolylineSegment();
        return;
    }
	m_pHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
	if(currentAction ) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 12
0
/**
 * Sets the current action.
 */
void RS_EventHandler::setCurrentAction(RS_ActionInterface* action) {
    RS_DEBUG->print("RS_EventHandler::setCurrentAction");
    if (action==NULL) {
        return;
    }

    // Predecessor of the new action or NULL:
    RS_ActionInterface* predecessor = NULL;

    // Suspend current action:
    if(hasAction()){
        predecessor = currentActions.last();
        predecessor->suspend();
        predecessor->hideOptions();
    }
    else {
        if (defaultAction) {
            predecessor = defaultAction;
            predecessor->suspend();
            predecessor->hideOptions();
        }
    }

    //    // Forget about the oldest action and make space for the new action:
    //    if (actionIndex==RS_MAXACTIONS-1) {
    //        // delete oldest action if necessary (usually never happens):
    //        if (currentActions[0]) {
    //            currentActions[0]->finish();
    //            delete currentActions[0];
    //            currentActions[0] = NULL;
    //        }
    //        // Move up actionstack (optimize):
    //        for (int i=0; i<RS_MAXACTIONS-1; ++i) {
    //            currentActions[i] = currentActions[i+1];
    //        }
    //    } else if (actionIndex<RS_MAXACTIONS-1) {
    //        actionIndex++;
    //    }

    // Set current action:
    currentActions.push_back(action);
    RS_DEBUG->print("RS_EventHandler::setCurrentAction: current action is: %s",
                    currentActions.last()->getName().toLatin1().data());

    // Initialisation of our new action:
    RS_DEBUG->print("RS_EventHandler::setCurrentAction: init current action");
    action->init();
    // ## new:
    if (action->isFinished()==false) {
        RS_DEBUG->print("RS_EventHandler::setCurrentAction: show options");
        currentActions.last()->showOptions();
        RS_DEBUG->print("RS_EventHandler::setCurrentAction: set predecessor");
        action->setPredecessor(predecessor);
    }

    RS_DEBUG->print("RS_EventHandler::setCurrentAction: cleaning up..");
    cleanUp();

    RS_DEBUG->print("RS_EventHandler::setCurrentAction: debugging actions");
    debugActions();
    RS_DEBUG->print("RS_GraphicView::setCurrentAction: OK");
}
Esempio n. 13
0
//restore action from checked
void QG_CadToolBarModify::restoreAction() {
    if(actionHandler==NULL) return;
    if ( bMove ->isChecked() ) {
        actionHandler->slotModifyMove();
        return;
    }
    if ( bRotate ->isChecked() ) {
        actionHandler->slotModifyRotate();
        return;
    }
    if ( bScale ->isChecked() ) {
        actionHandler->slotModifyScale();
        return;
    }
    if ( bMirror ->isChecked() ) {
        actionHandler->slotModifyMirror();
        return;
    }
    if ( bMoveRotate ->isChecked() ) {
        actionHandler->slotModifyMoveRotate();
        return;
    }
    if ( bRotate2 ->isChecked() ) {
        actionHandler->slotModifyRotate2();
        return;
    }
    if ( bTrim ->isChecked() ) {
        actionHandler->slotModifyTrim();
        return;
    }
    if ( bTrim2 ->isChecked() ) {
        actionHandler->slotModifyTrim2();
        return;
    }
    if ( bTrimAmount ->isChecked() ) {
        actionHandler->slotModifyTrimAmount();
        return;
    }
    if ( bBevel ->isChecked() ) {
        actionHandler->slotModifyBevel();
        return;
    }
    if ( bRound ->isChecked() ) {
        actionHandler->slotModifyRound();
        return;
    }
    if ( bCut ->isChecked() ) {
        actionHandler->slotModifyCut();
        return;
    }
    if ( bStretch ->isChecked() ) {
        actionHandler->slotModifyStretch();
        return;
    }
    if ( bEntity ->isChecked() ) {
        actionHandler->slotModifyEntity();
        return;
    }
    if ( bAttributes ->isChecked() ) {
        actionHandler->slotModifyAttributes();
        return;
    }
    if ( bDelete ->isChecked() ) {
        actionHandler->slotModifyDelete();
        return;
    }
    if ( bExplode ->isChecked() ) {
        actionHandler->slotBlocksExplode();
        return;
    }
    if ( bExplodeText ->isChecked() ) {
        actionHandler->slotModifyExplodeText();
        return;
    }
    if ( bEntityText ->isChecked() ) {
        actionHandler->slotModifyExplodeText();
        return;
    }
    if ( bOffset ->isChecked() ) {
        actionHandler->slotModifyOffset();
        return;
    }
    bHidden->setChecked(true);
    //clear all action
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
    if(currentAction != NULL) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 14
0
void QG_CadToolBar::showCadToolBar(RS2::ActionType actionType, bool cleanup){
    switch(actionType){
    //no op
    case RS2::ActionFileNew:
    case RS2::ActionFileNewTemplate:
    case RS2::ActionFileOpen:
    case RS2::ActionFileSave:
    case RS2::ActionFileSaveAs:
    case RS2::ActionFileExport:
    case RS2::ActionFileClose:
    case RS2::ActionFilePrint:
    case RS2::ActionFilePrintPreview:
    case RS2::ActionFileQuit:
    case RS2::ActionPrintPreview:
    case RS2::ActionEditUndo:
    case RS2::ActionEditRedo:
    case RS2::ActionEditCut:
    case RS2::ActionEditCutNoSelect:
    case RS2::ActionEditCopy:
    case RS2::ActionEditCopyNoSelect:
    case RS2::ActionEditPaste:
    case RS2::ActionViewStatusBar:
    case RS2::ActionViewLayerList:
    case RS2::ActionViewBlockList:
    case RS2::ActionViewCommandLine:
    case RS2::ActionViewLibrary:
    case RS2::ActionViewPenToolbar:
    case RS2::ActionViewOptionToolbar:
    case RS2::ActionViewCadToolbar:
    case RS2::ActionViewFileToolbar:
    case RS2::ActionViewEditToolbar:
    case RS2::ActionViewSnapToolbar:
    case RS2::ActionViewGrid:
    case RS2::ActionViewDraft:
    case RS2::ActionZoomIn:
    case RS2::ActionZoomOut:
    case RS2::ActionZoomAuto:
    case RS2::ActionZoomWindow:
    case RS2::ActionZoomPan:
    case RS2::ActionZoomRedraw:
    case RS2::ActionZoomPrevious:
    case RS2::ActionSelect:
    case RS2::ActionSelectSingle:
    case RS2::ActionSelectContour:
    case RS2::ActionSelectWindow:
    case RS2::ActionDeselectWindow:
    case RS2::ActionSelectAll:
    case RS2::ActionDeselectAll:
    case RS2::ActionSelectIntersected:
    case RS2::ActionDeselectIntersected:
    case RS2::ActionSelectInvert:
    case RS2::ActionSelectLayer:
    case RS2::ActionSelectDouble:
    case RS2::ActionDrawHatch:
    case RS2::ActionDrawHatchNoSelect:
    case RS2::ActionEditKillAllActions:
    case RS2::ActionSnapFree:
    case RS2::ActionSnapGrid:
    case RS2::ActionSnapEndpoint:
    case RS2::ActionSnapOnEntity:
    case RS2::ActionSnapCenter:
    case RS2::ActionSnapMiddle:
    case RS2::ActionSnapDist:
    case RS2::ActionSnapIntersection:
    case RS2::ActionSnapIntersectionManual:
    case RS2::ActionRestrictNothing:
    case RS2::ActionRestrictOrthogonal:
    case RS2::ActionRestrictHorizontal:
    case RS2::ActionRestrictVertical:
    case RS2::ActionSetRelativeZero:
    case RS2::ActionLockRelativeZero:
    case RS2::ActionUnlockRelativeZero:
    case RS2::ActionLayersDefreezeAll:
    case RS2::ActionLayersFreezeAll:
    case RS2::ActionLayersAdd:
    case RS2::ActionLayersRemove:
    case RS2::ActionLayersEdit:
    case RS2::ActionLayersToggleView:
    case RS2::ActionLayersToggleLock:
    case RS2::ActionLayersTogglePrint:
    case RS2::ActionBlocksDefreezeAll:
    case RS2::ActionBlocksFreezeAll:
    case RS2::ActionBlocksAdd:
    case RS2::ActionBlocksRemove:
    case RS2::ActionBlocksAttributes:
    case RS2::ActionBlocksEdit:
    case RS2::ActionBlocksInsert:
    case RS2::ActionBlocksToggleView:
    case RS2::ActionBlocksCreate:
    case RS2::ActionBlocksCreateNoSelect:
    case RS2::ActionBlocksExplode:
    case RS2::ActionBlocksExplodeNoSelect:
    case RS2::ActionModifyExplodeText:
    default:
        return;
        //default action resets toolbar, issue#295
    case RS2::ActionDefault:
        resetToolBar();
        break;
    case RS2::ActionDrawImage:
    case RS2::ActionDrawPoint:
    case RS2::ActionDrawSpline:
    case RS2::ActionDrawMText:
        showToolBar(RS2::ToolBarMain, false);
        if(tbMain != NULL){
            tbMain->showCadToolBar(actionType);
        }
        break;
    case RS2::ActionDrawArc:
    case RS2::ActionDrawArc3P:
    case RS2::ActionDrawArcParallel:
    case RS2::ActionDrawArcTangential:
        showToolBar(RS2::ToolBarArcs, false);
       if(tbArcs != NULL){
           tbArcs->showCadToolBar(actionType);
       }
        break;
    case RS2::ActionDrawCircle:
    case RS2::ActionDrawCircle2P:
    case RS2::ActionDrawCircle3P:
    case RS2::ActionDrawCircleCR:
    case RS2::ActionDrawCircleParallel:
    case RS2::ActionDrawCircleInscribe:
    case RS2::ActionDrawCircleTan2:
    case RS2::ActionDrawCircleTan2_1P:
    case RS2::ActionDrawCircleTan1_2P:
        showToolBar(RS2::ToolBarCircles, false);
       if(tbCircles != NULL){
           tbCircles->showCadToolBar(actionType);
       }
        break;
    case RS2::ActionDrawEllipseArcAxis:
    case RS2::ActionDrawEllipseAxis:
    case RS2::ActionDrawEllipseFociPoint:
    case RS2::ActionDrawEllipse4Points:
    case RS2::ActionDrawEllipseCenter3Points:
    case RS2::ActionDrawEllipseInscribe:
        showToolBar(RS2::ToolBarEllipses, false);
        if(tbEllipses != NULL){
            tbEllipses->showCadToolBar(actionType);
        }
        break;
    case RS2::ActionDrawLine:
    case RS2::ActionDrawLineAngle:
    case RS2::ActionDrawLineBisector:
    case RS2::ActionDrawLineFree:
    case RS2::ActionDrawLineHorVert:
    case RS2::ActionDrawLineHorizontal:
    case RS2::ActionDrawLineOrthogonal:
    case RS2::ActionDrawLineOrthTan:
    case RS2::ActionDrawLineParallel:
    case RS2::ActionDrawLineParallelThrough:
    case RS2::ActionDrawLinePolygonCenCor:
    case RS2::ActionDrawLinePolygonCorCor:
    case RS2::ActionDrawLineRectangle:
    case RS2::ActionDrawLineRelAngle:
    case RS2::ActionDrawLineTangent1:
    case RS2::ActionDrawLineTangent2:
    case RS2::ActionDrawLineVertical:
        showToolBar(RS2::ToolBarLines, false);
        if(tbLines != NULL){
            tbLines->showCadToolBar(actionType);
        }
        break;
    case RS2::ActionDrawPolyline:
    case RS2::ActionPolylineAdd:
    case RS2::ActionPolylineAppend:
    case RS2::ActionPolylineDel:
    case RS2::ActionPolylineDelBetween:
    case RS2::ActionPolylineTrim:
    case RS2::ActionPolylineEquidistant:
    case RS2::ActionPolylineSegment:
        showToolBar(RS2::ToolBarPolylines, false);
        if(tbPolylines != NULL){
            tbPolylines->showCadToolBar(actionType);
        }
        break;
    case RS2::ActionDimAligned:
    case RS2::ActionDimLinear:
    case RS2::ActionDimLinearVer:
    case RS2::ActionDimLinearHor:
    case RS2::ActionDimRadial:
    case RS2::ActionDimDiametric:
    case RS2::ActionDimAngular:
    case RS2::ActionDimLeader:
        showToolBar(RS2::ToolBarDim, false);
        if(tbDim != NULL){
            tbDim->showCadToolBar(actionType);
        }
        break;
    case RS2::ActionModifyAttributes:
    case RS2::ActionModifyAttributesNoSelect:
    case RS2::ActionModifyDelete:
    case RS2::ActionModifyDeleteNoSelect:
    case RS2::ActionModifyDeleteQuick:
    case RS2::ActionModifyDeleteFree:
    case RS2::ActionModifyMove:
    case RS2::ActionModifyMoveNoSelect:
    case RS2::ActionModifyRotate:
    case RS2::ActionModifyRotateNoSelect:
    case RS2::ActionModifyScale:
    case RS2::ActionModifyScaleNoSelect:
    case RS2::ActionModifyMirror:
    case RS2::ActionModifyMirrorNoSelect:
    case RS2::ActionModifyMoveRotate:
    case RS2::ActionModifyMoveRotateNoSelect:
    case RS2::ActionModifyRotate2:
    case RS2::ActionModifyRotate2NoSelect:
    case RS2::ActionModifyEntity:
    case RS2::ActionModifyTrim:
    case RS2::ActionModifyTrim2:
    case RS2::ActionModifyTrimAmount:
    case RS2::ActionModifyCut:
    case RS2::ActionModifyStretch:
    case RS2::ActionModifyBevel:
    case RS2::ActionModifyRound:
    case RS2::ActionModifyOffset:
    case RS2::ActionModifyOffsetNoSelect:
    case RS2::ActionModifyRevertDirection:
    case RS2::ActionModifyRevertDirectionNoSelect:
        showToolBar(RS2::ToolBarModify, false);
        if(tbModify != NULL){
            tbModify->showCadToolBar(actionType);
        }
        break;
    case RS2::ActionInfoInside:
    case RS2::ActionInfoDist:
    case RS2::ActionInfoDist2:
    case RS2::ActionInfoAngle:
    case RS2::ActionInfoTotalLength:
    case RS2::ActionInfoTotalLengthNoSelect:
    case RS2::ActionInfoArea:
        showToolBar(RS2::ToolBarInfo, false);
        if(tbInfo != NULL){
            tbInfo->showCadToolBar(actionType);
        }
        break;



    }
    if(cleanup){
        if(actionHandler != NULL) {
            RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
            if(currentAction != NULL) {
                currentAction->finish(false); //finish the action, but do not update toolBar
            }
        }
    }
}
Esempio n. 15
0
//restore action from checked
void QG_CadToolBarLines::restoreAction() {
    if(actionHandler==NULL) return;
    if(bNormal->isChecked()) {
        actionHandler->slotDrawLine();
        return;
    }
    if(bAngle->isChecked()) {
        actionHandler->slotDrawLineAngle();
        return;
    }
    if(bHorizontal->isChecked()) {
        actionHandler->slotDrawLineHorizontal();
        return;
    }
    if(bVertical->isChecked()) {
        actionHandler->slotDrawLineVertical();
        return;
    }
    if(bRectangle->isChecked()) {
        actionHandler->slotDrawLineRectangle();
        return;
    }
    if(bBisector->isChecked()) {
        actionHandler->slotDrawLineBisector();
        return;
    }
    if(bParallel->isChecked()) {
        actionHandler->slotDrawLineParallel();
        return;
    }
    if(bParallelThrough->isChecked()) {
        actionHandler->slotDrawLineParallelThrough();
        return;
    }
    if(bTangent1->isChecked()) {
        actionHandler->slotDrawLineTangent1();
        return;
    }
    if(bTangent2->isChecked()) {
        actionHandler->slotDrawLineTangent2();
        return;
    }
    if(bOrthTan->isChecked()) {
        actionHandler->slotDrawLineOrthTan();
        return;
    }
    if(bOrthogonal->isChecked()) {
        actionHandler->slotDrawLineOrthogonal();
        return;
    }
    if(bRelAngle->isChecked()) {
        actionHandler->slotDrawLineRelAngle();
        return;
    }
    if(bPolygon->isChecked()) {
        actionHandler->slotDrawLinePolygon();
        return;
    }
    if(bPolygon2->isChecked()) {
        actionHandler->slotDrawLinePolygon2();
        return;
    }
    if(bFree->isChecked()) {
        actionHandler->slotDrawLineFree();
        return;
    }
    //clear all action
    bHidden->setChecked(true);
    RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
    if(currentAction != NULL) {
        currentAction->finish(false); //finish the action, but do not update toolBar
    }
}
Esempio n. 16
0
void QG_CadToolBar::showCadToolBar(RS2::ActionType actionType, bool cleanup){
	RS2::ToolBarId id=RS2::ToolBarNone;
    switch(actionType){
    //no op
    default:
        return;
        //default action resets toolbar, issue#295
	case RS2::ActionDefault:
		break;
	case RS2::ActionDrawImage:
    case RS2::ActionDrawPoint:
    case RS2::ActionDrawMText:
		id=RS2::ToolBarMain;
		break;
    case RS2::ActionDrawArc:
    case RS2::ActionDrawArc3P:
    case RS2::ActionDrawArcParallel:
    case RS2::ActionDrawArcTangential:
		id=RS2::ToolBarArcs;
        break;
    case RS2::ActionDrawCircle:
    case RS2::ActionDrawCircle2P:
    case RS2::ActionDrawCircle3P:
    case RS2::ActionDrawCircleCR:
    case RS2::ActionDrawCircleParallel:
    case RS2::ActionDrawCircleInscribe:
    case RS2::ActionDrawCircleTan2:
    case RS2::ActionDrawCircleTan2_1P:
    case RS2::ActionDrawCircleTan1_2P:
		id=RS2::ToolBarCircles;
        break;
    case RS2::ActionDrawEllipseArcAxis:
    case RS2::ActionDrawEllipseAxis:
    case RS2::ActionDrawEllipseFociPoint:
    case RS2::ActionDrawEllipse4Points:
    case RS2::ActionDrawEllipseCenter3Points:
    case RS2::ActionDrawEllipseInscribe:
		id=RS2::ToolBarEllipses;
        break;
    case RS2::ActionDrawSpline:
    case RS2::ActionDrawSplinePoints:
		id=RS2::ToolBarSplines;
        break;
    case RS2::ActionDrawLine:
    case RS2::ActionDrawLineAngle:
    case RS2::ActionDrawLineBisector:
    case RS2::ActionDrawLineFree:
    case RS2::ActionDrawLineHorVert:
    case RS2::ActionDrawLineHorizontal:
    case RS2::ActionDrawLineOrthogonal:
    case RS2::ActionDrawLineOrthTan:
    case RS2::ActionDrawLineParallel:
    case RS2::ActionDrawLineParallelThrough:
    case RS2::ActionDrawLinePolygonCenCor:
    case RS2::ActionDrawLinePolygonCorCor:
    case RS2::ActionDrawLineRectangle:
    case RS2::ActionDrawLineRelAngle:
    case RS2::ActionDrawLineTangent1:
    case RS2::ActionDrawLineTangent2:
    case RS2::ActionDrawLineVertical:
		id=RS2::ToolBarLines;
        break;
    case RS2::ActionDrawPolyline:
    case RS2::ActionPolylineAdd:
    case RS2::ActionPolylineAppend:
    case RS2::ActionPolylineDel:
    case RS2::ActionPolylineDelBetween:
    case RS2::ActionPolylineTrim:
    case RS2::ActionPolylineEquidistant:
    case RS2::ActionPolylineSegment:
		id=RS2::ToolBarPolylines;
        break;
    case RS2::ActionDimAligned:
    case RS2::ActionDimLinear:
    case RS2::ActionDimLinearVer:
    case RS2::ActionDimLinearHor:
    case RS2::ActionDimRadial:
    case RS2::ActionDimDiametric:
    case RS2::ActionDimAngular:
    case RS2::ActionDimLeader:
		id=RS2::ToolBarDim;
        break;
    case RS2::ActionModifyAttributes:
    case RS2::ActionModifyAttributesNoSelect:
    case RS2::ActionModifyDelete:
    case RS2::ActionModifyDeleteNoSelect:
    case RS2::ActionModifyDeleteQuick:
    case RS2::ActionModifyDeleteFree:
    case RS2::ActionModifyMove:
    case RS2::ActionModifyMoveNoSelect:
    case RS2::ActionModifyRotate:
    case RS2::ActionModifyRotateNoSelect:
    case RS2::ActionModifyScale:
    case RS2::ActionModifyScaleNoSelect:
    case RS2::ActionModifyMirror:
    case RS2::ActionModifyMirrorNoSelect:
    case RS2::ActionModifyMoveRotate:
    case RS2::ActionModifyMoveRotateNoSelect:
    case RS2::ActionModifyRotate2:
    case RS2::ActionModifyRotate2NoSelect:
    case RS2::ActionModifyEntity:
    case RS2::ActionModifyTrim:
    case RS2::ActionModifyTrim2:
    case RS2::ActionModifyTrimAmount:
    case RS2::ActionModifyCut:
    case RS2::ActionModifyStretch:
    case RS2::ActionModifyBevel:
    case RS2::ActionModifyRound:
    case RS2::ActionModifyOffset:
    case RS2::ActionModifyOffsetNoSelect:
    case RS2::ActionModifyRevertDirection:
    case RS2::ActionModifyRevertDirectionNoSelect:
		id=RS2::ToolBarModify;
        break;
    case RS2::ActionInfoInside:
    case RS2::ActionInfoDist:
    case RS2::ActionInfoDist2:
    case RS2::ActionInfoAngle:
    case RS2::ActionInfoTotalLength:
    case RS2::ActionInfoTotalLengthNoSelect:
    case RS2::ActionInfoArea:
		id=RS2::ToolBarInfo;
        break;
    }
	if(id != RS2::ToolBarNone){
		m_toolbars[id]->showCadToolBar(actionType);
		showToolBar(id, false);
	}
    if(cleanup){
		if(actionHandler ) {
            RS_ActionInterface* currentAction =actionHandler->getCurrentAction();
			if(currentAction ) {
                currentAction->finish(false); //finish the action, but do not update toolBar
            }
        }
    }
}