| @@ -108,7 +108,7 @@ PropertiesFile::PropertiesFile (const File& f, const Options& o) | |||||
| file (f), options (o), | file (f), options (o), | ||||
| loadedOk (false), needsWriting (false) | loadedOk (false), needsWriting (false) | ||||
| { | { | ||||
| initialise(); | |||||
| reload(); | |||||
| } | } | ||||
| PropertiesFile::PropertiesFile (const Options& o) | PropertiesFile::PropertiesFile (const Options& o) | ||||
| @@ -116,17 +116,18 @@ PropertiesFile::PropertiesFile (const Options& o) | |||||
| file (o.getDefaultFile()), options (o), | file (o.getDefaultFile()), options (o), | ||||
| loadedOk (false), needsWriting (false) | loadedOk (false), needsWriting (false) | ||||
| { | { | ||||
| initialise(); | |||||
| reload(); | |||||
| } | } | ||||
| void PropertiesFile::initialise() | |||||
| bool PropertiesFile::reload() | |||||
| { | { | ||||
| ProcessScopedLock pl (createProcessLock()); | ProcessScopedLock pl (createProcessLock()); | ||||
| if (pl != nullptr && ! pl->isLocked()) | if (pl != nullptr && ! pl->isLocked()) | ||||
| return; // locking failure.. | |||||
| return false; // locking failure.. | |||||
| loadedOk = (! file.exists()) || loadAsBinary() || loadAsXml(); | loadedOk = (! file.exists()) || loadAsBinary() || loadAsXml(); | ||||
| return loadedOk; | |||||
| } | } | ||||
| PropertiesFile::~PropertiesFile() | PropertiesFile::~PropertiesFile() | ||||
| @@ -210,6 +210,9 @@ public: | |||||
| */ | */ | ||||
| void setNeedsToBeSaved (bool needsToBeSaved); | void setNeedsToBeSaved (bool needsToBeSaved); | ||||
| /** Attempts to reload the settings from the file. */ | |||||
| bool reload(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the file that's being used. */ | /** Returns the file that's being used. */ | ||||
| const File& getFile() const noexcept { return file; } | const File& getFile() const noexcept { return file; } | ||||
| @@ -229,7 +232,6 @@ private: | |||||
| InterProcessLock::ScopedLockType* createProcessLock() const; | InterProcessLock::ScopedLockType* createProcessLock() const; | ||||
| void timerCallback(); | void timerCallback(); | ||||
| void initialise(); | |||||
| bool saveAsXml(); | bool saveAsXml(); | ||||
| bool saveAsBinary(); | bool saveAsBinary(); | ||||
| bool loadAsXml(); | bool loadAsXml(); | ||||
| @@ -2506,9 +2506,7 @@ public: | |||||
| void restore() | void restore() | ||||
| { | { | ||||
| StateObjectType* const top = stack.getLast(); | |||||
| if (top != nullptr) | |||||
| if (StateObjectType* const top = stack.getLast()) | |||||
| { | { | ||||
| currentState = top; | currentState = top; | ||||
| stack.removeLast (1, false); | stack.removeLast (1, false); | ||||
| @@ -877,9 +877,7 @@ void UIViewComponentPeer::updateHiddenTextContent (TextInputTarget* target) | |||||
| BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, const String& text) | BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, const String& text) | ||||
| { | { | ||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | |||||
| if (target != nullptr) | |||||
| if (TextInputTarget* const target = findCurrentTextInputTarget()) | |||||
| { | { | ||||
| const Range<int> currentSelection (target->getHighlightedRegion()); | const Range<int> currentSelection (target->getHighlightedRegion()); | ||||
| @@ -900,9 +898,7 @@ BOOL UIViewComponentPeer::textViewReplaceCharacters (const Range<int>& range, co | |||||
| void UIViewComponentPeer::globalFocusChanged (Component*) | void UIViewComponentPeer::globalFocusChanged (Component*) | ||||
| { | { | ||||
| TextInputTarget* const target = findCurrentTextInputTarget(); | |||||
| if (target != nullptr) | |||||
| if (TextInputTarget* const target = findCurrentTextInputTarget()) | |||||
| { | { | ||||
| Component* comp = dynamic_cast<Component*> (target); | Component* comp = dynamic_cast<Component*> (target); | ||||