diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:56:27 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:56:27 +0200 |
commit | 19eb73ff543c81c6886725a20dea0060cb0c0c26 (patch) | |
tree | 91442c0fdb9cac90c75dfb6bb84def9df297cd77 /wx+ | |
parent | 7.2 (diff) | |
download | FreeFileSync-19eb73ff543c81c6886725a20dea0060cb0c0c26.tar.gz FreeFileSync-19eb73ff543c81c6886725a20dea0060cb0c0c26.tar.bz2 FreeFileSync-19eb73ff543c81c6886725a20dea0060cb0c0c26.zip |
7.3
Diffstat (limited to 'wx+')
-rw-r--r-- | wx+/file_drop.h | 8 | ||||
-rw-r--r-- | wx+/grid.cpp | 52 | ||||
-rw-r--r-- | wx+/grid.h | 9 | ||||
-rw-r--r-- | wx+/image_resources.cpp | 5 | ||||
-rw-r--r-- | wx+/tooltip.cpp | 2 |
5 files changed, 42 insertions, 34 deletions
diff --git a/wx+/file_drop.h b/wx+/file_drop.h index 2feef6e2..c9f2469c 100644 --- a/wx+/file_drop.h +++ b/wx+/file_drop.h @@ -28,7 +28,7 @@ namespace zen /* 1. setup a window to emit EVENT_DROP_FILE: - - simple file system paths: setupFileDrop + - simple file system paths: setupFileDrop - any shell paths with validation: setupShellItemDrop 2. register events: @@ -64,14 +64,14 @@ const wxEventType EVENT_DROP_FILE = impl::createNewEventType(); class FileDropEvent : public wxCommandEvent { public: - FileDropEvent(const std::vector<Zstring>& filesDropped) : wxCommandEvent(EVENT_DROP_FILE), filesDropped_(filesDropped) {} + FileDropEvent(const std::vector<Zstring>& droppedPaths) : wxCommandEvent(EVENT_DROP_FILE), droppedPaths_(droppedPaths) {} - const std::vector<Zstring>& getFiles() const { return filesDropped_; } + const std::vector<Zstring>& getPaths() const { return droppedPaths_; } private: wxEvent* Clone() const override { return new FileDropEvent(*this); } - const std::vector<Zstring> filesDropped_; + const std::vector<Zstring> droppedPaths_; }; typedef void (wxEvtHandler::*FileDropEventFunction)(FileDropEvent&); diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 7573fcb9..b24fabdc 100644 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -40,7 +40,15 @@ const int GridData::COLUMN_GAP_LEFT = 4; namespace { -//------------ Grid Constants -------------------------------- +//------------------------------ Grid Parameters -------------------------------- +wxColor getColorLabelText() { return wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); } + +wxColor getColorLabelGradientFrom () { return wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); } +wxColor getColorLabelGradientTo () { return wxColour(200, 200, 200); } //light grey + +wxColor getColorLabelGradientFocusFrom() { return getColorLabelGradientFrom(); } +wxColor getColorLabelGradientFocusTo () { return getColorSelectionGradientFrom(); } + const double MOUSE_DRAG_ACCELERATION = 1.5; //unit: [rows / (pixel * sec)] -> same value as Explorer! const int DEFAULT_COL_LABEL_BORDER = 6; //top + bottom border in addition to label height //const int COLUMN_LABEL_BORDER = GridData::COLUMN_GAP_LEFT; @@ -50,12 +58,6 @@ const int ROW_LABEL_BORDER = 3; const int COLUMN_RESIZE_TOLERANCE = 6; //unit [pixel] const int COLUMN_FILL_GAP_TOLERANCE = 10; //enlarge column to fill full width when resizing -const wxColor COLOR_LABEL_GRADIENT_FROM = *wxWHITE; -const wxColor COLOR_LABEL_GRADIENT_TO = wxColour(200, 200, 200); //light grey - -const wxColor COLOR_LABEL_GRADIENT_FROM_FOCUS = COLOR_LABEL_GRADIENT_FROM; -const wxColor COLOR_LABEL_GRADIENT_TO_FOCUS = getColorSelectionGradientFrom(); - const wxColor colorGridLine = wxColour(192, 192, 192); //light grey const bool fillGapAfterColumns = true; //draw rows/column label to fill full window width; may become an instance variable some time? @@ -202,7 +204,7 @@ wxRect GridData::drawColumnLabelBorder(wxDC& dc, const wxRect& rect) //returns r //draw border (with gradient) { wxDCPenChanger dummy(dc, wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID)); - dc.GradientFillLinear(wxRect(rect.GetTopRight(), rect.GetBottomRight()), COLOR_LABEL_GRADIENT_FROM, dc.GetPen().GetColour(), wxSOUTH); + dc.GradientFillLinear(wxRect(rect.GetTopRight(), rect.GetBottomRight()), getColorLabelGradientFrom(), dc.GetPen().GetColour(), wxSOUTH); dc.DrawLine(rect.GetBottomLeft(), rect.GetBottomRight() + wxPoint(1, 0)); } @@ -213,15 +215,15 @@ wxRect GridData::drawColumnLabelBorder(wxDC& dc, const wxRect& rect) //returns r void GridData::drawColumnLabelBackground(wxDC& dc, const wxRect& rect, bool highlighted) { if (highlighted) - dc.GradientFillLinear(rect, COLOR_LABEL_GRADIENT_FROM_FOCUS, COLOR_LABEL_GRADIENT_TO_FOCUS, wxSOUTH); + dc.GradientFillLinear(rect, getColorLabelGradientFocusFrom(), getColorLabelGradientFocusTo(), wxSOUTH); else //regular background gradient - dc.GradientFillLinear(rect, COLOR_LABEL_GRADIENT_FROM, COLOR_LABEL_GRADIENT_TO, wxSOUTH); //clear overlapping cells + dc.GradientFillLinear(rect, getColorLabelGradientFrom(), getColorLabelGradientTo(), wxSOUTH); //clear overlapping cells } void GridData::drawColumnLabelText(wxDC& dc, const wxRect& rect, const wxString& text) { - wxDCTextColourChanger dummy(dc, *wxBLACK); //accessibility: always set both foreground AND background colors! + wxDCTextColourChanger dummy(dc, getColorLabelText()); //accessibility: always set both foreground AND background colors! drawTextLabelFitting(dc, text, rect, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); } @@ -384,17 +386,17 @@ private: { const wxRect& clientRect = GetClientRect(); - dc.GradientFillLinear(clientRect, COLOR_LABEL_GRADIENT_FROM, COLOR_LABEL_GRADIENT_TO, wxSOUTH); + dc.GradientFillLinear(clientRect, getColorLabelGradientFrom(), getColorLabelGradientTo(), wxSOUTH); dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID)); { - wxDCPenChanger dummy(dc, COLOR_LABEL_GRADIENT_FROM); + wxDCPenChanger dummy(dc, getColorLabelGradientFrom()); dc.DrawLine(clientRect.GetTopLeft(), clientRect.GetTopRight()); } - dc.GradientFillLinear(wxRect(clientRect.GetBottomLeft (), clientRect.GetTopLeft ()), COLOR_LABEL_GRADIENT_FROM, dc.GetPen().GetColour(), wxSOUTH); - dc.GradientFillLinear(wxRect(clientRect.GetBottomRight(), clientRect.GetTopRight()), COLOR_LABEL_GRADIENT_FROM, dc.GetPen().GetColour(), wxSOUTH); + dc.GradientFillLinear(wxRect(clientRect.GetBottomLeft (), clientRect.GetTopLeft ()), getColorLabelGradientFrom(), dc.GetPen().GetColour(), wxSOUTH); + dc.GradientFillLinear(wxRect(clientRect.GetBottomRight(), clientRect.GetTopRight()), getColorLabelGradientFrom(), dc.GetPen().GetColour(), wxSOUTH); dc.DrawLine(clientRect.GetBottomLeft(), clientRect.GetBottomRight()); @@ -470,12 +472,11 @@ private: void render(wxDC& dc, const wxRect& rect) override { - /* IsEnabled() vs IsThisEnabled() since wxWidgets 2.9.5: - void wxWindowBase::NotifyWindowOnEnableChange(), called from bool wxWindowBase::Enable(), has this buggy exception of NOT - refreshing child elements when disabling a IsTopLevel() dialog, e.g. when showing a modal dialog. + void wxWindowBase::NotifyWindowOnEnableChange(), called from bool wxWindowBase::Enable(), fails to refresh + child elements when disabling a IsTopLevel() dialog, e.g. when showing a modal dialog. The unfortunate effect on XP for using IsEnabled() when rendering the grid is that the user can move the modal dialog and *draw* with it on the background while the grid refreshes as disabled incrementally! @@ -513,8 +514,8 @@ private: void drawRowLabel(wxDC& dc, const wxRect& rect, size_t row) { //clearArea(dc, rect, getColorRowLabel()); - dc.GradientFillLinear(rect, COLOR_LABEL_GRADIENT_FROM, COLOR_LABEL_GRADIENT_TO, wxEAST); //clear overlapping cells - wxDCTextColourChanger dummy3(dc, *wxBLACK); //accessibility: always set both foreground AND background colors! + dc.GradientFillLinear(rect, getColorLabelGradientFrom(), getColorLabelGradientTo(), wxEAST); //clear overlapping cells + wxDCTextColourChanger dummy3(dc, getColorLabelText()); //accessibility: always set both foreground AND background colors! //label text wxRect textRect = rect; @@ -673,9 +674,9 @@ private: if (activeMove && activeMove->isRealMove()) { if (col + 1 == activeMove->refColumnTo()) //handle pos 1, 2, .. up to "at end" position - dc.GradientFillLinear(wxRect(rect.GetTopRight(), rect.GetBottomRight() + wxPoint(-2, 0)), COLOR_LABEL_GRADIENT_FROM, *wxBLUE, wxSOUTH); + dc.GradientFillLinear(wxRect(rect.GetTopRight(), rect.GetBottomRight() + wxPoint(-2, 0)), getColorLabelGradientFrom(), *wxBLUE, wxSOUTH); else if (col == activeMove->refColumnTo() && col == 0) //pos 0 - dc.GradientFillLinear(wxRect(rect.GetTopLeft(), rect.GetBottomLeft() + wxPoint(2, 0)), COLOR_LABEL_GRADIENT_FROM, *wxBLUE, wxSOUTH); + dc.GradientFillLinear(wxRect(rect.GetTopLeft(), rect.GetBottomLeft() + wxPoint(2, 0)), getColorLabelGradientFrom(), *wxBLUE, wxSOUTH); } } } @@ -2050,6 +2051,13 @@ void Grid::scrollTo(size_t row) } + bool Grid::Enable(bool enable) + { + Refresh(); + return wxScrolledWindow::Enable(enable); + } + + size_t Grid::getGridCursor() const { return mainWin_->getCursor(); @@ -192,7 +192,8 @@ public: void scrollTo(size_t row); void Refresh(bool eraseBackground = true, const wxRect* rect = nullptr) override; - bool Enable( bool enable = true) override { Refresh(); return wxScrolledWindow::Enable(enable); } + bool Enable(bool enable = true) override; + //############################################################################################################ private: @@ -234,11 +235,11 @@ private: std::vector<size_t> get() const { - std::vector<size_t> selection; + std::vector<size_t> result; for (size_t row = 0; row < rowSelectionValue.size(); ++row) if (rowSelectionValue[row] != 0) - selection.push_back(row); - return selection; + result.push_back(row); + return result; } void selectAll() { selectRange(0, rowSelectionValue.size(), true); } diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp index 9d4f2396..7383f620 100644 --- a/wx+/image_resources.cpp +++ b/wx+/image_resources.cpp @@ -42,10 +42,9 @@ class GlobalResources public: static GlobalResources& instance() { -#if defined _MSC_VER && _MSC_VER > 1800 -#error remove warning +#if defined _MSC_VER && _MSC_VER < 1900 +#error function scope static initialization is not yet thread-safe! #endif - //caveat: function scope static initialization is not thread-safe in VS 2010! => but we wouldn't use wxWidgets in combination with multithreading anyway! static GlobalResources inst; return inst; } diff --git a/wx+/tooltip.cpp b/wx+/tooltip.cpp index 91298db4..ea9852d3 100644 --- a/wx+/tooltip.cpp +++ b/wx+/tooltip.cpp @@ -73,7 +73,7 @@ void Tooltip::show(const wxString& text, wxPoint mousePos, const wxBitmap* bmp) } tipWindow->GetSizer()->SetSizeHints(tipWindow); //~=Fit() + SetMinSize() - //Linux: Fit() seems to be somewhat broken => this needs to be called EVERY time inside show, not only if text or bmp change + //Linux: Fit() seems to be broken => this needs to be called EVERY time inside show, not only if text or bmp change const wxPoint newPos = wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ? mousePos - wxPoint(30 + tipWindow->GetSize().GetWidth(), 0) : |