diff options
author | Luis Ibanez <luis.ibanez@kitware.com> | 2001-10-28 03:47:23 (GMT) |
---|---|---|
committer | Luis Ibanez <luis.ibanez@kitware.com> | 2001-10-28 03:47:23 (GMT) |
commit | f90e25894157601d9776f3bf2f04407ce19eebab (patch) | |
tree | 24c6cea2286a2028b270c8b9aa25db475e3fd1fd /Source/FLTKDialog | |
parent | 0fb47ad240d3a3a0cb2ff12c5c34aef27095a041 (diff) | |
download | CMake-f90e25894157601d9776f3bf2f04407ce19eebab.zip CMake-f90e25894157601d9776f3bf2f04407ce19eebab.tar.gz CMake-f90e25894157601d9776f3bf2f04407ce19eebab.tar.bz2 |
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.
Diffstat (limited to 'Source/FLTKDialog')
-rw-r--r-- | Source/FLTKDialog/CMakeSetupGUI.cxx | 52 | ||||
-rw-r--r-- | Source/FLTKDialog/CMakeSetupGUI.fl | 35 | ||||
-rw-r--r-- | Source/FLTKDialog/CMakeSetupGUI.h | 23 | ||||
-rw-r--r-- | Source/FLTKDialog/CMakeSetupGUIImplementation.cxx | 170 | ||||
-rw-r--r-- | Source/FLTKDialog/CMakeSetupGUIImplementation.h | 6 | ||||
-rw-r--r-- | Source/FLTKDialog/FLTKPropertyItemRow.cxx | 13 | ||||
-rw-r--r-- | Source/FLTKDialog/FLTKPropertyList.cxx | 49 | ||||
-rw-r--r-- | Source/FLTKDialog/FLTKPropertyList.h | 32 |
8 files changed, 304 insertions, 76 deletions
diff --git a/Source/FLTKDialog/CMakeSetupGUI.cxx b/Source/FLTKDialog/CMakeSetupGUI.cxx index 62e7619..858cacb 100644 --- a/Source/FLTKDialog/CMakeSetupGUI.cxx +++ b/Source/FLTKDialog/CMakeSetupGUI.cxx @@ -38,18 +38,18 @@ void CMakeSetupGUI::cb_Browse1(Fl_Button* o, void* v) { ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Browse1_i(o,v); } -inline void CMakeSetupGUI::cb_Close_i(Fl_Button*, void*) { - Close(); +inline void CMakeSetupGUI::cb_m_CancelButton_i(Fl_Button*, void*) { + ClickOnCancel(); } -void CMakeSetupGUI::cb_Close(Fl_Button* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Close_i(o,v); +void CMakeSetupGUI::cb_m_CancelButton(Fl_Button* o, void* v) { + ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_m_CancelButton_i(o,v); } -inline void CMakeSetupGUI::cb_Build_i(Fl_Button*, void*) { - BuildProjectFiles(); +inline void CMakeSetupGUI::cb_m_ConfigureButton_i(Fl_Button*, void*) { + ClickOnConfigure(); } -void CMakeSetupGUI::cb_Build(Fl_Button* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Build_i(o,v); +void CMakeSetupGUI::cb_m_ConfigureButton(Fl_Button* o, void* v) { + ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_m_ConfigureButton_i(o,v); } 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); } +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() { 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; o->callback((Fl_Callback*)cb_dialogWindow, (void*)(this)); { 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->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->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->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); o->box(FL_ENGRAVED_BOX); @@ -137,7 +144,7 @@ CMakeSetupGUI::CMakeSetupGUI() { o->end(); 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); } { Fl_Button* o = new Fl_Button(420, 15, 22, 21, "@#2>"); @@ -160,6 +167,11 @@ CMakeSetupGUI::CMakeSetupGUI() { o->callback((Fl_Callback*)cb_recentBinaryDirectoriesBrowser); 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(); } } @@ -170,9 +182,6 @@ CMakeSetupGUI::~CMakeSetupGUI() { void CMakeSetupGUI::Close(void) { } -void CMakeSetupGUI::BuildProjectFiles(void) { -} - void CMakeSetupGUI::BrowseForSourcePath(void) { } @@ -199,3 +208,12 @@ void CMakeSetupGUI::SelectOneRecentBinaryDirectory(void) { void CMakeSetupGUI::SelectOneRecentSourceDirectory(void) { } + +void CMakeSetupGUI::ClickOnConfigure(void) { +} + +void CMakeSetupGUI::ClickOnOK(void) { +} + +void CMakeSetupGUI::ClickOnCancel(void) { +} diff --git a/Source/FLTKDialog/CMakeSetupGUI.fl b/Source/FLTKDialog/CMakeSetupGUI.fl index ab24bc8..90ecd80 100644 --- a/Source/FLTKDialog/CMakeSetupGUI.fl +++ b/Source/FLTKDialog/CMakeSetupGUI.fl @@ -12,8 +12,8 @@ class CMakeSetupGUI {open Fl_Window dialogWindow { label CMakeSetupDialog callback {recentSourceDirectoriesBrowser->hide(); -recentBinaryDirectoriesBrowser->hide();} open selected - xywh {645 144 563 363} resizable visible +recentBinaryDirectoriesBrowser->hide();} + xywh {646 144 562 373} resizable visible } { Fl_Input sourcePathTextInput { label {Where is the source code: } @@ -35,15 +35,15 @@ recentBinaryDirectoriesBrowser->hide();} open selected callback {BrowseForBinaryPath();} xywh {453 49 65 22} shortcut 0x80062 labelsize 11 } - Fl_Button {} { - label Close - callback {Close();} - xywh {345 331 77 23} shortcut 0x80071 labelsize 11 + Fl_Button m_CancelButton { + label Quit + callback {ClickOnCancel();} + xywh {435 331 77 23} shortcut 0x80071 labelsize 11 } - Fl_Button {} { - label {Build Project Files} - callback {BuildProjectFiles();} - xywh {123 332 101 23} shortcut 0x8006d labelsize 11 + Fl_Button m_ConfigureButton { + label {Configure Only} + callback {ClickOnConfigure();} + xywh {50 332 120 23} shortcut 0x8006d labelsize 11 } Fl_Group {} { xywh {25 80 515 222} box ENGRAVED_BOX labelsize 11 align 0 resizable @@ -59,7 +59,7 @@ recentBinaryDirectoriesBrowser->hide();} open selected } Fl_Box {} { 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 {} { label {@\#2>} @@ -79,13 +79,16 @@ recentBinaryDirectoriesBrowser->hide();} open selected callback {SelectOneRecentBinaryDirectory();} 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 {Close(void)} {return_type {virtual void} } {} - Function {BuildProjectFiles(void)} {return_type {virtual void} - } {} Function {BrowseForSourcePath(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 {ClickOnConfigure(void)} {return_type {virtual void} + } {} + Function {ClickOnOK(void)} {return_type {virtual void} + } {} + Function {ClickOnCancel(void)} {return_type {virtual void} + } {} } diff --git a/Source/FLTKDialog/CMakeSetupGUI.h b/Source/FLTKDialog/CMakeSetupGUI.h index e28e8e3..2a26f92 100644 --- a/Source/FLTKDialog/CMakeSetupGUI.h +++ b/Source/FLTKDialog/CMakeSetupGUI.h @@ -33,10 +33,16 @@ private: static void cb_binaryPathTextInput(Fl_Input*, void*); inline void cb_Browse1_i(Fl_Button*, void*); static void cb_Browse1(Fl_Button*, void*); - inline void cb_Close_i(Fl_Button*, void*); - static void cb_Close(Fl_Button*, void*); - inline void cb_Build_i(Fl_Button*, void*); - static void cb_Build(Fl_Button*, void*); +public: + Fl_Button *m_CancelButton; +private: + 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: Fl_Scroll *cacheValuesScroll; Fl_Pack *propertyListPack; @@ -56,9 +62,13 @@ private: inline void cb_recentBinaryDirectoriesBrowser_i(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: ~CMakeSetupGUI(); virtual void Close(void); - virtual void BuildProjectFiles(void); virtual void BrowseForSourcePath(void); virtual void BrowseForBinaryPath(void); virtual void Show(void); @@ -68,5 +78,8 @@ public: virtual void ShowRecentSourceDirectories(void); virtual void SelectOneRecentBinaryDirectory(void); virtual void SelectOneRecentSourceDirectory(void); + virtual void ClickOnConfigure(void); + virtual void ClickOnOK(void); + virtual void ClickOnCancel(void); }; #endif diff --git a/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx b/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx index 6b47c2c..1961a36 100644 --- a/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx +++ b/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx @@ -7,8 +7,10 @@ #include "../cmMakefile.h" #include <iostream> #include "FLTKPropertyList.h" +#include "FLTKPropertyItemRow.h" #include "FL/fl_draw.H" #include "../cmake.h" +#include "../cmMakefileGenerator.h" @@ -308,25 +310,33 @@ CMakeSetupGUIImplementation */ void CMakeSetupGUIImplementation -::BuildProjectFiles( void ) +::RunCMake( bool generateProjectFiles ) { - // Take and verify the source path from the GUI - if( !SetSourcePath( sourcePathTextInput->value() ) ) - { - return; - } - - // Take and verify the binary path from the GUI - if( !SetBinaryPath( binaryPathTextInput->value() ) ) - { - return; - } - + if(!cmSystemTools::FileExists( m_WhereBuild.c_str() )) + { + 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; + } + } + // set the wait cursor fl_cursor(FL_CURSOR_WAIT,FL_BLACK,FL_WHITE); + // save the current GUI values to the cache this->SaveCacheFromGUI(); @@ -348,11 +358,15 @@ CMakeSetupGUIImplementation arg = "-B"; arg += m_WhereBuild; args.push_back(arg); + arg = "-G"; + arg += m_GeneratorChoiceString; + args.push_back(arg); // run the generate process - if(make.Generate(args) != 0) + if(make.Generate(args, generateProjectFiles) != 0) { cmSystemTools::Error( "Error in generation process, project files may be invalid"); + cmSystemTools::ResetErrorOccuredFlag(); } // update the GUI with any new values in the caused by the // generation process @@ -411,14 +425,40 @@ void CMakeSetupGUIImplementation ::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 - m_CacheEntriesList.RemoveAll(); + // all the current values are not new any more + 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->begin(); const cmCacheManager::CacheEntryMap &cache = cmCacheManager::GetInstance()->GetCacheMap(); + if(cache.size() == 0) + { + m_OKButton->deactivate(); + } + else + { + m_OKButton->activate(); + } + + + for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); i != cache.end(); ++i) { @@ -433,41 +473,58 @@ CMakeSetupGUIImplementation m_CacheEntriesList.AddProperty(key, "ON", value.m_HelpString.c_str(), - fltk::PropertyList::CHECKBOX,""); + fltk::PropertyList::CHECKBOX,"", + reverseOrder); } else { m_CacheEntriesList.AddProperty(key, "OFF", value.m_HelpString.c_str(), - fltk::PropertyList::CHECKBOX,""); + fltk::PropertyList::CHECKBOX,"", + reverseOrder); } break; case cmCacheManager::PATH: m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), value.m_HelpString.c_str(), - fltk::PropertyList::PATH,""); + fltk::PropertyList::PATH,"", + reverseOrder); break; case cmCacheManager::FILEPATH: m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), value.m_HelpString.c_str(), - fltk::PropertyList::FILE,""); + fltk::PropertyList::FILE,"", + reverseOrder); break; case cmCacheManager::STRING: m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), value.m_HelpString.c_str(), - fltk::PropertyList::EDIT,""); + fltk::PropertyList::EDIT,"", + reverseOrder); break; case cmCacheManager::INTERNAL: // These entries should not be seen by the user + m_CacheEntriesList.RemoveProperty(key); 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->init_sizes(); cacheValuesScroll->position( 0, 0 ); @@ -514,6 +571,10 @@ CMakeSetupGUIImplementation { entry->m_Value = item->m_curValue; } + if( item->m_Dirty ) + { + m_CacheEntriesList.SetDirty(); + } } } @@ -643,7 +704,10 @@ void CMakeSetupGUIImplementation ::ShowRecentBinaryDirectories( void ) { - recentBinaryDirectoriesBrowser->Fl_Widget::show(); + if( recentBinaryDirectoriesBrowser->size() ) + { + recentBinaryDirectoriesBrowser->Fl_Widget::show(); + } } @@ -654,7 +718,10 @@ void CMakeSetupGUIImplementation ::ShowRecentSourceDirectories( void ) { - recentSourceDirectoriesBrowser->Fl_Widget::show(); + if( recentSourceDirectoriesBrowser->size() ) + { + 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(); + } + +} + + + + + diff --git a/Source/FLTKDialog/CMakeSetupGUIImplementation.h b/Source/FLTKDialog/CMakeSetupGUIImplementation.h index 273ac16..a6a209a 100644 --- a/Source/FLTKDialog/CMakeSetupGUIImplementation.h +++ b/Source/FLTKDialog/CMakeSetupGUIImplementation.h @@ -24,7 +24,6 @@ public: virtual void Close( void ); virtual void Show( void ); virtual void UpdateData( bool option ); - virtual void BuildProjectFiles( void ); virtual void BrowseForBinaryPath( void ); virtual void BrowseForSourcePath( void ); virtual bool SetBinaryPath( const char * path ); @@ -41,6 +40,10 @@ public: virtual void SelectOneRecentSourceDirectory(void); virtual void SelectOneRecentBinaryDirectory(void); virtual void UpdateListOfRecentDirectories(void); + virtual void ClickOnConfigure(void); + virtual void ClickOnOK(void); + virtual void ClickOnCancel(void); + virtual void RunCMake( bool generateProjectFiles ); private: virtual bool VerifyBinaryPath( const std::string & path ) const; @@ -52,6 +55,7 @@ private: std::string m_WhereBuild; std::string m_WhereSource; std::string m_PathToExecutable; + std::string m_GeneratorChoiceString; bool m_BuildPathChanged; std::set< std::string > m_RecentBinaryDirectories; diff --git a/Source/FLTKDialog/FLTKPropertyItemRow.cxx b/Source/FLTKDialog/FLTKPropertyItemRow.cxx index fa259f7..47c9d26 100644 --- a/Source/FLTKDialog/FLTKPropertyItemRow.cxx +++ b/Source/FLTKDialog/FLTKPropertyItemRow.cxx @@ -57,6 +57,10 @@ PropertyItemRow m_NameButton->box( FL_DOWN_BOX ); m_NameButton->size( secondColumn, rowHeight ); m_NameButton->callback( NameButtonCallback, (void *)m_PropertyItem ); + if( m_PropertyItem->m_NewValue ) + { + m_NameButton->color(FL_RED); + } switch( m_PropertyItem->m_nItemType ) { @@ -272,6 +276,9 @@ CheckButtonCallback( Fl_Widget * widget, void * data) button->label(" OFF "); pItem->m_curValue = "OFF"; } + + pItem->m_Dirty = true; + button->redraw(); FillCacheManagerFromCacheGUI(); @@ -289,6 +296,8 @@ InputTextCallback( Fl_Widget * widget, void * data) item->m_curValue = input->value(); + item->m_Dirty = true; + FillCacheManagerFromCacheGUI(); } @@ -320,6 +329,8 @@ ColorSelectionCallback( Fl_Widget * widget, void * data) colorIndex = FL_FREE_COLOR; } + propertyItem->m_Dirty = true; + colorButton->redraw(); FillCacheManagerFromCacheGUI(); @@ -348,6 +359,8 @@ BrowsePathCallback( Fl_Widget * widget, void * data) inputText->value( newpath ); } + propertyItem->m_Dirty = true; + FillCacheManagerFromCacheGUI(); } diff --git a/Source/FLTKDialog/FLTKPropertyList.cxx b/Source/FLTKDialog/FLTKPropertyList.cxx index 70a6255..8072a60 100644 --- a/Source/FLTKDialog/FLTKPropertyList.cxx +++ b/Source/FLTKDialog/FLTKPropertyList.cxx @@ -21,6 +21,7 @@ PropertyList::PropertyList( CMakeSetupGUIImplementation * cmakeSetup ) { m_CMakeSetup = cmakeSetup; PropertyItemRow::SetCMakeSetupGUI( cmakeSetup ); + m_Dirty = false; } @@ -39,28 +40,40 @@ PropertyList::~PropertyList() int PropertyList::AddItem( std::string txt) { - int nIndex =0;// = AddString(txt); + int nIndex =0; return nIndex; } -int PropertyList::AddPropItem(PropertyItem* pItem) + + +int PropertyList::AddPropItem(PropertyItem* pItem, bool reverseOrder) { - int nIndex =0; //= AddString(_T("")); - // SetItemDataPtr(nIndex,pItem); + int nIndex =0; + 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); return nIndex; } + + int PropertyList::AddProperty(const char* name, const char* value, const char* helpString, int type, - const char* comboItems) + const char* comboItems, + bool reverseOrder) { PropertyItem* pItem = 0; @@ -84,10 +97,24 @@ int PropertyList::AddProperty(const char* name, { 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() @@ -99,7 +126,6 @@ void PropertyList::RemoveAll() cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str()); m_PropertyItems.erase(pItem); delete pItem; - // this->DeleteString(0); } Invalidate(); } @@ -127,6 +153,13 @@ PropertyItem * PropertyList::GetItem(int index) return *it; } +void +PropertyList +::InvalidateList(void) +{ + Invalidate(); + m_Dirty = true; +} } // end fltk namespace diff --git a/Source/FLTKDialog/FLTKPropertyList.h b/Source/FLTKDialog/FLTKPropertyList.h index ef1318d..ea98609 100644 --- a/Source/FLTKDialog/FLTKPropertyList.h +++ b/Source/FLTKDialog/FLTKPropertyList.h @@ -23,6 +23,8 @@ public: int m_nItemType; std::string m_cmbItems; bool m_Removed; + bool m_NewValue; + bool m_Dirty; public: PropertyItem( std::string propName, std::string curValue, @@ -30,12 +32,14 @@ public: int nItemType, std::string cmbItems ) { - m_HelpString = helpString; - m_Removed = false; - m_propName = propName; - m_curValue = curValue; - m_nItemType = nItemType; - m_cmbItems = cmbItems; + m_HelpString = helpString; + m_propName = propName; + m_curValue = curValue; + m_nItemType = nItemType; + m_cmbItems = cmbItems; + m_Removed = false; + m_NewValue = true; + m_Dirty = false; } }; @@ -73,11 +77,15 @@ public: const char* value, const char* helpString, int type, - const char* comboItems); - std::set<PropertyItem*> GetItems() + const char* comboItems, + bool reverseOrder); + void RemoveProperty(const char* name); + std::set<PropertyItem*> & GetItems() { return m_PropertyItems; } + + void InvalidateList(void); void Invalidate(void) { // fltk redraw(); @@ -93,18 +101,24 @@ public: PropertyItem* GetItem(int index); 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 public: virtual ~PropertyList(); protected: - int AddPropItem(PropertyItem* pItem); + int AddPropItem(PropertyItem* pItem,bool reverseOrder); std::set<PropertyItem*> m_PropertyItems; CMakeSetupGUIImplementation * m_CMakeSetup; + bool m_Dirty; + }; |