This commit is contained in:
lsv 2026-06-09 18:26:23 +05:00
commit cb58e91edd
6 changed files with 100 additions and 6 deletions

View file

@ -20,6 +20,14 @@ cmake --build . --config Release --target all -j 3 --
Могут быть проблемы с отсутствующем файлом файлом kwlist.h
Его можно взять в исходниках Postgresql 15 и положить в include/parser/
Особенности/проблемы Linux
Некоторых комбинации могут быть перехвачены оконными менеджерами:
F10. Отключение в настройках комбинаций клавиш оконного менеджера.
ALT+Левая кнопка мыши на колонке результата. Отключение:
Для XFCE: xfconf-query -c xfwm4 -p /general/easy_click -s none
ОС для сборки использовал «Альт Рабочая станция» 10
https://www.basealt.ru/alt-workstation/download#c1211

View file

@ -381,6 +381,7 @@ void ctlSQLBox::OnDiff(wxCommandEvent& ev) {
if (wxTheClipboard->GetData(textData)) {
sql_1 = textData.GetText();
} else {
wxTheClipboard->Close();
return;
}
@ -1911,7 +1912,8 @@ wxString ctlSQLBox::TextToHtml(int start, int end,bool isAddNewLine, const std::
refreshgbcolor=true;
bgclr="#ffff00";
tmppos=IndicatorEnd(indic,epos);
if (tmppos==textlen) spos=-1;
if (tmppos==textlen)
spos=-1;
else spos=tmppos;
} else if (startp>=epos && epos!=-1) {
bgclr="";
@ -1919,6 +1921,12 @@ wxString ctlSQLBox::TextToHtml(int start, int end,bool isAddNewLine, const std::
tmppos=IndicatorEnd(indic,spos);
if (tmppos==textlen) epos=-1;
else epos=tmppos;
if (spos==-1) epos=-1;
if (newlineadd)
{
// if add only \n
str+=lstr; lstr=""; newlineadd=false;
}
}
if (prevColor != tColor || refreshgbcolor) {
str+= wxT("</span><span style=\"color:");

View file

@ -8,9 +8,9 @@
// frmDatabaseDesigner.cpp - The database designer form
//
//////////////////////////////////////////////////////////////////////////
#ifdef DATABASEDESIGNER
#include "pgAdmin3.h"
// wxWindows headers
#include <wx/wx.h>
#include <wx/dcbuffer.h>
@ -927,3 +927,4 @@ wxWindow *databaseDesignerFactory::StartDialog(frmMain *form, pgObject *obj)
qry = obj->GetSql(form->GetBrowser());
return StartDialogDesigner(form, obj, qry);
}
#endif

View file

@ -3138,6 +3138,10 @@ void frmQuery::OnExecute(wxCommandEvent &event)
void frmQuery::OnExecScript(wxCommandEvent &event)
{
#ifdef NO_PGSCRIPT
wxMessageBox(("pgScript disable."), ("Disable compile support pgScript."), wxICON_WARNING | wxOK);
return;
#endif
// Get the script
wxString query = sqlQuery->GetSelectedText();
if (query.IsNull())

View file

@ -134,7 +134,6 @@ public:
ctlR->IndicatorSetAlpha(s_indicHighlight, 50);
ctlR->IndicatorSetStyle(s_indicHighlight, wxSTC_INDIC_ROUNDBOX);
ctlR->SetIndicatorCurrent(s_indicHighlight);
while (it != diffs.end()) // <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
{
aDiff = *it;
@ -154,7 +153,8 @@ public:
cl.table=escapeHtml(t,false);
cl.table.Replace("\t","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
cl.level=s_indicHighlight;
cl.startIndex=ctlR->GetTextLength();
// Scintillia not support length text in chars
cl.startIndex=ctlR->GetText().Length();
FSQL::complite_element prev;
if (listdelete.size()>0) {
prev=listdelete[listdelete.size()-1];
@ -192,7 +192,7 @@ public:
FSQL::complite_element cl={};
cl.table=escapeHtml("\n",false);
cl.level=s_indicHighlight;
cl.startIndex=ctlR->GetTextLength();
cl.startIndex=ctlR->GetText().Length();
FSQL::complite_element prev;
if (listdelete.size()>0) {
prev=listdelete[listdelete.size()-1];
@ -400,6 +400,9 @@ public:
t->SetFirstVisibleLine(l);
int cl=t->GetColumn(start);
t->ScrollToColumn(cl);
// sync line visible position other window
if (t!=m_text2) m_text2->SetFirstVisibleLine(l);
if (t!=m_text1) m_text1->SetFirstVisibleLine(l);
break;
}
else {
@ -470,10 +473,14 @@ public:
}
void onHtmlDiff(wxCommandEvent& evt) {
if (m_text2->GetLength()>0) {
m_text2->Colourise(0,m_text2->GetLastPosition());
wxString html=m_text2->TextToHtml(0,m_text2->GetLength(),false,listdelete);
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData(new wxHTMLDataObject(html));
wxDataObjectComposite* dataobj = new wxDataObjectComposite();
dataobj->Add(new wxTextDataObject(html));
dataobj->Add(new wxHTMLDataObject(html));
wxTheClipboard->SetData(dataobj);
wxTheClipboard->Close();
}
@ -484,6 +491,8 @@ public:
wxWindow *wnd = lastfocus;
wxString html;
if (wnd) {
m_text2->Colourise(0,m_text2->GetLastPosition());
m_text1->Colourise(0,m_text1->GetLastPosition());
if (m_text2==wnd) html=m_text2->TextToHtml(0,m_text2->GetLength(),false);
if (m_text1==wnd) html=m_text1->TextToHtml(0,m_text1->GetLength(),false);
if (html.Length()>0 && wxTheClipboard->Open())

View file

@ -11,6 +11,7 @@
#ifndef PGSAPP_H_
#define PGSAPP_H_
#ifndef NO_PGSCRIPT
#include "pgscript/pgScript.h"
#include "pgscript/utilities/pgsThread.h"
@ -124,5 +125,68 @@ private:
pgsApplication &operator=(const pgsApplication &that);
};
#else
//NO_PGSCRIPT
#define pgsOutputStream wxTextOutputStream
class pgsApplication
{
public:
static const int default_port = 5432;
pgsApplication(pgConn *connection) {};
/** Deletes custom connection if one was created (first constructor). */
/** Parses a file by creating a new thread. */
bool ParseFile(const wxString &file, pgsOutputStream &out,
wxMBConv *conv = &wxConvLocal) {return false;};
/** Parses a string by creating a new thread. */
bool ParseString(const wxString &string, pgsOutputStream &out) {return false;};
/** Is m_thread running? */
bool IsRunning() {return false;};
/** If m_thread is running then wait for it to terminate. */
void Wait();
/** If m_thread is running then delete it. */
void Terminate() {};
/** Called by m_thread when the thread is finished: IsRunning() becomes
* false and m_event_id is pushed into the event queue if m_caller exists. */
void Complete() {};
/** Uses a new database connection instead of the previous one. If the
* previous one was user-defined then it is deleted otherwise it is just
* replaced with the new one. */
void SetConnection(pgConn *conn) {};
/** Deletes everything in the symbol table. */
void ClearSymbols() {};
#if !defined(PGSCLI)
/** Used in pgAdmin integration for sending an event to the caller when the
* thread is finishing its task. */
void SetCaller(wxWindow *caller, long event_id) {};
#endif // PGSCLI
/** Tells whether the database connection is valid. */
bool IsConnectionValid() const { return true;};
/** Gets a lock on the output stream. */
void LockOutput() {};
/** Releases the lock on the output stream. */
void UnlockOutput() {};
/** Was there an error? */
bool errorOccurred() const {return false;};
/** Get the position (line) of the last error. */
int errorLine() const {return 0;};
private:
};
#endif
#endif /*PGSAPP_H_*/