[TD]harmonize Arrow enums
This commit is contained in:
52
src/Mod/TechDraw/App/ArrowPropEnum.cpp
Normal file
52
src/Mod/TechDraw/App/ArrowPropEnum.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include "ArrowPropEnum.h"
|
||||
|
||||
namespace TechDraw {
|
||||
|
||||
const int ArrowPropEnum::ArrowCount = 8;
|
||||
const char* ArrowPropEnum::ArrowTypeEnums[]= { "NONE",
|
||||
"FILLED_ARROW",
|
||||
"OPEN_ARROW",
|
||||
"TICK",
|
||||
"DOT",
|
||||
"OPEN_CIRCLE",
|
||||
"FORK",
|
||||
"FILLED_TRIANGLE",
|
||||
NULL};
|
||||
|
||||
const std::vector<std::string> ArrowPropEnum::ArrowTypeIcons = { ":icons/arrownone.svg",
|
||||
":icons/arrowfilled.svg",
|
||||
":icons/arrowopen.svg",
|
||||
":icons/arrowtick.svg",
|
||||
":icons/arrowdot.svg",
|
||||
":icons/arrowopendot.svg",
|
||||
":icons/arrowfork.svg",
|
||||
":icons/arrowpyramid.svg"};
|
||||
|
||||
}
|
||||
56
src/Mod/TechDraw/App/ArrowPropEnum.h
Normal file
56
src/Mod/TechDraw/App/ArrowPropEnum.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _ARROWENUMS_H_
|
||||
#define _ARROWENUMS_H_
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
//common definitions for line ends / arrows
|
||||
enum ArrowType { NONE = 0,
|
||||
FILLED_ARROW,
|
||||
OPEN_ARROW,
|
||||
TICK,
|
||||
DOT,
|
||||
OPEN_CIRCLE,
|
||||
FORK,
|
||||
FILLED_TRIANGLE };
|
||||
|
||||
class TechDrawExport ArrowPropEnum {
|
||||
public:
|
||||
|
||||
static const char* ArrowTypeEnums[];
|
||||
static const int ArrowCount;
|
||||
static const std::vector<std::string> ArrowTypeIcons;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
} //end namespace TechDraw
|
||||
#endif
|
||||
@@ -153,6 +153,8 @@ SET(TechDraw_SRCS
|
||||
DrawProjectSplit.h
|
||||
LineGroup.cpp
|
||||
LineGroup.h
|
||||
ArrowPropEnum.cpp
|
||||
ArrowPropEnum.h
|
||||
)
|
||||
|
||||
SET(Geometry_SRCS
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <Mod/TechDraw/App/DrawLeaderLinePy.h> // generated from DrawLeaderLinePy.xml
|
||||
#include "DrawLeaderLine.h"
|
||||
#include "ArrowPropEnum.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
@@ -45,6 +46,26 @@ using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawLeaderLine, TechDraw::DrawView)
|
||||
|
||||
//TODO: share this between DrawViewBalloon, DrawLeaderLine, QGIArrow, Prefs, etc
|
||||
//const char* DrawLeaderLine::ArrowTypeEnums[]= { "NONE",
|
||||
// "FILLED_ARROW",
|
||||
// "OPEN_ARROW",
|
||||
// "TICK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "FILLED_TRIANGLE",
|
||||
// NULL};
|
||||
//const char* DrawLeaderLine::ArrowTypeEnums2[]= { "NONE",
|
||||
// "FILLED_ARROW",
|
||||
// "OPEN_ARROW",
|
||||
// "TICK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "FILLED_TRIANGLE",
|
||||
// NULL};
|
||||
|
||||
DrawLeaderLine::DrawLeaderLine(void)
|
||||
{
|
||||
static const char *group = "Leader";
|
||||
@@ -54,8 +75,19 @@ DrawLeaderLine::DrawLeaderLine(void)
|
||||
LeaderParent.setScope(App::LinkScope::Global);
|
||||
ADD_PROPERTY_TYPE(WayPoints,(Base::Vector3d()) ,group, App::Prop_None,
|
||||
"Intermediate points for Leader line");
|
||||
ADD_PROPERTY_TYPE(StartSymbol, (-1), group, App::Prop_None, "Symbol (arrowhead) for start of line");
|
||||
ADD_PROPERTY_TYPE(EndSymbol, (-1), group, App::Prop_None, "Symbol (arrowhead) for end of line");
|
||||
|
||||
// EndType.setEnums(ArrowTypeEnums);
|
||||
// ADD_PROPERTY(EndType,(prefEnd()));
|
||||
|
||||
StartSymbol.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY(StartSymbol,(1l)); //filled arrow
|
||||
|
||||
// ADD_PROPERTY_TYPE(StartSymbol, (0), group, App::Prop_None, "Symbol (arrowhead) for start of line");
|
||||
EndSymbol.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY(EndSymbol,(0l)); //no symbol
|
||||
// ADD_PROPERTY_TYPE(EndSymbol, (0), group, App::Prop_None, "Symbol (arrowhead) for end of line");
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Scalable ,(false),group,App::Prop_None,"Scale line with LeaderParent");
|
||||
ADD_PROPERTY_TYPE(AutoHorizontal ,(getDefAuto()),group,App::Prop_None,"Forces last line segment to be horizontal");
|
||||
|
||||
|
||||
@@ -44,8 +44,12 @@ public:
|
||||
|
||||
App::PropertyLink LeaderParent;
|
||||
App::PropertyVectorList WayPoints;
|
||||
App::PropertyInteger StartSymbol; //see Gui/QGIArrow for values
|
||||
App::PropertyInteger EndSymbol;
|
||||
App::PropertyEnumeration StartSymbol;
|
||||
App::PropertyEnumeration EndSymbol;
|
||||
|
||||
/* App::PropertyInteger StartSymbol; //see Gui/QGIArrow for values*/
|
||||
/* App::PropertyInteger EndSymbol;*/
|
||||
|
||||
App::PropertyBool Scalable;
|
||||
App::PropertyBool AutoHorizontal;
|
||||
|
||||
@@ -71,11 +75,15 @@ public:
|
||||
Base::Vector3d getKinkPoint(void) const;
|
||||
Base::Vector3d getTailPoint(void) const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop) override;
|
||||
|
||||
private:
|
||||
/* static const char* ArrowTypeEnums[];*/
|
||||
/* static const int ArrowCount;*/
|
||||
/* static const std::vector<std::string> ArrowTypeIcons;*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawLeaderLine> DrawLeaderLinePython;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "DrawUtil.h"
|
||||
#include "LineGroup.h"
|
||||
#include "ArrowPropEnum.h"
|
||||
|
||||
|
||||
//#include <Mod/TechDraw/App/DrawViewBalloonPy.h> // generated from DrawViewBalloonPy.xml
|
||||
@@ -74,31 +75,30 @@ using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewBalloon, TechDraw::DrawView)
|
||||
|
||||
//from Gui/QGIArrow.h
|
||||
//enum ArrowType {
|
||||
// FILLED_TRIANGLE = 0,
|
||||
// OPEN_ARROW,
|
||||
// HASH_MARK,
|
||||
// DOT,
|
||||
// OPEN_CIRCLE,
|
||||
// FORK,
|
||||
// PYRAMID
|
||||
// };
|
||||
//const char* DrawViewBalloon::ArrowTypeEnums[]= { "NONE",
|
||||
// "FILLED_ARROW",
|
||||
// "OPEN_ARROW",
|
||||
// "TICK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "FILLED_TRIANGLE",
|
||||
// NULL};
|
||||
|
||||
const char* DrawViewBalloon::endTypeEnums[]= { "FILLED_TRIANGLE",
|
||||
"OPEN_ARROW",
|
||||
"HASH_MARK",
|
||||
"DOT",
|
||||
"OPEN_CIRCLE",
|
||||
"FORK",
|
||||
"PYRAMID",
|
||||
"NONE",
|
||||
NULL};
|
||||
|
||||
//const char* DrawViewBalloon::endTypeEnums[]= {"Arrow",
|
||||
// "Dot",
|
||||
//const char* DrawViewBalloon::endTypeEnums[]= { "FILLED_TRIANGLE",
|
||||
// "OPEN_ARROW",
|
||||
// "HASH_MARK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "PYRAMID",
|
||||
// "NONE",
|
||||
// NULL};
|
||||
|
||||
////const char* DrawViewBalloon::endTypeEnums[]= {"Arrow",
|
||||
//// "Dot",
|
||||
//// NULL};
|
||||
|
||||
const char* DrawViewBalloon::balloonTypeEnums[]= {"Circular",
|
||||
"None",
|
||||
"Triangle",
|
||||
@@ -116,7 +116,8 @@ DrawViewBalloon::DrawViewBalloon(void)
|
||||
ADD_PROPERTY_TYPE(OriginY,(0),"",(App::PropertyType)(App::Prop_None),"Balloon origin y");
|
||||
ADD_PROPERTY_TYPE(OriginIsSet, (false), "",(App::PropertyType)(App::Prop_None),"Balloon origin is set");
|
||||
|
||||
EndType.setEnums(endTypeEnums);
|
||||
// EndType.setEnums(endTypeEnums);
|
||||
EndType.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY(EndType,(prefEnd()));
|
||||
|
||||
Symbol.setEnums(balloonTypeEnums);
|
||||
|
||||
@@ -76,7 +76,8 @@ public:
|
||||
}
|
||||
|
||||
static const char* balloonTypeEnums[];
|
||||
static const char* endTypeEnums[];
|
||||
/* static const char* endTypeEnums[];*/
|
||||
static const char* ArrowTypeEnums[];
|
||||
|
||||
void handleXYLock(void) override;
|
||||
|
||||
@@ -97,6 +98,11 @@ protected:
|
||||
const char *PropName) override;
|
||||
|
||||
private:
|
||||
/* static const char* ArrowTypeEnums[];*/
|
||||
/* static const int ArrowCount;*/
|
||||
/* static const std::vector<std::string> ArrowTypeIcons;*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
} //namespace TechDraw
|
||||
|
||||
Reference in New Issue
Block a user