ENH: PropertyRows have now a reference to CMakeSetupGUI and save the cache
at each callback action
This commit is contained in:
parent
8fe1e1fcc6
commit
446ea3b97d
|
@ -17,7 +17,7 @@
|
|||
* Constructor
|
||||
*/
|
||||
CMakeSetupGUIImplementation
|
||||
::CMakeSetupGUIImplementation()
|
||||
::CMakeSetupGUIImplementation():m_CacheEntriesList( this )
|
||||
{
|
||||
m_BuildPathChanged = false;
|
||||
}
|
||||
|
@ -387,14 +387,12 @@ void
|
|||
CMakeSetupGUIImplementation
|
||||
::SaveCacheFromGUI( void )
|
||||
{
|
||||
std::cout << "Saving cache from GUI ...";
|
||||
this->FillCacheManagerFromCacheGUI();
|
||||
if( m_WhereBuild != "" )
|
||||
{
|
||||
cmCacheManager::GetInstance()->SaveCache(
|
||||
m_WhereBuild.c_str() );
|
||||
}
|
||||
std::cout << " Done ! " << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,17 +10,26 @@
|
|||
#include <FL/Fl_Color_Chooser.H>
|
||||
#include <FL/Fl_Menu_Button.H>
|
||||
#include "../cmCacheManager.h"
|
||||
#include "FLTKPropertyList.h"
|
||||
#include "CMakeSetupGUIImplementation.h"
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
namespace fltk {
|
||||
|
||||
|
||||
PropertyItemRow::PropertyItemRow( PropertyItem * pItem ):Fl_Tile(0,0,10,10,"")
|
||||
|
||||
CMakeSetupGUIImplementation * PropertyItemRow::m_CMakeSetup = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
PropertyItemRow
|
||||
::PropertyItemRow( PropertyItem * pItem ):Fl_Tile(0,0,10,10,"")
|
||||
{
|
||||
|
||||
m_PropertyItem = pItem;
|
||||
m_ItemValue = new ItemValue;
|
||||
|
||||
m_ItemValue = new ItemValue;
|
||||
|
||||
const unsigned int fontsize = 11;
|
||||
const unsigned int nameWidth = 200;
|
||||
|
@ -162,6 +171,12 @@ PropertyItemRow::~PropertyItemRow( )
|
|||
|
||||
|
||||
|
||||
void PropertyItemRow
|
||||
::SetCMakeSetupGUI( CMakeSetupGUIImplementation * cmakeSetup )
|
||||
{
|
||||
m_CMakeSetup = cmakeSetup;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
|
@ -205,15 +220,18 @@ NameButtonCallback( Fl_Widget * widget, void * data)
|
|||
// Remove the entry from the cache
|
||||
cmCacheManager::GetInstance()->RemoveCacheEntry( propertyName );
|
||||
// Get the parent: Fl_Tile that manages the whole row in the GUI
|
||||
Fl_Group * parentGroup = (Fl_Group *) (button->parent());
|
||||
Fl_Group * parentGroup = dynamic_cast<Fl_Group *>(button->parent());
|
||||
// Get the grandParent: Fl_Pack with the property list
|
||||
Fl_Group * grandParentGroup = (Fl_Group *) parentGroup->parent();
|
||||
Fl_Group * grandParentGroup = dynamic_cast<Fl_Group *>( parentGroup->parent() );
|
||||
// Remove the row from the list
|
||||
grandParentGroup->remove( *parentGroup );
|
||||
// Destroy the row
|
||||
delete parentGroup; // Patricide... ?
|
||||
// Redraw the list
|
||||
grandParentGroup->redraw();
|
||||
|
||||
SaveCacheFromGUI();
|
||||
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -225,6 +243,17 @@ NameButtonCallback( Fl_Widget * widget, void * data)
|
|||
|
||||
|
||||
|
||||
void
|
||||
PropertyItemRow::
|
||||
SaveCacheFromGUI( void )
|
||||
{
|
||||
if( m_CMakeSetup )
|
||||
{
|
||||
m_CMakeSetup->SaveCacheFromGUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
PropertyItemRow::
|
||||
|
@ -246,6 +275,9 @@ CheckButtonCallback( Fl_Widget * widget, void * data)
|
|||
pItem->m_curValue = "OFF";
|
||||
}
|
||||
button->redraw();
|
||||
|
||||
SaveCacheFromGUI();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,6 +291,8 @@ InputTextCallback( Fl_Widget * widget, void * data)
|
|||
|
||||
item->m_curValue = input->value();
|
||||
|
||||
SaveCacheFromGUI();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,6 +324,8 @@ ColorSelectionCallback( Fl_Widget * widget, void * data)
|
|||
|
||||
colorButton->redraw();
|
||||
|
||||
SaveCacheFromGUI();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -314,6 +350,8 @@ BrowsePathCallback( Fl_Widget * widget, void * data)
|
|||
inputText->value( newpath );
|
||||
}
|
||||
|
||||
SaveCacheFromGUI();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#include <FL/Fl_Button.H>
|
||||
|
||||
|
||||
class CMakeSetupGUIImplementation;
|
||||
|
||||
|
||||
namespace fltk {
|
||||
|
||||
|
||||
|
@ -30,7 +33,7 @@ class PropertyItemRow : public Fl_Tile
|
|||
|
||||
public:
|
||||
|
||||
PropertyItemRow( PropertyItem * );
|
||||
PropertyItemRow( PropertyItem *);
|
||||
~PropertyItemRow();
|
||||
|
||||
private:
|
||||
|
@ -39,6 +42,7 @@ class PropertyItemRow : public Fl_Tile
|
|||
ItemValue * m_ItemValue;
|
||||
Fl_Button * m_NameButton;
|
||||
|
||||
static CMakeSetupGUIImplementation * m_CMakeSetup;
|
||||
|
||||
static void CheckButtonCallback( Fl_Widget *, void *);
|
||||
static void NameButtonCallback( Fl_Widget *, void *);
|
||||
|
@ -46,6 +50,11 @@ class PropertyItemRow : public Fl_Tile
|
|||
static void BrowsePathCallback( Fl_Widget *, void *);
|
||||
static void ColorSelectionCallback( Fl_Widget * widget, void * data);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
static void SetCMakeSetupGUI( CMakeSetupGUIImplementation * );
|
||||
static void SaveCacheFromGUI( void );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -10,14 +10,18 @@
|
|||
#include "FL/fl_ask.H"
|
||||
#include "FL/Fl_Button.H"
|
||||
#include <cstdio>
|
||||
#include "CMakeSetupGUIImplementation.h"
|
||||
|
||||
|
||||
namespace fltk {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// PropertyList
|
||||
|
||||
PropertyList::PropertyList()
|
||||
PropertyList::PropertyList( CMakeSetupGUIImplementation * cmakeSetup )
|
||||
{
|
||||
m_CMakeSetup = cmakeSetup;
|
||||
PropertyItemRow::SetCMakeSetupGUI( cmakeSetup );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include <string>
|
||||
|
||||
|
||||
class CMakeSetupGUIImplementation;
|
||||
|
||||
|
||||
namespace fltk {
|
||||
|
||||
|
||||
|
@ -36,6 +39,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// PropertyList window
|
||||
|
||||
|
@ -53,7 +60,8 @@ public:
|
|||
CHECKBOX,
|
||||
PATH
|
||||
};
|
||||
PropertyList();
|
||||
|
||||
PropertyList( CMakeSetupGUIImplementation * );
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
@ -93,19 +101,10 @@ protected:
|
|||
|
||||
int AddPropItem(PropertyItem* pItem);
|
||||
|
||||
/*
|
||||
bool m_Dirty;
|
||||
int m_curSel;
|
||||
int m_prevSel;
|
||||
int m_nDivider;
|
||||
int m_nDivTop;
|
||||
int m_nDivBtm;
|
||||
int m_nOldDivX;
|
||||
int m_nLastBox;
|
||||
*/
|
||||
|
||||
std::set<PropertyItem*> m_PropertyItems;
|
||||
|
||||
CMakeSetupGUIImplementation * m_CMakeSetup;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue