summaryrefslogtreecommitdiffstats
path: root/Source/FLTKDialog
diff options
context:
space:
mode:
authorLuis Ibanez <luis.ibanez@kitware.com>2001-06-21 12:41:14 (GMT)
committerLuis Ibanez <luis.ibanez@kitware.com>2001-06-21 12:41:14 (GMT)
commit446ea3b97d2004f11d9002ec09872a796548e771 (patch)
treed7fff47eb567d6ab5774fa9858b9ad93122695c7 /Source/FLTKDialog
parent8fe1e1fcc6be2de71ebe3ce2e252c2e8bd75931b (diff)
downloadCMake-446ea3b97d2004f11d9002ec09872a796548e771.zip
CMake-446ea3b97d2004f11d9002ec09872a796548e771.tar.gz
CMake-446ea3b97d2004f11d9002ec09872a796548e771.tar.bz2
ENH: PropertyRows have now a reference to CMakeSetupGUI and save the cache
at each callback action
Diffstat (limited to 'Source/FLTKDialog')
-rw-r--r--Source/FLTKDialog/CMakeSetupGUIImplementation.cxx4
-rw-r--r--Source/FLTKDialog/FLTKPropertyItemRow.cxx48
-rw-r--r--Source/FLTKDialog/FLTKPropertyItemRow.h13
-rw-r--r--Source/FLTKDialog/FLTKPropertyList.cxx6
-rw-r--r--Source/FLTKDialog/FLTKPropertyList.h23
5 files changed, 71 insertions, 23 deletions
diff --git a/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx b/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx
index 5dca254..d42bd3d 100644
--- a/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx
+++ b/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx
@@ -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;
}
diff --git a/Source/FLTKDialog/FLTKPropertyItemRow.cxx b/Source/FLTKDialog/FLTKPropertyItemRow.cxx
index 2ce380a..078a7e5 100644
--- a/Source/FLTKDialog/FLTKPropertyItemRow.cxx
+++ b/Source/FLTKDialog/FLTKPropertyItemRow.cxx
@@ -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();
+
}
diff --git a/Source/FLTKDialog/FLTKPropertyItemRow.h b/Source/FLTKDialog/FLTKPropertyItemRow.h
index d7af02d..e72d501 100644
--- a/Source/FLTKDialog/FLTKPropertyItemRow.h
+++ b/Source/FLTKDialog/FLTKPropertyItemRow.h
@@ -9,6 +9,9 @@
#include <FL/Fl_Button.H>
+class CMakeSetupGUIImplementation;
+
+
namespace fltk {
@@ -30,15 +33,16 @@ class PropertyItemRow : public Fl_Tile
public:
- PropertyItemRow( PropertyItem * );
+ PropertyItemRow( PropertyItem *);
~PropertyItemRow();
-
+
private:
PropertyItem * m_PropertyItem;
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 );
};
diff --git a/Source/FLTKDialog/FLTKPropertyList.cxx b/Source/FLTKDialog/FLTKPropertyList.cxx
index 8c42397..8422f07 100644
--- a/Source/FLTKDialog/FLTKPropertyList.cxx
+++ b/Source/FLTKDialog/FLTKPropertyList.cxx
@@ -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 );
}
diff --git a/Source/FLTKDialog/FLTKPropertyList.h b/Source/FLTKDialog/FLTKPropertyList.h
index b750c27..ef1318d 100644
--- a/Source/FLTKDialog/FLTKPropertyList.h
+++ b/Source/FLTKDialog/FLTKPropertyList.h
@@ -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;
+
};