From 7b996f791044f45c67f213ff57c39fc881e7e992 Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Sun, 10 Jun 2001 18:25:38 -0400 Subject: [PATCH] .cpp renamed as .cxx --- Source/FLTKDialog/CMakeSetupGUI.cpp | 131 ------- .../CMakeSetupGUIImplementation.cpp | 364 ------------------ Source/FLTKDialog/FLTKDialog.cpp | 23 -- Source/FLTKDialog/FLTKPropertyList.cpp | 196 ---------- 4 files changed, 714 deletions(-) delete mode 100644 Source/FLTKDialog/CMakeSetupGUI.cpp delete mode 100644 Source/FLTKDialog/CMakeSetupGUIImplementation.cpp delete mode 100644 Source/FLTKDialog/FLTKDialog.cpp delete mode 100644 Source/FLTKDialog/FLTKPropertyList.cpp diff --git a/Source/FLTKDialog/CMakeSetupGUI.cpp b/Source/FLTKDialog/CMakeSetupGUI.cpp deleted file mode 100644 index 71f5e1ef3..000000000 --- a/Source/FLTKDialog/CMakeSetupGUI.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0010 - -#include "CMakeSetupGUI.h" - -inline void CMakeSetupGUI::cb_sourcePathTextInput_i(Fl_Input*, void*) { - SetSourcePath( sourcePathTextInput->value() ); -} -void CMakeSetupGUI::cb_sourcePathTextInput(Fl_Input* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_sourcePathTextInput_i(o,v); -} - -inline void CMakeSetupGUI::cb_Browse_i(Fl_Button*, void*) { - BrowseForSourcePath(); -} -void CMakeSetupGUI::cb_Browse(Fl_Button* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Browse_i(o,v); -} - -inline void CMakeSetupGUI::cb_binaryPathTextInput_i(Fl_Input*, void*) { - SetBinaryPath( binaryPathTextInput->value() ); -} -void CMakeSetupGUI::cb_binaryPathTextInput(Fl_Input* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_binaryPathTextInput_i(o,v); -} - -inline void CMakeSetupGUI::cb_Browse1_i(Fl_Button*, void*) { - BrowseForBinaryPath(); -} -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(); -} -void CMakeSetupGUI::cb_Close(Fl_Button* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Close_i(o,v); -} - -inline void CMakeSetupGUI::cb_Build_i(Fl_Button*, void*) { - BuildProjectFiles(); -} -void CMakeSetupGUI::cb_Build(Fl_Button* o, void* v) { - ((CMakeSetupGUI*)(o->parent()->user_data()))->cb_Build_i(o,v); -} - -CMakeSetupGUI::CMakeSetupGUI() { - Fl_Window* w; - { Fl_Window* o = dialogWindow = new Fl_Window(563, 363, "CMakeSetupDialog"); - w = o; - o->user_data((void*)(this)); - { Fl_Input* o = sourcePathTextInput = new Fl_Input(219, 15, 200, 20, "Where is the source code: "); - o->labelsize(11); - o->textsize(11); - o->callback((Fl_Callback*)cb_sourcePathTextInput); - o->when(FL_WHEN_ENTER_KEY); - } - { Fl_Button* o = new Fl_Button(426, 14, 65, 22, "Browse..."); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Browse); - } - { Fl_Input* o = binaryPathTextInput = new Fl_Input(219, 50, 200, 20, "Where do you want to build the binaries: "); - o->labelsize(11); - o->textsize(11); - o->callback((Fl_Callback*)cb_binaryPathTextInput); - o->when(FL_WHEN_ENTER_KEY); - } - { Fl_Button* o = new Fl_Button(426, 50, 65, 22, "Browse..."); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Browse1); - } - { Fl_Button* o = new Fl_Button(345, 331, 77, 23, "Close"); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Close); - } - { Fl_Button* o = new Fl_Button(123, 332, 101, 23, "Build Project Files"); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Build); - } - { Fl_Group* o = new Fl_Group(25, 80, 515, 222); - o->box(FL_ENGRAVED_FRAME); - o->labelsize(11); - o->align(FL_ALIGN_CENTER); - { Fl_Scroll* o = new Fl_Scroll(40, 98, 485, 190, "Cache Values"); - o->type(6); - o->box(FL_DOWN_BOX); - o->labelsize(11); - o->align(FL_ALIGN_TOP_LEFT); - { Fl_Pack* o = propertyListPack = new Fl_Pack(40, 99, 485, 185); - InsertProperties(); - o->end(); - Fl_Group::current()->resizable(o); - } - o->end(); - } - 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"); - o->labelsize(11); - } - o->end(); - } -} - -CMakeSetupGUI::~CMakeSetupGUI() { -} - -void CMakeSetupGUI::Close(void) { -} - -void CMakeSetupGUI::BuildProjectFiles(void) { -} - -void CMakeSetupGUI::BrowseForSourcePath(void) { -} - -void CMakeSetupGUI::BrowseForBinaryPath(void) { -} - -void CMakeSetupGUI::Show(void) { -} - -void CMakeSetupGUI::SetBinaryPath(const char *) { -} - -void CMakeSetupGUI::SetSourcePath(const char *) { -} - -void CMakeSetupGUI::InsertProperties(void) { -} diff --git a/Source/FLTKDialog/CMakeSetupGUIImplementation.cpp b/Source/FLTKDialog/CMakeSetupGUIImplementation.cpp deleted file mode 100644 index b3ce5200a..000000000 --- a/Source/FLTKDialog/CMakeSetupGUIImplementation.cpp +++ /dev/null @@ -1,364 +0,0 @@ - -#include "CMakeSetupGUIImplementation.h" -#include "Fl/fl_file_chooser.H" -#include "Fl/filename.H" -#include "Fl/fl_ask.H" -#include "cstring" -#include "../cmCacheManager.h" -#include "../cmMakefile.h" -#include - - - -/** - * Constructor - */ -CMakeSetupGUIImplementation -::CMakeSetupGUIImplementation() -{ -} - - - -/** - * Destructor - */ -CMakeSetupGUIImplementation -::~CMakeSetupGUIImplementation() -{ -} - - - -/** - * Insert Properties on the Scroll/Pack widget - */ -void -CMakeSetupGUIImplementation -::InsertProperties( void ) -{ - for(unsigned int i=0; i<20; i++) - { - std::cout << "new button" << std::endl; - new Fl_Button(30,30*i,100,25,"Azucar"); - } -} - - - - -/** - * Show the graphic interface - */ -void -CMakeSetupGUIImplementation -::Show( void ) -{ - dialogWindow->show(); -} - - - - - -/** - * Hide the graphic interface - */ -void -CMakeSetupGUIImplementation -::Close( void ) -{ - dialogWindow->hide(); -} - - - - - -/** - * Browse for the path to the sources - */ -void -CMakeSetupGUIImplementation -::BrowseForSourcePath( void ) -{ - const char * path = - fl_file_chooser( - "Path to Sources", - "", - sourcePathTextInput->value() ); - - if( !path ) - { - return; - } - - SetSourcePath( path ); - -} - - - - -/** - * Browse for the path to the binaries - */ -void -CMakeSetupGUIImplementation -::BrowseForBinaryPath( void ) -{ - const char * path = - fl_file_chooser( - "Path to Binaries", - "", - binaryPathTextInput->value() ); - - if( !path ) - { - return; - } - - SetBinaryPath( path ); - -} - - - - - -/** - * Set the source path - */ -void -CMakeSetupGUIImplementation -::SetSourcePath( const char * path ) -{ - if( VerifySourcePath( path ) ) - { - sourcePathTextInput->value( path ); - } - -} - - - - -/** - * Set the binary path - */ -void -CMakeSetupGUIImplementation -::SetBinaryPath( const char * path ) -{ - - if( VerifyBinaryPath( path ) ) - { - binaryPathTextInput->value( path ); - } - - LoadCacheFromDiskToGUI(); -} - - - -/** - * Verify the path to binaries - */ -bool -CMakeSetupGUIImplementation -::VerifyBinaryPath( const char * path ) -{ - - if( !path || strlen(path)==0 ) - { - fl_alert("Please select the path to the binaries"); - return false; - } - - - if( !filename_isdir( path ) ) - { - fl_alert("%s \n Doesn't exist or is not a directory",path); - return false; - } - - return true; -} - - - -/** - * Verify the path to sources - */ -bool -CMakeSetupGUIImplementation -::VerifySourcePath( const char * path ) -{ - - if( !path || strlen(path)==0 ) - { - fl_alert("Please select the path to the sources"); - return false; - } - - - if( !filename_isdir( path ) ) - { - fl_alert("%s \n Doesn't exist or is not a directory",path); - return false; - } - - return true; -} - - - - -/** - * Build the project files - */ -void -CMakeSetupGUIImplementation -::BuildProjectFiles( void ) -{ - - // Verify that source path is a valid directory - if( !VerifySourcePath( sourcePathTextInput->value() ) ) - { - return; - } - - // Verify that binary path is a valid directory - if( !VerifyBinaryPath( binaryPathTextInput->value() ) ) - { - return; - } - - SaveCacheFromGUI(); - - fl_message("Building project files ... please wait"); - -} - - - - -/** - * Load Cache from disk to GUI - */ -void -CMakeSetupGUIImplementation -::LoadCacheFromDiskToGUI( void ) -{ - - const char * m_WhereBuild = binaryPathTextInput->value(); - - if( m_WhereBuild != "" ) - { - cmCacheManager::GetInstance()->LoadCache(m_WhereBuild); - - // Make sure the internal "CMAKE" cache entry is set. - const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue("CMAKE"); - if(!cacheValue) - { - // Find our own exectuable. - std::string cMakeCMD = "\""+cmSystemTools::GetProgramPath(_pgmptr); - cMakeCMD += "/CMakeSetupCMD.exe\""; - - // Save the value in the cache - cmCacheManager::GetInstance()->AddCacheEntry("CMAKE", - cMakeCMD.c_str(), - "Path to CMake executable.", - cmCacheManager::INTERNAL); - } - - this->FillCacheGUIFromCacheManager(); - } -} - - - -/** - * Save Cache from disk to GUI - */ -void -CMakeSetupGUIImplementation -::SaveCacheFromGUI( void ) -{ -} - - -/** - * Fill Cache GUI from cache manager - */ -void -CMakeSetupGUIImplementation -::FillCacheGUIFromCacheManager( void ) -{ - const cmCacheManager::CacheEntryMap &cache = - cmCacheManager::GetInstance()->GetCacheMap(); - for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); - i != cache.end(); ++i) - { - const char* key = i->first.c_str(); - const cmCacheManager::CacheEntry& value = i->second; - - switch(value.m_Type ) - { - case cmCacheManager::BOOL: - if(cmCacheManager::GetInstance()->IsOn(key)) - { - m_CacheEntriesList.AddProperty(key, - "ON", - value.m_HelpString.c_str(), - fltk::PropertyList::CHECKBOX,""); - } - else - { - m_CacheEntriesList.AddProperty(key, - "OFF", - value.m_HelpString.c_str(), - fltk::PropertyList::CHECKBOX,""); - } - break; - case cmCacheManager::PATH: - m_CacheEntriesList.AddProperty(key, - value.m_Value.c_str(), - value.m_HelpString.c_str(), - fltk::PropertyList::PATH,""); - break; - case cmCacheManager::FILEPATH: - m_CacheEntriesList.AddProperty(key, - value.m_Value.c_str(), - value.m_HelpString.c_str(), - fltk::PropertyList::FILE,""); - break; - case cmCacheManager::STRING: - m_CacheEntriesList.AddProperty(key, - value.m_Value.c_str(), - value.m_HelpString.c_str(), - fltk::PropertyList::EDIT,""); - break; - case cmCacheManager::INTERNAL: - break; - } - - } - this->UpdateData(false); - -} - - -/** - * UpdateData - */ -void -CMakeSetupGUIImplementation -::UpdateData( bool option ) -{ - dialogWindow->redraw(); - Fl::check(); -} - - - diff --git a/Source/FLTKDialog/FLTKDialog.cpp b/Source/FLTKDialog/FLTKDialog.cpp deleted file mode 100644 index 2d3666a02..000000000 --- a/Source/FLTKDialog/FLTKDialog.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -#include "CMakeSetupGUIImplementation.h" -#include "FL/FL.h" -#include "FL/FL_ask.H" - -int main() -{ - - fl_message_font(FL_HELVETICA,11); - - CMakeSetupGUIImplementation * gui - = new CMakeSetupGUIImplementation; - - gui->Show(); - gui->LoadCacheFromDiskToGUI(); - - Fl::run(); - - delete gui; - - return 0; - -} diff --git a/Source/FLTKDialog/FLTKPropertyList.cpp b/Source/FLTKDialog/FLTKPropertyList.cpp deleted file mode 100644 index 8f5208b7d..000000000 --- a/Source/FLTKDialog/FLTKPropertyList.cpp +++ /dev/null @@ -1,196 +0,0 @@ -// FLTKPropertyList.cpp : implementation file -// - -#include "FLTKPropertyList.h" -#include "../cmCacheManager.h" -#include "Fl/filename.H" -#include "Fl/fl_file_chooser.H" -#include "Fl/fl_color_chooser.H" -#include "Fl/fl_ask.H" - -namespace fltk { - -///////////////////////////////////////////////////////////////////////////// -// PropertyList - -PropertyList::PropertyList() -{ - m_Dirty = false; - m_curSel = -1; -} - -PropertyList::~PropertyList() -{ - for(std::set::iterator i = m_PropertyItems.begin(); - i != m_PropertyItems.end(); ++i) - { - delete *i; - } -} - - - - -int PropertyList::AddItem(string txt) -{ - int nIndex =0;// = AddString(txt); - return nIndex; -} - -int PropertyList::AddPropItem(PropertyItem* pItem) -{ - int nIndex =0; //= AddString(_T("")); - // SetItemDataPtr(nIndex,pItem); - m_PropertyItems.insert(pItem); - return nIndex; -} - -int PropertyList::AddProperty(const char* name, - const char* value, - const char* helpString, - int type, - const char* comboItems) -{ - std::cout << "Adding property type: " << type; - std::cout << " Name " << name; - std::cout << " = " << value << std::endl; - - PropertyItem* pItem = 0; - for(int i =0; i < this->GetCount(); ++i) - { - PropertyItem* item = this->GetItem(i); - if(item->m_propName == name) - { - pItem = item; - if(pItem->m_curValue != value) - { - pItem->m_curValue = value; - pItem->m_HelpString = helpString; - m_Dirty = true; - Invalidate(); - } - return i; - } - } - // if it is not found, then create a new one - if(!pItem) - { - pItem = new PropertyItem(name, value, helpString, type, comboItems); - } - return this->AddPropItem(pItem); -} - - - - -void PropertyList::OnButton() -{ - PropertyItem* pItem = (PropertyItem*) GetItemDataPtr(m_curSel); - - //display the appropriate common dialog depending on what type - //of chooser is associated with the property - if (pItem->m_nItemType == PropertyList::COLOR) - { - unsigned char red = 0; - unsigned char blue = 0; - unsigned char green = 0; - fl_color_chooser("Please pick a color",red,green,blue); - char buffer[300]; - sprintf(buffer,"RGB(%d,%d,%d)",red,green,blue); - pItem->m_curValue = buffer; - m_Dirty = true; - Invalidate(); - } - else if (pItem->m_nItemType == PropertyList::FILE) - { - string currPath = pItem->m_curValue; - - const char * SelectedFile - = fl_file_chooser("Choose a file", - "*",currPath.c_str() ); - - if( SelectedFile ) - { - pItem->m_curValue = SelectedFile; - m_Dirty = true; - Invalidate(); - } - } - else if (pItem->m_nItemType == PropertyList::PATH) - { - string currPath = pItem->m_curValue; - string initialDir = currPath; - - const char * SelectedFile - = fl_file_chooser("Choose a directory", - "*/",initialDir.c_str() ); - - if( SelectedFile && filename_isdir( SelectedFile ) ) - { - pItem->m_curValue = SelectedFile; - m_Dirty = true; - Invalidate(); - } - } - else if (pItem->m_nItemType == PropertyList::FONT) - { - } -} - - - - -void PropertyList::OnHelp() -{ - if(m_curSel == -1 || this->GetCount() <= 0) - { - return; - } - PropertyItem* pItem = (PropertyItem*) GetItemDataPtr(m_curSel); - fl_message(pItem->m_HelpString.c_str()); -} - - -void PropertyList::RemoveAll() -{ - int c = this->GetCount(); - for(int i =0; i < c; ++i) - { - PropertyItem* pItem = (PropertyItem*) GetItemDataPtr(0); - cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName.c_str()); - m_PropertyItems.erase(pItem); - delete pItem; - // this->DeleteString(0); - } - Invalidate(); -} - - - -PropertyItem * PropertyList::GetItemDataPtr(int index) -{ - std::set::iterator it = m_PropertyItems.begin(); - for(int i=0; it != m_PropertyItems.end() && i::iterator it = m_PropertyItems.begin(); - for(int i=0; it != m_PropertyItems.end() && i