Commit 1e9236af authored by Serrière Guillaume's avatar Serrière Guillaume

Working version (as far as I test).

Signed-off-by: default avatarSerrière Guillaume <guillaume.serriere@inria.fr>
parent 572ed526
......@@ -310,8 +310,8 @@ CBoxConfigurationDialog::CBoxConfigurationDialog(const IKernelContext& rKernelCo
//action buttons can't be unparented from builder interface and added to dialog, which is why they are added at dialog creation time
#endif
::GtkScrolledWindow * l_pScrolledWindow=GTK_SCROLLED_WINDOW(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-scrolledwindow"));
::GtkViewport * l_pViewPort=GTK_VIEWPORT(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-viewport"));
m_pScrolledWindow=GTK_SCROLLED_WINDOW(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-scrolledwindow"));
m_pViewPort=GTK_VIEWPORT(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-viewport"));
m_pSettingsTable=GTK_TABLE(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-table"));
::GtkContainer* l_pFileOverrideContainer=GTK_CONTAINER(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-hbox_filename_override"));
::GtkButton* l_pButtonLoad=GTK_BUTTON(gtk_builder_get_object(l_pBuilderInterfaceSetting, "box_configuration-button_load_current_from_file"));
......@@ -320,20 +320,7 @@ CBoxConfigurationDialog::CBoxConfigurationDialog(const IKernelContext& rKernelCo
g_object_unref(l_pBuilderInterfaceSetting);
generateSettingsTable();
// Resize the window to fit as much of the table as possible, but keep the max size
// limited so it doesn't get outside the screen. For safety, we cap to 800x600
// anyway to hopefully prevent the window from going under things such as the gnome toolbar.
// The ui file at the moment does not allow resize of this window because the result
// looked ugly if the window was made overly large, and no satisfying solution at the time was
// found by the limited intellectual resources available.
const uint32 l_ui32MaxWidth = std::min(800,gdk_screen_get_width(gdk_screen_get_default()));
const uint32 l_ui32MaxHeight = std::min(600,gdk_screen_get_height(gdk_screen_get_default()));
GtkRequisition l_oSize;
gtk_widget_size_request(GTK_WIDGET(l_pViewPort), &l_oSize);
gtk_widget_set_size_request(GTK_WIDGET(l_pScrolledWindow),
std::min(l_ui32MaxWidth,(uint32)l_oSize.width),
std::min(l_ui32MaxHeight,(uint32)l_oSize.height));
updateSize();
// If a scenario is not running, we add the buttons to save/load etc
if (!m_bIsScenarioRunning)
......@@ -596,10 +583,12 @@ void CBoxConfigurationDialog::update(OpenViBE::CObservable &o, void* data)
{
case SettingsAllChange:
generateSettingsTable();
updateSize();
break;
case SettingValueUpdate:
{
std::cout << "**** Value : " << l_pEvent->m_i32FirstIndex<< " " << std::endl;
CString l_sSettingName;
CString l_sSettingValue;
......@@ -607,11 +596,29 @@ void CBoxConfigurationDialog::update(OpenViBE::CObservable &o, void* data)
m_rBox.getSettingValue(l_pEvent->m_i32FirstIndex, l_sSettingValue);
m_mSettingViewMap[l_sSettingName]->setValue(l_sSettingValue);
std::cout << " Fin de value" << std::endl<< std::endl;
break;
}
case SettingDelete:
std::cout << "**** Delete" << std::endl;
removeSetting(l_pEvent->m_i32FirstIndex);
std::cout << " Fin de delete" << std::endl << std::endl;
break;
case SettingAdd:
generateSettingsTable();
updateSize();
break;
case SettingChange:
std::cout << "**** Changement" << std::endl;
settingChange(l_pEvent->m_i32FirstIndex);
std::cout << " Fin de changement" << std::endl<< std::endl;
break;
default:
std::cout << "Unhandle box event" << std::endl;
std::cout << "Unhandle box event " << l_pEvent->m_eType << std::endl;
}
}
......@@ -627,7 +634,9 @@ void remove_rows(GtkWidget* data)
void CBoxConfigurationDialog::generateSettingsTable()
{
clearSettingWrappersVector();
remove_rows(GTK_WIDGET(m_pSettingsTable));
// count the number of modifiable settings
uint32 l_ui32TableSize = 0;
for(uint32 i=0; i<m_rBox.getSettingCount(); i++)
......@@ -648,29 +657,130 @@ void CBoxConfigurationDialog::generateSettingsTable()
}
gtk_table_resize(m_pSettingsTable, l_ui32TableSize+2, 4);
// Iterate over box settings, generate corresponding gtk widgets. If the scenario is running, we are making a
// 'modifiable settings' dialog and use a subset of widgets with a slightly different layout and buttons.
for(uint32 i=0,j=0; i<m_rBox.getSettingCount(); i++)
{
if(this->addSettingsToView(i, j))
{
++j;
}
}
std::cout << "Number of setting display " << m_vSettingWrappers.size() << std::endl;
}
boolean CBoxConfigurationDialog::addSettingsToView(uint32 ui32SettingIndex, OpenViBE::uint32 ui32TableIndex)
{
boolean l_bSettingModifiable;
m_rBox.getSettingMod(ui32SettingIndex, l_bSettingModifiable);
//if the scenario is not running we take all the settings
//otherwise, we take only the modifiable ones
if( (!m_bIsScenarioRunning) || (m_bIsScenarioRunning && l_bSettingModifiable) )
{
CString l_sSettingName;
boolean l_bSettingModifiable;
m_rBox.getSettingName(i, l_sSettingName);
m_rBox.getSettingMod(i, l_bSettingModifiable);
m_rBox.getSettingName(ui32SettingIndex, l_sSettingName);
Setting::CAbstractSettingView* l_oView = m_oSettingFactory.getSettingView(m_rBox, ui32SettingIndex);
gtk_table_attach(m_pSettingsTable, l_oView->getNameWidget() , 0, 1, ui32TableIndex, ui32TableIndex+1, ::GtkAttachOptions(GTK_FILL), ::GtkAttachOptions(GTK_FILL), 0, 0);
gtk_table_attach(m_pSettingsTable, l_oView->getEntryWidget(), 1, 4, ui32TableIndex, ui32TableIndex+1, ::GtkAttachOptions(GTK_SHRINK|GTK_FILL|GTK_EXPAND), ::GtkAttachOptions(GTK_SHRINK), 0, 0);
m_mSettingViewMap[l_sSettingName] = l_oView;
m_mSettingViewIndexMap[l_sSettingName] = ui32TableIndex;
m_vSettingWrappers.insert(m_vSettingWrappers.begin()+ui32TableIndex, CSettingViewWrapper(ui32SettingIndex, l_oView));
return true;
}
return false;
}
void CBoxConfigurationDialog::settingChange(uint32 ui32SettingIndex)
{
//We remeber the place to add the new setting at the same place
uint32 l_ui32IndexTable = getTableIndex(ui32SettingIndex);
removeSetting(ui32SettingIndex, false);
addSettingsToView(ui32SettingIndex, l_ui32IndexTable);
}
void CBoxConfigurationDialog::clearSettingWrappersVector(void)
{
for (std::vector<CSettingViewWrapper>::iterator it = m_vSettingWrappers.begin() ; it != m_vSettingWrappers.end(); ++it)
{
CSettingViewWrapper &l_oView = *it;
delete l_oView.m_pView;
}
m_vSettingWrappers.clear();
}
void CBoxConfigurationDialog::removeSetting(uint32 ui32SettingIndex, boolean bShift)
{
uint32 ui32TableIndex = getTableIndex(ui32SettingIndex);
CSettingViewWrapper &l_rViewWrapper = m_vSettingWrappers[ui32TableIndex];
::GtkWidget* l_pName = l_rViewWrapper.m_pView->getNameWidget();
::GtkWidget* l_pEntry = l_rViewWrapper.m_pView->getEntryWidget();
gtk_container_remove(GTK_CONTAINER(m_pSettingsTable), l_pName);
gtk_container_remove(GTK_CONTAINER(m_pSettingsTable), l_pEntry);
delete l_rViewWrapper.m_pView;
m_vSettingWrappers.erase(m_vSettingWrappers.begin() + ui32TableIndex);
//if the scenario is not running we take all the settings
//otherwise, we take only the modifiable ones
if( (!m_bIsScenarioRunning) || (m_bIsScenarioRunning && l_bSettingModifiable) )
//Now if we need to do it we shift everything to avoid an empty row in the table
if(bShift){
for(size_t i = ui32TableIndex; i < m_vSettingWrappers.size() ; ++i)
{
Setting::CAbstractSettingView* l_oView = m_oSettingFactory.getSettingView(m_rBox, i);
Setting::CAbstractSettingView *l_oView = m_vSettingWrappers[i].m_pView;
--(m_vSettingWrappers[i].m_ui32SettingIndex);
gtk_table_attach(m_pSettingsTable, l_oView->getNameWidget() , 0, 1, j, j+1, ::GtkAttachOptions(GTK_FILL), ::GtkAttachOptions(GTK_FILL), 0, 0);
gtk_table_attach(m_pSettingsTable, l_oView->getEntryWidget(), 1, 4, j, j+1, ::GtkAttachOptions(GTK_SHRINK|GTK_FILL|GTK_EXPAND), ::GtkAttachOptions(GTK_SHRINK), 0, 0);
gtk_container_remove(GTK_CONTAINER(m_pSettingsTable), l_oView->getNameWidget());
gtk_table_attach(m_pSettingsTable, l_oView->getNameWidget() , 0, 1, i, i+1, ::GtkAttachOptions(GTK_FILL), ::GtkAttachOptions(GTK_FILL), 0, 0);
m_mSettingViewMap[l_sSettingName] = l_oView;
++j;
gtk_container_remove(GTK_CONTAINER(m_pSettingsTable), l_oView->getEntryWidget());
gtk_table_attach(m_pSettingsTable, l_oView->getEntryWidget(), 1, 4, i, i+1, ::GtkAttachOptions(GTK_SHRINK|GTK_FILL|GTK_EXPAND), ::GtkAttachOptions(GTK_SHRINK), 0, 0);
}
//Now let's resize everything
updateSize();
}
}
uint32 CBoxConfigurationDialog::getTableIndex(uint32 ui32SettingIndex)
{
uint32 ui32TableIndex=0;
for (std::vector<CSettingViewWrapper>::iterator it = m_vSettingWrappers.begin() ; it != m_vSettingWrappers.end(); ++it, ++ui32TableIndex)
{
CSettingViewWrapper &l_rViewWrapper = *it;
if(l_rViewWrapper.m_ui32SettingIndex == ui32SettingIndex){
return ui32SettingIndex;
}
}
return 0xFFFFFFF;
}
void CBoxConfigurationDialog::updateSize()
{
// Resize the window to fit as much of the table as possible, but keep the max size
// limited so it doesn't get outside the screen. For safety, we cap to 800x600
// anyway to hopefully prevent the window from going under things such as the gnome toolbar.
// The ui file at the moment does not allow resize of this window because the result
// looked ugly if the window was made overly large, and no satisfying solution at the time was
// found by the limited intellectual resources available.
const uint32 l_ui32MaxWidth = std::min(800,gdk_screen_get_width(gdk_screen_get_default()));
const uint32 l_ui32MaxHeight = std::min(600,gdk_screen_get_height(gdk_screen_get_default()));
GtkRequisition l_oSize;
gtk_widget_size_request(GTK_WIDGET(m_pViewPort), &l_oSize);
gtk_widget_set_size_request(GTK_WIDGET(m_pScrolledWindow),
std::min(l_ui32MaxWidth,(uint32)l_oSize.width),
std::min(l_ui32MaxHeight,(uint32)l_oSize.height));
}
const CIdentifier CBoxConfigurationDialog::getBoxID() const
......
......@@ -33,6 +33,16 @@ namespace OpenViBEDesigner
OpenViBE::Kernel::IBox& m_rBox;
};
class CSettingViewWrapper{
public:
CSettingViewWrapper(OpenViBE::uint32 ui32SettingIndex, Setting::CAbstractSettingView *pView):
m_ui32SettingIndex(ui32SettingIndex), m_pView(pView)
{}
OpenViBE::uint32 m_ui32SettingIndex;
Setting::CAbstractSettingView *m_pView;
};
class CBoxConfigurationDialog : public OpenViBE::IObserver
{
public:
......@@ -46,8 +56,17 @@ namespace OpenViBEDesigner
virtual void update(OpenViBE::CObservable &o, void* data);
void updateSize();
protected:
void generateSettingsTable(void);
OpenViBE::boolean addSettingsToView(OpenViBE::uint32 ui32SettingIndex, OpenViBE::uint32 ui32TableIndex);
void settingChange(OpenViBE::uint32 ui32SettingIndex);
void clearSettingWrappersVector(void);
void removeSetting(OpenViBE::uint32 ui32SettingIndex, OpenViBE::boolean bShift = true);
OpenViBE::uint32 getTableIndex(OpenViBE::uint32 ui32SettingIndex);
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::Kernel::IBox& m_rBox;
......@@ -59,11 +78,18 @@ namespace OpenViBEDesigner
::GtkWidget* m_pSettingOverrideValue;
::GtkTable *m_pSettingsTable;
::GtkViewport *m_pViewPort;
::GtkScrolledWindow * m_pScrolledWindow;
bool m_bIsScenarioRunning; // true if the scenario is running, false otherwise
std::map< OpenViBE::CString, ::GtkWidget* > m_mSettingWidget;
Setting::CSettingViewFactory m_oSettingFactory;
std::map< OpenViBE::CString, Setting::CAbstractSettingView* > m_mSettingViewMap;//Temporary need to be remove
std::map< OpenViBE::CString, OpenViBE::uint32 > m_mSettingViewIndexMap;
std::vector<CSettingViewWrapper> m_vSettingWrappers;
CSettingCollectionHelper* m_pHelper;
SButtonCB* m_pButtonCB;
::GtkCheckButton* m_pFileOverrideCheck;
......
......@@ -19,10 +19,10 @@ OpenViBE::CString CAbstractSettingView::getSettingWidgetName(void)
CAbstractSettingView::~CAbstractSettingView()
{
if(m_pNameWidget){
if(GTK_IS_WIDGET(m_pNameWidget)){
gtk_widget_destroy(m_pNameWidget);
}
if(m_pEntryWidget){
if(GTK_IS_WIDGET(m_pEntryWidget)){
gtk_widget_destroy(m_pEntryWidget);
}
}
......@@ -32,7 +32,8 @@ CAbstractSettingView::CAbstractSettingView(OpenViBE::Kernel::IBox& rBox, OpenViB
m_ui32Index(ui32Index),
m_sSettingWidgetName(""),
m_pNameWidget(NULL),
m_pEntryWidget(NULL)
m_pEntryWidget(NULL),
m_bOnValueSetting(false)
{
m_pBuilder = gtk_builder_new();
gtk_builder_add_from_file(m_pBuilder, rBuilderName.toASCIIString(), NULL);
......@@ -108,6 +109,8 @@ GtkWidget *CAbstractSettingView::generateEntryWidget(void)
setEntryWidget(GTK_WIDGET(m_pTable));
gtk_widget_set_visible(getEntryWidget(), true);
//If we don't increase the ref counter it will cause trouble when we gonna move it later
g_object_ref(G_OBJECT(m_pTable));
return l_pSettingWidget;
}
......@@ -115,7 +118,6 @@ void CAbstractSettingView::initializeValue()
{
CString l_sSettingValue;
getBox().getSettingValue(m_ui32Index, l_sSettingValue);
std::cout << l_sSettingValue << std::endl;
setValue(l_sSettingValue);
}
......
......@@ -47,6 +47,7 @@ namespace OpenViBEDesigner
//If we don't store the builder, the setting name will be free when we'll unref the builder
::GtkBuilder *m_pBuilder;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -28,10 +28,8 @@ namespace OpenViBEDesigner
OpenViBE::CIdentifier m_oTypeIdentifier;
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::boolean m_bOnValueSetting;
std::vector < ::GtkToggleButton *> m_vToggleButton;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -13,7 +13,7 @@ static void on_checkbutton_setting_boolean_pressed(::GtkToggleButton* pButton, g
}
CBooleanSettingView::CBooleanSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName):
CAbstractSettingView(rBox, ui32Index, rBuilderName)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_boolean");
......@@ -40,6 +40,7 @@ void CBooleanSettingView::getValue(OpenViBE::CString &rValue) const
void CBooleanSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
if(rValue==CString("true"))
{
gtk_toggle_button_set_active(m_pToggle, true);
......@@ -54,18 +55,22 @@ void CBooleanSettingView::setValue(const OpenViBE::CString &rValue)
}
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
void CBooleanSettingView::toggleButtonClick()
{
if(::gtk_toggle_button_get_active(m_pToggle))
if(!m_bOnValueSetting)
{
getBox().setSettingValue(getSettingsIndex(), "true");
}
else
{
getBox().setSettingValue(getSettingsIndex(), "false");
if(::gtk_toggle_button_get_active(m_pToggle))
{
getBox().setSettingValue(getSettingsIndex(), "true");
}
else
{
getBox().setSettingValue(getSettingsIndex(), "false");
}
}
}
......@@ -22,6 +22,7 @@ namespace OpenViBEDesigner
private:
::GtkToggleButton* m_pToggle;
::GtkEntry* m_pEntry;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -57,7 +57,7 @@ static void on_change(::GtkEntry *entry, gpointer pUserData)
CColorGradientSettingView::CColorGradientSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName, const Kernel::IKernelContext &rKernelContext):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_sBuilderName(rBuilderName)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_sBuilderName(rBuilderName), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_color_gradient");
......@@ -83,7 +83,9 @@ void CColorGradientSettingView::getValue(OpenViBE::CString &rValue) const
void CColorGradientSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
void CColorGradientSettingView::configurePressed()
......@@ -131,7 +133,10 @@ void CColorGradientSettingView::configurePressed()
l_oFinalGradient[i*4+3] = vColorGradient[i].oColor.blue * 100. / 65535.;
}
OpenViBEToolkit::Tools::ColorGradient::format(l_sFinalGradient, l_oFinalGradient);
getBox().setSettingValue(getSettingsIndex(), l_sFinalGradient.toASCIIString());
if(!m_bOnValueSetting)
{
getBox().setSettingValue(getSettingsIndex(), l_sFinalGradient.toASCIIString());
}
//gtk_entry_set_text(m_pEntry, l_sFinalGradient.toASCIIString());
}
......
......@@ -56,6 +56,8 @@ namespace OpenViBEDesigner
std::vector < SColorGradientDataNode > vColorGradient;
std::map < ::GtkColorButton*, OpenViBE::uint32 > vColorButtonMap;
std::map < ::GtkSpinButton*, OpenViBE::uint32 > vSpinButtonMap;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -19,7 +19,7 @@ static void on_change(::GtkEntry *entry, gpointer pUserData)
CColorSettingView::CColorSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName, const Kernel::IKernelContext &rKernelContext):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_color");
......@@ -46,6 +46,7 @@ void CColorSettingView::getValue(OpenViBE::CString &rValue) const
void CColorSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
int r=0, g=0, b=0;
::sscanf(m_rKernelContext.getConfigurationManager().expand(rValue).toASCIIString(), "%i,%i,%i", &r, &g, &b);
......@@ -56,6 +57,7 @@ void CColorSettingView::setValue(const OpenViBE::CString &rValue)
gtk_color_button_set_color(m_pButton, &l_oColor);
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
......@@ -72,7 +74,10 @@ void CColorSettingView::selectColor()
void CColorSettingView::onChange()
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
if(!m_bOnValueSetting)
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
}
}
......@@ -27,6 +27,7 @@ namespace OpenViBEDesigner
::GtkColorButton *m_pButton;
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -16,7 +16,7 @@ static void on_change(::GtkEntry *entry, gpointer pUserData)
CEnumerationSettingView::CEnumerationSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index,
CString &rBuilderName, const Kernel::IKernelContext &rKernelContext,
const OpenViBE::CIdentifier &rTypeIdentifier):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_oTypeIdentifier(rTypeIdentifier), m_rKernelContext(rKernelContext)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_oTypeIdentifier(rTypeIdentifier), m_rKernelContext(rKernelContext), m_bOnValueSetting(false)
{
p=false;
setSettingWidgetName("settings_collection-comboboxentry_setting_enumeration");
......@@ -59,12 +59,17 @@ void CEnumerationSettingView::getValue(OpenViBE::CString &rValue) const
void CEnumerationSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
gtk_combo_box_set_active(m_pComboBox, (gint)m_mEntriesIndex[rValue]);
m_bOnValueSetting =false;
}
void CEnumerationSettingView::onChange()
{
const gchar* l_sValue = gtk_combo_box_get_active_text(m_pComboBox);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
if(!m_bOnValueSetting)
{
const gchar* l_sValue = gtk_combo_box_get_active_text(m_pComboBox);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
}
}
......@@ -33,6 +33,7 @@ namespace OpenViBEDesigner
std::map < OpenViBE::CString, OpenViBE::uint64 > m_mEntriesIndex;
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -21,7 +21,7 @@ static void on_change(::GtkEntry *entry, gpointer pUserData)
CFilenameSettingView::CFilenameSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName, const Kernel::IKernelContext &rKernelContext):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_filename");
......@@ -48,7 +48,9 @@ void CFilenameSettingView::getValue(OpenViBE::CString &rValue) const
void CFilenameSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
void CFilenameSettingView::browse()
......@@ -91,6 +93,9 @@ void CFilenameSettingView::browse()
void CFilenameSettingView::onChange()
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
if(!m_bOnValueSetting)
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
}
}
......@@ -26,6 +26,7 @@ namespace OpenViBEDesigner
::GtkEntry* m_pEntry;
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -25,7 +25,7 @@ static void on_change(::GtkEntry *entry, gpointer pUserData)
CFloatSettingView::CFloatSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName, const Kernel::IKernelContext &rKernelContext):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_float");
......@@ -54,7 +54,9 @@ void CFloatSettingView::getValue(OpenViBE::CString &rValue) const
void CFloatSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
void CFloatSettingView::adjustValue(float64 amount)
......@@ -69,6 +71,10 @@ void CFloatSettingView::adjustValue(float64 amount)
void CFloatSettingView::onChange()
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
if(!m_bOnValueSetting)
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
}
}
......@@ -23,10 +23,13 @@ namespace OpenViBEDesigner
void onChange();
private:
::GtkEntry* m_pEntry;
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -24,7 +24,7 @@ static void on_insertion(::GtkEntry *entry, gpointer pUserData)
CIntegerSettingView::CIntegerSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName, const Kernel::IKernelContext &rKernelContext):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_integer");
......@@ -53,7 +53,9 @@ void CIntegerSettingView::getValue(OpenViBE::CString &rValue) const
void CIntegerSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
void CIntegerSettingView::adjustValue(int amount)
......@@ -68,6 +70,9 @@ void CIntegerSettingView::adjustValue(int amount)
void CIntegerSettingView::onChange()
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
if(!m_bOnValueSetting)
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);
}
}
......@@ -27,6 +27,7 @@ namespace OpenViBEDesigner
::GtkEntry* m_pEntry;
const OpenViBE::Kernel::IKernelContext& m_rKernelContext;
OpenViBE::boolean m_bOnValueSetting;
};
}
......
......@@ -25,7 +25,7 @@ static void on_change(::GtkEntry *entry, gpointer pUserData)
}
CScriptSettingView::CScriptSettingView(OpenViBE::Kernel::IBox &rBox, OpenViBE::uint32 ui32Index, CString &rBuilderName, const Kernel::IKernelContext &rKernelContext):
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext)
CAbstractSettingView(rBox, ui32Index, rBuilderName), m_rKernelContext(rKernelContext), m_bOnValueSetting(false)
{
setSettingWidgetName("settings_collection-hbox_setting_script");
......@@ -52,7 +52,9 @@ void CScriptSettingView::getValue(OpenViBE::CString &rValue) const
void CScriptSettingView::setValue(const OpenViBE::CString &rValue)
{
m_bOnValueSetting = true;
gtk_entry_set_text(m_pEntry, rValue);
m_bOnValueSetting =false;
}
void CScriptSettingView::browse()
......@@ -116,6 +118,9 @@ void CScriptSettingView::edit()
void CScriptSettingView::onChange()
{
const gchar* l_sValue = gtk_entry_get_text(m_pEntry);
getBox().setSettingValue(getSettingsIndex(), l_sValue);