build NSIS Menu from source (requires wxWidgets)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4958 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
1a7016361c
commit
b8bf22affb
20 changed files with 792 additions and 3060 deletions
|
@ -3,7 +3,7 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include <wx/wxprec.h>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
|
@ -12,12 +12,16 @@
|
|||
// for all others, include the necessary headers (this file is usually all you
|
||||
// need because it includes almost all "standard" wxWindows headers
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include <wx/wx.h>
|
||||
#endif
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "wx/html/htmlwin.h"
|
||||
#include "wx/html/htmlproc.h"
|
||||
#include <wx/event.h>
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/html/htmlwin.h>
|
||||
#include <wx/html/htmlproc.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
|
@ -42,6 +46,9 @@ class MyFrame : public wxFrame
|
|||
public:
|
||||
// ctor(s)
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
// event handler(s)
|
||||
void OnLink(wxHtmlLinkEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
private:
|
||||
wxHtmlWindow *m_Html;
|
||||
|
@ -58,7 +65,7 @@ private:
|
|||
enum
|
||||
{
|
||||
// controls start here (the numbers are, of course, arbitrary)
|
||||
Minimal_Text = 1000
|
||||
HtmlControl = 1000
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -69,6 +76,7 @@ private:
|
|||
// handlers) which process them. It can be also done at run-time, but for the
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_HTML_LINK_CLICKED(HtmlControl, OnLink)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Create a new application object: this macro will allow wxWindows to create
|
||||
|
@ -90,19 +98,19 @@ private:
|
|||
{
|
||||
wxInitAllImageHandlers();
|
||||
|
||||
// Create the main application window
|
||||
MyFrame *frame = new MyFrame(_("NSIS Menu"),
|
||||
wxPoint(50, 50), wxSize(612 + (GetSystemMetrics(SM_CXEDGE) * 2), 353 + GetSystemMetrics(SM_CYSIZE) + (GetSystemMetrics(SM_CXEDGE) * 2)));
|
||||
// Create the main application window
|
||||
MyFrame *frame = new MyFrame(_("NSIS Menu"),
|
||||
wxPoint(50, 50), wxSize(600 + GetSystemMetrics(SM_CXDLGFRAME), 382 + GetSystemMetrics(SM_CYDLGFRAME)));
|
||||
|
||||
// Show it and tell the application that it's our main window
|
||||
// Show it and tell the application that it's our main window
|
||||
|
||||
frame->Show(TRUE);
|
||||
SetTopWindow(frame);
|
||||
frame->Show(TRUE);
|
||||
SetTopWindow(frame);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// application would exit immediately.
|
||||
return TRUE;
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// application would exit immediately.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -112,23 +120,54 @@ private:
|
|||
|
||||
// frame constructor
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size, wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION,
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size, wxCLOSE_BOX | wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION,
|
||||
wxT("nsis_menu"))
|
||||
{
|
||||
m_Html = new wxHtmlWindow(this);
|
||||
m_Html = new wxHtmlWindow(this, HtmlControl);
|
||||
m_Html->SetRelatedFrame(this, _("NSIS Menu"));
|
||||
m_Html->SetBorders(0);
|
||||
|
||||
// Set font size
|
||||
wxWindow UnitConvert;
|
||||
wxSize DialogSize(1000, 1000);
|
||||
DialogSize = UnitConvert.ConvertDialogToPixels(DialogSize);
|
||||
int fonts[7] = {0, 0, 20000 / (DialogSize.GetWidth()), 25000 / (DialogSize.GetWidth()), 0, 0, 0};
|
||||
m_Html->SetFonts("", "", fonts);
|
||||
|
||||
m_Html->LoadPage(wxT("Menu/index.html"));
|
||||
|
||||
this->Centre(wxBOTH);
|
||||
this->SetIcon(wxICON(nsisicon));
|
||||
m_Html->SetBorders(0);
|
||||
m_Html->EnableScrolling(false, false);
|
||||
|
||||
// Set font size
|
||||
wxWindow UnitConvert;
|
||||
wxSize DialogSize(1000, 1000);
|
||||
DialogSize = UnitConvert.ConvertDialogToPixels(DialogSize);
|
||||
int fonts[7] = {0, 0, 14000 / (DialogSize.GetWidth()), 19000 / (DialogSize.GetWidth()), 0, 0, 0};
|
||||
m_Html->SetFonts("", "", fonts);
|
||||
|
||||
m_Html->LoadPage(wxT("Menu/index.html"));
|
||||
|
||||
this->Centre(wxBOTH);
|
||||
this->SetIcon(wxICON(nsisicon));
|
||||
}
|
||||
|
||||
}
|
||||
// event handler
|
||||
|
||||
void MyFrame::OnLink(wxHtmlLinkEvent& event)
|
||||
{
|
||||
const wxMouseEvent *e = event.GetLinkInfo().GetEvent();
|
||||
if (e == NULL || e->LeftUp())
|
||||
{
|
||||
const wxString href = event.GetLinkInfo().GetHref();
|
||||
if (href.Left(3).IsSameAs("EX:", false))
|
||||
{
|
||||
wxString url = href.Mid(3);
|
||||
if (url.Left(7).IsSameAs("http://", false) || url.Left(6).IsSameAs("irc://", false))
|
||||
{
|
||||
::wxLaunchDefaultBrowser(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString exePath = wxStandardPaths::Get().GetExecutablePath();
|
||||
wxString path = ::wxPathOnly(exePath);
|
||||
path.Append(wxFileName::GetPathSeparators()[0]);
|
||||
path.Append(url);
|
||||
::wxLaunchDefaultBrowser(path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nsismenu", "nsismenu.vcproj", "{598BB726-F3FC-43A4-9E39-A1F9AD153F05}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{598BB726-F3FC-43A4-9E39-A1F9AD153F05}.Debug.ActiveCfg = Debug|Win32
|
||||
{598BB726-F3FC-43A4-9E39-A1F9AD153F05}.Debug.Build.0 = Debug|Win32
|
||||
{598BB726-F3FC-43A4-9E39-A1F9AD153F05}.Release.ActiveCfg = Release|Win32
|
||||
{598BB726-F3FC-43A4-9E39-A1F9AD153F05}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,164 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="nsismenu"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/I..\lib\msw "
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="../include"
|
||||
PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,WINVER=0x400,_MT,wxUSE_GUI=1"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/nsismenu.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib ..\lib\zlib.lib ..\lib\wxmsw.lib"
|
||||
OutputFile=".\Release\NSIS.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
ProgramDatabaseFile=".\Release/nsismenu.pdb"
|
||||
SubSystem="2"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/nsismenu.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="../include"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/I..\lib\mswd "
|
||||
Optimization="1"
|
||||
AdditionalIncludeDirectories="../include"
|
||||
PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,WINVER=0x400,_MT,wxUSE_GUI=1,__WXDEBUG__,WXDEBUG=1"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/nsismenu.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib ..\lib\zlibd.lib ..\lib\wxmswd.lib"
|
||||
OutputFile=".\Debug\NSIS.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/nsismenu.pdb"
|
||||
SubSystem="2"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/nsismenu.tlb"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="../include"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="wx\msw\hand.cur">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="nsisicon.ico">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="nsismenu.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="nsismenu.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="resource.h">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
109
Contrib/NSIS Menu/nsismenu/nslinks.cpp
Normal file
109
Contrib/NSIS Menu/nsismenu/nslinks.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/html/m_links.cpp
|
||||
// Purpose: wxHtml module for links & anchors
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id: m_links.cpp,v 1.18 2006/04/18 08:11:25 ABX Exp $
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_HTML && wxUSE_STREAMS
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#endif
|
||||
|
||||
#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
|
||||
{
|
||||
private:
|
||||
wxString m_AnchorName;
|
||||
|
||||
public:
|
||||
wxHtmlAnchorCell(const wxString& name) : wxHtmlCell()
|
||||
{ m_AnchorName = name; }
|
||||
void Draw(wxDC& WXUNUSED(dc),
|
||||
int WXUNUSED(x), int WXUNUSED(y),
|
||||
int WXUNUSED(view_y1), int WXUNUSED(view_y2),
|
||||
wxHtmlRenderingInfo& WXUNUSED(info)) {}
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxHtmlAnchorCell)
|
||||
};
|
||||
|
||||
|
||||
|
||||
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("EX:", false))
|
||||
{
|
||||
wxString url = name.Mid(3);
|
||||
if (!url.Left(7).IsSameAs("http://", false) && !url.Left(6).IsSameAs("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("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);
|
||||
|
||||
ParseInner(tag);
|
||||
|
||||
m_WParser->SetLink(oldlnk);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont()));
|
||||
m_WParser->SetActualColor(oldclr);
|
||||
m_WParser->GetContainer()->InsertCell(new wxHtmlColourCell(oldclr));
|
||||
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
TAG_HANDLER_END(A)
|
||||
|
||||
|
||||
|
||||
TAGS_MODULE_BEGIN(CustomLinks)
|
||||
|
||||
TAGS_MODULE_ADD(A)
|
||||
|
||||
TAGS_MODULE_END(CustomLinks)
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue