Browse Source

Dateien hochladen nach „src/TactileVisualization“

master
Tobias Baumann 2 years ago
parent
commit
b5ab468b8e

+ 16
- 4
src/TactileVisualization/TactileMenu.cpp View File

@@ -19,7 +19,7 @@ namespace Plugins {
namespace Tactilebci {
//TactileMenu Memberfunctions
TactileMenu::TactileMenu(char* label0, char* label1, char* label2, char* label3, char* label4, char* label5, GtkBuilder* maininterface)
TactileMenu::TactileMenu(char* label0, char* label1, char* label2, char* label3, char* label4, char* label5)
{
m_LabelText[0] = label0;
m_LabelText[1] = label1;
@@ -28,13 +28,13 @@ TactileMenu::TactileMenu(char* label0, char* label1, char* label2, char* label3,
m_LabelText[4] = label4;
m_LabelText[5] = label5;
m_Maininterface = maininterface;
m_MainInterface = nullptr;
for(int i = 0; i < 6; i++)
{
m_SubMenu[i] = this;
m_SubRoutine[i] = nullptr;
m_Label[i] = GTK_LABEL(gtk_builder_get_object(maininterface, "label-" + to_string(i));
m_Label[i] = nullptr;
}
}
@@ -68,12 +68,24 @@ void TactileMenu::set_SubMenu(int i, TactileMenu* submenu)
void TactileMenu::reloadui(void)
{
for(uint64_t i = 0; i < 6; i++)
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)

+ 3
- 2
src/TactileVisualization/TactileMenu.h View File

@@ -30,10 +30,10 @@ class TactileMenu
TactileMenu* m_SubMenu[6];
void (*m_SubRoutine[6])(void);
GtkLabel* m_Label[6];
GtkBuilder* m_Maininterface;
GtkBuilder* m_MainInterface;
public:
TactileMenu(char* label0, char* label1, char* label2, char* label3, char* label4, char* label5, GtkBuilder* maininterface);
TactileMenu(char* label0, char* label1, char* label2, char* label3, char* label4, char* label5);
void call_SubRoutine(int i);
char* get_LabelText(int i);
TactileMenu* get_SubMenu(int i);
@@ -41,6 +41,7 @@ class TactileMenu
void set_SubRoutine(int i, void(*subroutine)(void));
void set_SubMenu(int i, TactileMenu* submenu);
void init_Labels(GtkBuilder* maininterface);
void reloadui(void);
};

+ 43
- 22
src/TactileVisualization/ovpCBoxAlgorithmP300TactileVisualization.cpp View File

@@ -129,18 +129,39 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
m_result = GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, "label-result"));
m_target = GTK_LABEL(gtk_builder_get_object(m_mainWidgetInterface, "label-target"));
//TactileMenu initialization
TactileMenu CBoxAlgorithmP300TactileVisualization::m_MainMenu("Ja", "Nein", "Pflege", "Hilfe", "Geräte", "Optionen", m_mainWidgetInterface);
TactileMenu CBoxAlgorithmP300TactileVisualization::m_CareMenu("Ja", "Nein", "Hunger", "Lage", "Müdigkeit", "Hauptmenü", m_mainWidgetInterface);
TactileMenu CBoxAlgorithmP300TactileVisualization::m_HelpMenu("Ja", "Nein", "Schmerzen", "Atemnot", "Anderes", "Hauptmenü", m_mainWidgetInterface);
TactileMenu CBoxAlgorithmP300TactileVisualization::m_DevicesMenu("Ja", "Nein", "Atemgerät", "Rollstuhl", "Computer", "Hauptmenü", m_mainWidgetInterface);
TactileMenu CBoxAlgorithmP300TactileVisualization::m_FunctionsMenu("Ja", "Nein", "befehl1", "befehl2", "befehl3", "Hauptmenü", m_mainWidgetInterface);
//Begin TactileMenu Initialization -------------------------------------------------------------------------------------
//Create Menus
m_MainMenu = new TactileMenu("Ja", "Nein", "Pflege", "Hilfe", "Geräte", "Funktionen");
m_CareMenu = new TactileMenu("Ja", "Nein", "Hunger", "Lage", "Müdigkeit", "Hauptmenü");
m_HelpMenu = new TactileMenu("Ja", "Nein", "Schmerzen", "Atemnot", "Anderes", "Hauptmenü");
m_DevicesMenu = new TactileMenu("Ja", "Nein", "Atemgerät", "Rollstuhl", "Computer", "Hauptmenü");
m_FunctionsMenu = new TactileMenu("Ja", "Nein", "befehl1", "befehl2", "befehl3", "Hauptmenü");
//Initialize MainMenu
m_MainMenu->init_Labels(m_mainWidgetInterface);
m_MainMenu->set_SubMenu(2, m_CareMenu);
m_MainMenu->set_SubMenu(3, m_HelpMenu);
m_MainMenu->set_SubMenu(4, m_DevicesMenu);
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);
m_CurrentMenu = &m_MainMenu;
//Set Pointer to active Menu
//Load MenuLabels
m_CurrentMenu = m_MainMenu;
m_CurrentMenu->reloadui();
//Grenze-------------------------------------------------------------------------------------
//End TactileMenu Initialization ---------------------------------------------------------------------------------------
gtk_builder_connect_signals(m_mainWidgetInterface, nullptr);
gtk_builder_connect_signals(m_toolbarWidgetInterface, nullptr);
@@ -211,6 +232,14 @@ bool CBoxAlgorithmP300TactileVisualization::initialize()
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)
{
m_stimuliQueue.clear();
@@ -605,6 +634,10 @@ bool CBoxAlgorithmP300TactileVisualization::process()
this->getLogManager() << Kernel::LogLevel_Warning << "Did not find a unique widget at row : " << size_t(m_selectedRow) <<
" column : " << size_t(m_selectedCol) << "\n";
}
//Toggle Menu
m_CurrentMenu->call_SubRoutine(m_selectedRow);
m_CurrentMenu = m_CurrentMenu->get_SubMenu(m_selectedRow);
m_CurrentMenu->reloadui();
}
else
{
@@ -614,22 +647,10 @@ bool CBoxAlgorithmP300TactileVisualization::process()
label += "*";
gtk_label_set_text(m_result, label.c_str());
}
m_selectedRow = -1;
m_selectedCol = -1;
}
//Load new menuentries
uint64_t label_id = id - m_rowStimulationBase;
if(main)
{
set_labeltext(label_id);
main = false;
}
else if(label_id == 5)
{
set_labeltext(6);
main = true;
}
}
}

+ 7
- 6
src/TactileVisualization/ovpCBoxAlgorithmP300TactileVisualization.h View File

@@ -71,12 +71,13 @@ private:
GtkLabel* m_target = nullptr;
//Deklaration TactileMenu Variablen
TactileMenu m_MainMenu;
TactileMenu m_CareMenu;
TactileMenu m_HelpMenu;
TactileMenu m_DevicesMenu;
TactileMenu m_FunctionsMenu;
TactileMenu* m_CurrentMenu; = nullptr;
TactileMenu* m_MainMenu = nullptr;
TactileMenu* m_CareMenu = nullptr;
TactileMenu* m_HelpMenu = nullptr;
TactileMenu* m_DevicesMenu = nullptr;
TactileMenu* m_FunctionsMenu = nullptr;
TactileMenu* m_CurrentMenu = nullptr;
uint64_t m_nRow = 0;
uint64_t m_nCol = 0;

Loading…
Cancel
Save