diff options
Diffstat (limited to 'Source/CursesDialog')
22 files changed, 73 insertions, 138 deletions
diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 548f5a5..7d4e88c 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -26,13 +26,25 @@ set( CURSES_SRCS CursesDialog/ccmake ) -include_directories(${CMake_SOURCE_DIR}/Source/CursesDialog/form - ${CMake_BINARY_DIR}/Source/CursesDialog/form) +if( NOT CMAKE_USE_SYSTEM_FORM ) + include_directories(${CMake_SOURCE_DIR}/Source/CursesDialog/form + ${CMake_BINARY_DIR}/Source/CursesDialog/form) +endif() include_directories(${CURSES_INCLUDE_PATH}) add_executable(ccmake ${CURSES_SRCS} ) target_link_libraries(ccmake CMakeLib) -target_link_libraries(ccmake cmForm) +if(CMAKE_USE_SYSTEM_FORM) + target_link_libraries(ccmake + ${CURSES_FORM_LIBRARY} + ${CURSES_LIBRARY} + ) + if(CURSES_EXTRA_LIBRARY) + target_link_libraries(ccmake ${CURSES_EXTRA_LIBRARY}) + endif() +else() + target_link_libraries(ccmake cmForm) +endif() install(TARGETS ccmake DESTINATION bin) diff --git a/Source/CursesDialog/cmCursesBoolWidget.h b/Source/CursesDialog/cmCursesBoolWidget.h index d2a25ca..8a57c73 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.h +++ b/Source/CursesDialog/cmCursesBoolWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesBoolWidget_h -#define __cmCursesBoolWidget_h +#ifndef cmCursesBoolWidget_h +#define cmCursesBoolWidget_h #include "cmCursesWidget.h" class cmCursesMainForm; @@ -37,4 +37,4 @@ protected: }; -#endif // __cmCursesBoolWidget_h +#endif // cmCursesBoolWidget_h diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 98107cc..7cdf13b 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesCacheEntryComposite_h -#define __cmCursesCacheEntryComposite_h +#ifndef cmCursesCacheEntryComposite_h +#define cmCursesCacheEntryComposite_h #include "../cmCacheManager.h" #include "cmCursesLabelWidget.h" @@ -40,4 +40,4 @@ protected: int EntryWidth; }; -#endif // __cmCursesCacheEntryComposite_h +#endif // cmCursesCacheEntryComposite_h diff --git a/Source/CursesDialog/cmCursesDummyWidget.h b/Source/CursesDialog/cmCursesDummyWidget.h index 9ac1365..2b3b9b5 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.h +++ b/Source/CursesDialog/cmCursesDummyWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesDummyWidget_h -#define __cmCursesDummyWidget_h +#ifndef cmCursesDummyWidget_h +#define cmCursesDummyWidget_h #include "cmCursesWidget.h" @@ -33,4 +33,4 @@ protected: }; -#endif // __cmCursesDummyWidget_h +#endif // cmCursesDummyWidget_h diff --git a/Source/CursesDialog/cmCursesFilePathWidget.h b/Source/CursesDialog/cmCursesFilePathWidget.h index 9d2972e..6c50dd4 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.h +++ b/Source/CursesDialog/cmCursesFilePathWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesFilePathWidget_h -#define __cmCursesFilePathWidget_h +#ifndef cmCursesFilePathWidget_h +#define cmCursesFilePathWidget_h #include "cmCursesPathWidget.h" @@ -25,4 +25,4 @@ protected: }; -#endif // __cmCursesFilePathWidget_h +#endif // cmCursesFilePathWidget_h diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index f9317b9..9837f5a 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesForm_h -#define __cmCursesForm_h +#ifndef cmCursesForm_h +#define cmCursesForm_h #include "../cmStandardIncludes.h" #include "cmCursesStandardIncludes.h" @@ -73,4 +73,4 @@ protected: FORM* Form; }; -#endif // __cmCursesForm_h +#endif // cmCursesForm_h diff --git a/Source/CursesDialog/cmCursesLabelWidget.h b/Source/CursesDialog/cmCursesLabelWidget.h index cc32d11..98170f5 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.h +++ b/Source/CursesDialog/cmCursesLabelWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesLabelWidget_h -#define __cmCursesLabelWidget_h +#ifndef cmCursesLabelWidget_h +#define cmCursesLabelWidget_h #include "cmCursesWidget.h" #include "cmCursesStandardIncludes.h" @@ -35,4 +35,4 @@ protected: void operator=(const cmCursesLabelWidget&); }; -#endif // __cmCursesLabelWidget_h +#endif // cmCursesLabelWidget_h diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h b/Source/CursesDialog/cmCursesLongMessageForm.h index 1e86974..6e37eea 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.h +++ b/Source/CursesDialog/cmCursesLongMessageForm.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesLongMessageForm_h -#define __cmCursesLongMessageForm_h +#ifndef cmCursesLongMessageForm_h +#define cmCursesLongMessageForm_h #include "../cmStandardIncludes.h" #include "cmCursesForm.h" @@ -55,4 +55,4 @@ protected: }; -#endif // __cmCursesLongMessageForm_h +#endif // cmCursesLongMessageForm_h diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 0734927..dcd0b6c 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -47,7 +47,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args, cmSystemTools::GetCMakeCursesCommand()); // create the arguments for the cmake object - std::string whereCMake = cmSystemTools::GetProgramPath(this->Args[0].c_str()); + std::string whereCMake = cmSystemTools::GetProgramPath(this->Args[0]); whereCMake += "/cmake"; this->Args[0] = whereCMake; this->CMakeInstance->SetArgs(this->Args); @@ -69,11 +69,7 @@ cmCursesMainForm::~cmCursesMainForm() // Clean-up composites if (this->Entries) { - std::vector<cmCursesCacheEntryComposite*>::iterator it; - for (it = this->Entries->begin(); it != this->Entries->end(); ++it) - { - delete *it; - } + cmDeleteAll(*this->Entries); } delete this->Entries; if (this->CMakeInstance) @@ -188,12 +184,7 @@ void cmCursesMainForm::InitializeUI() // Clean old entries if (this->Entries) { - // Have to call delete on each pointer - std::vector<cmCursesCacheEntryComposite*>::iterator it; - for (it = this->Entries->begin(); it != this->Entries->end(); ++it) - { - delete *it; - } + cmDeleteAll(*this->Entries); } delete this->Entries; this->Entries = newEntries; @@ -902,7 +893,7 @@ void cmCursesMainForm::HandleInput() if ( key == 10 || key == KEY_ENTER ) { this->SearchMode = false; - if ( this->SearchString.size() > 0 ) + if (!this->SearchString.empty()) { this->JumpToCacheEntry(this->SearchString.c_str()); this->OldSearchString = this->SearchString; @@ -927,7 +918,7 @@ void cmCursesMainForm::HandleInput() } else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC ) { - if ( this->SearchString.size() > 0 ) + if (!this->SearchString.empty()) { this->SearchString.resize(this->SearchString.size()-1); } @@ -1076,7 +1067,7 @@ void cmCursesMainForm::HandleInput() } else if ( key == 'n' ) { - if ( this->OldSearchString.size() > 0 ) + if (!this->OldSearchString.empty()) { this->JumpToCacheEntry(this->OldSearchString.c_str()); } @@ -1210,7 +1201,7 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr) int findex = start_index; for(;;) { - if ( str.size() > 0 ) + if (!str.empty()) { cmCursesWidget* lbl = 0; if ( findex >= 0 ) diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index fba9bc5..6455252 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesMainForm_h -#define __cmCursesMainForm_h +#ifndef cmCursesMainForm_h +#define cmCursesMainForm_h #include "../cmStandardIncludes.h" #include "cmCursesForm.h" @@ -161,4 +161,4 @@ protected: bool SearchMode; }; -#endif // __cmCursesMainForm_h +#endif // cmCursesMainForm_h diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index 5cee489..324014e 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesOptionsWidget_h -#define __cmCursesOptionsWidget_h +#ifndef cmCursesOptionsWidget_h +#define cmCursesOptionsWidget_h #include "cmCursesWidget.h" class cmCursesMainForm; @@ -36,4 +36,4 @@ protected: std::vector<std::string>::size_type CurrentOption; }; -#endif // __cmCursesOptionsWidget_h +#endif // cmCursesOptionsWidget_h diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index cd93bc3..89e2238 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -69,7 +69,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) cstr = cstr.substr(0, cstr.size()-1); } - if ( cmSystemTools::FileIsDirectory(cstr.c_str()) ) + if ( cmSystemTools::FileIsDirectory(cstr) ) { cstr += "/"; } diff --git a/Source/CursesDialog/cmCursesPathWidget.h b/Source/CursesDialog/cmCursesPathWidget.h index 45c22a3..18d298a 100644 --- a/Source/CursesDialog/cmCursesPathWidget.h +++ b/Source/CursesDialog/cmCursesPathWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesPathWidget_h -#define __cmCursesPathWidget_h +#ifndef cmCursesPathWidget_h +#define cmCursesPathWidget_h #include "cmCursesStringWidget.h" @@ -37,4 +37,4 @@ protected: std::string::size_type CurrentIndex; }; -#endif // __cmCursesPathWidget_h +#endif // cmCursesPathWidget_h diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index b157a28..6047ec5 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -15,52 +15,12 @@ #define _MSE_INT_H #endif -#include <cmFormConfigure.h> - #if defined(__hpux) # define _BOOL_DEFINED # include <sys/time.h> -# define _XOPEN_SOURCE_EXTENDED -# include <curses.h> -# include <form.h> -# undef _XOPEN_SOURCE_EXTENDED -#else -/* figure out which curses.h to include */ -# if defined(CURSES_HAVE_NCURSES_H) -# include <ncurses.h> -# elif defined(CURSES_HAVE_NCURSES_NCURSES_H) -# include <ncurses/ncurses.h> -# elif defined(CURSES_HAVE_NCURSES_CURSES_H) -# include <ncurses/curses.h> -# else -# include <curses.h> -# endif - -# include <form.h> -#endif - -// This is a hack to prevent warnings about these functions being -// declared but not referenced. -#if defined(__sgi) && !defined(__GNUC__) -class cmCursesStandardIncludesHack -{ -public: - enum - { - Ref1 = sizeof(cfgetospeed(0)), - Ref2 = sizeof(cfgetispeed(0)), - Ref3 = sizeof(tcgetattr(0, 0)), - Ref4 = sizeof(tcsetattr(0, 0, 0)), - Ref5 = sizeof(cfsetospeed(0,0)), - Ref6 = sizeof(cfsetispeed(0,0)) - }; -}; -#endif - -#ifndef getmaxyx - #define getmaxyx(w,y,x) ((y) = getmaxy(w), (x) = getmaxx(w)) #endif +#include <form.h> // on some machines move erase and clear conflict with stl // so remove them from the namespace diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index dd8c02a..fc1b2ba 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesStringWidget_h -#define __cmCursesStringWidget_h +#ifndef cmCursesStringWidget_h +#define cmCursesStringWidget_h #include "cmCursesWidget.h" @@ -73,4 +73,4 @@ protected: bool Done; }; -#endif // __cmCursesStringWidget_h +#endif // cmCursesStringWidget_h diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index d91a0cb..7d82864 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -9,8 +9,8 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#ifndef __cmCursesWidget_h -#define __cmCursesWidget_h +#ifndef cmCursesWidget_h +#define cmCursesWidget_h #include "../cmCacheManager.h" #include "cmCursesStandardIncludes.h" @@ -84,4 +84,4 @@ protected: int Page; }; -#endif // __cmCursesWidget_h +#endif // cmCursesWidget_h diff --git a/Source/CursesDialog/form/fld_attr.c b/Source/CursesDialog/form/fld_attr.c index 8619588..35ea903 100644 --- a/Source/CursesDialog/form/fld_attr.c +++ b/Source/CursesDialog/form/fld_attr.c @@ -29,13 +29,7 @@ /**************************************************************************** * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * ****************************************************************************/ -#if defined(__hpux) - #define _XOPEN_SOURCE_EXTENDED -#endif - #include "form.priv.h" -#if defined(__hpux) - #undef _XOPEN_SOURCE_EXTENDED -#endif +#include "form.priv.h" MODULE_ID("$Id$") /*---------------------------------------------------------------------------- diff --git a/Source/CursesDialog/form/form.h b/Source/CursesDialog/form/form.h index 94f05af..1219cb5 100644 --- a/Source/CursesDialog/form/form.h +++ b/Source/CursesDialog/form/form.h @@ -47,7 +47,17 @@ # elif defined(CURSES_HAVE_NCURSES_CURSES_H) # include <ncurses/curses.h> # else +# if defined(__hpux) +# if defined(_XOPEN_SOURCE_EXTENDED) +# define HAVE__XOPEN_SOURCE_EXTENDED +# else +# define _XOPEN_SOURCE_EXTENDED +# endif +# endif # include <curses.h> +# if defined(__hpux) && !defined(HAVE__XOPEN_SOURCE_EXTENDED) +# undef _XOPEN_SOURCE_EXTENDED +# endif # endif #include <eti.h> diff --git a/Source/CursesDialog/form/form.priv.h b/Source/CursesDialog/form/form.priv.h index 3691f2f..8516a6f 100644 --- a/Source/CursesDialog/form/form.priv.h +++ b/Source/CursesDialog/form/form.priv.h @@ -33,12 +33,6 @@ #include "mf_common.h" #include "form.h" -/* get around odd bug on aCC and itanium */ -#if defined(__hpux) && defined(__ia64) -#define getmaxx __getmaxx -#define getmaxy __getmaxy -#endif - /* form status values */ #define _OVLMODE (0x04) /* Form is in overlay mode */ #define _WINDOW_MODIFIED (0x10) /* Current field window has been modified */ diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c index b9611bf..26f580e 100644 --- a/Source/CursesDialog/form/frm_driver.c +++ b/Source/CursesDialog/form/frm_driver.c @@ -29,13 +29,7 @@ /**************************************************************************** * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * ****************************************************************************/ -#if defined(__hpux) - #define _XOPEN_SOURCE_EXTENDED -#endif #include "form.priv.h" -#if defined(__hpux) - #undef _XOPEN_SOURCE_EXTENDED -#endif /* AIX seems to define this */ #undef lines @@ -357,12 +351,7 @@ static void Buffer_To_Window(const FIELD * field, WINDOW * win) assert(win && field); -#if defined(__LSB_VERSION__) getmaxyx(win, height, width); -#else - width = getmaxx(win); - height = getmaxy(win); -#endif for(row=0, pBuffer=field->buf; row < height; @@ -394,17 +383,13 @@ static void Window_To_Buffer(WINDOW * win, FIELD * field) int pad; int len = 0; char *p; - int row, height; + int row, height, width; assert(win && field && field->buf ); pad = field->pad; p = field->buf; -#if defined(__LSB_VERSION__) - { int width; getmaxyx(win, height, width); } -#else - height = getmaxy(win); -#endif + getmaxyx(win, height, width); for(row=0; (row < height) && (row < field->drows); row++ ) { diff --git a/Source/CursesDialog/form/frm_post.c b/Source/CursesDialog/form/frm_post.c index 3c63de7..924fe6a 100644 --- a/Source/CursesDialog/form/frm_post.c +++ b/Source/CursesDialog/form/frm_post.c @@ -63,12 +63,7 @@ int post_form(FORM * form) RETURN(E_NOT_CONNECTED); formwin = Get_Form_Window(form); -#if defined(__LSB_VERSION__) getmaxyx(formwin, height, width); -#else - width = getmaxx(formwin); - height = getmaxy(formwin); -#endif if ((form->cols > width) || (form->rows > height)) RETURN(E_NO_ROOM); diff --git a/Source/CursesDialog/form/frm_req_name.c b/Source/CursesDialog/form/frm_req_name.c index b108dab..6fb9183 100644 --- a/Source/CursesDialog/form/frm_req_name.c +++ b/Source/CursesDialog/form/frm_req_name.c @@ -35,13 +35,7 @@ * Routines to handle external names of menu requests * ***************************************************************************/ -#if defined(__hpux) - #define _XOPEN_SOURCE_EXTENDED -#endif #include "form.priv.h" -#if defined(__hpux) - #undef _XOPEN_SOURCE_EXTENDED -#endif MODULE_ID("$Id$") |