Added Drawing_OpenBrowserView command

While the Drawing viewer is still based on QtSvg,
I added this little button to make it handy to
check how a page renders in the webkit window.
This commit is contained in:
Yorik van Havre
2012-01-19 21:01:57 -02:00
parent d02c928b4b
commit 7b6eab3781
5 changed files with 771 additions and 0 deletions

View File

@@ -317,6 +317,44 @@ void CmdDrawingOrthoViews::activated(int iMsg)
}
//===========================================================================
// Drawing_OpenBrowserView
//===========================================================================
DEF_STD_CMD_A(CmdDrawingOpenBrowserView);
CmdDrawingOpenBrowserView::CmdDrawingOpenBrowserView()
: Command("Drawing_OpenBrowserView")
{
// seting the
sGroup = QT_TR_NOOP("Drawing");
sMenuText = QT_TR_NOOP("Open &browser view");
sToolTipText = QT_TR_NOOP("Opens the selected page in a browser view");
sWhatsThis = "Drawing_OpenBrowserView";
sStatusTip = QT_TR_NOOP("Opens the selected page in a browser view");
sPixmap = "actions/drawing-openbrowser";
}
void CmdDrawingOpenBrowserView::activated(int iMsg)
{
unsigned int n = getSelection().countObjectsOfType(Drawing::FeaturePage::getClassTypeId());
if (n != 1) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Select one Page object."));
return;
}
std::vector<Gui::SelectionSingleton::SelObj> Sel = getSelection().getSelection();
doCommand(Doc,"PageName = App.activeDocument().%s.PageResult",Sel[0].FeatName);
doCommand(Doc,"import WebGui");
doCommand(Doc,"WebGui.openBrowser(PageName)");
}
bool CmdDrawingOpenBrowserView::isActive(void)
{
return (getActiveGuiDocument() ? true : false);
}
//===========================================================================
// Drawing_ExportPage
//===========================================================================
@@ -412,6 +450,7 @@ void CreateDrawingCommands(void)
rcCmdMgr.addCommand(new CmdDrawingNewA3Landscape());
rcCmdMgr.addCommand(new CmdDrawingNewView());
rcCmdMgr.addCommand(new CmdDrawingOrthoViews());
rcCmdMgr.addCommand(new CmdDrawingOpenBrowserView());
rcCmdMgr.addCommand(new CmdDrawingExportPage());
rcCmdMgr.addCommand(new CmdDrawingProjectShape());
}

View File

@@ -15,6 +15,7 @@
<file>icons/actions/drawing-portrait-A4.svg</file>
<file>icons/actions/drawing-view.svg</file>
<file>icons/actions/drawing-orthoviews.svg</file>
<file>icons/actions/drawing-openbrowser.svg</file>
<file>translations/Drawing_af.qm</file>
<file>translations/Drawing_de.qm</file>
<file>translations/Drawing_es.qm</file>

View File

@@ -19,6 +19,7 @@ EXTRA_DIST = \
icons/actions/drawing-landscape-new.svg \
icons/actions/drawing-portrait-A4.svg \
icons/actions/drawing-orthoviews.svg \
icons/actions/drawing-openbrowser.svg \
icons/Page.svg \
icons/Pages.svg \
icons/View.svg \

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -61,6 +61,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
*part << "Drawing_NewPage";
*part << "Drawing_NewView";
*part << "Drawing_OrthoViews";
*part << "Drawing_OpenBrowserView";
*part << "Drawing_ExportPage";
return root;
@@ -76,6 +77,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
*part << "Drawing_NewPage";
*part << "Drawing_NewView";
*part << "Drawing_OrthoViews";
*part << "Drawing_OpenBrowserView";
*part << "Drawing_ExportPage";
return root;
}
@@ -92,6 +94,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
//*img << "Drawing_NewA3Landscape";
*img << "Drawing_NewPage";
*img << "Drawing_OrthoViews";
*img << "Drawing_OpenBrowserView";
img = new Gui::ToolBarItem(root);
img->setCommand("Views");
*img << "Drawing_NewView";