Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
wxutils.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
7 /* This is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public
18  * License along with this software. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef _BASE_WX_WXUTILS_H
24 #define _BASE_WX_WXUTILS_H
25 
26 #include "hugin_shared.h"
27 #include "panoinc_WX.h"
28 #include "hugin_utils/utils.h"
29 
30 // use trace function under windows, because usually there is
31 // no stdout under windows
32 #ifdef __WXMSW__
33  #include <wx/string.h>
34  #include <wx/log.h>
35 
36  #ifdef DEBUG
37  #undef DEBUG_TRACE
38  #undef DEBUG_DEBUG
39  #undef DEBUG_INFO
40  #undef DEBUG_NOTICE
41 
42  // debug trace
43 // #define DEBUG_TRACE(msg) { std::stringstream o; o << "TRACE " << DEBUG_HEADER << msg; wxLogDebug(o.str().c_str());}
44  #define DEBUG_TRACE(msg) { std::cerr << "TRACE " << DEBUG_HEADER << msg << std::endl; }
45  // low level debug info
46 // #define DEBUG_DEBUG(msg) { std::stringstream o; o << "DEBUG " << DEBUG_HEADER << msg; wxLogDebug(o.str().c_str()); }
47  #define DEBUG_DEBUG(msg) { std::cerr << "DEBUG " << DEBUG_HEADER << msg << std::endl; }
48  // informational debug message,
49 // #define DEBUG_INFO(msg) { std::stringstream o; o << "INFO " << DEBUG_HEADER << msg; wxLogDebug(o.str().c_str()); }
50  #define DEBUG_INFO(msg) { std::cerr << "INFO " << DEBUG_HEADER << msg << std::endl; }
51  // major change/operation should use this
52 // #define DEBUG_NOTICE(msg) { std::stringstream o; o << "NOTICE " << DEBUG_HEADER << msg; wxLogMessage(o.str().c_str()); }
53  #define DEBUG_NOTICE(msg) { std::cerr << "NOTICE " << DEBUG_HEADER << msg << std::endl; }
54  #endif
55 
56  #undef DEBUG_WARN
57  #undef DEBUG_ERROR
58  #undef DEBUG_FATAL
59  #undef DEBUG_ASSERT
60 
61  // when an error occurred, but can be handled by the same function
62  #define DEBUG_WARN(msg) { std::stringstream o; o << "WARN: " << DEBUG_HEADER << msg; wxLogWarning(wxString(o.str().c_str(), wxConvISO8859_1));}
63  // an error occurred, might be handled by a calling function
64  #define DEBUG_ERROR(msg) { std::stringstream o; o << "ERROR: " << DEBUG_HEADER << msg; wxLogError(wxString(o.str().c_str(),wxConvISO8859_1));}
65  // a fatal error occurred. further program execution is unlikely
66  #define DEBUG_FATAL(msg) { std::stringstream o; o << "FATAL: " << DEBUG_HEADER << "(): " << msg; wxLogError(wxString(o.str().c_str(),wxConvISO8859_1)); }
67  // assertion
68  #define DEBUG_ASSERT(cond) \
69  do { \
70  if (!(cond)) { \
71  std::stringstream o; o << "ASSERTATION: " << DEBUG_HEADER << "(): " << #cond; \
72  wxLogFatalError(wxString(o.str().c_str(),wxConvISO8859_1)); \
73  } \
74  } while(0)
75 #endif
76 
77 WXIMPEX wxString GetFormattedTimeSpan(const wxTimeSpan & timeSpan);
78 
79 // functions to store/restore frame/dialog position and size
80 WXIMPEX void RestoreFramePosition(wxTopLevelWindow * frame, const wxString & basename);
81 WXIMPEX void StoreFramePosition(wxTopLevelWindow * frame, const wxString & basename);
82 
83 #endif // _BASE_WX_WXUTILS_H
WXIMPEX wxString GetFormattedTimeSpan(const wxTimeSpan &timeSpan)
Definition: wxutils.cpp:27
#define WXIMPEX
Definition: hugin_shared.h:40
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
Definition: wxutils.cpp:133
include file for the hugin project
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
Definition: wxutils.cpp:65