Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
code simplifications and sorting
  • Loading branch information
donovaly authored and wwmayer committed Aug 10, 2020
1 parent 3ce634b commit 26ebfbf
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 84 deletions.
43 changes: 20 additions & 23 deletions src/Mod/Part/Gui/TaskFaceColors.cpp
Expand Up @@ -24,51 +24,50 @@
#include "PreCompiled.h"

#ifndef _PreComp_
# include <sstream>
# include <boost/signals2.hpp>
# include <boost_bind_bind.hpp>
# include <BRep_Tool.hxx>
# include <BRepGProp.hxx>
# include <GProp_GProps.hxx>
# include <gp_Pnt.hxx>
# include <TopExp_Explorer.hxx>
# include <TopoDS.hxx>
# include <TopTools_IndexedMapOfShape.hxx>
# include <QFontMetrics>
# include <QMessageBox>
# include <QPointer>
# include <QSet>
# include <Python.h>
# include <Inventor/SoPickedPoint.h>
# include <Inventor/actions/SoRayPickAction.h>
# include <Inventor/actions/SoSearchAction.h>
# include <Inventor/details/SoFaceDetail.h>
# include <Inventor/events/SoMouseButtonEvent.h>
# include <Inventor/nodes/SoCamera.h>
# include <Inventor/nodes/SoSeparator.h>
# include <boost/signals2.hpp>
# include <boost_bind_bind.hpp>
# include <Inventor/SoPickedPoint.h>
# include <Python.h>
# include <QFontMetrics>
# include <QMessageBox>
# include <QPointer>
# include <QSet>
# include <sstream>
# include <TopExp_Explorer.hxx>
# include <TopoDS.hxx>
# include <TopTools_IndexedMapOfShape.hxx>
#endif

#include "ui_TaskFaceColors.h"

#include "SoBrepFaceSet.h"
#include "TaskFaceColors.h"
#include "ViewProviderExt.h"
#include "SoBrepFaceSet.h"

#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Gui/Application.h>
#include <Gui/Control.h>
#include <Gui/Document.h>
#include <Gui/MainWindow.h>
#include <Gui/Selection.h>
#include <Gui/SoFCUnifiedSelection.h>
#include <Gui/Tools.h>
#include <Gui/Utilities.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Gui/Tools.h>

#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Mod/Part/App/PartFeature.h>


using namespace PartGui;
namespace bp = boost::placeholders;

Expand Down Expand Up @@ -321,22 +320,20 @@ void FaceColors::slotDeleteObject(const Gui::ViewProvider& obj)
Gui::Control().closeDialog();
}

void FaceColors::on_boxSelection_clicked()
void FaceColors::on_boxSelection_toggled(bool checked)
{
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
// toggle the button state and feature
if (d->boxSelection) {
if (!checked) {
d->boxSelection = false;
d->ui->boxSelection->setChecked(false);
// end box selection mode
if (view)
view->getViewer()->stopSelection();
}
else {
d->boxSelection = true;
d->ui->boxSelection->setChecked(true);
}
if (view && d->boxSelection) {
if (view && checked) {
Gui::View3DInventorViewer* viewer = view->getViewer();
if (!viewer->isSelecting()) {
viewer->startSelection(Gui::View3DInventorViewer::Rubberband);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Part/Gui/TaskFaceColors.h
Expand Up @@ -51,7 +51,7 @@ class FaceColors : public QWidget, public Gui::SelectionObserver
private Q_SLOTS:
void on_colorButton_changed();
void on_defaultButton_clicked();
void on_boxSelection_clicked();
void on_boxSelection_toggled(bool checked);

protected:
void onSelectionChanged(const Gui::SelectionChanges& msg);
Expand Down
116 changes: 56 additions & 60 deletions src/Mod/Part/Gui/TaskFaceColors.ui
Expand Up @@ -22,66 +22,62 @@
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string notr="true">Group box</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="faceLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Faces:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelElement">
<property name="text">
<string notr="true">[]</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="Gui::ColorButton" name="colorButton">
<property name="minimumSize">
<size>
<width>146</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string notr="true">Group box</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="faceLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Faces:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="Gui::ColorButton" name="colorButton">
<property name="minimumSize">
<size>
<width>146</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="labelElement">
<property name="text">
<string notr="true">[]</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
Expand Down

0 comments on commit 26ebfbf

Please sign in to comment.