From a63bec1972e4d2c5f4712248d61d7747346c1b26 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 23 Jul 2007 10:06:55 +0000 Subject: [PATCH] --- build/linux/JUCE.make | 28 ++++++++--- .../juce_linux_Audio.cpp | 2 + .../juce_linux_Fonts.cpp | 35 ++++++++------ .../juce_linux_Windowing.cpp | 46 ++++++++++--------- .../platform_specific_code/juce_mac_Fonts.cpp | 4 +- .../juce_mac_Windowing.cpp | 4 +- .../juce_win32_Fonts.cpp | 4 +- .../juce_win32_Misc.cpp | 4 +- .../juce_win32_PlatformUtils.cpp | 4 +- extras/binarybuilder/BinaryBuilder.cpp | 7 +-- extras/juce demo/build/linux/JuceDemo.make | 31 ++++++++++--- .../application/juce_SystemClipboard.h | 4 +- .../gui/components/juce_Component.cpp | 4 +- .../gui/components/juce_Component.h | 4 +- .../gui/graphics/fonts/juce_Font.cpp | 12 ++--- .../gui/graphics/fonts/juce_Font.h | 16 +++---- .../geometry/juce_PositionedRectangle.cpp | 38 +++++++-------- .../geometry/juce_PositionedRectangle.h | 38 +++++++-------- src/juce_core/misc/juce_PlatformUtilities.h | 4 +- src/juce_core/text/juce_String.cpp | 2 +- 20 files changed, 167 insertions(+), 124 deletions(-) diff --git a/build/linux/JUCE.make b/build/linux/JUCE.make index 9e57ad9c78..527e7f5cfa 100644 --- a/build/linux/JUCE.make +++ b/build/linux/JUCE.make @@ -10,12 +10,14 @@ ifeq ($(CONFIG),Debug) LIBDIR := ../../bin OBJDIR := ../../bin/intermediate_linux/Debug OUTDIR := ../../bin - CPPFLAGS := -MD -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "../../" -I "/usr/include" -I "/usr/include/freetype2" - CFLAGS += $(CPPFLAGS) -g -D_DEBUG -ggdb -Wall + CPPFLAGS := -MMD -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "../../" -I "/usr/include" -I "/usr/include/freetype2" + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -D_DEBUG -ggdb -Wall CXXFLAGS := $(CFLAGS) LDFLAGS += -L$(BINDIR) -L$(LIBDIR) LDDEPS := + RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "../../" -I "/usr/include" -I "/usr/include/freetype2" TARGET := libjuce_debug.a + BLDCMD = ar -rcs $(OUTDIR)/$(TARGET) $(OBJECTS) $(TARGET_ARCH) endif ifeq ($(CONFIG),Release) @@ -23,12 +25,14 @@ ifeq ($(CONFIG),Release) LIBDIR := ../../bin OBJDIR := ../../bin/intermediate_linux/Release OUTDIR := ../../bin - CPPFLAGS := -MD -D "LINUX=1" -D "NDEBUG=1" -I "../../" -I "/usr/include" -I "/usr/include/freetype2" - CFLAGS += $(CPPFLAGS) -O2 -Wall + CPPFLAGS := -MMD -D "LINUX=1" -D "NDEBUG=1" -I "../../" -I "/usr/include" -I "/usr/include/freetype2" + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2 -Wall CXXFLAGS := $(CFLAGS) LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -s LDDEPS := + RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -I "../../" -I "/usr/include" -I "/usr/include/freetype2" TARGET := libjuce.a + BLDCMD = ar -rcs $(OUTDIR)/$(TARGET) $(OBJECTS) $(TARGET_ARCH) endif OBJECTS := \ @@ -391,8 +395,15 @@ OBJECTS := \ $(OBJDIR)/juce_linux_Threads.o \ $(OBJDIR)/juce_linux_Windowing.o \ +MKDIR_TYPE := msdos CMD := $(subst \,\\,$(ComSpec)$(COMSPEC)) ifeq (,$(CMD)) + MKDIR_TYPE := posix +endif +ifeq (/bin/sh.exe,$(SHELL)) + MKDIR_TYPE := posix +endif +ifeq ($(MKDIR_TYPE),posix) CMD_MKBINDIR := mkdir -p $(BINDIR) CMD_MKLIBDIR := mkdir -p $(LIBDIR) CMD_MKOUTDIR := mkdir -p $(OUTDIR) @@ -411,12 +422,17 @@ $(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES) -@$(CMD_MKBINDIR) -@$(CMD_MKLIBDIR) -@$(CMD_MKOUTDIR) - @ar -cr $@ $^ - @ranlib $@ + @$(BLDCMD) clean: @echo Cleaning JUCE +ifeq ($(MKDIR_TYPE),posix) -@rm -rf $(OUTDIR)/$(TARGET) $(OBJDIR) +else + -@if exist $(subst /,\,$(OUTDIR)/$(TARGET)) del /q $(subst /,\,$(OUTDIR)/$(TARGET)) + -@if exist $(subst /,\,$(OBJDIR)) del /q $(subst /,\,$(OBJDIR)) + -@if exist $(subst /,\,$(OBJDIR)) rmdir /s /q $(subst /,\,$(OBJDIR)) +endif $(OBJDIR)/juce_FileLogger.o: ../../src/juce_core/basics/juce_FileLogger.cpp -@$(CMD_MKOBJDIR) diff --git a/build/linux/platform_specific_code/juce_linux_Audio.cpp b/build/linux/platform_specific_code/juce_linux_Audio.cpp index 52068f0225..64f3aa3799 100644 --- a/build/linux/platform_specific_code/juce_linux_Audio.cpp +++ b/build/linux/platform_specific_code/juce_linux_Audio.cpp @@ -40,6 +40,8 @@ /* Got an include error here? If so, you've either not got ALSA installed, or you've not got your paths set up correctly to find its header files. + The package you need to install to get ASLA support is "libasound2-dev". + If you don't have the ALSA library and don't want to build Juce with audio support, just disable the JUCE_ALSA flag in juce_Config.h */ diff --git a/build/linux/platform_specific_code/juce_linux_Fonts.cpp b/build/linux/platform_specific_code/juce_linux_Fonts.cpp index 3c420bc63e..8adc6da111 100644 --- a/build/linux/platform_specific_code/juce_linux_Fonts.cpp +++ b/build/linux/platform_specific_code/juce_linux_Fonts.cpp @@ -33,6 +33,11 @@ #if JUCE_BUILD_GUI_CLASSES #include "linuxincludes.h" + +/* Got a build error here? You'll need to install the freetype library... + + The name of the package to install is "libfreetype6-dev". +*/ #include #include FT_FREETYPE_H @@ -114,7 +119,7 @@ class FreeTypeInterface : public DeletedAtShutdown { public: //============================================================================== - FreeTypeInterface() + FreeTypeInterface() throw() : lastFace (0), lastBold (false), lastItalic (false) @@ -152,7 +157,7 @@ public: enumerateFaces (fontDirs[i]); } - ~FreeTypeInterface() + ~FreeTypeInterface() throw() { if (lastFace != 0) FT_Done_Face (lastFace); @@ -165,7 +170,7 @@ public: //============================================================================== FreeTypeFontFace* findOrCreate (const String& familyName, - const bool create = false) + const bool create = false) throw() { for (int i = 0; i < faces.size(); i++) if (faces[i]->getFamilyName() == familyName) @@ -181,7 +186,7 @@ public: } // Enumerate all font faces available in a given directory - void enumerateFaces (const String& path) + void enumerateFaces (const String& path) throw() { File dirPath (path); if (path.isEmpty() || ! dirPath.isDirectory()) @@ -255,7 +260,7 @@ public: // Create a FreeType face object for a given font FT_Face createFT_Face (const String& fontName, const bool bold, - const bool italic) + const bool italic) throw() { FT_Face face = NULL; @@ -324,7 +329,7 @@ public: return face; } - void addGlyph (FT_Face face, Typeface& dest, uint32 character) + void addGlyph (FT_Face face, Typeface& dest, uint32 character) throw() { const unsigned int glyphIndex = FT_Get_Char_Index (face, character); const float height = (float) (face->ascender - face->descender); @@ -417,7 +422,7 @@ public: addKerning (face, dest, character, glyphIndex); } - void addKerning (FT_Face face, Typeface& dest, const uint32 character, const uint32 glyphIndex) + void addKerning (FT_Face face, Typeface& dest, const uint32 character, const uint32 glyphIndex) throw() { const float height = (float) (face->ascender - face->descender); @@ -441,7 +446,7 @@ public: // Add a glyph to a font bool addGlyphToFont (const uint32 character, const tchar* fontName, bool bold, bool italic, - Typeface& dest) + Typeface& dest) throw() { FT_Face face = createFT_Face (fontName, bold, italic); @@ -458,7 +463,7 @@ public: bool createTypeface (const String& fontName, const bool bold, const bool italic, Typeface& dest, - const bool addAllGlyphs) + const bool addAllGlyphs) throw() { dest.clear(); dest.setName (fontName); @@ -498,27 +503,27 @@ public: } //============================================================================== - void getFamilyNames (StringArray& familyNames) const + void getFamilyNames (StringArray& familyNames) const throw() { for (int i = 0; i < faces.size(); i++) familyNames.add (faces[i]->getFamilyName()); } - void getMonospacedNames (StringArray& monoSpaced) const + void getMonospacedNames (StringArray& monoSpaced) const throw() { for (int i = 0; i < faces.size(); i++) if (faces[i]->getMonospaced()) monoSpaced.add (faces[i]->getFamilyName()); } - void getSerifNames (StringArray& serif) const + void getSerifNames (StringArray& serif) const throw() { for (int i = 0; i < faces.size(); i++) if (faces[i]->getSerif()) serif.add (faces[i]->getFamilyName()); } - void getSansSerifNames (StringArray& sansSerif) const + void getSansSerifNames (StringArray& sansSerif) const throw() { for (int i = 0; i < faces.size(); i++) if (! faces[i]->getSerif()) @@ -554,7 +559,7 @@ void Typeface::findAndAddSystemGlyph (juce_wchar character) throw() ->addGlyphToFont (character, getName(), isBold(), isItalic(), *this); } -const StringArray Font::findAllTypefaceNames() +const StringArray Font::findAllTypefaceNames() throw() { StringArray s; FreeTypeInterface::getInstance()->getFamilyNames (s); @@ -612,7 +617,7 @@ static const String linux_getDefaultMonospacedFontName() return pickBestFont (allFonts, "Bitstream Vera Sans Mono, Courier, Sans Mono, Mono"); } -void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) +void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw() { defaultSans = linux_getDefaultSansSerifFontName(); defaultSerif = linux_getDefaultSerifFontName(); diff --git a/build/linux/platform_specific_code/juce_linux_Windowing.cpp b/build/linux/platform_specific_code/juce_linux_Windowing.cpp index 9e65927deb..3cf34c4d31 100644 --- a/build/linux/platform_specific_code/juce_linux_Windowing.cpp +++ b/build/linux/platform_specific_code/juce_linux_Windowing.cpp @@ -42,6 +42,8 @@ #include #if JUCE_USE_XINERAMA + /* If you're trying to use Xinerama, you'll need to install the "libxinerama-dev" package.. + */ #include #endif @@ -52,7 +54,14 @@ #endif #if JUCE_OPENGL - #include + /* Got an include error here? + + If you want to install OpenGL support, the packages to get are "mesa-common-dev" + and "freeglut3-dev". + + Alternatively, you can turn off the JUCE_OPENGL flag in juce_Config.h if you + want to disable it. + */ #include #endif @@ -1048,17 +1057,10 @@ public: bool isFocused() const { int revert; - Window focus = 0; - XGetInputFocus (display, &focus, &revert); + Window focusedWindow = 0; + XGetInputFocus (display, &focusedWindow, &revert); - if (focus == 0 || focus == None || focus == PointerRoot) - return 0; - - ComponentPeer* focusedPeer = 0; - if (XFindContext (display, (XID) focus, improbableNumber, (XPointer*) &focusedPeer) != 0) - focusedPeer = 0; - - return this == focusedPeer; + return focusedWindow == windowH; } void grabFocus() @@ -1067,15 +1069,11 @@ public: if (windowH != 0 && XGetWindowAttributes (display, windowH, &atts) - && atts.map_state == IsViewable) + && atts.map_state == IsViewable + && ! isFocused()) { XSetInputFocus (display, windowH, RevertToParent, CurrentTime); - - if (! isActiveApplication) - { - isActiveApplication = true; - handleFocusGain(); - } + isActiveApplication = true; } } @@ -1408,14 +1406,18 @@ public: case FocusIn: { isActiveApplication = true; - handleFocusGain(); + if (isFocused()) + handleFocusGain(); + break; } case FocusOut: { isActiveApplication = false; - handleFocusLoss(); + if (! isFocused()) + handleFocusLoss(); + break; } @@ -2918,7 +2920,7 @@ static void initClipboard (Window root, Atom* cutBuffers) throw() // Clipboard implemented currently using cut buffers // rather than the more powerful selection method -void SystemClipboard::copyTextToClipboard (const String& clipText) +void SystemClipboard::copyTextToClipboard (const String& clipText) throw() { Window root = RootWindow (display, DefaultScreen (display)); Atom cutBuffers[8] = { XA_CUT_BUFFER0, XA_CUT_BUFFER1, XA_CUT_BUFFER2, XA_CUT_BUFFER3, @@ -2932,7 +2934,7 @@ void SystemClipboard::copyTextToClipboard (const String& clipText) clipText.length()); } -const String SystemClipboard::getTextFromClipboard() +const String SystemClipboard::getTextFromClipboard() throw() { char* clipData; const int bufSize = 64; // in words diff --git a/build/macosx/platform_specific_code/juce_mac_Fonts.cpp b/build/macosx/platform_specific_code/juce_mac_Fonts.cpp index 163a071694..06d769b8bc 100644 --- a/build/macosx/platform_specific_code/juce_mac_Fonts.cpp +++ b/build/macosx/platform_specific_code/juce_mac_Fonts.cpp @@ -455,7 +455,7 @@ void Typeface::findAndAddSystemGlyph (juce_wchar character) throw() ATSFontHelperCache::getInstance()->releaseFont (helper); } -const StringArray Font::findAllTypefaceNames() +const StringArray Font::findAllTypefaceNames() throw() { StringArray names; ATSFontIterator iter; @@ -518,7 +518,7 @@ const StringArray Font::findAllTypefaceNames() return names; } -void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) +void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw() { defaultSans = "Lucida Grande"; defaultSerif = "Times New Roman"; diff --git a/build/macosx/platform_specific_code/juce_mac_Windowing.cpp b/build/macosx/platform_specific_code/juce_mac_Windowing.cpp index 2b82855eb2..2d973944b0 100644 --- a/build/macosx/platform_specific_code/juce_mac_Windowing.cpp +++ b/build/macosx/platform_specific_code/juce_mac_Windowing.cpp @@ -2870,7 +2870,7 @@ void PlatformUtilities::beep() } //============================================================================== -void SystemClipboard::copyTextToClipboard (const String& text) +void SystemClipboard::copyTextToClipboard (const String& text) throw() { ClearCurrentScrap(); ScrapRef ref; @@ -2892,7 +2892,7 @@ void SystemClipboard::copyTextToClipboard (const String& text) juce_free (temp); } -const String SystemClipboard::getTextFromClipboard() +const String SystemClipboard::getTextFromClipboard() throw() { String result; diff --git a/build/win32/platform_specific_code/juce_win32_Fonts.cpp b/build/win32/platform_specific_code/juce_win32_Fonts.cpp index 04092ddb09..df00ea46ae 100644 --- a/build/win32/platform_specific_code/juce_win32_Fonts.cpp +++ b/build/win32/platform_specific_code/juce_win32_Fonts.cpp @@ -174,7 +174,7 @@ static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe, return 1; } -const StringArray Font::findAllTypefaceNames() +const StringArray Font::findAllTypefaceNames() throw() { StringArray results; HDC dc = CreateCompatibleDC (0); @@ -241,7 +241,7 @@ const StringArray Font::findAllTypefaceNames() void Font::getDefaultFontNames (String& defaultSans, String& defaultSerif, - String& defaultFixed) + String& defaultFixed) throw() { defaultSans = "Verdana"; defaultSerif = "Times"; diff --git a/build/win32/platform_specific_code/juce_win32_Misc.cpp b/build/win32/platform_specific_code/juce_win32_Misc.cpp index ca4dd28e56..5740ba950c 100644 --- a/build/win32/platform_specific_code/juce_win32_Misc.cpp +++ b/build/win32/platform_specific_code/juce_win32_Misc.cpp @@ -68,7 +68,7 @@ void PlatformUtilities::beep() #pragma warning (disable : 4127) // "Conditional expression is constant" warning #endif -void SystemClipboard::copyTextToClipboard (const String& text) +void SystemClipboard::copyTextToClipboard (const String& text) throw() { if (OpenClipboard (0) != 0) { @@ -96,7 +96,7 @@ void SystemClipboard::copyTextToClipboard (const String& text) } } -const String SystemClipboard::getTextFromClipboard() +const String SystemClipboard::getTextFromClipboard() throw() { String result; diff --git a/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp b/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp index edebc70b00..30f4deb30c 100644 --- a/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp +++ b/build/win32/platform_specific_code/juce_win32_PlatformUtils.cpp @@ -304,7 +304,7 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath) //============================================================================== static void* currentModuleHandle = 0; -void* PlatformUtilities::getCurrentModuleInstanceHandle() +void* PlatformUtilities::getCurrentModuleInstanceHandle() throw() { if (currentModuleHandle == 0) currentModuleHandle = GetModuleHandle (0); @@ -312,7 +312,7 @@ void* PlatformUtilities::getCurrentModuleInstanceHandle() return currentModuleHandle; } -void PlatformUtilities::setCurrentModuleInstanceHandle (void* newHandle) +void PlatformUtilities::setCurrentModuleInstanceHandle (void* const newHandle) throw() { currentModuleHandle = newHandle; } diff --git a/extras/binarybuilder/BinaryBuilder.cpp b/extras/binarybuilder/BinaryBuilder.cpp index 4656dc558e..e9ab6ff81d 100644 --- a/extras/binarybuilder/BinaryBuilder.cpp +++ b/extras/binarybuilder/BinaryBuilder.cpp @@ -84,9 +84,9 @@ int main (int argc, char* argv[]) printf ("\n BinaryBuilder! Copyright 2007 by Julian Storer - www.rawmaterialsoftware.com\n\n"); - if (argc != 4) + if (argc < 4 || argc > 5) { - printf (" Usage: BinaryBuilder sourcedirectory targetdirectory targetclassname\n\n"); + printf (" Usage: BinaryBuilder sourcedirectory targetdirectory targetclassname [optional wildcard pattern]\n\n"); printf (" BinaryBuilder will find all files in the source directory, and encode them\n"); printf (" into two files called (targetclassname).cpp and (targetclassname).h, which it\n"); printf (" will write into the target directory supplied.\n\n"); @@ -136,7 +136,8 @@ int main (int argc, char* argv[]) printf ((const char*) message); OwnedArray files; - sourceDirectory.findChildFiles (files, File::findFiles, true, "*"); + sourceDirectory.findChildFiles (files, File::findFiles, true, + (argc > 4) ? argv[4] : "*"); if (files.size() == 0) { diff --git a/extras/juce demo/build/linux/JuceDemo.make b/extras/juce demo/build/linux/JuceDemo.make index f54f86c1f2..66f84dccb0 100644 --- a/extras/juce demo/build/linux/JuceDemo.make +++ b/extras/juce demo/build/linux/JuceDemo.make @@ -10,12 +10,14 @@ ifeq ($(CONFIG),Debug) LIBDIR := build OBJDIR := build/intermediate/Debug OUTDIR := build - CPPFLAGS := -MD -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" - CFLAGS += $(CPPFLAGS) -g -D_DEBUG -ggdb + CPPFLAGS := -MMD -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -D_DEBUG -ggdb CXXFLAGS := $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L "/usr/X11R6/lib/" -L "../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -ljuce_debug + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -ljuce_debug LDDEPS := + RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" TARGET := jucedemo + BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) endif ifeq ($(CONFIG),Release) @@ -23,12 +25,14 @@ ifeq ($(CONFIG),Release) LIBDIR := build OBJDIR := build/intermediate/Release OUTDIR := build - CPPFLAGS := -MD -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" - CFLAGS += $(CPPFLAGS) -O2 + CPPFLAGS := -MMD -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" + CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2 CXXFLAGS := $(CFLAGS) - LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -s -L "/usr/X11R6/lib/" -L "../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -ljuce + LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -s -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound -ljuce LDDEPS := + RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" TARGET := jucedemo + BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) endif OBJECTS := \ @@ -47,8 +51,15 @@ OBJECTS := \ $(OBJDIR)/TreeViewDemo.o \ $(OBJDIR)/WidgetsDemo.o \ +MKDIR_TYPE := msdos CMD := $(subst \,\\,$(ComSpec)$(COMSPEC)) ifeq (,$(CMD)) + MKDIR_TYPE := posix +endif +ifeq (/bin/sh.exe,$(SHELL)) + MKDIR_TYPE := posix +endif +ifeq ($(MKDIR_TYPE),posix) CMD_MKBINDIR := mkdir -p $(BINDIR) CMD_MKLIBDIR := mkdir -p $(LIBDIR) CMD_MKOUTDIR := mkdir -p $(OUTDIR) @@ -67,11 +78,17 @@ $(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES) -@$(CMD_MKBINDIR) -@$(CMD_MKLIBDIR) -@$(CMD_MKOUTDIR) - @$(CXX) -o $@ $(OBJECTS) $(LDFLAGS) $(RESOURCES) + @$(BLDCMD) clean: @echo Cleaning JuceDemo +ifeq ($(MKDIR_TYPE),posix) -@rm -rf $(OUTDIR)/$(TARGET) $(OBJDIR) +else + -@if exist $(subst /,\,$(OUTDIR)/$(TARGET)) del /q $(subst /,\,$(OUTDIR)/$(TARGET)) + -@if exist $(subst /,\,$(OBJDIR)) del /q $(subst /,\,$(OBJDIR)) + -@if exist $(subst /,\,$(OBJDIR)) rmdir /s /q $(subst /,\,$(OBJDIR)) +endif $(OBJDIR)/ApplicationStartup.o: ../../src/ApplicationStartup.cpp -@$(CMD_MKOBJDIR) diff --git a/src/juce_appframework/application/juce_SystemClipboard.h b/src/juce_appframework/application/juce_SystemClipboard.h index af34829176..8995c08b14 100644 --- a/src/juce_appframework/application/juce_SystemClipboard.h +++ b/src/juce_appframework/application/juce_SystemClipboard.h @@ -43,14 +43,14 @@ class JUCE_API SystemClipboard { public: /** Copies a string of text onto the clipboard */ - static void copyTextToClipboard (const String& text); + static void copyTextToClipboard (const String& text) throw(); /** Gets the current clipboard's contents. Obviously this might have come from another app, so could contain anything.. */ - static const String getTextFromClipboard(); + static const String getTextFromClipboard() throw(); }; #endif // __JUCE_SYSTEMCLIPBOARD_JUCEHEADER__ diff --git a/src/juce_appframework/gui/components/juce_Component.cpp b/src/juce_appframework/gui/components/juce_Component.cpp index 7722e6db5c..ad19afcfb2 100644 --- a/src/juce_appframework/gui/components/juce_Component.cpp +++ b/src/juce_appframework/gui/components/juce_Component.cpp @@ -3208,7 +3208,7 @@ KeyboardFocusTraverser* Component::createFocusTraverser() return parentComponent_->createFocusTraverser(); } -void Component::takeKeyboardFocus (FocusChangeType cause) +void Component::takeKeyboardFocus (const FocusChangeType cause) { // give the focus to this component if (currentlyFocusedComponent != this) @@ -3264,7 +3264,7 @@ void Component::takeKeyboardFocus (FocusChangeType cause) } } -void Component::grabFocusInternal (FocusChangeType cause, const bool canTryParent) +void Component::grabFocusInternal (const FocusChangeType cause, const bool canTryParent) { if (isShowing()) { diff --git a/src/juce_appframework/gui/components/juce_Component.h b/src/juce_appframework/gui/components/juce_Component.h index e4d8647a88..1be6bccbb2 100644 --- a/src/juce_appframework/gui/components/juce_Component.h +++ b/src/juce_appframework/gui/components/juce_Component.h @@ -2083,8 +2083,8 @@ private: void sendMovedResizedMessages (const bool wasMoved, const bool wasResized); void repaintParent() throw(); void sendFakeMouseMove() const; - void takeKeyboardFocus (FocusChangeType cause); - void grabFocusInternal (FocusChangeType cause, const bool canTryParent = true); + void takeKeyboardFocus (const FocusChangeType cause); + void grabFocusInternal (const FocusChangeType cause, const bool canTryParent = true); static void giveAwayFocus(); void sendEnablementChangeMessage(); static void* runModalLoopCallback (void*); diff --git a/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp b/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp index b0d79ee87c..f3b243b34b 100644 --- a/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp +++ b/src/juce_appframework/gui/graphics/fonts/juce_Font.cpp @@ -268,7 +268,7 @@ bool Font::isUnderlined() const throw() return (styleFlags & underlined) != 0; } -float Font::getAscent() const +float Font::getAscent() const throw() { if (ascent == 0) ascent = getTypeface()->getAscent(); @@ -276,17 +276,17 @@ float Font::getAscent() const return height * ascent; } -float Font::getDescent() const +float Font::getDescent() const throw() { return height - getAscent(); } -int Font::getStringWidth (const String& text) const +int Font::getStringWidth (const String& text) const throw() { return roundFloatToInt (getStringWidthFloat (text)); } -float Font::getStringWidthFloat (const String& text) const +float Font::getStringWidthFloat (const String& text) const throw() { float x = 0.0f; @@ -311,7 +311,7 @@ float Font::getStringWidthFloat (const String& text) const return x; } -Typeface* Font::getTypeface() const +Typeface* Font::getTypeface() const throw() { if (typeface == 0) typeface = Typeface::getTypefaceFor (*this); @@ -319,7 +319,7 @@ Typeface* Font::getTypeface() const return typeface; } -void Font::findFonts (OwnedArray& destArray) +void Font::findFonts (OwnedArray& destArray) throw() { const StringArray names (findAllTypefaceNames()); diff --git a/src/juce_appframework/gui/graphics/fonts/juce_Font.h b/src/juce_appframework/gui/graphics/fonts/juce_Font.h index 20018de21c..b56893d150 100644 --- a/src/juce_appframework/gui/graphics/fonts/juce_Font.h +++ b/src/juce_appframework/gui/graphics/fonts/juce_Font.h @@ -190,7 +190,7 @@ public: @see getHeight, getDescent */ - float getAscent() const; + float getAscent() const throw(); /** Returns the amount that the font descends below its baseline. @@ -198,7 +198,7 @@ public: @see getAscent, getHeight */ - float getDescent() const; + float getDescent() const throw(); //============================================================================== /** Returns the font's style flags. @@ -291,13 +291,13 @@ public: For a more accurate floating-point result, use getStringWidthFloat(). */ - int getStringWidth (const String& text) const; + int getStringWidth (const String& text) const throw(); /** Returns the total width of a string as it would be drawn using this font. @see getStringWidth */ - float getStringWidthFloat (const String& text) const; + float getStringWidthFloat (const String& text) const throw(); //============================================================================== /** Returns the typeface used by this font. @@ -305,7 +305,7 @@ public: Note that the object returned may go out of scope if this font is deleted or has its style changed. */ - Typeface* getTypeface() const; + Typeface* getTypeface() const throw(); /** Creates an array of Font objects to represent all the fonts on the system. @@ -314,7 +314,7 @@ public: @param results the array to which new Font objects will be added. */ - static void findFonts (OwnedArray& results); + static void findFonts (OwnedArray& results) throw(); /** Returns a list of all the available typeface names. @@ -323,7 +323,7 @@ public: You can use this instead of findFonts() if you only need their names, and not font objects. */ - static const StringArray findAllTypefaceNames(); + static const StringArray findAllTypefaceNames() throw(); //============================================================================== juce_UseDebuggingNewOperator @@ -340,7 +340,7 @@ private: mutable Typeface::Ptr typeface; // platform-specific calls - static void getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed); + static void getDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed) throw(); friend void JUCE_PUBLIC_FUNCTION initialiseJuce_GUI(); static void initialiseDefaultFontNames() throw(); diff --git a/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.cpp b/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.cpp index 58ba536abc..ead431aaa5 100644 --- a/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.cpp +++ b/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.cpp @@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE //============================================================================== -PositionedRectangle::PositionedRectangle() +PositionedRectangle::PositionedRectangle() throw() : x (0.0), y (0.0), w (0.0), @@ -49,7 +49,7 @@ PositionedRectangle::PositionedRectangle() { } -PositionedRectangle::PositionedRectangle (const PositionedRectangle& other) +PositionedRectangle::PositionedRectangle (const PositionedRectangle& other) throw() : x (other.x), y (other.y), w (other.w), @@ -61,7 +61,7 @@ PositionedRectangle::PositionedRectangle (const PositionedRectangle& other) { } -const PositionedRectangle& PositionedRectangle::operator= (const PositionedRectangle& other) +const PositionedRectangle& PositionedRectangle::operator= (const PositionedRectangle& other) throw() { if (this != &other) { @@ -78,7 +78,7 @@ const PositionedRectangle& PositionedRectangle::operator= (const PositionedRecta return *this; } -PositionedRectangle::~PositionedRectangle() +PositionedRectangle::~PositionedRectangle() throw() { } @@ -100,7 +100,7 @@ const bool PositionedRectangle::operator!= (const PositionedRectangle& other) co } //============================================================================== -PositionedRectangle::PositionedRectangle (const String& stringVersion) +PositionedRectangle::PositionedRectangle (const String& stringVersion) throw() { StringArray tokens; tokens.addTokens (stringVersion, false); @@ -111,7 +111,7 @@ PositionedRectangle::PositionedRectangle (const String& stringVersion) decodeSizeString (tokens [3], hMode, h); } -const String PositionedRectangle::toString() const +const String PositionedRectangle::toString() const throw() { String s; s.preallocateStorage (12); @@ -128,7 +128,7 @@ const String PositionedRectangle::toString() const } //============================================================================== -const Rectangle PositionedRectangle::getRectangle (const Rectangle& target) const +const Rectangle PositionedRectangle::getRectangle (const Rectangle& target) const throw() { jassert (! target.isEmpty()); @@ -142,7 +142,7 @@ const Rectangle PositionedRectangle::getRectangle (const Rectangle& target) cons void PositionedRectangle::getRectangleDouble (const Rectangle& target, double& x_, double& y_, - double& w_, double& h_) const + double& w_, double& h_) const throw() { jassert (! target.isEmpty()); @@ -150,14 +150,14 @@ void PositionedRectangle::getRectangleDouble (const Rectangle& target, applyPosAndSize (y_, h_, y, h, yMode, hMode, target.getY(), target.getHeight()); } -void PositionedRectangle::applyToComponent (Component& comp) const +void PositionedRectangle::applyToComponent (Component& comp) const throw() { comp.setBounds (getRectangle (Rectangle (0, 0, comp.getParentWidth(), comp.getParentHeight()))); } //============================================================================== void PositionedRectangle::updateFrom (const Rectangle& rectangle, - const Rectangle& target) + const Rectangle& target) throw() { updatePosAndSize (x, w, rectangle.getX(), rectangle.getWidth(), xMode, wMode, target.getX(), target.getWidth()); updatePosAndSize (y, h, rectangle.getY(), rectangle.getHeight(), yMode, hMode, target.getY(), target.getHeight()); @@ -165,13 +165,13 @@ void PositionedRectangle::updateFrom (const Rectangle& rectangle, void PositionedRectangle::updateFromDouble (const double newX, const double newY, const double newW, const double newH, - const Rectangle& target) + const Rectangle& target) throw() { updatePosAndSize (x, w, newX, newW, xMode, wMode, target.getX(), target.getWidth()); updatePosAndSize (y, h, newY, newH, yMode, hMode, target.getY(), target.getHeight()); } -void PositionedRectangle::updateFromComponent (const Component& comp) +void PositionedRectangle::updateFromComponent (const Component& comp) throw() { if (comp.getParentComponent() == 0 && ! comp.isOnDesktop()) updateFrom (comp.getBounds(), Rectangle()); @@ -222,7 +222,7 @@ void PositionedRectangle::setModes (const AnchorPoint xAnchor, const PositionMode yMode_, const SizeMode widthMode, const SizeMode heightMode, - const Rectangle& target) + const Rectangle& target) throw() { if (xMode != (xAnchor | xMode_) || wMode != widthMode) { @@ -256,7 +256,7 @@ bool PositionedRectangle::isPositionAbsolute() const throw() } //============================================================================== -void PositionedRectangle::addPosDescription (String& s, const uint8 mode, const double value) const +void PositionedRectangle::addPosDescription (String& s, const uint8 mode, const double value) const throw() { if ((mode & proportionOfParentSize) != 0) { @@ -278,7 +278,7 @@ void PositionedRectangle::addPosDescription (String& s, const uint8 mode, const s << T('c'); } -void PositionedRectangle::addSizeDescription (String& s, const uint8 mode, const double value) const +void PositionedRectangle::addSizeDescription (String& s, const uint8 mode, const double value) const throw() { if (mode == proportionalSize) s << (roundDoubleToInt (value * 100000.0) / 1000.0) << T('%'); @@ -288,7 +288,7 @@ void PositionedRectangle::addSizeDescription (String& s, const uint8 mode, const s << (roundDoubleToInt (value * 100.0) / 100.0); } -void PositionedRectangle::decodePosString (const String& s, uint8& mode, double& value) +void PositionedRectangle::decodePosString (const String& s, uint8& mode, double& value) throw() { if (s.containsChar (T('r'))) mode = anchorAtRightOrBottom; @@ -315,7 +315,7 @@ void PositionedRectangle::decodePosString (const String& s, uint8& mode, double& } } -void PositionedRectangle::decodeSizeString (const String& s, uint8& mode, double& value) +void PositionedRectangle::decodeSizeString (const String& s, uint8& mode, double& value) throw() { if (s.containsChar (T('%'))) { @@ -338,7 +338,7 @@ void PositionedRectangle::applyPosAndSize (double& xOut, double& wOut, const double x, const double w, const uint8 xMode, const uint8 wMode, const int parentPos, - const int parentSize) const + const int parentSize) const throw() { if (wMode == proportionalSize) wOut = roundDoubleToInt (w * parentSize); @@ -366,7 +366,7 @@ void PositionedRectangle::updatePosAndSize (double& xOut, double& wOut, double x, const double w, const uint8 xMode, const uint8 wMode, const int parentPos, - const int parentSize) const + const int parentSize) const throw() { if (wMode == proportionalSize) { diff --git a/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.h b/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.h index 2120955d5d..e9e726a1ba 100644 --- a/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.h +++ b/src/juce_appframework/gui/graphics/geometry/juce_PositionedRectangle.h @@ -80,22 +80,22 @@ public: The default anchor point is top-left; the default */ - PositionedRectangle(); + PositionedRectangle() throw(); /** Initialises a PositionedRectangle from a saved string version. The string must be in the format generated by toString(). */ - PositionedRectangle (const String& stringVersion); + PositionedRectangle (const String& stringVersion) throw(); /** Creates a copy of another PositionedRectangle. */ - PositionedRectangle (const PositionedRectangle& other); + PositionedRectangle (const PositionedRectangle& other) throw(); /** Copies another PositionedRectangle. */ - const PositionedRectangle& operator= (const PositionedRectangle& other); + const PositionedRectangle& operator= (const PositionedRectangle& other) throw(); /** Destructor. */ - ~PositionedRectangle(); + ~PositionedRectangle() throw(); //============================================================================== /** Returns a string version of this position, from which it can later be @@ -123,7 +123,7 @@ public: To reload a stored string, use the constructor that takes a string parameter. */ - const String toString() const; + const String toString() const throw(); //============================================================================== /** Calculates the absolute position, given the size of the space that @@ -134,7 +134,7 @@ public: @see applyToComponent */ - const Rectangle getRectangle (const Rectangle& targetSpaceToBeRelativeTo) const; + const Rectangle getRectangle (const Rectangle& targetSpaceToBeRelativeTo) const throw(); /** Same as getRectangle(), but returning the values as doubles rather than ints. */ @@ -142,7 +142,7 @@ public: double& x, double& y, double& width, - double& height) const; + double& height) const throw(); /** This sets the bounds of the given component to this position. @@ -153,7 +153,7 @@ public: @see getRectangle, updateFromComponent */ - void applyToComponent (Component& comp) const; + void applyToComponent (Component& comp) const throw(); //============================================================================== /** Updates this object's co-ordinates to match the given rectangle. @@ -170,13 +170,13 @@ public: will not be changed. */ void updateFrom (const Rectangle& newPosition, - const Rectangle& targetSpaceToBeRelativeTo); + const Rectangle& targetSpaceToBeRelativeTo) throw(); /** Same functionality as updateFrom(), but taking doubles instead of ints. */ void updateFromDouble (const double x, const double y, const double width, const double height, - const Rectangle& targetSpaceToBeRelativeTo); + const Rectangle& targetSpaceToBeRelativeTo) throw(); /** Updates this object's co-ordinates to match the bounds of this component. @@ -187,7 +187,7 @@ public: might not be updated because it would need to know the parent's size to do the maths for this. */ - void updateFromComponent (const Component& comp); + void updateFromComponent (const Component& comp) throw(); //============================================================================== /** Specifies the point within the rectangle, relative to which it should be positioned. */ @@ -228,7 +228,7 @@ public: const PositionMode yPositionMode, const SizeMode widthMode, const SizeMode heightMode, - const Rectangle& targetSpaceToBeRelativeTo); + const Rectangle& targetSpaceToBeRelativeTo) throw(); /** Returns the anchoring mode for the x co-ordinate. To change any of the modes, use setModes(). @@ -336,16 +336,16 @@ private: double x, y, w, h; uint8 xMode, yMode, wMode, hMode; - void addPosDescription (String& result, const uint8 mode, const double value) const; - void addSizeDescription (String& result, const uint8 mode, const double value) const; - void decodePosString (const String& s, uint8& mode, double& value); - void decodeSizeString (const String& s, uint8& mode, double& value); + void addPosDescription (String& result, const uint8 mode, const double value) const throw(); + void addSizeDescription (String& result, const uint8 mode, const double value) const throw(); + void decodePosString (const String& s, uint8& mode, double& value) throw(); + void decodeSizeString (const String& s, uint8& mode, double& value) throw(); void applyPosAndSize (double& xOut, double& wOut, const double x, const double w, const uint8 xMode, const uint8 wMode, - const int parentPos, const int parentSize) const; + const int parentPos, const int parentSize) const throw(); void updatePosAndSize (double& xOut, double& wOut, double x, const double w, const uint8 xMode, const uint8 wMode, - const int parentPos, const int parentSize) const; + const int parentPos, const int parentSize) const throw(); }; diff --git a/src/juce_core/misc/juce_PlatformUtilities.h b/src/juce_core/misc/juce_PlatformUtilities.h index ff38a6985a..4e9d453bf8 100644 --- a/src/juce_core/misc/juce_PlatformUtilities.h +++ b/src/juce_core/misc/juce_PlatformUtilities.h @@ -126,13 +126,13 @@ public: to set the correct module handle in your DllMain() function, because the win32 system relies on the correct instance handle when opening windows. */ - static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle(); + static void* JUCE_CALLTYPE getCurrentModuleInstanceHandle() throw(); /** WIN32 ONLY - Sets a new module handle to be used by the library. @see getCurrentModuleInstanceHandle() */ - static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle); + static void JUCE_CALLTYPE setCurrentModuleInstanceHandle (void* newHandle) throw(); #endif diff --git a/src/juce_core/text/juce_String.cpp b/src/juce_core/text/juce_String.cpp index 5b30fabd92..657efc82db 100644 --- a/src/juce_core/text/juce_String.cpp +++ b/src/juce_core/text/juce_String.cpp @@ -294,7 +294,7 @@ static tchar* int64ToCharString (tchar* t, const int64 n) throw() static tchar* intToCharString (tchar* t, const int n) throw() { - if (n == 0x80000000) // (would cause an overflow) + if (n == (int) 0x80000000) // (would cause an overflow) return int64ToCharString (t, n); *--t = 0;