Leader and RichText block improvements
This commit is contained in:
@@ -48,12 +48,12 @@
|
||||
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawTextLeader.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "TaskTextLeader.h"
|
||||
#include "TaskLeaderLine.h"
|
||||
#include "ViewProviderLeader.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
@@ -92,7 +92,7 @@ bool ViewProviderLeader::setEdit(int ModNum)
|
||||
}
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Control().showDialog(new TaskDlgTextLeader(LINEMODE, this));
|
||||
Gui::Control().showDialog(new TaskDlgLeaderLine(this));
|
||||
return true;
|
||||
} else {
|
||||
return ViewProviderDrawingView::setEdit(ModNum);
|
||||
@@ -134,7 +134,27 @@ void ViewProviderLeader::onChanged(const App::Property* p)
|
||||
}
|
||||
}
|
||||
ViewProviderDrawingView::onChanged(p);
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderLeader::claimChildren(void) const
|
||||
{
|
||||
// Collect any child Document Objects and put them in the right place in the Feature tree
|
||||
// valid children of a ViewLeader are:
|
||||
// - Rich Annotations
|
||||
std::vector<App::DocumentObject*> temp;
|
||||
const std::vector<App::DocumentObject *> &views = getFeature()->getInList();
|
||||
try {
|
||||
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())) {
|
||||
temp.push_back((*it));
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
catch (...) {
|
||||
std::vector<App::DocumentObject*> tmp;
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
TechDraw::DrawLeaderLine* ViewProviderLeader::getViewObject() const
|
||||
@@ -168,109 +188,4 @@ App::Color ViewProviderLeader::getDefLineColor(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderTextLeader, TechDrawGui::ViewProviderLeader)
|
||||
|
||||
ViewProviderTextLeader::ViewProviderTextLeader()
|
||||
{
|
||||
sPixmap = "actions/techdraw-textleader";
|
||||
|
||||
static const char *group = "Text Format";
|
||||
|
||||
ADD_PROPERTY_TYPE(Font ,(getDefFont().c_str()),group,App::Prop_None, "The name of the font to use");
|
||||
ADD_PROPERTY_TYPE(Fontsize,(getDefFontSize()) ,group,(App::PropertyType)(App::Prop_None),
|
||||
"Text size in internal units");
|
||||
ADD_PROPERTY_TYPE(MaxWidth,(-1) ,group,(App::PropertyType)(App::Prop_None),
|
||||
"Maximum width of text in mm");
|
||||
ADD_PROPERTY_TYPE(ShowFrame,(true) ,group,(App::PropertyType)(App::Prop_None),
|
||||
"Draw a box around text or not");
|
||||
}
|
||||
|
||||
ViewProviderTextLeader::~ViewProviderTextLeader()
|
||||
{
|
||||
}
|
||||
|
||||
void ViewProviderTextLeader::attach(App::DocumentObject *pcFeat)
|
||||
{
|
||||
ViewProviderLeader::attach(pcFeat);
|
||||
}
|
||||
|
||||
bool ViewProviderTextLeader::setEdit(int ModNum)
|
||||
{
|
||||
// Base::Console().Message("VPTL::setEdit(%d)\n",ModNum);
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
if (Gui::Control().activeDialog()) { //TaskPanel already open!
|
||||
return false;
|
||||
}
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Control().showDialog(new TaskDlgTextLeader(TEXTMODE, this));
|
||||
return true;
|
||||
} else {
|
||||
return ViewProviderLeader::setEdit(ModNum);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderTextLeader::unsetEdit(int ModNum)
|
||||
{
|
||||
Q_UNUSED(ModNum);
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
else {
|
||||
ViewProviderLeader::unsetEdit(ModNum);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderTextLeader::doubleClicked(void)
|
||||
{
|
||||
// Base::Console().Message("VPTL::doubleClicked()\n");
|
||||
setEdit(ViewProvider::Default);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderTextLeader::updateData(const App::Property* p)
|
||||
{
|
||||
ViewProviderLeader::updateData(p);
|
||||
}
|
||||
|
||||
void ViewProviderTextLeader::onChanged(const App::Property* p)
|
||||
{
|
||||
if ((p == &Font) ||
|
||||
(p == &Fontsize) ||
|
||||
(p == &MaxWidth) ||
|
||||
(p == &ShowFrame)) {
|
||||
QGIView* qgiv = getQView();
|
||||
if (qgiv) {
|
||||
qgiv->updateView(true);
|
||||
}
|
||||
}
|
||||
ViewProviderLeader::onChanged(p);
|
||||
|
||||
}
|
||||
|
||||
TechDraw::DrawTextLeader* ViewProviderTextLeader::getFeature() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawTextLeader*>(pcObject);
|
||||
}
|
||||
|
||||
std::string ViewProviderTextLeader::getDefFont(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Labels");
|
||||
std::string result = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return result;
|
||||
}
|
||||
|
||||
double ViewProviderTextLeader::getDefFontSize(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
double result = hGrp->GetFloat("FontSize", 6.0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user