diff --git a/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp b/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp index ff04e6b786..18b38cc5be 100644 --- a/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp +++ b/extras/Introjucer/Source/Utility/jucer_FileHelpers.cpp @@ -198,10 +198,8 @@ namespace FileHelpers return toks.joinIntoString ("/"); } - else - { - return p; - } + + return p; } String simplifyPath (const String& path) diff --git a/modules/juce_core/native/juce_BasicNativeHeaders.h b/modules/juce_core/native/juce_BasicNativeHeaders.h index 074506f42a..9704489906 100644 --- a/modules/juce_core/native/juce_BasicNativeHeaders.h +++ b/modules/juce_core/native/juce_BasicNativeHeaders.h @@ -126,7 +126,6 @@ #if JUCE_MSVC && ! JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES #pragma comment (lib, "kernel32.lib") #pragma comment (lib, "user32.lib") - #pragma comment (lib, "shell32.lib") #pragma comment (lib, "wininet.lib") #pragma comment (lib, "advapi32.lib") #pragma comment (lib, "ws2_32.lib") diff --git a/modules/juce_core/native/juce_win32_ComSmartPtr.h b/modules/juce_core/native/juce_win32_ComSmartPtr.h index 5ab921528a..ab775b011d 100644 --- a/modules/juce_core/native/juce_win32_ComSmartPtr.h +++ b/modules/juce_core/native/juce_win32_ComSmartPtr.h @@ -63,12 +63,7 @@ public: HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER) { - #if ! JUCE_MINGW return ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress()); - #else - jassertfalse; // need to find a mingw equivalent of __uuidof to make this possible - return E_NOTIMPL; - #endif } template @@ -83,12 +78,7 @@ public: template HRESULT QueryInterface (ComSmartPtr& destObject) const { - #if ! JUCE_MINGW return this->QueryInterface (__uuidof (OtherComClass), destObject); - #else - jassertfalse; // need to find a mingw equivalent of __uuidof to make this possible - return E_NOTIMPL; - #endif } private: @@ -130,12 +120,7 @@ public: JUCE_COMRESULT QueryInterface (REFIID refId, void** result) { - #if ! JUCE_MINGW if (refId == __uuidof (ComClass)) { this->AddRef(); *result = dynamic_cast (this); return S_OK; } - #else - jassertfalse; // need to find a mingw equivalent of __uuidof to make this possible - #endif - if (refId == IID_IUnknown) { this->AddRef(); *result = dynamic_cast (this); return S_OK; } *result = 0; diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index d0f86dc085..b3bd26e5df 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -711,20 +711,19 @@ bool Process::openDocument (const String& fileName, const String& parameters) void File::revealToUser() const { - #if JUCE_MINGW - jassertfalse; // not supported in MinGW.. - #else - #pragma warning (push) - #pragma warning (disable: 4090) // (alignment warning) - ITEMIDLIST* const itemIDList = ILCreateFromPath (fullPath.toWideCharPointer()); - #pragma warning (pop) + DynamicLibrary dll ("Shell32.dll"); + JUCE_LOAD_WINAPI_FUNCTION (dll, ILCreateFromPathW, ilCreateFromPathW, ITEMIDLIST*, (LPCWSTR)) + JUCE_LOAD_WINAPI_FUNCTION (dll, ILFree, ilFree, void, (ITEMIDLIST*)) + JUCE_LOAD_WINAPI_FUNCTION (dll, SHOpenFolderAndSelectItems, shOpenFolderAndSelectItems, HRESULT, (ITEMIDLIST*, UINT, void*, DWORD)) - if (itemIDList != nullptr) + if (ilCreateFromPathW != nullptr && shOpenFolderAndSelectItems != nullptr && ilFree != nullptr) { - SHOpenFolderAndSelectItems (itemIDList, 0, nullptr, 0); - ILFree (itemIDList); + if (ITEMIDLIST* const itemIDList = ilCreateFromPathW (fullPath.toWideCharPointer())) + { + shOpenFolderAndSelectItems (itemIDList, 0, nullptr, 0); + ilFree (itemIDList); + } } - #endif } //============================================================================== diff --git a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp index e2e228846b..cdf567e390 100644 --- a/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp +++ b/modules/juce_graphics/native/juce_win32_DirectWriteTypeLayout.cpp @@ -40,11 +40,7 @@ namespace DirectWriteTypeLayout JUCE_COMRESULT QueryInterface (REFIID refId, void** result) { - #if ! JUCE_MINGW if (refId == __uuidof (IDWritePixelSnapping)) { AddRef(); *result = dynamic_cast (this); return S_OK; } - #else - jassertfalse; // need to find a mingw equivalent of __uuidof to make this possible - #endif return ComBaseClassHelper::QueryInterface (refId, result); } diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index aeccabf6ba..8eb33695c5 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -1547,7 +1547,10 @@ public: If not overridden, a component will forward this message to its parent, so that parent components can collect mouse-wheel messages that happen to - child components which aren't interested in them. + child components which aren't interested in them. (Bear in mind that if + you attach a component as a mouse-listener to other components, then + those wheel moves will also end up calling this method and being passed up + to the parents, which may not be what you intended to happen). @param event details about the mouse event @param wheel details about the mouse wheel movement diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 823ce68de0..515a3885e8 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -27,30 +27,30 @@ class ListBox::RowComponent : public Component, public TooltipClient { public: - RowComponent (ListBox& owner_) - : owner (owner_), row (-1), + RowComponent (ListBox& lb) + : owner (lb), row (-1), selected (false), isDragging (false), selectRowOnMouseUp (false) { } void paint (Graphics& g) { - if (owner.getModel() != nullptr) - owner.getModel()->paintListBoxItem (row, g, getWidth(), getHeight(), selected); + if (ListBoxModel* m = owner.getModel()) + m->paintListBoxItem (row, g, getWidth(), getHeight(), selected); } - void update (const int row_, const bool selected_) + void update (const int newRow, const bool nowSelected) { - if (row != row_ || selected != selected_) + if (row != newRow || selected != nowSelected) { repaint(); - row = row_; - selected = selected_; + row = newRow; + selected = nowSelected; } - if (owner.getModel() != nullptr) + if (ListBoxModel* m = owner.getModel()) { - customComponent = owner.getModel()->refreshComponentForRow (row_, selected_, customComponent.release()); + customComponent = m->refreshComponentForRow (newRow, nowSelected, customComponent.release()); if (customComponent != nullptr) { @@ -71,8 +71,8 @@ public: { owner.selectRowsBasedOnModifierKeys (row, e.mods, false); - if (owner.getModel() != nullptr) - owner.getModel()->listBoxItemClicked (row, e); + if (ListBoxModel* m = owner.getModel()) + m->listBoxItemClicked (row, e); } else { @@ -87,31 +87,35 @@ public: { owner.selectRowsBasedOnModifierKeys (row, e.mods, true); - if (owner.getModel() != nullptr) - owner.getModel()->listBoxItemClicked (row, e); + if (ListBoxModel* m = owner.getModel()) + m->listBoxItemClicked (row, e); } } void mouseDoubleClick (const MouseEvent& e) { - if (owner.getModel() != nullptr && isEnabled()) - owner.getModel()->listBoxItemDoubleClicked (row, e); + if (ListBoxModel* m = owner.getModel()) + if (isEnabled()) + m->listBoxItemDoubleClicked (row, e); } void mouseDrag (const MouseEvent& e) { - if (isEnabled() && owner.getModel() != nullptr && ! (e.mouseWasClicked() || isDragging)) + if (ListBoxModel* m = owner.getModel()) { - const SparseSet selectedRows (owner.getSelectedRows()); - - if (selectedRows.size() > 0) + if (isEnabled() && ! (e.mouseWasClicked() || isDragging)) { - const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); + const SparseSet selectedRows (owner.getSelectedRows()); - if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) + if (selectedRows.size() > 0) { - isDragging = true; - owner.startDragAndDrop (e, dragDescription, true); + const var dragDescription (m->getDragSourceDescription (selectedRows)); + + if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) + { + isDragging = true; + owner.startDragAndDrop (e, dragDescription, true); + } } } } @@ -125,8 +129,8 @@ public: String getTooltip() { - if (owner.getModel() != nullptr) - return owner.getModel()->getTooltipForRow (row); + if (ListBoxModel* m = owner.getModel()) + return m->getTooltipForRow (row); return String::empty; } @@ -146,8 +150,8 @@ private: class ListBox::ListViewport : public Viewport { public: - ListViewport (ListBox& owner_) - : owner (owner_) + ListViewport (ListBox& lb) + : owner (lb) { setWantsKeyboardFocus (false); @@ -184,8 +188,8 @@ public: { updateVisibleArea (true); - if (owner.getModel() != nullptr) - owner.getModel()->listWasScrolled(); + if (ListBoxModel* m = owner.getModel()) + m->listWasScrolled(); } void updateVisibleArea (const bool makeSureItUpdatesContent) @@ -334,9 +338,9 @@ private: enum { defaultListRowHeight = 22 }; //============================================================================== -ListBox::ListBox (const String& name, ListBoxModel* const model_) +ListBox::ListBox (const String& name, ListBoxModel* const m) : Component (name), - model (model_), + model (m), totalItems (0), rowHeight (defaultListRowHeight), minimumRowWidth (0), @@ -401,7 +405,7 @@ void ListBox::paintOverChildren (Graphics& g) void ListBox::resized() { - viewport->setBoundsInset (BorderSize (outlineThickness + ((headerComponent != nullptr) ? headerComponent->getHeight() : 0), + viewport->setBoundsInset (BorderSize (outlineThickness + (headerComponent != nullptr ? headerComponent->getHeight() : 0), outlineThickness, outlineThickness, outlineThickness)); viewport->setSingleStepSizes (20, getRowHeight()); @@ -509,7 +513,7 @@ void ListBox::setSelectedRows (const SparseSet& setOfRowsToBeSelected, viewport->updateContents(); - if ((model != nullptr) && sendNotificationEventToModel == sendNotification) + if (model != nullptr && sendNotificationEventToModel == sendNotification) model->selectedRowsChanged (lastRowSelected); } @@ -593,7 +597,7 @@ bool ListBox::isRowSelected (const int row) const int ListBox::getLastRowSelected() const { - return (isRowSelected (lastRowSelected)) ? lastRowSelected : -1; + return isRowSelected (lastRowSelected) ? lastRowSelected : -1; } //============================================================================== @@ -839,9 +843,9 @@ void ListBox::colourChanged() repaint(); } -void ListBox::setOutlineThickness (const int outlineThickness_) +void ListBox::setOutlineThickness (const int newThickness) { - outlineThickness = outlineThickness_; + outlineThickness = newThickness; resized(); }