The new Release 20.03 is out! You can download binaries for Windows and many major Linux distros here .
/*! Here is a snapshot of my new application: * \image html application.jpg * \image latex application.eps "My application" width=10cm */
why not display it within a popup contex window, like message tips? And provide a entry to let the user have a change to show a big view via web browser.
And, how many people will use this feature?
diff --git a/src/sdk/cbeditor.cpp b/src/sdk/cbeditor.cppindex 71622d79..2a76d8a9 100644--- a/src/sdk/cbeditor.cpp+++ b/src/sdk/cbeditor.cpp@@ -393,7 +393,7 @@ struct cbEditorInternalData } } - wxString GetUrl()+ wxString GetUrl(wxString filename = wxEmptyString) { cbStyledTextCtrl* control = m_pOwner->GetControl(); if (!control)@@ -409,6 +409,9 @@ struct cbEditorInternalData ")" "(\\/?)([\\w\\-\\.\\?\\,\\'\\/\\\\\\+&%\\$#]*)?" "([\\d\\w\\.\\/\\%\\+\\-\\=\\&\\?\\:\\\\\\"\\'\\,\\|\\~\\;]*)"));++ wxRegEx reFile(R"raw([A-Za-z0-9]+\.(jpg|jpeg|png|gif|bmp|svg))raw");+ wxString url = control->GetSelectedText(); // Is the URL selected? if (reUrl.Matches(url))@@ -456,6 +459,31 @@ struct cbEditorInternalData else url = wxEmptyString; // nope, too far from cursor, return invalid (empty) }+ else if (reFile.Matches(url))+ {+ wxString match = reFile.GetMatch(url);+ if ((url.Find(match) + startPos < control->GetCurrentPos()) &&+ (url.Find(match) + startPos + (int)match.Length() > control->GetCurrentPos()))+ {+ // Translate short file path to absolute file path using the current source file path+ // match is some string like "xyz.jpg" or "xyz.png"+ if (match.IsEmpty())+ {+ return wxT("file:///") + match;+ }+ else+ {+ // suppose we are editing a file named : "c:/abc/def.cpp"+ // the file contains some piece of the comments which is "xyz.jpg"+ // we create an absolute file path of the image file named "c:/abc/xyz.jpg"+ wxFileName baseFilename(filename);+ wxFileName newFilename(baseFilename.GetPath(), match);+ return wxT("file:///") + newFilename.GetFullPath();+ }+ }+ else+ url = wxEmptyString; // nope, too far from cursor, return invalid (empty)+ } else url = wxEmptyString; // nope, return invalid (empty) @@ -3289,7 +3317,7 @@ void cbEditor::OnContextMenuEntry(wxCommandEvent& event) else if (id == idFoldingToggleCurrent) ToggleFoldBlockFromLine(); else if (id == idOpenUrl)- wxLaunchDefaultBrowser(m_pData->GetUrl());+ wxLaunchDefaultBrowser(m_pData->GetUrl(GetFilename())); else if (id == idSplitHorz) Split(stHorizontal); else if (id == idSplitVert)
wxRegEx reUrl(wxT("***:(" "((ht|f)tp(s?)\\:\\/\\/)" "|(www\\.)" ")" "(" "([\\w\\-]+(\\.[\\w\\-]+)+)" "|localhost" ")" "(\\/?)([\\w\\-\\.\\?\\,\\'\\/\\\\\\+&%\\$#]*)?" "([\\d\\w\\.\\/\\%\\+\\-\\=\\&\\?\\:\\\\\\"\\'\\,\\|\\~\\;]*)"));