diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 15 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesForm.cxx | 30 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesForm.h | 19 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 5 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 5 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesStringWidget.cxx | 8 |
6 files changed, 81 insertions, 1 deletions
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index a05d726..ece3c02 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -38,13 +38,21 @@ void CMakeErrorHandler(const char* message, const char* title, bool& disable) int main(int argc, char** argv) { + bool debug = false; unsigned int i; int j; cmake msg; std::vector<std::string> args; for(j =0; j < argc; ++j) { - args.push_back(argv[j]); + if(strcmp(argv[j], "-debug") == 0) + { + debug = true; + } + else + { + args.push_back(argv[j]); + } } for(i=1; i < args.size(); ++i) @@ -64,6 +72,11 @@ int main(int argc, char** argv) cmCacheManager::GetInstance()->LoadCache(cmSystemTools::GetCurrentWorkingDirectory().c_str()); + if (debug) + { + cmCursesForm::DebugStart(); + } + initscr(); /* Initialization */ noecho(); /* Echo off */ cbreak(); /* nl- or cr not needed */ diff --git a/Source/CursesDialog/cmCursesForm.cxx b/Source/CursesDialog/cmCursesForm.cxx index 8d9c444..a91172f 100644 --- a/Source/CursesDialog/cmCursesForm.cxx +++ b/Source/CursesDialog/cmCursesForm.cxx @@ -1,5 +1,8 @@ #include "cmCursesForm.h" +std::ofstream cmCursesForm::DebugFile; +bool cmCursesForm::Debug = false; + cmCursesForm::cmCursesForm() { m_Form = 0; @@ -14,3 +17,30 @@ cmCursesForm::~cmCursesForm() m_Form = 0; } } + +void cmCursesForm::DebugStart() +{ + cmCursesForm::Debug = true; + cmCursesForm::DebugFile.open("ccmakelog.txt"); +} + +void cmCursesForm::DebugEnd() +{ + if (!cmCursesForm::Debug) + { + return; + } + + cmCursesForm::Debug = false; + cmCursesForm::DebugFile.close(); +} + +void cmCursesForm::LogMessage(const char* msg) +{ + if (!cmCursesForm::Debug) + { + return; + } + + cmCursesForm::DebugFile << msg << std::endl; +} diff --git a/Source/CursesDialog/cmCursesForm.h b/Source/CursesDialog/cmCursesForm.h index c333cf4..35a3f13 100644 --- a/Source/CursesDialog/cmCursesForm.h +++ b/Source/CursesDialog/cmCursesForm.h @@ -1,6 +1,7 @@ #ifndef __cmCursesForm_h #define __cmCursesForm_h +#include "../cmStandardIncludes.h" #include "cmCursesStandardIncludes.h" class cmCursesForm @@ -22,13 +23,31 @@ public: // The only exception is during a resize. virtual void UpdateStatusBar() = 0; + // Description: // During a CMake run, an error handle should add errors // to be displayed afterwards. virtual void AddError(const char* message, const char* title) {}; + // Description: + // Turn debugging on. This will create ccmakelog.txt. + static void DebugStart(); + + // Description: + // Turn debugging off. This will close ccmakelog.txt. + static void DebugEnd(); + + // Description: + // Write a debugging message. + static void LogMessage(const char* msg); + static cmCursesForm* CurrentForm; + protected: + + static std::ofstream DebugFile; + static bool Debug; + cmCursesForm(const cmCursesForm& from); void operator=(const cmCursesForm&); diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 80940a5..83c01f1 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -156,10 +156,15 @@ void cmCursesLongMessageForm::HandleInput() return; } + char debugMessage[128]; + while(1) { int key = getch(); + sprintf(debugMessage, "Message widget handling input, key: %d", key); + cmCursesForm::LogMessage(debugMessage); + // quit if ( key == 'o' ) { diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 33d70ba..516a945 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -539,6 +539,9 @@ void cmCursesMainForm::HandleInput() FIELD* currentField; cmCursesWidget* currentWidget; + + char debugMessage[128]; + while(1) { this->UpdateStatusBar(); @@ -551,6 +554,8 @@ void cmCursesMainForm::HandleInput() if (!currentWidget || !currentWidget->HandleInput(key, m_Form, stdscr)) { + sprintf(debugMessage, "Main form handling input, key: %d", key); + cmCursesForm::LogMessage(debugMessage); // quit if ( key == 'q' ) { diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index 2bc39d8..8273fdf 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -1,4 +1,6 @@ #include "cmCursesStringWidget.h" +#include "cmCursesForm.h" + inline int ctrl(int z) { return (z&037); @@ -26,9 +28,13 @@ bool cmCursesStringWidget::HandleInput(int& key, FORM* form, WINDOW* w) char* originalStr=0; + char debugMessage[128]; + // <Enter> is used to change edit mode (like <Esc> in vi). while(1) { + sprintf(debugMessage, "String widget handling input, key: %d", key); + cmCursesForm::LogMessage(debugMessage); // If resize occured during edit, move out of edit mode if (!m_InEdit && ( key != 10 && key != KEY_ENTER ) ) { @@ -39,6 +45,7 @@ bool cmCursesStringWidget::HandleInput(int& key, FORM* form, WINDOW* w) { if (m_InEdit) { + cmCursesForm::LogMessage("String widget leaving edit."); m_InEdit = false; delete[] originalStr; // trick to force forms to update the field buffer @@ -48,6 +55,7 @@ bool cmCursesStringWidget::HandleInput(int& key, FORM* form, WINDOW* w) } else { + cmCursesForm::LogMessage("String widget entering edit."); m_InEdit = true; char* buf = field_buffer(m_Field, 0); originalStr = new char[strlen(buf)+1]; |