| @@ -294,6 +294,37 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const File File::getLinkedTarget() const throw() | |||||
| { | |||||
| char buffer [4096]; | |||||
| size_t numChars = readlink ((const char*) getFullPathName().toUTF8(), | |||||
| buffer, sizeof (buffer)); | |||||
| if (numChars > 0 && numChars <= sizeof (buffer)) | |||||
| return File (String::fromUTF8 ((const uint8*) buffer, (int) numChars)); | |||||
| return *this; | |||||
| } | |||||
| //============================================================================== | |||||
| bool File::moveToTrash() const throw() | |||||
| { | |||||
| if (! exists()) | |||||
| return true; | |||||
| File trashCan (T("~/.Trash")); | |||||
| if (! trashCan.isDirectory()) | |||||
| trashCan = T("~/.local/share/Trash/files"); | |||||
| if (! trashCan.isDirectory()) | |||||
| return false; | |||||
| return moveFileTo (trashCan.getNonexistentChildFile (getFileNameWithoutExtension(), | |||||
| getFileExtension())); | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| struct FindFileStruct | struct FindFileStruct | ||||
| { | { | ||||
| @@ -439,7 +470,7 @@ bool juce_launchFile (const String& fileName, | |||||
| if (cmdString.startsWithIgnoreCase (T("file:"))) | if (cmdString.startsWithIgnoreCase (T("file:"))) | ||||
| cmdString = cmdString.substring (5); | cmdString = cmdString.substring (5); | ||||
| char* const argv[4] = { "/bin/sh", "-c", (char*) cmdString.toUTF8(), 0 }; | |||||
| const char* const argv[4] = { "/bin/sh", "-c", (const char*) cmdString.toUTF8(), 0 }; | |||||
| const int cpid = fork(); | const int cpid = fork(); | ||||
| @@ -448,7 +479,7 @@ bool juce_launchFile (const String& fileName, | |||||
| setsid(); | setsid(); | ||||
| // Child process | // Child process | ||||
| execve (argv[0], argv, environ); | |||||
| execve (argv[0], (char**) argv, environ); | |||||
| exit (0); | exit (0); | ||||
| } | } | ||||
| @@ -77,8 +77,8 @@ BEGIN_JUCE_NAMESPACE | |||||
| //============================================================================== | //============================================================================== | ||||
| void Logger::outputDebugString (const String& text) throw() | void Logger::outputDebugString (const String& text) throw() | ||||
| { | { | ||||
| fprintf (stdout, text.toUTF8()); | |||||
| fprintf (stdout, "\n"); | |||||
| fputs (text.toUTF8(), stdout); | |||||
| fputs ("\n", stdout); | |||||
| } | } | ||||
| void Logger::outputDebugPrintf (const tchar* format, ...) throw() | void Logger::outputDebugPrintf (const tchar* format, ...) throw() | ||||
| @@ -330,6 +330,40 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const File File::getLinkedTarget() const throw() | |||||
| { | |||||
| FSRef ref; | |||||
| Boolean targetIsAFolder, wasAliased; | |||||
| if (PlatformUtilities::makeFSRefFromPath (&ref, getFullPathName()) | |||||
| && (FSResolveAliasFileWithMountFlags (&ref, true, &targetIsAFolder, &wasAliased, 0) == noErr) | |||||
| && wasAliased) | |||||
| { | |||||
| return File (PlatformUtilities::makePathFromFSRef (&ref)); | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| //============================================================================== | |||||
| bool File::moveToTrash() const throw() | |||||
| { | |||||
| if (! exists()) | |||||
| return true; | |||||
| const ScopedAutoReleasePool pool; | |||||
| NSString* p = juceStringToNS (getFullPathName()); | |||||
| return [[NSWorkspace sharedWorkspace] | |||||
| performFileOperation: NSWorkspaceRecycleOperation | |||||
| source: [p stringByDeletingLastPathComponent] | |||||
| destination: @"" | |||||
| files: [NSArray arrayWithObject: [p lastPathComponent]] | |||||
| tag: nil ]; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| struct FindFileStruct | struct FindFileStruct | ||||
| { | { | ||||
| @@ -171,8 +171,14 @@ static ScreenSaverDefeater* screenSaverDefeater = 0; | |||||
| void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | ||||
| { | { | ||||
| if (screenSaverDefeater == 0) | |||||
| if (isEnabled) | |||||
| { | |||||
| deleteAndZero (screenSaverDefeater); | |||||
| } | |||||
| else if (screenSaverDefeater == 0) | |||||
| { | |||||
| screenSaverDefeater = new ScreenSaverDefeater(); | screenSaverDefeater = new ScreenSaverDefeater(); | ||||
| } | |||||
| } | } | ||||
| bool Desktop::isScreenSaverEnabled() throw() | bool Desktop::isScreenSaverEnabled() throw() | ||||
| @@ -109,6 +109,29 @@ bool juce_deleteFile (const String& fileName) throw() | |||||
| return DeleteFile (fileName) != 0; | return DeleteFile (fileName) != 0; | ||||
| } | } | ||||
| bool File::moveToTrash() const throw() | |||||
| { | |||||
| if (! exists()) | |||||
| return true; | |||||
| SHFILEOPSTRUCT fos; | |||||
| zerostruct (fos); | |||||
| // The string we pass in must be double null terminated.. | |||||
| String doubleNullTermPath (getFullPathName() + " "); | |||||
| TCHAR* p = (TCHAR*) (const TCHAR*) doubleNullTermPath; | |||||
| p [getFullPathName().length()] = 0; | |||||
| fos.wFunc = FO_DELETE; | |||||
| fos.hwnd = (HWND) 0; | |||||
| fos.pFrom = p; | |||||
| fos.pTo = NULL; | |||||
| fos.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION | |||||
| | FOF_NOCONFIRMMKDIR | FOF_RENAMEONCOLLISION; | |||||
| return SHFileOperation (&fos) == 0; | |||||
| } | |||||
| bool juce_moveFile (const String& source, const String& dest) throw() | bool juce_moveFile (const String& source, const String& dest) throw() | ||||
| { | { | ||||
| return MoveFile (source, dest) != 0; | return MoveFile (source, dest) != 0; | ||||
| @@ -501,6 +524,44 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return SetCurrentDirectory (getFullPathName()) != FALSE; | return SetCurrentDirectory (getFullPathName()) != FALSE; | ||||
| } | } | ||||
| //============================================================================== | |||||
| const File File::getLinkedTarget() const throw() | |||||
| { | |||||
| File result (*this); | |||||
| String p (getFullPathName()); | |||||
| if (! exists()) | |||||
| p += T(".lnk"); | |||||
| else if (getFileExtension() != T(".lnk")) | |||||
| return result; | |||||
| IShellLink* shellLink = 0; | |||||
| if (SUCCEEDED (CoCreateInstance (CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, | |||||
| IID_IShellLink, (LPVOID*) &shellLink))) | |||||
| { | |||||
| IPersistFile* persistFile; | |||||
| if (SUCCEEDED (shellLink->QueryInterface (IID_IPersistFile, (LPVOID*) &persistFile))) | |||||
| { | |||||
| if (SUCCEEDED (persistFile->Load ((const WCHAR*) p, STGM_READ)) | |||||
| && SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI))) | |||||
| { | |||||
| WIN32_FIND_DATA winFindData; | |||||
| WCHAR resolvedPath [MAX_PATH]; | |||||
| if (SUCCEEDED (shellLink->GetPath (resolvedPath, MAX_PATH, &winFindData, SLGP_UNCPRIORITY))) | |||||
| result = File (resolvedPath); | |||||
| } | |||||
| persistFile->Release(); | |||||
| } | |||||
| shellLink->Release(); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| template <class FindDataType> | template <class FindDataType> | ||||
| static void getFindFileInfo (FindDataType& findData, | static void getFindFileInfo (FindDataType& findData, | ||||
| @@ -2309,6 +2309,61 @@ void Desktop::setMousePosition (int x, int y) throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| class ScreenSaverDefeater : public Timer, | |||||
| public DeletedAtShutdown | |||||
| { | |||||
| public: | |||||
| ScreenSaverDefeater() throw() | |||||
| { | |||||
| startTimer (10000); | |||||
| timerCallback(); | |||||
| } | |||||
| ~ScreenSaverDefeater() {} | |||||
| void timerCallback() | |||||
| { | |||||
| if (Process::isForegroundProcess()) | |||||
| { | |||||
| // simulate a shift key getting pressed.. | |||||
| INPUT input[2]; | |||||
| input[0].type = INPUT_KEYBOARD; | |||||
| input[0].ki.wVk = VK_SHIFT; | |||||
| input[0].ki.dwFlags = 0; | |||||
| input[0].ki.dwExtraInfo = 0; | |||||
| input[1].type = INPUT_KEYBOARD; | |||||
| input[1].ki.wVk = VK_SHIFT; | |||||
| input[1].ki.dwFlags = KEYEVENTF_KEYUP; | |||||
| input[1].ki.dwExtraInfo = 0; | |||||
| SendInput (2, input, sizeof (INPUT)); | |||||
| } | |||||
| } | |||||
| }; | |||||
| static ScreenSaverDefeater* screenSaverDefeater = 0; | |||||
| void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | |||||
| { | |||||
| if (isEnabled) | |||||
| { | |||||
| deleteAndZero (screenSaverDefeater); | |||||
| } | |||||
| else if (screenSaverDefeater == 0) | |||||
| { | |||||
| screenSaverDefeater = new ScreenSaverDefeater(); | |||||
| } | |||||
| } | |||||
| bool Desktop::isScreenSaverEnabled() throw() | |||||
| { | |||||
| return screenSaverDefeater == 0; | |||||
| } | |||||
| /* (The code below is the "correct" way to disable the screen saver, but it | |||||
| completely fails on winXP when the saver is password-protected...) | |||||
| static bool juce_screenSaverEnabled = true; | static bool juce_screenSaverEnabled = true; | ||||
| void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | ||||
| @@ -2322,6 +2377,7 @@ bool Desktop::isScreenSaverEnabled() throw() | |||||
| { | { | ||||
| return juce_screenSaverEnabled; | return juce_screenSaverEnabled; | ||||
| } | } | ||||
| */ | |||||
| //============================================================================== | //============================================================================== | ||||
| void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable) | void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable) | ||||
| @@ -209,7 +209,7 @@ public: | |||||
| { | { | ||||
| MessageManager* const messageManager = MessageManager::getInstance(); | MessageManager* const messageManager = MessageManager::getInstance(); | ||||
| const int64 originalThreadId = messageManager->getCurrentMessageThread(); | |||||
| const Thread::ThreadID originalThreadId = messageManager->getCurrentMessageThread(); | |||||
| messageManager->setCurrentMessageThread (Thread::getCurrentThreadId()); | messageManager->setCurrentMessageThread (Thread::getCurrentThreadId()); | ||||
| while ((! threadShouldExit()) && messageManager->runDispatchLoopUntil (250)) | while ((! threadShouldExit()) && messageManager->runDispatchLoopUntil (250)) | ||||
| @@ -5,19 +5,22 @@ ifndef CONFIG | |||||
| CONFIG=Debug | CONFIG=Debug | ||||
| endif | endif | ||||
| # if multiple archs are defined turn off automated dependency generation | |||||
| DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD) | |||||
| ifeq ($(CONFIG),Debug) | ifeq ($(CONFIG),Debug) | ||||
| BINDIR := build | BINDIR := build | ||||
| LIBDIR := build | LIBDIR := build | ||||
| OBJDIR := build/intermediate/Debug | OBJDIR := build/intermediate/Debug | ||||
| OUTDIR := build | OUTDIR := build | ||||
| CPPFLAGS := -MMD -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | |||||
| CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | |||||
| CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -D_DEBUG -ggdb | CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -D_DEBUG -ggdb | ||||
| CXXFLAGS := $(CFLAGS) | |||||
| CXXFLAGS += $(CFLAGS) | |||||
| LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound | LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound | ||||
| LDDEPS := | LDDEPS := | ||||
| RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | ||||
| TARGET := jucedemo | TARGET := jucedemo | ||||
| BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) | |||||
| BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) | |||||
| endif | endif | ||||
| ifeq ($(CONFIG),Release) | ifeq ($(CONFIG),Release) | ||||
| @@ -25,39 +28,39 @@ ifeq ($(CONFIG),Release) | |||||
| LIBDIR := build | LIBDIR := build | ||||
| OBJDIR := build/intermediate/Release | OBJDIR := build/intermediate/Release | ||||
| OUTDIR := build | OUTDIR := build | ||||
| CPPFLAGS := -MMD -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | |||||
| CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | |||||
| CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2 | CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O2 | ||||
| CXXFLAGS := $(CFLAGS) | |||||
| CXXFLAGS += $(CFLAGS) | |||||
| LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -s -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound | LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -mwindows -s -L"/usr/X11R6/lib/" -L"../../../../bin" -lfreetype -lpthread -lrt -lX11 -lGL -lGLU -lXinerama -lasound | ||||
| LDDEPS := | LDDEPS := | ||||
| RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -I "/usr/include" -I "/usr/include/freetype2" | ||||
| TARGET := jucedemo | TARGET := jucedemo | ||||
| BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) | |||||
| BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) | |||||
| endif | endif | ||||
| OBJECTS := \ | OBJECTS := \ | ||||
| $(OBJDIR)/MainDemoWindow.o \ | |||||
| $(OBJDIR)/ApplicationStartup.o \ | $(OBJDIR)/ApplicationStartup.o \ | ||||
| $(OBJDIR)/juce_LibrarySource.o \ | |||||
| $(OBJDIR)/BinaryData.o \ | $(OBJDIR)/BinaryData.o \ | ||||
| $(OBJDIR)/PathsAndTransformsDemo.o \ | |||||
| $(OBJDIR)/juce_LibrarySource.o \ | |||||
| $(OBJDIR)/MainDemoWindow.o \ | |||||
| $(OBJDIR)/AudioDemo.o \ | |||||
| $(OBJDIR)/DragAndDropDemo.o \ | $(OBJDIR)/DragAndDropDemo.o \ | ||||
| $(OBJDIR)/ThreadingDemo.o \ | |||||
| $(OBJDIR)/FontsAndTextDemo.o \ | |||||
| $(OBJDIR)/InterprocessCommsDemo.o \ | |||||
| $(OBJDIR)/OpenGLDemo.o \ | $(OBJDIR)/OpenGLDemo.o \ | ||||
| $(OBJDIR)/WidgetsDemo.o \ | |||||
| $(OBJDIR)/TreeViewDemo.o \ | |||||
| $(OBJDIR)/PathsAndTransformsDemo.o \ | |||||
| $(OBJDIR)/QuickTimeDemo.o \ | $(OBJDIR)/QuickTimeDemo.o \ | ||||
| $(OBJDIR)/InterprocessCommsDemo.o \ | |||||
| $(OBJDIR)/AudioDemo.o \ | |||||
| $(OBJDIR)/FontsAndTextDemo.o \ | |||||
| $(OBJDIR)/TableDemo.o \ | $(OBJDIR)/TableDemo.o \ | ||||
| $(OBJDIR)/ThreadingDemo.o \ | |||||
| $(OBJDIR)/TreeViewDemo.o \ | |||||
| $(OBJDIR)/WidgetsDemo.o \ | |||||
| MKDIR_TYPE := msdos | MKDIR_TYPE := msdos | ||||
| CMD := $(subst \,\\,$(ComSpec)$(COMSPEC)) | CMD := $(subst \,\\,$(ComSpec)$(COMSPEC)) | ||||
| ifeq (,$(CMD)) | ifeq (,$(CMD)) | ||||
| MKDIR_TYPE := posix | MKDIR_TYPE := posix | ||||
| endif | endif | ||||
| ifeq (/bin/sh.exe,$(SHELL)) | |||||
| ifeq (/bin,$(findstring /bin,$(SHELL))) | |||||
| MKDIR_TYPE := posix | MKDIR_TYPE := posix | ||||
| endif | endif | ||||
| ifeq ($(MKDIR_TYPE),posix) | ifeq ($(MKDIR_TYPE),posix) | ||||
| @@ -84,87 +87,88 @@ $(OUTDIR)/$(TARGET): $(OBJECTS) $(LDDEPS) $(RESOURCES) | |||||
| clean: | clean: | ||||
| @echo Cleaning JuceDemo | @echo Cleaning JuceDemo | ||||
| ifeq ($(MKDIR_TYPE),posix) | ifeq ($(MKDIR_TYPE),posix) | ||||
| -@rm -rf $(OUTDIR)/$(TARGET) $(OBJDIR) | |||||
| -@rm -f $(OUTDIR)/$(TARGET) | |||||
| -@rm -rf $(OBJDIR) | |||||
| else | else | ||||
| -@if exist $(subst /,\,$(OUTDIR)/$(TARGET)) del /q $(subst /,\,$(OUTDIR)/$(TARGET)) | -@if exist $(subst /,\,$(OUTDIR)/$(TARGET)) del /q $(subst /,\,$(OUTDIR)/$(TARGET)) | ||||
| -@if exist $(subst /,\,$(OBJDIR)) del /q $(subst /,\,$(OBJDIR)) | -@if exist $(subst /,\,$(OBJDIR)) del /q $(subst /,\,$(OBJDIR)) | ||||
| -@if exist $(subst /,\,$(OBJDIR)) rmdir /s /q $(subst /,\,$(OBJDIR)) | -@if exist $(subst /,\,$(OBJDIR)) rmdir /s /q $(subst /,\,$(OBJDIR)) | ||||
| endif | endif | ||||
| $(OBJDIR)/MainDemoWindow.o: ../../src/MainDemoWindow.cpp | |||||
| $(OBJDIR)/ApplicationStartup.o: ../../src/ApplicationStartup.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/ApplicationStartup.o: ../../src/ApplicationStartup.cpp | |||||
| $(OBJDIR)/BinaryData.o: ../../src/BinaryData.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/juce_LibrarySource.o: ../../src/juce_LibrarySource.cpp | $(OBJDIR)/juce_LibrarySource.o: ../../src/juce_LibrarySource.cpp | ||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/BinaryData.o: ../../src/BinaryData.cpp | |||||
| $(OBJDIR)/MainDemoWindow.o: ../../src/MainDemoWindow.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/PathsAndTransformsDemo.o: ../../src/demos/PathsAndTransformsDemo.cpp | |||||
| $(OBJDIR)/AudioDemo.o: ../../src/demos/AudioDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/DragAndDropDemo.o: ../../src/demos/DragAndDropDemo.cpp | $(OBJDIR)/DragAndDropDemo.o: ../../src/demos/DragAndDropDemo.cpp | ||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/ThreadingDemo.o: ../../src/demos/ThreadingDemo.cpp | |||||
| $(OBJDIR)/FontsAndTextDemo.o: ../../src/demos/FontsAndTextDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/OpenGLDemo.o: ../../src/demos/OpenGLDemo.cpp | |||||
| $(OBJDIR)/InterprocessCommsDemo.o: ../../src/demos/InterprocessCommsDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/WidgetsDemo.o: ../../src/demos/WidgetsDemo.cpp | |||||
| $(OBJDIR)/OpenGLDemo.o: ../../src/demos/OpenGLDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/TreeViewDemo.o: ../../src/demos/TreeViewDemo.cpp | |||||
| $(OBJDIR)/PathsAndTransformsDemo.o: ../../src/demos/PathsAndTransformsDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/QuickTimeDemo.o: ../../src/demos/QuickTimeDemo.cpp | $(OBJDIR)/QuickTimeDemo.o: ../../src/demos/QuickTimeDemo.cpp | ||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/InterprocessCommsDemo.o: ../../src/demos/InterprocessCommsDemo.cpp | |||||
| $(OBJDIR)/TableDemo.o: ../../src/demos/TableDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/AudioDemo.o: ../../src/demos/AudioDemo.cpp | |||||
| $(OBJDIR)/ThreadingDemo.o: ../../src/demos/ThreadingDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/FontsAndTextDemo.o: ../../src/demos/FontsAndTextDemo.cpp | |||||
| $(OBJDIR)/TreeViewDemo.o: ../../src/demos/TreeViewDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| $(OBJDIR)/TableDemo.o: ../../src/demos/TableDemo.cpp | |||||
| $(OBJDIR)/WidgetsDemo.o: ../../src/demos/WidgetsDemo.cpp | |||||
| -@$(CMD_MKOBJDIR) | -@$(CMD_MKOBJDIR) | ||||
| @echo $(notdir $<) | @echo $(notdir $<) | ||||
| @$(CXX) $(CXXFLAGS) -o $@ -c $< | |||||
| @$(CXX) $(CXXFLAGS) -o "$@" -c "$<" | |||||
| -include $(OBJECTS:%.o=%.d) | -include $(OBJECTS:%.o=%.d) | ||||
| @@ -19240,11 +19240,11 @@ END_JUCE_NAMESPACE | |||||
| #if JUCE_QUICKTIME | #if JUCE_QUICKTIME | ||||
| #if ! defined (_WIN32) | #if ! defined (_WIN32) | ||||
| #include <Quicktime/Movies.h> | |||||
| #include <Quicktime/QTML.h> | |||||
| #include <Quicktime/QuickTimeComponents.h> | |||||
| #include <Quicktime/MediaHandlers.h> | |||||
| #include <Quicktime/ImageCodec.h> | |||||
| #include <QuickTime/Movies.h> | |||||
| #include <QuickTime/QTML.h> | |||||
| #include <QuickTime/QuickTimeComponents.h> | |||||
| #include <QuickTime/MediaHandlers.h> | |||||
| #include <QuickTime/ImageCodec.h> | |||||
| #else | #else | ||||
| #ifdef _MSC_VER | #ifdef _MSC_VER | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| @@ -21067,6 +21067,9 @@ void BufferingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info | |||||
| } | } | ||||
| nextPlayPos += info.numSamples; | nextPlayPos += info.numSamples; | ||||
| if (source->isLooping() && nextPlayPos > 0) | |||||
| nextPlayPos %= source->getTotalLength(); | |||||
| } | } | ||||
| SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); | SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); | ||||
| @@ -239808,6 +239811,29 @@ bool juce_deleteFile (const String& fileName) throw() | |||||
| return DeleteFile (fileName) != 0; | return DeleteFile (fileName) != 0; | ||||
| } | } | ||||
| bool File::moveToTrash() const throw() | |||||
| { | |||||
| if (! exists()) | |||||
| return true; | |||||
| SHFILEOPSTRUCT fos; | |||||
| zerostruct (fos); | |||||
| // The string we pass in must be double null terminated.. | |||||
| String doubleNullTermPath (getFullPathName() + " "); | |||||
| TCHAR* p = (TCHAR*) (const TCHAR*) doubleNullTermPath; | |||||
| p [getFullPathName().length()] = 0; | |||||
| fos.wFunc = FO_DELETE; | |||||
| fos.hwnd = (HWND) 0; | |||||
| fos.pFrom = p; | |||||
| fos.pTo = NULL; | |||||
| fos.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION | |||||
| | FOF_NOCONFIRMMKDIR | FOF_RENAMEONCOLLISION; | |||||
| return SHFileOperation (&fos) == 0; | |||||
| } | |||||
| bool juce_moveFile (const String& source, const String& dest) throw() | bool juce_moveFile (const String& source, const String& dest) throw() | ||||
| { | { | ||||
| return MoveFile (source, dest) != 0; | return MoveFile (source, dest) != 0; | ||||
| @@ -240190,6 +240216,42 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return SetCurrentDirectory (getFullPathName()) != FALSE; | return SetCurrentDirectory (getFullPathName()) != FALSE; | ||||
| } | } | ||||
| const File File::getLinkedTarget() const throw() | |||||
| { | |||||
| File result (*this); | |||||
| String p (getFullPathName()); | |||||
| if (! exists()) | |||||
| p += T(".lnk"); | |||||
| else if (getFileExtension() != T(".lnk")) | |||||
| return result; | |||||
| IShellLink* shellLink = 0; | |||||
| if (SUCCEEDED (CoCreateInstance (CLSID_ShellLink, 0, CLSCTX_INPROC_SERVER, | |||||
| IID_IShellLink, (LPVOID*) &shellLink))) | |||||
| { | |||||
| IPersistFile* persistFile; | |||||
| if (SUCCEEDED (shellLink->QueryInterface (IID_IPersistFile, (LPVOID*) &persistFile))) | |||||
| { | |||||
| if (SUCCEEDED (persistFile->Load ((const WCHAR*) p, STGM_READ)) | |||||
| && SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI))) | |||||
| { | |||||
| WIN32_FIND_DATA winFindData; | |||||
| WCHAR resolvedPath [MAX_PATH]; | |||||
| if (SUCCEEDED (shellLink->GetPath (resolvedPath, MAX_PATH, &winFindData, SLGP_UNCPRIORITY))) | |||||
| result = File (resolvedPath); | |||||
| } | |||||
| persistFile->Release(); | |||||
| } | |||||
| shellLink->Release(); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| template <class FindDataType> | template <class FindDataType> | ||||
| static void getFindFileInfo (FindDataType& findData, | static void getFindFileInfo (FindDataType& findData, | ||||
| String& filename, bool* const isDir, bool* const isHidden, | String& filename, bool* const isDir, bool* const isHidden, | ||||
| @@ -243556,6 +243618,61 @@ void Desktop::setMousePosition (int x, int y) throw() | |||||
| SetCursorPos (x, y); | SetCursorPos (x, y); | ||||
| } | } | ||||
| class ScreenSaverDefeater : public Timer, | |||||
| public DeletedAtShutdown | |||||
| { | |||||
| public: | |||||
| ScreenSaverDefeater() throw() | |||||
| { | |||||
| startTimer (10000); | |||||
| timerCallback(); | |||||
| } | |||||
| ~ScreenSaverDefeater() {} | |||||
| void timerCallback() | |||||
| { | |||||
| if (Process::isForegroundProcess()) | |||||
| { | |||||
| // simulate a shift key getting pressed.. | |||||
| INPUT input[2]; | |||||
| input[0].type = INPUT_KEYBOARD; | |||||
| input[0].ki.wVk = VK_SHIFT; | |||||
| input[0].ki.dwFlags = 0; | |||||
| input[0].ki.dwExtraInfo = 0; | |||||
| input[1].type = INPUT_KEYBOARD; | |||||
| input[1].ki.wVk = VK_SHIFT; | |||||
| input[1].ki.dwFlags = KEYEVENTF_KEYUP; | |||||
| input[1].ki.dwExtraInfo = 0; | |||||
| SendInput (2, input, sizeof (INPUT)); | |||||
| } | |||||
| } | |||||
| }; | |||||
| static ScreenSaverDefeater* screenSaverDefeater = 0; | |||||
| void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | |||||
| { | |||||
| if (isEnabled) | |||||
| { | |||||
| deleteAndZero (screenSaverDefeater); | |||||
| } | |||||
| else if (screenSaverDefeater == 0) | |||||
| { | |||||
| screenSaverDefeater = new ScreenSaverDefeater(); | |||||
| } | |||||
| } | |||||
| bool Desktop::isScreenSaverEnabled() throw() | |||||
| { | |||||
| return screenSaverDefeater == 0; | |||||
| } | |||||
| /* (The code below is the "correct" way to disable the screen saver, but it | |||||
| completely fails on winXP when the saver is password-protected...) | |||||
| static bool juce_screenSaverEnabled = true; | static bool juce_screenSaverEnabled = true; | ||||
| void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | ||||
| @@ -243569,6 +243686,7 @@ bool Desktop::isScreenSaverEnabled() throw() | |||||
| { | { | ||||
| return juce_screenSaverEnabled; | return juce_screenSaverEnabled; | ||||
| } | } | ||||
| */ | |||||
| void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable) | void juce_setKioskComponent (Component* kioskModeComponent, bool enableOrDisable) | ||||
| { | { | ||||
| @@ -254286,6 +254404,35 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| const File File::getLinkedTarget() const throw() | |||||
| { | |||||
| char buffer [4096]; | |||||
| size_t numChars = readlink ((const char*) getFullPathName().toUTF8(), | |||||
| buffer, sizeof (buffer)); | |||||
| if (numChars > 0 && numChars <= sizeof (buffer)) | |||||
| return File (String::fromUTF8 ((const uint8*) buffer, (int) numChars)); | |||||
| return *this; | |||||
| } | |||||
| bool File::moveToTrash() const throw() | |||||
| { | |||||
| if (! exists()) | |||||
| return true; | |||||
| File trashCan (T("~/.Trash")); | |||||
| if (! trashCan.isDirectory()) | |||||
| trashCan = T("~/.local/share/Trash/files"); | |||||
| if (! trashCan.isDirectory()) | |||||
| return false; | |||||
| return moveFileTo (trashCan.getNonexistentChildFile (getFileNameWithoutExtension(), | |||||
| getFileExtension())); | |||||
| } | |||||
| struct FindFileStruct | struct FindFileStruct | ||||
| { | { | ||||
| String parentDir, wildCard; | String parentDir, wildCard; | ||||
| @@ -254430,7 +254577,7 @@ bool juce_launchFile (const String& fileName, | |||||
| if (cmdString.startsWithIgnoreCase (T("file:"))) | if (cmdString.startsWithIgnoreCase (T("file:"))) | ||||
| cmdString = cmdString.substring (5); | cmdString = cmdString.substring (5); | ||||
| char* const argv[4] = { "/bin/sh", "-c", (char*) cmdString.toUTF8(), 0 }; | |||||
| const char* const argv[4] = { "/bin/sh", "-c", (const char*) cmdString.toUTF8(), 0 }; | |||||
| const int cpid = fork(); | const int cpid = fork(); | ||||
| @@ -254439,7 +254586,7 @@ bool juce_launchFile (const String& fileName, | |||||
| setsid(); | setsid(); | ||||
| // Child process | // Child process | ||||
| execve (argv[0], argv, environ); | |||||
| execve (argv[0], (char**) argv, environ); | |||||
| exit (0); | exit (0); | ||||
| } | } | ||||
| @@ -255147,8 +255294,8 @@ BEGIN_JUCE_NAMESPACE | |||||
| void Logger::outputDebugString (const String& text) throw() | void Logger::outputDebugString (const String& text) throw() | ||||
| { | { | ||||
| fprintf (stdout, text.toUTF8()); | |||||
| fprintf (stdout, "\n"); | |||||
| fputs (text.toUTF8(), stdout); | |||||
| fputs ("\n", stdout); | |||||
| } | } | ||||
| void Logger::outputDebugPrintf (const tchar* format, ...) throw() | void Logger::outputDebugPrintf (const tchar* format, ...) throw() | ||||
| @@ -264283,6 +264430,38 @@ bool File::setAsCurrentWorkingDirectory() const throw() | |||||
| return chdir (getFullPathName().toUTF8()) == 0; | return chdir (getFullPathName().toUTF8()) == 0; | ||||
| } | } | ||||
| const File File::getLinkedTarget() const throw() | |||||
| { | |||||
| FSRef ref; | |||||
| Boolean targetIsAFolder, wasAliased; | |||||
| if (PlatformUtilities::makeFSRefFromPath (&ref, getFullPathName()) | |||||
| && (FSResolveAliasFileWithMountFlags (&ref, true, &targetIsAFolder, &wasAliased, 0) == noErr) | |||||
| && wasAliased) | |||||
| { | |||||
| return File (PlatformUtilities::makePathFromFSRef (&ref)); | |||||
| } | |||||
| return *this; | |||||
| } | |||||
| bool File::moveToTrash() const throw() | |||||
| { | |||||
| if (! exists()) | |||||
| return true; | |||||
| const ScopedAutoReleasePool pool; | |||||
| NSString* p = juceStringToNS (getFullPathName()); | |||||
| return [[NSWorkspace sharedWorkspace] | |||||
| performFileOperation: NSWorkspaceRecycleOperation | |||||
| source: [p stringByDeletingLastPathComponent] | |||||
| destination: @"" | |||||
| files: [NSArray arrayWithObject: [p lastPathComponent]] | |||||
| tag: nil ]; | |||||
| } | |||||
| struct FindFileStruct | struct FindFileStruct | ||||
| { | { | ||||
| String parentDir, wildCard; | String parentDir, wildCard; | ||||
| @@ -264628,8 +264807,14 @@ static ScreenSaverDefeater* screenSaverDefeater = 0; | |||||
| void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() | ||||
| { | { | ||||
| if (screenSaverDefeater == 0) | |||||
| if (isEnabled) | |||||
| { | |||||
| deleteAndZero (screenSaverDefeater); | |||||
| } | |||||
| else if (screenSaverDefeater == 0) | |||||
| { | |||||
| screenSaverDefeater = new ScreenSaverDefeater(); | screenSaverDefeater = new ScreenSaverDefeater(); | ||||
| } | |||||
| } | } | ||||
| bool Desktop::isScreenSaverEnabled() throw() | bool Desktop::isScreenSaverEnabled() throw() | ||||
| @@ -6341,6 +6341,12 @@ public: | |||||
| */ | */ | ||||
| bool isHidden() const throw(); | bool isHidden() const throw(); | ||||
| /** If this file is a link, this returns the file that it points to. | |||||
| If this file isn't actually link, it'll just return itself. | |||||
| */ | |||||
| const File getLinkedTarget() const throw(); | |||||
| /** Returns the last modification time of this file. | /** Returns the last modification time of this file. | ||||
| @returns the time, or an invalid time if the file doesn't exist. | @returns the time, or an invalid time if the file doesn't exist. | ||||
| @@ -6431,6 +6437,14 @@ public: | |||||
| */ | */ | ||||
| bool deleteRecursively() const throw(); | bool deleteRecursively() const throw(); | ||||
| /** Moves this file or folder to the trash. | |||||
| @returns true if the operation succeeded. It could fail if the trash is full, or | |||||
| if the file is write-protected, so you should check the return value | |||||
| and act appropriately. | |||||
| */ | |||||
| bool moveToTrash() const throw(); | |||||
| /** Moves or renames a file. | /** Moves or renames a file. | ||||
| Tries to move a file to a different location. | Tries to move a file to a different location. | ||||
| @@ -34,11 +34,11 @@ | |||||
| #if JUCE_QUICKTIME | #if JUCE_QUICKTIME | ||||
| #if ! defined (_WIN32) | #if ! defined (_WIN32) | ||||
| #include <Quicktime/Movies.h> | |||||
| #include <Quicktime/QTML.h> | |||||
| #include <Quicktime/QuickTimeComponents.h> | |||||
| #include <Quicktime/MediaHandlers.h> | |||||
| #include <Quicktime/ImageCodec.h> | |||||
| #include <QuickTime/Movies.h> | |||||
| #include <QuickTime/QTML.h> | |||||
| #include <QuickTime/QuickTimeComponents.h> | |||||
| #include <QuickTime/MediaHandlers.h> | |||||
| #include <QuickTime/ImageCodec.h> | |||||
| #else | #else | ||||
| #ifdef _MSC_VER | #ifdef _MSC_VER | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| @@ -244,6 +244,9 @@ void BufferingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info | |||||
| } | } | ||||
| nextPlayPos += info.numSamples; | nextPlayPos += info.numSamples; | ||||
| if (source->isLooping() && nextPlayPos > 0) | |||||
| nextPlayPos %= source->getTotalLength(); | |||||
| } | } | ||||
| SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); | SharedBufferingAudioSourceThread* const thread = SharedBufferingAudioSourceThread::getInstanceWithoutCreating(); | ||||
| @@ -352,6 +352,12 @@ public: | |||||
| */ | */ | ||||
| bool isHidden() const throw(); | bool isHidden() const throw(); | ||||
| /** If this file is a link, this returns the file that it points to. | |||||
| If this file isn't actually link, it'll just return itself. | |||||
| */ | |||||
| const File getLinkedTarget() const throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the last modification time of this file. | /** Returns the last modification time of this file. | ||||
| @@ -444,6 +450,14 @@ public: | |||||
| */ | */ | ||||
| bool deleteRecursively() const throw(); | bool deleteRecursively() const throw(); | ||||
| /** Moves this file or folder to the trash. | |||||
| @returns true if the operation succeeded. It could fail if the trash is full, or | |||||
| if the file is write-protected, so you should check the return value | |||||
| and act appropriately. | |||||
| */ | |||||
| bool moveToTrash() const throw(); | |||||
| /** Moves or renames a file. | /** Moves or renames a file. | ||||
| Tries to move a file to a different location. | Tries to move a file to a different location. | ||||