From aaacf880719022dc95f14ed8f497cc9e757122e2 Mon Sep 17 00:00:00 2001 From: SET Date: Sun, 22 Dec 2019 16:35:16 +0100 Subject: [PATCH] Added classes to manage simple tabular data of known structure using a popup containing a wxGrid object. BasePicker : Abstract class adding a popup to wxPickerBase styled with a wxTextCtrl. BaseGridPicker : Abstract class adding a wxGrid in the popup. JsonGridPickerCtrl : UI control storing the tabular data in a JSON array. LBoundJsonGridPicker : connect JsonGridPicker to database. LGridJsonCellEditor : use LBoundJsonGridPicker in other wxGrid objects. LGridJsonCellRenderer : render cell JSON data. XmlGridPickerCtrl : UI control storing the tabular data in as XML document. LBoundXmlGridPicker : connect XmlGridPicker to database. LGridXmlCellEditor : grid editor for LBoundXmlGridPicker. LGridXmlCellRenderer : grid renderer for LBoundXmlGridPicker. JsonHelper and XmlHelper : for applications to quickly get intent value from database data.. The structure of managed tabular data : Column 1 : Intent - this is what we want to store/edit. This can be telephone numbers, email addresses, instant messaging addresses... any single line piece of information that can exist many times for one entity (person, company...). Column 2 : Type - A short description of the intent : 'Home, Work, Mobile, Fax, Other...'. It is displayed in a non editable wxComboBox. Column 3 : Preferred - One line of data can be selected as the preferred one. It is not mandatory, but it must be a single choice. Column 4 : Notes - single line notes. Adjust sql scripts and L7.dox. Applied ANSI formatting style to all files. Other changes : Work around a nasty misbehavior. Grid columns edited by a translated combobox expect full string data as cell values. LResultSet::BEData() will report these mapped strings, instead of database real data. LBoundComboBox::IsDirty() will always be true even if the editor is unchanged once created. Simplest workaround : disconnect m_BoundComboBox if unchanged. LGridTextEditor::ProvideFormEditor() : set the form editor's value explicitely.; wxTextCtrl does not interpret data it receives LBoundControl::SetNull must be void. LBoundGrid : Unbind:: instructions should limit to the widget's id, like Bind:: LConnection::GetReturnedKeys should return NULL. LConnection::SetData should return void. Notes : wxJSON must be configured with the same prefix as wxWidgets, here /usr/local/{wxWidgets,wxWidgets-Release}. --- L7/.dep.inc | 5 + L7/L7.dox | 2 +- L7/LBoundCheckBox.cpp | 36 +-- L7/LBoundCheckBox.h | 12 +- L7/LBoundComboBox.cpp | 21 +- L7/LBoundComboBox.h | 10 +- L7/LBoundControl.h | 12 +- L7/LBoundDatePickerCtrl.cpp | 53 +++-- L7/LBoundDatePickerCtrl.h | 13 +- L7/LBoundGrid.cpp | 85 ++++++- L7/LBoundGrid.h | 18 +- L7/LBoundSpinCtrl.cpp | 5 +- L7/LBoundSpinCtrl.h | 9 +- L7/LBoundTextCtrl.cpp | 3 +- L7/LBoundTextCtrl.h | 12 +- L7/LConnection.cpp | 3 + L7/LConnection.h | 6 +- L7/LGridCheckEditor.cpp | 73 ++++-- L7/LGridCheckEditor.h | 4 +- L7/LGridCheckRenderer.cpp | 8 +- L7/LGridCheckRenderer.h | 4 +- L7/LGridColEditor.h | 10 +- L7/LGridComboEditor.cpp | 14 +- L7/LGridComboEditor.h | 4 +- L7/LGridComboRenderer.h | 4 +- L7/LGridDateEditor.cpp | 3 +- L7/LGridDateEditor.h | 28 ++- L7/LGridDateRenderer.h | 4 +- L7/LGridSpinEditor.h | 4 +- L7/LGridSpinRenderer.h | 7 +- L7/LGridTextEditor.cpp | 44 ++-- L7/LGridTextEditor.h | 4 +- L7/LGridTextRenderer.h | 4 +- L7/LInformation.cpp | 2 +- L7/LInformation.h | 5 +- L7/LItemData.h | 4 +- L7/LLightPQResultSet.h | 81 +++---- L7/LLightResultSet.h | 22 +- L7/LLightSQResultSet.cpp | 15 +- L7/LLightSQResultSet.h | 89 ++++---- L7/LNavigator.h | 5 +- L7/LPQConnection.h | 4 +- L7/LPQResultSet.cpp | 7 +- L7/LPQResultSet.h | 152 ++++++------- L7/LResultSet.h | 4 +- L7/LSQConnection.h | 6 +- L7/LSQResultSet.cpp | 6 +- L7/LSQResultSet.h | 156 ++++++------- L7/LSQresult.h | 52 ++--- L7/LVersion.h | 6 +- L7/changelog.txt | 7 +- L7/nbproject/Makefile-Debug.mk | 138 +++++++++--- L7/nbproject/Makefile-Release.mk | 138 +++++++++--- L7/nbproject/configurations.xml | 130 +++++++++++ .../private/c_standard_headers_indexer.c | 30 +-- .../private/cpp_standard_headers_indexer.cpp | 58 ++--- L7/nbproject/private/private.xml | 7 +- L7/nbproject/project.xml | 6 +- L7/special/BaseGridPicker.cpp | 211 ++++++++++++++++++ L7/special/BaseGridPicker.h | 181 +++++++++++++++ L7/special/BasePicker.cpp | 74 ++++++ L7/special/BasePicker.h | 63 ++++++ L7/special/JsonGridPickerCtrl.cpp | 171 ++++++++++++++ L7/special/JsonGridPickerCtrl.h | 70 ++++++ L7/special/JsonHelper.cpp | 53 +++++ L7/special/JsonHelper.h | 36 +++ L7/special/LBoundJsonGridPicker.cpp | 113 ++++++++++ L7/special/LBoundJsonGridPicker.h | 81 +++++++ L7/special/LBoundXmlGridPicker.cpp | 72 ++++++ L7/special/LBoundXmlGridPicker.h | 80 +++++++ L7/special/LGridJsonCellEditor.cpp | 144 ++++++++++++ L7/special/LGridJsonCellEditor.h | 124 ++++++++++ L7/special/LGridJsonCellRenderer.cpp | 73 ++++++ L7/special/LGridJsonCellRenderer.h | 38 ++++ L7/special/LGridXmlCellEditor.cpp | 143 ++++++++++++ L7/special/LGridXmlCellEditor.h | 123 ++++++++++ L7/special/LGridXmlCellRenderer.cpp | 58 +++++ L7/special/LGridXmlCellRenderer.h | 39 ++++ L7/special/XmlGridPickerCtrl.cpp | 167 ++++++++++++++ L7/special/XmlGridPickerCtrl.h | 66 ++++++ L7/special/XmlHelper.cpp | 75 +++++++ L7/special/XmlHelper.h | 54 +++++ 82 files changed, 3368 insertions(+), 595 deletions(-) create mode 100644 L7/.dep.inc create mode 100644 L7/special/BaseGridPicker.cpp create mode 100644 L7/special/BaseGridPicker.h create mode 100644 L7/special/BasePicker.cpp create mode 100644 L7/special/BasePicker.h create mode 100644 L7/special/JsonGridPickerCtrl.cpp create mode 100644 L7/special/JsonGridPickerCtrl.h create mode 100644 L7/special/JsonHelper.cpp create mode 100644 L7/special/JsonHelper.h create mode 100644 L7/special/LBoundJsonGridPicker.cpp create mode 100644 L7/special/LBoundJsonGridPicker.h create mode 100644 L7/special/LBoundXmlGridPicker.cpp create mode 100644 L7/special/LBoundXmlGridPicker.h create mode 100644 L7/special/LGridJsonCellEditor.cpp create mode 100644 L7/special/LGridJsonCellEditor.h create mode 100644 L7/special/LGridJsonCellRenderer.cpp create mode 100644 L7/special/LGridJsonCellRenderer.h create mode 100644 L7/special/LGridXmlCellEditor.cpp create mode 100644 L7/special/LGridXmlCellEditor.h create mode 100644 L7/special/LGridXmlCellRenderer.cpp create mode 100644 L7/special/LGridXmlCellRenderer.h create mode 100644 L7/special/XmlGridPickerCtrl.cpp create mode 100644 L7/special/XmlGridPickerCtrl.h create mode 100644 L7/special/XmlHelper.cpp create mode 100644 L7/special/XmlHelper.h diff --git a/L7/.dep.inc b/L7/.dep.inc new file mode 100644 index 0000000..38ba445 --- /dev/null +++ b/L7/.dep.inc @@ -0,0 +1,5 @@ +# This code depends on make tool being used +DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES})) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif diff --git a/L7/L7.dox b/L7/L7.dox index 466d35b..0c04f4a 100644 --- a/L7/L7.dox +++ b/L7/L7.dox @@ -831,7 +831,7 @@ FILE_PATTERNS = *.c \ # be searched for input files as well. # The default value is: NO. -RECURSIVE = NO +RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a diff --git a/L7/LBoundCheckBox.cpp b/L7/LBoundCheckBox.cpp index 8cffff8..2c2d162 100644 --- a/L7/LBoundCheckBox.cpp +++ b/L7/LBoundCheckBox.cpp @@ -10,16 +10,15 @@ #include "LBoundCheckBox.h" LBoundCheckBox::LBoundCheckBox(wxWindow* parent, wxWindowID id, long style) - : wxCheckBox(parent, id, _T("LCheckBox"), wxDefaultPosition, wxDefaultSize, style) -{ +: wxCheckBox(parent, id, _T("LCheckBox"), wxDefaultPosition, wxDefaultSize, style) { m_sqlQuote = wxEmptyString; SetNull(); } -LBoundCheckBox::~LBoundCheckBox() -{ +LBoundCheckBox::~LBoundCheckBox() { if (m_rs) m_rs->UnRegisterControl(this); } + const wxAny LBoundCheckBox::GetData() { if (Is3State()) { if (Get3StateValue() == wxCHK_UNDETERMINED) return L_SQLNULL; @@ -30,7 +29,8 @@ const wxAny LBoundCheckBox::GetData() { if (GetValue() == wxCHK_CHECKED) return 1; } } -bool LBoundCheckBox::SetData(const wxAny& newData) { + +void LBoundCheckBox::SetData(const wxAny& newData) { /* The interpretation of literal non is not documented * as it's for internal use. */ @@ -40,7 +40,7 @@ bool LBoundCheckBox::SetData(const wxAny& newData) { if (snewData.IsEmpty() || snewData == L_SQLNULL) { Set3StateValue(wxCHK_UNDETERMINED); - return true; + return; } if (snewData == _T("0") || snewData.Lower() == _T("no")) { @@ -48,7 +48,7 @@ bool LBoundCheckBox::SetData(const wxAny& newData) { } else { Set3StateValue(wxCHK_CHECKED); } - return true; + return; } else { if (snewData == _T("0") || snewData.IsEmpty() @@ -58,14 +58,14 @@ bool LBoundCheckBox::SetData(const wxAny& newData) { SetValue(wxCHK_CHECKED); } } - return false; } -void LBoundCheckBox::SetResultSet(LResultSet* newResultSet) -{ + +void LBoundCheckBox::SetResultSet(LResultSet* newResultSet) { m_rs = newResultSet; if (m_rs == NULL) return; m_rs->RegisterControl(this); } + bool LBoundCheckBox::IsNull() { if (Is3State()) { return (Get3StateValue() == wxCHK_UNDETERMINED); @@ -73,25 +73,28 @@ bool LBoundCheckBox::IsNull() { return false; } } -bool LBoundCheckBox::SetNull() { - return SetData(wxEmptyString); + +void LBoundCheckBox::SetNull() { + SetData(wxEmptyString); } + bool LBoundCheckBox::IsDirty() { wxASSERT_MSG(m_rs != NULL, "m_rs est NULL."); wxAny ctrlData = GetData(); // 0, 1 or L_SQLNULL wxAny BEData = m_rs->GetData(m_columnName); - int iBEData; BEData.GetAs(&iBEData); + int iBEData; + BEData.GetAs(&iBEData); if (Is3State()) { if (BEData.IsNull() - || BEData.As().IsEmpty()) { + || BEData.As().IsEmpty()) { BEData = L_SQLNULL; } else if (iBEData != 0) { BEData = 1; } } else { if (BEData.IsNull() - || iBEData == 0 - || BEData.As().IsEmpty()) { + || iBEData == 0 + || BEData.As().IsEmpty()) { BEData = 0; } else { BEData = 1; @@ -99,6 +102,7 @@ bool LBoundCheckBox::IsDirty() { } return (ctrlData.As() != BEData.As()); } + const wxString LBoundCheckBox::GetDisplayedData() { if (Is3State()) { if (Get3StateValue() == wxCHK_UNDETERMINED) return L_SQLNULL; diff --git a/L7/LBoundCheckBox.h b/L7/LBoundCheckBox.h index 714495f..ef885c6 100644 --- a/L7/LBoundCheckBox.h +++ b/L7/LBoundCheckBox.h @@ -8,14 +8,13 @@ */ #ifndef LBOUNDCHECKBOX_H -#define LBOUNDCHECKBOX_H +#define LBOUNDCHECKBOX_H #include #include "LBoundControl.h" #include "LResultSet.h" -class LBoundCheckBox : public wxCheckBox, public LBoundControl -{ +class LBoundCheckBox : public wxCheckBox, public LBoundControl { public: LBoundCheckBox(wxWindow* parent, wxWindowID id = wxID_ANY, long style = 0); virtual ~LBoundCheckBox(); @@ -32,9 +31,8 @@ public: * and any other value to checked status. * * @param newData - * @return */ - bool SetData(const wxAny& newData); + void SetData(const wxAny& newData); /** * Sets the resultset member and registers the control in the resultset. * @param newResultSet @@ -49,7 +47,7 @@ public: * If control is tristate, it is set to undetermined state. Else, it is set to unchecked state. * @return */ - bool SetNull(); + void SetNull(); bool IsDirty(); /** * If the control is checked, returns literal Oui @@ -64,5 +62,5 @@ private: }; -#endif /* LBOUNDCHECKBOX_H */ +#endif /* LBOUNDCHECKBOX_H */ diff --git a/L7/LBoundComboBox.cpp b/L7/LBoundComboBox.cpp index 77e6f45..2a3561e 100644 --- a/L7/LBoundComboBox.cpp +++ b/L7/LBoundComboBox.cpp @@ -163,17 +163,17 @@ void LBoundComboBox::Clear() SetWindowStyleFlag(wsflags); } -bool LBoundComboBox::SetData(const wxAny& data) +void LBoundComboBox::SetData(const wxAny& data) { const wxString sData = data.As(); if (IsTranslated()) { if (data.IsNull() - || sData.IsEmpty() - || sData == L_SQLNULL) + || sData.IsEmpty() + || sData == L_SQLNULL) { SetNull(); - return (GetSelection() != wxNOT_FOUND); // ? + return; } for (unsigned int i = 0; i < GetCount(); i++) { @@ -183,18 +183,16 @@ bool LBoundComboBox::SetData(const wxAny& data) if (x->GetData().As() == sData) { SetSelection(i); - return true; + return; } } } } else { - bool hasData = FindString(sData, true); + //bool hasData = FindString(sData, true); SetValue(sData); - return hasData; } - return false; } const wxAny LBoundComboBox::GetData() @@ -245,7 +243,7 @@ bool LBoundComboBox::IsNull() } } -bool LBoundComboBox::SetNull() +void LBoundComboBox::SetNull() { if (IsTranslated()) { @@ -255,17 +253,16 @@ bool LBoundComboBox::SetNull() if (x == NULL) { SetSelection(i); - return true; + return; } } - return false; + return; } long wsflags = GetWindowStyleFlag(); SetWindowStyleFlag(0); SetSelection(wxNOT_FOUND); SetValue(wxEmptyString); SetWindowStyleFlag(wsflags); - return true; } bool LBoundComboBox::IsDirty() diff --git a/L7/LBoundComboBox.h b/L7/LBoundComboBox.h index 92d1300..3f4f40b 100644 --- a/L7/LBoundComboBox.h +++ b/L7/LBoundComboBox.h @@ -8,11 +8,12 @@ */ #ifndef LBOUNDCOMBOBOX_H -#define LBOUNDCOMBOBOX_H +#define LBOUNDCOMBOBOX_H #include #include "LBoundControl.h" #include "LResultSet.h" + /** * The control is called 'translated' if its items have associated client data that are instances of LItemData. * The item strings are then only descriptive. @@ -93,9 +94,8 @@ public: * If newData is empty or literal NULL, calls SetNull(). * Else, selects the first item whose associated client data equals newData. * @param newData - * @return false if no item can be matched with newData, true otherwise. */ - bool SetData(const wxAny& newData); + void SetData(const wxAny& newData); /** * Sets the resultset member and registers the control in the resultset. * @param newResultSet @@ -114,7 +114,7 @@ public: * Else, selects the first item that does not have an associated client data. * @return */ - bool SetNull(); + void SetNull(); bool IsDirty(); /** * Alias for GetValue(). @@ -125,5 +125,5 @@ private: }; -#endif /* LBOUNDCOMBOBOX_H */ +#endif /* LBOUNDCOMBOBOX_H */ diff --git a/L7/LBoundControl.h b/L7/LBoundControl.h index 8675cb2..13850c5 100644 --- a/L7/LBoundControl.h +++ b/L7/LBoundControl.h @@ -8,7 +8,7 @@ */ #ifndef LBOUNDCONTROL_H -#define LBOUNDCONTROL_H +#define LBOUNDCONTROL_H #include #include "LResultSet.h" @@ -16,6 +16,7 @@ #define L_SQLNULL wxString(_T("NULL")) class LResultSet; + /** * Abstract base class for controls interacting with database table columns. * @@ -26,6 +27,7 @@ class LBoundControl public: LBoundControl(); virtual ~LBoundControl(); + /** * Do not use column aliases. * @param newColName @@ -45,14 +47,16 @@ public: * @return */ virtual const wxAny GetData() = 0; - virtual bool SetData(const wxAny& newData) = 0; + virtual void SetData(const wxAny& newData) = 0; virtual void SetResultSet(LResultSet * newResultSet) = 0; + LResultSet* GetResultSet() const { return m_rs; } virtual bool IsNull() = 0; - virtual bool SetNull() = 0; + virtual void SetNull() = 0; + /** * If the database column is numeric, use wxEmptystring, else, use a single quote ' . * @@ -86,5 +90,5 @@ private: }; -#endif /* LBOUNDCONTROL_H */ +#endif /* LBOUNDCONTROL_H */ diff --git a/L7/LBoundDatePickerCtrl.cpp b/L7/LBoundDatePickerCtrl.cpp index 135cd8c..5d94c69 100644 --- a/L7/LBoundDatePickerCtrl.cpp +++ b/L7/LBoundDatePickerCtrl.cpp @@ -10,8 +10,8 @@ #include "LBoundDatePickerCtrl.h" #include -LBoundDatePickerCtrl::LBoundDatePickerCtrl(wxWindow* parent, wxWindowID id) - : wxDatePickerCtrl(parent, id, wxInvalidDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_ALLOWNONE|wxDP_SHOWCENTURY) +LBoundDatePickerCtrl::LBoundDatePickerCtrl(wxWindow* parent, wxWindowID id) +: wxDatePickerCtrl(parent, id, wxInvalidDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT | wxDP_ALLOWNONE | wxDP_SHOWCENTURY) { m_sqlQuote = _T("'"); SetValue(wxInvalidDateTime); @@ -22,59 +22,70 @@ LBoundDatePickerCtrl::~LBoundDatePickerCtrl() if (m_rs) m_rs->UnRegisterControl(this); } -const wxAny LBoundDatePickerCtrl::GetData() { +const wxAny LBoundDatePickerCtrl::GetData() +{ if (IsNull()) return L_SQLNULL; return GetValue().GetDateOnly().FormatISODate(); } -bool LBoundDatePickerCtrl::SetData(const wxAny& newData) { - if (newData.IsNull()) { +void LBoundDatePickerCtrl::SetData(const wxAny& newData) +{ + if (newData.IsNull()) + { SetValue(wxInvalidDateTime); - return false; + return; } - if (newData.As() == L_SQLNULL || newData.As().IsEmpty()) { + if (newData.As() == L_SQLNULL || newData.As().IsEmpty()) + { SetValue(wxInvalidDateTime); - return true; + return; } - wxString s; newData.GetAs(&s); + wxString s; + newData.GetAs(&s); const wxDateTime dt = BuildDate(s); - if (!dt.IsValid()) { - SetValue(wxInvalidDateTime); - return false; - } SetValue(dt); - return true; } + void LBoundDatePickerCtrl::SetResultSet(LResultSet* newResultSet) { m_rs = newResultSet; if (m_rs == NULL) return; m_rs->RegisterControl(this); } -bool LBoundDatePickerCtrl::IsNull() { + +bool LBoundDatePickerCtrl::IsNull() +{ return !(GetValue().IsValid()); } -bool LBoundDatePickerCtrl::SetNull() { - return SetData(L_SQLNULL); + +void LBoundDatePickerCtrl::SetNull() +{ + SetData(L_SQLNULL); } -bool LBoundDatePickerCtrl::IsDirty() { + +bool LBoundDatePickerCtrl::IsDirty() +{ wxASSERT_MSG(m_rs != NULL, "m_rs est NULL."); wxAny BEData = m_rs->GetData(m_columnName); if (BEData.As().IsEmpty()) BEData = L_SQLNULL; return (GetData().As() != BEData.As()); } -const wxString LBoundDatePickerCtrl::GetDisplayedData() { + +const wxString LBoundDatePickerCtrl::GetDisplayedData() +{ if (IsNull()) return wxEmptyString; return GetValue().GetDateOnly().FormatDate(); } -wxDateTime LBoundDatePickerCtrl::BuildDate(const wxString& ISODate) { + +wxDateTime LBoundDatePickerCtrl::BuildDate(const wxString& ISODate) +{ wxDateTime dt = wxDateTime::Today(); if (!dt.ParseISODate(ISODate)) return wxInvalidDateTime; unsigned int * res = new unsigned int[3]; unsigned int i = 0; wxAny token; wxStringTokenizer tkz(ISODate, _T("-")); - while ( tkz.HasMoreTokens() ) + while (tkz.HasMoreTokens()) { token = tkz.GetNextToken(); token.GetAs(&res[i]); diff --git a/L7/LBoundDatePickerCtrl.h b/L7/LBoundDatePickerCtrl.h index 166a9e0..a39f396 100644 --- a/L7/LBoundDatePickerCtrl.h +++ b/L7/LBoundDatePickerCtrl.h @@ -8,11 +8,12 @@ */ #ifndef LBOUNDDATEPICKERCTRL_H -#define LBOUNDDATEPICKERCTRL_H +#define LBOUNDDATEPICKERCTRL_H #include #include "LBoundControl.h" #include "LResultSet.h" + /** * Initialised with wxInvalidDateTime. The underlying toolkit must allow wxDP_ALLOWNONE. * @@ -32,10 +33,8 @@ public: /** * * @param newData - * @return false if newData is not a valid ISO date string. - * True if newData is empty, or literal NULL, or a valid ISO date string. */ - bool SetData(const wxAny& newData); + void SetData(const wxAny& newData); /** * Sets the resultset member and registers the control in the resultset. * @param newResultSet @@ -50,7 +49,7 @@ public: * Sets the control to invalid date. * @return */ - bool SetNull(); + void SetNull(); bool IsDirty(); /** * If IsNull() is true, returns wxEmptyString. @@ -68,10 +67,10 @@ public: * @return */ static wxDateTime BuildDate(const wxString& ISODate); - + private: }; -#endif /* LBOUNDDATEPICKERCTRL_H */ +#endif /* LBOUNDDATEPICKERCTRL_H */ diff --git a/L7/LBoundGrid.cpp b/L7/LBoundGrid.cpp index c019444..012460f 100644 --- a/L7/LBoundGrid.cpp +++ b/L7/LBoundGrid.cpp @@ -18,6 +18,10 @@ #include "LGridTextRenderer.h" #include "LGridSpinEditor.h" #include "LGridSpinRenderer.h" +#include "special/LGridJsonCellRenderer.h" +#include "special/LGridJsonCellEditor.h" +#include "special/LGridXmlCellRenderer.h" +#include "special/LGridXmlCellEditor.h" LBoundGrid::LBoundGrid(wxWindow* parent, wxWindowID id) : wxGrid(parent, id, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL) @@ -34,9 +38,10 @@ LBoundGrid::LBoundGrid(wxWindow* parent, wxWindowID id) SetTable(m_stringTable); SetSelectionMode(wxGridSelectRows); CreateMenu(); - Bind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this); - Bind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this); - Bind(wxEVT_GRID_CELL_RIGHT_CLICK, &LBoundGrid::ShowMenu, this); + // These bindings must not propagate to the grid of BaseGridPicker !!! + Bind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this, GetId(), GetId()); + Bind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this, GetId(), GetId()); + Bind(wxEVT_GRID_CELL_RIGHT_CLICK, &LBoundGrid::ShowMenu, this, GetId(), GetId()); } LBoundGrid::~LBoundGrid() @@ -66,8 +71,8 @@ void LBoundGrid::SetResultSet(LResultSet* newResultSet) void LBoundGrid::ClearGrid() { - Unbind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this); - Unbind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this); + Unbind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this, GetId(), GetId()); + Unbind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this, GetId(), GetId()); if (GetNumberRows()) DeleteRows(0, GetNumberRows()); if (GetNumberCols()) DeleteCols(0, GetNumberCols()); } @@ -79,8 +84,8 @@ void LBoundGrid::FillGrid() wxGridUpdateLocker locker(this); // Starting again, the grid's resultset must free itself from any registered controls. RestoreEditorControls(); - Unbind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this); - Unbind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this); + Unbind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this, GetId(), GetId()); + Unbind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this, GetId(), GetId()); // Remember some states const wxGridSizesInfo colSizes = GetColSizes(); const int col = GetGridCursorCol() > -1 ? GetGridCursorCol() : 0; @@ -112,8 +117,8 @@ void LBoundGrid::FillGrid() m_stringTable->SetValue(r, c, (m_rs->GetData(r, c)).As()); } } - Bind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this); - Bind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this); + Bind(wxEVT_GRID_SELECT_CELL, &LBoundGrid::CellSelected, this, GetId(), GetId()); + Bind(wxEVT_GRID_RANGE_SELECT, &LBoundGrid::ForceSingleLineRange, this, GetId(), GetId()); // Restore SetColSizes(colSizes); // synchronize with the resultset @@ -234,6 +239,54 @@ void LBoundGrid::CreateSpinColumn(const wxString& newColName, SetColSize(col, width); } +void LBoundGrid::CreateJsonGridColumn(const wxString& newColName, + const wxString& newLabel, + unsigned int width, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize, + bool readOnly) +{ + wxASSERT_MSG(m_rs != NULL, _("RS = NULL")); + const int col = m_rs->GetColumnIndex(newColName); + wxASSERT_MSG(col > -1, _("Invalid column name : ") + newColName); + wxGridCellAttr * colAtt = m_stringTable->GetAttr(GetGridCursorRow(), col, wxGridCellAttr::Col); + if (colAtt == NULL) colAtt = new wxGridCellAttr(); + LGridJsonCellEditor * ed = new LGridJsonCellEditor(newColName, intentLabel, types, popupSize); + colAtt->SetEditor(ed); + LGridJsonCellRenderer * rn = new LGridJsonCellRenderer(); + colAtt->SetRenderer(rn); + colAtt->SetReadOnly(readOnly); + colAtt->SetAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); + m_stringTable->SetColAttr(colAtt, col); + m_stringTable->SetColLabelValue(col, newLabel); + SetColSize(col, width); +} + +void LBoundGrid::CreateXmlGridColumn(const wxString& newColName, + const wxString& newLabel, + unsigned int width, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize, + bool readOnly) +{ + wxASSERT_MSG(m_rs != NULL, _("RS = NULL")); + const int col = m_rs->GetColumnIndex(newColName); + wxASSERT_MSG(col > -1, _("Invalid column name : ") + newColName); + wxGridCellAttr * colAtt = m_stringTable->GetAttr(GetGridCursorRow(), col, wxGridCellAttr::Col); + if (colAtt == NULL) colAtt = new wxGridCellAttr(); + LGridXmlCellEditor * ed = new LGridXmlCellEditor(newColName, intentLabel, types, popupSize); + colAtt->SetEditor(ed); + LGridXmlCellRenderer * rn = new LGridXmlCellRenderer(); + colAtt->SetRenderer(rn); + colAtt->SetReadOnly(readOnly); + colAtt->SetAlignment(wxALIGN_RIGHT, wxALIGN_CENTRE); + m_stringTable->SetColAttr(colAtt, col); + m_stringTable->SetColLabelValue(col, newLabel); + SetColSize(col, width); +} + const wxString LBoundGrid::GetColName(const unsigned int col) { wxASSERT_MSG(m_rs != NULL, _("RS = NULL")); @@ -427,7 +480,7 @@ void LBoundGrid::ForceSingleLineRange(wxGridRangeSelectEvent& evt) { wxASSERT_MSG(GetSelectionMode() == wxGridSelectRows, "Selection mode is not wxGridSelectRows."); if (evt.ControlDown() == true - || evt.GetTopRow() != evt.GetBottomRow()) + || evt.GetTopRow() != evt.GetBottomRow()) { SelectRow(GetGridCursorRow()); evt.Veto(); @@ -527,7 +580,8 @@ void LBoundGrid::ShowMenu(wxGridEvent& evt) void LBoundGrid::MenuAction(wxCommandEvent& evt) { - switch (evt.GetId()) { + switch (evt.GetId()) + { case ID_MNU_SAVE: if (m_rs) { @@ -650,7 +704,8 @@ void LBoundGrid::ShowFormView() wxControl * fEditor = NULL; // One more pointer to a text control wxTextCtrl * txtCtrl = NULL; - switch (type) { + switch (type) + { case LGridColEditor::TEXT: fEditor = static_cast (gce->ProvideFormEditor(pan0)); txtCtrl = static_cast (fEditor); @@ -667,6 +722,12 @@ void LBoundGrid::ShowFormView() case LGridColEditor::SPIN: fEditor = static_cast (gce->ProvideFormEditor(pan0)); break; + case LGridColEditor::JSON_GRID: + fEditor = static_cast (gce->ProvideFormEditor(pan0)); + break; + case LGridColEditor::XML_GRID: + fEditor = static_cast (gce->ProvideFormEditor(pan0)); + break; } // A label corresponding to the grid column header wxStaticText * lbl = new wxStaticText(pan0, wxID_ANY, m_stringTable->GetColLabelValue(col), wxDefaultPosition, wxDefaultSize, 0); diff --git a/L7/LBoundGrid.h b/L7/LBoundGrid.h index bccc5b4..d46ed48 100644 --- a/L7/LBoundGrid.h +++ b/L7/LBoundGrid.h @@ -8,7 +8,7 @@ */ #ifndef LBOUNDGRID_H -#define LBOUNDGRID_H +#define LBOUNDGRID_H #include #include "LResultSet.h" @@ -119,6 +119,20 @@ public: int newMax = 100, int newInitial = 0, bool readOnly = false); + void CreateJsonGridColumn(const wxString& newColName, + const wxString& newLabel, + unsigned int width, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + bool readOnly = false); + void CreateXmlGridColumn(const wxString& newColName, + const wxString& newLabel, + unsigned int width, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + bool readOnly = false); /** * * @param col the grid column index @@ -316,5 +330,5 @@ private: }; -#endif /* LBOUNDGRID_H */ +#endif /* LBOUNDGRID_H */ diff --git a/L7/LBoundSpinCtrl.cpp b/L7/LBoundSpinCtrl.cpp index 06cae46..1f99178 100644 --- a/L7/LBoundSpinCtrl.cpp +++ b/L7/LBoundSpinCtrl.cpp @@ -34,9 +34,9 @@ void LBoundSpinCtrl::SetResultSet(LResultSet* newResultSet) m_rs->RegisterControl(this); } -bool LBoundSpinCtrl::SetData(const wxAny& newData) +void LBoundSpinCtrl::SetData(const wxAny& newData) { - if (newData.IsNull() || newData.As().IsEmpty() ) + if (newData.IsNull() || newData.As().IsEmpty()) { SetValue(m_initialValue); } @@ -46,7 +46,6 @@ bool LBoundSpinCtrl::SetData(const wxAny& newData) newData.GetAs(&iData); SetValue(iData); } - return true; } bool LBoundSpinCtrl::IsDirty() diff --git a/L7/LBoundSpinCtrl.h b/L7/LBoundSpinCtrl.h index d620772..43ec2f7 100644 --- a/L7/LBoundSpinCtrl.h +++ b/L7/LBoundSpinCtrl.h @@ -8,7 +8,7 @@ */ #ifndef LBOUNDSPINCTRL_H -#define LBOUNDSPINCTRL_H +#define LBOUNDSPINCTRL_H #include #include "LBoundControl.h" @@ -48,9 +48,8 @@ public: /** * If newData is null or empty, sets the control to its initial value. * @param newData - * @return */ - bool SetData(const wxAny& newData); + void SetData(const wxAny& newData); /** * This control is never empty. @@ -65,7 +64,7 @@ public: * Sets the control to its initial value. * @return */ - bool SetNull() + void SetNull() { SetData(m_initialValue); } @@ -84,5 +83,5 @@ private: int m_initialValue; }; -#endif /* LBOUNDSPINCTRL_H */ +#endif /* LBOUNDSPINCTRL_H */ diff --git a/L7/LBoundTextCtrl.cpp b/L7/LBoundTextCtrl.cpp index 9ab619d..cf29ce4 100644 --- a/L7/LBoundTextCtrl.cpp +++ b/L7/LBoundTextCtrl.cpp @@ -33,10 +33,9 @@ const wxAny LBoundTextCtrl::GetData() return GetValue(); } -bool LBoundTextCtrl::SetData(const wxAny& newData) +void LBoundTextCtrl::SetData(const wxAny& newData) { ChangeValue(newData.As()); - return true; } bool LBoundTextCtrl::IsDirty() diff --git a/L7/LBoundTextCtrl.h b/L7/LBoundTextCtrl.h index 7ee99a4..1511040 100644 --- a/L7/LBoundTextCtrl.h +++ b/L7/LBoundTextCtrl.h @@ -8,7 +8,7 @@ */ #ifndef LBOUNDTEXTCTRL_H -#define LBOUNDTEXTCTRL_H +#define LBOUNDTEXTCTRL_H #include #include "LBoundControl.h" @@ -32,9 +32,9 @@ public: /** * Calls ChangeValue(). * @param newData - * @return */ - bool SetData(const wxAny& newData); + void SetData(const wxAny& newData); + /** * Alias for IsEmpty(). * @return @@ -43,15 +43,17 @@ public: { return IsEmpty(); } + /** * Alias for Clear(). * @return */ - bool SetNull() + void SetNull() { Clear(); } bool IsDirty(); + /** * Alias for GetValue(). * @return @@ -64,5 +66,5 @@ public: private: }; -#endif /* LBOUNDTEXTCTRL_H */ +#endif /* LBOUNDTEXTCTRL_H */ diff --git a/L7/LConnection.cpp b/L7/LConnection.cpp index 1b34573..29c681c 100644 --- a/L7/LConnection.cpp +++ b/L7/LConnection.cpp @@ -53,12 +53,15 @@ LConnectionEvent::LConnectionEvent() LConnectionEvent::~LConnectionEvent() { } + void LConnectionEvent::BeforeExecute(const LConnection* caller) { } + void LConnectionEvent::AfterExecute(const LConnection* caller) { } + void LConnectionEvent::Inform(const LConnection* caller, const LInformation& msg) const { } \ No newline at end of file diff --git a/L7/LConnection.h b/L7/LConnection.h index 4e3fb81..62d7307 100644 --- a/L7/LConnection.h +++ b/L7/LConnection.h @@ -8,7 +8,7 @@ */ #ifndef LCONNECTION_H -#define LCONNECTION_H +#define LCONNECTION_H #include #include "LInformation.h" @@ -116,6 +116,7 @@ public: */ virtual void * GetReturnedKeys() const { + return NULL; }; /** @@ -134,6 +135,7 @@ public: * @param evh : an LConnectionEvent derived class. */ void UnRegisterEventHandler(LConnectionEvent * evh); + /** * Returns registered derived classes of LConnectionEvent. * @return A reference to a wxArrayPtrVoid object. @@ -185,5 +187,5 @@ private: }; -#endif /* LCONNECTION_H */ +#endif /* LCONNECTION_H */ diff --git a/L7/LGridCheckEditor.cpp b/L7/LGridCheckEditor.cpp index 7e78518..faecc4c 100644 --- a/L7/LGridCheckEditor.cpp +++ b/L7/LGridCheckEditor.cpp @@ -13,12 +13,15 @@ LGridCheckEditor::LGridCheckEditor(const wxString& newColName, bool isDualstate, const wxString& newNullLabel) { m_triState = !isDualstate; - m_style = wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER; + m_style = wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER; if (!m_triState) m_style = wxCHK_2STATE; m_colName = newColName; - if (newNullLabel.IsEmpty()) { + if (newNullLabel.IsEmpty()) + { m_nullLabel = _T("?"); - } else { + } + else + { m_nullLabel = newNullLabel; } m_type = LGridColEditor::CHECK; @@ -32,7 +35,8 @@ LGridCheckEditor::~LGridCheckEditor() wxDELETE(m_control); } -void LGridCheckEditor::Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) { +void LGridCheckEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) +{ m_control = new LBoundCheckBox(parent, id, m_style); m_BoundCheckBox = static_cast (m_control); m_BoundCheckBox->SetColumnName(m_colName); @@ -41,59 +45,86 @@ void LGridCheckEditor::Create (wxWindow *parent, wxWindowID id, wxEvtHandler *ev m_control->Show(false); } -void LGridCheckEditor::BeginEdit (int row, int col, wxGrid *grid) { - if (m_control == NULL) { +void LGridCheckEditor::BeginEdit(int row, int col, wxGrid *grid) +{ + if (m_control == NULL) + { Create(grid->GetGridWindow(), wxID_ANY, NULL); } m_BoundCheckBox->SetResultSet(((LBoundGrid *) grid)->GetResultSet()); const wxAny val = grid->GetTable()->GetValue(row, col); - if (m_triState && val.As() == m_nullLabel) { + if (m_triState && val.As() == m_nullLabel) + { m_BoundCheckBox->SetNull(); - } else { + } + else + { m_BoundCheckBox->SetData(val); } m_control->Show(true); } -wxGridCellEditor* LGridCheckEditor::Clone () const { + +wxGridCellEditor* LGridCheckEditor::Clone() const +{ return new LGridCheckEditor(m_colName, !m_triState, m_nullLabel); } -bool LGridCheckEditor::EndEdit (int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) { + +bool LGridCheckEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) +{ // What do we do here ? return true; } -void LGridCheckEditor::ApplyEdit (int row, int col, wxGrid *grid) { + +void LGridCheckEditor::ApplyEdit(int row, int col, wxGrid *grid) +{ const wxAny val = m_BoundCheckBox->GetData(); - if (m_triState && val.As() == L_SQLNULL) { + if (m_triState && val.As() == L_SQLNULL) + { grid->GetTable()->SetValue(row, col, m_nullLabel); - } else { + } + else + { grid->GetTable()->SetValue(row, col, val.As()); } } -void LGridCheckEditor::Reset () { + +void LGridCheckEditor::Reset() +{ wxDELETE(m_control); m_BoundControl = NULL; m_BoundCheckBox = NULL; } -wxString LGridCheckEditor::GetValue() const { +wxString LGridCheckEditor::GetValue() const +{ return m_control == NULL ? wxString(wxEmptyString) : m_BoundControl->GetData().As(); } -wxControl* LGridCheckEditor::ProvideFormEditor(wxWindow * parent) { + +wxControl* LGridCheckEditor::ProvideFormEditor(wxWindow * parent) +{ if (!m_formEditor) m_formEditor = new wxCheckBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_style); - if (m_triState) { + if (m_triState) + { m_formEditor->Set3StateValue(m_BoundCheckBox->Get3StateValue()); - } else { + } + else + { m_formEditor->SetValue(m_BoundCheckBox->GetValue()); } m_formEditor->SetName(m_BoundCheckBox->GetName()); if (m_BoundCheckBox->GetValidator()) m_formEditor->SetValidator(*(m_BoundCheckBox->GetValidator())); return m_formEditor; } -void LGridCheckEditor::SyncBack(const int row, const int col, wxGrid * grid) { + +void LGridCheckEditor::SyncBack(const int row, const int col, wxGrid * grid) +{ if (!m_formEditor) return; - if (m_triState) { + if (m_triState) + { m_BoundCheckBox->Set3StateValue(m_formEditor->Get3StateValue()); - } else { + } + else + { m_BoundCheckBox->SetValue(m_formEditor->GetValue()); } ApplyEdit(row, col, grid); diff --git a/L7/LGridCheckEditor.h b/L7/LGridCheckEditor.h index 3910e86..22eb81a 100644 --- a/L7/LGridCheckEditor.h +++ b/L7/LGridCheckEditor.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDCHECKEDITOR_H -#define LGRIDCHECKEDITOR_H +#define LGRIDCHECKEDITOR_H #include "LBoundCheckBox.h" #include "LGridColEditor.h" @@ -93,5 +93,5 @@ private: LBoundCheckBox * m_BoundCheckBox; }; -#endif /* LGRIDCHECKEDITOR_H */ +#endif /* LGRIDCHECKEDITOR_H */ diff --git a/L7/LGridCheckRenderer.cpp b/L7/LGridCheckRenderer.cpp index 9b2cb3f..1f09cab 100644 --- a/L7/LGridCheckRenderer.cpp +++ b/L7/LGridCheckRenderer.cpp @@ -42,14 +42,14 @@ void LGridCheckRenderer::Draw(wxGrid & grid, if (m_triState) { if (val.IsEmpty() - || val == m_nullLabel) + || val == m_nullLabel) { grid.GetTable()->SetValue(row, col, m_nullLabel); wxGridCellStringRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); return; } if (val == _T("0") - || val.Lower() == _("no")) + || val.Lower() == _("no")) { grid.GetTable()->SetValue(row, col, _T("No")); } @@ -61,8 +61,8 @@ void LGridCheckRenderer::Draw(wxGrid & grid, else { if (val == _T("0") - || val.IsEmpty() - || val.Lower() == _("no")) + || val.IsEmpty() + || val.Lower() == _("no")) { grid.GetTable()->SetValue(row, col, _T("No")); } diff --git a/L7/LGridCheckRenderer.h b/L7/LGridCheckRenderer.h index 67712f6..b11f289 100644 --- a/L7/LGridCheckRenderer.h +++ b/L7/LGridCheckRenderer.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDCHECKRENDERER_H -#define LGRIDCHECKRENDERER_H +#define LGRIDCHECKRENDERER_H #include "wx/grid.h" @@ -52,5 +52,5 @@ private: bool m_triState; }; -#endif /* LGRIDCHECKRENDERER_H */ +#endif /* LGRIDCHECKRENDERER_H */ diff --git a/L7/LGridColEditor.h b/L7/LGridColEditor.h index b883318..b1c0d2a 100644 --- a/L7/LGridColEditor.h +++ b/L7/LGridColEditor.h @@ -12,7 +12,8 @@ #include "LBoundControl.h" #ifndef LGRIDCOLEDITOR_H -#define LGRIDCOLEDITOR_H +#define LGRIDCOLEDITOR_H + /** * Abstract class defining methods data bound grid cell editors must implement. */ @@ -24,8 +25,9 @@ public: enum COL_TYPE { - TEXT, COMBO, DATE, CHECK, SPIN + TEXT, COMBO, DATE, CHECK, SPIN, JSON_GRID, XML_GRID }; + /** * * @return the database table column name. @@ -34,7 +36,7 @@ public: { return m_colName; } - + int GetType() const { return m_type; @@ -74,5 +76,5 @@ private: }; -#endif /* LGRIDCOLEDITOR_H */ +#endif /* LGRIDCOLEDITOR_H */ diff --git a/L7/LGridComboEditor.cpp b/L7/LGridComboEditor.cpp index 4b782ff..1ff805d 100644 --- a/L7/LGridComboEditor.cpp +++ b/L7/LGridComboEditor.cpp @@ -59,7 +59,19 @@ wxGridCellEditor* LGridComboEditor::Clone() const bool LGridComboEditor::EndEdit(int row, int col, const wxGrid* grid, const wxString& oldval, wxString* newval) { - // What do we do here ? + /* + * Work around a nasty misbehavior. + * Grid columns edited by a translated combobox expect full string + * data as cell values. LResultSet::BEData() will report these mapped strings, + * instead of database real data. LBoundComboBox::IsDirty() will always be + * true even if m_BoundComboBox is unchanged once created. + * Simplest workaround : disconnect m_BoundComboBox if unchanged. + */ + if (m_BoundComboBox->GetStringSelection() == oldval && m_BoundComboBox->IsTranslated()) + { + LResultSet * rs = ((LBoundGrid *) grid)->GetResultSet(); + rs->UnRegisterControl(m_BoundComboBox); + } return true; } diff --git a/L7/LGridComboEditor.h b/L7/LGridComboEditor.h index 8524f91..9c0bcc5 100644 --- a/L7/LGridComboEditor.h +++ b/L7/LGridComboEditor.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDCOMBOEDITOR_H -#define LGRIDCOMBOEDITOR_H +#define LGRIDCOMBOEDITOR_H #include "LGridColEditor.h" #include "LBoundComboBox.h" @@ -85,5 +85,5 @@ private: LBoundComboBox * m_BoundComboBox; }; -#endif /* LGRIDCOMBOEDITOR_H */ +#endif /* LGRIDCOMBOEDITOR_H */ diff --git a/L7/LGridComboRenderer.h b/L7/LGridComboRenderer.h index ad6fa37..2245359 100644 --- a/L7/LGridComboRenderer.h +++ b/L7/LGridComboRenderer.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDCOMBORENDERER_H -#define LGRIDCOMBORENDERER_H +#define LGRIDCOMBORENDERER_H #include "wx/grid.h" @@ -21,5 +21,5 @@ private: }; -#endif /* LGRIDCOMBORENDERER_H */ +#endif /* LGRIDCOMBORENDERER_H */ diff --git a/L7/LGridDateEditor.cpp b/L7/LGridDateEditor.cpp index 0888f08..6414200 100644 --- a/L7/LGridDateEditor.cpp +++ b/L7/LGridDateEditor.cpp @@ -35,7 +35,8 @@ void LGridDateEditor::Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtH void LGridDateEditor::BeginEdit(int row, int col, wxGrid* grid) { - if (m_control == NULL) { + if (m_control == NULL) + { Create(grid->GetGridWindow(), wxID_ANY, NULL); } m_BoundDatePicker->SetResultSet(((LBoundGrid *) grid)->GetResultSet()); diff --git a/L7/LGridDateEditor.h b/L7/LGridDateEditor.h index 75adf4f..187c457 100644 --- a/L7/LGridDateEditor.h +++ b/L7/LGridDateEditor.h @@ -8,14 +8,16 @@ */ #ifndef LGRIDDATEEDITOR_H -#define LGRIDDATEEDITOR_H +#define LGRIDDATEEDITOR_H #include "LGridColEditor.h" #include "LBoundDatePickerCtrl.h" + /** * Edits table data using an LBoundDatePickerCtrl. */ -class LGridDateEditor : public wxGridCellEditor, public LGridColEditor { +class LGridDateEditor : public wxGridCellEditor, public LGridColEditor +{ public: /** * @@ -32,16 +34,16 @@ public: * @param id * @param evtHandler */ - void Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler); + void Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler); /** * Creates m_control if necessary. Registers the editor in the grid's resultset. * @param row * @param col * @param grid */ - void BeginEdit (int row, int col, wxGrid *grid); - wxGridCellEditor* Clone () const; - bool EndEdit (int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); + void BeginEdit(int row, int col, wxGrid *grid); + wxGridCellEditor* Clone() const; + bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); /** * Applies the editor value as returned by GetData() to the grid cell. * If the editor contains wxInvalidDateTime, the grid cell is set to an empty string. @@ -49,11 +51,11 @@ public: * @param col * @param grid */ - void ApplyEdit (int row, int col, wxGrid *grid); + void ApplyEdit(int row, int col, wxGrid *grid); /** * Deletes the editor, all pointers to the editor are set to NULL. */ - void Reset (); + void Reset(); /** * * @return GetData(), or wxEmptyString if the editor control has not been created. @@ -63,7 +65,11 @@ public: * Creates a wxDatePickerCtrl to be used as editor in form view. */ wxControl* ProvideFormEditor(wxWindow * parent); - wxControl* GetFormEditor() const {return m_formEditor;} + + wxControl* GetFormEditor() const + { + return m_formEditor; + } /** * Updates the grid cell and the editor. m_formEditor is deleted and set to NULL. * @param row @@ -71,7 +77,7 @@ public: * @param grid */ void SyncBack(const int row, const int col, wxGrid * grid); - + private: wxDatePickerCtrl * m_formEditor; /** @@ -80,5 +86,5 @@ private: LBoundDatePickerCtrl * m_BoundDatePicker; }; -#endif /* LGRIDDATEEDITOR_H */ +#endif /* LGRIDDATEEDITOR_H */ diff --git a/L7/LGridDateRenderer.h b/L7/LGridDateRenderer.h index 338f934..4086b20 100644 --- a/L7/LGridDateRenderer.h +++ b/L7/LGridDateRenderer.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDDATERENDERER_H -#define LGRIDDATERENDERER_H +#define LGRIDDATERENDERER_H #include @@ -21,5 +21,5 @@ private: }; -#endif /* LGRIDDATERENDERER_H */ +#endif /* LGRIDDATERENDERER_H */ diff --git a/L7/LGridSpinEditor.h b/L7/LGridSpinEditor.h index e60a8db..8e25d87 100644 --- a/L7/LGridSpinEditor.h +++ b/L7/LGridSpinEditor.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDSPINEDITOR_H -#define LGRIDSPINEDITOR_H +#define LGRIDSPINEDITOR_H #include "LGridColEditor.h" #include "LBoundSpinCtrl.h" @@ -93,5 +93,5 @@ private: int m_min, m_max, m_initial; }; -#endif /* LGRIDSPINEDITOR_H */ +#endif /* LGRIDSPINEDITOR_H */ diff --git a/L7/LGridSpinRenderer.h b/L7/LGridSpinRenderer.h index 5935ac2..72beb58 100644 --- a/L7/LGridSpinRenderer.h +++ b/L7/LGridSpinRenderer.h @@ -8,11 +8,12 @@ */ #ifndef LGRIDSPINRENDERER_H -#define LGRIDSPINRENDERER_H +#define LGRIDSPINRENDERER_H #include -class LGridSpinRenderer : public wxGridCellNumberRenderer { +class LGridSpinRenderer : public wxGridCellNumberRenderer +{ public: LGridSpinRenderer(); virtual ~LGridSpinRenderer(); @@ -20,5 +21,5 @@ private: }; -#endif /* LGRIDSPINRENDERER_H */ +#endif /* LGRIDSPINRENDERER_H */ diff --git a/L7/LGridTextEditor.cpp b/L7/LGridTextEditor.cpp index 361c3c5..253ba9f 100644 --- a/L7/LGridTextEditor.cpp +++ b/L7/LGridTextEditor.cpp @@ -11,7 +11,7 @@ #include "LBoundGrid.h" LGridTextEditor::LGridTextEditor(const wxString& newColName, bool newMultiline) - : wxGridCellAutoWrapStringEditor() +: wxGridCellAutoWrapStringEditor() { m_multiline = newMultiline; m_style = 0; @@ -28,15 +28,19 @@ LGridTextEditor::~LGridTextEditor() wxDELETE(m_control); } -void LGridTextEditor::Create (wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) { - m_control = new LBoundTextCtrl( parent, id, m_style); +void LGridTextEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) +{ + m_control = new LBoundTextCtrl(parent, id, m_style); m_BoundTextCtrl = (static_cast (m_control)); m_BoundTextCtrl->SetColumnName(m_colName); m_BoundControl = m_BoundTextCtrl; m_control->Show(false); } -void LGridTextEditor::BeginEdit (int row, int col, wxGrid *grid) { - if (m_control == NULL) { + +void LGridTextEditor::BeginEdit(int row, int col, wxGrid *grid) +{ + if (m_control == NULL) + { Create(grid->GetGridWindow(), wxID_ANY, NULL); } m_BoundTextCtrl->SetResultSet(((LBoundGrid *) grid)->GetResultSet()); @@ -44,32 +48,46 @@ void LGridTextEditor::BeginEdit (int row, int col, wxGrid *grid) { m_BoundTextCtrl->SetData(sText); m_control->Show(true); } -wxGridCellEditor* LGridTextEditor::Clone () const { + +wxGridCellEditor* LGridTextEditor::Clone() const +{ return new LGridTextEditor(m_colName, m_multiline); } -bool LGridTextEditor::EndEdit (int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) { + +bool LGridTextEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) +{ // What do we do here ? return true; } -void LGridTextEditor::ApplyEdit (int row, int col, wxGrid *grid) { + +void LGridTextEditor::ApplyEdit(int row, int col, wxGrid *grid) +{ grid->GetTable()->SetValue(row, col, m_BoundTextCtrl->GetValue()); } -void LGridTextEditor::Reset () { + +void LGridTextEditor::Reset() +{ wxDELETE(m_control); m_BoundControl = NULL; m_BoundTextCtrl = NULL; } -wxString LGridTextEditor::GetValue() const { + +wxString LGridTextEditor::GetValue() const +{ return m_control == NULL ? wxString(wxEmptyString) : m_BoundControl->GetData().As(); } -wxControl* LGridTextEditor::ProvideFormEditor(wxWindow * parent) { + +wxControl* LGridTextEditor::ProvideFormEditor(wxWindow * parent) +{ if (!m_formEditor) m_formEditor = new wxTextCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_style); - m_formEditor->SetValue(GetValue()); + m_formEditor->SetValue(m_BoundTextCtrl->GetValue()); m_formEditor->SetName(m_BoundTextCtrl->GetName()); if (m_BoundTextCtrl->GetValidator()) m_formEditor->SetValidator(*(m_BoundTextCtrl->GetValidator())); return m_formEditor; } -void LGridTextEditor::SyncBack(const int row, const int col, wxGrid * grid) { + +void LGridTextEditor::SyncBack(const int row, const int col, wxGrid * grid) +{ if (!m_formEditor) return; m_BoundTextCtrl->SetValue(m_formEditor->GetValue()); ApplyEdit(row, col, grid); diff --git a/L7/LGridTextEditor.h b/L7/LGridTextEditor.h index 3844b90..278705b 100644 --- a/L7/LGridTextEditor.h +++ b/L7/LGridTextEditor.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDTEXTEDITOR_H -#define LGRIDTEXTEDITOR_H +#define LGRIDTEXTEDITOR_H #include "LGridColEditor.h" #include "LBoundTextCtrl.h" @@ -88,5 +88,5 @@ private: LBoundTextCtrl * m_BoundTextCtrl; }; -#endif /* LGRIDTEXTEDITOR_H */ +#endif /* LGRIDTEXTEDITOR_H */ diff --git a/L7/LGridTextRenderer.h b/L7/LGridTextRenderer.h index 50c24de..68920dd 100644 --- a/L7/LGridTextRenderer.h +++ b/L7/LGridTextRenderer.h @@ -8,7 +8,7 @@ */ #ifndef LGRIDTEXTRENDERER_H -#define LGRIDTEXTRENDERER_H +#define LGRIDTEXTRENDERER_H #include "wx/grid.h" @@ -21,5 +21,5 @@ private: }; -#endif /* LGRIDTEXTRENDERER_H */ +#endif /* LGRIDTEXTRENDERER_H */ diff --git a/L7/LInformation.cpp b/L7/LInformation.cpp index 337eb39..37ceab9 100644 --- a/L7/LInformation.cpp +++ b/L7/LInformation.cpp @@ -9,7 +9,7 @@ #include "LInformation.h" -LInformation::LInformation(const wxString& newCode, +LInformation::LInformation(const wxString& newCode, const wxString& newMsg) { m_code = newCode; diff --git a/L7/LInformation.h b/L7/LInformation.h index b8a4222..1947177 100644 --- a/L7/LInformation.h +++ b/L7/LInformation.h @@ -8,7 +8,7 @@ */ #ifndef LINFORMATION_H -#define LINFORMATION_H +#define LINFORMATION_H #include @@ -33,6 +33,7 @@ public: { return m_msg; } + /** * * @return Both the code and the message concatenated. @@ -46,5 +47,5 @@ private: wxString m_msg; }; -#endif /* LINFORMATION_H */ +#endif /* LINFORMATION_H */ diff --git a/L7/LItemData.h b/L7/LItemData.h index 53eeac3..817328f 100644 --- a/L7/LItemData.h +++ b/L7/LItemData.h @@ -8,7 +8,7 @@ */ #ifndef LITEMDATA_H -#define LITEMDATA_H +#define LITEMDATA_H #include @@ -39,5 +39,5 @@ private: wxAny m_data; }; -#endif /* LITEMDATA_H */ +#endif /* LITEMDATA_H */ diff --git a/L7/LLightPQResultSet.h b/L7/LLightPQResultSet.h index 44ad319..032bf00 100644 --- a/L7/LLightPQResultSet.h +++ b/L7/LLightPQResultSet.h @@ -9,7 +9,7 @@ #ifdef USE_LIBPQ #ifndef LLIGHTPQRESULTSET_H -#define LLIGHTPQRESULTSET_H +#define LLIGHTPQRESULTSET_H #include #include @@ -21,49 +21,50 @@ */ namespace PQ { + +/** + * Scrollable minimal resultset for the PostgreSQL backend. + * + * This class does not allow data modification and does not output any messages. + * The underlying SQL query may contain table and/or column aliases. + */ +class LLightPQResultSet : public LLightResultSet +{ +public: + LLightPQResultSet(); + LLightPQResultSet(LConnection * newConnection); + virtual ~LLightPQResultSet(); /** - * Scrollable minimal resultset for the PostgreSQL backend. - * - * This class does not allow data modification and does not output any messages. - * The underlying SQL query may contain table and/or column aliases. + * Updates and runs the SQL string. + * @param newSql + * @return */ - class LLightPQResultSet : public LLightResultSet - { - public: - LLightPQResultSet(); - LLightPQResultSet(LConnection * newConnection); - virtual ~LLightPQResultSet(); - /** - * Updates and runs the SQL string. - * @param newSql - * @return - */ - bool SetSQL(const wxString& newSql); - bool HasData() const; - bool Absolute(const unsigned int newRowIndex); - bool IsFirst() const; - bool IsLast() const; - bool First(); - bool Next(); - bool Previous(); - bool Last(); - const unsigned int GetRowCount() const; - const unsigned int GetColumnCount() const; - const wxString GetColumnName(const unsigned int colIndex) const; - const int GetColumnIndex(const wxString& colName) const; - const wxAny GetData(const int unsigned rowIdx, const unsigned int colIdx) const; - /** - * At current row. - * @param colName - * @return database table value or wxEmptyString. - */ - const wxAny GetData(const wxString& colName) const; + bool SetSQL(const wxString& newSql); + bool HasData() const; + bool Absolute(const unsigned int newRowIndex); + bool IsFirst() const; + bool IsLast() const; + bool First(); + bool Next(); + bool Previous(); + bool Last(); + const unsigned int GetRowCount() const; + const unsigned int GetColumnCount() const; + const wxString GetColumnName(const unsigned int colIndex) const; + const int GetColumnIndex(const wxString& colName) const; + const wxAny GetData(const int unsigned rowIdx, const unsigned int colIdx) const; + /** + * At current row. + * @param colName + * @return database table value or wxEmptyString. + */ + const wxAny GetData(const wxString& colName) const; - private: - bool RunSQL(); - }; +private: + bool RunSQL(); +}; } -#endif /* LLIGHTPQRESULTSET_H */ +#endif /* LLIGHTPQRESULTSET_H */ #endif diff --git a/L7/LLightResultSet.h b/L7/LLightResultSet.h index 5443388..60905e6 100644 --- a/L7/LLightResultSet.h +++ b/L7/LLightResultSet.h @@ -8,7 +8,7 @@ */ #ifndef LLIGHTRESULTSET_H -#define LLIGHTRESULTSET_H +#define LLIGHTRESULTSET_H /* Added to be able to use derived classes independantly * If xConnection and xResultSet classes are included in some project, @@ -27,7 +27,8 @@ * * Does not modify data. */ -class LLightResultSet : public wxTrackable { +class LLightResultSet : public wxTrackable +{ public: LLightResultSet(); LLightResultSet(LConnection * newConnection); @@ -39,19 +40,23 @@ public: * Updates the SQL statement without running it. * @param newSql */ - void UpdateSQL(const wxString& newSql) { + void UpdateSQL(const wxString& newSql) + { m_curSql = newSql; } - const wxString& GetSQL() const { + const wxString& GetSQL() const + { return m_curSql; } - void SetConnection(LConnection * newConnection) { + void SetConnection(LConnection * newConnection) + { m_conn = newConnection; } - const LConnection * GetConnection() const { + const LConnection * GetConnection() const + { return m_conn; } virtual bool HasData() const = 0; @@ -68,7 +73,8 @@ public: * * Returns -1 if there's no data. */ - const int GetRow() const { + const int GetRow() const + { return m_cursor; } virtual const unsigned int GetRowCount() const = 0; @@ -89,5 +95,5 @@ private: }; -#endif /* LLIGHTRESULTSET_H */ +#endif /* LLIGHTRESULTSET_H */ diff --git a/L7/LLightSQResultSet.cpp b/L7/LLightSQResultSet.cpp index 57fff13..bb7c428 100644 --- a/L7/LLightSQResultSet.cpp +++ b/L7/LLightSQResultSet.cpp @@ -25,7 +25,8 @@ LLightSQResultSet::~LLightSQResultSet() { SQresult * srs = static_cast (m_rs); sqlite3_free_table(srs->m_data); - delete srs; m_rs = NULL; + delete srs; + m_rs = NULL; } } @@ -44,12 +45,14 @@ bool LLightSQResultSet::RunSQL() { SQresult * srs = static_cast (m_rs); sqlite3_free_table(srs->m_data); - wxDELETE(srs);; + wxDELETE(srs); + ; m_rs = NULL; } m_rs = m_conn->ExecuteSQL(m_curSql); SQresult * srs = static_cast (m_rs); - if (!RetrieveColNames(srs)) { // No columns returned if no data ! + if (!RetrieveColNames(srs)) + { // No columns returned if no data ! m_rs = NULL; return false; } @@ -199,12 +202,14 @@ bool LLightSQResultSet::RetrieveColNames(SQresult * emptyResult) emptyResult->m_nbCols = m_colNames.GetCount(); sqlite3_finalize(ppStmt); return true; - } else { + } + else + { int errCode = sqlite3_errcode(db); const char * errMsg = sqlite3_errmsg(db); const char * errStr = sqlite3_errstr(errCode); const wxString msg(wxAny(errCode).As() + _T(" ") + - wxString(errMsg) + _T("\n") + wxString(errStr)); + wxString(errMsg) + _T("\n") + wxString(errStr)); wxPrintf("%s\n", msg); wxFAIL_MSG(msg); } diff --git a/L7/LLightSQResultSet.h b/L7/LLightSQResultSet.h index 2160b3a..5e01897 100644 --- a/L7/LLightSQResultSet.h +++ b/L7/LLightSQResultSet.h @@ -9,7 +9,7 @@ #ifdef USE_LIBSQ #ifndef LLIGHTSQRESULTSET_H -#define LLIGHTSQRESULTSET_H +#define LLIGHTSQRESULTSET_H #include #include @@ -22,50 +22,51 @@ */ namespace SQ { - /** - * Scrollable minimal resultset for the SQLite backend. - * - * This object does not allow data modification and does not output any messages. - * The underlying SQL query may contain table and/or column aliases - */ - class LLightSQResultSet : public LLightResultSet - { - public: - LLightSQResultSet(); - LLightSQResultSet(LConnection * newConnection); - virtual ~LLightSQResultSet(); - /** - * Updates and runs the SQL string. - * @param newSql - * @return - */ - bool SetSQL(const wxString& newSql); - bool HasData() const; - bool Absolute(const unsigned int newRowIndex); - bool IsFirst() const; - bool IsLast() const; - bool First(); - bool Next(); - bool Previous(); - bool Last(); - const unsigned int GetRowCount() const; - const unsigned int GetColumnCount() const; - const wxString GetColumnName(const unsigned int colIndex) const; - const int GetColumnIndex(const wxString& colName) const; - const wxAny GetData(const int unsigned rowIdx, const unsigned int colIdx) const; - /** - * At current row. - * @param colName - * @return database table value or wxEmptyString. - */ - const wxAny GetData(const wxString& colName) const; - private: - bool RunSQL(); - wxArrayString m_colNames; - bool RetrieveColNames(SQresult * emptyResult); - }; +/** + * Scrollable minimal resultset for the SQLite backend. + * + * This object does not allow data modification and does not output any messages. + * The underlying SQL query may contain table and/or column aliases + */ +class LLightSQResultSet : public LLightResultSet +{ +public: + LLightSQResultSet(); + LLightSQResultSet(LConnection * newConnection); + virtual ~LLightSQResultSet(); + /** + * Updates and runs the SQL string. + * @param newSql + * @return + */ + bool SetSQL(const wxString& newSql); + bool HasData() const; + bool Absolute(const unsigned int newRowIndex); + bool IsFirst() const; + bool IsLast() const; + bool First(); + bool Next(); + bool Previous(); + bool Last(); + const unsigned int GetRowCount() const; + const unsigned int GetColumnCount() const; + const wxString GetColumnName(const unsigned int colIndex) const; + const int GetColumnIndex(const wxString& colName) const; + const wxAny GetData(const int unsigned rowIdx, const unsigned int colIdx) const; + /** + * At current row. + * @param colName + * @return database table value or wxEmptyString. + */ + const wxAny GetData(const wxString& colName) const; + +private: + bool RunSQL(); + wxArrayString m_colNames; + bool RetrieveColNames(SQresult * emptyResult); +}; } -#endif /* LLIGHTSQRESULTSET_H */ +#endif /* LLIGHTSQRESULTSET_H */ #endif diff --git a/L7/LNavigator.h b/L7/LNavigator.h index 71e11df..39c5a85 100644 --- a/L7/LNavigator.h +++ b/L7/LNavigator.h @@ -8,7 +8,7 @@ */ #ifndef LNAVIGATOR_H -#define LNAVIGATOR_H +#define LNAVIGATOR_H #include #include "LResultSet.h" @@ -74,6 +74,7 @@ private: }; ////////////////////////////////////////////////////////////////////////////// + /** * A private resultset event handler for LNavigator. All functions are declared private. * Don't use it. @@ -91,5 +92,5 @@ private: void UpdateLocation(const LResultSet* caller); }; -#endif /* LNAVIGATOR_H */ +#endif /* LNAVIGATOR_H */ diff --git a/L7/LPQConnection.h b/L7/LPQConnection.h index 06030a5..4782819 100644 --- a/L7/LPQConnection.h +++ b/L7/LPQConnection.h @@ -9,7 +9,7 @@ #ifdef USE_LIBPQ #ifndef LPQCONNECTION_H -#define LPQCONNECTION_H +#define LPQCONNECTION_H #include #include @@ -130,5 +130,5 @@ private: }; } -#endif /* LPQCONNECTION_H */ +#endif /* LPQCONNECTION_H */ #endif diff --git a/L7/LPQResultSet.cpp b/L7/LPQResultSet.cpp index 50e0399..6329558 100644 --- a/L7/LPQResultSet.cpp +++ b/L7/LPQResultSet.cpp @@ -15,7 +15,6 @@ using namespace PQ; LPQResultSet::LPQResultSet() : LResultSet() { - } LPQResultSet::LPQResultSet(LConnection* newConnection) : LResultSet(newConnection) @@ -197,9 +196,9 @@ const wxAny LPQResultSet::GetData(const wxString& columnName) const { PGresult * prs = static_cast (m_rs); if (m_cursor < 0 - || IsInserting() - || !HasData() - || m_cursor > PQntuples(prs) - 1) + || IsInserting() + || !HasData() + || m_cursor > PQntuples(prs) - 1) return wxEmptyString; const char* colName = columnName.c_str(); int colIdx = PQfnumber(prs, colName); diff --git a/L7/LPQResultSet.h b/L7/LPQResultSet.h index 54d2740..fc7787d 100644 --- a/L7/LPQResultSet.h +++ b/L7/LPQResultSet.h @@ -9,7 +9,7 @@ #ifdef USE_LIBPQ #ifndef LPQRESULTSET_H -#define LPQRESULTSET_H +#define LPQRESULTSET_H #include "LResultSet.h" #include @@ -33,86 +33,86 @@ namespace PQ #define RS004C wxString(_T("RS004")) #define RS004M wxString(_("Invalid column name :\n")) +/** + * Scrollable resultset for the PostgreSQL backend. + * + * This class allows data modification through GUI elements. + * The underlying SQL query must not contain table aliases. + * + * A column alias must still be a real column name of the table specified in SetTableName. + * + * Ex : SELECT tbl1.pk1, tbl1.text1, list2.text2 AS num1 FROM tbl1 LEFT JOIN list2 ON tbl1.num1 = list2.pk2 + */ +class LPQResultSet : public LResultSet +{ +public: + LPQResultSet(); + LPQResultSet(LConnection * newConnection); + virtual ~LPQResultSet(); + /** - * Scrollable resultset for the PostgreSQL backend. - * - * This class allows data modification through GUI elements. - * The underlying SQL query must not contain table aliases. - * - * A column alias must still be a real column name of the table specified in SetTableName. - * - * Ex : SELECT tbl1.pk1, tbl1.text1, list2.text2 AS num1 FROM tbl1 LEFT JOIN list2 ON tbl1.num1 = list2.pk2 + * Updates and runs the SQL string. + * @param newSql + * @return */ - class LPQResultSet : public LResultSet + bool SetSQL(const wxString& newSql); + bool HasData() const; + bool Absolute(const unsigned int newRowIndex); + bool IsFirst() const; + bool IsLast() const; + bool First(); + bool Next(); + bool Previous(); + bool Last(); + const unsigned int GetRowCount() const; + const unsigned int GetColumnCount() const; + const wxString GetColumnName(const unsigned int colIndex) const; + const int GetColumnIndex(const wxString& colName) const; + const wxAny GetData(const unsigned int rowIdx, const unsigned int colIdx) const; + /** + * At current row. + * @param colName + * @return database table value or wxEmptyString. + */ + const wxAny GetData(const wxString& colName) const; + /** + * Updates registered controls on screen. + */ + void Display(); + bool Save(); + + inline void InformInserting() const { - public: - LPQResultSet(); - LPQResultSet(LConnection * newConnection); - virtual ~LPQResultSet(); + InformLibMessage(LInformation(RS001C, RS001M)); + } - /** - * Updates and runs the SQL string. - * @param newSql - * @return - */ - bool SetSQL(const wxString& newSql); - bool HasData() const; - bool Absolute(const unsigned int newRowIndex); - bool IsFirst() const; - bool IsLast() const; - bool First(); - bool Next(); - bool Previous(); - bool Last(); - const unsigned int GetRowCount() const; - const unsigned int GetColumnCount() const; - const wxString GetColumnName(const unsigned int colIndex) const; - const int GetColumnIndex(const wxString& colName) const; - const wxAny GetData(const unsigned int rowIdx, const unsigned int colIdx) const; - /** - * At current row. - * @param colName - * @return database table value or wxEmptyString. - */ - const wxAny GetData(const wxString& colName) const; - /** - * Updates registered controls on screen. - */ - void Display(); - bool Save(); - - inline void InformInserting() const - { - InformLibMessage(LInformation(RS001C, RS001M)); - } - - inline void InformDirty() const - { - InformLibMessage(LInformation(RS003C, RS003M)); - }; - - /** - * Replaces a single quote ' by two single quotes '' . - * @param literal - * @return the number of single quotes replaced - */ - static int EscapeChar(wxString& literal) - { - return literal.Replace(_T("'"), _T("''")); - } - - private: - bool RunSQL(); - const wxString MakeUpdateSQL() const; - const wxString MakeDeleteSQL() const; - /** - * Locates a row by the primary key value and returns its index. - * @param pkValue - * @return row index or -1 if not found. - */ - const int GetRowByPKValue(const wxAny& pkValue) const; + inline void InformDirty() const + { + InformLibMessage(LInformation(RS003C, RS003M)); }; + /** + * Replaces a single quote ' by two single quotes '' . + * @param literal + * @return the number of single quotes replaced + */ + static int EscapeChar(wxString& literal) + { + return literal.Replace(_T("'"), _T("''")); + } + +private: + bool RunSQL(); + const wxString MakeUpdateSQL() const; + const wxString MakeDeleteSQL() const; + /** + * Locates a row by the primary key value and returns its index. + * @param pkValue + * @return row index or -1 if not found. + */ + const int GetRowByPKValue(const wxAny& pkValue) const; +}; + } -#endif /* LPQRESULTSET_H */ +#endif /* LPQRESULTSET_H */ #endif diff --git a/L7/LResultSet.h b/L7/LResultSet.h index 2a6df50..6833980 100644 --- a/L7/LResultSet.h +++ b/L7/LResultSet.h @@ -8,7 +8,7 @@ */ #ifndef LRESULTSET_H -#define LRESULTSET_H +#define LRESULTSET_H #include "LInformation.h" #include "LBoundControl.h" @@ -271,5 +271,5 @@ private: }; -#endif /* LRESULTSET_H */ +#endif /* LRESULTSET_H */ diff --git a/L7/LSQConnection.h b/L7/LSQConnection.h index de836cf..b490e67 100644 --- a/L7/LSQConnection.h +++ b/L7/LSQConnection.h @@ -9,7 +9,7 @@ #ifdef USE_LIBSQ #ifndef LSQCONNECTION_H -#define LSQCONNECTION_H +#define LSQCONNECTION_H #include #include @@ -73,7 +73,7 @@ public: * @param newSql a valid SQL statement. * @return an untyped pointer to an SQresult referencing the data, or NULL if error. */ - void * ExecuteSQL (const wxString& newSql); + void * ExecuteSQL(const wxString& newSql); /** * Intended for database actions that do not fetch table rows. Calls sqlite3_exec. * @param newSql : : a valid SQL statement. @@ -104,5 +104,5 @@ private: }; } -#endif /* LSQCONNECTION_H */ +#endif /* LSQCONNECTION_H */ #endif diff --git a/L7/LSQResultSet.cpp b/L7/LSQResultSet.cpp index 8d745f5..4cae37d 100644 --- a/L7/LSQResultSet.cpp +++ b/L7/LSQResultSet.cpp @@ -208,9 +208,9 @@ const wxAny LSQResultSet::GetData(const wxString &columnName) const { SQresult * srs = static_cast (m_rs); if (m_cursor < 0 - || IsInserting() - || !HasData() - || m_cursor > srs->m_nbRows - 1) + || IsInserting() + || !HasData() + || m_cursor > srs->m_nbRows - 1) return wxEmptyString; for (unsigned int c = 0; c < srs->m_nbCols; c++) { diff --git a/L7/LSQResultSet.h b/L7/LSQResultSet.h index f6881cd..f6f48b1 100644 --- a/L7/LSQResultSet.h +++ b/L7/LSQResultSet.h @@ -8,7 +8,7 @@ */ #ifdef USE_LIBSQ #ifndef LSQRESULTSET_H -#define LSQRESULTSET_H +#define LSQRESULTSET_H #include "LResultSet.h" #include @@ -32,88 +32,88 @@ namespace SQ #define RSSQ004C wxString(_T("RS004")) #define RSSQ004M wxString(_("Invalid column name :\n")) +/** + * Scrollable resultset for the SQLite backend. + * + * This class allows data modification through GUI elements. + * The underlying SQL query must not contain table aliases. + * + * A column alias must still be a real column name of the table specified in SetTableName. + * + * Ex : SELECT tbl1.pk1, tbl1.text1, list2.text2 AS num1 FROM tbl1 LEFT JOIN list2 ON tbl1.num1 = list2.pk2 + */ +class LSQResultSet : public LResultSet +{ +public: + LSQResultSet(); + LSQResultSet(LConnection * newConnection); + virtual ~LSQResultSet(); /** - * Scrollable resultset for the SQLite backend. - * - * This class allows data modification through GUI elements. - * The underlying SQL query must not contain table aliases. - * - * A column alias must still be a real column name of the table specified in SetTableName. - * - * Ex : SELECT tbl1.pk1, tbl1.text1, list2.text2 AS num1 FROM tbl1 LEFT JOIN list2 ON tbl1.num1 = list2.pk2 + * Updates and runs the SQL string. + * @param newSql + * @return */ - class LSQResultSet : public LResultSet + bool SetSQL(const wxString& newSql); + bool HasData() const; + bool Absolute(const unsigned int newRowIndex); + bool IsFirst() const; + bool IsLast() const; + bool First(); + bool Next(); + bool Previous(); + bool Last(); + const unsigned int GetRowCount() const; + const unsigned int GetColumnCount() const; + const wxString GetColumnName(const unsigned int colIndex) const; + const int GetColumnIndex(const wxString& colName) const; + const wxAny GetData(const unsigned int rowIdx, const unsigned int colIdx) const; + /** + * At current row. + * @param colName + * @return database table value or wxEmptyString. + */ + const wxAny GetData(const wxString& colName) const; + /** + * Updates registered controls on screen. + */ + void Display(); + bool Save(); + + inline void InformInserting() const { - public: - LSQResultSet(); - LSQResultSet(LConnection * newConnection); - virtual ~LSQResultSet(); - /** - * Updates and runs the SQL string. - * @param newSql - * @return - */ - bool SetSQL(const wxString& newSql); - bool HasData() const; - bool Absolute(const unsigned int newRowIndex); - bool IsFirst() const; - bool IsLast() const; - bool First(); - bool Next(); - bool Previous(); - bool Last(); - const unsigned int GetRowCount() const; - const unsigned int GetColumnCount() const; - const wxString GetColumnName(const unsigned int colIndex) const; - const int GetColumnIndex(const wxString& colName) const; - const wxAny GetData(const unsigned int rowIdx, const unsigned int colIdx) const; - /** - * At current row. - * @param colName - * @return database table value or wxEmptyString. - */ - const wxAny GetData(const wxString& colName) const; - /** - * Updates registered controls on screen. - */ - void Display(); - bool Save(); + InformLibMessage(LInformation(RSSQ001C, RSSQ001M)); + } - inline void InformInserting() const - { - InformLibMessage(LInformation(RSSQ001C, RSSQ001M)); - } - - inline void InformDirty() const - { - InformLibMessage(LInformation(RSSQ003C, RSSQ003M)); - }; - - /** - * Replaces a single quote ' by two single quotes '' . - * @param literal - * @return the number of single quotes replaced - */ - static int EscapeChar(wxString& literal) - { - return literal.Replace(_T("'"), _T("''")); - } - - private: - bool RunSQL(); - const wxString MakeUpdateSQL() const; - const wxString MakeDeleteSQL() const; - /** - * Locates a row by the primary key value and returns its index. - * @param pkValue - * @return row index or -1 if not found. - */ - const int GetRowByPKValue(const wxAny& pkValue) const; - - wxArrayString m_colNames; - bool RetrieveColNames(SQresult * emptyResult); + inline void InformDirty() const + { + InformLibMessage(LInformation(RSSQ003C, RSSQ003M)); }; + /** + * Replaces a single quote ' by two single quotes '' . + * @param literal + * @return the number of single quotes replaced + */ + static int EscapeChar(wxString& literal) + { + return literal.Replace(_T("'"), _T("''")); + } + +private: + bool RunSQL(); + const wxString MakeUpdateSQL() const; + const wxString MakeDeleteSQL() const; + /** + * Locates a row by the primary key value and returns its index. + * @param pkValue + * @return row index or -1 if not found. + */ + const int GetRowByPKValue(const wxAny& pkValue) const; + + wxArrayString m_colNames; + bool RetrieveColNames(SQresult * emptyResult); +}; + } -#endif /* LSQRESULTSET_H */ +#endif /* LSQRESULTSET_H */ #endif diff --git a/L7/LSQresult.h b/L7/LSQresult.h index b1dd3f2..891bfcb 100644 --- a/L7/LSQresult.h +++ b/L7/LSQresult.h @@ -9,7 +9,7 @@ #ifdef USE_LIBSQ #ifndef LSQRESULT_H -#define LSQRESULT_H +#define LSQRESULT_H /** * SQLite namespace. * @@ -18,32 +18,32 @@ namespace SQ { - class SQresult - { - /** - * This class is used to reference the data obtained by LSQConnection::ExecuteSQL. - * - * If no rows are returned, m_data is NULL and does not even provide the column names. - */ - public: - SQresult(); - virtual ~SQresult(); - /** - * Pointer to the array of column names and data. - */ - char ** m_data; - /** - * Number of rows. - */ - int m_nbRows; - /** - * Number of columns - */ - int m_nbCols; - private: +class SQresult +{ + /** + * This class is used to reference the data obtained by LSQConnection::ExecuteSQL. + * + * If no rows are returned, m_data is NULL and does not even provide the column names. + */ +public: + SQresult(); + virtual ~SQresult(); + /** + * Pointer to the array of column names and data. + */ + char ** m_data; + /** + * Number of rows. + */ + int m_nbRows; + /** + * Number of columns + */ + int m_nbCols; +private: - }; +}; } -#endif /* LSQRESULT_H */ +#endif /* LSQRESULT_H */ #endif diff --git a/L7/LVersion.h b/L7/LVersion.h index b3b1494..44bb8ed 100644 --- a/L7/LVersion.h +++ b/L7/LVersion.h @@ -8,9 +8,9 @@ */ #ifndef LVERSION_H -#define LVERSION_H +#define LVERSION_H -#define L7_VERSION_STR "4" +#define L7_VERSION_STR "5" -#endif /* LVERSION_H */ +#endif /* LVERSION_H */ diff --git a/L7/changelog.txt b/L7/changelog.txt index 6b5525e..c89f7b4 100644 --- a/L7/changelog.txt +++ b/L7/changelog.txt @@ -1,6 +1,11 @@ +2019-12-23 +Added pickers to manage simple tabular data in a grid shown in a popup. +The grid's content is stored as JSON or XML data. + 2018-04-25 1. Controls in 'Form View' inherit the grid cell's editor validator. -2. Corrected a bug in LGridSpinEditor::ProvideFormEditor, where the form editor was created without the style parameter. +2. Corrected a bug in LGridSpinEditor::ProvideFormEditor, where the form editor +was created without the style parameter. 3. Rename the project to L7. 4. Change versioning pattern to running integers. 5. Moved to github.com. diff --git a/L7/nbproject/Makefile-Debug.mk b/L7/nbproject/Makefile-Debug.mk index 7debf02..7d23a07 100644 --- a/L7/nbproject/Makefile-Debug.mk +++ b/L7/nbproject/Makefile-Debug.mk @@ -65,7 +65,19 @@ OBJECTFILES= \ ${OBJECTDIR}/LResultSet.o \ ${OBJECTDIR}/LSQConnection.o \ ${OBJECTDIR}/LSQResultSet.o \ - ${OBJECTDIR}/LSQresult.o + ${OBJECTDIR}/LSQresult.o \ + ${OBJECTDIR}/special/BaseGridPicker.o \ + ${OBJECTDIR}/special/BasePicker.o \ + ${OBJECTDIR}/special/JsonGridPickerCtrl.o \ + ${OBJECTDIR}/special/JsonHelper.o \ + ${OBJECTDIR}/special/LBoundJsonGridPicker.o \ + ${OBJECTDIR}/special/LBoundXmlGridPicker.o \ + ${OBJECTDIR}/special/LGridJsonCellEditor.o \ + ${OBJECTDIR}/special/LGridJsonCellRenderer.o \ + ${OBJECTDIR}/special/LGridXmlCellEditor.o \ + ${OBJECTDIR}/special/LGridXmlCellRenderer.o \ + ${OBJECTDIR}/special/XmlGridPickerCtrl.o \ + ${OBJECTDIR}/special/XmlHelper.o # C Compiler Flags @@ -82,7 +94,7 @@ FFLAGS= ASFLAGS= # Link Libraries and Options -LDLIBSOPTIONS=-L/usr/local/wxWidgets/lib -lwx_baseu-3.1 -lwx_gtk2u_core-3.1 +LDLIBSOPTIONS=-L/usr/local/wxWidgets/lib -lwx_baseu-3.1 -lwx_gtk2u_core-3.1 -lwx_baseu_xml-3.1 -lwxcode_gtk2ud_wxjson-3.1 # Build Targets .build-conf: ${BUILD_SUBPROJECTS} @@ -95,157 +107,217 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libL7.${CND_DLIB_EXT}: ${OBJECTFILES} ${OBJECTDIR}/LBoundCheckBox.o: LBoundCheckBox.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundCheckBox.o LBoundCheckBox.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundCheckBox.o LBoundCheckBox.cpp ${OBJECTDIR}/LBoundComboBox.o: LBoundComboBox.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundComboBox.o LBoundComboBox.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundComboBox.o LBoundComboBox.cpp ${OBJECTDIR}/LBoundControl.o: LBoundControl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundControl.o LBoundControl.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundControl.o LBoundControl.cpp ${OBJECTDIR}/LBoundDatePickerCtrl.o: LBoundDatePickerCtrl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundDatePickerCtrl.o LBoundDatePickerCtrl.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundDatePickerCtrl.o LBoundDatePickerCtrl.cpp ${OBJECTDIR}/LBoundGrid.o: LBoundGrid.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundGrid.o LBoundGrid.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundGrid.o LBoundGrid.cpp ${OBJECTDIR}/LBoundSpinCtrl.o: LBoundSpinCtrl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundSpinCtrl.o LBoundSpinCtrl.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundSpinCtrl.o LBoundSpinCtrl.cpp ${OBJECTDIR}/LBoundTextCtrl.o: LBoundTextCtrl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundTextCtrl.o LBoundTextCtrl.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundTextCtrl.o LBoundTextCtrl.cpp ${OBJECTDIR}/LConnection.o: LConnection.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LConnection.o LConnection.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LConnection.o LConnection.cpp ${OBJECTDIR}/LGridCheckEditor.o: LGridCheckEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckEditor.o LGridCheckEditor.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckEditor.o LGridCheckEditor.cpp ${OBJECTDIR}/LGridCheckRenderer.o: LGridCheckRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckRenderer.o LGridCheckRenderer.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckRenderer.o LGridCheckRenderer.cpp ${OBJECTDIR}/LGridColEditor.o: LGridColEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridColEditor.o LGridColEditor.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridColEditor.o LGridColEditor.cpp ${OBJECTDIR}/LGridComboEditor.o: LGridComboEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboEditor.o LGridComboEditor.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboEditor.o LGridComboEditor.cpp ${OBJECTDIR}/LGridComboRenderer.o: LGridComboRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboRenderer.o LGridComboRenderer.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboRenderer.o LGridComboRenderer.cpp ${OBJECTDIR}/LGridDateEditor.o: LGridDateEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateEditor.o LGridDateEditor.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateEditor.o LGridDateEditor.cpp ${OBJECTDIR}/LGridDateRenderer.o: LGridDateRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateRenderer.o LGridDateRenderer.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateRenderer.o LGridDateRenderer.cpp ${OBJECTDIR}/LGridSpinEditor.o: LGridSpinEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinEditor.o LGridSpinEditor.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinEditor.o LGridSpinEditor.cpp ${OBJECTDIR}/LGridSpinRenderer.o: LGridSpinRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinRenderer.o LGridSpinRenderer.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinRenderer.o LGridSpinRenderer.cpp ${OBJECTDIR}/LGridTextEditor.o: LGridTextEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextEditor.o LGridTextEditor.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextEditor.o LGridTextEditor.cpp ${OBJECTDIR}/LGridTextRenderer.o: LGridTextRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextRenderer.o LGridTextRenderer.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextRenderer.o LGridTextRenderer.cpp ${OBJECTDIR}/LInformation.o: LInformation.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LInformation.o LInformation.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LInformation.o LInformation.cpp ${OBJECTDIR}/LItemData.o: LItemData.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LItemData.o LItemData.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LItemData.o LItemData.cpp ${OBJECTDIR}/LLightPQResultSet.o: LLightPQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightPQResultSet.o LLightPQResultSet.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightPQResultSet.o LLightPQResultSet.cpp ${OBJECTDIR}/LLightResultSet.o: LLightResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightResultSet.o LLightResultSet.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightResultSet.o LLightResultSet.cpp ${OBJECTDIR}/LLightSQResultSet.o: LLightSQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightSQResultSet.o LLightSQResultSet.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightSQResultSet.o LLightSQResultSet.cpp ${OBJECTDIR}/LNavigator.o: LNavigator.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LNavigator.o LNavigator.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LNavigator.o LNavigator.cpp ${OBJECTDIR}/LPQConnection.o: LPQConnection.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQConnection.o LPQConnection.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQConnection.o LPQConnection.cpp ${OBJECTDIR}/LPQResultSet.o: LPQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQResultSet.o LPQResultSet.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQResultSet.o LPQResultSet.cpp ${OBJECTDIR}/LResultSet.o: LResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LResultSet.o LResultSet.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LResultSet.o LResultSet.cpp ${OBJECTDIR}/LSQConnection.o: LSQConnection.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQConnection.o LSQConnection.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQConnection.o LSQConnection.cpp ${OBJECTDIR}/LSQResultSet.o: LSQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQResultSet.o LSQResultSet.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQResultSet.o LSQResultSet.cpp ${OBJECTDIR}/LSQresult.o: LSQresult.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQresult.o LSQresult.cpp + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQresult.o LSQresult.cpp + +${OBJECTDIR}/special/BaseGridPicker.o: special/BaseGridPicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/BaseGridPicker.o special/BaseGridPicker.cpp + +${OBJECTDIR}/special/BasePicker.o: special/BasePicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/BasePicker.o special/BasePicker.cpp + +${OBJECTDIR}/special/JsonGridPickerCtrl.o: special/JsonGridPickerCtrl.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/JsonGridPickerCtrl.o special/JsonGridPickerCtrl.cpp + +${OBJECTDIR}/special/JsonHelper.o: special/JsonHelper.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/JsonHelper.o special/JsonHelper.cpp + +${OBJECTDIR}/special/LBoundJsonGridPicker.o: special/LBoundJsonGridPicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LBoundJsonGridPicker.o special/LBoundJsonGridPicker.cpp + +${OBJECTDIR}/special/LBoundXmlGridPicker.o: special/LBoundXmlGridPicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LBoundXmlGridPicker.o special/LBoundXmlGridPicker.cpp + +${OBJECTDIR}/special/LGridJsonCellEditor.o: special/LGridJsonCellEditor.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridJsonCellEditor.o special/LGridJsonCellEditor.cpp + +${OBJECTDIR}/special/LGridJsonCellRenderer.o: special/LGridJsonCellRenderer.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridJsonCellRenderer.o special/LGridJsonCellRenderer.cpp + +${OBJECTDIR}/special/LGridXmlCellEditor.o: special/LGridXmlCellEditor.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridXmlCellEditor.o special/LGridXmlCellEditor.cpp + +${OBJECTDIR}/special/LGridXmlCellRenderer.o: special/LGridXmlCellRenderer.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridXmlCellRenderer.o special/LGridXmlCellRenderer.cpp + +${OBJECTDIR}/special/XmlGridPickerCtrl.o: special/XmlGridPickerCtrl.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/XmlGridPickerCtrl.o special/XmlGridPickerCtrl.cpp + +${OBJECTDIR}/special/XmlHelper.o: special/XmlHelper.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -g -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -I/usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets/include/wx-3.1 -I/usr/local/wxWidgets/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/XmlHelper.o special/XmlHelper.cpp # Subprojects .build-subprojects: diff --git a/L7/nbproject/Makefile-Release.mk b/L7/nbproject/Makefile-Release.mk index b42a2ab..90fdc13 100644 --- a/L7/nbproject/Makefile-Release.mk +++ b/L7/nbproject/Makefile-Release.mk @@ -65,7 +65,19 @@ OBJECTFILES= \ ${OBJECTDIR}/LResultSet.o \ ${OBJECTDIR}/LSQConnection.o \ ${OBJECTDIR}/LSQResultSet.o \ - ${OBJECTDIR}/LSQresult.o + ${OBJECTDIR}/LSQresult.o \ + ${OBJECTDIR}/special/BaseGridPicker.o \ + ${OBJECTDIR}/special/BasePicker.o \ + ${OBJECTDIR}/special/JsonGridPickerCtrl.o \ + ${OBJECTDIR}/special/JsonHelper.o \ + ${OBJECTDIR}/special/LBoundJsonGridPicker.o \ + ${OBJECTDIR}/special/LBoundXmlGridPicker.o \ + ${OBJECTDIR}/special/LGridJsonCellEditor.o \ + ${OBJECTDIR}/special/LGridJsonCellRenderer.o \ + ${OBJECTDIR}/special/LGridXmlCellEditor.o \ + ${OBJECTDIR}/special/LGridXmlCellRenderer.o \ + ${OBJECTDIR}/special/XmlGridPickerCtrl.o \ + ${OBJECTDIR}/special/XmlHelper.o # C Compiler Flags @@ -82,7 +94,7 @@ FFLAGS= ASFLAGS= # Link Libraries and Options -LDLIBSOPTIONS=-L/usr/local/wxWidgets-Release/lib -lwx_baseu-3.1 -lwx_gtk2u_core-3.1 +LDLIBSOPTIONS=-L/usr/local/wxWidgets-Release/lib -lwx_baseu-3.1 -lwx_gtk2u_core-3.1 -lwx_baseu_xml-3.1 -lwxcode_gtk2u_wxjson-3.1 # Build Targets .build-conf: ${BUILD_SUBPROJECTS} @@ -95,157 +107,217 @@ ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/libL7.${CND_DLIB_EXT}: ${OBJECTFILES} ${OBJECTDIR}/LBoundCheckBox.o: LBoundCheckBox.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundCheckBox.o LBoundCheckBox.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundCheckBox.o LBoundCheckBox.cpp ${OBJECTDIR}/LBoundComboBox.o: LBoundComboBox.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundComboBox.o LBoundComboBox.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundComboBox.o LBoundComboBox.cpp ${OBJECTDIR}/LBoundControl.o: LBoundControl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundControl.o LBoundControl.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundControl.o LBoundControl.cpp ${OBJECTDIR}/LBoundDatePickerCtrl.o: LBoundDatePickerCtrl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundDatePickerCtrl.o LBoundDatePickerCtrl.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundDatePickerCtrl.o LBoundDatePickerCtrl.cpp ${OBJECTDIR}/LBoundGrid.o: LBoundGrid.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundGrid.o LBoundGrid.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundGrid.o LBoundGrid.cpp ${OBJECTDIR}/LBoundSpinCtrl.o: LBoundSpinCtrl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundSpinCtrl.o LBoundSpinCtrl.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundSpinCtrl.o LBoundSpinCtrl.cpp ${OBJECTDIR}/LBoundTextCtrl.o: LBoundTextCtrl.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundTextCtrl.o LBoundTextCtrl.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LBoundTextCtrl.o LBoundTextCtrl.cpp ${OBJECTDIR}/LConnection.o: LConnection.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LConnection.o LConnection.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LConnection.o LConnection.cpp ${OBJECTDIR}/LGridCheckEditor.o: LGridCheckEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckEditor.o LGridCheckEditor.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckEditor.o LGridCheckEditor.cpp ${OBJECTDIR}/LGridCheckRenderer.o: LGridCheckRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckRenderer.o LGridCheckRenderer.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridCheckRenderer.o LGridCheckRenderer.cpp ${OBJECTDIR}/LGridColEditor.o: LGridColEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridColEditor.o LGridColEditor.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridColEditor.o LGridColEditor.cpp ${OBJECTDIR}/LGridComboEditor.o: LGridComboEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboEditor.o LGridComboEditor.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboEditor.o LGridComboEditor.cpp ${OBJECTDIR}/LGridComboRenderer.o: LGridComboRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboRenderer.o LGridComboRenderer.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridComboRenderer.o LGridComboRenderer.cpp ${OBJECTDIR}/LGridDateEditor.o: LGridDateEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateEditor.o LGridDateEditor.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateEditor.o LGridDateEditor.cpp ${OBJECTDIR}/LGridDateRenderer.o: LGridDateRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateRenderer.o LGridDateRenderer.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridDateRenderer.o LGridDateRenderer.cpp ${OBJECTDIR}/LGridSpinEditor.o: LGridSpinEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinEditor.o LGridSpinEditor.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinEditor.o LGridSpinEditor.cpp ${OBJECTDIR}/LGridSpinRenderer.o: LGridSpinRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinRenderer.o LGridSpinRenderer.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridSpinRenderer.o LGridSpinRenderer.cpp ${OBJECTDIR}/LGridTextEditor.o: LGridTextEditor.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextEditor.o LGridTextEditor.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextEditor.o LGridTextEditor.cpp ${OBJECTDIR}/LGridTextRenderer.o: LGridTextRenderer.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextRenderer.o LGridTextRenderer.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LGridTextRenderer.o LGridTextRenderer.cpp ${OBJECTDIR}/LInformation.o: LInformation.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LInformation.o LInformation.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LInformation.o LInformation.cpp ${OBJECTDIR}/LItemData.o: LItemData.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LItemData.o LItemData.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LItemData.o LItemData.cpp ${OBJECTDIR}/LLightPQResultSet.o: LLightPQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightPQResultSet.o LLightPQResultSet.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightPQResultSet.o LLightPQResultSet.cpp ${OBJECTDIR}/LLightResultSet.o: LLightResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightResultSet.o LLightResultSet.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightResultSet.o LLightResultSet.cpp ${OBJECTDIR}/LLightSQResultSet.o: LLightSQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightSQResultSet.o LLightSQResultSet.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LLightSQResultSet.o LLightSQResultSet.cpp ${OBJECTDIR}/LNavigator.o: LNavigator.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LNavigator.o LNavigator.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LNavigator.o LNavigator.cpp ${OBJECTDIR}/LPQConnection.o: LPQConnection.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQConnection.o LPQConnection.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQConnection.o LPQConnection.cpp ${OBJECTDIR}/LPQResultSet.o: LPQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQResultSet.o LPQResultSet.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LPQResultSet.o LPQResultSet.cpp ${OBJECTDIR}/LResultSet.o: LResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LResultSet.o LResultSet.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LResultSet.o LResultSet.cpp ${OBJECTDIR}/LSQConnection.o: LSQConnection.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQConnection.o LSQConnection.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQConnection.o LSQConnection.cpp ${OBJECTDIR}/LSQResultSet.o: LSQResultSet.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQResultSet.o LSQResultSet.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQResultSet.o LSQResultSet.cpp ${OBJECTDIR}/LSQresult.o: LSQresult.cpp ${MKDIR} -p ${OBJECTDIR} ${RM} "$@.d" - $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQresult.o LSQresult.cpp + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/LSQresult.o LSQresult.cpp + +${OBJECTDIR}/special/BaseGridPicker.o: special/BaseGridPicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/BaseGridPicker.o special/BaseGridPicker.cpp + +${OBJECTDIR}/special/BasePicker.o: special/BasePicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/BasePicker.o special/BasePicker.cpp + +${OBJECTDIR}/special/JsonGridPickerCtrl.o: special/JsonGridPickerCtrl.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/JsonGridPickerCtrl.o special/JsonGridPickerCtrl.cpp + +${OBJECTDIR}/special/JsonHelper.o: special/JsonHelper.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/JsonHelper.o special/JsonHelper.cpp + +${OBJECTDIR}/special/LBoundJsonGridPicker.o: special/LBoundJsonGridPicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LBoundJsonGridPicker.o special/LBoundJsonGridPicker.cpp + +${OBJECTDIR}/special/LBoundXmlGridPicker.o: special/LBoundXmlGridPicker.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LBoundXmlGridPicker.o special/LBoundXmlGridPicker.cpp + +${OBJECTDIR}/special/LGridJsonCellEditor.o: special/LGridJsonCellEditor.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridJsonCellEditor.o special/LGridJsonCellEditor.cpp + +${OBJECTDIR}/special/LGridJsonCellRenderer.o: special/LGridJsonCellRenderer.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridJsonCellRenderer.o special/LGridJsonCellRenderer.cpp + +${OBJECTDIR}/special/LGridXmlCellEditor.o: special/LGridXmlCellEditor.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridXmlCellEditor.o special/LGridXmlCellEditor.cpp + +${OBJECTDIR}/special/LGridXmlCellRenderer.o: special/LGridXmlCellRenderer.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/LGridXmlCellRenderer.o special/LGridXmlCellRenderer.cpp + +${OBJECTDIR}/special/XmlGridPickerCtrl.o: special/XmlGridPickerCtrl.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/XmlGridPickerCtrl.o special/XmlGridPickerCtrl.cpp + +${OBJECTDIR}/special/XmlHelper.o: special/XmlHelper.cpp + ${MKDIR} -p ${OBJECTDIR}/special + ${RM} "$@.d" + $(COMPILE.cc) -O2 -s -DUSE_LIBPQ -DUSE_LIBSQ -DWXUSINGDLL -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -DwxDEBUG_LEVEL=0 -I/usr/local/wxWidgets-Release/include/wx-3.1 -I/usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 -I/usr/local/wxWidgets-Release/include -fPIC -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/special/XmlHelper.o special/XmlHelper.cpp # Subprojects .build-subprojects: diff --git a/L7/nbproject/configurations.xml b/L7/nbproject/configurations.xml index 1bfb2db..610dd8a 100644 --- a/L7/nbproject/configurations.xml +++ b/L7/nbproject/configurations.xml @@ -4,6 +4,20 @@ + + special/BaseGridPicker.h + special/BasePicker.h + special/JsonGridPickerCtrl.h + special/JsonHelper.h + special/LBoundJsonGridPicker.h + special/LBoundXmlGridPicker.h + special/LGridJsonCellEditor.h + special/LGridJsonCellRenderer.h + special/LGridXmlCellEditor.h + special/LGridXmlCellRenderer.h + special/XmlGridPickerCtrl.h + special/XmlHelper.h + LBoundCheckBox.h LBoundComboBox.h LBoundControl.h @@ -44,6 +58,20 @@ + + special/BaseGridPicker.cpp + special/BasePicker.cpp + special/JsonGridPickerCtrl.cpp + special/JsonHelper.cpp + special/LBoundJsonGridPicker.cpp + special/LBoundXmlGridPicker.cpp + special/LGridJsonCellEditor.cpp + special/LGridJsonCellRenderer.cpp + special/LGridXmlCellEditor.cpp + special/LGridXmlCellRenderer.cpp + special/XmlGridPickerCtrl.cpp + special/XmlHelper.cpp + LBoundCheckBox.cpp LBoundComboBox.cpp LBoundControl.cpp @@ -101,6 +129,7 @@ /usr/local/wxWidgets/lib/wx/include/gtk2-unicode-3.1 /usr/local/wxWidgets/include/wx-3.1 + /usr/local/wxWidgets/include USE_LIBPQ @@ -118,6 +147,8 @@ wx_baseu-3.1 wx_gtk2u_core-3.1 + wx_baseu_xml-3.1 + wxcode_gtk2ud_wxjson-3.1 @@ -247,6 +278,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -264,6 +343,7 @@ /usr/local/wxWidgets-Release/include/wx-3.1 /usr/local/wxWidgets-Release/lib/wx/include/gtk2-unicode-3.1 + /usr/local/wxWidgets-Release/include USE_LIBPQ @@ -288,6 +368,8 @@ wx_baseu-3.1 wx_gtk2u_core-3.1 + wx_baseu_xml-3.1 + wxcode_gtk2u_wxjson-3.1 @@ -417,6 +499,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L7/nbproject/private/c_standard_headers_indexer.c b/L7/nbproject/private/c_standard_headers_indexer.c index c2548d2..04d32b3 100644 --- a/L7/nbproject/private/c_standard_headers_indexer.c +++ b/L7/nbproject/private/c_standard_headers_indexer.c @@ -40,21 +40,21 @@ // List of standard headers was taken in http://en.cppreference.com/w/c/header -#include // Conditionally compiled macro that compares its argument to zero -#include // Functions to determine the type contained in character data -#include // Macros reporting error conditions -#include // Limits of float types -#include // Sizes of basic types -#include // Localization utilities -#include // Common mathematics functions -#include // Nonlocal jumps -#include // Signal handling -#include // Variable arguments -#include // Common macro definitions -#include // Input/output -#include // String handling -#include // General utilities: memory management, program utilities, string conversions, random numbers -#include // Time/date utilities +#include // Conditionally compiled macro that compares its argument to zero +#include // Functions to determine the type contained in character data +#include // Macros reporting error conditions +#include // Limits of float types +#include // Sizes of basic types +#include // Localization utilities +#include // Common mathematics functions +#include // Nonlocal jumps +#include // Signal handling +#include // Variable arguments +#include // Common macro definitions +#include // Input/output +#include // String handling +#include // General utilities: memory management, program utilities, string conversions, random numbers +#include // Time/date utilities #include // (since C95) Alternative operator spellings #include // (since C95) Extended multibyte and wide character utilities #include // (since C95) Wide character classification and mapping utilities diff --git a/L7/nbproject/private/cpp_standard_headers_indexer.cpp b/L7/nbproject/private/cpp_standard_headers_indexer.cpp index 04f6fa6..8ad8a57 100644 --- a/L7/nbproject/private/cpp_standard_headers_indexer.cpp +++ b/L7/nbproject/private/cpp_standard_headers_indexer.cpp @@ -40,39 +40,39 @@ // List of standard headers was taken in http://en.cppreference.com/w/cpp/header -#include // General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search -#include // Functions and macro constants for signal management -#include // Macro (and function) that saves (and jumps) to an execution context -#include // Handling of variable length argument lists -#include // Runtime type information utilities -#include // std::bitset class template -#include // Function objects, designed for use with the standard algorithms -#include // Various utility components -#include // C-style time/date utilites -#include // typedefs for types such as size_t, NULL and others -#include // Low-level memory management utilities -#include // Higher level memory management utilities +#include // General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search +#include // Functions and macro constants for signal management +#include // Macro (and function) that saves (and jumps) to an execution context +#include // Handling of variable length argument lists +#include // Runtime type information utilities +#include // std::bitset class template +#include // Function objects, designed for use with the standard algorithms +#include // Various utility components +#include // C-style time/date utilites +#include // typedefs for types such as size_t, NULL and others +#include // Low-level memory management utilities +#include // Higher level memory management utilities #include // limits of integral types -#include // limits of float types -#include // standardized way to query properties of arithmetic types -#include // Exception handling utilities -#include // Standard exception objects -#include // Conditionally compiled macro that compares its argument to zero +#include // limits of float types +#include // standardized way to query properties of arithmetic types +#include // Exception handling utilities +#include // Standard exception objects +#include // Conditionally compiled macro that compares its argument to zero #include // Macro containing the last error number #include // functions to determine the type contained in character data #include // functions for determining the type of wide character data -#include // various narrow character string handling functions -#include // various wide and multibyte string handling functions -#include // std::basic_string class template -#include // std::vector container -#include // std::deque container -#include // std::list container -#include // std::set and std::multiset associative containers -#include // std::map and std::multimap associative containers -#include // std::stack container adaptor -#include // std::queue and std::priority_queue container adaptors -#include // Algorithms that operate on containers -#include // Container iterators +#include // various narrow character string handling functions +#include // various wide and multibyte string handling functions +#include // std::basic_string class template +#include // std::vector container +#include // std::deque container +#include // std::list container +#include // std::set and std::multiset associative containers +#include // std::map and std::multimap associative containers +#include // std::stack container adaptor +#include // std::queue and std::priority_queue container adaptors +#include // Algorithms that operate on containers +#include // Container iterators #include // Common mathematics functions #include // Complex number type #include // Class for representing and manipulating arrays of values diff --git a/L7/nbproject/private/private.xml b/L7/nbproject/private/private.xml index 7945e41..499a032 100644 --- a/L7/nbproject/private/private.xml +++ b/L7/nbproject/private/private.xml @@ -2,10 +2,13 @@ 2 - 0 + 1 - + + file:/home/user/Documents/published/L7/L7/special/LGridJsonCellRenderer.h + file:/home/user/Documents/published/L7/L7/special/LGridJsonCellRenderer.cpp + diff --git a/L7/nbproject/project.xml b/L7/nbproject/project.xml index 6daef88..3159f51 100644 --- a/L7/nbproject/project.xml +++ b/L7/nbproject/project.xml @@ -22,9 +22,9 @@ true - Apache|Apache - Apache|Apache - Apache|Apache + ANSI|ANSI + ANSI|ANSI + ANSI|ANSI diff --git a/L7/special/BaseGridPicker.cpp b/L7/special/BaseGridPicker.cpp new file mode 100644 index 0000000..9820f0b --- /dev/null +++ b/L7/special/BaseGridPicker.cpp @@ -0,0 +1,211 @@ +/* + * File: BaseGridPicker.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 7, 2019, 9:40 PM + */ + +#include "BaseGridPicker.h" + +IMPLEMENT_CLASS(BaseGridPicker, BasePicker) + +BaseGridPicker::BaseGridPicker(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize, + const wxString& text, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +: BasePicker(parent, id, popupSize, text, pos, size, style, validator, name) +{ + m_grid = NULL; + m_stringTable = NULL; + m_editable = true; + m_intentLabel = _T("Intent"); + m_nbInsertRows = 3; + m_colTypeChoices = types; + m_PrefEditor = NULL; + wxButton * btn = static_cast (GetPickerCtrl()); + btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &BaseGridPicker::ShowPopup, this); +} + +BaseGridPicker::~BaseGridPicker() +{ + delete m_grid; +} + +void BaseGridPicker::UpdatePickerFromTextCtrl() +{ + // Gets called when TextCtrl is changed +} + +void BaseGridPicker::UpdateTextCtrlFromPicker() +{ + // Gets called when TextCtrl loses focus +} + +void BaseGridPicker::CreateGrid() +{ + wxDELETE(m_grid); + BasePicker::CreatePopup(); + m_grid = new wxGrid(m_popup, wxID_ANY); + m_popup->GetSizer()->Add(m_grid, 1, wxGROW | wxALL, 0); + m_grid->SetSize(m_popup->GetSize()); + m_grid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); + m_stringTable = new wxGridStringTable(); + m_stringTable->CanHaveAttributes(); + m_grid->HideRowLabels(); + m_grid->SetUseNativeColLabels(); + m_grid->SetTable(m_stringTable); + m_grid->SetSelectionMode(wxGrid::wxGridSelectionModes::wxGridSelectRows); + + PrepareGrid(); + FillGrid(); +} + +void BaseGridPicker::SetIntentLabel(const wxString& intent) +{ + m_intentLabel = intent; + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + m_stringTable->SetColLabelValue(0, m_intentLabel); +} + +wxString BaseGridPicker::GetIntent() const +{ + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + for (uint row = 0; row < m_stringTable->GetRowsCount(); row++) + { + if (m_stringTable->GetValue(row, 2) != _T("0") + && !m_stringTable->GetValue(row, 2).IsEmpty() + && !m_stringTable->GetValue(row, 0).IsEmpty()) + { + return m_stringTable->GetValue(row, 0); + } + } + return wxEmptyString; +} + +void BaseGridPicker::EnableEditing(bool editable) +{ + m_editable = editable; + m_nbInsertRows = editable ? 3 : 0; +} + +void BaseGridPicker::OnPopupHidden(wxShowEvent& evt) +{ + if (evt.IsShown()) + { + evt.Skip(); + return; + } + m_grid->SaveEditControlValue(); + /* + * Workaround an unexpected behavior : + * If cell is edited to empty, SaveEditControlValue() above does not + * save the empty string in the string table. + * It still contains the old non-empty value. + * GoToCell() below effectively ends editing. + * But this does not happen if cell is edited from empty to any non-empty + * value. + */ + m_grid->GoToCell(m_grid->GetGridCursorRow(), m_grid->GetGridCursorCol()); + DumpGrid(); + for (uint row = 0; row < m_stringTable->GetRowsCount(); row++) + { + if (m_stringTable->GetValue(row, 2) != _T("0") + && !m_stringTable->GetValue(row, 2).IsEmpty()) + { + const wxString intent = m_stringTable->GetValue(row, 0); + if (!intent.IsEmpty()) + { + GetTextCtrl()->SetValue(intent); + } + else + { + GetTextCtrl()->SetValue(INVALID_INTENT); + } + evt.Skip(); + return; + } + } + GetTextCtrl()->SetValue(INVALID_INTENT); + evt.Skip(); +} + +void BaseGridPicker::PreparePreferredCol() +{ + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + wxGridCellAttr * colAtt = m_stringTable->GetAttr(m_grid->GetGridCursorRow(), 2, wxGridCellAttr::Col); + if (colAtt == NULL) colAtt = new wxGridCellAttr(); + wxGridCellBoolEditor * ed = new wxGridCellBoolEditor(); + colAtt->SetEditor(ed); + wxGridCellBoolRenderer * rn = new wxGridCellBoolRenderer(); + colAtt->SetRenderer(rn); + colAtt->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTRE); + m_stringTable->SetColAttr(colAtt, 2); +} + +void BaseGridPicker::PrepareTypeCol() +{ + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + wxGridCellAttr * colAtt = m_stringTable->GetAttr(m_grid->GetGridCursorRow(), 1, wxGridCellAttr::Col); + if (colAtt == NULL) colAtt = new wxGridCellAttr(); + wxGridCellChoiceEditor* ed = new wxGridCellChoiceEditor(m_colTypeChoices); + colAtt->SetEditor(ed); + m_stringTable->SetColAttr(colAtt, 1); +} + +void BaseGridPicker::PrepareGrid() +{ + wxASSERT_MSG(m_grid != NULL, _("m_grid IS NULL")); + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + m_grid->AppendCols(4); + m_grid->AppendRows(m_nbInsertRows); + PreparePreferredCol(); + PrepareTypeCol(); + m_grid->SetColSize(0, 170); + m_grid->SetColSize(1, 100); + m_grid->SetColSize(3, 200); + m_stringTable->SetColLabelValue(0, m_intentLabel); + m_stringTable->SetColLabelValue(1, _T("Type")); + m_stringTable->SetColLabelValue(2, _T("Preferred")); + m_stringTable->SetColLabelValue(3, _T("Notes")); + m_grid->Bind(wxEVT_GRID_EDITOR_CREATED, &BaseGridPicker::OnEditorCreated, this); + m_grid->Bind(wxEVT_GRID_EDITOR_HIDDEN, &BaseGridPicker::OnEditorHidden, this); +} + +void BaseGridPicker::OnEditorCreated(wxGridEditorCreatedEvent& evt) +{ + if (evt.GetCol() == 2) + { + m_PrefEditor = static_cast (evt.GetControl()); + } + evt.Skip(); +} + +void BaseGridPicker::OnEditorHidden(wxGridEvent& evt) +{ + if (evt.GetCol() == 2 && m_PrefEditor && m_PrefEditor->IsChecked()) + { + for (uint row = 0; row < m_stringTable->GetRowsCount(); row++) + { + if (row != evt.GetRow()) + { + m_stringTable->SetValue(row, evt.GetCol(), _T("0")); + } + } + m_grid->ForceRefresh(); + } + evt.Skip(); +} + +void BaseGridPicker::ShowPopup(wxCommandEvent& evt) +{ + BasePicker::DoShowPopup(); + evt.Skip(); +} diff --git a/L7/special/BaseGridPicker.h b/L7/special/BaseGridPicker.h new file mode 100644 index 0000000..5b6e689 --- /dev/null +++ b/L7/special/BaseGridPicker.h @@ -0,0 +1,181 @@ +/* + * File: BaseGridPicker.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 7, 2019, 9:40 PM + */ + +#ifndef BASEGRIDPICKER_H +#define BASEGRIDPICKER_H + +#include "BasePicker.h" +#include + +#define INVALID_INTENT _("[Invalid]") + +/** + * Abstract class adding a wxGrid to BasePicker. + *
The grid is contained in the popup. It has 4 columns : + *

Column 0 : The intent : phone, email..., in single line + *
Column 1 : Type : Home, Work... + *
Column 2 : Preferred : one entry should be preferred + *
Column 3 : Short notes in single line + *

+ * The label of the Intent column can be changed by an application. The other + * columns have fixed labels. + *
+ * The Type column is edited with a combobox. Its values are set by + * SetColTypeChoices(). + *
+ * The Preferred column allows selecting one single entry as preferred. If none + * is selected, the dataset persists but considered invalid. + *
+ * Selection mode is wxGridSelectRows. Row labels are hidden. + *
+ * Three empty rows are available for quick multiple inputs. + * @return + */ +class BaseGridPicker : public BasePicker +{ + DECLARE_CLASS(BaseGridPicker) +public: + BaseGridPicker(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPB_USE_TEXTCTRL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual ~BaseGridPicker(); + /** + * Unused, empty implementation. + */ + virtual void UpdatePickerFromTextCtrl(); + /** + * Unused, empty implementation. + */ + virtual void UpdateTextCtrlFromPicker(); + + virtual void SetValue(const wxString& value) = 0; + + virtual wxString GetValue() = 0; + + /** + * Sets the values of the Type column in a combobox. + * @param choices + */ + void SetColTypeChoices(const wxArrayString& choices) + { + m_colTypeChoices = choices; + } + + /** + * Gets the values of the Type column. + * @return + */ + wxArrayString GetColTypeChoices() const + { + return m_colTypeChoices; + } + /** + * Sets the label of the Intent column. + * @param intent + */ + void SetIntentLabel(const wxString& intent); + + /** + * Gets the label of the Intent column. + * @return + */ + wxString GetIntentLabel() const + { + return m_intentLabel; + } + /** + * Gets the Intent value, the one that is marked as preferred. + * It may return an empty string if no item is preferred. + * @return + */ + wxString GetIntent() const; + + /** + * Can we modify data ? + * @return + */ + bool IsEditable() const + { + return m_editable; + } + /** + * Grid data may be editable or not. In the latter case, no empty rows are + * shown. + * @param editable + */ + void EnableEditing(bool editable); + +protected: + /** + * Saves the grid's content internally and updates the wxTextCtrl's value. + * @param evt + */ + virtual void OnPopupHidden(wxShowEvent& evt); + virtual void FillGrid() = 0; + virtual void DumpGrid() = 0; + /** + * Creates, configures and fills the grid by calling FillGrid(). A previous + * grid is deleted. + */ + void CreateGrid(); + wxGrid * m_grid; + wxGridStringTable * m_stringTable; + bool m_editable; +private: + wxArrayString m_colTypeChoices; + wxString m_intentLabel; + uint m_nbInsertRows; + wxCheckBox * m_PrefEditor; + /** + * Configures the Preferred column for editing and rendering using a + * checkbox. + */ + void PreparePreferredCol(); + /** + * Configures the Type column for editing using a combobox. + */ + void PrepareTypeCol(); + /** + * Adds rows and columns, configures the columns, further setting sizes + * and labels. + *
+ * Binds the grid to editor creation and hidden events. + */ + void PrepareGrid(); + /** + * References the wxCheckBox editor. + *
+ * Does nothing for the other columns. + * + * @param evt + */ + void OnEditorCreated(wxGridEditorCreatedEvent& evt); + /** + * Concerns the Preferred column only. When the editor is checked, ensures + * the other rows are unchecked. + * @param evt + */ + void OnEditorHidden(wxGridEvent& evt); + /** + * Just calls BasePicker::DoShowPopup(). + * @param evt + */ + virtual void ShowPopup(wxCommandEvent& evt); + +}; + +#endif /* BASEGRIDPICKER_H */ + diff --git a/L7/special/BasePicker.cpp b/L7/special/BasePicker.cpp new file mode 100644 index 0000000..5a633d4 --- /dev/null +++ b/L7/special/BasePicker.cpp @@ -0,0 +1,74 @@ +/* + * File: BasePicker.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 7, 2019, 9:24 PM + */ + +#include "BasePicker.h" + +IMPLEMENT_CLASS(BasePicker, wxPickerBase) + +BasePicker::BasePicker(wxWindow *parent, + wxWindowID id, + wxSize popupSize, + const wxString& text, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +: wxPickerBase() +{ + m_popup = NULL; + m_popupSize = popupSize; + wxPickerBase::CreateBase(parent, id, text, pos, size, style, validator, name); + wxButton * btn = new wxButton(this, wxID_ANY, _T("↓"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT); + SetPickerCtrl(btn); + wxPickerBase::PostCreation(); + GetTextCtrl()->SetEditable(false); + SetTextCtrlGrowable(true); + SetPickerCtrlGrowable(true); +} + +BasePicker::~BasePicker() +{ + delete m_popup; +} + +void BasePicker::CreatePopup() +{ + wxDELETE(m_popup); + m_popup = new wxPopupTransientWindow(this); + wxBoxSizer * sz = new wxBoxSizer(wxVERTICAL); + m_popup->SetSizer(sz); + + m_popup->Bind(wxEVT_SHOW, &BasePicker::OnPopupHidden, this); +} + +void BasePicker::DoShowPopup() +{ + if (m_popupSize.GetWidth() < 0) + m_popupSize.SetWidth(GetClientSize().GetWidth()); + if (m_popupSize.GetHeight() < 0) + m_popupSize.SetHeight(300); + m_popup->SetClientSize(m_popupSize); + m_popup->GetSizer()->Layout(); + + wxScreenDC dc; + const int screenWidth = dc.GetSize().GetWidth(); + const int screenHeight = dc.GetSize().GetHeight(); + const wxPoint oriPos = GetScreenPosition() + GetClientRect().GetBottomLeft(); + wxPoint dest(oriPos.x, oriPos.y); + if (oriPos.x > (screenWidth - m_popupSize.GetWidth())) dest.x = (screenWidth - m_popupSize.GetWidth()); + if (oriPos.x < 0) dest.x = 0; + if (oriPos.y > (screenHeight - m_popupSize.GetHeight())) dest.y = (screenHeight - m_popupSize.GetHeight()); + if (oriPos.y < 0) dest.y = 0; + if (m_popupSize.GetWidth() > screenWidth) dest.x = 0; + if (m_popupSize.GetHeight() > screenHeight) dest.y = 0; + m_popup->SetPosition(dest); + + m_popup->Popup(); +} diff --git a/L7/special/BasePicker.h b/L7/special/BasePicker.h new file mode 100644 index 0000000..682de84 --- /dev/null +++ b/L7/special/BasePicker.h @@ -0,0 +1,63 @@ +/* + * File: BasePicker.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 7, 2019, 9:24 PM + */ + +#ifndef BASEPICKER_H +#define BASEPICKER_H + +#include +#include +#include + +/** + * Abstract class adding a popup to wxPickerBase styled with + * a non-editable wxTextCtrl. It manages the popup's position and size also. + * The picker control is a wxButton that shows the popup. + */ +class BasePicker : public wxPickerBase +{ + DECLARE_CLASS(BasePicker) +public: + BasePicker(wxWindow *parent, + wxWindowID id, + wxSize popupSize = wxDefaultSize, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPB_USE_TEXTCTRL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual ~BasePicker(); + + virtual void UpdatePickerFromTextCtrl() = 0; + virtual void UpdateTextCtrlFromPicker() = 0; + +private: + +protected: + wxPopupTransientWindow * m_popup; + wxSize m_popupSize; + /** + * A new popup is always created. Any previous popup is deleted. + * It binds to OnPopupHidden(). + */ + virtual void CreatePopup(); + /** + * Shows the popup managing its position and size. + *

+ * If m_popupSize.GetWidth() < 0, the popup's width is set to the control's + * width. + *
+ * If m_popupSize.GetHeight() < 0, it defaults to 300. + */ + virtual void DoShowPopup(); + virtual void OnPopupHidden(wxShowEvent& evt) = 0; +}; + +#endif /* BASEPICKER_H */ + diff --git a/L7/special/JsonGridPickerCtrl.cpp b/L7/special/JsonGridPickerCtrl.cpp new file mode 100644 index 0000000..1185175 --- /dev/null +++ b/L7/special/JsonGridPickerCtrl.cpp @@ -0,0 +1,171 @@ +/* + * File: JsonGridPickerCtrl.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 7, 2019, 10:01 PM + */ + +/* + * [ + { + "Intent" : "a@b.com", + "Type" : "Home", + "Preferred" : 0, + "Notes" : "Do not use" + }, + { + "Intent" : "c@d.com", + "Type" : "Work", + "Preferred" : 1, + "Notes" : "Neither" + } + ] + + */ +#include "JsonGridPickerCtrl.h" +#include +#include + +IMPLEMENT_CLASS(JsonGridPickerCtrl, BaseGridPicker) + +#define EMPTY_ARR _T("[]") + +JsonGridPickerCtrl::JsonGridPickerCtrl(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize, + const wxString& text, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +: BaseGridPicker(parent, id, types, popupSize, text, pos, size, style, validator, name) +{ + /* + * Don't create the grid here. Let SetValue() do it, deleting the previous + * one every time new data is fed in. + */ + SetValue(wxEmptyString); +} + +JsonGridPickerCtrl::~JsonGridPickerCtrl() +{ +} + +void JsonGridPickerCtrl::SetValue(const wxString& value) +{ + if (value.IsEmpty()) + { + m_value = EMPTY_ARR; + BaseGridPicker::CreateGrid(); // +++ + GetTextCtrl()->SetValue(INVALID_INTENT); + return; + } + m_value = value; + BaseGridPicker::CreateGrid(); // +++ + GetTextCtrl()->SetValue(INVALID_INTENT); + + wxJSONReader reader(wxJSONREADER_STRICT); + wxJSONValue root; + uint nbErr = reader.Parse(m_value, &root); + if (nbErr > 0) + { + const wxArrayString& errors = reader.GetErrors(); + for (int i = 0; i < nbErr; i++) + { + wxASSERT_MSG(nbErr == 0, errors[i]); + } + return; + } + if (!root.IsArray()) + { + wxASSERT_MSG(root.IsArray(), _("JSON data is not an array")); + return; + } + for (uint row = 0; row < root.Size(); row++) + { + if (root[row]["Preferred"].IsValid() + && !root[row]["Preferred"].AsString().IsEmpty() + && root[row]["Preferred"].AsInt() != 0) + { + GetTextCtrl()->SetValue(root[row]["Intent"].AsString()); + return; + } + } + GetTextCtrl()->SetValue(INVALID_INTENT); +} + +wxString JsonGridPickerCtrl::GetValue() +{ + DumpGrid(); + /* + * wxJSONWriter adds quotes and line breaks to EMPTY_ARR ! + * m_value is set in DumpGrid(). If there is no grid data, m_value is set + * to \"[]\"\n + */ + wxJSONValue empty(EMPTY_ARR); + wxJSONWriter writer; + wxString sempty; + writer.Write(empty, sempty); + if (m_value == sempty) + return wxEmptyString; + return m_value; +} + +void JsonGridPickerCtrl::FillGrid() +{ + wxASSERT_MSG(m_grid != NULL, _("m_grid IS NULL")); + wxJSONReader reader(wxJSONREADER_STRICT); + wxJSONValue root; + uint nbErr = reader.Parse(m_value, &root); + if (nbErr > 0) + { + const wxArrayString& errors = reader.GetErrors(); + for (int i = 0; i < nbErr; i++) + { + wxASSERT_MSG(nbErr == 0, errors[i]); + } + return; + } + if (!root.IsArray()) + { + wxASSERT_MSG(root.IsArray(), _("JSON data is not an array")); + return; + } + + for (uint row = 0; row < root.Size(); row++) + { + m_grid->InsertRows(row); + m_grid->SetCellValue(row, 0, root[row]["Intent"].AsString()); + m_grid->SetCellValue(row, 1, root[row]["Type"].AsString()); + m_grid->SetCellValue(row, 2, root[row]["Preferred"].AsString()); + m_grid->SetCellValue(row, 3, root[row]["Notes"].AsString()); + } +} + +void JsonGridPickerCtrl::DumpGrid() +{ + wxASSERT_MSG(m_grid != NULL, _("m_grid IS NULL")); + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + if (!m_editable || !m_stringTable || !m_grid) + return; + wxJSONWriter writer; + wxJSONValue root(EMPTY_ARR); + uint row = 0; + uint jrow = 0; + for (row; row < m_stringTable->GetRowsCount(); row++) + { + if (m_stringTable->GetValue(row, 0).IsEmpty()) + continue; + root[jrow]["Intent"] = m_stringTable->GetValue(row, 0); + root[jrow]["Type"] = m_stringTable->GetValue(row, 1); + root[jrow]["Preferred"] = (m_stringTable->GetValue(row, 2) == _T("0") + || m_stringTable->GetValue(row, 2).IsEmpty()) ? 0 : 1; + root[jrow]["Notes"] = m_stringTable->GetValue(row, 3); + jrow++; + } + writer.Write(root, m_value); // May be EMPTY_ARR +} diff --git a/L7/special/JsonGridPickerCtrl.h b/L7/special/JsonGridPickerCtrl.h new file mode 100644 index 0000000..1a80337 --- /dev/null +++ b/L7/special/JsonGridPickerCtrl.h @@ -0,0 +1,70 @@ +/* + * File: JsonGridPickerCtrl.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 7, 2019, 10:01 PM + */ + +#ifndef JSONGRIDPICKERCTRL_H +#define JSONGRIDPICKERCTRL_H + +#include "BaseGridPicker.h" + +/** + * The grid content is stored in a JSON array. + * @return + */ +class JsonGridPickerCtrl : public BaseGridPicker +{ + DECLARE_CLASS(JsonGridPickerCtrl) +public: + JsonGridPickerCtrl(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPB_USE_TEXTCTRL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual ~JsonGridPickerCtrl(); + + /** + * Creates a new grid deleting the previous one and fills it with the JSON + * data. + * @param value + */ + virtual void SetValue(const wxString& value); + + /** + * Dumps the grid content and returns it as a JSON array. But returns empty + * string if JSON array is empty. + * @return + */ + virtual wxString GetValue(); + +protected: + /** + * Parses the JSON data and fills the grid. It should be pure JSON, without + * any extension like comments. + */ + virtual void FillGrid(); + /** + * Translates the grid content to a JSON array. + * If the Intent column is empty, this row is ignored. + */ + virtual void DumpGrid(); + /** + * Is the JSON array. + */ + wxString m_value; + +private: + +}; + +#endif /* JSONGRIDPICKERCTRL_H */ + diff --git a/L7/special/JsonHelper.cpp b/L7/special/JsonHelper.cpp new file mode 100644 index 0000000..08a76b5 --- /dev/null +++ b/L7/special/JsonHelper.cpp @@ -0,0 +1,53 @@ +/* + * File: JsonHelper.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 16, 2019, 8:25 PM + */ + +#include "JsonHelper.h" +#include + +JsonHelper::JsonHelper() +{ +} + +JsonHelper::~JsonHelper() +{ +} + +wxString JsonHelper::GetIntent(const wxString& jsonData) +{ + if (jsonData.IsEmpty()) + return wxEmptyString; + + wxJSONReader reader(wxJSONREADER_STRICT); + wxJSONValue root; + uint nbErr = reader.Parse(jsonData, &root); + if (nbErr > 0) + { + const wxArrayString& errors = reader.GetErrors(); + for (int i = 0; i < nbErr; i++) + { + wxASSERT_MSG(nbErr == 0, errors[i]); + } + return wxEmptyString; + } + if (!root.IsArray()) + { + wxASSERT_MSG(root.IsArray(), _("JSON data is not an array")); + return wxEmptyString; + } + for (uint row = 0; row < root.Size(); row++) + { + if (root[row]["Preferred"].IsValid() + && !root[row]["Preferred"].AsString().IsEmpty() + && root[row]["Preferred"].AsInt() != 0) + { + return root[row]["Intent"].AsString(); + } + } + return wxEmptyString; +} diff --git a/L7/special/JsonHelper.h b/L7/special/JsonHelper.h new file mode 100644 index 0000000..5846ee3 --- /dev/null +++ b/L7/special/JsonHelper.h @@ -0,0 +1,36 @@ +/* + * File: JsonHelper.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 16, 2019, 8:25 PM + */ + +#ifndef JSONHELPER_H +#define JSONHELPER_H + +#include + +/** + * Application helper to quickly get the Intent value. + * @param jsonData + * @return + */ +class JsonHelper +{ +public: + + /** + * Returns a valid Intent value or an empty string. + * @param jsonData + * @return + */ + static wxString GetIntent(const wxString& jsonData); +private: + JsonHelper(); + virtual ~JsonHelper(); +}; + +#endif /* JSONHELPER_H */ + diff --git a/L7/special/LBoundJsonGridPicker.cpp b/L7/special/LBoundJsonGridPicker.cpp new file mode 100644 index 0000000..7967fc0 --- /dev/null +++ b/L7/special/LBoundJsonGridPicker.cpp @@ -0,0 +1,113 @@ +/* + * File: LBoundJsonGridPicker.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 8, 2019, 9:23 AM + */ + +#include "LBoundJsonGridPicker.h" +#include + +IMPLEMENT_CLASS(LBoundJsonGridPicker, JsonGridPickerCtrl) + +LBoundJsonGridPicker::LBoundJsonGridPicker(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize, + const wxString& text, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +: JsonGridPickerCtrl(parent, id, types, popupSize, text, pos, size, style, validator, name) +{ + m_sqlQuote = _T("'"); +} + +LBoundJsonGridPicker::~LBoundJsonGridPicker() +{ + if (m_rs) m_rs->UnRegisterControl(this); +} + +void LBoundJsonGridPicker::SetResultSet(LResultSet* newResultSet) +{ + m_rs = newResultSet; + if (m_rs == NULL) return; + m_rs->RegisterControl(this); +} + +const wxAny LBoundJsonGridPicker::GetData() +{ + // If m_value == EMPTY_ARR, GetValue() returns empty string + if (GetValue().IsEmpty()) return L_SQLNULL; + return GetValue(); +} + +void LBoundJsonGridPicker::SetData(const wxAny& newData) +{ + SetValue(newData.As()); +} + +void LBoundJsonGridPicker::SetNull() +{ + // m_value is set to EMPTY_ARR + SetValue(wxEmptyString); +} + +bool LBoundJsonGridPicker::IsDirty() +{ + wxASSERT_MSG(m_rs != NULL, _("RS = NULL")); + wxAny BEData = m_rs->GetData(m_columnName); + const wxString ctrlValue = GetValue(); + /* + * Make JSON objects from backend and control values, and compare them. + * Postgresql : jsonb columns contain single line values. Can't compare strings. + */ + const wxString beValue = BEData.As(); + if (ctrlValue.IsEmpty() || beValue.IsEmpty()) + return (ctrlValue != beValue); + + wxJSONReader beReader(wxJSONREADER_STRICT); + wxJSONValue beRoot; + uint nbErr = beReader.Parse(beValue, &beRoot); + if (nbErr > 0) + { + const wxArrayString& errors = beReader.GetErrors(); + for (int i = 0; i < nbErr; i++) + { + wxASSERT_MSG(nbErr == 0, errors[i]); + } + // Backend value is not what we expect. Declare dirty to overwrite it. + return true; + } + if (!beRoot.IsArray()) + { + wxASSERT_MSG(beRoot.IsArray(), _("Back end JSON data is not an array")); + return true; + } + + wxJSONReader ctrlReader(wxJSONREADER_STRICT); + wxJSONValue ctrlRoot; + nbErr = beReader.Parse(ctrlValue, &ctrlRoot); + // Should not happen as we wrote the data. + if (nbErr > 0) + { + const wxArrayString& errors = ctrlReader.GetErrors(); + for (int i = 0; i < nbErr; i++) + { + wxASSERT_MSG(nbErr == 0, errors[i]); + } + // Control value is not what we expect. Don't overwrite in backend. + return false; + } + if (!ctrlRoot.IsArray()) + { + wxASSERT_MSG(ctrlRoot.IsArray(), _("Control JSON data is not an array")); + return false; + } + + return (!ctrlRoot.IsSameAs(beRoot)); +} diff --git a/L7/special/LBoundJsonGridPicker.h b/L7/special/LBoundJsonGridPicker.h new file mode 100644 index 0000000..23836c8 --- /dev/null +++ b/L7/special/LBoundJsonGridPicker.h @@ -0,0 +1,81 @@ +/* + * File: LBoundJsonGridPicker.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 8, 2019, 9:23 AM + */ + +#ifndef LBOUNDJSONGRIDPICKER_H +#define LBOUNDJSONGRIDPICKER_H + +#include "JsonGridPickerCtrl.h" +#include "../LBoundControl.h" +#include "../LResultSet.h" + +/** + * Saves a JSON array in database. + * Data type of database column should be TEXT for sqlite, and can be TEXT or + * JSONB for postgresql. + * @return + */ +class LBoundJsonGridPicker : public JsonGridPickerCtrl, public LBoundControl +{ + DECLARE_CLASS(LBoundJsonGridPicker) +public: + LBoundJsonGridPicker(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPB_USE_TEXTCTRL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual ~LBoundJsonGridPicker(); + + /** + * Sets the resultset member and registers the control in the resultset. + * @param newResultSet + */ + void SetResultSet(LResultSet * newResultSet); + /** + * + * @return If the control is empty, returns literal NULL. + * Else, returns GetValue(). + */ + const wxAny GetData(); + void SetData(const wxAny& newData); + + bool IsNull() + { + return (GetData().As() == L_SQLNULL); + } + void SetNull(); + /** + * Is control data same as backend data? + *

+ * If backend data cannot be parsed, will always return true, because + * GetValue() returns empty control data. + * @return + */ + bool IsDirty(); + + /** + * Alias for GetValue(). + * Not really the displayed informative value in the picker's wxTextCtrl. + * @return + */ + const wxString GetDisplayedData() + { + return GetValue(); + } + +private: + +}; + +#endif /* LBOUNDJSONGRIDPICKER_H */ + diff --git a/L7/special/LBoundXmlGridPicker.cpp b/L7/special/LBoundXmlGridPicker.cpp new file mode 100644 index 0000000..8464ebf --- /dev/null +++ b/L7/special/LBoundXmlGridPicker.cpp @@ -0,0 +1,72 @@ +/* + * File: LBoundXmlGridPicker.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 14, 2019, 10:12 PM + */ + +#include "LBoundXmlGridPicker.h" + +IMPLEMENT_CLASS(LBoundXmlGridPicker, XmlGridPickerCtrl) + +LBoundXmlGridPicker::LBoundXmlGridPicker(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize, + const wxString& text, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +: XmlGridPickerCtrl(parent, id, types, popupSize, text, pos, size, style, validator, name) +{ + m_sqlQuote = _T("'"); +} + +LBoundXmlGridPicker::~LBoundXmlGridPicker() +{ + if (m_rs) m_rs->UnRegisterControl(this); +} + +void LBoundXmlGridPicker::SetResultSet(LResultSet* newResultSet) +{ + m_rs = newResultSet; + if (m_rs == NULL) return; + m_rs->RegisterControl(this); +} + +const wxAny LBoundXmlGridPicker::GetData() +{ + // If m_value is EMPTY_DOC, GetValue() returns empty string + if (GetValue().IsEmpty()) return L_SQLNULL; + return GetValue(); +} + +void LBoundXmlGridPicker::SetData(const wxAny& newData) +{ + SetValue(newData.As()); +} + +void LBoundXmlGridPicker::SetNull() +{ + // m_value is set to EMPTY_DOC + SetValue(wxEmptyString); +} + +bool LBoundXmlGridPicker::IsDirty() +{ + /* + * String compare backend and control values. + * Database column data type is TEXT, hence data is saved verbatim. + * On the other hand, comparing XML documents is not trivial. + * wxWidgets does not have this functionality, not does it write + * canonical XML, AFAIK. + * Linking to other libraries for this would be an overkill. + */ + wxASSERT_MSG(m_rs != NULL, _("RS = NULL")); + wxAny BEData = m_rs->GetData(m_columnName); + return (GetValue() != BEData.As()); +} diff --git a/L7/special/LBoundXmlGridPicker.h b/L7/special/LBoundXmlGridPicker.h new file mode 100644 index 0000000..2eb1c72 --- /dev/null +++ b/L7/special/LBoundXmlGridPicker.h @@ -0,0 +1,80 @@ +/* + * File: LBoundXmlGridPicker.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 14, 2019, 10:12 PM + */ + +#ifndef LBOUNDXMLGRIDPICKER_H +#define LBOUNDXMLGRIDPICKER_H + +#include "XmlGridPickerCtrl.h" +#include "../LBoundControl.h" +#include "../LResultSet.h" + +/** + * Saves an XML document in database. + * Data type of database column should be TEXT for both sqlite and postgresql. + * @return + */ +class LBoundXmlGridPicker : public XmlGridPickerCtrl, public LBoundControl +{ + DECLARE_CLASS(LBoundXmlGridPicker) +public: + LBoundXmlGridPicker(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPB_USE_TEXTCTRL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual ~LBoundXmlGridPicker(); + + /** + * Sets the resultset member and registers the control in the resultset. + * @param newResultSet + */ + void SetResultSet(LResultSet * newResultSet); + /** + * + * @return If the control is empty, returns literal NULL. + * Else, returns GetValue(). + */ + const wxAny GetData(); + void SetData(const wxAny& newData); + + bool IsNull() + { + return (GetData().As() == L_SQLNULL); + } + void SetNull(); + /** + * Is control data same as backend data? + *

+ * If backend data is cannot be parsed, will always return true, because + * GetValue() returns empty control data. + * @return + */ + bool IsDirty(); + + /** + * Alias for GetValue(). + * Not really the displayed informative value in the picker'swxTextCtrl. + * @return + */ + const wxString GetDisplayedData() + { + return GetValue(); + } + +private: + +}; + +#endif /* LBOUNDXMLGRIDPICKER_H */ + diff --git a/L7/special/LGridJsonCellEditor.cpp b/L7/special/LGridJsonCellEditor.cpp new file mode 100644 index 0000000..94e4afd --- /dev/null +++ b/L7/special/LGridJsonCellEditor.cpp @@ -0,0 +1,144 @@ +/* + * File: LGridJsonCellEditor.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * Author: user + * + * Created on December 9, 2019, 10:36 AM + */ + +#include "LGridJsonCellEditor.h" +#include "../LBoundGrid.h" + +LGridJsonCellEditor::LGridJsonCellEditor(const wxString& newColName, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize) +: wxGridCellEditor(), LGridColEditor() +{ + m_intentLabel = intentLabel; + m_choices = types; + m_popupSize = popupSize; + m_colName = newColName; + m_type = LGridColEditor::JSON_GRID; + m_formEditor = NULL; + m_BoundControl = NULL; + m_BoundJsonGridPicker = NULL; + m_editRow = wxNOT_FOUND; + m_rsEVH = NULL; +} + +LGridJsonCellEditor::~LGridJsonCellEditor() +{ + delete m_rsEVH; + wxDELETE(m_control); +} + +void LGridJsonCellEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) +{ + m_control = new LBoundJsonGridPicker(parent, id, m_choices, m_popupSize); + m_BoundJsonGridPicker = (static_cast (m_control)); + m_BoundJsonGridPicker->SetColumnName(m_colName); + if (!m_intentLabel.IsEmpty()) + m_BoundJsonGridPicker->SetIntentLabel(m_intentLabel); + m_BoundControl = m_BoundJsonGridPicker; + m_rsEVH = new JsonGridEditorRsEVH(this); + m_control->Show(false); +} + +void LGridJsonCellEditor::BeginEdit(int row, int col, wxGrid *grid) +{ + if (m_editRow != row) + m_jsonBuffer.MakeNull(); + m_editRow = row; + if (m_control == NULL) + { + Create(grid->GetGridWindow(), wxID_ANY, NULL); + } + + LResultSet * rs = ((LBoundGrid *) grid)->GetResultSet(); + m_rsEVH->SetResultSet(rs); + rs->RegisterEventHandler(m_rsEVH); + + m_BoundJsonGridPicker->SetResultSet(rs); + if (m_jsonBuffer.IsNull() && row < rs->GetRowCount()) + m_jsonBuffer = rs->GetData(row, col); + m_BoundJsonGridPicker->SetData(m_jsonBuffer); + m_control->Show(true); +} + +wxGridCellEditor* LGridJsonCellEditor::Clone() const +{ + return new LGridJsonCellEditor(m_colName, m_intentLabel, m_choices, m_popupSize); +} + +bool LGridJsonCellEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) +{ + // What do we do here ? + return true; +} + +void LGridJsonCellEditor::ApplyEdit(int row, int col, wxGrid *grid) +{ + m_jsonBuffer = m_BoundJsonGridPicker->GetValue(); + grid->GetTable()->SetValue(row, col, m_jsonBuffer.As()); +} + +void LGridJsonCellEditor::Reset() +{ + delete m_rsEVH; + m_rsEVH = NULL; + wxDELETE(m_control); + m_BoundControl = NULL; + m_BoundJsonGridPicker = NULL; + m_jsonBuffer.MakeNull(); + m_editRow = wxNOT_FOUND; +} + +wxString LGridJsonCellEditor::GetValue() const +{ + return m_control == NULL ? wxString(wxEmptyString) : m_BoundControl->GetData().As(); +} + +wxControl* LGridJsonCellEditor::ProvideFormEditor(wxWindow * parent) +{ + if (!m_formEditor) m_formEditor = new JsonGridPickerCtrl(parent, wxID_ANY, m_choices); + m_formEditor->SetValue(GetValue()); + m_formEditor->SetName(m_BoundJsonGridPicker->GetName()); + m_formEditor->SetIntentLabel(m_BoundJsonGridPicker->GetIntentLabel()); + if (m_BoundJsonGridPicker->GetValidator()) m_formEditor->SetValidator(*(m_BoundJsonGridPicker->GetValidator())); + return m_formEditor; +} + +void LGridJsonCellEditor::SyncBack(const int row, const int col, wxGrid * grid) +{ + if (!m_formEditor) return; + m_BoundJsonGridPicker->SetValue(m_formEditor->GetValue()); + ApplyEdit(row, col, grid); + wxDELETE(m_formEditor); +} + +/////////////////////////////////////////////////////////////////////////////// + +JsonGridEditorRsEVH::JsonGridEditorRsEVH(LGridJsonCellEditor * owner) +: LResultSetEvent() +{ + m_owner = owner; + m_rs = NULL; +} + +JsonGridEditorRsEVH::~JsonGridEditorRsEVH() +{ + if (m_rs) + m_rs->UnRegisterEventHandler(this); +} + +void JsonGridEditorRsEVH::AfterAction(LResultSet * caller, ACTIONS action) +{ + m_rs = caller; + if (action == ACTIONS::ACTION_CANCEL) + { + m_owner->m_jsonBuffer.MakeNull(); + } +} diff --git a/L7/special/LGridJsonCellEditor.h b/L7/special/LGridJsonCellEditor.h new file mode 100644 index 0000000..4090d65 --- /dev/null +++ b/L7/special/LGridJsonCellEditor.h @@ -0,0 +1,124 @@ +/* + * File: LGridJsonCellEditor.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 9, 2019, 10:36 AM + */ + +#ifndef LGRIDJSONCELLEDITOR_H +#define LGRIDJSONCELLEDITOR_H + +#include "../LGridColEditor.h" +#include "LBoundJsonGridPicker.h" + +class JsonGridEditorRsEVH; +class LGridJsonCellEditor; + +/** + * A grid cell editor using LBoundJsonGridPicker + * @param newColName + * @param intentLabel + * @param types + * @param popupSize + */ +class LGridJsonCellEditor : public wxGridCellEditor, public LGridColEditor +{ + friend class JsonGridEditorRsEVH; +public: + LGridJsonCellEditor(const wxString& newColName, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize); + virtual ~LGridJsonCellEditor(); + + /** + * Creates m_control as LBoundJsonGridPicker. + * @param parent + * @param id + * @param evtHandler + */ + void Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler); + /** + * Creates m_control if necessary. Registers the editor in the grid's resultset. + * @param row + * @param col + * @param grid + */ + void BeginEdit(int row, int col, wxGrid *grid); + wxGridCellEditor* Clone() const; + bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); + /** + * Applies the editor value as returned by GetValue() to the grid cell. + * @param row + * @param col + * @param grid + */ + void ApplyEdit(int row, int col, wxGrid *grid); + /** + * Deletes the editor, all pointers to the editor are set to NULL. + */ + void Reset(); + /** + * + * @return GetData(), or wxEmptyString if the editor control has not been created. + */ + wxString GetValue() const; + /** + * Creates a wxTextCtrl to be used as editor in form view. + */ + wxControl* ProvideFormEditor(wxWindow * parent); + + wxControl* GetFormEditor() const + { + return m_formEditor; + } + /** + * Updates the grid cell and the editor. m_formEditor is deleted and set to NULL. + * @param row + * @param col + * @param grid + */ + void SyncBack(const int row, const int col, wxGrid * grid); + +private: + wxString m_intentLabel; + wxArrayString m_choices; + wxSize m_popupSize; + JsonGridPickerCtrl * m_formEditor; + wxAny m_jsonBuffer; + int m_editRow; + /** + * Fully typed alias to m_control. + */ + LBoundJsonGridPicker * m_BoundJsonGridPicker; + wxWeakRef m_rsEVH; +}; + +/** + * Clears LGridJsonGridEditor::m_jsonBuffer on LBoundGrid::Cancel. + * Must be trackable. If it is deleted by an application, avoid crash in + * destructor of LGridJsonGridEditor. + */ +class JsonGridEditorRsEVH : public LResultSetEvent, public wxTrackable +{ + friend class LGridJsonCellEditor; +public: + +private: + JsonGridEditorRsEVH(LGridJsonCellEditor * owner); + virtual ~JsonGridEditorRsEVH(); + virtual void AfterAction(LResultSet * caller, ACTIONS action); + + void SetResultSet(LResultSet * caller) + { + m_rs = caller; + } + + LResultSet * m_rs; + LGridJsonCellEditor * m_owner; +}; + +#endif /* LGRIDJSONCELLEDITOR_H */ + diff --git a/L7/special/LGridJsonCellRenderer.cpp b/L7/special/LGridJsonCellRenderer.cpp new file mode 100644 index 0000000..220c847 --- /dev/null +++ b/L7/special/LGridJsonCellRenderer.cpp @@ -0,0 +1,73 @@ +/* + * File: LGridJsonCellRenderer.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 9, 2019, 1:55 PM + */ + +#include "LGridJsonCellRenderer.h" +#include "BaseGridPicker.h" +#include + +LGridJsonCellRenderer::LGridJsonCellRenderer() +{ +} + +LGridJsonCellRenderer::~LGridJsonCellRenderer() +{ +} + +void LGridJsonCellRenderer::Draw(wxGrid & grid, + wxGridCellAttr & attr, + wxDC & dc, + const wxRect & rect, + int row, + int col, + bool isSelected) +{ + const wxString intent = ProcessJsonValue(grid.GetCellValue(row, col)); + grid.SetCellValue(row, col, intent); + + wxGridCellStringRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); +} + +const wxString LGridJsonCellRenderer::ProcessJsonValue(const wxString& cellValue) +{ + if (cellValue.IsEmpty()) + return INVALID_INTENT; + + wxJSONReader reader(wxJSONREADER_STRICT); + wxJSONValue root; + uint nbErr = reader.Parse(cellValue, &root); + if (nbErr > 0) + { + const wxArrayString& errors = reader.GetErrors(); + for (int i = 0; i < nbErr; i++) + { + wxASSERT_MSG(nbErr == 0, errors[i]); + } + // Show raw data. + return cellValue; + } + if (!root.IsArray()) + { + wxASSERT_MSG(root.IsArray(), _("JSON data is not an array")); + return cellValue; + } + for (uint row = 0; row < root.Size(); row++) + { + if (root[row]["Preferred"].IsValid() + && !root[row]["Preferred"].AsString().IsEmpty() + && root[row]["Preferred"].AsInt() != 0) + { + return root[row]["Intent"].AsString(); + } + } + /* + * Don't show raw data if there's no preferred item. + * The data will still be in the editor and saved. + */ + return INVALID_INTENT; +} diff --git a/L7/special/LGridJsonCellRenderer.h b/L7/special/LGridJsonCellRenderer.h new file mode 100644 index 0000000..7b52737 --- /dev/null +++ b/L7/special/LGridJsonCellRenderer.h @@ -0,0 +1,38 @@ +/* + * File: LGridJsonCellRenderer.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 9, 2019, 1:55 PM + */ + +#ifndef LGRIDJSONCELLRENDERER_H +#define LGRIDJSONCELLRENDERER_H + +#include "wx/grid.h" + +/** + * A grid cell renderer for json stored data. + * It show the selected Intent value, or INVALID_INTENT. + */ +class LGridJsonCellRenderer : public wxGridCellStringRenderer +{ +public: + LGridJsonCellRenderer(); + virtual ~LGridJsonCellRenderer(); + + void Draw(wxGrid & grid, + wxGridCellAttr & attr, + wxDC & dc, + const wxRect & rect, + int row, + int col, + bool isSelected); +private: + + const wxString ProcessJsonValue(const wxString& cellValue); +}; + +#endif /* LGRIDJSONCELLRENDERER_H */ + diff --git a/L7/special/LGridXmlCellEditor.cpp b/L7/special/LGridXmlCellEditor.cpp new file mode 100644 index 0000000..937741c --- /dev/null +++ b/L7/special/LGridXmlCellEditor.cpp @@ -0,0 +1,143 @@ +/* + * File: LGridXmlCellEditor.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 15, 2019, 6:32 PM + */ + +#include "LGridXmlCellEditor.h" +#include "../LBoundGrid.h" + +LGridXmlCellEditor::LGridXmlCellEditor(const wxString& newColName, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize) +: wxGridCellEditor(), LGridColEditor() +{ + m_intentLabel = intentLabel; + m_choices = types; + m_popupSize = popupSize; + m_colName = newColName; + m_type = LGridColEditor::XML_GRID; + m_formEditor = NULL; + m_BoundControl = NULL; + m_BoundXmlGridPicker = NULL; + m_editRow = wxNOT_FOUND; + m_rsEVH = NULL; +} + +LGridXmlCellEditor::~LGridXmlCellEditor() +{ + delete m_rsEVH; + wxDELETE(m_control); +} + +void LGridXmlCellEditor::Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler) +{ + m_control = new LBoundXmlGridPicker(parent, id, m_choices, m_popupSize); + m_BoundXmlGridPicker = (static_cast (m_control)); + m_BoundXmlGridPicker->SetColumnName(m_colName); + if (!m_intentLabel.IsEmpty()) + m_BoundXmlGridPicker->SetIntentLabel(m_intentLabel); + m_BoundControl = m_BoundXmlGridPicker; + m_rsEVH = new XmlGridEditorRsEVH(this); + m_control->Show(false); +} + +void LGridXmlCellEditor::BeginEdit(int row, int col, wxGrid *grid) +{ + if (m_editRow != row) + m_xmlBuffer.MakeNull(); + m_editRow = row; + if (m_control == NULL) + { + Create(grid->GetGridWindow(), wxID_ANY, NULL); + } + + LResultSet * rs = ((LBoundGrid *) grid)->GetResultSet(); + m_rsEVH->SetResultSet(rs); + rs->RegisterEventHandler(m_rsEVH); + + m_BoundXmlGridPicker->SetResultSet(rs); + if (m_xmlBuffer.IsNull() && row < rs->GetRowCount()) + m_xmlBuffer = rs->GetData(row, col); + m_BoundXmlGridPicker->SetData(m_xmlBuffer); + m_control->Show(true); +} + +wxGridCellEditor* LGridXmlCellEditor::Clone() const +{ + return new LGridXmlCellEditor(m_colName, m_intentLabel, m_choices, m_popupSize); +} + +bool LGridXmlCellEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval) +{ + // What do we do here ? + return true; +} + +void LGridXmlCellEditor::ApplyEdit(int row, int col, wxGrid *grid) +{ + m_xmlBuffer = m_BoundXmlGridPicker->GetValue(); + grid->GetTable()->SetValue(row, col, m_xmlBuffer.As()); +} + +void LGridXmlCellEditor::Reset() +{ + delete m_rsEVH; + m_rsEVH = NULL; + wxDELETE(m_control); + m_BoundControl = NULL; + m_BoundXmlGridPicker = NULL; + m_xmlBuffer.MakeNull(); + m_editRow = wxNOT_FOUND; +} + +wxString LGridXmlCellEditor::GetValue() const +{ + return m_control == NULL ? wxString(wxEmptyString) : m_BoundControl->GetData().As(); +} + +wxControl* LGridXmlCellEditor::ProvideFormEditor(wxWindow * parent) +{ + if (!m_formEditor) m_formEditor = new XmlGridPickerCtrl(parent, wxID_ANY, m_choices); + m_formEditor->SetValue(GetValue()); + m_formEditor->SetName(m_BoundXmlGridPicker->GetName()); + m_formEditor->SetIntentLabel(m_BoundXmlGridPicker->GetIntentLabel()); + if (m_BoundXmlGridPicker->GetValidator()) m_formEditor->SetValidator(*(m_BoundXmlGridPicker->GetValidator())); + return m_formEditor; +} + +void LGridXmlCellEditor::SyncBack(const int row, const int col, wxGrid * grid) +{ + if (!m_formEditor) return; + m_BoundXmlGridPicker->SetValue(m_formEditor->GetValue()); + ApplyEdit(row, col, grid); + wxDELETE(m_formEditor); +} + +/////////////////////////////////////////////////////////////////////////////// + +XmlGridEditorRsEVH::XmlGridEditorRsEVH(LGridXmlCellEditor * owner) +: LResultSetEvent() +{ + m_owner = owner; + m_rs = NULL; +} + +XmlGridEditorRsEVH::~XmlGridEditorRsEVH() +{ + if (m_rs) + m_rs->UnRegisterEventHandler(this); +} + +void XmlGridEditorRsEVH::AfterAction(LResultSet * caller, ACTIONS action) +{ + m_rs = caller; + if (action == ACTIONS::ACTION_CANCEL) + { + m_owner->m_xmlBuffer.MakeNull(); + } +} diff --git a/L7/special/LGridXmlCellEditor.h b/L7/special/LGridXmlCellEditor.h new file mode 100644 index 0000000..3822ef0 --- /dev/null +++ b/L7/special/LGridXmlCellEditor.h @@ -0,0 +1,123 @@ +/* + * File: LGridXmlCellEditor.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 15, 2019, 6:32 PM + */ + +#ifndef LGRIDXMLCELLEDITOR_H +#define LGRIDXMLCELLEDITOR_H + +#include "../LGridColEditor.h" +#include "LBoundXmlGridPicker.h" + +class XmlGridEditorRsEVH; +class LGridXmlCellEditor; + +/** + * A grid cell editor using LBoundXmlGridPicker + * @param newColName + * @param intentLabel + * @param types + * @param popupSize + */ +class LGridXmlCellEditor : public wxGridCellEditor, public LGridColEditor +{ + friend class XmlGridEditorRsEVH; +public: + LGridXmlCellEditor(const wxString& newColName, + const wxString& intentLabel, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize); + virtual ~LGridXmlCellEditor(); + /** + * Creates m_control as LBoundJsonGridPicker. + * @param parent + * @param id + * @param evtHandler + */ + void Create(wxWindow *parent, wxWindowID id, wxEvtHandler *evtHandler); + /** + * Creates m_control if necessary. Registers the editor in the grid's resultset. + * @param row + * @param col + * @param grid + */ + void BeginEdit(int row, int col, wxGrid *grid); + wxGridCellEditor* Clone() const; + bool EndEdit(int row, int col, const wxGrid *grid, const wxString &oldval, wxString *newval); + /** + * Applies the editor value as returned by GetValue() to the grid cell. + * @param row + * @param col + * @param grid + */ + void ApplyEdit(int row, int col, wxGrid *grid); + /** + * Deletes the editor, all pointers to the editor are set to NULL. + */ + void Reset(); + /** + * + * @return GetData(), or wxEmptyString if the editor control has not been created. + */ + wxString GetValue() const; + /** + * Creates a wxTextCtrl to be used as editor in form view. + */ + wxControl* ProvideFormEditor(wxWindow * parent); + + wxControl* GetFormEditor() const + { + return m_formEditor; + } + /** + * Updates the grid cell and the editor. m_formEditor is deleted and set to NULL. + * @param row + * @param col + * @param grid + */ + void SyncBack(const int row, const int col, wxGrid * grid); + +private: + wxString m_intentLabel; + wxArrayString m_choices; + wxSize m_popupSize; + XmlGridPickerCtrl * m_formEditor; + wxAny m_xmlBuffer; + int m_editRow; + /** + * Fully typed alias to m_control. + */ + LBoundXmlGridPicker * m_BoundXmlGridPicker; + wxWeakRef m_rsEVH; +}; + +/** + * Clears LGridXmlGridEditor::m_jsonBuffer on LBoundGrid::Cancel. + * Must be trackable. If it is deleted by an application, avoid crash in + * destructor of LGridXmlGridEditor. + */ +class XmlGridEditorRsEVH : public LResultSetEvent, public wxTrackable +{ + friend class LGridXmlCellEditor; +public: + +private: + XmlGridEditorRsEVH(LGridXmlCellEditor * owner); + virtual ~XmlGridEditorRsEVH(); + virtual void AfterAction(LResultSet * caller, ACTIONS action); + + void SetResultSet(LResultSet * caller) + { + m_rs = caller; + } + + LResultSet * m_rs; + LGridXmlCellEditor * m_owner; +}; + +#endif /* LGRIDXMLCELLEDITOR_H */ + diff --git a/L7/special/LGridXmlCellRenderer.cpp b/L7/special/LGridXmlCellRenderer.cpp new file mode 100644 index 0000000..31b2e7f --- /dev/null +++ b/L7/special/LGridXmlCellRenderer.cpp @@ -0,0 +1,58 @@ +/* + * File: LGridXmlCellRenderer.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 15, 2019, 6:18 PM + */ + +#include "LGridXmlCellRenderer.h" +#include "XmlHelper.h" +#include "BaseGridPicker.h" + +LGridXmlCellRenderer::LGridXmlCellRenderer() +{ +} + +LGridXmlCellRenderer::~LGridXmlCellRenderer() +{ +} + +void LGridXmlCellRenderer::Draw(wxGrid & grid, + wxGridCellAttr & attr, + wxDC & dc, + const wxRect & rect, + int row, + int col, + bool isSelected) +{ + const wxString intent = ProcessXmlValue(grid.GetCellValue(row, col)); + grid.SetCellValue(row, col, intent); + + wxGridCellStringRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); +} + +const wxString LGridXmlCellRenderer::ProcessXmlValue(const wxString& cellValue) +{ + if (cellValue.IsEmpty()) + return INVALID_INTENT; + wxXmlDocument doc; + wxXmlNode * root = XmlHelper::ValidateXmlValue(doc, cellValue); + if (root == NULL) + // Show raw data. + return cellValue; + wxXmlNode * row = root->GetChildren(); + while (row) + { + const wxString pref = row->GetAttribute(XML_ATTR_PREF); + if (!pref.IsEmpty() && pref != _T("0")) + return row->GetNodeContent(); + row = row->GetNext(); + } + /* + * Don't show raw data if there's no preferred item. + * The data will still be in the editor and saved. + */ + return INVALID_INTENT; +} diff --git a/L7/special/LGridXmlCellRenderer.h b/L7/special/LGridXmlCellRenderer.h new file mode 100644 index 0000000..1e79e14 --- /dev/null +++ b/L7/special/LGridXmlCellRenderer.h @@ -0,0 +1,39 @@ +/* + * File: LGridXmlCellRenderer.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 15, 2019, 6:18 PM + */ + +#ifndef LGRIDXMLCELLRENDERER_H +#define LGRIDXMLCELLRENDERER_H + +#include "wx/grid.h" + +/** + * A grid cell renderer for xml stored data. + * It show the selected Intent value, or INVALID_INTENT. + */ +class LGridXmlCellRenderer : public wxGridCellStringRenderer +{ +public: + LGridXmlCellRenderer(); + virtual ~LGridXmlCellRenderer(); + + void Draw(wxGrid & grid, + wxGridCellAttr & attr, + wxDC & dc, + const wxRect & rect, + int row, + int col, + bool isSelected); +private: + + const wxString ProcessXmlValue(const wxString& cellValue); + +}; + +#endif /* LGRIDXMLCELLRENDERER_H */ + diff --git a/L7/special/XmlGridPickerCtrl.cpp b/L7/special/XmlGridPickerCtrl.cpp new file mode 100644 index 0000000..66c7c6b --- /dev/null +++ b/L7/special/XmlGridPickerCtrl.cpp @@ -0,0 +1,167 @@ +/* + * File: XmlGridPickerCtrl.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 14, 2019, 3:28 PM + */ + +#include "XmlGridPickerCtrl.h" +#include +#include "XmlHelper.h" + +/* + * + + +33 1 23 45 67 89 + +33 9 87 65 43 21 +
+ */ + +IMPLEMENT_CLASS(XmlGridPickerCtrl, BaseGridPicker) + +XmlGridPickerCtrl::XmlGridPickerCtrl(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize, + const wxString& text, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +: BaseGridPicker(parent, id, types, popupSize, text, pos, size, style, validator, name) +{ + /* + * Don't create the grid here. Let SetValue() do it, deleting the previous + * one every time new data is fed in. + */ + SetValue(wxEmptyString); +} + +XmlGridPickerCtrl::~XmlGridPickerCtrl() +{ +} + +void XmlGridPickerCtrl::SetValue(const wxString& value) +{ + if (value.IsEmpty()) + { + m_value = EMPTY_DOC; + BaseGridPicker::CreateGrid(); // +++ + GetTextCtrl()->SetValue(INVALID_INTENT); + return; + } + m_value = value; + BaseGridPicker::CreateGrid(); // +++ + GetTextCtrl()->SetValue(INVALID_INTENT); + wxXmlDocument doc; + wxXmlNode * root = XmlHelper::ValidateXmlValue(doc, m_value); + if (root == NULL) + { + GetTextCtrl()->SetValue(INVALID_INTENT); + return; + } + // Look for preferred + wxXmlNode * row = root->GetChildren(); + while (row) + { + const wxString pref = row->GetAttribute(XML_ATTR_PREF); + if (!pref.IsEmpty() + && pref != _T("0")) + { + GetTextCtrl()->SetValue(row->GetNodeContent()); + return; + } + row = row->GetNext(); + } + GetTextCtrl()->SetValue(INVALID_INTENT); +} + +wxString XmlGridPickerCtrl::GetValue() +{ + DumpGrid(); + + wxXmlDocument doc; + wxXmlNode * root = new wxXmlNode(wxXML_ELEMENT_NODE, XML_ROOT_NAME); + doc.SetRoot(root); + wxString emptyXmlData; + wxStringOutputStream sos(&emptyXmlData); + doc.Save(sos); + + if (m_value == emptyXmlData) + return wxEmptyString; + return m_value; +} + +void XmlGridPickerCtrl::FillGrid() +{ + wxASSERT_MSG(m_grid != NULL, _("m_grid IS NULL")); + wxXmlDocument doc; + wxXmlNode * root = XmlHelper::ValidateXmlValue(doc, m_value); + if (root == NULL) + { + GetTextCtrl()->SetValue(INVALID_INTENT); + return; + } + wxXmlNode * row = root->GetChildren(); + int idx = 0; + while (row) + { + m_grid->InsertRows(idx); + m_grid->SetCellValue(idx, 0, row->GetNodeContent()); + m_grid->SetCellValue(idx, 1, row->GetAttribute(XML_ATTR_TYPE)); + m_grid->SetCellValue(idx, 2, row->GetAttribute(XML_ATTR_PREF)); + m_grid->SetCellValue(idx, 3, row->GetAttribute(XML_ATTR_NOTES)); + idx++; + row = row->GetNext(); + } +} + +void XmlGridPickerCtrl::DumpGrid() +{ + wxASSERT_MSG(m_grid != NULL, _("m_grid IS NULL")); + wxASSERT_MSG(m_stringTable != NULL, _("m_stringTable IS NULL")); + if (!m_editable || !m_stringTable || !m_grid) + return; + wxXmlDocument doc; + // This is EMPTY_DOC + wxXmlNode * root = new wxXmlNode(wxXML_ELEMENT_NODE, XML_ROOT_NAME); + doc.SetRoot(root); + for (uint grow = 0; grow < m_stringTable->GetRowsCount(); grow++) + { + if (m_stringTable->GetValue(grow, 0).IsEmpty()) + continue; + /* + * Don't use the other constructor : + * wxXmlNode(wxXmlNode *parent, wxXmlNodeType type ... + * The row order will be reversed each time. + * Explicitly add independent nodes to root. + */ + wxXmlNode * row = new wxXmlNode(wxXML_ELEMENT_NODE, XML_ROW_NAME); + wxXmlAttribute * attr = new wxXmlAttribute(XML_ATTR_TYPE, m_stringTable->GetValue(grow, 1)); + row->AddAttribute(attr); + attr = new wxXmlAttribute(XML_ATTR_PREF, (m_stringTable->GetValue(grow, 2) == _T("0") + || m_stringTable->GetValue(grow, 2).IsEmpty()) ? _T("0") : _T("1")); + row->AddAttribute(attr); + attr = new wxXmlAttribute(XML_ATTR_NOTES, m_stringTable->GetValue(grow, 3)); + row->AddAttribute(attr); + new wxXmlNode(row, wxXML_TEXT_NODE, _T("irrelevant_name"), m_stringTable->GetValue(grow, 0)); + root->AddChild(row); + } + wxString xmlData; + wxStringOutputStream sos(&xmlData); + bool res = doc.Save(sos); + if (!res) + { + wxASSERT_MSG(res, _T("Error dumping to XML")); + // Let's not empty m_value. + } + else + { + m_value = xmlData; // May be empty XML with XML_ROOT_NAME tag only + } +} + + diff --git a/L7/special/XmlGridPickerCtrl.h b/L7/special/XmlGridPickerCtrl.h new file mode 100644 index 0000000..1306033 --- /dev/null +++ b/L7/special/XmlGridPickerCtrl.h @@ -0,0 +1,66 @@ +/* + * File: XmlGridPickerCtrl.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 14, 2019, 3:28 PM + */ + +#ifndef XMLGRIDPICKERCTRL_H +#define XMLGRIDPICKERCTRL_H + +#include "BaseGridPicker.h" +#include + +/** + * The grid content is stored in an XML document. + * @return + */ +class XmlGridPickerCtrl : public BaseGridPicker +{ + DECLARE_CLASS(XmlGridPickerCtrl) +public: + XmlGridPickerCtrl(wxWindow *parent, + wxWindowID id, + const wxArrayString& types, + wxSize popupSize = wxDefaultSize, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxPB_USE_TEXTCTRL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + virtual ~XmlGridPickerCtrl(); + + /** + * Creates a new grid deleting the previous one and fills it with the XML + * data. + * @param value + */ + virtual void SetValue(const wxString& value); + + /** + * Dumps the grid content and returns it as an XML document. But returns + * empty string if XML document is empty. + * @return + */ + virtual wxString GetValue(); +private: + /** + * Parses the XML document and fills the grid. + */ + virtual void FillGrid(); + /** + * Translates the grid content to an XML document. + * If the Intent column is empty, this row is ignored. + */ + virtual void DumpGrid(); + /** + * Is the XML document. + */ + wxString m_value; +}; + +#endif /* XMLGRIDPICKERCTRL_H */ + diff --git a/L7/special/XmlHelper.cpp b/L7/special/XmlHelper.cpp new file mode 100644 index 0000000..c8a71fb --- /dev/null +++ b/L7/special/XmlHelper.cpp @@ -0,0 +1,75 @@ +/* + * File: XmlHelper.cpp + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 15, 2019, 4:13 PM + */ + +#include "XmlHelper.h" +#include + +XmlHelper::XmlHelper() +{ +} + +XmlHelper::~XmlHelper() +{ +} + +// if doc is declared with local scope, root elements are empty in caller + +wxXmlNode* XmlHelper::ValidateXmlValue(wxXmlDocument& doc, const wxString& value) +{ + // Avoid 'XML parsing error' message box. + wxLogNull lognull; + wxStringInputStream sis(value); + bool res = doc.Load(sis); + if (!res) + { + wxASSERT_MSG(res == true, _T("Can't load XML data.\n") + value); + return NULL; + } + wxXmlNode * root = doc.GetRoot(); + if (root->GetName() != XML_ROOT_NAME) + { + wxASSERT_MSG(root->GetName() != XML_ROOT_NAME, _T("Bad XML data.\n") + value); + return NULL; + } + // Check all rows and attributes + wxXmlNode * row = root->GetChildren(); + while (row) + { + if (row->GetName() != XML_ROW_NAME + || !row->HasAttribute(XML_ATTR_TYPE) + || !row->HasAttribute(XML_ATTR_PREF) + || !row->HasAttribute(XML_ATTR_NOTES) + || row->GetNodeContent().IsEmpty()) + { + wxASSERT_MSG(root->GetName() != XML_ROOT_NAME, _T("Unexpected XML data.\n") + value); + return NULL; + } + row = row->GetNext(); + } + return root; +} + +wxString XmlHelper::GetIntent(const wxString& xmlData) +{ + if (xmlData.IsEmpty()) + return wxEmptyString; + wxXmlDocument doc; + wxXmlNode * root = ValidateXmlValue(doc, xmlData); + if (root == NULL) + return wxEmptyString; + wxXmlNode * row = root->GetChildren(); + while (row) + { + const wxString pref = row->GetAttribute(XML_ATTR_PREF); + if (!pref.IsEmpty() && pref != _T("0")) + return row->GetNodeContent(); + row = row->GetNext(); + } + return wxEmptyString; +} diff --git a/L7/special/XmlHelper.h b/L7/special/XmlHelper.h new file mode 100644 index 0000000..0980827 --- /dev/null +++ b/L7/special/XmlHelper.h @@ -0,0 +1,54 @@ +/* + * File: XmlHelper.h + * Author: SET - nmset@netcourrier.com + * License : LGPL version 2.1 + * Copyright SET, M. D. - © 2014 + * + * Created on December 15, 2019, 4:13 PM + */ + +#ifndef XMLHELPER_H +#define XMLHELPER_H + +#include +#include + +#define XML_ROOT_NAME _T("TABLE") +#define XML_ROW_NAME _T("ROW") +#define XML_ATTR_TYPE _T("Type") +#define XML_ATTR_PREF _T("Preferred") +#define XML_ATTR_NOTES _T("Notes") +#define EMPTY_DOC _T("\n") + +/** + * Application helper to quickly get the Intent value. + * @param doc + * @param value + * @return + */ +class XmlHelper +{ +public: + + /** + * Parses value which is XML data and returns the XML root node, while + * loading the XML data in doc. + * If value does not have the expected tags defined above, returns NULL. + * @param doc + * @param value + * @return + */ + static wxXmlNode * ValidateXmlValue(wxXmlDocument& doc, const wxString& value); + /** + * Returns a valid Intent value or an empty string. + * @param xmlData + * @return + */ + static wxString GetIntent(const wxString& xmlData); +private: + XmlHelper(); + virtual ~XmlHelper(); +}; + +#endif /* XMLHELPER_H */ +