Using anchors in the function help.

Добавлена возможность использовать файлы справки на прямую, но с учётом структуры справки Postgresql.
This commit is contained in:
lsv 2025-11-28 14:27:46 +05:00
parent 47fda8071f
commit 20e91cda3c
4 changed files with 135 additions and 3 deletions

View file

@ -5,7 +5,7 @@
#include <wx/regex.h>
#include <map>
#include <vector>
struct anchor_src { int start ;int end; wxString id;};
class FunctionPGHelper
{
public:
@ -27,13 +27,17 @@ public:
int GetTimerClose() { return m_interval; }
void Add(const wxString& key, const wxString& v) { body.emplace(key, v); }
wxString getHelpString(wxString fnd, bool isPart = true) ;
// Загружаем файл и формируем якоря
wxString getHelpFile(wxString filename);
wxString getSqlCommandHelp(wxString fnd);
bool isValid();
void setDbConn(pgConn *db);
// Ищем ключевое слово в объектах БД
wxString getDBinfoKeyword(wxString objname,bool islower);
// Ищем файлы справки для команд sql
wxString getSqlCommandHelp(wxString fnd);
// получим текст по якорю
wxString getTextForAnchor(wxString filename);
private:
bool isload = false;
int m_interval = -1;
@ -41,6 +45,9 @@ private:
std::map<wxString, wxString> body;
// db connect
pgConn *dblast;
//
std::vector<anchor_src> an;
wxString filecontext;
void loadfile();
};

View file

@ -136,6 +136,13 @@ public:
wxHtmlLinkInfo i = event.GetLinkInfo();
wxString name = i.GetHref();
wxString body;
if (name.Len()>1 && name[0]=='#') {
body=this->hhelper->getTextForAnchor(name);
if (body.Len()>0) {
SetPage(body);
}
return;
}
body=this->hhelper->getDBinfoKeyword(name,false);
if (body.IsEmpty()) {
body=this->hhelper->getHelpString(name);
@ -152,6 +159,20 @@ public:
Hide();
return;
}
if (event.GetKeyCode() == WXK_NUMPAD_ADD) {
wxSize sz=this->GetSize();
wxSize szh=htmlWindow->GetSize();
szh.IncBy(50,50);
htmlWindow->SetSize(szh);
std::cout << sz.GetWidth() << "," << sz.GetHeight() << std::endl;
sz.IncBy(50,50);
this->SetSizePopup(sz);
wxPoint p;
p=this->GetScreenPosition();
p.x=p.x-50;
p.y=p.y-50;
//this->Move(p);
}
});
htmlWindow->Bind(wxEVT_RIGHT_UP, [&](wxMouseEvent& event) {
wxString name;