diff --git a/Software/src/src.pro b/Software/src/src.pro
index a740e8d13..d2e500a7c 100644
--- a/Software/src/src.pro
+++ b/Software/src/src.pro
@@ -225,11 +225,12 @@ SOURCES += \
wizard/MonitorIdForm.cpp \
wizard/MonitorConfigurationPage.cpp \
wizard/LightpackDiscoveryPage.cpp \
- wizard/AndromedaDistributor.cpp \
wizard/ConfigureDevicePage.cpp \
wizard/SelectDevicePage.cpp \
+ wizard/AndromedaDistributor.cpp \
wizard/CassiopeiaDistributor.cpp \
wizard/PegasusDistributor.cpp \
+ wizard/CustomDistributor.cpp \
systrayicon/SysTrayIcon.cpp \
UpdatesProcessor.cpp
@@ -274,13 +275,14 @@ HEADERS += \
wizard/MonitorIdForm.hpp \
wizard/MonitorConfigurationPage.hpp \
wizard/LightpackDiscoveryPage.hpp \
- wizard/AndromedaDistributor.hpp \
wizard/ConfigureDevicePage.hpp \
wizard/SelectDevicePage.hpp \
types.h \
wizard/AreaDistributor.hpp \
+ wizard/AndromedaDistributor.hpp \
wizard/CassiopeiaDistributor.hpp \
wizard/PegasusDistributor.hpp \
+ wizard/CustomDistributor.hpp \
systrayicon/SysTrayIcon.hpp \
systrayicon/SysTrayIcon_p.hpp \
UpdatesProcessor.hpp
diff --git a/Software/src/wizard/CustomDistributor.cpp b/Software/src/wizard/CustomDistributor.cpp
new file mode 100644
index 000000000..c9324ba59
--- /dev/null
+++ b/Software/src/wizard/CustomDistributor.cpp
@@ -0,0 +1,116 @@
+/*
+ * CustomDistributor.cpp
+ *
+ * Created on: 08.06.2016
+ * Project: Prismatik
+ *
+ * Copyright (c) 2015 Patrick Siegler
+ *
+ * Lightpack is an open-source, USB content-driving ambient lighting
+ * hardware.
+ *
+ * Prismatik is a free, open-source software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Prismatik and Lightpack files 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#include "CustomDistributor.hpp"
+#include "PrismatikMath.hpp"
+
+#define STAND_WIDTH 0.3333 //33%
+
+int roundDown(int n) {
+ return (n % 2 == 0) ? n : (n - 1);
+}
+
+CustomDistributor::~CustomDistributor() {
+ if (_currentArea)
+ cleanCurrentArea();
+}
+
+ScreenArea * CustomDistributor::next() {
+ const double thikness = 0.15;
+ double x, y;
+
+ if (_dx == 0 && _dy == 0) {
+ _dx = 1;
+ _width = 1.0 / areaCountOnBottomEdge();
+ _height = thikness;
+ x = 1.0 - roundDown(areaCountOnBottomEdge()) * _width / 2;
+ y = 1.0 - _height;
+ } else if (_dx > 0 && cmp(_currentArea->hScanEnd(), 1.0, 0.01) >= 0 ) {
+ cleanCurrentArea();
+ _dx = 0;
+ _dy = -1;
+ _width = thikness;
+ _height = 1.0f / areaCountOnSideEdge();
+ x = 1.0f - _width;
+ y = 1.0f - _height;
+ } else if (_dy < 0 && cmp(_currentArea->vScanStart(), 0.0, .01) <= 0) {
+ cleanCurrentArea();
+ _dx = -1;
+ _dy = 0;
+ _width = 1.0 / areaCountOnTopEdge();
+ _height = thikness;
+ x = 1.0 - _width;
+ y = 0.0;
+ } else if (_dx < 0 && cmp(_currentArea->hScanStart(), 0.0, .01) <= 0) {
+ cleanCurrentArea();
+ _dx = 0;
+ _dy = 1;
+ _width = thikness;
+ _height = 1.0 / areaCountOnSideEdge();
+ x = 0.0;
+ y = 0.0;
+ } else if (_dy > 0 && cmp(_currentArea->vScanEnd(), 1.0, .01) >= 0) {
+ cleanCurrentArea();
+ _dx = 1;
+ _dy = 0;
+ _width = 1.0 / areaCountOnBottomEdge();
+ _height = thikness;
+ x = 0.0;
+ y = 1.0 - _height;
+ }
+
+ ScreenArea *result = NULL;
+ if (!_currentArea) {
+ result = new ScreenArea( x, x + _width, y, y + _height);
+ } else {
+ ScreenArea *cf = _currentArea;
+ double dx = _width * (double)_dx;
+ double dy = _height * (double)_dy;
+
+ result = new ScreenArea(within1(cf->hScanStart() + dx), within1(cf->hScanEnd() + dx),
+ within1(cf->vScanStart() + dy), within1(cf->vScanEnd() + dy));
+ cleanCurrentArea();
+ }
+
+ _currentArea = result;
+ return new ScreenArea(*_currentArea);
+
+}
+
+size_t CustomDistributor::areaCountOnTopEdge() const
+{
+ return _top;
+}
+
+size_t CustomDistributor::areaCountOnBottomEdge() const
+{
+ return _bottom;
+}
+
+size_t CustomDistributor::areaCountOnSideEdge() const
+{
+ return _side;
+}
diff --git a/Software/src/wizard/CustomDistributor.hpp b/Software/src/wizard/CustomDistributor.hpp
new file mode 100644
index 000000000..e04dc8662
--- /dev/null
+++ b/Software/src/wizard/CustomDistributor.hpp
@@ -0,0 +1,59 @@
+/*
+ * CustomDistributor.hpp
+ *
+ * Created on: 08.06.2016
+ * Project: Prismatik
+ *
+ * Copyright (c) 2015 Patrick Siegler
+ *
+ * Lightpack is an open-source, USB content-driving ambient lighting
+ * hardware.
+ *
+ * Prismatik is a free, open-source software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Prismatik and Lightpack files 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#ifndef CUSTOMDISTRIBUTOR_HPP
+#define CUSTOMDISTRIBUTOR_HPP
+#include "AreaDistributor.hpp"
+
+class CustomDistributor : public AreaDistributor
+{
+public:
+ CustomDistributor(int screenId, size_t top, size_t side, size_t bottom):
+ AreaDistributor(screenId, top + 2*side + bottom),
+ _top(top), _side(side), _bottom(bottom),
+ _dx(0), _dy(0)
+ {}
+ virtual ~CustomDistributor();
+
+ virtual ScreenArea * next();
+
+protected:
+ char _dx, _dy;
+ double _width, _height;
+ size_t _top, _side, _bottom;
+
+ virtual size_t areaCountOnSideEdge() const;
+ virtual size_t areaCountOnTopEdge() const;
+ virtual size_t areaCountOnBottomEdge() const;
+
+private:
+ void cleanCurrentArea() {
+ delete _currentArea;
+ _currentArea = NULL;
+ }
+};
+
+#endif // CUSTOMDISTRIBUTOR_HPP
diff --git a/Software/src/wizard/ZonePlacementPage.cpp b/Software/src/wizard/ZonePlacementPage.cpp
index 497631114..97735d87e 100644
--- a/Software/src/wizard/ZonePlacementPage.cpp
+++ b/Software/src/wizard/ZonePlacementPage.cpp
@@ -32,6 +32,7 @@
#include "AndromedaDistributor.hpp"
#include "CassiopeiaDistributor.hpp"
#include "PegasusDistributor.hpp"
+#include "CustomDistributor.hpp"
#include "GrabWidget.hpp"
#include "LedDeviceLightpack.hpp"
@@ -233,7 +234,16 @@ void ZonePlacementPage::on_pbPegasus_clicked()
distributeAreas(pegasus);
delete pegasus;
+}
+
+
+void ZonePlacementPage::on_pbCustom_clicked()
+{
+ CustomDistributor *custom = new CustomDistributor(_screenId, _ui->sbTopLeds->value(), _ui->sbSideLeds->value(), _ui->sbBottomLeds->value());
+
+ distributeAreas(custom);
+ delete custom;
}
diff --git a/Software/src/wizard/ZonePlacementPage.hpp b/Software/src/wizard/ZonePlacementPage.hpp
index 0aac0afe4..ee3dfabad 100644
--- a/Software/src/wizard/ZonePlacementPage.hpp
+++ b/Software/src/wizard/ZonePlacementPage.hpp
@@ -59,12 +59,12 @@ public slots:
private slots:
void on_pbAndromeda_clicked();
- void on_pbCassiopeia_clicked();
+ void on_pbCassiopeia_clicked();
+ void on_pbPegasus_clicked();
+ void on_pbCustom_clicked();
void on_numberOfLeds_valueChanged(int arg1);
- void on_pbPegasus_clicked();
-
private:
void addGrabArea(int id, const QRect &rect);
void removeLastGrabArea();
diff --git a/Software/src/wizard/ZonePlacementPage.ui b/Software/src/wizard/ZonePlacementPage.ui
index 711348c51..6f897e21e 100644
--- a/Software/src/wizard/ZonePlacementPage.ui
+++ b/Software/src/wizard/ZonePlacementPage.ui
@@ -14,42 +14,21 @@
WizardPage
- -
-
-
- Pegasus
-
-
-
- -
-
-
- Cassiopeia
-
-
-
- -
-
-
- Andromeda
-
-
-
- -
-
+
-
+
- Qt::Horizontal
+ Qt::Vertical
- 40
- 20
+ 20
+ 40
- -
-
+
-
+
Qt::Vertical
@@ -62,7 +41,113 @@
-
-
+
+
-
+
+
-
+
+
+ Andromeda
+
+
+
+ -
+
+
+ Cassiopeia
+
+
+
+ -
+
+
+ Pegasus
+
+
+
+ -
+
+
+ Number of LEDs:
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ -
+
+
-
+
+
+ Top
+
+
+
+ -
+
+
+ 3
+
+
+
+ -
+
+
+ Sides
+
+
+
+ -
+
+
+ 2
+
+
+
+ -
+
+
+ Bottom
+
+
+
+ -
+
+
+ 3
+
+
+
+ -
+
+
+ Custom
+
+
+
+
+
+
+
+ -
+
Qt::Horizontal
@@ -74,36 +159,19 @@
- -
-
+
-
+
- Qt::Vertical
+ Qt::Horizontal
- 20
- 40
+ 40
+ 20
- -
-
-
- 1
-
-
- 10
-
-
-
- -
-
-
- Number of LEDs:
-
-
-