init
This commit is contained in:
+80
@@ -0,0 +1,80 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomCount : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const size_t nSample = m_renderer->getSampleCount();
|
||||
const size_t historyIdx = m_renderer->getHistoryIndex();
|
||||
|
||||
|
||||
const size_t leftIdx1 = historyIdx - historyIdx % nSample;
|
||||
const size_t leftIdx2 = historyIdx;
|
||||
const size_t rightIdx1 = leftIdx2 - nSample;
|
||||
const size_t rightIdx2 = leftIdx1;
|
||||
|
||||
std::vector<double> range1 = splitRange(double(leftIdx1), double(leftIdx1 + nSample), 10);
|
||||
std::vector<double> range2 = splitRange(double(rightIdx1), double(rightIdx1 + nSample), 10);
|
||||
|
||||
gint w, h, x;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : range1)
|
||||
{
|
||||
if (i >= leftIdx1 && i < leftIdx2)
|
||||
{
|
||||
x = gint(((i - leftIdx1) / nSample) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
for (const auto& i : range2)
|
||||
{
|
||||
if (i >= rightIdx1 && i < rightIdx2)
|
||||
{
|
||||
x = gint(((i + nSample - leftIdx1) / nSample) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomERPCount : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const size_t nSample = m_renderer->getSampleCount();
|
||||
const double duration = nSample * 1.;
|
||||
|
||||
std::vector<double> range = splitRange(0, duration, 10);
|
||||
|
||||
gint w, h;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : range)
|
||||
{
|
||||
const gint x = gint((i / duration) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomERPTime : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const size_t nSample = m_renderer->getSampleCount();
|
||||
const uint64_t sampleDuration = m_rendererCtx->getSampleDuration();
|
||||
const double duration = double((nSample * sampleDuration) >> 16) / 65536.;
|
||||
|
||||
std::vector<double> range = splitRange(0, duration, 10);
|
||||
|
||||
gint w, h;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : range)
|
||||
{
|
||||
const gint x = gint((i / duration) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomFrequency : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
const auto scale = float(m_rendererCtx->getSpectrumFrequencyRange());
|
||||
if (m_lastScale != scale)
|
||||
{
|
||||
m_range = splitRange(0, scale);
|
||||
m_lastScale = scale;
|
||||
}
|
||||
|
||||
gint w, h;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : m_range)
|
||||
{
|
||||
const gint x = gint((i / scale) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
|
||||
protected:
|
||||
float m_lastScale = 0;
|
||||
std::vector<double> m_range;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomPercent : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
gint w, h;
|
||||
gint lw, lh;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (int i = 0; i <= 10; i += 2)
|
||||
{
|
||||
const gint x = (i * (w - 1)) / 10;
|
||||
const std::string label = (std::to_string(i * 10) + "%");
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, label.c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
gdk_draw_layout(widget->window, drawGC, x, 4, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mCRulerTexture.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomTexture : public CRulerTexture
|
||||
{
|
||||
public:
|
||||
|
||||
void render() override
|
||||
|
||||
{
|
||||
this->preRender();
|
||||
|
||||
glColor4f(0, 0, 0, m_blackAlpha);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord1f(0);
|
||||
glVertex2f(0, 0.00F);
|
||||
glVertex2f(0, 0.05F);
|
||||
glTexCoord1f(1);
|
||||
glVertex2f(1, 0.05F);
|
||||
glVertex2f(1, 0.00F);
|
||||
glEnd();
|
||||
|
||||
glColor4f(1, 1, 1, m_whiteAlpha);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord1f(0);
|
||||
glVertex2f(0, 0.00F);
|
||||
glVertex2f(0, 0.04F);
|
||||
glTexCoord1f(1);
|
||||
glVertex2f(1, 0.04F);
|
||||
glVertex2f(1, 0.00F);
|
||||
glEnd();
|
||||
|
||||
this->postRender();
|
||||
}
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
const float scale = 1.F / m_rendererCtx->getScale();
|
||||
if (m_lastScale != scale)
|
||||
{
|
||||
m_range = splitRange(-scale * .5, scale * .5);
|
||||
m_lastScale = scale;
|
||||
}
|
||||
|
||||
gint w, h;
|
||||
gint lw, lh;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : m_range)
|
||||
{
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
gdk_draw_layout(widget->window, drawGC, gint((.5 + i / scale) * w - lw * .5), 0, layout);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
|
||||
protected:
|
||||
float m_lastScale = 0;
|
||||
std::vector<double> m_range;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerBottomTime : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const size_t nSample = m_renderer->getSampleCount();
|
||||
const size_t historyIdx = m_renderer->getHistoryIndex();
|
||||
const uint64_t sampleDuration = m_rendererCtx->getSampleDuration();
|
||||
|
||||
const size_t leftIdx = historyIdx - historyIdx % nSample;
|
||||
const size_t midIdx = historyIdx;
|
||||
double startTime = double((leftIdx * sampleDuration) >> 16) / 65536.;
|
||||
double midTime = double((midIdx * sampleDuration) >> 16) / 65536.;
|
||||
const double duration = double((nSample * sampleDuration) >> 16) / 65536.;
|
||||
|
||||
const double offset = (m_renderer->getTimeOffset() >> 16) / 65536.;
|
||||
startTime += offset;
|
||||
midTime += offset;
|
||||
|
||||
std::vector<double> range1 = this->splitRange(startTime - duration, startTime, 10);
|
||||
std::vector<double> range2 = this->splitRange(startTime, startTime + duration, 10);
|
||||
|
||||
gint w, h, x;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : range1)
|
||||
{
|
||||
if (i >= 0 && i + duration > midTime)
|
||||
{
|
||||
x = gint(((i + duration - startTime) / duration) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
for (const auto& i : range2)
|
||||
{
|
||||
if (i >= 0 && i < midTime)
|
||||
{
|
||||
x = gint(((i - startTime) / duration) * w);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, x, 5, layout);
|
||||
gdk_draw_line(widget->window, drawGC, x, 0, x, 3);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerConditionIsTimeLocked : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
CRulerConditionIsTimeLocked() : m_rendererCtx(nullptr), m_renderer(nullptr) { }
|
||||
|
||||
void setRendererContext(const CRendererContext* ctx) override { m_rendererCtx = ctx; }
|
||||
void setRenderer(const IRenderer* renderer) override { m_renderer = renderer; }
|
||||
|
||||
bool operator()() const { return m_rendererCtx->isTimeLocked(); }
|
||||
|
||||
protected:
|
||||
const CRendererContext* m_rendererCtx;
|
||||
const IRenderer* m_renderer;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerERPProgress : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void render() override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const float progress = m_rendererCtx->getERPFraction();
|
||||
if (progress != 0 && progress != 1)
|
||||
{
|
||||
glDisable(GL_TEXTURE_1D);
|
||||
|
||||
glLineWidth(4);
|
||||
glColor3f(0, 0, 0);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(progress, 0);
|
||||
glVertex2f(progress, 1);
|
||||
glEnd();
|
||||
|
||||
glLineWidth(2);
|
||||
glColor3f(0.25, 1, 0.25);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(progress, 0);
|
||||
glVertex2f(progress, 1);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerLeftChannelNames : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderLeft(GtkWidget* widget) override
|
||||
{
|
||||
gint w, h, lw, lh;
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (size_t i = 0; i < m_rendererCtx->getSelectedCount(); ++i)
|
||||
{
|
||||
const size_t idx = m_rendererCtx->getSelected(i);
|
||||
const std::string label = (m_rendererCtx->getChannelName(idx) + " (" + std::to_string(idx + 1) + ")");
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, label.c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
gdk_draw_layout(widget->window, drawGC, w - lw, gint(((i + 0.5) * h) / m_rendererCtx->getSelectedCount() - float(lh) / 2), layout);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mCRulerTexture.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerLeftTexture : public CRulerTexture
|
||||
{
|
||||
public:
|
||||
|
||||
void render() override
|
||||
|
||||
{
|
||||
this->preRender();
|
||||
|
||||
glColor4f(0, 0, 0, m_blackAlpha);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord1f(0);
|
||||
glVertex2f(0.00F, 0);
|
||||
glVertex2f(0.05F, 0);
|
||||
glTexCoord1f(1);
|
||||
glVertex2f(0.05F, 1);
|
||||
glVertex2f(0.00F, 1);
|
||||
glEnd();
|
||||
|
||||
glColor4f(1, 1, 1, m_whiteAlpha);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord1f(0);
|
||||
glVertex2f(0.00F, 0);
|
||||
glVertex2f(0.04F, 0);
|
||||
glTexCoord1f(1);
|
||||
glVertex2f(0.04F, 1);
|
||||
glVertex2f(0.00F, 1);
|
||||
glEnd();
|
||||
|
||||
this->postRender();
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerProgress : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void renderFinal(const float progress) = 0;
|
||||
|
||||
void render() override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const size_t nSample = m_renderer->getSampleCount();
|
||||
const size_t historyIdx = m_renderer->getHistoryIndex();
|
||||
|
||||
const float progress = float(historyIdx - (float(historyIdx) / nSample) * nSample) / nSample;
|
||||
if (progress != 0 && progress != 1) { this->renderFinal(progress); }
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mCRulerProgress.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerProgressH : public CRulerProgress
|
||||
{
|
||||
public:
|
||||
|
||||
void renderFinal(const float progress) override
|
||||
{
|
||||
const size_t selectedCount = m_rendererCtx->getSelectedCount();
|
||||
glDisable(GL_TEXTURE_1D);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glLineWidth(4);
|
||||
glColor3f(0, 0, 0);
|
||||
glBegin(GL_LINES);
|
||||
for (size_t i = 0; i < selectedCount; ++i)
|
||||
{
|
||||
glVertex2f(0, (i + progress) / selectedCount);
|
||||
glVertex2f(1, (i + progress) / selectedCount);
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glLineWidth(2);
|
||||
glColor3f(0.25, 1, 0.25);
|
||||
glBegin(GL_LINES);
|
||||
for (size_t i = 0; i < selectedCount; ++i)
|
||||
{
|
||||
glVertex2f(0, (i + progress) / selectedCount);
|
||||
glVertex2f(1, (i + progress) / selectedCount);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mCRulerProgress.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerProgressV : public CRulerProgress
|
||||
{
|
||||
public:
|
||||
|
||||
void renderFinal(const float progress) override
|
||||
{
|
||||
glDisable(GL_TEXTURE_1D);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glLineWidth(4);
|
||||
glColor3f(0, 0, 0);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(progress, 0);
|
||||
glVertex2f(progress, 1);
|
||||
glEnd();
|
||||
|
||||
glLineWidth(2);
|
||||
glColor3f(0.25, 1, 0.25);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(progress, 0);
|
||||
glVertex2f(progress, 1);
|
||||
glEnd();
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerRightCount : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
if (m_renderer == nullptr) { return; }
|
||||
if (m_renderer->getSampleCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryCount() == 0) { return; }
|
||||
if (m_renderer->getHistoryIndex() == 0) { return; }
|
||||
|
||||
const size_t nSample = m_renderer->getSampleCount();
|
||||
const size_t historyIdx = m_renderer->getHistoryIndex();
|
||||
|
||||
const size_t leftIdx1 = historyIdx - historyIdx % nSample;
|
||||
const size_t leftIdx2 = historyIdx;
|
||||
const size_t rightIdx1 = leftIdx2 - nSample;
|
||||
const size_t rightIdx2 = leftIdx1;
|
||||
|
||||
std::vector<double> range1 = splitRange(double(leftIdx1), double(leftIdx1 + nSample), 10);
|
||||
std::vector<double> range2 = splitRange(double(rightIdx1), double(rightIdx1 + nSample), 10);
|
||||
|
||||
gint w, h, y;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
|
||||
for (const auto& i : range1)
|
||||
{
|
||||
if (i >= leftIdx1 && i < leftIdx2)
|
||||
{
|
||||
y = gint(((i - leftIdx1) / nSample) * h);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, 5, y, layout);
|
||||
gdk_draw_line(widget->window, drawGC, 0, y, 3, y);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
for (const auto& i : range2)
|
||||
{
|
||||
if (i >= rightIdx1 && i < rightIdx2)
|
||||
{
|
||||
y = gint(((i + nSample - leftIdx1) / nSample) * h);
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
gdk_draw_layout(widget->window, drawGC, 5, y, layout);
|
||||
gdk_draw_line(widget->window, drawGC, 0, y, 3, y);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerRightFrequency : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
const auto scale = float(m_rendererCtx->getSpectrumFrequencyRange());
|
||||
if (m_lastScale != scale)
|
||||
{
|
||||
m_range = splitRange(0, scale);
|
||||
m_lastScale = scale;
|
||||
}
|
||||
|
||||
gint w, h;
|
||||
gint lw, lh;
|
||||
|
||||
const size_t nChannel = m_rendererCtx->getSelectedCount();
|
||||
for (size_t i = 0; i < nChannel; ++i)
|
||||
{
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& r : m_range)
|
||||
{
|
||||
const gint y = gint((i + r / scale) * (h * 1.F / nChannel));
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(r).c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
gdk_draw_layout(widget->window, drawGC, 8, h - y - lh / 2, layout);
|
||||
gdk_draw_line(widget->window, drawGC, 0, h - y, 3, h - y);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
float m_lastScale = 1;
|
||||
std::vector<double> m_range;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
template <size_t TDim>
|
||||
class CRulerRightLabels : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
gint w, h, lw, lh;
|
||||
|
||||
const size_t nChannel = m_rendererCtx->getSelectedCount();
|
||||
for (size_t channel = 0; channel < nChannel; ++channel)
|
||||
{
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
|
||||
const auto labelCount = float(m_rendererCtx->getDimensionLabelCount(TDim));
|
||||
|
||||
gint lastY = gint((channel + (-1 + 0.5F) / labelCount) * (h * 1.F / nChannel));
|
||||
|
||||
for (size_t label = 0; label < m_rendererCtx->getDimensionLabelCount(TDim); ++label)
|
||||
{
|
||||
const gint y = gint((channel + (label + 0.5F) / labelCount) * (h * 1.F / nChannel));
|
||||
if (y >= lastY + 10)
|
||||
{
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, m_rendererCtx->getDimensionLabel(TDim, label));
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
gdk_draw_layout(widget->window, drawGC, 8, h - y - lh / 2, layout);
|
||||
gdk_draw_line(widget->window, drawGC, 0, h - y, 3, h - y);
|
||||
g_object_unref(layout);
|
||||
lastY = y;
|
||||
}
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerRightMonoScale : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
CRulerRightMonoScale() : m_lastScale(-1) { }
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
const float scale = 1.F / m_rendererCtx->getScale();
|
||||
if (m_lastScale != scale)
|
||||
{
|
||||
if (m_rendererCtx->isPositiveOnly()) { m_range = splitRange(0, scale, IRuler_SplitCount); }
|
||||
else { m_range = splitRange(-scale * .5, scale * .5, IRuler_SplitCount); }
|
||||
m_lastScale = scale;
|
||||
}
|
||||
|
||||
const float offset = m_rendererCtx->isPositiveOnly() ? 0 : 0.5F;
|
||||
|
||||
gint w, h, lw, lh;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : m_range)
|
||||
{
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
const gint y = gint((1 - (offset + i / scale)) * h);
|
||||
gdk_draw_layout(widget->window, drawGC, 8, y - lh / 2, layout);
|
||||
gdk_draw_line(widget->window, drawGC, 0, y, 3, y);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
|
||||
protected:
|
||||
float m_lastScale = 1;
|
||||
std::vector<double> m_range;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerRightScale : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
CRulerRightScale() : m_lastScale(-1) { }
|
||||
|
||||
void renderRight(GtkWidget* pWidget) override
|
||||
{
|
||||
const size_t nSelected = m_rendererCtx->getSelectedCount();
|
||||
if (!nSelected) { return; }
|
||||
|
||||
const float scale = 1.F / m_rendererCtx->getScale();
|
||||
if (m_lastScale != scale)
|
||||
{
|
||||
if (m_rendererCtx->isPositiveOnly()) { m_range = splitRange(0, scale, IRuler_SplitCount); }
|
||||
else { m_range = splitRange(-scale * .5, scale * .5, IRuler_SplitCount); }
|
||||
m_lastScale = scale;
|
||||
}
|
||||
|
||||
const float offset = m_rendererCtx->isPositiveOnly() ? 0.0F : 0.5F;
|
||||
|
||||
gint w, h, lw, lh;
|
||||
|
||||
gdk_drawable_get_size(pWidget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(pWidget->window);
|
||||
for (size_t i = 0; i < m_rendererCtx->getSelectedCount(); ++i)
|
||||
{
|
||||
for (const auto& j : m_range)
|
||||
{
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(pWidget, getLabel(j).c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
const gint y = gint((1 - (float(i) + offset + j / scale) / nSelected) * h);
|
||||
gdk_draw_layout(pWidget->window, drawGC, 8, y - lh / 2, layout);
|
||||
gdk_draw_line(pWidget->window, drawGC, 0, y, 3, y);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
|
||||
protected:
|
||||
float m_lastScale = 1;
|
||||
std::vector<double> m_range;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mCRulerTexture.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerRightTexture : public CRulerTexture
|
||||
{
|
||||
public:
|
||||
|
||||
CRulerRightTexture() : m_lastScale(-1) { }
|
||||
|
||||
void render() override
|
||||
{
|
||||
this->preRender();
|
||||
|
||||
glColor4f(0, 0, 0, m_blackAlpha);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord1f(0);
|
||||
glVertex2f(0.95F, 0);
|
||||
glVertex2f(1.00F, 0);
|
||||
glTexCoord1f(1);
|
||||
glVertex2f(1.00F, 1);
|
||||
glVertex2f(0.95F, 1);
|
||||
glEnd();
|
||||
|
||||
glColor4f(1, 1, 1, m_whiteAlpha);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord1f(0);
|
||||
glVertex2f(0.96F, 0);
|
||||
glVertex2f(1.00F, 0);
|
||||
glTexCoord1f(1);
|
||||
glVertex2f(1.00F, 1);
|
||||
glVertex2f(0.96F, 1);
|
||||
glEnd();
|
||||
|
||||
this->postRender();
|
||||
}
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
const float scale = 1.F / m_rendererCtx->getScale();
|
||||
if (m_lastScale != scale)
|
||||
{
|
||||
m_range = this->splitRange(-scale * .5, scale * .5);
|
||||
m_lastScale = scale;
|
||||
}
|
||||
|
||||
gint w, h, lw, lh;
|
||||
|
||||
gdk_drawable_get_size(widget->window, &w, &h);
|
||||
GdkGC* drawGC = gdk_gc_new(widget->window);
|
||||
for (const auto& i : m_range)
|
||||
{
|
||||
PangoLayout* layout = gtk_widget_create_pango_layout(widget, getLabel(i).c_str());
|
||||
pango_layout_get_size(layout, &lw, &lh);
|
||||
lw /= PANGO_SCALE;
|
||||
lh /= PANGO_SCALE;
|
||||
gdk_draw_layout(widget->window, drawGC, 0, gint((.5 - i / scale) * h - lh * .5), layout);
|
||||
g_object_unref(layout);
|
||||
}
|
||||
g_object_unref(drawGC);
|
||||
}
|
||||
|
||||
protected:
|
||||
float m_lastScale;
|
||||
std::vector<double> m_range;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
class CRulerTexture : public IRuler
|
||||
{
|
||||
protected:
|
||||
|
||||
virtual void preRender()
|
||||
|
||||
{
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_TEXTURE_1D);
|
||||
glColor3f(1, 1, 1);
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
virtual void postRender()
|
||||
|
||||
{
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
#include "../m_VisualizationTools.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
template <class TRulerMatrix, class TRulerSignal, class TRulerSpectrum>
|
||||
class TRulerAutoType : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void setRendererContext(const CRendererContext* ctx) override
|
||||
{
|
||||
IRuler::setRendererContext(ctx);
|
||||
m_rulerSignal.setRendererContext(ctx);
|
||||
m_rulerSpectrum.setRendererContext(ctx);
|
||||
m_rulerMatrix.setRendererContext(ctx);
|
||||
}
|
||||
|
||||
void setRenderer(const IRenderer* renderer) override
|
||||
{
|
||||
IRuler::setRenderer(renderer);
|
||||
m_rulerSignal.setRenderer(renderer);
|
||||
m_rulerSpectrum.setRenderer(renderer);
|
||||
m_rulerMatrix.setRenderer(renderer);
|
||||
}
|
||||
|
||||
void render() override
|
||||
{
|
||||
const CRendererContext::EDataType dataType = m_rendererCtx->getDataType();
|
||||
if (dataType == CRendererContext::EDataType::Signal) { m_rulerSignal.doRender(); }
|
||||
else if (dataType == CRendererContext::EDataType::Spectrum) { m_rulerSpectrum.doRender(); }
|
||||
else { m_rulerMatrix.doRender(); }
|
||||
}
|
||||
|
||||
void renderLeft(GtkWidget* widget) override
|
||||
{
|
||||
const CRendererContext::EDataType dataType = m_rendererCtx->getDataType();
|
||||
if (dataType == CRendererContext::EDataType::Signal) { m_rulerSignal.doRenderLeft(widget); }
|
||||
else if (dataType == CRendererContext::EDataType::Spectrum) { m_rulerSpectrum.doRenderLeft(widget); }
|
||||
else { m_rulerMatrix.doRenderLeft(widget); }
|
||||
}
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
const CRendererContext::EDataType dataType = m_rendererCtx->getDataType();
|
||||
if (dataType == CRendererContext::EDataType::Signal) { m_rulerSignal.doRenderRight(widget); }
|
||||
else if (dataType == CRendererContext::EDataType::Spectrum) { m_rulerSpectrum.doRenderRight(widget); }
|
||||
else { m_rulerMatrix.doRenderRight(widget); }
|
||||
}
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
const CRendererContext::EDataType dataType = m_rendererCtx->getDataType();
|
||||
|
||||
if (dataType == CRendererContext::EDataType::Signal) { m_rulerSignal.doRenderBottom(widget); }
|
||||
else if (dataType == CRendererContext::EDataType::Spectrum) { m_rulerSpectrum.doRenderBottom(widget); }
|
||||
else { m_rulerMatrix.doRenderBottom(widget); }
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
TRulerMatrix m_rulerMatrix;
|
||||
TRulerSignal m_rulerSignal;
|
||||
TRulerSpectrum m_rulerSpectrum;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
template <class T1, class T2, class TCondition>
|
||||
class TRulerConditionalPair : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void setRendererContext(const CRendererContext* ctx) override
|
||||
{
|
||||
IRuler::setRendererContext(ctx);
|
||||
condition.setRendererContext(ctx);
|
||||
first.setRendererContext(ctx);
|
||||
second.setRendererContext(ctx);
|
||||
}
|
||||
|
||||
void setRenderer(const IRenderer* renderer) override
|
||||
{
|
||||
IRuler::setRenderer(renderer);
|
||||
condition.setRenderer(renderer);
|
||||
first.setRenderer(renderer);
|
||||
second.setRenderer(renderer);
|
||||
}
|
||||
|
||||
void render() override { condition() ? first.doRender() : second.doRender(); }
|
||||
void renderLeft(GtkWidget* widget) override { condition() ? first.doRenderLeft(widget) : second.doRenderLeft(widget); }
|
||||
void renderRight(GtkWidget* widget) override { condition() ? first.doRenderRight(widget) : second.doRenderRight(widget); }
|
||||
void renderBottom(GtkWidget* widget) override { condition() ? first.doRenderBottom(widget) : second.doRenderBottom(widget); }
|
||||
|
||||
TCondition condition;
|
||||
T1 first;
|
||||
T2 second;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*********************************************************************
|
||||
* Software License Agreement (AGPL-3 License)
|
||||
*
|
||||
* OpenViBE Designer
|
||||
* Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
|
||||
* Copyright (C) Inria, 2015-2017,V1.0
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../mIRuler.hpp"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace AdvancedVisualization {
|
||||
template <class T1, class T2>
|
||||
class TRulerPair : public IRuler
|
||||
{
|
||||
public:
|
||||
|
||||
void setRendererContext(const CRendererContext* ctx) override
|
||||
{
|
||||
IRuler::setRendererContext(ctx);
|
||||
first.setRendererContext(ctx);
|
||||
second.setRendererContext(ctx);
|
||||
}
|
||||
|
||||
void setRenderer(const IRenderer* renderer) override
|
||||
{
|
||||
IRuler::setRenderer(renderer);
|
||||
first.setRenderer(renderer);
|
||||
second.setRenderer(renderer);
|
||||
}
|
||||
|
||||
void render() override
|
||||
{
|
||||
first.doRender();
|
||||
second.doRender();
|
||||
}
|
||||
|
||||
void renderLeft(GtkWidget* widget) override
|
||||
{
|
||||
first.doRenderLeft(widget);
|
||||
second.doRenderLeft(widget);
|
||||
}
|
||||
|
||||
void renderRight(GtkWidget* widget) override
|
||||
{
|
||||
first.doRenderRight(widget);
|
||||
second.doRenderRight(widget);
|
||||
}
|
||||
|
||||
void renderBottom(GtkWidget* widget) override
|
||||
{
|
||||
first.doRenderBottom(widget);
|
||||
second.doRenderBottom(widget);
|
||||
}
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
};
|
||||
} // namespace AdvancedVisualization
|
||||
} // namespace OpenViBE
|
||||
Reference in New Issue
Block a user