summaryrefslogtreecommitdiff
path: root/wx+
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2020-03-20 22:34:51 +0000
committerDaniel Wilhelm <shieldwed@outlook.com>2020-03-20 22:34:51 +0000
commit543ddcd795ba2fa44676b59135a745f51f28a8da (patch)
tree5c378aa54f4bb65c081cf9a92530d8af1f1f53dd /wx+
parentMerge branch '10.20' into 'master' (diff)
parentadd upstream 10.21 (diff)
downloadFreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.gz
FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.tar.bz2
FreeFileSync-543ddcd795ba2fa44676b59135a745f51f28a8da.zip
Merge branch '10.21' into 'master'10.21
add upstream 10.21 See merge request opensource-tracking/FreeFileSync!18
Diffstat (limited to 'wx+')
-rw-r--r--wx+/file_drop.cpp25
-rw-r--r--wx+/file_drop.h3
-rw-r--r--wx+/grid.cpp2
-rw-r--r--wx+/image_resources.cpp2
-rw-r--r--wx+/image_tools.cpp2
-rw-r--r--wx+/popup_dlg.cpp8
6 files changed, 29 insertions, 13 deletions
diff --git a/wx+/file_drop.cpp b/wx+/file_drop.cpp
index 65d5d861..938f9dbd 100644
--- a/wx+/file_drop.cpp
+++ b/wx+/file_drop.cpp
@@ -23,9 +23,23 @@ namespace
class WindowDropTarget : public wxFileDropTarget
{
public:
- WindowDropTarget(wxWindow& dropWindow) : dropWindow_(dropWindow) {}
+ WindowDropTarget(const wxWindow& dropWindow) : dropWindow_(dropWindow) {}
private:
+ wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) override
+ {
+ //why the FUCK I is drag & drop still working while showing another modal dialog!???
+ //why the FUCK II is drag & drop working even when dropWindow is disabled!?? [Windows] => we can fix this
+ //why the FUCK III is dropWindow NOT disabled while showing another modal dialog!??? [macOS, Linux] => we CANNOT fix this: FUUUUUUUUUUUUUU...
+ if (!dropWindow_.IsEnabled())
+ return wxDragNone;
+
+ return wxFileDropTarget::OnDragOver(x, y, def);
+ }
+
+ //"bool wxDropTarget::GetData() [...] This method may only be called from within OnData()."
+ //=> FUUUUUUUUUUUUUU........ a.k.a. no support for DragDropValidator during mouse hover! >:(
+
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& fileArray) override
{
/*Linux, MTP: we get an empty file array
@@ -35,6 +49,9 @@ private:
/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C002%5D/Telefonspeicher/Folder/file.txt
*/
+ if (!dropWindow_.IsEnabled())
+ return false;
+
//wxPoint clientDropPos(x, y)
std::vector<Zstring> filePaths;
for (const wxString& file : fileArray)
@@ -46,12 +63,12 @@ private:
return true;
}
- wxWindow& dropWindow_;
+ const wxWindow& dropWindow_;
};
}
-void zen::setupFileDrop(wxWindow& wnd)
+void zen::setupFileDrop(wxWindow& dropWindow)
{
- wnd.SetDropTarget(new WindowDropTarget(wnd)); /*takes ownership*/
+ dropWindow.SetDropTarget(new WindowDropTarget(dropWindow)); /*takes ownership*/
}
diff --git a/wx+/file_drop.h b/wx+/file_drop.h
index 9826bf27..0a1089fc 100644
--- a/wx+/file_drop.h
+++ b/wx+/file_drop.h
@@ -58,8 +58,7 @@ using FileDropEventFunction = void (wxEvtHandler::*)(FileDropEvent&);
-
-void setupFileDrop(wxWindow& wnd);
+void setupFileDrop(wxWindow& dropWindow);
}
#endif //FILE_DROP_H_09457802957842560325626
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index fe168df6..c7b43d4a 100644
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
@@ -159,7 +159,7 @@ wxSize GridData::drawCellText(wxDC& dc, const wxRect& rect, const std::wstring&
*/
//truncate large texts and add ellipsis
- assert(!contains(text, L"\n"));
+ assert(!contains(text, L'\n'));
std::wstring textTrunc = text;
wxSize extentTrunc = dc.GetTextExtent(textTrunc);
diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp
index 070b9112..255a352e 100644
--- a/wx+/image_resources.cpp
+++ b/wx+/image_resources.cpp
@@ -231,7 +231,7 @@ void GlobalBitmaps::init(const Zstring& zipPath)
{
wxMemoryInputStream wxstream(stream.c_str(), stream.size()); //stream does not take ownership of data
//bonus: work around wxWidgets bug: wxAnimation::Load() requires seekable input stream (zip-input stream is not seekable)
-
+
if (endsWith(fileName, L".png"))
{
wxImage img(wxstream, wxBITMAP_TYPE_PNG);
diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp
index 8f94d1bc..9fcc5563 100644
--- a/wx+/image_tools.cpp
+++ b/wx+/image_tools.cpp
@@ -120,7 +120,7 @@ std::vector<std::pair<wxString, wxSize>> getTextExtentInfo(const wxString& text,
dc.SetFont(font); //the font parameter of GetMultiLineTextExtent() is not evalated on OS X, wxWidgets 2.9.5, so apply it to the DC directly!
std::vector<std::pair<wxString, wxSize>> lineInfo; //text + extent
- for (const wxString& line : split(text, L"\n", SplitType::ALLOW_EMPTY))
+ for (const wxString& line : split(text, L'\n', SplitType::ALLOW_EMPTY))
lineInfo.emplace_back(line, line.empty() ? wxSize() : dc.GetTextExtent(line));
return lineInfo;
diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp
index 11c4511f..c677cf57 100644
--- a/wx+/popup_dlg.cpp
+++ b/wx+/popup_dlg.cpp
@@ -45,7 +45,7 @@ void setBestInitialSize(wxTextCtrl& ctrl, const wxString& text, wxSize maxSize)
auto itEnd = std::find(it, text.end(), L'\n');
wxString line(it, itEnd);
if (line.empty())
- line = L" "; //GetTextExtent() returns (0, 0) for empty strings!
+ line = L' '; //GetTextExtent() returns (0, 0) for empty strings!
wxSize sz = ctrl.GetTextExtent(line); //exactly gives row height, but does *not* consider newlines
if (evalLineExtent(sz))
@@ -135,8 +135,8 @@ public:
{
wxString text;
if (!cfg.textMain.empty())
- text += L"\n";
- text += trimCpy(cfg.textDetail) + L"\n"; //add empty top/bottom lines *instead* of using border space!
+ text += L'\n';
+ text += trimCpy(cfg.textDetail) + L'\n'; //add empty top/bottom lines *instead* of using border space!
setBestInitialSize(*m_textCtrlTextDetail, text, wxSize(maxWidth, maxHeight));
m_textCtrlTextDetail->ChangeValue(text);
}
@@ -145,7 +145,7 @@ public:
if (checkBoxValue_)
{
- assert(contains(cfg.checkBoxLabel, L"&"));
+ assert(contains(cfg.checkBoxLabel, L'&'));
m_checkBoxCustom->SetLabel(cfg.checkBoxLabel);
m_checkBoxCustom->SetValue(*checkBoxValue_);
}
bgstack15