11 Commits

Author SHA1 Message Date
Simon Rozman
c21aa27e62 URL encoding/decoding added
API level changed to 13
2016-05-31 14:49:52 +02:00
Simon Rozman
e25bce487b Missing #include added 2016-05-24 14:22:00 +02:00
Simon Rozman
cdefd74f3f wxHexValidator extended with leading zeros support
Version set to 1.2
2016-05-23 14:05:37 +02:00
Simon Rozman
28f244cf2f German and Russian translation stub added 2016-05-13 20:03:44 +02:00
Simon Rozman
3d873f060b - wxHexValidator template added
- Translation file now suffixed with version to allow side by side installation of different wxExtend versions
- Version set to 1.1 (API Level 11)
2016-05-12 14:11:34 +02:00
Simon Rozman
4055f49f03 wxPersistentDialog class for saving dialog position added 2016-05-12 14:07:01 +02:00
Simon Rozman
981cdc370b Missing tool reference added 2016-05-09 11:01:23 +02:00
Simon Rozman
63e206a7ab vwVERIFY macro non-executing issue fixed 2016-05-06 12:09:10 +02:00
Simon Rozman
5a372f955b Version set to 1.0.1 2016-05-03 13:17:40 +02:00
Simon Rozman
d32c8b79dc wxPersistentAuiManager class for wxAuiManager state save and restore support added 2016-05-03 13:17:15 +02:00
Simon Rozman
7627cabc1b Doxygen support added 2016-04-11 13:52:23 +02:00
22 changed files with 3231 additions and 70 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/doc
*.user
temp

2312
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -40,13 +40,13 @@ Component ComponentId Directory_ Attributes Condition KeyPath
s$(MSIBUILD_LENGTH_ID) S38 s$(MSIBUILD_LENGTH_ID) i2 S255 S$(MSIBUILD_LENGTH_ID)
Component Component
!IF "$(PLAT)" == "Win32"
compwxExtend.dll.Win32 {CF0DA67E-4D98-4059-9ECA-CB0DE44E92EB} $(WXEXTEND_BIN_DIR) 0 filewxExtend.dll.Win32
compwxExtend.dll.Win32 {7645D753-4A8C-40C6-BD6F-6DDE54F2B8F8} $(WXEXTEND_BIN_DIR) 0 filewxExtend.dll.Win32
!ENDIF
!IF "$(PLAT)" == "x64"
compwxExtend.dll.x64 {02F1022D-AA80-4FCA-A6F2-C576C405E1B2} $(WXEXTEND_BIN_DIR) 256 filewxExtend.dll.x64
compwxExtend.dll.x64 {919135CB-B106-467E-A3DA-CBC463FBB7FF} $(WXEXTEND_BIN_DIR) 256 filewxExtend.dll.x64
!ENDIF
!IF "$(LANG)" == "Sl"
compwxExtend.mo.sl_SI {60770F71-A7B4-4B20-9535-726049A5D412} WXEXTENDLOCSLSIDIR $(MSIBUILD_COMPONENT_ATTRIB_FILE) filewxExtend.mo.sl_SI
compwxExtend.mo.sl_SI {08656BB6-0887-4605-B6D3-20B0444624BA} WXEXTENDLOCSLSIDIR $(MSIBUILD_COMPONENT_ATTRIB_FILE) filewxExtend.mo.sl_SI
!ENDIF
<<NOKEEP
@@ -79,22 +79,22 @@ s$(MSIBUILD_LENGTH_ID) s$(MSIBUILD_LENGTH_ID) l255 i4 S$(MSIBUILD_LENGTH_ID) S20
File File
!IF "$(PLAT)" == "Win32"
!IF "$(CFG)" == "Release"
filewxExtend.dll.Win32 compwxExtend.dll.Win32 WXEXTE~2.DLL|wxExtend10u_vc100.dll 0 0 1536 1
filewxExtend.dll.Win32 compwxExtend.dll.Win32 WXEXTE~2.DLL|wxExtend13u_vc100.dll 0 0 1536 1
!ENDIF
!IF "$(CFG)" == "Debug"
filewxExtend.dll.Win32 compwxExtend.dll.Win32 WXEXTE~4.DLL|wxExtend10ud_vc100.dll 0 0 1536 1
filewxExtend.dll.Win32 compwxExtend.dll.Win32 WXEXTE~4.DLL|wxExtend13ud_vc100.dll 0 0 1536 1
!ENDIF
!ENDIF
!IF "$(PLAT)" == "x64"
!IF "$(CFG)" == "Release"
filewxExtend.dll.x64 compwxExtend.dll.x64 WXEXTE~6.DLL|wxExtend10u_vc100_x64.dll 0 0 1536 1
filewxExtend.dll.x64 compwxExtend.dll.x64 WXEXTE~6.DLL|wxExtend13u_vc100_x64.dll 0 0 1536 1
!ENDIF
!IF "$(CFG)" == "Debug"
filewxExtend.dll.x64 compwxExtend.dll.x64 WXEXTE~8.DLL|wxExtend10ud_vc100_x64.dll 0 0 1536 1
filewxExtend.dll.x64 compwxExtend.dll.x64 WXEXTE~8.DLL|wxExtend13ud_vc100_x64.dll 0 0 1536 1
!ENDIF
!ENDIF
!IF "$(LANG)" == "Sl"
filewxExtend.mo.sl_SI compwxExtend.mo.sl_SI WXEXTE~1.MO|wxExtend.mo 0 1060 0 1
filewxExtend.mo.sl_SI compwxExtend.mo.sl_SI WXEXTE~1.MO|wxExtend13.mo 0 1060 0 1
!ENDIF
<<NOKEEP

View File

@@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<wxExtendVersion>10</wxExtendVersion>
<wxExtendVersion>13</wxExtendVersion>
</PropertyGroup>
<PropertyGroup>
<OutDir>..\..\..\output\$(Platform).$(Configuration)\</OutDir>
@@ -11,6 +11,9 @@
<ClCompile>
<PreprocessorDefinitions>WXEXTEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<POCompile>
<OutputFile>$(OutDir)..\locale\%(Filename)\$(ProjectName)$(wxExtendVersion).mo</OutputFile>
</POCompile>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="wxExtendVersion">

View File

@@ -29,6 +29,8 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\url.cpp" />
<ClCompile Include="..\src\valhex.cpp" />
<ClCompile Include="..\src\xml.cpp" />
</ItemGroup>
<ItemGroup>
@@ -37,10 +39,16 @@
<ClInclude Include="..\include\wxex\comutils.h" />
<ClInclude Include="..\include\wxex\crypto.h" />
<ClInclude Include="..\include\wxex\hex.h" />
<ClInclude Include="..\include\wxex\persist\auimanager.h" />
<ClInclude Include="..\include\wxex\persist\dialog.h" />
<ClInclude Include="..\include\wxex\url.h" />
<ClInclude Include="..\include\wxex\valhex.h" />
<ClInclude Include="..\include\wxex\xml.h" />
<ClInclude Include="..\src\stdafx.h" />
</ItemGroup>
<ItemGroup>
<POCompile Include="..\locale\de_DE.po" />
<POCompile Include="..\locale\ru_RU.po" />
<POCompile Include="..\locale\sl_SI.po" />
</ItemGroup>
<ItemGroup>
@@ -119,5 +127,6 @@
<PropertyGroup />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\include\xgettext.targets" />
</ImportGroup>
</Project>

View File

@@ -17,6 +17,9 @@
<UniqueIdentifier>{e43059ae-37ac-4b28-84fb-18d1b3972b30}</UniqueIdentifier>
<Extensions>po;pot</Extensions>
</Filter>
<Filter Include="Header Files\persist">
<UniqueIdentifier>{33d4709f-47d3-42c1-9562-bc4743799b49}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\stdafx.cpp">
@@ -37,6 +40,12 @@
<ClCompile Include="..\src\hex.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\valhex.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\url.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\stdafx.h">
@@ -60,6 +69,18 @@
<ClInclude Include="..\include\wxex\hex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\wxex\persist\auimanager.h">
<Filter>Header Files\persist</Filter>
</ClInclude>
<ClInclude Include="..\include\wxex\persist\dialog.h">
<Filter>Header Files\persist</Filter>
</ClInclude>
<ClInclude Include="..\include\wxex\valhex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\wxex\url.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\locale\wxExtend.pot">
@@ -70,6 +91,12 @@
<POCompile Include="..\locale\sl_SI.po">
<Filter>Resource Files\Localization</Filter>
</POCompile>
<POCompile Include="..\locale\de_DE.po">
<Filter>Resource Files\Localization</Filter>
</POCompile>
<POCompile Include="..\locale\ru_RU.po">
<Filter>Resource Files\Localization</Filter>
</POCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\res\wxExtend.rc">

View File

@@ -123,15 +123,15 @@ public:
/// Returns whether application bar is displayed always on top.
///
/// \returns
/// - true when application bar is always on top
/// - false otherwise
/// - \c true when application bar is always on top
/// - \c false otherwise
///
inline bool IsAlwaysOnTop() const;
///
/// Sets whether application bar is displayed always on top.
///
/// \param[in] alwaysOnTop Logical variable to control whether always-on-top behaviour is to be enabled (true) or disabled (false).
/// \param[in] alwaysOnTop Logical variable to control whether always-on-top behaviour is to be enabled (\c true) or disabled (\c false).
///
inline bool SetAlwaysOnTop(bool alwaysOnTop = true);
@@ -139,15 +139,15 @@ public:
/// Returns if application bar is configured for auto-hide.
///
/// \returns
/// - true if application bar is configured for auto-hide
/// - false otherwise
/// - \c true if application bar is configured for auto-hide
/// - \c false otherwise
///
inline bool IsAutoHide() const;
///
/// Sets whether application bar is displayed always on top.
///
/// \param[in] autoHide Logical variable to control whether auto-hide behaviour is to be enabled (true) or disabled (false).
/// \param[in] autoHide Logical variable to control whether auto-hide behaviour is to be enabled (\c true) or disabled (\c false).
///
inline bool SetAutoHide(bool autoHide = true);
@@ -155,15 +155,15 @@ public:
/// Returns if sizing of the application bar is allowed.
///
/// \returns
/// - true if sizing of the application bar is allowed
/// - false otherwise
/// - \c true if sizing of the application bar is allowed
/// - \c false otherwise
///
inline bool GetAllowSizing() const;
///
/// Sets whether resizing of the application bar is allowed.
///
/// \param[in] allow Logical variable to control whether resizing is to be enabled (true) or disabled (false).
/// \param[in] allow Logical variable to control whether resizing is to be enabled (\c true) or disabled (\c false).
///
inline bool SetAllowSizing(bool allow = true);
@@ -171,8 +171,8 @@ public:
/// Returns if application bar is auto-hidden right now.
///
/// \returns
/// - true if application bar is auto-hidden right now
/// - false otherwise
/// - \c true if application bar is auto-hidden right now
/// - \c false otherwise
inline bool GetAutoHidden() const;
//bool GetAppBarPlacement(LPAPPBARPLACEMENT lpPlacement) const;
@@ -198,7 +198,7 @@ public:
///
/// Shows or hides auto-hide application bar.
///
/// \param[in] show Logical variable to control whether application bar is be shown (true) or hidden (false).
/// \param[in] show Logical variable to control whether application bar is be shown (\c true) or hidden (\c false).
///
void ShowAutoHideAppBar(bool show = true);
@@ -236,7 +236,7 @@ protected:
///
/// Derived classes can implement their own. However, overriden virtual method should call the parent's implementation too.
///
/// \param[in] beginning true when windows arrangement starts and false when arrangement ends.
/// \param[in] beginning \c true when windows arrangement starts and \c false when arrangement ends.
///
virtual void OnWindowsArrange(bool beginning);
@@ -340,8 +340,8 @@ public:
/// \param[in] state The state of the application bar
///
/// \returns
/// - true if the application bar state represents docked state
/// - false otherwise
/// - \c true if the application bar state represents docked state
/// - \c false otherwise
///
inline bool wxAppBarIsDocked(wxAppBarState state)
{
@@ -355,8 +355,8 @@ inline bool wxAppBarIsDocked(wxAppBarState state)
/// \param[in] state The state of the application bar
///
/// \returns
/// - true if the application bar state represents vertically docked state
/// - false otherwise
/// - \c true if the application bar state represents vertically docked state
/// - \c false otherwise
///
inline bool wxAppBarIsDockedVert(wxAppBarState state)
{
@@ -370,8 +370,8 @@ inline bool wxAppBarIsDockedVert(wxAppBarState state)
/// \param[in] state The state of the application bar
///
/// \returns
/// - true if the application bar state represents horizontally docked state
/// - false otherwise
/// - \c true if the application bar state represents horizontally docked state
/// - \c false otherwise
///
inline bool wxAppBarIsDockedHoriz(wxAppBarState state)
{

View File

@@ -23,16 +23,18 @@
///
/// wxExtend Version
///
#define wxEXTEND_VERSION 0x01000000
#define wxEXTEND_VERSION 0x01030000
#define wxEXTEND_VERSION_MAJ 1
#define wxEXTEND_VERSION_MIN 0
#define wxEXTEND_VERSION_MIN 3
#define wxEXTEND_VERSION_REV 0
#define wxEXTEND_VERSION_BUILD 0
#define wxEXTEND_VERSION_STR "1.0"
#define wxEXTEND_VERSION_STR "1.3"
#define wxEXTEND_BUILD_YEAR_STR "2016"
#define wxExtendVersion "13"
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
@@ -55,9 +57,20 @@
/// Debug macros
///
#if wxDEBUG_LEVEL
#define wxVERIFY(x) wxASSERT((x))
#define wxVERIFY_MSG(cond, msg) \
wxSTATEMENT_MACRO_BEGIN \
if ( !(cond) && wxTheAssertHandler && \
(wxOnAssert(__FILE__, __LINE__, __WXFUNCTION__, \
#cond, msg), wxTrapInAssert) ) \
{ \
wxTrapInAssert = false; \
wxTrap(); \
} \
wxSTATEMENT_MACRO_END
#define wxVERIFY(cond) wxVERIFY_MSG(cond, (const char*)NULL)
#else
#define wxVERIFY(x) (x)
#define wxVERIFY(cond) (cond)
#endif
@@ -65,8 +78,8 @@
/// Returns whether windows animation is enabled.
///
/// \returns
/// - true when window animation is enabled
/// - false otherwise
/// - \c true when window animation is enabled
/// - \c false otherwise
///
inline bool wxGetDoWndAnimation()
{
@@ -85,8 +98,8 @@ inline bool wxGetDoWndAnimation()
/// \param[in] nFlags Additional SWP_ flags to pass to SetWindowPos(). If zero, SetWindowPos() is not called.
///
/// \returns
/// - true when the window extended style was modified
/// - false if the window extended style was not neccessary
/// - \c true when the window extended style was modified
/// - \c false if the window extended style was not neccessary
///
inline bool wxModifyStyleEx(_In_ WXHWND hWnd, _In_ DWORD dwRemove, _In_ DWORD dwAdd, _In_ UINT nFlags = 0)
{

View File

@@ -44,8 +44,8 @@ public:
/// Has the initialization been successful? (explicit test)
///
/// \returns
/// - true if initialization succeeded
/// - false otherwise
/// - \c true if initialization succeeded
/// - \c false otherwise
///
bool IsOk() const { return m_ok; }
@@ -53,8 +53,8 @@ public:
/// Has the initialization been successful? (implicit test)
///
/// \returns
/// - true if initialization succeeded
/// - false otherwise
/// - \c true if initialization succeeded
/// - \c false otherwise
///
operator bool() const { return m_ok; }

View File

@@ -23,6 +23,7 @@
#include <wx/buffer.h>
#include <wx/ffile.h>
#include <wx/log.h>
#include <wx/string.h>
#include <Wincrypt.h>
@@ -45,8 +46,8 @@ public:
/// Has the session creation been successful?
///
/// \returns
/// - true if creation succeeded
/// - false otherwise
/// - \c true if creation succeeded
/// - \c false otherwise
///
inline bool IsOk() const
{
@@ -91,8 +92,8 @@ public:
/// Has the hash creation been successful?
///
/// \returns
/// - true if creation succeeded
/// - false otherwise
/// - \c true if creation succeeded
/// - \c false otherwise
///
inline bool IsOk() const
{
@@ -116,8 +117,8 @@ public:
/// \param[in] size Size of memory block in bytes
///
/// \returns
/// - true if hashing succeeded
/// - false otherwise
/// - \c true if hashing succeeded
/// - \c false otherwise
///
bool Hash(const void *data, size_t size);
@@ -128,8 +129,8 @@ public:
/// \param[in] data Memory block
///
/// \returns
/// - true if hashing succeeded
/// - false otherwise
/// - \c true if hashing succeeded
/// - \c false otherwise
///
inline bool Hash(const wxMemoryBuffer &data)
{
@@ -143,8 +144,8 @@ public:
/// \param[in] str String to hash
///
/// \returns
/// - true if hashing succeeded
/// - false otherwise
/// - \c true if hashing succeeded
/// - \c false otherwise
///
inline bool HashAsUTF8(const wxString &str)
{
@@ -159,8 +160,8 @@ public:
/// \param[in] fileName The path of the file to calculate hash of
///
/// \returns
/// - true if hashing succeeded
/// - false otherwise
/// - \c true if hashing succeeded
/// - \c false otherwise
///
inline bool HashFile(const wxString &fileName)
{
@@ -186,8 +187,8 @@ public:
/// \param[out] hash Hash data
///
/// \returns
/// - true if succeeded
/// - false otherwise
/// - \c true if succeeded
/// - \c false otherwise
///
virtual bool GetValue(wxMemoryBuffer &hash);
@@ -198,8 +199,8 @@ public:
/// \param[out] signature Digital signature
///
/// \returns
/// - true if signing succeeded
/// - false otherwise
/// - \c true if signing succeeded
/// - \c false otherwise
///
bool Sign(wxMemoryBuffer &signature);
@@ -233,8 +234,8 @@ public:
/// \param[out] hash Hash data
///
/// \returns
/// - true if succeeded
/// - false otherwise
/// - \c true if succeeded
/// - \c false otherwise
///
virtual bool GetValue(wxMemoryBuffer &hash);
};
@@ -254,8 +255,8 @@ public:
/// Has the key creation been successful?
///
/// \returns
/// - true if creation succeeded
/// - false otherwise
/// - \c true if creation succeeded
/// - \c false otherwise
///
inline bool IsOk() const
{
@@ -289,8 +290,8 @@ protected:
/// \param[in] key Public key
///
/// \returns
/// - true if verification succeeded and the hash matches
/// - false otherwise
/// - \c true if verification succeeded and the hash matches
/// - \c false otherwise
///
bool WXEXTEND_API wxCryptoVerifySignature(const wxCryptoHash &hash, const void *signature_data, size_t signature_size, const wxCryptoKey &key);
@@ -303,8 +304,8 @@ bool WXEXTEND_API wxCryptoVerifySignature(const wxCryptoHash &hash, const void *
/// \param[in] key Public key
///
/// \returns
/// - true if verification succeeded and the hash matches
/// - false otherwise
/// - \c true if verification succeeded and the hash matches
/// - \c false otherwise
///
inline bool wxCryptoVerifySignature(const wxCryptoHash &hash, const wxMemoryBuffer &signature, const wxCryptoKey &key)
{

View File

@@ -19,6 +19,8 @@
#pragma once
#include "common.h"
#include "wx/string.h"
#include "wx/buffer.h"
@@ -32,6 +34,7 @@
/// of a buffer of given length
///
/// \param[in] len Length of the buffer
///
/// \returns Maximum encoded representation size (in characters)
///
inline size_t wxHexEncodedSize(size_t len)
@@ -110,6 +113,7 @@ enum wxHexDecodeMode
/// length
///
/// \param[in] len Length of the hex encoded string
///
/// \returns Maximum decoded representation size (in bytes)
///
inline size_t wxHexDecodedSize(size_t len)

View File

@@ -0,0 +1,89 @@
/*
Copyright 2015-2016 Amebis
This file is part of wxExtend.
wxExtend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wxExtend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../common.h"
#include <wx/persist.h>
#include <wx/aui/framemanager.h>
// ----------------------------------------------------------------------------
// string constants used by wxPersistentAuiManager
// ----------------------------------------------------------------------------
#define wxPERSIST_AUIMGR_KIND "AuiManager"
// names for persistent options
#define wxPERSIST_AUIMGR_PERSPECTIVE "perspective"
///
/// Supports saving/restoring wxAuiManager state
///
class wxPersistentAuiManager : public wxPersistentObject
{
public:
wxPersistentAuiManager(wxAuiManager *mgr) : wxPersistentObject(mgr)
{
}
virtual wxString GetKind() const
{
return wxT(wxPERSIST_AUIMGR_KIND);
}
virtual wxString GetName() const
{
// Borrow the name of wxAguiManager from its window.
return GetManager()->GetManagedWindow()->GetName();
}
virtual void Save() const
{
// Save perspective string to configuration.
SaveValue(wxT(wxPERSIST_AUIMGR_PERSPECTIVE), GetManager()->SavePerspective());
}
virtual bool Restore()
{
// Load perspective string from configuration.
wxString persp;
return RestoreValue(wxT(wxPERSIST_AUIMGR_PERSPECTIVE), &persp) && GetManager()->LoadPerspective(persp);
}
protected:
wxAuiManager *GetManager() const
{
return static_cast<wxAuiManager*>(GetObject());
}
private:
wxDECLARE_NO_COPY_CLASS(wxPersistentAuiManager);
};
///
/// wxAuiManager's instantiation of wxCreatePersistentObject template
///
inline wxPersistentObject *wxCreatePersistentObject(wxAuiManager *mgr)
{
return new wxPersistentAuiManager(mgr);
}

View File

@@ -0,0 +1,103 @@
/*
Copyright 2015-2016 Amebis
This file is part of wxExtend.
wxExtend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wxExtend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "../common.h"
#include <wx/persist.h>
#include <wx/persist/toplevel.h>
#include <wx/persist/window.h>
#include <wx/dialog.h>
// ----------------------------------------------------------------------------
// string constants used by wxPersistentDialog
// ----------------------------------------------------------------------------
#define wxPERSIST_DIALOG_KIND "Dialog"
///
/// Supports saving/restoring wxDialog state
///
class wxPersistentDialog : public wxPersistentWindow<wxDialog>
{
public:
wxPersistentDialog(wxDialog *mgr) : wxPersistentWindow<wxDialog>(mgr)
{
}
virtual wxString GetKind() const
{
return wxT(wxPERSIST_DIALOG_KIND);
}
virtual void Save() const
{
const wxDialog * const wnd = Get();
// Code copied from wxPersistentTLW::Save()
const wxPoint pos = wnd->GetScreenPosition();
SaveValue(wxPERSIST_TLW_X, pos.x);
SaveValue(wxPERSIST_TLW_Y, pos.y);
}
virtual bool Restore()
{
wxDialog * const wnd = Get();
// Code copied from wxPersistentTLW::Restore()
long
x wxDUMMY_INITIALIZE(-1),
y wxDUMMY_INITIALIZE(-1);
const wxSize size = wnd->GetSize();
const bool hasPos = RestoreValue(wxPERSIST_TLW_X, &x) &&
RestoreValue(wxPERSIST_TLW_Y, &y);
if (hasPos) {
// to avoid making the window completely invisible if it had been
// shown on a monitor which was disconnected since the last run
// (this is pretty common for notebook with external displays)
//
// NB: we should allow window position to be (slightly) off screen,
// it's not uncommon to position the window so that its upper
// left corner has slightly negative coordinate
if (wxDisplay::GetFromPoint(wxPoint(x , y )) != wxNOT_FOUND ||
wxDisplay::GetFromPoint(wxPoint(x + size.x, y + size.y)) != wxNOT_FOUND)
{
wnd->Move(x, y, wxSIZE_ALLOW_MINUS_ONE);
}
}
return true;
}
private:
wxDECLARE_NO_COPY_CLASS(wxPersistentDialog);
};
///
/// wxDialog's instantiation of wxCreatePersistentObject template
///
inline wxPersistentObject *wxCreatePersistentObject(wxDialog *mgr)
{
return new wxPersistentDialog(mgr);
}

221
include/wxex/url.h Normal file
View File

@@ -0,0 +1,221 @@
/*
Copyright 2015-2016 Amebis
This file is part of wxExtend.
wxExtend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wxExtend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common.h"
#include "wx/string.h"
#include "wx/buffer.h"
///
/// Return if given character should be protected for URL encoding
///
/// \param[in] chr ASCII character
///
/// \returns
/// - \c true if character should be protected
/// - \c false otherwise
///
inline bool wxURLIsProtected(char chr)
{
switch (chr) {
case ' ':
case '!':
case '*':
case '\'':
case '(':
case ')':
case ';':
case ':':
case '@':
case '&':
case '=':
case '+':
case '$':
case ',':
case '/':
case '?':
case '#':
case '[':
case ']': return true;
}
return chr < 0x20;
}
///
/// Return the size needed for the buffer containing the encoded representation
/// of a string of given length
///
/// \param[in] src Source string to encode
/// \param[in] srcLen Length of \p src string (in bytes)
///
/// \returns Maximum encoded representation size (in characters)
///
inline size_t wxURLEncodedSize(size_t len)
{
return len*3;
}
///
/// Raw URL encoding function which encodes the contents of a string of the
/// specified length into the buffer of the specified size
///
/// \param[out] dst Destination buffer to receive URL encoded data
/// \param[in] dstLen Length of \p dst buffer (in characters)
/// \param[in] src Source string to encode
/// \param[in] srcLen Length of \p src string (in bytes)
///
/// \returns The length of the encoded data or wxCONV_FAILED if the buffer is not
/// large enough; to determine the needed size you can either allocate a buffer
/// of \c{wxURLEncodedSize(srcLen)} size or call the function with NULL string in
/// which case the required size will be returned
///
size_t WXEXTEND_API wxURLEncode(char *dst, size_t dstLen, const char *src, size_t srcLen);
///
/// URL encoding function which encodes the contents of a string of the
/// specified length into the wxString
///
/// \param[in] src Source string to encode
/// \param[in] srcLen Length of \p src string (in bytes)
///
/// \returns The URL encoded string
///
inline wxString wxURLEncode(const char *src, size_t srcLen)
{
const size_t dstLen = wxURLEncodedSize(srcLen);
wxCharBuffer dst(dstLen);
dst.shrink(wxURLEncode(dst.data(), dstLen, src, srcLen));
return dst;
}
///
/// URL encoding function which encodes the contents of a string into the wxString
///
/// \param[in] str Source string to encode
///
/// \returns The URL encoded string
///
inline wxString wxURLEncode(const wxString& str)
{
return wxURLEncode(str.GetData(), str.Length());
}
///
/// URL encoding function which encodes the contents of a buffer into the wxString
///
/// \param[in] buf Source buffer to encode
///
/// \returns The URL encoded string
///
inline wxString wxURLEncode(const wxMemoryBuffer& buf)
{
return wxURLEncode((const char*)buf.GetData(), buf.GetDataLen());
}
// ----------------------------------------------------------------------------
// Decoding Functions
// ----------------------------------------------------------------------------
///
/// Return the buffer size necessary for decoding a URL string of the given
/// length
///
/// \param[in] len Length of the URL encoded string
///
/// \returns Maximum decoded representation size (in bytes)
///
inline size_t wxURLDecodedSize(size_t len)
{
return len;
}
///
/// Raw decoding function which decodes the contents of the string of specified
/// length (or zero terminated by default) into the provided buffer of the given
/// size
///
/// \param[out] dst Destination buffer to receive decoded data
/// \param[in] dstLen Length of \p dst buffer (in bytes)
/// \param[in] src Source buffer to decode
/// \param[in] srcLen Length of \p src buffer (in characters) or wxNO_LEN for zero terminated strings
///
/// \returns The length of the decoded data or wxCONV_FAILED if the buffer is not
/// large enough; to determine the needed size you can either allocate a buffer
/// of \c{wxURLDecodedSize(srcLen)} size or call the function with NULL string in
/// which case the required size will be returned
///
size_t WXEXTEND_API wxURLDecode(char *dst, size_t dstLen, const char *src, size_t srcLen = wxNO_LEN);
///
/// Decoding function which decodes the contents of the string into the provided buffer of the given size
///
/// \param[out] dst Destination buffer to receive decoded data
/// \param[in] dstLen Length of \p dst buffer (in bytes)
/// \param[in] src Source string to decode
///
/// \returns The length of the decoded data or wxCONV_FAILED if the buffer is not
/// large enough; to determine the needed size you can either allocate a buffer
/// of \c{wxURLDecodedSize(srcLen)} size or call the function with NULL string in
/// which case the required size will be returned
///
inline size_t wxURLDecode(char *dst, size_t dstLen, const wxString& src)
{
// don't use str.length() here as the ASCII buffer is shorter than it is for
// strings with embedded NULs
return wxURLDecode(dst, dstLen, src.ToAscii(), wxNO_LEN);
}
///
/// Decoding function which decodes the contents of the string of specified
/// length (or zero terminated by default) into the buffer
///
/// \param[in] src Source buffer to decode
/// \param[in] srcLen Length of \p src buffer (in characters) or wxNO_LEN for zero terminated strings
///
/// \returns Destination buffer with decoded data or an empty buffer if an error occured during decoding
///
wxMemoryBuffer WXEXTEND_API wxURLDecode(const char *src, size_t srcLen = wxNO_LEN);
///
/// Decoding function which decodes the contents of the string into the buffer
///
/// \param[in] src Source string to decode
///
/// \returns Destination buffer with decoded data or an empty buffer if an error occured during decoding
///
inline wxMemoryBuffer wxURLDecode(const wxString& src)
{
// don't use str.length() here as the ASCII buffer is shorter than it for
// strings with embedded NULs
return wxURLDecode(src.ToAscii(), wxNO_LEN);
}

85
include/wxex/valhex.h Normal file
View File

@@ -0,0 +1,85 @@
/*
Copyright 2015-2016 Amebis
This file is part of wxExtend.
wxExtend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wxExtend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common.h"
#include <wx/valnum.h>
///
/// Bit masks used for hexadecimal validator styles.
///
enum wxHexValidatorStyle
{
// Do not use values used by wxNumValidatorStyle flags, since this is the extension.
wxNUM_VAL_HEX_LOWERCASE = 0x1000,
};
///
/// Base class for hexadecimal validator
///
class WXEXTEND_API wxHexValidatorBase : public wxIntegerValidatorBase
{
protected:
wxHexValidatorBase(int style);
wxHexValidatorBase(const wxHexValidatorBase& other);
bool IsMinusOk(const wxString& val, int pos) const;
static bool FromString(const wxString& s, long *value);
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
static bool FromString(const wxString &s, wxLongLong_t *value);
#endif
wxString ToString(LongestValueType value) const;
protected:
void DoSetWidth(unsigned int width) { m_width = width; }
private:
virtual bool IsCharOk(const wxString& val, int pos, wxChar ch) const;
private:
unsigned int m_width; ///< Preferred width of the string - zero padding (<=1 disables padding)
};
///
/// Validator for hexadecimal entries
///
template <typename T>
class wxHexValidator : public wxPrivate::wxNumValidator<wxHexValidatorBase, T>
{
public:
typedef wxPrivate::wxNumValidator<wxHexValidatorBase, T> Base;
wxHexValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT, unsigned int width = 0) : Base(value, style)
{
this->DoSetWidth(width);
this->DoSetMin(std::numeric_limits<ValueType>::min());
this->DoSetMax(std::numeric_limits<ValueType>::max());
}
virtual wxObject *Clone() const { return new wxHexValidator(*this); }
private:
wxDECLARE_NO_ASSIGN_CLASS(wxHexValidator);
};

View File

@@ -19,9 +19,10 @@
#pragma once
#include "crypto.h"
#include "common.h"
#include "crypto.h"
#include <wx/string.h>
#include <wx/xml/xml.h>

28
locale/de_DE.po Normal file
View File

@@ -0,0 +1,28 @@
msgid ""
msgstr ""
"Project-Id-Version: wxExtend\n"
"POT-Creation-Date: 2016-05-13 19:22+0200\n"
"PO-Revision-Date: 2016-05-13 19:33+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
#: include/wxex/appbar.h:981
msgid ""
"There is already an auto hidden bar on this edge.\n"
"Only one auto hidden bar is allowed on each edge.\n"
"Auto-hide feature is now off."
msgstr ""
#: include/wxex/appbar.h:981
#, fuzzy
msgid "Warning"
msgstr "Warnung: "

28
locale/ru_RU.po Normal file
View File

@@ -0,0 +1,28 @@
msgid ""
msgstr ""
"Project-Id-Version: wxExtend\n"
"POT-Creation-Date: 2016-05-13 19:23+0200\n"
"PO-Revision-Date: 2016-05-13 19:32+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
"Language: ru_RU\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
#: include/wxex/appbar.h:981
msgid ""
"There is already an auto hidden bar on this edge.\n"
"Only one auto hidden bar is allowed on each edge.\n"
"Auto-hide feature is now off."
msgstr ""
#: include/wxex/appbar.h:981
msgid "Warning"
msgstr ""

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: wxExtend\n"
"POT-Creation-Date: 2016-03-14 17:16+0100\n"
"PO-Revision-Date: 2016-03-14 17:20+0100\n"
"PO-Revision-Date: 2016-05-13 19:32+0200\n"
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
"Language: sl_SI\n"
@@ -10,13 +10,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: _\n"
"X-Poedit-SearchPath-0: src\n"
"X-Poedit-SearchPath-1: include\n"
#: include/wxex/appbar.h:981
msgid ""

View File

@@ -27,6 +27,8 @@
#include "../include/wxex/comutils.h"
#include "../include/wxex/crypto.h"
#include "../include/wxex/hex.h"
#include "../include/wxex/url.h"
#include "../include/wxex/valhex.h"
#include "../include/wxex/xml.h"
#include "../include/wxex/common.h"

134
src/url.cpp Normal file
View File

@@ -0,0 +1,134 @@
/*
Copyright 2015-2016 Amebis
This file is part of wxExtend.
wxExtend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wxExtend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
size_t WXEXTEND_API wxURLEncode(char *dst, size_t dstLen, const char *src, size_t srcLen)
{
wxCHECK_MSG(src, wxCONV_FAILED, wxT("NULL input buffer"));
static const char bhex[] = "0123456789ABCDEF";
size_t encLen = 0;
for (size_t i = 0; i < srcLen && src[i]; i++) {
if (wxURLIsProtected(src[i])) {
encLen += 3;
if ( dst )
{
if ( encLen > dstLen )
return wxCONV_FAILED;
*dst++ = '%';
*dst++ = bhex[((unsigned char)src[i]) >> 4];
*dst++ = bhex[((unsigned char)src[i]) & 0x0f];
}
} else {
encLen ++;
if ( dst )
{
if ( encLen > dstLen )
return wxCONV_FAILED;
*dst++ = src[i];
}
}
}
// Zero terminate.
if ( dst && encLen < dstLen )
*dst++ = 0;
return encLen;
}
size_t WXEXTEND_API wxURLDecode(char *dst, size_t dstLen, const char *src, size_t srcLen)
{
wxCHECK_MSG(src, wxCONV_FAILED, wxT("NULL input buffer"));
static const char bhex[] = "0123456789ABCDEF";
size_t i, decLen = 0;
for (i = 0 ; i < srcLen && src[i];) {
decLen ++;
if (src[i] == '%') {
// Decode % escaped hex value to character.
char c = 0;
size_t j = i + 1;
for (size_t j_max = i + 3; j < j_max && j < srcLen; j++) {
char x = src[j];
c <<= 4;
if ('0' <= x && x <= '9') c += x - '0';
else if ('A' <= x && x <= 'F') c += x - 'A' + 10;
else if ('a' <= x && x <= 'f') c += x - 'a' + 10;
else break;
}
if (c) {
if ( dst )
{
if ( decLen > dstLen )
return wxCONV_FAILED;
*dst++ = c;
}
i = j;
continue;
}
}
if ( dst )
{
if ( decLen > dstLen )
return wxCONV_FAILED;
*dst++ = src[i];
}
i++;
}
// Zero terminate.
if ( dst && decLen < dstLen )
*dst++ = 0;
return decLen;
}
wxMemoryBuffer WXEXTEND_API wxURLDecode(const char *src, size_t srcLen)
{
wxMemoryBuffer buf;
wxCHECK_MSG( src, buf, wxT("NULL input buffer") );
if ( srcLen == wxNO_LEN )
srcLen = strlen(src);
size_t len = wxURLDecodedSize(srcLen);
len = wxURLDecode((char*)buf.GetWriteBuf(len), len, src, srcLen);
if ( len == wxCONV_FAILED )
len = 0;
buf.SetDataLen(len);
return buf;
}

102
src/valhex.cpp Normal file
View File

@@ -0,0 +1,102 @@
/*
Copyright 2015-2016 Amebis
This file is part of wxExtend.
wxExtend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
wxExtend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with wxExtend. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
//////////////////////////////////////////////////////////////////////////
// wxHexValidatorBase
//////////////////////////////////////////////////////////////////////////
wxHexValidatorBase::wxHexValidatorBase(int style) :
m_width(0),
wxIntegerValidatorBase(style)
{
}
wxHexValidatorBase::wxHexValidatorBase(const wxHexValidatorBase& other) :
m_width(other.m_width),
wxIntegerValidatorBase(other)
{
}
bool wxHexValidatorBase::IsMinusOk(const wxString& val, int pos) const
{
// Minus is never OK with hexadecimal numbers.
return false;
}
bool wxHexValidatorBase::FromString(const wxString& s, long *value)
{
return s.ToLong(value, 16);
}
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
bool wxHexValidatorBase::FromString(const wxString &s, wxLongLong_t *value)
{
return s.ToLongLong(value, 16);
}
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxString wxHexValidatorBase::ToString(LongestValueType value) const
{
const wxStringCharType hexa = (HasFlag((wxNumValidatorStyle)wxNUM_VAL_HEX_LOWERCASE) ? wxT('a') : wxT('A')) - 0xa;
unsigned int offset = sizeof(LongestValueType)*8 - 4, offset_s = m_width*4 - 4;
wxULongLong_t m = ((wxULongLong_t)0xf) << offset;
unsigned int x = 0;
// Skip leading zeros.
while (m && !x && offset >= offset_s) {
x = (unsigned int)((m & (wxULongLong_t)value) >> offset);
m >>= 4, offset -= 4;
}
// First digit.
wxString str(1, (wxStringCharType)((x < 0xa ? wxT('0') : hexa) + x));
// Rest of the digits.
while (m) {
x = (unsigned int)((m & (wxULongLong_t)value) >> offset);
m >>= 4, offset -= 4;
str += (wxStringCharType)((x < 0xa ? wxT('0') : hexa) + x);
}
return str;
}
bool wxHexValidatorBase::IsCharOk(const wxString& val, int pos, wxChar ch) const
{
// We only accept hexadecimal digits here.
if ((ch < '0' || ch > '9') && (ch < 'A' || ch > 'F') && (ch < 'a' || ch > 'f'))
return false;
// And the value after insertion needs to be in the defined range.
LongestValueType value;
if (!FromString(GetValueAfterInsertingChar(val, pos, ch), &value))
return false;
return IsInRange(value);
}