~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

Viewing changes to pgadmin/include/frm/frmStatus.h

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//////////////////////////////////////////////////////////////////////////
2
2
//
3
3
// pgAdmin III - PostgreSQL Tools
4
 
// RCS-ID:      $Id: frmStatus.h 6930 2008-01-02 00:10:01Z dpage $
5
 
// Copyright (C) 2002 - 2008, The pgAdmin Development Team
6
 
// This software is released under the Artistic Licence
 
4
// RCS-ID:      $Id: frmStatus.h 7901 2009-06-09 11:19:10Z dpage $
 
5
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
 
6
// This software is released under the BSD Licence
7
7
//
8
8
// frmStatus.h - Status Screen
9
9
//
19
19
#include <wx/spinctrl.h>
20
20
#include <wx/notebook.h>
21
21
 
 
22
// wxAUI
 
23
#include <wx/aui/aui.h>
 
24
#include <wx/aui/auibook.h>
 
25
 
22
26
#include "dlg/dlgClasses.h"
23
27
#include "utils/factory.h"
24
28
 
25
 
#define CTL_STATUSLIST 300
 
29
enum
 
30
{
 
31
    CTL_RATECBO=250,
 
32
    CTL_REFRESHBTN,
 
33
    CTL_CANCELBTN,
 
34
    CTL_TERMINATEBTN,
 
35
    CTL_COMMITBTN,
 
36
    CTL_ROLLBACKBTN,
 
37
    CTL_LOGCBO,
 
38
    CTL_ROTATEBTN,
 
39
    CTL_STATUSLIST,
 
40
    CTL_LOCKLIST,
 
41
    CTL_XACTLIST,
 
42
    CTL_LOGLIST,
 
43
    MNU_STATUSPAGE,
 
44
    MNU_LOCKPAGE,
 
45
    MNU_XACTPAGE,
 
46
    MNU_LOGPAGE,
 
47
    MNU_TERMINATE,
 
48
    MNU_COMMIT,
 
49
    MNU_ROLLBACK,
 
50
    TIMER_REFRESHUI_ID,
 
51
    TIMER_STATUS_ID,
 
52
    TIMER_LOCKS_ID,
 
53
    TIMER_XACT_ID,
 
54
    TIMER_LOG_ID
 
55
};
 
56
 
 
57
 
 
58
enum
 
59
{
 
60
    PANE_STATUS=1,
 
61
    PANE_LOCKS,
 
62
    PANE_XACT,
 
63
    PANE_LOG
 
64
};
 
65
 
 
66
 
 
67
#define FRMSTATUS_PERSPECTIVE_VER wxT("$Rev: 7901 $")
 
68
 
 
69
#ifdef __WXMAC__
 
70
#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6293500;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=321;besth=244;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=462;floaty=165;floatw=595;floath=282|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=321;besth=244;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-231;floaty=235;floatw=595;floath=282|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=0;pos=2;prop=100000;bestw=0;besth=0;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=461;floaty=527;floatw=595;floath=282|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=0;besth=0;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-103;floaty=351;floatw=595;floath=282|name=toolBar;caption=Tool bar;state=2124528;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=608;besth=33;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=888;floaty=829;floatw=558;floath=49|dock_size(4,0,0)=583|dock_size(5,0,0)=10|dock_size(1,10,0)=35|")
 
71
#else
 
72
#ifdef __WXGTK__
 
73
#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6293500;dir=4;layer=0;row=0;pos=2;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=0;pos=1;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=720;besth=31;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|dock_size(4,0,0)=549|dock_size(5,0,0)=22|dock_size(1,10,0)=33|")
 
74
#else
 
75
#define FRMSTATUS_DEFAULT_PERSPECTIVE wxT("layout2|name=Activity;caption=Activity;state=6309884;dir=4;layer=0;row=1;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=174;floaty=216;floatw=578;floath=282|name=Locks;caption=Locks;state=6293500;dir=4;layer=0;row=1;pos=1;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=136;floaty=339;floatw=576;floath=283|name=Transactions;caption=Transactions;state=6293500;dir=4;layer=0;row=1;pos=2;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=133;floaty=645;floatw=577;floath=283|name=Logfile;caption=Logfile;state=6293500;dir=5;layer=0;row=0;pos=0;prop=100000;bestw=20;besth=20;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=-1;floaty=-1;floatw=-1;floath=-1|name=toolBar;caption=Tool bar;state=2108144;dir=1;layer=10;row=0;pos=0;prop=100000;bestw=516;besth=23;minw=-1;minh=-1;maxw=-1;maxh=-1;floatx=586;floaty=525;floatw=483;floath=49|dock_size(5,0,0)=22|dock_size(1,10,0)=25|dock_size(4,0,1)=627|")
 
76
#endif
 
77
#endif
 
78
 
 
79
 
 
80
static wxCriticalSection gs_critsect;
 
81
 
26
82
 
27
83
// Class declarations
28
84
 
29
 
class frmStatus : public pgDialog
 
85
class frmStatus : public pgFrame
30
86
{
31
87
public:
32
88
    frmStatus(frmMain *form, const wxString& _title, pgConn *conn);
34
90
    void Go();
35
91
    
36
92
private:
 
93
    wxAuiManager manager;
 
94
    
 
95
    frmMain *mainForm;
 
96
    pgConn *connection;
 
97
 
 
98
    wxString logFormat;
 
99
    bool logHasTimestamp, logFormatKnown;
 
100
    int logFmtPos;
 
101
 
 
102
    wxDateTime logfileTimestamp, latestTimestamp;
 
103
    wxString logDirectory, logfileName;
 
104
 
 
105
    wxString savedPartialLine;
 
106
 
 
107
    bool showCurrent, isCurrent;
 
108
    
 
109
    long backend_pid;
 
110
 
 
111
        bool loaded;
 
112
    long logfileLength;
 
113
    
 
114
    int currentPane;
 
115
 
 
116
    ctlComboBoxFix    *cbRate;
 
117
    wxComboBox    *cbLogfiles;
 
118
    wxButton      *btnRotateLog;
 
119
    
 
120
    wxTimer *refreshUITimer;
 
121
    wxTimer *statusTimer, *locksTimer, *xactTimer, *logTimer;
 
122
    int statusRate, locksRate, xactRate, logRate;
 
123
 
 
124
    ctlListView   *statusList;
 
125
    ctlListView   *lockList;
 
126
    ctlListView   *xactList;
 
127
    ctlListView   *logList;
 
128
    
 
129
    int cboToRate();
 
130
    wxString rateToCboString(int rate);
 
131
    
 
132
    void AddStatusPane();
 
133
    void AddLockPane();
 
134
    void AddXactPane();
 
135
    void AddLogPane();
 
136
 
37
137
    void OnHelp(wxCommandEvent& ev);
38
 
    void OnCloseBtn(wxCommandEvent &event);
 
138
    void OnExit(wxCommandEvent& event);
 
139
    
 
140
    void OnCopy(wxCommandEvent& ev);
 
141
 
 
142
    void OnToggleStatusPane(wxCommandEvent& event);
 
143
    void OnToggleLockPane(wxCommandEvent& event);
 
144
    void OnToggleXactPane(wxCommandEvent& event);
 
145
    void OnToggleLogPane(wxCommandEvent& event);
 
146
    void OnToggleToolBar(wxCommandEvent& event);
 
147
    void OnDefaultView(wxCommandEvent& event);
 
148
    
 
149
    void OnRefreshUITimer(wxTimerEvent &event);
 
150
    void OnRefreshStatusTimer(wxTimerEvent &event);
 
151
    void OnRefreshLocksTimer(wxTimerEvent &event);
 
152
    void OnRefreshXactTimer(wxTimerEvent &event);
 
153
    void OnRefreshLogTimer(wxTimerEvent &event);
 
154
    
 
155
    void OnRateChange(wxCommandEvent &event);
 
156
    
 
157
    void OnPaneClose(wxAuiManagerEvent& evt);
 
158
 
39
159
    void OnClose(wxCloseEvent &event);
40
160
    void OnRefresh(wxCommandEvent &event);
41
 
    void OnRefreshTimer(wxTimerEvent &event);
42
 
    void OnRateChange(wxScrollEvent &event);
43
 
        void OnNotebookPageChanged(wxNotebookEvent& event);
 
161
    void OnCancelBtn(wxCommandEvent &event);
 
162
    void OnStatusCancelBtn(wxCommandEvent &event);
 
163
    void OnLocksCancelBtn(wxCommandEvent &event);
44
164
    void OnTerminateBtn(wxCommandEvent &event);
45
 
    void OnCancelBtn(wxCommandEvent &event);
 
165
    void OnStatusTerminateBtn(wxCommandEvent &event);
 
166
    void OnLocksTerminateBtn(wxCommandEvent &event);
46
167
        void OnSelStatusItem(wxListEvent &event);
47
168
        void OnSelLockItem(wxListEvent &event);
48
169
    void OnSelXactItem(wxListEvent &event);
 
170
    void OnSelLogItem(wxListEvent &event);
49
171
        void OnLoadLogfile(wxCommandEvent &event);
50
172
    void OnRotateLogfile(wxCommandEvent &event);
51
173
    void OnCommit(wxCommandEvent &event);
56
178
 
57
179
    void addLogFile(wxDateTime *dt, bool skipFirst);
58
180
    void addLogFile(const wxString &filename, const wxDateTime timestamp, long len, long &read, bool skipFirst);
59
 
    void addLogLine(const wxString &str, bool formatted=true);
 
181
    void addLogLine(const wxString &str, bool formatted=true, bool csv_log_format=false);
60
182
 
61
183
        void checkConnection();
62
184
    
63
 
    frmMain *mainForm;
64
 
    wxButton *btnCancelSt, *btnTerminateSt,*btnCancelLk, *btnTerminateLk, *btnCommit, *btnRollback;
65
 
 
66
 
    wxString logFormat;
67
 
    bool logHasTimestamp, logFormatKnown;
68
 
    int logFmtPos;
69
 
 
70
 
    wxDateTime logfileTimestamp, latestTimestamp;
71
 
    wxString logDirectory, logfileName;
72
 
    bool showCurrent, isCurrent;
73
 
 
74
 
    pgConn *connection;
75
 
    long backend_pid;
76
 
    wxTimer *timer;
77
 
        bool loaded;
78
 
    long logfileLength;
79
 
    int xactPage, logPage;
80
 
 
81
185
    DECLARE_EVENT_TABLE()
82
186
};
83
187
 
85
189
class serverStatusFactory : public actionFactory
86
190
{
87
191
public:
88
 
    serverStatusFactory(menuFactoryList *list, wxMenu *mnu, wxToolBar *toolbar);
 
192
    serverStatusFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
89
193
    wxWindow *StartDialog(frmMain *form, pgObject *obj);
90
194
    bool CheckEnable(pgObject *obj);
91
195
};