From 90c328085ede2acac13a923692caec761aab8d54 Mon Sep 17 00:00:00 2001 From: lsv Date: Fri, 27 Feb 2026 12:08:43 +0500 Subject: [PATCH] A hotkey Ctrl-F1 to JSON options. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлена справка "Ctrl-F1" по командам редактирования настроек JSON. --- ctl/ctlTreeJSON.cpp | 25 ++++++++++++++-- include/utils/misc.h | 1 + utils/misc.cpp | 70 +++++++++++++++++++++++++++++--------------- 3 files changed, 71 insertions(+), 25 deletions(-) diff --git a/ctl/ctlTreeJSON.cpp b/ctl/ctlTreeJSON.cpp index 9f16051..900f234 100644 --- a/ctl/ctlTreeJSON.cpp +++ b/ctl/ctlTreeJSON.cpp @@ -53,11 +53,32 @@ void ctlTreeJSON::OnChar(wxKeyEvent& event) { } } + if (event.GetKeyCode() == WXK_F1) { + int x=50; + int y=50; + this->ClientToScreen(&x,&y); + wxPoint screenPos(x,y); + wxString helpstr=R"( + + + + +

Ctrl-F - find and colorize nodes

+

F3 - next find node

+

Shift-F3 - previos find node

+

Insert - copy select node

+

Delete - delete select node

+

Ctrl-Z - Return source context node.

+ +)"; + showHelpHtml(this,helpstr,screenPos, wxSize(450,300)); + return; + } if (event.GetKeyCode() == WXK_CONTROL_F) { wxTextEntryDialog dialog(this, - wxT("Please enter find string\n") + _("Please enter find string\n") , - wxT("Find"), + _("Find"), m_FindString, wxOK | wxCANCEL); //setName( dlg.GetValue().wc_str() ); if (dialog.ShowModal() == wxID_OK) { diff --git a/include/utils/misc.h b/include/utils/misc.h index 06f379d..0630bc8 100644 --- a/include/utils/misc.h +++ b/include/utils/misc.h @@ -280,6 +280,7 @@ wxString qtIdent(const wxString &value); // add " if necessary wxString qtTypeIdent(const wxString &value); // add " if necessary bool make_identifier(const wxString &strname, wxString &s, wxString &n, bool islower); +void showHelpHtml(wxWindow *parent, const wxString &htmlHelp,wxPoint screenPos, wxSize size); #endif diff --git a/utils/misc.cpp b/utils/misc.cpp index 9af20da..1c51506 100644 --- a/utils/misc.cpp +++ b/utils/misc.cpp @@ -1483,28 +1483,52 @@ bool make_identifier(const wxString &strname, wxString &s, wxString &n, bool isl } else {if (islower) s=s.MakeLower();} return true; } -/* -class DirCopyTraverser: public wxDirTraverser { -public: - DirCopyTraverser(const wxString &destBase): m_destBase(destBase) {} - virtual wxDirTraverseResult OnFile(const wxString &file) wxOVERRIDE { - wxFileName srcFile(file); - //wxString relativePath=srcFile.GetPath(wxPATH_DOS,true); - srcFile.MakeRelativeTo(m_destBase); - wxString destFile=m_destBase+wxFileName::GetPathSeparator()+srcFile.GetFullName(); - wxFileName destDir(destFile); - destDir.RemoveLastDir(); - if (!destDir.DirExists()) destDir.Mkdir(wxS_DIR_DEFAULT,wxPATH_MKDIR_FULL); - if (!wxCopyFile(file,destFile,true)) { - wxLogError("Error copy file %s",file); - return wxDIR_STOP; + +//show help window +void showHelpHtml(wxWindow *parent, const wxString &htmlHelp,wxPoint screenPos, wxSize size) { + FunctionPGHelper fh(htmlHelp); + wxString key = "content"; + // screen size + wxPoint posScreen; + wxSize sizeScreen; + const int displayNum = wxDisplay::GetFromPoint(screenPos); + if (displayNum != wxNOT_FOUND) + { + const wxRect rectScreen = wxDisplay(displayNum).GetGeometry(); + posScreen = rectScreen.GetPosition(); + sizeScreen = rectScreen.GetSize(); } - return wxDIR_CONTINUE; - } - virtual wxDirTraverseResult OnDir(const wxString &file) wxOVERRIDE { - return 0; - } -private: - wxString m_destBase; + else // outside of any display? + { + // just use the primary one then + posScreen = wxPoint(0, 0); + sizeScreen = wxGetDisplaySize(); + } + + wxSize rr(350, 70); + if (size.x!=-1) rr=size; + popuphelp *m_Popup = new popuphelp(parent, key, &fh, screenPos, rr); + if (m_Popup && m_Popup->IsValid() && rr != m_Popup->GetSizePopup()) { + // recreate with new size + rr = m_Popup->GetSizePopup(); + delete m_Popup; + m_Popup = new popuphelp((wxWindow*)winMain, key, &fh, screenPos, rr); + } + if (m_Popup && m_Popup->IsValid()) { + wxSize top_sz = m_Popup->GetSizePopup(); + wxSize top_new(top_sz); + wxPoint p(screenPos); + wxPoint oldp(p); + if (p.x + top_new.x > sizeScreen.x) p.x = sizeScreen.x - top_new.x - 20; + if (p.y + top_new.y > sizeScreen.y) p.y = sizeScreen.y - top_new.y - 20; + if (oldp == p) p.x = p.x + 20; + m_Popup->Move(p); + wxRect r = m_Popup->GetScreenRect(); + m_Popup->Popup(); + } + + } -*/ \ No newline at end of file + + +