Gui: send message events for zoom in/out commands to also support the image view

This commit is contained in:
wmayer
2023-03-19 19:23:30 +01:00
parent 63320c752b
commit 565cf73f1d
2 changed files with 75 additions and 39 deletions

View File

@@ -2439,16 +2439,12 @@ StdViewZoomIn::StdViewZoomIn()
void StdViewZoomIn::activated(int iMsg)
{
Q_UNUSED(iMsg);
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if ( view ) {
View3DInventorViewer* viewer = view->getViewer();
viewer->navigationStyle()->zoomIn();
}
getGuiApplication()->sendMsgToFocusView("ZoomIn");
}
bool StdViewZoomIn::isActive()
{
return (qobject_cast<View3DInventor*>(getMainWindow()->activeWindow()));
return getGuiApplication()->sendHasMsgToActiveView("ZoomIn");
}
//===========================================================================
@@ -2472,16 +2468,12 @@ StdViewZoomOut::StdViewZoomOut()
void StdViewZoomOut::activated(int iMsg)
{
Q_UNUSED(iMsg);
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
if (view) {
View3DInventorViewer* viewer = view->getViewer();
viewer->navigationStyle()->zoomOut();
}
getGuiApplication()->sendMsgToFocusView("ZoomOut");
}
bool StdViewZoomOut::isActive()
{
return (qobject_cast<View3DInventor*>(getMainWindow()->activeWindow()));
return getGuiApplication()->sendHasMsgToActiveView("ZoomOut");
}
namespace {

View File

@@ -422,18 +422,31 @@ bool View3DInventor::onMsg(const char* pMsg, const char** ppReturn)
getGuiDocument()->saveCopy();
return true;
}
else if (strcmp("ZoomIn", pMsg) == 0) {
View3DInventorViewer* viewer = getViewer();
viewer->navigationStyle()->zoomIn();
return true;
}
else if (strcmp("ZoomOut", pMsg) == 0) {
View3DInventorViewer* viewer = getViewer();
viewer->navigationStyle()->zoomOut();
return true;
}
return false;
}
bool View3DInventor::onHasMsg(const char* pMsg) const
{
if (strcmp("Save",pMsg) == 0)
if (strcmp("Save",pMsg) == 0) {
return true;
else if (strcmp("SaveAs",pMsg) == 0)
}
else if (strcmp("SaveAs",pMsg) == 0) {
return true;
else if (strcmp("SaveCopy",pMsg) == 0)
}
else if (strcmp("SaveCopy",pMsg) == 0) {
return true;
}
else if (strcmp("Undo",pMsg) == 0) {
App::Document* doc = getAppDocument();
return doc && doc->getAvailableUndos() > 0;
@@ -442,58 +455,89 @@ bool View3DInventor::onHasMsg(const char* pMsg) const
App::Document* doc = getAppDocument();
return doc && doc->getAvailableRedos() > 0;
}
else if (strcmp("Print",pMsg) == 0)
else if (strcmp("Print",pMsg) == 0) {
return true;
else if (strcmp("PrintPreview",pMsg) == 0)
}
else if (strcmp("PrintPreview",pMsg) == 0) {
return true;
else if (strcmp("PrintPdf",pMsg) == 0)
}
else if (strcmp("PrintPdf",pMsg) == 0) {
return true;
else if(strcmp("SetStereoRedGreen",pMsg) == 0)
}
else if(strcmp("SetStereoRedGreen",pMsg) == 0) {
return true;
else if(strcmp("SetStereoQuadBuff",pMsg) == 0)
}
else if(strcmp("SetStereoQuadBuff",pMsg) == 0) {
return true;
else if(strcmp("SetStereoInterleavedRows",pMsg) == 0)
}
else if(strcmp("SetStereoInterleavedRows",pMsg) == 0) {
return true;
else if(strcmp("SetStereoInterleavedColumns",pMsg) == 0)
}
else if(strcmp("SetStereoInterleavedColumns",pMsg) == 0) {
return true;
else if(strcmp("SetStereoOff",pMsg) == 0)
}
else if(strcmp("SetStereoOff",pMsg) == 0) {
return true;
else if(strcmp("Example1",pMsg) == 0)
}
else if(strcmp("Example1",pMsg) == 0) {
return true;
else if(strcmp("Example2",pMsg) == 0)
}
else if(strcmp("Example2",pMsg) == 0) {
return true;
else if(strcmp("Example3",pMsg) == 0)
}
else if(strcmp("Example3",pMsg) == 0) {
return true;
else if(strcmp("ViewFit",pMsg) == 0)
}
else if(strcmp("ViewFit",pMsg) == 0) {
return true;
else if(strcmp("ViewVR",pMsg) == 0)
}
else if(strcmp("ViewVR",pMsg) == 0) {
#ifdef BUILD_VR
return true;
#else
return false;
#endif
else if(strcmp("ViewSelection",pMsg) == 0)
}
else if(strcmp("ViewSelection",pMsg) == 0) {
return true;
else if(strcmp("ViewBottom",pMsg) == 0)
}
else if(strcmp("ViewBottom",pMsg) == 0) {
return true;
else if(strcmp("ViewFront",pMsg) == 0)
}
else if(strcmp("ViewFront",pMsg) == 0) {
return true;
else if(strcmp("ViewLeft",pMsg) == 0)
}
else if(strcmp("ViewLeft",pMsg) == 0) {
return true;
else if(strcmp("ViewRear",pMsg) == 0)
}
else if(strcmp("ViewRear",pMsg) == 0) {
return true;
else if(strcmp("ViewRight",pMsg) == 0)
}
else if(strcmp("ViewRight",pMsg) == 0) {
return true;
else if(strcmp("ViewTop",pMsg) == 0)
}
else if(strcmp("ViewTop",pMsg) == 0) {
return true;
else if(strcmp("ViewAxo",pMsg) == 0)
}
else if(strcmp("ViewAxo",pMsg) == 0) {
return true;
else if(strcmp("GetCamera",pMsg) == 0)
}
else if(strcmp("GetCamera",pMsg) == 0) {
return true;
else if(strncmp("SetCamera",pMsg,9) == 0)
}
else if(strncmp("SetCamera",pMsg,9) == 0) {
return true;
else if(strncmp("Dump",pMsg,4) == 0)
}
else if(strncmp("Dump",pMsg,4) == 0) {
return true;
}
if (strcmp("ZoomIn", pMsg) == 0) {
return true;
}
if (strcmp("ZoomOut", pMsg) == 0) {
return true;
}
return false;
}