add ToggleFrame command

This commit is contained in:
WandererFan 2016-01-30 13:02:23 -05:00 committed by wmayer
parent 42eed349ac
commit 6fe7add213
6 changed files with 537 additions and 4 deletions

View File

@ -67,8 +67,8 @@ DEF_STD_CMD(CmdTechDrawNewHatch);
CmdTechDrawNewHatch::CmdTechDrawNewHatch()
: Command("TechDraw_NewHatch")
{
sAppModule = "Drawing";
sGroup = QT_TR_NOOP("Drawing");
sAppModule = "TechDraw";
sGroup = QT_TR_NOOP("TechDraw");
sMenuText = QT_TR_NOOP("Insert a hatched area into a view");
sToolTipText = QT_TR_NOOP("Insert a hatched area into a view");
sWhatsThis = "TechDraw_NewHatch";
@ -120,12 +120,65 @@ void CmdTechDrawNewHatch::activated(int iMsg)
objFeat->X.setValue(x);
}
//===========================================================================
// TechDraw_ToggleFrame
//===========================================================================
DEF_STD_CMD(CmdTechDrawToggleFrame);
CmdTechDrawToggleFrame::CmdTechDrawToggleFrame()
: Command("TechDraw_ToggleFrame")
{
sAppModule = "TechDraw";
sGroup = QT_TR_NOOP("TechDraw");
sMenuText = QT_TR_NOOP("Turn View Frames on or off");
sToolTipText = QT_TR_NOOP("Turn View Frames on or off");
sWhatsThis = "TechDraw_ToggleFrame";
sStatusTip = sToolTipText;
sPixmap = "actions/techdraw-toggleframe";
}
void CmdTechDrawToggleFrame::activated(int iMsg)
{
std::vector<App::DocumentObject*> pages = getSelection().getObjectsOfType(TechDraw::DrawPage::getClassTypeId());
if (pages.empty()) { // no Pages in Selection
pages = getDocument()->getObjectsOfType(TechDraw::DrawPage::getClassTypeId());
if (pages.empty()) { // no Pages in Document
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No pages found"),
QObject::tr("Create a TechDraw Page first."));
return;
}
}
unsigned int n = getSelection().countObjectsOfType(TechDraw::DrawPage::getClassTypeId());
if (n > 1) { // too many Pages
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
QObject::tr("Select only one Page object."));
return;
}
TechDraw::DrawPage* page = dynamic_cast<TechDraw::DrawPage*>(pages.front());
//TODO: this should probably work on the currently displayed page, rather than selecting one in the Tree
Gui::Document* activeGui = Gui::Application::Instance->getDocument(page->getDocument());
Gui::ViewProvider* vp = activeGui->getViewProvider(page);
ViewProviderPage* dvp = dynamic_cast<ViewProviderPage*>(vp);
if (dvp && dvp->getMDIViewPage()) {
dvp->getMDIViewPage()->setFrameState(!dvp->getMDIViewPage()->getFrameState());
} else {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No TechDraw Page"),
QObject::tr("Need a TechDraw Page for this command"));
return;
}
}
void CreateTechDrawCommandsDecorate(void)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdTechDrawNewHatch());
//rcCmdMgr.addCommand(new CmdTechDrawHideLabels());
rcCmdMgr.addCommand(new CmdTechDrawToggleFrame());
}
//===========================================================================

View File

@ -104,7 +104,9 @@ using namespace TechDrawGui;
/* TRANSLATOR TechDrawGui::MDIViewPage */
MDIViewPage::MDIViewPage(ViewProviderPage *pageVp, Gui::Document* doc, QWidget* parent)
: Gui::MDIView(doc, parent), pageGui(pageVp)
: Gui::MDIView(doc, parent),
pageGui(pageVp),
m_frameState(true)
{
m_view = new QGVPage(pageVp);
@ -1091,6 +1093,13 @@ void MDIViewPage::saveSVG()
m_view->scene()->update();
}
void MDIViewPage::setFrameState(bool state)
{
m_frameState = state;
m_view->toggleEdit(state);
m_view->scene()->update();
}
PyObject* MDIViewPage::getPyObject()
{
Py_Return;

View File

@ -87,6 +87,8 @@ public:
void print(QPrinter* printer);
void printPdf();
void printPreview();
void setFrameState(bool state);
bool getFrameState(void) {return m_frameState;};
void setDocumentObject(const std::string&);
PyObject* getPyObject();
@ -120,6 +122,8 @@ private:
QPrinter::PageSize m_pageSize;
ViewProviderPage *pageGui;
bool m_frameState;
QList<QGIView *> deleteItems;
};

View File

@ -39,6 +39,7 @@
<file>icons/actions/saveSVG.svg</file>
<file>icons/actions/techdraw-viewsection.svg</file>
<file>icons/actions/techdraw-hatch.svg</file>
<file>icons/actions/techdraw-toggleframe.svg</file>
<file>icons/ProjBottom.svg</file>
<file>icons/ProjFront.svg</file>
<file>icons/ProjGroup.svg</file>

View File

@ -0,0 +1,464 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48.000000px"
height="48.000000px"
id="svg249"
sodipodi:version="0.32"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="techdraw-draft-view.svg"
inkscape:export-filename="/home/jimmac/gfx/novell/pdes/trunk/docs/BIGmime-text.png"
inkscape:export-xdpi="240.00000"
inkscape:export-ydpi="240.00000"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs3">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5031"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<linearGradient
inkscape:collect="always"
id="linearGradient5060">
<stop
style="stop-color:black;stop-opacity:1;"
offset="0"
id="stop5062" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5064" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5029"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<linearGradient
id="linearGradient5048">
<stop
style="stop-color:black;stop-opacity:0;"
offset="0"
id="stop5050" />
<stop
id="stop5056"
offset="0.5"
style="stop-color:black;stop-opacity:1;" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5052" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5048"
id="linearGradient5027"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
x1="302.85715"
y1="366.64789"
x2="302.85715"
y2="609.50507" />
<linearGradient
inkscape:collect="always"
id="linearGradient4542">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop4544" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop4546" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4542"
id="radialGradient4548"
cx="24.306795"
cy="42.07798"
fx="24.306795"
fy="42.07798"
r="15.821514"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.284916,-6.310056e-16,30.08928)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient15662">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop15664" />
<stop
style="stop-color:#f8f8f8;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop15666" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.5679"
fx="20.8921"
r="5.257"
cy="64.5679"
cx="20.8921"
id="aigrd3">
<stop
id="stop15573"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15575"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.8921"
r="5.256"
cy="114.5684"
cx="20.8921"
id="aigrd2">
<stop
id="stop15566"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15568"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<linearGradient
id="linearGradient269">
<stop
style="stop-color:#a3a3a3;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop270" />
<stop
style="stop-color:#4c4c4c;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop271" />
</linearGradient>
<linearGradient
id="linearGradient259">
<stop
style="stop-color:#fafafa;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop260" />
<stop
style="stop-color:#bbbbbb;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop261" />
</linearGradient>
<linearGradient
id="linearGradient12512">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop12513" />
<stop
style="stop-color:#fff520;stop-opacity:0.89108908;"
offset="0.50000000"
id="stop12517" />
<stop
style="stop-color:#fff300;stop-opacity:0.0000000;"
offset="1.0000000"
id="stop12514" />
</linearGradient>
<radialGradient
r="37.751713"
fy="3.7561285"
fx="8.8244190"
cy="3.7561285"
cx="8.8244190"
gradientTransform="matrix(0.72620472,0,0,0.77457522,9.2878109,-41.554179)"
gradientUnits="userSpaceOnUse"
id="radialGradient15656"
xlink:href="#linearGradient269"
inkscape:collect="always" />
<radialGradient
r="86.708450"
fy="35.736916"
fx="33.966679"
cy="35.736916"
cx="33.966679"
gradientTransform="matrix(0.72036972,0,0,0.78084897,6.7726462,-42.039015)"
gradientUnits="userSpaceOnUse"
id="radialGradient15658"
xlink:href="#linearGradient259"
inkscape:collect="always" />
<radialGradient
r="38.158695"
fy="7.2678967"
fx="8.1435566"
cy="7.2678967"
cx="8.1435566"
gradientTransform="matrix(0.72620472,0,0,0.77457522,9.2878109,-41.554179)"
gradientUnits="userSpaceOnUse"
id="radialGradient15668"
xlink:href="#linearGradient15662"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-76"
id="linearGradient4343"
gradientUnits="userSpaceOnUse"
x1="18.971846"
y1="14.452502"
x2="44.524982"
y2="41.792759" />
<linearGradient
id="linearGradient3377-76">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop3379-5" />
<stop
id="stop4345"
offset="0.5"
style="stop-color:#fcb915;stop-opacity:1;" />
<stop
style="stop-color:#c68708;stop-opacity:1;"
offset="1"
id="stop3381-7" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-76"
id="linearGradient4349"
x1="145.64697"
y1="79.160103"
x2="175.6825"
y2="108.75008"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4482">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop4484" />
<stop
id="stop4486"
offset="0.5"
style="stop-color:#fcb915;stop-opacity:1;" />
<stop
style="stop-color:#c68708;stop-opacity:1;"
offset="1"
id="stop4488" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient4351"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436" />
<linearGradient
id="linearGradient3377">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop3379" />
<stop
style="stop-color:#ffaa00;stop-opacity:1;"
offset="1"
id="stop3381" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient4353"
gradientUnits="userSpaceOnUse"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436" />
<linearGradient
id="linearGradient4495">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop4497" />
<stop
style="stop-color:#ffaa00;stop-opacity:1;"
offset="1"
id="stop4499" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.32941176"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-2.1104681"
inkscape:cy="10.228358"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1366"
inkscape:window-height="694"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:showpageshadow="false"
inkscape:window-maximized="1" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://jimmac.musichall.cz</dc:source>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Shadow"
id="layer6"
inkscape:groupmode="layer">
<g
style="display:inline"
id="g5022"
transform="matrix(0.01623864,0,0,0.01114307,38.193192,38.728485)">
<rect
y="-150.69685"
x="-1559.2523"
height="478.35718"
width="1339.6335"
id="rect4173"
style="opacity:0.40206185;color:#000000;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" />
<path
sodipodi:nodetypes="cccc"
id="path5058"
d="m -219.61876,-150.68038 c 0,0 0,478.33079 0,478.33079 142.874166,0.90045 345.40022,-107.16966 345.40014,-239.196175 0,-132.026537 -159.436816,-239.134595 -345.40014,-239.134615 z"
style="opacity:0.40206185;color:#000000;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
inkscape:connector-curvature="0" />
<path
style="opacity:0.40206185;color:#000000;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible"
d="m -1559.2523,-150.68038 c 0,0 0,478.33079 0,478.33079 -142.8742,0.90045 -345.4002,-107.16966 -345.4002,-239.196175 0,-132.026537 159.4368,-239.134595 345.4002,-239.134615 z"
id="path5018"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0" />
</g>
</g>
<g
id="layer1"
inkscape:label="Base"
inkscape:groupmode="layer"
style="display:inline">
<rect
ry="0.86178643"
y="-39.30418"
x="11.72531"
height="30.690371"
width="26.15625"
id="rect15391"
style="color:#000000;fill:url(#radialGradient15658);fill-opacity:1;fill-rule:nonzero;stroke:url(#radialGradient15656);stroke-width:0.75;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
rx="0.86178643"
transform="matrix(3.7443727e-4,0.99999993,-0.99999993,3.7443727e-4,0,0)" />
<rect
rx="0.11178643"
ry="0.11178643"
y="-38.601055"
x="12.522186"
height="29.209787"
width="24.581915"
id="rect15660"
style="color:#000000;fill:none;stroke:url(#radialGradient15668);stroke-width:0.75;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:block;overflow:visible"
transform="matrix(3.7443727e-4,0.99999993,-0.99999993,3.7443727e-4,0,0)" />
<text
xml:space="preserve"
style="font-size:6px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
x="17.49218"
y="36.180321"
id="text3797"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3799"
x="17.49218"
y="36.180321">View</tspan></text>
<g
transform="translate(-114,-114)"
id="g3879">
<circle
d="M 262,138 C 262,206.48331 206.48331,262 138,262 69.516691,262 14,206.48331 14,138 14,69.516691 69.516691,14 138,14 c 68.48331,0 124,55.516691 124,124 z"
style="fill:none;stroke:#b30000;stroke-width:28"
transform="matrix(0.17391304,0,0,0.17391304,114,114)"
sodipodi:ry="124"
sodipodi:rx="124"
sodipodi:cy="138"
sodipodi:cx="138"
id="circle3869"
r="124"
cy="138"
cx="138" />
<line
style="stroke:#b30000;stroke-width:3.826087"
id="line3871"
y2="154.17392"
x2="154.17392"
y1="121.82609"
x1="121.82609" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="new"
style="display:inline" />
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -121,6 +121,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
decor->setCommand("TechDraw Decoration");
*decor << "TechDraw_NewHatch";
*decor << "TechDraw_ToggleFrame";
return root;
}
@ -163,6 +164,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
decor->setCommand("TechDraw Decoration");
*decor << "TechDraw_NewHatch";
*decor << "TechDraw_ToggleFrame";
return root;
}