File: pgAdmin3.h

package info (click to toggle)
pgadmin3 1.22.2-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 74,488 kB
  • sloc: cpp: 195,064; ansic: 20,444; sh: 5,119; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (261 lines) | stat: -rw-r--r-- 6,819 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2016, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// pgAdmin3.h - The main application header
//
//////////////////////////////////////////////////////////////////////////

#ifndef PGADMIN3_H
#define PGADMIN3_H

// wxWindows headers
#include <wx/wx.h>
#include <wx/hashmap.h>
#include <wx/colordlg.h>
#include <wx/listctrl.h>
#include <wx/xrc/xmlres.h>

#ifdef WIN32
#include <winsock2.h>
#endif

#include "utils/misc.h"
#include <ctl/ctlTree.h>
#include "ctl/ctlSQLBox.h"
#include "ctl/ctlListView.h"
#include "ctl/ctlComboBox.h"
#include <ctl/ctlCheckTreeView.h>
#include <ctl/ctlColourPicker.h>
#include "dlg/dlgClasses.h"
#include "db/pgConn.h"
#include "db/pgSet.h"
#include "utils/factory.h"

#include "precomp.h"

// App headers
#include "utils/sysSettings.h"

#ifdef __WXMSW__
#else
#include "config.h"
#undef VERSION
#endif

// Check the wxWidgets config
#if !wxCHECK_VERSION(2, 8, 0)
#error wxWidgets 2.8.0 or higher is required to compile this version of pgAdmin.
#endif

#if !wxUSE_UNICODE
#error wxWidgets must be compiled with Unicode support to build pgAdmin.
#endif

// Supported server minimum and maximum values.
const short SERVER_MIN_VERSION_N = 0x0804;
const wxString SERVER_MIN_VERSION_T = wxT("8.4");
const short SERVER_MAX_VERSION_N = 0x7FFF; /* Don't check for maximally supported PG version. */
const wxString SERVER_MAX_VERSION_T = wxT("99");

// Supported Greenplum Database and Greenplum HAWQ minimum and maximum values.
const short GP_MIN_VERSION_N = 0x0802;
const wxString GP_MIN_VERSION_T = wxT("8.2");
const short GP_MAX_VERSION_N = 0x0803;
const wxString GP_MAX_VERSION_T = wxT("8.3");

// The registry file
#ifndef __WXMSW__
#define REGISTRY_FILE wxT("/etc/postgres-reg.ini")
#endif

// Some redefines for modern Microsoft compilers
#if defined(_MSC_VER)
#define creat _creat
#define close _close
#define mkdir _mkdir
#define sprintf _sprintf
#define snprintf _snprintf
#define strcat _strcat
#define strdup _strdup
#define stricmp _stricmp
#define strincmp _strincmp
#endif

extern wxPathList path;                 // The search path
extern wxString loadPath;               // Where the program is loaded from
extern wxString docPath;                // Where docs are stored
extern wxString uiPath;                 // Where ui data is stored
extern wxString i18nPath;               // Where i18n data is stored
extern wxString pluginsDir;             // The plugins ini file directory
extern wxString settingsIni;            // The default settings file

extern sysSettings *settings;           // The settings manager

extern frmMain *winMain;                // The main app window

extern wxLocale *locale;                // Application locale
extern wxArrayInt existingLangs;        // Language IDs
extern wxArrayString existingLangNames; // Language Names

#if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
class CSSHTunnelThread;
extern CSSHTunnelThread *pgadminTunnelThread; // SSH Tunneling Thread Object
#endif

// Helper app paths - PG
extern wxString pgBackupExecutable;
extern wxString pgBackupAllExecutable;
extern wxString pgRestoreExecutable;

// Helper app paths - EDB
extern wxString edbBackupExecutable;
extern wxString edbBackupAllExecutable;
extern wxString edbRestoreExecutable;

// Helper app paths - Greenplum
extern wxString gpBackupExecutable;
extern wxString gpBackupAllExecutable;
extern wxString gpRestoreExecutable;

//
// Support for additional functions included in the EnterpriseDB
// version of libpq. These are enable via runtime loading of the
// functions on Windows, and a configure time macro on other
// platforms (EDB_LIBPQ).
//
// Currently, these are only use to support EDB callable statements
// so the debugger can grab OUT/INOUT parameters from EDB stored
// procedures.
//
#ifdef __WXMSW__
// Dynamically loaded PQgetOutResult
typedef PGresult *(*PQGETOUTRESULT)(PGconn *);
extern PQGETOUTRESULT PQiGetOutResult;
#define PQiGetOutResult (PQiGetOutResult)

// Dynamically loaded PQprepareOut
typedef PGresult *(*PQPREPAREOUT)(PGconn *, const char *, const char *, int, const Oid *, const int *);
extern PQPREPAREOUT PQiPrepareOut;
#define PQiPrepareOut (PQiPrepareOut)

// Dynamically loaded PQsendQueryPreparedOut
typedef int (*PQSENDQUERYPREPAREDOUT)(PGconn *, const char *, int, const char *const *, const int *, const int *, int);
extern PQSENDQUERYPREPAREDOUT PQiSendQueryPreparedOut;
#define PQiSendQueryPreparedOut (PQiSendQueryPreparedOut)

#else
#ifdef EDB_LIBPQ
#define PQiGetOutResult PQgetOutResult
#define PQiPrepareOut PQprepareOut
#define PQiSendQueryPreparedOut PQsendQueryPreparedOut
#endif
#endif

// Simple hash map used as an ad-hoc data cache
WX_DECLARE_STRING_HASH_MAP(wxString, cacheMap);

// Class declarations
class pgAdmin3 : public wxApp
{
public:
	virtual bool OnInit();
	virtual int OnExit();

#ifdef __WXMAC__
	void MacOpenFile(const wxString &fileName);
#endif

private:
	wxString LocatePath(const wxString &pathToFind, const bool isFile);
	wxString GenerateHelpPath(const wxString &file, const wxString &current, wxPathList stdPaths, wxPathList dbmsPaths);
	bool LoadAllXrc(const wxString dir);

#ifdef __WXMAC__
	wxString macFileToOpen;
#endif

protected:
	void InitAppPaths();
	void InitXtraPaths();
	void InitHelp();
	void InitLogger();
	void InitNetwork();
	void InitXml();

#ifdef __WXMSW__
	void InitLibpq();
#endif

};

class pgAppearanceFactory
{
public:
	pgAppearanceFactory();

	void SetIcons(wxDialog *dlg);
	void SetIcons(wxTopLevelWindow *dlg);
	wxIcon GetSmallIconImage();
	wxIcon GetBigIconImage();
	wxBitmap GetSplashImage()
	{
		return wxBitmap(splash_image);
	};
	wxFont GetSplashTextFont();
	wxColour GetSplashTextColour()
	{
		return splash_text_colour;
	};
	long GetSplashTextOffset()
	{
		return splash_pos_offset;
	};
	wxPoint GetSplashTextPos()
	{
		return wxPoint(splash_pos_x, splash_pos_y);
	};
	wxString GetShortAppName()
	{
		return short_appname;
	};
	wxString GetLongAppName()
	{
		return long_appname;
	};
	wxString GetWebsiteUrl()
	{
		return website_url;
	};
	wxColour GetReportKeyColour()
	{
		return report_key_colour;
	};
	bool GetHideEnterprisedbHelp()
	{
		return hide_enterprisedb_help;
	};
	bool GetHideGreenplumHelp()
	{
		return hide_greenplum_help;
	};
	bool IsBranded()
	{
		return is_branded;
	};

private:
	wxString long_appname, short_appname, website_url, icon;
	wxImage large_icon, small_icon, splash_image;
	long splash_font_size, splash_pos_x, splash_pos_y, splash_pos_offset;
	wxColor splash_text_colour, report_key_colour;
	bool hide_enterprisedb_help, hide_greenplum_help, is_branded;
};

extern pgAppearanceFactory *appearanceFactory;


#endif // PGADMIN3_H