Gui: split out TreeParams into its own source files
Auto generated using TreeParams.py
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include <Gui/ViewProviderDocumentObject.h>
|
||||
|
||||
#include "ActiveObjectList.h"
|
||||
#include "Tree.h"
|
||||
#include "TreeParams.h"
|
||||
|
||||
|
||||
FC_LOG_LEVEL_INIT("MDIView", true, true)
|
||||
@@ -66,7 +66,7 @@ void ActiveObjectList::setHighlight(const ObjectInfo &info, HighlightMode mode,
|
||||
if (!vp)
|
||||
return;
|
||||
|
||||
if (TreeParams::Instance()->TreeActiveAutoExpand()) {
|
||||
if (TreeParams::getTreeActiveAutoExpand()) {
|
||||
vp->getDocument()->signalExpandObject(*vp, enable ? TreeItemMode::ExpandPath : TreeItemMode::CollapseItem,
|
||||
info.obj, info.subname.c_str());
|
||||
}
|
||||
|
||||
@@ -1043,6 +1043,19 @@ SET(Widget_SRCS
|
||||
)
|
||||
SOURCE_GROUP("Widget" FILES ${Widget_SRCS})
|
||||
|
||||
SET(Params_CPP_SRCS
|
||||
TreeParams.cpp
|
||||
)
|
||||
|
||||
SET(Params_HPP_SRCS
|
||||
TreeParams.h
|
||||
)
|
||||
|
||||
SET(Params_SRCS
|
||||
${Params_CPP_SRCS}
|
||||
${Params_HPP_SRCS}
|
||||
)
|
||||
SOURCE_GROUP("Params" FILES ${Params_SRCS})
|
||||
# The view sources
|
||||
SET(View_CPP_SRCS
|
||||
MDIView.cpp
|
||||
@@ -1194,6 +1207,7 @@ SET(FreeCADGui_SRCS
|
||||
${View3D_SRCS}
|
||||
${Viewprovider_SRCS}
|
||||
${Widget_SRCS}
|
||||
${Params_SRCS}
|
||||
${View_SRCS}
|
||||
${Workbench_SRCS}
|
||||
${Selection_SRCS}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
#include "TextureMapping.h"
|
||||
#include "Tools.h"
|
||||
#include "Tree.h"
|
||||
#include "TreeParams.h"
|
||||
#include "Utilities.h"
|
||||
#include "View3DInventor.h"
|
||||
#include "View3DInventorViewer.h"
|
||||
@@ -3376,7 +3377,7 @@ bool StdCmdSelForward::isActive()
|
||||
#define TREEVIEW_DOC_CMD_DEF(_name,_v) \
|
||||
DEF_STD_CMD_AC(StdTree##_name) \
|
||||
void StdTree##_name::activated(int){ \
|
||||
TreeParams::Instance()->setDocumentMode(_v);\
|
||||
TreeParams::setDocumentMode(_v);\
|
||||
if(_pcAction) _pcAction->setChecked(true,true);\
|
||||
}\
|
||||
Action * StdTree##_name::createAction(void) {\
|
||||
@@ -3388,7 +3389,7 @@ Action * StdTree##_name::createAction(void) {\
|
||||
return pcAction;\
|
||||
}\
|
||||
bool StdTree##_name::isActive() {\
|
||||
bool checked = TreeParams::Instance()->DocumentMode()==_v;\
|
||||
bool checked = TreeParams::getDocumentMode()==_v;\
|
||||
if(_pcAction && _pcAction->isChecked()!=checked)\
|
||||
_pcAction->setChecked(checked,true);\
|
||||
return true;\
|
||||
@@ -3448,8 +3449,8 @@ StdTreeCollapseDocument::StdTreeCollapseDocument()
|
||||
#define TREEVIEW_CMD_DEF(_name) \
|
||||
DEF_STD_CMD_AC(StdTree##_name) \
|
||||
void StdTree##_name::activated(int){ \
|
||||
auto checked = !TreeParams::Instance()->_name();\
|
||||
TreeParams::Instance()->set##_name(checked);\
|
||||
auto checked = !TreeParams::get##_name();\
|
||||
TreeParams::set##_name(checked);\
|
||||
if(_pcAction) _pcAction->setChecked(checked,true);\
|
||||
}\
|
||||
Action * StdTree##_name::createAction(void) {\
|
||||
@@ -3461,7 +3462,7 @@ Action * StdTree##_name::createAction(void) {\
|
||||
return pcAction;\
|
||||
}\
|
||||
bool StdTree##_name::isActive() {\
|
||||
bool checked = TreeParams::Instance()->_name();\
|
||||
bool checked = TreeParams::get##_name();\
|
||||
if(_pcAction && _pcAction->isChecked()!=checked)\
|
||||
_pcAction->setChecked(checked,true);\
|
||||
return true;\
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "PropertyView.h"
|
||||
#include "Selection.h"
|
||||
#include "Tree.h"
|
||||
#include "TreeParams.h"
|
||||
#include "View3DInventor.h"
|
||||
#include "ViewProviderDocumentObject.h"
|
||||
|
||||
@@ -449,7 +450,7 @@ void DlgPropertyLink::showEvent(QShowEvent *ev) {
|
||||
}
|
||||
|
||||
void DlgPropertyLink::onItemEntered(QTreeWidgetItem *) {
|
||||
int timeout = Gui::TreeParams::Instance()->PreSelectionDelay()/2;
|
||||
int timeout = Gui::TreeParams::getPreSelectionDelay()/2;
|
||||
if(timeout < 0)
|
||||
timeout = 1;
|
||||
timer->start(timeout);
|
||||
@@ -509,7 +510,7 @@ void DlgPropertyLink::onItemSelectionChanged()
|
||||
|
||||
bool focus = false;
|
||||
// Do auto view switch if tree view does not do it
|
||||
if(!TreeParams::Instance()->SyncView()) {
|
||||
if(!TreeParams::getSyncView()) {
|
||||
focus = ui->treeWidget->hasFocus();
|
||||
auto doc = Gui::Application::Instance->getDocument(sobjs.front().getDocumentName().c_str());
|
||||
if(doc) {
|
||||
|
||||
179
src/Gui/Tree.cpp
179
src/Gui/Tree.cpp
@@ -58,6 +58,7 @@
|
||||
#include "Macro.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MenuManager.h"
|
||||
#include "TreeParams.h"
|
||||
#include "View3DInventor.h"
|
||||
#include "ViewProviderDocumentObject.h"
|
||||
#include "Widgets.h"
|
||||
@@ -81,80 +82,28 @@ namespace bp = boost::placeholders;
|
||||
|
||||
std::unique_ptr<QPixmap> TreeWidget::documentPixmap;
|
||||
std::unique_ptr<QPixmap> TreeWidget::documentPartialPixmap;
|
||||
static QBrush _TreeItemBackground;
|
||||
std::set<TreeWidget*> TreeWidget::Instances;
|
||||
static TreeWidget* _LastSelectedTreeWidget;
|
||||
const int TreeWidget::DocumentType = 1000;
|
||||
const int TreeWidget::ObjectType = 1001;
|
||||
bool _DragEventFilter;
|
||||
static bool _DragEventFilter;
|
||||
static bool _DraggingActive;
|
||||
|
||||
TreeParams::TreeParams() {
|
||||
handle = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView");
|
||||
handle->Attach(this);
|
||||
|
||||
|
||||
#undef FC_TREEPARAM_DEF
|
||||
#define FC_TREEPARAM_DEF(_name,_type,_Type,_default) \
|
||||
_##_name = handle->Get##_Type(#_name,_default);
|
||||
|
||||
FC_TREEPARAM_DEFS
|
||||
}
|
||||
|
||||
|
||||
#undef FC_TREEPARAM_DEF
|
||||
#define FC_TREEPARAM_DEF(_name,_type,_Type,_default) \
|
||||
void TreeParams::set##_name(_type value) {\
|
||||
if(_##_name != value) {\
|
||||
handle->Set##_Type(#_name,value);\
|
||||
}\
|
||||
}
|
||||
|
||||
FC_TREEPARAM_DEFS
|
||||
|
||||
void TreeParams::OnChange(Base::Subject<const char*>&, const char* sReason) {
|
||||
|
||||
#undef FC_TREEPARAM_DEF
|
||||
#define FC_TREEPARAM_DEF(_name,_type,_Type,_default) \
|
||||
if(strcmp(sReason,#_name)==0) {\
|
||||
_##_name = handle->Get##_Type(#_name,_default);\
|
||||
return;\
|
||||
}
|
||||
|
||||
#undef FC_TREEPARAM_DEF2
|
||||
#define FC_TREEPARAM_DEF2(_name,_type,_Type,_default) \
|
||||
if(strcmp(sReason,#_name)==0) {\
|
||||
_##_name = handle->Get##_Type(#_name,_default);\
|
||||
on##_name##Changed();\
|
||||
return;\
|
||||
}
|
||||
|
||||
FC_TREEPARAM_DEFS
|
||||
}
|
||||
|
||||
void TreeParams::onSyncSelectionChanged() {
|
||||
if (!TreeParams::Instance()->SyncSelection() || !Gui::Selection().hasSelection())
|
||||
return;
|
||||
TreeWidget::scrollItemToTop();
|
||||
}
|
||||
|
||||
void TreeParams::onCheckBoxesSelectionChanged()
|
||||
void TreeParams::onItemBackgroundChanged()
|
||||
{
|
||||
TreeWidget::instance()->synchronizeSelectionCheckBoxes();
|
||||
}
|
||||
|
||||
void TreeParams::onDocumentModeChanged() {
|
||||
App::GetApplication().setActiveDocument(App::GetApplication().getActiveDocument());
|
||||
}
|
||||
|
||||
TreeParams* TreeParams::Instance() {
|
||||
static TreeParams* instance;
|
||||
if (!instance)
|
||||
instance = new TreeParams;
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool TreeParams::getTreeViewStretchDescription() const
|
||||
{
|
||||
return handle->GetBool("TreeViewStretchDescription", false);
|
||||
if (getItemBackground()) {
|
||||
App::Color color;
|
||||
color.setPackedValue(getItemBackground());
|
||||
QColor col;
|
||||
col.setRedF(color.r);
|
||||
col.setGreenF(color.g);
|
||||
col.setBlueF(color.b);
|
||||
col.setAlphaF(color.a);
|
||||
_TreeItemBackground = QBrush(col);
|
||||
} else
|
||||
_TreeItemBackground = QBrush();
|
||||
refreshTreeViews();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -528,9 +477,14 @@ TreeWidget::TreeWidget(const char* name, QWidget* parent)
|
||||
connectChangedViewObj = Application::Instance->signalChangedObject.connect(
|
||||
boost::bind(&TreeWidget::slotChangedViewObject, this, bp::_1, bp::_2));
|
||||
|
||||
// make sure to show a horizontal scrollbar if needed
|
||||
this->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
this->header()->setStretchLastSection(TreeParams::Instance()->getTreeViewStretchDescription());
|
||||
setupResizableColumn(this);
|
||||
this->header()->setStretchLastSection(false);
|
||||
QObject::connect(this->header(), &QHeaderView::sectionResized, [this](int idx, int, int newSize) {
|
||||
if (idx)
|
||||
TreeParams::setColumnSize2(newSize);
|
||||
else
|
||||
TreeParams::setColumnSize1(newSize);
|
||||
});
|
||||
|
||||
// Add the first main label
|
||||
this->rootItem = new QTreeWidgetItem(this);
|
||||
@@ -574,6 +528,7 @@ TreeWidget::TreeWidget(const char* name, QWidget* parent)
|
||||
QIcon icon(*documentPixmap);
|
||||
documentPartialPixmap.reset(new QPixmap(icon.pixmap(documentPixmap->size(), QIcon::Disabled)));
|
||||
}
|
||||
setColumnHidden(1, TreeParams::getHideColumn());
|
||||
}
|
||||
|
||||
TreeWidget::~TreeWidget()
|
||||
@@ -603,7 +558,7 @@ void TreeWidget::selectAll() {
|
||||
auto itDoc = DocumentMap.find(gdoc);
|
||||
if (itDoc == DocumentMap.end())
|
||||
return;
|
||||
if (TreeParams::Instance()->RecordSelection())
|
||||
if (TreeParams::getRecordSelection())
|
||||
Gui::Selection().selStackPush();
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().setSelection(gdoc->getDocument()->getName(), gdoc->getDocument()->getObjects());
|
||||
@@ -814,7 +769,7 @@ void TreeWidget::_updateStatus(bool delay) {
|
||||
onUpdateStatus();
|
||||
return;
|
||||
}
|
||||
int timeout = TreeParams::Instance()->StatusTimeout();
|
||||
int timeout = TreeParams::getStatusTimeout();
|
||||
if (timeout < 0)
|
||||
timeout = 1;
|
||||
statusTimer->start(timeout);
|
||||
@@ -1205,6 +1160,24 @@ TreeWidget* TreeWidget::instance() {
|
||||
return res;
|
||||
}
|
||||
|
||||
void TreeWidget::setupResizableColumn(TreeWidget *tree) {
|
||||
auto mode = TreeParams::getResizableColumn()?
|
||||
QHeaderView::Interactive : QHeaderView::ResizeToContents;
|
||||
for(auto inst : Instances) {
|
||||
if(!tree || tree==inst) {
|
||||
inst->header()->setSectionResizeMode(0, mode);
|
||||
inst->header()->setSectionResizeMode(1, mode);
|
||||
if (TreeParams::getResizableColumn()) {
|
||||
QSignalBlocker blocker(inst);
|
||||
if (TreeParams::getColumnSize1() > 0)
|
||||
inst->header()->resizeSection(0, TreeParams::getColumnSize1());
|
||||
if (TreeParams::getColumnSize2() > 0)
|
||||
inst->header()->resizeSection(1, TreeParams::getColumnSize2());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<TreeWidget::SelInfo> TreeWidget::getSelection(App::Document* doc)
|
||||
{
|
||||
std::vector<SelInfo> ret;
|
||||
@@ -1742,7 +1715,7 @@ void TreeWidget::dropEvent(QDropEvent* event)
|
||||
targetParent->getNameInDocument());
|
||||
}
|
||||
|
||||
bool syncPlacement = TreeParams::Instance()->SyncPlacement() && targetItemObj->isGroup();
|
||||
bool syncPlacement = TreeParams::getSyncPlacement() && targetItemObj->isGroup();
|
||||
|
||||
bool setSelection = true;
|
||||
std::vector<std::pair<App::DocumentObject*, std::string> > droppedObjects;
|
||||
@@ -2064,7 +2037,7 @@ void TreeWidget::dropEvent(QDropEvent* event)
|
||||
|
||||
std::vector<ItemInfo2> infos;
|
||||
infos.reserve(items.size());
|
||||
bool syncPlacement = TreeParams::Instance()->SyncPlacement();
|
||||
bool syncPlacement = TreeParams::getSyncPlacement();
|
||||
|
||||
// check if items can be dragged
|
||||
for (auto& v : items) {
|
||||
@@ -2255,10 +2228,10 @@ void TreeWidget::dropEvent(QDropEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
if (touched && TreeParams::Instance()->RecomputeOnDrop())
|
||||
if (touched && TreeParams::getRecomputeOnDrop())
|
||||
thisDoc->recompute();
|
||||
|
||||
if (touched && TreeParams::Instance()->SyncView()) {
|
||||
if (touched && TreeParams::getSyncView()) {
|
||||
auto gdoc = Application::Instance->getDocument(thisDoc);
|
||||
if (gdoc)
|
||||
gdoc->setActiveView();
|
||||
@@ -2388,7 +2361,7 @@ void TreeWidget::slotActiveDocument(const Gui::Document& Doc)
|
||||
auto jt = DocumentMap.find(&Doc);
|
||||
if (jt == DocumentMap.end())
|
||||
return; // signal is emitted before the item gets created
|
||||
int displayMode = TreeParams::Instance()->DocumentMode();
|
||||
int displayMode = TreeParams::getDocumentMode();
|
||||
for (auto it = DocumentMap.begin();
|
||||
it != DocumentMap.end(); ++it)
|
||||
{
|
||||
@@ -2625,14 +2598,14 @@ void TreeWidget::onItemEntered(QTreeWidgetItem* item)
|
||||
auto objItem = static_cast<DocumentObjectItem*>(item);
|
||||
objItem->displayStatusInfo();
|
||||
|
||||
if (TreeParams::Instance()->PreSelection()) {
|
||||
int timeout = TreeParams::Instance()->PreSelectionDelay();
|
||||
if (TreeParams::getPreSelection()) {
|
||||
int timeout = TreeParams::getPreSelectionDelay();
|
||||
if (timeout < 0)
|
||||
timeout = 1;
|
||||
if (preselectTime.elapsed() < timeout)
|
||||
onPreSelectTimer();
|
||||
else {
|
||||
timeout = TreeParams::Instance()->PreSelectionTimeout();
|
||||
timeout = TreeParams::getPreSelectionTimeout();
|
||||
if (timeout < 0)
|
||||
timeout = 1;
|
||||
preselectTimer->start(timeout);
|
||||
@@ -2640,19 +2613,19 @@ void TreeWidget::onItemEntered(QTreeWidgetItem* item)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TreeParams::Instance()->PreSelection())
|
||||
else if (TreeParams::getPreSelection())
|
||||
Selection().rmvPreselect();
|
||||
}
|
||||
|
||||
void TreeWidget::leaveEvent(QEvent*) {
|
||||
if (!updateBlocked && TreeParams::Instance()->PreSelection()) {
|
||||
if (!updateBlocked && TreeParams::getPreSelection()) {
|
||||
preselectTimer->stop();
|
||||
Selection().rmvPreselect();
|
||||
}
|
||||
}
|
||||
|
||||
void TreeWidget::onPreSelectTimer() {
|
||||
if (!TreeParams::Instance()->PreSelection())
|
||||
if (!TreeParams::getPreSelection())
|
||||
return;
|
||||
auto item = itemAt(viewport()->mapFromGlobal(QCursor::pos()));
|
||||
if (!item || item->type() != TreeWidget::ObjectType)
|
||||
@@ -2810,7 +2783,7 @@ void TreeWidget::setupText()
|
||||
|
||||
void TreeWidget::syncView(ViewProviderDocumentObject* vp)
|
||||
{
|
||||
if (currentDocItem && TreeParams::Instance()->SyncView()) {
|
||||
if (currentDocItem && TreeParams::getSyncView()) {
|
||||
bool focus = hasFocus();
|
||||
currentDocItem->document()->setActiveView(vp);
|
||||
if (focus)
|
||||
@@ -2883,7 +2856,7 @@ void TreeWidget::onItemSelectionChanged()
|
||||
}
|
||||
|
||||
if (selItems.size() <= 1) {
|
||||
if (TreeParams::Instance()->RecordSelection())
|
||||
if (TreeParams::getRecordSelection())
|
||||
Gui::Selection().selStackPush();
|
||||
|
||||
// This special handling to deal with possible discrepancy of
|
||||
@@ -2896,7 +2869,7 @@ void TreeWidget::onItemSelectionChanged()
|
||||
item = static_cast<DocumentObjectItem*>(selItems.front());
|
||||
else if (selItems.front()->type() == DocumentType) {
|
||||
auto ditem = static_cast<DocumentItem*>(selItems.front());
|
||||
if (TreeParams::Instance()->SyncView()) {
|
||||
if (TreeParams::getSyncView()) {
|
||||
bool focus = hasFocus();
|
||||
ditem->document()->setActiveView();
|
||||
if (focus)
|
||||
@@ -2911,7 +2884,7 @@ void TreeWidget::onItemSelectionChanged()
|
||||
v.second->clearSelection(item);
|
||||
currentDocItem = nullptr;
|
||||
}
|
||||
if (TreeParams::Instance()->RecordSelection())
|
||||
if (TreeParams::getRecordSelection())
|
||||
Gui::Selection().selStackPush();
|
||||
}
|
||||
else {
|
||||
@@ -2920,7 +2893,7 @@ void TreeWidget::onItemSelectionChanged()
|
||||
pos->second->updateSelection(pos->second);
|
||||
currentDocItem = nullptr;
|
||||
}
|
||||
if (TreeParams::Instance()->RecordSelection())
|
||||
if (TreeParams::getRecordSelection())
|
||||
Gui::Selection().selStackPush(true, true);
|
||||
}
|
||||
|
||||
@@ -2928,20 +2901,24 @@ void TreeWidget::onItemSelectionChanged()
|
||||
}
|
||||
|
||||
static bool isSelectionCheckBoxesEnabled() {
|
||||
return TreeParams::Instance()->CheckBoxesSelection();
|
||||
return TreeParams::getCheckBoxesSelection();
|
||||
}
|
||||
|
||||
void TreeWidget::synchronizeSelectionCheckBoxes() {
|
||||
const bool useCheckBoxes = isSelectionCheckBoxesEnabled();
|
||||
for (QTreeWidgetItemIterator it(this); *it; ++it) {
|
||||
if (const auto item = dynamic_cast<DocumentObjectItem*>(*it)) {
|
||||
if (useCheckBoxes)
|
||||
item->QTreeWidgetItem::setCheckState(0, item->isSelected() ? Qt::Checked : Qt::Unchecked);
|
||||
else
|
||||
item->setData(0, Qt::CheckStateRole, QVariant());
|
||||
for (auto tree : TreeWidget::Instances) {
|
||||
QSignalBlocker blocker(tree);
|
||||
for (QTreeWidgetItemIterator it(tree); *it; ++it) {
|
||||
auto item = *it;
|
||||
if (item->type() == ObjectType) {
|
||||
if (useCheckBoxes)
|
||||
item->setCheckState(0, item->isSelected() ? Qt::Checked : Qt::Unchecked);
|
||||
else
|
||||
item->setData(0, Qt::CheckStateRole, QVariant());
|
||||
}
|
||||
}
|
||||
tree->resizeColumnToContents(0);
|
||||
}
|
||||
resizeColumnToContents(0);
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem*> TreeWidget::childrenOfItem(const QTreeWidgetItem& item) const {
|
||||
@@ -2971,7 +2948,7 @@ void TreeWidget::onSelectTimer() {
|
||||
|
||||
_updateStatus(false);
|
||||
|
||||
bool syncSelect = TreeParams::Instance()->SyncSelection();
|
||||
bool syncSelect = TreeParams::getSyncSelection();
|
||||
bool locked = this->blockSelection(true);
|
||||
if (Selection().hasSelection()) {
|
||||
for (auto& v : DocumentMap) {
|
||||
@@ -2998,7 +2975,7 @@ void TreeWidget::onSelectionChanged(const SelectionChanges& msg)
|
||||
case SelectionChanges::RmvSelection:
|
||||
case SelectionChanges::SetSelection:
|
||||
case SelectionChanges::ClrSelection: {
|
||||
int timeout = TreeParams::Instance()->SelectionTimeout();
|
||||
int timeout = TreeParams::getSelectionTimeout();
|
||||
if (timeout <= 0)
|
||||
timeout = 1;
|
||||
selectTimer->start(timeout);
|
||||
@@ -3017,7 +2994,7 @@ TreePanel::TreePanel(const char* name, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
this->treeWidget = new TreeWidget(name, this);
|
||||
int indent = TreeParams::Instance()->Indentation();
|
||||
int indent = TreeParams::getIndentation();
|
||||
if (indent)
|
||||
this->treeWidget->setIndentation(indent);
|
||||
|
||||
@@ -3616,7 +3593,7 @@ void DocumentItem::populateItem(DocumentObjectItem* item, bool refresh, bool del
|
||||
}
|
||||
|
||||
int DocumentItem::findRootIndex(App::DocumentObject* childObj) {
|
||||
if (!TreeParams::Instance()->KeepRootOrder() || !childObj || !childObj->getNameInDocument())
|
||||
if (!TreeParams::getKeepRootOrder() || !childObj || !childObj->getNameInDocument())
|
||||
return -1;
|
||||
|
||||
// object id is monotonically increasing, so use this as a hint to insert
|
||||
|
||||
@@ -41,6 +41,7 @@ class QLineEdit;
|
||||
|
||||
namespace Gui {
|
||||
|
||||
class TreeParams;
|
||||
class ViewProviderDocumentObject;
|
||||
class DocumentObjectItem;
|
||||
class DocumentObjectData;
|
||||
@@ -59,6 +60,7 @@ public:
|
||||
explicit TreeWidget(const char *name, QWidget* parent=nullptr);
|
||||
~TreeWidget() override;
|
||||
|
||||
static void setupResizableColumn(TreeWidget *tree=0);
|
||||
static void scrollItemToTop();
|
||||
void selectAllInstances(const ViewProviderDocumentObject &vpd);
|
||||
void selectLinkedObject(App::DocumentObject *linked);
|
||||
@@ -109,7 +111,7 @@ public:
|
||||
void startItemSearch(QLineEdit*);
|
||||
void itemSearch(const QString &text, bool select);
|
||||
|
||||
void synchronizeSelectionCheckBoxes();
|
||||
static void synchronizeSelectionCheckBoxes();
|
||||
|
||||
QList<QTreeWidgetItem *> childrenOfItem(const QTreeWidgetItem &item) const;
|
||||
|
||||
@@ -238,6 +240,7 @@ private:
|
||||
|
||||
friend class DocumentItem;
|
||||
friend class DocumentObjectItem;
|
||||
friend class TreeParams;
|
||||
|
||||
using Connection = boost::signals2::connection;
|
||||
Connection connectNewDocument;
|
||||
@@ -487,73 +490,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/** Helper class to read/write tree view options
|
||||
*
|
||||
* The parameters are stored under group "User parameter:BaseApp/Preferences/TreeView".
|
||||
* Call TreeParams::Instance()->ParamName/setParamName() to get/set parameter.
|
||||
* To add a new parameter, add a new line under FC_TREEPARAM_DEFS using macro
|
||||
*
|
||||
* @code
|
||||
* FC_TREEPARAM_DEF(parameter_name, c_type, parameter_type, default_value)
|
||||
* @endcode
|
||||
*
|
||||
* If there is special handling on parameter change, use FC_TREEPARAM_DEF2()
|
||||
* instead, and add a function with the following signature in Tree.cpp,
|
||||
*
|
||||
* @code
|
||||
* void TreeParams:on<ParamName>Changed()
|
||||
* @endcode
|
||||
*/
|
||||
class GuiExport TreeParams : public ParameterGrp::ObserverType {
|
||||
public:
|
||||
TreeParams();
|
||||
void OnChange(Base::Subject<const char*> &, const char* sReason) override;
|
||||
static TreeParams *Instance();
|
||||
bool getTreeViewStretchDescription() const;
|
||||
|
||||
#define FC_TREEPARAM_DEFS \
|
||||
FC_TREEPARAM_DEF2(SyncSelection,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF2(CheckBoxesSelection,bool,Bool,false) \
|
||||
FC_TREEPARAM_DEF(SyncView,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF(PreSelection,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF(SyncPlacement,bool,Bool,false) \
|
||||
FC_TREEPARAM_DEF(RecordSelection,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF2(DocumentMode,int,Int,2) \
|
||||
FC_TREEPARAM_DEF(StatusTimeout,int,Int,100) \
|
||||
FC_TREEPARAM_DEF(SelectionTimeout,int,Int,100) \
|
||||
FC_TREEPARAM_DEF(PreSelectionTimeout,int,Int,500) \
|
||||
FC_TREEPARAM_DEF(PreSelectionDelay,int,Int,700) \
|
||||
FC_TREEPARAM_DEF(RecomputeOnDrop,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF(KeepRootOrder,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF(TreeActiveAutoExpand,bool,Bool,true) \
|
||||
FC_TREEPARAM_DEF(Indentation,int,Int,0) \
|
||||
|
||||
#undef FC_TREEPARAM_DEF
|
||||
#define FC_TREEPARAM_DEF(_name,_type,_Type,_default) \
|
||||
_type _name() const {return _##_name;} \
|
||||
void set##_name(_type);\
|
||||
|
||||
#undef FC_TREEPARAM_DEF2
|
||||
#define FC_TREEPARAM_DEF2(_name,_type,_Type,_default) \
|
||||
FC_TREEPARAM_DEF(_name,_type,_Type,_default) \
|
||||
void on##_name##Changed();\
|
||||
|
||||
FC_TREEPARAM_DEFS
|
||||
|
||||
private:
|
||||
|
||||
#undef FC_TREEPARAM_DEF
|
||||
#define FC_TREEPARAM_DEF(_name,_type,_Type,_default) \
|
||||
_type _##_name;
|
||||
|
||||
#undef FC_TREEPARAM_DEF2
|
||||
#define FC_TREEPARAM_DEF2 FC_TREEPARAM_DEF
|
||||
|
||||
FC_TREEPARAM_DEFS
|
||||
|
||||
ParameterGrp::handle handle;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // GUI_TREE_H
|
||||
|
||||
1485
src/Gui/TreeParams.cpp
Normal file
1485
src/Gui/TreeParams.cpp
Normal file
File diff suppressed because it is too large
Load Diff
473
src/Gui/TreeParams.h
Normal file
473
src/Gui/TreeParams.h
Normal file
@@ -0,0 +1,473 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2020 Zheng Lei (realthunder) <realthunder.dev@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 GUI_TREE_PARAMS_H
|
||||
#define GUI_TREE_PARAMS_H
|
||||
|
||||
/*[[[cog
|
||||
import TreeParams
|
||||
TreeParams.declare_begin()
|
||||
]]]*/
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:72)
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:78)
|
||||
namespace Gui {
|
||||
/** Convenient class to obtain tree view related parameters
|
||||
|
||||
* The parameters are under group "User parameter:BaseApp/Preferences/TreeView"
|
||||
*
|
||||
* This class is auto generated by Gui/TreeParams.py. Modify that file
|
||||
* instead of this one, if you want to add any parameter. You need
|
||||
* to install Cog Python package for code generation:
|
||||
* @code
|
||||
* pip install cogapp
|
||||
* @endcode
|
||||
*
|
||||
* Once modified, you can regenerate the header and the source file,
|
||||
* @code
|
||||
* python3 -m cogapp -r Gui/TreeParams.h Tree.cpp
|
||||
* @endcode
|
||||
*
|
||||
* You can add a new parameter by adding lines in Gui/TreeParams.py. Available
|
||||
* parameter types are 'Int, UInt, String, Bool, Float'. For example, to add
|
||||
* a new Int type parameter,
|
||||
* @code
|
||||
* ParamInt(parameter_name, default_value, documentation, on_change=False)
|
||||
* @endcode
|
||||
*
|
||||
* If there is special handling on parameter change, pass in on_change=True.
|
||||
* And you need to provide a function implementation in Tree.cpp with
|
||||
* the following signature.
|
||||
* @code
|
||||
* void TreeParams:on<parameter_name>Changed()
|
||||
* @endcode
|
||||
*/
|
||||
class GuiExport TreeParams {
|
||||
public:
|
||||
static ParameterGrp::handle getHandle();
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter SyncSelection
|
||||
static const bool & getSyncSelection();
|
||||
static const bool & defaultSyncSelection();
|
||||
static void removeSyncSelection();
|
||||
static void setSyncSelection(const bool &v);
|
||||
static const char *docSyncSelection();
|
||||
static void onSyncSelectionChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter CheckBoxesSelection
|
||||
static const bool & getCheckBoxesSelection();
|
||||
static const bool & defaultCheckBoxesSelection();
|
||||
static void removeCheckBoxesSelection();
|
||||
static void setCheckBoxesSelection(const bool &v);
|
||||
static const char *docCheckBoxesSelection();
|
||||
static void onCheckBoxesSelectionChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter SyncView
|
||||
static const bool & getSyncView();
|
||||
static const bool & defaultSyncView();
|
||||
static void removeSyncView();
|
||||
static void setSyncView(const bool &v);
|
||||
static const char *docSyncView();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter PreSelection
|
||||
static const bool & getPreSelection();
|
||||
static const bool & defaultPreSelection();
|
||||
static void removePreSelection();
|
||||
static void setPreSelection(const bool &v);
|
||||
static const char *docPreSelection();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter SyncPlacement
|
||||
static const bool & getSyncPlacement();
|
||||
static const bool & defaultSyncPlacement();
|
||||
static void removeSyncPlacement();
|
||||
static void setSyncPlacement(const bool &v);
|
||||
static const char *docSyncPlacement();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter RecordSelection
|
||||
static const bool & getRecordSelection();
|
||||
static const bool & defaultRecordSelection();
|
||||
static void removeRecordSelection();
|
||||
static void setRecordSelection(const bool &v);
|
||||
static const char *docRecordSelection();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter DocumentMode
|
||||
static const long & getDocumentMode();
|
||||
static const long & defaultDocumentMode();
|
||||
static void removeDocumentMode();
|
||||
static void setDocumentMode(const long &v);
|
||||
static const char *docDocumentMode();
|
||||
static void onDocumentModeChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter StatusTimeout
|
||||
static const long & getStatusTimeout();
|
||||
static const long & defaultStatusTimeout();
|
||||
static void removeStatusTimeout();
|
||||
static void setStatusTimeout(const long &v);
|
||||
static const char *docStatusTimeout();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter SelectionTimeout
|
||||
static const long & getSelectionTimeout();
|
||||
static const long & defaultSelectionTimeout();
|
||||
static void removeSelectionTimeout();
|
||||
static void setSelectionTimeout(const long &v);
|
||||
static const char *docSelectionTimeout();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter PreSelectionTimeout
|
||||
static const long & getPreSelectionTimeout();
|
||||
static const long & defaultPreSelectionTimeout();
|
||||
static void removePreSelectionTimeout();
|
||||
static void setPreSelectionTimeout(const long &v);
|
||||
static const char *docPreSelectionTimeout();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter PreSelectionDelay
|
||||
static const long & getPreSelectionDelay();
|
||||
static const long & defaultPreSelectionDelay();
|
||||
static void removePreSelectionDelay();
|
||||
static void setPreSelectionDelay(const long &v);
|
||||
static const char *docPreSelectionDelay();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter PreSelectionMinDelay
|
||||
static const long & getPreSelectionMinDelay();
|
||||
static const long & defaultPreSelectionMinDelay();
|
||||
static void removePreSelectionMinDelay();
|
||||
static void setPreSelectionMinDelay(const long &v);
|
||||
static const char *docPreSelectionMinDelay();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter RecomputeOnDrop
|
||||
static const bool & getRecomputeOnDrop();
|
||||
static const bool & defaultRecomputeOnDrop();
|
||||
static void removeRecomputeOnDrop();
|
||||
static void setRecomputeOnDrop(const bool &v);
|
||||
static const char *docRecomputeOnDrop();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter KeepRootOrder
|
||||
static const bool & getKeepRootOrder();
|
||||
static const bool & defaultKeepRootOrder();
|
||||
static void removeKeepRootOrder();
|
||||
static void setKeepRootOrder(const bool &v);
|
||||
static const char *docKeepRootOrder();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeActiveAutoExpand
|
||||
static const bool & getTreeActiveAutoExpand();
|
||||
static const bool & defaultTreeActiveAutoExpand();
|
||||
static void removeTreeActiveAutoExpand();
|
||||
static void setTreeActiveAutoExpand(const bool &v);
|
||||
static const char *docTreeActiveAutoExpand();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeActiveColor
|
||||
static const unsigned long & getTreeActiveColor();
|
||||
static const unsigned long & defaultTreeActiveColor();
|
||||
static void removeTreeActiveColor();
|
||||
static void setTreeActiveColor(const unsigned long &v);
|
||||
static const char *docTreeActiveColor();
|
||||
static void onTreeActiveColorChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeEditColor
|
||||
static const unsigned long & getTreeEditColor();
|
||||
static const unsigned long & defaultTreeEditColor();
|
||||
static void removeTreeEditColor();
|
||||
static void setTreeEditColor(const unsigned long &v);
|
||||
static const char *docTreeEditColor();
|
||||
static void onTreeEditColorChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter SelectingGroupColor
|
||||
static const unsigned long & getSelectingGroupColor();
|
||||
static const unsigned long & defaultSelectingGroupColor();
|
||||
static void removeSelectingGroupColor();
|
||||
static void setSelectingGroupColor(const unsigned long &v);
|
||||
static const char *docSelectingGroupColor();
|
||||
static void onSelectingGroupColorChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeActiveBold
|
||||
static const bool & getTreeActiveBold();
|
||||
static const bool & defaultTreeActiveBold();
|
||||
static void removeTreeActiveBold();
|
||||
static void setTreeActiveBold(const bool &v);
|
||||
static const char *docTreeActiveBold();
|
||||
static void onTreeActiveBoldChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeActiveItalic
|
||||
static const bool & getTreeActiveItalic();
|
||||
static const bool & defaultTreeActiveItalic();
|
||||
static void removeTreeActiveItalic();
|
||||
static void setTreeActiveItalic(const bool &v);
|
||||
static const char *docTreeActiveItalic();
|
||||
static void onTreeActiveItalicChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeActiveUnderlined
|
||||
static const bool & getTreeActiveUnderlined();
|
||||
static const bool & defaultTreeActiveUnderlined();
|
||||
static void removeTreeActiveUnderlined();
|
||||
static void setTreeActiveUnderlined(const bool &v);
|
||||
static const char *docTreeActiveUnderlined();
|
||||
static void onTreeActiveUnderlinedChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeActiveOverlined
|
||||
static const bool & getTreeActiveOverlined();
|
||||
static const bool & defaultTreeActiveOverlined();
|
||||
static void removeTreeActiveOverlined();
|
||||
static void setTreeActiveOverlined(const bool &v);
|
||||
static const char *docTreeActiveOverlined();
|
||||
static void onTreeActiveOverlinedChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter Indentation
|
||||
static const long & getIndentation();
|
||||
static const long & defaultIndentation();
|
||||
static void removeIndentation();
|
||||
static void setIndentation(const long &v);
|
||||
static const char *docIndentation();
|
||||
static void onIndentationChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter LabelExpression
|
||||
static const bool & getLabelExpression();
|
||||
static const bool & defaultLabelExpression();
|
||||
static void removeLabelExpression();
|
||||
static void setLabelExpression(const bool &v);
|
||||
static const char *docLabelExpression();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter IconSize
|
||||
static const long & getIconSize();
|
||||
static const long & defaultIconSize();
|
||||
static void removeIconSize();
|
||||
static void setIconSize(const long &v);
|
||||
static const char *docIconSize();
|
||||
static void onIconSizeChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter FontSize
|
||||
static const long & getFontSize();
|
||||
static const long & defaultFontSize();
|
||||
static void removeFontSize();
|
||||
static void setFontSize(const long &v);
|
||||
static const char *docFontSize();
|
||||
static void onFontSizeChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter ItemSpacing
|
||||
static const long & getItemSpacing();
|
||||
static const long & defaultItemSpacing();
|
||||
static void removeItemSpacing();
|
||||
static void setItemSpacing(const long &v);
|
||||
static const char *docItemSpacing();
|
||||
static void onItemSpacingChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter ItemBackground
|
||||
///
|
||||
/// Tree view item background. Only effecitve in overlay.
|
||||
static const unsigned long & getItemBackground();
|
||||
static const unsigned long & defaultItemBackground();
|
||||
static void removeItemBackground();
|
||||
static void setItemBackground(const unsigned long &v);
|
||||
static const char *docItemBackground();
|
||||
static void onItemBackgroundChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter ItemBackgroundPadding
|
||||
///
|
||||
/// Tree view item background padding.
|
||||
static const long & getItemBackgroundPadding();
|
||||
static const long & defaultItemBackgroundPadding();
|
||||
static void removeItemBackgroundPadding();
|
||||
static void setItemBackgroundPadding(const long &v);
|
||||
static const char *docItemBackgroundPadding();
|
||||
static void onItemBackgroundPaddingChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter HideColumn
|
||||
///
|
||||
/// Hide extra tree view column for item description.
|
||||
static const bool & getHideColumn();
|
||||
static const bool & defaultHideColumn();
|
||||
static void removeHideColumn();
|
||||
static void setHideColumn(const bool &v);
|
||||
static const char *docHideColumn();
|
||||
static void onHideColumnChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter HideScrollBar
|
||||
///
|
||||
/// Hide tree view scroll bar in dock overlay
|
||||
static const bool & getHideScrollBar();
|
||||
static const bool & defaultHideScrollBar();
|
||||
static void removeHideScrollBar();
|
||||
static void setHideScrollBar(const bool &v);
|
||||
static const char *docHideScrollBar();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter HideHeaderView
|
||||
///
|
||||
/// Hide tree view header view in dock overlay
|
||||
static const bool & getHideHeaderView();
|
||||
static const bool & defaultHideHeaderView();
|
||||
static void removeHideHeaderView();
|
||||
static void setHideHeaderView(const bool &v);
|
||||
static const char *docHideHeaderView();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter ResizableColumn
|
||||
///
|
||||
/// Allow tree view columns to be manually resized
|
||||
static const bool & getResizableColumn();
|
||||
static const bool & defaultResizableColumn();
|
||||
static void removeResizableColumn();
|
||||
static void setResizableColumn(const bool &v);
|
||||
static const char *docResizableColumn();
|
||||
static void onResizableColumnChanged();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter ColumnSize1
|
||||
static const long & getColumnSize1();
|
||||
static const long & defaultColumnSize1();
|
||||
static void removeColumnSize1();
|
||||
static void setColumnSize1(const long &v);
|
||||
static const char *docColumnSize1();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter ColumnSize2
|
||||
static const long & getColumnSize2();
|
||||
static const long & defaultColumnSize2();
|
||||
static void removeColumnSize2();
|
||||
static void setColumnSize2(const long &v);
|
||||
static const char *docColumnSize2();
|
||||
//@}
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:122)
|
||||
//@{
|
||||
/// Accessor for parameter TreeToolTipIcon
|
||||
static const bool & getTreeToolTipIcon();
|
||||
static const bool & defaultTreeToolTipIcon();
|
||||
static void removeTreeToolTipIcon();
|
||||
static void setTreeToolTipIcon(const bool &v);
|
||||
static const char *docTreeToolTipIcon();
|
||||
//@}
|
||||
//[[[end]]]
|
||||
|
||||
static void refreshTreeViews();
|
||||
|
||||
/*[[[cog
|
||||
TreeParams.declare_end()
|
||||
]]]*/
|
||||
|
||||
// Auto generated code (Tools/params_utils.py:150)
|
||||
}; // class TreeParams
|
||||
} // namespace Gui
|
||||
//[[[end]]]
|
||||
|
||||
#endif // GUI_TREE_PARAMS_H
|
||||
94
src/Gui/TreeParams.py
Normal file
94
src/Gui/TreeParams.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2022 Zheng Lei (realthunder) <realthunder.dev@gmail.com>*
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program 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 program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
'''Auto code generator for parameters in Preferences/TreeView
|
||||
'''
|
||||
import sys
|
||||
from os import sys, path
|
||||
|
||||
# import Tools/params_utils.py
|
||||
sys.path.append(path.join(path.dirname(path.dirname(path.abspath(__file__))), 'Tools'))
|
||||
import params_utils
|
||||
|
||||
from params_utils import ParamBool, ParamInt, ParamString, ParamUInt,\
|
||||
ParamFloat, ParamSpinBox, ParamColor, ParamHex
|
||||
|
||||
NameSpace = 'Gui'
|
||||
ClassName = 'TreeParams'
|
||||
ParamPath = 'User parameter:BaseApp/Preferences/TreeView'
|
||||
ClassDoc = 'Convenient class to obtain tree view related parameters'
|
||||
SourceFile = 'Tree.cpp'
|
||||
|
||||
Params = [
|
||||
ParamBool('SyncSelection', True, on_change=True),
|
||||
ParamBool('CheckBoxesSelection',False, on_change=True, title="Show item checkbox"),
|
||||
ParamBool('SyncView', True),
|
||||
ParamBool('PreSelection', True),
|
||||
ParamBool('SyncPlacement', False),
|
||||
ParamBool('RecordSelection', True),
|
||||
ParamInt('DocumentMode', 2, on_change=True),
|
||||
ParamInt('StatusTimeout', 100),
|
||||
ParamInt('SelectionTimeout', 100),
|
||||
ParamInt('PreSelectionTimeout', 500),
|
||||
ParamInt('PreSelectionDelay', 700),
|
||||
ParamInt('PreSelectionMinDelay', 200),
|
||||
ParamBool('RecomputeOnDrop', True),
|
||||
ParamBool('KeepRootOrder', True),
|
||||
ParamBool('TreeActiveAutoExpand', True),
|
||||
ParamUInt('TreeActiveColor', 0xe6e6ffff, on_change=True),
|
||||
ParamUInt('TreeEditColor', 0x929200ff, on_change=True),
|
||||
ParamUInt('SelectingGroupColor', 0x408081ff, on_change=True),
|
||||
ParamBool('TreeActiveBold', True, on_change=True),
|
||||
ParamBool('TreeActiveItalic', False, on_change=True),
|
||||
ParamBool('TreeActiveUnderlined', False, on_change=True),
|
||||
ParamBool('TreeActiveOverlined', False, on_change=True),
|
||||
ParamInt('Indentation', 0, on_change=True),
|
||||
ParamBool('LabelExpression', False),
|
||||
ParamInt('IconSize', 0, on_change=True),
|
||||
ParamInt('FontSize', 0, on_change=True),
|
||||
ParamInt('ItemSpacing', 0, on_change=True),
|
||||
ParamHex('ItemBackground', 0, on_change=True, title='Item background color', proxy=ParamColor(),
|
||||
doc = "Tree view item background. Only effecitve in overlay."),
|
||||
ParamInt('ItemBackgroundPadding', 10, on_change=True, title="Item background padding", proxy=ParamSpinBox(0, 100, 1),
|
||||
doc = "Tree view item background padding."),
|
||||
ParamBool('HideColumn', False, on_change=True, title="Hide extra column",
|
||||
doc = "Hide extra tree view column for item description."),
|
||||
ParamBool('HideScrollBar', True, title="Hide scroll bar",
|
||||
doc = "Hide tree view scroll bar in dock overlay"),
|
||||
ParamBool('HideHeaderView', True, title="Hide header",
|
||||
doc = "Hide tree view header view in dock overlay"),
|
||||
ParamBool('ResizableColumn', False, on_change=True, title="Resizable columns",
|
||||
doc = "Allow tree view columns to be manually resized"),
|
||||
ParamInt('ColumnSize1', 0),
|
||||
ParamInt('ColumnSize2', 0),
|
||||
ParamBool('TreeToolTipIcon', False, title='Show icon in tool tip'),
|
||||
]
|
||||
|
||||
def declare_begin():
|
||||
params_utils.declare_begin(sys.modules[__name__])
|
||||
|
||||
def declare_end():
|
||||
params_utils.declare_end(sys.modules[__name__])
|
||||
|
||||
def define():
|
||||
params_utils.define(sys.modules[__name__])
|
||||
|
||||
params_utils.init_params(Params, NameSpace, ClassName, ParamPath)
|
||||
Reference in New Issue
Block a user