Dateien hochladen nach „src/TactileVisualization“
This commit is contained in:
parent
a4b9a30d83
commit
c6d41a2377
@ -12,84 +12,39 @@
|
|||||||
//includes
|
//includes
|
||||||
#include "TactileMenu.h"
|
#include "TactileMenu.h"
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace OpenViBE {
|
namespace OpenViBE {
|
||||||
namespace Plugins {
|
namespace Plugins {
|
||||||
namespace Tactilebci {
|
namespace Tactilebci {
|
||||||
|
|
||||||
//TactileMenu Memberfunctions
|
//TactileMenu Memberfunctions
|
||||||
TactileMenu::TactileMenu(char* label0, char* label1, char* label2, char* label3, char* label4, char* label5)
|
TactileMenu::TactileMenu(int n_Tactilos)
|
||||||
{
|
{
|
||||||
m_LabelText[0] = label0;
|
for(int i = 1; i <= n_Tactilos; i++)
|
||||||
m_LabelText[1] = label1;
|
|
||||||
m_LabelText[2] = label2;
|
|
||||||
m_LabelText[3] = label3;
|
|
||||||
m_LabelText[4] = label4;
|
|
||||||
m_LabelText[5] = label5;
|
|
||||||
|
|
||||||
m_MainInterface = nullptr;
|
|
||||||
|
|
||||||
for(int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
m_SubMenu[i] = this;
|
|
||||||
m_SubRoutine[i] = nullptr;
|
|
||||||
m_Label[i] = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TactileMenu::call_SubRoutine(int i)
|
|
||||||
{
|
|
||||||
if(m_SubRoutine[i] != nullptr)
|
|
||||||
{
|
{
|
||||||
(*m_SubRoutine[i])();
|
m_LabelText.push_back("Tactilo" + std::to_string(i));
|
||||||
|
m_SubMenu.push_back(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* TactileMenu::get_LabelText(int i)
|
void TactileMenu::set_LabelText(int i, std::string Text)
|
||||||
{
|
{
|
||||||
return(m_LabelText[i]);
|
m_LabelText[i] = Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TactileMenu::set_SubMenu(int i, TactileMenu* Menu)
|
||||||
|
{
|
||||||
|
m_SubMenu[i] = Menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string TactileMenu::get_LabelText(int i)
|
||||||
|
{
|
||||||
|
return(m_LabelText[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TactileMenu* TactileMenu::get_SubMenu(int i)
|
TactileMenu* TactileMenu::get_SubMenu(int i)
|
||||||
{
|
{
|
||||||
return(m_SubMenu[i]);
|
return(m_SubMenu[i]);
|
||||||
}
|
|
||||||
|
|
||||||
void TactileMenu::set_SubRoutine(int i, void(*subroutine)(void))
|
|
||||||
{
|
|
||||||
m_SubRoutine[i] = subroutine;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TactileMenu::set_SubMenu(int i, TactileMenu* submenu)
|
|
||||||
{
|
|
||||||
m_SubMenu[i] = submenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TactileMenu::reloadui(void)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
gtk_label_set_text(m_Label[i], m_LabelText[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TactileMenu::init_Labels(GtkBuilder* maininterface)
|
|
||||||
{
|
|
||||||
m_MainInterface = maininterface;
|
|
||||||
|
|
||||||
m_Label[0] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-1"));
|
|
||||||
m_Label[1] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-2"));
|
|
||||||
m_Label[2] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-3"));
|
|
||||||
m_Label[3] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-4"));
|
|
||||||
m_Label[4] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-5"));
|
|
||||||
m_Label[5] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-6"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Subroutine Functions
|
|
||||||
void dummysubroutine(void)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Tactilebci
|
} // namespace Tactilebci
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
/// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
|
/// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
|
||||||
///
|
///
|
||||||
///-------------------------------------------------------------------------------------------------
|
///-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
//includes
|
//includes
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -18,6 +17,9 @@
|
|||||||
#include <openvibe/ov_all.h>
|
#include <openvibe/ov_all.h>
|
||||||
#include <toolkit/ovtk_all.h>
|
#include <toolkit/ovtk_all.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace OpenViBE {
|
namespace OpenViBE {
|
||||||
namespace Plugins {
|
namespace Plugins {
|
||||||
namespace Tactilebci {
|
namespace Tactilebci {
|
||||||
@ -26,29 +28,19 @@ namespace Tactilebci {
|
|||||||
class TactileMenu
|
class TactileMenu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
char* m_LabelText[6];
|
std::vector<std::string> m_LabelText;
|
||||||
TactileMenu* m_SubMenu[6];
|
std::vector<TactileMenu*> m_SubMenu;
|
||||||
void (*m_SubRoutine[6])(void);
|
|
||||||
GtkLabel* m_Label[6];
|
|
||||||
GtkBuilder* m_MainInterface;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TactileMenu(char* label0, char* label1, char* label2, char* label3, char* label4, char* label5);
|
TactileMenu(int n_Tactilos);
|
||||||
void call_SubRoutine(int i);
|
|
||||||
char* get_LabelText(int i);
|
std::string get_LabelText(int i);
|
||||||
TactileMenu* get_SubMenu(int i);
|
TactileMenu* get_SubMenu(int i);
|
||||||
|
|
||||||
void set_SubRoutine(int i, void(*subroutine)(void));
|
void set_LabelText(int i, std::string Text);
|
||||||
void set_SubMenu(int i, TactileMenu* submenu);
|
void set_SubMenu(int i, TactileMenu* Menu);
|
||||||
|
|
||||||
void init_Labels(GtkBuilder* maininterface);
|
|
||||||
void reloadui(void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//Subroutine declarations
|
|
||||||
void dummysubroutine(void);
|
|
||||||
|
|
||||||
} // namespace Tactilebci
|
} // namespace Tactilebci
|
||||||
} // namespace Plugins
|
} // namespace Plugins
|
||||||
} // namespace OpenViBE
|
} // namespace OpenViBE
|
@ -66,6 +66,8 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
|
|||||||
m_selectedBgColor = CGdkcolorAutoCast(boxContext, this->getConfigurationManager(), 12);
|
m_selectedBgColor = CGdkcolorAutoCast(boxContext, this->getConfigurationManager(), 12);
|
||||||
m_selectedFgColor = CGdkcolorAutoCast(boxContext, this->getConfigurationManager(), 13);
|
m_selectedFgColor = CGdkcolorAutoCast(boxContext, this->getConfigurationManager(), 13);
|
||||||
m_selectedFontSize = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 14);
|
m_selectedFontSize = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 14);
|
||||||
|
|
||||||
|
m_nTactilos = FSettingValueAutoCast(*this->getBoxAlgorithmContext(), 15);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -129,39 +131,65 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
|
|||||||
m_result = GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, "label-result"));
|
m_result = GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, "label-result"));
|
||||||
m_target = GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, "label-target"));
|
m_target = GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, "label-target"));
|
||||||
|
|
||||||
//Begin TactileMenu Initialization -------------------------------------------------------------------------------------
|
//Begin Menu Initialization -------------------------------------------------------------------------------------
|
||||||
//Create Menus
|
if(m_nTactilos == 6) //Create Menus for m_nTactilos = 6
|
||||||
m_MainMenu = new TactileMenu("Ja", "Nein", "Pflege", "Hilfe", "Geräte", "Funktionen");
|
{
|
||||||
m_CareMenu = new TactileMenu("Ja", "Nein", "Hunger", "Lage", "Müdigkeit", "Hauptmenü");
|
m_Menu.push_back(TactileMenu(6));
|
||||||
m_HelpMenu = new TactileMenu("Ja", "Nein", "Schmerzen", "Atemnot", "Anderes", "Hauptmenü");
|
m_Menu[0].set_LabelText(0, "Ja");
|
||||||
m_DevicesMenu = new TactileMenu("Ja", "Nein", "Atemgerät", "Rollstuhl", "Computer", "Hauptmenü");
|
m_Menu[0].set_LabelText(1, "Nein");
|
||||||
m_FunctionsMenu = new TactileMenu("Ja", "Nein", "befehl1", "befehl2", "befehl3", "Hauptmenü");
|
m_Menu[0].set_LabelText(2, "Pflege");
|
||||||
|
m_Menu[0].set_LabelText(3, "Hilfe");
|
||||||
//Initialize MainMenu
|
m_Menu[0].set_LabelText(4, "Geräte");
|
||||||
m_MainMenu->init_Labels(m_mainWidgetInterface);
|
m_Menu[0].set_LabelText(5, "Funktionen");
|
||||||
m_MainMenu->set_SubMenu(2, m_CareMenu);
|
m_Menu[0].set_SubMenu(2, &m_Menu[1]);
|
||||||
m_MainMenu->set_SubMenu(3, m_HelpMenu);
|
m_Menu[0].set_SubMenu(3, &m_Menu[2]);
|
||||||
m_MainMenu->set_SubMenu(4, m_DevicesMenu);
|
m_Menu[0].set_SubMenu(4, &m_Menu[3]);
|
||||||
m_MainMenu->set_SubMenu(5, m_FunctionsMenu);
|
|
||||||
//Initialize CareMenu
|
|
||||||
m_CareMenu->init_Labels(m_mainWidgetInterface);
|
|
||||||
m_CareMenu->set_SubMenu(5, m_MainMenu);
|
|
||||||
//Initialize HelpMenu
|
|
||||||
m_HelpMenu->init_Labels(m_mainWidgetInterface);
|
|
||||||
m_HelpMenu->set_SubMenu(5, m_MainMenu);
|
|
||||||
//Initialize DevicesMenu
|
|
||||||
m_DevicesMenu->init_Labels(m_mainWidgetInterface);
|
|
||||||
m_DevicesMenu->set_SubMenu(5, m_MainMenu);
|
|
||||||
//Initialize FunctionsMenu
|
|
||||||
m_FunctionsMenu->init_Labels(m_mainWidgetInterface);
|
|
||||||
m_FunctionsMenu->set_SubMenu(5, m_MainMenu);
|
|
||||||
|
|
||||||
//Set Pointer to active Menu
|
|
||||||
//Load MenuLabels
|
|
||||||
m_CurrentMenu = m_MainMenu;
|
|
||||||
m_CurrentMenu->reloadui();
|
|
||||||
|
|
||||||
//End TactileMenu Initialization ---------------------------------------------------------------------------------------
|
m_Menu.push_back(TactileMenu(6));
|
||||||
|
m_Menu[1].set_LabelText(0, "Ja");
|
||||||
|
m_Menu[1].set_LabelText(1, "Nein");
|
||||||
|
m_Menu[1].set_LabelText(2, "Hunger");
|
||||||
|
m_Menu[1].set_LabelText(3, "Lage");
|
||||||
|
m_Menu[1].set_LabelText(4, "Müdigkeit");
|
||||||
|
m_Menu[1].set_LabelText(5, "Hauptmenü");
|
||||||
|
m_Menu[0].set_SubMenu(5, &m_Menu[0]);
|
||||||
|
|
||||||
|
m_Menu.push_back(TactileMenu(6));
|
||||||
|
m_Menu[2].set_LabelText(0, "Ja");
|
||||||
|
m_Menu[2].set_LabelText(1, "Nein");
|
||||||
|
m_Menu[2].set_LabelText(2, "Schmerzen");
|
||||||
|
m_Menu[2].set_LabelText(3, "Atemnot");
|
||||||
|
m_Menu[2].set_LabelText(4, "Anderes");
|
||||||
|
m_Menu[2].set_LabelText(5, "Hauptmenü");
|
||||||
|
m_Menu[0].set_SubMenu(5, &m_Menu[0]);
|
||||||
|
|
||||||
|
m_Menu.push_back(TactileMenu(6));
|
||||||
|
m_Menu[3].set_LabelText(0, "Ja");
|
||||||
|
m_Menu[3].set_LabelText(1, "Nein");
|
||||||
|
m_Menu[3].set_LabelText(2, "Atemgerät");
|
||||||
|
m_Menu[3].set_LabelText(3, "Rollstuhl");
|
||||||
|
m_Menu[3].set_LabelText(4, "Computer");
|
||||||
|
m_Menu[3].set_LabelText(5, "Hauptmenü");
|
||||||
|
m_Menu[0].set_SubMenu(5, &m_Menu[0]);
|
||||||
|
|
||||||
|
//Set Pointer to Mainmenu
|
||||||
|
m_currMenu = &m_Menu[0];
|
||||||
|
|
||||||
|
//Init Gtk Labels
|
||||||
|
for(int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
std::string label_id = "label-" + std::to_string(i+1);
|
||||||
|
std::string label_text = m_currMenu->get_LabelText(i);
|
||||||
|
m_Label.push_back(GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, label_id.c_str())));
|
||||||
|
gtk_label_set_text(m_Label[i], label_text.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//End Menu Initialization ---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
gtk_builder_connect_signals(m_mainWidgetInterface, nullptr);
|
gtk_builder_connect_signals(m_mainWidgetInterface, nullptr);
|
||||||
gtk_builder_connect_signals(m_toolbarWidgetInterface, nullptr);
|
gtk_builder_connect_signals(m_toolbarWidgetInterface, nullptr);
|
||||||
|
|
||||||
@ -231,15 +259,7 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CBoxAlgorithmP300TactileVisualization::uninitialize()
|
bool CBoxAlgorithmP300TactileVisualization::uninitialize()
|
||||||
{
|
{
|
||||||
//Begin Uninitialize TactileMenu -----------------------------------------------------------------------
|
|
||||||
delete m_MainMenu;
|
|
||||||
delete m_CareMenu;
|
|
||||||
delete m_HelpMenu;
|
|
||||||
delete m_DevicesMenu;
|
|
||||||
delete m_FunctionsMenu;
|
|
||||||
//End Uninitialize TactileMenu -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if (m_idleFuncTag)
|
if (m_idleFuncTag)
|
||||||
{
|
{
|
||||||
m_stimuliQueue.clear();
|
m_stimuliQueue.clear();
|
||||||
@ -634,10 +654,13 @@ bool CBoxAlgorithmP300TactileVisualization::process()
|
|||||||
this->getLogManager() << Kernel::LogLevel_Warning << "Did not find a unique widget at row : " << size_t(m_selectedRow) <<
|
this->getLogManager() << Kernel::LogLevel_Warning << "Did not find a unique widget at row : " << size_t(m_selectedRow) <<
|
||||||
" column : " << size_t(m_selectedCol) << "\n";
|
" column : " << size_t(m_selectedCol) << "\n";
|
||||||
}
|
}
|
||||||
//Toggle Menu
|
//Switch Menu
|
||||||
m_CurrentMenu->call_SubRoutine(m_selectedRow);
|
m_currMenu = m_currMenu->get_SubMenu(m_selectedRow);
|
||||||
m_CurrentMenu = m_CurrentMenu->get_SubMenu(m_selectedRow);
|
for(int i = 0; i < 6; i++)
|
||||||
m_CurrentMenu->reloadui();
|
{
|
||||||
|
std::string label_text = m_currMenu->get_LabelText(i);
|
||||||
|
gtk_label_set_text(m_Label[i], label_text.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
/// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
|
/// \copyright <a href="https://choosealicense.com/licenses/agpl-3.0/">GNU Affero General Public License v3.0</a>.
|
||||||
///
|
///
|
||||||
///-------------------------------------------------------------------------------------------------
|
///-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
//includes
|
//includes
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -21,6 +20,7 @@
|
|||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
|
|
||||||
namespace TCPTagging {
|
namespace TCPTagging {
|
||||||
@ -71,16 +71,13 @@ private:
|
|||||||
GtkLabel* m_target = nullptr;
|
GtkLabel* m_target = nullptr;
|
||||||
|
|
||||||
//Deklaration TactileMenu Variablen
|
//Deklaration TactileMenu Variablen
|
||||||
TactileMenu* m_MainMenu = nullptr;
|
std::vector<TactileMenu> m_Menu;
|
||||||
TactileMenu* m_CareMenu = nullptr;
|
std::vector<GtkLabel*> m_Label;
|
||||||
TactileMenu* m_HelpMenu = nullptr;
|
TactileMenu* m_currMenu;
|
||||||
TactileMenu* m_DevicesMenu = nullptr;
|
|
||||||
TactileMenu* m_FunctionsMenu = nullptr;
|
|
||||||
|
|
||||||
TactileMenu* m_CurrentMenu = nullptr;
|
|
||||||
|
|
||||||
uint64_t m_nRow = 0;
|
uint64_t m_nRow = 0;
|
||||||
uint64_t m_nCol = 0;
|
uint64_t m_nCol = 0;
|
||||||
|
|
||||||
int m_lastTargetRow = 0;
|
int m_lastTargetRow = 0;
|
||||||
int m_lastTargetCol = 0;
|
int m_lastTargetCol = 0;
|
||||||
@ -145,6 +142,8 @@ protected:
|
|||||||
GdkColor m_selectedFgColor = InitGDKColor(0, 19661, 6554, 6554);
|
GdkColor m_selectedFgColor = InitGDKColor(0, 19661, 6554, 6554);
|
||||||
uint64_t m_selectedFontSize = 100;
|
uint64_t m_selectedFontSize = 100;
|
||||||
PangoFontDescription* m_selectedFontDesc = nullptr;
|
PangoFontDescription* m_selectedFontDesc = nullptr;
|
||||||
|
|
||||||
|
uint64_t m_nTactilos = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBoxAlgorithmP300TactileVisualizationDesc final : public IBoxAlgorithmDesc
|
class CBoxAlgorithmP300TactileVisualizationDesc final : public IBoxAlgorithmDesc
|
||||||
@ -195,6 +194,8 @@ public:
|
|||||||
prototype.addSetting("Selected background color", OV_TypeId_Color, "70,20,20");
|
prototype.addSetting("Selected background color", OV_TypeId_Color, "70,20,20");
|
||||||
prototype.addSetting("Selected foreground color", OV_TypeId_Color, "30,10,10");
|
prototype.addSetting("Selected foreground color", OV_TypeId_Color, "30,10,10");
|
||||||
prototype.addSetting("Selected font size", OV_TypeId_Integer, "100");
|
prototype.addSetting("Selected font size", OV_TypeId_Integer, "100");
|
||||||
|
|
||||||
|
prototype.addSetting("Number of Tactilos",OV_TypeId_Integer,"6");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user