MyProgressDialog.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00028 #include <config.h>
00029 #include "panoinc_WX.h"
00030 
00031 #include "MyProgressDialog.h"
00032 
00033 // provide some more translations for strings in huginbase
00034 #if 0
00035 _("Sampling points");
00036 _("Loading image:");
00037 _("Scaling image:");
00038 _("sampling points");
00039 _("extracting good points");
00040 _("Elapsed time: ")
00041 #endif
00042 
00043 void ProgressReporterDialog::setMessage(const std::string& message, const std::string& filename)
00044 {
00045     setMessage(wxString(message.c_str(), wxConvLocal), wxString(filename.c_str(), wxConvLocal));
00046 }
00047 
00048 void ProgressReporterDialog::setMessage(const wxString& message, const wxString& filename)
00049 {
00050     m_wxmessage = message;
00051     m_wxfilename = filename;
00052     updateProgressDisplay();
00053 }
00054 
00055 bool ProgressReporterDialog::updateDisplay(const wxString& message)
00056 {
00057     setMessage(message);
00058     return !m_canceled;
00059 }
00060 
00061 bool ProgressReporterDialog::updateDisplayValue(const wxString& message, const wxString& filename)
00062 {
00063     m_wxmessage = message;
00064     m_wxfilename = filename;
00065     return ProgressDisplay::updateDisplayValue();
00066 }
00067 
00068 void ProgressReporterDialog::updateProgressDisplay()
00069 {
00070     wxString msg;
00071     if (!m_wxmessage.empty())
00072     {
00073         msg = wxGetTranslation(m_wxmessage);
00074         if (!m_wxfilename.empty())
00075         {
00076             msg.Append(wxT(" "));
00077             msg.Append(m_wxfilename);
00078         };
00079     };
00080     if (ProgressDisplay::m_maximum == 0)
00081     {
00082         if (!wxProgressDialog::Pulse(msg))
00083         {
00084             m_canceled = true;
00085         }
00086     }
00087     else
00088     {
00089         if (!wxProgressDialog::Update(m_progress * 100 / ProgressDisplay::m_maximum, msg))
00090         {
00091             m_canceled = true;
00092         }
00093     }
00094 }

Generated on 27 Aug 2015 for Hugintrunk by  doxygen 1.4.7