One step towards the dialog
Problem registering the own ViewProvider
This commit is contained in:
@@ -45,6 +45,11 @@ public:
|
||||
|
||||
short mustExecute() const;
|
||||
|
||||
/// returns the type name of the view provider
|
||||
const char* getViewProviderName(void) const {
|
||||
return "SurfaceGui::ViewProviderBSurf";
|
||||
}
|
||||
|
||||
protected:
|
||||
GeomFill_FillingStyle getFillingStyle();
|
||||
void getWire(TopoDS_Wire& aWire);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <Gui/Application.h>
|
||||
|
||||
#include "Workbench.h"
|
||||
//#include "ViewProviderCut.h"
|
||||
#include "BSurf.h"
|
||||
|
||||
// use a different name to CreateCommand()
|
||||
void CreateSurfaceCommands(void);
|
||||
@@ -55,6 +55,7 @@ void SurfaceGuiExport initSurfaceGui()
|
||||
}
|
||||
|
||||
SurfaceGui::Workbench::init();
|
||||
SurfaceGui::ViewProviderBSurf::init();
|
||||
|
||||
// instanciating the commands
|
||||
CreateSurfaceCommands();
|
||||
|
||||
@@ -41,79 +41,36 @@
|
||||
#include <Base/Sequencer.h>
|
||||
#include <Gui/Control.h>
|
||||
|
||||
|
||||
using namespace SurfaceGui;
|
||||
//#undef CS_FUTURE // multi-threading causes some problems
|
||||
|
||||
namespace SurfaceGui {
|
||||
|
||||
class ViewProviderBSurf : public Gui::ViewProvider
|
||||
bool ViewProviderBSurf::setEdit(int ModNum)
|
||||
{
|
||||
public:
|
||||
ViewProviderBSurf()
|
||||
{
|
||||
/* coords = new SoCoordinate3();
|
||||
coords->ref();
|
||||
planes = new SoLineSet();
|
||||
planes->ref();
|
||||
SoBaseColor* color = new SoBaseColor();
|
||||
color->rgb.setValue(1.0f, 0.447059f, 0.337255f);
|
||||
SoDrawStyle* style = new SoDrawStyle();
|
||||
style->lineWidth.setValue(2.0f);
|
||||
this->pcRoot->addChild(color);
|
||||
this->pcRoot->addChild(style);
|
||||
this->pcRoot->addChild(coords);
|
||||
this->pcRoot->addChild(planes);*/
|
||||
}
|
||||
|
||||
~ViewProviderBSurf()
|
||||
{
|
||||
}
|
||||
|
||||
void updateData(const App::Property*)
|
||||
{
|
||||
}
|
||||
|
||||
const char* getDefaultDisplayMode() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<std::string> getDisplayModes(void) const
|
||||
{
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
virtual bool setEdit(int ModNum)
|
||||
{
|
||||
// When double-clicking on the item for this sketch the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskBSurf* tDlg = qobject_cast<TaskBSurf*>(dlg);
|
||||
// start the edit dialog
|
||||
if(dlg)
|
||||
Gui::Control().showDialog(tDlg);
|
||||
else
|
||||
Gui::Control().showDialog(new TaskBSurf(this));
|
||||
// When double-clicking on the item for this sketch the
|
||||
// object unsets and sets its edit mode without closing
|
||||
// the task panel
|
||||
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
|
||||
TaskBSurf* tDlg = qobject_cast<TaskBSurf*>(dlg);
|
||||
// start the edit dialog
|
||||
if(dlg)
|
||||
Gui::Control().showDialog(tDlg);
|
||||
else
|
||||
Gui::Control().showDialog(new TaskBSurf(this));
|
||||
// draw();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void unsetEdit(int ModNum)
|
||||
{
|
||||
/*if(!Gui::Selection().isSelected(pcObject) || !Visibility.getValue()) {
|
||||
internal_vp.switch_node(false);
|
||||
pcModeSwitch->whichChild = -1;
|
||||
m_selected = false;
|
||||
} */
|
||||
}
|
||||
|
||||
/* void setCoords(const std::vector<Base::Vector3f>& v)
|
||||
{
|
||||
}*/
|
||||
|
||||
private:
|
||||
};
|
||||
void ViewProviderBSurf::unsetEdit(int ModNum)
|
||||
{
|
||||
/*if(!Gui::Selection().isSelected(pcObject) || !Visibility.getValue()) {
|
||||
internal_vp.switch_node(false);
|
||||
pcModeSwitch->whichChild = -1;
|
||||
m_selected = false;
|
||||
} */
|
||||
}
|
||||
|
||||
BSurf::BSurf(ViewProviderBSurf* vp)
|
||||
//: QDialog(parent, fl), bbox(bb)
|
||||
|
||||
@@ -25,17 +25,26 @@
|
||||
#ifndef SURFACE_GUI_BSURF_H
|
||||
#define SURFACE_GUI_BSURF_H
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Base/BoundBox.h>
|
||||
#include <QDialog>
|
||||
#include <QPointer>
|
||||
#include "../FillType.h"
|
||||
#include <Mod/Part/Gui/ViewProvider.h>
|
||||
#include "ui_BSurf.h"
|
||||
|
||||
namespace SurfaceGui
|
||||
{
|
||||
class ViewProviderBSurf;
|
||||
|
||||
class SurfaceGuiExport ViewProviderBSurf : public PartGui::ViewProviderPart
|
||||
{
|
||||
public:
|
||||
virtual bool setEdit(int ModNum);
|
||||
virtual void unsetEdit(int ModNum);
|
||||
};
|
||||
|
||||
class BSurf : public QDialog
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ include_directories(
|
||||
|
||||
set(SurfaceGui_LIBS
|
||||
Surface
|
||||
PartGui
|
||||
FreeCADGui
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user