From ffd93c034306bf3fd0e27a95169b18b96904c0a1 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Fri, 11 Jun 2010 13:08:10 +0100 Subject: [PATCH] Cleaned up some compiler warings in the demo. Minor Viewport tweak. --- .../juce demo/Source/ApplicationStartup.cpp | 4 ++-- extras/juce demo/Source/MainDemoWindow.cpp | 10 ++++---- .../Source/demos/AudioDemoPlaybackPage.cpp | 6 ++--- .../Source/demos/AudioDemoSynthPage.cpp | 13 +++++------ .../Source/demos/AudioDemoTabComponent.cpp | 2 +- .../juce demo/Source/demos/CodeEditorDemo.cpp | 2 +- .../Source/demos/DragAndDropDemo.cpp | 18 ++++----------- .../Source/demos/FontsAndTextDemo.cpp | 4 ++-- .../Source/demos/RenderingTestComponent.cpp | 2 +- extras/juce demo/Source/demos/TableDemo.cpp | 16 ++++++------- .../juce demo/Source/demos/WebBrowserDemo.cpp | 6 ++--- extras/juce demo/Source/demos/WidgetsDemo.cpp | 23 +++++++++---------- extras/juce demo/Source/jucedemo_headers.h | 2 +- juce_amalgamated.cpp | 22 +++++++++++------- juce_amalgamated.h | 20 ++++++++++++++-- src/core/juce_MathsFunctions.h | 6 ++++- src/core/juce_StandardHeader.h | 2 +- src/gui/components/layout/juce_Viewport.cpp | 8 ++++++- src/gui/components/layout/juce_Viewport.h | 12 ++++++++++ .../geometry/juce_RelativeCoordinate.cpp | 14 +++++------ 20 files changed, 112 insertions(+), 80 deletions(-) diff --git a/extras/juce demo/Source/ApplicationStartup.cpp b/extras/juce demo/Source/ApplicationStartup.cpp index 09ff7bc0bb..ce16a13294 100644 --- a/extras/juce demo/Source/ApplicationStartup.cpp +++ b/extras/juce demo/Source/ApplicationStartup.cpp @@ -58,7 +58,7 @@ public: } //============================================================================== - void initialise (const String& commandLine) + void initialise (const String& /*commandLine*/) { // just create the main window... theMainWindow = new MainDemoWindow(); @@ -105,7 +105,7 @@ public: return true; } - void anotherInstanceStarted (const String& commandLine) + void anotherInstanceStarted (const String& /*commandLine*/) { // This will get called if the user launches another copy of the app, but // there's nothing that the demo app needs to do here. diff --git a/extras/juce demo/Source/MainDemoWindow.cpp b/extras/juce demo/Source/MainDemoWindow.cpp index 9253ac547d..1a348883ad 100644 --- a/extras/juce demo/Source/MainDemoWindow.cpp +++ b/extras/juce demo/Source/MainDemoWindow.cpp @@ -112,8 +112,7 @@ public: return StringArray ((const tchar**) names); } - const PopupMenu getMenuForIndex (int menuIndex, - const String& menuName) + const PopupMenu getMenuForIndex (int menuIndex, const String& /*menuName*/) { ApplicationCommandManager* const commandManager = mainWindow->commandManager; @@ -168,8 +167,7 @@ public: return menu; } - void menuItemSelected (int menuItemID, - int topLevelMenuIndex) + void menuItemSelected (int menuItemID, int /*topLevelMenuIndex*/) { // most of our menu items are invoked automatically as commands, but we can handle the // other special cases here.. @@ -377,7 +375,7 @@ public: break; case showWidgets: - showDemo (createWidgetsDemo (mainWindow->commandManager)); + showDemo (createWidgetsDemo()); currentDemoId = showWidgets; break; @@ -522,7 +520,7 @@ public: { } - void mouseDown (const MouseEvent& e) + void mouseDown (const MouseEvent&) { PopupMenu m; m.addItem (1, T("Quit the Juce demo")); diff --git a/extras/juce demo/Source/demos/AudioDemoPlaybackPage.cpp b/extras/juce demo/Source/demos/AudioDemoPlaybackPage.cpp index 415385adf2..30acefc252 100644 --- a/extras/juce demo/Source/demos/AudioDemoPlaybackPage.cpp +++ b/extras/juce demo/Source/demos/AudioDemoPlaybackPage.cpp @@ -61,7 +61,7 @@ public: } } - void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY) + void mouseWheelMove (const MouseEvent&, float wheelIncrementX, float wheelIncrementY) { if (thumbnail.getTotalLength() > 0) { @@ -298,11 +298,11 @@ void AudioDemoPlaybackPage::selectionChanged() thumbnail->setFile (fileTreeComp->getSelectedFile()); } -void AudioDemoPlaybackPage::fileClicked (const File& file, const MouseEvent& e) +void AudioDemoPlaybackPage::fileClicked (const File&, const MouseEvent&) { } -void AudioDemoPlaybackPage::fileDoubleClicked (const File& file) +void AudioDemoPlaybackPage::fileDoubleClicked (const File&) { } //[/MiscUserCode] diff --git a/extras/juce demo/Source/demos/AudioDemoSynthPage.cpp b/extras/juce demo/Source/demos/AudioDemoSynthPage.cpp index f39506780c..81a32f231e 100644 --- a/extras/juce demo/Source/demos/AudioDemoSynthPage.cpp +++ b/extras/juce demo/Source/demos/AudioDemoSynthPage.cpp @@ -37,8 +37,8 @@ public: { } - bool appliesToNote (const int midiNoteNumber) { return true; } - bool appliesToChannel (const int midiChannel) { return true; } + bool appliesToNote (const int /*midiNoteNumber*/) { return true; } + bool appliesToChannel (const int /*midiChannel*/) { return true; } }; @@ -60,7 +60,7 @@ public: } void startNote (const int midiNoteNumber, const float velocity, - SynthesiserSound* sound, const int currentPitchWheelPosition) + SynthesiserSound* /*sound*/, const int /*currentPitchWheelPosition*/) { currentAngle = 0.0; level = velocity * 0.15; @@ -92,12 +92,12 @@ public: } } - void pitchWheelMoved (const int newValue) + void pitchWheelMoved (const int /*newValue*/) { // can't be bothered implementing this for the demo! } - void controllerMoved (const int controllerNumber, const int newValue) + void controllerMoved (const int /*controllerNumber*/, const int /*newValue*/) { // not interested in controllers in this case. } @@ -215,8 +215,7 @@ public: delete audioReader; } - void prepareToPlay (int samplesPerBlockExpected, - double sampleRate) + void prepareToPlay (int /*samplesPerBlockExpected*/, double sampleRate) { midiCollector.reset (sampleRate); diff --git a/extras/juce demo/Source/demos/AudioDemoTabComponent.cpp b/extras/juce demo/Source/demos/AudioDemoTabComponent.cpp index 478218f93d..e360763505 100644 --- a/extras/juce demo/Source/demos/AudioDemoTabComponent.cpp +++ b/extras/juce demo/Source/demos/AudioDemoTabComponent.cpp @@ -65,7 +65,7 @@ void LiveAudioInputDisplayComp::timerCallback() repaint(); } -void LiveAudioInputDisplayComp::audioDeviceAboutToStart (AudioIODevice* device) +void LiveAudioInputDisplayComp::audioDeviceAboutToStart (AudioIODevice*) { zeromem (samples, sizeof (samples)); } diff --git a/extras/juce demo/Source/demos/CodeEditorDemo.cpp b/extras/juce demo/Source/demos/CodeEditorDemo.cpp index 9ae64b3a58..70ba626b2f 100644 --- a/extras/juce demo/Source/demos/CodeEditorDemo.cpp +++ b/extras/juce demo/Source/demos/CodeEditorDemo.cpp @@ -55,7 +55,7 @@ public: deleteAllChildren(); } - void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) + void filenameComponentChanged (FilenameComponent*) { File f (fileChooser->getCurrentFile()); editor->loadContent (f.loadFileAsString()); diff --git a/extras/juce demo/Source/demos/DragAndDropDemo.cpp b/extras/juce demo/Source/demos/DragAndDropDemo.cpp index 27e5aaca5a..fecbec867c 100644 --- a/extras/juce demo/Source/demos/DragAndDropDemo.cpp +++ b/extras/juce demo/Source/demos/DragAndDropDemo.cpp @@ -146,8 +146,7 @@ public: } //============================================================================== - bool isInterestedInDragSource (const String& sourceDescription, - Component* sourceComponent) + bool isInterestedInDragSource (const String& /*sourceDescription*/, Component* /*sourceComponent*/) { // normally you'd check the sourceDescription value to see if it's the // sort of object that you're interested in before returning true, but for @@ -155,30 +154,23 @@ public: return true; } - void itemDragEnter (const String& sourceDescription, - Component* sourceComponent, - int x, int y) + void itemDragEnter (const String& /*sourceDescription*/, Component* /*sourceComponent*/, int /*x*/, int /*y*/) { somethingIsBeingDraggedOver = true; repaint(); } - void itemDragMove (const String& sourceDescription, - Component* sourceComponent, - int x, int y) + void itemDragMove (const String& /*sourceDescription*/, Component* /*sourceComponent*/, int /*x*/, int /*y*/) { } - void itemDragExit (const String& sourceDescription, - Component* sourceComponent) + void itemDragExit (const String& /*sourceDescription*/, Component* /*sourceComponent*/) { somethingIsBeingDraggedOver = false; repaint(); } - void itemDropped (const String& sourceDescription, - Component* sourceComponent, - int x, int y) + void itemDropped (const String& sourceDescription, Component* /*sourceComponent*/, int /*x*/, int /*y*/) { message = T("last rows dropped: ") + sourceDescription; diff --git a/extras/juce demo/Source/demos/FontsAndTextDemo.cpp b/extras/juce demo/Source/demos/FontsAndTextDemo.cpp index dee9033d56..c46f2ef5e1 100644 --- a/extras/juce demo/Source/demos/FontsAndTextDemo.cpp +++ b/extras/juce demo/Source/demos/FontsAndTextDemo.cpp @@ -176,12 +176,12 @@ public: textBox->applyFontToAllText (font); } - void selectedRowsChanged (int lastRowselected) + void selectedRowsChanged (int /*lastRowselected*/) { updatePreviewBoxText(); } - void buttonClicked (Button* button) + void buttonClicked (Button*) { updatePreviewBoxText(); } diff --git a/extras/juce demo/Source/demos/RenderingTestComponent.cpp b/extras/juce demo/Source/demos/RenderingTestComponent.cpp index 750c1a4b81..423406779a 100644 --- a/extras/juce demo/Source/demos/RenderingTestComponent.cpp +++ b/extras/juce demo/Source/demos/RenderingTestComponent.cpp @@ -197,7 +197,7 @@ private: transform); } - void drawPaths (Graphics& g, bool solid, bool linearGradient, bool radialGradient) + void drawPaths (Graphics& g, bool /*solid*/, bool linearGradient, bool radialGradient) { Path p; p.addRectangle (-50, 0, 100, 100); diff --git a/extras/juce demo/Source/demos/TableDemo.cpp b/extras/juce demo/Source/demos/TableDemo.cpp index da8ed77580..e709c537c0 100644 --- a/extras/juce demo/Source/demos/TableDemo.cpp +++ b/extras/juce demo/Source/demos/TableDemo.cpp @@ -84,7 +84,7 @@ public: } // This is overloaded from TableListBoxModel, and should fill in the background of the whole row - void paintRowBackground (Graphics& g, int rowNumber, int width, int height, bool rowIsSelected) + void paintRowBackground (Graphics& g, int /*rowNumber*/, int /*width*/, int /*height*/, bool rowIsSelected) { if (rowIsSelected) g.fillAll (Colours::lightblue); @@ -96,7 +96,7 @@ public: int rowNumber, int columnId, int width, int height, - bool rowIsSelected) + bool /*rowIsSelected*/) { g.setColour (Colours::black); g.setFont (font); @@ -128,7 +128,7 @@ public: } // This is overloaded from TableListBoxModel, and must update any custom components that we're using - Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected, + Component* refreshComponentForCell (int rowNumber, int columnId, bool /*isRowSelected*/, Component* existingComponentToUpdate) { if (columnId == 5) // If it's the ratings column, we'll return our custom component.. @@ -180,12 +180,12 @@ public: // A couple of quick methods to set and get the "rating" value when the user // changes the combo box - int getRating (const int rowNumber, const int columnId) const + int getRating (const int rowNumber) const { return dataList->getChildElement (rowNumber)->getIntAttribute ("Rating"); } - void setRating (const int rowNumber, const int columnId, const int newRating) + void setRating (const int rowNumber, const int newRating) { dataList->getChildElement (rowNumber)->setAttribute ("Rating", newRating); } @@ -249,12 +249,12 @@ private: { row = newRow; columnId = newColumn; - comboBox->setSelectedId (owner.getRating (row, columnId), true); + comboBox->setSelectedId (owner.getRating (row), true); } - void comboBoxChanged (ComboBox* comboBoxThatHasChanged) + void comboBoxChanged (ComboBox* /*comboBoxThatHasChanged*/) { - owner.setRating (row, columnId, comboBox->getSelectedId()); + owner.setRating (row, comboBox->getSelectedId()); } private: diff --git a/extras/juce demo/Source/demos/WebBrowserDemo.cpp b/extras/juce demo/Source/demos/WebBrowserDemo.cpp index ca09bf3295..272a2d385a 100644 --- a/extras/juce demo/Source/demos/WebBrowserDemo.cpp +++ b/extras/juce demo/Source/demos/WebBrowserDemo.cpp @@ -108,9 +108,9 @@ public: forwardButton->setBounds (55, 10, 35, 25); } - void textEditorTextChanged (TextEditor& editor) {} - void textEditorEscapeKeyPressed (TextEditor& editor) {} - void textEditorFocusLost (TextEditor& editor) {} + void textEditorTextChanged (TextEditor&) {} + void textEditorEscapeKeyPressed (TextEditor&) {} + void textEditorFocusLost (TextEditor&) {} void textEditorReturnKeyPressed (TextEditor&) { diff --git a/extras/juce demo/Source/demos/WidgetsDemo.cpp b/extras/juce demo/Source/demos/WidgetsDemo.cpp index 1f8468fd26..5e5042abe4 100644 --- a/extras/juce demo/Source/demos/WidgetsDemo.cpp +++ b/extras/juce demo/Source/demos/WidgetsDemo.cpp @@ -82,7 +82,7 @@ public: setTopLeftPosition ((int) x, (int) y); } - bool hitTest (int x, int y) + bool hitTest (int /*x*/, int /*y*/) { return false; } @@ -110,7 +110,7 @@ public: deleteAllChildren(); } - void mouseDown (const MouseEvent& e) + void mouseDown (const MouseEvent&) { dragger.startDraggingComponent (this, 0); } @@ -647,7 +647,7 @@ class ToolbarDemoComp : public Component, public ButtonListener { public: - ToolbarDemoComp (ApplicationCommandManager* commandManager) + ToolbarDemoComp() { // Create and add the toolbar... addAndMakeVisible (toolbar = new Toolbar()); @@ -701,7 +701,7 @@ public: toolbar->setBounds (0, 0, getWidth(), (int) depthSlider->getValue()); } - void sliderValueChanged (Slider* slider) + void sliderValueChanged (Slider*) { resized(); } @@ -883,8 +883,7 @@ private: delete comboBox; } - bool getToolbarItemSizes (int toolbarDepth, - bool isToolbarVertical, + bool getToolbarItemSizes (int /*toolbarDepth*/, bool isToolbarVertical, int& preferredSize, int& minSize, int& maxSize) { if (isToolbarVertical) @@ -921,11 +920,11 @@ class DemoTabbedComponent : public TabbedComponent, public ButtonListener { public: - DemoTabbedComponent (ApplicationCommandManager* commandManager) + DemoTabbedComponent() : TabbedComponent (TabbedButtonBar::TabsAtTop) { addTab ("sliders", getRandomBrightColour(), createSlidersPage(), true); - addTab ("toolbars", getRandomBrightColour(), new ToolbarDemoComp (commandManager), true); + addTab ("toolbars", getRandomBrightColour(), new ToolbarDemoComp(), true); addTab ("buttons", getRandomBrightColour(), new ButtonsPage (this), true); addTab ("radio buttons", getRandomBrightColour(), createRadioButtonPage(), true); addTab ("misc widgets", getRandomBrightColour(), createMiscPage(), true); @@ -1125,11 +1124,11 @@ class WidgetsDemo : public Component, public: //============================================================================== - WidgetsDemo (ApplicationCommandManager* commandManager) + WidgetsDemo() { setName ("Widgets"); - addAndMakeVisible (tabs = new DemoTabbedComponent (commandManager)); + addAndMakeVisible (tabs = new DemoTabbedComponent()); //============================================================================== menuButton = new TextButton ("click for a popup menu..", @@ -1432,7 +1431,7 @@ public: //============================================================================== -Component* createWidgetsDemo (ApplicationCommandManager* commandManager) +Component* createWidgetsDemo() { - return new WidgetsDemo (commandManager); + return new WidgetsDemo(); } diff --git a/extras/juce demo/Source/jucedemo_headers.h b/extras/juce demo/Source/jucedemo_headers.h index 9c6ae288e6..e8903eca0c 100644 --- a/extras/juce demo/Source/jucedemo_headers.h +++ b/extras/juce demo/Source/jucedemo_headers.h @@ -36,7 +36,7 @@ // Pre-declare the functions that create each of the demo components.. Component* createFontsAndTextDemo(); Component* createRenderingDemo(); -Component* createWidgetsDemo (ApplicationCommandManager* commandManager); +Component* createWidgetsDemo(); Component* createThreadingDemo(); Component* createTreeViewDemo(); Component* createTableDemo(); diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 412a06b2c2..fe8e98b61c 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -63367,7 +63367,13 @@ int Viewport::getMaximumVisibleHeight() const void Viewport::setViewPosition (const int xPixelsOffset, const int yPixelsOffset) { if (contentComp != 0) - contentComp->setTopLeftPosition (-xPixelsOffset, -yPixelsOffset); + contentComp->setTopLeftPosition (jmax (jmin (0, contentHolder.getWidth() - contentComp->getWidth()), jmin (0, -xPixelsOffset)), + jmax (jmin (0, contentHolder.getHeight() - contentComp->getHeight()), jmin (0, -yPixelsOffset))); +} + +void Viewport::setViewPosition (const Point& newPosition) +{ + setViewPosition (newPosition.getX(), newPosition.getY()); } void Viewport::setViewPositionProportionately (const double x, const double y) @@ -92784,20 +92790,20 @@ namespace RelativeCoordinateHelpers } }; - static void skipWhitespace (const String& s, int& i) + static void skipWhitespace (const juce_wchar* const s, int& i) { while (CharacterFunctions::isWhitespace (s[i])) ++i; } - static void skipComma (const String& s, int& i) + static void skipComma (const juce_wchar* const s, int& i) { skipWhitespace (s, i); if (s[i] == ',') ++i; } - static const String readAnchorName (const String& s, int& i) + static const String readAnchorName (const juce_wchar* const s, int& i) { skipWhitespace (s, i); @@ -92807,13 +92813,13 @@ namespace RelativeCoordinateHelpers while (CharacterFunctions::isLetterOrDigit (s[i]) || s[i] == '_' || s[i] == '.') ++i; - return s.substring (start, i); + return String (s + start, i - start); } return String::empty; } - static double readNumber (const String& s, int& i) + static double readNumber (const juce_wchar* const s, int& i) { skipWhitespace (s, i); @@ -92835,14 +92841,14 @@ namespace RelativeCoordinateHelpers ++i; } - const double value = s.substring (start, i).getDoubleValue(); + const double value = String (s + start, i - start).getDoubleValue(); while (CharacterFunctions::isWhitespace (s[i]) || s[i] == ',') ++i; return value; } - static const RelativeCoordinate readNextCoordinate (const String& s, int& i, const bool isHorizontal) + static const RelativeCoordinate readNextCoordinate (const juce_wchar* const s, int& i, const bool isHorizontal) { String anchor1 (readAnchorName (s, i)); double value = 0; diff --git a/juce_amalgamated.h b/juce_amalgamated.h index c230a1a273..1d30512bd7 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 17 +#define JUCE_BUILDNUMBER 18 /** Current Juce version number. @@ -1103,7 +1103,11 @@ inline void swapVariables (Type& variable1, Type& variable2) @endcode */ template -inline int numElementsInArray (Type& array) { return static_cast (sizeof (array) / sizeof (array[0])); } +inline int numElementsInArray (Type& array) +{ + (void) array; // (required to avoid a spurious warning in MS compilers) + return static_cast (sizeof (array) / sizeof (array[0])); +} // Some useful maths functions that aren't always present with all compilers and build settings. @@ -34572,6 +34576,18 @@ public: */ void setViewPosition (int xPixelsOffset, int yPixelsOffset); + /** Changes the position of the viewed component. + + The inner component will be moved so that the pixel at the top left of + the viewport will be the pixel at the specified coordinates within the + inner component. + + This will update the scrollbars and might cause a call to visibleAreaChanged(). + + @see getViewPositionX, getViewPositionY, setViewPositionProportionately + */ + void setViewPosition (const Point& newPosition); + /** Changes the view position as a proportion of the distance it can move. The values here are from 0.0 to 1.0 - where (0, 0) would put the diff --git a/src/core/juce_MathsFunctions.h b/src/core/juce_MathsFunctions.h index d0e75b32e5..066bf3f9a1 100644 --- a/src/core/juce_MathsFunctions.h +++ b/src/core/juce_MathsFunctions.h @@ -173,7 +173,11 @@ inline void swapVariables (Type& variable1, Type& variable2) @endcode */ template -inline int numElementsInArray (Type& array) { return static_cast (sizeof (array) / sizeof (array[0])); } +inline int numElementsInArray (Type& array) +{ + (void) array; // (required to avoid a spurious warning in MS compilers) + return static_cast (sizeof (array) / sizeof (array[0])); +} //============================================================================== // Some useful maths functions that aren't always present with all compilers and build settings. diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index be2d180d41..1eb4140e63 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 17 +#define JUCE_BUILDNUMBER 18 /** Current Juce version number. diff --git a/src/gui/components/layout/juce_Viewport.cpp b/src/gui/components/layout/juce_Viewport.cpp index 80ce380d71..533a5abdbe 100644 --- a/src/gui/components/layout/juce_Viewport.cpp +++ b/src/gui/components/layout/juce_Viewport.cpp @@ -102,7 +102,13 @@ int Viewport::getMaximumVisibleHeight() const void Viewport::setViewPosition (const int xPixelsOffset, const int yPixelsOffset) { if (contentComp != 0) - contentComp->setTopLeftPosition (-xPixelsOffset, -yPixelsOffset); + contentComp->setTopLeftPosition (jmax (jmin (0, contentHolder.getWidth() - contentComp->getWidth()), jmin (0, -xPixelsOffset)), + jmax (jmin (0, contentHolder.getHeight() - contentComp->getHeight()), jmin (0, -yPixelsOffset))); +} + +void Viewport::setViewPosition (const Point& newPosition) +{ + setViewPosition (newPosition.getX(), newPosition.getY()); } void Viewport::setViewPositionProportionately (const double x, const double y) diff --git a/src/gui/components/layout/juce_Viewport.h b/src/gui/components/layout/juce_Viewport.h index e62fe9b91b..a5a4477770 100644 --- a/src/gui/components/layout/juce_Viewport.h +++ b/src/gui/components/layout/juce_Viewport.h @@ -93,6 +93,18 @@ public: */ void setViewPosition (int xPixelsOffset, int yPixelsOffset); + /** Changes the position of the viewed component. + + The inner component will be moved so that the pixel at the top left of + the viewport will be the pixel at the specified coordinates within the + inner component. + + This will update the scrollbars and might cause a call to visibleAreaChanged(). + + @see getViewPositionX, getViewPositionY, setViewPositionProportionately + */ + void setViewPosition (const Point& newPosition); + /** Changes the view position as a proportion of the distance it can move. The values here are from 0.0 to 1.0 - where (0, 0) would put the diff --git a/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp b/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp index 89a188d969..14e31b4217 100644 --- a/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp +++ b/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp @@ -79,20 +79,20 @@ namespace RelativeCoordinateHelpers }; //============================================================================== - static void skipWhitespace (const String& s, int& i) + static void skipWhitespace (const juce_wchar* const s, int& i) { while (CharacterFunctions::isWhitespace (s[i])) ++i; } - static void skipComma (const String& s, int& i) + static void skipComma (const juce_wchar* const s, int& i) { skipWhitespace (s, i); if (s[i] == ',') ++i; } - static const String readAnchorName (const String& s, int& i) + static const String readAnchorName (const juce_wchar* const s, int& i) { skipWhitespace (s, i); @@ -102,13 +102,13 @@ namespace RelativeCoordinateHelpers while (CharacterFunctions::isLetterOrDigit (s[i]) || s[i] == '_' || s[i] == '.') ++i; - return s.substring (start, i); + return String (s + start, i - start); } return String::empty; } - static double readNumber (const String& s, int& i) + static double readNumber (const juce_wchar* const s, int& i) { skipWhitespace (s, i); @@ -130,14 +130,14 @@ namespace RelativeCoordinateHelpers ++i; } - const double value = s.substring (start, i).getDoubleValue(); + const double value = String (s + start, i - start).getDoubleValue(); while (CharacterFunctions::isWhitespace (s[i]) || s[i] == ',') ++i; return value; } - static const RelativeCoordinate readNextCoordinate (const String& s, int& i, const bool isHorizontal) + static const RelativeCoordinate readNextCoordinate (const juce_wchar* const s, int& i, const bool isHorizontal) { String anchor1 (readAnchorName (s, i)); double value = 0;