ENH: Updated with respect to MFC CMakeSetup. New cache entries are now

colored in red. The browsers for recent directories only popup if
     there is at least one in the list.
This commit is contained in:
Luis Ibanez 2001-10-27 23:47:23 -04:00
parent 0fb47ad240
commit f90e258941
8 changed files with 304 additions and 76 deletions

View File

@ -38,18 +38,18 @@ void CMakeSetupGUI::cb_Browse1(Fl_Button* o, void* v) {
((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Browse1_i(o,v); ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Browse1_i(o,v);
} }
inline void CMakeSetupGUI::cb_Close_i(Fl_Button*, void*) { inline void CMakeSetupGUI::cb_m_CancelButton_i(Fl_Button*, void*) {
Close(); ClickOnCancel();
} }
void CMakeSetupGUI::cb_Close(Fl_Button* o, void* v) { void CMakeSetupGUI::cb_m_CancelButton(Fl_Button* o, void* v) {
((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Close_i(o,v); ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_m_CancelButton_i(o,v);
} }
inline void CMakeSetupGUI::cb_Build_i(Fl_Button*, void*) { inline void CMakeSetupGUI::cb_m_ConfigureButton_i(Fl_Button*, void*) {
BuildProjectFiles(); ClickOnConfigure();
} }
void CMakeSetupGUI::cb_Build(Fl_Button* o, void* v) { void CMakeSetupGUI::cb_m_ConfigureButton(Fl_Button* o, void* v) {
((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Build_i(o,v); ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_m_ConfigureButton_i(o,v);
} }
inline void CMakeSetupGUI::cb_2_i(Fl_Button*, void*) { inline void CMakeSetupGUI::cb_2_i(Fl_Button*, void*) {
@ -80,9 +80,16 @@ void CMakeSetupGUI::cb_recentBinaryDirectoriesBrowser(Fl_Browser* o, void* v) {
((CMakeSetupGUI*)(o->parent()->user_data()))->cb_recentBinaryDirectoriesBrowser_i(o,v); ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_recentBinaryDirectoriesBrowser_i(o,v);
} }
inline void CMakeSetupGUI::cb_m_OKButton_i(Fl_Button*, void*) {
ClickOnOK();
}
void CMakeSetupGUI::cb_m_OKButton(Fl_Button* o, void* v) {
((CMakeSetupGUI*)(o->parent()->user_data()))->cb_m_OKButton_i(o,v);
}
CMakeSetupGUI::CMakeSetupGUI() { CMakeSetupGUI::CMakeSetupGUI() {
Fl_Window* w; Fl_Window* w;
{ Fl_Window* o = dialogWindow = new Fl_Window(563, 363, "CMakeSetupDialog"); { Fl_Window* o = dialogWindow = new Fl_Window(562, 373, "CMakeSetupDialog");
w = o; w = o;
o->callback((Fl_Callback*)cb_dialogWindow, (void*)(this)); o->callback((Fl_Callback*)cb_dialogWindow, (void*)(this));
{ Fl_Input* o = sourcePathTextInput = new Fl_Input(219, 15, 200, 20, "Where is the source code: "); { Fl_Input* o = sourcePathTextInput = new Fl_Input(219, 15, 200, 20, "Where is the source code: ");
@ -107,15 +114,15 @@ CMakeSetupGUI::CMakeSetupGUI() {
o->labelsize(11); o->labelsize(11);
o->callback((Fl_Callback*)cb_Browse1); o->callback((Fl_Callback*)cb_Browse1);
} }
{ Fl_Button* o = new Fl_Button(345, 331, 77, 23, "Close"); { Fl_Button* o = m_CancelButton = new Fl_Button(435, 331, 77, 23, "Quit");
o->shortcut(0x80071); o->shortcut(0x80071);
o->labelsize(11); o->labelsize(11);
o->callback((Fl_Callback*)cb_Close); o->callback((Fl_Callback*)cb_m_CancelButton);
} }
{ Fl_Button* o = new Fl_Button(123, 332, 101, 23, "Build Project Files"); { Fl_Button* o = m_ConfigureButton = new Fl_Button(50, 332, 120, 23, "Configure Only");
o->shortcut(0x8006d); o->shortcut(0x8006d);
o->labelsize(11); o->labelsize(11);
o->callback((Fl_Callback*)cb_Build); o->callback((Fl_Callback*)cb_m_ConfigureButton);
} }
{ Fl_Group* o = new Fl_Group(25, 80, 515, 222); { Fl_Group* o = new Fl_Group(25, 80, 515, 222);
o->box(FL_ENGRAVED_BOX); o->box(FL_ENGRAVED_BOX);
@ -137,7 +144,7 @@ CMakeSetupGUI::CMakeSetupGUI() {
o->end(); o->end();
Fl_Group::current()->resizable(o); Fl_Group::current()->resizable(o);
} }
{ Fl_Box* o = new Fl_Box(141, 305, 275, 25, "Right click on cache entries for additional options"); { Fl_Box* o = new Fl_Box(160, 305, 275, 25, "Right click on cache entries for additional options");
o->labelsize(11); o->labelsize(11);
} }
{ Fl_Button* o = new Fl_Button(420, 15, 22, 21, "@#2>"); { Fl_Button* o = new Fl_Button(420, 15, 22, 21, "@#2>");
@ -160,6 +167,11 @@ CMakeSetupGUI::CMakeSetupGUI() {
o->callback((Fl_Callback*)cb_recentBinaryDirectoriesBrowser); o->callback((Fl_Callback*)cb_recentBinaryDirectoriesBrowser);
o->hide(); o->hide();
} }
{ Fl_Button* o = m_OKButton = new Fl_Button(210, 332, 190, 23, "Configure and Generate Makefiles");
o->shortcut(0x8006d);
o->labelsize(11);
o->callback((Fl_Callback*)cb_m_OKButton);
}
o->end(); o->end();
} }
} }
@ -170,9 +182,6 @@ CMakeSetupGUI::~CMakeSetupGUI() {
void CMakeSetupGUI::Close(void) { void CMakeSetupGUI::Close(void) {
} }
void CMakeSetupGUI::BuildProjectFiles(void) {
}
void CMakeSetupGUI::BrowseForSourcePath(void) { void CMakeSetupGUI::BrowseForSourcePath(void) {
} }
@ -199,3 +208,12 @@ void CMakeSetupGUI::SelectOneRecentBinaryDirectory(void) {
void CMakeSetupGUI::SelectOneRecentSourceDirectory(void) { void CMakeSetupGUI::SelectOneRecentSourceDirectory(void) {
} }
void CMakeSetupGUI::ClickOnConfigure(void) {
}
void CMakeSetupGUI::ClickOnOK(void) {
}
void CMakeSetupGUI::ClickOnCancel(void) {
}

View File

@ -12,8 +12,8 @@ class CMakeSetupGUI {open
Fl_Window dialogWindow { Fl_Window dialogWindow {
label CMakeSetupDialog label CMakeSetupDialog
callback {recentSourceDirectoriesBrowser->hide(); callback {recentSourceDirectoriesBrowser->hide();
recentBinaryDirectoriesBrowser->hide();} open selected recentBinaryDirectoriesBrowser->hide();}
xywh {645 144 563 363} resizable visible xywh {646 144 562 373} resizable visible
} { } {
Fl_Input sourcePathTextInput { Fl_Input sourcePathTextInput {
label {Where is the source code: } label {Where is the source code: }
@ -35,15 +35,15 @@ recentBinaryDirectoriesBrowser->hide();} open selected
callback {BrowseForBinaryPath();} callback {BrowseForBinaryPath();}
xywh {453 49 65 22} shortcut 0x80062 labelsize 11 xywh {453 49 65 22} shortcut 0x80062 labelsize 11
} }
Fl_Button {} { Fl_Button m_CancelButton {
label Close label Quit
callback {Close();} callback {ClickOnCancel();}
xywh {345 331 77 23} shortcut 0x80071 labelsize 11 xywh {435 331 77 23} shortcut 0x80071 labelsize 11
} }
Fl_Button {} { Fl_Button m_ConfigureButton {
label {Build Project Files} label {Configure Only}
callback {BuildProjectFiles();} callback {ClickOnConfigure();}
xywh {123 332 101 23} shortcut 0x8006d labelsize 11 xywh {50 332 120 23} shortcut 0x8006d labelsize 11
} }
Fl_Group {} { Fl_Group {} {
xywh {25 80 515 222} box ENGRAVED_BOX labelsize 11 align 0 resizable xywh {25 80 515 222} box ENGRAVED_BOX labelsize 11 align 0 resizable
@ -59,7 +59,7 @@ recentBinaryDirectoriesBrowser->hide();} open selected
} }
Fl_Box {} { Fl_Box {} {
label {Right click on cache entries for additional options} label {Right click on cache entries for additional options}
xywh {141 305 275 25} labelsize 11 xywh {160 305 275 25} labelsize 11
} }
Fl_Button {} { Fl_Button {} {
label {@\#2>} label {@\#2>}
@ -79,13 +79,16 @@ recentBinaryDirectoriesBrowser->hide();} open selected
callback {SelectOneRecentBinaryDirectory();} callback {SelectOneRecentBinaryDirectory();}
xywh {15 70 535 115} type Hold box BORDER_BOX hide xywh {15 70 535 115} type Hold box BORDER_BOX hide
} }
Fl_Button m_OKButton {
label {Configure and Generate Makefiles}
callback {ClickOnOK();} selected
xywh {210 332 190 23} shortcut 0x8006d labelsize 11
}
} }
} }
Function {~CMakeSetupGUI()} {} {} Function {~CMakeSetupGUI()} {} {}
Function {Close(void)} {return_type {virtual void} Function {Close(void)} {return_type {virtual void}
} {} } {}
Function {BuildProjectFiles(void)} {return_type {virtual void}
} {}
Function {BrowseForSourcePath(void)} {return_type {virtual void} Function {BrowseForSourcePath(void)} {return_type {virtual void}
} {} } {}
Function {BrowseForBinaryPath(void)} {return_type {virtual void} Function {BrowseForBinaryPath(void)} {return_type {virtual void}
@ -104,4 +107,10 @@ recentBinaryDirectoriesBrowser->hide();} open selected
} {} } {}
Function {SelectOneRecentSourceDirectory(void)} {return_type {virtual void} Function {SelectOneRecentSourceDirectory(void)} {return_type {virtual void}
} {} } {}
Function {ClickOnConfigure(void)} {return_type {virtual void}
} {}
Function {ClickOnOK(void)} {return_type {virtual void}
} {}
Function {ClickOnCancel(void)} {return_type {virtual void}
} {}
} }

View File

@ -33,10 +33,16 @@ private:
static void cb_binaryPathTextInput(Fl_Input*, void*); static void cb_binaryPathTextInput(Fl_Input*, void*);
inline void cb_Browse1_i(Fl_Button*, void*); inline void cb_Browse1_i(Fl_Button*, void*);
static void cb_Browse1(Fl_Button*, void*); static void cb_Browse1(Fl_Button*, void*);
inline void cb_Close_i(Fl_Button*, void*); public:
static void cb_Close(Fl_Button*, void*); Fl_Button *m_CancelButton;
inline void cb_Build_i(Fl_Button*, void*); private:
static void cb_Build(Fl_Button*, void*); inline void cb_m_CancelButton_i(Fl_Button*, void*);
static void cb_m_CancelButton(Fl_Button*, void*);
public:
Fl_Button *m_ConfigureButton;
private:
inline void cb_m_ConfigureButton_i(Fl_Button*, void*);
static void cb_m_ConfigureButton(Fl_Button*, void*);
public: public:
Fl_Scroll *cacheValuesScroll; Fl_Scroll *cacheValuesScroll;
Fl_Pack *propertyListPack; Fl_Pack *propertyListPack;
@ -55,10 +61,14 @@ public:
private: private:
inline void cb_recentBinaryDirectoriesBrowser_i(Fl_Browser*, void*); inline void cb_recentBinaryDirectoriesBrowser_i(Fl_Browser*, void*);
static void cb_recentBinaryDirectoriesBrowser(Fl_Browser*, void*); static void cb_recentBinaryDirectoriesBrowser(Fl_Browser*, void*);
public:
Fl_Button *m_OKButton;
private:
inline void cb_m_OKButton_i(Fl_Button*, void*);
static void cb_m_OKButton(Fl_Button*, void*);
public: public:
~CMakeSetupGUI(); ~CMakeSetupGUI();
virtual void Close(void); virtual void Close(void);
virtual void BuildProjectFiles(void);
virtual void BrowseForSourcePath(void); virtual void BrowseForSourcePath(void);
virtual void BrowseForBinaryPath(void); virtual void BrowseForBinaryPath(void);
virtual void Show(void); virtual void Show(void);
@ -68,5 +78,8 @@ public:
virtual void ShowRecentSourceDirectories(void); virtual void ShowRecentSourceDirectories(void);
virtual void SelectOneRecentBinaryDirectory(void); virtual void SelectOneRecentBinaryDirectory(void);
virtual void SelectOneRecentSourceDirectory(void); virtual void SelectOneRecentSourceDirectory(void);
virtual void ClickOnConfigure(void);
virtual void ClickOnOK(void);
virtual void ClickOnCancel(void);
}; };
#endif #endif

View File

@ -7,8 +7,10 @@
#include "../cmMakefile.h" #include "../cmMakefile.h"
#include <iostream> #include <iostream>
#include "FLTKPropertyList.h" #include "FLTKPropertyList.h"
#include "FLTKPropertyItemRow.h"
#include "FL/fl_draw.H" #include "FL/fl_draw.H"
#include "../cmake.h" #include "../cmake.h"
#include "../cmMakefileGenerator.h"
@ -308,25 +310,33 @@ CMakeSetupGUIImplementation
*/ */
void void
CMakeSetupGUIImplementation CMakeSetupGUIImplementation
::BuildProjectFiles( void ) ::RunCMake( bool generateProjectFiles )
{ {
// Take and verify the source path from the GUI if(!cmSystemTools::FileExists( m_WhereBuild.c_str() ))
if( !SetSourcePath( sourcePathTextInput->value() ) )
{ {
std::string message =
"Build directory does not exist, should I create it?\n\n"
"Directory: ";
message += m_WhereBuild;
int userWantToCreateDirectory =
fl_ask(message.c_str());
if( userWantToCreateDirectory )
{
cmSystemTools::MakeDirectory( m_WhereBuild.c_str() );
}
else
{
fl_alert("Build Project aborted, nothing done.");
return; return;
} }
// Take and verify the binary path from the GUI
if( !SetBinaryPath( binaryPathTextInput->value() ) )
{
return;
} }
// set the wait cursor // set the wait cursor
fl_cursor(FL_CURSOR_WAIT,FL_BLACK,FL_WHITE); fl_cursor(FL_CURSOR_WAIT,FL_BLACK,FL_WHITE);
// save the current GUI values to the cache // save the current GUI values to the cache
this->SaveCacheFromGUI(); this->SaveCacheFromGUI();
@ -348,11 +358,15 @@ CMakeSetupGUIImplementation
arg = "-B"; arg = "-B";
arg += m_WhereBuild; arg += m_WhereBuild;
args.push_back(arg); args.push_back(arg);
arg = "-G";
arg += m_GeneratorChoiceString;
args.push_back(arg);
// run the generate process // run the generate process
if(make.Generate(args) != 0) if(make.Generate(args, generateProjectFiles) != 0)
{ {
cmSystemTools::Error( cmSystemTools::Error(
"Error in generation process, project files may be invalid"); "Error in generation process, project files may be invalid");
cmSystemTools::ResetErrorOccuredFlag();
} }
// update the GUI with any new values in the caused by the // update the GUI with any new values in the caused by the
// generation process // generation process
@ -411,14 +425,40 @@ void
CMakeSetupGUIImplementation CMakeSetupGUIImplementation
::FillCacheGUIFromCacheManager( void ) ::FillCacheGUIFromCacheManager( void )
{ {
int size = m_CacheEntriesList.GetItems().size();
bool reverseOrder = false;
// if there are already entries in the cache, then
// put the new ones in the top, so they show up first
if(size)
{
reverseOrder = true;
}
// Prepare to add rows to the scroll // all the current values are not new any more
m_CacheEntriesList.RemoveAll(); std::set<fltk::PropertyItem*> items = m_CacheEntriesList.GetItems();
for(std::set<fltk::PropertyItem*>::iterator i = items.begin();
i != items.end(); ++i)
{
fltk::PropertyItem* item = *i;
item->m_NewValue = false;
}
// Prepare to add rows to the FLTK scroll/pack
propertyListPack->clear(); propertyListPack->clear();
propertyListPack->begin(); propertyListPack->begin();
const cmCacheManager::CacheEntryMap &cache = const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap(); cmCacheManager::GetInstance()->GetCacheMap();
if(cache.size() == 0)
{
m_OKButton->deactivate();
}
else
{
m_OKButton->activate();
}
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
i != cache.end(); ++i) i != cache.end(); ++i)
{ {
@ -433,41 +473,58 @@ CMakeSetupGUIImplementation
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"ON", "ON",
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
fltk::PropertyList::CHECKBOX,""); fltk::PropertyList::CHECKBOX,"",
reverseOrder);
} }
else else
{ {
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"OFF", "OFF",
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
fltk::PropertyList::CHECKBOX,""); fltk::PropertyList::CHECKBOX,"",
reverseOrder);
} }
break; break;
case cmCacheManager::PATH: case cmCacheManager::PATH:
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(), value.m_Value.c_str(),
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
fltk::PropertyList::PATH,""); fltk::PropertyList::PATH,"",
reverseOrder);
break; break;
case cmCacheManager::FILEPATH: case cmCacheManager::FILEPATH:
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(), value.m_Value.c_str(),
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
fltk::PropertyList::FILE,""); fltk::PropertyList::FILE,"",
reverseOrder);
break; break;
case cmCacheManager::STRING: case cmCacheManager::STRING:
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(), value.m_Value.c_str(),
value.m_HelpString.c_str(), value.m_HelpString.c_str(),
fltk::PropertyList::EDIT,""); fltk::PropertyList::EDIT,"",
reverseOrder);
break; break;
case cmCacheManager::INTERNAL: case cmCacheManager::INTERNAL:
// These entries should not be seen by the user // These entries should not be seen by the user
m_CacheEntriesList.RemoveProperty(key);
break; break;
} }
} }
// Add the old entry to the end of the pack
for(std::set<fltk::PropertyItem*>::iterator i = items.begin();
i != items.end(); ++i)
{
fltk::PropertyItem* item = *i;
if( !(item->m_NewValue) )
{
new fltk::PropertyItemRow( item ); // GUI of the old property row
}
}
propertyListPack->end(); propertyListPack->end();
propertyListPack->init_sizes(); propertyListPack->init_sizes();
cacheValuesScroll->position( 0, 0 ); cacheValuesScroll->position( 0, 0 );
@ -514,6 +571,10 @@ CMakeSetupGUIImplementation
{ {
entry->m_Value = item->m_curValue; entry->m_Value = item->m_curValue;
} }
if( item->m_Dirty )
{
m_CacheEntriesList.SetDirty();
}
} }
} }
@ -643,7 +704,10 @@ void
CMakeSetupGUIImplementation CMakeSetupGUIImplementation
::ShowRecentBinaryDirectories( void ) ::ShowRecentBinaryDirectories( void )
{ {
if( recentBinaryDirectoriesBrowser->size() )
{
recentBinaryDirectoriesBrowser->Fl_Widget::show(); recentBinaryDirectoriesBrowser->Fl_Widget::show();
}
} }
@ -654,7 +718,10 @@ void
CMakeSetupGUIImplementation CMakeSetupGUIImplementation
::ShowRecentSourceDirectories( void ) ::ShowRecentSourceDirectories( void )
{ {
if( recentSourceDirectoriesBrowser->size() )
{
recentSourceDirectoriesBrowser->Fl_Widget::show(); recentSourceDirectoriesBrowser->Fl_Widget::show();
}
} }
@ -720,3 +787,60 @@ CMakeSetupGUIImplementation
/**
* Clicked on Configure Button
*/
void
CMakeSetupGUIImplementation
::ClickOnConfigure( void )
{
this->RunCMake(false);
}
/**
* Clicked on OK Button
*/
void
CMakeSetupGUIImplementation
::ClickOnOK( void )
{
m_CacheEntriesList.ClearDirty();
this->RunCMake(true);
cmMakefileGenerator::UnRegisterGenerators();
this->Close();
}
/**
* Clicked on Cancel Button
*/
void
CMakeSetupGUIImplementation
::ClickOnCancel( void )
{
if(m_CacheEntriesList.IsDirty())
{
int userWantsExitEvenThoughOptionsHaveChanged =
fl_ask("You have changed options but not rebuilt, \n"
"are you sure you want to exit?");
if( userWantsExitEvenThoughOptionsHaveChanged )
{
this->Close();
}
}
else
{
this->Close();
}
}

View File

@ -24,7 +24,6 @@ public:
virtual void Close( void ); virtual void Close( void );
virtual void Show( void ); virtual void Show( void );
virtual void UpdateData( bool option ); virtual void UpdateData( bool option );
virtual void BuildProjectFiles( void );
virtual void BrowseForBinaryPath( void ); virtual void BrowseForBinaryPath( void );
virtual void BrowseForSourcePath( void ); virtual void BrowseForSourcePath( void );
virtual bool SetBinaryPath( const char * path ); virtual bool SetBinaryPath( const char * path );
@ -41,6 +40,10 @@ public:
virtual void SelectOneRecentSourceDirectory(void); virtual void SelectOneRecentSourceDirectory(void);
virtual void SelectOneRecentBinaryDirectory(void); virtual void SelectOneRecentBinaryDirectory(void);
virtual void UpdateListOfRecentDirectories(void); virtual void UpdateListOfRecentDirectories(void);
virtual void ClickOnConfigure(void);
virtual void ClickOnOK(void);
virtual void ClickOnCancel(void);
virtual void RunCMake( bool generateProjectFiles );
private: private:
virtual bool VerifyBinaryPath( const std::string & path ) const; virtual bool VerifyBinaryPath( const std::string & path ) const;
@ -52,6 +55,7 @@ private:
std::string m_WhereBuild; std::string m_WhereBuild;
std::string m_WhereSource; std::string m_WhereSource;
std::string m_PathToExecutable; std::string m_PathToExecutable;
std::string m_GeneratorChoiceString;
bool m_BuildPathChanged; bool m_BuildPathChanged;
std::set< std::string > m_RecentBinaryDirectories; std::set< std::string > m_RecentBinaryDirectories;

View File

@ -57,6 +57,10 @@ PropertyItemRow
m_NameButton->box( FL_DOWN_BOX ); m_NameButton->box( FL_DOWN_BOX );
m_NameButton->size( secondColumn, rowHeight ); m_NameButton->size( secondColumn, rowHeight );
m_NameButton->callback( NameButtonCallback, (void *)m_PropertyItem ); m_NameButton->callback( NameButtonCallback, (void *)m_PropertyItem );
if( m_PropertyItem->m_NewValue )
{
m_NameButton->color(FL_RED);
}
switch( m_PropertyItem->m_nItemType ) switch( m_PropertyItem->m_nItemType )
{ {
@ -272,6 +276,9 @@ CheckButtonCallback( Fl_Widget * widget, void * data)
button->label(" OFF "); button->label(" OFF ");
pItem->m_curValue = "OFF"; pItem->m_curValue = "OFF";
} }
pItem->m_Dirty = true;
button->redraw(); button->redraw();
FillCacheManagerFromCacheGUI(); FillCacheManagerFromCacheGUI();
@ -289,6 +296,8 @@ InputTextCallback( Fl_Widget * widget, void * data)
item->m_curValue = input->value(); item->m_curValue = input->value();
item->m_Dirty = true;
FillCacheManagerFromCacheGUI(); FillCacheManagerFromCacheGUI();
} }
@ -320,6 +329,8 @@ ColorSelectionCallback( Fl_Widget * widget, void * data)
colorIndex = FL_FREE_COLOR; colorIndex = FL_FREE_COLOR;
} }
propertyItem->m_Dirty = true;
colorButton->redraw(); colorButton->redraw();
FillCacheManagerFromCacheGUI(); FillCacheManagerFromCacheGUI();
@ -348,6 +359,8 @@ BrowsePathCallback( Fl_Widget * widget, void * data)
inputText->value( newpath ); inputText->value( newpath );
} }
propertyItem->m_Dirty = true;
FillCacheManagerFromCacheGUI(); FillCacheManagerFromCacheGUI();
} }

View File

@ -21,6 +21,7 @@ PropertyList::PropertyList( CMakeSetupGUIImplementation * cmakeSetup )
{ {
m_CMakeSetup = cmakeSetup; m_CMakeSetup = cmakeSetup;
PropertyItemRow::SetCMakeSetupGUI( cmakeSetup ); PropertyItemRow::SetCMakeSetupGUI( cmakeSetup );
m_Dirty = false;
} }
@ -39,28 +40,40 @@ PropertyList::~PropertyList()
int PropertyList::AddItem( std::string txt) int PropertyList::AddItem( std::string txt)
{ {
int nIndex =0;// = AddString(txt); int nIndex =0;
return nIndex; return nIndex;
} }
int PropertyList::AddPropItem(PropertyItem* pItem)
int PropertyList::AddPropItem(PropertyItem* pItem, bool reverseOrder)
{ {
int nIndex =0; //= AddString(_T("")); int nIndex =0;
// SetItemDataPtr(nIndex,pItem); if(reverseOrder)
{
nIndex = 0;
}
else
{
nIndex = m_PropertyItems.size();
}
new PropertyItemRow( pItem ); // GUI of the property row new PropertyItemRow( pItem ); // GUI of the new property row
m_PropertyItems.insert(pItem); m_PropertyItems.insert(pItem);
return nIndex; return nIndex;
} }
int PropertyList::AddProperty(const char* name, int PropertyList::AddProperty(const char* name,
const char* value, const char* value,
const char* helpString, const char* helpString,
int type, int type,
const char* comboItems) const char* comboItems,
bool reverseOrder)
{ {
PropertyItem* pItem = 0; PropertyItem* pItem = 0;
@ -84,10 +97,24 @@ int PropertyList::AddProperty(const char* name,
{ {
pItem = new PropertyItem(name, value, helpString, type, comboItems); pItem = new PropertyItem(name, value, helpString, type, comboItems);
} }
return this->AddPropItem(pItem); return this->AddPropItem(pItem,reverseOrder);
} }
void PropertyList::RemoveProperty(const char* name)
{
for(int i =0; i < this->GetCount(); ++i)
{
PropertyItem* pItem = (PropertyItem*) GetItemDataPtr(i);
if(pItem->m_propName == name)
{
m_PropertyItems.erase(pItem);
delete pItem;
return;
}
}
}
void PropertyList::RemoveAll() void PropertyList::RemoveAll()
@ -99,7 +126,6 @@ void PropertyList::RemoveAll()
cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str()); cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str());
m_PropertyItems.erase(pItem); m_PropertyItems.erase(pItem);
delete pItem; delete pItem;
// this->DeleteString(0);
} }
Invalidate(); Invalidate();
} }
@ -127,6 +153,13 @@ PropertyItem * PropertyList::GetItem(int index)
return *it; return *it;
} }
void
PropertyList
::InvalidateList(void)
{
Invalidate();
m_Dirty = true;
}
} // end fltk namespace } // end fltk namespace

View File

@ -23,6 +23,8 @@ public:
int m_nItemType; int m_nItemType;
std::string m_cmbItems; std::string m_cmbItems;
bool m_Removed; bool m_Removed;
bool m_NewValue;
bool m_Dirty;
public: public:
PropertyItem( std::string propName, PropertyItem( std::string propName,
std::string curValue, std::string curValue,
@ -31,11 +33,13 @@ public:
std::string cmbItems ) std::string cmbItems )
{ {
m_HelpString = helpString; m_HelpString = helpString;
m_Removed = false;
m_propName = propName; m_propName = propName;
m_curValue = curValue; m_curValue = curValue;
m_nItemType = nItemType; m_nItemType = nItemType;
m_cmbItems = cmbItems; m_cmbItems = cmbItems;
m_Removed = false;
m_NewValue = true;
m_Dirty = false;
} }
}; };
@ -73,11 +77,15 @@ public:
const char* value, const char* value,
const char* helpString, const char* helpString,
int type, int type,
const char* comboItems); const char* comboItems,
std::set<PropertyItem*> GetItems() bool reverseOrder);
void RemoveProperty(const char* name);
std::set<PropertyItem*> & GetItems()
{ {
return m_PropertyItems; return m_PropertyItems;
} }
void InvalidateList(void);
void Invalidate(void) void Invalidate(void)
{ {
// fltk redraw(); // fltk redraw();
@ -93,18 +101,24 @@ public:
PropertyItem* GetItem(int index); PropertyItem* GetItem(int index);
PropertyItem* GetItemDataPtr(int m_curSel); PropertyItem* GetItemDataPtr(int m_curSel);
void ClearDirty(void) { m_Dirty = false; }
void SetDirty(void) { m_Dirty = true; }
bool IsDirty(void) const { return m_Dirty; }
// Implementation // Implementation
public: public:
virtual ~PropertyList(); virtual ~PropertyList();
protected: protected:
int AddPropItem(PropertyItem* pItem); int AddPropItem(PropertyItem* pItem,bool reverseOrder);
std::set<PropertyItem*> m_PropertyItems; std::set<PropertyItem*> m_PropertyItems;
CMakeSetupGUIImplementation * m_CMakeSetup; CMakeSetupGUIImplementation * m_CMakeSetup;
bool m_Dirty;
}; };