From c91ca248f6b0cb9a1eebf47dce9a56e51e40b1db Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Thu, 14 Nov 2002 18:18:49 -0500 Subject: Add progress reporting --- Source/WXDialog/cmWXMainFrame.cxx | 25 +++++++++++++++++++++++++ Source/WXDialog/cmWXMainFrame.h | 10 +++++++++- Source/WXDialog/wxCMakeSetup.cxx | 3 ++- 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'Source/WXDialog') diff --git a/Source/WXDialog/cmWXMainFrame.cxx b/Source/WXDialog/cmWXMainFrame.cxx index 605433f052..3a7f4828e9 100644 --- a/Source/WXDialog/cmWXMainFrame.cxx +++ b/Source/WXDialog/cmWXMainFrame.cxx @@ -239,6 +239,7 @@ cmMainFrame::cmMainFrame(const wxString& title, const wxSize& size) this->Connect(cmCacheProperty::Menu_Popup_Help, wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction) &cmMainFrame::OnPopupMenuHelp); + this->m_CMakeInstance->SetProgressCallback(&cmMainFrame::ProgressCallback, this); } cmMainFrame::~cmMainFrame() @@ -279,6 +280,27 @@ void cmMainFrame::MessageCallback(const char* m, const char* title, bool& nomore } +void cmMainFrame::ProgressCallback(const char* m, float prog, + void* clientData) +{ + + if ( clientData ) + { + cmMainFrame* self = static_cast( clientData ); + char tmp[1024]; + if (prog >= 0) + { + sprintf(tmp,"%s %i%%",m,(int)(100*prog)); + } + else + { + sprintf(tmp,"%s",m); + } + self->SetStatusText(tmp); + wxYield(); + } +} + void cmMainFrame::DisplayMessage(const char* m, const char* title, bool& nomore) { this->CursorNormal(false); @@ -829,6 +851,7 @@ void cmMainFrame::RunCMake(bool generateProjectFiles) cmSystemTools::Error( "Error in configuration process, project files may be invalid"); } + // update the GUI with any new values in the caused by the // generation process this->LoadCacheFromDiskToGUI(); @@ -1438,6 +1461,7 @@ void cmMainFrame::CursorBusy(bool s) { this->m_CursorChanged = true; } + wxYield(); } void cmMainFrame::CursorNormal(bool s) @@ -1447,6 +1471,7 @@ void cmMainFrame::CursorNormal(bool s) { this->m_CursorChanged = false; } + wxYield(); } void cmMainFrame::OnSourceUpdated(wxCommandEvent& event) diff --git a/Source/WXDialog/cmWXMainFrame.h b/Source/WXDialog/cmWXMainFrame.h index a192e8b783..8f97fd0571 100644 --- a/Source/WXDialog/cmWXMainFrame.h +++ b/Source/WXDialog/cmWXMainFrame.h @@ -33,6 +33,7 @@ class wxScrolledWindow; class wxSizer; class wxStaticBox; class wxStaticText; +class wxApp; /** \class cmMainFrame * \brief GUI for CMake with wxWindows toolkit @@ -82,11 +83,16 @@ public: void ConnectEventTo(wxWindow*, wxEventType, wxObjectEventFunction); //! Callback for the error message. - static void MessageCallback(const char* m, const char* title, bool& nomore, void* cd); + static void MessageCallback(const char* m, const char* title, + bool& nomore, void* cd); + static void ProgressCallback(const char* m, float prog, void* clientData); void DisplayMessage(const char* m, const char* title, bool& nomore); //! Retrieve the current build directory. const std::string& GetBuildDir() { return this->m_WhereBuild; } + + //! Set the application for progress + void SetApplication(wxApp* app) { m_Application = app; } private: //! Load cache file from m_WhereBuild and display in GUI editor @@ -221,6 +227,8 @@ private: cmake* m_CMakeInstance; wxTimer* m_ExitTimer; + wxApp* m_Application; + enum Events { ID_MainFrame, ID_Resize, diff --git a/Source/WXDialog/wxCMakeSetup.cxx b/Source/WXDialog/wxCMakeSetup.cxx index 6a11ccd2e5..2db6f9e36f 100644 --- a/Source/WXDialog/wxCMakeSetup.cxx +++ b/Source/WXDialog/wxCMakeSetup.cxx @@ -146,10 +146,11 @@ bool wxCMakeSetup::OnInit() cm.SetValidArguments("ABGHQ"); cm.ParseCommandLine(wxApp::argc, wxApp::argv); - this->SetVendorName("Andy"); + this->SetVendorName("Kitware"); this->SetAppName("CMakeSetup"); cmMainFrame *frame = new cmMainFrame("CMake", wxSize(200, 100)); + frame->SetApplication(this); frame->Initialize(&cm); //wxFrame *frame = new testFrame("CMake", wxSize(200, 100)); //wxFrame *frame = new testFrame1("Frame", wxSize(200, 100)); -- cgit v1.2.1