[TD] add dialog for hatches

as discussed in the forum, the hatch feature misses a dialog. So here it is. The code is more or less just the one of the existing GeomHatch dialog
This commit is contained in:
donovaly
2020-06-12 03:04:28 +02:00
committed by WandererFan
parent d9981891c9
commit e889a49bbb
8 changed files with 579 additions and 9 deletions

View File

@@ -37,9 +37,12 @@
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Gui/Application.h>
#include <Gui/Control.h>
#include <Mod/TechDraw/App/DrawHatch.h>
#include <Mod/TechDraw/App/DrawViewPart.h>
#include "TaskHatch.h"
#include "ViewProviderHatch.h"
using namespace TechDrawGui;
@@ -93,6 +96,45 @@ std::vector<std::string> ViewProviderHatch::getDisplayModes(void) const
return StrList;
}
bool ViewProviderHatch::setEdit(int ModNum)
{
Q_UNUSED(ModNum);
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgHatch *projDlg = qobject_cast<TaskDlgHatch *>(dlg);
if (projDlg && (projDlg->getViewProvider() != this))
projDlg = 0; // somebody left task panel open
// clear the selection (convenience)
Gui::Selection().clearSelection();
// start the edit dialog
if (projDlg) {
projDlg->setCreateMode(false);
Gui::Control().showDialog(projDlg);
}
else {
Gui::Control().showDialog(new TaskDlgHatch(getViewObject(), this, false));
}
return true;
}
void ViewProviderHatch::unsetEdit(int ModNum)
{
if (ModNum == ViewProvider::Default) {
Gui::Control().closeDialog();
}
else {
ViewProviderDocumentObject::unsetEdit(ModNum);
}
}
bool ViewProviderHatch::doubleClicked(void)
{
setEdit(0);
return true;
}
void ViewProviderHatch::onChanged(const App::Property* prop)
{
if ((prop == &HatchScale) ||