source: git/src/aven.h @ 53496ab3

RELEASE/1.2debug-cidebug-ci-sanitisersstereowalls-data
Last change on this file since 53496ab3 was df3e22fc, checked in by Olly Betts <olly@…>, 12 years ago

src/aven.h: Need to forward declare class wxPageSetupDialogData for
wx 2.9.2.

git-svn-id: file:///home/survex-svn/survex/trunk@3872 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2//  aven.h
3//
4//  Main class for Aven.
5//
6//  Copyright (C) 2001, Mark R. Shinwell.
7//  Copyright (C) 2002,2003,2004,2005,2006 Olly Betts
8//
9//  This program is free software; you can redistribute it and/or modify
10//  it under the terms of the GNU General Public License as published by
11//  the Free Software Foundation; either version 2 of the License, or
12//  (at your option) any later version.
13//
14//  This program is distributed in the hope that it will be useful,
15//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17//  GNU General Public License for more details.
18//
19//  You should have received a copy of the GNU General Public License
20//  along with this program; if not, write to the Free Software
21//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22*/
23
24/* Note: this header needs to be safe to include from C code */
25
26#ifndef aven_h
27#define aven_h
28
29#include <stdarg.h>
30
31#define APP_NAME wxT("Aven")
32#define APP_IMAGE wxT("aven.png")
33#define APP_ABOUT_IMAGE wxT("aven-about.png")
34
35extern
36#ifdef __cplusplus
37 "C"
38#endif
39void aven_v_report(int severity, const char *fnm, int line, int en,
40                   va_list ap);
41
42#ifdef __cplusplus
43
44#include "wx.h"
45
46#include <string>
47
48inline std::string
49string_formatv(const char * fmt, va_list args)
50{
51    static size_t len = 4096;
52    static char * buf = NULL;
53    while (true) {
54        if (!buf) buf = new char[len];
55        int r = vsnprintf(buf, len, fmt, args);
56        if (r < int(len) && r != -1) {
57            return std::string(buf, r);
58        }
59        delete [] buf;
60        buf = NULL;
61        len += len;
62    }
63}
64
65inline std::string
66string_format(const char * fmt, ...)
67{
68    va_list args;
69    va_start(args, fmt);
70    std::string s = string_formatv(fmt, args);
71    va_end(args);
72    return s;
73}
74
75// wmsg is the unicode version of msg.
76wxString wmsg(int msg_no);
77
78const wxString & wmsg_cfgpth();
79
80class MainFrm;
81
82extern bool double_buffered;
83
84class wxPageSetupDialogData;
85
86class Aven : public wxGLApp {
87    MainFrm * m_Frame;
88    // This must be a pointer, otherwise it gets initialised too early and
89    // we get a segfault on MS Windows when it tries to look up paper
90    // sizes in wxThePrintPaperDatabase which is still NULL at the point
91    // when the Aven class is constructed.
92    wxPageSetupDialogData * m_pageSetupData;
93
94public:
95    Aven();
96    ~Aven();
97
98#ifdef __WXMSW__
99    virtual bool Initialize(int& argc, wxChar **argv);
100#endif
101    virtual bool OnInit();
102
103    wxPageSetupDialogData * GetPageSetupDialogData();
104    void SetPageSetupDialogData(const wxPageSetupDialogData & psdd);
105
106    void ReportError(const wxString&);
107};
108
109DECLARE_APP(Aven)
110
111#endif
112
113#endif
Note: See TracBrowser for help on using the repository browser.