This commit is contained in:
levinsv 2019-01-09 07:25:44 +05:00
parent 503dfba43b
commit 51fc0dec7f
14 changed files with 711 additions and 660 deletions

Binary file not shown.

View file

@ -24,6 +24,9 @@
#include "utils/sysProcess.h"
wxString ctlSQLBox::sqlKeywords;
static const wxString s_leftBrace(_T("([{"));
static const wxString s_rightBrace(_T(")]}"));
static const int s_indicHighlight(20);
// Additional pl/pgsql keywords we should highlight
wxString plpgsqlKeywords = wxT(" elsif exception exit loop raise record return text while call");
@ -462,6 +465,56 @@ void ctlSQLBox::SetDefFunction(wxArrayString &name, wxArrayString &def) {
void ctlSQLBox::OnKeyDown(wxKeyEvent &event)
{
int pos = GetCurrentPos();
wxChar ch = GetCharAt(pos - 1);
wxChar nextch = GetCharAt(pos);
int st = GetStyleAt(pos - 1);
if (event.GetKeyCode() == WXK_LEFT) nextch=' ';
if (event.GetKeyCode() == WXK_RIGHT) ch=' ';
int match;
BraceBadLight(wxSTC_INVALID_POSITION);
// BraceHighlight(-1, -1);
// Check for braces that aren't in comment styles,
// double quoted styles or single quoted styles
if ((ch == '{' || ch == '}' ||
ch == '[' || ch == ']' ||
ch == '(' || ch == ')') &&
st != 1 && st != 2 && st != 6 && st != 7)
{
match = BraceMatch(pos - 1);
if (match != wxSTC_INVALID_POSITION) {
BraceHighlight(pos - 1, match);
}
}
else if ((nextch == '{' || nextch == '}' ||
nextch == '[' || nextch == ']' ||
nextch == '(' || nextch == ')') &&
st != 1 &&st != 2 && st != 6 && st != 7)
{
match = BraceMatch(pos);
if (match != wxSTC_INVALID_POSITION)
BraceHighlight(pos, match);
}
while ((pos--) >= 0)
{
ch = GetCharAt(pos);
st = GetStyleAt(pos);
if ((ch == '{' || ch == '}' ||
ch == '[' || ch == ']' ||
ch == '(' || ch == ')') &&
st != 1 &&st != 2 && st != 6 && st != 7)
{
match = BraceMatch(pos);
if (match == wxSTC_INVALID_POSITION)
{
BraceBadLight(pos);
}
}
}
//wxString autoreplace[]={wxT("se"),wxT("select * from"),wxT("sc"),wxT("select count(*) from"),wxT("si"),wxT("select * from info_oper where"),wxT("sh"),wxT("select * from info_history where")};
#ifdef __WXGTK__
event.m_metaDown = false;
@ -490,7 +543,7 @@ void ctlSQLBox::OnKeyDown(wxKeyEvent &event)
wxCharBuffer myStringChars = line.mb_str();
for (int kk=pos-max-1;kk>=0;kk--) {
//char c=myStringChars.data[kk];
if ( line[kk]<'0') break;
if ( line[kk].GetValue()<'0') break;
l++;
}
wxString f_name=GetTextRange(pos-l, pos);
@ -532,7 +585,7 @@ void ctlSQLBox::OnKeyDown(wxKeyEvent &event)
int pos=ct_hl+direction;
int a=0;
while ( (pos<calltip.Len())&&(pos>0)) {
c=calltip[pos];
c=calltip[pos].GetValue();
if ((c==',')||(c=='\n')) {
if (direction==1) break;
if (a==1) break;
@ -661,8 +714,10 @@ void ctlSQLBox::OnKeyDown(wxKeyEvent &event)
int max = line.Length() - (GetLineEndPosition(GetCurrentLine()) - GetCurrentPos()) - offset;
if(line != wxEmptyString)
{
while ((line[x] == '\t' || line[x] == ' ') && x < max)
while ((line[x].GetValue() == '\t' || line[x].GetValue() == ' ') && x < max) {
wxChar ccc=line[x];
indent += line[x++];
}
}
// Select any indent in front of the cursor to be removed. If
@ -952,6 +1007,24 @@ long ctlSQLBox::SelectQuery(int startposition)
if (startposition<0) SetSelection(pstart,pend);
return (pstart <<16)+pend;
}
void ctlSQLBox::HighlightBrace(int lb, int rb) {
SetIndicatorCurrent(s_indicHighlight);
{
//SetCaretForeground(wxColour(255, 0, 0));
//SetCaretWidth(caretWidth + 1);
IndicatorSetForeground(s_indicHighlight, wxColour(80, 236, 120));
IndicatorSetStyle(s_indicHighlight, wxSTC_INDIC_ROUNDBOX);
#ifndef wxHAVE_RAW_BITMAP
IndicatorSetUnder(s_indicHighlight, true);
#endif
SetIndicatorCurrent(s_indicHighlight);
IndicatorFillRange(lb, 1);
IndicatorFillRange(rb, 1);
return;
}
}
void ctlSQLBox::OnPositionStc(wxStyledTextEvent &event)
{
@ -960,8 +1033,6 @@ void ctlSQLBox::OnPositionStc(wxStyledTextEvent &event)
wxChar nextch = GetCharAt(pos);
int st = GetStyleAt(pos - 1);
int match;
// Line numbers
// Ensure we don't recurse through any paint handlers on Mac
#ifdef __WXMAC__
@ -971,30 +1042,6 @@ void ctlSQLBox::OnPositionStc(wxStyledTextEvent &event)
#ifdef __WXMAC__
Thaw();
#endif
// Clear all highlighting
BraceBadLight(wxSTC_INVALID_POSITION);
// Check for braces that aren't in comment styles,
// double quoted styles or single quoted styles
if ((ch == '{' || ch == '}' ||
ch == '[' || ch == ']' ||
ch == '(' || ch == ')') &&
st != 1 && st != 2 && st != 6 && st != 7)
{
match = BraceMatch(pos - 1);
if (match != wxSTC_INVALID_POSITION)
BraceHighlight(pos - 1, match);
}
else if ((nextch == '{' || nextch == '}' ||
nextch == '[' || nextch == ']' ||
nextch == '(' || nextch == ')') &&
st != 1 &&st != 2 && st != 6 && st != 7)
{
match = BraceMatch(pos);
if (match != wxSTC_INVALID_POSITION)
BraceHighlight(pos, match);
}
int startsql=0;
// Roll back through the doc and highlight any unmatched braces
int tmp=pos;
@ -1012,12 +1059,8 @@ void ctlSQLBox::OnPositionStc(wxStyledTextEvent &event)
match = BraceMatch(pos);
if (match == wxSTC_INVALID_POSITION)
{
BraceBadLight(pos);
event.Skip();
return;
} else
{
}
}
}

View file

@ -331,7 +331,7 @@ void ctlSQLGrid::OnLabelDoubleClick(wxGridEvent &event)
SaveEditControlValue();
}
SetRowHeight(row, extentWant);
SetRowSize(row, extentWant);
EndBatch();
}
}
@ -371,7 +371,7 @@ void ctlSQLGrid::OnLabelDoubleClick(wxGridEvent &event)
extentWant += EXTRAEXTENT_WIDTH;
extentWant = wxMax(extentWant, GetColMinimalAcceptableWidth());
extentWant = wxMin(extentWant, maxWidth * 3 / 4);
int currentWidth = GetColumnWidth(col);
int currentWidth = GetColSize(col);
if (currentWidth >= maxWidth * 3 / 4 || currentWidth == extentWant)
extentWant = GetColMinimalAcceptableWidth();
@ -390,7 +390,7 @@ void ctlSQLGrid::OnLabelDoubleClick(wxGridEvent &event)
HideCellEditControl();
SaveEditControlValue();
}
SetColumnWidth(col, extentWant);
SetColSize(col, extentWant);
EndBatch();
colSizes[GetColKeyValue(col)] = extentWant;
}
@ -621,8 +621,13 @@ int recurse(ctlSQLGrid *g, int pos,int row, double &transfer) {
//
//leveltime=leveltime+transfer;
//GroupRows *u=g->getgroup();
g->grp->AddGroup(row-1,newrow-1,lastnode-transfer);
s << (lastnode-transfer) ;
int tt=lastnode-transfer;
text = g->GetCellValue(row-1, 0);
if ((text.Find("Append")>0)
||(text.Find("Gather")>0))
tt=lastnode;
g->grp->AddGroup(row-1,newrow-1,tt);
s << (tt) ;
s=s+wxT("-");
g->GetTable()->SetRowLabelValue(row-1,s);

View file

@ -212,7 +212,7 @@ void ctlSQLResult::DisplayData(bool single)
//
isplan=true;
FullArrayCollapseRowsPlan();
}
} else isplan=false;
AutoSizeColumn(0, false, false);
}

View file

@ -100,10 +100,11 @@ void ddGenerationWizard::OnFinishPressed(wxWizardEvent &event)
wxString strChoicesAlter[4] = {_("Alter table"), _("Drop, then create"), _("Create table [conflict]"), wxT("No action")};
wxArrayString tables;
wxArrayInt options;
if(page4->getGrid()->GetRows() > 0)
//if(page4->getGrid()->GetRows() > 0)
if(page4->getGrid()->GetNumberRows() > 0)
{
int i;
for(i = page4->getGrid()->GetRows() - 1; i >= 0; i--)
for(i = page4->getGrid()->GetNumberRows() - 1; i >= 0; i--)
{
tables.Add(page4->getGrid()->GetCellValue(i, 0));
wxString value = page4->getGrid()->GetCellValue(i, 1);

View file

@ -95,11 +95,11 @@ dlgDirectDbg::dlgDirectDbg(frmDebugger *_parent, dbgController *_controller,
grdParams->GetClientSize(&width, &height);
for (int i = 0; i < grdParams->GetNumberCols(); i++)
{
totalWidth += grdParams->GetColumnWidth(i);
totalWidth += grdParams->GetColSize(i);
}
// Total client width - total six column widths - the first (an empty) column
// width
grdParams->SetColumnWidth(COL_DEF_VAL, width - totalWidth - 100);
grdParams->SetColSize(COL_DEF_VAL, width - totalWidth - 100);
}
}

View file

@ -49,8 +49,7 @@ BEGIN_EVENT_TABLE(frmDebugger, pgFrame)
EVT_STC_MARGINCLICK(wxID_ANY, frmDebugger::OnMarginClick)
EVT_STC_UPDATEUI(wxID_ANY, frmDebugger::OnPositionStc)
EVT_LISTBOX(wxID_ANY, frmDebugger::OnSelectFrame)
EVT_GRID_CELL_CHANGE( frmDebugger::OnVarChange)
EVT_GRID_CELL_CHANGED( frmDebugger::OnVarChange)
EVT_MENU(MNU_EXIT, frmDebugger ::OnExit)
EVT_MENU(MENU_ID_VIEW_TOOLBAR, frmDebugger::OnToggleToolBar)
EVT_MENU(MENU_ID_VIEW_STACKPANE, frmDebugger::OnToggleStackPane)

View file

@ -1277,7 +1277,7 @@ void frmEditGrid::OnEditorHidden(wxGridEvent &event)
void frmEditGrid::OnGridSelectCells(wxGridRangeSelectEvent &event)
{
if (sqlGrid->GetEditable())
if (sqlGrid->IsEditable())
{
wxArrayInt rows = sqlGrid->GetSelectedRows();

View file

@ -532,7 +532,7 @@ void gqbColsPopUp::refreshTree(gqbModel *_model)
void gqbColsPopUp::OnPopUpOKClick(wxCommandEvent &event)
{
this->usedGrid->SetCellValue(_row, _col, this->getEditText());
this->MakeModal(false);
//this->MakeModal(false);
this->Hide();
this->GetParent()->Refresh();
}
@ -551,7 +551,7 @@ void gqbColsPopUp::OnPopUpTreeDoubleClick(wxTreeEvent &event)
{
this->usedGrid->SetCellValue(_row, _col, _("Set value"));
}
this->MakeModal(false);
//this->MakeModal(false);
this->Hide();
this->GetParent()->Refresh();
}
@ -669,8 +669,9 @@ void gqbCriteriaPanel::showColsPopUp(int row, int col, wxPoint pos)
p.x += p2.x;
p.y += p2.y + 40;
colsPopUp->SetPosition(p);
colsPopUp->Show();
colsPopUp->MakeModal(true);
//colsPopUp->Show();
//colsPopUp->MakeModal(true);
colsPopUp->ShowModal();
colsPopUp->focus();
colsPopUp->setUsedCell(restrictionsGrid, row, col);
}
@ -1017,7 +1018,7 @@ gqbOrderPanel::gqbOrderPanel(wxWindow *parent, gqbGridOrderTable *gridTableLeft,
void gqbOrderPanel::OnButtonRemove(wxCommandEvent &)
{
if(usedColumns->GetRows() > 0)
if(usedColumns->GetNumberRows() > 0)
{
if(selRightTop != -1)
{
@ -1032,9 +1033,9 @@ void gqbOrderPanel::OnButtonRemove(wxCommandEvent &)
void gqbOrderPanel::OnButtonRemoveAll(wxCommandEvent &)
{
if(usedColumns->GetRows() > 0)
if(usedColumns->GetNumberRows() > 0)
{
for(int i = usedColumns->GetRows() - 1; i >= 0; i--)
for(int i = usedColumns->GetNumberRows() - 1; i >= 0; i--)
{
gqbColumn *col = (gqbColumn *) tableRight->getObjectAt(i, 0);
gqbQueryObject *colParent = (gqbQueryObject *) tableRight->getObjectAt(i, 1);
@ -1047,14 +1048,14 @@ void gqbOrderPanel::OnButtonRemoveAll(wxCommandEvent &)
void gqbOrderPanel::OnButtonAdd(wxCommandEvent &)
{
if(availableColumns->GetRows() > 0)
if(availableColumns->GetNumberRows() > 0)
{
if(selLeft != -1)
{
gqbColumn *col = (gqbColumn *) tableLeft->getObjectAt(selLeft, 0);
gqbQueryObject *colParent = (gqbQueryObject *) tableLeft->getObjectAt(selLeft, 1);
tableRight->AppendItem(col, colParent, 'A');
usedColumns->SetCellRenderer((usedColumns->GetRows() - 1), 1, new wxGridCellButtonRenderer);
usedColumns->SetCellRenderer((usedColumns->GetNumberRows() - 1), 1, new wxGridCellButtonRenderer);
tableLeft->removeRowAt(selLeft);
}
}
@ -1063,14 +1064,14 @@ void gqbOrderPanel::OnButtonAdd(wxCommandEvent &)
void gqbOrderPanel::OnButtonAddAll(wxCommandEvent &)
{
if(availableColumns->GetRows() > 0)
if(availableColumns->GetNumberRows() > 0)
{
for(int i = availableColumns->GetRows() - 1; i >= 0; i--)
for(int i = availableColumns->GetNumberRows() - 1; i >= 0; i--)
{
gqbColumn *col = (gqbColumn *) tableLeft->getObjectAt(i, 0);
gqbQueryObject *colParent = (gqbQueryObject *) tableLeft->getObjectAt(i, 1);
tableRight->AppendItem(col, colParent, 'A');
usedColumns->SetCellRenderer((usedColumns->GetRows() - 1), 1, new wxGridCellButtonRenderer);
usedColumns->SetCellRenderer((usedColumns->GetNumberRows() - 1), 1, new wxGridCellButtonRenderer);
tableLeft->removeRowAt(i);
}
}
@ -1085,7 +1086,7 @@ void gqbOrderPanel::OnGridSelectCell( wxGridEvent &ev )
{
wxObject *object = ev.GetEventObject();
wxGrid *grid = wxDynamicCast( object, wxGrid );
if(grid->GetCols() == 1) // Left Grid
if(grid->GetNumberCols() == 1) // Left Grid
{
selLeft = ev.GetRow();
}
@ -1402,7 +1403,8 @@ void gqbJoinsPopUp::OnPopUpOKClick(wxCommandEvent &event)
updateJoin();
}
this->MakeModal(false);
//this->MakeModal(false);
this->Hide();
this->GetParent()->Refresh();
this->join = NULL;
@ -1471,7 +1473,7 @@ void gqbJoinsPopUp::OnPopUpTreeDoubleClick(wxTreeEvent &event)
updateJoin();
this->MakeModal(false);
//this->MakeModal(false);
this->Hide();
this->GetParent()->Refresh();
this->join = NULL;
@ -1568,8 +1570,8 @@ void gqbJoinsPanel::showColsPopUp(int row, int col, wxPoint pos)
p.x += p2.x;
p.y += p2.y + 40;
joinsPopUp->SetPosition(p);
joinsPopUp->Show();
joinsPopUp->MakeModal(true);
//joinsPopUp->Show();
joinsPopUp->ShowModal();
joinsPopUp->focus();
joinsPopUp->setUsedCell(joinsGrid, row, col);
}

View file

@ -48,7 +48,7 @@ public:
~ctlSQLBox();
void Create(wxWindow *parent, wxWindowID id = -1, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0);
void HighlightBrace(int lb, int rb);
void SetDatabase(pgConn *db);
void OnKeyDown(wxKeyEvent &event);

View file

@ -148,7 +148,8 @@ protected:
wxMBConv &conv;
bool needColQuoting;
mutable wxArrayString colTypes, colFullTypes;
wxArrayInt colClasses;
mutable wxArrayInt colClasses;
};

View file

@ -396,7 +396,7 @@
<hgap>4</hgap>
<growablecols>1</growablecols>
</object>
<flag>wxALL|wxEXPAND|wxALIGN_BOTTOM|wxALIGN_CENTRE_HORIZONTAL</flag>
<flag>wxALL|wxALIGN_BOTTOM|wxALIGN_CENTRE_HORIZONTAL</flag>
<border>5</border>
</object>
<object class="sizeritem">
@ -502,7 +502,7 @@
<pos>5,6d</pos>
<style>wxLC_REPORT|wxLC_SINGLE_SEL</style>
</object>
<flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
<flag>wxALL|wxGROW</flag>
<border>4</border>
</object>
<object class="sizeritem">
@ -527,7 +527,7 @@
<border>4</border>
</object>
</object>
<flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
<flag>wxALL|wxGROW</flag>
<border>3</border>
</object>
<object class="sizeritem">
@ -576,7 +576,7 @@
</object>
<flag>wxEXPAND|wxALIGN_CENTER_VERTICAL</flag>
</object>
<flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
<flag>wxALL|wxGROW</flag>
<border>4</border>
</object>
</object>
@ -586,7 +586,7 @@
</object>
</object>
</object>
<flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
<flag>wxALL|wxGROW</flag>
<border>3</border>
</object>
<object class="sizeritem">
@ -625,7 +625,7 @@
<object class="wxStatusBar" name="unkStatusBar">
<style>wxST_SIZEGRIP</style>
</object>
<flag>wxEXPAND|wxALIGN_CENTRE</flag>
<flag>wxEXPAND</flag>
<border>3</border>
</object>
</object>

View file

@ -9,6 +9,7 @@
<growablerows>0</growablerows>
<growablecols>0</growablecols>
<object class="sizeritem">
<flag>wxEXPAND|wxALL</flag>
<object class="wxNotebook" name="nbNotebook">
<size>296,240d</size>
<selected>0</selected>
@ -85,6 +86,7 @@
<border>4</border>
</object>
<object class="sizeritem">
<flag>wxEXPAND|wxALL</flag>
<object class="wxTextCtrl" name="txtComment">
<style>wxTE_MULTILINE</style>
</object>
@ -679,7 +681,7 @@
</object>
</object>
</object>
<flag>wxALL|wxGROW|wxALIGN_CENTRE</flag>
<flag>wxALL|wxGROW</flag>
<border>3</border>
</object>
<object class="sizeritem">
@ -718,7 +720,7 @@
<object class="wxStatusBar" name="unkStatusBar">
<style>wxST_SIZEGRIP</style>
</object>
<flag>wxEXPAND|wxALIGN_CENTRE</flag>
<flag>wxEXPAND</flag>
<border>3</border>
</object>
</object>

File diff suppressed because it is too large Load diff