diff --git a/ctl/ctlSQLResult.cpp b/ctl/ctlSQLResult.cpp index 796ebe4..53569f1 100644 --- a/ctl/ctlSQLResult.cpp +++ b/ctl/ctlSQLResult.cpp @@ -1088,8 +1088,10 @@ void ctlSQLResult::OnKeyChar(wxKeyEvent& event) { } else { + bool skip=false; + if (event.AltDown() || event.ControlDown()) skip=true; wxChar uc = event.GetUnicodeKey(); - if (uc != WXK_NONE) { + if (uc != WXK_NONE && !skip) { if (uc >= 32) { this->searchStr.Append(uc); if (this->searchStr.Len() == 1) { diff --git a/frm/frmExport.cpp b/frm/frmExport.cpp index 3546c56..2fa62db 100644 --- a/frm/frmExport.cpp +++ b/frm/frmExport.cpp @@ -34,6 +34,7 @@ #define rbQuoteAll CTRL_RADIOBUTTON("rbQuoteAll") #define rbQuoteNone CTRL_RADIOBUTTON("rbQuoteNone") #define chkColnames CTRL_CHECKBOX("chkColnames") +#define chkCopy CTRL_CHECKBOX("chkCopy") #define chkXlsCopy CTRL_CHECKBOX("chkXlsCopy") #define cbColSeparator CTRL_COMBOBOX("cbColSeparator") #define cbQuoteChar CTRL_COMBOBOX("cbQuoteChar") @@ -42,10 +43,11 @@ BEGIN_EVENT_TABLE(frmExport, pgDialog) EVT_TEXT(XRCID("txtFilename"), frmExport::OnChange) EVT_RADIOBUTTON(XRCID("rbQuoteNone"), frmExport::OnChange) - EVT_RADIOBUTTON(XRCID("rbQuoteStrings"), frmExport::OnChange) + EVT_RADIOBUTTON(XRCID("rbQuoteStrings"),frmExport::OnChange) EVT_RADIOBUTTON(XRCID("rbQuoteAll"), frmExport::OnChange) + EVT_CHECKBOX(XRCID("chkCopy"), frmExport::OnChange) + EVT_CHECKBOX(XRCID("chkXlsCopy"), frmExport::OnChange) EVT_BUTTON(XRCID("btnFilename"), frmExport::OnBrowseFile) - EVT_BUTTON(wxID_HELP, frmExport::OnHelp) EVT_BUTTON(wxID_OK, frmExport::OnOK) EVT_BUTTON(wxID_CANCEL, frmExport::OnCancel) END_EVENT_TABLE() @@ -154,6 +156,10 @@ frmExport::frmExport(wxWindow *p) if (!ctrl) { chkXlsCopy->SetValue(false); chkXlsCopy->Enable(false); + } else { + chkCopy->SetValue(false); + chkCopy->Enable(false); + } wxCommandEvent ev; @@ -176,6 +182,16 @@ void frmExport::OnHelp(wxCommandEvent &ev) void frmExport::OnChange(wxCommandEvent &ev) { cbQuoteChar->Enable(rbQuoteStrings->GetValue() || rbQuoteAll->GetValue()); + bool ischk = chkXlsCopy->GetValue(); + if (ev.GetEventObject()==chkXlsCopy ) { + if (chkCopy->IsEnabled()) chkCopy->SetValue(!chkXlsCopy->GetValue()); + } + if (ev.GetEventObject()==chkCopy ) { + if (chkXlsCopy->IsEnabled()) chkXlsCopy->SetValue(!chkCopy->GetValue()); + } + + + btnOK->Enable(!txtFilename->GetValue().IsEmpty() && !cbColSeparator->GetValue().IsEmpty()); } @@ -266,7 +282,7 @@ wxString textEscapeXml(wxString &text) for ( i = text.begin(); i != text.end(); ++i ) { #if wxCHECK_VERSION(3, 0, 0) - char c=*i; + wxChar c=*i; switch (c) #else switch (*i) @@ -442,7 +458,9 @@ bool frmExport::Export(pgSet *set) colCount = grid->GetNumberCols(); rowCount = grid->NumRows(); } - + bool isCOPY= chkCopy->GetValue(); + wxString colsep=cbColSeparator->GetValue(); + if (colsep=="\\t" || isCOPY) colsep="\t"; int col; if (chkColnames->GetValue()) { @@ -451,9 +469,9 @@ bool frmExport::Export(pgSet *set) if (!col) line = wxEmptyString; else - line += cbColSeparator->GetValue(); + line += colsep; - if (rbQuoteStrings->GetValue() || rbQuoteAll->GetValue()) + if ((rbQuoteStrings->GetValue() || rbQuoteAll->GetValue())&& (!isCOPY)) { wxString qc = cbQuoteChar->GetValue(); @@ -503,7 +521,7 @@ bool frmExport::Export(pgSet *set) if (!col) line = wxEmptyString; else - line += cbColSeparator->GetValue(); + line += colsep; bool needQuote = rbQuoteAll->GetValue(); @@ -531,14 +549,34 @@ bool frmExport::Export(pgSet *set) break; } } - if (needQuote) + if (needQuote && !isCOPY) { wxString qc = cbQuoteChar->GetValue(); text.Replace(qc, qc + qc); line += qc + text + qc; } - else - line += text; + else { + if (isCOPY) { + for (size_t i = 0; i < text.length(); ++i) { + wxChar c = text[i]; + switch (c) { + case '\\': line += "\\\\"; break; + case '\n': line += "\\n"; break; + case '\r': line += "\\r"; break; + case '\t': line += "\\t"; break; + default: line += c; break; + } + } + if (set) { + if (set->IsNull(col)) line+="\\N"; + } + else { + if (text.length()==0) line+="\\N"; + } + } else + line += text; + } + } if (rbCRLF->GetValue()) line += wxT("\r\n"); diff --git a/frm/frmQuery.cpp b/frm/frmQuery.cpp index 6b78134..81398dd 100644 --- a/frm/frmQuery.cpp +++ b/frm/frmQuery.cpp @@ -2849,6 +2849,7 @@ void frmQuery::OnCancel(wxCommandEvent &event) void frmQuery::OnExplain(wxCommandEvent &event) { + if (!queryMenu->IsEnabled(MNU_EXPLAIN)) return; if(sqlNotebook->GetSelection() == 1) { if (!updateFromGqb(true)) @@ -3038,6 +3039,7 @@ void frmQuery::SelectQuery() { void frmQuery::OnExecuteShift(wxCommandEvent &event) { //add new page outpane + if (!queryMenu->IsEnabled(MNU_EXECUTE_2)) return; int len = sizeof(ctlSQL) / sizeof(ctlSQL[0]); wxString titlename; for (int i=0;iIsEnabled(MNU_EXECUTE)) return; if(sqlNotebook->GetSelection() == 1) { if (!updateFromGqb(true)) @@ -3154,6 +3157,7 @@ void frmQuery::OnExecScript(wxCommandEvent &event) wxMessageBox(("pgScript disable."), ("Disable compile support pgScript."), wxICON_WARNING | wxOK); return; #endif + if (!queryMenu->IsEnabled(MNU_EXECUTE)) return; // Get the script wxString query = sqlQuery->GetSelectedText(); if (query.IsNull()) @@ -3319,6 +3323,9 @@ void frmQuery::showMessage(const wxString &msg, const wxString &msgShort) void frmQuery::execQuery(const wxString &query, int resultToRetrieve, bool singleResult, const int queryOffset, bool toFile, bool explain, bool verbose) { + // check is query running + if (!queryMenu->IsEnabled(MNU_EXECUTE)) return; + setTools(true); queryMenu->Enable(MNU_SAVEHISTORY, true); queryMenu->Enable(MNU_CLEARHISTORY, true); @@ -3768,7 +3775,7 @@ void frmQuery::OnQueryComplete(pgQueryResultEvent &ev) if (qi->toFileExportForm) { - SetStatusText(wxString::Format(wxPLURAL("%d row.", "%d rows.", rowsTotal), rowsTotal), STATUSPOS_ROWS); + SetStatusText(wxString::Format(wxPLURAL("%ld row.", "%ld rows.", rowsTotal), rowsTotal), STATUSPOS_ROWS); if (rowsTotal) { diff --git a/frm/frmReport.cpp b/frm/frmReport.cpp index d353bc6..0341bb0 100644 --- a/frm/frmReport.cpp +++ b/frm/frmReport.cpp @@ -2008,6 +2008,7 @@ std::wstring reportCompareFactory::printdiff(std::wstring str1, std::wstring str return L""; } diffs=dmp.diff_main(str1,str2,true); + dmp.diff_cleanupSemantic(diffs); int nstart=0; int pos=0; countdiffline=0; diff --git a/include/ctl/SourceViewDialog.h b/include/ctl/SourceViewDialog.h index f5d5c5d..76b3081 100644 --- a/include/ctl/SourceViewDialog.h +++ b/include/ctl/SourceViewDialog.h @@ -100,8 +100,8 @@ public: return; } if (m_linescompare && m_linescompare->IsChecked()) { - //auto a = dmp.diff_linesToChars(sL.wc_str(), sR.wc_str()); - auto a = dmp.diff_wordsToChars(sL.wc_str(), sR.wc_str()); + auto a = dmp.diff_linesToChars(sL.wc_str(), sR.wc_str()); + //auto a = dmp.diff_wordsToChars(sL.wc_str(), sR.wc_str()); auto lineText1 = std::get<0>(a); auto lineText2 = std::get<1>(a); std::vector lineArray = std::get<2>(a); @@ -320,7 +320,7 @@ public: m_showNumber = new wxCheckBox(m_panelOpt, wxID_ANY, wxT("Show number line"), wxDefaultPosition, wxDefaultSize, 0); bSizer4->Add(m_showNumber, 0, wxALL, 5); - m_linescompare = new wxCheckBox(m_panelOpt, wxID_ANY, wxT("Words compare"), wxDefaultPosition, wxDefaultSize, 0); + m_linescompare = new wxCheckBox(m_panelOpt, wxID_ANY, wxT("Lines compare"), wxDefaultPosition, wxDefaultSize, 0); m_symantecclean= new wxCheckBox(m_panelOpt, wxID_ANY, wxT("Cleanup semantic"), wxDefaultPosition, wxDefaultSize, 0); bSizer4->Add(m_linescompare, 0, wxALL, 5); diff --git a/ui/frmExport.xrc b/ui/frmExport.xrc index 9482f4e..f213670 100644 --- a/ui/frmExport.xrc +++ b/ui/frmExport.xrc @@ -28,10 +28,11 @@ ; , | + \t 0 - 100,53d - 25,12d + 90,53d + 35,12d @@ -44,8 +45,8 @@ ' 0 - 100,68d - 25,12d + 90,68d + 35,12d @@ -105,15 +106,16 @@ 235,105d 15,-1d - - + + + 0 + 70,12d 2,125d - 1 - 55,125d + 80,125d 70,12d diff --git a/ui/xrcDialogs.cpp b/ui/xrcDialogs.cpp index f0482c3..d39f140 100644 --- a/ui/xrcDialogs.cpp +++ b/ui/xrcDialogs.cpp @@ -35113,7 +35113,7 @@ static unsigned char xml_res_file_75[] = { 106,101,99,116,62,10,32,32,60,47,111,98,106,101,99,116,62,10,60,47,114, 101,115,111,117,114,99,101,62,10}; -static size_t xml_res_size_76 = 3765; +static size_t xml_res_size_76 = 3827; static unsigned char xml_res_file_76[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101, 110,99,111,100,105,110,103,61,34,73,83,79,45,56,56,53,57,45,49,34,63,62, @@ -35157,32 +35157,33 @@ static unsigned char xml_res_file_76[] = { 60,99,111,110,116,101,110,116,62,10,32,32,32,32,32,32,32,32,60,105,116, 101,109,62,59,60,47,105,116,101,109,62,10,32,32,32,32,32,32,32,32,60,105, 116,101,109,62,44,60,47,105,116,101,109,62,10,32,32,32,32,32,32,32,32,60, -105,116,101,109,62,124,60,47,105,116,101,109,62,10,32,32,32,32,32,32,60, -47,99,111,110,116,101,110,116,62,10,32,32,32,32,32,32,60,115,101,108,101, -99,116,105,111,110,62,48,60,47,115,101,108,101,99,116,105,111,110,62,10, -32,32,32,32,32,32,60,112,111,115,62,49,48,48,44,53,51,100,60,47,112,111, -115,62,10,32,32,32,32,32,32,60,115,105,122,101,62,50,53,44,49,50,100,60, -47,115,105,122,101,62,10,32,32,32,32,32,32,60,115,116,121,108,101,62,119, -120,67,66,95,68,82,79,80,68,79,87,78,60,47,115,116,121,108,101,62,10,32, -32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101, -99,116,32,99,108,97,115,115,61,34,119,120,83,116,97,116,105,99,84,101,120, -116,34,32,110,97,109,101,61,34,115,116,81,117,111,116,101,67,104,97,114, -34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,81,117,111,116,101,32, -99,104,97,114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,112,111, -115,62,53,44,55,48,100,60,47,112,111,115,62,10,32,32,32,32,60,47,111,98, -106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97, -115,115,61,34,119,120,67,111,109,98,111,66,111,120,34,32,110,97,109,101, -61,34,99,98,81,117,111,116,101,67,104,97,114,34,62,10,32,32,32,32,32,32, -60,99,111,110,116,101,110,116,62,10,32,32,32,32,32,32,32,32,60,105,116, +105,116,101,109,62,124,60,47,105,116,101,109,62,10,32,32,32,32,32,32,32, +32,60,105,116,101,109,62,92,116,60,47,105,116,101,109,62,10,32,32,32,32, +32,32,60,47,99,111,110,116,101,110,116,62,10,32,32,32,32,32,32,60,115,101, +108,101,99,116,105,111,110,62,48,60,47,115,101,108,101,99,116,105,111,110, +62,10,32,32,32,32,32,32,60,112,111,115,62,57,48,44,53,51,100,60,47,112, +111,115,62,10,32,32,32,32,32,32,60,115,105,122,101,62,51,53,44,49,50,100, +60,47,115,105,122,101,62,10,32,32,32,32,32,32,60,115,116,121,108,101,62, +119,120,67,66,95,68,82,79,80,68,79,87,78,60,47,115,116,121,108,101,62,10, +32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106, +101,99,116,32,99,108,97,115,115,61,34,119,120,83,116,97,116,105,99,84,101, +120,116,34,32,110,97,109,101,61,34,115,116,81,117,111,116,101,67,104,97, +114,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,81,117,111,116,101, +32,99,104,97,114,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,112, +111,115,62,53,44,55,48,100,60,47,112,111,115,62,10,32,32,32,32,60,47,111, +98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108, +97,115,115,61,34,119,120,67,111,109,98,111,66,111,120,34,32,110,97,109, +101,61,34,99,98,81,117,111,116,101,67,104,97,114,34,62,10,32,32,32,32,32, +32,60,99,111,110,116,101,110,116,62,10,32,32,32,32,32,32,32,32,60,105,116, 101,109,62,34,60,47,105,116,101,109,62,10,32,32,32,32,32,32,32,32,60,105, 116,101,109,62,39,60,47,105,116,101,109,62,10,32,32,32,32,32,32,60,47,99, 111,110,116,101,110,116,62,10,32,32,32,32,32,32,60,115,101,108,101,99,116, 105,111,110,62,48,60,47,115,101,108,101,99,116,105,111,110,62,10,32,32, -32,32,32,32,60,112,111,115,62,49,48,48,44,54,56,100,60,47,112,111,115,62, -10,32,32,32,32,32,32,60,115,105,122,101,62,50,53,44,49,50,100,60,47,115, -105,122,101,62,10,32,32,32,32,32,32,60,115,116,121,108,101,62,119,120,67, -66,95,68,82,79,80,68,79,87,78,60,47,115,116,121,108,101,62,10,32,32,32, -32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116, +32,32,32,32,60,112,111,115,62,57,48,44,54,56,100,60,47,112,111,115,62,10, +32,32,32,32,32,32,60,115,105,122,101,62,51,53,44,49,50,100,60,47,115,105, +122,101,62,10,32,32,32,32,32,32,60,115,116,121,108,101,62,119,120,67,66, +95,68,82,79,80,68,79,87,78,60,47,115,116,121,108,101,62,10,32,32,32,32, +60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116, 32,99,108,97,115,115,61,34,119,120,83,116,97,116,105,99,84,101,120,116, 34,32,110,97,109,101,61,34,115,116,67,111,108,110,97,109,101,115,34,62, 10,32,32,32,32,32,32,60,108,97,98,101,108,62,67,111,108,117,109,110,32, @@ -35263,35 +35264,37 @@ static unsigned char xml_res_file_76[] = { 115,62,10,32,32,32,32,32,32,60,115,105,122,101,62,49,53,44,45,49,100,60, 47,115,105,122,101,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10, 32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,117,116,116,111,110,34,32,110,97,109,101,61,34,119,120,73,68,95,72,69, -76,80,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,38,97,109,112, -59,72,101,108,112,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,112, -111,115,62,50,44,49,50,53,100,60,47,112,111,115,62,10,32,32,32,32,32,32, -60,115,116,121,108,101,47,62,10,32,32,32,32,60,47,111,98,106,101,99,116, -62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,67,104,101,99,107,66,111,120,34,32,110,97,109,101,61,34,99,104,107, -88,108,115,67,111,112,121,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108, -62,88,108,115,32,102,109,116,32,99,111,112,121,60,47,108,97,98,101,108, -62,10,32,32,32,32,32,32,60,99,104,101,99,107,101,100,62,49,60,47,99,104, -101,99,107,101,100,62,10,32,32,32,32,32,32,60,112,111,115,62,53,53,44,49, -50,53,100,60,47,112,111,115,62,10,32,32,32,32,32,32,60,115,105,122,101, -62,55,48,44,49,50,100,60,47,115,105,122,101,62,10,32,32,32,32,60,47,111, -98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108, -97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97,109,101,61, -34,119,120,73,68,95,79,75,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108, -62,38,97,109,112,59,79,75,60,47,108,97,98,101,108,62,10,32,32,32,32,32, -32,60,100,101,102,97,117,108,116,62,49,60,47,100,101,102,97,117,108,116, -62,10,32,32,32,32,32,32,60,112,111,115,62,49,52,55,44,49,50,53,100,60,47, -112,111,115,62,10,32,32,32,32,32,32,60,115,116,121,108,101,47,62,10,32, -32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101, -99,116,32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34,32, -110,97,109,101,61,34,119,120,73,68,95,67,65,78,67,69,76,34,62,10,32,32, -32,32,32,32,60,108,97,98,101,108,62,38,97,109,112,59,67,97,110,99,101,108, -60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60,100,101,102,97,117,108, -116,62,48,60,47,100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,60,112, -111,115,62,50,48,48,44,49,50,53,100,60,47,112,111,115,62,10,32,32,32,32, -60,47,111,98,106,101,99,116,62,10,32,32,60,47,111,98,106,101,99,116,62, -10,60,47,114,101,115,111,117,114,99,101,62,10}; +67,104,101,99,107,66,111,120,34,32,110,97,109,101,61,34,99,104,107,67,111, +112,121,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,102,111,114, +109,97,116,32,67,79,80,89,60,47,108,97,98,101,108,62,10,32,32,32,32,32, +32,60,99,104,101,99,107,101,100,62,48,60,47,99,104,101,99,107,101,100,62, +10,32,32,32,32,32,32,60,115,105,122,101,62,55,48,44,49,50,100,60,47,115, +105,122,101,62,10,32,32,32,32,32,32,60,112,111,115,62,50,44,49,50,53,100, +60,47,112,111,115,62,10,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32, +32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,67, +104,101,99,107,66,111,120,34,32,110,97,109,101,61,34,99,104,107,88,108, +115,67,111,112,121,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,88, +108,115,32,102,109,116,32,99,111,112,121,60,47,108,97,98,101,108,62,10, +32,32,32,32,32,32,60,99,104,101,99,107,101,100,62,49,60,47,99,104,101,99, +107,101,100,62,10,32,32,32,32,32,32,60,112,111,115,62,56,48,44,49,50,53, +100,60,47,112,111,115,62,10,32,32,32,32,32,32,60,115,105,122,101,62,55, +48,44,49,50,100,60,47,115,105,122,101,62,10,32,32,32,32,60,47,111,98,106, +101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,66,117,116,116,111,110,34,32,110,97,109,101,61,34,119, +120,73,68,95,79,75,34,62,10,32,32,32,32,32,32,60,108,97,98,101,108,62,38, +97,109,112,59,79,75,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,60, +100,101,102,97,117,108,116,62,49,60,47,100,101,102,97,117,108,116,62,10, +32,32,32,32,32,32,60,112,111,115,62,49,52,55,44,49,50,53,100,60,47,112, +111,115,62,10,32,32,32,32,32,32,60,115,116,121,108,101,47,62,10,32,32,32, +32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,66,117,116,116,111,110,34,32,110,97, +109,101,61,34,119,120,73,68,95,67,65,78,67,69,76,34,62,10,32,32,32,32,32, +32,60,108,97,98,101,108,62,38,97,109,112,59,67,97,110,99,101,108,60,47, +108,97,98,101,108,62,10,32,32,32,32,32,32,60,100,101,102,97,117,108,116, +62,48,60,47,100,101,102,97,117,108,116,62,10,32,32,32,32,32,32,60,112,111, +115,62,50,48,48,44,49,50,53,100,60,47,112,111,115,62,10,32,32,32,32,60, +47,111,98,106,101,99,116,62,10,32,32,60,47,111,98,106,101,99,116,62,10, +60,47,114,101,115,111,117,114,99,101,62,10}; static size_t xml_res_size_77 = 1443; static unsigned char xml_res_file_77[] = {