From b4251726f0748de2e8ffcb9320afb651850ed811 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 28 Jun 2012 19:11:48 +0100 Subject: [PATCH] Introjucer: refactored some settings classes, and added new icons for the treeviews. --- .../The Introjucer.xcodeproj/project.pbxproj | 12 +- .../VisualStudio2005/The Introjucer.vcproj | 10 - .../VisualStudio2008/The Introjucer.vcproj | 10 - .../VisualStudio2010/The Introjucer.vcxproj | 1 - .../The Introjucer.vcxproj.filters | 3 - extras/Introjucer/Introjucer.jucer | 1 - .../Introjucer/JuceLibraryCode/BinaryData.cpp | 16 -- .../Introjucer/JuceLibraryCode/BinaryData.h | 3 - .../Source/Application/jucer_Application.h | 9 +- .../Source/Application/jucer_MainWindow.cpp | 16 +- .../Introjucer/Source/BinaryData/cog_icon.svg | 7 - .../Source/Project/jucer_ConfigPage.cpp | 6 +- .../Source/Project/jucer_Module.cpp | 4 +- .../Source/Project/jucer_Project.cpp | 16 +- .../Introjucer/Source/Project/jucer_Project.h | 1 - .../Project/jucer_ProjectContentComponent.cpp | 2 +- .../Source/Utility/jucer_JucerTreeViewBase.h | 5 +- .../Source/Utility/jucer_StoredSettings.cpp | 172 +++++++++--------- .../Source/Utility/jucer_StoredSettings.h | 48 +++-- 19 files changed, 156 insertions(+), 186 deletions(-) delete mode 100644 extras/Introjucer/Source/BinaryData/cog_icon.svg diff --git a/extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj b/extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj index 87c22415a6..fe712644b0 100644 --- a/extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj +++ b/extras/Introjucer/Builds/MacOSX/The Introjucer.xcodeproj/project.pbxproj @@ -122,7 +122,6 @@ 18D9EBA1DAE45EEF81FD5C8F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_MainConsoleAppTemplate.cpp"; path = "../../Source/BinaryData/jucer_MainConsoleAppTemplate.cpp"; sourceTree = "SOURCE_ROOT"; }; 193908A02BA553DB5B30D759 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ScopedLock.h"; path = "../../../../modules/juce_core/threads/juce_ScopedLock.h"; sourceTree = "SOURCE_ROOT"; }; 199722DD9BA0E30C0506941E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MouseListener.cpp"; path = "../../../../modules/juce_gui_basics/mouse/juce_MouseListener.cpp"; sourceTree = "SOURCE_ROOT"; }; - 19B46FEFF7C614EB69BCDF61 = { isa = PBXFileReference; lastKnownFileType = file.svg; name = "cog_icon.svg"; path = "../../Source/BinaryData/cog_icon.svg"; sourceTree = "SOURCE_ROOT"; }; 1A1B5A2E9F1DA2122D21F9DF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ScopedPointer.h"; path = "../../../../modules/juce_core/memory/juce_ScopedPointer.h"; sourceTree = "SOURCE_ROOT"; }; 1A1C8AEC3C5AB2E972B0212E = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MD5.h"; path = "../../../../modules/juce_cryptography/hashing/juce_MD5.h"; sourceTree = "SOURCE_ROOT"; }; 1A79A64F47F7B5083EEBB328 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ActionListener.h"; path = "../../../../modules/juce_events/broadcasters/juce_ActionListener.h"; sourceTree = "SOURCE_ROOT"; }; @@ -626,7 +625,6 @@ D141433D3FE81F20490DE928 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Desktop.h"; path = "../../../../modules/juce_gui_basics/components/juce_Desktop.h"; sourceTree = "SOURCE_ROOT"; }; D1F9B0E9F5D54FE48BEB46EA = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; D253F74B7F5734984E568CA7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_Files.cpp"; path = "../../../../modules/juce_core/native/juce_linux_Files.cpp"; sourceTree = "SOURCE_ROOT"; }; - D2F1CF252F7EC62B35A21CB6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DropShadowEffect.cpp"; path = "../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"; sourceTree = "SOURCE_ROOT"; }; D376B9B54EC944E766AFEC45 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PopupMenu.cpp"; path = "../../../../modules/juce_gui_basics/menus/juce_PopupMenu.cpp"; sourceTree = "SOURCE_ROOT"; }; D4697A0232AECE5DAC5E332E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ChoicePropertyComponent.cpp"; path = "../../../../modules/juce_gui_basics/properties/juce_ChoicePropertyComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; D4E56676E2EF83404EDCBA8C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_TextEditor.cpp"; path = "../../../../modules/juce_gui_basics/widgets/juce_TextEditor.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -643,8 +641,8 @@ D800DE818BEDBF4579D15B1D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_AppleRemote.mm"; path = "../../../../modules/juce_gui_extra/native/juce_mac_AppleRemote.mm"; sourceTree = "SOURCE_ROOT"; }; D926E13AB5AD647A7A00F486 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_Network.cpp"; path = "../../../../modules/juce_core/native/juce_linux_Network.cpp"; sourceTree = "SOURCE_ROOT"; }; D9342535EA61901A1AD816C6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_WebBrowserComponent.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_linux_WebBrowserComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; - D9E59DE07A815AB303A297D9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_data_structures.mm"; path = "../../../../modules/juce_data_structures/juce_data_structures.mm"; sourceTree = "SOURCE_ROOT"; }; - DD985A60FB76E976AF91852D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SHA256.h"; path = "../../../../modules/juce_cryptography/hashing/juce_SHA256.h"; sourceTree = "SOURCE_ROOT"; }; + DC5E7FF30B01118F6DAEC38F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Time.cpp"; path = "../../../../modules/juce_core/time/juce_Time.cpp"; sourceTree = "SOURCE_ROOT"; }; + DF7BB5B6B394EDEEF5F5B4B8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_CallbackMessage.h"; path = "../../../../modules/juce_events/messages/juce_CallbackMessage.h"; sourceTree = "SOURCE_ROOT"; }; E5D6C36496F5BC84D7213BE8 = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; E60E28D1B7491047DEA236AE = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ProjectContentComponent.h"; path = "../../Source/Project/jucer_ProjectContentComponent.h"; sourceTree = "SOURCE_ROOT"; }; E70CA21960A64CCB835725FF = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_ProjectType.cpp"; path = "../../Source/Project/jucer_ProjectType.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -652,22 +650,23 @@ E96597BBC6A98255B51B94DC = { isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 25F52316D256B4534BED16D1 = { isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Introjucer.app; sourceTree = "BUILT_PRODUCTS_DIR"; }; CF8011B3C67B609032974DA5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_NewCppFileTemplate.cpp"; path = "../../Source/BinaryData/jucer_NewCppFileTemplate.cpp"; sourceTree = "SOURCE_ROOT"; }; + D2F1CF252F7EC62B35A21CB6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DropShadowEffect.cpp"; path = "../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"; sourceTree = "SOURCE_ROOT"; }; D2F80DA0946A5EE01FC016CA = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_CharPointer_UTF32.h"; path = "../../../../modules/juce_core/text/juce_CharPointer_UTF32.h"; sourceTree = "SOURCE_ROOT"; }; D526C38D581425949BA0E4AC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_FilePreviewComponent.h"; path = "../../Source/Application/jucer_FilePreviewComponent.h"; sourceTree = "SOURCE_ROOT"; }; D7A7F1AA9F313B0CCAAA73A0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MathsFunctions.h"; path = "../../../../modules/juce_core/maths/juce_MathsFunctions.h"; sourceTree = "SOURCE_ROOT"; }; D95D7B49EC6C6BDCB5A1B988 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_ios_MessageManager.mm"; path = "../../../../modules/juce_events/native/juce_ios_MessageManager.mm"; sourceTree = "SOURCE_ROOT"; }; D9B077E2ECDDA94961E134D7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringPairArray.h"; path = "../../../../modules/juce_core/text/juce_StringPairArray.h"; sourceTree = "SOURCE_ROOT"; }; + D9E59DE07A815AB303A297D9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_data_structures.mm"; path = "../../../../modules/juce_data_structures/juce_data_structures.mm"; sourceTree = "SOURCE_ROOT"; }; DB20268A566DABEAE3F2CBEE = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RectanglePlacement.cpp"; path = "../../../../modules/juce_graphics/placement/juce_RectanglePlacement.cpp"; sourceTree = "SOURCE_ROOT"; }; DB876F7873F42DC685A58CA7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_JPEGLoader.cpp"; path = "../../../../modules/juce_graphics/image_formats/juce_JPEGLoader.cpp"; sourceTree = "SOURCE_ROOT"; }; - DC5E7FF30B01118F6DAEC38F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Time.cpp"; path = "../../../../modules/juce_core/time/juce_Time.cpp"; sourceTree = "SOURCE_ROOT"; }; DCCB75165B7C73A589498E87 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_Windowing.cpp"; path = "../../../../modules/juce_gui_basics/native/juce_linux_Windowing.cpp"; sourceTree = "SOURCE_ROOT"; }; DD00494140C86144306A9356 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Array.h"; path = "../../../../modules/juce_core/containers/juce_Array.h"; sourceTree = "SOURCE_ROOT"; }; DD2494D5F1C081898D616AF5 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_KeyListener.cpp"; path = "../../../../modules/juce_gui_basics/keyboard/juce_KeyListener.cpp"; sourceTree = "SOURCE_ROOT"; }; + DD985A60FB76E976AF91852D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SHA256.h"; path = "../../../../modules/juce_cryptography/hashing/juce_SHA256.h"; sourceTree = "SOURCE_ROOT"; }; DE40B42B57F29C650CB7F2AD = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_RecentlyOpenedFilesList.h"; path = "../../../../modules/juce_gui_extra/misc/juce_RecentlyOpenedFilesList.h"; sourceTree = "SOURCE_ROOT"; }; DE5F3C9EF6BFFDE73AF9E7FC = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DirectoryContentsDisplayComponent.cpp"; path = "../../../../modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; DE8DF5D263F40F65581CFDE4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ChildProcess.cpp"; path = "../../../../modules/juce_core/threads/juce_ChildProcess.cpp"; sourceTree = "SOURCE_ROOT"; }; DEF579B1433EB8DEE7AB50F8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Drawable.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_Drawable.cpp"; sourceTree = "SOURCE_ROOT"; }; - DF7BB5B6B394EDEEF5F5B4B8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_CallbackMessage.h"; path = "../../../../modules/juce_events/messages/juce_CallbackMessage.h"; sourceTree = "SOURCE_ROOT"; }; DFC6364D81D9C60BD4CA9D12 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_RelativeTime.cpp"; path = "../../../../modules/juce_core/time/juce_RelativeTime.cpp"; sourceTree = "SOURCE_ROOT"; }; E07C56267CBB46FC44EF2026 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Image.cpp"; path = "../../../../modules/juce_graphics/images/juce_Image.cpp"; sourceTree = "SOURCE_ROOT"; }; E1C16C872E34BCB144B469F9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_EdgeTable.h"; path = "../../../../modules/juce_graphics/geometry/juce_EdgeTable.h"; sourceTree = "SOURCE_ROOT"; }; @@ -820,7 +819,6 @@ 88DFD62CB6545EE8CA5C485B = { isa = PBXGroup; children = ( 5F4F4EAB042F2730F94A1CEA, 7074AEDE4B0416BC898DD27A, - 19B46FEFF7C614EB69BCDF61, B483D960309FAFC193F9CDA2, 0075C5208947159AF2802F3B, AFF72BA2B130F3F9AC029080, diff --git a/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj b/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj index 7ea27cda4f..325cc860d2 100644 --- a/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj +++ b/extras/Introjucer/Builds/VisualStudio2005/The Introjucer.vcproj @@ -224,16 +224,6 @@ - - - - - - - - diff --git a/extras/Introjucer/Builds/VisualStudio2008/The Introjucer.vcproj b/extras/Introjucer/Builds/VisualStudio2008/The Introjucer.vcproj index 6399f860e0..0f1b7fa9c2 100644 --- a/extras/Introjucer/Builds/VisualStudio2008/The Introjucer.vcproj +++ b/extras/Introjucer/Builds/VisualStudio2008/The Introjucer.vcproj @@ -224,16 +224,6 @@ - - - - - - - - diff --git a/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj b/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj index d67c75f5af..9b90410e0c 100644 --- a/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj +++ b/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj @@ -1332,7 +1332,6 @@ - diff --git a/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj.filters b/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj.filters index 51672cbd61..2f409940fa 100644 --- a/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj.filters +++ b/extras/Introjucer/Builds/VisualStudio2010/The Introjucer.vcxproj.filters @@ -2291,9 +2291,6 @@ The Introjucer\BinaryData - - The Introjucer\BinaryData - The Introjucer\BinaryData diff --git a/extras/Introjucer/Introjucer.jucer b/extras/Introjucer/Introjucer.jucer index 7f93feb06f..49d047f7c1 100644 --- a/extras/Introjucer/Introjucer.jucer +++ b/extras/Introjucer/Introjucer.jucer @@ -205,7 +205,6 @@ file="Source/BinaryData/AudioPluginXCodeScript.txt"/> - diff --git a/extras/Introjucer/JuceLibraryCode/BinaryData.cpp b/extras/Introjucer/JuceLibraryCode/BinaryData.cpp index 1d078c6dcd..d62d2e4ba6 100644 --- a/extras/Introjucer/JuceLibraryCode/BinaryData.cpp +++ b/extras/Introjucer/JuceLibraryCode/BinaryData.cpp @@ -294,20 +294,6 @@ static const unsigned char temp_9aa09877[] = const char* brushed_aluminium_png = (const char*) temp_9aa09877; -//================== cog_icon.svg ================== -static const unsigned char temp_8136acca[] = -"\n" -" \n" -" \n" -" \n" -""; - -const char* cog_icon_svg = (const char*) temp_8136acca; - //================== juce_icon.png ================== static const unsigned char temp_ee6f0c0f[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,128,0,0,0,128,8,6,0,0,0,195,62,97,203,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24,0,0,0,4,103,65,77,65,0,0,177,142,124,251,81,147,0,0,0,32,99,72,82,77,0,0,122,37,0,0,128,131,0,0,249,255, @@ -1165,8 +1151,6 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes) throw case 0x2981a553: numBytes = 2112; return AudioPluginXCodeScript_txt; case 0x950fd7dd: case 0xa6cfe0e2: numBytes = 14724; return brushed_aluminium_png; - case 0xabd76fe2: - case 0x0e0b94aa: numBytes = 915; return cog_icon_svg; case 0x154a7275: case 0xcd05ca61: numBytes = 19826; return juce_icon_png; case 0x27c5a93a: diff --git a/extras/Introjucer/JuceLibraryCode/BinaryData.h b/extras/Introjucer/JuceLibraryCode/BinaryData.h index 166ccd4e0e..5bc86feeaa 100644 --- a/extras/Introjucer/JuceLibraryCode/BinaryData.h +++ b/extras/Introjucer/JuceLibraryCode/BinaryData.h @@ -13,9 +13,6 @@ namespace BinaryData extern const char* brushed_aluminium_png; const int brushed_aluminium_pngSize = 14724; - extern const char* cog_icon_svg; - const int cog_icon_svgSize = 915; - extern const char* juce_icon_png; const int juce_icon_pngSize = 19826; diff --git a/extras/Introjucer/Source/Application/jucer_Application.h b/extras/Introjucer/Source/Application/jucer_Application.h index 30e0a87ebc..3264ce3583 100644 --- a/extras/Introjucer/Source/Application/jucer_Application.h +++ b/extras/Introjucer/Source/Application/jucer_Application.h @@ -85,11 +85,11 @@ public: #endif menuModel = nullptr; - StoredSettings::deleteInstance(); mainWindowList.forceCloseAllWindows(); OpenDocumentManager::deleteInstance(); commandManager = nullptr; + settings.flush(); } //============================================================================== @@ -161,7 +161,7 @@ public: menu.addCommandItem (commandManager, CommandIDs::open); PopupMenu recentFiles; - StoredSettings::getInstance()->recentFiles.createPopupMenuItems (recentFiles, 100, true, true); + getAppSettings().recentFiles.createPopupMenuItems (recentFiles, 100, true, true); menu.addSubMenu ("Open recent file", recentFiles); menu.addSeparator(); @@ -249,7 +249,7 @@ public: if (menuItemID >= 100 && menuItemID < 200) { // open a file from the "recent files" menu - const File file (StoredSettings::getInstance()->recentFiles.getFile (menuItemID - 100)); + const File file (getAppSettings().recentFiles.getFile (menuItemID - 100)); getApp()->openFile (file); } @@ -413,6 +413,9 @@ public: } //============================================================================== + StoredSettings settings; + Icons icons; + ScopedPointer menuModel; MainWindowList mainWindowList; diff --git a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp index 6a0d9b2922..1dc69f8876 100644 --- a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp @@ -58,7 +58,7 @@ MainWindow::MainWindow() { commandManager->getKeyMappings()->resetToDefaultMappings(); - ScopedPointer keys (StoredSettings::getInstance()->getProps().getXmlValue ("keyMappings")); + ScopedPointer keys (getAppProperties().getXmlValue ("keyMappings")); if (keys != nullptr) commandManager->getKeyMappings()->restoreFromXml (*keys); @@ -82,8 +82,7 @@ MainWindow::~MainWindow() removeKeyListener (commandManager->getKeyMappings()); // save the current size and position to our settings file.. - StoredSettings::getInstance()->getProps() - .setValue ("lastMainWindowPos", getWindowStateAsString()); + getAppProperties().setValue ("lastMainWindowPos", getWindowStateAsString()); clearContentComponent(); currentProject = nullptr; @@ -125,8 +124,7 @@ bool MainWindow::closeProject (Project* project) if (project == nullptr) return true; - StoredSettings::getInstance()->getProps() - .setValue (getProjectWindowPosName(), getWindowStateAsString()); + getAppProperties().setValue (getProjectWindowPosName(), getWindowStateAsString()); if (! OpenDocumentManager::getInstance()->closeAllDocumentsUsingProject (*project, true)) return false; @@ -165,10 +163,10 @@ void MainWindow::restoreWindowPosition() String windowState; if (currentProject != nullptr) - windowState = StoredSettings::getInstance()->getProps().getValue (getProjectWindowPosName()); + windowState = getAppProperties().getValue (getProjectWindowPosName()); if (windowState.isEmpty()) - windowState = StoredSettings::getInstance()->getProps().getValue ("lastMainWindowPos"); + windowState = getAppProperties().getValue ("lastMainWindowPos"); restoreWindowStateFromString (windowState); } @@ -470,12 +468,12 @@ void MainWindowList::saveCurrentlyOpenProjectList() projects.add (mw->getProject()->getFile()); } - StoredSettings::getInstance()->setLastProjects (projects); + getAppSettings().setLastProjects (projects); } void MainWindowList::reopenLastProjects() { - Array projects (StoredSettings::getInstance()->getLastProjects()); + Array projects (getAppSettings().getLastProjects()); for (int i = 0; i < projects.size(); ++ i) openFile (projects.getReference(i)); diff --git a/extras/Introjucer/Source/BinaryData/cog_icon.svg b/extras/Introjucer/Source/BinaryData/cog_icon.svg deleted file mode 100644 index 4990b28480..0000000000 --- a/extras/Introjucer/Source/BinaryData/cog_icon.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/extras/Introjucer/Source/Project/jucer_ConfigPage.cpp b/extras/Introjucer/Source/Project/jucer_ConfigPage.cpp index 06e68f6164..0337cad37f 100644 --- a/extras/Introjucer/Source/Project/jucer_ConfigPage.cpp +++ b/extras/Introjucer/Source/Project/jucer_ConfigPage.cpp @@ -74,7 +74,7 @@ namespace ProjectSettingsTreeClasses String getRenamingName() const { return getDisplayName(); } String getDisplayName() const { return config->getName(); } void setName (const String&) {} - const Drawable* getIcon() const { return StoredSettings::getInstance()->getCogIcon(); } + const Drawable* getIcon() const { return getIcons().config; } void showDocument() { showSettingsPage (new SettingsComp (config, exporterName)); } void itemOpennessChanged (bool) {} @@ -175,7 +175,7 @@ namespace ProjectSettingsTreeClasses String getDisplayName() const { return exporter->getName(); } void setName (const String&) {} bool isMissing() { return false; } - const Drawable* getIcon() const { return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); } + const Drawable* getIcon() const { return getIcons().exporter; } void showDocument() { showSettingsPage (new SettingsComp (exporter)); } void deleteItem() @@ -297,7 +297,7 @@ namespace ProjectSettingsTreeClasses String getDisplayName() const { return "Modules"; } void setName (const String&) {} bool isMissing() { return false; } - const Drawable* getIcon() const { return project.getMainGroup().getIcon(); } + const Drawable* getIcon() const { return getIcons().graph; } void showDocument() { showSettingsPage (new SettingsComp (project)); } private: diff --git a/extras/Introjucer/Source/Project/jucer_Module.cpp b/extras/Introjucer/Source/Project/jucer_Module.cpp index 08d7ecf6b8..5e053577f1 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.cpp +++ b/extras/Introjucer/Source/Project/jucer_Module.cpp @@ -146,7 +146,7 @@ File ModuleList::getLocalModulesFolder (Project* project) { File defaultJuceFolder (getDefaultModulesFolder (project)); - File f (StoredSettings::getInstance()->getProps().getValue ("lastJuceFolder", defaultJuceFolder.getFullPathName())); + File f (getAppProperties().getValue ("lastJuceFolder", defaultJuceFolder.getFullPathName())); f = getModulesFolderForJuceOrModulesFolder (f); if ((! ModuleList::isModulesFolder (f)) && ModuleList::isModulesFolder (defaultJuceFolder)) @@ -163,7 +163,7 @@ File ModuleList::getModuleFolder (const String& uid) const void ModuleList::setLocalModulesFolder (const File& file) { //jassert (FileHelpers::isJuceFolder (file)); - StoredSettings::getInstance()->getProps().setValue ("lastJuceFolder", file.getFullPathName()); + getAppProperties().setValue ("lastJuceFolder", file.getFullPathName()); } struct ModuleSorter diff --git a/extras/Introjucer/Source/Project/jucer_Project.cpp b/extras/Introjucer/Source/Project/jucer_Project.cpp index 256282e7a1..fb150ddb67 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.cpp +++ b/extras/Introjucer/Source/Project/jucer_Project.cpp @@ -60,8 +60,6 @@ Project::Project (const File& file_) setChangedFlag (false); - mainProjectIcon.setImage (ImageCache::getFromMemory (BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize)); - projectRoot.addListener (this); } @@ -217,8 +215,8 @@ bool Project::isAudioPluginModuleMissing() const static void registerRecentFile (const File& file) { RecentlyOpenedFilesList::registerRecentFileNatively (file); - StoredSettings::getInstance()->recentFiles.addFile (file); - StoredSettings::getInstance()->flush(); + getAppSettings().recentFiles.addFile (file); + getAppSettings().flush(); } Result Project::loadDocument (const File& file) @@ -775,19 +773,21 @@ bool Project::Item::addRelativeFile (const RelativePath& file, int insertIndex, const Drawable* Project::Item::getIcon() const { + const Icons& icons = getIcons(); + if (isFile()) { if (isImageFile()) - return StoredSettings::getInstance()->getImageFileIcon(); + return icons.imageDoc; - return LookAndFeel::getDefaultLookAndFeel().getDefaultDocumentFileImage(); + return icons.document; } else if (isMainGroup()) { - return &(project.mainProjectIcon); + return icons.juceLogo; } - return LookAndFeel::getDefaultLookAndFeel().getDefaultFolderImage(); + return icons.folder; } //============================================================================== diff --git a/extras/Introjucer/Source/Project/jucer_Project.h b/extras/Introjucer/Source/Project/jucer_Project.h index 84a2b6630a..e457e65f92 100644 --- a/extras/Introjucer/Source/Project/jucer_Project.h +++ b/extras/Introjucer/Source/Project/jucer_Project.h @@ -269,7 +269,6 @@ public: private: friend class Item; ValueTree projectRoot; - DrawableImage mainProjectIcon; void updateProjectSettings(); void sanitiseConfigFlags(); diff --git a/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp b/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp index 559c768098..c90fbde891 100644 --- a/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp +++ b/extras/Introjucer/Source/Project/jucer_ProjectContentComponent.cpp @@ -113,7 +113,7 @@ void ProjectContentComponent::setProject (Project* newProject) { if (project != newProject) { - PropertiesFile& settings = StoredSettings::getInstance()->getProps(); + PropertiesFile& settings = getAppProperties(); if (project != nullptr) project->removeChangeListener (this); diff --git a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h index 7df0b9ba3d..b2a8fa05d7 100644 --- a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h +++ b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h @@ -125,8 +125,7 @@ public: tree.setRootItem (root); tree.getRootItem()->setOpen (true); - const ScopedPointer treeOpenness (StoredSettings::getInstance()->getProps() - .getXmlValue (opennessStateKey)); + const ScopedPointer treeOpenness (getAppProperties().getXmlValue (opennessStateKey)); if (treeOpenness != nullptr) tree.restoreOpennessState (*treeOpenness, true); } @@ -136,7 +135,7 @@ public: const ScopedPointer opennessState (tree.getOpennessState (true)); if (opennessState != nullptr) - StoredSettings::getInstance()->getProps().setValue (opennessStateKey, opennessState); + getAppProperties().setValue (opennessStateKey, opennessState); } void deleteSelectedItems() diff --git a/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp b/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp index 7fca6a021c..467a93e30d 100644 --- a/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp +++ b/extras/Introjucer/Source/Utility/jucer_StoredSettings.cpp @@ -25,25 +25,30 @@ #include "../jucer_Headers.h" #include "jucer_StoredSettings.h" +#include "../Application/jucer_Application.h" +//============================================================================== +StoredSettings& getAppSettings() +{ + return JucerApplication::getApp()->settings; +} + +PropertiesFile& getAppProperties() +{ + return getAppSettings().getProps(); +} //============================================================================== StoredSettings::StoredSettings() { - flush(); + reload(); } StoredSettings::~StoredSettings() { flush(); - props = nullptr; - clearSingletonInstance(); } -juce_ImplementSingleton (StoredSettings); - - -//============================================================================== PropertiesFile& StoredSettings::getProps() { jassert (props != nullptr); @@ -65,8 +70,13 @@ void StoredSettings::flush() if (keys != nullptr) props->setValue ("keyMappings", (XmlElement*) keys); } + + props->saveIfNeeded(); } +} +void StoredSettings::reload() +{ props = nullptr; { @@ -99,24 +109,7 @@ void StoredSettings::flush() recentFiles.restoreFromString (props->getValue ("recentFiles")); recentFiles.removeNonExistentFiles(); - // swatch colours... - swatchColours.clear(); - - #define COL(col) Colours::col, - - const Colour colours[] = - { - #include "jucer_Colours.h" - Colours::transparentBlack - }; - - #undef COL - - const int numSwatchColours = 24; - - for (int i = 0; i < numSwatchColours; ++i) - swatchColours.add (Colour::fromString (props->getValue ("swatchColour" + String (i), - colours [2 + i].toString()))); + loadSwatchColours(); } Array StoredSettings::getLastProjects() const @@ -148,73 +141,84 @@ const StringArray& StoredSettings::getFontNames() return fontNames; } -Image StoredSettings::getFallbackImage() +//============================================================================== +void StoredSettings::loadSwatchColours() { - if (fallbackImage.isNull()) - fallbackImage = ImageFileFormat::loadFrom (BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize); + swatchColours.clear(); - return fallbackImage; + #define COL(col) Colours::col, + + const Colour colours[] = + { + #include "jucer_Colours.h" + Colours::transparentBlack + }; + + #undef COL + + const int numSwatchColours = 24; + + for (int i = 0; i < numSwatchColours; ++i) + swatchColours.add (Colour::fromString (props->getValue ("swatchColour" + String (i), + colours [2 + i].toString()))); } -const Drawable* StoredSettings::getImageFileIcon() +int StoredSettings::ColourSelectorWithSwatches::getNumSwatches() const { - if (imageFileIcon == nullptr) - { - static const unsigned char data[] = - { 120,218,197,90,75,111,28,199,17,158,181,60,146,98,36,135,28,98,58,185,100,175,1,164,65,87,117,87,63,142,74,156,228,34,3,129,125,80,146,27,37,46,229,141,41,238,130,92,37,240,191,207,87,61,59,195,158,215,138,176,44,154,132,128,209,246,199,154,238,122,126, - 85,189,95,127,251,226,213,139,63,191,252,107,181,250,236,250,252,221,166,90,125,81,127,125,115,254,191,243,215,87,155,106,123,81,173,126,85,111,94,191,124,241,54,189,170,86,171,191,223,236,222,239,171,213,231,237,231,251,237,155,195,251,155,77,117,216, - 237,95,110,46,15,213,234,113,109,158,173,141,254,255,219,237,219,239,241,193,211,154,156,215,143,94,239,14,135,221,187,22,245,84,81,36,161,90,61,234,94,116,91,85,171,223,252,227,252,240,125,181,170,85,246,231,245,158,170,219,195,205,238,135,205,171,237, - 133,126,252,168,54,213,127,118,219,235,195,119,135,31,177,177,213,147,250,221,246,176,185,169,222,156,239,143,159,60,174,95,191,63,28,170,235,221,245,191,55,55,187,87,219,235,139,237,245,219,246,15,87,143,254,182,189,186,194,1,15,63,238,243,223,222,238, - 174,240,154,55,187,171,221,251,27,61,240,229,241,167,170,190,203,47,61,9,53,249,167,170,242,126,171,213,111,191,217,253,23,200,21,118,188,250,170,246,13,73,178,209,134,240,108,237,26,203,137,99,114,174,170,94,110,175,23,64,212,24,31,133,3,159,0,133,208, - 68,19,130,79,241,4,136,200,53,226,124,74,97,0,58,27,130,132,26,142,158,221,8,99,83,227,99,48,108,121,25,19,108,195,176,167,55,126,25,67,198,55,193,177,53,39,228,144,51,13,99,159,206,46,97,190,26,98,230,15,54,4,45,170,168,4,45,42,187,220,246,162,217,202, - 243,47,130,74,69,222,207,1,10,208,95,174,118,183,155,234,232,90,125,40,240,39,8,133,199,173,127,127,81,191,189,57,191,216,110,174,15,213,94,69,182,202,160,38,89,130,74,212,206,46,53,28,34,65,173,25,192,173,182,98,35,49,101,64,108,44,162,33,5,23,90,128, - 173,86,127,168,159,7,110,60,25,39,209,61,91,63,79,190,97,235,196,113,172,244,101,231,87,237,86,218,152,186,173,86,127,172,205,154,98,27,86,235,226,145,214,249,223,199,7,165,52,6,30,0,195,37,248,73,67,222,82,8,46,141,108,82,130,156,133,195,57,120,165, - 61,1,10,169,73,236,77,136,241,4,136,200,67,65,65,232,36,72,160,174,24,147,151,177,51,197,134,76,226,228,78,129,2,53,148,112,40,161,19,32,24,3,118,180,41,240,41,144,13,141,21,111,77,188,47,104,233,116,37,104,81,79,37,104,81,227,229,198,23,109,87,170,96, - 17,84,42,243,94,94,80,130,230,35,211,62,104,100,158,105,100,26,49,212,38,96,131,51,123,230,97,96,166,134,92,100,118,186,123,235,162,177,209,15,3,211,54,206,5,246,226,219,192,180,49,37,18,121,176,192,124,58,8,76,215,24,103,77,138,78,158,173,125,227,67, - 18,253,133,182,223,191,222,190,193,102,166,40,17,192,140,75,142,170,61,143,23,213,87,188,39,235,83,5,211,140,23,197,54,94,152,133,39,242,99,19,9,90,109,213,218,163,90,249,9,142,25,130,137,193,13,23,109,235,193,72,127,206,225,143,79,201,31,160,16,49,145, - 225,232,246,40,191,92,212,72,73,193,24,242,51,242,17,33,228,147,245,217,27,135,242,25,158,106,61,170,200,179,181,53,77,116,72,222,62,118,242,73,144,205,57,228,60,131,180,13,112,114,210,201,135,194,2,57,138,81,245,15,119,50,54,240,68,190,70,151,4,242, - 34,3,84,43,31,49,236,177,99,118,110,184,104,167,246,93,146,63,68,113,18,84,139,126,255,35,23,161,32,40,229,243,242,11,255,153,141,86,247,208,117,20,17,234,93,48,214,181,60,135,16,64,68,125,184,158,229,112,13,198,167,160,187,183,170,157,148,252,32,90, - 157,146,35,129,74,218,104,21,39,72,152,241,23,138,86,139,228,163,101,92,112,30,129,223,176,3,113,11,99,107,14,80,162,73,8,249,202,117,222,82,44,170,243,37,112,32,215,69,211,96,81,16,202,148,172,184,153,104,69,94,19,120,241,0,213,71,171,210,18,242,60, - 92,60,70,83,106,172,69,238,11,167,228,15,80,164,89,84,108,144,62,90,239,22,163,105,76,64,132,70,158,145,239,184,9,32,69,134,220,92,180,34,125,145,109,163,21,92,52,56,203,125,180,194,200,98,189,215,132,21,64,73,1,12,161,143,86,65,32,146,83,38,43,13,50, - 127,226,224,105,46,90,81,12,157,102,179,2,213,71,171,137,62,58,26,45,218,169,125,231,229,127,57,66,89,142,196,50,99,93,228,105,49,46,166,56,47,189,240,158,217,88,149,113,172,218,79,28,171,172,52,35,136,102,66,43,72,147,6,217,42,148,165,21,121,46,128, - 16,133,108,25,52,27,96,188,142,250,96,205,172,25,159,91,31,89,73,49,130,26,122,182,11,133,245,5,66,245,242,242,226,92,127,215,250,184,241,155,139,75,89,27,120,91,66,23,18,2,62,187,36,253,69,232,226,209,232,111,241,120,143,96,22,247,129,70,21,189,12,168, - 64,219,241,8,122,44,229,58,147,62,165,0,161,81,19,36,171,9,67,43,65,80,76,2,163,128,22,78,128,180,159,67,25,160,144,78,129,144,48,157,122,234,76,131,133,148,97,98,180,39,64,218,170,193,4,54,156,146,148,155,62,5,209,41,16,218,71,139,131,19,223,23,180, - 116,186,18,180,168,167,18,180,168,241,114,227,139,182,43,85,176,8,42,149,121,63,47,40,64,243,145,235,135,145,251,235,154,80,227,242,143,124,178,9,142,66,238,83,222,186,41,207,49,34,158,12,34,130,160,11,2,127,32,117,7,237,122,41,57,166,177,234,75,16,18, - 69,0,57,156,206,37,24,140,82,172,245,246,36,8,213,34,137,120,16,51,208,188,192,160,118,51,150,86,80,108,199,50,247,218,83,1,154,183,79,120,216,193,154,243,231,198,249,159,66,62,38,214,17,147,12,19,18,52,19,158,37,177,113,83,77,244,32,85,124,212,104,157, - 132,24,163,198,6,84,200,112,18,4,78,77,100,116,128,1,230,29,65,145,131,153,54,213,40,106,70,43,254,61,247,84,130,230,173,19,31,214,58,233,226,117,188,224,159,215,58,232,50,200,163,97,178,147,185,95,1,10,220,216,144,144,71,198,244,69,192,80,80,69,179, - 226,193,176,160,226,36,177,163,47,72,155,72,135,168,144,202,33,24,84,207,68,209,201,148,237,236,10,137,33,128,219,40,113,78,100,65,178,102,236,202,198,26,29,2,104,242,3,69,129,188,153,168,67,215,159,103,215,11,167,89,62,242,200,174,63,151,57,169,58,122, - 72,234,237,250,100,194,103,74,123,93,128,84,156,95,148,195,3,156,138,157,201,222,234,144,86,36,89,20,178,130,225,192,59,209,108,122,227,242,58,131,28,39,229,182,119,12,167,16,160,195,20,73,1,133,161,96,56,116,199,112,126,151,25,14,118,177,201,29,200, - 197,70,29,232,167,248,217,227,161,159,149,91,64,13,245,65,71,187,19,138,77,26,213,134,181,62,22,168,125,127,204,94,13,232,169,29,99,145,122,31,162,82,71,110,65,126,129,66,139,19,18,163,191,14,69,195,221,189,220,155,187,151,79,84,88,44,142,229,27,110, - 60,80,146,134,34,218,22,39,180,18,212,131,203,151,219,241,226,242,254,7,168,66,5,60,126,121,169,60,123,82,255,211,100,86,215,123,50,15,60,31,211,1,10,82,123,30,151,184,198,120,147,64,210,123,23,255,125,109,181,133,214,190,70,251,105,214,153,161,14,87, - 6,45,55,154,118,70,163,30,180,41,215,150,27,117,28,84,46,205,243,248,63,29,189,252,242,114,221,63,208,186,227,25,197,227,199,123,62,91,164,36,43,185,255,80,74,65,62,121,55,105,190,129,178,32,125,41,98,247,12,20,154,87,244,112,217,178,103,122,122,171, - 7,214,106,229,149,50,132,40,157,227,248,136,180,139,150,47,14,23,199,142,147,154,104,13,229,137,69,41,226,24,88,172,212,213,90,176,30,112,155,200,228,189,239,123,87,244,87,54,55,85,153,215,10,72,77,30,8,143,3,43,207,127,140,250,158,128,191,34,243,27, - 238,122,123,56,187,4,70,3,25,115,84,4,168,0,213,161,235,46,209,44,163,179,69,139,140,69,189,82,138,50,179,127,228,236,232,116,32,209,162,162,17,72,236,186,87,236,16,205,182,13,202,218,156,52,58,85,50,174,219,255,162,250,231,29,159,30,120,212,20,116,242, - 224,19,114,118,158,34,162,109,128,147,251,34,185,227,67,176,80,177,33,182,39,199,57,197,187,34,185,51,142,239,35,34,27,166,181,214,193,206,17,93,200,47,224,246,163,9,177,105,144,138,216,233,76,69,139,186,183,54,40,75,30,145,6,109,154,24,150,109,81,228, - 29,142,215,77,88,241,65,162,200,94,237,234,161,27,155,151,187,132,201,13,115,66,33,139,121,209,193,251,252,204,76,8,105,79,28,194,42,101,148,231,32,46,246,51,27,104,206,72,240,161,165,53,232,234,28,219,126,194,138,40,116,158,144,69,242,206,208,8,228, - 217,230,140,223,71,239,13,41,202,99,255,160,41,161,159,224,66,4,44,155,179,90,68,110,70,124,128,33,21,242,103,22,39,84,5,145,97,80,41,50,72,4,137,111,142,167,6,23,225,213,54,31,3,239,103,33,63,73,48,202,192,24,57,147,243,121,172,42,246,184,211,179,154, - 213,243,18,54,211,154,193,122,182,253,248,103,209,144,243,1,244,208,119,158,72,31,200,87,129,36,95,125,121,24,148,193,37,203,0,114,141,179,14,231,213,249,15,234,191,179,17,233,163,100,71,122,243,11,39,99,37,29,120,78,1,52,211,127,40,128,138,16,42,34, - 167,127,248,120,102,142,173,226,32,236,244,114,64,251,21,34,47,60,113,240,5,212,113,172,7,143,116,46,5,27,219,163,91,75,137,219,161,234,89,237,242,169,93,202,189,110,22,35,60,33,245,222,54,200,54,240,11,237,80,89,239,134,241,219,230,221,47,107,56,27, - 251,200,89,184,105,34,226,32,117,247,31,209,42,20,65,147,187,109,3,207,69,53,155,220,15,37,4,184,119,49,146,94,113,232,109,63,154,53,246,69,85,74,2,183,204,34,80,1,125,76,49,22,116,79,172,51,217,234,90,47,209,105,207,221,175,160,15,33,145,246,62,87,64, - 27,36,24,62,250,60,18,136,55,150,218,105,49,195,199,19,42,224,81,55,17,137,33,161,25,207,45,2,105,213,160,56,202,93,224,44,40,107,17,154,33,157,103,147,182,251,168,208,157,230,5,205,10,146,186,214,43,149,174,49,25,186,205,91,164,113,44,145,38,189,118, - 34,132,99,79,82,11,235,85,189,69,57,208,61,24,232,151,196,248,254,242,9,245,80,144,191,212,103,83,196,65,208,231,186,78,62,103,130,20,114,69,80,159,128,253,88,75,246,40,82,39,119,160,252,169,39,181,232,16,117,39,46,143,200,197,171,167,74,17,169,9,238, - 11,47,130,11,128,68,32,11,33,55,139,12,57,94,66,124,195,39,148,102,60,207,151,98,193,161,113,188,231,172,182,123,252,148,179,218,122,216,245,232,197,66,55,20,228,187,161,224,216,77,145,126,201,199,60,194,214,76,28,57,223,36,246,23,11,240,46,67,109,223, - 11,237,224,252,254,232,167,234,61,185,124,102,110,134,196,6,41,83,241,38,232,69,98,214,59,66,81,121,152,187,187,197,52,232,7,29,106,135,70,153,215,111,192,32,87,250,226,222,162,27,87,202,210,144,113,241,140,199,250,240,205,249,205,15,155,155,219,127, - 66,57,159,181,207,253,23,214,30,215,87,250,197,178,253,238,118,123,216,238,174,143,227,192,17,232,73,125,147,191,147,118,135,170,245,203,105,189,224,127,205,8,174,235,195,110,255,1,185,79,235,246,187,109,67,193,74,61,255,15,229,51,49,67,0,0 }; - - imageFileIcon = LookAndFeel::loadDrawableFromData (data, sizeof (data)); - } + return getAppSettings().swatchColours.size(); +} - return imageFileIcon; +Colour StoredSettings::ColourSelectorWithSwatches::getSwatchColour (int index) const +{ + return getAppSettings().swatchColours [index]; } -const Drawable* StoredSettings::getCogIcon() +void StoredSettings::ColourSelectorWithSwatches::setSwatchColour (int index, const Colour& newColour) const { - if (cogIcon == nullptr) - { - ScopedPointer svg (XmlDocument::parse (BinaryData::cog_icon_svg)); - jassert (svg != nullptr); - cogIcon = Drawable::createFromSVG (*svg); - } + getAppSettings().swatchColours.set (index, newColour); +} + +//============================================================================== +const Icons& getIcons() +{ + return JucerApplication::getApp()->icons; +} - return cogIcon; +Icons::Icons() +{ + reload (Colours::white); +} + +static Drawable* createDrawableFromSVGPath (const Colour& colour, const char* pathString) +{ + XmlElement svg ("svg"); + XmlElement* path = svg.createNewChildElement ("path"); + path->setAttribute ("fill", "#" + colour.toDisplayString (false)); + path->setAttribute ("d", pathString); + + return Drawable::createFromSVG (svg); +} + +void Icons::reload (const Colour& /*backgroundColour*/) +{ + const Colour iconColour (Colours::darkgrey); + + /* Some of the icon images used here are based on icons from this project: + http://raphaeljs.com/icons + They're MIT licensed - the licensing info is on the linked page. + + I thought they looked pretty stylish in this context, and it was also very + convenient to be able to paste-in the shapes directly as SVG path strings! + */ + drawables.add (folder = createDrawableFromSVGPath (Colours::darkgrey, "M 76.531972,116.65943 C 138.19864,91.877357 199.54658,66.389965 261.4126,42.049945 c 26.20551,4.17061 17.00846,35.348262 27.46812,51.842442 13.17191,44.087933 9.69881,51.512093 30.18158,93.124923 -7.79805,3.15935 -15.59597,6.3187 -23.39388,9.47805 C 269.9507,143.92299 270.68187,124.6488 255.14018,68.762725 208.6656,76.96787 149.63136,111.49835 96.876892,132.86616 c 20.096368,70.18096 40.229418,141.99553 81.756898,204.0512 15.24262,21.51974 46.21675,10.98988 56.02749,-9.54254 13.20038,-16.5246 12.12083,-76.13991 21.41808,-93.76216 8.17116,-9.97231 16.50664,-13.63709 27.69311,-19.48495 50.88575,-20.6198 101.77151,-41.23961 152.65739,-61.85942 16.97618,7.01928 -2.60481,67.74804 -8.54318,82.55545 -12.1959,28.12442 -28.64236,40.75479 -52.50229,58.90091 -59.50287,23.63196 -104.33289,55.33391 -164.43294,77.49302 -25.20592,5.49938 -48.76333,-11.78739 -59.77927,-31.99889 -33.49404,-49.05055 -49.87845,-106.05947 -67.959828,-161.26271 -5.38388,-17.37827 -10.5735,-34.85117 -13.98158,-52.68629 0.58247,-3.82935 3.52241,-7.1755 7.3012,-8.61035 z")); + drawables.add (document = createDrawableFromSVGPath (Colours::yellow.darker(1.0f), "M23.024,5.673c-1.744-1.694-3.625-3.051-5.168-3.236c-0.084-0.012-0.171-0.019-0.263-0.021H7.438c-0.162,0-0.322,0.063-0.436,0.18C6.889,2.71,6.822,2.87,6.822,3.033v25.75c0,0.162,0.063,0.317,0.18,0.435c0.117,0.116,0.271,0.179,0.436,0.179h18.364c0.162,0,0.317-0.062,0.434-0.179c0.117-0.117,0.182-0.272,0.182-0.435V11.648C26.382,9.659,24.824,7.49,23.024,5.673zM22.157,6.545c0.805,0.786,1.529,1.676,2.069,2.534c-0.468-0.185-0.959-0.322-1.42-0.431c-1.015-0.228-2.008-0.32-2.625-0.357c0.003-0.133,0.004-0.283,0.004-0.446c0-0.869-0.055-2.108-0.356-3.2c-0.003-0.01-0.005-0.02-0.009-0.03C20.584,5.119,21.416,5.788,22.157,6.545zM25.184,28.164H8.052V3.646h9.542v0.002c0.416-0.025,0.775,0.386,1.05,1.326c0.25,0.895,0.313,2.062,0.312,2.871c0.002,0.593-0.027,0.991-0.027,0.991l-0.049,0.652l0.656,0.007c0.003,0,1.516,0.018,3,0.355c1.426,0.308,2.541,0.922,2.645,1.617c0.004,0.062,0.005,0.124,0.004,0.182V28.164z")); + drawables.add (imageDoc = createDrawableFromSVGPath (Colours::darkgrey, "M25.25,25.25H6.75V6.75h18.5V25.25zM11.25,14c1.426,0,2.583-1.157,2.583-2.583c0-1.427-1.157-2.583-2.583-2.583c-1.427,0-2.583,1.157-2.583,2.583C8.667,12.843,9.823,14,11.25,14zM24.251,16.25l-4.917-4.917l-6.917,6.917L10.5,16.333l-2.752,2.752v5.165h16.503V16.25z")); + drawables.add (config = createDrawableFromSVGPath (Colours::darkgreen, "M17.41,20.395l-0.778-2.723c0.228-0.2,0.442-0.414,0.644-0.643l2.721,0.778c0.287-0.418,0.534-0.862,0.755-1.323l-2.025-1.96c0.097-0.288,0.181-0.581,0.241-0.883l2.729-0.684c0.02-0.252,0.039-0.505,0.039-0.763s-0.02-0.51-0.039-0.762l-2.729-0.684c-0.061-0.302-0.145-0.595-0.241-0.883l2.026-1.96c-0.222-0.46-0.469-0.905-0.756-1.323l-2.721,0.777c-0.201-0.228-0.416-0.442-0.644-0.643l0.778-2.722c-0.418-0.286-0.863-0.534-1.324-0.755l-1.96,2.026c-0.287-0.097-0.581-0.18-0.883-0.241l-0.683-2.73c-0.253-0.019-0.505-0.039-0.763-0.039s-0.51,0.02-0.762,0.039l-0.684,2.73c-0.302,0.061-0.595,0.144-0.883,0.241l-1.96-2.026C7.048,3.463,6.604,3.71,6.186,3.997l0.778,2.722C6.736,6.919,6.521,7.134,6.321,7.361L3.599,6.583C3.312,7.001,3.065,7.446,2.844,7.907l2.026,1.96c-0.096,0.288-0.18,0.581-0.241,0.883l-2.73,0.684c-0.019,0.252-0.039,0.505-0.039,0.762s0.02,0.51,0.039,0.763l2.73,0.684c0.061,0.302,0.145,0.595,0.241,0.883l-2.026,1.96c0.221,0.46,0.468,0.905,0.755,1.323l2.722-0.778c0.2,0.229,0.415,0.442,0.643,0.643l-0.778,2.723c0.418,0.286,0.863,0.533,1.323,0.755l1.96-2.026c0.288,0.097,0.581,0.181,0.883,0.241l0.684,2.729c0.252,0.02,0.505,0.039,0.763,0.039s0.51-0.02,0.763-0.039l0.683-2.729c0.302-0.061,0.596-0.145,0.883-0.241l1.96,2.026C16.547,20.928,16.992,20.681,17.41,20.395zM11.798,15.594c-1.877,0-3.399-1.522-3.399-3.399s1.522-3.398,3.399-3.398s3.398,1.521,3.398,3.398S13.675,15.594,11.798,15.594zM27.29,22.699c0.019-0.547-0.06-1.104-0.23-1.654l1.244-1.773c-0.188-0.35-0.4-0.682-0.641-0.984l-2.122,0.445c-0.428-0.364-0.915-0.648-1.436-0.851l-0.611-2.079c-0.386-0.068-0.777-0.105-1.173-0.106l-0.974,1.936c-0.279,0.054-0.558,0.128-0.832,0.233c-0.257,0.098-0.497,0.22-0.727,0.353L17.782,17.4c-0.297,0.262-0.568,0.545-0.813,0.852l0.907,1.968c-0.259,0.495-0.437,1.028-0.519,1.585l-1.891,1.06c0.019,0.388,0.076,0.776,0.164,1.165l2.104,0.519c0.231,0.524,0.541,0.993,0.916,1.393l-0.352,2.138c0.32,0.23,0.66,0.428,1.013,0.6l1.715-1.32c0.536,0.141,1.097,0.195,1.662,0.15l1.452,1.607c0.2-0.057,0.399-0.118,0.596-0.193c0.175-0.066,0.34-0.144,0.505-0.223l0.037-2.165c0.455-0.339,0.843-0.747,1.152-1.206l2.161-0.134c0.152-0.359,0.279-0.732,0.368-1.115L27.29,22.699zM23.127,24.706c-1.201,0.458-2.545-0.144-3.004-1.345s0.143-2.546,1.344-3.005c1.201-0.458,2.547,0.144,3.006,1.345C24.931,22.902,24.328,24.247,23.127,24.706z")); + drawables.add (graph = createDrawableFromSVGPath (Colours::darkred, "M6.812,17.202l7.396-3.665v-2.164h-0.834c-0.414,0-0.808-0.084-1.167-0.237v1.159l-7.396,3.667v2.912h2V17.202zM26.561,18.875v-2.913l-7.396-3.666v-1.158c-0.358,0.152-0.753,0.236-1.166,0.236h-0.832l-0.001,2.164l7.396,3.666v1.672H26.561zM16.688,18.875v-7.501h-2v7.501H16.688zM27.875,19.875H23.25c-1.104,0-2,0.896-2,2V26.5c0,1.104,0.896,2,2,2h4.625c1.104,0,2-0.896,2-2v-4.625C29.875,20.771,28.979,19.875,27.875,19.875zM8.125,19.875H3.5c-1.104,0-2,0.896-2,2V26.5c0,1.104,0.896,2,2,2h4.625c1.104,0,2-0.896,2-2v-4.625C10.125,20.771,9.229,19.875,8.125,19.875zM13.375,10.375H18c1.104,0,2-0.896,2-2V3.75c0-1.104-0.896-2-2-2h-4.625c-1.104,0-2,0.896-2,2v4.625C11.375,9.479,12.271,10.375,13.375,10.375zM18,19.875h-4.625c-1.104,0-2,0.896-2,2V26.5c0,1.104,0.896,2,2,2H18c1.104,0,2-0.896,2-2v-4.625C20,20.771,19.104,19.875,18,19.875z")); + drawables.add (exporter = createDrawableFromSVGPath (Colours::darkgrey, "M15.067,2.25c-5.979,0-11.035,3.91-12.778,9.309h3.213c1.602-3.705,5.271-6.301,9.565-6.309c5.764,0.01,10.428,4.674,10.437,10.437c-0.009,5.764-4.673,10.428-10.437,10.438c-4.294-0.007-7.964-2.605-9.566-6.311H2.289c1.744,5.399,6.799,9.31,12.779,9.312c7.419-0.002,13.437-6.016,13.438-13.438C28.504,8.265,22.486,2.252,15.067,2.25zM10.918,19.813l7.15-4.126l-7.15-4.129v2.297H-0.057v3.661h10.975V19.813z")); + drawables.add (jigsaw = createDrawableFromSVGPath (Colours::darkgrey, "M3.739,13.619c0,0,3.516-4.669,5.592-3.642c2.077,1.027-0.414,2.795,1.598,3.719c2.011,0.924,5.048-0.229,4.376-2.899c-0.672-2.67-1.866-0.776-2.798-2.208c-0.934-1.432,4.586-4.59,4.586-4.59s3.361,6.651,4.316,4.911c1.157-2.105,3.193-4.265,5.305-1.025c0,0,1.814,2.412,0.246,3.434s-2.917,0.443-3.506,1.553c-0.586,1.112,3.784,4.093,3.784,4.093s-2.987,4.81-4.926,3.548c-1.939-1.262,0.356-3.364-2.599-3.989c-1.288-0.23-3.438,0.538-3.818,2.34c-0.13,2.709,1.604,2.016,2.797,3.475c1.191,1.457-4.484,4.522-4.484,4.522s-1.584-3.923-3.811-4.657c-2.227-0.735-0.893,2.135-2.917,2.531c-2.024,0.396-4.816-2.399-3.46-4.789c1.358-2.391,3.275-0.044,3.441-1.951C7.629,16.087,3.739,13.619,3.739,13.619z")); + + DrawableImage* juceImage = new DrawableImage(); + juceImage->setImage (ImageCache::getFromMemory (BinaryData::juce_icon_png, BinaryData::juce_icon_pngSize)); + drawables.add (juceLogo = juceImage); } diff --git a/extras/Introjucer/Source/Utility/jucer_StoredSettings.h b/extras/Introjucer/Source/Utility/jucer_StoredSettings.h index b55a75ab7e..424e84d107 100644 --- a/extras/Introjucer/Source/Utility/jucer_StoredSettings.h +++ b/extras/Introjucer/Source/Utility/jucer_StoredSettings.h @@ -39,10 +39,9 @@ public: StoredSettings(); ~StoredSettings(); - juce_DeclareSingleton (StoredSettings, false); - PropertiesFile& getProps(); void flush(); + void reload(); //============================================================================== RecentlyOpenedFilesList recentFiles; @@ -60,27 +59,48 @@ public: public: ColourSelectorWithSwatches() {} - int getNumSwatches() const { return StoredSettings::getInstance()->swatchColours.size(); } - Colour getSwatchColour (int index) const { return StoredSettings::getInstance()->swatchColours [index]; } - void setSwatchColour (int index, const Colour& newColour) const { StoredSettings::getInstance()->swatchColours.set (index, newColour); } + int getNumSwatches() const; + Colour getSwatchColour (int index) const; + void setSwatchColour (int index, const Colour& newColour) const; }; - - //============================================================================== - Image getFallbackImage(); - const Drawable* getImageFileIcon(); - const Drawable* getCogIcon(); - - private: ScopedPointer props; StringArray fontNames; - ScopedPointer imageFileIcon, cogIcon; - Image fallbackImage; + void loadSwatchColours(); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (StoredSettings); }; +StoredSettings& getAppSettings(); +PropertiesFile& getAppProperties(); + + +//============================================================================== +class Icons +{ +public: + Icons(); + + void reload (const Colour& backgroundColour); + + const Drawable* folder; + const Drawable* document; + const Drawable* imageDoc; + const Drawable* config; + const Drawable* exporter; + const Drawable* juceLogo; + const Drawable* graph; + const Drawable* jigsaw; + +private: + OwnedArray drawables; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Icons); +}; + +const Icons& getIcons(); + #endif // __JUCER_STOREDSETTINGS_JUCEHEADER__