Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MyProgressDialog.cpp
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
2 
28 #include "hugin_config.h"
29 #include "panoinc_WX.h"
30 
31 #include "MyProgressDialog.h"
32 
33 // provide some more translations for strings in huginbase
34 #if 0
35 _("Sampling points");
36 _("Loading image:");
37 _("Scaling image:");
38 _("sampling points");
39 _("extracting good points");
40 _("Elapsed time: ")
41 #endif
42 
43 void ProgressReporterDialog::setMessage(const std::string& message, const std::string& filename)
44 {
45  setMessage(wxString(message.c_str(), wxConvLocal), wxString(filename.c_str(), wxConvLocal));
46 }
47 
48 void ProgressReporterDialog::setMessage(const wxString& message, const wxString& filename)
49 {
50  m_wxmessage = message;
51  m_wxfilename = filename;
53 }
54 
55 bool ProgressReporterDialog::updateDisplay(const wxString& message)
56 {
57  setMessage(message);
58  return !m_canceled;
59 }
60 
61 bool ProgressReporterDialog::updateDisplayValue(const wxString& message, const wxString& filename)
62 {
63  m_wxmessage = message;
64  m_wxfilename = filename;
65  return ProgressDisplay::updateDisplayValue();
66 }
67 
69 {
70  wxString msg;
71  if (!m_wxmessage.empty())
72  {
73  msg = wxGetTranslation(m_wxmessage);
74  if (!m_wxfilename.empty())
75  {
76  msg.Append(wxT(" "));
77  msg.Append(m_wxfilename);
78  };
79  };
80  if (ProgressDisplay::m_maximum == 0)
81  {
82  if (!wxProgressDialog::Pulse(msg))
83  {
84  m_canceled = true;
85  }
86  }
87  else
88  {
89  if (!wxProgressDialog::Update(m_progress * 100 / ProgressDisplay::m_maximum, msg))
90  {
91  m_canceled = true;
92  }
93  }
94 }
virtual void updateProgressDisplay()
Template method, updates the display.
void setMessage(const std::string &message, const std::string &filename="")
bool updateDisplay()
updates the display, return true, if update was successful, false if cancel was pressed ...
include file for the hugin project