Browse Source

Removed 'const' from some virtual method return types - this might require a few tweaks to user-code.

tags/2021-05-28
Julian Storer 13 years ago
parent
commit
bd9a32c757
18 changed files with 54 additions and 63 deletions
  1. +1
    -1
      extras/JuceDemo/Source/demos/DragAndDropDemo.cpp
  2. +2
    -6
      extras/JuceDemo/Source/demos/TreeViewDemo.cpp
  3. +15
    -13
      modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp
  4. +1
    -1
      modules/juce_gui_basics/buttons/juce_Button.cpp
  5. +1
    -1
      modules/juce_gui_basics/buttons/juce_Button.h
  6. +3
    -6
      modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp
  7. +8
    -11
      modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp
  8. +2
    -2
      modules/juce_gui_basics/mouse/juce_TooltipClient.h
  9. +0
    -1
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  10. +1
    -1
      modules/juce_gui_basics/widgets/juce_ComboBox.h
  11. +3
    -3
      modules/juce_gui_basics/widgets/juce_ListBox.cpp
  12. +2
    -2
      modules/juce_gui_basics/widgets/juce_ListBox.h
  13. +2
    -2
      modules/juce_gui_basics/widgets/juce_TableListBox.cpp
  14. +1
    -1
      modules/juce_gui_basics/widgets/juce_TableListBox.h
  15. +4
    -4
      modules/juce_gui_basics/widgets/juce_TreeView.cpp
  16. +3
    -3
      modules/juce_gui_basics/widgets/juce_TreeView.h
  17. +4
    -4
      modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp
  18. +1
    -1
      modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.h

+ 1
- 1
extras/JuceDemo/Source/demos/DragAndDropDemo.cpp View File

@@ -70,7 +70,7 @@ public:
Justification::centredLeft, true);
}
const var getDragSourceDescription (const SparseSet<int>& selectedRows)
var getDragSourceDescription (const SparseSet<int>& selectedRows)
{
// for our drag desctription, we'll just make a list of the selected
// row numbers - this will be picked up by the drag target and displayed in


+ 2
- 6
extras/JuceDemo/Source/demos/TreeViewDemo.cpp View File

@@ -35,16 +35,12 @@ public:
{
}
~TreeViewDemoItem()
{
}
int getItemWidth() const
{
return xml.getIntAttribute ("width", -1);
}
const String getUniqueName() const
String getUniqueName() const
{
return xml.getTagName();
}
@@ -98,7 +94,7 @@ public:
}
}
const var getDragSourceDescription()
var getDragSourceDescription()
{
return "TreeView Items";
}


+ 15
- 13
modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp View File

@@ -1089,7 +1089,6 @@ bool AudioProcessorGraph::addConnection (const uint32 sourceNodeId,
connections.addSorted (sorter, new Connection (sourceNodeId, sourceChannelIndex,
destNodeId, destChannelIndex));
triggerAsyncUpdate();
return true;
}
@@ -1115,7 +1114,6 @@ bool AudioProcessorGraph::removeConnection (const uint32 sourceNodeId, const int
{
removeConnection (i);
doneAnything = true;
triggerAsyncUpdate();
}
}
@@ -1134,7 +1132,6 @@ bool AudioProcessorGraph::disconnectNode (const uint32 nodeId)
{
removeConnection (i);
doneAnything = true;
triggerAsyncUpdate();
}
}
@@ -1164,7 +1161,6 @@ bool AudioProcessorGraph::removeIllegalConnections()
{
removeConnection (i);
doneAnything = true;
triggerAsyncUpdate();
}
}
@@ -1172,14 +1168,22 @@ bool AudioProcessorGraph::removeIllegalConnections()
}
//==============================================================================
static void deleteRenderOpArray (Array<void*>& ops)
{
for (int i = ops.size(); --i >= 0;)
delete static_cast<GraphRenderingOps::AudioGraphRenderingOp*> (ops.getUnchecked(i));
}
void AudioProcessorGraph::clearRenderingSequence()
{
const ScopedLock sl (renderLock);
Array<void*> oldOps;
for (int i = renderingOps.size(); --i >= 0;)
delete static_cast<GraphRenderingOps::AudioGraphRenderingOp*> (renderingOps.getUnchecked(i));
{
const ScopedLock sl (renderLock);
renderingOps.swapWithArray (oldOps);
}
renderingOps.clear();
deleteRenderOpArray (oldOps);
}
bool AudioProcessorGraph::isAnInputTo (const uint32 possibleInputId,
@@ -1237,8 +1241,6 @@ void AudioProcessorGraph::buildRenderingSequence()
numMidiBuffersNeeded = calculator.getNumMidiBuffersNeeded();
}
Array<void*> oldRenderingOps (renderingOps);
{
// swap over to the new rendering sequence..
const ScopedLock sl (renderLock);
@@ -1252,11 +1254,11 @@ void AudioProcessorGraph::buildRenderingSequence()
while (midiBuffers.size() < numMidiBuffersNeeded)
midiBuffers.add (new MidiBuffer());
renderingOps = newRenderingOps;
renderingOps.swapWithArray (newRenderingOps);
}
for (int i = oldRenderingOps.size(); --i >= 0;)
delete static_cast<GraphRenderingOps::AudioGraphRenderingOp*> (oldRenderingOps.getUnchecked(i));
// delete the old ones..
deleteRenderOpArray (newRenderingOps);
}
void AudioProcessorGraph::handleAsyncUpdate()


+ 1
- 1
modules/juce_gui_basics/buttons/juce_Button.cpp View File

@@ -91,7 +91,7 @@ void Button::setTooltip (const String& newTooltip)
generateTooltip = false;
}
const String Button::getTooltip()
String Button::getTooltip()
{
if (generateTooltip && commandManagerToUse != nullptr && commandID != 0)
{


+ 1
- 1
modules/juce_gui_basics/buttons/juce_Button.h View File

@@ -299,7 +299,7 @@ public:
void setTooltip (const String& newTooltip);
// (implementation of the TooltipClient method)
const String getTooltip();
String getTooltip();
//==============================================================================


+ 3
- 6
modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp View File

@@ -80,7 +80,6 @@ class FileListItemComponent : public Component,
public AsyncUpdater
{
public:
//==============================================================================
FileListItemComponent (FileListComponent& owner_, TimeSliceThread& thread_)
: owner (owner_), thread (thread_), index (0), highlighted (false)
{
@@ -226,11 +225,9 @@ Component* FileListComponent::refreshComponentForRow (int row, bool isSelected,
}
DirectoryContentsList::FileInfo fileInfo;
if (fileList.getFileInfo (row, fileInfo))
comp->update (fileList.getDirectory(), &fileInfo, row, isSelected);
else
comp->update (fileList.getDirectory(), nullptr, row, isSelected);
comp->update (fileList.getDirectory(),
fileList.getFileInfo (row, fileInfo) ? &fileInfo : nullptr,
row, isSelected);
return comp;
}


+ 8
- 11
modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp View File

@@ -34,7 +34,6 @@ class FileListTreeItem : public TreeViewItem,
public ChangeListener
{
public:
//==============================================================================
FileListTreeItem (FileTreeComponent& owner_,
DirectoryContentsList* const parentContentsList_,
const int indexInContentsList_,
@@ -70,10 +69,10 @@ public:
//==============================================================================
bool mightContainSubItems() { return isDirectory; }
const String getUniqueName() const { return file.getFullPathName(); }
String getUniqueName() const { return file.getFullPathName(); }
int getItemHeight() const { return 22; }
const var getDragSourceDescription() { return owner.getDragAndDropDescription(); }
var getDragSourceDescription() { return owner.getDragAndDropDescription(); }
void itemOpennessChanged (bool isNowOpen)
{
@@ -133,12 +132,11 @@ public:
thread.addTimeSliceClient (this);
}
owner.getLookAndFeel()
.drawFileBrowserRow (g, width, height,
file.getFileName(),
&icon, fileSize, modTime,
isDirectory, isSelected(),
indexInContentsList, owner);
owner.getLookAndFeel().drawFileBrowserRow (g, width, height,
file.getFileName(),
&icon, fileSize, modTime,
isDirectory, isSelected(),
indexInContentsList, owner);
}
void itemClicked (const MouseEvent& e)
@@ -179,8 +177,7 @@ private:
bool isDirectory;
TimeSliceThread& thread;
Image icon;
String fileSize;
String modTime;
String fileSize, modTime;
void updateIcon (const bool onlyUpdateIfCached)
{


+ 2
- 2
modules/juce_gui_basics/mouse/juce_TooltipClient.h View File

@@ -44,7 +44,7 @@ public:
virtual ~TooltipClient() {}
/** Returns the string that this object wants to show as its tooltip. */
virtual const String getTooltip() = 0;
virtual String getTooltip() = 0;
};
@@ -73,7 +73,7 @@ public:
virtual void setTooltip (const String& newTooltip) { tooltipString = newTooltip; }
/** Returns the tooltip assigned to this object. */
virtual const String getTooltip() { return tooltipString; }
virtual String getTooltip() { return tooltipString; }
protected:
SettableTooltipClient() {}


+ 0
- 1
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -84,7 +84,6 @@ DECLARE_JNI_CLASS (ComponentPeerView, "com/juce/ComponentPeerView");
class AndroidComponentPeer : public ComponentPeer
{
public:
//==============================================================================
AndroidComponentPeer (Component* const component, const int windowStyleFlags)
: ComponentPeer (component, windowStyleFlags),
view (android.activity.callObjectMethod (JuceAppActivity.createNewView, component->isOpaque())),


+ 1
- 1
modules/juce_gui_basics/widgets/juce_ComboBox.h View File

@@ -350,7 +350,7 @@ public:
/** @internal */
void handleAsyncUpdate();
/** @internal */
const String getTooltip() { return label->getTooltip(); }
String getTooltip() { return label->getTooltip(); }
/** @internal */
void mouseDown (const MouseEvent&);
/** @internal */


+ 3
- 3
modules/juce_gui_basics/widgets/juce_ListBox.cpp View File

@@ -126,7 +126,7 @@ public:
customComponent->setBounds (getLocalBounds());
}
const String getTooltip()
String getTooltip()
{
if (owner.getModel() != nullptr)
return owner.getModel()->getTooltipForRow (row);
@@ -944,8 +944,8 @@ void ListBoxModel::selectedRowsChanged (int) {}
void ListBoxModel::deleteKeyPressed (int) {}
void ListBoxModel::returnKeyPressed (int) {}
void ListBoxModel::listWasScrolled() {}
const var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
const String ListBoxModel::getTooltipForRow (int) { return String::empty; }
var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
String ListBoxModel::getTooltipForRow (int) { return String::empty; }
END_JUCE_NAMESPACE

+ 2
- 2
modules/juce_gui_basics/widgets/juce_ListBox.h View File

@@ -145,12 +145,12 @@ public:
@see DragAndDropContainer::startDragging
*/
virtual const var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
virtual var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
/** You can override this to provide tool tips for specific rows.
@see TooltipClient
*/
virtual const String getTooltipForRow (int row);
virtual String getTooltipForRow (int row);
};


+ 2
- 2
modules/juce_gui_basics/widgets/juce_TableListBox.cpp View File

@@ -190,7 +190,7 @@ public:
owner.getModel()->cellDoubleClicked (row, columnId, e);
}
const String getTooltip()
String getTooltip()
{
const int columnId = owner.getHeader().getColumnIdAtX (getMouseXYRelative().getX());
@@ -480,7 +480,7 @@ void TableListBoxModel::returnKeyPressed (int) {}
void TableListBoxModel::listWasScrolled() {}
const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; }
const var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; }
Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate)
{


+ 1
- 1
modules/juce_gui_basics/widgets/juce_TableListBox.h View File

@@ -183,7 +183,7 @@ public:
@see getDragSourceCustomData, DragAndDropContainer::startDragging
*/
virtual const var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
virtual var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
};


+ 4
- 4
modules/juce_gui_basics/widgets/juce_TreeView.cpp View File

@@ -303,7 +303,7 @@ public:
owner.itemsChanged();
}
const String getTooltip()
String getTooltip()
{
Rectangle<int> pos;
TreeViewItem* const item = findItemAt (getMouseXYRelative().getY(), pos);
@@ -1150,7 +1150,7 @@ TreeViewItem::~TreeViewItem()
{
}
const String TreeViewItem::getUniqueName() const
String TreeViewItem::getUniqueName() const
{
return String::empty;
}
@@ -1311,12 +1311,12 @@ void TreeViewItem::itemSelectionChanged (bool)
{
}
const String TreeViewItem::getTooltip()
String TreeViewItem::getTooltip()
{
return String::empty;
}
const var TreeViewItem::getDragSourceDescription()
var TreeViewItem::getDragSourceDescription()
{
return var::null;
}


+ 3
- 3
modules/juce_gui_basics/widgets/juce_TreeView.h View File

@@ -190,7 +190,7 @@ public:
If you're not going to store the state, then it's ok not to bother implementing
this method.
*/
virtual const String getUniqueName() const;
virtual String getUniqueName() const;
/** Called when an item is opened or closed.
@@ -333,7 +333,7 @@ public:
/** The item can return a tool tip string here if it wants to.
@see TooltipClient
*/
virtual const String getTooltip();
virtual String getTooltip();
//==============================================================================
/** To allow items from your treeview to be dragged-and-dropped, implement this method.
@@ -351,7 +351,7 @@ public:
@see DragAndDropContainer::startDragging
*/
virtual const var getDragSourceDescription();
virtual var getDragSourceDescription();
/** If you want your item to be able to have files drag-and-dropped onto it, implement this
method and return true.


+ 4
- 4
modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.cpp View File

@@ -280,7 +280,7 @@ public:
{
}
const String getUniqueName() const { return String ((int) commandID) + "_id"; }
String getUniqueName() const { return String ((int) commandID) + "_id"; }
bool mightContainSubItems() { return false; }
int getItemHeight() const { return 20; }
@@ -306,7 +306,7 @@ public:
{
}
const String getUniqueName() const { return categoryName + "_cat"; }
String getUniqueName() const { return categoryName + "_cat"; }
bool mightContainSubItems() { return true; }
int getItemHeight() const { return 28; }
@@ -367,7 +367,7 @@ public:
}
bool mightContainSubItems() { return true; }
const String getUniqueName() const { return "keys"; }
String getUniqueName() const { return "keys"; }
void changeListenerCallback (ChangeBroadcaster*)
{
@@ -484,7 +484,7 @@ bool KeyMappingEditorComponent::isCommandReadOnly (const CommandID commandID)
return ci != nullptr && (ci->flags & ApplicationCommandInfo::readOnlyInKeyEditor) != 0;
}
const String KeyMappingEditorComponent::getDescriptionForKeyPress (const KeyPress& key)
String KeyMappingEditorComponent::getDescriptionForKeyPress (const KeyPress& key)
{
return key.getTextDescription();
}


+ 1
- 1
modules/juce_gui_extra/misc/juce_KeyMappingEditorComponent.h View File

@@ -87,7 +87,7 @@ public:
method, be sure to let the base class's method handle keys you're not
interested in.
*/
virtual const String getDescriptionForKeyPress (const KeyPress& key);
virtual String getDescriptionForKeyPress (const KeyPress& key);
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the editor.


Loading…
Cancel
Save