예제 #1
0
파일: tapp.cpp 프로젝트: SaierMe/opentoonz
void TApp::autosave() {
  ToonzScene *scene = getCurrentScene()->getScene();

  if (!getCurrentScene()->getDirtyFlag()) return;

  if (getCurrentTool()->isToolBusy()) {
    m_autosaveSuspended = true;
    return;
  } else
    m_autosaveSuspended = false;

  if (scene->isUntitled()) {
    DVGui::warning(
        tr("It is not possible to save automatically an untitled scene."));
    return;
  }

  DVGui::ProgressDialog pb(
      "Autosaving scene..." + toQString(scene->getScenePath()), 0, 0, 1);
  pb.show();
  IoCmd::saveScene();
  pb.setValue(1);
}
예제 #2
0
void LLToolMgr::updateToolStatus()
{
	// call getcurrenttool() to calculate active tool and call handleSelect() and handleDeselect() immediately
	// when active tool changes
	getCurrentTool();
}
예제 #3
0
/*! \brief .
*
*/
void
RoadTypeEditor::toolAction(ToolAction *toolAction)
{
    // Parent //
    //
    ProjectEditor::toolAction(toolAction);

    if (getCurrentTool() == ODD::TRT_SELECT)
    {
        // does nothing //
    }
    else if (getCurrentTool() == ODD::TRT_ADD)
    {
        // does nothing //
    }
    else if (getCurrentTool() == ODD::TRT_DEL)
    {
        // Problem: The ToolAction is resent, after a warning message has been clicked away. (Due to resend on getting the focus back?)

        //		QList<QGraphicsItem *> selectedItems = getTopviewGraph()->graphScene()->selectedItems();
        //
        //		// Macro Command //
        //		//
        //		int numberOfSelectedItems = selectedItems.size();
        //		if(numberOfSelectedItems > 1)
        //		{
        //			getProjectData()->getUndoStack()->beginMacro(QObject::tr("Delete Road Type Sections"));
        //		}
        //
        //		// Delete selected items //
        //		//
        //		foreach(QGraphicsItem * item, getTopviewGraph()->graphScene()->selectedItems())
        //		{
        //			TypeSectionItem * typeSectionItem = dynamic_cast<TypeSectionItem *>(item);
        //			if(typeSectionItem)
        //			{
        //				typeSectionItem->setSelected(false);
        //				typeSectionItem->deleteTypeSection();
        //			}
        //		}
        //
        //		// Macro Command //
        //		//
        //		if(numberOfSelectedItems > 1)
        //		{
        //			getProjectData()->getUndoStack()->endMacro();
        //		}
    }

    // RoadType //
    //
    TypeEditorToolAction *typeEditorToolAction = dynamic_cast<TypeEditorToolAction *>(toolAction);
    if (typeEditorToolAction)
    {
        // Set RoadType //
        //
        TypeSection::RoadType roadType = typeEditorToolAction->getRoadType();
        if (roadType != TypeSection::RTP_NONE)
        {
            if (typeEditorToolAction->isApplyingRoadType())
            {
                QList<QGraphicsItem *> selectedItems = getTopviewGraph()->getScene()->selectedItems();

                // Macro Command //
                //
                int numberOfSelectedItems = selectedItems.size();
                if (numberOfSelectedItems > 1)
                {
                    getProjectData()->getUndoStack()->beginMacro(QObject::tr("Set Road Type"));
                }

                // Change types of selected items //
                //
                foreach (QGraphicsItem *item, selectedItems)
                {
                    TypeSectionItem *typeSectionItem = dynamic_cast<TypeSectionItem *>(item);
                    if (typeSectionItem)
                    {
                        typeSectionItem->changeRoadType(roadType);
                    }
                }

                // Macro Command //
                //
                if (numberOfSelectedItems > 1)
                {
                    getProjectData()->getUndoStack()->endMacro();
                }
            }
            else
            {
예제 #4
0
BOOL LLToolCompInspect::handleMouseUp(S32 x, S32 y, MASK mask)
{
	BOOL handled = LLToolComposite::handleMouseUp(x, y, mask);
	mIsToolCameraActive = getCurrentTool() == LLToolCamera::getInstance();
	return handled;
}