Paddle
2022-10-06 16:22:49 +02:00
committed by abdullahtahiriyo
parent bad35fe26c
commit a656ffbd53
5 changed files with 1140 additions and 932 deletions

View File

@@ -123,7 +123,7 @@ public: // Utility methods
static bool getConstruction(const Part::Geometry * geometry);
static void setConstruction(Part::Geometry * geometry, bool construction);
static bool isInternalType(const Part::Geometry * geometry, InternalType::InternalType type);
static bool isInternalAligned(const Part::Geometry * geometry);
static bool isInternalAligned(const Part::Geometry* geometry);
static bool getBlocked(const Part::Geometry * geometry);
public:

View File

@@ -1,54 +1,204 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="64px" height="64px" id="svg2816" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs id="defs2818">
<linearGradient id="linearGradient3846">
<stop style="stop-color:#a40000;stop-opacity:1" offset="0" id="stop3848" />
<stop style="stop-color:#ef2929;stop-opacity:1" offset="1" id="stop3850" />
<svg
width="64px"
height="64px"
id="svg2816"
version="1.1"
sodipodi:docname="Sketcher_Element_SelectionTypeInvalid.svg"
inkscape:version="1.1-beta1 (77e7b44db3, 2021-03-28)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview40"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
objecttolerance="10.0"
gridtolerance="10.0"
guidetolerance="10.0"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="5.8828125"
inkscape:cx="61.280212"
inkscape:cy="15.383798"
inkscape:window-width="3840"
inkscape:window-height="1571"
inkscape:window-x="-9"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:current-layer="svg2816" />
<defs
id="defs2818">
<linearGradient
id="linearGradient3846">
<stop
style="stop-color:#a40000;stop-opacity:1"
offset="0"
id="stop3848" />
<stop
style="stop-color:#ef2929;stop-opacity:1"
offset="1"
id="stop3850" />
</linearGradient>
<linearGradient id="linearGradient3602">
<stop style="stop-color:#ff2600;stop-opacity:1" offset="0" id="stop3604" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606" />
<linearGradient
id="linearGradient3602">
<stop
style="stop-color:#ff2600;stop-opacity:1"
offset="0"
id="stop3604" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606" />
</linearGradient>
<linearGradient xlink:href="#linearGradient3602-7" id="linearGradient3608-5" x1="3.909091" y1="14.363636" x2="24.81818" y2="14.363636" gradientUnits="userSpaceOnUse" />
<linearGradient id="linearGradient3602-7">
<stop style="stop-color:#c51900;stop-opacity:1" offset="0" id="stop3604-1" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606-3" />
<linearGradient
xlink:href="#linearGradient3602-7"
id="linearGradient3608-5"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-7">
<stop
style="stop-color:#c51900;stop-opacity:1"
offset="0"
id="stop3604-1" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606-3" />
</linearGradient>
<linearGradient xlink:href="#linearGradient3602-5" id="linearGradient3608-1" x1="3.909091" y1="14.363636" x2="24.81818" y2="14.363636" gradientUnits="userSpaceOnUse" />
<linearGradient id="linearGradient3602-5">
<stop style="stop-color:#c51900;stop-opacity:1" offset="0" id="stop3604-9" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606-9" />
<linearGradient
xlink:href="#linearGradient3602-5"
id="linearGradient3608-1"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-5">
<stop
style="stop-color:#c51900;stop-opacity:1"
offset="0"
id="stop3604-9" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606-9" />
</linearGradient>
<linearGradient y2="14.363636" x2="24.81818" y1="14.363636" x1="3.909091" gradientUnits="userSpaceOnUse" id="linearGradient3686" xlink:href="#linearGradient3602-5" />
<linearGradient xlink:href="#linearGradient3602-58" id="linearGradient3608-8" x1="3.909091" y1="14.363636" x2="24.81818" y2="14.363636" gradientUnits="userSpaceOnUse" />
<linearGradient id="linearGradient3602-58">
<stop style="stop-color:#c51900;stop-opacity:1" offset="0" id="stop3604-2" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606-2" />
<linearGradient
y2="14.363636"
x2="24.81818"
y1="14.363636"
x1="3.909091"
gradientUnits="userSpaceOnUse"
id="linearGradient3686"
xlink:href="#linearGradient3602-5" />
<linearGradient
xlink:href="#linearGradient3602-58"
id="linearGradient3608-8"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-58">
<stop
style="stop-color:#c51900;stop-opacity:1"
offset="0"
id="stop3604-2" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606-2" />
</linearGradient>
<linearGradient y2="14.363636" x2="24.81818" y1="14.363636" x1="3.909091" gradientUnits="userSpaceOnUse" id="linearGradient3726" xlink:href="#linearGradient3602-58" />
<linearGradient xlink:href="#linearGradient3602-1" id="linearGradient3608" x1="3.909091" y1="14.363636" x2="24.81818" y2="14.363636" gradientUnits="userSpaceOnUse" />
<linearGradient id="linearGradient3602-1">
<stop style="stop-color:#ff2600;stop-opacity:1" offset="0" id="stop3604-22" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606-1" />
<linearGradient
y2="14.363636"
x2="24.81818"
y1="14.363636"
x1="3.909091"
gradientUnits="userSpaceOnUse"
id="linearGradient3726"
xlink:href="#linearGradient3602-58" />
<linearGradient
xlink:href="#linearGradient3602-1"
id="linearGradient3608"
x1="3.909091"
y1="14.363636"
x2="24.81818"
y2="14.363636"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3602-1">
<stop
style="stop-color:#ff2600;stop-opacity:1"
offset="0"
id="stop3604-22" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606-1" />
</linearGradient>
<linearGradient id="linearGradient3602-1-9">
<stop style="stop-color:#ff2600;stop-opacity:1" offset="0" id="stop3604-22-5" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606-1-4" />
<linearGradient
id="linearGradient3602-1-9">
<stop
style="stop-color:#ff2600;stop-opacity:1"
offset="0"
id="stop3604-22-5" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606-1-4" />
</linearGradient>
<linearGradient y2="14.363636" x2="24.81818" y1="14.363636" x1="3.909091" gradientUnits="userSpaceOnUse" id="linearGradient8395" xlink:href="#linearGradient3602-1-9" />
<linearGradient id="linearGradient3602-1-2">
<stop style="stop-color:#ff2600;stop-opacity:1" offset="0" id="stop3604-22-55" />
<stop style="stop-color:#ff5f00;stop-opacity:1" offset="1" id="stop3606-1-8" />
<linearGradient
y2="14.363636"
x2="24.81818"
y1="14.363636"
x1="3.909091"
gradientUnits="userSpaceOnUse"
id="linearGradient8395"
xlink:href="#linearGradient3602-1-9" />
<linearGradient
id="linearGradient3602-1-2">
<stop
style="stop-color:#ff2600;stop-opacity:1"
offset="0"
id="stop3604-22-55" />
<stop
style="stop-color:#ff5f00;stop-opacity:1"
offset="1"
id="stop3606-1-8" />
</linearGradient>
<linearGradient xlink:href="#linearGradient3846" id="linearGradient3852" x1="36" y1="57" x2="22" y2="8" gradientUnits="userSpaceOnUse" />
<linearGradient
xlink:href="#linearGradient3846"
id="linearGradient3852"
x1="36"
y1="57"
x2="22"
y2="8"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(77.167605,2.1635777)" />
</defs>
<metadata id="metadata2821">
<metadata
id="metadata2821">
<rdf:RDF>
<cc:Work rdf:about="">
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:creator>
<cc:Agent>
<dc:title>[wmayer]</dc:title>
@@ -76,8 +226,8 @@
</cc:Work>
</rdf:RDF>
</metadata>
<g id="layer1">
<path style="color:#000000;fill:url(#linearGradient3852);fill-opacity:1;fill-rule:nonzero;stroke:#280000;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="M 3,13 22,32 3,51 13,61 32,42 51,61 61,51 42,32 61,13 51,3 32,22 13,3 z" id="rect8776" />
<path style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ef2929;stroke-width:2;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="M 6,13 25,32 6,51 13,58 32,39 51,59 59,51 39,32 58,13 51,6 32,25 13,6 z" id="rect8776-1" />
</g>
<path
style="fill:none;stroke:#a3a3a3;stroke-width:0.975351;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 17.872682,31.957503 H 46.169813"
id="path894-1" />
</svg>

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,7 @@
#include <boost_signals2.hpp>
#include <QListWidget>
#include <QIcon>
#include <QStyledItemDelegate>
namespace App {
class Property;
@@ -39,6 +40,84 @@ namespace SketcherGui {
class ViewProviderSketch;
class Ui_TaskSketcherElements;
enum class ElementType { edge, start, end, mid, none }; //This is to identify the type of element selected
// helper class to store additional information about the listWidget entry.
class ElementItem : public QListWidgetItem
{
public:
enum class GeometryState {
Normal,
Construction,
InternalAlignment,
External
};
ElementItem(int elementnr, int startingVertex, int midVertex, int endVertex,
Base::Type geometryType, GeometryState state, const QString & lab) :
ElementNbr(elementnr)
, StartingVertex(startingVertex)
, MidVertex(midVertex)
, EndVertex(endVertex)
, GeometryType(geometryType)
, State(state)
, isLineSelected(false)
, isStartingPointSelected(false)
, isEndPointSelected(false)
, isMidPointSelected(false)
, clickedOn(ElementType::none)
, hovered(ElementType::none)
, rightClicked(false)
, label(lab)
{}
~ElementItem() override {
}
int ElementNbr;
int StartingVertex;
int MidVertex;
int EndVertex;
Base::Type GeometryType;
GeometryState State;
bool isLineSelected;
bool isStartingPointSelected;
bool isEndPointSelected;
bool isMidPointSelected;
ElementType clickedOn;
ElementType hovered;
bool rightClicked;
QString label;
};
class ElementView;
class ElementItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit ElementItemDelegate(ElementView* parent);
~ElementItemDelegate() override;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;
ElementItem* getElementtItem(const QModelIndex& index) const;
const int border = 1; //1px, looks good around buttons.
const int leftMargin = 4; //4px on the left of icons, looks good.
const int textBottomMargin = 5; //5px center the text.
Q_SIGNALS:
void itemHovered(QModelIndex);
};
class ElementView : public QListWidget
{
Q_OBJECT
@@ -46,14 +125,10 @@ class ElementView : public QListWidget
public:
explicit ElementView(QWidget *parent = nullptr);
~ElementView() override;
Q_SIGNALS:
void onFilterShortcutPressed();
ElementItem* itemFromIndex(const QModelIndex& index);
protected:
void contextMenuEvent (QContextMenuEvent* event) override;
void keyPressEvent(QKeyEvent * event) override;
protected Q_SLOTS:
// Constraints
@@ -86,24 +161,17 @@ protected Q_SLOTS:
void doSelectHAxis();
void doSelectVAxis();
void deleteSelectedItems();
void onIndexHovered(QModelIndex index);
Q_SIGNALS:
void onItemHovered(QListWidgetItem *);
};
class TaskSketcherElements : public Gui::TaskView::TaskBox, public Gui::SelectionObserver
{
Q_OBJECT
class MultIcon {
public:
explicit MultIcon(const char*);
QIcon Normal;
QIcon Construction;
QIcon External;
QIcon getIcon(bool construction, bool external) const;
};
public:
explicit TaskSketcherElements(ViewProviderSketch *sketchView);
~TaskSketcherElements() override;
@@ -111,22 +179,23 @@ public:
/// Observer message from the Selection
void onSelectionChanged(const Gui::SelectionChanges& msg) override;
bool eventFilter(QObject* obj, QEvent* event) override;
private:
void slotElementsChanged();
void updateIcons(int element);
void updatePreselection();
void updateVisibility(int filterindex);
void setItemVisibility(int elementindex,int filterindex);
void updateVisibility();
void setItemVisibility(QListWidgetItem* item);
void clearWidget();
void createSettingsButtonActions();
public Q_SLOTS:
void on_listWidgetElements_itemSelectionChanged();
void on_listWidgetElements_itemPressed(QListWidgetItem* item);
void on_listWidgetElements_itemEntered(QListWidgetItem *item);
void on_listWidgetElements_filterShortcutPressed();
void on_listWidgetElements_currentFilterChanged ( int index );
void on_listWidgetElements_currentModeFilterChanged ( int index );
void on_namingBox_stateChanged(int state);
void on_autoSwitchBox_stateChanged(int state);
void on_listWidgetElements_mouseMoveOnItem(QListWidgetItem* item);
void on_settings_extendedInformation_changed();
void on_settingsButton_clicked(bool);
void on_filterBox_stateChanged(int val);
void on_listMultiFilter_itemChanged(QListWidgetItem* item);
protected:
void changeEvent(QEvent *e) override;
@@ -140,11 +209,10 @@ private:
std::unique_ptr<Ui_TaskSketcherElements> ui;
int focusItemIndex;
int previouslySelectedItemIndex;
int previouslyHoveredItemIndex;
ElementType previouslyHoveredType;
bool isNamingBoxChecked;
bool isautoSwitchBoxChecked;
bool inhibitSelectionUpdate;
};
} //namespace SketcherGui

View File

@@ -6,163 +6,171 @@
<rect>
<x>0</x>
<y>0</y>
<width>214</width>
<height>401</height>
<width>220</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>0</width>
<height>400</height>
<width>16777215</width>
<height>350</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxElementFilter">
<property name="enabled">
<bool>false</bool>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Edge</string>
</property>
</item>
<item>
<property name="text">
<string>Starting Point</string>
</property>
</item>
<item>
<property name="text">
<string>End Point</string>
</property>
</item>
<item>
<property name="text">
<string>Center Point</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout1">
<item>
<widget class="QLabel" name="label1">
<widget class="QCheckBox" name="filterBox">
<property name="toolTip">
<string>Check to activate filters</string>
</property>
<property name="styleSheet">
<string notr="true">padding-bottom: 0px; margin-bottom: 0px</string>
</property>
<property name="text">
<string>Mode:</string>
<string>Filters</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxModeFilter">
<property name="enabled">
<bool>false</bool>
<widget class="QToolButton" name="settingsButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
<property name="toolTip">
<string>Settings</string>
</property>
<property name="editable">
<bool>false</bool>
<property name="text">
<string/>
</property>
<property name="currentIndex">
<number>0</number>
<property name="icon">
<iconset resource="Resources/Sketcher.qrc">
<normaloff>:/icons/dialogs/Sketcher_Settings.svg</normaloff>:/icons/dialogs/Sketcher_Settings.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<item>
<property name="text">
<string>All</string>
</property>
</item>
<item>
<property name="text">
<string>Normal</string>
</property>
</item>
<item>
<property name="text">
<string>Construction</string>
</property>
</item>
<item>
<property name="text">
<string>External</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="ElementView" name="listWidgetElements">
<widget class="QListWidget" name="listMultiFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>237</height>
</size>
<property name="styleSheet">
<string notr="true">padding-top: 0px; margin-top: 0px</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<item>
<property name="text">
<string>Normal</string>
</property>
</item>
<item>
<property name="text">
<string>Construction</string>
</property>
</item>
<item>
<property name="text">
<string>Internal</string>
</property>
</item>
<item>
<property name="text">
<string>External</string>
</property>
</item>
<item>
<property name="text">
<string>All types</string>
</property>
</item>
<item>
<property name="text">
<string> - Point</string>
</property>
</item>
<item>
<property name="text">
<string> - Line</string>
</property>
</item>
<item>
<property name="text">
<string> - Circle</string>
</property>
</item>
<item>
<property name="text">
<string> - Ellipse </string>
</property>
</item>
<item>
<property name="text">
<string> - Arc</string>
</property>
</item>
<item>
<property name="text">
<string> - Arc of ellipse</string>
</property>
</item>
<item>
<property name="text">
<string> - Arc of hyperbola</string>
</property>
</item>
<item>
<property name="text">
<string> - Arc of parabola</string>
</property>
</item>
<item>
<property name="text">
<string> - B-Spline</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="namingBox">
<property name="toolTip">
<string>Extended naming containing info about element mode</string>
<widget class="ElementView" name="listWidgetElements">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Extended naming</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoSwitchBox">
<property name="toolTip">
<string>Only the type 'Edge' will be available for the list</string>
</property>
<property name="text">
<string>Auto-switch to Edge</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="Explanation">
<property name="text">
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&amp;quot;Ctrl&amp;quot;: multiple selection&lt;/p&gt;&lt;p&gt;&amp;quot;Z&amp;quot;: switch to next valid type&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<property name="modelColumn">
<number>0</number>
</property>
</widget>
</item>