summaryrefslogtreecommitdiff
path: root/wx+
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:09:55 +0200
committerDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:09:55 +0200
commit9b623ea3943165fe7efb5e47a0b5b9452c1599e6 (patch)
treedde40e07e907ac6e0ca9ea32524f2cd4810d4be6 /wx+
parent9.7 (diff)
downloadFreeFileSync-9b623ea3943165fe7efb5e47a0b5b9452c1599e6.tar.gz
FreeFileSync-9b623ea3943165fe7efb5e47a0b5b9452c1599e6.tar.bz2
FreeFileSync-9b623ea3943165fe7efb5e47a0b5b9452c1599e6.zip
9.8
Diffstat (limited to 'wx+')
-rwxr-xr-xwx+/app_main.h9
-rwxr-xr-xwx+/choice_enum.h3
-rwxr-xr-xwx+/context_menu.h1
-rwxr-xr-xwx+/dc.h1
-rwxr-xr-xwx+/graph.cpp18
-rwxr-xr-xwx+/graph.h2
-rwxr-xr-xwx+/grid.cpp6
-rwxr-xr-xwx+/grid.h2
-rwxr-xr-xwx+/http.cpp6
-rwxr-xr-xwx+/http.h2
-rwxr-xr-xwx+/image_resources.h1
-rwxr-xr-xwx+/no_flicker.h1
-rwxr-xr-xwx+/rtl.h1
-rwxr-xr-xwx+/toggle_button.h17
14 files changed, 39 insertions, 31 deletions
diff --git a/wx+/app_main.h b/wx+/app_main.h
index d9559fea..8d2a6eeb 100755
--- a/wx+/app_main.h
+++ b/wx+/app_main.h
@@ -10,6 +10,7 @@
#include <wx/window.h>
#include <wx/app.h>
+
namespace zen
{
//just some wrapper around a global variable representing the (logical) main application window
@@ -22,12 +23,16 @@ bool mainWindowWasSet();
//######################## implementation ########################
+namespace impl
+{
inline
bool& refMainWndStatus()
{
static bool status = false; //external linkage!
return status;
}
+}
+
inline
void setMainWindow(wxWindow* window)
@@ -35,10 +40,10 @@ void setMainWindow(wxWindow* window)
wxTheApp->SetTopWindow(window);
wxTheApp->SetExitOnFrameDelete(true);
- refMainWndStatus() = true;
+ impl::refMainWndStatus() = true;
}
-inline bool mainWindowWasSet() { return refMainWndStatus(); }
+inline bool mainWindowWasSet() { return impl::refMainWndStatus(); }
}
#endif //APP_MAIN_H_08215601837818347575856
diff --git a/wx+/choice_enum.h b/wx+/choice_enum.h
index a19e1457..6b2edd01 100755
--- a/wx+/choice_enum.h
+++ b/wx+/choice_enum.h
@@ -33,7 +33,6 @@ Update enum tooltips (after user changed selection):
updateTooltipEnumVal(enumDescrMap, *m_choiceHandleError);
*/
-
namespace zen
{
template <class Enum>
@@ -41,7 +40,7 @@ struct EnumDescrList
{
EnumDescrList& add(Enum value, const wxString& text, const wxString& tooltip = {})
{
- descrList.emplace_back(value, std::make_pair(text, tooltip));
+ descrList.push_back({ value, { text, tooltip } });
return *this;
}
using DescrList = std::vector<std::pair<Enum, std::pair<wxString, wxString>>>;
diff --git a/wx+/context_menu.h b/wx+/context_menu.h
index de351df4..7f459aca 100755
--- a/wx+/context_menu.h
+++ b/wx+/context_menu.h
@@ -22,7 +22,6 @@ Usage:
...
menu.popup(wnd);
*/
-
namespace zen
{
class ContextMenu : private wxEvtHandler
diff --git a/wx+/dc.h b/wx+/dc.h
index ff182b6a..55047a53 100755
--- a/wx+/dc.h
+++ b/wx+/dc.h
@@ -11,6 +11,7 @@
#include <zen/optional.h>
#include <wx/dcbuffer.h> //for macro: wxALWAYS_NATIVE_DOUBLE_BUFFER
+
namespace zen
{
/*
diff --git a/wx+/graph.cpp b/wx+/graph.cpp
index b81896b4..dbce3769 100755
--- a/wx+/graph.cpp
+++ b/wx+/graph.cpp
@@ -539,8 +539,6 @@ void Graph2D::addCurve(const std::shared_ptr<CurveData>& data, const CurveAttrib
void Graph2D::render(wxDC& dc) const
{
- using namespace numeric;
-
//set label font right at the start so that it is considered by wxDC::GetTextExtent() below!
dc.SetFont(labelFont_);
@@ -722,10 +720,10 @@ void Graph2D::render(wxDC& dc) const
const wxPoint screenCurrent = activeSel_->refCurrentPos() - graphAreaOrigin;
//normalize positions: a mouse selection is symmetric and *not* an half-open range!
- double screenFromX = clampCpy(screenStart .x, 0, graphArea.width - 1);
- double screenFromY = clampCpy(screenStart .y, 0, graphArea.height - 1);
- double screenToX = clampCpy(screenCurrent.x, 0, graphArea.width - 1);
- double screenToY = clampCpy(screenCurrent.y, 0, graphArea.height - 1);
+ double screenFromX = numeric::clampCpy(screenStart .x, 0, graphArea.width - 1);
+ double screenFromY = numeric::clampCpy(screenStart .y, 0, graphArea.height - 1);
+ double screenToX = numeric::clampCpy(screenCurrent.x, 0, graphArea.width - 1);
+ double screenToY = numeric::clampCpy(screenCurrent.y, 0, graphArea.height - 1);
widen(&screenFromX, &screenToX); //use full pixel range for selection!
widen(&screenFromY, &screenToY);
@@ -780,10 +778,10 @@ void Graph2D::render(wxDC& dc) const
shrink(&screenFromX, &screenToX);
shrink(&screenFromY, &screenToY);
- clamp(screenFromX, 0.0, graphArea.width - 1.0);
- clamp(screenFromY, 0.0, graphArea.height - 1.0);
- clamp(screenToX, 0.0, graphArea.width - 1.0);
- clamp(screenToY, 0.0, graphArea.height - 1.0);
+ numeric::clamp(screenFromX, 0.0, graphArea.width - 1.0);
+ numeric::clamp(screenFromY, 0.0, graphArea.height - 1.0);
+ numeric::clamp(screenToX, 0.0, graphArea.width - 1.0);
+ numeric::clamp(screenToY, 0.0, graphArea.height - 1.0);
const wxPoint pixelFrom = wxPoint(numeric::round(screenFromX),
numeric::round(screenFromY)) + graphAreaOrigin;
diff --git a/wx+/graph.h b/wx+/graph.h
index 5c71ed52..45129c4b 100755
--- a/wx+/graph.h
+++ b/wx+/graph.h
@@ -16,8 +16,8 @@
#include <zen/string_tools.h>
#include <zen/optional.h>
-//elegant 2D graph as wxPanel specialization
+//elegant 2D graph as wxPanel specialization
namespace zen
{
/*
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index b301bf6b..64f7f4a6 100755
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
@@ -462,8 +462,8 @@ public:
const int yFrom = refParent().CalcUnscrolledPosition(clientRect.GetTopLeft ()).y;
const int yTo = refParent().CalcUnscrolledPosition(clientRect.GetBottomRight()).y;
- return std::make_pair(std::max(yFrom / rowHeight_, 0),
- std::min<ptrdiff_t>((yTo / rowHeight_) + 1, refParent().getRowCount()));
+ return { std::max(yFrom / rowHeight_, 0),
+ std::min<ptrdiff_t>((yTo / rowHeight_) + 1, refParent().getRowCount()) };
}
private:
@@ -1269,7 +1269,7 @@ private:
ColLabelWin& colLabelWin_;
std::unique_ptr<MouseSelection> activeSelection_; //bound while user is selecting with mouse
- MouseHighlight highlight_; //current mouse highlight_ (superseeded by activeSelection_ if available)
+ MouseHighlight highlight_; //current mouse highlight_ (superseded by activeSelection_ if available)
ptrdiff_t cursorRow_ = 0;
size_t selectionAnchor_ = 0;
diff --git a/wx+/grid.h b/wx+/grid.h
index 8b916f2f..a5c1a783 100755
--- a/wx+/grid.h
+++ b/wx+/grid.h
@@ -14,8 +14,8 @@
#include <zen/basic_math.h>
#include <zen/optional.h>
-//a user-friendly, extensible and high-performance grid control
+//a user-friendly, extensible and high-performance grid control
namespace zen
{
enum class ColumnType { NONE = -1 }; //user-defiend column type
diff --git a/wx+/http.cpp b/wx+/http.cpp
index fa88bb1d..1526d30f 100755
--- a/wx+/http.cpp
+++ b/wx+/http.cpp
@@ -33,9 +33,9 @@ public:
{
ZEN_ON_SCOPE_FAIL( cleanup(); /*destructor call would lead to member double clean-up!!!*/ );
- assert(!startsWith(url, L"https:", CmpAsciiNoCase())); //not supported by wxHTTP!
- const std::wstring urlFmt = startsWith(url, L"http://", CmpAsciiNoCase()) ||
- startsWith(url, L"https://", CmpAsciiNoCase()) ? afterFirst(url, L"://", IF_MISSING_RETURN_NONE) : url;
+ //assert(!startsWith(url, L"https:", CmpAsciiNoCase())); //not supported by wxHTTP!
+
+ const std::wstring urlFmt = afterFirst(url, L"://", IF_MISSING_RETURN_NONE);
const std::wstring server = beforeFirst(urlFmt, L'/', IF_MISSING_RETURN_ALL);
const std::wstring page = L'/' + afterFirst(urlFmt, L'/', IF_MISSING_RETURN_NONE);
diff --git a/wx+/http.h b/wx+/http.h
index aba6b96d..bbfa3a74 100755
--- a/wx+/http.h
+++ b/wx+/http.h
@@ -15,7 +15,7 @@ namespace zen
/*
TREAD-SAFETY
------------
- Windows: WinInet-based => may be called from worker thread
+ Windows: WinInet-based => may be called from worker thread, supports HTTPS
Linux: wxWidgets-based => don't call from worker thread
*/
class HttpInputStream
diff --git a/wx+/image_resources.h b/wx+/image_resources.h
index 3c3bf39c..cc4ab2cc 100755
--- a/wx+/image_resources.h
+++ b/wx+/image_resources.h
@@ -11,6 +11,7 @@
#include <wx/animate.h>
#include <zen/zstring.h>
+
namespace zen
{
void initResourceImages(const Zstring& filepath); //pass resources .zip file at application startup
diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h
index f9bf862b..03969c00 100755
--- a/wx+/no_flicker.h
+++ b/wx+/no_flicker.h
@@ -10,6 +10,7 @@
#include <wx/textctrl.h>
#include <wx/stattext.h>
+
namespace zen
{
inline
diff --git a/wx+/rtl.h b/wx+/rtl.h
index 1e775c79..e479c5a8 100755
--- a/wx+/rtl.h
+++ b/wx+/rtl.h
@@ -12,6 +12,7 @@
#include <wx/image.h>
#include <wx/app.h>
+
namespace zen
{
//functions supporting right-to-left GUI layout
diff --git a/wx+/toggle_button.h b/wx+/toggle_button.h
index 0172881e..f61c3857 100755
--- a/wx+/toggle_button.h
+++ b/wx+/toggle_button.h
@@ -10,6 +10,9 @@
#include <wx/bmpbuttn.h>
#include <wx+/bitmap_button.h>
+
+namespace zen
+{
class ToggleButton : public wxBitmapButton
{
public:
@@ -29,12 +32,11 @@ public:
const wxBitmap& inactiveBmp);
void setActive(bool value);
- bool isActive() const { return active; }
- void toggle() { setActive(!active); }
+ bool isActive() const { return active_; }
+ void toggle() { setActive(!active_); }
private:
- bool active = false;
-
+ bool active_ = false;
wxBitmap activeBmp_;
wxBitmap inactiveBmp_;
};
@@ -53,15 +55,16 @@ void ToggleButton::init(const wxBitmap& activeBmp,
activeBmp_ = activeBmp;
inactiveBmp_ = inactiveBmp;
- setActive(active);
+ setActive(active_);
}
inline
void ToggleButton::setActive(bool value)
{
- active = value;
- zen::setImage(*this, active ? activeBmp_ : inactiveBmp_);
+ active_ = value;
+ setImage(*this, active_ ? activeBmp_ : inactiveBmp_);
+}
}
#endif //TOGGLE_BUTTON_H_8173024810574556
bgstack15