source: git/src/aven.h @ a72ed95

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

Makefile.am,lib/icons/Makefile.am,lib/icons/aven.png,
lib/icons/aven.xpm,src/: Compile in the "aven" icon on all platforms,
not just MSW, and use this icon for the about dialog instead of
loading it from disk.

  • Property mode set to 100644
File size: 2.7 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,2015 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_ABOUT_IMAGE wxT("aven-about.png")
33
34extern
35#ifdef __cplusplus
36 "C"
37#endif
38void aven_v_report(int severity, const char *fnm, int line, int en,
39                   va_list ap);
40
41#ifdef __cplusplus
42
43#include "wx.h"
44
45#include <string>
46
47inline std::string
48string_formatv(const char * fmt, va_list args)
49{
50    static size_t len = 4096;
51    static char * buf = NULL;
52    while (true) {
53        if (!buf) buf = new char[len];
54        int r = vsnprintf(buf, len, fmt, args);
55        if (r < int(len) && r != -1) {
56            return std::string(buf, r);
57        }
58        delete [] buf;
59        buf = NULL;
60        len += len;
61    }
62}
63
64inline std::string
65string_format(const char * fmt, ...)
66{
67    va_list args;
68    va_start(args, fmt);
69    std::string s = string_formatv(fmt, args);
70    va_end(args);
71    return s;
72}
73
74// wmsg is the unicode version of msg.
75wxString wmsg(int msg_no);
76
77const wxString & wmsg_cfgpth();
78
79class MainFrm;
80
81extern bool double_buffered;
82
83class wxPageSetupDialogData;
84
85class Aven : public wxGLApp {
86    MainFrm * m_Frame;
87    // This must be a pointer, otherwise it gets initialised too early and
88    // we get a segfault on MS Windows when it tries to look up paper
89    // sizes in wxThePrintPaperDatabase which is still NULL at the point
90    // when the Aven class is constructed.
91    wxPageSetupDialogData * m_pageSetupData;
92
93public:
94    Aven();
95    ~Aven();
96
97#ifdef __WXMSW__
98    virtual bool Initialize(int& argc, wxChar **argv);
99#endif
100    virtual bool OnInit();
101
102    wxPageSetupDialogData * GetPageSetupDialogData();
103    void SetPageSetupDialogData(const wxPageSetupDialogData & psdd);
104
105#ifdef __WXMAC__
106    void MacOpenFiles(const wxArrayString & filenames);
107    void MacPrintFiles(const wxArrayString & filenames);
108#endif
109
110    void ReportError(const wxString&);
111};
112
113DECLARE_APP(Aven)
114
115#endif
116
117#endif
Note: See TracBrowser for help on using the repository browser.