예제 #1
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();
    }
}
예제 #2
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();
//	}
}
예제 #3
0
void QG_CadToolBar::showToolBar(RS2::ToolBarId id, bool restoreAction ) {
    QWidget* newTb = NULL;
    switch (id) {
    default:
    case RS2::ToolBarMain:
        if(restoreAction) tbMain->restoreAction();
        newTb = tbMain;
        break;
    case RS2::ToolBarLines:
        if(restoreAction) tbLines->restoreAction();
        newTb = tbLines;
        break;
    case RS2::ToolBarArcs:
        if(restoreAction) tbArcs->restoreAction();
        newTb = tbArcs;
        break;
    case RS2::ToolBarEllipses:
        if(restoreAction) tbEllipses->restoreAction();
        newTb = tbEllipses;
        break;
    case RS2::ToolBarPolylines:
        if(restoreAction) tbPolylines->restoreAction();
        newTb = tbPolylines;
        break;
    case RS2::ToolBarCircles:
        if(restoreAction) tbCircles->restoreAction();
        newTb = tbCircles;
        break;
    case RS2::ToolBarInfo:
        if(restoreAction) tbInfo->restoreAction();
        newTb = tbInfo;
        break;
    case RS2::ToolBarModify:
        if(restoreAction) tbModify->restoreAction();
        newTb = tbModify;
        break;
    case RS2::ToolBarDim:
        if(restoreAction) tbDim->restoreAction();
        newTb = tbDim;
        break;
    case RS2::ToolBarSelect:
        newTb = tbSelect;
        break;
    }
    hideSubToolBars();
    int i0=toolbarIDs.indexOf(id)+1;
    if(i0>0 && i0<toolbarIDs.size()){
        toolbars.erase(toolbars.begin()+i0,toolbars.end());
        toolbarIDs.erase(toolbarIDs.begin()+i0,toolbarIDs.end());
    }
    if (newTb!=NULL) {
        if(!( toolbarIDs.size()>0 && id == toolbarIDs.last())) {
            toolbarIDs.push_back(id);
            toolbars.push_back(newTb);
        }
    }
    showSubToolBar();
}
예제 #4
0
void QG_CadToolBar::showToolBarSelect(RS_ActionInterface* selectAction,
                                      int nextAction) {
	auto p=m_toolbars[RS2::ToolBarSelect];

	p->setNextAction(nextAction);
	p->setSelectAction(selectAction);
    showToolBar(RS2::ToolBarSelect);
	showSubToolBar();
}
예제 #5
0
void QG_CadToolBar::showToolBar(RS2::ToolBarId id, bool restoreAction ) {

	LC_CadToolBarInterface* newTb;
	if(m_toolbars.count(id)){
		newTb=m_toolbars[id];
	}else{
		newTb=m_toolbars[RS2::ToolBarMain];
	}
	if(restoreAction) newTb->restoreAction();
	hideSubToolBars();
	auto it=std::find(activeToolbars.begin(), activeToolbars.end(), newTb);
	if(it != activeToolbars.end()){
		activeToolbars.erase(it+1,activeToolbars.end());
	}
	if(!( activeToolbars.size()>0 && newTb == activeToolbars.back())) {
		activeToolbars.push_back(newTb);
	}
	showSubToolBar();
	adjustSize();
}