NSIS Menu POSIX fixes (bug #1144)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6758 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
7fff5828ad
commit
e922c1b182
6 changed files with 232 additions and 142 deletions
|
@ -16,7 +16,7 @@
|
|||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
#if wxUSE_HTML && wxUSE_STREAMS && !defined(NSISMENU_NOLINKTAGHANDLER)
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
@ -24,12 +24,18 @@
|
|||
#include "wx/html/forcelnk.h"
|
||||
#include "wx/html/m_templ.h"
|
||||
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
FORCE_LINK_ME(nslinks)
|
||||
|
||||
class wxHtmlAnchorCell : public wxHtmlCell
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <nsis-sconf.h>
|
||||
|
||||
FORCE_LINK_ME(nslinks)
|
||||
|
||||
// TODO: These helper function declarations should be in a header file
|
||||
typedef enum { SUT_UNKNOWN = 0, SUT_BIN = 0x14, SUT_DOC = 0x24, SUT_WEB = 0x34 } SPECIALURLTYPE;
|
||||
SPECIALURLTYPE TransformUrl(wxString&Url);
|
||||
|
||||
class wxHtmlAnchorCell : public wxHtmlCell
|
||||
{
|
||||
private:
|
||||
wxString m_AnchorName;
|
||||
|
@ -44,45 +50,38 @@ public:
|
|||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlAnchorCell)
|
||||
};
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(A, "A")
|
||||
TAG_HANDLER_CONSTR(A) { }
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
|
||||
|
||||
|
||||
TAG_HANDLER_BEGIN(A, "A")
|
||||
TAG_HANDLER_CONSTR(A) { }
|
||||
|
||||
TAG_HANDLER_PROC(tag)
|
||||
{
|
||||
if (tag.HasParam( wxT("HREF") ))
|
||||
{
|
||||
wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
|
||||
wxColour oldclr = m_WParser->GetActualColor();
|
||||
wxString name(tag.GetParam( wxT("HREF") )), target;
|
||||
|
||||
if (tag.HasParam( wxT("TARGET") )) target = tag.GetParam( wxT("TARGET") );
|
||||
|
||||
wxColour colour = m_WParser->GetLinkColor();
|
||||
wxHtmlLinkInfo linkInfo(name, target);
|
||||
|
||||
if (name.Left(3).IsSameAs((const wxChar*) wxT("EX:"), false))
|
||||
{
|
||||
wxString url = name.Mid(3);
|
||||
if (!url.Left(7).IsSameAs((const wxChar*) wxT("http://"), false) && !url.Left(6).IsSameAs((const wxChar*) wxT("irc://"), false))
|
||||
{
|
||||
wxString exePath = wxStandardPaths::Get().GetExecutablePath();
|
||||
wxString path = ::wxPathOnly(exePath);
|
||||
path.Append(wxFileName::GetPathSeparators()[0]);
|
||||
path.Append(url);
|
||||
|
||||
if (!::wxFileExists(path) && !::wxDirExists(path))
|
||||
{
|
||||
colour = wxColour(0x80, 0x80, 0x80);
|
||||
linkInfo = wxHtmlLinkInfo(wxT("notinstalled.html"), target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_WParser->SetActualColor(colour);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(colour));
|
||||
{
|
||||
wxHtmlLinkInfo oldlnk = m_WParser->GetLink();
|
||||
wxColour oldclr = m_WParser->GetActualColor();
|
||||
wxString href(tag.GetParam( wxT("HREF") )), target;
|
||||
|
||||
if (tag.HasParam( wxT("TARGET") )) target = tag.GetParam( wxT("TARGET") );
|
||||
|
||||
wxColour colour = m_WParser->GetLinkColor();
|
||||
wxHtmlLinkInfo linkInfo(href, target);
|
||||
|
||||
wxString location = href;
|
||||
SPECIALURLTYPE ut = TransformUrl(location);
|
||||
if (ut == SUT_BIN || ut == SUT_DOC)
|
||||
{
|
||||
if (!wxFileExists(location) && !wxDirExists(location))
|
||||
{
|
||||
colour = wxColour(0x80, 0x80, 0x80);
|
||||
linkInfo = wxHtmlLinkInfo(wxT("notinstalled.html"), target);
|
||||
}
|
||||
}
|
||||
|
||||
m_WParser->SetActualColor(colour);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(colour));
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
m_WParser->SetLink(linkInfo);
|
||||
|
||||
|
@ -95,18 +94,18 @@ TAG_HANDLER_BEGIN(A, "A")
|
|||
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(A)
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(CustomLinks)
|
||||
|
||||
TAGS_MODULE_ADD(A)
|
||||
|
||||
TAGS_MODULE_END(CustomLinks)
|
||||
|
||||
else return false;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(A)
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(Links)
|
||||
|
||||
TAGS_MODULE_ADD(A)
|
||||
|
||||
TAGS_MODULE_END(Links)
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue