diff --git a/MSIBuild/Makefile b/MSIBuild/Makefile index b68fef4..3a92362 100644 --- a/MSIBuild/Makefile +++ b/MSIBuild/Makefile @@ -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 {239F2FF9-E998-4F81-85A8-DA2C0A5F860B} $(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 {AA798500-8E4F-4554-8611-F2C225046606} $(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 {026F2E74-4190-4B49-820B-94141F32F04B} 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 < - 11 + 12 ..\..\..\output\$(Platform).$(Configuration)\ diff --git a/include/wxex/common.h b/include/wxex/common.h index 8aacf6d..d4335c0 100644 --- a/include/wxex/common.h +++ b/include/wxex/common.h @@ -23,17 +23,17 @@ /// /// wxExtend Version /// -#define wxEXTEND_VERSION 0x01010000 +#define wxEXTEND_VERSION 0x01020000 #define wxEXTEND_VERSION_MAJ 1 -#define wxEXTEND_VERSION_MIN 1 +#define wxEXTEND_VERSION_MIN 2 #define wxEXTEND_VERSION_REV 0 #define wxEXTEND_VERSION_BUILD 0 -#define wxEXTEND_VERSION_STR "1.1" +#define wxEXTEND_VERSION_STR "1.2" #define wxEXTEND_BUILD_YEAR_STR "2016" -#define wxExtendVersion "11" +#define wxExtendVersion "12" #if !defined(RC_INVOKED) && !defined(MIDL_PASS) diff --git a/include/wxex/valhex.h b/include/wxex/valhex.h index f0fbe88..5b06c80 100644 --- a/include/wxex/valhex.h +++ b/include/wxex/valhex.h @@ -51,8 +51,14 @@ protected: #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) }; @@ -65,8 +71,9 @@ class wxHexValidator : public wxPrivate::wxNumValidator public: typedef wxPrivate::wxNumValidator Base; - wxHexValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT) : Base(value, style) + wxHexValidator(ValueType *value = NULL, int style = wxNUM_VAL_DEFAULT, unsigned int width = 0) : Base(value, style) { + this->DoSetWidth(width); this->DoSetMin(std::numeric_limits::min()); this->DoSetMax(std::numeric_limits::max()); } diff --git a/src/valhex.cpp b/src/valhex.cpp index d875222..8add4f1 100644 --- a/src/valhex.cpp +++ b/src/valhex.cpp @@ -24,12 +24,16 @@ // wxHexValidatorBase ////////////////////////////////////////////////////////////////////////// -wxHexValidatorBase::wxHexValidatorBase(int style) : wxIntegerValidatorBase(style) +wxHexValidatorBase::wxHexValidatorBase(int style) : + m_width(0), + wxIntegerValidatorBase(style) { } -wxHexValidatorBase::wxHexValidatorBase(const wxHexValidatorBase& other) : wxIntegerValidatorBase(other) +wxHexValidatorBase::wxHexValidatorBase(const wxHexValidatorBase& other) : + m_width(other.m_width), + wxIntegerValidatorBase(other) { } @@ -59,13 +63,13 @@ bool wxHexValidatorBase::FromString(const wxString &s, wxLongLong_t *value) wxString wxHexValidatorBase::ToString(LongestValueType value) const { const wxStringCharType hexa = (HasFlag((wxNumValidatorStyle)wxNUM_VAL_HEX_LOWERCASE) ? wxT('a') : wxT('A')) - 0xa; - int offset = sizeof(LongestValueType)*8 - 4; + 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) { - x = (int)((m & (wxULongLong_t)value) >> offset); + while (m && !x && offset >= offset_s) { + x = (unsigned int)((m & (wxULongLong_t)value) >> offset); m >>= 4, offset -= 4; } @@ -74,7 +78,7 @@ wxString wxHexValidatorBase::ToString(LongestValueType value) const // Rest of the digits. while (m) { - x = (int)((m & (wxULongLong_t)value) >> offset); + x = (unsigned int)((m & (wxULongLong_t)value) >> offset); m >>= 4, offset -= 4; str += (wxStringCharType)((x < 0xa ? wxT('0') : hexa) + x); }