Mac OS X: removed dependency from AudioToolbox.framework by calling NSBeep() from Cocoa.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8135 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-12-29 11:33:42 +00:00
parent d3d16a354e
commit dbb7be0fee
6 changed files with 19 additions and 43 deletions

View File

@ -60,7 +60,7 @@ if(APPLE)
set(HAVE_STRTOLL 1)
set(HAVE_STRCASECMP 1)
set(HAVE_DIRENT_H 1)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework Carbon -framework AudioToolBox")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa -framework Carbon")
endif(APPLE)
if(WIN32)

View File

@ -299,8 +299,7 @@ TODO: Build Rules
If the little helpers above were installed, the menu "File > New Project..."
will pop up a dialog that offers a User Template named Fluid. Select it and
follow the instructions. You will need to add the "AudioToolbox.framework"
manually which is needed to create warning beeps.
follow the instructions.
@ -310,3 +309,4 @@ manually which is needed to create warning beeps.
Oct 29 2010 - matt: removed warnings
Oct 24 2010 - matt: restructured entire document and verified instructions
Dec 19 2010 - Manolo: corrected typos
Dec 29 2010 - Manolo: removed reference to AudioToolbox.framework that's no longer needed

View File

@ -843,7 +843,7 @@ case $uname_GUI in
Darwin*)
# MacOS X uses Cocoa for graphics. There are still some Carbon leftovers.
LIBS="$LIBS -framework Cocoa -framework Carbon -framework AudioToolbox"
LIBS="$LIBS -framework Cocoa -framework Carbon"
if test x$have_pthread = xyes; then
AC_DEFINE(HAVE_PTHREAD)

View File

@ -500,7 +500,6 @@
C96290C21274D0CF007D3CFE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; };
C96290E21274D0EF007D3CFE /* AGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C96290E11274D0EF007D3CFE /* AGL.framework */; };
C96290E61274D100007D3CFE /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C96290E51274D100007D3CFE /* OpenGL.framework */; };
C96290EC1274D134007D3CFE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C96290EB1274D133007D3CFE /* AudioToolbox.framework */; };
C962910E1274D1D7007D3CFE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; };
C96291151274D1FD007D3CFE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; };
C96291E712756D5E007D3CFE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFB1274D0B3007D3CFE /* Carbon.framework */; };
@ -4476,7 +4475,6 @@
C9628FFD1274D0B3007D3CFE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
C96290E11274D0EF007D3CFE /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = System/Library/Frameworks/AGL.framework; sourceTree = SDKROOT; };
C96290E51274D100007D3CFE /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
C96290EB1274D133007D3CFE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
C9EDD143127338F600ADB21C /* README.OSX.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.OSX.txt; path = ../../README.OSX.txt; sourceTree = SOURCE_ROOT; };
C9EDD4DE1274BB6600ADB21C /* png.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = png.h; path = ../../png/png.h; sourceTree = SOURCE_ROOT; };
C9EDD4DF1274BB6600ADB21C /* pngconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pngconf.h; path = ../../png/pngconf.h; sourceTree = SOURCE_ROOT; };
@ -5202,7 +5200,6 @@
files = (
C96290C11274D0CD007D3CFE /* Carbon.framework in Frameworks */,
C96290C21274D0CF007D3CFE /* Cocoa.framework in Frameworks */,
C96290EC1274D134007D3CFE /* AudioToolbox.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -6355,7 +6352,6 @@
C9628FFA1274D0A1007D3CFE /* Resources */ = {
isa = PBXGroup;
children = (
C96290EB1274D133007D3CFE /* AudioToolbox.framework */,
C9628FFB1274D0B3007D3CFE /* Carbon.framework */,
C9628FFD1274D0B3007D3CFE /* Cocoa.framework */,
C96290E11274D0EF007D3CFE /* AGL.framework */,

View File

@ -71,6 +71,7 @@ extern "C" {
#include <FL/Fl_Printer.H>
#include <FL/Fl_Input_.H>
#include <FL/Fl_Text_Display.H>
#include <FL/fl_ask.H>
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
@ -3271,6 +3272,17 @@ Window fl_xid(const Fl_Window* w)
return Fl_X::i(w)->xid;
}
void fl_beep(int type) {
switch (type) {
case FL_BEEP_DEFAULT :
case FL_BEEP_ERROR :
NSBeep();
break;
default :
break;
}
}
#endif // __APPLE__
//

View File

@ -47,12 +47,6 @@
#include <FL/x.H>
#include <FL/fl_draw.H>
#ifdef __APPLE__
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
# include <AudioToolbox/AudioServices.h>
# endif
#endif
static Fl_Window *message_form;
static Fl_Box *message;
static Fl_Box *icon;
@ -258,7 +252,7 @@ const char* fl_cancel= "Cancel"; ///< string pointer used in common dialogs, you
const char* fl_close= "Close"; ///< string pointer used in common dialogs, you can change it to a foreign language
// fltk functions:
#ifndef __APPLE__ // the Mac code is in file Fl_cocoa.mm
/**
Emits a system beep message.
\note \#include <FL/fl_ask.H>
@ -283,34 +277,6 @@ void fl_beep(int type) {
MessageBeep(0xFFFFFFFF);
break;
}
#elif defined(__APPLE__)
switch (type) {
case FL_BEEP_DEFAULT :
case FL_BEEP_ERROR :
// How Apple is not any better than Microsoft:
/* MacOS 8 */ // SysBeep(30);
/* OS X 10.1 */ // AlertSoundPlay();
/* OS X 10.5 */ // AudioServicesPlayAlertSound(kUserPreferredAlert);
/* OS X 10.6 */ // AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert);
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (AudioServicesPlayAlertSound!=0L)
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert);
# else
AudioServicesPlayAlertSound(kUserPreferredAlert);
# endif
else
# endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
AlertSoundPlay();
#else
{
}
#endif
break;
default :
break;
}
#else
switch (type) {
case FL_BEEP_DEFAULT :
@ -327,6 +293,8 @@ void fl_beep(int type) {
}
#endif // WIN32
}
#endif // __APPLE__
/** Shows an information message dialog box.
\note Common dialog boxes are application modal. No more than one common dialog box