@@ -136,6 +136,12 @@ void CanvasBox::setGroupName(QString group_name) | |||||
updatePositions(); | updatePositions(); | ||||
} | } | ||||
void CanvasBox::setShadowOpacity(float opacity) | |||||
{ | |||||
if (shadow) | |||||
shadow->setOpacity(opacity); | |||||
} | |||||
CanvasPort* CanvasBox::addPortFromGroup(int port_id, QString port_name, PortMode port_mode, PortType port_type) | CanvasPort* CanvasBox::addPortFromGroup(int port_id, QString port_name, PortMode port_mode, PortType port_type) | ||||
{ | { | ||||
if (m_port_list_ids.count() == 0) | if (m_port_list_ids.count() == 0) | ||||
@@ -54,6 +54,8 @@ public: | |||||
void setSplit(bool split, PortMode mode=PORT_MODE_NULL); | void setSplit(bool split, PortMode mode=PORT_MODE_NULL); | ||||
void setGroupName(QString group_name); | void setGroupName(QString group_name); | ||||
void setShadowOpacity(float opacity); | |||||
CanvasPort* addPortFromGroup(int port_id, QString port_name, PortMode port_mode, PortType port_type); | CanvasPort* addPortFromGroup(int port_id, QString port_name, PortMode port_mode, PortType port_type); | ||||
void removePortFromGroup(int port_id); | void removePortFromGroup(int port_id); | ||||
void addLineFromGroup(AbstractCanvasLine* line, int connection_id); | void addLineFromGroup(AbstractCanvasLine* line, int connection_id); | ||||
@@ -36,6 +36,13 @@ void CanvasBoxShadow::setFakeParent(CanvasBox* fakeParent) | |||||
m_fakeParent = fakeParent; | m_fakeParent = fakeParent; | ||||
} | } | ||||
void CanvasBoxShadow::setOpacity(float opacity) | |||||
{ | |||||
QColor color(canvas.theme->box_shadow); | |||||
color.setAlphaF(opacity); | |||||
setColor(color); | |||||
} | |||||
void CanvasBoxShadow::draw(QPainter* painter) | void CanvasBoxShadow::draw(QPainter* painter) | ||||
{ | { | ||||
if (m_fakeParent) | if (m_fakeParent) | ||||
@@ -31,6 +31,7 @@ class CanvasBoxShadow : public QGraphicsDropShadowEffect | |||||
public: | public: | ||||
CanvasBoxShadow(QObject* parent); | CanvasBoxShadow(QObject* parent); | ||||
void setFakeParent(CanvasBox* fakeParent); | void setFakeParent(CanvasBox* fakeParent); | ||||
void setOpacity(float opacity); | |||||
protected: | protected: | ||||
virtual void draw(QPainter* painter); | virtual void draw(QPainter* painter); | ||||
@@ -17,7 +17,7 @@ | |||||
#include "canvasfadeanimation.h" | #include "canvasfadeanimation.h" | ||||
#include <QGraphicsItem> | |||||
#include "canvasbox.h" | |||||
START_NAMESPACE_PATCHCANVAS | START_NAMESPACE_PATCHCANVAS | ||||
@@ -63,6 +63,9 @@ void CanvasFadeAnimation::updateCurrentTime(int time) | |||||
value = 1.0-(float(time)/m_duration); | value = 1.0-(float(time)/m_duration); | ||||
m_item->setOpacity(value); | m_item->setOpacity(value); | ||||
if (m_item->type() == CanvasBoxType) | |||||
((CanvasBox*)m_item)->setShadowOpacity(value); | |||||
} | } | ||||
void CanvasFadeAnimation::updateState(QAbstractAnimation::State /*newState*/, QAbstractAnimation::State /*oldState*/) | void CanvasFadeAnimation::updateState(QAbstractAnimation::State /*newState*/, QAbstractAnimation::State /*oldState*/) | ||||
@@ -156,7 +156,7 @@ CanvasTestApp::CanvasTestApp(QWidget *parent) : | |||||
options.auto_hide_groups = false; | options.auto_hide_groups = false; | ||||
options.use_bezier_lines = true; | options.use_bezier_lines = true; | ||||
options.antialiasing = PatchCanvas::ANTIALIASING_SMALL; | options.antialiasing = PatchCanvas::ANTIALIASING_SMALL; | ||||
options.eyecandy = PatchCanvas::EYECANDY_FULL; | |||||
options.eyecandy = PatchCanvas::EYECANDY_SMALL; | |||||
options.theme_name = PatchCanvas::getDefaultThemeName(); | options.theme_name = PatchCanvas::getDefaultThemeName(); | ||||
PatchCanvas::features_t features; | PatchCanvas::features_t features; | ||||
@@ -128,6 +128,7 @@ void connectPorts(int connection_id, int port_out_id, int port_in_id); | |||||
void disconnectPorts(int connection_id); | void disconnectPorts(int connection_id); | ||||
void arrange(); | void arrange(); | ||||
void updateZValues(); | |||||
END_NAMESPACE_PATCHCANVAS | END_NAMESPACE_PATCHCANVAS | ||||
@@ -305,6 +305,15 @@ void addGroup(int group_id, QString group_name, SplitOption split, Icon icon) | |||||
if (canvas.debug) | if (canvas.debug) | ||||
qDebug("PatchCanvas::addGroup(%i, %s, %s, %s)", group_id, group_name.toUtf8().constData(), split2str(split), icon2str(icon)); | qDebug("PatchCanvas::addGroup(%i, %s, %s, %s)", group_id, group_name.toUtf8().constData(), split2str(split), icon2str(icon)); | ||||
foreach (const group_dict_t& group, canvas.group_list) | |||||
{ | |||||
if (group.group_id == group_id) | |||||
{ | |||||
qWarning("PatchCanvas::addGroup(%i, %s, %s, %s) - group already exists", group_id, group_name.toUtf8().constData(), split2str(split), icon2str(icon)); | |||||
return; | |||||
} | |||||
} | |||||
if (split == SPLIT_UNDEF && features.handle_group_pos) | if (split == SPLIT_UNDEF && features.handle_group_pos) | ||||
split = static_cast<SplitOption>(canvas.settings->value(QString("CanvasPositions/%1_SPLIT").arg(group_name), split).toInt()); | split = static_cast<SplitOption>(canvas.settings->value(QString("CanvasPositions/%1_SPLIT").arg(group_name), split).toInt()); | ||||
@@ -716,6 +725,15 @@ void addPort(int group_id, int port_id, QString port_name, PortMode port_mode, P | |||||
if (canvas.debug) | if (canvas.debug) | ||||
qDebug("PatchCanvas::addPort(%i, %i, %s, %s, %s)", group_id, port_id, port_name.toUtf8().constData(), port_mode2str(port_mode), port_type2str(port_type)); | qDebug("PatchCanvas::addPort(%i, %i, %s, %s, %s)", group_id, port_id, port_name.toUtf8().constData(), port_mode2str(port_mode), port_type2str(port_type)); | ||||
foreach (const port_dict_t& port, canvas.port_list) | |||||
{ | |||||
if (port.group_id == group_id and port.port_id == port_id) | |||||
{ | |||||
qWarning("PatchCanvas::addPort(%i, %i, %s, %s, %s) - port already exists" , group_id, port_id, port_name.toUtf8().constData(), port_mode2str(port_mode), port_type2str(port_type)); | |||||
return; | |||||
} | |||||
} | |||||
CanvasBox* box_widget = 0; | CanvasBox* box_widget = 0; | ||||
CanvasPort* port_widget = 0; | CanvasPort* port_widget = 0; | ||||
@@ -938,6 +956,21 @@ void arrange() | |||||
qDebug("PatchCanvas::Arrange()"); | qDebug("PatchCanvas::Arrange()"); | ||||
} | } | ||||
void updateZValues() | |||||
{ | |||||
if (canvas.debug) | |||||
qDebug("PatchCanvas::updateZValues()"); | |||||
foreach (const group_dict_t& group, canvas.group_list) | |||||
{ | |||||
group.widgets[0]->resetLinesZValue(); | |||||
if (group.split and group.widgets[1]) | |||||
group.widgets[1]->resetLinesZValue(); | |||||
} | |||||
} | |||||
/* Extra Internal functions */ | /* Extra Internal functions */ | ||||
QString CanvasGetGroupName(int group_id) | QString CanvasGetGroupName(int group_id) | ||||