Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge commit 'c49256696d672195f5265c925d22d842be5386d7'

  • Loading branch information...
commit c783448866102662e196663031f643ba04798b3f 2 parents b2f7552 + c492566
@vinniefalco authored
Showing with 799 additions and 380 deletions.
  1. +3 −1 JUCE/extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj
  2. +2 −1  JUCE/extras/Introjucer/Introjucer.jucer
  3. +1 −1  JUCE/extras/Introjucer/JuceLibraryCode/AppConfig.h
  4. +68 −21 JUCE/extras/Introjucer/Source/Application/jucer_Application.h
  5. +7 −33 JUCE/extras/Introjucer/Source/Application/jucer_CommandIDs.h
  6. +3 −1 JUCE/extras/Introjucer/Source/Application/jucer_MainWindow.cpp
  7. +272 −7 JUCE/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp
  8. +21 −0 JUCE/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h
  9. +55 −52 JUCE/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h
  10. +6 −15 JUCE/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h
  11. +1 −5 JUCE/extras/Introjucer/Source/Project/jucer_NewProjectWizard.cpp
  12. +3 −2 JUCE/extras/Introjucer/Source/Project/jucer_Project.cpp
  13. +4 −4 JUCE/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp
  14. +4 −13 JUCE/extras/Introjucer/Source/Project/jucer_TreeViewTypes.cpp
  15. +20 −17 JUCE/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp
  16. +1 −0  JUCE/extras/Introjucer/Source/Utility/jucer_StoredSettings.h
  17. +3 −1 JUCE/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj
  18. +3 −1 JUCE/extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj
  19. +3 −1 JUCE/extras/audio plugin demo/Builds/MacOSX/JuceDemoPlugin.xcodeproj/project.pbxproj
  20. +3 −1 JUCE/extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj
  21. +3 −1 JUCE/extras/binarybuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj
  22. +3 −1 JUCE/extras/example projects/Builds/MacOSX/HelloWorld.xcodeproj/project.pbxproj
  23. +3 −1 JUCE/extras/example projects/Builds/iOS/HelloWorld.xcodeproj/project.pbxproj
  24. +3 −1 JUCE/extras/the jucer/Builds/MacOSX/Jucer.xcodeproj/project.pbxproj
  25. +4 −11 JUCE/modules/juce_audio_plugin_client/utility/juce_FakeMouseMoveGenerator.h
  26. +4 −9 JUCE/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  27. +18 −10 JUCE/modules/juce_core/files/juce_File.cpp
  28. +52 −53 JUCE/modules/juce_core/logging/juce_FileLogger.cpp
  29. +47 −19 JUCE/modules/juce_core/logging/juce_FileLogger.h
  30. +7 −12 JUCE/modules/juce_core/logging/juce_Logger.cpp
  31. +3 −7 JUCE/modules/juce_core/logging/juce_Logger.h
  32. +1 −2  JUCE/modules/juce_core/native/juce_win32_Network.cpp
  33. +6 −6 JUCE/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp
  34. +16 −28 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp
  35. +1 −8 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.h
  36. +9 −12 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandTarget.cpp
  37. +2 −2 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandTarget.h
  38. +6 −0 JUCE/modules/juce_gui_basics/components/juce_Component.cpp
  39. +1 −4 JUCE/modules/juce_gui_basics/components/juce_Component.h
  40. +1 −1  JUCE/modules/juce_gui_basics/keyboard/juce_CaretComponent.cpp
  41. +104 −13 JUCE/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp
  42. +22 −2 JUCE/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.h
View
4 JUCE/extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj
@@ -1639,6 +1639,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -1657,6 +1658,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -1745,7 +1747,7 @@
C009859650B4628FDD068941,
84449D044096A03F2582904B,
B8D802107FEE6AD60F5309A3 ); buildRules = ( ); dependencies = ( ); name = "The Introjucer"; productName = "The Introjucer"; productReference = 25F52316D256B4534BED16D1; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- 74EA481348A24104E6ACE009 = { isa = PBXProject; buildConfigurationList = F90407F24422C589DA251604; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 3CC531922CC2D398E283A845; projectDirPath = ""; projectRoot = ""; targets = ( FE688C03195D5E72123A75BF ); };
+ 74EA481348A24104E6ACE009 = { isa = PBXProject; buildConfigurationList = F90407F24422C589DA251604; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 3CC531922CC2D398E283A845; projectDirPath = ""; projectRoot = ""; targets = ( FE688C03195D5E72123A75BF ); };
};
rootObject = 74EA481348A24104E6ACE009;
}
View
3  JUCE/extras/Introjucer/Introjucer.jucer
@@ -244,7 +244,8 @@
JUCE_ALSA="disabled" JUCE_QUICKTIME="disabled" JUCE_OPENGL="disabled"
JUCE_USE_FLAC="disabled" JUCE_USE_CDBURNER="disabled" JUCE_USE_CDREADER="disabled"
JUCE_USE_CAMERA="disabled" JUCE_PLUGINHOST_VST="disabled" JUCE_PLUGINHOST_AU="disabled"
- JUCE_USE_OGGVORBIS="disabled" JUCE_USE_COREIMAGE_LOADER="disabled"/>
+ JUCE_USE_OGGVORBIS="disabled" JUCE_USE_COREIMAGE_LOADER="disabled"
+ JUCE_LOG_ASSERTIONS="enabled"/>
<MODULES>
<MODULE id="juce_core" showAllCode="1"/>
<MODULE id="juce_events" showAllCode="1"/>
View
2  JUCE/extras/Introjucer/JuceLibraryCode/AppConfig.h
@@ -38,7 +38,7 @@
#endif
#ifndef JUCE_LOG_ASSERTIONS
- //#define JUCE_LOG_ASSERTIONS
+ #define JUCE_LOG_ASSERTIONS 1
#endif
#ifndef JUCE_CHECK_MEMORY_LEAKS
View
89 JUCE/extras/Introjucer/Source/Application/jucer_Application.h
@@ -44,6 +44,8 @@ class IntrojucerApp : public JUCEApplication
//==============================================================================
void initialise (const String& commandLine)
{
+ initialiseLogger ("log_");
+
LookAndFeel::setDefaultLookAndFeel (&lookAndFeel);
settings = new StoredSettings();
settings->initialise();
@@ -72,6 +74,12 @@ class IntrojucerApp : public JUCEApplication
commandManager = new ApplicationCommandManager();
commandManager->registerAllCommandsForTarget (this);
+ {
+ CodeDocument doc;
+ CppCodeEditorComponent ed (File::nonexistent, doc);
+ commandManager->registerAllCommandsForTarget (&ed);
+ }
+
menuModel = new MainMenuModel();
doExtraInitialisation();
@@ -110,6 +118,10 @@ class IntrojucerApp : public JUCEApplication
settings = nullptr;
LookAndFeel::setDefaultLookAndFeel (nullptr);
+
+ Logger::writeToLog ("Shutdown");
+
+ deleteLogger();
}
//==============================================================================
@@ -262,13 +274,10 @@ class IntrojucerApp : public JUCEApplication
menu.addCommandItem (commandManager, StandardApplicationCommandIDs::selectAll);
menu.addCommandItem (commandManager, StandardApplicationCommandIDs::deselectAll);
menu.addSeparator();
- menu.addCommandItem (commandManager, CommandIDs::toFront);
- menu.addCommandItem (commandManager, CommandIDs::toBack);
- menu.addSeparator();
- menu.addCommandItem (commandManager, CommandIDs::group);
- menu.addCommandItem (commandManager, CommandIDs::ungroup);
- menu.addSeparator();
- menu.addCommandItem (commandManager, CommandIDs::bringBackLostItems);
+ menu.addCommandItem (commandManager, CommandIDs::showFindPanel);
+ menu.addCommandItem (commandManager, CommandIDs::findSelection);
+ menu.addCommandItem (commandManager, CommandIDs::findNext);
+ menu.addCommandItem (commandManager, CommandIDs::findPrevious);
}
virtual void createViewMenu (PopupMenu& menu)
@@ -331,7 +340,6 @@ class IntrojucerApp : public JUCEApplication
const CommandID ids[] = { CommandIDs::newProject,
CommandIDs::open,
- CommandIDs::showPrefs,
CommandIDs::closeAllDocuments,
CommandIDs::saveAll,
CommandIDs::updateModules,
@@ -355,11 +363,6 @@ class IntrojucerApp : public JUCEApplication
result.defaultKeypresses.add (KeyPress ('o', ModifierKeys::commandModifier, 0));
break;
- case CommandIDs::showPrefs:
- result.setInfo ("Preferences...", "Shows the preferences panel.", CommandCategories::general, 0);
- result.defaultKeypresses.add (KeyPress (',', ModifierKeys::commandModifier, 0));
- break;
-
case CommandIDs::showAppearanceSettings:
result.setInfo ("Fonts and Colours...", "Shows the appearance settings window.", CommandCategories::general, 0);
break;
@@ -394,7 +397,6 @@ class IntrojucerApp : public JUCEApplication
{
case CommandIDs::newProject: createNewProject(); break;
case CommandIDs::open: askUserToOpenFile(); break;
- case CommandIDs::showPrefs: showPrefsPanel(); break;
case CommandIDs::saveAll: openDocumentManager.saveAll(); break;
case CommandIDs::closeAllDocuments: closeAllDocuments (true); break;
case CommandIDs::showUTF8Tool: showUTF8ToolWindow (utf8Window); break;
@@ -407,11 +409,6 @@ class IntrojucerApp : public JUCEApplication
}
//==============================================================================
- void showPrefsPanel()
- {
- jassertfalse;
- }
-
void createNewProject()
{
if (makeSureUserHasSelectedModuleFolder())
@@ -472,8 +469,57 @@ class IntrojucerApp : public JUCEApplication
}
//==============================================================================
+ void initialiseLogger (const char* filePrefix)
+ {
+ if (logger == nullptr)
+ {
+ logger = FileLogger::createDateStampedLogger (getLogFolderName(), filePrefix, ".txt",
+ getApplicationName() + " " + getApplicationVersion());
+ Logger::setCurrentLogger (logger);
+ }
+ }
+
+ void deleteLogger()
+ {
+ const int maxNumLogFilesToKeep = 50;
+
+ Logger::setCurrentLogger (nullptr);
+
+ if (logger != nullptr)
+ {
+ Array<File> logFiles;
+ logger->getLogFile().getParentDirectory().findChildFiles (logFiles, File::findFiles, false);
+
+ if (logFiles.size() > maxNumLogFilesToKeep)
+ {
+ struct FileWithTime
+ {
+ FileWithTime (const File& f) : file (f), time (f.getLastModificationTime()) {}
+ FileWithTime() {}
+
+ bool operator< (const FileWithTime& other) const { return time < other.time; }
+ bool operator== (const FileWithTime& other) const { return time == other.time; }
+
+ File file;
+ Time time;
+ };
+
+ Array <FileWithTime> files;
+
+ for (int i = 0; i < logFiles.size(); ++i)
+ files.addUsingDefaultSort (logFiles.getReference(i));
+
+ for (int i = 0; i < files.size() - maxNumLogFilesToKeep; ++i)
+ files.getReference(i).file.deleteFile();
+ }
+ }
+
+ logger = nullptr;
+ }
+
virtual void doExtraInitialisation() {}
virtual void addExtraConfigItems (Project&, TreeViewItem&) {}
+ virtual String getLogFolderName() const { return "com.juce.introjucer"; }
virtual Component* createProjectContentComponent() const
{
@@ -493,6 +539,8 @@ class IntrojucerApp : public JUCEApplication
ScopedPointer<Component> appearanceEditorWindow, utf8Window;
+ ScopedPointer<FileLogger> logger;
+
private:
class AsyncQuitRetrier : private Timer
{
@@ -504,8 +552,7 @@ class IntrojucerApp : public JUCEApplication
stopTimer();
delete this;
- JUCEApplication* app = JUCEApplication::getInstance();
- if (app != nullptr)
+ if (JUCEApplication* app = JUCEApplication::getInstance())
app->systemRequestedQuit();
}
View
40 JUCE/extras/Introjucer/Source/Application/jucer_CommandIDs.h
@@ -37,53 +37,27 @@ namespace CommandIDs
closeProject = 0x200051,
saveProject = 0x200060,
+ saveAll = 0x200080,
openInIDE = 0x200072,
saveAndOpenInIDE = 0x200073,
+
updateModules = 0x200075,
showUTF8Tool = 0x200076,
showAppearanceSettings = 0x200077,
showConfigPanel = 0x200074,
showFilePanel = 0x200078,
- saveAll = 0x200080,
-
closeWindow = 0x201001,
closeAllDocuments = 0x201000,
goToPreviousDoc = 0x201002,
goToNextDoc = 0x201003,
goToCounterpart = 0x201004,
+ deleteSelectedItem = 0x201005,
- toFront = 0x2020a0,
- toBack = 0x2030a1,
- showOrHideProperties = 0x2030b0,
- showOrHideTree = 0x2030b1,
- showOrHideMarkers = 0x2030b2,
- toggleSnapping = 0x2030b3,
-
- makeLineSegment = 0x2030c0,
- makeCubicSegment = 0x2030c1,
- breakSegment = 0x2030c2,
- pointModeCorner = 0x2030c3,
- pointModeRounded = 0x2030c4,
- pointModeSymmetric = 0x2030c5,
-
- group = 0x202170,
- ungroup = 0x202180,
-
- showPrefs = 0x2020c0,
- useTabbedWindows = 0x2020d0,
-
- showGrid = 0x2020e0,
- enableSnapToGrid = 0x2020f0,
- zoomIn = 0x202130,
- zoomOut = 0x202140,
- zoomNormal = 0x202150,
- spaceBarDrag = 0x202160,
- bringBackLostItems = 0x202120,
-
- newDocumentBase = 0x322010,
- newComponentBase = 0x302010,
- newElementBase = 0x312010
+ showFindPanel = 0x2010a0,
+ findSelection = 0x2010a1,
+ findNext = 0x2010a2,
+ findPrevious = 0x2010a3
};
}
View
4 JUCE/extras/Introjucer/Source/Application/jucer_MainWindow.cpp
@@ -71,6 +71,8 @@ MainWindow::MainWindow()
//getPeer()->setCurrentRenderingEngine (0);
getLookAndFeel().setColour (ColourSelector::backgroundColourId, Colours::transparentBlack);
+
+ setResizeLimits (600, 500, 32000, 32000);
}
MainWindow::~MainWindow()
@@ -259,7 +261,7 @@ void MainWindow::showNewProjectWizard()
//==============================================================================
ApplicationCommandTarget* MainWindow::getNextCommandTarget()
{
- return 0;
+ return nullptr;
}
void MainWindow::getAllCommands (Array <CommandID>& commands)
View
279 JUCE/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.cpp
@@ -27,8 +27,8 @@
#include "../Application/jucer_OpenDocumentManager.h"
//==============================================================================
-SourceCodeDocument::SourceCodeDocument (Project* project_, const File& file_)
- : modDetector (file_), project (project_)
+SourceCodeDocument::SourceCodeDocument (Project* p, const File& f)
+ : modDetector (f), project (p)
{
}
@@ -97,8 +97,8 @@ void SourceCodeDocument::applyLastState (CodeEditorComponent& editor) const
}
//==============================================================================
-SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* document_)
- : DocumentEditorComponent (document_)
+SourceCodeEditor::SourceCodeEditor (OpenDocumentManager::Document* doc)
+ : DocumentEditorComponent (doc)
{
}
@@ -106,9 +106,7 @@ SourceCodeEditor::~SourceCodeEditor()
{
getAppSettings().appearance.settings.removeListener (this);
- SourceCodeDocument* doc = dynamic_cast <SourceCodeDocument*> (getDocument());
-
- if (doc != nullptr)
+ if (SourceCodeDocument* doc = dynamic_cast <SourceCodeDocument*> (getDocument()))
doc->updateLastState (*editor);
}
@@ -176,6 +174,11 @@ static CPlusPlusCodeTokeniser cppTokeniser;
CppCodeEditorComponent::CppCodeEditorComponent (const File& f, CodeDocument& codeDocument)
: CodeEditorComponent (codeDocument, &cppTokeniser), file (f)
{
+ setCommandManager (commandManager);
+}
+
+CppCodeEditorComponent::~CppCodeEditorComponent()
+{
}
void CppCodeEditorComponent::handleReturnKey()
@@ -261,3 +264,265 @@ void CppCodeEditorComponent::performPopupMenuAction (int menuItemID)
else
CodeEditorComponent::performPopupMenuAction (menuItemID);
}
+
+void CppCodeEditorComponent::getAllCommands (Array <CommandID>& commands)
+{
+ CodeEditorComponent::getAllCommands (commands);
+
+ const CommandID ids[] = { CommandIDs::showFindPanel,
+ CommandIDs::findSelection,
+ CommandIDs::findNext,
+ CommandIDs::findPrevious };
+
+ commands.addArray (ids, numElementsInArray (ids));
+}
+
+void CppCodeEditorComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
+{
+ const bool anythingSelected = isHighlightActive();
+
+ switch (commandID)
+ {
+ case CommandIDs::showFindPanel:
+ result.setInfo (TRANS ("Find"), TRANS ("Searches for text in the current document."), "Editing", 0);
+ result.defaultKeypresses.add (KeyPress ('f', ModifierKeys::commandModifier, 0));
+ break;
+
+ case CommandIDs::findSelection:
+ result.setInfo (TRANS ("Find Selection"), TRANS ("Searches for the currently selected text."), "Editing", 0);
+ result.setActive (anythingSelected);
+ result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier, 0));
+ break;
+
+ case CommandIDs::findNext:
+ result.setInfo (TRANS ("Find Next"), TRANS ("Searches for the next occurrence of the current search-term."), "Editing", 0);
+ result.defaultKeypresses.add (KeyPress ('g', ModifierKeys::commandModifier, 0));
+ break;
+
+ case CommandIDs::findPrevious:
+ result.setInfo (TRANS ("Find Previous"), TRANS ("Searches for the previous occurrence of the current search-term."), "Editing", 0);
+ result.defaultKeypresses.add (KeyPress ('g', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
+ result.defaultKeypresses.add (KeyPress ('d', ModifierKeys::commandModifier, 0));
+ break;
+
+ default:
+ CodeEditorComponent::getCommandInfo (commandID, result);
+ break;
+ }
+}
+
+bool CppCodeEditorComponent::perform (const InvocationInfo& info)
+{
+ switch (info.commandID)
+ {
+ case CommandIDs::showFindPanel: showFindPanel(); return true;
+ case CommandIDs::findSelection: findSelection(); return true;
+ case CommandIDs::findNext: findNext (true, true); return true;
+ case CommandIDs::findPrevious: findNext (false, false); return true;
+ default: break;
+ }
+
+ return CodeEditorComponent::perform (info);
+}
+
+//==============================================================================
+class CppCodeEditorComponent::FindPanel : public Component,
+ private TextEditor::Listener,
+ private Button::Listener
+{
+public:
+ FindPanel()
+ : caseButton ("Case-sensitive"),
+ findPrev ("<"),
+ findNext (">")
+ {
+ editor.setColour (CaretComponent::caretColourId, Colours::black);
+
+ addAndMakeVisible (&editor);
+ label.setText ("Find:", false);
+ label.setColour (Label::textColourId, Colours::white);
+ label.attachToComponent (&editor, false);
+
+ addAndMakeVisible (&caseButton);
+ caseButton.setColour (ToggleButton::textColourId, Colours::white);
+ caseButton.setToggleState (isCaseSensitiveSearch(), false);
+ caseButton.addListener (this);
+
+ findPrev.setConnectedEdges (Button::ConnectedOnRight);
+ findNext.setConnectedEdges (Button::ConnectedOnLeft);
+ addAndMakeVisible (&findPrev);
+ addAndMakeVisible (&findNext);
+
+ setWantsKeyboardFocus (false);
+ setFocusContainer (true);
+ findPrev.setWantsKeyboardFocus (false);
+ findNext.setWantsKeyboardFocus (false);
+
+ editor.setText (getSearchString());
+ editor.addListener (this);
+ }
+
+ void setCommandManager (ApplicationCommandManager* cm)
+ {
+ findPrev.setCommandToTrigger (cm, CommandIDs::findPrevious, true);
+ findNext.setCommandToTrigger (cm, CommandIDs::findNext, true);
+ }
+
+ void paint (Graphics& g)
+ {
+ Path outline;
+ outline.addRoundedRectangle (1.0f, 1.0f, getWidth() - 2.0f, getHeight() - 2.0f, 8.0f);
+
+ g.setColour (Colours::black.withAlpha (0.6f));
+ g.fillPath (outline);
+ g.setColour (Colours::white.withAlpha (0.8f));
+ g.strokePath (outline, PathStrokeType (1.0f));
+ }
+
+ void resized()
+ {
+ int y = 30;
+ editor.setBounds (10, y, getWidth() - 20, 24);
+ y += 30;
+ caseButton.setBounds (10, y, getWidth() / 2 - 10, 22);
+ findNext.setBounds (getWidth() - 40, y, 30, 22);
+ findPrev.setBounds (getWidth() - 70, y, 30, 22);
+ }
+
+ void buttonClicked (Button*)
+ {
+ setCaseSensitiveSearch (caseButton.getToggleState());
+ }
+
+ void textEditorTextChanged (TextEditor&)
+ {
+ setSearchString (editor.getText());
+
+ if (CppCodeEditorComponent* ed = getOwner())
+ ed->findNext (true, false);
+ }
+
+ void textEditorFocusLost (TextEditor&) {}
+
+ void textEditorReturnKeyPressed (TextEditor&)
+ {
+ commandManager->invokeDirectly (CommandIDs::findNext, true);
+ }
+
+ void textEditorEscapeKeyPressed (TextEditor&)
+ {
+ if (CppCodeEditorComponent* ed = getOwner())
+ ed->hideFindPanel();
+ }
+
+ CppCodeEditorComponent* getOwner() const
+ {
+ return findParentComponentOfClass <CppCodeEditorComponent>();
+ }
+
+ TextEditor editor;
+ Label label;
+ ToggleButton caseButton;
+ TextButton findPrev, findNext;
+};
+
+void CppCodeEditorComponent::showFindPanel()
+{
+ if (findPanel == nullptr)
+ {
+ findPanel = new FindPanel();
+ findPanel->setCommandManager (commandManager);
+
+ addAndMakeVisible (findPanel);
+ resized();
+ }
+
+ findPanel->editor.grabKeyboardFocus();
+ findPanel->editor.selectAll();
+}
+
+void CppCodeEditorComponent::hideFindPanel()
+{
+ findPanel = nullptr;
+}
+
+void CppCodeEditorComponent::findSelection()
+{
+ const String selected (getTextInRange (getHighlightedRegion()));
+
+ if (selected.isNotEmpty())
+ {
+ setSearchString (selected);
+ findNext (true, true);
+ }
+}
+
+void CppCodeEditorComponent::findNext (bool forwards, bool skipCurrentSelection)
+{
+ const Range<int> highlight (getHighlightedRegion());
+ const CodeDocument::Position startPos (getDocument(), skipCurrentSelection ? highlight.getEnd()
+ : highlight.getStart());
+ int lineNum = startPos.getLineNumber();
+ int linePos = startPos.getIndexInLine();
+
+ const int totalLines = getDocument().getNumLines();
+ const String searchText (getSearchString());
+ const bool caseSensitive = isCaseSensitiveSearch();
+
+ for (int linesToSearch = totalLines; --linesToSearch >= 0;)
+ {
+ String line (getDocument().getLine (lineNum));
+ int index;
+
+ if (forwards)
+ {
+ index = caseSensitive ? line.indexOf (linePos, searchText)
+ : line.indexOfIgnoreCase (linePos, searchText);
+ }
+ else
+ {
+ if (linePos >= 0)
+ line = line.substring (0, linePos);
+
+ index = caseSensitive ? line.lastIndexOf (searchText)
+ : line.lastIndexOfIgnoreCase (searchText);
+ }
+
+ if (index >= 0)
+ {
+ const CodeDocument::Position p (getDocument(), lineNum, index);
+ selectRegion (p, p.movedBy (searchText.length()));
+ break;
+ }
+
+ if (forwards)
+ {
+ linePos = 0;
+ lineNum = (lineNum + 1) % totalLines;
+ }
+ else
+ {
+ if (--lineNum < 0)
+ lineNum = totalLines - 1;
+
+ linePos = -1;
+ }
+ }
+}
+
+void CppCodeEditorComponent::handleEscapeKey()
+{
+ CodeEditorComponent::handleEscapeKey();
+ hideFindPanel();
+}
+
+void CppCodeEditorComponent::resized()
+{
+ CodeEditorComponent::resized();
+
+ if (findPanel != nullptr)
+ {
+ findPanel->setSize (jmin (260, getWidth() - 32), 100);
+ findPanel->setTopRightPosition (getWidth() - 16, 8);
+ }
+}
View
21 JUCE/extras/Introjucer/Source/Code Editor/jucer_SourceCodeEditor.h
@@ -169,15 +169,36 @@ class CppCodeEditorComponent : public CodeEditorComponent
{
public:
CppCodeEditorComponent (const File& file, CodeDocument& codeDocument);
+ ~CppCodeEditorComponent();
void handleReturnKey();
+ void handleEscapeKey();
void insertTextAtCaret (const String& newText);
void addPopupMenuItems (PopupMenu&, const MouseEvent*);
void performPopupMenuAction (int menuItemID);
+ void getAllCommands (Array<CommandID>&);
+ void getCommandInfo (CommandID, ApplicationCommandInfo&);
+ bool perform (const InvocationInfo&);
+
+ void showFindPanel();
+ void hideFindPanel();
+ void findSelection();
+ void findNext (bool forwards, bool skipCurrentSelection);
+
+ void resized();
+
+ static String getSearchString() { return getAppSettings().getGlobalProperties().getValue ("searchString"); }
+ static void setSearchString (const String& s) { getAppSettings().getGlobalProperties().setValue ("searchString", s); }
+ static bool isCaseSensitiveSearch() { return getAppSettings().getGlobalProperties().getBoolValue ("searchCaseSensitive"); }
+ static void setCaseSensitiveSearch (bool b) { getAppSettings().getGlobalProperties().setValue ("searchCaseSensitive", b); }
+
private:
File file;
+ class FindPanel;
+ ScopedPointer<FindPanel> findPanel;
+
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CppCodeEditorComponent);
};
View
107 JUCE/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h
@@ -724,6 +724,8 @@ class XCodeProjectExporter : public ProjectExporter
if (config.getCppLibType().isNotEmpty())
s.add ("CLANG_CXX_LIBRARY = " + config.getCppLibType().quoted());
+ s.add ("COMBINE_HIDPI_IMAGES = YES");
+
{
StringArray linkerFlags, librarySearchPaths;
getLinkerFlags (config, linkerFlags, librarySearchPaths);
@@ -887,11 +889,11 @@ class XCodeProjectExporter : public ProjectExporter
sourceIDs.add (fileID);
ValueTree* v = new ValueTree (fileID);
- v->setProperty ("isa", "PBXBuildFile", 0);
- v->setProperty ("fileRef", fileRefID, 0);
+ v->setProperty ("isa", "PBXBuildFile", nullptr);
+ v->setProperty ("fileRef", fileRefID, nullptr);
if (inhibitWarnings)
- v->setProperty ("settings", "{COMPILER_FLAGS = \"-w\"; }", 0);
+ v->setProperty ("settings", "{COMPILER_FLAGS = \"-w\"; }", nullptr);
pbxBuildFiles.add (v);
return fileID;
@@ -920,11 +922,11 @@ class XCodeProjectExporter : public ProjectExporter
const String fileRefID (createFileRefID (pathString));
ScopedPointer<ValueTree> v (new ValueTree (fileRefID));
- v->setProperty ("isa", "PBXFileReference", 0);
- v->setProperty ("lastKnownFileType", getFileType (path), 0);
- v->setProperty (Ids::name, pathString.fromLastOccurrenceOf ("/", false, false), 0);
- v->setProperty ("path", sanitisePath (pathString), 0);
- v->setProperty ("sourceTree", sourceTree, 0);
+ v->setProperty ("isa", "PBXFileReference", nullptr);
+ v->setProperty ("lastKnownFileType", getFileType (path), nullptr);
+ v->setProperty (Ids::name, pathString.fromLastOccurrenceOf ("/", false, false), nullptr);
+ v->setProperty ("path", sanitisePath (pathString), nullptr);
+ v->setProperty ("sourceTree", sourceTree, nullptr);
const int existing = pbxFileReferences.indexOfSorted (*this, v);
@@ -1035,10 +1037,10 @@ class XCodeProjectExporter : public ProjectExporter
void addGroup (const String& groupID, const String& groupName, const StringArray& childIDs) const
{
ValueTree* v = new ValueTree (groupID);
- v->setProperty ("isa", "PBXGroup", 0);
- v->setProperty ("children", "(" + indentList (childIDs, ",") + " )", 0);
- v->setProperty (Ids::name, groupName, 0);
- v->setProperty ("sourceTree", "<group>", 0);
+ v->setProperty ("isa", "PBXGroup", nullptr);
+ v->setProperty ("children", "(" + indentList (childIDs, ",") + " )", nullptr);
+ v->setProperty (Ids::name, groupName, nullptr);
+ v->setProperty ("sourceTree", "<group>", nullptr);
pbxGroups.add (v);
}
@@ -1067,29 +1069,29 @@ class XCodeProjectExporter : public ProjectExporter
void addBuildProduct (const String& fileType, const String& binaryName) const
{
ValueTree* v = new ValueTree (createID ("__productFileID"));
- v->setProperty ("isa", "PBXFileReference", 0);
- v->setProperty ("explicitFileType", fileType, 0);
- v->setProperty ("includeInIndex", (int) 0, 0);
- v->setProperty ("path", sanitisePath (binaryName), 0);
- v->setProperty ("sourceTree", "BUILT_PRODUCTS_DIR", 0);
+ v->setProperty ("isa", "PBXFileReference", nullptr);
+ v->setProperty ("explicitFileType", fileType, nullptr);
+ v->setProperty ("includeInIndex", (int) 0, nullptr);
+ v->setProperty ("path", sanitisePath (binaryName), nullptr);
+ v->setProperty ("sourceTree", "BUILT_PRODUCTS_DIR", nullptr);
pbxFileReferences.add (v);
}
void addTargetConfig (const String& configName, const StringArray& buildSettings) const
{
ValueTree* v = new ValueTree (createID ("targetconfigid_" + configName));
- v->setProperty ("isa", "XCBuildConfiguration", 0);
- v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", 0);
- v->setProperty (Ids::name, configName, 0);
+ v->setProperty ("isa", "XCBuildConfiguration", nullptr);
+ v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", nullptr);
+ v->setProperty (Ids::name, configName, nullptr);
targetConfigs.add (v);
}
void addProjectConfig (const String& configName, const StringArray& buildSettings) const
{
ValueTree* v = new ValueTree (createID ("projectconfigid_" + configName));
- v->setProperty ("isa", "XCBuildConfiguration", 0);
- v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", 0);
- v->setProperty (Ids::name, configName, 0);
+ v->setProperty ("isa", "XCBuildConfiguration", nullptr);
+ v->setProperty ("buildSettings", "{" + indentList (buildSettings, ";") + " }", nullptr);
+ v->setProperty (Ids::name, configName, nullptr);
projectConfigs.add (v);
}
@@ -1101,12 +1103,12 @@ class XCodeProjectExporter : public ProjectExporter
configIDs.add (configsToUse[i]->getType().toString());
ValueTree* v = new ValueTree (listID);
- v->setProperty ("isa", "XCConfigurationList", 0);
- v->setProperty ("buildConfigurations", "(" + indentList (configIDs, ",") + " )", 0);
- v->setProperty ("defaultConfigurationIsVisible", (int) 0, 0);
+ v->setProperty ("isa", "XCConfigurationList", nullptr);
+ v->setProperty ("buildConfigurations", "(" + indentList (configIDs, ",") + " )", nullptr);
+ v->setProperty ("defaultConfigurationIsVisible", (int) 0, nullptr);
if (configsToUse[0] != nullptr)
- v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), 0);
+ v->setProperty ("defaultConfigurationName", configsToUse[0]->getProperty (Ids::name), nullptr);
misc.add (v);
}
@@ -1117,10 +1119,10 @@ class XCodeProjectExporter : public ProjectExporter
buildPhaseIDs.add (phaseId);
ValueTree* v = new ValueTree (phaseId);
- v->setProperty ("isa", phaseType, 0);
- v->setProperty ("buildActionMask", "2147483647", 0);
- v->setProperty ("files", "(" + indentList (fileIds, ",") + " )", 0);
- v->setProperty ("runOnlyForDeploymentPostprocessing", (int) 0, 0);
+ v->setProperty ("isa", phaseType, nullptr);
+ v->setProperty ("buildActionMask", "2147483647", nullptr);
+ v->setProperty ("files", "(" + indentList (fileIds, ",") + " )", nullptr);
+ v->setProperty ("runOnlyForDeploymentPostprocessing", (int) 0, nullptr);
misc.add (v);
return v;
}
@@ -1128,20 +1130,20 @@ class XCodeProjectExporter : public ProjectExporter
void addTargetObject() const
{
ValueTree* const v = new ValueTree (createID ("__target"));
- v->setProperty ("isa", "PBXNativeTarget", 0);
- v->setProperty ("buildConfigurationList", createID ("__configList"), 0);
- v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", 0);
- v->setProperty ("buildRules", "( )", 0);
- v->setProperty ("dependencies", "( )", 0);
- v->setProperty (Ids::name, projectName, 0);
- v->setProperty ("productName", projectName, 0);
- v->setProperty ("productReference", createID ("__productFileID"), 0);
+ v->setProperty ("isa", "PBXNativeTarget", nullptr);
+ v->setProperty ("buildConfigurationList", createID ("__configList"), nullptr);
+ v->setProperty ("buildPhases", "(" + indentList (buildPhaseIDs, ",") + " )", nullptr);
+ v->setProperty ("buildRules", "( )", nullptr);
+ v->setProperty ("dependencies", "( )", nullptr);
+ v->setProperty (Ids::name, projectName, nullptr);
+ v->setProperty ("productName", projectName, nullptr);
+ v->setProperty ("productReference", createID ("__productFileID"), nullptr);
if (xcodeProductInstallPath.isNotEmpty())
- v->setProperty ("productInstallPath", xcodeProductInstallPath, 0);
+ v->setProperty ("productInstallPath", xcodeProductInstallPath, nullptr);
jassert (xcodeProductType.isNotEmpty());
- v->setProperty ("productType", xcodeProductType, 0);
+ v->setProperty ("productType", xcodeProductType, nullptr);
misc.add (v);
}
@@ -1149,14 +1151,15 @@ class XCodeProjectExporter : public ProjectExporter
void addProjectObject() const
{
ValueTree* const v = new ValueTree (createID ("__root"));
- v->setProperty ("isa", "PBXProject", 0);
- v->setProperty ("buildConfigurationList", createID ("__projList"), 0);
- v->setProperty ("compatibilityVersion", "Xcode 3.2", 0);
- v->setProperty ("hasScannedForEncodings", (int) 0, 0);
- v->setProperty ("mainGroup", createID ("__mainsourcegroup"), 0);
- v->setProperty ("projectDirPath", "\"\"", 0);
- v->setProperty ("projectRoot", "\"\"", 0);
- v->setProperty ("targets", "( " + createID ("__target") + " )", 0);
+ v->setProperty ("isa", "PBXProject", nullptr);
+ v->setProperty ("buildConfigurationList", createID ("__projList"), nullptr);
+ v->setProperty ("attributes", "{ LastUpgradeCheck = 0440; }", nullptr);
+ v->setProperty ("compatibilityVersion", "Xcode 3.2", nullptr);
+ v->setProperty ("hasScannedForEncodings", (int) 0, nullptr);
+ v->setProperty ("mainGroup", createID ("__mainsourcegroup"), nullptr);
+ v->setProperty ("projectDirPath", "\"\"", nullptr);
+ v->setProperty ("projectRoot", "\"\"", nullptr);
+ v->setProperty ("targets", "( " + createID ("__target") + " )", nullptr);
misc.add (v);
}
@@ -1165,12 +1168,12 @@ class XCodeProjectExporter : public ProjectExporter
if (getPostBuildScript().isNotEmpty())
{
ValueTree* const v = addBuildPhase ("PBXShellScriptBuildPhase", StringArray());
- v->setProperty (Ids::name, "Post-build script", 0);
- v->setProperty ("shellPath", "/bin/sh", 0);
+ v->setProperty (Ids::name, "Post-build script", nullptr);
+ v->setProperty ("shellPath", "/bin/sh", nullptr);
v->setProperty ("shellScript", getPostBuildScript().replace ("\\", "\\\\")
.replace ("\"", "\\\"")
.replace ("\r\n", "\\n")
- .replace ("\n", "\\n"), 0);
+ .replace ("\n", "\\n"), nullptr);
}
}
View
21 JUCE/extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h
@@ -90,22 +90,13 @@ class ProjectSaver
project.createRequiredModules (moduleList, modules);
}
- if (errors.size() == 0)
- writeAppConfigFile (modules, appConfigUserContent);
+ if (errors.size() == 0) writeAppConfigFile (modules, appConfigUserContent);
+ if (errors.size() == 0) writeBinaryDataFiles();
+ if (errors.size() == 0) writeAppHeader (modules);
+ if (errors.size() == 0) writeProjects (modules);
+ if (errors.size() == 0) writeAppConfigFile (modules, appConfigUserContent); // (this is repeated in case the projects added anything to it)
- if (errors.size() == 0)
- writeBinaryDataFiles();
-
- if (errors.size() == 0)
- writeAppHeader (modules);
-
- if (errors.size() == 0)
- writeProjects (modules);
-
- if (errors.size() == 0)
- writeAppConfigFile (modules, appConfigUserContent); // (this is repeated in case the projects added anything to it)
-
- if (generatedCodeFolder.exists() && errors.size() == 0)
+ if (errors.size() == 0 && generatedCodeFolder.exists())
writeReadmeFile();
if (generatedCodeFolder.exists())
View
6 JUCE/extras/Introjucer/Source/Project/jucer_NewProjectWizard.cpp
@@ -32,16 +32,12 @@
static void createFileCreationOptionComboBox (Component& setupComp,
OwnedArray<Component>& itemsCreated,
- const char** types)
+ const char** fileOptions)
{
ComboBox* c = new ComboBox();
itemsCreated.add (c);
setupComp.addChildAndSetID (c, "filesToCreate");
- const char* fileOptions[] = { "Create a Main.cpp file",
- "Create a Main.cpp file and a basic window",
- "Don't create any files", 0 };
-
c->addItemList (StringArray (fileOptions), 1);
c->setSelectedId (1, false);
View
5 JUCE/extras/Introjucer/Source/Project/jucer_Project.cpp
@@ -47,14 +47,15 @@ namespace Tags
const char* Project::projectFileExtension = ".jucer";
//==============================================================================
-Project::Project (const File& file_)
+Project::Project (const File& f)
: FileBasedDocument (projectFileExtension,
String ("*") + projectFileExtension,
"Choose a Jucer project to load",
"Save Jucer project"),
projectRoot (Tags::projectRoot)
{
- setFile (file_);
+ Logger::writeToLog ("Loading project: " + f.getFullPathName());
+ setFile (f);
removeDefunctExporters();
setMissingDefaultValues();
View
8 JUCE/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp
@@ -535,7 +535,7 @@ void ProjectContentComponent::getAllCommands (Array <CommandID>& commands)
CommandIDs::goToPreviousDoc,
CommandIDs::goToNextDoc,
CommandIDs::goToCounterpart,
- StandardApplicationCommandIDs::del };
+ CommandIDs::deleteSelectedItem };
commands.addArray (ids, numElementsInArray (ids));
}
@@ -636,7 +636,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
"Saves the project and launches it in an external IDE",
CommandCategories::general, 0);
result.setActive (ProjectExporter::canProjectBeLaunched (project));
- result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier, 0));
+ result.defaultKeypresses.add (KeyPress ('l', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
break;
case CommandIDs::showFilePanel:
@@ -655,7 +655,7 @@ void ProjectContentComponent::getCommandInfo (const CommandID commandID, Applica
result.defaultKeypresses.add (KeyPress ('i', ModifierKeys::commandModifier, 0));
break;
- case StandardApplicationCommandIDs::del:
+ case CommandIDs::deleteSelectedItem:
result.setInfo ("Delete Selected File", String::empty, CommandCategories::general, 0);
result.defaultKeypresses.add (KeyPress (KeyPress::deleteKey, 0, 0));
result.defaultKeypresses.add (KeyPress (KeyPress::backspaceKey, 0, 0));
@@ -712,7 +712,7 @@ bool ProjectContentComponent::perform (const InvocationInfo& info)
case CommandIDs::openInIDE: openInIDE(); break;
- case StandardApplicationCommandIDs::del: deleteSelectedTreeItems(); break;
+ case CommandIDs::deleteSelectedItem: deleteSelectedTreeItems(); break;
case CommandIDs::saveAndOpenInIDE:
if (saveProject())
View
17 JUCE/extras/Introjucer/Source/Project/jucer_TreeViewTypes.cpp
@@ -75,12 +75,8 @@ void GroupTreeViewItem::moveSelectedItemsTo (OwnedArray <Project::Item>& selecte
void GroupTreeViewItem::checkFileStatus()
{
for (int i = 0; i < getNumSubItems(); ++i)
- {
- ProjectTreeViewBase* p = dynamic_cast <ProjectTreeViewBase*> (getSubItem(i));
-
- if (p != nullptr)
+ if (ProjectTreeViewBase* p = dynamic_cast <ProjectTreeViewBase*> (getSubItem(i)))
p->checkFileStatus();
- }
}
ProjectTreeViewBase* GroupTreeViewItem::createSubItem (const Project::Item& child)
@@ -97,9 +93,7 @@ ProjectTreeViewBase* GroupTreeViewItem::createSubItem (const Project::Item& chil
void GroupTreeViewItem::showDocument()
{
- ProjectContentComponent* pcc = getProjectContentComponent();
-
- if (pcc != nullptr)
+ if (ProjectContentComponent* pcc = getProjectContentComponent())
pcc->setEditorComponent (new GroupInformationComponent (item), nullptr);
}
@@ -243,8 +237,7 @@ void SourceFileTreeViewItem::showPopupMenu()
{
PopupMenu m;
- GroupTreeViewItem* parentGroup = dynamic_cast <GroupTreeViewItem*> (getParentProjectItem());
- if (parentGroup != nullptr)
+ if (GroupTreeViewItem* parentGroup = dynamic_cast <GroupTreeViewItem*> (getParentProjectItem()))
{
parentGroup->addCreateFileMenuItems (m);
m.addSeparator();
@@ -267,8 +260,6 @@ void SourceFileTreeViewItem::showPopupMenu()
void SourceFileTreeViewItem::handlePopupMenuResult (int resultCode)
{
- GroupTreeViewItem* parentGroup = dynamic_cast <GroupTreeViewItem*> (getParentProjectItem());
-
switch (resultCode)
{
case 1: getFile().startAsProcess(); break;
@@ -277,7 +268,7 @@ void SourceFileTreeViewItem::handlePopupMenuResult (int resultCode)
case 4: triggerAsyncRename (item); break;
default:
- if (parentGroup != nullptr)
+ if (GroupTreeViewItem* parentGroup = dynamic_cast <GroupTreeViewItem*> (getParentProjectItem()))
parentGroup->processCreateFileMenuItem (resultCode);
break;
View
37 JUCE/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp
@@ -90,31 +90,34 @@ PropertiesFile& StoredSettings::getProjectProperties (const String& projectUID)
return *p;
}
-void StoredSettings::flush()
+void StoredSettings::updateGlobalProps()
{
- for (int i = propertyFiles.size(); --i >= 0;)
+ PropertiesFile& props = getGlobalProperties();
+
{
- PropertiesFile* const props = propertyFiles.getUnchecked(i);
+ const ScopedPointer<XmlElement> xml (appearance.settings.createXml());
+ props.setValue ("editorColours", xml);
+ }
- {
- const ScopedPointer<XmlElement> xml (appearance.settings.createXml());
- props->setValue ("editorColours", xml);
- }
+ props.setValue ("recentFiles", recentFiles.toString());
- props->setValue ("recentFiles", recentFiles.toString());
+ props.removeValue ("keyMappings");
- props->removeValue ("keyMappings");
+ if (commandManager != nullptr)
+ {
+ const ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true));
- if (commandManager != nullptr)
- {
- ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true));
+ if (keys != nullptr)
+ props.setValue ("keyMappings", keys);
+ }
+}
- if (keys != nullptr)
- props->setValue ("keyMappings", (XmlElement*) keys);
- }
+void StoredSettings::flush()
+{
+ updateGlobalProps();
- props->saveIfNeeded();
- }
+ for (int i = propertyFiles.size(); --i >= 0;)
+ propertyFiles.getUnchecked(i)->saveIfNeeded();
}
void StoredSettings::reload()
View
1  JUCE/extras/Introjucer/Source/Utility/jucer_StoredSettings.h
@@ -71,6 +71,7 @@ class StoredSettings
private:
OwnedArray<PropertiesFile> propertyFiles;
+ void updateGlobalProps();
void loadSwatchColours();
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StoredSettings);
View
4 JUCE/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj
@@ -2028,6 +2028,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -2047,6 +2048,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -2147,7 +2149,7 @@
2E115993E9743E9E60D96434,
8478974C956501F4EA996448,
8C6D93B7CB9CCF8025AA68EB ); buildRules = ( ); dependencies = ( ); name = "Juce Demo"; productName = "Juce Demo"; productReference = D119A3871626EC2B8EFCB0D4; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- C1B2C620111BD898B338CCA1 = { isa = PBXProject; buildConfigurationList = C01737B8733CB01B27C1DF59; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 197E966E1B8F9DE1A6F9F0D4; projectDirPath = ""; projectRoot = ""; targets = ( 9A1F85020B3ADFBFE3D383F2 ); };
+ C1B2C620111BD898B338CCA1 = { isa = PBXProject; buildConfigurationList = C01737B8733CB01B27C1DF59; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 197E966E1B8F9DE1A6F9F0D4; projectDirPath = ""; projectRoot = ""; targets = ( 9A1F85020B3ADFBFE3D383F2 ); };
};
rootObject = C1B2C620111BD898B338CCA1;
}
View
4 JUCE/extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj
@@ -2014,6 +2014,7 @@
INSTALL_PATH = "$(HOME)/Applications";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -2030,6 +2031,7 @@
INSTALL_PATH = "$(HOME)/Applications";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -2132,7 +2134,7 @@
2E115993E9743E9E60D96434,
8478974C956501F4EA996448,
8C6D93B7CB9CCF8025AA68EB ); buildRules = ( ); dependencies = ( ); name = "Juce Demo"; productName = "Juce Demo"; productReference = D119A3871626EC2B8EFCB0D4; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- C1B2C620111BD898B338CCA1 = { isa = PBXProject; buildConfigurationList = C01737B8733CB01B27C1DF59; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 197E966E1B8F9DE1A6F9F0D4; projectDirPath = ""; projectRoot = ""; targets = ( 9A1F85020B3ADFBFE3D383F2 ); };
+ C1B2C620111BD898B338CCA1 = { isa = PBXProject; buildConfigurationList = C01737B8733CB01B27C1DF59; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 197E966E1B8F9DE1A6F9F0D4; projectDirPath = ""; projectRoot = ""; targets = ( 9A1F85020B3ADFBFE3D383F2 ); };
};
rootObject = C1B2C620111BD898B338CCA1;
}
View
4 JUCE/extras/audio plugin demo/Builds/MacOSX/JuceDemoPlugin.xcodeproj/project.pbxproj
@@ -1995,6 +1995,7 @@
EXCLUDED_SOURCE_FILE_NAMES_x86_64 = "*Carbon*.cpp";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
OTHER_LDFLAGS = "-bundle";
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
@@ -2018,6 +2019,7 @@
EXCLUDED_SOURCE_FILE_NAMES_x86_64 = "*Carbon*.cpp";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
OTHER_LDFLAGS = "-bundle";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
@@ -2129,7 +2131,7 @@
E032EB514708440DE9B7FF2A,
95E57A758351FE57067B605F,
E277BCF6E051A6008DD74155 ); buildRules = ( ); dependencies = ( ); name = JuceDemoPlugin; productName = JuceDemoPlugin; productReference = 63F8022F081E22DFFFCAC998; productInstallPath = "$(HOME)/Library/Audio/Plug-Ins/Components/"; productType = "com.apple.product-type.bundle"; };
- 85250052F3E019894332668E = { isa = PBXProject; buildConfigurationList = 0720B453F376663EAB98BF9B; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 4074359E1E7C4D54E87C3461; projectDirPath = ""; projectRoot = ""; targets = ( 27A65CD0B053616E226D4547 ); };
+ 85250052F3E019894332668E = { isa = PBXProject; buildConfigurationList = 0720B453F376663EAB98BF9B; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 4074359E1E7C4D54E87C3461; projectDirPath = ""; projectRoot = ""; targets = ( 27A65CD0B053616E226D4547 ); };
};
rootObject = 85250052F3E019894332668E;
}
View
4 JUCE/extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj
@@ -1949,6 +1949,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -1967,6 +1968,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -2049,7 +2051,7 @@
2309EA55A722EF4ED2D62447,
8915908C84EBB721DD5BF3C1,
C1A9B94FBBEB8C8B72689262 ); buildRules = ( ); dependencies = ( ); name = "Plugin Host"; productName = "Plugin Host"; productReference = B2A7B6A8E3CCA7E2038E8EFF; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- ADE6E539DB98A302483A82D0 = { isa = PBXProject; buildConfigurationList = 493C2C5E457692E5149C5525; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 65BEFC705A89E5C8A9E35C97; projectDirPath = ""; projectRoot = ""; targets = ( B5F8DFF64A83B053583709F0 ); };
+ ADE6E539DB98A302483A82D0 = { isa = PBXProject; buildConfigurationList = 493C2C5E457692E5149C5525; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = 65BEFC705A89E5C8A9E35C97; projectDirPath = ""; projectRoot = ""; targets = ( B5F8DFF64A83B053583709F0 ); };
};
rootObject = ADE6E539DB98A302483A82D0;
}
View
4 JUCE/extras/binarybuilder/Builds/MacOSX/BinaryBuilder.xcodeproj/project.pbxproj
@@ -440,6 +440,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -456,6 +457,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -509,7 +511,7 @@
7B52CBCC65AE087EEFB2C437,
77D79017A9F2C7F35DD55196,
FA91AF2CE863567091E8A6B0 ); buildRules = ( ); dependencies = ( ); name = BinaryBuilder; productName = BinaryBuilder; productReference = E2EADDD364B6C6F37D8BBD7A; productInstallPath = /usr/bin; productType = "com.apple.product-type.tool"; };
- 36B6F402BC83F21646259DEF = { isa = PBXProject; buildConfigurationList = E4C85B0464A93027D035AA1F; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = C18D022743CF5BD14D6A6A9E; projectDirPath = ""; projectRoot = ""; targets = ( 3F86988238803AA6377D688E ); };
+ 36B6F402BC83F21646259DEF = { isa = PBXProject; buildConfigurationList = E4C85B0464A93027D035AA1F; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = C18D022743CF5BD14D6A6A9E; projectDirPath = ""; projectRoot = ""; targets = ( 3F86988238803AA6377D688E ); };
};
rootObject = 36B6F402BC83F21646259DEF;
}
View
4 JUCE/extras/example projects/Builds/MacOSX/HelloWorld.xcodeproj/project.pbxproj
@@ -1403,6 +1403,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -1419,6 +1420,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -1481,7 +1483,7 @@
7B2C68FAAB7FB794B44BA476,
5C249F77DD3C907CDA919026,
A8FE28D8F12C03C93B8EAD1D ); buildRules = ( ); dependencies = ( ); name = HelloWorld; productName = HelloWorld; productReference = EA398D9C544440E06637C134; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- E34D5B980741D93050D0BB6B = { isa = PBXProject; buildConfigurationList = D5495970AC0AFC78DD0ADE12; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = CB9C4DF3F11D65C6BF6B80AD; projectDirPath = ""; projectRoot = ""; targets = ( 9337F8263A94B688D61D5B68 ); };
+ E34D5B980741D93050D0BB6B = { isa = PBXProject; buildConfigurationList = D5495970AC0AFC78DD0ADE12; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = CB9C4DF3F11D65C6BF6B80AD; projectDirPath = ""; projectRoot = ""; targets = ( 9337F8263A94B688D61D5B68 ); };
};
rootObject = E34D5B980741D93050D0BB6B;
}
View
4 JUCE/extras/example projects/Builds/iOS/HelloWorld.xcodeproj/project.pbxproj
@@ -1401,6 +1401,7 @@
INSTALL_PATH = "$(HOME)/Applications";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -1415,6 +1416,7 @@
INSTALL_PATH = "$(HOME)/Applications";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -1483,7 +1485,7 @@
7B2C68FAAB7FB794B44BA476,
5C249F77DD3C907CDA919026,
A8FE28D8F12C03C93B8EAD1D ); buildRules = ( ); dependencies = ( ); name = HelloWorld; productName = HelloWorld; productReference = EA398D9C544440E06637C134; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- E34D5B980741D93050D0BB6B = { isa = PBXProject; buildConfigurationList = D5495970AC0AFC78DD0ADE12; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = CB9C4DF3F11D65C6BF6B80AD; projectDirPath = ""; projectRoot = ""; targets = ( 9337F8263A94B688D61D5B68 ); };
+ E34D5B980741D93050D0BB6B = { isa = PBXProject; buildConfigurationList = D5495970AC0AFC78DD0ADE12; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = CB9C4DF3F11D65C6BF6B80AD; projectDirPath = ""; projectRoot = ""; targets = ( 9337F8263A94B688D61D5B68 ); };
};
rootObject = E34D5B980741D93050D0BB6B;
}
View
4 JUCE/extras/the jucer/Builds/MacOSX/Jucer.xcodeproj/project.pbxproj
@@ -1666,6 +1666,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
ONLY_ACTIVE_ARCH = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
@@ -1682,6 +1683,7 @@
SDKROOT_ppc = macosx10.5;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ COMBINE_HIDPI_IMAGES = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
@@ -1775,7 +1777,7 @@
C06AC70106231834669512C5,
394C2D5A71955036D265B490,
B11FA40C6130EB5EB185D0FF ); buildRules = ( ); dependencies = ( ); name = Jucer; productName = Jucer; productReference = C2070DE2D6C322FDEADA3835; productInstallPath = "$(HOME)/Applications"; productType = "com.apple.product-type.application"; };
- 67EDA91590B438C436662019 = { isa = PBXProject; buildConfigurationList = B01CF9105DD0717790C4738E; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = A7BE471011DB0F6646F53DC3; projectDirPath = ""; projectRoot = ""; targets = ( CC78C20B8F6159F24605BED8 ); };
+ 67EDA91590B438C436662019 = { isa = PBXProject; buildConfigurationList = B01CF9105DD0717790C4738E; attributes = { LastUpgradeCheck = 0440; }; compatibilityVersion = "Xcode 3.2"; hasScannedForEncodings = 0; mainGroup = A7BE471011DB0F6646F53DC3; projectDirPath = ""; projectRoot = ""; targets = ( CC78C20B8F6159F24605BED8 ); };
};
rootObject = 67EDA91590B438C436662019;
}
View
15 JUCE/modules/juce_audio_plugin_client/utility/juce_FakeMouseMoveGenerator.h
@@ -49,17 +49,10 @@ class FakeMouseMoveGenerator : private Timer
const ModifierKeys mods (ModifierKeys::getCurrentModifiers());
if (! mods.isAnyMouseButtonDown())
- {
- Component* comp = Desktop::getInstance().findComponentAt (screenPos);
-
- if (comp != nullptr)
- {
- ComponentPeer* const peer = comp->getPeer();
-
- if (peer != nullptr && ! peer->isFocused())
- peer->handleMouseEvent (0, screenPos - peer->getScreenPosition(), mods, Time::currentTimeMillis());
- }
- }
+ if (Component* const comp = Desktop::getInstance().findComponentAt (screenPos))
+ if (ComponentPeer* const peer = comp->getPeer())
+ if (! peer->isFocused())
+ peer->handleMouseEvent (0, screenPos - peer->getScreenPosition(), mods, Time::currentTimeMillis());
}
}
View
13 JUCE/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
@@ -161,9 +161,7 @@ String s (fileOrIdentifier.substring (jmax (fileOrIdentifier.lastIndexOfChar (':
desc.componentSubType = stringToOSType (tokens[1]);
desc.componentManufacturer = stringToOSType (tokens[2]);
- ComponentRecord* comp = FindNextComponent (0, &desc);
-
- if (comp != nullptr)
+ if (ComponentRecord* comp = FindNextComponent (0, &desc))
{
getAUDetails (comp, name, manufacturer);
return true;
@@ -295,9 +293,7 @@ bool getComponentDescFromFile (const String& fileOrIdentifier, ComponentDescript
if (getComponentDescFromFile (fileOrIdentifier, componentDesc, pluginName, version, manufacturer))
{
- ComponentRecord* const comp = FindNextComponent (0, &componentDesc);
-
- if (comp != nullptr)
+ if (ComponentRecord* const comp = FindNextComponent (0, &componentDesc))
{
audioUnit = (AudioUnit) OpenComponent (comp);
@@ -604,7 +600,7 @@ void sendAllParametersChangedEvents()
const String getParameterName (int index)
{
- AudioUnitParameterInfo info = { 0 };
+ AudioUnitParameterInfo info;
UInt32 sz = sizeof (info);
String name;
@@ -1394,9 +1390,8 @@ void removeView (HIViewRef)
try
{
ScopedPointer <AudioPluginInstance> createdInstance (createInstanceFromDescription (desc));
- AudioUnitPluginInstance* const auInstance = dynamic_cast <AudioUnitPluginInstance*> ((AudioPluginInstance*) createdInstance);
- if (auInstance != nullptr)
+ if (AudioUnitPluginInstance* const auInstance = dynamic_cast <AudioUnitPluginInstance*> ((AudioPluginInstance*) createdInstance))
{
auInstance->fillInPluginDescription (desc);
results.add (new PluginDescription (desc));
View
28 JUCE/modules/juce_core/files/juce_File.cpp
@@ -130,21 +130,29 @@ String File::parseAbsolutePath (const String& p)
// expand a name of type "~dave/abc"
const String userName (path.substring (1).upToFirstOccurrenceOf ("/", false, false));
- struct passwd* const pw = getpwnam (userName.toUTF8());
- if (pw != nullptr)
+ if (struct passwd* const pw = getpwnam (userName.toUTF8()))
path = addTrailingSeparator (pw->pw_dir) + path.fromFirstOccurrenceOf ("/", false, false);
}
}
else if (! path.startsWithChar (separator))
{
- /* When you supply a raw string to the File object constructor, it must be an absolute path.
- If you're trying to parse a string that may be either a relative path or an absolute path,
- you MUST provide a context against which the partial path can be evaluated - you can do
- this by simply using File::getChildFile() instead of the File constructor. E.g. saying
- "File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
- path if that's what was supplied, or would evaluate a partial path relative to the CWD.
- */
- jassert (path.startsWith ("./") || path.startsWith ("../")); // (assume that a path "./xyz" is deliberately intended to be relative to the CWD)
+ #if JUCE_DEBUG || JUCE_LOG_ASSERTIONS
+ if (! (path.startsWith ("./") || path.startsWith ("../")))
+ {
+ /* When you supply a raw string to the File object constructor, it must be an absolute path.
+ If you're trying to parse a string that may be either a relative path or an absolute path,
+ you MUST provide a context against which the partial path can be evaluated - you can do
+ this by simply using File::getChildFile() instead of the File constructor. E.g. saying
+ "File::getCurrentWorkingDirectory().getChildFile (myUnknownPath)" would return an absolute
+ path if that's what was supplied, or would evaluate a partial path relative to the CWD.
+ */
+ jassertfalse;
+
+ #if JUCE_LOG_ASSERTIONS
+ Logger::writeToLog ("Illegal absolute path: " + path);
+ #endif
+ }
+ #endif
return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
}
View
105 JUCE/modules/juce_core/logging/juce_FileLogger.cpp
@@ -23,19 +23,16 @@
==============================================================================
*/
-FileLogger::FileLogger (const File& logFile_,
+FileLogger::FileLogger (const File& file,
const String& welcomeMessage,
- const int maxInitialFileSizeBytes)
- : logFile (logFile_)
+ const int64 maxInitialFileSizeBytes)
+ : logFile (file)
{
if (maxInitialFileSizeBytes >= 0)
trimFileSize (maxInitialFileSizeBytes);
- if (! logFile_.exists())
- {
- // do this so that the parent directories get created..
- logFile_.create();
- }
+ if (! file.exists())
+ file.create(); // (to create the parent directories)
String welcome;
welcome << newLine
@@ -46,23 +43,18 @@ FileLogger::FileLogger (const File& logFile_,
FileLogger::logMessage (welcome);
}
-FileLogger::~FileLogger()
-{
-}
+FileLogger::~FileLogger() {}
//==============================================================================
void FileLogger::logMessage (const String& message)
{
- DBG (message);
-
const ScopedLock sl (logLock);
-
+ DBG (message);
FileOutputStream out (logFile, 256);
out << message << newLine;
}
-
-void FileLogger::trimFileSize (int maxFileSizeBytes) const
+void FileLogger::trimFileSize (int64 maxFileSizeBytes) const
{
if (maxFileSizeBytes <= 0)
{
@@ -74,59 +66,66 @@ void FileLogger::trimFileSize (int maxFileSizeBytes) const
if (fileSize > maxFileSizeBytes)
{
- ScopedPointer <FileInputStream> in (logFile.createInputStream());
- jassert (in != nullptr);
+ TemporaryFile tempFile (logFile);
- if (in != nullptr)
{
- in->setPosition (fileSize - maxFileSizeBytes);
- String content;
+ FileOutputStream out (tempFile.getFile());
+ FileInputStream in (logFile);
- {
- MemoryBlock contentToSave;
- contentToSave.setSize ((size_t) maxFileSizeBytes + 4);
- contentToSave.fillWith (0);
+ if (! (out.openedOk() && in.openedOk()))
+ return;
- in->read (contentToSave.getData(), maxFileSizeBytes);
- in = nullptr;
+ in.setPosition (fileSize - maxFileSizeBytes);
- content = contentToSave.toString();
+ for (;;)
+ {
+ const char c = in.readByte();
+ if (c == 0)
+ return;
+
+ if (c == '\n' || c == '\r')
+ {
+ out << c;
+ break;
+ }
}
- int newStart = 0;
-
- while (newStart < fileSize
- && content[newStart] != '\n'
- && content[newStart] != '\r')
- ++newStart;
-
- logFile.deleteFile();
- logFile.appendText (content.substring (newStart), false, false);
+ out.writeFromInputStream (in, -1);
}
+
+ tempFile.overwriteTargetFileWithTemporary();
}
}
}
//==============================================================================
-FileLogger* FileLogger::createDefaultAppLogger (const String& logFileSubDirectoryName,
- const String& logFileName,
- const String& welcomeMessage,
- const int maxInitialFileSizeBytes)
+File FileLogger::getSystemLogFileFolder()
{
#if JUCE_MAC
- File logFile ("~/Library/Logs");
- logFile = logFile.getChildFile (logFileSubDirectoryName)
- .getChildFile (logFileName);
-
+ return File ("~/Library/Logs");
#else
- File logFile (File::getSpecialLocation (File::userApplicationDataDirectory));
-
- if (logFile.isDirectory())
- {
- logFile = logFile.getChildFile (logFileSubDirectoryName)
- .getChildFile (logFileName);
- }
+ return File::getSpecialLocation (File::userApplicationDataDirectory);
#endif
+}
- return new FileLogger (logFile, welcomeMessage, maxInitialFileSizeBytes);
+FileLogger* FileLogger::createDefaultAppLogger (const String& logFileSubDirectoryName,
+ const String& logFileName,
+ const String& welcomeMessage,
+ const int64 maxInitialFileSizeBytes)
+{
+ return new FileLogger (getSystemLogFileFolder().getChildFile (logFileSubDirectoryName)
+ .getChildFile (logFileName),
+ welcomeMessage, maxInitialFileSizeBytes);
+}
+
+FileLogger* FileLogger::createDateStampedLogger (const String& logFileSubDirectoryName,
+ const String& logFileNameRoot,
+ const String& logFileNameSuffix,
+ const String& welcomeMessage)
+{
+ return new FileLogger (getSystemLogFileFolder().getChildFile (logFileSubDirectoryName)
+ .getChildFile (logFileNameRoot + Time::getCurrentTime().formatted ("%Y-%m-%d_%H-%M-%S"))
+ .withFileExtension (logFileNameSuffix)
+ .getNonexistentSibling(),
+ welcomeMessage, 0);
}
View
66 JUCE/modules/juce_core/logging/juce_FileLogger.h
@@ -59,47 +59,75 @@ class JUCE_API FileLogger : public Logger
*/
FileLogger (const File& fileToWriteTo,
const String& welcomeMessage,
- const int maxInitialFileSizeBytes = 128 * 1024);
+ const int64 maxInitialFileSizeBytes = 128 * 1024);
/** Destructor. */
~FileLogger();
//==============================================================================
- void logMessage (const String& message);
-
- File getLogFile() const { return logFile; }
+ /** Returns the file that this logger is writing to. */
+ const File& getLogFile() const noexcept { return logFile; }
//==============================================================================
/** Helper function to create a log file in the correct place for this platform.
- On Windows this will return a logger with a path such as:
- c:\\Documents and Settings\\username\\Application Data\\[logFileSubDirectoryName]\\[logFileName]
-
- On the Mac it'll create something like:
- ~/Library/Logs/[logFileName]
-
- The method might return 0 if the file can't be created for some reason.
+ The method might return nullptr if the file can't be created for some reason.
- @param logFileSubDirectoryName if a subdirectory is needed, this is what it will be called -
- it's best to use the something like the name of your application here.
- @param logFileName the name of the file to create, e.g. "MyAppLog.txt". Don't just
- call it "log.txt" because if it goes in a directory with logs
- from other applications (as it will do on the Mac) then no-one
- will know which one is yours!
+ @param logFileSubDirectoryName the name of the subdirectory to create inside the logs folder (as
+ returned by getSystemLogFileFolder). It's best to use something
+ like the name of your application here.
+ @param logFileName the name of the file to create, e.g. "MyAppLog.txt".
@param welcomeMessage a message that will be written to the log when it's opened.
@param maxInitialFileSizeBytes (see the FileLogger constructor for more info on this)
*/
static FileLogger* createDefaultAppLogger (const String& logFileSubDirectoryName,
const String& logFileName,
const String& welcomeMessage,
- const int maxInitialFileSizeBytes = 128 * 1024);
+ const int64 maxInitialFileSizeBytes = 128 * 1024);
+
+ /** Helper function to create a log file in the correct place for this platform.
+
+ The filename used is based on the root and suffix strings provided, along with a
+ time and date string, meaning that a new, empty log file will be always be created
+ rather than appending to an exising one.
+
+ The method might return nullptr if the file can't be created for some reason.
+
+ @param logFileSubDirectoryName the name of the subdirectory to create inside the logs folder (as
+ returned by getSystemLogFileFolder). It's best to use something
+ like the name of your application here.
+ @param logFileNameRoot the start of the filename to use, e.g. "MyAppLog_". This will have
+ a timestamp and the logFileNameSuffix appended to it
+ @param logFileNameSuffix the file suffix to use, e.g. ".txt"
+ @param welcomeMessage a message that will be written to the log when it's opened.
+ */
+ static FileLogger* createDateStampedLogger (const String& logFileSubDirectoryName,
+ const String& logFileNameRoot,
+ const String& logFileNameSuffix,
+ const String& welcomeMessage);
+
+ //==============================================================================
+ /** Returns an OS-specific folder where log-files should be stored.
+
+ On Windows this will return a logger with a path such as:
+ c:\\Documents and Settings\\username\\Application Data\\[logFileSubDirectoryName]\\[logFileName]
+
+ On the Mac it'll create something like:
+ ~/Library/Logs/[logFileSubDirectoryName]/[logFileName]
+
+ @see createDefaultAppLogger
+ */
+ static File getSystemLogFileFolder();
+
+ // (implementation of the Logger virtual method)
+ void logMessage (const String&);
private:
//==============================================================================
File logFile;
CriticalSection logLock;
- void trimFileSize (int maxFileSizeBytes) const;
+ void trimFileSize (int64 maxFileSizeBytes) const;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileLogger);
};
View
19 JUCE/modules/juce_core/logging/juce_Logger.cpp
@@ -23,25 +23,20 @@
==============================================================================
*/
-Logger::Logger()
-{
-}
+Logger::Logger() {}
Logger::~Logger()
{
+ // You're deleting this logger while it's still being used!
+ // Always call Logger::setCurrentLogger (nullptr) before deleting the active logger.
+ jassert (currentLogger != this);
}
-//==============================================================================
Logger* Logger::currentLogger = nullptr;
-void Logger::setCurrentLogger (Logger* const newLogger,
- const bool deleteOldLogger)
+void Logger::setCurrentLogger (Logger* const newLogger) noexcept
{
- Logger* const oldLogger = currentLogger;
currentLogger = newLogger;
-
- if (deleteOldLogger)
- delete oldLogger;
}
void Logger::writeToLog (const String& message)
@@ -53,10 +48,10 @@ void Logger::writeToLog (const String& message)
}
#if JUCE_LOG_ASSERTIONS
-void JUCE_API logAssertion (const char* filename, const int lineNum) noexcept
+void JUCE_API logAssertion (const char* const filename, const int lineNum) noexcept
{
String m ("JUCE Assertion failure in ");
- m << filename << ", line " << lineNum;
+ m << File (filename).getFileName() << ':' << lineNum;
Logger::writeToLog (m);
}
View
10 JUCE/modules/juce_core/logging/juce_Logger.h
@@ -51,14 +51,11 @@ class JUCE_API Logger
//==============================================================================
/** Sets the current logging class to use.
- Note that the object passed in won't be deleted when no longer needed.
+ Note that the object passed in will not be owned or deleted by the logger, so
+ the caller must make sure that it is not deleted while still being used.
A null pointer can be passed-in to disable any logging.
-
- If deleteOldLogger is set to true, the existing logger will be
- deleted (if there is one).
*/
- static void JUCE_CALLTYPE setCurrentLogger (Logger* newLogger,
- bool deleteOldLogger = false);
+ static void JUCE_CALLTYPE setCurrentLogger (Logger* newLogger) noexcept;
/** Writes a string to the current logger.
@@ -84,7 +81,6 @@ class JUCE_API Logger
Logger();
/** This is overloaded by subclasses to implement custom logging behaviour.
-
@see setCurrentLogger
*/
virtual void logMessage (const String& message) = 0;
View
3  JUCE/modules/juce_core/native/juce_win32_Network.cpp
@@ -295,8 +295,7 @@ class WebInputStream : public InputStream
{
const TCHAR* mimeTypes[] = { _T("*/*"), 0 };
- DWORD flags = INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE
- | INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
+ DWORD flags = INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_COOKIES;
if (address.startsWithIgnoreCase ("https:"))
flags |= INTERNET_FLAG_SECURE; // (this flag only seems necessary if the OS is running IE6 -
View
12 JUCE/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp
@@ -103,17 +103,17 @@ File PropertiesFile::Options::getDefaultFile() const
//==============================================================================
-PropertiesFile::PropertiesFile (const File& file_, const Options& options_)
- : PropertySet (options_.ignoreCaseOfKeyNames),
- file (file_), options (options_),
+PropertiesFile::PropertiesFile (const File& f, const Options& o)
+ : PropertySet (o.ignoreCaseOfKeyNames),
+ file (f), options (o),
loadedOk (false), needsWriting (false)
{
initialise();
}
-PropertiesFile::PropertiesFile (const Options& options_)
- : PropertySet (options_.ignoreCaseOfKeyNames),
- file (options_.getDefaultFile()), options (options_),
+PropertiesFile::PropertiesFile (const Options& o)
+ : PropertySet (o.ignoreCaseOfKeyNames),
+ file (o.getDefaultFile()), options (o),
loadedOk (false), needsWriting (false)
{
initialise();
View
44 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp
@@ -27,7 +27,6 @@ ApplicationCommandManager::ApplicationCommandManager()
: firstTarget (nullptr)
{
keyMappings = new KeyPressMappingSet (this);
-
Desktop::getInstance().addFocusChangeListener (this);
}
@@ -65,7 +64,7 @@ void ApplicationCommandManager::registerCommand (const ApplicationCommandInfo& n
}
else
{
- // trying to re-register the same command with different parameters?
+ // trying to re-register the same command ID with different parameters?
jassert (newCommand.shortName == getCommandForID (newCommand.commandID)->shortName
&& (newCommand.description == getCommandForID (newCommand.commandID)->description || newCommand.description.isEmpty())
&& newCommand.categoryName == getCommandForID (newCommand.commandID)->categoryName
@@ -169,26 +168,24 @@ bool ApplicationCommandManager::invokeDirectly (const CommandID commandID, const
return invoke (info, asynchronously);
}
-bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::InvocationInfo& info_, const bool asynchronously)
+bool ApplicationCommandManager::invoke (const ApplicationCommandTarget::InvocationInfo& inf, const bool asynchronously)
{
// This call isn't thread-safe for use from a non-UI thread without locking the message
// manager first..
jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager());
+ bool ok = false;
ApplicationCommandInfo commandInfo (0);
- ApplicationCommandTarget* const target = getTargetForCommand (info_.commandID, commandInfo);
-
- if (target == nullptr)
- return false;
-
- ApplicationCommandTarget::InvocationInfo info (info_);
- info.commandFlags = commandInfo.flags;
- sendListenerInvokeCallback (info);
-
- const bool ok = target->invoke (info, asynchronously);
+ if (ApplicationCommandTarget* const target = getTargetForCommand (inf.commandID, commandInfo))
+ {
+ ApplicationCommandTarget::InvocationInfo info (inf);
+ info.commandFlags = commandInfo.flags;
- commandStatusChanged();
+ sendListenerInvokeCallback (info);
+ ok = target->invoke (info, asynchronously);
+ commandStatusChanged();
+ }
return ok;
}
@@ -239,9 +236,7 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
if (c == nullptr)
{
- TopLevelWindow* const activeWindow = TopLevelWindow::getActiveTopLevelWindow();
-
- if (activeWindow != nullptr)
+ if (TopLevelWindow* const activeWindow = TopLevelWindow::getActiveTopLevelWindow())
{
c = activeWindow->getPeer()->getLastFocusedSubcomponent();
@@ -252,16 +247,11 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
if (c == nullptr && Process::isForegroundProcess())
{
- // getting a bit desperate now - try all desktop comps..
+ // getting a bit desperate now: try all desktop comps..
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
- {
- ApplicationCommandTarget* const target
- = findTargetForComponent (Desktop::getInstance().getComponent (i)
- ->getPeer()->getLastFocusedSubcomponent());
-
- if (target != nullptr)
+ if (ApplicationCommandTarget* const target = findTargetForComponent (Desktop::getInstance().getComponent (i)
+ ->getPeer()->getLastFocusedSubcomponent()))
return target;
- }
}
if (c != nullptr)
@@ -275,9 +265,7 @@ ApplicationCommandTarget* ApplicationCommandManager::findDefaultComponentTarget(
if (resizableWindow != nullptr && resizableWindow->getContentComponent() != nullptr)
c = resizableWindow->getContentComponent();
- ApplicationCommandTarget* const target = findTargetForComponent (c);
-
- if (target != nullptr)
+ if (ApplicationCommandTarget* const target = findTargetForComponent (c))
return target;
}
View
9 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.h
@@ -109,13 +109,11 @@ class JUCE_API ApplicationCommandManager : private AsyncUpdater,
//==============================================================================
/** Clears the current list of all commands.
-
Note that this will also clear the contents of the KeyPressMappingSet.
*/
void clearCommands();
/** Adds a command to the list of registered commands.
-
@see registerAllCommandsForTarget
*/
void registerCommand (const ApplicationCommandInfo& newCommand);
@@ -131,7 +129,6 @@ class JUCE_API ApplicationCommandManager : private AsyncUpdater,
void registerAllCommandsForTarget (ApplicationCommandTarget* target);
/** Removes the command with a specified ID.
-
Note that this will also remove any key mappings that are mapped to the command.
*/
void removeCommand (CommandID commandID);
@@ -150,13 +147,11 @@ class JUCE_API ApplicationCommandManager : private AsyncUpdater,
//==============================================================================
/** Returns the number of commands that have been registered.
-
@see registerCommand
*/
int getNumCommands() const noexcept { return commands.size(); }
/** Returns the details about one of the registered commands.
-
The index is between 0 and (getNumCommands() - 1).
*/
const ApplicationCommandInfo* getCommandForIndex (int index) const noexcept { return commands [index]; }
@@ -195,7 +190,6 @@ class JUCE_API ApplicationCommandManager : private AsyncUpdater,
StringArray getCommandCategories() const;
/** Returns a list of all the command UIDs in a particular category.
-
@see getCommandCategories()
*/
Array<CommandID> getCommandsInCategory (const String& categoryName) const;
@@ -214,7 +208,6 @@ class JUCE_API ApplicationCommandManager : private AsyncUpdater,
//==============================================================================
/** Invokes the given command directly, sending it to the default target.
-
This is just an easy way to call invoke() without having to fill out the InvocationInfo
structure.
*/
@@ -318,7 +311,7 @@ class JUCE_API ApplicationCommandManager : private AsyncUpdater,
ScopedPointer <KeyPressMappingSet> keyMappings;
ApplicationCommandTarget* firstTarget;
- void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo& info);
+ void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo&);
void handleAsyncUpdate();
void globalFocusChanged (Component*);
View
21 JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandTarget.cpp
@@ -26,15 +26,14 @@
class ApplicationCommandTarget::CommandMessage : public MessageManager::MessageBase
{
public:
- CommandMessage (ApplicationCommandTarget* const owner_, const InvocationInfo& info_)
- : owner (owner_), info (info_)
+ CommandMessage (ApplicationCommandTarget* const target, const InvocationInfo& inf)
+ : owner (target), info (inf)
{
}
void messageCallback()
{
- ApplicationCommandTarget* const target = owner;
- if (target != nullptr)
+ if (ApplicationCommandTarget* const target = owner)
target->tryToInvoke (info, false);
}
@@ -69,9 +68,9 @@ bool ApplicationCommandTarget::tryToInvoke (const InvocationInfo& info, const bo
{
const bool success = perform (info);
- jassert (success); // hmm - your target should have been able to perform this command. If it can't
- // do it at the moment for some reason, it should clear the 'isActive' flag when it
- // returns the command's info.
+ jassert (success); // Hmm.. your target claimed that it could perform this command, but failed to do so.
+ // If it can't do it at the moment for some reason, it should clear the 'isActive' flag
+ // when it returns the command's info.
return success;
}
}