// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
//
#include "SHAPERGUI.h"
#include <XGUI_OperationMgr.h>
#include <XGUI_Displayer.h>
#include <XGUI_MenuMgr.h>
+#include <XGUI_FacesPanel.h>
+#include <XGUI_SelectionActivate.h>
+#include <XGUI_InspectionPanel.h>
#include <ModuleBase_Operation.h>
#include <ModuleBase_Preferences.h>
#include <QTimer>
#include <QMenu>
-//#define SALOME_PATCH_FOR_CTRL_WHEEL
+#define SALOME_PATCH_FOR_CTRL_WHEEL
extern "C" {
SHAPERGUI_EXPORT CAM_Module* createModule()
//******************************************************
SHAPERGUI::SHAPERGUI()
: LightApp_Module("SHAPER"),
- mySelector(0), myIsOpened(0), myPopupMgr(0)
+ mySelector(0), myIsOpened(0), myPopupMgr(0), myIsInspectionVisible(false),
+ myInspectionPanel(0)
{
myWorkshop = new XGUI_Workshop(this);
connect(myWorkshop, SIGNAL(commandStatusUpdated()),
//******************************************************
SHAPERGUI::~SHAPERGUI()
{
+ delete myWorkshop;
+ delete myProxyViewer;
}
//******************************************************
{
connect(anApp, SIGNAL(preferenceResetToDefaults()), this, SLOT(onDefaultPreferences()));
}
+
+ int aMenu = createMenu(tr("Inspection"), -1, -1, 30);
+ int aSubMenu = createMenu(tr("Information"), aMenu);
+
+ int aId = myActionsList.size();
+ myActionsList.append("INSPECTION_CMD");
+ SUIT_Desktop* aDesk = application()->desktop();
+ QString aTip = tr("Show inspection window");
+ myWhatIsAction = createAction(aId, aTip, QIcon(":pictures/whatis.png"), tr("What Is"),
+ aTip, QKeySequence(), aDesk, true, this, SLOT(onWhatIs(bool)));
+ myWhatIsAction->setStatusTip(aTip);
+ myWhatIsAction->setData("INSPECTION_CMD");
+ createMenu(aId, aSubMenu, 0);
+
+ int aTool = createTool(tr("Inspection tool"));
+ int aToolId = createTool(myWhatIsAction, aTool);
}
//******************************************************
desktop()->tabifyDockWidget(aObjDoc, myWorkshop->propertyPanel());
}
+ if (!myInspectionPanel) {
+ myInspectionPanel = myWorkshop->inspectionPanel();
+ QAction* aViewAct = myInspectionPanel->toggleViewAction();
+ connect(aViewAct, SIGNAL(toggled(bool)), this, SLOT(onWhatIs(bool)));
+ }
+ myInspectionPanel->toggleViewAction()->setEnabled(true);
+
if (!mySelector) {
ViewManagerList OCCViewManagers;
application()->viewManagers(OCCViewer_Viewer::Type(), OCCViewManagers);
// Postrrocessing for LoadScriptId to remove created(if it was created) SALOME Object Browser
connect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),
this, SLOT(onScriptLoaded()));
+
+ disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
+ getApp(), SLOT(onSaveDoc()));
+ disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
+ getApp(), SLOT(onSaveAsDoc()));
+
+ connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
+ this, SLOT(onSaveDocByShaper()));
+ connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
+ this, SLOT(onSaveAsDocByShaper()));
+
return isDone;
}
aViewAct->setEnabled(false);
}
+ myIsInspectionVisible = myInspectionPanel->isVisible();
+ myInspectionPanel->hide();
+ QAction* aViewAct = myInspectionPanel->toggleViewAction();
+ aViewAct->setEnabled(false);
+
// the active operation should be stopped for the next activation.
// There should not be active operation and visualized preview.
// Abort operation should be performed before the selection's remove
mySelector = 0;
}
+ myWorkshop->hidePanel(myWorkshop->facesPanel());
//myWorkshop->contextMenuMgr()->disconnectViewer();
SUIT_ResourceMgr* aResMgr = application()->resourceMgr();
disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)),
this, SLOT(onScriptLoaded()));
+ disconnect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
+ this, SLOT(onSaveDocByShaper()));
+ disconnect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
+ this, SLOT(onSaveAsDocByShaper()));
+
+ connect(getApp()->action(LightApp_Application::FileSaveId), SIGNAL(triggered(bool)),
+ getApp(), SLOT(onSaveDoc()));
+ connect(getApp()->action(LightApp_Application::FileSaveAsId), SIGNAL(triggered(bool)),
+ getApp(), SLOT(onSaveAsDoc()));
+
+
return LightApp_Module::deactivateModule(theStudy);
}
{
if (!mySelector) {
mySelector = createSelector(theMgr);
- myWorkshop->module()->activateSelectionFilters();
+ myWorkshop->selectionActivate()->updateSelectionFilters();
+ myWorkshop->selectionActivate()->updateSelectionModes();
myWorkshop->synchronizeViewer();
}
}
delete aBrowser;
}
+//******************************************************
+void SHAPERGUI::onSaveDocByShaper()
+{
+ if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
+ return;
+
+ getApp()->onSaveDoc();
+}
+
+//******************************************************
+void SHAPERGUI::onSaveAsDocByShaper()
+{
+ if(!workshop()->operationMgr()->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
+ return;
+
+ getApp()->onSaveAsDoc();
+}
+
//******************************************************
void SHAPERGUI::onUpdateCommandStatus()
{
const bool isAddSeparator)
{
return addFeature(theWBName,
+ theInfo.toolBar,
theInfo.id,
theInfo.text,
//Issue #650: in the SALOME mode the tooltip should be same as text
}
//******************************************************
-QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theId,
- const QString& theTitle, const QString& theTip,
+QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBName,
+ const QString& theId, const QString& theTitle, const QString& theTip,
const QIcon& theIcon, const QKeySequence& theKeys,
bool isCheckable, const bool isAddSeparator,
const QString& theStatusTip)
if (isAddSeparator)
createMenu(separator(), aWBMenu);
- int aWBTool = createTool(theWBName, theWBName);
+ int aWBTool = createTool(theTBName, theTBName);
int aToolId = createTool(aId, aWBTool);
if (isAddSeparator)
createTool(separator(), aWBTool);
int sensitivityGroup = pref->addItem(tr("Selection sensitivity"), viewTab);
pref->setItemProperty("columns", 2, sensitivityGroup);
- pref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::Double,
+ pref->addItem(tr("Vertex"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity");
- pref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::Double,
+ pref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin,
ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity");
pref->retrieve();
}
{
myWorkshop->menuMgr()->createFeatureActions();
}
+
+void SHAPERGUI::onWhatIs(bool isToggled)
+{
+ if (sender() == myWhatIsAction) {
+ QAction* aViewAct = myInspectionPanel->toggleViewAction();
+ aViewAct->blockSignals(true);
+ aViewAct->setChecked(isToggled);
+ aViewAct->blockSignals(false);
+ myInspectionPanel->setVisible(isToggled);
+ }
+ else {
+ myWhatIsAction->blockSignals(true);
+ myWhatIsAction->setChecked(isToggled);
+ myWhatIsAction->blockSignals(false);
+ myInspectionPanel->setVisible(isToggled);
+ }
+}
+
+void SHAPERGUI::updateModuleVisibilityState()
+{
+ LightApp_Module::updateModuleVisibilityState();
+ onWhatIs(myIsInspectionVisible);
+}