]> git.saurik.com Git - wxWidgets.git/commitdiff
Removed some extraneous whitespace.
authorDavid Elliott <dfe@tgwbd.org>
Mon, 18 Oct 2004 21:41:34 +0000 (21:41 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Mon, 18 Oct 2004 21:41:34 +0000 (21:41 +0000)
Changed YES/NO to true/false; do not confuse BOOL (Objective-C) with bool (C++).
Changed some of the indentation to match that the rest of wxCocoa.

There was an if (isLastSoundInScope = NO) which I think was wrong not only
because it used NO rather than false but also because it's an assignment
rather than a test.  Changed it to if (!isLastSoundInScope).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29972 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/cocoa/sound.h
src/cocoa/sound.mm

index 03655103f9d8c4f2c01e7af3340d6bb7a6f7a66e..e9f71ccfe4c4c13bd37e4bdf0c2f7dafeed54f82 100644 (file)
 class WXDLLEXPORT wxSound : public wxSoundBase
 {
 public:
-  wxSound();
-  wxSound(const wxString& fileName, bool isResource = FALSE);
-  wxSound(int size, const wxByte* data);
-  ~wxSound();
+    wxSound();
+    wxSound(const wxString& fileName, bool isResource = false);
+    wxSound(int size, const wxByte* data);
+    ~wxSound();
 
 public:
-  bool  Create(const wxString& fileName, bool isResource = FALSE);
-  bool  IsOk() const { return m_hSnd != NULL; }
-  static void  Stop();
-  static bool IsPlaying();
+    bool Create(const wxString& fileName, bool isResource = false);
+    bool IsOk() const { return m_hSnd != NULL; }
+    static void Stop();
+    static bool IsPlaying();
 
-  inline WX_NSSound GetNSSound()
-  {            return m_hSnd;  }
+    inline WX_NSSound GetNSSound()
+    {   return m_hSnd; }
 protected:  
-  bool  DoPlay(unsigned flags) const;
+    bool DoPlay(unsigned flags) const;
 
 private:
     WX_NSSound m_hSnd; //NSSound handle
index dcfdd3acbd71f11821a1c3bc1c43a80bcb2eda80..7c2daa5cb26dc1109e5bcc71a15df5a8480e2c30 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2004-10-02
 // RCS-ID:      $Id$
 // Copyright:   (c) Ryan Norton
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -32,8 +32,8 @@
 //
 
 WX_NSSound lastSound=NULL;
-bool isLastSoundLooping = NO;
-bool isLastSoundInScope = NO;
+bool isLastSoundLooping = false;
+bool isLastSoundInScope = false;
 
 // ========================================================================
 // wxNSSoundDelegate
@@ -52,7 +52,7 @@ bool isLastSoundInScope = NO;
 {
     if (bOK && isLastSoundLooping)
         [lastSound play];
-    else if (isLastSoundInScope = NO)
+    else if (!isLastSoundInScope)
     {
         [lastSound release];
         [self release];
@@ -66,18 +66,21 @@ bool isLastSoundInScope = NO;
 // ------------------------------------------------------------------
 
 wxSound::wxSound()
-: m_hSnd(NULL), m_waveLength(0)
+:   m_hSnd(NULL)
+,   m_waveLength(0)
 {
 }
 
 wxSound::wxSound(const wxString& sFileName, bool isResource)
-: m_hSnd(NULL), m_waveLength(0)
+:   m_hSnd(NULL)
+,   m_waveLength(0)
 {
     Create(sFileName, isResource);
 }
 
 wxSound::wxSound(int size, const wxByte* data)
-: m_hSnd(NULL), m_waveLength(size)
+:   m_hSnd(NULL)
+,   m_waveLength(size)
 {
     NSData* theData = [[NSData alloc] dataWithBytesNoCopy:(void*)data length:size];
     m_hSnd = [[NSSound alloc] initWithData:theData];
@@ -93,7 +96,7 @@ wxSound::~wxSound()
         [m_cocoaSoundDelegate release];
     }
     else
-        isLastSoundInScope = NO;
+        isLastSoundInScope = false;
 }
 
 bool wxSound::Create(const wxString& fileName, bool isResource)
@@ -104,10 +107,12 @@ bool wxSound::Create(const wxString& fileName, bool isResource)
 
     if (isResource)
     {
-            //oftype could be @"snd" @"wav" or @"aiff", nil or @"" autodetects (?)
-        m_hSnd = [[NSSound alloc] initWithContentsOfFile:
-            [[NSBundle mainBundle] pathForResource:wxNSStringWithWxString(fileName) ofType:nil] 
-            byReference:NO];    
+        //oftype could be @"snd" @"wav" or @"aiff"; nil or @"" autodetects (?)
+        m_hSnd = [[NSSound alloc]
+            initWithContentsOfFile:[[NSBundle mainBundle]
+                    pathForResource:wxNSStringWithWxString(fileName)
+                    ofType:nil]
+            byReference:YES];
     }
     else
             m_hSnd = [[NSSound alloc] initWithContentsOfFile:wxNSStringWithWxString(fileName) byReference:YES];
@@ -120,7 +125,7 @@ bool wxSound::Create(const wxString& fileName, bool isResource)
 
 bool wxSound::DoPlay(unsigned flags) const
 {
-    wxASSERT_MSG(!( (flags & wxSOUND_SYNC) && (flags & wxSOUND_LOOP)), 
+    wxASSERT_MSG(!( (flags & wxSOUND_SYNC) && (flags & wxSOUND_LOOP)),
                 wxT("Invalid flag combination passed to wxSound::Play"));
 
     Stop();
@@ -129,18 +134,18 @@ bool wxSound::DoPlay(unsigned flags) const
     {
         lastSound = m_hSnd;
         isLastSoundLooping = (flags & wxSOUND_LOOP) == wxSOUND_LOOP;
-        isLastSoundInScope = YES;
-       [m_hSnd setDelegate:m_cocoaSoundDelegate];
+        isLastSoundInScope = true;
+        [m_hSnd setDelegate:m_cocoaSoundDelegate];
         return [m_hSnd play];
     }
     else
     {
         [m_hSnd setDelegate:nil];
-   
-           //play until done
+
+        //play until done
         bool bOK = [m_hSnd play];
-        
-        while ([m_hSnd isPlaying]) 
+
+        while ([m_hSnd isPlaying])
         {
             wxTheApp->Yield(false);
         }
@@ -157,15 +162,15 @@ void wxSound::Stop()
 {
     if (isLastSoundInScope)
     {
-        isLastSoundInScope = NO;
-        
+        isLastSoundInScope = false;
+
         //remember that even though we're
         //programatically stopping it, the
-        //delegate will still be called - 
+        //delegate will still be called -
         //so it will free the memory here
         [((NSSound*&)lastSound) stop];
     }
-    
+
     lastSound = nil;
 }