42
cacheLine() { cols=0; stored=false; readOnly=false; }
43
~cacheLine() { if (cols) delete[] cols; }
50
if (cols) delete[] cols;
46
bool stored, readOnly;
54
bool stored, readOnly;
50
58
class cacheLinePool
53
cacheLinePool(int initialLines);
55
cacheLine *operator[] (int line) { return Get(line); }
56
cacheLine *Get(int lineNo);
57
bool IsFilled(int lineNo);
58
void Delete(int lineNo);
61
cacheLinePool(int initialLines);
63
cacheLine *operator[] (int line)
67
cacheLine *Get(int lineNo);
68
bool IsFilled(int lineNo);
69
void Delete(int lineNo);
69
sqlCell() { ClearCell(); }
71
void SetCell(long r, long c) { row = r; col = c; }
72
void ClearCell() { row = -1; col = -1; }
73
bool IsSet() { return row != -1 && col != -1; }
75
long GetRow() { return row; }
76
long GetCol() { return col; }
85
void SetCell(long r, long c)
97
return row != -1 && col != -1;
83
// we cannot derive from wxGridCellAttr because destructor is private but not virtual
114
// we cannot derive from wxGridCellAttr because destructor is private but not virtual
87
sqlCellAttr() { attr = new wxGridCellAttr; isPrimaryKey=false; needResize=false; }
88
~sqlCellAttr() { attr->DecRef(); }
120
attr = new wxGridCellAttr;
121
isPrimaryKey = false;
93
wxString Quote(pgConn *conn, const wxString &value);
96
wxString name, typeName, displayTypeName;
97
bool numeric, isPrimaryKey, needResize;
131
wxGridCellAttr *attr;
132
wxString Quote(pgConn *conn, const wxString &value);
135
wxString name, typeName, displayTypeName;
136
bool numeric, isPrimaryKey, needResize;
103
142
class ctlSQLEditGrid : public ctlSQLGrid
106
ctlSQLEditGrid(wxFrame *parent, wxWindowID id, const wxPoint& pos, const wxSize& size);
145
ctlSQLEditGrid(wxFrame *parent, wxWindowID id, const wxPoint &pos, const wxSize &size);
108
sqlTable *GetTable() { return (sqlTable*)wxGrid::GetTable(); }
109
//wxSize GetBestSize(int row, int col);
110
void ResizeEditor(int row, int col);
111
wxArrayInt GetSelectedRows() const;
112
bool CheckRowPresent(int row);
113
virtual bool IsColText(int col);
149
return (sqlTable *)wxGrid::GetTable();
151
//wxSize GetBestSize(int row, int col);
152
void ResizeEditor(int row, int col);
153
wxArrayInt GetSelectedRows() const;
154
bool CheckRowPresent(int row);
155
virtual bool IsColText(int col);
116
158
class sqlTable : public wxGridTableBase
119
sqlTable(pgConn *conn, pgQueryThread *thread, const wxString& tabName, const OID relid, bool _hasOid, const wxString& _pkCols, char _relkind);
122
void UndoLine(int row);
125
int GetNumberStoredRows();
127
wxString GetColLabelValue(int col);
128
wxString GetColLabelValueUnformatted(int col);
129
wxString GetRowLabelValue(int row);
130
wxGridCellAttr* GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind);
132
wxString GetValue(int row, int col);
133
void SetValue(int row, int col, const wxString &value);
135
bool IsEmptyCell(int row, int col) { return false; }
136
bool needsResizing(int col) { return columns[col].needResize; }
137
bool AppendRows(size_t rows);
138
bool DeleteRows(size_t pos, size_t rows);
139
int LastRow() { return lastRow; }
140
bool IsColText(int col);
141
bool IsColBoolean(int col);
143
bool CheckInCache(int row);
144
bool IsLineSaved(int row) { return GetLine(row)->stored; }
161
sqlTable(pgConn *conn, pgQueryThread *thread, const wxString &tabName, const OID relid, bool _hasOid, const wxString &_pkCols, char _relkind);
164
void UndoLine(int row);
167
int GetNumberStoredRows();
169
wxString GetColLabelValue(int col);
170
wxString GetColLabelValueUnformatted(int col);
171
wxString GetRowLabelValue(int row);
172
wxGridCellAttr *GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind);
174
wxString GetValue(int row, int col);
175
void SetValue(int row, int col, const wxString &value);
177
bool IsEmptyCell(int row, int col)
181
bool needsResizing(int col)
183
return columns[col].needResize;
185
bool AppendRows(size_t rows);
186
bool DeleteRows(size_t pos, size_t rows);
191
bool IsColText(int col);
192
bool IsColBoolean(int col);
194
bool CheckInCache(int row);
195
bool IsLineSaved(int row)
197
return GetLine(row)->stored;
149
pgQueryThread *thread;
155
wxString primaryKeyColNumbers;
157
cacheLine *GetLine(int row);
158
wxString MakeKey(cacheLine *line);
159
void SetNumberEditor(int col, int len);
161
cacheLinePool *dataPool, *addPool;
165
int *lineIndex; // reindex of lines in dataSet to handle deleted rows
167
int nCols; // columns from dataSet
168
int nRows; // rows initially returned by dataSet
169
int rowsCached; // rows read from dataset; if nRows=rowsCached, dataSet can be deleted
170
int rowsAdded; // rows added (never been in dataSet)
171
int rowsStored; // rows added and stored to db
172
int rowsDeleted; // rows deleted from initial dataSet
173
sqlCellAttr *columns;
203
pgQueryThread *thread;
209
wxString primaryKeyColNumbers;
211
cacheLine *GetLine(int row);
212
wxString MakeKey(cacheLine *line);
213
void SetNumberEditor(int col, int len);
215
cacheLinePool *dataPool, *addPool;
219
int *lineIndex; // reindex of lines in dataSet to handle deleted rows
221
int nCols; // columns from dataSet
222
int nRows; // rows initially returned by dataSet
223
int rowsCached; // rows read from dataset; if nRows=rowsCached, dataSet can be deleted
224
int rowsAdded; // rows added (never been in dataSet)
225
int rowsStored; // rows added and stored to db
226
int rowsDeleted; // rows deleted from initial dataSet
227
sqlCellAttr *columns;
175
229
wxArrayInt colMap;
177
friend class ctlSQLEditGrid;
231
friend class ctlSQLEditGrid;
184
238
class frmEditGrid : public pgFrame
187
frmEditGrid(frmMain *form, const wxString& _title, pgConn *conn, pgSchemaObject *obj);
241
frmEditGrid(frmMain *form, const wxString &_title, pgConn *conn, pgSchemaObject *obj, bool ascending = true);
190
void ShowForm(bool filter = false);
192
wxString GetSortCols() const { return orderBy; } ;
193
void SetSortCols(const wxString &cols);
194
wxString GetFilter() const { return rowFilter; } ;
195
void SetFilter(const wxString &filter);
196
int GetLimit() const { return limit; } ;
197
void SetLimit(const int rowlimit);
198
wxMenu *GetFileMenu() { return fileMenu; };
199
wxMenu *GetEditMenu() { return editMenu; };
244
void ShowForm(bool filter = false);
246
wxString GetSortCols() const
250
void SetSortCols(const wxString &cols);
251
wxString GetFilter() const
255
void SetFilter(const wxString &filter);
260
void SetLimit(const int rowlimit);
261
wxMenu *GetFileMenu()
265
wxMenu *GetEditMenu()
202
void OnEraseBackground(wxEraseEvent& event);
203
void OnSize(wxSizeEvent& event);
205
void OnCloseWindow(wxCloseEvent& event);
206
void OnClose(wxCommandEvent& event);
207
void OnHelp(wxCommandEvent& event);
208
void OnContents(wxCommandEvent& event);
209
void OnRefresh(wxCommandEvent& event);
210
void OnDelete(wxCommandEvent& event);
211
void OnOptions(wxCommandEvent& event);
212
void OnSave(wxCommandEvent& event);
271
void OnEraseBackground(wxEraseEvent &event);
272
void OnSize(wxSizeEvent &event);
274
void OnCloseWindow(wxCloseEvent &event);
275
void OnClose(wxCommandEvent &event);
276
void OnHelp(wxCommandEvent &event);
277
void OnContents(wxCommandEvent &event);
278
void OnRefresh(wxCommandEvent &event);
279
void OnDelete(wxCommandEvent &event);
280
void OnOptions(wxCommandEvent &event);
281
void OnSave(wxCommandEvent &event);
214
283
void CancelChange();
215
void OnUndo(wxCommandEvent& event);
216
void OnCellChange(wxGridEvent& event);
217
void OnGridSelectCells(wxGridRangeSelectEvent& event);
218
void OnEditorShown(wxGridEvent& event);
219
void OnEditorHidden(wxGridEvent& event);
220
void OnKey(wxKeyEvent& event);
221
void OnCopy(wxCommandEvent& event);
222
void OnIncludeFilter(wxCommandEvent& event);
223
void OnExcludeFilter(wxCommandEvent& event);
224
void OnRemoveFilters(wxCommandEvent& event);
225
void OnAscSort(wxCommandEvent& event);
226
void OnDescSort(wxCommandEvent& event);
227
void OnRemoveSort(wxCommandEvent& event);
228
void OnPaste(wxCommandEvent& event);
229
void OnLabelDoubleClick(wxGridEvent& event);
230
void OnLabelRightClick(wxGridEvent& event);
231
void OnCellRightClick(wxGridEvent& event);
233
void OnToggleScratchPad(wxCommandEvent& event);
234
void OnToggleLimitBar(wxCommandEvent& event);
235
void OnToggleToolBar(wxCommandEvent& event);
236
void OnAuiUpdate(wxAuiManagerEvent& event);
237
void OnDefaultView(wxCommandEvent& event);
239
wxAuiManager manager;
240
ctlSQLEditGrid *sqlGrid;
244
pgQueryThread *thread;
245
wxMenu *fileMenu, *editMenu, *viewMenu, *toolsMenu, *helpMenu;
246
ctlMenuToolbar *toolBar;
248
wxTextCtrl *scratchPad;
254
wxString primaryKeyColNumbers;
261
DECLARE_EVENT_TABLE()
284
void OnUndo(wxCommandEvent &event);
285
void OnCellChange(wxGridEvent &event);
286
void OnGridSelectCells(wxGridRangeSelectEvent &event);
287
void OnEditorShown(wxGridEvent &event);
288
void OnEditorHidden(wxGridEvent &event);
289
void OnKey(wxKeyEvent &event);
290
void OnCopy(wxCommandEvent &event);
291
void OnIncludeFilter(wxCommandEvent &event);
292
void OnExcludeFilter(wxCommandEvent &event);
293
void OnRemoveFilters(wxCommandEvent &event);
294
void OnAscSort(wxCommandEvent &event);
295
void OnDescSort(wxCommandEvent &event);
296
void OnRemoveSort(wxCommandEvent &event);
297
void OnPaste(wxCommandEvent &event);
298
void OnLabelDoubleClick(wxGridEvent &event);
299
void OnLabelRightClick(wxGridEvent &event);
300
void OnCellRightClick(wxGridEvent &event);
302
void OnToggleScratchPad(wxCommandEvent &event);
303
void OnToggleLimitBar(wxCommandEvent &event);
304
void OnToggleToolBar(wxCommandEvent &event);
305
void OnAuiUpdate(wxAuiManagerEvent &event);
306
void OnDefaultView(wxCommandEvent &event);
308
wxAuiManager manager;
309
ctlSQLEditGrid *sqlGrid;
313
pgQueryThread *thread;
314
wxMenu *fileMenu, *editMenu, *viewMenu, *toolsMenu, *helpMenu;
315
ctlMenuToolbar *toolBar;
317
wxTextCtrl *scratchPad;
323
wxString primaryKeyColNumbers;
330
DECLARE_EVENT_TABLE()
265
334
class editGridFactoryBase : public contextActionFactory
268
bool CheckEnable(pgObject *obj);
337
bool CheckEnable(pgObject *obj);
271
editGridFactoryBase(menuFactoryList *list) : contextActionFactory(list) { rowlimit = 0; }
272
wxWindow *ViewData(frmMain *form, pgObject *obj, bool filter);
340
editGridFactoryBase(menuFactoryList *list) : contextActionFactory(list)
344
wxWindow *ViewData(frmMain *form, pgObject *obj, bool filter);
277
350
class editGridFactory : public editGridFactoryBase
280
editGridFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
281
wxWindow *StartDialog(frmMain *form, pgObject *obj);
353
editGridFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
354
wxWindow *StartDialog(frmMain *form, pgObject *obj);
285
358
class editGridFilteredFactory : public editGridFactoryBase
288
editGridFilteredFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
289
wxWindow *StartDialog(frmMain *form, pgObject *obj);
361
editGridFilteredFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar);
362
wxWindow *StartDialog(frmMain *form, pgObject *obj);
292
365
class editGridLimitedFactory : public editGridFactoryBase
295
editGridLimitedFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar, int limit);
368
editGridLimitedFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar, int limit, bool ascending);
296
369
wxWindow *StartDialog(frmMain *form, pgObject *obj);