]> git.saurik.com Git - wxWidgets.git/commitdiff
Tidied space and tabs in wxMac files
authorJulian Smart <julian@anthemion.co.uk>
Fri, 28 Feb 2003 23:48:13 +0000 (23:48 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 28 Feb 2003 23:48:13 +0000 (23:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19397 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

202 files changed:
include/wx/mac/gauge.h
include/wx/mac/gdiobj.h
include/wx/mac/glcanvas.h
include/wx/mac/gsockmac.h
include/wx/mac/helpxxxx.h
include/wx/mac/icon.h
include/wx/mac/imaglist.h
include/wx/mac/joystick.h
include/wx/mac/listbox.h
include/wx/mac/listctrl.h
include/wx/mac/mdi.h
include/wx/mac/menu.h
include/wx/mac/menuitem.h
include/wx/mac/metafile.h
include/wx/mac/mimetype.h
include/wx/mac/minifram.h
include/wx/mac/msgdlg.h
include/wx/mac/notebook.h
include/wx/mac/palette.h
include/wx/mac/pen.h
include/wx/mac/pnghand.h
include/wx/mac/pngread.h
include/wx/mac/print.h
include/wx/mac/printdlg.h
include/wx/mac/printmac.h
include/wx/mac/private.h
include/wx/mac/radiobox.h
include/wx/mac/radiobut.h
include/wx/mac/region.h
include/wx/mac/scrolbar.h
include/wx/mac/setup0.h
include/wx/mac/slider.h
include/wx/mac/spinbutt.h
include/wx/mac/statbmp.h
include/wx/mac/statbox.h
include/wx/mac/stattext.h
include/wx/mac/tabctrl.h
include/wx/mac/taskbar.h
include/wx/mac/textctrl.h
include/wx/mac/timer.h
include/wx/mac/toolbar.h
include/wx/mac/toplevel.h
include/wx/mac/treectrl.h
include/wx/mac/uma.h
include/wx/mac/wave.h
include/wx/mac/window.h
src/mac/app.cpp
src/mac/bitmap.cpp
src/mac/bmpbuttn.cpp
src/mac/brush.cpp
src/mac/button.cpp
src/mac/carbon/app.cpp
src/mac/carbon/bitmap.cpp
src/mac/carbon/bmpbuttn.cpp
src/mac/carbon/brush.cpp
src/mac/carbon/button.cpp
src/mac/carbon/checkbox.cpp
src/mac/carbon/checklst.cpp
src/mac/carbon/choice.cpp
src/mac/carbon/clipbrd.cpp
src/mac/carbon/colordlg.cpp
src/mac/carbon/colour.cpp
src/mac/carbon/combobox.cpp
src/mac/carbon/control.cpp
src/mac/carbon/cursor.cpp
src/mac/carbon/data.cpp
src/mac/carbon/dataobj.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcclient.cpp
src/mac/carbon/dcmemory.cpp
src/mac/carbon/dcprint.cpp
src/mac/carbon/dcscreen.cpp
src/mac/carbon/dialog.cpp
src/mac/carbon/dirdlg.cpp
src/mac/carbon/dirmac.cpp
src/mac/carbon/display.cpp
src/mac/carbon/dnd.cpp
src/mac/carbon/filedlg.cpp
src/mac/carbon/font.cpp
src/mac/carbon/fontdlg.cpp
src/mac/carbon/fontenum.cpp
src/mac/carbon/frame.cpp
src/mac/carbon/gauge.cpp
src/mac/carbon/gdiobj.cpp
src/mac/carbon/glcanvas.cpp
src/mac/carbon/helpxxxx.cpp
src/mac/carbon/icon.cpp
src/mac/carbon/joystick.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/macnotfy.cpp
src/mac/carbon/main.cpp
src/mac/carbon/mdi.cpp
src/mac/carbon/menu.cpp
src/mac/carbon/menuitem.cpp
src/mac/carbon/metafile.cpp
src/mac/carbon/mimetmac.cpp
src/mac/carbon/minifram.cpp
src/mac/carbon/msgdlg.cpp
src/mac/carbon/notebmac.cpp
src/mac/carbon/palette.cpp
src/mac/carbon/pen.cpp
src/mac/carbon/pnghand.cpp
src/mac/carbon/printdlg.cpp
src/mac/carbon/printmac.cpp
src/mac/carbon/radiobox.cpp
src/mac/carbon/radiobut.cpp
src/mac/carbon/region.cpp
src/mac/carbon/scrolbar.cpp
src/mac/carbon/slider.cpp
src/mac/carbon/spinbutt.cpp
src/mac/carbon/statbmp.cpp
src/mac/carbon/statbox.cpp
src/mac/carbon/statbrma.cpp
src/mac/carbon/statlmac.cpp
src/mac/carbon/stattext.cpp
src/mac/carbon/tabctrl.cpp
src/mac/carbon/taskbar.cpp
src/mac/carbon/textctrl.cpp
src/mac/carbon/thread.cpp
src/mac/carbon/timer.cpp
src/mac/carbon/toolbar.cpp
src/mac/carbon/tooltip.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/treectrl.cpp
src/mac/carbon/uma.cpp
src/mac/carbon/utils.cpp
src/mac/carbon/utilsexc.cpp
src/mac/carbon/wave.cpp
src/mac/carbon/window.cpp
src/mac/checkbox.cpp
src/mac/checklst.cpp
src/mac/choice.cpp
src/mac/clipbrd.cpp
src/mac/colordlg.cpp
src/mac/colour.cpp
src/mac/combobox.cpp
src/mac/control.cpp
src/mac/cursor.cpp
src/mac/data.cpp
src/mac/dataobj.cpp
src/mac/dc.cpp
src/mac/dcclient.cpp
src/mac/dcmemory.cpp
src/mac/dcprint.cpp
src/mac/dcscreen.cpp
src/mac/dialog.cpp
src/mac/dirdlg.cpp
src/mac/dirmac.cpp
src/mac/display.cpp
src/mac/dnd.cpp
src/mac/filedlg.cpp
src/mac/font.cpp
src/mac/fontdlg.cpp
src/mac/fontenum.cpp
src/mac/frame.cpp
src/mac/gauge.cpp
src/mac/gdiobj.cpp
src/mac/glcanvas.cpp
src/mac/helpxxxx.cpp
src/mac/icon.cpp
src/mac/joystick.cpp
src/mac/listbox.cpp
src/mac/macnotfy.cpp
src/mac/main.cpp
src/mac/mdi.cpp
src/mac/menu.cpp
src/mac/menuitem.cpp
src/mac/metafile.cpp
src/mac/mimetmac.cpp
src/mac/minifram.cpp
src/mac/msgdlg.cpp
src/mac/notebmac.cpp
src/mac/palette.cpp
src/mac/pen.cpp
src/mac/pnghand.cpp
src/mac/printdlg.cpp
src/mac/printmac.cpp
src/mac/radiobox.cpp
src/mac/radiobut.cpp
src/mac/region.cpp
src/mac/scrolbar.cpp
src/mac/slider.cpp
src/mac/spinbutt.cpp
src/mac/statbmp.cpp
src/mac/statbox.cpp
src/mac/statbrma.cpp
src/mac/statlmac.cpp
src/mac/stattext.cpp
src/mac/tabctrl.cpp
src/mac/taskbar.cpp
src/mac/textctrl.cpp
src/mac/thread.cpp
src/mac/timer.cpp
src/mac/toolbar.cpp
src/mac/tooltip.cpp
src/mac/toplevel.cpp
src/mac/treectrl.cpp
src/mac/uma.cpp
src/mac/utils.cpp
src/mac/utilsexc.cpp
src/mac/wave.cpp
src/mac/window.cpp

index 849532b453c54447b915ca2c6b7af871e10a778e..29a8b71a5301b6e64ce386a503a84a216e34510d 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_GAUGE_H_
index 33905be3180ede8656c18db1e32183b9be474577..4030aa8d4132f21820d96d500edeb4ddcb1d7db0 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_GDIOBJ_H_
@@ -21,8 +21,8 @@
 class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
 public:
     inline wxGDIRefData()
-       {
-       }
+    {
+     }
 };
 
 #define M_GDIDATA ((wxGDIRefData *)m_refData)
index db2d418854467c625a99490f3049ac586d899d9f..dae7bff782cc63267cc7ce80b71998fec36f4472 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #if defined(__GNUG__) && !defined(__APPLE__)
@@ -92,17 +92,17 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
    wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
         wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
         const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas", 
-             int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
+          int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
 
    wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
         const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, 
-               const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
+        const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
 
    ~wxGLCanvas();
 
    bool Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
                const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-              int *attribList, const wxPalette& palette);
+           int *attribList, const wxPalette& palette);
 
    void SetCurrent();
    void SetColour(const char *colour);
@@ -115,9 +115,9 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
    // You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
    void OnSize(wxSizeEvent& event);
    
-        virtual void MacSuperChangedPosition() ;
-        virtual void MacTopLevelWindowChangedPosition() ;
-        void MacUpdateView() ;
+     virtual void MacSuperChangedPosition() ;
+     virtual void MacTopLevelWindowChangedPosition() ;
+     void MacUpdateView() ;
 
    inline wxGLContext* GetContext() const { return m_glContext; }
 
index 4ffdc1266a0df0fe967edb9b28a381aac9966ba4..6bb4a2aa71fe92ae01eda6d7abdc9c422684e0ad 100644 (file)
@@ -54,8 +54,8 @@ struct _GSocket
 
 struct _GAddress
 {
-  UInt32               m_host ;
-  UInt16               m_port ;
+  UInt32         m_host ;
+  UInt16         m_port ;
   GAddressType m_family;
   GSocketError m_error;
 };
index 188eb37306b045ab9e482adcca1fc20b69ed3814..9351360ce30412404875d461faf6dfc9af9dbbba 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_HELPXXXX_H_
index 93c2665d7a5757978ce7c1bc6762fda89bdc6587..aa5db567abb596013972aaa57c820ff536d9a1fe 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_ICON_H_
@@ -41,7 +41,7 @@ public:
   bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
       int desiredWidth /* = -1 */ , int desiredHeight = -1);
   bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
-       { return LoadFile( name , flags , -1 , -1 ) ; } 
+      { return LoadFile( name , flags , -1 , -1 ) ; } 
 
   inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
   inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
@@ -60,9 +60,9 @@ class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
 public:
   inline wxICONFileHandler()
   {
-       m_name = "ICO icon file";
-       m_extension = "ico";
-       m_type = wxBITMAP_TYPE_ICO;
+    m_name = "ICO icon file";
+    m_extension = "ico";
+    m_type = wxBITMAP_TYPE_ICO;
   };
 
   virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
@@ -76,9 +76,9 @@ class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
 public:
   inline wxICONResourceHandler()
   {
-       m_name = "ICON resource";
-       m_extension = "";
-       m_type = wxBITMAP_TYPE_ICON_RESOURCE;
+    m_name = "ICON resource";
+    m_extension = "";
+    m_type = wxBITMAP_TYPE_ICON_RESOURCE;
   };
 
   virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
index 6be49880d6abb96adfa5ae933887ded6dfa00853..c8fd74617707f638e995017fd600e793ecad622d 100644 (file)
@@ -8,7 +8,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_IMAGLIST_H_
index bc284dd2004dc3ca838f77e9810df29bbc083e35..e1138391be08267a0b97a2ec35b183e05909ee8b 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_JOYSTICK_H_
index 3608f7eb324b0a826edc7f613eb863e7bafd6df2..0d8f38b53e626e0d28ae0a2fc43887860478a3c3 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 
@@ -94,7 +94,7 @@ public:
     virtual void* DoGetItemClientData(int n) const;
     virtual void DoSetItemClientObject(int n, wxClientData* clientData);
     virtual wxClientData* DoGetItemClientObject(int n) const;
-    virtual void        DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
+    virtual void       DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
 
     // wxCheckListBox support
 #if wxUSE_OWNER_DRAWN
@@ -112,7 +112,7 @@ public:
 
     virtual void    SetupColours();
     virtual void    MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
-       virtual bool MacCanFocus() const { return true ; }
+       virtual bool MacCanFocus() const { return true ; }
     void OnChar(wxKeyEvent& event);
 
     void*           m_macList ;
@@ -145,8 +145,8 @@ protected:
 
     int m_noItems;
     int m_selected;
-       wxString  m_typeIn ;
-       long      m_lastTypeIn ;
+    wxString  m_typeIn ;
+    long      m_lastTypeIn ;
 
     virtual wxSize DoGetBestSize() const;
 
index 2171e0fcf1e63a352e3dc0d032d50fdf72bf3416..ee6f1e3df9fe3ba95189253278923c91d8336de1 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_LISTCTRL_H_
index 38882726869b9ecd4848b4a0adfd112946139e29..a9be83cc8abfb23865092a457469cafd6c919603 100644 (file)
@@ -8,7 +8,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_MDI_H_
index ea1159e932c12a30214ccb5d1e1f1dd4b8a479fb..ed73c5ed3e46c190b8b793125c9a3251c4e8564b 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_MENU_H_
@@ -57,9 +57,9 @@ public:
     // implementation only from now on
     // -------------------------------
 
-       int     MacGetIndexFromId( int id ) ; 
-       int     MacGetIndexFromItem( wxMenuItem *pItem ) ; 
-       void MacEnableMenu( bool bDoEnable ) ;
+      int    MacGetIndexFromId( int id ) ; 
+      int    MacGetIndexFromItem( wxMenuItem *pItem ) ;
+      void MacEnableMenu( bool bDoEnable ) ;
 
     // semi-private accessors
         // get the window which contains this menu
@@ -67,7 +67,7 @@ public:
         // get the menu handle
     WXHMENU GetHMenu() const { return m_hMenu; }
 
-       short MacGetMenuId() { return m_macMenuId ; }
+    short MacGetMenuId() { return m_macMenuId ; }
 
 private:
     // common part of all ctors
@@ -88,9 +88,9 @@ private:
     // the menu handle of this menu
     WXHMENU m_hMenu;
 
-       short                           m_macMenuId;
+      short                m_macMenuId;
 
-       static short            s_macNextMenuId ;
+      static short        s_macNextMenuId ;
 
     DECLARE_DYNAMIC_CLASS(wxMenu)
 };
@@ -146,11 +146,11 @@ public:
         // attach to a frame
     void Attach(wxFrame *frame);
 
-               // clear the invoking window for all menus and submenus
-       void UnsetInvokingWindow() ;
+        // clear the invoking window for all menus and submenus
+    void UnsetInvokingWindow() ;
 
-               // set the invoking window for all menus and submenus
-       void SetInvokingWindow( wxFrame* frame ) ;
+        // set the invoking window for all menus and submenus
+    void SetInvokingWindow( wxFrame* frame ) ;
 
     // if the menubar is modified, the display is not updated automatically,
     // call this function to update it (m_menuBarFrame should be !NULL)
@@ -171,7 +171,7 @@ protected:
     wxArrayString m_titles;
 
 private:
-  static wxMenuBar*                    s_macInstalledMenuBar ;
+  static wxMenuBar*            s_macInstalledMenuBar ;
 
     DECLARE_DYNAMIC_CLASS(wxMenuBar)
 };
index 92c5f8d5ec7c1b7956baaffc469046583b15284b..1b79af6591289c5454bebc5c6666ad1678ca7f89 100644 (file)
@@ -46,10 +46,10 @@ public:
     virtual void SetBitmap(const wxBitmap& bitmap) ;
     virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
 
-       // update the os specific representation
-       void UpdateItemBitmap() ;
-       void UpdateItemText() ;
-       void UpdateItemStatus() ;
+    // update the os specific representation
+    void UpdateItemBitmap() ;
+    void UpdateItemText() ;
+    void UpdateItemStatus() ;
 
     // mark item as belonging to the given radio group
     void SetAsRadioGroupStart();
index b2468e42d1956c9ee868d9e9b9ab8b6af6a81ab5..7184a9c79bf6544d221c06a1c72407cc835f2a8f 100644 (file)
@@ -8,7 +8,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 
index 475267c7badd051279df5f29805b6120b20f2ee3..021d360a6ea62100632703ae6c226acf0f5258c1 100644 (file)
@@ -71,7 +71,7 @@ public:
     // the first extension found, index 1 for the second and so on
     
     void Init(wxMimeTypesManagerImpl *manager, size_t index)
-       { m_manager = manager; m_index.Add(index); }
+    { m_manager = manager; m_index.Add(index); }
 
     // initialize us with our file type name
     void SetFileType(const wxString& strFileType)
@@ -98,10 +98,10 @@ public:
     // remove the record for this file type
     // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
     bool Unassociate(wxFileType *ft)
-       {
-           return m_manager->Unassociate(ft);
-       }
-    
+    {
+        return m_manager->Unassociate(ft);
+    }
+
     // set an arbitrary command, ask confirmation if it already exists and
     // overwriteprompt is TRUE
     bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE);
index 448e40f75afdb8d7b1a8ee2118b60bbaab1e69b8..6f606cd82fd4643266040d026effcc586e78c0af 100644 (file)
@@ -8,7 +8,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_MINIFRAM_H_
index 833d3c44425eb4a7970981b7f01f6a207f9ac05a..1acd4b3ad6610123d13625f9813016d8e9d740ec 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_MSGBOXDLG_H_
index c1bf4c42d4f229660adc3152dfb55a2cf08a4cf3..316cb94f1bc9258cb2c4ef3e07acdb5ef65315e8 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_NOTEBOOK_H_
@@ -135,7 +135,7 @@ public:
   virtual void Command(wxCommandEvent& event);
 protected:
     virtual wxNotebookPage *DoRemovePage(int page) ;
-       virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
+    virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
   // common part of all ctors
   void Init();
 
index b3508ee090b8c0dc2bb37c8ff475dcffe732d521..56962e91f3d8fbb0e6cd0a2d16a5856128c28f43 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_PALETTE_H_
index 037493abbbc8cdba3b1bf07c1352aa9804684cf1..ca48f977ac7f95c56a3bb44e56b1d8356c6d8cb2 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_PEN_H_
index 426b0c448302be3b1969913743637172c403ded1..4fa01a942be28245285fce117d770fe2f388f483 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Microsoft, Julian Smart
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #if defined(__GNUG__) && !defined(__APPLE__)
@@ -22,9 +22,9 @@ class WXDLLEXPORT wxPNGFileHandler: public wxBitmapHandler
 public:
   inline wxPNGFileHandler(void)
   {
-       m_name = "PNG bitmap file";
-       m_extension = "bmp";
-       m_type = wxBITMAP_TYPE_PNG;
+    m_name = "PNG bitmap file";
+    m_extension = "bmp";
+    m_type = wxBITMAP_TYPE_PNG;
   };
 
   virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
index 8aa50a09d44520a0f3245db2279f3f46d6283007..a761a8470e543fb4e7a72e136f6d7ee81dd87ad0 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * File:       pngread.h
- * Purpose:    PNG file reader
- * Author:     Alejandro Aguilar Sierra/Julian Smart
- * Created:    1995
- * Copyright:  (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ * File:    pngread.h
+ * Purpose:    PNG file reader
+ * Author:    Alejandro Aguilar Sierra/Julian Smart
+ * Created:    1995
+ * Copyright:    (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
  *
  *
  */
@@ -25,30 +25,30 @@ typedef byte * ImagePointerType;
 
 typedef struct
 {
-       byte red;
-       byte green;
+    byte red;
+    byte green;
    byte blue;
 } rgb_color_struct;
 
 
-#define COLORTYPE_PALETTE      1
-#define COLORTYPE_COLOR                2
-#define COLORTYPE_ALPHA                4
+#define COLORTYPE_PALETTE    1
+#define COLORTYPE_COLOR        2
+#define COLORTYPE_ALPHA        4
 
 class wxPNGReader
 {
 protected:
   int filetype;
   char filename[255];
-  ImagePointerType RawImage;   //  Image data
+  ImagePointerType RawImage;      //  Image data
 
-  int Width, Height;                   //  Dimensions
-  int Depth;                   // (bits x pixel)
-  int ColorType;               // Bit 1 = Palette used
-                               // Bit 2 = Color used
-                               // Bit 3 = Alpha used
+  int Width, Height;               //  Dimensions
+  int Depth;             // (bits x pixel)
+  int ColorType;        // Bit 1 = Palette used
+                // Bit 2 = Color used
+                // Bit 3 = Alpha used
 
-  long EfeWidth;               // Efective Width
+  long EfeWidth;         // Efective Width
 
   void *lpbi;
   int bgindex;
@@ -98,9 +98,9 @@ public:
 class wxPNGReaderIter
 {
 protected:
-  int Itx, Ity;                                // Counters
+  int Itx, Ity;                // Counters
   int Stepx, Stepy;
-  ImagePointerType IterImage;                  //  Image pointer
+  ImagePointerType IterImage;          //  Image pointer
   wxPNGReader *ima;
 public:
 // Constructors
@@ -146,7 +146,7 @@ inline
 wxPNGReaderIter::wxPNGReaderIter(wxPNGReader *imax): ima(imax)
 {
   if (ima)
-        IterImage = ima->RawImage;
+     IterImage = ima->RawImage;
   Itx = Ity = 0;
   Stepx = Stepy = 0;
 }
@@ -161,9 +161,9 @@ inline
 bool wxPNGReaderIter::ItOK ()
 {
   if (ima)
-        return ima->Inside(Itx, Ity);
+     return ima->Inside(Itx, Ity);
   else
-        return FALSE;
+     return FALSE;
 }
 
 
@@ -209,7 +209,7 @@ inline void wxPNGReaderIter::SetRow(byte *buf, int n)
 // Here should be bcopy or memcpy
   //_fmemcpy(IterImage, (void far *)buf, n);
   if (n<0)
-        n = ima->GetWidth();
+     n = ima->GetWidth();
 
   for (int i=0; i<n; i++) IterImage[i] = buf[i];
 }
@@ -227,45 +227,45 @@ inline ImagePointerType wxPNGReaderIter::GetRow()
 inline bool wxPNGReaderIter::NextByte()
 {
   if (++Itx < ima->EfeWidth)
-        return 1;
+     return 1;
   else
-        if (++Ity < ima->Height)
-        {
-               IterImage += ima->EfeWidth;
-               Itx = 0;
-               return 1;
-        } else
-               return 0;
+     if (++Ity < ima->Height)
+     {
+        IterImage += ima->EfeWidth;
+        Itx = 0;
+        return 1;
+     } else
+        return 0;
 }
 
 inline bool wxPNGReaderIter::PrevByte()
 {
   if (--Itx >= 0)
-        return 1;
+     return 1;
   else
-        if (--Ity >= 0)
-        {
-               IterImage -= ima->EfeWidth;
-               Itx = 0;
-               return 1;
-        } else
-               return 0;
+     if (--Ity >= 0)
+     {
+        IterImage -= ima->EfeWidth;
+        Itx = 0;
+        return 1;
+     } else
+        return 0;
 }
 
 inline bool wxPNGReaderIter::NextStep()
 {
   Itx += Stepx;
   if (Itx < ima->EfeWidth)
-        return 1;
+     return 1;
   else {
-        Ity += Stepy;
-        if (Ity < ima->Height)
-        {
-               IterImage += ima->EfeWidth;
-               Itx = 0;
-               return 1;
-        } else
-               return 0;
+     Ity += Stepy;
+     if (Ity < ima->Height)
+     {
+        IterImage += ima->EfeWidth;
+        Itx = 0;
+        return 1;
+     } else
+        return 0;
   }
 }
 
@@ -273,16 +273,16 @@ inline bool wxPNGReaderIter::PrevStep()
 {
   Itx -= Stepx;
   if (Itx >= 0)
-        return 1;
-  else {       
-        Ity -= Stepy;
-        if (Ity >= 0 && Ity < ima->Height)
-        {
-               IterImage -= ima->EfeWidth;
-               Itx = 0;
-               return 1;
-        } else
-               return 0;
+     return 1;
+  else {
+     Ity -= Stepy;
+     if (Ity >= 0 && Ity < ima->Height)
+     {
+        IterImage -= ima->EfeWidth;
+        Itx = 0;
+        return 1;
+     } else
+        return 0;
   }
 }
 
index 5a7d5f1c43595764371ac437afbd86104665c2bb..fdaef230067b527948e6b0a9c894df942bcaa042 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_PRINT_H_
index bb0806af2e6f4907ab3300820374a082ea095220..28d35819464f2b11f839f5d4e84e8579380de348 100644 (file)
@@ -8,7 +8,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_PRINTDLG_H_
index 6e155b947079f6255da8440405ca82af0991d8ea..388f4dc796360fd12ab9b86d09a4b39b0f0bbfa4 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_PRINTWIN_H_
index c9315e988d6ecec533990fae27f92f0ebd9f1236..b69f5075868fc42c1b16d35ecff418ccc934f1c2 100644 (file)
@@ -8,7 +8,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_PRIVATE_H_
@@ -50,14 +50,14 @@ public:
     GrafPtr GetCurrentPort() { return m_currentPort ; }
 
 private:
-    GrafPtr          m_currentPort ;
-    GrafPtr          m_oldPort ;
-    RgnHandle        m_clip ;
+    GrafPtr          m_currentPort ;
+    GrafPtr          m_oldPort ;
+    RgnHandle          m_clip ;
     ThemeDrawingState m_drawingState ;
-    short            m_textFont ;
-    short            m_textSize ;
-    short            m_textStyle ;
-    short            m_textMode ;
+    short          m_textFont ;
+    short          m_textSize ;
+    short          m_textStyle ;
+    short           m_textMode ;
 } ;
 
 class WXDLLEXPORT wxMacPortSetter
@@ -123,12 +123,12 @@ WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
                                      OSType folderType,
                                      Boolean createFolder);
 
-GWorldPtr          wxMacCreateGWorld( int width , int height , int depth ) ;
-void                   wxMacDestroyGWorld( GWorldPtr gw ) ;
-PicHandle          wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
+GWorldPtr         wxMacCreateGWorld( int width , int height , int depth ) ;
+void                 wxMacDestroyGWorld( GWorldPtr gw ) ;
+PicHandle         wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
 CIconHandle     wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize  ) ;
-void                   wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green ,  int blue ) ;
-CTabHandle         wxMacCreateColorTable( int numColors ) ;
+void                 wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green ,  int blue ) ;
+CTabHandle         wxMacCreateColorTable( int numColors ) ;
 void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
 
 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
@@ -165,7 +165,7 @@ inline wxString wxMacMakeStringFromMacString( const char* from  )
 // converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
 inline wxString wxMacMakeStringFromMacString( const wxString& from  ) 
   { return wxApp::s_macDefaultEncodingIsPC ? 
-       wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
+      wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
 
 // 
 // Pascal Strings
index 531ba62a0125f165f2f5cecb1b859974608f5f10..f2262eea389ec2f67f080522a88bf03f1a969453 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_RADIOBOX_H_
@@ -23,65 +23,65 @@ class WXDLLEXPORT wxRadioButton ;
 
 class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
 {
-       DECLARE_DYNAMIC_CLASS(wxRadioBox)
+    DECLARE_DYNAMIC_CLASS(wxRadioBox)
 public:
 // Constructors & destructor
-       wxRadioBox();
-       inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
+    wxRadioBox();
+    inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
              const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
              int n = 0, const wxString choices[] = NULL,
              int majorDim = 0, long style = wxRA_HORIZONTAL,
              const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
-               {
-                       Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
-               }
-       ~wxRadioBox();
-       bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
+        {
+            Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
+        }
+    ~wxRadioBox();
+    bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
              const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
              int n = 0, const wxString choices[] = NULL,
              int majorDim = 0, long style = wxRA_HORIZONTAL,
              const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
 
 // Specific functions (in wxWindows2 reference)
-       virtual void SetSelection(int item);
-       virtual int GetSelection() const;
-       
-       inline virtual int GetCount() const { return m_noItems; } ;
+    virtual void SetSelection(int item);
+    virtual int GetSelection() const;
 
-       virtual wxString GetString(int item) const;
-       virtual void SetString(int item, const wxString& label) ;
-       
-       virtual void Enable(int item, bool enable);
-       virtual void Show(int item, bool show) ;
+    inline virtual int GetCount() const { return m_noItems; } ;
+
+    virtual wxString GetString(int item) const;
+    virtual void SetString(int item, const wxString& label) ;
+
+    virtual void Enable(int item, bool enable);
+    virtual void Show(int item, bool show) ;
 
     virtual int GetColumnCount() const ;
     virtual int GetRowCount() const ;
 
 
-       virtual bool Enable(bool enable = TRUE);
-       virtual wxString GetLabel() const;
-       virtual void SetLabel(const wxString& label) ;
-       virtual bool Show(bool show = TRUE);
+    virtual bool Enable(bool enable = TRUE);
+    virtual wxString GetLabel() const;
+    virtual void SetLabel(const wxString& label) ;
+    virtual bool Show(bool show = TRUE);
 
 // Other external functions 
-       void Command(wxCommandEvent& event);
-       void SetFocus();
+    void Command(wxCommandEvent& event);
+    void SetFocus();
 
 // Other variable access functions
-       inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
-       inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
+    inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
+    inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
 
-       void OnRadioButton( wxCommandEvent& event ) ;
+    void OnRadioButton( wxCommandEvent& event ) ;
 protected:
-       wxRadioButton           *m_radioButtonCycle;
-       
-       int               m_majorDim ;
-       int               m_noItems;
-       int               m_noRowsOrCols;
+    wxRadioButton        *m_radioButtonCycle;
+
+    int               m_majorDim ;
+    int               m_noItems;
+    int               m_noRowsOrCols;
 
 // Internal functions 
     virtual wxSize DoGetBestSize() const ;
-       virtual void DoSetSize(int x, int y,
+    virtual void DoSetSize(int x, int y,
                            int width, int height,
                            int sizeFlags = wxSIZE_AUTO);
 
index 23da10736b002009ad0070eb3342aca4ef58bf44..74dfccde46d7c10793f3c08e8006d38e74bd9ee1 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_RADIOBUT_H_
@@ -44,7 +44,7 @@ public:
 
     // implementation 
     
-       virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ); 
+      virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ); 
     void Command(wxCommandEvent& event);
     wxRadioButton *AddInCycle(wxRadioButton *cycle);
     inline wxRadioButton *NextInCycle() {return m_cycle;}
index 98c8107550ece24b3e63e036c667b02343e07b17..e91e4ab36df6b7f66953bbdb306acae763763c8c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_REGION_H_
@@ -24,7 +24,7 @@ class WXDLLEXPORT wxRect;
 class WXDLLEXPORT wxPoint;
 
 enum wxRegionContain {
-       wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
+    wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
 };
 
 // So far, for internal use only
@@ -38,7 +38,7 @@ wxRGN_XOR           // Creates the union of two combined regions except for any
 
 class WXDLLEXPORT wxRegion : public wxGDIObject {
 DECLARE_DYNAMIC_CLASS(wxRegion);
-       friend class WXDLLEXPORT wxRegionIterator;
+    friend class WXDLLEXPORT wxRegionIterator;
 public:
     wxRegion(long x, long y, long w, long h);
     wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
@@ -155,4 +155,4 @@ private:
 };
 
 #endif
-       // _WX_REGION_H_
+    // _WX_REGION_H_
index 90e46d698c2daee24ef971c8d9dc39aac6521369..0709b7e6c0a50b9d5847be0044c95c1a9386c2f6 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SCROLBAR_H_
@@ -57,7 +57,7 @@ public:
     bool refresh = TRUE);
 
   void Command(wxCommandEvent& event);
-               virtual void                                            MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
+        virtual void                         MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
 
 protected:
     int m_pageSize;
index c030b6d36d5c88ddbe1f0e80bb6764a135194e67..360e356636a7566b3e87d0518f51ce1319c59b9d 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SETUP_H_
 // that use the connection) should support forward only scrolling of cursors,
 // or both forward and backward support for backward scrolling cursors is
 // dependent on the data source as well as the ODBC driver being used.
-#define wxODBC_FWD_ONLY_CURSORS         1
+#define wxODBC_FWD_ONLY_CURSORS     1
 
 // Default is 0.  Set to 1 to use the deprecated classes, enum types, function,
 // member variables.  With a setting of 1, full backward compatability with the
index 7c52c5a54ad02532f0a8dd5da0ff2a505b97637f..caf89d18426f247c5d6605ef41e9d23c48c709ee 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SLIDER_H_
@@ -87,12 +87,12 @@ public:
      virtual void   DoMoveWindow(int x, int y, int w, int h);
  
   void Command(wxCommandEvent& event);
-       void                                    MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
-       virtual void            MacUpdateDimensions() ;
+    void                     MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
+    virtual void            MacUpdateDimensions() ;
 
-       wxStaticText*   m_macMinimumStatic ;
-       wxStaticText*   m_macMaximumStatic ;
-       wxStaticText*   m_macValueStatic ;
+     wxStaticText*    m_macMinimumStatic ;
+     wxStaticText*    m_macMaximumStatic ;
+     wxStaticText*    m_macValueStatic ;
 
   int           m_rangeMin;
   int           m_rangeMax;
index f11a058b47c9cf1d36d90207d152d351f550c23a..fb0bc70b3c788a38b4c717fef8be1da836ac59e0 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_SPINBUTT_H_
index 858c6da40bbbef026217b44d7207eea3dcb36595..55879e17fbb2e978c977a8db0bc17f270a9c0182 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_STATBMP_H_
@@ -50,8 +50,8 @@ class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase
   wxBitmap GetBitmap() const { return m_bitmap; }
   wxIcon GetIcon() const
       {
-         // icons and bitmaps are really the same thing in wxMac
-         return (const wxIcon &)m_bitmap;
+      // icons and bitmaps are really the same thing in wxMac
+      return (const wxIcon &)m_bitmap;
       }
   void  SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; }
 
@@ -61,7 +61,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase
 
  protected:
   wxBitmap m_bitmap;
-       DECLARE_EVENT_TABLE() 
+    DECLARE_EVENT_TABLE() 
 };
 
 #endif
index 4ea33efdcc428172ea14fafbba3f13b08941f20a..f3a68c5fcdd90fd691079aa64fb9b4e27273e640 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_STATBOX_H_
index fdd889d90dba2105f00f798a70f72d6034fefb8d..2105314cb8e302690d4e6446dd27ff1937ec959a 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_STATTEXT_H_
@@ -53,7 +53,7 @@ class WXDLLEXPORT wxStaticText: public wxStaticTextBase
   virtual wxSize DoGetBestSize() const ;
   virtual bool AcceptsFocus() const { return FALSE; }
  private :
-       wxString        m_label ;
+     wxString    m_label ;
 
    DECLARE_EVENT_TABLE()
 };
index dae86ff145c37a9bc9f3efefbb71daf9077271bc..7def1aa18347933e0aa0535a966b698085dcba08 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_TABCTRL_H_
index 64487aadac75f6467b2882f21d8fced1bf64f6d6..d896d3dfa21c5304071fc0da81bbd2f483cfa239 100644 (file)
@@ -1,13 +1,13 @@
 /////////////////////////////////////////////////////////////////////////
 // File:        taskbar.h
-// Purpose:        Defines wxTaskBarIcon class for manipulating icons on the
+// Purpose:        Defines wxTaskBarIcon class for manipulating icons on the
 //              task bar. Optional.
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c)
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_TASKBAR_H_
@@ -23,8 +23,8 @@
 class wxTaskBarIcon: public wxObject
 {
 public:
-       wxTaskBarIcon();
-       virtual ~wxTaskBarIcon();
+    wxTaskBarIcon();
+    virtual ~wxTaskBarIcon();
 
 // Accessors
 
index 4ef850483bafb939210ec059027f90ab5769f805..df241fbdcff8265549dbe173761e474405ce7570 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_TEXTCTRL_H_
@@ -151,11 +151,11 @@ public:
     void OnUpdateUndo(wxUpdateUIEvent& event);
     void OnUpdateRedo(wxUpdateUIEvent& event);
 
-       virtual bool MacCanFocus() const { return true ; }
+       virtual bool MacCanFocus() const { return true ; }
     virtual bool MacSetupCursor( const wxPoint& pt ) ;
 
-    virtual void        MacSuperShown( bool show ) ;
-    virtual bool        Show(bool show = TRUE) ;
+    virtual void      MacSuperShown( bool show ) ;
+    virtual bool     Show(bool show = TRUE) ;
 
 protected:
   virtual wxSize DoGetBestSize() const;
index dd3f5fd511ce936c9413b24f1ce2aaaa059aa4d5..3cc7bcd76dfc08eea29b542af070f9a4e147e360 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_TIMER_H_
@@ -26,8 +26,8 @@ struct MacTimerInfo ;
 class WXDLLEXPORT wxTimer: public wxTimerBase
 {
 public:
-       wxTimer() { Init(); }
-       wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); }
+    wxTimer() { Init(); }
+    wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); }
     ~wxTimer();
 
     virtual bool Start(int milliseconds = -1,
@@ -38,7 +38,7 @@ public:
 
     MacTimerInfo* m_info;
 protected :
-       void Init();
+    void Init();
 private:
 
     DECLARE_ABSTRACT_CLASS(wxTimer)
index 5ee32cf5511f0bd8f127ac5e549fb0b1ea99805c..fd64e322f51e4ab8c1c1c5a1b07a59bfd33747a6 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_TOOLBAR_H_
@@ -61,11 +61,11 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
 
   // Add all the buttons
 
-       virtual void MacHandleControlClick( WXWidget control , short controlpart ) ;
-       virtual wxString MacGetToolTipString( wxPoint &where ) ;
-       void OnPaint(wxPaintEvent& event) ;
-       void OnMouse(wxMouseEvent& event) ;
-       virtual void MacSuperChangedPosition() ;
+    virtual void MacHandleControlClick( WXWidget control , short controlpart ) ;
+    virtual wxString MacGetToolTipString( wxPoint &where ) ;
+    void OnPaint(wxPaintEvent& event) ;
+    void OnMouse(wxMouseEvent& event) ;
+    virtual void MacSuperChangedPosition() ;
 protected:
     // common part of all ctors
     void Init();
@@ -88,9 +88,9 @@ protected:
                                           const wxString& longHelp);
     virtual wxToolBarToolBase *CreateTool(wxControl *control);
 
-       wxArrayPtrVoid  m_macToolHandles ;
+    wxArrayPtrVoid    m_macToolHandles ;
 
-       DECLARE_EVENT_TABLE()
+    DECLARE_EVENT_TABLE()
 };
 
 #endif // wxUSE_TOOLBAR
index f101e5626d88db7549c0aa24e88bc5fe54075868..d6aea4496c4f68151b1246cc79d0bad411484da1 100644 (file)
@@ -93,7 +93,7 @@ public:
     short MacGetWindowBackgroundTheme() const { return m_macWindowBackgroundTheme ; }
 
 #if TARGET_CARBON
-       WXEVENTHANDLERREF       MacGetEventHandler() { return m_macEventHandler ; }
+    WXEVENTHANDLERREF    MacGetEventHandler() { return m_macEventHandler ; }
 #endif
 protected:
     // common part of all ctors
@@ -116,7 +116,7 @@ protected:
     static WXWindow s_macWindowInUpdate ;
 private :
 #if TARGET_CARBON
-       WXEVENTHANDLERREF       m_macEventHandler ;
+    WXEVENTHANDLERREF    m_macEventHandler ;
 #endif
 };
 
index 3ef738e5cce640dc1118cd759e64caf6e54ee326..058b5653e533cfd7337bf23aff6da4344e1738eb 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_TREECTRL_H_
index 676c3736d129a5186d3cb68d9eb4ce1ba011fdc1..f96f5d42a526d97364b357f31985742196f0e66c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     03/02/99
 // RCS-ID:      $Id: 
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef H_UMA
@@ -31,59 +31,59 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
 
 // menu manager
 
-MenuRef                UMANewMenu( SInt16 id , const wxString& title ) ;
-void                   UMASetMenuTitle( MenuRef menu , const wxString& title ) ;
-UInt32                         UMAMenuEvent( EventRecord *inEvent ) ;
-void                   UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;        
+MenuRef         UMANewMenu( SInt16 id , const wxString& title ) ;
+void             UMASetMenuTitle( MenuRef menu , const wxString& title ) ;
+UInt32             UMAMenuEvent( EventRecord *inEvent ) ;
+void             UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
 
-void                   UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 submenuid ) ;
-void                   UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 submenuid  ) ;
-void                   UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry = NULL  ) ;
-void                   UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
-void                   UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
+void            UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 submenuid ) ;
+void            UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 submenuid  ) ;
+void            UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry = NULL  ) ;
+void            UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
+void             UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
 
-void                   UMASetMenuItemText(  MenuRef menu,  MenuItemIndex item, const wxString& title ) ;
+void            UMASetMenuItemText(  MenuRef menu,  MenuItemIndex item, const wxString& title ) ;
 
 // quickdraw
 
-void                   UMAShowWatchCursor() ;
-void                   UMAShowArrowCursor() ;
+void            UMAShowWatchCursor() ;
+void            UMAShowArrowCursor() ;
 
-OSStatus               UMAPrOpen(void *macPrintSession) ;
-OSStatus               UMAPrClose(void *macPrintSession) ;
+OSStatus        UMAPrOpen(void *macPrintSession) ;
+OSStatus        UMAPrClose(void *macPrintSession) ;
 
 // window manager
 
-GrafPtr                UMAGetWindowPort( WindowRef inWindowRef ) ;
-void                   UMADisposeWindow( WindowRef inWindowRef ) ;
-void                   UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
-void                   UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
+GrafPtr        UMAGetWindowPort( WindowRef inWindowRef ) ;
+void             UMADisposeWindow( WindowRef inWindowRef ) ;
+void             UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
+void             UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
 
-void                   UMADrawGrowIcon( WindowRef inWindowRef ) ;
-void                   UMAShowHide( WindowRef inWindowRef , Boolean show) ;
+void             UMADrawGrowIcon( WindowRef inWindowRef ) ;
+void            UMAShowHide( WindowRef inWindowRef , Boolean show) ;
 
 // appearance manager
 
-void                   UMADrawControl( ControlHandle inControl ) ;
+void             UMADrawControl( ControlHandle inControl ) ;
 
-void                   UMAEnableControl( ControlHandle inControl ) ;
-void                   UMADisableControl( ControlHandle inControl ) ;
-void                   UMAActivateControl( ControlHandle inControl ) ;
-void                   UMADeactivateControl( ControlHandle inControl ) ;
-//                                                              ControlPartCode                hiliteState)    ;
-void UMAShowControl                                            (ControlHandle                  theControl)     ;
-void UMAHideControl                                            (ControlHandle                  theControl);
-void UMAActivateControl                                        (ControlHandle                  inControl);
-void UMADeactivateControl                              (ControlHandle                  inControl);
+void             UMAEnableControl( ControlHandle inControl ) ;
+void            UMADisableControl( ControlHandle inControl ) ;
+void             UMAActivateControl( ControlHandle inControl ) ;
+void            UMADeactivateControl( ControlHandle inControl ) ;
+//                                 ControlPartCode         hiliteState)    ;
+void UMAShowControl                        (ControlHandle             theControl)    ;
+void UMAHideControl                        (ControlHandle             theControl);
+void UMAActivateControl                    (ControlHandle             inControl);
+void UMADeactivateControl                (ControlHandle             inControl);
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
 void UMASizeControl( ControlHandle inControl , short x , short y ) ;
 // control hierarchy
 
 // keyboard focus
-OSErr UMASetKeyboardFocus                              (WindowPtr                              inWindow,
-                                                                ControlHandle                  inControl,
-                                                                ControlFocusPart               inPart) ;
+OSErr UMASetKeyboardFocus                (WindowPtr                 inWindow,
+                                 ControlHandle             inControl,
+                                 ControlFocusPart         inPart)    ;
 
 // events
 
@@ -91,8 +91,8 @@ void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ;
 OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
 
 // handling control data
-bool                   UMAIsWindowFloating( WindowRef inWindow ) ;
-bool                   UMAIsWindowModal( WindowRef inWindow ) ;
+bool            UMAIsWindowFloating( WindowRef inWindow ) ;
+bool            UMAIsWindowModal( WindowRef inWindow ) ;
 
 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;
 
index bdf3062040b8b1c5f3d9303dbe9972c21904c17b..9a9c17ca5f2030e2fd4d90345ad517d4a060c7eb 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_WAVE_H_
index ec8e81943bc3cf8f8c057e00435f69b2320d9708..86096d5948e1d8068c87a5ae376e84f9f7b3bffc 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifndef _WX_WINDOW_H_
@@ -38,7 +38,7 @@ class WXDLLEXPORT wxWindowMac: public wxWindowBase
     friend class wxPaintDC;
     
 public:
-       
+    
     wxWindowMac()
         : m_macBackgroundBrush()
         , m_macVisibleRegion()
@@ -155,7 +155,7 @@ public:
     void MacRootWindowToClient( int *x , int *y ) const ;
     void MacWindowToRootWindow( int *x , int *y ) const ;
     void MacRootWindowToWindow( int *x , int *y ) const ;
-       
+    
     virtual wxString MacGetToolTipString( wxPoint &where ) ;
 
     // simple accessors
@@ -163,7 +163,7 @@ public:
 
 //    WXHWND GetHWND() const { return m_hWnd; }
 //    void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
-       virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
+    virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
 
     bool GetUseCtl3D() const { return m_useCtl3D; }
     bool GetTransparentBackground() const { return m_backgroundTransparent; }
@@ -171,7 +171,7 @@ public:
 
     // event handlers
     // --------------
-       void OnSetFocus(wxFocusEvent& event) ;
+    void OnSetFocus(wxFocusEvent& event) ;
     void OnNcPaint(wxNcPaintEvent& event);
     void OnEraseBackground(wxEraseEvent& event);
     void OnIdle(wxIdleEvent& event);
@@ -233,7 +233,7 @@ public:
     static long          MacRemoveBordersFromStyle( long style ) ;
     virtual void         MacSuperChangedPosition() ;
     // the absolute coordinates of this item within the toplevel window may have changed
-    virtual void                MacUpdateDimensions() {}
+    virtual void         MacUpdateDimensions() {}
     // the absolute coortinates of this window's root have changed
     virtual void         MacTopLevelWindowChangedPosition() ;
     virtual void         MacSuperShown( bool show ) ;
index fcc04b18cb28d876a66335ab25f29c3aa3a39cba..48b2c379c82b09d37a907b4eabcdd63b10c74e2b 100644 (file)
@@ -289,21 +289,21 @@ void wxApp::MacNewFile()
 
 #if TARGET_CARBON
 
-       static const EventTypeSpec eventList[] = 
-       {
-           { kEventClassCommand, kEventProcessCommand } ,
-           { kEventClassCommand, kEventCommandUpdateStatus } ,
-           
-           { kEventClassApplication , kEventAppActivated } ,
-           { kEventClassApplication , kEventAppDeactivated } ,
-           // handling the quit event is not recommended by apple
-           // rather using the quit apple event - which we do
-           
-           { kEventClassAppleEvent , kEventAppleEvent } ,
-           
-       { kEventClassMouse , kEventMouseDown } ,
-       { 'WXMC' , 'WXMC' }
-       } ;
+    static const EventTypeSpec eventList[] = 
+    {
+        { kEventClassCommand, kEventProcessCommand } ,
+        { kEventClassCommand, kEventCommandUpdateStatus } ,
+        
+        { kEventClassApplication , kEventAppActivated } ,
+        { kEventClassApplication , kEventAppDeactivated } ,
+        // handling the quit event is not recommended by apple
+        // rather using the quit apple event - which we do
+        
+        { kEventClassAppleEvent , kEventAppleEvent } ,
+        
+        { kEventClassMouse , kEventMouseDown } ,
+        { 'WXMC' , 'WXMC' }
+    } ;
 
 static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
@@ -323,23 +323,23 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
     
     switch( GetEventKind(event) )
     {
-       case kEventMouseDown :
-       {
-                       Point point ;
-                       WindowRef window ;
-               
-                       GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
-                               sizeof( Point ), NULL, &point );
-                   short windowPart = ::FindWindow(point, &window);
-
-                       if ( windowPart == inMenuBar )
-                       {
-                               MenuSelect( point ) ;
-                               result = noErr ;
-                       }
-       }
-       break ;
-    }  
+        case kEventMouseDown :
+        {
+            Point point ;
+            WindowRef window ;
+        
+            GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
+                sizeof( Point ), NULL, &point );
+            short windowPart = ::FindWindow(point, &window);
+
+            if ( windowPart == inMenuBar )
+            {
+                MenuSelect( point ) ;
+                result = noErr ;
+            }
+        }
+        break ;
+    }    
 
     return result ;
 }
@@ -348,15 +348,15 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
 {
     OSStatus result = eventNotHandledErr ;
 
-       HICommand command ;
-       
-       GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
-               sizeof( HICommand ), NULL, &command );
+    HICommand command ;
+    
+    GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
+        sizeof( HICommand ), NULL, &command );
 
-       MenuCommand id = command.commandID ;
-       if ( id == kHICommandPreferences )
-               id = wxApp::s_macPreferencesMenuItemId ;
-               
+    MenuCommand id = command.commandID ;
+    if ( id == kHICommandPreferences )
+        id = wxApp::s_macPreferencesMenuItemId ;
+        
     wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
     wxMenu* menu = NULL ;
     wxMenuItem* item = NULL ;
@@ -365,28 +365,28 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
         item = mbar->FindItem( id , &menu ) ;
 
     if ( item == NULL || menu == NULL || mbar == NULL )
-       return result ;
-       
-       switch( GetEventKind( event ) )
-       {
-               case kEventProcessCommand :
-              {
-                       if (item->IsCheckable())
-                       {
-                           item->Check( !item->IsChecked() ) ;
-                       }
-                               
-                               menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
-                               result = noErr ;
-                       }
-                       break ;
-               case kEventCommandUpdateStatus:
-                       // eventually trigger an updateui round
-                               result = noErr ;
-                       break ;
-               default :
-                       break ;
-       }   
+        return result ;
+       
+       switch( GetEventKind( event ) )
+       {
+           case kEventProcessCommand :
+           {
+                if (item->IsCheckable())
+                {
+                    item->Check( !item->IsChecked() ) ;
+                }
+                
+                menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
+                result = noErr ;
+            }
+               break ;
+        case kEventCommandUpdateStatus:
+            // eventually trigger an updateui round
+                result = noErr ;
+            break ;
+           default :
+               break ;
+       }   
     
     return result ;
 }
@@ -394,23 +394,23 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
 static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     OSStatus result = eventNotHandledErr ;
-       switch ( GetEventKind( event ) )
-       {
-               case kEventAppActivated :
-                       {
-                               wxTheApp->MacResume( true ) ;
-                               result = noErr ;
-                       }
-                       break ;
-               case kEventAppDeactivated :
-                       {
-                               wxTheApp->MacSuspend( true ) ;
-                               result = noErr ;
-                       }
-                       break ;
-               default :
-                       break ;
-       }
+    switch ( GetEventKind( event ) )
+    {
+        case kEventAppActivated :
+            {
+                wxTheApp->MacResume( true ) ;
+                result = noErr ;
+            }
+            break ;
+        case kEventAppDeactivated :
+            {
+                wxTheApp->MacSuspend( true ) ;
+                result = noErr ;
+            }
+            break ;
+        default :
+            break ;
+    }
     return result ;
 }
 
@@ -419,27 +419,27 @@ pascal OSStatus wxAppEventHandler( EventHandlerCallRef handler , EventRef event
     OSStatus result = eventNotHandledErr ;
     switch( GetEventClass( event ) )
     {
-       case kEventClassCommand :
-               result = CommandEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassApplication :
-               result = ApplicationEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassMenu :
-               result = MenuEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassMouse :
-               result = MouseEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassAppleEvent :
-               {
-                       EventRecord rec ;
-                       wxMacConvertEventToRecord( event , &rec ) ;
-                       result = AEProcessAppleEvent( &rec ) ;
-               }
-               break ;
-       default :
-               break ;
+        case kEventClassCommand :
+            result = CommandEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassApplication :
+            result = ApplicationEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassMenu :
+            result = MenuEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassMouse :
+            result = MouseEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassAppleEvent :
+            {
+                EventRecord rec ;
+                wxMacConvertEventToRecord( event , &rec ) ;
+                result = AEProcessAppleEvent( &rec ) ;
+            }
+            break ;
+        default :
+            break ;
     }
 
     return result ;
@@ -532,7 +532,7 @@ bool wxApp::Initialize()
 
 #ifndef __DARWIN__
     // now avoid exceptions thrown for new (bad_alloc)
-       // FIXME CS for some changes outside wxMac does not compile anymore
+    // FIXME CS for some changes outside wxMac does not compile anymore
 #if 0
     std::__throws_bad_alloc = 0 ;
 #endif
@@ -593,17 +593,17 @@ bool wxApp::Initialize()
 
 bool wxApp::OnInitGui()
 {
-       if( !wxAppBase::OnInitGui() )
-               return false ;
-               
-#if TARGET_CARBON              
-       InstallStandardEventHandler( GetApplicationEventTarget() ) ;
-       
-       InstallApplicationEventHandler(
-               GetwxAppEventHandlerUPP(), 
-               GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));    
+    if( !wxAppBase::OnInitGui() )
+        return false ;
+        
+#if TARGET_CARBON        
+    InstallStandardEventHandler( GetApplicationEventTarget() ) ;
+    
+    InstallApplicationEventHandler(
+        GetwxAppEventHandlerUPP(), 
+        GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));    
 #endif
-               
+        
 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
     AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
                            NewAEEventHandlerUPP(AEHandleODoc) ,
@@ -632,7 +632,7 @@ bool wxApp::OnInitGui()
                            0 , FALSE ) ;
 #endif
 
-       return TRUE ;
+    return TRUE ;
 }
 
 void wxApp::CleanUp()
@@ -879,7 +879,7 @@ void wxStAppResource::CloseSharedLibraryResource()
 // the __wxinitialize and __wxterminate must be used
 
 extern "C" {
-    void __sinit(void);        /*      (generated by linker)   */
+    void __sinit(void);    /*    (generated by linker)    */
     pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
     pascal void __terminate(void);
 }
@@ -1149,14 +1149,14 @@ bool wxApp::Initialized()
 
 int wxApp::MainLoop()
 {
-       m_keepGoing = TRUE;
+    m_keepGoing = TRUE;
 
-       while (m_keepGoing)
-       {
-           MacDoOneEvent() ;
-       }
+    while (m_keepGoing)
+    {
+        MacDoOneEvent() ;
+    }
 
-       return 0;
+    return 0;
 }
 
 // Returns TRUE if more time is needed.
@@ -1171,18 +1171,18 @@ bool wxApp::ProcessIdle()
 
 void wxApp::ExitMainLoop()
 {
-       m_keepGoing = FALSE;
+      m_keepGoing = FALSE;
 }
 
 // Is a message/event pending?
 bool wxApp::Pending()
 {
 #if TARGET_CARBON
-       return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
+    return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
 #else
     EventRecord event ;
 
-       return EventAvail( everyEvent , &event ) ;
+      return EventAvail( everyEvent , &event ) ;
 #endif
 }
 
@@ -1336,39 +1336,39 @@ bool wxApp::Yield(bool onlyIfNeeded)
 #if wxUSE_THREADS
     YieldToAnyThread() ;
 #endif
-       // by definition yield should handle all non-processed events
+    // by definition yield should handle all non-processed events
 #if TARGET_CARBON
-       EventRef theEvent;
-
-       OSStatus status = noErr ;
-       do
-       {
-               s_inReceiveEvent = true ;
-               status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
-               s_inReceiveEvent = false ;
-               
-               if ( status == eventLoopTimedOutErr )
-               {
-                       // make sure next time the event loop will trigger idle events
-               sleepTime = kEventDurationNoWait ;
-               }
-               else if ( status == eventLoopQuitErr )
-               {
-                       // according to QA1061 this may also occur when a WakeUp Process
-                       // is executed
-               }
-               else
-               {
-                       MacHandleOneEvent( theEvent ) ;
-                       ReleaseEvent(theEvent);
-               }
-       } while( status == noErr ) ;
+    EventRef theEvent;
+
+    OSStatus status = noErr ;
+    do
+    {
+        s_inReceiveEvent = true ;
+        status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
+        s_inReceiveEvent = false ;
+        
+        if ( status == eventLoopTimedOutErr )
+        {
+            // make sure next time the event loop will trigger idle events
+            sleepTime = kEventDurationNoWait ;
+        }
+        else if ( status == eventLoopQuitErr )
+        {
+            // according to QA1061 this may also occur when a WakeUp Process
+            // is executed
+        }
+        else
+        {
+            MacHandleOneEvent( theEvent ) ;
+            ReleaseEvent(theEvent);
+        }
+    } while( status == noErr ) ;
 #else
     EventRecord event ;
 
-       // having a larger value here leads to large performance slowdowns
-       // so we cannot give background apps more processor time here
-       // we do so however having a large sleep value in the main event loop
+    // having a larger value here leads to large performance slowdowns
+    // so we cannot give background apps more processor time here
+    // we do so however having a large sleep value in the main event loop
     sleepTime = 0 ; 
 
     while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
@@ -1449,32 +1449,32 @@ void wxApp::MacConvertPublicToPrivateScrap()
 void wxApp::MacDoOneEvent()
 {
 #if TARGET_CARBON
-       EventRef theEvent;
+    EventRef theEvent;
 
-       s_inReceiveEvent = true ;
-       OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
-       s_inReceiveEvent = false ;
-       if ( status == eventLoopTimedOutErr )
-       {
+    s_inReceiveEvent = true ;
+    OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
+    s_inReceiveEvent = false ;
+    if ( status == eventLoopTimedOutErr )
+    {
         if ( wxTheApp->ProcessIdle() )
-               sleepTime = kEventDurationNoWait ;
+            sleepTime = kEventDurationNoWait ;
         else
-               sleepTime = kEventDurationForever ;
-       }
-       else if ( status == eventLoopQuitErr )
-       {
-               // according to QA1061 this may also occur when a WakeUp Process
-               // is executed
-       }
-       else
-       {
-               MacHandleOneEvent( theEvent ) ;
-               ReleaseEvent(theEvent);
-       }
+            sleepTime = kEventDurationForever ;
+    }
+    else if ( status == eventLoopQuitErr )
+    {
+        // according to QA1061 this may also occur when a WakeUp Process
+        // is executed
+    }
+    else
+    {
+        MacHandleOneEvent( theEvent ) ;
+        ReleaseEvent(theEvent);
+    }
 #else
-       EventRecord event ;
+      EventRecord event ;
 
-       EventMask eventMask = everyEvent ;
+    EventMask eventMask = everyEvent ;
 
     if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
     {
@@ -1490,9 +1490,9 @@ void wxApp::MacDoOneEvent()
             ::IdleControls( window ) ;
 
         if ( wxTheApp->ProcessIdle() )
-               sleepTime = 0 ;
+            sleepTime = 0 ;
         else
-               sleepTime = GetCaretTime() / 2 ;
+            sleepTime = GetCaretTime() / 2 ;
     }
     if ( event.what != kHighLevelEvent )
         SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v ,  event.where.h + 1 , event.where.v + 1 ) ;
@@ -1506,10 +1506,10 @@ void wxApp::MacDoOneEvent()
 void wxApp::MacHandleOneEvent( WXEVENTREF evr )
 {
 #if TARGET_CARBON
-       EventTargetRef theTarget;
-       theTarget = GetEventDispatcherTarget();
+    EventTargetRef theTarget;
+    theTarget = GetEventDispatcherTarget();
     m_macCurrentEvent = evr ;
-       SendEventToEventTarget ((EventRef) evr , theTarget);
+    SendEventToEventTarget ((EventRef) evr , theTarget);
 #else
     EventRecord* ev = (EventRecord*) evr ;
     m_macCurrentEvent = ev ;
@@ -1784,15 +1784,15 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr )
     WindowRef window;
 
     short windowPart = inNoWindow ;
-       if ( wxTheApp->s_captureWindow )
-       {
-               window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
-               windowPart = inContent ;
-       }
-       else
-       {
-               windowPart = ::FindWindow(ev->where, &window) ;
-       }
+    if ( wxTheApp->s_captureWindow )
+    {
+        window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
+        windowPart = inContent ;
+    }
+    else
+    {
+        windowPart = ::FindWindow(ev->where, &window) ;
+    }
 
     switch (windowPart)
     {
@@ -1990,14 +1990,14 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
         keycode = short(keyInfo & keyCodeMask) >> 8 ;
     }
     long keyval = wxMacTranslateKey(keychar, keycode) ;
-       long realkeyval = keyval ;
-       if ( keyval == keychar )
-       {
-               // we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
-               realkeyval = short(keymessage & charCodeMask) ;
-               keyval = wxToupper( keyval ) ;
-       }
-       
+    long realkeyval = keyval ;
+    if ( keyval == keychar )
+    {
+        // we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
+        realkeyval = short(keymessage & charCodeMask) ;
+        keyval = wxToupper( keyval ) ;
+    }
+    
     wxKeyEvent event(wxEVT_KEY_DOWN);
     bool handled = false ;
     event.m_shiftDown = modifiers & shiftKey;
@@ -2120,10 +2120,10 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
     }
     long keyval = wxMacTranslateKey(keychar, keycode) ;
 
-       if ( keyval == keychar )
-       {
-               keyval = wxToupper( keyval ) ;  
-       }
+    if ( keyval == keychar )
+    {
+        keyval = wxToupper( keyval ) ;    
+    }
     bool handled = false ;
 
     wxKeyEvent event(wxEVT_KEY_UP);
@@ -2248,15 +2248,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
 
                 wxWindow* currentMouseWindow = NULL ;
 
-                               if (s_captureWindow )
-                               {
-                                       currentMouseWindow = s_captureWindow ;
-                               }
-                               else
-                               {
-                               wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
-                                                                        &currentMouseWindow ) ;
-                           }
+                if (s_captureWindow )
+                {
+                    currentMouseWindow = s_captureWindow ;
+                }
+                else
+                {
+                    wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
+                                                             &currentMouseWindow ) ;
+                }
 
                 if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
                 {
@@ -2299,16 +2299,16 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
 
                 short windowPart = inNoWindow ;
 
-                               if ( s_captureWindow )
-                               {
-                                       window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
-                                       windowPart = inContent ;
-                               }
-                               else
-                               {
-                                       windowPart = ::FindWindow(ev->where, &window); 
-                               }
-                               
+                if ( s_captureWindow )
+                {
+                    window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
+                    windowPart = inContent ;
+                }
+                else
+                {
+                    windowPart = ::FindWindow(ev->where, &window); 
+                }
+                
                 switch (windowPart)
                 {
                     case inContent :
@@ -2358,8 +2358,8 @@ void wxApp::MacHandleMenuCommand( wxUint32 id )
         {
             item->Check( !item->IsChecked() ) ;
         }
-               
-               menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
+        
+        menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
 }
 
 #if !TARGET_CARBON
@@ -2384,7 +2384,7 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
     {
         MenuCommand id ;
         GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
-               MacHandleMenuCommand( id ) ;
+        MacHandleMenuCommand( id ) ;
     }
     HiliteMenu(0);
 }
index 212114ed9a6f4b15c350f3af3fb86bf9f3a502ed..a60d47d2ed6e224ae09a5e6090bc95358460fedc 100644 (file)
@@ -218,8 +218,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
 
     if ( mask )
     {
-       Rect r ;
-       GetPortBounds( image , &r ) ;
+        Rect r ;
+        GetPortBounds( image , &r ) ;
       LockPixels(GetGWorldPixMap(mask) ) ;
       CopyBits(GetPortBitMapForCopyBits(mask) ,
           &(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -229,8 +229,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
     }
     else
     {
-       Rect r ;
-       GetPortBounds( image , &r ) ;
+        Rect r ;
+        GetPortBounds( image , &r ) ;
         LockPixels(GetGWorldPixMap(image));
       CopyBits(GetPortBitMapForCopyBits(image) ,
           &(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -275,7 +275,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
   if ( clipRgn )
     GetRegionBounds( clipRgn , &portRect ) ;   
   else
-       GetPortBounds( wp , &portRect ) ;
+      GetPortBounds( wp , &portRect ) ;
   pict = OpenPicture(&portRect);   
   if(pict)  
   {
@@ -283,7 +283,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
     RGBBackColor( &white ) ;
     
     if ( clipRgn )
-       SetClip( clipRgn ) ;
+        SetClip( clipRgn ) ;
     
     LockPixels( GetGWorldPixMap( wp ) ) ;
     CopyBits(GetPortBitMapForCopyBits(wp),          
@@ -296,7 +296,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
   }
   SetGWorld( origPort , origDev ) ;
   if ( clipRgn )
-       DisposeRgn( clipRgn ) ;
+      DisposeRgn( clipRgn ) ;
   return pict;                  
 }
 
@@ -335,19 +335,19 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
                 info->contentType = kControlContentPictHandle ;
                 if ( bitmap.GetMask() )
                 {
-                                   info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
+                    info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
                }
                 else
                 {
-                                   info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
+                    info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
                 }
             }
         }
-               else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
-               {
-               info->contentType = kControlContentCIconHandle ;
-               info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
-               }
+        else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
+        {
+            info->contentType = kControlContentCIconHandle ;
+            info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
+        }
     }
 }
 
@@ -369,46 +369,46 @@ wxBitmapRefData::wxBitmapRefData()
 // TODO move this to a public function of Bitmap Ref
 static void DisposeBitmapRefData(wxBitmapRefData *data)
 {
-       if ( !data )
-               return ;
-               
-       switch (data->m_bitmapType)
-       {
-           case kMacBitmapTypePict :
-               {
-                   if ( data->m_hPict )
-                   {
-                       KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
-                       data->m_hPict = NULL ;
-                   }
-               }
-               break ;
-           case kMacBitmapTypeGrafWorld :
-               {
-                   if ( data->m_hBitmap )
-                   {
-                       wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
-                       data->m_hBitmap = NULL ;
-                   }
-               }
-               break ;
-           case kMacBitmapTypeIcon :
-               if ( data->m_hIcon )
-               {
-                   DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
-                   data->m_hIcon = NULL ;
-               }
-           
-           default :
-               // unkown type ?
-               break ;
-       }
+    if ( !data )
+        return ;
+        
+    switch (data->m_bitmapType)
+    {
+        case kMacBitmapTypePict :
+            {
+                if ( data->m_hPict )
+                {
+                    KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
+                    data->m_hPict = NULL ;
+                }
+            }
+            break ;
+        case kMacBitmapTypeGrafWorld :
+            {
+                if ( data->m_hBitmap )
+                {
+                    wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
+                    data->m_hBitmap = NULL ;
+                }
+            }
+            break ;
+        case kMacBitmapTypeIcon :
+            if ( data->m_hIcon )
+            {
+                DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
+                data->m_hIcon = NULL ;
+            }
+        
+        default :
+            // unkown type ?
+            break ;
+    }
     
-       if (data->m_bitmapMask)
-       {
-               delete data->m_bitmapMask;
-               data->m_bitmapMask = NULL;
-       }
+    if (data->m_bitmapMask)
+    {
+        delete data->m_bitmapMask;
+        data->m_bitmapMask = NULL;
+    }
 }
 
 wxBitmapRefData::~wxBitmapRefData()
@@ -642,8 +642,8 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
 {
     if (!M_BITMAPDATA)
         m_refData = new wxBitmapRefData;
-       else
-       DisposeBitmapRefData( M_BITMAPDATA ) ;
+    else
+        DisposeBitmapRefData( M_BITMAPDATA ) ;
     
     M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
     M_BITMAPDATA->m_hBitmap = bmp ;
@@ -654,8 +654,8 @@ void wxBitmap::SetHICON(WXHICON ico)
 {
     if (!M_BITMAPDATA)
         m_refData = new wxBitmapRefData;
-       else
-       DisposeBitmapRefData( M_BITMAPDATA ) ;
+    else
+        DisposeBitmapRefData( M_BITMAPDATA ) ;
     
     M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
     M_BITMAPDATA->m_hIcon = ico ;
@@ -666,8 +666,8 @@ void wxBitmap::SetPict(WXHMETAFILE pict)
 {
     if (!M_BITMAPDATA)
         m_refData = new wxBitmapRefData;
-       else
-       DisposeBitmapRefData( M_BITMAPDATA ) ;
+    else
+        DisposeBitmapRefData( M_BITMAPDATA ) ;
     
     M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
     M_BITMAPDATA->m_hPict = pict ;
@@ -820,26 +820,26 @@ wxImage wxBitmap::ConvertToImage() const
     GetGWorld( &origPort, &origDevice );
     if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
     {
-       tempPort = wxMacCreateGWorld( width , height , -1) ;
+        tempPort = wxMacCreateGWorld( width , height , -1) ;
     }
     else
     {
-       tempPort =  (GWorldPtr) GetHBITMAP() ;
-       }
-       LockPixels(GetGWorldPixMap(tempPort));
-       SetGWorld( tempPort, NULL);
-       if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
-       {
+        tempPort =  (GWorldPtr) GetHBITMAP() ;
+    }
+    LockPixels(GetGWorldPixMap(tempPort));
+    SetGWorld( tempPort, NULL);
+    if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
+    {
         Rect bitmaprect = { 0 , 0 , height, width };
-       if ( GetBitmapType() == kMacBitmapTypeIcon )
-       {
-               ::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
-               maskRgn = NewRgn() ;
-               BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ; 
+        if ( GetBitmapType() == kMacBitmapTypeIcon )
+        {
+            ::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
+            maskRgn = NewRgn() ;
+            BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ; 
         }
-       else
-               ::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
-       }
+         else
+             ::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
+    }
     // Copy data into image
     index = 0;
     for (int yy = 0; yy < height; yy++)
@@ -854,28 +854,28 @@ wxImage wxBitmap::ConvertToImage() const
             data[index + 1] = g;
             data[index + 2] = b;
             if ( maskRgn )
-            {  
-               Point pt ;
-               pt.h = xx ;
-               pt.v = yy ;
-               if ( !PtInRgn( pt , maskRgn ) )
-               {
+            {    
+                Point pt ;
+                pt.h = xx ;
+                pt.v = yy ;
+                if ( !PtInRgn( pt , maskRgn ) )
+                {
                     data[index    ] = mask_r;
                     data[index + 1] = mask_g;
                     data[index + 2] = mask_b;
-               }
+                }
             }
             else
             {
-                   if (mask)
-                   {
-                       if (mask->PointMasked(xx,yy))
-                       {
-                           data[index    ] = mask_r;
-                           data[index + 1] = mask_g;
-                           data[index + 2] = mask_b;
-                       }
-                   }
+                if (mask)
+                {
+                    if (mask->PointMasked(xx,yy))
+                    {
+                        data[index    ] = mask_r;
+                        data[index + 1] = mask_g;
+                        data[index + 2] = mask_b;
+                    }
+                }
             }
             index += 3;
         }
@@ -891,11 +891,11 @@ wxImage wxBitmap::ConvertToImage() const
     SetGWorld(origPort, origDevice);
     if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
     {
-       wxMacDestroyGWorld( tempPort ) ;
+        wxMacDestroyGWorld( tempPort ) ;
     }
     if ( maskRgn )
     {
-       DisposeRgn( maskRgn ) ;
+        DisposeRgn( maskRgn ) ;
     }
 
     return image;
@@ -1038,33 +1038,33 @@ WXHBITMAP wxBitmap::GetHBITMAP() const
 
 WXHMETAFILE wxBitmap::GetPict( bool *created ) const
 {
-       wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
+    wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
    
-       PicHandle picture = NULL ;       // This is the returned picture
-       if ( created )
-               (*created) = false ;
-       // If bitmap already in Pict format return pointer
-       if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
-          return M_BITMAPDATA->m_hPict;
-       }
-       else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
-          // Invalid bitmap
-          return NULL;
-       }
-       else
-       {
-               if ( GetMask() )
-               {
-                   picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
-               }
-               else
-               {
-                   picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
-               }
-               if ( created && picture )
-                       (*created) = true ;
+    PicHandle picture = NULL ;       // This is the returned picture
+    if ( created )
+        (*created) = false ;
+    // If bitmap already in Pict format return pointer
+    if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
+       return M_BITMAPDATA->m_hPict;
+    }
+    else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
+       // Invalid bitmap
+       return NULL;
+    }
+    else
+    {
+        if ( GetMask() )
+        {
+            picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
+        }
+        else
+        {
+            picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
+        }
+        if ( created && picture )
+            (*created) = true ;
     }
-       return picture ;
+     return picture ;
 }
 
 /*
index a98ad95896e0bdfbf1031615aa8b268fba0934a0..ebf802126278a3c96a90ea1d89260ee7e347e0e6 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -45,35 +45,35 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
         m_windowId = id;
 
     if ( width == -1 && bitmap.Ok())
-       width = bitmap.GetWidth() + 2*m_marginX;
+    width = bitmap.GetWidth() + 2*m_marginX;
 
     if ( height == -1 && bitmap.Ok())
-       height = bitmap.GetHeight() + 2*m_marginY;
+    height = bitmap.GetHeight() + 2*m_marginY;
 
-       Rect bounds ;
-       Str255 title ;
+    Rect bounds ;
+    Str255 title ;
     m_bmpNormal = bitmap;
-       wxBitmapRefData * bmap = NULL ;
-       
-       if ( m_bmpNormal.Ok() )
-               bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
+    wxBitmapRefData * bmap = NULL ;
+    
+    if ( m_bmpNormal.Ok() )
+        bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 
-               kControlBehaviorOffsetContents + 
-                   ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? 
-                   kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
-               (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-       
-       ControlButtonContentInfo info ;
-       wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
-       if ( info.contentType != kControlNoContent )
-       {
-           ::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 
+        kControlBehaviorOffsetContents + 
+            ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? 
+            kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
+          (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    ControlButtonContentInfo info ;
+    wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
+    if ( info.contentType != kControlNoContent )
+    {
+        ::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
     }
-       MacPostControlCreate() ;
+    MacPostControlCreate() ;
 
     return TRUE;
 }
index 5589004fbecc086716f464eb344438ef1c4bd0a3..d484314a2ce98af507fea1e9621cdd950f9ff496 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -112,17 +112,17 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
 }
 void wxBrush::Unshare()
 {
-       // Don't change shared data
-       if (!m_refData)
+    // Don't change shared data
+    if (!m_refData)
     {
-               m_refData = new wxBrushRefData();
-       }
+        m_refData = new wxBrushRefData();
+    }
     else
     {
-               wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
-               UnRef();
-               m_refData = ref;
-       }
+        wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
+        UnRef();
+        m_refData = ref;
+    }
 }
 
 void wxBrush::SetColour(const wxColour& col)
@@ -203,25 +203,27 @@ unsigned long wxBrush::GetMacThemeBackground( WXRECTPTR extent)  const
   }
 }
 
-short wxBrush::GetMacTheme()  const 
+short wxBrush::GetMacTheme() const 
 { 
-  return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); 
-};
+    return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); 
+}
 
 wxColour& wxBrush::GetColour() const 
-{ return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
+{
+    return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
+}
 
 int wxBrush::GetStyle() const 
 { 
-  return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); 
-};
+    return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); 
+}
 
 wxBitmap *wxBrush::GetStipple() const 
 { 
-  return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); 
-};
+    return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); 
+}
 
 wxMacBrushKind wxBrush::MacGetBrushKind()  const 
 { 
-  return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); 
-};
+    return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); 
+}
\ No newline at end of file
index ca997d69266e7382fb3a20fe7a6e1085ba936422..763048808eda4a392ceb7fd53ea906402ac8169b 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -34,23 +34,23 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
            const wxValidator& validator,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
+    Rect bounds ;
+    Str255 title ;
 
     if ( UMAHasAquaLayout() )
     {
         m_macHorizontalBorder = kMacOSXHorizontalBorder;
         m_macVerticalBorder = kMacOSXVerticalBorder;
     }
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlPushButtonProc , (long) this ) ;
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-       
-       MacPostControlCreate() ;
-       
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
+
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlPushButtonProc , (long) this ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    MacPostControlCreate() ;
+    
   return TRUE;
 }
 
@@ -65,19 +65,19 @@ void wxButton::SetDefault()
         parent->SetDefaultItem(this);
     }
 
-       Boolean inData;
-       if ( btnOldDefault && btnOldDefault->m_macControl )
-       {
-               inData = 0;
-               ::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
-                                                  kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
-       }
-       if ( (ControlHandle) m_macControl )
-       {
-               inData = 1;
-               ::SetControlData(  (ControlHandle) m_macControl , kControlButtonPart ,
-                                                  kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
-       }
+    Boolean inData;
+    if ( btnOldDefault && btnOldDefault->m_macControl )
+    {
+          inData = 0;
+        ::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
+                           kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+    }
+    if ( (ControlHandle) m_macControl )
+    {
+          inData = 1;
+        ::SetControlData(  (ControlHandle) m_macControl , kControlButtonPart ,
+                           kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+    }
 }
 
 wxSize wxButton::DoGetBestSize() const
@@ -85,7 +85,7 @@ wxSize wxButton::DoGetBestSize() const
   wxSize sz = GetDefaultSize() ;
   
   int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
-       
+    
   if (wBtn > sz.x) sz.x = wBtn;
   
   return sz ;
@@ -94,7 +94,7 @@ wxSize wxButton::DoGetBestSize() const
 wxSize wxButton::GetDefaultSize()
 {
     int wBtn = 70 ; 
-       int hBtn = 20 ;
+    int hBtn = 20 ;
 
     if ( UMAHasAquaLayout() )
     {
index fcc04b18cb28d876a66335ab25f29c3aa3a39cba..48b2c379c82b09d37a907b4eabcdd63b10c74e2b 100644 (file)
@@ -289,21 +289,21 @@ void wxApp::MacNewFile()
 
 #if TARGET_CARBON
 
-       static const EventTypeSpec eventList[] = 
-       {
-           { kEventClassCommand, kEventProcessCommand } ,
-           { kEventClassCommand, kEventCommandUpdateStatus } ,
-           
-           { kEventClassApplication , kEventAppActivated } ,
-           { kEventClassApplication , kEventAppDeactivated } ,
-           // handling the quit event is not recommended by apple
-           // rather using the quit apple event - which we do
-           
-           { kEventClassAppleEvent , kEventAppleEvent } ,
-           
-       { kEventClassMouse , kEventMouseDown } ,
-       { 'WXMC' , 'WXMC' }
-       } ;
+    static const EventTypeSpec eventList[] = 
+    {
+        { kEventClassCommand, kEventProcessCommand } ,
+        { kEventClassCommand, kEventCommandUpdateStatus } ,
+        
+        { kEventClassApplication , kEventAppActivated } ,
+        { kEventClassApplication , kEventAppDeactivated } ,
+        // handling the quit event is not recommended by apple
+        // rather using the quit apple event - which we do
+        
+        { kEventClassAppleEvent , kEventAppleEvent } ,
+        
+        { kEventClassMouse , kEventMouseDown } ,
+        { 'WXMC' , 'WXMC' }
+    } ;
 
 static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
@@ -323,23 +323,23 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
     
     switch( GetEventKind(event) )
     {
-       case kEventMouseDown :
-       {
-                       Point point ;
-                       WindowRef window ;
-               
-                       GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
-                               sizeof( Point ), NULL, &point );
-                   short windowPart = ::FindWindow(point, &window);
-
-                       if ( windowPart == inMenuBar )
-                       {
-                               MenuSelect( point ) ;
-                               result = noErr ;
-                       }
-       }
-       break ;
-    }  
+        case kEventMouseDown :
+        {
+            Point point ;
+            WindowRef window ;
+        
+            GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
+                sizeof( Point ), NULL, &point );
+            short windowPart = ::FindWindow(point, &window);
+
+            if ( windowPart == inMenuBar )
+            {
+                MenuSelect( point ) ;
+                result = noErr ;
+            }
+        }
+        break ;
+    }    
 
     return result ;
 }
@@ -348,15 +348,15 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
 {
     OSStatus result = eventNotHandledErr ;
 
-       HICommand command ;
-       
-       GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
-               sizeof( HICommand ), NULL, &command );
+    HICommand command ;
+    
+    GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
+        sizeof( HICommand ), NULL, &command );
 
-       MenuCommand id = command.commandID ;
-       if ( id == kHICommandPreferences )
-               id = wxApp::s_macPreferencesMenuItemId ;
-               
+    MenuCommand id = command.commandID ;
+    if ( id == kHICommandPreferences )
+        id = wxApp::s_macPreferencesMenuItemId ;
+        
     wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
     wxMenu* menu = NULL ;
     wxMenuItem* item = NULL ;
@@ -365,28 +365,28 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
         item = mbar->FindItem( id , &menu ) ;
 
     if ( item == NULL || menu == NULL || mbar == NULL )
-       return result ;
-       
-       switch( GetEventKind( event ) )
-       {
-               case kEventProcessCommand :
-              {
-                       if (item->IsCheckable())
-                       {
-                           item->Check( !item->IsChecked() ) ;
-                       }
-                               
-                               menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
-                               result = noErr ;
-                       }
-                       break ;
-               case kEventCommandUpdateStatus:
-                       // eventually trigger an updateui round
-                               result = noErr ;
-                       break ;
-               default :
-                       break ;
-       }   
+        return result ;
+       
+       switch( GetEventKind( event ) )
+       {
+           case kEventProcessCommand :
+           {
+                if (item->IsCheckable())
+                {
+                    item->Check( !item->IsChecked() ) ;
+                }
+                
+                menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
+                result = noErr ;
+            }
+               break ;
+        case kEventCommandUpdateStatus:
+            // eventually trigger an updateui round
+                result = noErr ;
+            break ;
+           default :
+               break ;
+       }   
     
     return result ;
 }
@@ -394,23 +394,23 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
 static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
 {
     OSStatus result = eventNotHandledErr ;
-       switch ( GetEventKind( event ) )
-       {
-               case kEventAppActivated :
-                       {
-                               wxTheApp->MacResume( true ) ;
-                               result = noErr ;
-                       }
-                       break ;
-               case kEventAppDeactivated :
-                       {
-                               wxTheApp->MacSuspend( true ) ;
-                               result = noErr ;
-                       }
-                       break ;
-               default :
-                       break ;
-       }
+    switch ( GetEventKind( event ) )
+    {
+        case kEventAppActivated :
+            {
+                wxTheApp->MacResume( true ) ;
+                result = noErr ;
+            }
+            break ;
+        case kEventAppDeactivated :
+            {
+                wxTheApp->MacSuspend( true ) ;
+                result = noErr ;
+            }
+            break ;
+        default :
+            break ;
+    }
     return result ;
 }
 
@@ -419,27 +419,27 @@ pascal OSStatus wxAppEventHandler( EventHandlerCallRef handler , EventRef event
     OSStatus result = eventNotHandledErr ;
     switch( GetEventClass( event ) )
     {
-       case kEventClassCommand :
-               result = CommandEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassApplication :
-               result = ApplicationEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassMenu :
-               result = MenuEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassMouse :
-               result = MouseEventHandler( handler , event , data ) ;
-               break ;
-       case kEventClassAppleEvent :
-               {
-                       EventRecord rec ;
-                       wxMacConvertEventToRecord( event , &rec ) ;
-                       result = AEProcessAppleEvent( &rec ) ;
-               }
-               break ;
-       default :
-               break ;
+        case kEventClassCommand :
+            result = CommandEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassApplication :
+            result = ApplicationEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassMenu :
+            result = MenuEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassMouse :
+            result = MouseEventHandler( handler , event , data ) ;
+            break ;
+        case kEventClassAppleEvent :
+            {
+                EventRecord rec ;
+                wxMacConvertEventToRecord( event , &rec ) ;
+                result = AEProcessAppleEvent( &rec ) ;
+            }
+            break ;
+        default :
+            break ;
     }
 
     return result ;
@@ -532,7 +532,7 @@ bool wxApp::Initialize()
 
 #ifndef __DARWIN__
     // now avoid exceptions thrown for new (bad_alloc)
-       // FIXME CS for some changes outside wxMac does not compile anymore
+    // FIXME CS for some changes outside wxMac does not compile anymore
 #if 0
     std::__throws_bad_alloc = 0 ;
 #endif
@@ -593,17 +593,17 @@ bool wxApp::Initialize()
 
 bool wxApp::OnInitGui()
 {
-       if( !wxAppBase::OnInitGui() )
-               return false ;
-               
-#if TARGET_CARBON              
-       InstallStandardEventHandler( GetApplicationEventTarget() ) ;
-       
-       InstallApplicationEventHandler(
-               GetwxAppEventHandlerUPP(), 
-               GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));    
+    if( !wxAppBase::OnInitGui() )
+        return false ;
+        
+#if TARGET_CARBON        
+    InstallStandardEventHandler( GetApplicationEventTarget() ) ;
+    
+    InstallApplicationEventHandler(
+        GetwxAppEventHandlerUPP(), 
+        GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));    
 #endif
-               
+        
 #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
     AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments ,
                            NewAEEventHandlerUPP(AEHandleODoc) ,
@@ -632,7 +632,7 @@ bool wxApp::OnInitGui()
                            0 , FALSE ) ;
 #endif
 
-       return TRUE ;
+    return TRUE ;
 }
 
 void wxApp::CleanUp()
@@ -879,7 +879,7 @@ void wxStAppResource::CloseSharedLibraryResource()
 // the __wxinitialize and __wxterminate must be used
 
 extern "C" {
-    void __sinit(void);        /*      (generated by linker)   */
+    void __sinit(void);    /*    (generated by linker)    */
     pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
     pascal void __terminate(void);
 }
@@ -1149,14 +1149,14 @@ bool wxApp::Initialized()
 
 int wxApp::MainLoop()
 {
-       m_keepGoing = TRUE;
+    m_keepGoing = TRUE;
 
-       while (m_keepGoing)
-       {
-           MacDoOneEvent() ;
-       }
+    while (m_keepGoing)
+    {
+        MacDoOneEvent() ;
+    }
 
-       return 0;
+    return 0;
 }
 
 // Returns TRUE if more time is needed.
@@ -1171,18 +1171,18 @@ bool wxApp::ProcessIdle()
 
 void wxApp::ExitMainLoop()
 {
-       m_keepGoing = FALSE;
+      m_keepGoing = FALSE;
 }
 
 // Is a message/event pending?
 bool wxApp::Pending()
 {
 #if TARGET_CARBON
-       return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
+    return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
 #else
     EventRecord event ;
 
-       return EventAvail( everyEvent , &event ) ;
+      return EventAvail( everyEvent , &event ) ;
 #endif
 }
 
@@ -1336,39 +1336,39 @@ bool wxApp::Yield(bool onlyIfNeeded)
 #if wxUSE_THREADS
     YieldToAnyThread() ;
 #endif
-       // by definition yield should handle all non-processed events
+    // by definition yield should handle all non-processed events
 #if TARGET_CARBON
-       EventRef theEvent;
-
-       OSStatus status = noErr ;
-       do
-       {
-               s_inReceiveEvent = true ;
-               status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
-               s_inReceiveEvent = false ;
-               
-               if ( status == eventLoopTimedOutErr )
-               {
-                       // make sure next time the event loop will trigger idle events
-               sleepTime = kEventDurationNoWait ;
-               }
-               else if ( status == eventLoopQuitErr )
-               {
-                       // according to QA1061 this may also occur when a WakeUp Process
-                       // is executed
-               }
-               else
-               {
-                       MacHandleOneEvent( theEvent ) ;
-                       ReleaseEvent(theEvent);
-               }
-       } while( status == noErr ) ;
+    EventRef theEvent;
+
+    OSStatus status = noErr ;
+    do
+    {
+        s_inReceiveEvent = true ;
+        status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
+        s_inReceiveEvent = false ;
+        
+        if ( status == eventLoopTimedOutErr )
+        {
+            // make sure next time the event loop will trigger idle events
+            sleepTime = kEventDurationNoWait ;
+        }
+        else if ( status == eventLoopQuitErr )
+        {
+            // according to QA1061 this may also occur when a WakeUp Process
+            // is executed
+        }
+        else
+        {
+            MacHandleOneEvent( theEvent ) ;
+            ReleaseEvent(theEvent);
+        }
+    } while( status == noErr ) ;
 #else
     EventRecord event ;
 
-       // having a larger value here leads to large performance slowdowns
-       // so we cannot give background apps more processor time here
-       // we do so however having a large sleep value in the main event loop
+    // having a larger value here leads to large performance slowdowns
+    // so we cannot give background apps more processor time here
+    // we do so however having a large sleep value in the main event loop
     sleepTime = 0 ; 
 
     while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
@@ -1449,32 +1449,32 @@ void wxApp::MacConvertPublicToPrivateScrap()
 void wxApp::MacDoOneEvent()
 {
 #if TARGET_CARBON
-       EventRef theEvent;
+    EventRef theEvent;
 
-       s_inReceiveEvent = true ;
-       OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
-       s_inReceiveEvent = false ;
-       if ( status == eventLoopTimedOutErr )
-       {
+    s_inReceiveEvent = true ;
+    OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
+    s_inReceiveEvent = false ;
+    if ( status == eventLoopTimedOutErr )
+    {
         if ( wxTheApp->ProcessIdle() )
-               sleepTime = kEventDurationNoWait ;
+            sleepTime = kEventDurationNoWait ;
         else
-               sleepTime = kEventDurationForever ;
-       }
-       else if ( status == eventLoopQuitErr )
-       {
-               // according to QA1061 this may also occur when a WakeUp Process
-               // is executed
-       }
-       else
-       {
-               MacHandleOneEvent( theEvent ) ;
-               ReleaseEvent(theEvent);
-       }
+            sleepTime = kEventDurationForever ;
+    }
+    else if ( status == eventLoopQuitErr )
+    {
+        // according to QA1061 this may also occur when a WakeUp Process
+        // is executed
+    }
+    else
+    {
+        MacHandleOneEvent( theEvent ) ;
+        ReleaseEvent(theEvent);
+    }
 #else
-       EventRecord event ;
+      EventRecord event ;
 
-       EventMask eventMask = everyEvent ;
+    EventMask eventMask = everyEvent ;
 
     if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
     {
@@ -1490,9 +1490,9 @@ void wxApp::MacDoOneEvent()
             ::IdleControls( window ) ;
 
         if ( wxTheApp->ProcessIdle() )
-               sleepTime = 0 ;
+            sleepTime = 0 ;
         else
-               sleepTime = GetCaretTime() / 2 ;
+            sleepTime = GetCaretTime() / 2 ;
     }
     if ( event.what != kHighLevelEvent )
         SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v ,  event.where.h + 1 , event.where.v + 1 ) ;
@@ -1506,10 +1506,10 @@ void wxApp::MacDoOneEvent()
 void wxApp::MacHandleOneEvent( WXEVENTREF evr )
 {
 #if TARGET_CARBON
-       EventTargetRef theTarget;
-       theTarget = GetEventDispatcherTarget();
+    EventTargetRef theTarget;
+    theTarget = GetEventDispatcherTarget();
     m_macCurrentEvent = evr ;
-       SendEventToEventTarget ((EventRef) evr , theTarget);
+    SendEventToEventTarget ((EventRef) evr , theTarget);
 #else
     EventRecord* ev = (EventRecord*) evr ;
     m_macCurrentEvent = ev ;
@@ -1784,15 +1784,15 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr )
     WindowRef window;
 
     short windowPart = inNoWindow ;
-       if ( wxTheApp->s_captureWindow )
-       {
-               window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
-               windowPart = inContent ;
-       }
-       else
-       {
-               windowPart = ::FindWindow(ev->where, &window) ;
-       }
+    if ( wxTheApp->s_captureWindow )
+    {
+        window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
+        windowPart = inContent ;
+    }
+    else
+    {
+        windowPart = ::FindWindow(ev->where, &window) ;
+    }
 
     switch (windowPart)
     {
@@ -1990,14 +1990,14 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
         keycode = short(keyInfo & keyCodeMask) >> 8 ;
     }
     long keyval = wxMacTranslateKey(keychar, keycode) ;
-       long realkeyval = keyval ;
-       if ( keyval == keychar )
-       {
-               // we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
-               realkeyval = short(keymessage & charCodeMask) ;
-               keyval = wxToupper( keyval ) ;
-       }
-       
+    long realkeyval = keyval ;
+    if ( keyval == keychar )
+    {
+        // we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
+        realkeyval = short(keymessage & charCodeMask) ;
+        keyval = wxToupper( keyval ) ;
+    }
+    
     wxKeyEvent event(wxEVT_KEY_DOWN);
     bool handled = false ;
     event.m_shiftDown = modifiers & shiftKey;
@@ -2120,10 +2120,10 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
     }
     long keyval = wxMacTranslateKey(keychar, keycode) ;
 
-       if ( keyval == keychar )
-       {
-               keyval = wxToupper( keyval ) ;  
-       }
+    if ( keyval == keychar )
+    {
+        keyval = wxToupper( keyval ) ;    
+    }
     bool handled = false ;
 
     wxKeyEvent event(wxEVT_KEY_UP);
@@ -2248,15 +2248,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
 
                 wxWindow* currentMouseWindow = NULL ;
 
-                               if (s_captureWindow )
-                               {
-                                       currentMouseWindow = s_captureWindow ;
-                               }
-                               else
-                               {
-                               wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
-                                                                        &currentMouseWindow ) ;
-                           }
+                if (s_captureWindow )
+                {
+                    currentMouseWindow = s_captureWindow ;
+                }
+                else
+                {
+                    wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
+                                                             &currentMouseWindow ) ;
+                }
 
                 if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
                 {
@@ -2299,16 +2299,16 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
 
                 short windowPart = inNoWindow ;
 
-                               if ( s_captureWindow )
-                               {
-                                       window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
-                                       windowPart = inContent ;
-                               }
-                               else
-                               {
-                                       windowPart = ::FindWindow(ev->where, &window); 
-                               }
-                               
+                if ( s_captureWindow )
+                {
+                    window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
+                    windowPart = inContent ;
+                }
+                else
+                {
+                    windowPart = ::FindWindow(ev->where, &window); 
+                }
+                
                 switch (windowPart)
                 {
                     case inContent :
@@ -2358,8 +2358,8 @@ void wxApp::MacHandleMenuCommand( wxUint32 id )
         {
             item->Check( !item->IsChecked() ) ;
         }
-               
-               menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
+        
+        menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
 }
 
 #if !TARGET_CARBON
@@ -2384,7 +2384,7 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
     {
         MenuCommand id ;
         GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
-               MacHandleMenuCommand( id ) ;
+        MacHandleMenuCommand( id ) ;
     }
     HiliteMenu(0);
 }
index 212114ed9a6f4b15c350f3af3fb86bf9f3a502ed..a60d47d2ed6e224ae09a5e6090bc95358460fedc 100644 (file)
@@ -218,8 +218,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
 
     if ( mask )
     {
-       Rect r ;
-       GetPortBounds( image , &r ) ;
+        Rect r ;
+        GetPortBounds( image , &r ) ;
       LockPixels(GetGWorldPixMap(mask) ) ;
       CopyBits(GetPortBitMapForCopyBits(mask) ,
           &(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -229,8 +229,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
     }
     else
     {
-       Rect r ;
-       GetPortBounds( image , &r ) ;
+        Rect r ;
+        GetPortBounds( image , &r ) ;
         LockPixels(GetGWorldPixMap(image));
       CopyBits(GetPortBitMapForCopyBits(image) ,
           &(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
@@ -275,7 +275,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
   if ( clipRgn )
     GetRegionBounds( clipRgn , &portRect ) ;   
   else
-       GetPortBounds( wp , &portRect ) ;
+      GetPortBounds( wp , &portRect ) ;
   pict = OpenPicture(&portRect);   
   if(pict)  
   {
@@ -283,7 +283,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
     RGBBackColor( &white ) ;
     
     if ( clipRgn )
-       SetClip( clipRgn ) ;
+        SetClip( clipRgn ) ;
     
     LockPixels( GetGWorldPixMap( wp ) ) ;
     CopyBits(GetPortBitMapForCopyBits(wp),          
@@ -296,7 +296,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
   }
   SetGWorld( origPort , origDev ) ;
   if ( clipRgn )
-       DisposeRgn( clipRgn ) ;
+      DisposeRgn( clipRgn ) ;
   return pict;                  
 }
 
@@ -335,19 +335,19 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
                 info->contentType = kControlContentPictHandle ;
                 if ( bitmap.GetMask() )
                 {
-                                   info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
+                    info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
                }
                 else
                 {
-                                   info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
+                    info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
                 }
             }
         }
-               else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
-               {
-               info->contentType = kControlContentCIconHandle ;
-               info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
-               }
+        else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
+        {
+            info->contentType = kControlContentCIconHandle ;
+            info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
+        }
     }
 }
 
@@ -369,46 +369,46 @@ wxBitmapRefData::wxBitmapRefData()
 // TODO move this to a public function of Bitmap Ref
 static void DisposeBitmapRefData(wxBitmapRefData *data)
 {
-       if ( !data )
-               return ;
-               
-       switch (data->m_bitmapType)
-       {
-           case kMacBitmapTypePict :
-               {
-                   if ( data->m_hPict )
-                   {
-                       KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
-                       data->m_hPict = NULL ;
-                   }
-               }
-               break ;
-           case kMacBitmapTypeGrafWorld :
-               {
-                   if ( data->m_hBitmap )
-                   {
-                       wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
-                       data->m_hBitmap = NULL ;
-                   }
-               }
-               break ;
-           case kMacBitmapTypeIcon :
-               if ( data->m_hIcon )
-               {
-                   DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
-                   data->m_hIcon = NULL ;
-               }
-           
-           default :
-               // unkown type ?
-               break ;
-       }
+    if ( !data )
+        return ;
+        
+    switch (data->m_bitmapType)
+    {
+        case kMacBitmapTypePict :
+            {
+                if ( data->m_hPict )
+                {
+                    KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
+                    data->m_hPict = NULL ;
+                }
+            }
+            break ;
+        case kMacBitmapTypeGrafWorld :
+            {
+                if ( data->m_hBitmap )
+                {
+                    wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
+                    data->m_hBitmap = NULL ;
+                }
+            }
+            break ;
+        case kMacBitmapTypeIcon :
+            if ( data->m_hIcon )
+            {
+                DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
+                data->m_hIcon = NULL ;
+            }
+        
+        default :
+            // unkown type ?
+            break ;
+    }
     
-       if (data->m_bitmapMask)
-       {
-               delete data->m_bitmapMask;
-               data->m_bitmapMask = NULL;
-       }
+    if (data->m_bitmapMask)
+    {
+        delete data->m_bitmapMask;
+        data->m_bitmapMask = NULL;
+    }
 }
 
 wxBitmapRefData::~wxBitmapRefData()
@@ -642,8 +642,8 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
 {
     if (!M_BITMAPDATA)
         m_refData = new wxBitmapRefData;
-       else
-       DisposeBitmapRefData( M_BITMAPDATA ) ;
+    else
+        DisposeBitmapRefData( M_BITMAPDATA ) ;
     
     M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
     M_BITMAPDATA->m_hBitmap = bmp ;
@@ -654,8 +654,8 @@ void wxBitmap::SetHICON(WXHICON ico)
 {
     if (!M_BITMAPDATA)
         m_refData = new wxBitmapRefData;
-       else
-       DisposeBitmapRefData( M_BITMAPDATA ) ;
+    else
+        DisposeBitmapRefData( M_BITMAPDATA ) ;
     
     M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
     M_BITMAPDATA->m_hIcon = ico ;
@@ -666,8 +666,8 @@ void wxBitmap::SetPict(WXHMETAFILE pict)
 {
     if (!M_BITMAPDATA)
         m_refData = new wxBitmapRefData;
-       else
-       DisposeBitmapRefData( M_BITMAPDATA ) ;
+    else
+        DisposeBitmapRefData( M_BITMAPDATA ) ;
     
     M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
     M_BITMAPDATA->m_hPict = pict ;
@@ -820,26 +820,26 @@ wxImage wxBitmap::ConvertToImage() const
     GetGWorld( &origPort, &origDevice );
     if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
     {
-       tempPort = wxMacCreateGWorld( width , height , -1) ;
+        tempPort = wxMacCreateGWorld( width , height , -1) ;
     }
     else
     {
-       tempPort =  (GWorldPtr) GetHBITMAP() ;
-       }
-       LockPixels(GetGWorldPixMap(tempPort));
-       SetGWorld( tempPort, NULL);
-       if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
-       {
+        tempPort =  (GWorldPtr) GetHBITMAP() ;
+    }
+    LockPixels(GetGWorldPixMap(tempPort));
+    SetGWorld( tempPort, NULL);
+    if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
+    {
         Rect bitmaprect = { 0 , 0 , height, width };
-       if ( GetBitmapType() == kMacBitmapTypeIcon )
-       {
-               ::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
-               maskRgn = NewRgn() ;
-               BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ; 
+        if ( GetBitmapType() == kMacBitmapTypeIcon )
+        {
+            ::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
+            maskRgn = NewRgn() ;
+            BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ; 
         }
-       else
-               ::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
-       }
+         else
+             ::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
+    }
     // Copy data into image
     index = 0;
     for (int yy = 0; yy < height; yy++)
@@ -854,28 +854,28 @@ wxImage wxBitmap::ConvertToImage() const
             data[index + 1] = g;
             data[index + 2] = b;
             if ( maskRgn )
-            {  
-               Point pt ;
-               pt.h = xx ;
-               pt.v = yy ;
-               if ( !PtInRgn( pt , maskRgn ) )
-               {
+            {    
+                Point pt ;
+                pt.h = xx ;
+                pt.v = yy ;
+                if ( !PtInRgn( pt , maskRgn ) )
+                {
                     data[index    ] = mask_r;
                     data[index + 1] = mask_g;
                     data[index + 2] = mask_b;
-               }
+                }
             }
             else
             {
-                   if (mask)
-                   {
-                       if (mask->PointMasked(xx,yy))
-                       {
-                           data[index    ] = mask_r;
-                           data[index + 1] = mask_g;
-                           data[index + 2] = mask_b;
-                       }
-                   }
+                if (mask)
+                {
+                    if (mask->PointMasked(xx,yy))
+                    {
+                        data[index    ] = mask_r;
+                        data[index + 1] = mask_g;
+                        data[index + 2] = mask_b;
+                    }
+                }
             }
             index += 3;
         }
@@ -891,11 +891,11 @@ wxImage wxBitmap::ConvertToImage() const
     SetGWorld(origPort, origDevice);
     if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
     {
-       wxMacDestroyGWorld( tempPort ) ;
+        wxMacDestroyGWorld( tempPort ) ;
     }
     if ( maskRgn )
     {
-       DisposeRgn( maskRgn ) ;
+        DisposeRgn( maskRgn ) ;
     }
 
     return image;
@@ -1038,33 +1038,33 @@ WXHBITMAP wxBitmap::GetHBITMAP() const
 
 WXHMETAFILE wxBitmap::GetPict( bool *created ) const
 {
-       wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
+    wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
    
-       PicHandle picture = NULL ;       // This is the returned picture
-       if ( created )
-               (*created) = false ;
-       // If bitmap already in Pict format return pointer
-       if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
-          return M_BITMAPDATA->m_hPict;
-       }
-       else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
-          // Invalid bitmap
-          return NULL;
-       }
-       else
-       {
-               if ( GetMask() )
-               {
-                   picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
-               }
-               else
-               {
-                   picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
-               }
-               if ( created && picture )
-                       (*created) = true ;
+    PicHandle picture = NULL ;       // This is the returned picture
+    if ( created )
+        (*created) = false ;
+    // If bitmap already in Pict format return pointer
+    if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
+       return M_BITMAPDATA->m_hPict;
+    }
+    else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
+       // Invalid bitmap
+       return NULL;
+    }
+    else
+    {
+        if ( GetMask() )
+        {
+            picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
+        }
+        else
+        {
+            picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
+        }
+        if ( created && picture )
+            (*created) = true ;
     }
-       return picture ;
+     return picture ;
 }
 
 /*
index a98ad95896e0bdfbf1031615aa8b268fba0934a0..ebf802126278a3c96a90ea1d89260ee7e347e0e6 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -45,35 +45,35 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
         m_windowId = id;
 
     if ( width == -1 && bitmap.Ok())
-       width = bitmap.GetWidth() + 2*m_marginX;
+    width = bitmap.GetWidth() + 2*m_marginX;
 
     if ( height == -1 && bitmap.Ok())
-       height = bitmap.GetHeight() + 2*m_marginY;
+    height = bitmap.GetHeight() + 2*m_marginY;
 
-       Rect bounds ;
-       Str255 title ;
+    Rect bounds ;
+    Str255 title ;
     m_bmpNormal = bitmap;
-       wxBitmapRefData * bmap = NULL ;
-       
-       if ( m_bmpNormal.Ok() )
-               bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
+    wxBitmapRefData * bmap = NULL ;
+    
+    if ( m_bmpNormal.Ok() )
+        bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 
-               kControlBehaviorOffsetContents + 
-                   ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? 
-                   kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
-               (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-       
-       ControlButtonContentInfo info ;
-       wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
-       if ( info.contentType != kControlNoContent )
-       {
-           ::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 
+        kControlBehaviorOffsetContents + 
+            ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? 
+            kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
+          (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    ControlButtonContentInfo info ;
+    wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
+    if ( info.contentType != kControlNoContent )
+    {
+        ::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
     }
-       MacPostControlCreate() ;
+    MacPostControlCreate() ;
 
     return TRUE;
 }
index 5589004fbecc086716f464eb344438ef1c4bd0a3..d484314a2ce98af507fea1e9621cdd950f9ff496 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -112,17 +112,17 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
 }
 void wxBrush::Unshare()
 {
-       // Don't change shared data
-       if (!m_refData)
+    // Don't change shared data
+    if (!m_refData)
     {
-               m_refData = new wxBrushRefData();
-       }
+        m_refData = new wxBrushRefData();
+    }
     else
     {
-               wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
-               UnRef();
-               m_refData = ref;
-       }
+        wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
+        UnRef();
+        m_refData = ref;
+    }
 }
 
 void wxBrush::SetColour(const wxColour& col)
@@ -203,25 +203,27 @@ unsigned long wxBrush::GetMacThemeBackground( WXRECTPTR extent)  const
   }
 }
 
-short wxBrush::GetMacTheme()  const 
+short wxBrush::GetMacTheme() const 
 { 
-  return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); 
-};
+    return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); 
+}
 
 wxColour& wxBrush::GetColour() const 
-{ return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
+{
+    return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
+}
 
 int wxBrush::GetStyle() const 
 { 
-  return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); 
-};
+    return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); 
+}
 
 wxBitmap *wxBrush::GetStipple() const 
 { 
-  return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); 
-};
+    return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); 
+}
 
 wxMacBrushKind wxBrush::MacGetBrushKind()  const 
 { 
-  return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); 
-};
+    return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); 
+}
\ No newline at end of file
index ca997d69266e7382fb3a20fe7a6e1085ba936422..763048808eda4a392ceb7fd53ea906402ac8169b 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -34,23 +34,23 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
            const wxValidator& validator,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
+    Rect bounds ;
+    Str255 title ;
 
     if ( UMAHasAquaLayout() )
     {
         m_macHorizontalBorder = kMacOSXHorizontalBorder;
         m_macVerticalBorder = kMacOSXVerticalBorder;
     }
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlPushButtonProc , (long) this ) ;
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-       
-       MacPostControlCreate() ;
-       
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
+
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlPushButtonProc , (long) this ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    MacPostControlCreate() ;
+    
   return TRUE;
 }
 
@@ -65,19 +65,19 @@ void wxButton::SetDefault()
         parent->SetDefaultItem(this);
     }
 
-       Boolean inData;
-       if ( btnOldDefault && btnOldDefault->m_macControl )
-       {
-               inData = 0;
-               ::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
-                                                  kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
-       }
-       if ( (ControlHandle) m_macControl )
-       {
-               inData = 1;
-               ::SetControlData(  (ControlHandle) m_macControl , kControlButtonPart ,
-                                                  kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
-       }
+    Boolean inData;
+    if ( btnOldDefault && btnOldDefault->m_macControl )
+    {
+          inData = 0;
+        ::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
+                           kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+    }
+    if ( (ControlHandle) m_macControl )
+    {
+          inData = 1;
+        ::SetControlData(  (ControlHandle) m_macControl , kControlButtonPart ,
+                           kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+    }
 }
 
 wxSize wxButton::DoGetBestSize() const
@@ -85,7 +85,7 @@ wxSize wxButton::DoGetBestSize() const
   wxSize sz = GetDefaultSize() ;
   
   int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
-       
+    
   if (wBtn > sz.x) sz.x = wBtn;
   
   return sz ;
@@ -94,7 +94,7 @@ wxSize wxButton::DoGetBestSize() const
 wxSize wxButton::GetDefaultSize()
 {
     int wBtn = 70 ; 
-       int hBtn = 20 ;
+    int hBtn = 20 ;
 
     if ( UMAHasAquaLayout() )
     {
index 60035000ddf2e7179975089afeaf423c221caac6..f1bc26ccc6c2d7bcb7ae97e19a1c7d9a4624c545 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -31,15 +31,15 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
            const wxValidator& validator,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlCheckBoxProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlCheckBoxProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
 
   return TRUE;
 }
@@ -63,7 +63,7 @@ void wxCheckBox::Command (wxCommandEvent & event)
 
 void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) ) 
 {
-       SetValue( !GetValue() ) ;
+    SetValue( !GetValue() ) ;
     wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
     event.SetInt(GetValue());
     event.SetEventObject(this);
index 33dba7507c997bbe0e132822c008ec8bdcd2cfbf..c50773b137ed9ff0bd6e24380e6a75030a63d6be 100644 (file)
@@ -73,9 +73,9 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
     RgnHandle savedClipRegion;
     SInt32 savedPenMode;
     wxCheckListBox*          list;
-  GetPort(&savePort);
-  SetPort((**listHandle).port);
-  grafPtr = (**listHandle).port ;
+    GetPort(&savePort);
+    SetPort((**listHandle).port);
+    grafPtr = (**listHandle).port ;
     // typecast our refCon
     list = (wxCheckListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
     
@@ -102,13 +102,13 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
             ClipRect( drawRect );
             EraseRect( drawRect );
             
-                       wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
+            wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
 
-                       if ( font )
-                       {
-                               ::TextFont( font->m_macFontNum ) ;
-                               ::TextSize( font->m_macFontSize)  ;
-                               ::TextFace( font->m_macFontStyle ) ;
+            if ( font )
+            {
+                ::TextFont( font->m_macFontNum ) ;
+                ::TextSize( font->m_macFontSize)  ;
+                ::TextFace( font->m_macFontStyle ) ;
             }
                        
             ThemeButtonDrawInfo info ;
@@ -123,11 +123,11 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
             checkRect.right = checkRect.left + list->m_checkBoxWidth ;
             checkRect.bottom = checkRect.top + list->m_checkBoxHeight ;
             DrawThemeButton(&checkRect,kThemeCheckBox,
-              &info,NULL,NULL, NULL,0);
-
-        MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
-        DrawText(text, 0 , text.Length());
+                &info,NULL,NULL, NULL,0);
+            
+            MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
+            
+            DrawText(text, 0 , text.Length());
             //  If the cell is hilited, do the hilite now. Paint the cell contents with the
             //  appropriate QuickDraw transform mode.
             
@@ -142,8 +142,8 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
             
             SetClip( savedClipRegion );
             DisposeRgn( savedClipRegion );
-            }
-            break;
+        }
+        break;
         case lHiliteMsg:
             
             //  Hilite or unhilite the cell. Paint the cell contents with the
@@ -194,7 +194,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
     GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);    
     GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
 #endif
-         wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
+      wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
 
     FontInfo finfo;
     FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo);
@@ -202,12 +202,12 @@ bool wxCheckListBox::Create(wxWindow *parent,
     m_TextBaseLineOffset= finfo.leading+finfo.ascent;
     m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;
     
-       if (m_checkBoxHeight<h)
-       {
-               m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
-               m_checkBoxHeight= h;
-       }
-               
+    if (m_checkBoxHeight<h)
+    {
+        m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
+        m_checkBoxHeight= h;
+    }
+        
     Rect bounds ;
     Str255 title ;
     
@@ -376,55 +376,55 @@ END_EVENT_TABLE()
 
 void wxCheckListBox::OnChar(wxKeyEvent& event)
 {
-  if ( event.GetKeyCode() == WXK_SPACE )
-  {
-    int index = GetSelection() ;
-    if ( index >= 0 )
+    if ( event.GetKeyCode() == WXK_SPACE )
     {
-      Check(index, !IsChecked(index) ) ;
-      wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
-      event.SetInt(index);
-      event.SetEventObject(this);
-      GetEventHandler()->ProcessEvent(event);
+        int index = GetSelection() ;
+        if ( index >= 0 )
+        {
+            Check(index, !IsChecked(index) ) ;
+            wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
+            event.SetInt(index);
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
+        }
     }
-  }
-  else
-    event.Skip();
+    else
+        event.Skip();
 }
 
 void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
 {
-  // clicking on the item selects it, clicking on the checkmark toggles
-  if ( event.GetX() <= 20 /*check width*/ ) {
-    int lineheight ;
-    int topcell ;
+    // clicking on the item selects it, clicking on the checkmark toggles
+    if ( event.GetX() <= 20 /*check width*/ ) {
+        int lineheight ;
+        int topcell ;
 #if TARGET_CARBON
-    Point pt ;
-    GetListCellSize( (ListHandle)m_macList , &pt ) ;
-    lineheight = pt.v ;
-    ListBounds visible ;
-    GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
-    topcell = visible.top ;
+        Point pt ;
+        GetListCellSize( (ListHandle)m_macList , &pt ) ;
+        lineheight = pt.v ;
+        ListBounds visible ;
+        GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
+        topcell = visible.top ;
 #else
-    lineheight =  (**(ListHandle)m_macList).cellSize.v ;
-    topcell = (**(ListHandle)m_macList).visible.top ;
+        lineheight =  (**(ListHandle)m_macList).cellSize.v ;
+        topcell = (**(ListHandle)m_macList).visible.top ;
 #endif
-    size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
-    
-    if ( nItem < (size_t)m_noItems )
-    {
-      Check(nItem, !IsChecked(nItem) ) ;
-      wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
-      event.SetInt(nItem);
-      event.SetEventObject(this);
-      GetEventHandler()->ProcessEvent(event);
+        size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
+        
+        if ( nItem < (size_t)m_noItems )
+        {
+            Check(nItem, !IsChecked(nItem) ) ;
+            wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
+            event.SetInt(nItem);
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
+        }
+        //else: it's not an error, just click outside of client zone
+    }
+    else {
+        // implement default behaviour: clicking on the item selects it
+        event.Skip();
     }
-    //else: it's not an error, just click outside of client zone
-  }
-  else {
-    // implement default behaviour: clicking on the item selects it
-    event.Skip();
-  }
 }
 
 #endif // wxUSE_CHECKLISTBOX
index 4074699ed54cc289279b2fa67c6b2513920bc27d..a53b5715cea7d8a82ca338c2e0de2ae51cd06dce 100644 (file)
@@ -6,19 +6,24 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 #pragma implementation "choice.h"
 #endif
+
 #include "wx/defs.h"
 #include "wx/choice.h"
 #include "wx/menu.h"
 #include "wx/mac/uma.h"
+
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
 #endif
+
 extern MenuHandle NewUniqueMenu() ;
+
 wxChoice::~wxChoice()
 {
     if ( HasClientObjectData() )
@@ -30,49 +35,52 @@ wxChoice::~wxChoice()
     }
 
         // DeleteMenu( m_macPopUpMenuId ) ;
-       // DisposeMenu( m_macPopUpMenuHandle ) ;
+    // DisposeMenu( m_macPopUpMenuHandle ) ;
 }
+
 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
            const wxSize& size,
-                  int n, const wxString choices[],
-                  long style,
+           int n, const wxString choices[],
+           long style,
            const wxValidator& validator,
            const wxString& name)
 {
-               Rect bounds ;
-               Str255 title ;
-       
-               MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
-               m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , 
-               kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
-       
-               m_macPopUpMenuHandle =  NewUniqueMenu() ;
-               SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
-               SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
-               SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
-               if ( n > 0 )
-                       SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
-               MacPostControlCreate() ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , 
+        kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
+    
+    m_macPopUpMenuHandle =  NewUniqueMenu() ;
+    SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
+    SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
+    SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
+    if ( n > 0 )
+        SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
+    MacPostControlCreate() ;
     for ( int i = 0; i < n; i++ )
     {
         Append(choices[i]);
     }
-       return TRUE;
+    return TRUE;
 }
+
 // ----------------------------------------------------------------------------
 // adding/deleting items to/from the list
 // ----------------------------------------------------------------------------
 int wxChoice::DoAppend(const wxString& item)
 {
-       UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
-       m_strings.Add( item ) ;
-       m_datas.Add( NULL ) ;
-       int index = m_strings.GetCount()  - 1  ;
-       DoSetItemClientData( index , NULL ) ;
-       SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
-       return index ;
+    UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
+    m_strings.Add( item ) ;
+    m_datas.Add( NULL ) ;
+    int index = m_strings.GetCount()  - 1  ;
+    DoSetItemClientData( index , NULL ) ;
+    SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
+    return index ;
 }
+
 void wxChoice::Delete(int n)
 {
     wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
@@ -83,19 +91,21 @@ void wxChoice::Delete(int n)
     ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
     m_strings.Remove( n ) ;
     m_datas.RemoveAt( n ) ;
-       SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
+    SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
 }
+
 void wxChoice::Clear()
 {
     FreeData();
     for ( int i = 0 ; i < GetCount() ; i++ )
     {
-       ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
+        ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
     }
     m_strings.Empty() ;
     m_datas.Empty() ;
     SetControl32BitMaximum( (ControlHandle) m_macControl , 0 ) ;
 }
+
 void wxChoice::FreeData()
 {
     if ( HasClientObjectData() )
@@ -107,6 +117,7 @@ void wxChoice::FreeData()
         }
     }
 }
+
 // ----------------------------------------------------------------------------
 // selection
 // ----------------------------------------------------------------------------
@@ -114,26 +125,31 @@ int wxChoice::GetSelection() const
 {
     return GetControl32BitValue( (ControlHandle) m_macControl ) -1 ;
 }
+
 void wxChoice::SetSelection(int n)
 {
     SetControl32BitValue( (ControlHandle) m_macControl , n + 1 ) ;
 }
+
 // ----------------------------------------------------------------------------
 // string list functions
 // ----------------------------------------------------------------------------
+
 int wxChoice::GetCount() const
 {
     return m_strings.GetCount() ;
 }
+
 int wxChoice::FindString(const wxString& s) const
 {
     for( int i = 0 ; i < GetCount() ; i++ )
     {
-       if ( GetString( i ).IsSameAs(s, FALSE) )
-               return i ; 
+        if ( GetString( i ).IsSameAs(s, FALSE) )
+            return i ; 
     }
     return wxNOT_FOUND ;
 }
+
 void wxChoice::SetString(int n, const wxString& s)
 {
     wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented"));
@@ -145,7 +161,7 @@ void wxChoice::SetString(int n, const wxString& s)
 
 wxString wxChoice::GetString(int n) const
 {
-       return m_strings[n] ;
+    return m_strings[n] ;
 }
 // ----------------------------------------------------------------------------
 // client data
@@ -154,23 +170,27 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
                  "invalid index in wxChoice::SetClientData" );
-       
+    
     m_datas[n] = (char*) clientData ;
 }
+
 void *wxChoice::DoGetItemClientData(int n) const
 {
     wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
                  "invalid index in wxChoice::GetClientData" );
     return (void *)m_datas[n];
 }
+
 void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
 {
     DoSetItemClientData(n, clientData);
 }
+
 wxClientData* wxChoice::DoGetItemClientObject( int n ) const
 {
     return (wxClientData *)DoGetItemClientData(n);
 }
+
 void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
     wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
@@ -188,6 +208,7 @@ void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
         ProcessCommand(event);
     }
 }
+
 wxSize wxChoice::DoGetBestSize() const
 {
     int lbWidth = 100;  // some defaults
@@ -198,35 +219,35 @@ wxSize wxChoice::DoGetBestSize() const
     GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );   
     lbHeight = metric ; 
 #endif
-       {
-               wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
-               Rect drawRect ;
-               wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-               if ( font )
-               {
-                       ::TextFont( font->m_macFontNum ) ;
-                       ::TextSize( short(font->m_macFontSize) ) ;
-                       ::TextFace( font->m_macFontStyle ) ;
-               }
-               else
-               {
-               ::TextFont( kFontIDMonaco ) ;
-               ::TextSize( 9  );
-               ::TextFace( 0 ) ;
-               }
-           // Find the widest line
-           for(int i = 0; i < GetCount(); i++) {
-               wxString str(GetString(i));
-               wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
-               lbWidth = wxMax(lbWidth, wLine);
-           }
-           // Add room for the popup arrow
-           lbWidth += 2 * lbHeight ;
-           // And just a bit more
-           int cy = 12 ;
-           int cx = ::TextWidth( "X" , 0 , 1 ) ;
-           lbWidth += cx ;
-           
-       }
+    {
+        wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
+         Rect drawRect ;
+        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+        if ( font )
+        {
+            ::TextFont( font->m_macFontNum ) ;
+            ::TextSize( short(font->m_macFontSize) ) ;
+            ::TextFace( font->m_macFontStyle ) ;
+        }
+        else
+        {
+            ::TextFont( kFontIDMonaco ) ;
+            ::TextSize( 9  );
+            ::TextFace( 0 ) ;
+        }
+        // Find the widest line
+        for(int i = 0; i < GetCount(); i++) {
+            wxString str(GetString(i));
+            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+            lbWidth = wxMax(lbWidth, wLine);
+        }
+        // Add room for the popup arrow
+        lbWidth += 2 * lbHeight ;
+        // And just a bit more
+        int cy = 12 ;
+        int cx = ::TextWidth( "X" , 0 , 1 ) ;
+        lbWidth += cx ;
+        
+    }
     return wxSize(lbWidth, lbHeight);
 }
index 7854006d09bfe35239bf1f1e9012b50f0fec0fc5..47a2b428f909abd55e8b862526c1b3b2858de434 100644 (file)
@@ -44,27 +44,27 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 #else
     OSStatus err = noErr ;
 #endif
-       void * data = NULL ;
-       Size byteCount;
+    void * data = NULL ;
+    Size byteCount;
     
     switch (dataFormat.GetType())
     {
-        case wxDF_OEMTEXT:
-            dataFormat = wxDF_TEXT;
-            // fall through
-
-        case wxDF_TEXT:
-                break;
-        case wxDF_BITMAP :
-        case wxDF_METAFILE :
-                       break ;
-        default:
-            {
-                wxLogError(_("Unsupported clipboard format."));
-                return NULL;
-            }
+    case wxDF_OEMTEXT:
+        dataFormat = wxDF_TEXT;
+        // fall through
+        
+    case wxDF_TEXT:
+        break;
+    case wxDF_BITMAP :
+    case wxDF_METAFILE :
+        break ;
+    default:
+        {
+            wxLogError(_("Unsupported clipboard format."));
+            return NULL;
+        }
     }
-
+    
 #if TARGET_CARBON
     ScrapRef scrapRef;
     
@@ -77,21 +77,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         {
             if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
             {
-              if ( dataFormat.GetType() == wxDF_TEXT )
-                byteCount++ ;
+                if ( dataFormat.GetType() == wxDF_TEXT )
+                    byteCount++ ;
                 
-          data = new char[ byteCount ] ;
-          if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
-          {
-            *len = byteCount ;
-                if ( dataFormat.GetType() == wxDF_TEXT )  
-                ((char*)data)[byteCount] = 0 ;
-          }
-          else
-          {
-            delete[] ((char *)data) ;
-            data = NULL ;
-          }
+                data = new char[ byteCount ] ;
+                if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
+                {
+                    *len = byteCount ;
+                    if ( dataFormat.GetType() == wxDF_TEXT )  
+                        ((char*)data)[byteCount] = 0 ;
+                }
+                else
+                {
+                    delete[] ((char *)data) ;
+                    data = NULL ;
+                }
             }
         }
     }
@@ -104,28 +104,28 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     HUnlock( datahandle ) ;
     if ( GetHandleSize( datahandle ) > 0 )
     {
-      byteCount = GetHandleSize( datahandle ) ;
-      if ( dataFormat.GetType() == wxDF_TEXT )  
-        data = new char[ byteCount + 1] ;
-      else
-        data = new char[ byteCount ] ;
-
-      memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
-      if ( dataFormat.GetType() == wxDF_TEXT )  
-          ((char*)data)[byteCount] = 0 ;
-      *len = byteCount ;
+        byteCount = GetHandleSize( datahandle ) ;
+        if ( dataFormat.GetType() == wxDF_TEXT )  
+            data = new char[ byteCount + 1] ;
+        else
+            data = new char[ byteCount ] ;
+        
+        memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
+        if ( dataFormat.GetType() == wxDF_TEXT )  
+            ((char*)data)[byteCount] = 0 ;
+        *len = byteCount ;
     }
     DisposeHandle( datahandle ) ;
 #endif
     if ( err )
     {
         wxLogSysError(_("Failed to get clipboard data."));
-
+        
         return NULL ;
     }
     if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
     {
-      wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
+        wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
     }
     return data;
 }
@@ -139,8 +139,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
 
 wxClipboard::wxClipboard()
 {
-  m_open = false ;
-  m_data = NULL ;
+    m_open = false ;
+    m_data = NULL ;
 }
 
 wxClipboard::~wxClipboard()
@@ -250,30 +250,30 @@ bool wxClipboard::AddData( wxDataObject *data )
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
            {
-                               wxMetafileDataObject* metaFileDataObject =
+                wxMetafileDataObject* metaFileDataObject =
                 (wxMetafileDataObject*) data;
-               wxMetafile metaFile = metaFileDataObject->GetMetafile();
-               PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
-               HLock( (Handle) pict ) ;
-               err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
-               HUnlock(  (Handle) pict ) ;
+                  wxMetafile metaFile = metaFileDataObject->GetMetafile();
+                PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
+                  HLock( (Handle) pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  HUnlock(  (Handle) pict ) ;
            }
            break ;
 #endif
            case wxDF_BITMAP:
            case wxDF_DIB:
            {
-                       bool created = false ;
-                       PicHandle pict = NULL ;
-                       
-                       wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
-                       pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
-
-               HLock( (Handle) pict ) ;
-               err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
-               HUnlock(  (Handle) pict ) ;
-               if ( created )
-                       KillPicture( pict ) ;
+                   bool created = false ;
+                   PicHandle pict = NULL ;
+                   
+                   wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
+                   pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
+
+                  HLock( (Handle) pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  HUnlock(  (Handle) pict ) ;
+                  if ( created )
+                      KillPicture( pict ) ;
            }
            default:
                 break ;
@@ -388,7 +388,7 @@ bool wxClipboard::GetData( wxDataObject& data )
                     transferred = true ;
                   }
               }
-                                                       break ;
+                            break ;
 
               default :
                 break ;
index bb2361b3ff096d28c5586c20217c94b71fff0f46..134e40f445d2a60f13e5d72894b7f8fa70fe2124 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -50,20 +50,20 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
 
 int wxColourDialog::ShowModal()
 {
-       Point where ;
-       RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
-       
-       where.h = where.v = -1;
+    Point where ;
+    RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
+    
+    where.h = where.v = -1;
 
-       if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
-       {
-               m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
-       return wxID_OK;
-       }
-       else
-       {
-       return wxID_CANCEL;
-       }
+    if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
+    {
+        m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
+        return wxID_OK;
+    }
+    else
+    {
+        return wxID_CANCEL;
+    }
 
     return wxID_CANCEL;
 }
index b9a18e9ca9665ace528dfe672336cb6c49eb4ff5..12a65e02a53125240a4c8d68cc0c943447bcfd82 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -28,17 +28,17 @@ static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green
 static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ) 
 {
     RGBColor* col = (RGBColor*) color ;
-       col->red = (red << 8) + red;
-       col->blue = (blue << 8) + blue;
-       col->green = (green << 8) + green;
+    col->red = (red << 8) + red;
+    col->blue = (blue << 8) + blue;
+    col->green = (green << 8) + green;
 }
 
 wxColour::wxColour ()
 {
-  m_isInit = FALSE;
-  m_red = m_blue = m_green = 0;
-
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    m_isInit = FALSE;
+    m_red = m_blue = m_green = 0;
+    
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
@@ -48,7 +48,7 @@ wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
     m_blue = b;
     m_isInit = TRUE;
 
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 wxColour::wxColour (const wxColour& col)
@@ -74,14 +74,14 @@ wxColour::wxColour (const wxColour* col)
 
 wxColour& wxColour::operator =(const wxColour& col)
 {
-  m_red = col.m_red;
-  m_green = col.m_green;
-  m_blue = col.m_blue;
-  m_isInit = col.m_isInit;
-  memcpy( &m_pixel , &col.m_pixel , 6 ) ;
-
-  return *this;
+    m_red = col.m_red;
+    m_green = col.m_green;
+    m_blue = col.m_blue;
+    m_isInit = col.m_isInit;
+    
+    memcpy( &m_pixel , &col.m_pixel , 6 ) ;
+    
+    return *this;
 }
 
 void wxColour::InitFromName(const wxString& col)
@@ -102,7 +102,7 @@ void wxColour::InitFromName(const wxString& col)
         m_isInit = FALSE;
     }
 
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 wxColour::~wxColour ()
@@ -116,7 +116,7 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
     m_blue = b;
     m_isInit = TRUE;
 
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 void wxColour::Set( const WXCOLORREF* color )
index 2c000f3b0b41319f1e81f3c8ce5a8729695f3736..7d2a6819ea93aff36c36c0f1310ae2c6050770f2 100644 (file)
@@ -96,7 +96,7 @@ protected:
 
                 wxWindow *parent = GetParent();
                 while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
-                  parent = parent->GetParent() ;
+                    parent = parent->GetParent() ;
                 }
                 if ( parent && parent->GetDefaultItem() )
                 {
@@ -314,9 +314,9 @@ void wxComboBox::SetValue(const wxString& value)
     int s = FindString (value);
     if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
     {
-       m_choice->Append(value) ;
+        m_choice->Append(value) ;
     }
-       SetStringSelection( value ) ;
+    SetStringSelection( value ) ;
 }
 
 // Clipboard operations
index 0ba0c065218f80ac3329955090ee03260715c3c6..2dd89c2b5542e5c2726e4e73292e5b227f49fbdc 100644 (file)
@@ -89,54 +89,54 @@ ControlDefUPP wxMacControlActionUPP = NULL ;
 pascal SInt32  wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
 {
     
-       wxControl*  wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
-       if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
-       {
-           if( message == drawCntl )
-           {
-               wxMacWindowClipper clip( wx ) ;
-               return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
-           }
-           else
-               return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
-       }
-       return  NULL ;
+    wxControl*  wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
+    if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+    {
+        if( message == drawCntl )
+        {
+            wxMacWindowClipper clip( wx ) ;
+            return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+        }
+        else
+            return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+    }
+    return  NULL ;
 }
 
 pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
 {
-       OSStatus status = noErr ;
-       switch( iMessage )
-       {
-               case kControlMsgSetUpBackground :
-                       {
-                       wxControl*  wx = (wxControl*) GetControlReference( iControl ) ;
-                       if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
-                       {
-                               wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
+    OSStatus status = noErr ;
+    switch( iMessage )
+    {
+        case kControlMsgSetUpBackground :
+            {
+                wxControl*  wx = (wxControl*) GetControlReference( iControl ) ;
+                if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+                {
+                    wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
 #if TARGET_CARBON
-                                       // under classic this would lead to partial redraws
-                                       RgnHandle clip = NewRgn() ;
-                               int x = 0 , y = 0;
-
-                               wx->MacWindowToRootWindow( &x,&y ) ;
-                               CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
-                               OffsetRgn( clip , x , y ) ;
-                               SetClip( clip ) ;
-                               DisposeRgn( clip ) ;
+                    // under classic this would lead to partial redraws
+                    RgnHandle clip = NewRgn() ;
+                    int x = 0 , y = 0;
+
+                    wx->MacWindowToRootWindow( &x,&y ) ;
+                    CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
+                    OffsetRgn( clip , x , y ) ;
+                    SetClip( clip ) ;
+                    DisposeRgn( clip ) ;
 #endif
-                               }
-                               else
-                               {
-                                       status = paramErr ;
-                               }
-                       }
-                       break ;
-               default :
-                       status = paramErr ;
-                       break ;
-       }
-       return status ;
+                }
+                else
+                {
+                    status = paramErr ;
+                }
+            }
+            break ;
+        default :
+            status = paramErr ;
+            break ;
+    }
+    return status ;
 }
  
 wxControl::wxControl()
@@ -389,14 +389,14 @@ void wxControl::MacPostControlCreate()
     m_macControlIsShown  = true ;
 
     wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
-       if ( wxMacSetupControlBackgroundUPP == NULL )
-       {
-               wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
-       }
-       if ( wxMacControlActionUPP == NULL )
-       {
-           wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
-       }
+    if ( wxMacSetupControlBackgroundUPP == NULL )
+    {
+        wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
+    }
+    if ( wxMacControlActionUPP == NULL )
+    {
+        wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
+    }
     // The following block of code is responsible for crashes when switching
     // back to windows, which can be seen in the dialogs sample.
     // It is disabled until a proper solution can be found.
@@ -414,35 +414,35 @@ void wxControl::MacPostControlCreate()
     cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ;
     if (  (**(ControlHandle)m_macControl).contrlDefProc != NULL )
     {
-      (**cdef).instruction = 0x4EF9;  /* JMP instruction */
-      (**cdef).function = (void(*)()) wxMacControlActionUPP;
-      (**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
+        (**cdef).instruction = 0x4EF9;  /* JMP instruction */
+        (**cdef).function = (void(*)()) wxMacControlActionUPP;
+        (**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
     }
 #endif
 #endif
-       SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
-     // Adjust the controls size and position
-     wxPoint pos(m_x, m_y);
-     wxSize best_size( DoGetBestSize() );
-     wxSize new_size( m_width, m_height );
-     m_x = m_y = m_width = m_height = -1;  // Forces SetSize to move/size the control
-     if (new_size.x == -1) {
+    SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
+    
+    // Adjust the controls size and position
+    wxPoint pos(m_x, m_y);
+    wxSize best_size( DoGetBestSize() );
+    wxSize new_size( m_width, m_height );
+    
+    m_x = m_y = m_width = m_height = -1;  // Forces SetSize to move/size the control
+    
+    if (new_size.x == -1) {
         new_size.x = best_size.x;
-     }
-     if (new_size.y == -1) {
-         new_size.y = best_size.y;
-     }
-     SetSize(pos.x, pos.y, new_size.x, new_size.y);
-     UMAShowControl( (ControlHandle) m_macControl ) ;
-     
-     SetCursor( *wxSTANDARD_CURSOR ) ;
-     
-     Refresh() ;
+    }
+    if (new_size.y == -1) {
+        new_size.y = best_size.y;
+    }
+    
+    SetSize(pos.x, pos.y, new_size.x, new_size.y);
+    
+    UMAShowControl( (ControlHandle) m_macControl ) ;
+    
+    SetCursor( *wxSTANDARD_CURSOR ) ;
+    
+    Refresh() ;
 }
 
 void wxControl::MacAdjustControlRect() 
@@ -496,7 +496,7 @@ void wxControl::MacAdjustControlRect()
 
             m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
         }
-               MacUpdateDimensions() ;      
+          MacUpdateDimensions() ;      
 //        UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
     }
 }
@@ -511,19 +511,19 @@ WXWidget wxControl::MacGetContainerForEmbedding()
 
 void wxControl::MacUpdateDimensions() 
 {
-       // actually in the current systems this should never be possible, but later reparenting
-       // may become a reality
-       
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-               
-       if ( GetParent() == NULL )
-               return ;
-               
+    // actually in the current systems this should never be possible, but later reparenting
+    // may become a reality
+    
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+        
+    if ( GetParent() == NULL )
+        return ;
+        
     WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
     if ( rootwindow == NULL )
-       return ;
-       
+        return ;
+        
     Rect oldBounds ;       
     GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ; 
     
@@ -535,23 +535,23 @@ void wxControl::MacUpdateDimensions()
     GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
     bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
     bool doResize =  ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
-       if ( doMove || doResize )
-       {
-               InvalWindowRect( rootwindow, &oldBounds ) ;
-               if ( doMove )
-               {
-                       UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
-               }
-               if ( doResize )
-               {
-                       UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
-               }
-       }
+    if ( doMove || doResize )
+    {
+        InvalWindowRect( rootwindow, &oldBounds ) ;
+        if ( doMove )
+        {
+            UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
+        }
+        if ( doResize )
+        {
+            UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
+        }
+    }
 }
 
 void wxControl::MacSuperChangedPosition() 
 {
-       MacUpdateDimensions() ;
+     MacUpdateDimensions() ;
     wxWindow::MacSuperChangedPosition() ;
 }
 
@@ -561,7 +561,7 @@ void wxControl::MacSuperEnabled( bool enabled )
     wxWindow::MacSuperEnabled( enabled ) ;
 }
 
-void  wxControl::MacSuperShown( bool show ) 
+void wxControl::MacSuperShown( bool show ) 
 {
     if ( (ControlHandle) m_macControl )
     {
@@ -593,19 +593,19 @@ void  wxControl::DoSetSize(int x, int y,
     wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
 #if 0
     {
-       Rect meta , control ;
-       GetControlBounds( (ControlHandle) m_macControl , &control ) ;
-       RgnHandle rgn = NewRgn() ;
-       GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
-       GetRegionBounds( rgn , &meta ) ;
-       if ( !EmptyRect( &meta ) )
-       {
-                       wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
-                       wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
-                       wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
-                       wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
-               }
-       DisposeRgn( rgn ) ;
+        Rect meta , control ;
+        GetControlBounds( (ControlHandle) m_macControl , &control ) ;
+        RgnHandle rgn = NewRgn() ;
+        GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
+        GetRegionBounds( rgn , &meta ) ;
+        if ( !EmptyRect( &meta ) )
+        {
+            wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
+            wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
+            wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
+            wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
+        }
+        DisposeRgn( rgn ) ;
     }
 #endif
     return ;
@@ -814,16 +814,16 @@ void  wxControl::OnKeyDown( wxKeyEvent &event )
     
 #if TARGET_CARBON
 
-       char charCode ;
-       UInt32 keyCode ;        
+    char charCode ;
+    UInt32 keyCode ;    
     UInt32 modifiers ;
 
-       GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
-       GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
-       GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
+    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
+       GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
 
     ::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
-       
+    
 #else
     EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
     short keycode ;
@@ -895,11 +895,10 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
 
 bool wxControl::MacCanFocus() const
 {
-        { if ( (ControlHandle) m_macControl == NULL ) 
-                return true ; 
-            else
-            return false ; 
-        }
+    if ( (ControlHandle) m_macControl == NULL ) 
+        return true ; 
+    else
+        return false ; 
 }
 
 void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
index df3f6dd7cbfcbee9512af5869b2cbbb117ec1924..79633bf14da10cf8df5decc7b699f5558d375851 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -41,7 +41,7 @@ const short kwxCursorSizeNESW = 22 ;
 const short kwxCursorSizeNWSE = 23 ;
 const short kwxCursorRoller = 24 ;
 
-wxCursor       gMacCurrentCursor ;
+wxCursor    gMacCurrentCursor ;
 
 wxCursorRefData::wxCursorRefData()
 {
@@ -60,15 +60,15 @@ wxCursorRefData::~wxCursorRefData()
     {
         ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
     }
-       else if ( m_disposeHandle )
-       {
-               ::DisposeHandle( (Handle ) m_hCursor ) ;
-       
-       else if ( m_releaseHandle )
-       {
-               // we don't release the resource since it may already
-               // be in use again
-       }
+    else if ( m_disposeHandle )
+    {
+        ::DisposeHandle( (Handle ) m_hCursor ) ;
+    } 
+    else if ( m_releaseHandle )
+    {
+        // we don't release the resource since it may already
+        // be in use again
+    }
 }
 
 // Cursors
@@ -91,14 +91,14 @@ void wxCursor::CreateFromImage(const wxImage & image)
     m_refData = new wxCursorRefData;
 
     wxImage image16 = image.Scale(16,16) ;
-       unsigned char * rgbBits = image16.GetData();
+       unsigned char * rgbBits = image16.GetData();
  
-       
+    
     int w = image16.GetWidth()  ;
     int h = image16.GetHeight() ;
     bool bHasMask = image16.HasMask() ;
 
-       int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
+       int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
     int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
     if (hotSpotX < 0 || hotSpotX >= w)
             hotSpotX = 0;
@@ -112,40 +112,40 @@ void wxCursor::CreateFromImage(const wxImage & image)
     memset( cp->data , 0 , sizeof( Bits16 ) ) ;
     memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
     
-       unsigned char mr = image16.GetMaskRed() ;
-       unsigned char mg = image16.GetMaskGreen() ;
-       unsigned char mb = image16.GetMaskBlue() ;
+    unsigned char mr = image16.GetMaskRed() ;
+    unsigned char mg = image16.GetMaskGreen() ;
+    unsigned char mb = image16.GetMaskBlue() ;
     for ( int y = 0 ; y < h ; ++y )
     {
-       short rowbits = 0 ;
-       short maskbits = 0 ;
-       
-       for ( int x = 0 ; x < w ; ++x )
-       {
-               long pos = (y * w + x) * 3;
+        short rowbits = 0 ;
+        short maskbits = 0 ;
+        
+        for ( int x = 0 ; x < w ; ++x )
+        {
+            long pos = (y * w + x) * 3;
 
-               unsigned char r = rgbBits[pos] ;
-               unsigned char g = rgbBits[pos+1] ;
-               unsigned char b = rgbBits[pos+2] ;
-               if ( bHasMask && r==mr && g==mg && b==mb )
-               {
-                       // masked area, does not appear anywhere
-               }
-               else
-               {
-                       if ( (int)r + (int)g + (int)b < 0x60 )
-                       {
-                               rowbits |= ( 1 << (15-x) ) ;
-                       }
-                       maskbits |= ( 1 << (15-x) ) ;
-               }
-       }
-       cp->data[y] = rowbits ;
-       cp->mask[y] = maskbits ;
+            unsigned char r = rgbBits[pos] ;
+            unsigned char g = rgbBits[pos+1] ;
+            unsigned char b = rgbBits[pos+2] ;
+            if ( bHasMask && r==mr && g==mg && b==mb )
+            {
+                // masked area, does not appear anywhere
+            }
+            else
+            {
+                if ( (int)r + (int)g + (int)b < 0x60 )
+                {
+                    rowbits |= ( 1 << (15-x) ) ;
+                }
+                maskbits |= ( 1 << (15-x) ) ;
+            }
+        }
+        cp->data[y] = rowbits ;
+        cp->mask[y] = maskbits ;
     }
     if ( !bHasMask )
     {
-       memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
+        memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
     }
     
     cp->hotSpot.h = hotSpotX ;
@@ -158,40 +158,40 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
     m_refData = new wxCursorRefData;
     if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
     {
-       Str255 theName ;
+        Str255 theName ;
 
     #if TARGET_CARBON
-       c2pstrcpy( (StringPtr) theName , cursor_file ) ;
+        c2pstrcpy( (StringPtr) theName , cursor_file ) ;
     #else
-       strcpy( (char *) theName , cursor_file ) ;
-       c2pstr( (char *) theName ) ;
+        strcpy( (char *) theName , cursor_file ) ;
+        c2pstr( (char *) theName ) ;
     #endif
-       
+        
         wxStAppResource resload ;
-       Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
-       if ( resHandle )
-       {
-                       short theId = -1 ;
-               OSType theType ;
-               GetResInfo( resHandle , &theId , &theType , theName ) ;
-               ReleaseResource( resHandle ) ;
-               M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
-               if ( M_CURSORDATA->m_hCursor )
-                       M_CURSORDATA->m_isColorCursor = true ;
-       }
-       else
-       {       
-               Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
-               if ( resHandle )
-               {
-                               short theId = -1 ;
-                       OSType theType ;
-                       GetResInfo( resHandle , &theId , &theType , theName ) ;
-                       ReleaseResource( resHandle ) ;
-                       M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
-                       if ( M_CURSORDATA->m_hCursor )
-                               M_CURSORDATA->m_releaseHandle = true ;
-               }
+        Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
+        if ( resHandle )
+        {
+            short theId = -1 ;
+            OSType theType ;
+            GetResInfo( resHandle , &theId , &theType , theName ) ;
+            ReleaseResource( resHandle ) ;
+            M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
+            if ( M_CURSORDATA->m_hCursor )
+                M_CURSORDATA->m_isColorCursor = true ;
+        }
+        else
+        {       
+            Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
+            if ( resHandle )
+            {
+                short theId = -1 ;
+                OSType theType ;
+                GetResInfo( resHandle , &theId , &theType , theName ) ;
+                ReleaseResource( resHandle ) ;
+                 M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
+                if ( M_CURSORDATA->m_hCursor )
+                    M_CURSORDATA->m_releaseHandle = true ;
+            }
         }
     }
     else
@@ -211,155 +211,155 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
 // Cursors by stock number
 wxCursor::wxCursor(int cursor_type)
 {
-  m_refData = new wxCursorRefData;
-
-  switch (cursor_type)
-  {
+    m_refData = new wxCursorRefData;
+    
+    switch (cursor_type)
+    {
     case wxCURSOR_WAIT:
-      M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
-      break;
+        M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
+        break;
     case wxCURSOR_IBEAM:
-      M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
-      break;
+        M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
+        break;
     case wxCURSOR_CROSS:
-      M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
-      break;
+        M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
+        break;
     case wxCURSOR_SIZENWSE:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
-      }
-      break;
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
+        }
+        break;
     case wxCURSOR_SIZENESW:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
-      }
-      break;
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
+        }
+        break;
     case wxCURSOR_SIZEWE:
-      {
-       M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
-      }
-      break;
+        {
+            M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
+        }
+        break;
     case wxCURSOR_SIZENS:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
-      }
-      break;
-   case wxCURSOR_SIZING:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
-      }
-      break;
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
+        }
+        break;
+    case wxCURSOR_SIZING:
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
+        }
+        break;
     case wxCURSOR_HAND:
-      {
-        M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
-      }
-      break;
+        {
+            M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
+        }
+        break;
     case wxCURSOR_BULLSEYE:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
         }
         break;
     case wxCURSOR_PENCIL:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
         }
         break;
     case wxCURSOR_MAGNIFIER:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
         }
         break;
     case wxCURSOR_NO_ENTRY:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
         }
         break;
     case wxCURSOR_WATCH:
-    {
-      M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
-      break;
-    }
+        {
+            M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
+            break;
+        }
     case wxCURSOR_PAINT_BRUSH:
-    {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
+            break;
+        }
     case wxCURSOR_POINT_LEFT:
-    {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
+            break;
+        }
     case wxCURSOR_POINT_RIGHT:
-    {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
+            break;
+        }
     case wxCURSOR_QUESTION_ARROW:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
+            break;
+        }
     case wxCURSOR_BLANK:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
+            break;
+        }
     case wxCURSOR_RIGHT_ARROW:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
+            break;
+        }
     case wxCURSOR_SPRAYCAN:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
+            break;
+        }
     case wxCURSOR_CHAR:
     case wxCURSOR_ARROW:
     case wxCURSOR_LEFT_BUTTON:
     case wxCURSOR_RIGHT_BUTTON:
     case wxCURSOR_MIDDLE_BUTTON:
-     default:
-      M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
-      break;
-       }
-       if ( M_CURSORDATA->m_themeCursor == -1 )
-               M_CURSORDATA->m_releaseHandle = true ;
+    default:
+        M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
+        break;
+    }
+    if ( M_CURSORDATA->m_themeCursor == -1 )
+        M_CURSORDATA->m_releaseHandle = true ;
 }
 
 void wxCursor::MacInstall() const 
 {
-       gMacCurrentCursor = *this ;
-       if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
-       {
-               SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
-       }
-       else if ( m_refData && M_CURSORDATA->m_hCursor )
-       {
-           if ( M_CURSORDATA->m_isColorCursor )
-                   ::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
-           else
-                   ::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
-       }
-       else
-       {
-               SetThemeCursor( kThemeArrowCursor ) ;
-       }
+    gMacCurrentCursor = *this ;
+    if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
+    {
+        SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
+    }
+    else if ( m_refData && M_CURSORDATA->m_hCursor )
+    {
+        if ( M_CURSORDATA->m_isColorCursor )
+            ::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
+        else
+            ::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
+    }
+    else
+    {
+        SetThemeCursor( kThemeArrowCursor ) ;
+    }
 }
 
 wxCursor::~wxCursor()
@@ -369,7 +369,7 @@ wxCursor::~wxCursor()
 // Global cursor setting
 void wxSetCursor(const wxCursor& cursor)
 {
-       cursor.MacInstall() ;
+    cursor.MacInstall() ;
 }
 
 
index c6471c8b0bfbd8a113f38a4188bf376dceaba2bd..6b56b896dcfbfa8b4e5f53f716a3513e85e4f921 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -137,7 +137,7 @@ const wxChar *wxDoubleToStringStr = wxT("%.2f");
 const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
 
 const wxEventTable wxEvtHandler::sm_eventTable =
-       { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
+    { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
 
 const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
 #endif
index 3d6437c7b743c73646dd0d5d4533f3708f4cd96e..15377f7f5b0644fa060758504d1461077c803d99 100644 (file)
@@ -141,7 +141,7 @@ bool wxDataObject::IsSupportedFormat(
     }
     else
     {
-        wxDataFormat*               pFormats = new wxDataFormat[nFormatCount];
+        wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
         GetAllFormats( pFormats
                       ,vDir
                      );
@@ -183,7 +183,7 @@ bool wxFileDataObject::GetDataHere(
 
 size_t wxFileDataObject::GetDataSize() const
 {
-    size_t                          nRes = 0;
+    size_t nRes = 0;
 
     for (size_t i = 0; i < m_filenames.GetCount(); i++)
     {
@@ -201,7 +201,7 @@ bool wxFileDataObject::SetData(
 {
     m_filenames.Empty();
 
-    wxString                        sFile( (const char *)pBuf);  /* char, not wxChar */
+    wxString sFile( (const char *)pBuf);  /* char, not wxChar */
 
     AddFile(sFile);
 
@@ -225,15 +225,15 @@ wxBitmapDataObject::wxBitmapDataObject()
 }
 
 wxBitmapDataObject::wxBitmapDataObject(
-  const wxBitmap&                   rBitmap
+  const wxBitmap& rBitmap
 )
 : wxBitmapDataObjectBase(rBitmap)
 {
     Init();
     if ( m_bitmap.Ok() )
     {
-               m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
-       }
+        m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
+    }
 }
 
 wxBitmapDataObject::~wxBitmapDataObject()
@@ -249,23 +249,23 @@ void wxBitmapDataObject::SetBitmap(
     wxBitmapDataObjectBase::SetBitmap(rBitmap);
     if ( m_bitmap.Ok() )
     {
-               m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
-       }
+        m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
+    }
 }
 
 void wxBitmapDataObject::Init() 
 { 
-       m_pictHandle = NULL ;
-       m_pictCreated = false ;
+    m_pictHandle = NULL ;
+    m_pictCreated = false ;
 } 
 
 void wxBitmapDataObject::Clear() 
 {
-       if ( m_pictCreated && m_pictHandle )
-       {
-               KillPicture( (PicHandle) m_pictHandle ) ;
-       }
-       m_pictHandle = NULL ;
+    if ( m_pictCreated && m_pictHandle )
+    {
+        KillPicture( (PicHandle) m_pictHandle ) ;
+    }
+    m_pictHandle = NULL ;
 }
 
 bool wxBitmapDataObject::GetDataHere(
@@ -283,7 +283,7 @@ bool wxBitmapDataObject::GetDataHere(
 
 size_t wxBitmapDataObject::GetDataSize() const
 {
-       return GetHandleSize((Handle)m_pictHandle) ;
+    return GetHandleSize((Handle)m_pictHandle) ;
 }
 
 bool wxBitmapDataObject::SetData(
@@ -299,7 +299,7 @@ bool wxBitmapDataObject::SetData(
     Rect frame = (**picHandle).picFrame ;
     
     m_bitmap.SetPict( picHandle ) ;
-       m_bitmap.SetWidth( frame.right - frame.left ) ;
-       m_bitmap.SetHeight( frame.bottom - frame.top ) ;
+    m_bitmap.SetWidth( frame.right - frame.left ) ;
+    m_bitmap.SetHeight( frame.bottom - frame.top ) ;
     return m_bitmap.Ok();
 }
index 9e84d5f4aa7ac7215d08f95b06bb542ca27e086f..9dff84e4d3800fe11a16ff5d6fcb1b377d9335f6 100644 (file)
@@ -6,11 +6,13 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 #pragma implementation "dc.h"
 #endif
+
 #include "wx/dc.h"
 #include "wx/app.h"
 #include "wx/mac/uma.h"
@@ -30,32 +32,37 @@ using namespace std ;
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 #endif
+
 //-----------------------------------------------------------------------------
 // constants
 //-----------------------------------------------------------------------------
-#define mm2inches              0.0393700787402
-#define inches2mm              25.4
-#define mm2twips               56.6929133859
-#define twips2mm               0.0176388888889
-#define mm2pt                  2.83464566929
-#define pt2mm                  0.352777777778
+
+#define mm2inches        0.0393700787402
+#define inches2mm        25.4
+#define mm2twips        56.6929133859
+#define twips2mm        0.0176388888889
+#define mm2pt            2.83464566929
+#define pt2mm            0.352777777778
 #ifndef __DARWIN__
 const double M_PI = 3.14159265358979 ;
 #endif
 const double RAD2DEG  = 180.0 / M_PI;
 const short kEmulatedMode = -1 ;
 const short kUnsupportedMode = -2 ;
+
 wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) :
-       m_ph( (GrafPtr) dc->m_macPort )
+    m_ph( (GrafPtr) dc->m_macPort )
 {
-       wxASSERT( dc->Ok() ) ;
-       m_dc = dc ;
-       dc->MacSetupPort(&m_ph) ;
+    wxASSERT( dc->Ok() ) ;
+    m_dc = dc ;
+    dc->MacSetupPort(&m_ph) ;
 }
+
 wxMacPortSetter::~wxMacPortSetter()
 {
-       m_dc->MacCleanupPort(&m_ph) ;
+    m_dc->MacCleanupPort(&m_ph) ;
 }
+
 wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) 
 {
     m_formerClip = NewRgn() ;
@@ -65,21 +72,21 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
     if ( win )
     {
 #if 0
-       // this clipping area was set to the parent window's drawing area, lead to problems
-       // with MacOSX controls drawing outside their wx' rectangle
+        // this clipping area was set to the parent window's drawing area, lead to problems
+        // with MacOSX controls drawing outside their wx' rectangle
         RgnHandle insidergn = NewRgn() ;
         int x = 0 , y = 0;
         wxWindow *parent = win->GetParent() ;
         parent->MacWindowToRootWindow( &x,&y ) ;
         wxSize size = parent->GetSize() ;
         SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() , 
-         size.x - parent->MacGetRightBorderSize(), 
-         size.y - parent->MacGetBottomBorderSize()) ;
+            size.x - parent->MacGetRightBorderSize(), 
+            size.y - parent->MacGetBottomBorderSize()) ;
         CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , m_newClip ) ;
-       SectRgn( m_newClip , insidergn , m_newClip ) ;
+        SectRgn( m_newClip , insidergn , m_newClip ) ;
         OffsetRgn( m_newClip , x , y ) ;
         SetClip( m_newClip ) ;
-       DisposeRgn( insidergn ) ;
+        DisposeRgn( insidergn ) ;
 #endif
         RgnHandle insidergn = NewRgn() ;
         int x = 0 , y = 0;
@@ -87,138 +94,143 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
         CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion().GetWXHRGN() , m_newClip ) ;
         OffsetRgn( m_newClip , x , y ) ;
         SetClip( m_newClip ) ;
-       }
+    }
 }
+
 wxMacWindowClipper::~wxMacWindowClipper() 
 {
     SetClip( m_formerClip ) ;
-       DisposeRgn( m_newClip ) ;
-       DisposeRgn( m_formerClip ) ;
+    DisposeRgn( m_newClip ) ;
+    DisposeRgn( m_formerClip ) ;
 }
+
 //-----------------------------------------------------------------------------
 // Local functions
 //-----------------------------------------------------------------------------
 static inline double dmin(double a, double b) { return a < b ? a : b; }
 static inline double dmax(double a, double b) { return a > b ? a : b; }
 static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
+
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
 // this function emulates all wx colour manipulations, used to verify the implementation
 // by setting the mode in the blitting functions to kEmulatedMode
 void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColor &dstColor ) ;
+
 void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColor &dstColor )
 {
     switch ( logical_func )
     {
-       case wxAND:        // src AND dst
-           dstColor.red = dstColor.red & srcColor.red ;
-           dstColor.green = dstColor.green & srcColor.green ;
-           dstColor.blue = dstColor.blue & srcColor.blue ;
-           break ;
-       case wxAND_INVERT: // (NOT src) AND dst
-           dstColor.red = dstColor.red & ~srcColor.red ;
-           dstColor.green = dstColor.green & ~srcColor.green ;
-           dstColor.blue = dstColor.blue & ~srcColor.blue ;
-           break ;
-       case wxAND_REVERSE:// src AND (NOT dst)
-           dstColor.red = ~dstColor.red & srcColor.red ;
-           dstColor.green = ~dstColor.green & srcColor.green ;
-           dstColor.blue = ~dstColor.blue & srcColor.blue ;
-           break ;
-       case wxCLEAR:      // 0
-           dstColor.red = 0 ;
-           dstColor.green = 0 ;
-           dstColor.blue = 0 ;
-           break ;
+        case wxAND:        // src AND dst
+            dstColor.red = dstColor.red & srcColor.red ;
+            dstColor.green = dstColor.green & srcColor.green ;
+            dstColor.blue = dstColor.blue & srcColor.blue ;
+            break ;
+        case wxAND_INVERT: // (NOT src) AND dst
+            dstColor.red = dstColor.red & ~srcColor.red ;
+            dstColor.green = dstColor.green & ~srcColor.green ;
+            dstColor.blue = dstColor.blue & ~srcColor.blue ;
+            break ;
+        case wxAND_REVERSE:// src AND (NOT dst)
+            dstColor.red = ~dstColor.red & srcColor.red ;
+            dstColor.green = ~dstColor.green & srcColor.green ;
+            dstColor.blue = ~dstColor.blue & srcColor.blue ;
+            break ;
+        case wxCLEAR:      // 0
+            dstColor.red = 0 ;
+            dstColor.green = 0 ;
+            dstColor.blue = 0 ;
+            break ;
         case wxCOPY:       // src
-           dstColor.red = srcColor.red ;
-           dstColor.green = srcColor.green ;
-           dstColor.blue = srcColor.blue ;
-               break ;
-       case wxEQUIV:      // (NOT src) XOR dst
-           dstColor.red = dstColor.red ^ ~srcColor.red ;
-           dstColor.green = dstColor.green ^ ~srcColor.green ;
-           dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
-           break ;
-       case wxINVERT:     // NOT dst
-           dstColor.red = ~dstColor.red ;
-           dstColor.green = ~dstColor.green ;
-           dstColor.blue = ~dstColor.blue ;
-               break ;
-       case wxNAND:       // (NOT src) OR (NOT dst)
-           dstColor.red = ~dstColor.red | ~srcColor.red ;
-           dstColor.green = ~dstColor.green | ~srcColor.green ;
-           dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
-           break ;
-       case wxNOR:        // (NOT src) AND (NOT dst)
-           dstColor.red = ~dstColor.red & ~srcColor.red ;
-           dstColor.green = ~dstColor.green & ~srcColor.green ;
-           dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
-           break ;
-       case wxNO_OP:      // dst
-           break ;
-       case wxOR:         // src OR dst
-           dstColor.red = dstColor.red | srcColor.red ;
-           dstColor.green = dstColor.green | srcColor.green ;
-           dstColor.blue = dstColor.blue | srcColor.blue ;
-           break ;
-       case wxOR_INVERT:  // (NOT src) OR dst
-           dstColor.red = dstColor.red | ~srcColor.red ;
-           dstColor.green = dstColor.green | ~srcColor.green ;
-           dstColor.blue = dstColor.blue | ~srcColor.blue ;
-           break ;
-       case wxOR_REVERSE: // src OR (NOT dst)
-           dstColor.red = ~dstColor.red | srcColor.red ;
-           dstColor.green = ~dstColor.green | srcColor.green ;
-           dstColor.blue = ~dstColor.blue | srcColor.blue ;
-               break ;
-       case wxSET:        // 1
-           dstColor.red = 0xFFFF ;
-           dstColor.green = 0xFFFF ;
-           dstColor.blue = 0xFFFF ;
-           break ;
-       case wxSRC_INVERT: // (NOT src)
-           dstColor.red = ~srcColor.red ;
-           dstColor.green = ~srcColor.green ;
-           dstColor.blue = ~srcColor.blue ;
-               break ;
-       case wxXOR:        // src XOR dst
-           dstColor.red = dstColor.red ^ srcColor.red ;
-           dstColor.green = dstColor.green ^ srcColor.green ;
-           dstColor.blue = dstColor.blue ^ srcColor.blue ;
-               break ;
+            dstColor.red = srcColor.red ;
+            dstColor.green = srcColor.green ;
+            dstColor.blue = srcColor.blue ;
+            break ;
+        case wxEQUIV:      // (NOT src) XOR dst
+            dstColor.red = dstColor.red ^ ~srcColor.red ;
+            dstColor.green = dstColor.green ^ ~srcColor.green ;
+            dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
+            break ;
+        case wxINVERT:     // NOT dst
+            dstColor.red = ~dstColor.red ;
+            dstColor.green = ~dstColor.green ;
+            dstColor.blue = ~dstColor.blue ;
+            break ;
+        case wxNAND:       // (NOT src) OR (NOT dst)
+            dstColor.red = ~dstColor.red | ~srcColor.red ;
+            dstColor.green = ~dstColor.green | ~srcColor.green ;
+            dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
+            break ;
+        case wxNOR:        // (NOT src) AND (NOT dst)
+            dstColor.red = ~dstColor.red & ~srcColor.red ;
+            dstColor.green = ~dstColor.green & ~srcColor.green ;
+            dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
+            break ;
+        case wxNO_OP:      // dst
+            break ;
+        case wxOR:         // src OR dst
+            dstColor.red = dstColor.red | srcColor.red ;
+            dstColor.green = dstColor.green | srcColor.green ;
+            dstColor.blue = dstColor.blue | srcColor.blue ;
+            break ;
+        case wxOR_INVERT:  // (NOT src) OR dst
+            dstColor.red = dstColor.red | ~srcColor.red ;
+            dstColor.green = dstColor.green | ~srcColor.green ;
+            dstColor.blue = dstColor.blue | ~srcColor.blue ;
+            break ;
+        case wxOR_REVERSE: // src OR (NOT dst)
+            dstColor.red = ~dstColor.red | srcColor.red ;
+            dstColor.green = ~dstColor.green | srcColor.green ;
+            dstColor.blue = ~dstColor.blue | srcColor.blue ;
+            break ;
+        case wxSET:        // 1
+            dstColor.red = 0xFFFF ;
+            dstColor.green = 0xFFFF ;
+            dstColor.blue = 0xFFFF ;
+            break ;
+        case wxSRC_INVERT: // (NOT src)
+            dstColor.red = ~srcColor.red ;
+            dstColor.green = ~srcColor.green ;
+            dstColor.blue = ~srcColor.blue ;
+            break ;
+        case wxXOR:        // src XOR dst
+            dstColor.red = dstColor.red ^ srcColor.red ;
+            dstColor.green = dstColor.green ^ srcColor.green ;
+            dstColor.blue = dstColor.blue ^ srcColor.blue ;
+            break ;
     }
 }
+
 wxDC::wxDC()
 {
-  m_ok = FALSE;
-  m_colour = TRUE;
-  m_mm_to_pix_x = mm2pt;
-  m_mm_to_pix_y = mm2pt;
-  m_internalDeviceOriginX = 0;
-  m_internalDeviceOriginY = 0;
-  m_externalDeviceOriginX = 0;
-  m_externalDeviceOriginY = 0;
-  m_logicalScaleX = 1.0;
-  m_logicalScaleY = 1.0;
-  m_userScaleX = 1.0;
-  m_userScaleY = 1.0;
-  m_scaleX = 1.0;
-  m_scaleY = 1.0;
-  m_needComputeScaleX = FALSE;
-  m_needComputeScaleY = FALSE;
-  m_macPort = NULL ;
-  m_macMask = NULL ;
-  m_ok = FALSE ;
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
-       m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
-       m_macBoundaryClipRgn = NewRgn() ;
-       m_macCurrentClipRgn = NewRgn() ;
-       SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
-       SetRectRgn( (RgnHandle) m_macCurrentClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
+    m_ok = FALSE;
+    m_colour = TRUE;
+    m_mm_to_pix_x = mm2pt;
+    m_mm_to_pix_y = mm2pt;
+    m_internalDeviceOriginX = 0;
+    m_internalDeviceOriginY = 0;
+    m_externalDeviceOriginX = 0;
+    m_externalDeviceOriginY = 0;
+    m_logicalScaleX = 1.0;
+    m_logicalScaleY = 1.0;
+    m_userScaleX = 1.0;
+    m_userScaleY = 1.0;
+    m_scaleX = 1.0;
+    m_scaleY = 1.0;
+    m_needComputeScaleX = FALSE;
+    m_needComputeScaleY = FALSE;
+    m_macPort = NULL ;
+    m_macMask = NULL ;
+    m_ok = FALSE ;
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
+    m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
+    m_macBoundaryClipRgn = NewRgn() ;
+    m_macCurrentClipRgn = NewRgn() ;
+    SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
+    SetRectRgn( (RgnHandle) m_macCurrentClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
     m_pen = *wxBLACK_PEN;
     m_font = *wxNORMAL_FONT;
     m_brush = *wxWHITE_BRUSH;
@@ -228,20 +240,23 @@ wxDC::wxDC()
     m_macForegroundPixMap = NULL ;
     m_macBackgroundPixMap = NULL ;
 }
+
 wxDC::~wxDC(void)
 {
     DisposeRgn( (RgnHandle) m_macBoundaryClipRgn ) ;
     DisposeRgn( (RgnHandle) m_macCurrentClipRgn ) ;
 }
+
 void wxDC::MacSetupPort(wxMacPortStateHelper* help) const
 {
     wxASSERT( m_macCurrentPortStateHelper == NULL ) ;
     m_macCurrentPortStateHelper = help ;
-       SetClip( (RgnHandle) m_macCurrentClipRgn);
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
+    SetClip( (RgnHandle) m_macCurrentClipRgn);
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
 }
+
 void wxDC::MacCleanupPort(wxMacPortStateHelper* help) const
 {
     wxASSERT( m_macCurrentPortStateHelper == help ) ;
@@ -271,6 +286,7 @@ void wxDC::MacCleanupPort(wxMacPortStateHelper* help) const
         m_macBackgroundPixMap = NULL ;
     }
 }
+
 void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
 {
      wxCHECK_RET( Ok(), wxT("invalid window dc") );
@@ -356,12 +372,14 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
      m_macBrushInstalled = false ;
      m_macFontInstalled = false ;
 }
+
 void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
 {
-     wxCHECK_RET(Ok(), wxT("Invalid dc  wxDC::DoDrawIcon"));
-     wxCHECK_RET(icon.Ok(), wxT("Invalid icon wxDC::DoDrawIcon"));
+    wxCHECK_RET(Ok(), wxT("Invalid dc  wxDC::DoDrawIcon"));
+    wxCHECK_RET(icon.Ok(), wxT("Invalid icon wxDC::DoDrawIcon"));
     DoDrawBitmap( icon , x , y , icon.GetMask() != NULL ) ;
 }
+
 void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion  Invalid DC"));
@@ -388,10 +406,11 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
         m_clipY2 = yy + hh;
     }
 }
+
 void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
 {
     wxCHECK_RET( Ok(), wxT("invalid window dc") ) ;
-       wxMacPortSetter helper(this) ;
+      wxMacPortSetter helper(this) ;
     if (region.Empty())
     {
         DestroyClippingRegion();
@@ -435,113 +454,127 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
         }
     }
 }
+
 void wxDC::DestroyClippingRegion()
 {
-  wxMacPortSetter helper(this) ;
-  CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
-  m_clipping = FALSE;
+    wxMacPortSetter helper(this) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_clipping = FALSE;
 }
+
 void wxDC::DoGetSize( int* width, int* height ) const
 {
-  *width = m_maxX-m_minX;
-  *height = m_maxY-m_minY;
+    *width = m_maxX-m_minX;
+    *height = m_maxY-m_minY;
 }
+
 void wxDC::DoGetSizeMM( int* width, int* height ) const
 {
-  int w = 0;
-  int h = 0;
-  GetSize( &w, &h );
-  *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
-  *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
+    int w = 0;
+    int h = 0;
+    GetSize( &w, &h );
+    *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
+    *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
 }
+
 void wxDC::SetTextForeground( const wxColour &col )
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     m_textForegroundColour = col;
     m_macFontInstalled = false ;
 }
+
 void wxDC::SetTextBackground( const wxColour &col )
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     m_textBackgroundColour = col;
     m_macFontInstalled = false ;
 }
+
 void wxDC::SetMapMode( int mode )
 {
-  switch (mode)
-  {
+    switch (mode)
+    {
     case wxMM_TWIPS:
-      SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-      break;
+        SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
+        break;
     case wxMM_POINTS:
-      SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-      break;
+        SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
+        break;
     case wxMM_METRIC:
-      SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-      break;
+        SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
+        break;
     case wxMM_LOMETRIC:
-      SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-      break;
+        SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
+        break;
     default:
     case wxMM_TEXT:
-      SetLogicalScale( 1.0, 1.0 );
-      break;
-  }
-  if (mode != wxMM_TEXT)
-  {
-    m_needComputeScaleX = TRUE;
-    m_needComputeScaleY = TRUE;
-  }
+        SetLogicalScale( 1.0, 1.0 );
+        break;
+    }
+    if (mode != wxMM_TEXT)
+    {
+        m_needComputeScaleX = TRUE;
+        m_needComputeScaleY = TRUE;
+    }
 }
+
 void wxDC::SetUserScale( double x, double y )
 {
-  // allow negative ? -> no
-  m_userScaleX = x;
-  m_userScaleY = y;
-  ComputeScaleAndOrigin();
+    // allow negative ? -> no
+    m_userScaleX = x;
+    m_userScaleY = y;
+    ComputeScaleAndOrigin();
 }
+
 void wxDC::SetLogicalScale( double x, double y )
 {
-  // allow negative ?
-  m_logicalScaleX = x;
-  m_logicalScaleY = y;
-  ComputeScaleAndOrigin();
+    // allow negative ?
+    m_logicalScaleX = x;
+    m_logicalScaleY = y;
+    ComputeScaleAndOrigin();
 }
+
 void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
 {
-  m_logicalOriginX = x * m_signX;   // is this still correct ?
-  m_logicalOriginY = y * m_signY;
-  ComputeScaleAndOrigin();
+    m_logicalOriginX = x * m_signX;   // is this still correct ?
+    m_logicalOriginY = y * m_signY;
+    ComputeScaleAndOrigin();
 }
+
 void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
 {
-  m_externalDeviceOriginX = x;
-  m_externalDeviceOriginY = y;
-  ComputeScaleAndOrigin();
+    m_externalDeviceOriginX = x;
+    m_externalDeviceOriginY = y;
+    ComputeScaleAndOrigin();
 }
+
 #if 0
 void wxDC::SetInternalDeviceOrigin( long x, long y )
 {
-  m_internalDeviceOriginX = x;
-  m_internalDeviceOriginY = y;
-  ComputeScaleAndOrigin();
+    m_internalDeviceOriginX = x;
+    m_internalDeviceOriginY = y;
+    ComputeScaleAndOrigin();
 }
 void wxDC::GetInternalDeviceOrigin( long *x, long *y )
 {
-  if (x) *x = m_internalDeviceOriginX;
-  if (y) *y = m_internalDeviceOriginY;
+    if (x) *x = m_internalDeviceOriginX;
+    if (y) *y = m_internalDeviceOriginY;
 }
 #endif
+
 void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
-  m_signX = (xLeftRight ?  1 : -1);
-  m_signY = (yBottomUp  ? -1 :  1);
-  ComputeScaleAndOrigin();
+    m_signX = (xLeftRight ?  1 : -1);
+    m_signY = (yBottomUp  ? -1 :  1);
+    ComputeScaleAndOrigin();
 }
+
 wxSize wxDC::GetPPI() const
 {
     return wxSize(72, 72);
 }
+
 int wxDC::GetDepth() const
 {
     if ( IsPortColor( (CGrafPtr) m_macPort ) )
@@ -550,77 +583,88 @@ int wxDC::GetDepth() const
     }
     return 1 ;
 }
+
 void wxDC::ComputeScaleAndOrigin()
 {
-  // CMB: copy scale to see if it changes
-  double origScaleX = m_scaleX;
-  double origScaleY = m_scaleY;
-  m_scaleX = m_logicalScaleX * m_userScaleX;
-  m_scaleY = m_logicalScaleY * m_userScaleY;
-  m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
-  m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
-  // CMB: if scale has changed call SetPen to recalulate the line width
-  if (m_scaleX != origScaleX || m_scaleY != origScaleY)
-  {
-    // this is a bit artificial, but we need to force wxDC to think
-    // the pen has changed
-    wxPen* pen = & GetPen();
-    wxPen tempPen;
-    m_pen = tempPen;
-    SetPen(* pen);
-  }
+    // CMB: copy scale to see if it changes
+    double origScaleX = m_scaleX;
+    double origScaleY = m_scaleY;
+    m_scaleX = m_logicalScaleX * m_userScaleX;
+    m_scaleY = m_logicalScaleY * m_userScaleY;
+    m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
+    m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
+    // CMB: if scale has changed call SetPen to recalulate the line width
+    if (m_scaleX != origScaleX || m_scaleY != origScaleY)
+    {
+        // this is a bit artificial, but we need to force wxDC to think
+        // the pen has changed
+        wxPen* pen = & GetPen();
+        wxPen tempPen;
+        m_pen = tempPen;
+        SetPen(* pen);
+    }
 }
+
 void  wxDC::SetPalette( const wxPalette& palette )
 {
 }
+
 void  wxDC::SetBackgroundMode( int mode )
 {
-       m_backgroundMode = mode ;
+    m_backgroundMode = mode ;
 }
+
 void  wxDC::SetFont( const wxFont &font )
 {
     m_font = font;
     m_macFontInstalled = false ;
 }
+
 void  wxDC::SetPen( const wxPen &pen )
 {
-       if ( m_pen == pen )
-               return ;
-  m_pen = pen;
-  m_macPenInstalled = false ;
+    if ( m_pen == pen )
+        return ;
+    m_pen = pen;
+    m_macPenInstalled = false ;
 }
+
 void  wxDC::SetBrush( const wxBrush &brush )
 {
-  if (m_brush == brush)
-       return;
-  m_brush = brush;
-  m_macBrushInstalled = false ;
+    if (m_brush == brush)
+        return;
+    m_brush = brush;
+    m_macBrushInstalled = false ;
 }
+
 void  wxDC::SetBackground( const wxBrush &brush )
 {
-  if (m_backgroundBrush == brush)
-       return;
-  m_backgroundBrush = brush;
-  if (!m_backgroundBrush.Ok())
-       return;
-   m_macBrushInstalled = false ;
+    if (m_backgroundBrush == brush)
+        return;
+    m_backgroundBrush = brush;
+    if (!m_backgroundBrush.Ok())
+        return;
+    m_macBrushInstalled = false ;
 }
+
 void  wxDC::SetLogicalFunction( int function )
 {
-       if (m_logicalFunction == function)
-               return;
-       m_logicalFunction = function ;
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
+    if (m_logicalFunction == function)
+        return;
+    m_logicalFunction = function ;
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
 }
+
 extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
                           const wxColour & col, int style);
+
 bool wxDC::DoFloodFill(wxCoord x, wxCoord y,
                        const wxColour& col, int style)
 {
     return wxDoFloodFill(this, x, y, col, style);
 }
+
 bool  wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
 {
     wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel  Invalid DC") );
@@ -629,47 +673,49 @@ bool  wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
     GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
     // Convert from Mac colour to wx
     col->Set( colour.red   >> 8,
-              colour.green >> 8,
-              colour.blue  >> 8);
+        colour.green >> 8,
+        colour.blue  >> 8);
     return true ;
 }
+
 void  wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
 {
-  wxCHECK_RET(Ok(), wxT("Invalid DC"));
-  wxMacPortSetter helper(this) ;
-  if (m_pen.GetStyle() != wxTRANSPARENT)
-  {
-               MacInstallPen() ;
-               wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
-                            m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
+        m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
         wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
         wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
         wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
         wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
         if ((m_pen.GetCap() == wxCAP_ROUND) &&
             (m_pen.GetWidth() <= 1))
-       {
-           // Implement LAST_NOT for MAC at least for
-           // orthogonal lines. RR.
-               if (xx1 == xx2)
-               {
-                       if (yy1 < yy2)
-                               yy2--;
-                   if (yy1 > yy2)
-                       yy2++;
-               }
-               if (yy1 == yy2)
-               {
-                       if (xx1 < xx2)
-                               xx2--;
-                   if (xx1 > xx2)
-                       xx2++;
-               }
-       }
-               ::MoveTo(xx1, yy1);
-               ::LineTo(xx2, yy2);
-  }
+        {
+            // Implement LAST_NOT for MAC at least for
+            // orthogonal lines. RR.
+            if (xx1 == xx2)
+            {
+                if (yy1 < yy2)
+                    yy2--;
+                if (yy1 > yy2)
+                    yy2++;
+            }
+            if (yy1 == yy2)
+            {
+                if (xx1 < xx2)
+                    xx2--;
+                if (xx1 > xx2)
+                    xx2++;
+            }
+        }
+        ::MoveTo(xx1, yy1);
+        ::LineTo(xx2, yy2);
+    }
 }
+
 void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
 {
     wxCHECK_RET( Ok(), wxT("wxDC::DoCrossHair  Invalid window dc") );
@@ -690,14 +736,16 @@ void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
         CalcBoundingBox(x+w, y+h);
     }
 }
+
 /*
- * To draw arcs properly the angles need to be converted from the WX style:
- * Angles start on the +ve X axis and go anti-clockwise (As you would draw on
- * a normal axis on paper).
- * TO
- * the Mac style:
- * Angles start on the +ve y axis and go clockwise.
- */
+* To draw arcs properly the angles need to be converted from the WX style:
+* Angles start on the +ve X axis and go anti-clockwise (As you would draw on
+* a normal axis on paper).
+* TO
+* the Mac style:
+* Angles start on the +ve y axis and go clockwise.
+*/
+
 static double wxConvertWXangleToMACangle(double angle)
 {
     double newAngle = 90 - angle ;
@@ -705,9 +753,10 @@ static double wxConvertWXangleToMACangle(double angle)
         newAngle += 360 ;
     return newAngle ;
 }
+
 void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
-                           wxCoord x2, wxCoord y2,
-                           wxCoord xc, wxCoord yc )
+                      wxCoord x2, wxCoord y2,
+                      wxCoord xc, wxCoord yc )
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc  Invalid DC"));
     wxMacPortSetter helper(this) ;
@@ -735,14 +784,14 @@ void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
     {
         radius1 = (xx1 - xxc == 0) ?
             (yy1 - yyc < 0) ? 90.0 : -90.0 :
-            -atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
-         radius2 = (xx2 - xxc == 0) ?
+        -atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
+        radius2 = (xx2 - xxc == 0) ?
             (yy2 - yyc < 0) ? 90.0 : -90.0 :
-            -atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
-     }
-     wxCoord alpha2 = wxCoord(radius2 - radius1);
+        -atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
+    }
+    wxCoord alpha2 = wxCoord(radius2 - radius1);
     wxCoord alpha1 = wxCoord(wxConvertWXangleToMACangle(radius1));
-     if( (xx1 > xx2) || (yy1 > yy2) ) {
+    if( (xx1 > xx2) || (yy1 > yy2) ) {
         alpha2 *= -1;
     }
     Rect r = { yyc - rad, xxc - rad, yyc + rad, xxc + rad };
@@ -755,8 +804,9 @@ void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
         FrameArc(&r, alpha1, alpha2);
     }
 }
+
 void  wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
-                                   double sa, double ea )
+                              double sa, double ea )
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawEllepticArc  Invalid DC"));
     wxMacPortSetter helper(this) ;
@@ -786,193 +836,198 @@ void  wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
         FrameArc(&r, (short)sa, (short)angle);
     }
 }
+
 void  wxDC::DoDrawPoint( wxCoord x, wxCoord y )
 {
-  wxCHECK_RET(Ok(), wxT("Invalid DC"));
-  wxMacPortSetter helper(this) ;
-  if (m_pen.GetStyle() != wxTRANSPARENT)
-  {
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
         wxCoord xx1 = XLOG2DEVMAC(x);
         wxCoord yy1 = YLOG2DEVMAC(y);
         RGBColor pencolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
         ::SetCPixel( xx1,yy1,&pencolor) ;
         CalcBoundingBox(x, y);
-  }
+    }
 }
+
 void  wxDC::DoDrawLines(int n, wxPoint points[],
-                             wxCoord xoffset, wxCoord yoffset)
-{
-  wxCHECK_RET(Ok(), wxT("Invalid DC"));
-  wxMacPortSetter helper(this) ;
-  if (m_pen.GetStyle() == wxTRANSPARENT)
-       return;
-  MacInstallPen() ;
-  wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
-                      m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
-  wxCoord x1, x2 , y1 , y2 ;
-  x1 = XLOG2DEVMAC(points[0].x + xoffset);
-  y1 = YLOG2DEVMAC(points[0].y + yoffset);
-  ::MoveTo(x1 - offset, y1 - offset );
-  for (int i = 0; i < n-1; i++)
-  {
-    x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
-    y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
-    ::LineTo( x2 - offset, y2 - offset );
-  }
+                        wxCoord xoffset, wxCoord yoffset)
+{
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    if (m_pen.GetStyle() == wxTRANSPARENT)
+        return;
+    MacInstallPen() ;
+    wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
+    m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
+    wxCoord x1, x2 , y1 , y2 ;
+    x1 = XLOG2DEVMAC(points[0].x + xoffset);
+    y1 = YLOG2DEVMAC(points[0].y + yoffset);
+    ::MoveTo(x1 - offset, y1 - offset );
+    for (int i = 0; i < n-1; i++)
+    {
+        x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+        y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
+        ::LineTo( x2 - offset, y2 - offset );
+    }
 }
+
 void  wxDC::DoDrawPolygon(int n, wxPoint points[],
                           wxCoord xoffset, wxCoord yoffset,
                           int fillStyle )
 {
-       wxCHECK_RET(Ok(), wxT("Invalid DC"));
-       wxMacPortSetter helper(this) ;
-       wxCoord x1, x2 , y1 , y2 ;
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    wxCoord x1, x2 , y1 , y2 ;
     if ( m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT )
         return ;
-       PolyHandle polygon = OpenPoly();
-       x2 = x1 = XLOG2DEVMAC(points[0].x + xoffset);
-       y2 = y1 = YLOG2DEVMAC(points[0].y + yoffset);
-       ::MoveTo(x1,y1);
-       for (int i = 1; i < n; i++)
-       {
-               x2 = XLOG2DEVMAC(points[i].x + xoffset);
-               y2 = YLOG2DEVMAC(points[i].y + yoffset);
-               ::LineTo(x2, y2);
-       }
+    PolyHandle polygon = OpenPoly();
+    x2 = x1 = XLOG2DEVMAC(points[0].x + xoffset);
+    y2 = y1 = YLOG2DEVMAC(points[0].y + yoffset);
+    ::MoveTo(x1,y1);
+    for (int i = 1; i < n; i++)
+    {
+        x2 = XLOG2DEVMAC(points[i].x + xoffset);
+        y2 = YLOG2DEVMAC(points[i].y + yoffset);
+        ::LineTo(x2, y2);
+    }
     // close the polyline if necessary
     if ( x1 != x2 || y1 != y2 )
     {
         ::LineTo(x1,y1 ) ;
     }
-       ClosePoly();
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush();
-               ::PaintPoly( polygon );
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FramePoly( polygon ) ;
-       }
-       KillPoly( polygon );
+    ClosePoly();
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush();
+        ::PaintPoly( polygon );
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FramePoly( polygon ) ;
+    }
+    KillPoly( polygon );
 }
+
 void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       wxCoord xx = XLOG2DEVMAC(x);
-       wxCoord yy = YLOG2DEVMAC(y);
-       wxCoord ww = m_signX * XLOG2DEVREL(width);
-       wxCoord hh = m_signY * YLOG2DEVREL(height);
-       // CMB: draw nothing if transformed w or h is 0
-       if (ww == 0 || hh == 0)
-               return;
-       // CMB: handle -ve width and/or height
-       if (ww < 0)
-       {
-               ww = -ww;
-               xx = xx - ww;
-       }
-       if (hh < 0)
-       {
-               hh = -hh;
-               yy = yy - hh;
-       }
-       Rect rect = { yy , xx , yy + hh , xx + ww } ;
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush() ;
-               ::PaintRect( &rect ) ;
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FrameRect( &rect ) ;
-       }
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
+    wxCoord ww = m_signX * XLOG2DEVREL(width);
+    wxCoord hh = m_signY * YLOG2DEVREL(height);
+    // CMB: draw nothing if transformed w or h is 0
+    if (ww == 0 || hh == 0)
+        return;
+    // CMB: handle -ve width and/or height
+    if (ww < 0)
+    {
+        ww = -ww;
+        xx = xx - ww;
+    }
+    if (hh < 0)
+    {
+        hh = -hh;
+        yy = yy - hh;
+    }
+    Rect rect = { yy , xx , yy + hh , xx + ww } ;
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush() ;
+        ::PaintRect( &rect ) ;
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FrameRect( &rect ) ;
+    }
 }
+
 void  wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
-                                        wxCoord width, wxCoord height,
-                                        double radius)
+                                   wxCoord width, wxCoord height,
+                                   double radius)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
     if (radius < 0.0)
-           radius = - radius * ((width < height) ? width : height);
-       wxCoord xx = XLOG2DEVMAC(x);
-       wxCoord yy = YLOG2DEVMAC(y);
-       wxCoord ww = m_signX * XLOG2DEVREL(width);
-       wxCoord hh = m_signY * YLOG2DEVREL(height);
-       // CMB: draw nothing if transformed w or h is 0
-       if (ww == 0 || hh == 0)
-               return;
-       // CMB: handle -ve width and/or height
-       if (ww < 0)
-       {
-               ww = -ww;
-               xx = xx - ww;
-       }
-       if (hh < 0)
-       {
-               hh = -hh;
-               yy = yy - hh;
-       }
-       Rect rect = { yy , xx , yy + hh , xx + ww } ;
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush() ;
-               ::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
-       }
+        radius = - radius * ((width < height) ? width : height);
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
+    wxCoord ww = m_signX * XLOG2DEVREL(width);
+    wxCoord hh = m_signY * YLOG2DEVREL(height);
+    // CMB: draw nothing if transformed w or h is 0
+    if (ww == 0 || hh == 0)
+        return;
+    // CMB: handle -ve width and/or height
+    if (ww < 0)
+    {
+        ww = -ww;
+        xx = xx - ww;
+    }
+    if (hh < 0)
+    {
+        hh = -hh;
+        yy = yy - hh;
+    }
+    Rect rect = { yy , xx , yy + hh , xx + ww } ;
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush() ;
+        ::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
+    }
 }
+
 void  wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       wxCoord xx = XLOG2DEVMAC(x);
-       wxCoord yy = YLOG2DEVMAC(y);
-       wxCoord ww = m_signX * XLOG2DEVREL(width);
-       wxCoord hh = m_signY * YLOG2DEVREL(height);
-       // CMB: draw nothing if transformed w or h is 0
-       if (ww == 0 || hh == 0)
-               return;
-       // CMB: handle -ve width and/or height
-       if (ww < 0)
-       {
-               ww = -ww;
-               xx = xx - ww;
-       }
-       if (hh < 0)
-       {
-               hh = -hh;
-               yy = yy - hh;
-       }
-       Rect rect = { yy , xx , yy + hh , xx + ww } ;
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush() ;
-               ::PaintOval( &rect ) ;
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FrameOval( &rect ) ;
-       }
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
+    wxCoord ww = m_signX * XLOG2DEVREL(width);
+    wxCoord hh = m_signY * YLOG2DEVREL(height);
+    // CMB: draw nothing if transformed w or h is 0
+    if (ww == 0 || hh == 0)
+        return;
+    // CMB: handle -ve width and/or height
+    if (ww < 0)
+    {
+        ww = -ww;
+        xx = xx - ww;
+    }
+    if (hh < 0)
+    {
+        hh = -hh;
+        yy = yy - hh;
+    }
+    Rect rect = { yy , xx , yy + hh , xx + ww } ;
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush() ;
+        ::PaintOval( &rect ) ;
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FrameOval( &rect ) ;
+    }
 }
 
-
 bool  wxDC::CanDrawBitmap(void) const
 {
-       return true ;
+    return true ;
 }
 
 bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
-                        wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
-                        wxCoord xsrcMask,  wxCoord ysrcMask )
+                   wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
+                   wxCoord xsrcMask,  wxCoord ysrcMask )
 {
     wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
     wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit  Illegal source DC"));
@@ -985,112 +1040,112 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
     // correct the parameter in case this dc does not have a mask at all
     if ( useMask && !source->m_macMask )
         useMask = false ;
-       Rect srcrect , dstrect ;
-       srcrect.top = source->YLOG2DEVMAC(ysrc) ;
-       srcrect.left = source->XLOG2DEVMAC(xsrc)  ;
-       srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
-       srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
-       dstrect.top = YLOG2DEVMAC(ydest) ;
-       dstrect.left = XLOG2DEVMAC(xdest) ;
-       dstrect.bottom = YLOG2DEVMAC(ydest + height )  ;
-       dstrect.right = XLOG2DEVMAC(xdest + width ) ;
+    Rect srcrect , dstrect ;
+    srcrect.top = source->YLOG2DEVMAC(ysrc) ;
+    srcrect.left = source->XLOG2DEVMAC(xsrc)  ;
+    srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
+    srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+    dstrect.top = YLOG2DEVMAC(ydest) ;
+    dstrect.left = XLOG2DEVMAC(xdest) ;
+    dstrect.bottom = YLOG2DEVMAC(ydest + height )  ;
+    dstrect.right = XLOG2DEVMAC(xdest + width ) ;
     short mode = kUnsupportedMode ;
     bool invertDestinationFirst = false ;
     switch ( logical_func )
     {
-               case wxAND:        // src AND dst
-                   mode = srcOr ; // ok
-                   break ;
-               case wxAND_INVERT: // (NOT src) AND dst
-                   mode = notSrcOr  ; // ok
-                   break ;
-               case wxAND_REVERSE:// src AND (NOT dst)
-                   invertDestinationFirst = true ;
-                   mode = srcOr ;
-                   break ;
-               case wxCLEAR:      // 0
-                   mode = kEmulatedMode ;
-                   break ;
-        case wxCOPY:       // src
-                       mode = srcCopy ; // ok
-                       break ;
-               case wxEQUIV:      // (NOT src) XOR dst
-                   mode = srcXor ; // ok
-                   break ;
-               case wxINVERT:     // NOT dst
-                       mode = kEmulatedMode ; //or hilite ;
-                       break ;
-               case wxNAND:       // (NOT src) OR (NOT dst)
-                   invertDestinationFirst = true ;
-                   mode = srcBic ;
-                   break ;
-               case wxNOR:        // (NOT src) AND (NOT dst)
-                   invertDestinationFirst = true ;
-                   mode = notSrcOr ;
-                   break ;
-               case wxNO_OP:      // dst
-                   mode = kEmulatedMode ; // this has already been handled upon entry
-                   break ;
-               case wxOR:         // src OR dst
-                   mode = notSrcBic ;
-                   break ;
-               case wxOR_INVERT:  // (NOT src) OR dst
-                   mode = srcBic ;
-                   break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                   invertDestinationFirst = true ;
-                       mode = notSrcBic ;
-                       break ;
-               case wxSET:        // 1
-                   mode = kEmulatedMode ;
-                   break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notSrcCopy ; // ok
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = notSrcXor ; // ok
-                       break ;
-        default :
-                       break ;
+    case wxAND:        // src AND dst
+        mode = srcOr ; // ok
+        break ;
+    case wxAND_INVERT: // (NOT src) AND dst
+        mode = notSrcOr  ; // ok
+        break ;
+    case wxAND_REVERSE:// src AND (NOT dst)
+        invertDestinationFirst = true ;
+        mode = srcOr ;
+        break ;
+    case wxCLEAR:      // 0
+        mode = kEmulatedMode ;
+        break ;
+    case wxCOPY:       // src
+        mode = srcCopy ; // ok
+        break ;
+    case wxEQUIV:      // (NOT src) XOR dst
+        mode = srcXor ; // ok
+        break ;
+    case wxINVERT:     // NOT dst
+        mode = kEmulatedMode ; //or hilite ;
+        break ;
+    case wxNAND:       // (NOT src) OR (NOT dst)
+        invertDestinationFirst = true ;
+        mode = srcBic ;
+        break ;
+    case wxNOR:        // (NOT src) AND (NOT dst)
+        invertDestinationFirst = true ;
+        mode = notSrcOr ;
+        break ;
+    case wxNO_OP:      // dst
+        mode = kEmulatedMode ; // this has already been handled upon entry
+        break ;
+    case wxOR:         // src OR dst
+        mode = notSrcBic ;
+        break ;
+    case wxOR_INVERT:  // (NOT src) OR dst
+        mode = srcBic ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        invertDestinationFirst = true ;
+        mode = notSrcBic ;
+        break ;
+    case wxSET:        // 1
+        mode = kEmulatedMode ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notSrcCopy ; // ok
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = notSrcXor ; // ok
+        break ;
+    default :
+        break ;
     }
     if ( mode == kUnsupportedMode )
     {
         wxFAIL_MSG("unsupported blitting mode" );
         return FALSE ;
     }
-       CGrafPtr                        sourcePort = (CGrafPtr) source->m_macPort ;
-       PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ;
-       if ( LockPixels(bmappixels) )
-       {
+    CGrafPtr            sourcePort = (CGrafPtr) source->m_macPort ;
+    PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ;
+    if ( LockPixels(bmappixels) )
+    {
         wxMacPortSetter helper(this) ;
-       if ( source->GetDepth() == 1 )
-       {
-           RGBForeColor( &MAC_WXCOLORREF(m_textForegroundColour.GetPixel()) ) ;
-           RGBBackColor( &MAC_WXCOLORREF(m_textBackgroundColour.GetPixel()) ) ;
+        if ( source->GetDepth() == 1 )
+        {
+            RGBForeColor( &MAC_WXCOLORREF(m_textForegroundColour.GetPixel()) ) ;
+            RGBBackColor( &MAC_WXCOLORREF(m_textBackgroundColour.GetPixel()) ) ;
         }
         else
         {
             // the modes need this, otherwise we'll end up having really nice colors...
-           RGBColor    white = { 0xFFFF, 0xFFFF,0xFFFF} ;
-           RGBColor    black = { 0,0,0} ;
-           RGBForeColor( &black ) ;
-           RGBBackColor( &white ) ;
+            RGBColor    white = { 0xFFFF, 0xFFFF,0xFFFF} ;
+            RGBColor    black = { 0,0,0} ;
+            RGBForeColor( &black ) ;
+            RGBBackColor( &white ) ;
         }
-               if ( useMask && source->m_macMask )
-               {
-                   if ( mode == srcCopy )
-                   {
-                       if ( LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) )
-                       {
-                               CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
-                                           GetPortBitMapForCopyBits( MAC_WXHBITMAP(source->m_macMask) ) ,
-                                           GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
-                                               &srcrect, &srcrect , &dstrect ) ;
-                               UnlockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) )  ) ;
-                       }
-                   }
-                   else
-                   {
+        if ( useMask && source->m_macMask )
+        {
+            if ( mode == srcCopy )
+            {
+                if ( LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) )
+                {
+                    CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
+                        GetPortBitMapForCopyBits( MAC_WXHBITMAP(source->m_macMask) ) ,
+                        GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+                        &srcrect, &srcrect , &dstrect ) ;
+                    UnlockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) )  ) ;
+                }
+            }
+            else
+            {
                 RgnHandle clipRgn = NewRgn() ;
                 LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) ;
                 BitMapToRegion( clipRgn , (BitMap*) *GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) ;
@@ -1099,17 +1154,17 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                 if ( mode == kEmulatedMode )
                 {
                     Pattern pat ;
-                           ::PenPat(GetQDGlobalsBlack(&pat));
+                    ::PenPat(GetQDGlobalsBlack(&pat));
                     if ( logical_func == wxSET )
                     {
                         RGBColor col= { 0xFFFF, 0xFFFF, 0xFFFF } ;
-                               ::RGBForeColor( &col  ) ;
+                        ::RGBForeColor( &col  ) ;
                         ::PaintRgn( clipRgn ) ;
                     }
                     else if ( logical_func == wxCLEAR )
                     {
                         RGBColor col= { 0x0000, 0x0000, 0x0000 } ;
-                               ::RGBForeColor( &col  ) ;
+                        ::RGBForeColor( &col  ) ;
                         ::PaintRgn( clipRgn ) ;
                     }
                     else if ( logical_func == wxINVERT )
@@ -1145,31 +1200,31 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                     {
                         MacInvertRgn( clipRgn ) ;
                     }
-                               CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
-                                   GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
-                                       &srcrect, &dstrect, mode, clipRgn ) ;
-                   }
-                   DisposeRgn( clipRgn ) ;
-               }
-               }
-               else
-               {
+                    CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
+                        GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+                        &srcrect, &dstrect, mode, clipRgn ) ;
+                }
+                DisposeRgn( clipRgn ) ;
+            }
+        }
+        else
+        {
             RgnHandle clipRgn = NewRgn() ;
             SetRectRgn( clipRgn , dstrect.left , dstrect.top , dstrect.right , dstrect.bottom ) ;
-                   if ( mode == kEmulatedMode )
-                   {
+            if ( mode == kEmulatedMode )
+            {
                 Pattern pat ;
-                   ::PenPat(GetQDGlobalsBlack(&pat));
+                ::PenPat(GetQDGlobalsBlack(&pat));
                 if ( logical_func == wxSET )
                 {
                     RGBColor col= { 0xFFFF, 0xFFFF, 0xFFFF } ;
-                       ::RGBForeColor( &col  ) ;
+                    ::RGBForeColor( &col  ) ;
                     ::PaintRgn( clipRgn ) ;
                 }
                 else if ( logical_func == wxCLEAR )
                 {
                     RGBColor col= { 0x0000, 0x0000, 0x0000 } ;
-                       ::RGBForeColor( &col  ) ;
+                    ::RGBForeColor( &col  ) ;
                     ::PaintRgn( clipRgn ) ;
                 }
                 else if ( logical_func == wxINVERT )
@@ -1197,34 +1252,36 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                         }
                     }
                 }
-               }
-               else
-               {
+            }
+            else
+            {
                 if ( invertDestinationFirst )
                 {
                     MacInvertRgn( clipRgn ) ;
                 }
-                       CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
-                           GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
-                               &srcrect, &dstrect, mode, NULL ) ;
-               }
-               DisposeRgn( clipRgn ) ;
-               }
-               UnlockPixels( bmappixels ) ;
-       }
-       m_macPenInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macFontInstalled = false ;
-  return TRUE;
-}
-inline Fixed   IntToFixed( int inInt )
-       {
-               return (((SInt32) inInt) << 16);
-       }
-inline int     FixedToInt( Fixed inFixed )
-       {
-               return (((SInt32) inFixed) >> 16);
-       }
+                CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
+                    GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+                    &srcrect, &dstrect, mode, NULL ) ;
+            }
+            DisposeRgn( clipRgn ) ;
+        }
+        UnlockPixels( bmappixels ) ;
+    }
+    m_macPenInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macFontInstalled = false ;
+    return TRUE;
+}
+
+inline Fixed    IntToFixed( int inInt )
+{
+    return (((SInt32) inInt) << 16);
+}
+
+inline int    FixedToInt( Fixed inFixed )
+{
+    return (((SInt32) inFixed) >> 16);
+}
 
 void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
                               double angle)
@@ -1239,16 +1296,16 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         return ;
     wxMacPortSetter helper(this) ;
     MacInstallFont() ;
-       wxString text ;
-       if ( wxApp::s_macDefaultEncodingIsPC )
-       {
-               text = wxMacMakeMacStringFromPC( str ) ;
-       }
-       else
-       {
-               text = str ;
-       }
-       wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+    wxString text ;
+    if ( wxApp::s_macDefaultEncodingIsPC )
+    {
+        text = wxMacMakeMacStringFromPC( str ) ;
+    }
+    else
+    {
+        text = str ;
+    }
+    wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
     if ( 0 )
     {
         m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
@@ -1256,23 +1313,23 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         m_macAliasWasEnabled = true ;
     }
     OSStatus status = noErr ;
-       TECObjectRef ec;
-       status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
-       wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
+    TECObjectRef ec;
+    status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+    wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
     ByteCount byteOutLen ;
     ByteCount byteInLen = text.Length() ;
     ByteCount byteBufferLen = byteInLen *2 ;
     char* buf = new char[byteBufferLen] ;
-       status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
-           (TextPtr)buf, byteBufferLen, &byteOutLen);
-       wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
-       status = TECDisposeConverter(ec);
-       wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
-       ATSUTextLayout atsuLayout ;
-       UniCharCount chars = byteOutLen / 2 ;
+    status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
+        (TextPtr)buf, byteBufferLen, &byteOutLen);
+    wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
+    status = TECDisposeConverter(ec);
+    wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
+    ATSUTextLayout atsuLayout ;
+    UniCharCount chars = byteOutLen / 2 ;
     status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) buf , 0 , byteOutLen / 2 , byteOutLen / 2 , 1 ,
         &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
-       wxASSERT_MSG( status == noErr , "couldn't create the layout of the rotated text" );
+    wxASSERT_MSG( status == noErr , "couldn't create the layout of the rotated text" );
     int iAngle = int( angle );
     int drawX = XLOG2DEVMAC(x) ;
     int drawY = YLOG2DEVMAC(y) ;
@@ -1286,708 +1343,720 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     if ( abs(iAngle) > 0 )
     {
         Fixed atsuAngle = IntToFixed( iAngle ) ;
-               ATSUAttributeTag atsuTags[] =
-               {
-                   kATSULineRotationTag ,
-               } ;
-           ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
-           {
-               sizeof( Fixed ) ,
-           } ;
-               ATSUAttributeValuePtr   atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
-               {
-                   &atsuAngle ,
-               } ;
-       status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag),
-                   atsuTags, atsuSizes, atsuValues ) ;
-    }
-       status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-                                       &textBefore , &textAfter, &ascent , &descent );
+        ATSUAttributeTag atsuTags[] =
+        {
+            kATSULineRotationTag ,
+        } ;
+        ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+        {
+            sizeof( Fixed ) ,
+        } ;
+        ATSUAttributeValuePtr    atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+        {
+            &atsuAngle ,
+        } ;
+        status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+            atsuTags, atsuSizes, atsuValues ) ;
+    }
+    status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+        &textBefore , &textAfter, &ascent , &descent );
     
     drawX += sin(angle/RAD2DEG) * FixedToInt(ascent) ;
     drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
     status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-                               IntToFixed(drawX) , IntToFixed(drawY) );
-       wxASSERT_MSG( status == noErr , "couldn't draw the rotated text" );
+        IntToFixed(drawX) , IntToFixed(drawY) );
+    wxASSERT_MSG( status == noErr , "couldn't draw the rotated text" );
     Rect rect ;
-       status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-                                       IntToFixed(drawX) , IntToFixed(drawY) , &rect );
-       wxASSERT_MSG( status == noErr , "couldn't measure the rotated text" );
+    status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+        IntToFixed(drawX) , IntToFixed(drawY) , &rect );
+    wxASSERT_MSG( status == noErr , "couldn't measure the rotated text" );
     OffsetRect( &rect , -m_macLocalOrigin.x , -m_macLocalOrigin.y ) ;
     CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
     CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
     ::ATSUDisposeTextLayout(atsuLayout);
     delete[] buf ;
 }
+
 void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText  Invalid DC"));
     wxMacPortSetter helper(this) ;
-       long xx = XLOG2DEVMAC(x);
-       long yy = YLOG2DEVMAC(y);
+    long xx = XLOG2DEVMAC(x);
+    long yy = YLOG2DEVMAC(y);
 #if TARGET_CARBON
-       bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-       if ( m_font.GetNoAntiAliasing() )
-           useDrawThemeText = false ;
+    bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
+    if ( m_font.GetNoAntiAliasing() )
+        useDrawThemeText = false ;
 #endif
-       MacInstallFont() ;
+    MacInstallFont() ;
     if ( 0 )
     {
         m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
         SetAntiAliasedTextEnabled(true, 8);
         m_macAliasWasEnabled = true ;
     }
-       FontInfo fi ;
-       ::GetFontInfo( &fi ) ;
+    FontInfo fi ;
+    ::GetFontInfo( &fi ) ;
 #if TARGET_CARBON
-       if ( !useDrawThemeText )
+    if ( !useDrawThemeText )
 #endif
-           yy += fi.ascent ;
-       ::MoveTo( xx , yy );
-       if (  m_backgroundMode == wxTRANSPARENT )
-       {
-               ::TextMode( srcOr) ;
-       }
-       else
-       {
-               ::TextMode( srcCopy ) ;
-       }
-       const char *text = NULL ;
-       int length = 0 ;
-       wxString macText ;
-       if ( wxApp::s_macDefaultEncodingIsPC )
-       {
-               macText = wxMacMakeMacStringFromPC( strtext ) ;
-               text = macText ;
-               length = macText.Length() ;
-       }
-       else
-       {
-               text = strtext ;
-               length = strtext.Length() ;
-       }
-       int laststop = 0 ;
-       int i = 0 ;
-       int line = 0 ;
-    {
-       while( i < length )
-       {
-               if( text[i] == 13 || text[i] == 10)
-               {
+        yy += fi.ascent ;
+    ::MoveTo( xx , yy );
+    if (  m_backgroundMode == wxTRANSPARENT )
+    {
+        ::TextMode( srcOr) ;
+    }
+    else
+    {
+        ::TextMode( srcCopy ) ;
+    }
+    const char *text = NULL ;
+    int length = 0 ;
+    wxString macText ;
+    if ( wxApp::s_macDefaultEncodingIsPC )
+    {
+        macText = wxMacMakeMacStringFromPC( strtext ) ;
+        text = macText ;
+        length = macText.Length() ;
+    }
+    else
+    {
+        text = strtext ;
+        length = strtext.Length() ;
+    }
+    int laststop = 0 ;
+    int i = 0 ;
+    int line = 0 ;
+    {
+        while( i < length )
+        {
+            if( text[i] == 13 || text[i] == 10)
+            {
 #if TARGET_CARBON
-               if ( useDrawThemeText )
-               {
-                   Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+                if ( useDrawThemeText )
+                {
+                    Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
                     CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                           if ( m_backgroundMode != wxTRANSPARENT )
-                           {
-                                   Point bounds={0,0} ;
-                                   Rect background = frame ;
-                                   SInt16 baseline ;
-                                       ::GetThemeTextDimensions( mString,
-                                                                               kThemeCurrentPortFont,
-                                                                               kThemeStateActive,
-                                                                               false,
-                                                                               &bounds,
-                                                                               &baseline );
-                                       background.right = background.left + bounds.h ;
-                                       background.bottom = background.top + bounds.v ;
-                                       ::EraseRect( &background ) ;
-                           }
-                       ::DrawThemeTextBox( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &frame,
-                                                               teJustLeft,
-                                                               nil );
-                   CFRelease( mString ) ;
-                   line++ ;
+                    if ( m_backgroundMode != wxTRANSPARENT )
+                    {
+                        Point bounds={0,0} ;
+                        Rect background = frame ;
+                        SInt16 baseline ;
+                        ::GetThemeTextDimensions( mString,
+                            kThemeCurrentPortFont,
+                            kThemeStateActive,
+                            false,
+                            &bounds,
+                            &baseline );
+                        background.right = background.left + bounds.h ;
+                        background.bottom = background.top + bounds.v ;
+                        ::EraseRect( &background ) ;
+                    }
+                    ::DrawThemeTextBox( mString,
+                        kThemeCurrentPortFont,
+                        kThemeStateActive,
+                        false,
+                        &frame,
+                        teJustLeft,
+                        nil );
+                    CFRelease( mString ) ;
+                    line++ ;
                 }
-                   else
+                else
 #endif
-                   {
-                               ::DrawText( text , laststop , i - laststop ) ;
-                   line++ ;
-                               ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
-                       }
-                       laststop = i+1 ;
-               }
-               i++ ;
-       }
+                {
+                    ::DrawText( text , laststop , i - laststop ) ;
+                    line++ ;
+                    ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
+                }
+                laststop = i+1 ;
+            }
+            i++ ;
+        }
 #if TARGET_CARBON
         if ( useDrawThemeText )
-       {
-           Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+        {
+            Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
             CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
             if ( m_backgroundMode != wxTRANSPARENT )
             {
-                   Point bounds={0,0} ;
-                   Rect background = frame ;
-                   SInt16 baseline ;
-                       ::GetThemeTextDimensions( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &bounds,
-                                                               &baseline );
-                       background.right = background.left + bounds.h ;
-                       background.bottom = background.top + bounds.v ;
-                       ::EraseRect( &background ) ;
+                Point bounds={0,0} ;
+                Rect background = frame ;
+                SInt16 baseline ;
+                ::GetThemeTextDimensions( mString,
+                    kThemeCurrentPortFont,
+                    kThemeStateActive,
+                    false,
+                    &bounds,
+                    &baseline );
+                background.right = background.left + bounds.h ;
+                background.bottom = background.top + bounds.v ;
+                ::EraseRect( &background ) ;
             }
-               ::DrawThemeTextBox( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       false,
-                                                       &frame,
-                                                       teJustLeft,
-                                                       nil );
+            ::DrawThemeTextBox( mString,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &frame,
+                teJustLeft,
+                nil );
             CFRelease( mString ) ;
         }
         else
 #endif
         {
-           ::DrawText( text , laststop , i - laststop ) ;
+            ::DrawText( text , laststop , i - laststop ) ;
         }
-       }
-       ::TextMode( srcOr ) ;
+    }
+    ::TextMode( srcOr ) ;
 }
+
 bool  wxDC::CanGetTextExtent() const
 {
-       wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
-       return true ;
+    wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
+    return true ;
 }
+
 void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
-                     wxCoord *descent, wxCoord *externalLeading ,
-                     wxFont *theFont ) const
-{
-   wxCHECK_RET(Ok(), wxT("Invalid DC"));
-   wxMacPortSetter helper(this) ;
-       wxFont formerFont = m_font ;
-       if ( theFont )
-       {
-           // work around the constness
-       *((wxFont*)(&m_font)) = *theFont ;
-       }
-       MacInstallFont() ;
-       FontInfo fi ;
-       ::GetFontInfo( &fi ) ;
-#if TARGET_CARBON      
-       bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
-       if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
-           useGetThemeText = false ;
+                            wxCoord *descent, wxCoord *externalLeading ,
+                            wxFont *theFont ) const
+{
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    wxFont formerFont = m_font ;
+    if ( theFont )
+    {
+        // work around the constness
+        *((wxFont*)(&m_font)) = *theFont ;
+    }
+    MacInstallFont() ;
+    FontInfo fi ;
+    ::GetFontInfo( &fi ) ;
+#if TARGET_CARBON    
+    bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
+    if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
+        useGetThemeText = false ;
 #endif
-       if ( height )
-               *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
-       if ( descent )
-               *descent =YDEV2LOGREL( fi.descent );
-       if ( externalLeading )
-               *externalLeading = YDEV2LOGREL( fi.leading ) ;
-       const char *text = NULL ;
-       int length = 0 ;
-       wxString macText ;
-       if ( wxApp::s_macDefaultEncodingIsPC )
-       {
-               macText = wxMacMakeMacStringFromPC( string ) ;
-               text = macText ;
-               length = macText.Length() ;
-       
-       else
-       {
-               text = string ;
-               length = string.Length() ;
-       }
-       int laststop = 0 ;
-       int i = 0 ;
-       int curwidth = 0 ;
-       if ( width )
-       {
-               *width = 0 ;
-               while( i < length )
-               {
-                       if( text[i] == 13 || text[i] == 10)
-                       {
-                               if ( height )
-                                       *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
+    if ( height )
+        *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
+    if ( descent )
+        *descent =YDEV2LOGREL( fi.descent );
+    if ( externalLeading )
+        *externalLeading = YDEV2LOGREL( fi.leading ) ;
+    const char *text = NULL ;
+    int length = 0 ;
+    wxString macText ;
+    if ( wxApp::s_macDefaultEncodingIsPC )
+    {
+        macText = wxMacMakeMacStringFromPC( string ) ;
+        text = macText ;
+        length = macText.Length() ;
+    } 
+    else
+    {
+        text = string ;
+        length = string.Length() ;
+    }
+    int laststop = 0 ;
+    int i = 0 ;
+    int curwidth = 0 ;
+    if ( width )
+    {
+        *width = 0 ;
+        while( i < length )
+        {
+            if( text[i] == 13 || text[i] == 10)
+            {
+                if ( height )
+                    *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
 #if TARGET_CARBON
                 if ( useGetThemeText )
                 {
                     Point bounds={0,0} ;
                     SInt16 baseline ;
                     CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                       ::GetThemeTextDimensions( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &bounds,
-                                                               &baseline );
-                   CFRelease( mString ) ;
-                   curwidth = bounds.h ;
+                    ::GetThemeTextDimensions( mString,
+                        kThemeCurrentPortFont,
+                        kThemeStateActive,
+                        false,
+                        &bounds,
+                        &baseline );
+                    CFRelease( mString ) ;
+                    curwidth = bounds.h ;
                 }
                 else
 #endif
                 {
-                                   curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-                               }
-                               if ( curwidth > *width )
-                                       *width = XDEV2LOGREL( curwidth ) ;
-                               laststop = i+1 ;
-                       }
-                       i++ ;
-               }
-                               
+                    curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                }
+                if ( curwidth > *width )
+                    *width = XDEV2LOGREL( curwidth ) ;
+                laststop = i+1 ;
+            }
+            i++ ;
+        }
+        
 #if TARGET_CARBON
         if ( useGetThemeText )
         {
             Point bounds={0,0} ;
             SInt16 baseline ;
             CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-               ::GetThemeTextDimensions( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       false,
-                                                       &bounds,
-                                                       &baseline );
-           CFRelease( mString ) ;
-           curwidth = bounds.h ;
+            ::GetThemeTextDimensions( mString,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &bounds,
+                &baseline );
+            CFRelease( mString ) ;
+            curwidth = bounds.h ;
         }
         else
 #endif
         {
-                   curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-               }
-               if ( curwidth > *width )
-                       *width = XDEV2LOGREL( curwidth ) ;
-       }
-       if ( theFont )
-       {
-           // work around the constness
-       *((wxFont*)(&m_font)) = formerFont ;
-               m_macFontInstalled = false ;
-       }
+            curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+        }
+        if ( curwidth > *width )
+            *width = XDEV2LOGREL( curwidth ) ;
+    }
+    if ( theFont )
+    {
+        // work around the constness
+        *((wxFont*)(&m_font)) = formerFont ;
+        m_macFontInstalled = false ;
+    }
 }
+
 wxCoord   wxDC::GetCharWidth(void) const
 {
     wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
-   wxMacPortSetter helper(this) ;
-       MacInstallFont() ;
+    wxMacPortSetter helper(this) ;
+    MacInstallFont() ;
     int width = 0 ;
 #if TARGET_CARBON
-       bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
-       if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
-               useGetThemeText = false ;
+    bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
+    if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
+        useGetThemeText = false ;
 #endif
-       char text[] = "H" ;
+    char text[] = "H" ;
 #if TARGET_CARBON
     if ( useGetThemeText )
     {
         Point bounds={0,0} ;
         SInt16 baseline ;
         CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text , 1 , CFStringGetSystemEncoding(), false ) ;
-               ::GetThemeTextDimensions( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       false,
-                                                       &bounds,
-                                                       &baseline );
-           CFRelease( mString ) ;
-           width = bounds.h ;
+        ::GetThemeTextDimensions( mString,
+            kThemeCurrentPortFont,
+            kThemeStateActive,
+            false,
+            &bounds,
+            &baseline );
+        CFRelease( mString ) ;
+        width = bounds.h ;
     }
     else
 #endif
     {
-           width = ::TextWidth( text , 0 , 1 ) ;
-       }
-       return YDEV2LOGREL(width) ;
+        width = ::TextWidth( text , 0 , 1 ) ;
+    }
+    return YDEV2LOGREL(width) ;
 }
+
 wxCoord   wxDC::GetCharHeight(void) const
 {
     wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       MacInstallFont() ;
-       FontInfo fi ;
-       ::GetFontInfo( &fi ) ;
-       return YDEV2LOGREL( fi.descent + fi.ascent );
+    MacInstallFont() ;
+    FontInfo fi ;
+    ::GetFontInfo( &fi ) ;
+    return YDEV2LOGREL( fi.descent + fi.ascent );
 }
+
 void  wxDC::Clear(void)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       Rect rect = { -31000 , -31000 , 31000 , 31000 } ;
-       if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
-       {
-           ::PenNormal() ;
-           //MacInstallBrush() ;
+    Rect rect = { -31000 , -31000 , 31000 , 31000 } ;
+    if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
+    {
+        ::PenNormal() ;
+        //MacInstallBrush() ;
         MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ;
-               ::EraseRect( &rect ) ;
-       }
+        ::EraseRect( &rect ) ;
+    }
 }
+
 void wxDC::MacInstallFont() const
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
-//     if ( m_macFontInstalled )
-//             return ;
-       Pattern blackColor ;
-       MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
-       wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-       if ( font )
-       {
-               ::TextFont( font->m_macFontNum ) ;
-               ::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
-               ::TextFace( font->m_macFontStyle ) ;
-               m_macFontInstalled = true ;
-               m_macBrushInstalled = false ;
-               m_macPenInstalled = false ;
-               RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
-               RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
-               ::RGBForeColor( &forecolor );
-               ::RGBBackColor( &backcolor );
-       }
-       else
-       {
+    //    if ( m_macFontInstalled )
+    //        return ;
+    Pattern blackColor ;
+    MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
+    wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+    if ( font )
+    {
+        ::TextFont( font->m_macFontNum ) ;
+        ::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
+        ::TextFace( font->m_macFontStyle ) ;
+        m_macFontInstalled = true ;
+        m_macBrushInstalled = false ;
+        m_macPenInstalled = false ;
+        RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
+        RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
+        ::RGBForeColor( &forecolor );
+        ::RGBBackColor( &backcolor );
+    }
+    else
+    {
         FontFamilyID fontId ;
-       Str255 fontName ;
-       SInt16 fontSize ;
-       Style fontStyle ;
-       GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+        Str255 fontName ;
+        SInt16 fontSize ;
+        Style fontStyle ;
+        GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
         GetFNum( fontName, &fontId );
-               ::TextFont( fontId ) ;
-               ::TextSize( short(m_scaleY * fontSize) ) ;
-               ::TextFace( fontStyle ) ;
-               // todo reset after spacing changes - or store the current spacing somewhere
-               m_macFontInstalled = true ;
-               m_macBrushInstalled = false ;
-               m_macPenInstalled = false ;
-               RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
-               RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
-               ::RGBForeColor( &forecolor );
-               ::RGBBackColor( &backcolor );
-       }
-       short mode = patCopy ;
-       // todo :
-       switch( m_logicalFunction )
-       {
-               case wxCOPY:       // src
-                       mode = patCopy ;
-                       break ;
-               case wxINVERT:     // NOT dst
-                       ::PenPat(GetQDGlobalsBlack(&blackColor));
-                       mode = patXor ;
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = patXor ;
-                       break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                       mode = notPatOr ;
-                       break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notPatCopy ;
-                       break ;
-               // unsupported TODO
-               case wxCLEAR:      // 0
-               case wxAND_REVERSE:// src AND (NOT dst)
-               case wxAND:        // src AND dst
-               case wxAND_INVERT: // (NOT src) AND dst
-               case wxNO_OP:      // dst
-               case wxNOR:        // (NOT src) AND (NOT dst)
-               case wxEQUIV:      // (NOT src) XOR dst
-               case wxOR_INVERT:  // (NOT src) OR dst
-               case wxNAND:       // (NOT src) OR (NOT dst)
-               case wxOR:         // src OR dst
-               case wxSET:        // 1
-//             case wxSRC_OR:     // source _bitmap_ OR destination
-//             case wxSRC_AND:     // source _bitmap_ AND destination
-                       break ;
-       }
-       ::PenMode( mode ) ;
+        ::TextFont( fontId ) ;
+        ::TextSize( short(m_scaleY * fontSize) ) ;
+        ::TextFace( fontStyle ) ;
+        // todo reset after spacing changes - or store the current spacing somewhere
+        m_macFontInstalled = true ;
+        m_macBrushInstalled = false ;
+        m_macPenInstalled = false ;
+        RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
+        RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
+        ::RGBForeColor( &forecolor );
+        ::RGBBackColor( &backcolor );
+    }
+    short mode = patCopy ;
+    // todo :
+    switch( m_logicalFunction )
+    {
+    case wxCOPY:       // src
+        mode = patCopy ;
+        break ;
+    case wxINVERT:     // NOT dst
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+        mode = patXor ;
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = patXor ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        mode = notPatOr ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notPatCopy ;
+        break ;
+        // unsupported TODO
+    case wxCLEAR:      // 0
+    case wxAND_REVERSE:// src AND (NOT dst)
+    case wxAND:        // src AND dst
+    case wxAND_INVERT: // (NOT src) AND dst
+    case wxNO_OP:      // dst
+    case wxNOR:        // (NOT src) AND (NOT dst)
+    case wxEQUIV:      // (NOT src) XOR dst
+    case wxOR_INVERT:  // (NOT src) OR dst
+    case wxNAND:       // (NOT src) OR (NOT dst)
+    case wxOR:         // src OR dst
+    case wxSET:        // 1
+        //        case wxSRC_OR:     // source _bitmap_ OR destination
+        //        case wxSRC_AND:     // source _bitmap_ AND destination
+        break ;
+    }
+    ::PenMode( mode ) ;
     OSStatus status = noErr ;
     Fixed atsuSize = IntToFixed( int(m_scaleY * font->m_macFontSize) ) ;
     Style qdStyle = font->m_macFontStyle ;
-       ATSUFontID      atsuFont = font->m_macATSUFontID ;
+    ATSUFontID    atsuFont = font->m_macATSUFontID ;
     status = ::ATSUCreateStyle(&(ATSUStyle)m_macATSUIStyle) ;
-       wxASSERT_MSG( status == noErr , "couldn't create ATSU style" ) ;
-       ATSUAttributeTag atsuTags[] =
-       {
-           kATSUFontTag ,
-           kATSUSizeTag ,
-//         kATSUColorTag ,
-//         kATSUBaselineClassTag ,
-           kATSUVerticalCharacterTag,
-           kATSUQDBoldfaceTag ,
-           kATSUQDItalicTag ,
-           kATSUQDUnderlineTag ,
-           kATSUQDCondensedTag ,
-           kATSUQDExtendedTag ,
-       } ;
+    wxASSERT_MSG( status == noErr , "couldn't create ATSU style" ) ;
+    ATSUAttributeTag atsuTags[] =
+    {
+        kATSUFontTag ,
+            kATSUSizeTag ,
+            //        kATSUColorTag ,
+            //        kATSUBaselineClassTag ,
+            kATSUVerticalCharacterTag,
+            kATSUQDBoldfaceTag ,
+            kATSUQDItalicTag ,
+            kATSUQDUnderlineTag ,
+            kATSUQDCondensedTag ,
+            kATSUQDExtendedTag ,
+    } ;
     ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
     {
         sizeof( ATSUFontID ) ,
-        sizeof( Fixed ) ,
-//        sizeof( RGBColor ) ,
-//        sizeof( BslnBaselineClass ) ,
-        sizeof( ATSUVerticalCharacterType),
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
+            sizeof( Fixed ) ,
+            //        sizeof( RGBColor ) ,
+            //        sizeof( BslnBaselineClass ) ,
+            sizeof( ATSUVerticalCharacterType),
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
     } ;
     Boolean kTrue = true ;
     Boolean kFalse = false ;
     BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
     ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
-       ATSUAttributeValuePtr   atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
-       {
-           &atsuFont ,
-           &atsuSize ,
-//         &MAC_WXCOLORREF( m_textForegroundColour.GetPixel() ) ,
-//         &kBaselineDefault ,
-           &kHorizontal,
-           (qdStyle & bold) ? &kTrue : &kFalse ,
-           (qdStyle & italic) ? &kTrue : &kFalse ,
-           (qdStyle & underline) ? &kTrue : &kFalse ,
-           (qdStyle & condense) ? &kTrue : &kFalse ,
-           (qdStyle & extend) ? &kTrue : &kFalse ,
-       } ;
-       status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
-           atsuTags, atsuSizes, atsuValues);
-       wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
+    ATSUAttributeValuePtr    atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+    {
+        &atsuFont ,
+            &atsuSize ,
+            //        &MAC_WXCOLORREF( m_textForegroundColour.GetPixel() ) ,
+            //        &kBaselineDefault ,
+            &kHorizontal,
+            (qdStyle & bold) ? &kTrue : &kFalse ,
+            (qdStyle & italic) ? &kTrue : &kFalse ,
+            (qdStyle & underline) ? &kTrue : &kFalse ,
+            (qdStyle & condense) ? &kTrue : &kFalse ,
+            (qdStyle & extend) ? &kTrue : &kFalse ,
+    } ;
+    status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+        atsuTags, atsuSizes, atsuValues);
+    wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
 }
+
 Pattern gHatchPatterns[] =
 {
-     { { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
-     { { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
-     { { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
-     { { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
-     { { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
-     { { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
-     { { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } } 
+    { { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
+    { { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
+    { { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
+    { { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
+    { { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
+    { { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
+    { { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } } 
 } ;
+
 static void wxMacGetHatchPattern(int hatchStyle, Pattern *pattern)
 {
-       int theIndex = 1 ;
-       switch(hatchStyle)
-       {
-               case wxBDIAGONAL_HATCH:
-                       theIndex = 2;
-                       break;
-               case wxFDIAGONAL_HATCH:
-                       theIndex = 3;
-                       break;
-               case wxCROSS_HATCH:
-                       theIndex = 4;
-                       break;
-               case wxHORIZONTAL_HATCH:
-                       theIndex = 5;
-                       break;
-               case wxVERTICAL_HATCH:
-                       theIndex = 6;
-                       break;
-               case wxCROSSDIAG_HATCH:
-                       theIndex = 7;
-                       break;
-               default:
-                       theIndex = 1; // solid pattern
-                       break;
-       }
-       *pattern = gHatchPatterns[theIndex-1] ;
+    int theIndex = 1 ;
+    switch(hatchStyle)
+    {
+    case wxBDIAGONAL_HATCH:
+        theIndex = 2;
+        break;
+    case wxFDIAGONAL_HATCH:
+        theIndex = 3;
+        break;
+    case wxCROSS_HATCH:
+        theIndex = 4;
+        break;
+    case wxHORIZONTAL_HATCH:
+        theIndex = 5;
+        break;
+    case wxVERTICAL_HATCH:
+        theIndex = 6;
+        break;
+    case wxCROSSDIAG_HATCH:
+        theIndex = 7;
+        break;
+    default:
+        theIndex = 1; // solid pattern
+        break;
+    }
+    *pattern = gHatchPatterns[theIndex-1] ;
 }
+
 void wxDC::MacInstallPen() const
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
-       Pattern  blackColor;
-//     if ( m_macPenInstalled )
-//             return ;
-       RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
-       RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
-       ::RGBForeColor( &forecolor );
-       ::RGBBackColor( &backcolor );
-       ::PenNormal() ;
-       int penWidth = m_pen.GetWidth() * (int) m_scaleX ;
-       // null means only one pixel, at whatever resolution
-       if ( penWidth == 0 )
-               penWidth = 1 ;
-       ::PenSize(penWidth, penWidth);
-       int penStyle = m_pen.GetStyle();
-       if (penStyle == wxSOLID)
-       {
-               ::PenPat(GetQDGlobalsBlack(&blackColor));
-       }
-       else if (IS_HATCH(penStyle))
-       {
-               Pattern pat ;
-               wxMacGetHatchPattern(penStyle, &pat);
-               ::PenPat(&pat);
-       }
-       else
-       {
-           Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
-           switch( penStyle )
-           {
-               case wxDOT :
-                for ( int i = 0 ; i < 8 ; ++i )
-                {
-                    pat.pat[i] = 0xCC ;
-                }
-                   break ;
-               case wxLONG_DASH :
-                for ( int i = 0 ; i < 8 ; ++i )
-                {
-                    pat.pat[i] = 0xFE ;
-                }
-                   break ;
-               case wxSHORT_DASH :
-                for ( int i = 0 ; i < 8 ; ++i )
-                {
-                    pat.pat[i] = 0xEE ;
-                }
-                   break ;
-               case wxDOT_DASH :
+    Pattern     blackColor;
+    //    if ( m_macPenInstalled )
+    //        return ;
+    RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
+    RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
+    ::RGBForeColor( &forecolor );
+    ::RGBBackColor( &backcolor );
+    ::PenNormal() ;
+    int penWidth = m_pen.GetWidth() * (int) m_scaleX ;
+    // null means only one pixel, at whatever resolution
+    if ( penWidth == 0 )
+        penWidth = 1 ;
+    ::PenSize(penWidth, penWidth);
+    int penStyle = m_pen.GetStyle();
+    if (penStyle == wxSOLID)
+    {
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+    }
+    else if (IS_HATCH(penStyle))
+    {
+        Pattern pat ;
+        wxMacGetHatchPattern(penStyle, &pat);
+        ::PenPat(&pat);
+    }
+    else
+    {
+        Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
+        switch( penStyle )
+        {
+        case wxDOT :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0xCC ;
+            }
+            break ;
+        case wxLONG_DASH :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0xFE ;
+            }
+            break ;
+        case wxSHORT_DASH :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0xEE ;
+            }
+            break ;
+        case wxDOT_DASH :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0x6F ;
+            }
+            break ;
+        case wxUSER_DASH :
+            {
+                wxDash* dash ;
+                m_pen.GetDashes(&dash) ;
+                // right now we don't allocate larger pixmaps
+                // int number = 
+                m_pen.GetDashes(&dash) ;
                 for ( int i = 0 ; i < 8 ; ++i )
                 {
-                    pat.pat[i] = 0x6F ;
+                    pat.pat[i] = dash[0] ;
                 }
-                   break ;
-               case wxUSER_DASH :
-                   {
-                       wxDash* dash ;
-                    m_pen.GetDashes(&dash) ;
-                       // right now we don't allocate larger pixmaps
-                       // int number = 
-                       m_pen.GetDashes(&dash) ;
-                       for ( int i = 0 ; i < 8 ; ++i )
-                       {
-                           pat.pat[i] = dash[0] ;
-                       }
-                   }
-                   break ;
-           }
-               ::PenPat(&pat);
-       }
-       short mode = patCopy ;
-       // todo :
-       switch( m_logicalFunction )
-       {
-               case wxCOPY:       // only foreground color, leave background (thus not patCopy)
-                       mode = patOr ;
-                       break ;
-               case wxINVERT:     // NOT dst
-//                     ::PenPat(GetQDGlobalsBlack(&blackColor));
-                       mode = patXor ;
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = patXor ;
-                       break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                       mode = notPatOr ;
-                       break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notPatCopy ;
-                       break ;
-               // unsupported TODO
-               case wxCLEAR:      // 0
-               case wxAND_REVERSE:// src AND (NOT dst)
-               case wxAND:        // src AND dst
-               case wxAND_INVERT: // (NOT src) AND dst
-               case wxNO_OP:      // dst
-               case wxNOR:        // (NOT src) AND (NOT dst)
-               case wxEQUIV:      // (NOT src) XOR dst
-               case wxOR_INVERT:  // (NOT src) OR dst
-               case wxNAND:       // (NOT src) OR (NOT dst)
-               case wxOR:         // src OR dst
-               case wxSET:        // 1
-//             case wxSRC_OR:     // source _bitmap_ OR destination
-//             case wxSRC_AND:     // source _bitmap_ AND destination
-                       break ;
-       }
-       ::PenMode( mode ) ;
-       m_macPenInstalled = true ;
-       m_macBrushInstalled = false ;
-       m_macFontInstalled = false ;
+            }
+            break ;
+        }
+        ::PenPat(&pat);
+    }
+    short mode = patCopy ;
+    // todo :
+    switch( m_logicalFunction )
+    {
+    case wxCOPY:       // only foreground color, leave background (thus not patCopy)
+        mode = patOr ;
+        break ;
+    case wxINVERT:     // NOT dst
+        //            ::PenPat(GetQDGlobalsBlack(&blackColor));
+        mode = patXor ;
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = patXor ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        mode = notPatOr ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notPatCopy ;
+        break ;
+        // unsupported TODO
+    case wxCLEAR:      // 0
+    case wxAND_REVERSE:// src AND (NOT dst)
+    case wxAND:        // src AND dst
+    case wxAND_INVERT: // (NOT src) AND dst
+    case wxNO_OP:      // dst
+    case wxNOR:        // (NOT src) AND (NOT dst)
+    case wxEQUIV:      // (NOT src) XOR dst
+    case wxOR_INVERT:  // (NOT src) OR dst
+    case wxNAND:       // (NOT src) OR (NOT dst)
+    case wxOR:         // src OR dst
+    case wxSET:        // 1
+        //        case wxSRC_OR:     // source _bitmap_ OR destination
+        //        case wxSRC_AND:     // source _bitmap_ AND destination
+        break ;
+    }
+    ::PenMode( mode ) ;
+    m_macPenInstalled = true ;
+    m_macBrushInstalled = false ;
+    m_macFontInstalled = false ;
 }
+
 void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
 {
     Pattern whiteColor ;
     switch( background.MacGetBrushKind() )
     {
-      case kwxMacBrushTheme :
+    case kwxMacBrushTheme :
         {
-               ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
-          break ;
+            ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
+            break ;
         }
-      case kwxMacBrushThemeBackground :
+    case kwxMacBrushThemeBackground :
         {
-               Rect extent ;
-               ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
-               ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
-          break ;
+            Rect extent ;
+            ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
+            ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
+            break ;
         }
-      case kwxMacBrushColour :
+    case kwxMacBrushColour :
         {
-                   ::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
-               int brushStyle = background.GetStyle();
-               if (brushStyle == wxSOLID)
-                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
-               else if (IS_HATCH(brushStyle))
-               {
-                       Pattern pat ;
-                       wxMacGetHatchPattern(brushStyle, &pat);
-                       ::BackPat(&pat);
-               }
-               else
-               {
-                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
-               }
-          break ;
+               ::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
+            int brushStyle = background.GetStyle();
+            if (brushStyle == wxSOLID)
+                ::BackPat(GetQDGlobalsWhite(&whiteColor));
+            else if (IS_HATCH(brushStyle))
+            {
+                Pattern pat ;
+                wxMacGetHatchPattern(brushStyle, &pat);
+                ::BackPat(&pat);
+            }
+            else
+            {
+                ::BackPat(GetQDGlobalsWhite(&whiteColor));
+            }
+            break ;
         }
     }
 }
+
 void wxDC::MacInstallBrush() const
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
-       Pattern  blackColor ;
-//     if ( m_macBrushInstalled )
-//             return ;
-       // foreground
-       bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
-       ::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
-       ::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
-       int brushStyle = m_brush.GetStyle();
-       if (brushStyle == wxSOLID)
-       {
-               ::PenPat(GetQDGlobalsBlack(&blackColor));
-    }
-       else if (IS_HATCH(brushStyle))
-       {
-               Pattern pat ;
-               wxMacGetHatchPattern(brushStyle, &pat);
-               ::PenPat(&pat);
-       }
-       else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
-       {
-           // we force this in order to be compliant with wxMSW
-           backgroundTransparent = false ;
-           // for these the text fore (and back for MASK_OPAQUE) colors are used
-           wxBitmap* bitmap = m_brush.GetStipple() ;
-           int width = bitmap->GetWidth() ;
-           int height = bitmap->GetHeight() ;
+    Pattern     blackColor ;
+    //    if ( m_macBrushInstalled )
+    //        return ;
+    // foreground
+    bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
+    ::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
+    ::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
+    int brushStyle = m_brush.GetStyle();
+    if (brushStyle == wxSOLID)
+    {
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+    }
+    else if (IS_HATCH(brushStyle))
+    {
+        Pattern pat ;
+        wxMacGetHatchPattern(brushStyle, &pat);
+        ::PenPat(&pat);
+    }
+    else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
+    {
+        // we force this in order to be compliant with wxMSW
+        backgroundTransparent = false ;
+        // for these the text fore (and back for MASK_OPAQUE) colors are used
+        wxBitmap* bitmap = m_brush.GetStipple() ;
+        int width = bitmap->GetWidth() ;
+        int height = bitmap->GetHeight() ;
         GWorldPtr gw = NULL ;
-           if ( m_brush.GetStyle() == wxSTIPPLE )
-               gw = MAC_WXHBITMAP(bitmap->GetHBITMAP())  ;
-           else
-               gw = MAC_WXHBITMAP(bitmap->GetMask()->GetMaskBitmap()) ;
+        if ( m_brush.GetStyle() == wxSTIPPLE )
+            gw = MAC_WXHBITMAP(bitmap->GetHBITMAP())  ;
+        else
+            gw = MAC_WXHBITMAP(bitmap->GetMask()->GetMaskBitmap()) ;
         PixMapHandle gwpixmaphandle = GetGWorldPixMap( gw ) ;
         LockPixels( gwpixmaphandle ) ;
-           bool isMonochrome = !IsPortColor( gw ) ;
+        bool isMonochrome = !IsPortColor( gw ) ;
         if ( !isMonochrome )
         {
             if ( (**gwpixmaphandle).pixelSize == 1 )
                 isMonochrome = true ;
         }
         if ( isMonochrome && width == 8 && height == 8 )
-           {
-               ::RGBForeColor( &MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) );
-               ::RGBForeColor( &MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) );
+        {
+            ::RGBForeColor( &MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) );
+            ::RGBForeColor( &MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) );
             BitMap* gwbitmap = (BitMap*) *gwpixmaphandle ; // since the color depth is 1 it is a BitMap
             UInt8 *gwbits = (UInt8*) gwbitmap->baseAddr ;
             int alignment = gwbitmap->rowBytes & 0x7FFF ;
@@ -1998,91 +2067,92 @@ void wxDC::MacInstallBrush() const
             }
             UnlockPixels( GetGWorldPixMap( gw ) ) ;
             ::PenPat( &pat ) ;
-           }
-           else
-           {
- // this will be the code to handle power of 2 patterns, we will have to arrive at a nice
- // caching scheme before putting this into production
-               Handle      image;
-               long            imageSize;
-               PixPatHandle pixpat = NewPixPat() ;
-               CopyPixMap(gwpixmaphandle, (**pixpat).patMap);
+        }
+        else
+        {
           // this will be the code to handle power of 2 patterns, we will have to arrive at a nice
           // caching scheme before putting this into production
+            Handle      image;
+            long        imageSize;
+            PixPatHandle pixpat = NewPixPat() ;
+            CopyPixMap(gwpixmaphandle, (**pixpat).patMap);
             imageSize = GetPixRowBytes((**pixpat).patMap) *
-                           ((**(**pixpat).patMap).bounds.bottom -
-                           (**(**pixpat).patMap).bounds.top);
+                ((**(**pixpat).patMap).bounds.bottom -
+                (**(**pixpat).patMap).bounds.top);
             PtrToHand( (**gwpixmaphandle).baseAddr, &image, imageSize );
             (**pixpat).patData = image;
             if ( isMonochrome )
             {
-                   CTabHandle ctable = ((**((**pixpat).patMap)).pmTable) ;
-                   ColorSpecPtr ctspec = (ColorSpecPtr) &(**ctable).ctTable ;
-                   if ( ctspec[0].rgb.red == 0x0000 )
-                   {
-                       ctspec[1].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
-                       ctspec[0].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
-                   }
-                   else
-                   {
-                       ctspec[0].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
-                       ctspec[1].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
-                   }
-                   ::CTabChanged( ctable ) ;
+                CTabHandle ctable = ((**((**pixpat).patMap)).pmTable) ;
+                ColorSpecPtr ctspec = (ColorSpecPtr) &(**ctable).ctTable ;
+                if ( ctspec[0].rgb.red == 0x0000 )
+                {
+                    ctspec[1].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
+                    ctspec[0].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
+                }
+                else
+                {
+                    ctspec[0].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
+                    ctspec[1].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
+                }
+                ::CTabChanged( ctable ) ;
             }
             ::PenPixPat(pixpat);
             m_macForegroundPixMap = pixpat ;
-           }
-           UnlockPixels( gwpixmaphandle ) ;
-       }
+        }
+        UnlockPixels( gwpixmaphandle ) ;
+    }
     else
     {
-           ::PenPat(GetQDGlobalsBlack(&blackColor));
-       }
-       short mode = patCopy ;
-       switch( m_logicalFunction )
-       {
-               case wxCOPY:       // src
-                   if ( backgroundTransparent )
-                       mode = patOr ;
-                   else
-                           mode = patCopy ;
-                       break ;
-               case wxINVERT:     // NOT dst
-                   if ( !backgroundTransparent )
-                   {
-                           ::PenPat(GetQDGlobalsBlack(&blackColor));
-                       }
-                       mode = patXor ;
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = patXor ;
-                       break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                       mode = notPatOr ;
-                       break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notPatCopy ;
-                       break ;
-               // unsupported TODO
-               case wxCLEAR:      // 0
-               case wxAND_REVERSE:// src AND (NOT dst)
-               case wxAND:        // src AND dst
-               case wxAND_INVERT: // (NOT src) AND dst
-               case wxNO_OP:      // dst
-               case wxNOR:        // (NOT src) AND (NOT dst)
-               case wxEQUIV:      // (NOT src) XOR dst
-               case wxOR_INVERT:  // (NOT src) OR dst
-               case wxNAND:       // (NOT src) OR (NOT dst)
-               case wxOR:         // src OR dst
-               case wxSET:        // 1
-//             case wxSRC_OR:     // source _bitmap_ OR destination
-//             case wxSRC_AND:     // source _bitmap_ AND destination
-                       break ;
-       }
-       ::PenMode( mode ) ;
-       m_macBrushInstalled = true ;
-       m_macPenInstalled = false ;
-       m_macFontInstalled = false ;
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+    }
+    short mode = patCopy ;
+    switch( m_logicalFunction )
+    {
+    case wxCOPY:       // src
+        if ( backgroundTransparent )
+            mode = patOr ;
+        else
+            mode = patCopy ;
+        break ;
+    case wxINVERT:     // NOT dst
+        if ( !backgroundTransparent )
+        {
+            ::PenPat(GetQDGlobalsBlack(&blackColor));
+        }
+        mode = patXor ;
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = patXor ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        mode = notPatOr ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notPatCopy ;
+        break ;
+        // unsupported TODO
+    case wxCLEAR:      // 0
+    case wxAND_REVERSE:// src AND (NOT dst)
+    case wxAND:        // src AND dst
+    case wxAND_INVERT: // (NOT src) AND dst
+    case wxNO_OP:      // dst
+    case wxNOR:        // (NOT src) AND (NOT dst)
+    case wxEQUIV:      // (NOT src) XOR dst
+    case wxOR_INVERT:  // (NOT src) OR dst
+    case wxNAND:       // (NOT src) OR (NOT dst)
+    case wxOR:         // src OR dst
+    case wxSET:        // 1
+        //        case wxSRC_OR:     // source _bitmap_ OR destination
+        //        case wxSRC_AND:     // source _bitmap_ AND destination
+        break ;
+    }
+    ::PenMode( mode ) ;
+    m_macBrushInstalled = true ;
+    m_macPenInstalled = false ;
+    m_macFontInstalled = false ;
 }
+
 // ---------------------------------------------------------------------------
 // coordinates transformations
 // ---------------------------------------------------------------------------
@@ -2091,30 +2161,37 @@ wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
 {
     return ((wxDC *)this)->XDEV2LOG(x);
 }
+
 wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
 {
     return ((wxDC *)this)->YDEV2LOG(y);
 }
+
 wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
 {
     return ((wxDC *)this)->XDEV2LOGREL(x);
 }
+
 wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
 {
     return ((wxDC *)this)->YDEV2LOGREL(y);
 }
+
 wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
 {
     return ((wxDC *)this)->XLOG2DEV(x);
 }
+
 wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
 {
     return ((wxDC *)this)->YLOG2DEV(y);
 }
+
 wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
 {
     return ((wxDC *)this)->XLOG2DEVREL(x);
 }
+
 wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
 {
     return ((wxDC *)this)->YLOG2DEVREL(y);
index 1a878857f70126ec0b86fa31ee08e2ccac9a4a61..8e85da2cf5f311eea8d19167278461ebc8ba8d2f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -49,24 +49,24 @@ wxWindowDC::wxWindowDC()
 
 wxWindowDC::wxWindowDC(wxWindow *the_canvas) 
 {
-       wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
-       WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
-       
-       int x , y ;
-       x = y = 0 ;
-       the_canvas->MacWindowToRootWindow( &x , &y ) ;
-       m_macLocalOrigin.x = x ;
-       m_macLocalOrigin.y = y ;
-       CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
-       m_macPort = UMAGetWindowPort( windowref ) ;
-       m_minY = m_minX =  0;
-       wxSize size = the_canvas->GetSize() ;
-       m_maxX = size.x  ;
-       m_maxY = size.y ; 
-
-       m_ok = TRUE ;
+    wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
+    WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
+    
+    int x , y ;
+    x = y = 0 ;
+    the_canvas->MacWindowToRootWindow( &x , &y ) ;
+    m_macLocalOrigin.x = x ;
+    m_macLocalOrigin.y = y ;
+    CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_macPort = UMAGetWindowPort( windowref ) ;
+    m_minY = m_minX =  0;
+    wxSize size = the_canvas->GetSize() ;
+    m_maxX = size.x  ;
+    m_maxY = size.y ; 
+
+     m_ok = TRUE ;
   SetBackground(the_canvas->MacGetBackgroundBrush());
 }
 
@@ -84,30 +84,30 @@ wxClientDC::wxClientDC()
 
 wxClientDC::wxClientDC(wxWindow *window)
 {
-       wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
-        if (!rootwindow)
-            return;
-       WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
-       wxPoint origin = window->GetClientAreaOrigin() ;
-       wxSize size = window->GetClientSize() ;
-       int x , y ;
-       x = origin.x ;
-       y = origin.y ;
-       window->MacWindowToRootWindow( &x , &y ) ;
-       m_macLocalOrigin.x = x ;
-       m_macLocalOrigin.y = y ;
-       SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
-       SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
-       m_macPort = UMAGetWindowPort( windowref ) ;
-       m_minY = m_minX =  0;
-       m_maxX = size.x  ;
-       m_maxY = size.y ; 
-       m_ok = TRUE ;
-  SetBackground(window->MacGetBackgroundBrush());
-       SetFont( window->GetFont() ) ;
+    wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
+    if (!rootwindow)
+        return;
+    WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
+    wxPoint origin = window->GetClientAreaOrigin() ;
+    wxSize size = window->GetClientSize() ;
+    int x , y ;
+    x = origin.x ;
+    y = origin.y ;
+    window->MacWindowToRootWindow( &x , &y ) ;
+    m_macLocalOrigin.x = x ;
+    m_macLocalOrigin.y = y ;
+    SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
+    SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
+    m_macPort = UMAGetWindowPort( windowref ) ;
+    m_minY = m_minX =  0;
+    m_maxX = size.x  ;
+    m_maxY = size.y ; 
+    m_ok = TRUE ;
+    SetBackground(window->MacGetBackgroundBrush());
+    SetFont( window->GetFont() ) ;
 }
 
 wxClientDC::~wxClientDC()
@@ -124,29 +124,29 @@ wxPaintDC::wxPaintDC()
 
 wxPaintDC::wxPaintDC(wxWindow *window)
 {
-       wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
-       WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
-       wxPoint origin = window->GetClientAreaOrigin() ;
-       wxSize size = window->GetClientSize() ;
-       int x , y ;
-       x = origin.x ;
-       y = origin.y ;
-       window->MacWindowToRootWindow( &x , &y ) ;
-       m_macLocalOrigin.x = x ;
-       m_macLocalOrigin.y = y ;
-       SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
-       SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
-  SectRgn( (RgnHandle) m_macBoundaryClipRgn  , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
-       m_macPort = UMAGetWindowPort( windowref ) ;
-       m_minY = m_minX =  0;
-       m_maxX = size.x  ;
-       m_maxY = size.y ; 
-       m_ok = TRUE ;
-  SetBackground(window->MacGetBackgroundBrush());
-       SetFont( window->GetFont() ) ;
+    wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
+    WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
+    wxPoint origin = window->GetClientAreaOrigin() ;
+    wxSize size = window->GetClientSize() ;
+    int x , y ;
+    x = origin.x ;
+    y = origin.y ;
+    window->MacWindowToRootWindow( &x , &y ) ;
+    m_macLocalOrigin.x = x ;
+    m_macLocalOrigin.y = y ;
+    SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
+    SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+    SectRgn( (RgnHandle) m_macBoundaryClipRgn  , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_macPort = UMAGetWindowPort( windowref ) ;
+    m_minY = m_minX =  0;
+    m_maxX = size.x  ;
+    m_maxY = size.y ; 
+    m_ok = TRUE ;
+    SetBackground(window->MacGetBackgroundBrush());
+    SetFont( window->GetFont() ) ;
 }
 
 wxPaintDC::~wxPaintDC()
index d4db46174e6cce6ae64ea89c95322db5cd9c0ddb..e850a59e4d431a92a96d7ef2ff3a6fad623c913c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
 
 wxMemoryDC::wxMemoryDC(void)
-    : m_selected()
+: m_selected()
 {
-  m_ok = TRUE;
+    m_ok = TRUE;
     SetBackground(*wxWHITE_BRUSH);
     SetBrush(*wxWHITE_BRUSH);
     SetPen(*wxBLACK_PEN);
-  m_ok = FALSE;
+    m_ok = FALSE;
 };
 
 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
-    : m_selected()
+: m_selected()
 {
-  m_ok = TRUE;
+    m_ok = TRUE;
     SetBackground(*wxWHITE_BRUSH);
     SetBrush(*wxWHITE_BRUSH);
     SetPen(*wxBLACK_PEN);
-  m_ok = FALSE;
+    m_ok = FALSE;
 };
 
 wxMemoryDC::~wxMemoryDC()
 {
-       if ( m_selected.Ok() )
-       {
-               UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
-       }
+    if ( m_selected.Ok() )
+    {
+        UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
+    }
 };
 
 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 {
-       if ( m_selected.Ok() )
-       {
-               UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
-       }
+    if ( m_selected.Ok() )
+    {
+        UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
+    }
     m_selected = bitmap;
     if (m_selected.Ok())
     {
-               if ( m_selected.GetHBITMAP() )
-               {
-                       m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
-                       LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
-                       wxMask * mask = bitmap.GetMask() ;
-                       if ( mask )
-                       {
-                               m_macMask = mask->GetMaskBitmap() ;
-                       }
-               SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
-               CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
-                       m_ok = TRUE ;
-               }
-               else
-               {
-               m_ok = FALSE;
-               }
-  }
-  else
-  {
-    m_ok = FALSE;
-  }
+        if ( m_selected.GetHBITMAP() )
+        {
+            m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
+            LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
+            wxMask * mask = bitmap.GetMask() ;
+            if ( mask )
+            {
+                m_macMask = mask->GetMaskBitmap() ;
+            }
+            SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
+            CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
+            m_ok = TRUE ;
+        }
+        else
+        {
+            m_ok = FALSE;
+        }
+    }
+    else
+    {
+        m_ok = FALSE;
+    }
 }
 
 void wxMemoryDC::DoGetSize( int *width, int *height ) const
 {
-  if (m_selected.Ok())
-  {
-    if (width) (*width) = m_selected.GetWidth();
-    if (height) (*height) = m_selected.GetHeight();
-  }
-  else
-  {
-    if (width) (*width) = 0;
-    if (height) (*height) = 0;
-  }
+    if (m_selected.Ok())
+    {
+        if (width) (*width) = m_selected.GetWidth();
+        if (height) (*height) = m_selected.GetHeight();
+    }
+    else
+    {
+        if (width) (*width) = 0;
+        if (height) (*height) = 0;
+    }
 }
 
 
index 6c32de8ad07f773c2225d7efd676509f24a34f64..2e822438347f4484c863e7f5118996373ee34cbe 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -46,172 +46,172 @@ GrafPtr macPrintFormerPort = NULL ;
 
 wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 {
-       OSStatus err ;
-       wxString message ;
-       
-       m_printData = printdata ;
-       m_printData.ConvertToNative() ;
+    OSStatus err ;
+    wxString message ;
+    
+    m_printData = printdata ;
+    m_printData.ConvertToNative() ;
 
 #if TARGET_CARBON && PM_USE_SESSION_APIS
-       err = UMAPrOpen(&m_macPrintSessionPort) ;
-       if ( err != noErr || m_macPrintSessionPort == kPMNoData )
+    err = UMAPrOpen(&m_macPrintSessionPort) ;
+    if ( err != noErr || m_macPrintSessionPort == kPMNoData )
 #else
-       err = UMAPrOpen(NULL) ;
-       if ( err != noErr )
+    err = UMAPrOpen(NULL) ;
+    if ( err != noErr )
 #endif
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
 #if TARGET_CARBON && PM_USE_SESSION_APIS
-               UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
 #else
-               UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
 #endif
-               m_ok = FALSE;
-               return;
-       }
-       
+        m_ok = FALSE;
+        return;
+    }
+    
 #if !TARGET_CARBON
-       if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
-       {
-               ::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
-               // the driver has changed in the mean time, should we pop up a page setup dialog ?
-       }
-       err = PrError() ;
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               UMAPrClose(NULL) ;
-               m_ok = FALSE;
-               return;
-       }
-       ::GetPort( &macPrintFormerPort ) ;
-       m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
-       err = PrError() ;
-       if ( err )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               UMAPrClose(NULL) ;
-               m_ok = FALSE;
-               return;
-       }
-       // sets current port
-       m_macPort = (GrafPtr ) m_macPrintSessionPort ;
+    if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
+    {
+        ::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
+        // the driver has changed in the mean time, should we pop up a page setup dialog ?
+    }
+    err = PrError() ;
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+        UMAPrClose(NULL) ;
+        m_ok = FALSE;
+        return;
+    }
+    ::GetPort( &macPrintFormerPort ) ;
+    m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
+    err = PrError() ;
+    if ( err )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+        UMAPrClose(NULL) ;
+        m_ok = FALSE;
+        return;
+    }
+    // sets current port
+    m_macPort = (GrafPtr ) m_macPrintSessionPort ;
 #else
   #if PM_USE_SESSION_APIS
     err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort,
               (PMPrintSettings)m_printData.m_macPrintSettings, 
-             (PMPageFormat)m_printData.m_macPageFormat);
+              (PMPageFormat)m_printData.m_macPageFormat);
     if ( err != noErr )
   #else
-       m_macPrintSessionPort = kPMNoReference ;
+    m_macPrintSessionPort = kPMNoReference ;
     err = PMBeginDocument(
-             m_printData.m_macPrintSettings, 
-             m_printData.m_macPageFormat, 
-             &m_macPrintSessionPort);
+              m_printData.m_macPrintSettings, 
+              m_printData.m_macPageFormat, 
+              &m_macPrintSessionPort);
     if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
   #endif
     {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
-               UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
   #endif
-               m_ok = FALSE;
-               return;
+        m_ok = FALSE;
+        return;
     }
-       // sets current port
-       ::GetPort( (GrafPtr *)&m_macPort ) ;
+    // sets current port
+    ::GetPort( (GrafPtr *)&m_macPort ) ;
 #endif
-       m_ok = TRUE ;
-       m_minY = m_minX = 0 ;
+    m_ok = TRUE ;
+    m_minY = m_minX = 0 ;
 #if TARGET_CARBON
-       PMRect rPaper;
-       
-       err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
+    PMRect rPaper;
+    
+    err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
     if ( err != noErr )
     {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
-               UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
   #endif
-               m_ok = FALSE;
-               return;
+        m_ok = FALSE;
+        return;
     }
-       m_maxX = wxCoord(rPaper.right - rPaper.left) ;
-       m_maxY = wxCoord(rPaper.bottom - rPaper.top);
+    m_maxX = wxCoord(rPaper.right - rPaper.left) ;
+    m_maxY = wxCoord(rPaper.bottom - rPaper.top);
 #else
-       m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
-       m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
+    m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
+    m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
 #endif
 }
 
 wxPrinterDC::~wxPrinterDC(void)
 {
-       OSStatus err ;
-       wxString message ;
+    OSStatus err ;
+    wxString message ;
 #if !TARGET_CARBON
-       if ( m_ok )
-       {
-               ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
-               err = PrError() ;
-               
-               if ( err == noErr )
-               {
-                       if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
-                       {
-                               TPrStatus status ;
-                               ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
-                       }
-               }
-               else
-               {
-                       message.Printf( "Print Error %ld", err ) ;
-                       wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-                   dialog.ShowModal();
-               }
-               ::UMAPrClose(NULL) ;
-//       ::SetPort( macPrintFormerPort ) ;
-               ::SetPort( LMGetWMgrPort() ) ;
-       }
+    if ( m_ok )
+    {
+        ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
+        err = PrError() ;
+        
+        if ( err == noErr )
+        {
+            if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
+            {
+                TPrStatus status ;
+                ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
+            }
+        }
+        else
+        {
+            message.Printf( "Print Error %ld", err ) ;
+            wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+            dialog.ShowModal();
+        }
+        ::UMAPrClose(NULL) ;
+//      ::SetPort( macPrintFormerPort ) ;
+        ::SetPort( LMGetWMgrPort() ) ;
+    }
 #else
-       if ( m_ok ) 
-       {
+    if ( m_ok ) 
+    {
   #if PM_USE_SESSION_APIS
-           err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
+        err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
   #else
-           err = PMEndDocument(m_macPrintSessionPort);
+        err = PMEndDocument(m_macPrintSessionPort);
   #endif
-       if ( err != noErr )
-       {
-                       message.Printf( "Print Error %ld", err ) ;
-                       wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-                   dialog.ShowModal();
-       }
+         if ( err != noErr )
+         {
+            message.Printf( "Print Error %ld", err ) ;
+            wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+            dialog.ShowModal();
+         }
   #if TARGET_CARBON && PM_USE_SESSION_APIS
-           UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-           UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
   #endif
-       }
+    }
 #endif
 }
 
 bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) ) 
 {
-       return m_ok ;
+    return m_ok ;
 }
 
 void wxPrinterDC::EndDoc(void) 
@@ -220,117 +220,117 @@ void wxPrinterDC::EndDoc(void)
 
 void wxPrinterDC::StartPage(void) 
 {
-       if ( !m_ok )
-               return ;
+    if ( !m_ok )
+        return ;
 
-       m_logicalFunction = wxCOPY;
+      m_logicalFunction = wxCOPY;
 //  m_textAlignment = wxALIGN_TOP_LEFT;
-       m_backgroundMode = wxTRANSPARENT;
+      m_backgroundMode = wxTRANSPARENT;
   
-       m_textForegroundColour = *wxBLACK;
-       m_textBackgroundColour = *wxWHITE;
-       m_pen = *wxBLACK_PEN;
-       m_font = *wxNORMAL_FONT;
-       m_brush = *wxTRANSPARENT_BRUSH;
-       m_backgroundBrush = *wxWHITE_BRUSH;
+      m_textForegroundColour = *wxBLACK;
+      m_textBackgroundColour = *wxWHITE;
+      m_pen = *wxBLACK_PEN;
+      m_font = *wxNORMAL_FONT;
+      m_brush = *wxTRANSPARENT_BRUSH;
+      m_backgroundBrush = *wxWHITE_BRUSH;
     
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
 
-               
-       OSStatus err ;
-       wxString message ;
+        
+    OSStatus err ;
+    wxString message ;
 
 #if !TARGET_CARBON
-       PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
-       m_macLocalOrigin.x =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
-       m_macLocalOrigin.y =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
-       
-       Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
-       ::ClipRect( &clip ) ;
-       err = PrError() ;
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
-               ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
-               ::UMAPrClose(NULL) ;
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+      PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
+      m_macLocalOrigin.x =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
+      m_macLocalOrigin.y =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
+      
+    Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
+    ::ClipRect( &clip ) ;
+    err = PrError() ;
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+           ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
+        ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
+        ::UMAPrClose(NULL) ;
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #else
   #if PM_USE_SESSION_APIS
-       err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
-                                (PMPageFormat)m_printData.m_macPageFormat,
-                                nil);
+    err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
+                 (PMPageFormat)m_printData.m_macPageFormat,
+                 nil);
   #else
-       err = PMBeginPage(m_macPrintSessionPort, nil);
+    err = PMBeginPage(m_macPrintSessionPort, nil);
   #endif
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if PM_USE_SESSION_APIS
-               PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
-               PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
-               UMAPrClose(&m_macPrintSessionPort) ;
+           PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
+        PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               PMEndPage(m_macPrintSessionPort);
-               PMEndDocument(m_macPrintSessionPort);
-               UMAPrClose(NULL) ;
+           PMEndPage(m_macPrintSessionPort);
+        PMEndDocument(m_macPrintSessionPort);
+        UMAPrClose(NULL) ;
   #endif
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #endif
 }
 
 void wxPrinterDC::EndPage(void) 
 {
-       if ( !m_ok )
-               return ;
+    if ( !m_ok )
+        return ;
 
-       OSStatus err ;
-       wxString message ;
+    OSStatus err ;
+    wxString message ;
 
 #if !TARGET_CARBON
-       PrClosePage(  (TPPrPort) m_macPort ) ;
-       err = PrError() ;
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
-               ::UMAPrClose(NULL) ;
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+       PrClosePage(  (TPPrPort) m_macPort ) ;
+    err = PrError() ;
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+        ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
+        ::UMAPrClose(NULL) ;
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #else
   #if PM_USE_SESSION_APIS
-       err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
+    err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
   #else
-       err = PMEndPage(m_macPrintSessionPort);
+    err = PMEndPage(m_macPrintSessionPort);
   #endif
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if PM_USE_SESSION_APIS
-               PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
-               UMAPrClose(&m_macPrintSessionPort) ;
+        PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               PMEndDocument(m_macPrintSessionPort);
-               UMAPrClose(NULL) ;
+        PMEndDocument(m_macPrintSessionPort);
+        UMAPrClose(NULL) ;
   #endif
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #endif
 
 }
index 0e12102f6f5dfbd0a2fe3bd1b96a298968041992..03d769a05b41ddf5987b5ac71122aac8a4e4da83 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -24,36 +24,36 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
 wxScreenDC::wxScreenDC()
 {
 #if TARGET_CARBON
-       m_macPort = GetQDGlobalsThePort() ;
-       GrafPtr port ;
-       GetPort( &port ) ;
-       SetPort( (GrafPtr) m_macPort ) ;
-       Point pt = { 0,0 } ;
-    LocalToGlobal( &pt ) ;     
-       SetPort( port ) ;
-       m_macLocalOrigin.x = -pt.h ;
-       m_macLocalOrigin.y = -pt.v ;
+    m_macPort = GetQDGlobalsThePort() ;
+    GrafPtr port ;
+    GetPort( &port ) ;
+    SetPort( (GrafPtr) m_macPort ) ;
+    Point pt = { 0,0 } ;
+    LocalToGlobal( &pt ) ;     
+    SetPort( port ) ;
+    m_macLocalOrigin.x = -pt.h ;
+    m_macLocalOrigin.y = -pt.v ;
 #else
-       m_macPort = LMGetWMgrPort() ;
-       m_macLocalOrigin.x = 0 ;
-       m_macLocalOrigin.y = 0 ;
+    m_macPort = LMGetWMgrPort() ;
+    m_macLocalOrigin.x = 0 ;
+    m_macLocalOrigin.y = 0 ;
 #endif
-       m_ok = TRUE ;
-       BitMap screenBits;
-       GetQDGlobalsScreenBits( &screenBits );
-       m_minX = screenBits.bounds.left ;
+     m_ok = TRUE ;
+    BitMap screenBits;
+    GetQDGlobalsScreenBits( &screenBits );
+     m_minX = screenBits.bounds.left ;
  #if TARGET_CARBON
-       SInt16 height ;
-       GetThemeMenuBarHeight( &height ) ;
-       m_minY = screenBits.bounds.top + height ;
+     SInt16 height ;
+     GetThemeMenuBarHeight( &height ) ;
+     m_minY = screenBits.bounds.top + height ;
  #else
-       m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
+     m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
  #endif
-       m_maxX = screenBits.bounds.right  ;
-       m_maxY = screenBits.bounds.bottom ;
-       MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_maxX = screenBits.bounds.right  ;
+    m_maxY = screenBits.bounds.bottom ;
+    MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
 }
 
 wxScreenDC::~wxScreenDC()
index 506e3399adb3cfdef236cc571b420b32fb5f90e7..7b7bfc024b7899c5636d789022edcb6947d7ef24 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -46,7 +46,7 @@ END_EVENT_TABLE()
 
 wxDialog::wxDialog()
 {
-       m_isShown = FALSE;
+      m_isShown = FALSE;
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
 }
 
@@ -57,60 +57,59 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
            long style,
            const wxString& name)
 {
-
-  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
-  
-
-  if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    
+    
+    if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
         return FALSE;
+    
+    MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style)  , name ) ;
+    
+    m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
+    SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
 
-       MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style)  , name ) ;
-
-       m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
-       SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-  return TRUE;
+    return TRUE;
 }
 
 void wxDialog::SetModal(bool flag)
 {
-  if ( flag )
+    if ( flag )
     {
         m_windowStyle |= wxDIALOG_MODAL;
-
+        
         wxModelessWindows.DeleteObject(this);
     }
     else
     {
         m_windowStyle &= ~wxDIALOG_MODAL;
-
+        
         wxModelessWindows.Append(this);
     }
 }
 
 wxDialog::~wxDialog()
 {
-       m_isBeingDeleted = TRUE ;
-  Show(FALSE);
+    m_isBeingDeleted = TRUE ;
+    Show(FALSE);
 }
 
 // By default, pressing escape cancels the dialog , on mac command-stop does the same thing
 void wxDialog::OnCharHook(wxKeyEvent& event)
 {
-  if (
-    ( event.m_keyCode == WXK_ESCAPE || 
-      ( event.m_keyCode == '.' && event.MetaDown() ) )
-     && FindWindow(wxID_CANCEL) )
-  {
-               // Behaviour changed in 2.0: we'll send a Cancel message
-               // to the dialog instead of Close.
-               wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
-               cancelEvent.SetEventObject( this );
-               GetEventHandler()->ProcessEvent(cancelEvent);
-
-               return;
-  }
-  // We didn't process this event.
-  event.Skip();
+    if (( event.m_keyCode == WXK_ESCAPE || 
+        ( event.m_keyCode == '.' && event.MetaDown() ) )
+        && FindWindow(wxID_CANCEL) )
+    {
+        // Behaviour changed in 2.0: we'll send a Cancel message
+        // to the dialog instead of Close.
+        wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+        cancelEvent.SetEventObject( this );
+        GetEventHandler()->ProcessEvent(cancelEvent);
+        
+        return;
+    }
+    // We didn't process this event.
+    event.Skip();
 }
 
 bool wxDialog::IsModal() const
@@ -165,7 +164,7 @@ void wxDialog::DoShowModal()
 
     wxModalDialogs.Append(this);
 
-       wxWindow *parent = GetParent();
+      wxWindow *parent = GetParent();
 
     // remember where the focus was
     wxWindow *winFocus = FindFocus();
@@ -178,23 +177,23 @@ void wxDialog::DoShowModal()
         winFocus = wxTheApp->GetTopWindow();
     }
 #if TARGET_CARBON
-       BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
+    BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
 #else
-       // TODO : test whether parent gets disabled
-       bool formerModal = s_macIsInModalLoop ;
-       s_macIsInModalLoop = true ;
+    // TODO : test whether parent gets disabled
+    bool formerModal = s_macIsInModalLoop ;
+    s_macIsInModalLoop = true ;
 #endif
-       while ( IsModalShowing() )
-       {
-               wxTheApp->MacDoOneEvent() ;
-               // calls process idle itself
-       }
-       
+    while ( IsModalShowing() )
+    {
+        wxTheApp->MacDoOneEvent() ;
+        // calls process idle itself
+    }
+    
 #if TARGET_CARBON
-       EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
+    EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
 #else
     // TODO probably reenable the parent window if any
-       s_macIsInModalLoop = formerModal ;
+    s_macIsInModalLoop = formerModal ;
 #endif
 
 
@@ -209,13 +208,13 @@ void wxDialog::DoShowModal()
 // Replacement for Show(TRUE) for modal dialogs - returns return code
 int wxDialog::ShowModal()
 {
-       if ( !IsModal() )
-       {
-           SetModal(TRUE);
-       }
+    if ( !IsModal() )
+    {
+        SetModal(TRUE);
+    }
 
-       Show(TRUE);
-       return GetReturnCode();
+    Show(TRUE);
+    return GetReturnCode();
 }
 
 // NB: this function (surprizingly) may be called for both modal and modeless
index 9c6c131e68f976f13a5e2d2a0e5f81d5a4a0a947..686405423442d2f944726f597cb2fe81a25d904a 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -40,107 +40,107 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
                          const wxSize& WXUNUSED(size),
                          const wxString& WXUNUSED(name))
 {
-       wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
-       m_path = defaultPath;
+    m_path = defaultPath;
 }
 
 int wxDirDialog::ShowModal()
 {
-       NavDialogOptions                mNavOptions;
-       NavObjectFilterUPP              mNavFilterUPP = NULL;
-       NavPreviewUPP                   mNavPreviewUPP = NULL ;
-       NavReplyRecord                  mNavReply;
-       AEDesc*                                 mDefaultLocation = NULL ;
-       bool                                    mSelectDefault = false ;
-       
-       ::NavGetDefaultDialogOptions(&mNavOptions);
+    NavDialogOptions        mNavOptions;
+    NavObjectFilterUPP        mNavFilterUPP = NULL;
+    NavPreviewUPP            mNavPreviewUPP = NULL ;
+    NavReplyRecord            mNavReply;
+    AEDesc*                    mDefaultLocation = NULL ;
+    bool                    mSelectDefault = false ;
+    
+    ::NavGetDefaultDialogOptions(&mNavOptions);
 
-       mNavFilterUPP   = nil;
-       mNavPreviewUPP  = nil;
-       mSelectDefault  = false;
-       mNavReply.validRecord                           = false;
-       mNavReply.replacing                                     = false;
-       mNavReply.isStationery                          = false;
-       mNavReply.translationNeeded                     = false;
-       mNavReply.selection.descriptorType = typeNull;
-       mNavReply.selection.dataHandle          = nil;
-       mNavReply.keyScript                                     = smSystemScript;
-       mNavReply.fileTranslation                       = nil;
-       
-       // Set default location, the location
-       //   that's displayed when the dialog
-       //   first appears
-       
-       if ( mDefaultLocation ) {
-               
-               if (mSelectDefault) {
-                       mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
-               } else {
-                       mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
-               }
-       }
-       
-       OSErr err = ::NavChooseFolder(
-                                               mDefaultLocation,
-                                               &mNavReply,
-                                               &mNavOptions,
-                                               NULL,
-                                               mNavFilterUPP,
-                                               0L);                                                    // User Data
-       
-       if ( (err != noErr) && (err != userCanceledErr) ) {
-               m_path = "" ;
-               return wxID_CANCEL ;
-       }
+    mNavFilterUPP    = nil;
+    mNavPreviewUPP    = nil;
+    mSelectDefault    = false;
+    mNavReply.validRecord                = false;
+    mNavReply.replacing                    = false;
+    mNavReply.isStationery                = false;
+    mNavReply.translationNeeded            = false;
+    mNavReply.selection.descriptorType = typeNull;
+    mNavReply.selection.dataHandle        = nil;
+    mNavReply.keyScript                    = smSystemScript;
+    mNavReply.fileTranslation            = nil;
+    
+    // Set default location, the location
+    //   that's displayed when the dialog
+    //   first appears
+    
+    if ( mDefaultLocation ) {
+        
+        if (mSelectDefault) {
+            mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
+        } else {
+            mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
+        }
+    }
+    
+    OSErr err = ::NavChooseFolder(
+                        mDefaultLocation,
+                        &mNavReply,
+                        &mNavOptions,
+                        NULL,
+                        mNavFilterUPP,
+                        0L);                            // User Data
+    
+    if ( (err != noErr) && (err != userCanceledErr) ) {
+        m_path = "" ;
+        return wxID_CANCEL ;
+    }
 
-       if (mNavReply.validRecord) {            // User chose a folder
-       
-               FSSpec  folderInfo;
-               FSSpec  outFileSpec ;
-               AEDesc specDesc ;
-               
-               OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
-               if ( err != noErr ) {
-                       m_path = "" ;
-                       return wxID_CANCEL ;
-               }                       
-               folderInfo = **(FSSpec**) specDesc.dataHandle;
-               if (specDesc.dataHandle != nil) {
-                       ::AEDisposeDesc(&specDesc);
-               }
+    if (mNavReply.validRecord) {        // User chose a folder
+    
+        FSSpec    folderInfo;
+        FSSpec  outFileSpec ;
+        AEDesc specDesc ;
+        
+        OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
+        if ( err != noErr ) {
+            m_path = "" ;
+            return wxID_CANCEL ;
+        }            
+        folderInfo = **(FSSpec**) specDesc.dataHandle;
+        if (specDesc.dataHandle != nil) {
+            ::AEDisposeDesc(&specDesc);
+        }
 
-//                     mNavReply.GetFileSpec(folderInfo);
-               
-                       // The FSSpec from NavChooseFolder is NOT the file spec
-                       // for the folder. The parID field is actually the DirID
-                       // of the folder itself, not the folder's parent, and
-                       // the name field is empty. We must call PBGetCatInfo
-                       // to get the parent DirID and folder name
-               
-               Str255          name;
-               CInfoPBRec      thePB;                  // Directory Info Parameter Block
-               thePB.dirInfo.ioCompletion      = nil;
-               thePB.dirInfo.ioVRefNum         = folderInfo.vRefNum;   // Volume is right
-               thePB.dirInfo.ioDrDirID         = folderInfo.parID;             // Folder's DirID
-               thePB.dirInfo.ioNamePtr         = name;
-               thePB.dirInfo.ioFDirIndex       = -1;   // Lookup using Volume and DirID
-               
-               err = ::PBGetCatInfoSync(&thePB);
-               if ( err != noErr ) {
-                       m_path = "" ;
-                       return wxID_CANCEL ;
-               }                       
-                                                                                       // Create cannonical FSSpec
-               ::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
-                                          name, &outFileSpec);
-                                               
-               // outFolderDirID = thePB.dirInfo.ioDrDirID;
-               m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
-               return wxID_OK ;
-       }
-       return wxID_CANCEL;
+//            mNavReply.GetFileSpec(folderInfo);
+        
+            // The FSSpec from NavChooseFolder is NOT the file spec
+            // for the folder. The parID field is actually the DirID
+            // of the folder itself, not the folder's parent, and
+            // the name field is empty. We must call PBGetCatInfo
+            // to get the parent DirID and folder name
+        
+        Str255        name;
+        CInfoPBRec    thePB;            // Directory Info Parameter Block
+        thePB.dirInfo.ioCompletion    = nil;
+        thePB.dirInfo.ioVRefNum        = folderInfo.vRefNum;    // Volume is right
+        thePB.dirInfo.ioDrDirID        = folderInfo.parID;        // Folder's DirID
+        thePB.dirInfo.ioNamePtr        = name;
+        thePB.dirInfo.ioFDirIndex    = -1;    // Lookup using Volume and DirID
+        
+        err = ::PBGetCatInfoSync(&thePB);
+        if ( err != noErr ) {
+            m_path = "" ;
+            return wxID_CANCEL ;
+        }            
+                                            // Create cannonical FSSpec
+        ::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
+                       name, &outFileSpec);
+                        
+        // outFolderDirID = thePB.dirInfo.ioDrDirID;
+        m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
+        return wxID_OK ;
+    }
+    return wxID_CANCEL;
 }
 
index 0f250ccd5ec17ed9f1e2fa38afb3fbfdf57aec91..53e9dcbd68b4ef2f34d0a4c00f7e031035d12d49 100644 (file)
@@ -83,11 +83,11 @@ public:
     const wxString& GetName() const { return m_dirname; }
 
 private:
-       CInfoPBRec                      m_CPB ;
-       wxInt16                         m_index ;
-       long                            m_dirId ;
-       Str255                          m_name ;
-       Boolean                         m_isDir ;
+    CInfoPBRec            m_CPB ;
+    wxInt16                m_index ;
+    long                m_dirId ;
+    Str255                m_name ;
+    Boolean                m_isDir ;
 
     wxString m_dirname;
     wxString m_filespec;
@@ -145,26 +145,26 @@ wxDirData::~wxDirData()
 
 void wxDirData::Rewind() 
 {
-       m_index = 0 ;
+    m_index = 0 ;
 }
 
 bool wxDirData::Read(wxString *filename)
 {
     if ( !m_isDir )
         return FALSE ;
-               
+        
 #if TARGET_CARBON
-       char c_name[256] ;
+    char c_name[256] ;
 #endif
     wxString result;
 
     short err = noErr ;
-       
+    
     while ( err == noErr )
     {
         m_index++ ;
         m_CPB.dirInfo.ioFDirIndex = m_index;
-        m_CPB.dirInfo.ioDrDirID = m_dirId;     /* we need to do this every time */
+        m_CPB.dirInfo.ioDrDirID = m_dirId;    /* we need to do this every time */
         err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
         if ( err != noErr )
             break ;
@@ -270,12 +270,12 @@ wxString wxDir::GetName() const
     wxString name;
     if ( m_data )
     {
-       name = M_DIR->GetName();
-       if ( !name.empty() && (name.Last() == _T('/')) )
-       {
-           // chop off the last (back)slash
-           name.Truncate(name.length() - 1);
-       }
+    name = M_DIR->GetName();
+    if ( !name.empty() && (name.Last() == _T('/')) )
+    {
+        // chop off the last (back)slash
+        name.Truncate(name.length() - 1);
+    }
     }
 
     return name;
index e25b2486e3fbe1fe4226caa3fb3acc86cd343d3d..3502ac55f53159d95850fbf5541859bf85c89f22 100644 (file)
@@ -44,7 +44,7 @@
 class wxDisplayMacPriv
 {
 public:
-       GDHandle m_hndl;
+    GDHandle m_hndl;
 };
 
 size_t wxDisplayBase::GetCount()
index 68b372cb851755a767dc77ce0f4c6c34aa3a4200..b9df2ac0049fdbb811a6fcb96d3642ab1b8b3076 100644 (file)
@@ -82,47 +82,47 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
     bool supported = false ;
     if ( gTrackingGlobals.m_currentSource != NULL )
     {
-      wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
-      
-      if ( data )
-      {
-        size_t formatcount = data->GetFormatCount() ;
-        wxDataFormat *array = new wxDataFormat[ formatcount  ];
-        data->GetAllFormats( array );
-        for (size_t i = 0; !supported && i < formatcount ; i++)
+        wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
+        
+        if ( data )
         {
-            wxDataFormat format = array[i] ;
-            if ( m_dataObject->IsSupported( format ) ) 
+            size_t formatcount = data->GetFormatCount() ;
+            wxDataFormat *array = new wxDataFormat[ formatcount  ];
+            data->GetAllFormats( array );
+            for (size_t i = 0; !supported && i < formatcount ; i++)
             {
-              supported = true ;
-              break ;
+                wxDataFormat format = array[i] ;
+                if ( m_dataObject->IsSupported( format ) ) 
+                {
+                    supported = true ;
+                    break ;
+                }
             }
+            delete[] array ;
         }
-        delete[] array ;
-      }
     }
     if ( !supported )
     {
-      UInt16 items ;
-      OSErr result;
-      CountDragItems((DragReference)m_currentDrag, &items);
-      for (UInt16 index = 1; index <= items && supported == false ; ++index) 
-      {
-          ItemReference theItem;
-          FlavorType theType ;
-          UInt16 flavors = 0 ;
-          GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
-          CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
-          for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
-          {
-            result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
-            if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
+        UInt16 items ;
+        OSErr result;
+        CountDragItems((DragReference)m_currentDrag, &items);
+        for (UInt16 index = 1; index <= items && supported == false ; ++index) 
+        {
+            ItemReference theItem;
+            FlavorType theType ;
+            UInt16 flavors = 0 ;
+            GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
+            CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
+            for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
             {
-              supported = true ;
-              break ;
+                result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
+                if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
+                {
+                    supported = true ;
+                    break ;
+                }
             }
-          }
-      }
+        }
     }
     return supported ;   
 }
@@ -131,109 +131,109 @@ bool wxDropTarget::GetData()
 {
     if (!m_dataObject)
         return FALSE;
-        
+    
     if ( !CurrentDragHasSupportedFormat() )
         return FALSE ;
-     
+    
     bool transferred = false ;   
     if ( gTrackingGlobals.m_currentSource != NULL )
     {
-      wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
-      
-      if ( data )
-      {
-        size_t formatcount = data->GetFormatCount() ;
-        wxDataFormat *array = new wxDataFormat[ formatcount  ];
-        data->GetAllFormats( array );
-        for (size_t i = 0; !transferred && i < formatcount ; i++)
+        wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
+        
+        if ( data )
         {
-            wxDataFormat format = array[i] ;
-            if ( m_dataObject->IsSupported( format ) ) 
+            size_t formatcount = data->GetFormatCount() ;
+            wxDataFormat *array = new wxDataFormat[ formatcount  ];
+            data->GetAllFormats( array );
+            for (size_t i = 0; !transferred && i < formatcount ; i++)
             {
-              int size = data->GetDataSize( format );
-              transferred = true ;
-
-              if (size == 0) 
-              {
-                m_dataObject->SetData(format , 0 , 0 ) ;
-              }
-              else
-              {
-                char *d = new char[size];
-                data->GetDataHere( format , (void*) d );
-                m_dataObject->SetData( format , size , d ) ;
-                delete[] d ;
-              }
+                wxDataFormat format = array[i] ;
+                if ( m_dataObject->IsSupported( format ) ) 
+                {
+                    int size = data->GetDataSize( format );
+                    transferred = true ;
+                    
+                    if (size == 0) 
+                    {
+                        m_dataObject->SetData(format , 0 , 0 ) ;
+                    }
+                    else
+                    {
+                        char *d = new char[size];
+                        data->GetDataHere( format , (void*) d );
+                        m_dataObject->SetData( format , size , d ) ;
+                        delete[] d ;
+                    }
+                }
             }
-         }
-        delete[] array ;
-      }
+            delete[] array ;
+        }
     }
     if ( !transferred )
     {
-      UInt16 items ;
-      OSErr result;
-      bool firstFileAdded = false ;
-      CountDragItems((DragReference)m_currentDrag, &items);
-      for (UInt16 index = 1; index <= items; ++index) 
-      {
-          ItemReference theItem;
-          FlavorType theType ;
-          UInt16 flavors = 0 ;
-          GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
-          CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
-          for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
-          {
-            result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
-            wxDataFormat format(theType) ;
-            if ( m_dataObject->IsSupportedFormat( format ) )
+        UInt16 items ;
+        OSErr result;
+        bool firstFileAdded = false ;
+        CountDragItems((DragReference)m_currentDrag, &items);
+        for (UInt16 index = 1; index <= items; ++index) 
+        {
+            ItemReference theItem;
+            FlavorType theType ;
+            UInt16 flavors = 0 ;
+            GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
+            CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
+            for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
             {
-              FlavorFlags theFlags;
-              result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
-              if (result == noErr) 
-              {
-                  Size dataSize ;
-                  Ptr theData ;
-                  GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
-                         if ( theType == 'TEXT' )
-                         {
-                               // this increment is only valid for allocating, on the next GetFlavorData
-                               // call it is reset again to the original value
-                           dataSize++ ;
-                         }
-                  theData = new char[dataSize];
-                  GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); 
-                  if( theType == 'TEXT' )
-                  {
-                    theData[dataSize]=0 ;       
-                    if ( wxApp::s_macDefaultEncodingIsPC )
-                    {
-                      wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
-                    }
-                    m_dataObject->SetData( format, dataSize, theData );
-                  }
-                  else if ( theType == kDragFlavorTypeHFS )
-                  {
-                    HFSFlavor* theFile = (HFSFlavor*) theData ;
-                    wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
-                    if (  firstFileAdded )
-                       ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
-                    else
+                result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
+                wxDataFormat format(theType) ;
+                if ( m_dataObject->IsSupportedFormat( format ) )
+                {
+                    FlavorFlags theFlags;
+                    result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
+                    if (result == noErr) 
                     {
-                       ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
-                       firstFileAdded = true ; 
+                        Size dataSize ;
+                        Ptr theData ;
+                        GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
+                        if ( theType == 'TEXT' )
+                        {
+                            // this increment is only valid for allocating, on the next GetFlavorData
+                            // call it is reset again to the original value
+                            dataSize++ ;
+                        }
+                        theData = new char[dataSize];
+                        GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); 
+                        if( theType == 'TEXT' )
+                        {
+                            theData[dataSize]=0 ;       
+                            if ( wxApp::s_macDefaultEncodingIsPC )
+                            {
+                                wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
+                            }
+                            m_dataObject->SetData( format, dataSize, theData );
+                        }
+                        else if ( theType == kDragFlavorTypeHFS )
+                        {
+                            HFSFlavor* theFile = (HFSFlavor*) theData ;
+                            wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
+                            if (  firstFileAdded )
+                                ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
+                            else
+                            {
+                                ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
+                                firstFileAdded = true ;    
+                            }
+                        }
+                        else
+                        {
+                            m_dataObject->SetData( format, dataSize, theData );
+                        }
+                        delete[] theData;
                     }
-                  }
-                  else
-                  {
-                    m_dataObject->SetData( format, dataSize, theData );
-                  }
-                  delete[] theData;
-              }
-              break ;
+                    break ;
+                }
             }
-          }
-      }
+        }
     }
     return TRUE ;   
 }
@@ -273,13 +273,13 @@ wxDropSource::~wxDropSource()
 wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
 {
     wxASSERT_MSG( m_data, wxT("Drop source: no data") );
-
+    
     if (!m_data)
         return (wxDragResult) wxDragNone;
-
+    
     if (m_data->GetFormatCount() == 0)
         return (wxDragResult) wxDragNone;
-
+    
     OSErr result;
     DragReference theDrag;
     RgnHandle dragRegion;
@@ -300,45 +300,45 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
         OSType type = formats[i].GetFormatId() ;
         if ( type == 'TEXT' )
         {
-          dataSize-- ;
-          if ( wxApp::s_macDefaultEncodingIsPC )
-          {
-            wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
-          }
-          AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
+            dataSize-- ;
+            if ( wxApp::s_macDefaultEncodingIsPC )
+            {
+                wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
+            }
+            AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
         }
         else if (type == kDragFlavorTypeHFS )
         {
-          HFSFlavor  theFlavor ;
-               OSErr err = noErr;
-               CInfoPBRec cat;
-          wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
-
-               cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
-               cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
-               cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
-               cat.hFileInfo.ioFDirIndex = 0;
-               err = PBGetCatInfoSync(&cat);
-               if (err == noErr )
-               {
-               theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
-               if (theFlavor.fileSpec.parID == fsRtParID) {
-                       theFlavor.fileCreator = 'MACS';
-                       theFlavor.fileType = 'disk';
-               } else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
-                       theFlavor.fileCreator = 'MACS';
-                       theFlavor.fileType = 'fold';
-               } else {
-                       theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
-                       theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
-               }
-            AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);  
-          }    
+            HFSFlavor  theFlavor ;
+            OSErr err = noErr;
+            CInfoPBRec cat;
+            
+            wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
+            
+            cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
+            cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
+            cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
+            cat.hFileInfo.ioFDirIndex = 0;
+            err = PBGetCatInfoSync(&cat);
+            if (err == noErr )
+            {
+                theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
+                if (theFlavor.fileSpec.parID == fsRtParID) {
+                    theFlavor.fileCreator = 'MACS';
+                    theFlavor.fileType = 'disk';
+                } else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
+                    theFlavor.fileCreator = 'MACS';
+                    theFlavor.fileType = 'fold';
+                } else {
+                    theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
+                    theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
+                }
+                AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);  
+            }    
         }
         else
         {
-          AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);      
+            AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);      
         }
         delete[] dataPtr ;
     }
@@ -349,37 +349,37 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
     
     EventRecord* ev = NULL ;
 #if !TARGET_CARBON // TODO
-       ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
+    ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
 #else
-       EventRecord rec ;
-       ev = &rec ;
-       wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
+    EventRecord rec ;
+    ev = &rec ;
+    wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
 #endif
     const short dragRegionOuterBoundary = 10 ;
     const short dragRegionInnerBoundary = 9 ;
     
     SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary , 
-      ev->where.v  - dragRegionOuterBoundary ,
-      ev->where.h + dragRegionOuterBoundary , 
-      ev->where.v + dragRegionOuterBoundary ) ;
-
+        ev->where.v  - dragRegionOuterBoundary ,
+        ev->where.h + dragRegionOuterBoundary , 
+        ev->where.v + dragRegionOuterBoundary ) ;
+    
     SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary , 
-      ev->where.v  - dragRegionInnerBoundary ,
-      ev->where.h + dragRegionInnerBoundary , 
-      ev->where.v + dragRegionInnerBoundary ) ;
-
+        ev->where.v  - dragRegionInnerBoundary ,
+        ev->where.h + dragRegionInnerBoundary , 
+        ev->where.v + dragRegionInnerBoundary ) ;
+    
     DiffRgn( dragRegion , tempRgn , dragRegion ) ;
     DisposeRgn( tempRgn ) ;    
-      
+    
     // TODO:work with promises in order to return data only when drag
     // was successfully completed
-
+    
     gTrackingGlobals.m_currentSource = this ;
     result = TrackDrag(theDrag, ev , dragRegion);
     DisposeRgn(dragRegion);
     DisposeDrag(theDrag);
     gTrackingGlobals.m_currentSource = NULL ;
-
+    
     return wxDragCopy ;
 }
 
@@ -423,7 +423,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
         case kDragTrackingLeaveHandler:
             break;
         case kDragTrackingEnterWindow:
-           trackingGlobals->m_currentTargetWindow = NULL ;
+            trackingGlobals->m_currentTargetWindow = NULL ;
             trackingGlobals->m_currentTarget = NULL ;
             break;
         case kDragTrackingInWindow:
index 841dc9936a222a456ebc7121ae84d01a62d4a961..b2a2cb240620e8730a5f22707b4e3a944d81cc5c 100644 (file)
@@ -52,160 +52,160 @@ extern bool gUseNavServices ;
 
 struct OpenUserDataRec {
   int           currentfilter ;
-  bool                         saveMode ;
+  bool                saveMode ;
   wxArrayString      name ;
   wxArrayString      extensions ;
-  wxArrayLong          filtermactypes ;
+  wxArrayLong        filtermactypes ;
   NavMenuItemSpecArrayHandle menuitems ;
 };
 
 typedef struct OpenUserDataRec
-       OpenUserDataRec, *OpenUserDataRecPtr;
+    OpenUserDataRec, *OpenUserDataRecPtr;
 
-static pascal void     NavEventProc(
-                                                               NavEventCallbackMessage         inSelector,
-                                                               NavCBRecPtr                                     ioParams,
-                                                               NavCallBackUserData                     ioUserData);
+static pascal void    NavEventProc(
+                                NavEventCallbackMessage        inSelector,
+                                NavCBRecPtr                    ioParams,
+                                NavCallBackUserData            ioUserData);
 
 #if TARGET_CARBON
-               static NavEventUPP      sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
+        static NavEventUPP    sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
 #else
-               static NavEventUPP      sStandardNavEventFilter = NewNavEventProc(NavEventProc);
+        static NavEventUPP    sStandardNavEventFilter = NewNavEventProc(NavEventProc);
 #endif
 
 static pascal void
 NavEventProc(
-       NavEventCallbackMessage         inSelector,
-       NavCBRecPtr                                     ioParams,
-       NavCallBackUserData     ioUserData      )
+    NavEventCallbackMessage        inSelector,
+    NavCBRecPtr                    ioParams,
+    NavCallBackUserData    ioUserData    )
 {
-       OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
-       if (inSelector == kNavCBEvent) {        
+    OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
+    if (inSelector == kNavCBEvent) {    
 #if !TARGET_CARBON
          wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
 #endif
-       
-       else if ( inSelector == kNavCBStart )
-       {
-               if ( data->menuitems )
-                       NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
-       }
-       else if ( inSelector == kNavCBPopupMenuSelect )
-       {
-               NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
-               if ( menu->menuCreator == 'WXNG' )
-               {
-                       data->currentfilter = menu->menuType ;
-                       if ( data->saveMode )
-                       {
-                               int i = menu->menuType ;
-                               wxString extension =  data->extensions[i].AfterLast('.') ;
-                               extension.MakeLower() ;
-                               Str255 filename ;
-                               // get the current filename
-                               NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
-                               CopyPascalStringToC( filename , (char*) filename ) ;
-                               wxString sfilename( filename ) ;
-                               int pos = sfilename.Find('.',TRUE) ;
-                               if ( pos != wxNOT_FOUND )
-                               {
-                                       sfilename = sfilename.Left(pos+1)+extension ;
-                                       CopyCStringToPascal( sfilename.c_str() , filename ) ;
-                                       NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
-                               }
-                       }
-               }
-       }
+    } 
+    else if ( inSelector == kNavCBStart )
+    {
+        if ( data->menuitems )
+            NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
+    }
+    else if ( inSelector == kNavCBPopupMenuSelect )
+    {
+        NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
+        if ( menu->menuCreator == 'WXNG' )
+        {
+            data->currentfilter = menu->menuType ;
+            if ( data->saveMode )
+            {
+                int i = menu->menuType ;
+                wxString extension =  data->extensions[i].AfterLast('.') ;
+                extension.MakeLower() ;
+                Str255 filename ;
+                // get the current filename
+                NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
+                CopyPascalStringToC( filename , (char*) filename ) ;
+                wxString sfilename( filename ) ;
+                int pos = sfilename.Find('.',TRUE) ;
+                if ( pos != wxNOT_FOUND )
+                {
+                    sfilename = sfilename.Left(pos+1)+extension ;
+                    CopyCStringToPascal( sfilename.c_str() , filename ) ;
+                    NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
+                }
+            }
+          }
+    }
 }
 
 const char * gfilters[] =
 {
-       "*.TXT" ,
-       "*.TIF" ,
-       "*.JPG" ,
-       
-       NULL 
+    "*.TXT" ,
+    "*.TIF" ,
+    "*.JPG" ,
+    
+    NULL 
 } ;
 
 OSType gfiltersmac[] =
 {
-       'TEXT' ,
-       'TIFF' ,
-       'JPEG' ,
-       
-       '****'
+    'TEXT' ,
+    'TIFF' ,
+    'JPEG' ,
+    
+    '****'
 } ;
 
 
 
-void MakeUserDataRec(OpenUserDataRec   *myData , const wxString& filter )
+void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
 {
-       myData->menuitems = NULL ;
-       myData->currentfilter = 0 ;
-       myData->saveMode = FALSE ;
-       
-       if ( filter && filter[0] )
-       {
-         wxString filter2(filter) ;
-    int filterIndex = 0;
-    bool isName = true ;
-    wxString current ;
-    for( unsigned int i = 0; i < filter2.Len() ; i++ )
+    myData->menuitems = NULL ;
+    myData->currentfilter = 0 ;
+    myData->saveMode = FALSE ;
+    
+    if ( filter && filter[0] )
     {
-       if( filter2.GetChar(i) == wxT('|') )
-       {
-        if( isName ) {
-          myData->name.Add( current ) ;
-        }
-        else {
-          myData->extensions.Add( current.MakeUpper() ) ;
-          ++filterIndex ;
+        wxString filter2(filter) ;
+        int filterIndex = 0;
+        bool isName = true ;
+        wxString current ;
+        for( unsigned int i = 0; i < filter2.Len() ; i++ )
+        {
+            if( filter2.GetChar(i) == wxT('|') )
+            {
+                if( isName ) {
+                    myData->name.Add( current ) ;
+                }
+                else {
+                    myData->extensions.Add( current.MakeUpper() ) ;
+                    ++filterIndex ;
+                }
+                isName = !isName ;
+                current = "" ;
+            }
+            else
+            {
+                current += filter2.GetChar(i) ;
+            }
         }
-        isName = !isName ;
-         current = "" ;
-       }
-       else
-       {
-        current += filter2.GetChar(i) ;
-       }
-    }
-    // we allow for compatibility reason to have a single filter expression (like *.*) without
-    // an explanatory text, in that case the first part is name and extension at the same time
-      
-    wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
-    if ( current.IsEmpty() )
-        myData->extensions.Add( myData->name[filterIndex] ) ;
-    else
-        myData->extensions.Add( current.MakeUpper() ) ;
-    if ( filterIndex == 0 || isName )
-        myData->name.Add( current.MakeUpper() ) ;
+        // we allow for compatibility reason to have a single filter expression (like *.*) without
+        // an explanatory text, in that case the first part is name and extension at the same time
+        
+        wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
+        if ( current.IsEmpty() )
+            myData->extensions.Add( myData->name[filterIndex] ) ;
+        else
+            myData->extensions.Add( current.MakeUpper() ) ;
+        if ( filterIndex == 0 || isName )
+            myData->name.Add( current.MakeUpper() ) ;
+        
+        ++filterIndex ;
+        
         
-    ++filterIndex ;
-
-
         const size_t extCount = myData->extensions.GetCount();
-               for ( size_t i = 0 ; i < extCount; i++ )
-               {
-                       int j ;
-                       for ( j = 0 ; gfilters[j] ; j++ )
-                       {
-                               if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
-                               {
-                                   myData->filtermactypes.Add( gfiltersmac[j] ) ;
-                                       break ;
-                               }
-                       }
-                       if( gfilters[j] == NULL )
-                       {
-                               myData->filtermactypes.Add( '****' ) ;
-                       }
-               }
-       }
+        for ( size_t i = 0 ; i < extCount; i++ )
+        {
+            int j ;
+            for ( j = 0 ; gfilters[j] ; j++ )
+            {
+                if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
+                {
+                    myData->filtermactypes.Add( gfiltersmac[j] ) ;
+                    break ;
+                }
+            }
+            if( gfilters[j] == NULL )
+            {
+                myData->filtermactypes.Add( '****' ) ;
+            }
+        }
+    }
 }
 
 static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
 {
-    Str255                     filename ;
+    Str255             filename ;
     
 #if TARGET_CARBON
     p2cstrcpy((char *)filename, name) ;
@@ -218,55 +218,55 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
     
     if ( data->extensions.GetCount() > 0 )
     {
-       //for ( int i = 0 ; i < data->numfilters ; ++i )
-           int i = data->currentfilter ;
-           if ( data->extensions[i].Right(2) == ".*" )
-             return true ;
-       
-           {
-             if ( type == (OSType)data->filtermactypes[i] )
-                     return true ;
-           
-             wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
-             while( tokenizer.HasMoreTokens() )
-             {
-               wxString extension = tokenizer.GetNextToken() ;
-             if ( extension.GetChar(0) == '*' )
-                     extension = extension.Mid(1) ;
-           
-             if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
-                     return true ;
-                   }
-           }
-           return false ;
+        //for ( int i = 0 ; i < data->numfilters ; ++i )
+        int i = data->currentfilter ;
+        if ( data->extensions[i].Right(2) == ".*" )
+            return true ;
+        
+        {
+            if ( type == (OSType)data->filtermactypes[i] )
+                return true ;
+            
+            wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
+            while( tokenizer.HasMoreTokens() )
+            {
+                wxString extension = tokenizer.GetNextToken() ;
+                if ( extension.GetChar(0) == '*' )
+                    extension = extension.Mid(1) ;
+                
+                if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
+                    return true ;
+            }
+        }
+        return false ;
     }
     return true ;
 }
 
 #ifndef __DARWIN__
 static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
-{      
-       OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
-       // return true if this item is invisible or a file
-
-       Boolean visibleFlag;
-       Boolean folderFlag;
-       
-       visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
-       folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
-       
-       // because the semantics of the filter proc are "true means don't show
-       // it" we need to invert the result that we return
-       
-       if ( !visibleFlag )
-               return true ;
-               
-       if ( !folderFlag )
-       {
-               return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
-       }       
-               
-       return false ;
+{    
+    OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
+    // return true if this item is invisible or a file
+
+    Boolean visibleFlag;
+    Boolean folderFlag;
+    
+    visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
+    folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
+    
+    // because the semantics of the filter proc are "true means don't show
+    // it" we need to invert the result that we return
+    
+    if ( !visibleFlag )
+        return true ;
+        
+    if ( !folderFlag )
+    {
+        return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
+    }    
+        
+    return false ;
 }
 #endif
 
@@ -335,7 +335,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
         long style, const wxPoint& pos)
 {
-       wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
@@ -362,7 +362,7 @@ pascal Boolean CrossPlatformFilterCallback (
         NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
         if (theItem->descriptorType == typeFSS && !theInfo->isFolder)
         {
-            FSSpec     spec;
+            FSSpec    spec;
             memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
             display = CheckFile( spec.name , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
         }
@@ -373,58 +373,58 @@ pascal Boolean CrossPlatformFilterCallback (
 
 int wxFileDialog::ShowModal()
 {
-    NavDialogOptions          mNavOptions;
-    NavObjectFilterUPP        mNavFilterUPP = NULL;
-    NavPreviewUPP             mNavPreviewUPP = NULL ;
-    NavReplyRecord            mNavReply;
-    AEDesc                    mDefaultLocation ;
-    bool                      mSelectDefault = false ;
-               
-       // zero all data
-       
-       m_path = wxEmptyString ;
-       m_fileName = wxEmptyString ;
-       m_paths.Empty();
-       m_fileNames.Empty();
-
-       // setup dialog
-               
+    NavDialogOptions           mNavOptions;
+    NavObjectFilterUPP           mNavFilterUPP = NULL;
+    NavPreviewUPP           mNavPreviewUPP = NULL ;
+    NavReplyRecord           mNavReply;
+    AEDesc               mDefaultLocation ;
+    bool               mSelectDefault = false ;
+        
+    // zero all data
+    
+    m_path = wxEmptyString ;
+    m_fileName = wxEmptyString ;
+    m_paths.Empty();
+    m_fileNames.Empty();
+
+    // setup dialog
+        
     ::NavGetDefaultDialogOptions(&mNavOptions);
-       
-    mNavFilterUPP      = nil;
-    mNavPreviewUPP     = nil;
-    mSelectDefault     = false;
+    
+    mNavFilterUPP    = nil;
+    mNavPreviewUPP    = nil;
+    mSelectDefault    = false;
     mNavReply.validRecord              = false;
-    mNavReply.replacing                       = false;
+    mNavReply.replacing                   = false;
     mNavReply.isStationery             = false;
-    mNavReply.translationNeeded               = false;
+    mNavReply.translationNeeded           = false;
     mNavReply.selection.descriptorType = typeNull;
     mNavReply.selection.dataHandle     = nil;
-    mNavReply.keyScript                       = smSystemScript;
+    mNavReply.keyScript                   = smSystemScript;
     mNavReply.fileTranslation          = nil;
-               
+        
     // Set default location, the location
     //   that's displayed when the dialog
     //   first appears
-               
+        
     FSSpec location ;
     wxMacFilename2FSSpec( m_dir , &location ) ;
     OSErr err = noErr ;
-               
+        
     mDefaultLocation.descriptorType = typeNull;
     mDefaultLocation.dataHandle     = nil;
 
     err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
 
     if ( mDefaultLocation.dataHandle ) {
-                       
+            
         if (mSelectDefault) {
             mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
         } else {
             mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
         }
     }
-               
+        
 #if TARGET_CARBON
     c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
 #else
@@ -438,7 +438,7 @@ int wxFileDialog::ShowModal()
     c2pstr((char *)mNavOptions.savedFileName ) ;
 #endif
 
-    OpenUserDataRec                    myData;
+    OpenUserDataRec            myData;
     MakeUserDataRec( &myData , m_wildCard ) ;
     myData.currentfilter = m_filterIndex ;
     if ( myData.extensions.GetCount() > 0 )
@@ -464,7 +464,7 @@ int wxFileDialog::ShowModal()
 
         mNavOptions.dialogOptionFlags |= kNavDontAutoTranslate ;
         mNavOptions.dialogOptionFlags |= kNavDontAddTranslateItems ;
-                       
+            
         err = ::NavPutFile(
                            &mDefaultLocation,
                            &mNavReply,
@@ -472,7 +472,7 @@ int wxFileDialog::ShowModal()
                            sStandardNavEventFilter ,
                            NULL,
                            kNavGenericSignature,
-                           &myData);                                   // User Data
+                           &myData);                    // User Data
         m_filterIndex = myData.currentfilter ;
     }
     else
@@ -484,7 +484,7 @@ int wxFileDialog::ShowModal()
             mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
         else
             mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
-                       
+            
         err = ::NavGetFile(
                            &mDefaultLocation,
                            &mNavReply,
@@ -496,23 +496,23 @@ int wxFileDialog::ShowModal()
                            &myData);
         m_filterIndex = myData.currentfilter ;
     }
-               
+        
     DisposeNavObjectFilterUPP(mNavFilterUPP);
     if ( mDefaultLocation.dataHandle != nil )
     {
         ::AEDisposeDesc(&mDefaultLocation);
     }
-               
+        
     if ( (err != noErr) && (err != userCanceledErr) ) {
         return wxID_CANCEL ;
     }
 
     if (mNavReply.validRecord) {
-               
+        
         FSSpec  outFileSpec ;
         AEDesc specDesc ;
         AEKeyword keyWord ;
-                       
+            
         long count ;
         ::AECountItems( &mNavReply.selection , &count ) ;
         for ( long i = 1 ; i <= count ; ++i )
@@ -521,7 +521,7 @@ int wxFileDialog::ShowModal()
             if ( err != noErr ) {
                 m_path = "" ;
                 return wxID_CANCEL ;
-            }                  
+            }            
             outFileSpec = **(FSSpec**) specDesc.dataHandle;
             if (specDesc.dataHandle != nil) {
                 ::AEDisposeDesc(&specDesc);
@@ -566,7 +566,7 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
 wxString
 wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
 {
-  return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
+    return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
 }
 
 
@@ -574,7 +574,7 @@ wxLoadFileSelector(const char *what, const char *extension, const char *default_
 wxString
 wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
 {
-  return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
+    return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
 }
 
 
index 1c6b6518bbf24be2bc8cd249696c0f1c84ba77bb..e134003482a5b61f689b823db36d2135eeedd0a2 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -67,66 +67,66 @@ wxFontRefData::~wxFontRefData()
 
 void wxFontRefData::MacFindFont()
 {
-       if( m_faceName == "" )
-       {
-               switch( m_family )
-               {
-                       case wxDEFAULT :
-                               m_macFontNum = ::GetAppFont() ;
-                               break ;
-                       case wxDECORATIVE :
-                               ::GetFNum( "\pTimes" , &m_macFontNum) ;
-                               break ;
-                       case wxROMAN :
-                               ::GetFNum( "\pTimes" , &m_macFontNum) ;
-                               break ;
-                       case wxSCRIPT :
-                               ::GetFNum( "\pTimes" , &m_macFontNum) ;
-                               break ;
-                       case wxSWISS :
-                               ::GetFNum( "\pGeneva" , &m_macFontNum) ;
-                               break ;
-                       case wxMODERN :
-                               ::GetFNum( "\pMonaco" , &m_macFontNum) ;
-                               break ;
-               }
-               Str255 name ;
-               GetFontName( m_macFontNum , name ) ;
-               CopyPascalStringToC( name , (char*) name ) ;
-               m_faceName = (char*) name ;
-       }
-       else
-       {
-               if ( m_faceName == "systemfont" )
-                       m_macFontNum = ::GetSysFont() ;
-               else if ( m_faceName == "applicationfont" )
-                       m_macFontNum = ::GetAppFont() ;
-               else
-               {
-                       Str255 fontname ;
-                       wxMacStringToPascal( m_faceName , fontname ) ;
-                       ::GetFNum( fontname, &m_macFontNum);
-               }
-       }
-
-       m_macFontStyle = 0;
-       if (m_weight == wxBOLD)
-                m_macFontStyle |= bold;
-       if (m_style == wxITALIC || m_style == wxSLANT) 
-               m_macFontStyle |= italic;
-       if (m_underlined) 
-               m_macFontStyle |= underline;
-       m_macFontSize = m_pointSize ;
-       
-       //TODO:if we supply the style as an additional parameter we must make a testing
-       //sequence in order to degrade gracefully while trying to maintain most of the style
-       //information, meanwhile we just take the normal font and apply the features after
-       OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID); 
+    if( m_faceName == "" )
+    {
+        switch( m_family )
+        {
+            case wxDEFAULT :
+                m_macFontNum = ::GetAppFont() ;
+                break ;
+            case wxDECORATIVE :
+                ::GetFNum( "\pTimes" , &m_macFontNum) ;
+                break ;
+            case wxROMAN :
+                ::GetFNum( "\pTimes" , &m_macFontNum) ;
+                break ;
+            case wxSCRIPT :
+                ::GetFNum( "\pTimes" , &m_macFontNum) ;
+                break ;
+            case wxSWISS :
+                ::GetFNum( "\pGeneva" , &m_macFontNum) ;
+                break ;
+            case wxMODERN :
+                ::GetFNum( "\pMonaco" , &m_macFontNum) ;
+                break ;
+        }
+        Str255 name ;
+        GetFontName( m_macFontNum , name ) ;
+        CopyPascalStringToC( name , (char*) name ) ;
+        m_faceName = (char*) name ;
+    }
+    else
+    {
+        if ( m_faceName == "systemfont" )
+            m_macFontNum = ::GetSysFont() ;
+        else if ( m_faceName == "applicationfont" )
+            m_macFontNum = ::GetAppFont() ;
+        else
+        {
+            Str255 fontname ;
+            wxMacStringToPascal( m_faceName , fontname ) ;
+            ::GetFNum( fontname, &m_macFontNum);
+        }
+    }
+
+    m_macFontStyle = 0;
+    if (m_weight == wxBOLD)
+         m_macFontStyle |= bold;
+    if (m_style == wxITALIC || m_style == wxSLANT) 
+        m_macFontStyle |= italic;
+    if (m_underlined) 
+        m_macFontStyle |= underline;
+    m_macFontSize = m_pointSize ;
+    
+    //TODO:if we supply the style as an additional parameter we must make a testing
+    //sequence in order to degrade gracefully while trying to maintain most of the style
+    //information, meanwhile we just take the normal font and apply the features after
+    OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID); 
     /*
     status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
-        kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage  ,  (UInt32*)&m_macATSUFontID ) ;
+        kFontFullName,    kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage  ,  (UInt32*)&m_macATSUFontID ) ;
     */
-       wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
+    wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
 }
 
 // ----------------------------------------------------------------------------
@@ -173,7 +173,7 @@ wxFont::~wxFont()
 
 bool wxFont::RealizeResource()
 {
-       M_FONTDATA->MacFindFont() ;
+    M_FONTDATA->MacFindFont() ;
     return TRUE;
 }
 
@@ -188,17 +188,17 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
 
 void wxFont::Unshare()
 {
-       // Don't change shared data
-       if (!m_refData)
+    // Don't change shared data
+    if (!m_refData)
     {
-               m_refData = new wxFontRefData();
-       }
+        m_refData = new wxFontRefData();
+    }
     else
     {
-               wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
-               UnRef();
-               m_refData = ref;
-       }
+        wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
+        UnRef();
+        m_refData = ref;
+    }
 }
 
 void wxFont::SetPointSize(int pointSize)
index 5924ed4a9eac0802891a3675914bdbbb203d47d7..03c894c553ad13863823f1d986cb9ec31abe7957 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index 4a91e5703f1bee306fd2166efeb7f78a3bdb2df1..5e9987348e33f3f5c06115e5ef5d2b2903622ea4 100644 (file)
@@ -103,46 +103,46 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
 
 void wxFontEnumeratorHelper::DoEnumerate()
 {
-       MenuHandle      menu ;
-       Str255          p_name ;
-
-       short           lines ;
-       
-       menu = NewMenu( 32000 , "\pFont" )  ;
-       AppendResMenu( menu , 'FONT' ) ;
-       lines = CountMenuItems( menu ) ;
-
-       for ( int i = 1 ; i < lines+1  ; i ++ )
-       {
-           GetMenuItemText( menu , i , p_name ) ;
-           wxString c_name = wxMacMakeStringFromPascal(p_name) ;
-
-           /*
-             
-             if ( m_fixedOnly )
-           {
-               // check that it's a fixed pitch font (there is *no* error here, the
-               // flag name is misleading!)
-               if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
-               {
-                   // not a fixed pitch font
-                   return TRUE;
-               }
-           }
-       
-           if ( m_charset != -1 )
-           {
-               // check that we have the right encoding
-               if ( lf->lfCharSet != m_charset )
-               {
-                   return TRUE;
-               }
-           }
-       
-               */
-               m_fontEnum->OnFacename( c_name ) ;
-       }
-       DisposeMenu( menu ) ;
+    MenuHandle    menu ;
+    Str255        p_name ;
+
+    short         lines ;
+    
+    menu = NewMenu( 32000 , "\pFont" )  ;
+    AppendResMenu( menu , 'FONT' ) ;
+    lines = CountMenuItems( menu ) ;
+
+    for ( int i = 1 ; i < lines+1  ; i ++ )
+    {
+        GetMenuItemText( menu , i , p_name ) ;
+        wxString c_name = wxMacMakeStringFromPascal(p_name) ;
+
+        /*
+          
+          if ( m_fixedOnly )
+        {
+            // check that it's a fixed pitch font (there is *no* error here, the
+            // flag name is misleading!)
+            if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
+            {
+                // not a fixed pitch font
+                return TRUE;
+            }
+        }
+    
+        if ( m_charset != -1 )
+        {
+            // check that we have the right encoding
+            if ( lf->lfCharSet != m_charset )
+            {
+                return TRUE;
+            }
+        }
+    
+        */
+        m_fontEnum->OnFacename( c_name ) ;
+    }
+    DisposeMenu( menu ) ;
 }
 
 // ----------------------------------------------------------------------------
index f8347b5ddd86e64d02387204544cd7d8ad56b43e..e3824f30bba9cabc8f7f96a432eca64eb7bd7d3f 100644 (file)
@@ -53,16 +53,16 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
 
 void wxFrame::Init()
 {
-  m_frameMenuBar = NULL;
-
+    m_frameMenuBar = NULL;
+    
 #if wxUSE_TOOLBAR
-  m_frameToolBar = NULL ;
+    m_frameToolBar = NULL ;
 #endif
-  m_frameStatusBar = NULL;
-  m_winLastFocused = NULL ;
-
+    m_frameStatusBar = NULL;
+    m_winLastFocused = NULL ;
+    
     m_iconized = FALSE;
-
+    
 #if wxUSE_TOOLTIPS
     m_hwndToolTip = 0;
 #endif
@@ -70,7 +70,7 @@ void wxFrame::Init()
 
 wxPoint wxFrame::GetClientAreaOrigin() const
 {
-       // on mac we are at position -1,-1 with the control
+    // on mac we are at position -1,-1 with the control
     wxPoint pt(0, 0);
 
 #if wxUSE_TOOLBAR
@@ -101,27 +101,26 @@ bool wxFrame::Create(wxWindow *parent,
            long style,
            const wxString& name)
 {
-  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
-
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
+    
     if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
         return FALSE;
-
-  MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
-  
-       m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
-       SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-
-  wxModelessWindows.Append(this);
-
-  return TRUE;
+    
+    MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+    
+    m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
+    SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
+    
+    wxModelessWindows.Append(this);
+    
+    return TRUE;
 }
 
 wxFrame::~wxFrame()
 {
-  m_isBeingDeleted = TRUE;
-
-  DeleteAllBars();
-
+    m_isBeingDeleted = TRUE;
+    
+    DeleteAllBars();
 }
 
 
@@ -130,14 +129,14 @@ bool wxFrame::Enable(bool enable)
     if ( !wxWindow::Enable(enable) )
         return FALSE;
 
-       if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
-       {
-               int iMaxMenu = m_frameMenuBar->GetMenuCount(); 
-               for ( int i = 0 ; i < iMaxMenu ; ++ i )
-               {
-                       m_frameMenuBar->EnableTop( i , enable ) ;
-               }
-       }
+    if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
+    {
+         int iMaxMenu = m_frameMenuBar->GetMenuCount(); 
+        for ( int i = 0 ; i < iMaxMenu ; ++ i )
+        {
+            m_frameMenuBar->EnableTop( i , enable ) ;
+        }
+    }
 
     return TRUE;
 }
@@ -149,24 +148,24 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
 
     statusBar = new wxStatusBar(this, id,
         style, name);
-       statusBar->SetSize( 100 , 15 ) ;
+    statusBar->SetSize( 100 , 15 ) ;
     statusBar->SetFieldsCount(number);
     return statusBar;
 }
 
 void wxFrame::PositionStatusBar()
 {
-  if (m_frameStatusBar )
-  {
-    int w, h;
-    GetClientSize(&w, &h);
-    int sw, sh;
-    m_frameStatusBar->GetSize(&sw, &sh);
-
-    // Since we wish the status bar to be directly under the client area,
-    // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
-    m_frameStatusBar->SetSize(0, h, w, sh);
-   }
+    if (m_frameStatusBar )
+    {
+        int w, h;
+        GetClientSize(&w, &h);
+        int sw, sh;
+        m_frameStatusBar->GetSize(&sw, &sh);
+        
+        // Since we wish the status bar to be directly under the client area,
+        // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
+        m_frameStatusBar->SetSize(0, h, w, sh);
+    }
 }
 
 // Responds to colour changes, and passes event on to children.
@@ -215,8 +214,8 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 
         event.Skip();
     }
-       else
-       {
+    else
+    {
         // restore focus to the child which was last focused
         wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
                                             : NULL;
@@ -225,19 +224,19 @@ void wxFrame::OnActivate(wxActivateEvent& event)
             parent = this;
         }
 
-       wxSetFocusToChild(parent, &m_winLastFocused);
+        wxSetFocusToChild(parent, &m_winLastFocused);
 
-           if ( m_frameMenuBar != NULL )
-           {
-               m_frameMenuBar->MacInstallMenuBar() ;
-           }
-           else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
+        if ( m_frameMenuBar != NULL )
+        {
+            m_frameMenuBar->MacInstallMenuBar() ;
+        }
+        else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
         {
             // Trying toplevel frame menbar
             if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
-                   ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
-           }
-       }
+                ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
+         }
+    }
 }
 
 void wxFrame::DetachMenuBar()
@@ -262,40 +261,40 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
 
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
-       wxWindow::DoGetClientSize( x , y ) ;
-
+    wxWindow::DoGetClientSize( x , y ) ;
+    
 #if wxUSE_STATUSBAR
-  if ( GetStatusBar() && y )
-  {
-    int statusX, statusY;
-    GetStatusBar()->GetClientSize(&statusX, &statusY);
-    *y -= statusY;
-  }
+    if ( GetStatusBar() && y )
+    {
+        int statusX, statusY;
+        GetStatusBar()->GetClientSize(&statusX, &statusY);
+        *y -= statusY;
+    }
 #endif // wxUSE_STATUSBAR
-
-  wxPoint pt(GetClientAreaOrigin());
-  if ( y )
-    *y -= pt.y;
-  if ( x ) 
-    *x -= pt.x;
+    
+    wxPoint pt(GetClientAreaOrigin());
+    if ( y )
+        *y -= pt.y;
+    if ( x ) 
+        *x -= pt.x;
 }
 
 void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
 {
-       int currentclientwidth , currentclientheight ;
-       int currentwidth , currentheight ;
-       
-       GetClientSize( &currentclientwidth , &currentclientheight ) ;
-       GetSize( &currentwidth , &currentheight ) ;
-       
-       // find the current client size
+    int currentclientwidth , currentclientheight ;
+    int currentwidth , currentheight ;
+    
+    GetClientSize( &currentclientwidth , &currentclientheight ) ;
+    GetSize( &currentwidth , &currentheight ) ;
+    
+    // find the current client size
 
   // Find the difference between the entire window (title bar and all)
   // and the client area; add this to the new client size to move the
   // window
 
-       DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
-               currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
+    DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
+        currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
 }
 
 
@@ -314,8 +313,8 @@ void wxFrame::PositionToolBar()
 {
     int cw, ch;
 
-       cw = m_width ;
-       ch = m_height ;
+    cw = m_width ;
+    ch = m_height ;
 
     if ( GetStatusBar() )
     {
index 4757f6ca43ecd462d84023acded9bc88e6767386..1a61e4f72378546570d84cdc7b25db76bba3a708 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -29,25 +29,25 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
-       wxSize size = s ;
-       Rect bounds ;
-       Str255 title ;
-       m_rangeMax = range ;
-       m_gaugePos = 0 ;
-       
-       if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
-       {
-               size = wxSize( 200 , 16 ) ;
-       }
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range, 
-               kControlProgressBarProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
-
-  return TRUE;
+    wxSize size = s ;
+    Rect bounds ;
+    Str255 title ;
+    m_rangeMax = range ;
+    m_gaugePos = 0 ;
+    
+    if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
+    {
+        size = wxSize( 200 , 16 ) ;
+    }
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range, 
+        kControlProgressBarProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    
+    return TRUE;
 }
 
 void wxGauge::SetShadowWidth(int w)
@@ -67,7 +67,7 @@ void wxGauge::SetRange(int r)
 void wxGauge::SetValue(int pos)
 {
     m_gaugePos = pos;
-       ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
+       ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
 }
 
 int wxGauge::GetShadowWidth() const
index 76bc6a264ea7fb6cc25d338c382f19371339adc7..528c5a7efe4467940b2f65a72bdbcec3b76aa440 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index 027bc28a8aada4d0842fbc16d26b26e9062182c6..345fc2aeaf3a6ae42169cb09488275a277fcd203 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #include "wx/mac/uma.h"
 
 /*
- * GLContext implementation
- */
+* GLContext implementation
+*/
 
 wxGLContext::wxGLContext(
-               AGLPixelFormat fmt, wxGLCanvas *win,
-               const wxPalette& palette,
-               const wxGLContext *other        /* for sharing display lists */
-)
+                         AGLPixelFormat fmt, wxGLCanvas *win,
+                         const wxPalette& palette,
+                         const wxGLContext *other        /* for sharing display lists */
+                         )
 {
     m_window = win;
-
+    
     m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetRootWindow()));
-
+    
     m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL);
     wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
-
-       GLboolean b;
+    
+    GLboolean b;
     b = aglSetDrawable(m_glContext, m_drawable);
     wxCHECK_RET( b, wxT("Couldn't bind OpenGl context") );
-       aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
+    aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
     b = aglSetCurrentContext(m_glContext);
     wxCHECK_RET( b, wxT("Couldn't activate OpenGl context") );
 }
 
 wxGLContext::~wxGLContext()
 {
-  if (m_glContext)
-  {
-    aglSetCurrentContext(NULL);
-       aglDestroyContext(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglSetCurrentContext(NULL);
+        aglDestroyContext(m_glContext);
+    }
 }
 
 void wxGLContext::SwapBuffers()
 {
-  if (m_glContext)
-  {
-    aglSwapBuffers(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglSwapBuffers(m_glContext);
+    }
 }
 
 void wxGLContext::SetCurrent()
 {
-  if (m_glContext)
-  {
-    aglSetCurrentContext(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglSetCurrentContext(m_glContext);
+    }
 }
 
 void wxGLContext::Update()
 {
-  if (m_glContext)
-  {
-    aglUpdateContext(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglUpdateContext(m_glContext);
+    }
 }
 
 void wxGLContext::SetColour(const char *colour)
 {
-  float r = 0.0;
-  float g = 0.0;
-  float b = 0.0;
-  wxColour *col = wxTheColourDatabase->FindColour(colour);
-  if (col)
-  {
-    r = (float)(col->Red()/256.0);
-    g = (float)(col->Green()/256.0);
-    b = (float)(col->Blue()/256.0);
-    glColor3f( r, g, b);
-  }
+    float r = 0.0;
+    float g = 0.0;
+    float b = 0.0;
+    wxColour *col = wxTheColourDatabase->FindColour(colour);
+    if (col)
+    {
+        r = (float)(col->Red()/256.0);
+        g = (float)(col->Green()/256.0);
+        b = (float)(col->Blue()/256.0);
+        glColor3f( r, g, b);
+    }
 }
 
 
 /*
- * wxGLCanvas implementation
- */
+* wxGLCanvas implementation
+*/
 
 IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
 
@@ -118,23 +118,23 @@ BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
 END_EVENT_TABLE()
 
 wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
-    const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-    int *attribList, const wxPalette& palette)
+                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                       int *attribList, const wxPalette& palette)
 {
     Create(parent, NULL, id, pos, size, style, name, attribList, palette);
 }
 
 wxGLCanvas::wxGLCanvas( wxWindow *parent,
-              const wxGLContext *shared, wxWindowID id,
-              const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-              int *attribList, const wxPalette& palette )
+                       const wxGLContext *shared, wxWindowID id,
+                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                       int *attribList, const wxPalette& palette )
 {
     Create(parent, shared, id, pos, size, style, name, attribList, palette);
 }
 
 wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
-                        const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-                        int *attribList, const wxPalette& palette )
+                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                       int *attribList, const wxPalette& palette )
 {
     Create(parent, shared ? shared->GetContext() : NULL, id, pos, size, style, name, attribList, palette);
 }
@@ -151,80 +151,80 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
 {
     GLint data[512];
     GLint defaultAttribs[] = { AGL_RGBA, 
-                    AGL_DOUBLEBUFFER, 
-                    AGL_MINIMUM_POLICY, 
-                    AGL_DEPTH_SIZE, 1,  // use largest available depth buffer
-                    AGL_RED_SIZE, 1, 
-                    AGL_GREEN_SIZE, 1, 
-                    AGL_BLUE_SIZE, 1, 
-                    AGL_ALPHA_SIZE, 0, 
-                    AGL_NONE };
+        AGL_DOUBLEBUFFER, 
+        AGL_MINIMUM_POLICY, 
+        AGL_DEPTH_SIZE, 1,  // use largest available depth buffer
+        AGL_RED_SIZE, 1, 
+        AGL_GREEN_SIZE, 1, 
+        AGL_BLUE_SIZE, 1, 
+        AGL_ALPHA_SIZE, 0, 
+        AGL_NONE };
     GLint *attribs;
     if (!attribList)
     {
-         attribs = defaultAttribs;
+        attribs = defaultAttribs;
     }
     else
     {
-      int arg=0, p=0;
-
-      data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
-      while( (attribList[arg]!=0) && (p<512) )
-      {
-        switch( attribList[arg++] )
+        int arg=0, p=0;
+        
+        data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
+        while( (attribList[arg]!=0) && (p<512) )
         {
-          case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
-          case WX_GL_BUFFER_SIZE:
-            data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_LEVEL:
-            data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
-          case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
-          case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
-          case WX_GL_AUX_BUFFERS:
-            data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_RED:
-            data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_GREEN:
-            data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_BLUE:
-            data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ALPHA:
-            data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_DEPTH_SIZE: 
-            data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_STENCIL_SIZE: 
-            data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_RED:
-            data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_GREEN:
-            data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_BLUE:
-            data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_ALPHA:
-            data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
-          default:
-            break;
-        }
-      }       
-      data[p] = 0; 
-
-      attribs = data;
+            switch( attribList[arg++] )
+            {
+            case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
+            case WX_GL_BUFFER_SIZE:
+                data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_LEVEL:
+                data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
+            case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
+            case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
+            case WX_GL_AUX_BUFFERS:
+                data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_RED:
+                data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_GREEN:
+                data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_BLUE:
+                data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ALPHA:
+                data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_DEPTH_SIZE: 
+                data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_STENCIL_SIZE: 
+                data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_RED:
+                data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_GREEN:
+                data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_BLUE:
+                data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_ALPHA:
+                data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
+            default:
+                break;
+            }
+        }       
+        data[p] = 0; 
+        
+        attribs = data;
     }
     
     return aglChoosePixelFormat(NULL, 0, attribs);
 }
 
 bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
-                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-                       int *attribList, const wxPalette& palette)
+                        const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                        int *attribList, const wxPalette& palette)
 {
     wxWindow::Create( parent, id, pos, size, style, name );
-
+    
     AGLPixelFormat fmt = ChoosePixelFormat(attribList);
     wxCHECK_MSG( fmt, false, wxT("Couldn't create OpenGl pixel format") );
-
+    
     m_glContext = new wxGLContext(fmt, this, palette, shared);
-
+    
     aglDestroyPixelFormat(fmt);
     
     return true;
@@ -232,20 +232,20 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID
 
 void wxGLCanvas::SwapBuffers()
 {
-  if (m_glContext)
-    m_glContext->SwapBuffers();
+    if (m_glContext)
+        m_glContext->SwapBuffers();
 }
 
 void wxGLCanvas::UpdateContext()
 {
-  if (m_glContext)
-    m_glContext->Update();
+    if (m_glContext)
+        m_glContext->Update();
 }
 
 void wxGLCanvas::SetViewport()
 {
-  // viewport is initially set to entire port
-  // adjust glViewport to just this window
+    // viewport is initially set to entire port
+    // adjust glViewport to just this window
     int x = 0 ;
     int y = 0 ;
     
@@ -259,49 +259,49 @@ void wxGLCanvas::SetViewport()
     parms[1] = bounds.bottom - bounds.top - ( y + height ) ;
     parms[2] = width ;
     parms[3] = height ;
-  
-       aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
+    
+       aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
 }
 
 void wxGLCanvas::OnSize(wxSizeEvent& event)
 {
-  MacUpdateView() ;
+    MacUpdateView() ;
 }
 
 void wxGLCanvas::MacUpdateView()
 {
-  if (m_glContext)
-  {
-    UpdateContext();
-    m_glContext->SetCurrent();
-    SetViewport();
-  }
+    if (m_glContext)
+    {
+        UpdateContext();
+        m_glContext->SetCurrent();
+        SetViewport();
+    }
 }
 
 void wxGLCanvas::MacSuperChangedPosition()
 {
-  MacUpdateView() ;
-  wxWindow::MacSuperChangedPosition() ;
+    MacUpdateView() ;
+    wxWindow::MacSuperChangedPosition() ;
 }
 
 void wxGLCanvas::MacTopLevelWindowChangedPosition()
 {
-  MacUpdateView() ;
-  wxWindow::MacTopLevelWindowChangedPosition() ;
+    MacUpdateView() ;
+    wxWindow::MacTopLevelWindowChangedPosition() ;
 }
 
 void wxGLCanvas::SetCurrent()
 {
-  if (m_glContext)
-  {
-    m_glContext->SetCurrent();
-  }
+    if (m_glContext)
+    {
+        m_glContext->SetCurrent();
+    }
 }
 
 void wxGLCanvas::SetColour(const char *colour)
 {
-  if (m_glContext)
-    m_glContext->SetColour(colour);
+    if (m_glContext)
+        m_glContext->SetColour(colour);
 }
 
 
index 8428f4fa7b40a9ab95f7e25cf0f24bdb914e5944..f41727e61b661f78ece72e15c30a1fd960361ace 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -47,7 +47,7 @@ bool wxXXXXHelpController::LoadFile(const wxString& file)
 bool wxXXXXHelpController::DisplayContents()
 {
     // TODO
-       return FALSE;
+    return FALSE;
 }
 
 bool wxXXXXHelpController::DisplaySection(int section)
index df10cf7b459cb77c32371a96af5fc16c7f61fcdc..ef4526a6705916e0a4a04c720f8287c3701a074f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -59,16 +59,16 @@ wxIcon::~wxIcon()
 bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
     int desiredWidth, int desiredHeight)
 {
-  UnRef();
-
-  m_refData = new wxBitmapRefData;
-
-  wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
-
-  if ( handler )
-       return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
-  else
-       return FALSE;
+    UnRef();
+    
+    m_refData = new wxBitmapRefData;
+    
+    wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
+    
+    if ( handler )
+        return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
+    else
+        return FALSE;
 }
 
 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
@@ -80,9 +80,9 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
 IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
 
 bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
-          int desiredWidth, int desiredHeight)
+                                      int desiredWidth, int desiredHeight)
 {
-       short theId = -1 ;
+    short theId = -1 ;
     if ( name == "wxICON_INFORMATION" )
     {
         theId = kNoteIcon ;
@@ -93,46 +93,46 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
     }
     else if ( name == "wxICON_WARNING" )
     {
-         theId = kCautionIcon ;
-   }
+        theId = kCautionIcon ;
+    }
     else if ( name == "wxICON_ERROR" )
     {
         theId = kStopIcon ;
     }
     else
     {
-       Str255 theName ;
-       OSType theType ;
-
-    #if TARGET_CARBON
-       c2pstrcpy( (StringPtr) theName , name ) ;
-    #else
-       strcpy( (char *) theName , name ) ;
-       c2pstr( (char *) theName ) ;
-    #endif
-       
-       Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
-       if ( resHandle != 0L )
-       {
-               GetResInfo( resHandle , &theId , &theType , theName ) ;
-               ReleaseResource( resHandle ) ;
-       }
+        Str255 theName ;
+        OSType theType ;
+        
+#if TARGET_CARBON
+        c2pstrcpy( (StringPtr) theName , name ) ;
+#else
+        strcpy( (char *) theName , name ) ;
+        c2pstr( (char *) theName ) ;
+#endif
+        
+        Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
+        if ( resHandle != 0L )
+        {
+            GetResInfo( resHandle , &theId , &theType , theName ) ;
+            ReleaseResource( resHandle ) ;
+        }
+    }
+    if ( theId != -1 )
+    {
+        CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
+        if ( theIcon )
+        {
+            M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
+            M_BITMAPHANDLERDATA->m_width =  32 ;
+            M_BITMAPHANDLERDATA->m_height = 32 ;
+            
+            M_BITMAPHANDLERDATA->m_depth = 8 ;
+            M_BITMAPHANDLERDATA->m_ok = true ;
+            M_BITMAPHANDLERDATA->m_numColors = 256 ;
+            M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
+            return TRUE ;
+        }
     }
-       if ( theId != -1 )
-       {
-               CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
-               if ( theIcon )
-               {
-                       M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
-                       M_BITMAPHANDLERDATA->m_width =  32 ;
-                       M_BITMAPHANDLERDATA->m_height = 32 ;
-                       
-                       M_BITMAPHANDLERDATA->m_depth = 8 ;
-                       M_BITMAPHANDLERDATA->m_ok = true ;
-                       M_BITMAPHANDLERDATA->m_numColors = 256 ;
-                       M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
-                       return TRUE ;
-               }
-       }
-       return FALSE ;
+    return FALSE ;
 }
index 5a39ba118be58a1b68276499a04eed5b14e5d7a1..6a45f419fdc0a85c422b9a1e68fda81f0f7bdeff 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -282,5 +282,5 @@ bool wxJoystick::ReleaseCapture()
 }
 
 #endif
-       // wxUSE_JOYSTICK
+    // wxUSE_JOYSTICK
 
index 67704b9660bc8b4f049090dffd7212543a25c637..2d7dff4fbcea8bdc3ad2b4f73c6e89a2ab90bd6f 100644 (file)
 #include "wx/utils.h"
 
 #if !USE_SHARED_LIBRARY
-  IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
-       EVT_SIZE( wxListBox::OnSize )
-       EVT_CHAR( wxListBox::OnChar )
+    EVT_SIZE( wxListBox::OnSize )
+    EVT_CHAR( wxListBox::OnChar )
 END_EVENT_TABLE()
 #endif
 
@@ -43,8 +43,8 @@ END_EVENT_TABLE()
 #endif
 
 typedef struct {
- unsigned short instruction;
- void (*function)();
   unsigned short instruction;
   void (*function)();
 } ldefRec, *ldefPtr, **ldefHandle;
 
 #if PRAGMA_STRUCT_ALIGN
@@ -77,105 +77,105 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
     RgnHandle savedClipRegion;
     SInt32 savedPenMode;
     wxListBox*          list;
-  GetPort(&savePort);
-  SetPort((**listHandle).port);
-  grafPtr = (**listHandle).port ;
+    GetPort(&savePort);
+    SetPort((**listHandle).port);
+    grafPtr = (**listHandle).port ;
     // typecast our refCon
     list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
-
+    
     //  Calculate the cell rect.
-
+    
     switch( message ) {
-        case lInitMsg:
-            break;
-
-        case lCloseMsg:
-            break;
-
-        case lDrawMsg:
+    case lInitMsg:
+        break;
+        
+    case lCloseMsg:
+        break;
+        
+    case lDrawMsg:
         {
             const wxString text = list->m_stringArray[cell.v] ;
-
+            
             //  Save the current clip region, and set the clip region to the area we are about
             //  to draw.
-
+            
             savedClipRegion = NewRgn();
             GetClip( savedClipRegion );
-
+            
             ClipRect( drawRect );
             EraseRect( drawRect );
-
-                       wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
-
-                       if ( font )
-                       {
-                               ::TextFont( font->m_macFontNum ) ;
-                               ::TextSize( short(font->m_macFontSize) ) ;
-                               ::TextFace( font->m_macFontStyle ) ;
-                       }
-                       else
-                       {
-                       ::TextFont( kFontIDMonaco ) ;
-                       ::TextSize( 9  );
-                       ::TextFace( 0 ) ;
-                       }
-
+            
+            wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
+            
+            if ( font )
+            {
+                ::TextFont( font->m_macFontNum ) ;
+                ::TextSize( short(font->m_macFontSize) ) ;
+                ::TextFace( font->m_macFontStyle ) ;
+            }
+            else
+            {
+                ::TextFont( kFontIDMonaco ) ;
+                ::TextSize( 9  );
+                ::TextFace( 0 ) ;
+            }
+            
 #if TARGET_CARBON
-               bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-
-               if ( useDrawThemeText )
-               {
-                   Rect frame = { drawRect->top, drawRect->left + 4,
-                                  drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
+            bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
+            
+               if ( useDrawThemeText )
+               {
+                Rect frame = { drawRect->top, drawRect->left + 4,
+                    drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
                 CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
                 CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
-                   CFRelease( sString ) ;
-                               ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
-                       ::DrawThemeTextBox( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &frame,
-                                                               teJustLeft,
-                                                               nil );
-                   CFRelease( mString ) ;
+                CFRelease( sString ) ;
+                ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
+                ::DrawThemeTextBox( mString,
+                    kThemeCurrentPortFont,
+                    kThemeStateActive,
+                    false,
+                    &frame,
+                    teJustLeft,
+                    nil );
+                CFRelease( mString ) ;
             }
-                   else
+            else
 #endif
-                   {
-                       MoveTo(drawRect->left + 4 , drawRect->top + 10 );
-                       DrawText(text, 0 , text.Length());
-                   }
-
+            {
+                MoveTo(drawRect->left + 4 , drawRect->top + 10 );
+                DrawText(text, 0 , text.Length());
+            }
+            
             //  If the cell is hilited, do the hilite now. Paint the cell contents with the
             //  appropriate QuickDraw transform mode.
-
+            
             if( isSelected ) {
                 savedPenMode = GetPortPenMode( (CGrafPtr) grafPtr );
                 SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
                 PaintRect( drawRect );
                 SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
             }
-
+            
             //  Restore the saved clip region.
-
+            
             SetClip( savedClipRegion );
             DisposeRgn( savedClipRegion );
-            }
-            break;
-        case lHiliteMsg:
-
-            //  Hilite or unhilite the cell. Paint the cell contents with the
-            //  appropriate QuickDraw transform mode.
-
-            GetPort( &grafPtr );
-            savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
-            SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
-            PaintRect( drawRect );
-            SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
-            break;
-        default :
-          break ;
+        }
+        break;
+    case lHiliteMsg:
+        
+        //  Hilite or unhilite the cell. Paint the cell contents with the
+        //  appropriate QuickDraw transform mode.
+        
+        GetPort( &grafPtr );
+        savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
+        SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
+        PaintRect( drawRect );
+        SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
+        break;
+    default :
+        break ;
     }
     SetPort(savePort);
 }
@@ -212,27 +212,27 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 
     Rect bounds ;
     Str255 title ;
-
+    
     MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
-
+    
     ListDefSpec listDef;
     listDef.defType = kListDefUserProcType;
     if ( macListDefUPP == NULL )
     {
-      macListDefUPP = NewListDefUPP( wxMacListDefinition );
+        macListDefUPP = NewListDefUPP( wxMacListDefinition );
     }
-        listDef.u.userProc = macListDefUPP ;
-
+    listDef.u.userProc = macListDefUPP ;
+    
     Str255 fontName ;
     SInt16 fontSize ;
     Style fontStyle ;
-       SInt16 fontNum ;
+    SInt16 fontNum ;
 #if TARGET_CARBON
-       GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+    GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
 #else
-       GetFontName( kFontIDMonaco , fontName ) ;
-       fontSize = 9 ;
-       fontStyle = normal ;
+    GetFontName( kFontIDMonaco , fontName ) ;
+    fontSize = 9 ;
+    fontStyle = normal ;
 #endif 
     CopyPascalStringToC( fontName , (char*) fontName ) ;
     SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
@@ -307,8 +307,8 @@ wxListBox::~wxListBox()
     if ( m_macList )
     {
 #if !TARGET_CARBON
-      DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
-      (**(ListHandle)m_macList).listDefProc = NULL ;
+        DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
+        (**(ListHandle)m_macList).listDefProc = NULL ;
 #endif
         m_macList = NULL ;
     }
@@ -406,25 +406,25 @@ int wxListBox::DoAppend(const wxString& item)
 
 void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
 {
-  MacSetRedraw( false ) ;
-  Clear() ;
-  int n = choices.GetCount();
-
-  for( int i = 0 ; i < n ; ++i )
-  {
-    if ( clientData )
+    MacSetRedraw( false ) ;
+    Clear() ;
+    int n = choices.GetCount();
+    
+    for( int i = 0 ; i < n ; ++i )
     {
+        if ( clientData )
+        {
 #if wxUSE_OWNER_DRAWN
             wxASSERT_MSG(clientData[i] == NULL,
-                         wxT("Can't use client data with owner-drawn listboxes"));
+                wxT("Can't use client data with owner-drawn listboxes"));
 #else // !wxUSE_OWNER_DRAWN
-        Append( choices[i] , clientData[i] ) ;
- #endif
+            Append( choices[i] , clientData[i] ) ;
+#endif
+        }
+        else
+            Append( choices[i] ) ;
     }
-    else
-        Append( choices[i] ) ;
-  }
-
+    
 #if wxUSE_OWNER_DRAWN
     if ( m_windowStyle & wxLB_OWNERDRAW ) {
         // first delete old items
@@ -434,7 +434,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
             m_aItems[ui] = NULL;
         }
         m_aItems.Empty();
-
+        
         // then create new ones
         for ( ui = 0; ui < (size_t)m_noItems; ui++ ) {
             wxOwnerDrawn *pNewItem = CreateItem(ui);
@@ -443,7 +443,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
         }
     }
 #endif // wxUSE_OWNER_DRAWN
-  MacSetRedraw( true ) ;
+    MacSetRedraw( true ) ;
 }
 
 bool wxListBox::HasMultipleSelection() const
@@ -460,20 +460,20 @@ int wxListBox::FindString(const wxString& st) const
     }
     else
         s = st ;
-
+    
     if ( s.Right(1) == "*" )
     {
         wxString search = s.Left( s.Length() - 1 ) ;
         int len = search.Length() ;
         Str255 s1 , s2 ;
-
+        
 #if TARGET_CARBON
         c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
 #else
         strcpy( (char *) s2 , search.c_str() ) ;
         c2pstr( (char *) s2 ) ;
 #endif
-
+        
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
 #if TARGET_CARBON
@@ -495,19 +495,19 @@ int wxListBox::FindString(const wxString& st) const
                     return i ;
             }
         }
-
+        
     }
     else
     {
         Str255 s1 , s2 ;
-
+        
 #if TARGET_CARBON
         c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
 #else
         strcpy( (char *) s2 , s.c_str() ) ;
         c2pstr( (char *) s2 ) ;
 #endif
-
+        
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
 #if TARGET_CARBON
@@ -519,40 +519,40 @@ int wxListBox::FindString(const wxString& st) const
             if ( EqualString( s1 , s2 , false , false ) )
                 return i ;
         }
-   }
-   return -1;
+    }
+    return -1;
 }
 
 void wxListBox::Clear()
 {
-  FreeData();
-  m_noItems = 0;
-  m_stringArray.Empty() ;
-  m_dataArray.Empty() ;
-  MacClear() ;
+    FreeData();
+    m_noItems = 0;
+    m_stringArray.Empty() ;
+    m_dataArray.Empty() ;
+    MacClear() ;
 }
 
 void wxListBox::SetSelection(int N, bool select)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-                 "invalid index in wxListBox::SetSelection" );
-      MacSetSelection( N , select ) ;
-      GetSelections( m_selectionPreImage ) ;
+        "invalid index in wxListBox::SetSelection" );
+    MacSetSelection( N , select ) ;
+    GetSelections( m_selectionPreImage ) ;
 }
 
 bool wxListBox::IsSelected(int N) const
 {
     wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
-                 "invalid index in wxListBox::Selected" );
-
-      return MacIsSelected( N ) ;
+        "invalid index in wxListBox::Selected" );
+    
+    return MacIsSelected( N ) ;
 }
 
 void *wxListBox::DoGetItemClientData(int N) const
 {
     wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
-                 wxT("invalid index in wxListBox::GetClientData"));
-
+        wxT("invalid index in wxListBox::GetClientData"));
+    
     return (void *)m_dataArray[N];
 }
 
@@ -564,8 +564,8 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
 void wxListBox::DoSetItemClientData(int N, void *Client_data)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-                 "invalid index in wxListBox::SetClientData" );
-
+        "invalid index in wxListBox::SetClientData" );
+    
 #if wxUSE_OWNER_DRAWN
     if ( m_windowStyle & wxLB_OWNERDRAW )
     {
@@ -575,7 +575,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
     }
 #endif // wxUSE_OWNER_DRAWN
     wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , "invalid client_data array" ) ;
-
+    
     if ( m_dataArray.GetCount() > (size_t) N )
     {
         m_dataArray[N] = (char*) Client_data ;
@@ -617,17 +617,17 @@ wxString wxListBox::GetString(int N) const
 void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
 {
     wxCHECK_RET( pos >= 0 && pos <= m_noItems,
-                 wxT("invalid index in wxListBox::InsertItems") );
-
+        wxT("invalid index in wxListBox::InsertItems") );
+    
     int nItems = items.GetCount();
-
+    
     for ( int i = 0 ; i < nItems ; i++ )
     {
         m_stringArray.Insert( items[i] , pos + i ) ;
         m_dataArray.Insert( NULL , pos + i ) ;
         MacInsert( pos + i , items[i] ) ;
     }
-
+    
     m_noItems += nItems;
 }
 
@@ -649,44 +649,44 @@ wxSize wxListBox::DoGetBestSize() const
     int lbWidth = 100;  // some defaults
     int lbHeight = 110;
     int wLine;
-
-       {
-               wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
-
-               wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-
-               if ( font )
-               {
-                       ::TextFont( font->m_macFontNum ) ;
-                       ::TextSize( short(font->m_macFontSize) ) ;
-                       ::TextFace( font->m_macFontStyle ) ;
-               }
-               else
-               {
-               ::TextFont( kFontIDMonaco ) ;
-               ::TextSize( 9  );
-               ::TextFace( 0 ) ;
-               }
-
-           // Find the widest line
-           for(int i = 0; i < GetCount(); i++) {
-               wxString str(GetString(i));
-               wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
-               lbWidth = wxMax(lbWidth, wLine);
-           }
-
-           // Add room for the scrollbar
-           lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
-
-           // And just a bit more
-           int cy = 12 ;
-           int cx = ::TextWidth( "X" , 0 , 1 ) ;
-           lbWidth += cx ;
-           
-           // don't make the listbox too tall (limit height to around 10 items) but don't
-           // make it too small neither
-           lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
-       }
+    
+    {
+        wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
+        
+        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+        
+        if ( font )
+        {
+            ::TextFont( font->m_macFontNum ) ;
+            ::TextSize( short(font->m_macFontSize) ) ;
+            ::TextFace( font->m_macFontStyle ) ;
+        }
+        else
+        {
+            ::TextFont( kFontIDMonaco ) ;
+            ::TextSize( 9  );
+            ::TextFace( 0 ) ;
+        }
+        
+        // Find the widest line
+        for(int i = 0; i < GetCount(); i++) {
+            wxString str(GetString(i));
+            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+            lbWidth = wxMax(lbWidth, wLine);
+        }
+        
+        // Add room for the scrollbar
+        lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
+        
+        // And just a bit more
+        int cy = 12 ;
+        int cx = ::TextWidth( "X" , 0 , 1 ) ;
+        lbWidth += cx ;
+        
+        // don't make the listbox too tall (limit height to around 10 items) but don't
+        // make it too small neither
+        lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
+    }
     return wxSize(lbWidth, lbHeight);
 }
 
@@ -704,7 +704,7 @@ void wxListBox::SetupColours()
 void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
 {
     wxControl::Refresh( eraseBack , rect ) ;
-//    MacRedrawControl() ;
+    //    MacRedrawControl() ;
 }
 
 #if wxUSE_OWNER_DRAWN
@@ -735,18 +735,18 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
 /*
 void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
 {
-    wxListBox*          list;
-    // typecast our refCon
-    list = (wxListBox*)refCon;
-
-    MoveTo(cellRect->left + 4 , cellRect->top + 10 );
-    const wxString text = list->m_stringArray[lCell.v] ;
-    ::TextFont( kFontIDMonaco ) ;
-    ::TextSize( 9  );
-    ::TextFace( 0 ) ;
-    DrawText(text, 0 , text.Length());
-
-}
+wxListBox*          list;
+// typecast our refCon
+list = (wxListBox*)refCon;
+
+  MoveTo(cellRect->left + 4 , cellRect->top + 10 );
+  const wxString text = list->m_stringArray[lCell.v] ;
+  ::TextFont( kFontIDMonaco ) ;
+  ::TextSize( 9  );
+  ::TextFace( 0 ) ;
+  DrawText(text, 0 , text.Length());
+  
+    }
 */
 void wxListBox::MacDelete( int N )
 {
@@ -759,7 +759,7 @@ void wxListBox::MacInsert( int n , const char * text)
     Cell cell = { 0 , 0 } ;
     cell.v = n ;
     LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
-//    LSetCell(text, strlen(text), cell, m_macList);
+    //    LSetCell(text, strlen(text), cell, m_macList);
     Refresh();
 }
 
@@ -768,7 +768,7 @@ void wxListBox::MacAppend( const char * text)
     Cell cell = { 0 , 0 } ;
     cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
     LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
- //   LSetCell(text, strlen(text), cell, m_macList);
   //   LSetCell(text, strlen(text), cell, m_macList);
     Refresh();
 }
 
@@ -788,7 +788,7 @@ void wxListBox::MacSetSelection( int n , bool select )
             LSetSelect( false , cell , (ListHandle)m_macList ) ;
         }
     }
-
+    
     cell.v = n ;
     LSetSelect( select , cell , (ListHandle)m_macList ) ;
     LAutoScroll( (ListHandle)m_macList ) ;
@@ -804,7 +804,7 @@ bool wxListBox::MacIsSelected( int n ) const
 
 void wxListBox::MacDestroy()
 {
-//    DisposeExtLDEFInfo( m_macList ) ;
+    //    DisposeExtLDEFInfo( m_macList ) ;
 }
 
 int wxListBox::MacGetSelection() const
@@ -819,12 +819,12 @@ int wxListBox::MacGetSelection() const
 int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
 {
     int no_sel = 0 ;
-
+    
     aSelections.Empty();
-
+    
     Cell cell = { 0 , 0 } ;
     cell.v = 0 ;
-
+    
     while ( LGetSelect( true , &cell ,(ListHandle) m_macList ) )
     {
         aSelections.Add( cell.v ) ;
@@ -840,7 +840,7 @@ void wxListBox::MacSet( int n , const char * text )
     // so we just have to redraw
     Cell cell = { 0 , 0 } ;
     cell.v = n ;
-//  LSetCell(text, strlen(text), cell, m_macList);
+    //  LSetCell(text, strlen(text), cell, m_macList);
     Refresh();
 }
 
@@ -852,7 +852,7 @@ void wxListBox::MacScrollTo( int n )
 void wxListBox::OnSize( const wxSizeEvent &event)
 {
     Point pt;
-
+    
 #if TARGET_CARBON
     GetListCellSize((ListHandle)m_macList, &pt);
 #else
@@ -866,7 +866,7 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
 {
     Boolean wasDoubleClick = false ;
     long    result ;
-
+    
     ::GetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlListBoxDoubleClickTag , sizeof( wasDoubleClick ) , (char*) &wasDoubleClick  , &result ) ;
     if ( !wasDoubleClick )
     {
@@ -881,7 +881,7 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
 void wxListBox::MacSetRedraw( bool doDraw )
 {
     LSetDrawingMode( doDraw , (ListHandle)m_macList ) ;
-
+    
 }
 
 void wxListBox::MacDoClick()
@@ -889,7 +889,7 @@ void wxListBox::MacDoClick()
     wxArrayInt aSelections;
     int n ;
     size_t count = GetSelections(aSelections);
-
+    
     if ( count == m_selectionPreImage.GetCount() )
     {
         bool hasChanged = false ;
@@ -906,12 +906,12 @@ void wxListBox::MacDoClick()
             return ;
         }
     }
-
+    
     m_selectionPreImage = aSelections;
-
+    
     wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
     event.SetEventObject( this );
-
+    
     if ( count > 0 )
     {
         n = aSelections[0];
@@ -923,11 +923,11 @@ void wxListBox::MacDoClick()
     }
     else
     {
-         n = -1;
+        n = -1;
     }
-
+    
     event.m_commandInt = n;
-
+    
     GetEventHandler()->ProcessEvent(event);
 }
 
@@ -935,35 +935,35 @@ void wxListBox::MacDoDoubleClick()
 {
     wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
     event.SetEventObject( this );
-       GetEventHandler()->ProcessEvent(event) ;
+    GetEventHandler()->ProcessEvent(event) ;
 }
 
 void wxListBox::OnChar(wxKeyEvent& event)
 {
     if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)
     {
-       wxWindow* parent = GetParent() ;
-       while( parent  && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
-               parent = parent->GetParent() ;
-
-       if ( parent && parent->GetDefaultItem() )
-       {
-               wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
-                                               wxButton);
-               if ( def && def->IsEnabled() )
-               {
-                    wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
-                    event.SetEventObject(def);
-                    def->Command(event);
-                    return ;
-               }
-           }
-           event.Skip() ;
+        wxWindow* parent = GetParent() ;
+        while( parent  && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
+            parent = parent->GetParent() ;
+        
+        if ( parent && parent->GetDefaultItem() )
+        {
+            wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
+                wxButton);
+            if ( def && def->IsEnabled() )
+            {
+                wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                event.SetEventObject(def);
+                def->Command(event);
+                return ;
+            }
+        }
+        event.Skip() ;
     }
     /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
     else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
     {
-       wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
+        wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
         wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
         new_event.SetEventObject( win );
         win->GetEventHandler()->ProcessEvent( new_event );
@@ -977,64 +977,64 @@ void wxListBox::OnChar(wxKeyEvent& event)
         new_event.SetWindowChange( event.ControlDown() );
         new_event.SetCurrentFocus( this );
         if ( !GetEventHandler()->ProcessEvent( new_event ) )
-               event.Skip() ;
+            event.Skip() ;
     }
-       else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
-       {
-               // perform the default key handling first
-               wxControl::OnKeyDown( event ) ;
-
+    else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
+    {
+        // perform the default key handling first
+        wxControl::OnKeyDown( event ) ;
+        
         wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
         event.SetEventObject( this );
-
+        
         wxArrayInt aSelections;
         int n, count = GetSelections(aSelections);
         if ( count > 0 )
         {
-               n = aSelections[0];
-               if ( HasClientObjectData() )
-                  event.SetClientObject( GetClientObject(n) );
-              else if ( HasClientUntypedData() )
-                  event.SetClientData( GetClientData(n) );
-              event.SetString( GetString(n) );
+            n = aSelections[0];
+            if ( HasClientObjectData() )
+                event.SetClientObject( GetClientObject(n) );
+            else if ( HasClientUntypedData() )
+                event.SetClientData( GetClientData(n) );
+            event.SetString( GetString(n) );
         }
         else
         {
-             n = -1;
+            n = -1;
         }
-
+        
         event.m_commandInt = n;
-
+        
         GetEventHandler()->ProcessEvent(event);
-       }
-       else
-       {
-         if ( event.GetTimestamp() > m_lastTypeIn + 60 )
-         {
-           m_typeIn = "" ;
-         }
-         m_lastTypeIn = event.GetTimestamp() ;
-         m_typeIn += (char) event.GetKeyCode() ;
-         int line = FindString("*"+m_typeIn+"*") ;
-         if ( line >= 0 )
-         {
-               if ( GetSelection() != line )
-               {
-               SetSelection(line) ;
-               wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
-               event.SetEventObject( this );
-
-            if ( HasClientObjectData() )
-              event.SetClientObject( GetClientObject( line ) );
-               else if ( HasClientUntypedData() )
-              event.SetClientData( GetClientData(line) );
-               event.SetString( GetString(line) );
-
-               event.m_commandInt = line ;
-
-               GetEventHandler()->ProcessEvent(event);
-           }
-         }
-       }
+    }
+    else
+    {
+        if ( event.GetTimestamp() > m_lastTypeIn + 60 )
+        {
+            m_typeIn = "" ;
+        }
+        m_lastTypeIn = event.GetTimestamp() ;
+        m_typeIn += (char) event.GetKeyCode() ;
+        int line = FindString("*"+m_typeIn+"*") ;
+        if ( line >= 0 )
+        {
+            if ( GetSelection() != line )
+            {
+                SetSelection(line) ;
+                wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
+                event.SetEventObject( this );
+                
+                if ( HasClientObjectData() )
+                    event.SetClientObject( GetClientObject( line ) );
+                else if ( HasClientUntypedData() )
+                    event.SetClientData( GetClientData(line) );
+                event.SetString( GetString(line) );
+                
+                event.m_commandInt = line ;
+                
+                GetEventHandler()->ProcessEvent(event);
+            }
+        }
+    }
 }
 
index c01f4deaf0cc189dd8cf8d79622dac2524f23e87..b6a170c8ee6b5ac400b66cee34e074c8ccc8d8be 100644 (file)
@@ -17,12 +17,12 @@ const short kMaxEvents = 1000 ;
 
 struct wxMacNotificationEvents
 {
-       short top ;
-       short bottom ;
-       
-       wxMacNotificationProcPtr proc[kMaxEvents] ;
-       unsigned long events[kMaxEvents] ;
-       void* data[kMaxEvents] ;
+    short top ;
+    short bottom ;
+    
+    wxMacNotificationProcPtr proc[kMaxEvents] ;
+    unsigned long events[kMaxEvents] ;
+    void* data[kMaxEvents] ;
 } ;
 
 typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
@@ -32,43 +32,43 @@ ProcessSerialNumber gAppProcess ;
 
 void wxMacWakeUp()
 {
-       ProcessSerialNumber psn ;
-       Boolean isSame ;
-       psn.highLongOfPSN = 0 ;
-       psn.lowLongOfPSN = kCurrentProcess ;
-       SameProcess( &gAppProcess , &psn , &isSame ) ;
-       if ( isSame )
-       {
+    ProcessSerialNumber psn ;
+    Boolean isSame ;
+    psn.highLongOfPSN = 0 ;
+    psn.lowLongOfPSN = kCurrentProcess ;
+    SameProcess( &gAppProcess , &psn , &isSame ) ;
+    if ( isSame )
+    {
 #if TARGET_CARBON
-               EventRef dummyEvent ;
-               OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
+        EventRef dummyEvent ;
+        OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
                         kEventAttributeNone, &dummyEvent);
         if (err == noErr) 
         {
-               err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
+            err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
                                   kEventPriorityHigh);
         } 
 #else
-               PostEvent( nullEvent , 0 ) ;
+        PostEvent( nullEvent , 0 ) ;
 #endif
-       }
-       else
-       {
-               WakeUpProcess( &gAppProcess ) ;
-       }
+    }
+    else
+    {
+        WakeUpProcess( &gAppProcess ) ;
+    }
 }
 
 void wxMacCreateNotifierTable()
 {
-       GetCurrentProcess(&gAppProcess);
-       gMacNotificationEvents.top = 0 ;
-       gMacNotificationEvents.bottom = 0 ;
-       for ( int i = 0 ; i < kMaxEvents ; ++i )
-       {
-               gMacNotificationEvents.proc[i] = NULL ;
-               gMacNotificationEvents.events[i] = NULL ;
-               gMacNotificationEvents.data[i] = NULL ;
-       }
+      GetCurrentProcess(&gAppProcess);
+    gMacNotificationEvents.top = 0 ;
+    gMacNotificationEvents.bottom = 0 ;
+    for ( int i = 0 ; i < kMaxEvents ; ++i )
+    {
+        gMacNotificationEvents.proc[i] = NULL ;
+        gMacNotificationEvents.events[i] = NULL ;
+        gMacNotificationEvents.data[i] = NULL ;
+    }
 }
 
 void wxMacDestroyNotifierTable() 
@@ -77,86 +77,86 @@ void wxMacDestroyNotifierTable()
 
 wxMacNotifierTableRef wxMacGetNotifierTable() 
 {
-       return (wxMacNotifierTableRef) &gMacNotificationEvents ;
+    return (wxMacNotifierTableRef) &gMacNotificationEvents ;
 }
 
 void wxMacAddEvent( 
-       wxMacNotifierTableRef table , 
-       wxMacNotificationProcPtr handler , 
-       unsigned long event , 
-       void* data , 
-       short wakeUp ) 
+    wxMacNotifierTableRef table , 
+    wxMacNotificationProcPtr handler , 
+    unsigned long event , 
+    void* data , 
+    short wakeUp ) 
 {
-       wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
-       wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
-       /* this should be protected eventually */
-       short index = e->top++ ;
-       
-       if ( e->top == kMaxEvents )
-               e->top = 0 ;
-
-       e->proc[index] = handler ;
-       e->events[index] = event ;
-       e->data[index] = data ;
-       if ( wakeUp )
-               wxMacWakeUp() ;
+    wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
+    wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
+    /* this should be protected eventually */
+    short index = e->top++ ;
+    
+    if ( e->top == kMaxEvents )
+        e->top = 0 ;
+
+    e->proc[index] = handler ;
+    e->events[index] = event ;
+    e->data[index] = data ;
+    if ( wakeUp )
+        wxMacWakeUp() ;
 }
 
 bool gInProcessing = false ;
 
 void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data ) 
 {
-       wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
-       /* this should be protected eventually */
-       short index = e->bottom ;
-       
-  while ( e->top != index )
-  {
-    if ( index == kMaxEvents )
-      index = 0 ;
-    if ( e->data[index] == data )
-       e->data[index] = NULL ;
-       index++ ;
-  }
+    wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
+    /* this should be protected eventually */
+    short index = e->bottom ;
+    
+    while ( e->top != index )
+    {
+        if ( index == kMaxEvents )
+            index = 0 ;
+        if ( e->data[index] == data )
+            e->data[index] = NULL ;
+        index++ ;
+    }
 }
 
 void wxMacProcessNotifierEvents()
 {
-//  if ( gInProcessing )
-//     return ;
-       
-  gInProcessing = true ;
-  if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
-  {
-    // we only should process the notifiers that were here when we entered it
-    // otherwise we might never get out...  
-       short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
-       if ( count < 0 )
-        count += kMaxEvents ;
-        
-    while ( count-- )
+    //  if ( gInProcessing )
+    //      return ;
+    
+    gInProcessing = true ;
+    if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
     {
-        // consume event at bottom
-       short index = gMacNotificationEvents.bottom++ ;
-        if ( gMacNotificationEvents.bottom == kMaxEvents )
-          gMacNotificationEvents.bottom = 0 ;
-        void* data = gMacNotificationEvents.data[index] ;
-        unsigned long event = gMacNotificationEvents.events[index] ;
-       wxMacNotificationProcPtr handler =  gMacNotificationEvents.proc[index] ;
-       
-       gMacNotificationEvents.data[index] = NULL ;
-       gMacNotificationEvents.events[index] = NULL ;
-       gMacNotificationEvents.proc[index]  = NULL ;
+        // we only should process the notifiers that were here when we entered it
+        // otherwise we might never get out...  
+        short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
+        if ( count < 0 )
+            count += kMaxEvents ;
         
-        if ( handler )
-           handler( event , data  ) ;
-       }
-  }
-  gInProcessing = false ;
+        while ( count-- )
+        {
+            // consume event at bottom
+            short index = gMacNotificationEvents.bottom++ ;
+            if ( gMacNotificationEvents.bottom == kMaxEvents )
+                gMacNotificationEvents.bottom = 0 ;
+            void* data = gMacNotificationEvents.data[index] ;
+            unsigned long event = gMacNotificationEvents.events[index] ;
+            wxMacNotificationProcPtr handler =  gMacNotificationEvents.proc[index] ;
+            
+            gMacNotificationEvents.data[index] = NULL ;
+            gMacNotificationEvents.events[index] = NULL ;
+            gMacNotificationEvents.proc[index]  = NULL ;
+            
+            if ( handler )
+                handler( event , data  ) ;
+        }
+    }
+    gInProcessing = false ;
 }
 
 void wxMacProcessNotifierAndPendingEvents() 
 {
-       wxMacProcessNotifierEvents() ;
-       wxTheApp->ProcessPendingEvents() ;
+    wxMacProcessNotifierEvents() ;
+    wxTheApp->ProcessPendingEvents() ;
 }
index e2cb64e8f5c59124e8dde4ab16dc18611ee970fd..724d53723d1e0ef765fa3f9e52244e7d09dc6d03 100644 (file)
@@ -6,13 +6,13 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/app.h"
 
 WXDLLEXPORT int main(int argc, char* argv[])
 {
-  return wxEntry(argc, argv);
+    return wxEntry(argc, argv);
 }
 
index 9c9a725b48274bbc5a5e98673b80dd193798776d..1d9e43f170c86a14636671a306d98c522ddd3356 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -71,33 +71,33 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
            long style,
            const wxString& name)
 {
-  m_clientWindow = NULL;
-  m_currentChild = NULL;
-
-  // this style can be used to prevent a window from having the standard MDI
-  // "Window" menu
-  if ( style & wxFRAME_NO_WINDOW_MENU )
-  {
-      m_windowMenu = (wxMenu *)NULL;
-      style -= wxFRAME_NO_WINDOW_MENU ;
-  }
-  else // normal case: we have the window menu, so construct it
-  {
-      m_windowMenu = new wxMenu;
-
-      m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
-      m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
-      m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
-      m_windowMenu->AppendSeparator();
-      m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
-      m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
-  }
-
-  wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
-  m_parentFrameActive = TRUE;
+    m_clientWindow = NULL;
+    m_currentChild = NULL;
+    
+    // this style can be used to prevent a window from having the standard MDI
+    // "Window" menu
+    if ( style & wxFRAME_NO_WINDOW_MENU )
+    {
+        m_windowMenu = (wxMenu *)NULL;
+        style -= wxFRAME_NO_WINDOW_MENU ;
+    }
+    else // normal case: we have the window menu, so construct it
+    {
+        m_windowMenu = new wxMenu;
         
-  OnCreateClient();
-
+        m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
+        m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
+        m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
+        m_windowMenu->AppendSeparator();
+        m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
+        m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
+    }
+    
+    wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
+    m_parentFrameActive = TRUE;
+    
+    OnCreateClient();
+    
     return TRUE;
 }
 
@@ -108,13 +108,13 @@ wxMDIParentFrame::~wxMDIParentFrame()
     m_frameToolBar = NULL;
     m_frameStatusBar = NULL;
     m_clientWindow = NULL ;
-
+    
     if (m_windowMenu)
     {
         delete m_windowMenu;
         m_windowMenu = (wxMenu*) NULL;
     }
-
+    
     if ( m_clientWindow )
     {
         delete m_clientWindow;
@@ -126,51 +126,51 @@ wxMDIParentFrame::~wxMDIParentFrame()
 // Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
 {
-       wxDisplaySize( x , y ) ;
+    wxDisplaySize( x , y ) ;
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
 {
-       wxFrame::SetMenuBar( menu_bar ) ;
+    wxFrame::SetMenuBar( menu_bar ) ;
 }
 
 void wxMDIParentFrame::OnSize(wxSizeEvent& event)
 {
 #if wxUSE_CONSTRAINTS
     if (GetAutoLayout())
-      Layout();
+        Layout();
 #endif
     int x = 0;
     int y = 0;
     int width, height;
     GetClientSize(&width, &height);
-
+    
     if ( GetClientWindow() )
         GetClientWindow()->SetSize(x, y, width, height);
 }
 
 void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
 {
-  if ( m_currentChild && event.GetActive() )
-  {
-    wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
-    event.SetEventObject( m_currentChild );
-    m_currentChild->GetEventHandler()->ProcessEvent(event) ;
-  }
-  else if ( event.GetActive() )
-  {
-         if ( m_frameMenuBar != NULL )
-           {
-                 m_frameMenuBar->MacInstallMenuBar() ;
-           }
-
-  }
+    if ( m_currentChild && event.GetActive() )
+    {
+        wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
+        event.SetEventObject( m_currentChild );
+        m_currentChild->GetEventHandler()->ProcessEvent(event) ;
+    }
+    else if ( event.GetActive() )
+    {
+        if ( m_frameMenuBar != NULL )
+        {
+            m_frameMenuBar->MacInstallMenuBar() ;
+        }
+        
+    }
 }
 
 // Returns the active MDI child window
 wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
 {
-  return m_currentChild ;
+    return m_currentChild ;
 }
 
 // Create the client window class (don't Create the window,
@@ -185,7 +185,7 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
     // TODO
-
+    
     // Propagate the event to the non-top-level children
     wxFrame::OnSysColourChanged(event);
 }
@@ -227,27 +227,27 @@ void wxMDIChildFrame::Init()
 }
 
 bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
-           wxWindowID id,
-           const wxString& title,
-           const wxPoint& pos,
-           const wxSize& size,
-           long style,
-           const wxString& name)
+                             wxWindowID id,
+                             const wxString& title,
+                             const wxPoint& pos,
+                             const wxSize& size,
+                             long style,
+                             const wxString& name)
 {
     SetName(name);
-
+    
     if ( id > -1 )
         m_windowId = id;
     else
         m_windowId = (int)NewControlId();
-
+    
     if (parent) parent->AddChild(this);
-
-       MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
-  
-       m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
-       SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-
+    
+    MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+    
+    m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
+    SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
+    
     wxModelessWindows.Append(this);
     return FALSE;
 }
@@ -262,7 +262,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
 
 void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
 {
-       return wxFrame::SetMenuBar( menu_bar ) ;
+    return wxFrame::SetMenuBar( menu_bar ) ;
 }
 
 // MDI operations
@@ -295,15 +295,15 @@ wxMDIClientWindow::~wxMDIClientWindow()
 
 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
 {
-
+    
     m_windowId = (int)NewControlId();
-
+    
     if ( parent )
     {
-       parent->AddChild(this);
+        parent->AddChild(this);
     }
     m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
-
+    
     wxModelessWindows.Append(this);
     return TRUE;
 }
index a5fe24d23bff812659057b834ba7b999293ad045..1d3195a6a70e5c343f6aded2d055084df4d43918 100644 (file)
@@ -6,10 +6,9 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
 #ifdef __GNUG__
 #pragma implementation "menu.h"
 #pragma implementation "menuitem.h"
@@ -70,8 +69,8 @@ void wxMenu::Init()
     m_startRadioGroup = -1;
 
     // create the menu
-       m_macMenuId = s_macNextMenuId++; 
-       m_hMenu = UMANewMenu(m_macMenuId, m_title);
+    m_macMenuId = s_macNextMenuId++; 
+    m_hMenu = UMANewMenu(m_macMenuId, m_title);
 
     if ( !m_hMenu )
     {
@@ -88,13 +87,13 @@ void wxMenu::Init()
 
 wxMenu::~wxMenu()
 {
-       if (MAC_WXHMENU(m_hMenu))
-               ::DisposeMenu(MAC_WXHMENU(m_hMenu));
+    if (MAC_WXHMENU(m_hMenu))
+        ::DisposeMenu(MAC_WXHMENU(m_hMenu));
 }
 
 void wxMenu::Break()
 {
-       // not available on the mac platform
+    // not available on the mac platform
 }
 
 void wxMenu::Attach(wxMenuBarBase *menubar)
@@ -110,60 +109,60 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
 {
     wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
 
-       if ( pItem->IsSeparator() )
-       {
-               if ( pos == (size_t)-1 )
-                       MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
-               else
-                       MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
-       }
-       else 
-       {
-               wxMenu *pSubMenu = pItem->GetSubMenu() ;
-               if ( pSubMenu != NULL )
-               {
-                       wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
-                   pSubMenu->m_menuParent = this ;
-               
-                       if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
-                               ::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
-                       
-                       if ( pos == (size_t)-1 )
-                               UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
-                       else
-                               UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
-                       pItem->UpdateItemBitmap() ;
-                       pItem->UpdateItemStatus() ;
-               }
-               else
-               {
-                       if ( pos == (size_t)-1 )
-                       {
-                               UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
-                               pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
-                       }
-                       else
-                       {
-                               UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
-                       }
-
-                       SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
-                       pItem->UpdateItemText() ;
-                       pItem->UpdateItemBitmap() ;
-                       pItem->UpdateItemStatus() ;
-
-                       if ( pItem->GetId() == idMenuTitle ) 
-                       {
-                               UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
-                       }
-               }
-       }
+    if ( pItem->IsSeparator() )
+    {
+        if ( pos == (size_t)-1 )
+            MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
+        else
+            MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
+    }
+    else 
+    {
+        wxMenu *pSubMenu = pItem->GetSubMenu() ;
+        if ( pSubMenu != NULL )
+        {
+               wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
+            pSubMenu->m_menuParent = this ;
+        
+            if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
+                ::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
+            
+            if ( pos == (size_t)-1 )
+                UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
+            else
+                UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
+            pItem->UpdateItemBitmap() ;
+            pItem->UpdateItemStatus() ;
+        }
+        else
+        {
+            if ( pos == (size_t)-1 )
+            {
+                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
+                pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
+            }
+            else
+            {
+                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
+            }
+
+            SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
+            pItem->UpdateItemText() ;
+            pItem->UpdateItemBitmap() ;
+            pItem->UpdateItemStatus() ;
+
+              if ( pItem->GetId() == idMenuTitle ) 
+              {
+                UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
+              }
+        }
+    }
     // if we're already attached to the menubar, we must update it
     if ( IsAttached() )
     {
         m_menuBar->Refresh();
     }
-       return TRUE ;
+    return TRUE ;
 }
 
 void wxMenu::EndRadioGroup()
@@ -250,7 +249,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
     // DoRemove() (unlike Remove) can only be called for existing item!
     wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
 
-       ::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
+    ::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
 
     if ( IsAttached() )
     {
@@ -264,8 +263,8 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
 
 void wxMenu::SetTitle(const wxString& label)
 {
-       m_title = label ;
-       UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
+       m_title = label ;
+    UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
 }
 bool wxMenu::ProcessCommand(wxCommandEvent & event)
 {
@@ -324,11 +323,11 @@ int wxMenu::MacGetIndexFromId( int id )
 
         node = node->GetNext();
     }
-       
+    
     if (!node)
-               return 0;
-               
-       return pos + 1 ;
+        return 0;
+        
+    return pos + 1 ;
 }
 
 int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem ) 
@@ -344,16 +343,16 @@ int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
     }
 
     if (!node)
-               return 0;
-               
-       return pos + 1 ;
+        return 0;
+        
+    return pos + 1 ;
 }
 
 void wxMenu::MacEnableMenu( bool bDoEnable ) 
 {
-       UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
-               
-       ::DrawMenuBar() ;
+    UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
+        
+    ::DrawMenuBar() ;
 }
 
 // Menu Bar
@@ -412,11 +411,11 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
 
 wxMenuBar::~wxMenuBar()
 {
-       if (s_macInstalledMenuBar == this)
-       {
-               ::ClearMenuBar();
-               s_macInstalledMenuBar = NULL;
-       }
+    if (s_macInstalledMenuBar == this)
+    {
+        ::ClearMenuBar();
+        s_macInstalledMenuBar = NULL;
+    }
 
 }
 
@@ -431,9 +430,9 @@ void wxMenuBar::MacInstallMenuBar()
 {
     if ( s_macInstalledMenuBar == this )
         return ;
-               
+        
     wxStAppResource resload ;
-               
+        
     Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
     wxString message ;
     wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
@@ -453,142 +452,142 @@ void wxMenuBar::MacInstallMenuBar()
 #endif
  
     // clean-up the help menu before adding new items
-       MenuHandle mh = NULL ;
-       if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
-       {
-           for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
-           {
-               DeleteMenuItem( mh , i ) ;
-           }
-       }
-       else
-       {
-           mh = NULL ;
-       }
+    MenuHandle mh = NULL ;
+    if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
+    {
+        for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
+        {
+            DeleteMenuItem( mh , i ) ;
+        }
+    }
+    else
+    {
+        mh = NULL ;
+    }
 #if TARGET_CARBON
-       if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
-       {
-               wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
-               if ( item == NULL || !(item->IsEnabled()) )
-                       DisableMenuCommand( NULL , kHICommandPreferences ) ;
-               else
-                       EnableMenuCommand( NULL , kHICommandPreferences ) ;
-       }
+    if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
+    {
+        wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
+        if ( item == NULL || !(item->IsEnabled()) )
+            DisableMenuCommand( NULL , kHICommandPreferences ) ;
+        else
+            EnableMenuCommand( NULL , kHICommandPreferences ) ;
+    }
 #endif
-       for (size_t i = 0; i < m_menus.GetCount(); i++)
-       {
-        Str255         label;
+       for (size_t i = 0; i < m_menus.GetCount(); i++)
+      {
+        Str255     label;
         wxMenuItemList::Node *node;
         wxMenuItem *item;
         int pos ;
-       wxMenu* menu = m_menus[i] , *subMenu = NULL ;
-
-       if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
-       {
-                       if ( mh == NULL )
-                       {
-                           continue ;
-                       }
-                               
-                       for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
-                       {
-                               item = (wxMenuItem *)node->GetData();
-                               subMenu = item->GetSubMenu() ;
-                               if (subMenu)                    
-                               {
-                                       // we don't support hierarchical menus in the help menu yet
-                               }
-                               else            
-                               {
-                                       if ( item->IsSeparator() )
-                                       {
-                                               if ( mh )
-                                                       MacAppendMenu(mh, "\p-" );
-                                       }
-                                       else
-                                       {
-                                               wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
-
-                                               if ( item->GetId() == wxApp::s_macAboutMenuItemId )
-                                               
-                                                               UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText()  );
-                                                               UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
-                                                               SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
-                                                               UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
-                                               }
-                                               else
-                                               {
-                                                       if ( mh )
-                                                       {
-                                                               UMAAppendMenuItem(mh, item->GetText()  , entry );
-                                                               SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
-                                                       }
-                                               }
-                                               
-                                               delete entry ;
-                                       }
-                               }
-                       }
-               }
-               else
-               {
-                       UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
-                       wxArrayPtrVoid submenus ;
-                       wxMenuItem* previousItem = NULL ;
-                       for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
-                       {
-                               item = (wxMenuItem *)node->GetData();
-                               subMenu = item->GetSubMenu() ;
-                               if (subMenu)                    
-                               {
-                                 submenus.Add(subMenu) ;
-                               }
-                               else
-                               {
+        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
+
+        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
+        {
+            if ( mh == NULL )
+            {
+                continue ;
+            }
+                
+              for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
+              {
+                 item = (wxMenuItem *)node->GetData();
+                 subMenu = item->GetSubMenu() ;
+                if (subMenu)             
+                {
+                    // we don't support hierarchical menus in the help menu yet
+                }
+                else        
+                {
+                    if ( item->IsSeparator() )
+                    {
+                        if ( mh )
+                            MacAppendMenu(mh, "\p-" );
+                    }
+                    else
+                    {
+                        wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
+
+                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
+                        { 
+                                UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText()  );
+                                UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
+                                SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
+                                UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
+                         }
+                        else
+                        {
+                            if ( mh )
+                            {
+                                UMAAppendMenuItem(mh, item->GetText()  , entry );
+                                SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
+                            }
+                        }
+                        
+                        delete entry ;
+                    }
+                }
+            }
+        }
+        else
+        {
+            UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
+            wxArrayPtrVoid submenus ;
+            wxMenuItem* previousItem = NULL ;
+              for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
+              {
+                 item = (wxMenuItem *)node->GetData();
+                 subMenu = item->GetSubMenu() ;
+                if (subMenu)             
+                {
+                  submenus.Add(subMenu) ;
+                }
+                else
+                {
 #if TARGET_CARBON
-                                       if ( UMAGetSystemVersion() >= 0x1000 )
-                                       {
-                                               if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
-                                               {
-                                                       ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
-                                                       if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
-                                                       {
-                                                               ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
-                                                       }
-                                               }
-                                       }
-#endif 
-                               }
-                               previousItem = item ;
-                       }
-                       ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
-                       for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
-                       {
-                           wxMenu* submenu = (wxMenu*) submenus[i] ;
-               wxMenuItemList::Node *subnode;
-               wxMenuItem *subitem;
-               int subpos ;
+                    if ( UMAGetSystemVersion() >= 0x1000 )
+                    {
+                        if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
+                        {
+                            ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
+                            if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
+                            {
+                                ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
+                            }
+                        }
+                    }
+#endif    
+                }
+                previousItem = item ;
+            }
+            ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
+            for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
+            {
+                wxMenu* submenu = (wxMenu*) submenus[i] ;
+                wxMenuItemList::Node *subnode;
+                wxMenuItem *subitem;
+                int subpos ;
                 for ( subpos = 0 , subnode = submenu->GetMenuItems().GetFirst(); subnode; subnode = subnode->GetNext(), subpos++) 
-                               {
-                                       subitem = (wxMenuItem *)subnode->GetData();
-                                       wxMenu* itsSubMenu = subitem->GetSubMenu() ;
-                                       if (itsSubMenu)                 
-                                       {
-                                               submenus.Add(itsSubMenu) ;
-                                       }                               
-                               }
-                               ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
-                   }
-               }
-       }
-       ::DrawMenuBar() ;
-       s_macInstalledMenuBar = this;
+                  {
+                       subitem = (wxMenuItem *)subnode->GetData();
+                       wxMenu* itsSubMenu = subitem->GetSubMenu() ;
+                      if (itsSubMenu)             
+                      {
+                          submenus.Add(itsSubMenu) ;
+                      }                  
+                  }
+                ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
+            }
+        }
+    }
+    ::DrawMenuBar() ;
+    s_macInstalledMenuBar = this;
 }
 
 void wxMenuBar::EnableTop(size_t pos, bool enable)
 {
     wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
-       m_menus[pos]->MacEnableMenu( enable ) ;
+    m_menus[pos]->MacEnableMenu( enable ) ;
     Refresh();
 }
 
@@ -604,11 +603,11 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
     }
 
     m_menus[pos]->SetTitle( label ) ;
-       if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
-       {
-               ::SetMenuBar( GetMenuBar() ) ;
-               ::InvalMenuBar() ;
-       }
+    if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
+    {
+        ::SetMenuBar( GetMenuBar() ) ;
+        ::InvalMenuBar() ;
+    }
 }
 
 wxString wxMenuBar::GetLabelTop(size_t pos) const
@@ -653,21 +652,21 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
 
     if ( IsAttached() )
     {
-               if (s_macInstalledMenuBar == this)
-               {
-                       ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
-                       {
-                               UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
-                               if ( pos == m_menus.GetCount() - 1)
-                               {
-                                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
-                               }
-                               else
-                               {
-                                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
-                               }
-                       }
-               }
+        if (s_macInstalledMenuBar == this)
+        {
+            ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
+            {
+                UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+                if ( pos == m_menus.GetCount() - 1)
+                {
+                    ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+                }
+                else
+                {
+                    ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
+                }
+            }
+        }
 
         Refresh();
     }
@@ -682,18 +681,18 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
 
     m_titles.Insert(title, pos);
 
-       UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+    UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
 
     if ( IsAttached() )
     {
-       if ( pos == (size_t) -1  || pos + 1 == m_menus.GetCount() )
-               {
-                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
-               }
-               else
-               {
-                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
-               }
+        if ( pos == (size_t) -1  || pos + 1 == m_menus.GetCount() )
+        {
+            ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+        }
+        else
+        {
+            ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
+        }
         Refresh();
     }
 
@@ -708,10 +707,10 @@ wxMenu *wxMenuBar::Remove(size_t pos)
 
     if ( IsAttached() )
     {
-               if (s_macInstalledMenuBar == this)
-               {
-                       ::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
-               }
+        if (s_macInstalledMenuBar == this)
+        {
+            ::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
+        }
 
         menu->Detach();
 
@@ -733,14 +732,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
 
     m_titles.Add(title);
     
-       UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+    UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
 
     if ( IsAttached() )
     {
-               if (s_macInstalledMenuBar == this)
-               {
-                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
-               }
+        if (s_macInstalledMenuBar == this)
+        {
+            ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+        }
 
         Refresh();
     }
index 423440458cc7eba0833ce692bbdf62be6de09c58..ce04c08eda6796d67935ecfa83f9c6ae1cc5f4af 100644 (file)
@@ -66,144 +66,144 @@ wxMenuItem::~wxMenuItem()
 
 void wxMenuItem::SetBitmap(const wxBitmap& bitmap) 
 { 
-       m_bitmap = bitmap; 
-       UpdateItemBitmap() ;
+      m_bitmap = bitmap; 
+      UpdateItemBitmap() ;
 }
 
 void wxMenuItem::UpdateItemBitmap() 
 {
-       if ( !m_parentMenu )
-               return ;
-               
-       MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
-       MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
-       if( mhandle == NULL || index == 0)
-               return ;
-               
-       if ( m_bitmap.Ok() )
-       {
-               ControlButtonContentInfo info ;
-               wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
-               if ( info.contentType != kControlNoContent )
-               {
-                       if ( info.contentType == kControlContentCIconHandle )
-                               SetMenuItemIconHandle( mhandle , index , 
-                                       kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
-           }
-                       
-       }
+    if ( !m_parentMenu )
+        return ;
+        
+    MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
+    MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
+    if( mhandle == NULL || index == 0)
+        return ;
+        
+    if ( m_bitmap.Ok() )
+    {
+        ControlButtonContentInfo info ;
+        wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
+        if ( info.contentType != kControlNoContent )
+        {
+            if ( info.contentType == kControlContentCIconHandle )
+                SetMenuItemIconHandle( mhandle , index , 
+                    kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
+        }
+            
+    }
 }
 
 void wxMenuItem::UpdateItemStatus() 
 {
-       if ( !m_parentMenu )
-               return ;
-               
-       MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
-       MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
-       if( mhandle == NULL || index == 0)
-               return ;
-
-       UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
-       if ( IsCheckable() && IsChecked() )
-               ::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
-       else
-               ::SetItemMark( mhandle , index , 0 ) ; // no mark
-
-       UMASetMenuItemText( mhandle , index , m_text ) ; 
-       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
-       UMASetMenuItemShortcut( mhandle , index , entry ) ;
-       delete entry ;
+    if ( !m_parentMenu )
+        return ;
+        
+    MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
+    MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
+    if( mhandle == NULL || index == 0)
+        return ;
+
+      UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
+      if ( IsCheckable() && IsChecked() )
+        ::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
+    else
+        ::SetItemMark( mhandle , index , 0 ) ; // no mark
+
+       UMASetMenuItemText( mhandle , index , m_text ) ; 
+       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
+    UMASetMenuItemShortcut( mhandle , index , entry ) ;
+    delete entry ;
 }
 
 void wxMenuItem::UpdateItemText() 
 {
-       if ( !m_parentMenu )
-               return ;
-               
-       MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
-       MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
-       if( mhandle == NULL || index == 0)
-               return ;
-
-       UMASetMenuItemText( mhandle , index , m_text ) ; 
-       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
-       UMASetMenuItemShortcut( mhandle , index , entry ) ;
-       delete entry ;
+    if ( !m_parentMenu )
+        return ;
+        
+    MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
+    MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
+    if( mhandle == NULL || index == 0)
+        return ;
+
+       UMASetMenuItemText( mhandle , index , m_text ) ; 
+       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
+    UMASetMenuItemShortcut( mhandle , index , entry ) ;
+    delete entry ;
 }
 
 
 void wxMenuItem::Enable(bool bDoEnable)
 {
-       if ( m_isEnabled != bDoEnable ) 
-       {
-               wxMenuItemBase::Enable( bDoEnable ) ;
-               UpdateItemStatus() ;
-       }
+    if ( m_isEnabled != bDoEnable ) 
+    {
+        wxMenuItemBase::Enable( bDoEnable ) ;
+        UpdateItemStatus() ;
+    }
 }
 void wxMenuItem::UncheckRadio()
 {
-       if ( m_isChecked ) 
-       {
-               wxMenuItemBase::Check( false ) ;
-               UpdateItemStatus() ;
-       }
+    if ( m_isChecked ) 
+    {
+        wxMenuItemBase::Check( false ) ;
+        UpdateItemStatus() ;
+    }
 }
 
 void wxMenuItem::Check(bool bDoCheck)
 {
-       wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
-
-       if ( m_isChecked != bDoCheck ) 
-       {
-               if ( GetKind() == wxITEM_RADIO )
-               {
-                       if ( bDoCheck )
-                       {
-                               wxMenuItemBase::Check( bDoCheck ) ;
-                               UpdateItemStatus() ;
-                               
-                       // get the index of this item in the menu
-                       const wxMenuItemList& items = m_parentMenu->GetMenuItems();
-                       int pos = items.IndexOf(this);
-                       wxCHECK_RET( pos != wxNOT_FOUND,
-                                    _T("menuitem not found in the menu items list?") );
-
-                       // get the radio group range
-                       int start,
-                           end;
-
-                       if ( m_isRadioGroupStart )
-                       {
-                           // we already have all information we need
-                           start = pos;
-                           end = m_radioGroup.end;
-                       }
-                       else // next radio group item
-                       {
-                           // get the radio group end from the start item
-                           start = m_radioGroup.start;
-                           end = items.Item(start)->GetData()->m_radioGroup.end;
-                       }
-
-                       // also uncheck all the other items in this radio group
-                       wxMenuItemList::Node *node = items.Item(start);
-                       for ( int n = start; n <= end && node; n++ )
-                       {
-                           if ( n != pos )
-                           {
-                               ((wxMenuItem*)node->GetData())->UncheckRadio();
-                           }
-                           node = node->GetNext();
-                       }
-                       }
-               }
-               else
-               {
-                       wxMenuItemBase::Check( bDoCheck ) ;
-                       UpdateItemStatus() ;
-               }
-       }
+    wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
+
+    if ( m_isChecked != bDoCheck ) 
+    {
+        if ( GetKind() == wxITEM_RADIO )
+        {
+            if ( bDoCheck )
+            {
+                wxMenuItemBase::Check( bDoCheck ) ;
+                UpdateItemStatus() ;
+                
+                // get the index of this item in the menu
+                const wxMenuItemList& items = m_parentMenu->GetMenuItems();
+                int pos = items.IndexOf(this);
+                wxCHECK_RET( pos != wxNOT_FOUND,
+                             _T("menuitem not found in the menu items list?") );
+
+                // get the radio group range
+                int start,
+                    end;
+
+                if ( m_isRadioGroupStart )
+                {
+                    // we already have all information we need
+                    start = pos;
+                    end = m_radioGroup.end;
+                }
+                else // next radio group item
+                {
+                    // get the radio group end from the start item
+                    start = m_radioGroup.start;
+                    end = items.Item(start)->GetData()->m_radioGroup.end;
+                }
+
+                // also uncheck all the other items in this radio group
+                wxMenuItemList::Node *node = items.Item(start);
+                for ( int n = start; n <= end && node; n++ )
+                {
+                    if ( n != pos )
+                    {
+                        ((wxMenuItem*)node->GetData())->UncheckRadio();
+                    }
+                    node = node->GetNext();
+                }
+            }
+        }
+        else
+        {
+            wxMenuItemBase::Check( bDoCheck ) ;
+            UpdateItemStatus() ;
+        }
+    }
 }
 
 void wxMenuItem::SetText(const wxString& text)
index 1d38499628de470f00b9488c32395e96459b85c7..1f87cb9f4a76c3e472673b1a1da235ffed71805d 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -61,7 +61,7 @@ wxMetafileRefData::~wxMetafileRefData(void)
 {
     if (m_metafile)
     {
-               KillPicture( (PicHandle) m_metafile ) ;
+        KillPicture( (PicHandle) m_metafile ) ;
         m_metafile = 0;
     }
 }
@@ -86,10 +86,10 @@ wxMetaFile::~wxMetaFile()
 bool wxMetaFile::SetClipboard(int width, int height)
 {
 #if wxUSE_DRAG_AND_DROP
-//TODO finishi this port , we need the data obj first
+    //TODO finishi this port , we need the data obj first
     if (!m_refData)
         return FALSE;
-
+    
     bool alreadyOpen=wxTheClipboard->IsOpened() ;
     if (!alreadyOpen)
     {
@@ -97,11 +97,11 @@ bool wxMetaFile::SetClipboard(int width, int height)
         wxTheClipboard->Clear();
     }
     wxDataObject *data =
-      new wxMetafileDataObject( *this) ;
+        new wxMetafileDataObject( *this) ;
     bool success = wxTheClipboard->SetData(data);
     if (!alreadyOpen) 
-      wxTheClipboard->Close();
-           return (bool) success;
+        wxTheClipboard->Close();
+    return (bool) success;
 #endif
     return TRUE ;
 }
@@ -116,17 +116,17 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
 
 bool wxMetaFile::Play(wxDC *dc)
 {
-  if (!m_refData)
-    return FALSE;
-
-       if (!dc->Ok() )
-               return FALSE;
-               
-       {
-               wxMacPortSetter helper( dc ) ;
-               PicHandle pict = (PicHandle) GetHMETAFILE() ;
-               DrawPicture( pict , &(**pict).picFrame ) ;
-       }
+    if (!m_refData)
+        return FALSE;
+    
+    if (!dc->Ok() )
+        return FALSE;
+        
+    {
+        wxMacPortSetter helper( dc ) ;
+        PicHandle pict = (PicHandle) GetHMETAFILE() ;
+        DrawPicture( pict , &(**pict).picFrame ) ;
+    }
     return TRUE;
 }
 
@@ -139,22 +139,22 @@ bool wxMetaFile::Play(wxDC *dc)
 // *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
 wxMetaFileDC::wxMetaFileDC(const wxString& file)
 {
-  m_metaFile = NULL;
-  m_minX = 10000;
-  m_minY = 10000;
-  m_maxX = -10000;
-  m_maxY = -10000;
-
-  wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
-
-  m_metaFile = new wxMetaFile("") ;
-  Rect r={0,0,1000,1000} ;
-       
-  m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
-  ::GetPort( (GrafPtr*) &m_macPort ) ; 
-  m_ok = TRUE ;
-
-  SetMapMode(wxMM_TEXT); 
+    m_metaFile = NULL;
+    m_minX = 10000;
+    m_minY = 10000;
+    m_maxX = -10000;
+    m_maxY = -10000;
+    
+    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    
+    m_metaFile = new wxMetaFile("") ;
+    Rect r={0,0,1000,1000} ;
+    
+    m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
+    ::GetPort( (GrafPtr*) &m_macPort ) ;    
+    m_ok = TRUE ;
+    
+    SetMapMode(wxMM_TEXT); 
 }
 
 // New constructor that takes origin and extent. If you use this, don't
@@ -162,21 +162,21 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
 
 wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
 {
-  m_minX = 10000;
-  m_minY = 10000;
-  m_maxX = -10000;
-  m_maxY = -10000;
-
-  wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
-
-       m_metaFile = new wxMetaFile("") ;
-       Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
-       
-       m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
-       ::GetPort( (GrafPtr*) &m_macPort ) ;    
-  m_ok = TRUE ;
-
-  SetMapMode(wxMM_TEXT); 
+    m_minX = 10000;
+    m_minY = 10000;
+    m_maxX = -10000;
+    m_maxY = -10000;
+    
+    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    
+    m_metaFile = new wxMetaFile("") ;
+    Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
+    
+    m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
+    ::GetPort( (GrafPtr*) &m_macPort ) ;    
+    m_ok = TRUE ;
+    
+    SetMapMode(wxMM_TEXT); 
 }
 
 wxMetaFileDC::~wxMetaFileDC()
@@ -185,29 +185,29 @@ wxMetaFileDC::~wxMetaFileDC()
 
 wxMetaFile *wxMetaFileDC::Close()
 {
-       ClosePicture() ;
-       return m_metaFile;
+    ClosePicture() ;
+    return m_metaFile;
 }
 
 #if wxUSE_DATAOBJ
 size_t wxMetafileDataObject::GetDataSize() const
 {
-  return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
+    return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
 }
 
 bool wxMetafileDataObject::GetDataHere(void *buf) const
 {
-  memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
-    GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
-  return true ;
+    memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
+        GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
+    return true ;
 }
 
 bool wxMetafileDataObject::SetData(size_t len, const void *buf)
 {
-  Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
-  SetHandleSize( handle , len ) ;
-  memcpy( *handle , buf , len ) ;
-  return true ;
+    Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
+    SetHandleSize( handle , len ) ;
+    memcpy( *handle , buf , len ) ;
+    return true ;
 }
 #endif
 
index 0306d07f2c75aace22699292b4dc2c0d7c7d0086..de41b17423833e54f979857dd1f20ca0f00f1389 100644 (file)
@@ -105,7 +105,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const
 
 size_t
 wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
-                              const wxFileType::MessageParameters& params) const
+                   const wxFileType::MessageParameters& params) const
 {
     wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
     return 0;
index 4cd78d710037aa875b4df5b285ac747e9e1d95e1..6b49b9bdc74542e9dc97c5b87d83b06901742a35 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index c7f38f17b7815555dd95fd49b19c2f2a66f26488..f7a4a0a7248189ccbb5de42250e094bbcc469a35 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -27,33 +27,33 @@ short language = 0 ;
 void wxMacConvertNewlines( const char *source , char * destination ) ;
 void wxMacConvertNewlines( const char *source , char * destination )
 {
-       const char *s = source ;
-       char *d = destination ;
-       
-       while( *s  )
-       {
-               switch( *s )
-               {
-                       case 0x0a :
-                               *d++ = 0x0d ;
-                               ++s ;
-                               break ;
-                       case 0x0d :
-                               *d++ = 0x0d ;
-                               ++s ;
-                               if ( *s == 0x0a )
-                                       ++s ;
-                               break ;
-                       default :
-                               *d++ = *s++ ;
-                               break ;
-               }
-       }
-       *d = 0 ;
+    const char *s = source ;
+    char *d = destination ;
+    
+    while( *s  )
+    {
+        switch( *s )
+        {
+        case 0x0a :
+            *d++ = 0x0d ;
+            ++s ;
+            break ;
+        case 0x0d :
+            *d++ = 0x0d ;
+            ++s ;
+            if ( *s == 0x0a )
+                ++s ;
+            break ;
+        default :
+            *d++ = *s++ ;
+            break ;
+        }
+    }
+    *d = 0 ;
 }
 
 wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
-        long style, const wxPoint& pos)
+                                 long style, const wxPoint& pos)
 {
     m_caption = caption;
     m_message = message;
@@ -63,252 +63,252 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
 
 int wxMessageDialog::ShowModal()
 {
-       int resultbutton = wxID_CANCEL ;
-
-       short result ;
-
-       wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
-
-       AlertType alertType = kAlertPlainAlert ;
-       if (m_dialogStyle & wxICON_EXCLAMATION)
-               alertType = kAlertNoteAlert ;
-       else if (m_dialogStyle & wxICON_HAND)
-               alertType = kAlertStopAlert ;
-       else if (m_dialogStyle & wxICON_INFORMATION)
-               alertType = kAlertNoteAlert ;
-       else if (m_dialogStyle & wxICON_QUESTION)
-               alertType = kAlertCautionAlert ;
-
+    int resultbutton = wxID_CANCEL ;
+    
+    short result ;
+    
+    wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
+    
+    AlertType alertType = kAlertPlainAlert ;
+    if (m_dialogStyle & wxICON_EXCLAMATION)
+        alertType = kAlertNoteAlert ;
+    else if (m_dialogStyle & wxICON_HAND)
+        alertType = kAlertStopAlert ;
+    else if (m_dialogStyle & wxICON_INFORMATION)
+        alertType = kAlertNoteAlert ;
+    else if (m_dialogStyle & wxICON_QUESTION)
+        alertType = kAlertCautionAlert ;
+    
 #if TARGET_CARBON
-       if ( UMAGetSystemVersion() >= 0x1000 )
-       {
-               AlertStdCFStringAlertParamRec param ;
-               CFStringRef cfNoString = NULL ;
-               CFStringRef cfYesString = NULL ;
-
-               CFStringRef cfTitle = NULL;
-               CFStringRef cfText = NULL;
-               
-               cfTitle = wxMacCreateCFString( m_caption ) ;
-               cfText = wxMacCreateCFString( m_message ) ;
-               cfNoString = wxMacCreateCFString( _("No") ) ;
-               cfYesString = wxMacCreateCFString( _("Yes") ) ;
-               
-               param.movable = true;
-               param.flags = 0 ;
-               
-               bool skipDialog = false ;
-               
-               if (m_dialogStyle & wxYES_NO)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-                               param.defaultText       = cfYesString ;
-                               param.cancelText        = (CFStringRef) kAlertDefaultCancelText;
-                               param.otherText         = cfNoString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = kAlertStdAlertCancelButton;
-                   }
-                   else
-                   {
-                               param.defaultText       = cfYesString ;
-                               param.cancelText        = NULL;
-                               param.otherText         = cfNoString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-               }
-               else if (m_dialogStyle & wxOK)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-               // thats a cancel missing
-                               param.defaultText       = (CFStringRef) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-                   else
-                   {
-                               param.defaultText       = (CFStringRef) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                       }
-               }
-               else
-               {
-                       skipDialog = true ;
-               }
-               
-               param.position = kWindowDefaultPosition;
-               if ( !skipDialog )
-               {
-                       DialogRef alertRef ;
-                       CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
-                       RunStandardAlert( alertRef , NULL , &result ) ;
-               }
-               if(cfTitle != NULL)
-               CFRelease(cfTitle);   
-               if(cfText != NULL)
-               CFRelease(cfText);   
-               if(cfNoString != NULL)
-               CFRelease(cfNoString);   
-               if(cfYesString != NULL)
-               CFRelease(cfYesString);   
-       if ( skipDialog )
-               return wxID_CANCEL ;
-  }
-  else
+    if ( UMAGetSystemVersion() >= 0x1000 )
+    {
+        AlertStdCFStringAlertParamRec param ;
+        CFStringRef cfNoString = NULL ;
+        CFStringRef cfYesString = NULL ;
+        
+        CFStringRef cfTitle = NULL;
+        CFStringRef cfText = NULL;
+        
+        cfTitle = wxMacCreateCFString( m_caption ) ;
+        cfText = wxMacCreateCFString( m_message ) ;
+        cfNoString = wxMacCreateCFString( _("No") ) ;
+        cfYesString = wxMacCreateCFString( _("Yes") ) ;
+        
+        param.movable = true;
+        param.flags = 0 ;
+        
+        bool skipDialog = false ;
+        
+        if (m_dialogStyle & wxYES_NO)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                param.defaultText     = cfYesString ;
+                param.cancelText     = (CFStringRef) kAlertDefaultCancelText;
+                param.otherText     = cfNoString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = kAlertStdAlertCancelButton;
+            }
+            else
+            {
+                param.defaultText     = cfYesString ;
+                param.cancelText     = NULL;
+                param.otherText     = cfNoString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else if (m_dialogStyle & wxOK)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                // thats a cancel missing
+                param.defaultText     = (CFStringRef) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+            else
+            {
+                param.defaultText     = (CFStringRef) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else
+        {
+            skipDialog = true ;
+        }
+        
+        param.position = kWindowDefaultPosition;
+        if ( !skipDialog )
+        {
+            DialogRef alertRef ;
+            CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
+            RunStandardAlert( alertRef , NULL , &result ) ;
+        }
+        if(cfTitle != NULL)
+            CFRelease(cfTitle);   
+        if(cfText != NULL)
+            CFRelease(cfText);   
+        if(cfNoString != NULL)
+            CFRelease(cfNoString);   
+        if(cfYesString != NULL)
+            CFRelease(cfYesString);   
+        if ( skipDialog )
+            return wxID_CANCEL ;
+    }
+    else
 #endif
-  {
-               AlertStdAlertParamRec   param;
-               char   cText[2048] ;
-               
-               if (wxApp::s_macDefaultEncodingIsPC)
-               {
-                       strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
-               }
-               else
-               {
-                       strcpy( cText , m_message ) ;
-               }
-               wxMacConvertNewlines( cText , cText ) ;
-       
-               Str255 yesPString ;
-               Str255 noPString ;
-
-               Str255 pascalTitle ;
-               Str255 pascalText ;
-               wxMacStringToPascal( m_caption , pascalTitle ) ;
-               wxMacStringToPascal( _("Yes") , yesPString ) ;
-               wxMacStringToPascal(  _("No") , noPString ) ;
-               CopyCStringToPascal( cText , pascalText ) ;
-               
-               param.movable           = true;
-       param.filterProc        = NULL ;
-               if (m_dialogStyle & wxYES_NO)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-                               param.defaultText       = yesPString ;
-                               param.cancelText        = (StringPtr) kAlertDefaultCancelText;
-                               param.otherText         = noPString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = kAlertStdAlertCancelButton;
-                   }
-                   else
-                   {
-                               param.defaultText       = yesPString ;
-                               param.cancelText        = NULL;
-                               param.otherText         = noPString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-               }
-               else if (m_dialogStyle & wxOK)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-               // thats a cancel missing
-                               param.defaultText       = (StringPtr) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-                   else
-                   {
-                               param.defaultText       = (StringPtr) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                       }
-               }
-               else
-               {
-                       return resultbutton ;
-               }
-
-               param.position          = 0;
-
-               StandardAlert( alertType, pascalTitle, pascalText, &param, &result );
-       }
-
-       if (m_dialogStyle & wxOK)
-       {
-               if (m_dialogStyle & wxCANCEL)                           
-               {
-                       //TODO add Cancelbutton
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_OK ;
-                                       break ;
-                               case 2 :
-                                       break ;
-                               case 3 :
-                                       break ;
-                       }
-               }
-               else
-               {
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_OK ;
-                                       break ;
-                               case 2 :
-                                       break ;
-                               case 3 :
-                                       break ;
-                       }
-               }
-       }
-       else if (m_dialogStyle & wxYES_NO)
-       {
-               if (m_dialogStyle & wxCANCEL)
-               {
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_YES ;
-                                       break ;
-                               case 2 :
-                                       resultbutton = wxID_CANCEL ;
-                                       break ;
-                               case 3 :
-                                       resultbutton = wxID_NO ;
-                                       break ;
-                       }
-               }
-               else
-               {
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_YES ;
-                                       break ;
-                               case 2 :
-                                       break ;
-                               case 3 :
-                                       resultbutton = wxID_NO ;
-                                       break ;
-                       }
-               }
-       
-
-       return resultbutton ;
+    {
+        AlertStdAlertParamRec    param;
+        char   cText[2048] ;
+        
+        if (wxApp::s_macDefaultEncodingIsPC)
+        {
+            strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
+        }
+        else
+        {
+            strcpy( cText , m_message ) ;
+        }
+        wxMacConvertNewlines( cText , cText ) ;
+        
+        Str255 yesPString ;
+        Str255 noPString ;
+        
+        Str255 pascalTitle ;
+        Str255 pascalText ;
+        wxMacStringToPascal( m_caption , pascalTitle ) ;
+        wxMacStringToPascal( _("Yes") , yesPString ) ;
+        wxMacStringToPascal(  _("No") , noPString ) ;
+        CopyCStringToPascal( cText , pascalText ) ;
+        
+        param.movable         = true;
+        param.filterProc     = NULL ;
+        if (m_dialogStyle & wxYES_NO)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                param.defaultText     = yesPString ;
+                param.cancelText     = (StringPtr) kAlertDefaultCancelText;
+                param.otherText     = noPString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = kAlertStdAlertCancelButton;
+            }
+            else
+            {
+                param.defaultText     = yesPString ;
+                param.cancelText     = NULL;
+                param.otherText     = noPString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else if (m_dialogStyle & wxOK)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                // thats a cancel missing
+                param.defaultText     = (StringPtr) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+            else
+            {
+                param.defaultText     = (StringPtr) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else
+        {
+            return resultbutton ;
+        }
+        
+        param.position         = 0;
+        
+        StandardAlert( alertType, pascalTitle, pascalText, &param, &result );
+    }
+    
+    if (m_dialogStyle & wxOK)
+    {
+        if (m_dialogStyle & wxCANCEL)                
+        {
+            //TODO add Cancelbutton
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_OK ;
+                break ;
+            case 2 :
+                break ;
+            case 3 :
+                break ;
+            }
+        }
+        else
+        {
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_OK ;
+                break ;
+            case 2 :
+                break ;
+            case 3 :
+                break ;
+            }
+        }
+    }
+    else if (m_dialogStyle & wxYES_NO)
+    {
+        if (m_dialogStyle & wxCANCEL)
+        {
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_YES ;
+                break ;
+            case 2 :
+                resultbutton = wxID_CANCEL ;
+                break ;
+            case 3 :
+                resultbutton = wxID_NO ;
+                break ;
+            }
+        }
+        else
+        {
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_YES ;
+                break ;
+            case 2 :
+                break ;
+            case 3 :
+                resultbutton = wxID_NO ;
+                break ;
+            }
+        }
+    } 
+    
+    return resultbutton ;
 }
 
index 6ba640fe91e0b2778e60ce795e692bc870f25386..33c40fe4486fe485d9e4d1b1794fdf8cbe507394 100644 (file)
@@ -10,7 +10,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-  #pragma implementation "notebook.h"
+#pragma implementation "notebook.h"
 #endif
 
 // ============================================================================
 
 static bool constantsSet = false ;
 
- short kwxMacTabLeftMargin = 0 ;
- short kwxMacTabTopMargin = 0 ;
- short kwxMacTabRightMargin = 0 ;
- short kwxMacTabBottomMargin = 0 ;
+short kwxMacTabLeftMargin = 0 ;
+short kwxMacTabTopMargin = 0 ;
+short kwxMacTabRightMargin = 0 ;
+short kwxMacTabBottomMargin = 0 ;
 
 // ----------------------------------------------------------------------------
 // event table
@@ -49,12 +49,12 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
 
 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
-    EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
-    EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
-    
-    EVT_SIZE(wxNotebook::OnSize)
-    EVT_SET_FOCUS(wxNotebook::OnSetFocus)
-    EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
+EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
+EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
+
+EVT_SIZE(wxNotebook::OnSize)
+EVT_SET_FOCUS(wxNotebook::OnSetFocus)
+EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
@@ -76,7 +76,7 @@ void wxNotebook::Init()
     {
         if ( UMAHasAquaLayout() )
         {
-      // I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
+            // I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
             kwxMacTabLeftMargin = 20 ;
             kwxMacTabTopMargin = 38 ;
             kwxMacTabRightMargin = 20 ;
@@ -96,7 +96,7 @@ void wxNotebook::Init()
         m_macHorizontalBorder = 7;
         m_macVerticalBorder = 8;
     }
-
+    
     m_nSelection = -1;
 }
 
@@ -115,7 +115,7 @@ wxNotebook::wxNotebook(wxWindow *parent,
                        const wxString& name)
 {
     Init();
-
+    
     Create(parent, id, pos, size, style, name);
 }
 
@@ -127,31 +127,31 @@ bool wxNotebook::Create(wxWindow *parent,
                         long style,
                         const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       int tabstyle = kControlTabSmallNorthProc ;
-       if ( HasFlag(wxNB_LEFT) )
-               tabstyle = kControlTabSmallWestProc ;
-       else if ( HasFlag( wxNB_RIGHT ) )
-               tabstyle = kControlTabSmallEastProc ;
-       else if ( HasFlag( wxNB_BOTTOM ) )
-               tabstyle = kControlTabSmallSouthProc ;
-
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               tabstyle , (long) this ) ;
-       
-       MacPostControlCreate() ;
-       return TRUE ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    
+    int tabstyle = kControlTabSmallNorthProc ;
+    if ( HasFlag(wxNB_LEFT) )
+        tabstyle = kControlTabSmallWestProc ;
+    else if ( HasFlag( wxNB_RIGHT ) )
+        tabstyle = kControlTabSmallEastProc ;
+    else if ( HasFlag( wxNB_BOTTOM ) )
+        tabstyle = kControlTabSmallSouthProc ;
+    
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+        tabstyle , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    return TRUE ;
 }
 
 // dtor
 wxNotebook::~wxNotebook()
 {
-       m_macControl = NULL ;
+    m_macControl = NULL ;
 }
 
 wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
@@ -162,7 +162,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
     wxGetOsVersion( &major, &minor );
     
     // Mac has large notebook borders. Aqua even more so.
-
+    
     if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
     {
         sizeTotal.x += 90;
@@ -185,7 +185,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
             sizeTotal.y += 44;
         }
     }
-
+    
     return sizeTotal;
 }
 
@@ -195,7 +195,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
 
 void wxNotebook::SetPadding(const wxSize& padding)
 {
-   wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
+    wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
 }
 
 void wxNotebook::SetTabSize(const wxSize& sz)
@@ -210,12 +210,12 @@ void wxNotebook::SetPageSize(const wxSize& size)
 
 int wxNotebook::SetSelection(int nPage)
 {
-  if( !IS_VALID_PAGE(nPage) ) 
-    return m_nSelection ;
-
+    if( !IS_VALID_PAGE(nPage) ) 
+        return m_nSelection ;
+    
     ChangePage(m_nSelection, nPage);
-       SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
-
+    SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
+    
     Refresh();
     return m_nSelection;
 }
@@ -223,18 +223,18 @@ int wxNotebook::SetSelection(int nPage)
 bool wxNotebook::SetPageText(int nPage, const wxString& strText)
 {
     wxASSERT( IS_VALID_PAGE(nPage) );
-
+    
     wxNotebookPage *page = m_pages[nPage];
     page->SetLabel(strText);
     MacSetupTabs();
-
+    
     return true;
 }
 
 wxString wxNotebook::GetPageText(int nPage) const
 {
     wxASSERT( IS_VALID_PAGE(nPage) );
-
+    
     wxNotebookPage *page = m_pages[nPage];
     return page->GetLabel();
 }
@@ -242,27 +242,27 @@ wxString wxNotebook::GetPageText(int nPage) const
 int wxNotebook::GetPageImage(int nPage) const
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") );
-
+    
     return m_images[nPage];
 }
 
 bool wxNotebook::SetPageImage(int nPage, int nImage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
-
+    
     wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
-                 _T("invalid image index in SetPageImage()") );
-
+        _T("invalid image index in SetPageImage()") );
+    
     if ( nImage != m_images[nPage] )
     {
         // if the item didn't have an icon before or, on the contrary, did have
         // it but has lost it now, its size will change - but if the icon just
         // changes, it won't
         m_images[nPage] = nImage;
-
-               MacSetupTabs() ;
+        
+        MacSetupTabs() ;
     }
-
+    
     return TRUE;
 }
 
@@ -276,9 +276,9 @@ wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
     wxCHECK( IS_VALID_PAGE(nPage), NULL );
     wxNotebookPage* page = m_pages[nPage] ;
     m_pages.RemoveAt(nPage);
-
+    
     MacSetupTabs();
-
+    
     if(m_nSelection >= GetPageCount()) {
         m_nSelection = GetPageCount() - 1;
     }
@@ -292,10 +292,10 @@ wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
 bool wxNotebook::DeleteAllPages()
 {
     // TODO: delete native widget pages
-
+    
     WX_CLEAR_ARRAY(m_pages) ;
     MacSetupTabs();
-
+    
     return TRUE;
 }
 
@@ -309,16 +309,16 @@ bool wxNotebook::InsertPage(int nPage,
 {
     wxASSERT( pPage != NULL );
     wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
-
+    
     pPage->SetLabel(strText);
-
+    
     // save the pointer to the page
     m_pages.Insert(pPage, nPage);
-
+    
     m_images.Insert(imageId, nPage);
-
+    
     MacSetupTabs();
-
+    
     if ( bSelect ) {
         m_nSelection = nPage;
     }
@@ -330,69 +330,69 @@ bool wxNotebook::InsertPage(int nPage,
     }
     // don't show pages by default (we'll need to adjust their size first)
     pPage->Show( false ) ;
-
+    
     int h, w;
     GetSize(&w, &h);
     pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
-                   w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
-                   h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
+        w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
+        h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
     if ( pPage->GetAutoLayout() ) {
         pPage->Layout();
     }
-
+    
     return true;
 }
 
 /* Added by Mark Newsam
- * When a page is added or deleted to the notebook this function updates
- * information held in the m_macControl so that it matches the order
- * the user would expect.
- */
+* When a page is added or deleted to the notebook this function updates
+* information held in the m_macControl so that it matches the order
+* the user would expect.
+*/
 void wxNotebook::MacSetupTabs()
 {
     SetControl32BitMaximum( (ControlHandle) m_macControl , GetPageCount() ) ;
-
+    
     wxNotebookPage *page;
     ControlTabInfoRec info;
-
+    
     for(int ii = 0; ii < GetPageCount(); ii++)
     {
         page = m_pages[ii];
         info.version = 0;
         info.iconSuiteID = 0;
 #if TARGET_CARBON
-               c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
+        c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
 #else
-               strcpy( (char *) info.name , page->GetLabel() ) ;
-               c2pstr( (char *) info.name ) ;
+        strcpy( (char *) info.name , page->GetLabel() ) ;
+        c2pstr( (char *) info.name ) ;
 #endif
         SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
-                        sizeof( ControlTabInfoRec) , (char*) &info ) ;
+            sizeof( ControlTabInfoRec) , (char*) &info ) ;
         SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
-
+        
 #if TARGET_CARBON
         if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
         {
-               // tab controls only support very specific types of images, therefore we are doing an odyssee
-               // accross the icon worlds (even Apple DTS did not find a shorter path)
-               // in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
-               // afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we 
-               // unregister it) in case this will ever lead to having the same icon everywhere add some kind
-               // of static counter 
-               ControlButtonContentInfo info ;
-               wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
-               IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
-               OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
+            // tab controls only support very specific types of images, therefore we are doing an odyssee
+            // accross the icon worlds (even Apple DTS did not find a shorter path)
+            // in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
+            // afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we 
+            // unregister it) in case this will ever lead to having the same icon everywhere add some kind
+            // of static counter 
+            ControlButtonContentInfo info ;
+            wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
+            IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
+            OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
             wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
-               IconRef iconRef ;
-               err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
+            IconRef iconRef ;
+            err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
             wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
-               info.contentType = kControlContentIconRef ;
-               info.u.iconRef = iconRef ;
-               SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
-                        sizeof( info ), (Ptr)&info );
+            info.contentType = kControlContentIconRef ;
+            info.u.iconRef = iconRef ;
+            SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
+                sizeof( info ), (Ptr)&info );
             wxASSERT_MSG( err == noErr , "Error when setting icon on tab" ) ;
-               UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
+               UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
             ReleaseIconRef( iconRef ) ;
             DisposeHandle( (Handle) iconFamily ) ;
         }
@@ -416,22 +416,22 @@ void wxNotebook::OnSize(wxSizeEvent& event)
     int nSel = m_nSelection;
     m_nSelection = -1;
     SetSelection(nSel);
-
+    
     // fit the notebook page to the tab control's display area
     int w, h;
     GetSize(&w, &h);
-
+    
     unsigned int nCount = m_pages.Count();
     for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
         wxNotebookPage *pPage = m_pages[nPage];
         pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
-                       w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
-                       h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
+            w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
+            h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
         if ( pPage->GetAutoLayout() ) {
             pPage->Layout();
         }
     }
-
+    
     // Processing continues to next OnSize
     event.Skip();
 }
@@ -441,7 +441,7 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event)
     // is it our tab control?
     if ( event.GetEventObject() == this )
         ChangePage(event.GetOldSelection(), event.GetSelection());
-
+    
     // we want to give others a chance to process this message as well
     event.Skip();
 }
@@ -451,7 +451,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event)
     // set focus to the currently selected page if any
     if ( m_nSelection != -1 )
         m_pages[m_nSelection]->SetFocus();
-
+    
     event.Skip();
 }
 
@@ -509,93 +509,93 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
         pPage->SetFocus();
         return;
     }
-
+    
     // Hide previous page
     if ( nOldSel != -1 ) {
         m_pages[nOldSel]->Show(FALSE);
     }
-
+    
     wxNotebookPage *pPage = m_pages[nSel];
     pPage->Show(TRUE);
     pPage->SetFocus();
-
+    
     m_nSelection = nSel;
 }
 
 
 void  wxNotebook::OnMouse( wxMouseEvent &event )
 {
-   if ( (ControlHandle) m_macControl == NULL )
-   {
-      event.Skip() ;
-      return ;
-   }
-
-   if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
-   {
-      int x = event.m_x ;
-      int y = event.m_y ;
-
-      MacClientToRootWindow( &x , &y ) ;
-
-      ControlHandle   control ;
-      Point       localwhere ;
-      SInt16      controlpart ;
-
-      localwhere.h = x ;
-      localwhere.v = y ;
-
-      short modifiers = 0;
-
-      if ( !event.m_leftDown && !event.m_rightDown )
-           modifiers  |= btnState ;
-
-      if ( event.m_shiftDown )
-           modifiers |= shiftKey ;
-
-      if ( event.m_controlDown )
-           modifiers |= controlKey ;
-
-      if ( event.m_altDown )
-           modifiers |= optionKey ;
-
-      if ( event.m_metaDown )
-           modifiers |= cmdKey ;
-
-      control = (ControlHandle) m_macControl ;
-      if ( control && ::IsControlActive( control ) )
-      {
-           {
-            wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
-                                    ::GetControl32BitValue(control) - 1, m_nSelection);
-               changing.SetEventObject(this);
-               ProcessEvent(changing);
-               if(changing.IsAllowed())
-               {
-              controlpart = ::HandleControlClick(control, localwhere, modifiers,
-                                                 (ControlActionUPP) -1);
-              wxTheApp->s_lastMouseDown = 0 ;
-     
-              wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
-                                    ::GetControl32BitValue(control) - 1, m_nSelection);
-              event.SetEventObject(this);
-     
-              ProcessEvent(event);
-               }
-           }
-       }
-   }
+    if ( (ControlHandle) m_macControl == NULL )
+    {
+        event.Skip() ;
+        return ;
+    }
+    
+    if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
+    {
+        int x = event.m_x ;
+        int y = event.m_y ;
+        
+        MacClientToRootWindow( &x , &y ) ;
+        
+        ControlHandle   control ;
+        Point       localwhere ;
+        SInt16      controlpart ;
+        
+        localwhere.h = x ;
+        localwhere.v = y ;
+        
+        short modifiers = 0;
+        
+        if ( !event.m_leftDown && !event.m_rightDown )
+            modifiers  |= btnState ;
+        
+        if ( event.m_shiftDown )
+            modifiers |= shiftKey ;
+        
+        if ( event.m_controlDown )
+            modifiers |= controlKey ;
+        
+        if ( event.m_altDown )
+            modifiers |= optionKey ;
+        
+        if ( event.m_metaDown )
+            modifiers |= cmdKey ;
+        
+        control = (ControlHandle) m_macControl ;
+        if ( control && ::IsControlActive( control ) )
+        {
+            {
+                wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
+                    ::GetControl32BitValue(control) - 1, m_nSelection);
+                changing.SetEventObject(this);
+                ProcessEvent(changing);
+                
+                if(changing.IsAllowed())
+                {
+                    controlpart = ::HandleControlClick(control, localwhere, modifiers,
+                        (ControlActionUPP) -1);
+                    wxTheApp->s_lastMouseDown = 0 ;
+                    
+                    wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
+                        ::GetControl32BitValue(control) - 1, m_nSelection);
+                    event.SetEventObject(this);
+                    
+                    ProcessEvent(event);
+                }
+            }
+        }
+    }
 }
+
 
 void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
 #if 0
-  wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
-  event.SetEventObject(this);
-
-  ProcessEvent(event);
+    wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
+    event.SetEventObject(this);
+    
+    ProcessEvent(event);
 #endif
 }
 
index 5fd459da77c82208aa2cd55d9189ef2b398db854..60a0de6a8a57792b32270aa48ef3b1c3f21f9748 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -30,8 +30,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
 
 wxPaletteRefData::wxPaletteRefData()
 {
-       m_palette = NULL ;
-       m_count = 0 ;
+    m_palette = NULL ;
+    m_count = 0 ;
 }
 
 wxPaletteRefData::~wxPaletteRefData()
@@ -57,41 +57,41 @@ wxPalette::~wxPalette()
 
 bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
 {
-  UnRef();
-
-  m_refData = new wxPaletteRefData;
-
-  M_PALETTEDATA->m_count = n ;
-  M_PALETTEDATA->m_palette = new wxColour[n] ;
-  
-  for ( int i = 0 ; i < n ; ++i)
-  {
-       M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
-       }
-
-  return FALSE;
+    UnRef();
+    
+    m_refData = new wxPaletteRefData;
+    
+    M_PALETTEDATA->m_count = n ;
+    M_PALETTEDATA->m_palette = new wxColour[n] ;
+    
+    for ( int i = 0 ; i < n ; ++i)
+    {
+        M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
+    }
+    
+    return FALSE;
 }
 
 int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
 {
     if ( !m_refData )
-       return -1;
-
+        return -1;
+    
     long bestdiff = 3 * 256 ;
     long bestpos = 0 ;
     long currentdiff ;
     
     for ( int i = 0  ; i < M_PALETTEDATA->m_count ; ++i )
     {
-       const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
-       currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue )  ;
-       if ( currentdiff < bestdiff )
-       {
-               bestdiff = currentdiff ;
-               bestpos = i ;
-               if ( bestdiff == 0 )
-                       break ; 
-       }
+        const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
+        currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue )  ;
+        if ( currentdiff < bestdiff )
+        {
+            bestdiff = currentdiff ;
+            bestpos = i ;
+            if ( bestdiff == 0 )
+                break ; 
+        }
     }
     
     return bestpos;
@@ -100,11 +100,11 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
 bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
 {
     if ( !m_refData )
-           return FALSE;
-
+        return FALSE;
+    
     if (index < 0 || index >= M_PALETTEDATA->m_count)
         return FALSE;
-
+    
     const wxColour& col = &M_PALETTEDATA->m_palette[index] ;
     *red = col.Red() ;
     *green = col.Green() ;
@@ -114,5 +114,5 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi
 }
 
 #endif
-    // wxUSE_PALETTE
+// wxUSE_PALETTE
 
index 3c3d9f033b40341f57fe56c31dc5c9764a1d42b0..fea55ab34eb7394f3f30661355ad70238b4056af 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -32,7 +32,7 @@ wxPenRefData::wxPenRefData()
 }
 
 wxPenRefData::wxPenRefData(const wxPenRefData& data)
-    : wxGDIRefData()
+: wxGDIRefData()
 {
     m_style = data.m_style;
     m_width = data.m_width;
@@ -61,7 +61,7 @@ wxPen::~wxPen()
 wxPen::wxPen(const wxColour& col, int Width, int Style)
 {
     m_refData = new wxPenRefData;
-
+    
     M_PENDATA->m_colour = col;
     M_PENDATA->m_width = Width;
     M_PENDATA->m_style = Style;
@@ -69,14 +69,14 @@ wxPen::wxPen(const wxColour& col, int Width, int Style)
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_dash = 0 ;
-
+    
     RealizeResource();
 }
 
 wxPen::wxPen(const wxBitmap& stipple, int Width)
 {
     m_refData = new wxPenRefData;
-
+    
     M_PENDATA->m_stipple = stipple;
     M_PENDATA->m_width = Width;
     M_PENDATA->m_style = wxSTIPPLE;
@@ -84,102 +84,102 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_dash = 0 ;
-
+    
     RealizeResource();
 }
 
 void wxPen::Unshare()
 {
-       // Don't change shared data
-       if (!m_refData)
+    // Don't change shared data
+    if (!m_refData)
     {
-               m_refData = new wxPenRefData();
-       }
+        m_refData = new wxPenRefData();
+    }
     else
     {
-               wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
-               UnRef();
-               m_refData = ref;
-       }
+        wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
+        UnRef();
+        m_refData = ref;
+    }
 }
 
 void wxPen::SetColour(const wxColour& col)
 {
     Unshare();
-
+    
     M_PENDATA->m_colour = col;
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
 {
     Unshare();
-
+    
     M_PENDATA->m_colour.Set(r, g, b);
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetWidth(int Width)
 {
     Unshare();
-
+    
     M_PENDATA->m_width = Width;
-
+    
     RealizeResource();
 }
 
 void wxPen::SetStyle(int Style)
 {
     Unshare();
-
+    
     M_PENDATA->m_style = Style;
-
+    
     RealizeResource();
 }
 
 void wxPen::SetStipple(const wxBitmap& Stipple)
 {
     Unshare();
-
+    
     M_PENDATA->m_stipple = Stipple;
     M_PENDATA->m_style = wxSTIPPLE;
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
 {
     Unshare();
-
+    
     M_PENDATA->m_nbDash = nb_dashes;
     M_PENDATA->m_dash = (wxDash *)Dash;
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetJoin(int Join)
 {
     Unshare();
-
+    
     M_PENDATA->m_join = Join;
-
+    
     RealizeResource();
 }
 
 void wxPen::SetCap(int Cap)
 {
     Unshare();
-
+    
     M_PENDATA->m_cap = Cap;
-
+    
     RealizeResource();
 }
 
 bool wxPen::RealizeResource()
 {
-       // nothing to do here for mac
+    // nothing to do here for mac
     return TRUE;
 }
 
index 52b07f6e600227ebe5ba3b31c500000c76e0edce..4f33c04b1e2988e434c1b12386dd3c1b0d8505ac 100644 (file)
@@ -57,8 +57,8 @@ extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
 void
 ima_png_error(png_struct *png_ptr, char *message)
 {
-       wxMessageBox(message, "PNG error");
-  longjmp(png_ptr->jmpbuf, 1);
+    wxMessageBox(message, "PNG error");
+    longjmp(png_ptr->jmpbuf, 1);
 }
 
 
@@ -67,68 +67,68 @@ wxPalette *wxCopyPalette(const wxPalette *cmap);
 
 wxPNGReader::wxPNGReader(void)
 {
-  filetype = 0;
-  RawImage = NULL;      //  Image data
-
-  Width = 0; Height = 0;       //  Dimensions
-  Depth = 0;           // (bits x pixel)
-  ColorType = 0;        // Bit 1 = Palette used
-                  // Bit 2 = Color used
-                  // Bit 3 = Alpha used
-
-  EfeWidth = 0;         // Efective Width
-
-  lpbi = NULL;
-  bgindex = -1;
-  m_palette = 0;
-  imageOK = FALSE;
+    filetype = 0;
+    RawImage = NULL;      //  Image data
+    
+    Width = 0; Height = 0;       //  Dimensions
+    Depth = 0;           // (bits x pixel)
+    ColorType = 0;        // Bit 1 = Palette used
+    // Bit 2 = Color used
+    // Bit 3 = Alpha used
+    
+    EfeWidth = 0;         // Efective Width
+    
+    lpbi = NULL;
+    bgindex = -1;
+    m_palette = 0;
+    imageOK = FALSE;
 }
 
 wxPNGReader::wxPNGReader ( char* ImageFileName )
 {
-  imageOK = FALSE;
-  filetype = 0;
-  RawImage = NULL;      //  Image data
-
-  Width = 0; Height = 0;       //  Dimensions
-  Depth = 0;           // (bits x pixel)
-  ColorType = 0;        // Bit 1 = m_palette used
-                  // Bit 2 = Color used
-                  // Bit 3 = Alpha used
-
-  EfeWidth = 0;         // Efective Width
-
-  lpbi = NULL;
-  bgindex = -1;
-  m_palette = 0;
-
-  imageOK = ReadFile (ImageFileName);
+    imageOK = FALSE;
+    filetype = 0;
+    RawImage = NULL;      //  Image data
+    
+    Width = 0; Height = 0;       //  Dimensions
+    Depth = 0;           // (bits x pixel)
+    ColorType = 0;        // Bit 1 = m_palette used
+    // Bit 2 = Color used
+    // Bit 3 = Alpha used
+    
+    EfeWidth = 0;         // Efective Width
+    
+    lpbi = NULL;
+    bgindex = -1;
+    m_palette = 0;
+    
+    imageOK = ReadFile (ImageFileName);
 }
 
 void
 wxPNGReader::Create(int width, int height, int depth, int colortype)
 {
-  Width = width; Height = height; Depth = depth;
-  ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
-  delete m_palette;
-  m_palette = NULL;
-  delete[] RawImage;
-  RawImage = NULL;
-
-  if (lpbi) {
-       wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
-  }
-  lpbi = wxMacCreateGWorld( Width , Height , Depth);
-  if (lpbi)
-  {
-    EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
-    int bitwidth = width ;
-    if ( EfeWidth > bitwidth )
-       bitwidth = EfeWidth ;
-       
-               RawImage = (byte*) new char[ ( bitwidth * Height * ((Depth+7)>>3) ) ];
-    imageOK = TRUE;
-  }
+    Width = width; Height = height; Depth = depth;
+    ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
+    delete m_palette;
+    m_palette = NULL;
+    delete[] RawImage;
+    RawImage = NULL;
+    
+    if (lpbi) {
+        wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+    }
+    lpbi = wxMacCreateGWorld( Width , Height , Depth);
+    if (lpbi)
+    {
+        EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
+        int bitwidth = width ;
+        if ( EfeWidth > bitwidth )
+            bitwidth = EfeWidth ;
+        
+        RawImage = (byte*) new char[ ( bitwidth * Height * ((Depth+7)>>3) ) ];
+        imageOK = TRUE;
+    }
 }
 
 wxPNGReader::~wxPNGReader ( )
@@ -138,7 +138,7 @@ wxPNGReader::~wxPNGReader ( )
         RawImage = NULL;
     }
     if (lpbi)  {
-       wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+        wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
         lpbi = NULL;
     }
     if (m_palette != NULL) {
@@ -150,128 +150,128 @@ wxPNGReader::~wxPNGReader ( )
 
 int wxPNGReader::GetIndex(int x, int y)
 {
-  if (!Inside(x, y) || (Depth>8)) return -1;
-
-  ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-  int index = (int)(*ImagePointer);
-  return index;
+    if (!Inside(x, y) || (Depth>8)) return -1;
+    
+    ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+    int index = (int)(*ImagePointer);
+    return index;
 }
 
 bool wxPNGReader::GetRGB(int x, int y, byte* r, byte* g, byte* b)
 {
-  if (!Inside(x, y)) return FALSE;
-
-  if (m_palette) {
-   return m_palette->GetRGB(GetIndex(x, y), r, g, b);
-/*   PALETTEENTRY entry;
-   ::GetPaletteEntries((HPALETTE) m_palette->GetHPALETTE(), GetIndex(x, y), 1, &entry);
-   *r = entry.peRed;
-   *g = entry.peGreen;
-   *b = entry.peBlue;  */
-  } else {
-   ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-   *b = ImagePointer[0];
-   *g = ImagePointer[1];
-   *r = ImagePointer[2];
-  }
-  return TRUE;
+    if (!Inside(x, y)) return FALSE;
+    
+    if (m_palette) {
+        return m_palette->GetRGB(GetIndex(x, y), r, g, b);
+        /*   PALETTEENTRY entry;
+        ::GetPaletteEntries((HPALETTE) m_palette->GetHPALETTE(), GetIndex(x, y), 1, &entry);
+        *r = entry.peRed;
+        *g = entry.peGreen;
+        *b = entry.peBlue;  */
+    } else {
+        ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+        *b = ImagePointer[0];
+        *g = ImagePointer[1];
+        *r = ImagePointer[2];
+    }
+    return TRUE;
 }
 
 
 bool wxPNGReader::SetIndex(int x, int y, int index)
 {
-  if (!Inside(x, y) || (Depth>8)) return FALSE;
-
-  ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-  *ImagePointer = index;
-
-  return TRUE;
+    if (!Inside(x, y) || (Depth>8)) return FALSE;
+    
+    ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+    *ImagePointer = index;
+    
+    return TRUE;
 }
 
 bool wxPNGReader::SetRGB(int x, int y, byte r, byte g, byte b)
 {
-  if (!Inside(x, y)) return FALSE;
-
-  if (ColorType & COLORTYPE_PALETTE)
-  {
-   if (!m_palette) return FALSE;
-   SetIndex(x, y, m_palette->GetPixel(r, g, b));
-
-  } else {
-   ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-   ImagePointer[0] = b;
-   ImagePointer[1] = g;
-   ImagePointer[2] = r;
-  }
-
-  return TRUE;
+    if (!Inside(x, y)) return FALSE;
+    
+    if (ColorType & COLORTYPE_PALETTE)
+    {
+        if (!m_palette) return FALSE;
+        SetIndex(x, y, m_palette->GetPixel(r, g, b));
+        
+    } else {
+        ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+        ImagePointer[0] = b;
+        ImagePointer[1] = g;
+        ImagePointer[2] = r;
+    }
+    
+    return TRUE;
 }
 
 bool wxPNGReader::SetPalette(wxPalette* colourmap)
 {
-  delete m_palette ;
-  if (!colourmap)
-   return FALSE;
-  ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
-  m_palette = new wxPalette( *colourmap );
-       return true ;
-//  return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+    delete m_palette ;
+    if (!colourmap)
+        return FALSE;
+    ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
+    m_palette = new wxPalette( *colourmap );
+    return true ;
+    //  return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
 }
 
 bool
 wxPNGReader::SetPalette(int n, byte *r, byte *g, byte *b)
 {
-  delete m_palette ;
-  m_palette = new wxPalette();
-  if (!m_palette)
-   return FALSE;
-
-  if (!g) g = r;
-  if (!b) b = g;
-  m_palette->Create(n, r, g, b);
-  ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
-       return true ;
-//    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+    delete m_palette ;
+    m_palette = new wxPalette();
+    if (!m_palette)
+        return FALSE;
+    
+    if (!g) g = r;
+    if (!b) b = g;
+    m_palette->Create(n, r, g, b);
+    ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
+    return true ;
+    //    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
 }
 
 bool
 wxPNGReader::SetPalette(int n, rgb_color_struct *rgb_struct)
 {
-  delete m_palette ;
-  m_palette = new wxPalette();
-  if (!m_palette)
-   return FALSE;
-
-  byte r[256], g[256], b[256];
-
-  for(int i=0; i<n; i++)
-  {
-   r[i] = rgb_struct[i].red;
-   g[i] = rgb_struct[i].green;
-   b[i] = rgb_struct[i].blue;
-  }
-  // Added by JACS copying from Andrew Davison's additions
-  // to GIF-reading code
-  // Make transparency colour black...
-  if (bgindex != -1)
-    r[bgindex] = g[bgindex] = b[bgindex] = 0;
-
-  m_palette->Create(n, r, g, b);
-  ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
-       return true ;
-//    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+    delete m_palette ;
+    m_palette = new wxPalette();
+    if (!m_palette)
+        return FALSE;
+    
+    byte r[256], g[256], b[256];
+    
+    for(int i=0; i<n; i++)
+    {
+        r[i] = rgb_struct[i].red;
+        g[i] = rgb_struct[i].green;
+        b[i] = rgb_struct[i].blue;
+    }
+    // Added by JACS copying from Andrew Davison's additions
+    // to GIF-reading code
+    // Make transparency colour black...
+    if (bgindex != -1)
+        r[bgindex] = g[bgindex] = b[bgindex] = 0;
+    
+    m_palette->Create(n, r, g, b);
+    ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
+    return true ;
+    //    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
 }
 
 void wxPNGReader::NullData()
 {
-  if (lpbi)  {
-       wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+    if (lpbi)  {
+        wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
         lpbi = NULL;
-  }
-  if (m_palette != NULL) {
-      delete m_palette;
-      m_palette = NULL;
-  }
+    }
+    if (m_palette != NULL) {
+        delete m_palette;
+        m_palette = NULL;
+    }
 }
 
 wxBitmap* wxPNGReader::GetBitmap(void)
@@ -290,353 +290,353 @@ bool wxPNGReader::InstantiateBitmap(wxBitmap *bitmap)
 {
     if ( lpbi )
     {
-      bitmap->SetHBITMAP((WXHBITMAP) lpbi);
-      bitmap->SetWidth(GetWidth());
-      bitmap->SetHeight(GetHeight());
-      bitmap->SetDepth(GetDepth());
-      if ( GetDepth() > 1 && m_palette )
-        bitmap->SetPalette(*m_palette);
-      bitmap->SetOk(TRUE);
-
-
-      // Make a mask if appropriate
-      /*
-      if ( bgindex > -1 )
-      {
+        bitmap->SetHBITMAP((WXHBITMAP) lpbi);
+        bitmap->SetWidth(GetWidth());
+        bitmap->SetHeight(GetHeight());
+        bitmap->SetDepth(GetDepth());
+        if ( GetDepth() > 1 && m_palette )
+            bitmap->SetPalette(*m_palette);
+        bitmap->SetOk(TRUE);
+        
+        
+        // Make a mask if appropriate
+        /*
+        if ( bgindex > -1 )
+        {
         wxMask *mask = CreateMask();
         bitmap->SetMask(mask);
-      }
-      */
-      lpbi = NULL ; // bitmap has taken over ownership
-               return TRUE;
+        }
+        */
+        lpbi = NULL ; // bitmap has taken over ownership
+        return TRUE;
     }
     else
     {
-      return FALSE;
+        return FALSE;
     }
-/*
-  HDC dc = ::CreateCompatibleDC(NULL);
-
-  if (dc)
-  {
-        // tmpBitmap is a dummy, to satisfy ::CreateCompatibleDC (it
-        // is a memory dc that must have a bitmap selected into it)
-        HDC dc2 = GetDC(NULL);
-        HBITMAP tmpBitmap = ::CreateCompatibleBitmap(dc2, GetWidth(), GetHeight());
-        ReleaseDC(NULL, dc2);
-        HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, tmpBitmap);
-
+    /*
+    HDC dc = ::CreateCompatibleDC(NULL);
+    
+      if (dc)
+      {
+      // tmpBitmap is a dummy, to satisfy ::CreateCompatibleDC (it
+      // is a memory dc that must have a bitmap selected into it)
+      HDC dc2 = GetDC(NULL);
+      HBITMAP tmpBitmap = ::CreateCompatibleBitmap(dc2, GetWidth(), GetHeight());
+      ReleaseDC(NULL, dc2);
+      HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, tmpBitmap);
+      
         if ( m_palette )
         {
-            HPALETTE oldPal = ::SelectPalette(dc, (HPALETTE) m_palette->GetHPALETTE(), FALSE);
+        HPALETTE oldPal = ::SelectPalette(dc, (HPALETTE) m_palette->GetHPALETTE(), FALSE);
         ::RealizePalette(dc);
         }
-
-    HBITMAP hBitmap = ::CreateDIBitmap(dc, lpbi,
-        CBM_INIT, RawImage, (LPBITMAPINFO) lpbi, DIB_PAL_COLORS);
-
-        ::SelectPalette(dc, NULL, TRUE);
-        ::SelectObject(dc, oldBitmap);
-        ::DeleteObject(tmpBitmap);
-        ::DeleteDC(dc);
-
-        if ( hBitmap )
-        {
-          bitmap->SetHBITMAP((WXHBITMAP) hBitmap);
-          bitmap->SetWidth(GetWidth());
-          bitmap->SetHeight(GetHeight());
-          bitmap->SetDepth(GetDepth());
-          if ( GetDepth() > 1 && m_palette )
-            bitmap->SetPalette(*m_palette);
-          bitmap->SetOk(TRUE);
-
-
-          // Make a mask if appropriate
-          if ( bgindex > -1 )
-          {
-            wxMask *mask = CreateMask();
-            bitmap->SetMask(mask);
-          }
-      return TRUE;
-        }
-        else
-        {
-          return FALSE;
-        }
-  }
-  else
-    {
-    return FALSE;
-    }
-  */
-  return false ;
+        
+          HBITMAP hBitmap = ::CreateDIBitmap(dc, lpbi,
+          CBM_INIT, RawImage, (LPBITMAPINFO) lpbi, DIB_PAL_COLORS);
+          
+            ::SelectPalette(dc, NULL, TRUE);
+            ::SelectObject(dc, oldBitmap);
+            ::DeleteObject(tmpBitmap);
+            ::DeleteDC(dc);
+            
+              if ( hBitmap )
+              {
+              bitmap->SetHBITMAP((WXHBITMAP) hBitmap);
+              bitmap->SetWidth(GetWidth());
+              bitmap->SetHeight(GetHeight());
+              bitmap->SetDepth(GetDepth());
+              if ( GetDepth() > 1 && m_palette )
+              bitmap->SetPalette(*m_palette);
+              bitmap->SetOk(TRUE);
+              
+                
+                  // Make a mask if appropriate
+                  if ( bgindex > -1 )
+                  {
+                  wxMask *mask = CreateMask();
+                  bitmap->SetMask(mask);
+                  }
+                  return TRUE;
+                  }
+                  else
+                  {
+                  return FALSE;
+                  }
+                  }
+                  else
+                  {
+                  return FALSE;
+                  }
+    */
+    return false ;
 }
 
 wxPalette *wxCopyPalette(const wxPalette *cmap)
 {
-  wxPalette *newCmap = new wxPalette( *cmap ) ;
-  return newCmap;
+    wxPalette *newCmap = new wxPalette( *cmap ) ;
+    return newCmap;
 }
 
 wxMask *wxPNGReader::CreateMask(void)
 {
 /*
-    HBITMAP hBitmap = ::CreateBitmap(GetWidth(), GetHeight(), 1, 1, NULL);
+HBITMAP hBitmap = ::CreateBitmap(GetWidth(), GetHeight(), 1, 1, NULL);
 
   HDC dc = ::CreateCompatibleDC(NULL);
-    HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, hBitmap);
-
+  HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, hBitmap);
+  
     int bgIndex = GetBGIndex();
-
-    int x,y;
-
-    for (x=0; x<GetWidth(); x++)
-    {
+    
+      int x,y;
+      
+        for (x=0; x<GetWidth(); x++)
+        {
         for (y=0; y<GetHeight(); y++)
         {
-            int index = GetIndex(x, y);
-            if ( index == bgIndex )
-                ::SetPixel(dc, x, GetHeight() - y - 1, RGB(0, 0, 0));
-            else
-                ::SetPixel(dc, x, GetHeight() - y - 1, RGB(255, 255, 255));
-
-      }
-    }
-    ::SelectObject(dc, oldBitmap);
-    wxMask *mask = new wxMask;
-    mask->SetMaskBitmap((WXHBITMAP) hBitmap);
-    return mask;
-   */
-   return NULL ;
+        int index = GetIndex(x, y);
+        if ( index == bgIndex )
+        ::SetPixel(dc, x, GetHeight() - y - 1, RGB(0, 0, 0));
+        else
+        ::SetPixel(dc, x, GetHeight() - y - 1, RGB(255, 255, 255));
+        
+          }
+          }
+          ::SelectObject(dc, oldBitmap);
+          wxMask *mask = new wxMask;
+          mask->SetMaskBitmap((WXHBITMAP) hBitmap);
+          return mask;
+    */
+    return NULL ;
 }
 
 bool wxPNGReader::ReadFile(char * ImageFileName)
 {
-  int number_passes;
-
-  if (ImageFileName)
-   strcpy(filename, ImageFileName);
-
-  FILE *fp;
-  png_struct *png_ptr;
-   png_info *info_ptr;
-  wxPNGReaderIter iter(this);
-
-  /* open the file */
-  fp = fopen( ImageFileName , "rb" );
-
-  if (!fp)
-    return FALSE;
-
-  /* allocate the necessary structures */
-  png_ptr = new (png_struct);
-  if (!png_ptr)
-  {
-    fclose(fp);
-    return FALSE;
-  }
-
-  info_ptr = new (png_info);
-  if (!info_ptr)
-  {
-    fclose(fp);
-    delete png_ptr;
-    return FALSE;
-  }
-  /* set error handling */
-  if (setjmp(png_ptr->jmpbuf))
-  {
-    png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-    fclose(fp);
-    delete png_ptr;
-    delete info_ptr;
-
-    /* If we get here, we had a problem reading the file */
-    return FALSE;
-  }
-        //png_set_error(ima_png_error, NULL);
-
-  /* initialize the structures, info first for error handling */
-  png_info_init(info_ptr);
-  png_read_init(png_ptr);
-
-  /* set up the input control */
-  png_init_io(png_ptr, fp);
-
-  /* read the file information */
-  png_read_info(png_ptr, info_ptr);
-
-  /* allocate the memory to hold the image using the fields
+    int number_passes;
+    
+    if (ImageFileName)
+        strcpy(filename, ImageFileName);
+    
+    FILE *fp;
+    png_struct *png_ptr;
+    png_info *info_ptr;
+    wxPNGReaderIter iter(this);
+    
+    /* open the file */
+    fp = fopen( ImageFileName , "rb" );
+    
+    if (!fp)
+        return FALSE;
+    
+    /* allocate the necessary structures */
+    png_ptr = new (png_struct);
+    if (!png_ptr)
+    {
+        fclose(fp);
+        return FALSE;
+    }
+    
+    info_ptr = new (png_info);
+    if (!info_ptr)
+    {
+        fclose(fp);
+        delete png_ptr;
+        return FALSE;
+    }
+    /* set error handling */
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+        fclose(fp);
+        delete png_ptr;
+        delete info_ptr;
+        
+        /* If we get here, we had a problem reading the file */
+        return FALSE;
+    }
+    //png_set_error(ima_png_error, NULL);
+    
+    /* initialize the structures, info first for error handling */
+    png_info_init(info_ptr);
+    png_read_init(png_ptr);
+    
+    /* set up the input control */
+    png_init_io(png_ptr, fp);
+    
+    /* read the file information */
+    png_read_info(png_ptr, info_ptr);
+    
+    /* allocate the memory to hold the image using the fields
     of png_info. */
-  png_color_16 my_background={ 0, 31, 127, 255, 0 };
-
-  if (info_ptr->valid & PNG_INFO_bKGD)
+    png_color_16 my_background={ 0, 31, 127, 255, 0 };
+    
+    if (info_ptr->valid & PNG_INFO_bKGD)
     {
-    png_set_background(png_ptr, &(info_ptr->background),
-      PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
+        png_set_background(png_ptr, &(info_ptr->background),
+            PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
         if ( info_ptr->num_palette > 0 )
             bgindex = info_ptr->background.index;
     }
-  else   {
-    png_set_background(png_ptr, &my_background,
-      PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
-
+    else   {
+        png_set_background(png_ptr, &my_background,
+            PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
+        
         // Added by JACS: guesswork!
         if ( info_ptr->num_trans != 0 )
             bgindex = info_ptr->num_trans - 1 ;
-   }
-
-  /* tell libpng to strip 16 bit depth files down to 8 bits */
-  if (info_ptr->bit_depth == 16)
-    png_set_strip_16(png_ptr);
-
-  int pixel_depth=(info_ptr->pixel_depth<24) ? info_ptr->pixel_depth: 24;
-  Create(info_ptr->width, info_ptr->height, pixel_depth,
-    info_ptr->color_type);
-
-  if (info_ptr->num_palette>0)
+    }
+    
+    /* tell libpng to strip 16 bit depth files down to 8 bits */
+    if (info_ptr->bit_depth == 16)
+        png_set_strip_16(png_ptr);
+    
+    int pixel_depth=(info_ptr->pixel_depth<24) ? info_ptr->pixel_depth: 24;
+    Create(info_ptr->width, info_ptr->height, pixel_depth,
+        info_ptr->color_type);
+    
+    if (info_ptr->num_palette>0)
     {
-      SetPalette((int)info_ptr->num_palette, (rgb_color_struct*)info_ptr->palette);
+        SetPalette((int)info_ptr->num_palette, (rgb_color_struct*)info_ptr->palette);
     }
-
-  int row_stride = info_ptr->width * ((pixel_depth+7)>>3);
- //  printf("P = %d D = %d RS= %d ", info_ptr->num_palette, info_ptr->pixel_depth,row_stride);
-//  printf("CT = %d TRS = %d BD= %d ", info_ptr->color_type, info_ptr->valid & PNG_INFO_tRNS,info_ptr->bit_depth);
-
-  byte *row_pointers = new byte[row_stride];
-
-  /* turn on interlace handling */
-  if (info_ptr->interlace_type)
-    number_passes = png_set_interlace_handling(png_ptr);
-  else
-    number_passes = 1;
-//  printf("NP = %d ", number_passes);
-
-  for (int pass=0; pass< number_passes; pass++) 
-  {
-         iter.upset();
-         int y=0;
-               CGrafPtr        origPort ;
-               GDHandle        origDevice ;
-               
-               GetGWorld( &origPort , &origDevice ) ;
-               // ignore shapedc
-               SetGWorld( (GWorldPtr) lpbi , NULL ) ;
-         do  
-         {
-       //    (unsigned char *)iter.GetRow();
-           if (info_ptr->interlace_type)  
-           {
-            if (pass>0)
-             iter.GetRow(row_pointers, row_stride);
-            png_read_row(png_ptr, row_pointers, NULL);
-           }
-           else
-            png_read_row(png_ptr, row_pointers, NULL);
-                       
-                       if ( info_ptr->palette )
-                       {
-                               if ( pixel_depth == 8 )
-                               {
-                                       for ( size_t i = 0 ; i < info_ptr->width ; ++i )
-                                       {
-                                               png_color_struct* color ; 
-                                               RGBColor col ;
-
-                                               int index = row_pointers[i] ;
-                                               color = &info_ptr->palette[index] ;
-                                               col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                               col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                               col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                               SetCPixel( i, y, &col);
-                                       }
-                                       /*
-                                       png_color_struct* color ; 
-                                       RGBColor col ;
-                                       unsigned char* p = &row_pointers[0] ;
-                                       PenNormal() ;
-                                       MoveTo( 0 , y ) ;
-                                       int index = *p ;
-                                       color = &info_ptr->palette[index] ;
-                                       col.red = (color->red << 8) | color->red ;
-                                       col.green = (color->green << 8) | color->green ;
-                                       col.blue = (color->blue << 8) | color->blue ;
-                                       RGBForeColor( &col ) ;
-                                       col.red = col.green = col.blue = 0xFFFF ;
-                                       RGBBackColor( &col ) ;
-                                       for ( int i = 0 ; i < info_ptr->width ; ++i , ++p)
-                                       {
-                                               if ( *p != index )
-                                               {
-                                                       LineTo( i , y ) ;
-                                                       index = *p ;
-                                                       color = &info_ptr->palette[index] ;
-                                                       col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                                       col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                                       col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                                       RGBForeColor( &col ) ;
-                                               }
-                                       }
-                                       LineTo( info_ptr->width  , y ) ;
-                                       */
-                               }
-                               else
-                               {
-                                       for ( size_t i = 0 ; i < info_ptr->width ; ++i )
-                                       {
-                                               png_color_struct* color ; 
-                                               RGBColor col ;
-
-                                               int byte = ( i * pixel_depth ) / 8 ;
-                                               int offset = ( 8 - pixel_depth ) - ( i * pixel_depth ) % 8 ;
-                                                       
-                                               int index = ( row_pointers[byte] >> offset ) & ( 0xFF >> ( 8 - pixel_depth ) );
-                                               color = &info_ptr->palette[index] ;
-                                               col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                               col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                               col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                               SetCPixel( i, y, &col);
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               for ( size_t i = 0 ; i < info_ptr->width ; ++i )
-                               {
-                                       png_color_struct* color ; 
-                                       RGBColor col ;
-                                       color =(png_color_struct*) (&row_pointers[i*3]) ;
-                                       col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                       col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                       col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                       SetCPixel( i, y, &col);
-                               }
-                       }
-                       if (number_passes)
-                               iter.SetRow(row_pointers, row_stride);
-           y++;
-         
-         while(iter.PrevRow());
-         SetGWorld( origPort , origDevice ) ;
-
-//  printf("Y=%d ",y);
+    
+    int row_stride = info_ptr->width * ((pixel_depth+7)>>3);
   //  printf("P = %d D = %d RS= %d ", info_ptr->num_palette, info_ptr->pixel_depth,row_stride);
+    //  printf("CT = %d TRS = %d BD= %d ", info_ptr->color_type, info_ptr->valid & PNG_INFO_tRNS,info_ptr->bit_depth);
+    
+    byte *row_pointers = new byte[row_stride];
+    
+    /* turn on interlace handling */
+    if (info_ptr->interlace_type)
+        number_passes = png_set_interlace_handling(png_ptr);
+    else
+        number_passes = 1;
+    //  printf("NP = %d ", number_passes);
+    
+    for (int pass=0; pass< number_passes; pass++) 
+    {
+        iter.upset();
+        int y=0;
+        CGrafPtr     origPort ;
+        GDHandle    origDevice ;
+        
+        GetGWorld( &origPort , &origDevice ) ;
+        // ignore shapedc
+        SetGWorld( (GWorldPtr) lpbi , NULL ) ;
+        do  
+        {
+            //    (unsigned char *)iter.GetRow();
+            if (info_ptr->interlace_type)  
+            {
+                if (pass>0)
+                    iter.GetRow(row_pointers, row_stride);
+                png_read_row(png_ptr, row_pointers, NULL);
+            }
+            else
+                png_read_row(png_ptr, row_pointers, NULL);
+            
+            if ( info_ptr->palette )
+            {
+                if ( pixel_depth == 8 )
+                {
+                    for ( size_t i = 0 ; i < info_ptr->width ; ++i )
+                    {
+                        png_color_struct* color ; 
+                        RGBColor col ;
+                        
+                        int index = row_pointers[i] ;
+                        color = &info_ptr->palette[index] ;
+                        col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                        col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                        col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                        SetCPixel( i, y, &col);
+                    }
+                    /*
+                    png_color_struct* color ; 
+                    RGBColor col ;
+                    unsigned char* p = &row_pointers[0] ;
+                    PenNormal() ;
+                    MoveTo( 0 , y ) ;
+                    int index = *p ;
+                    color = &info_ptr->palette[index] ;
+                    col.red = (color->red << 8) | color->red ;
+                    col.green = (color->green << 8) | color->green ;
+                    col.blue = (color->blue << 8) | color->blue ;
+                    RGBForeColor( &col ) ;
+                    col.red = col.green = col.blue = 0xFFFF ;
+                    RGBBackColor( &col ) ;
+                    for ( int i = 0 ; i < info_ptr->width ; ++i , ++p)
+                    {
+                    if ( *p != index )
+                    {
+                    LineTo( i , y ) ;
+                    index = *p ;
+                    color = &info_ptr->palette[index] ;
+                    col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                    col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                    col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                    RGBForeColor( &col ) ;
+                    }
+                    }
+                    LineTo( info_ptr->width  , y ) ;
+                    */
+                }
+                else
+                {
+                    for ( size_t i = 0 ; i < info_ptr->width ; ++i )
+                    {
+                        png_color_struct* color ; 
+                        RGBColor col ;
+                        
+                        int byte = ( i * pixel_depth ) / 8 ;
+                        int offset = ( 8 - pixel_depth ) - ( i * pixel_depth ) % 8 ;
+                        
+                        int index = ( row_pointers[byte] >> offset ) & ( 0xFF >> ( 8 - pixel_depth ) );
+                        color = &info_ptr->palette[index] ;
+                        col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                        col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                        col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                        SetCPixel( i, y, &col);
+                    }
+                }
+            }
+            else
+            {
+                for ( size_t i = 0 ; i < info_ptr->width ; ++i )
+                {
+                    png_color_struct* color ; 
+                    RGBColor col ;
+                    color =(png_color_struct*) (&row_pointers[i*3]) ;
+                    col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                    col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                    col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                    SetCPixel( i, y, &col);
+                }
+            }
+            if (number_passes)
+                iter.SetRow(row_pointers, row_stride);
+            y++;
+        } 
+        while(iter.PrevRow());
+        SetGWorld( origPort , origDevice ) ;
+        
+        //  printf("Y=%d ",y);
   }
   delete[] row_pointers;
-
+  
   /* read the rest of the file, getting any additional chunks
-    in info_ptr */
+  in info_ptr */
   png_read_end(png_ptr, info_ptr);
-
+  
   /* clean up after the read, and free any memory allocated */
   png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-
+  
   /* free the structures */
   delete png_ptr;
   delete info_ptr;
-
+  
   /* close the file */
   fclose(fp);
-
+  
   /* that's it */
   return TRUE;
 }
@@ -646,146 +646,146 @@ bool wxPNGReader::ReadFile(char * ImageFileName)
 
 bool wxPNGReader::SaveFile(char * ImageFileName)
 {
-  if (ImageFileName)
-   strcpy(filename, ImageFileName);
-
-  wxPNGReaderIter iter(this);
-  FILE *fp;
-   png_struct *png_ptr;
-  png_info *info_ptr;
-
-   /* open the file */
-  fp = fopen(filename, "wb");
-  if (!fp)
-    return FALSE;
-
-  /* allocate the necessary structures */
-  png_ptr = new (png_struct);
-  if (!png_ptr)
-  {
-    fclose(fp);
-    return FALSE;
-  }
-
-  info_ptr = new (png_info);
-  if (!info_ptr)
-  {
-    fclose(fp);
-    delete png_ptr;
-    return FALSE;
-  }
-
-  /* set error handling */
-  if (setjmp(png_ptr->jmpbuf))
-  {
+    if (ImageFileName)
+        strcpy(filename, ImageFileName);
+    
+    wxPNGReaderIter iter(this);
+    FILE *fp;
+    png_struct *png_ptr;
+    png_info *info_ptr;
+    
+    /* open the file */
+    fp = fopen(filename, "wb");
+    if (!fp)
+        return FALSE;
+    
+    /* allocate the necessary structures */
+    png_ptr = new (png_struct);
+    if (!png_ptr)
+    {
+        fclose(fp);
+        return FALSE;
+    }
+    
+    info_ptr = new (png_info);
+    if (!info_ptr)
+    {
+        fclose(fp);
+        delete png_ptr;
+        return FALSE;
+    }
+    
+    /* set error handling */
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_write_destroy(png_ptr);
+        fclose(fp);
+        delete png_ptr;
+        delete info_ptr;
+        
+        /* If we get here, we had a problem reading the file */
+        return FALSE;
+    }
+    //png_set_error(ima_png_error, NULL);
+    
+    //  printf("writig pg %s ", filename);
+    /* initialize the structures */
+    png_info_init(info_ptr);
+    png_write_init(png_ptr);
+    
+    int row_stride = GetWidth() * ((GetDepth()+7)>>3);
+    /* set up the output control */
+    png_init_io(png_ptr, fp);
+    
+    /* set the file information here */
+    info_ptr->width = GetWidth();
+    info_ptr->height = GetHeight();
+    info_ptr->pixel_depth = GetDepth();
+    info_ptr->channels = (GetDepth()>8) ? 3: 1;
+    info_ptr->bit_depth = GetDepth()/info_ptr->channels;
+    info_ptr->color_type = GetColorType();
+    info_ptr->compression_type = info_ptr->filter_type = info_ptr->interlace_type=0;
+    info_ptr->valid = 0;
+    info_ptr->rowbytes = row_stride;
+    
+    
+    // printf("P = %d D = %d RS= %d GD= %d CH= %d ", info_ptr->pixel_depth, info_ptr->bit_depth, row_stride, GetDepth(), info_ptr->channels);
+    /* set the palette if there is one */
+    if ((GetColorType() & COLORTYPE_PALETTE) && GetPalette())
+    {
+        //    printf("writing paleta[%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
+        info_ptr->valid |= PNG_INFO_PLTE;
+        info_ptr->palette = new png_color[256];
+        info_ptr->num_palette = 256;
+        for (int i=0; i<256; i++)
+            GetPalette()->GetRGB(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+    }
+    //    printf("Paleta [%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
+    
+    
+    /* optional significant bit chunk */
+    //   info_ptr->valid |= PNG_INFO_sBIT;
+    //   info_ptr->sig_bit = true_bit_depth;
+    
+    /* optional gamma chunk */
+    //   info_ptr->valid |= PNG_INFO_gAMA;
+    //   info_ptr->gamma = gamma;
+    
+    /* other optional chunks */
+    
+    /* write the file information */
+    png_write_info(png_ptr, info_ptr);
+    
+    /* set up the transformations you want.  Note that these are
+    all optional.  Only call them if you want them */
+    
+    /* shift the pixels up to a legal bit depth and fill in
+    as appropriate to correctly scale the image */
+    //   png_set_shift(png_ptr, &(info_ptr->sig_bit));
+    
+    /* pack pixels into bytes */
+    //   png_set_packing(png_ptr);
+    
+    /* flip bgr pixels to rgb */
+    //   png_set_bgr(png_ptr);
+    
+    /* swap bytes of 16 bit files to most significant bit first */
+    //   png_set_swap(png_ptr);
+    
+    /* get rid of filler bytes, pack rgb into 3 bytes */
+    //   png_set_rgbx(png_ptr);
+    
+    /* If you are only writing one row at a time, this works */
+    
+    byte *row_pointers = new byte[row_stride];
+    iter.upset();
+    do  {
+        //    (unsigned char *)iter.GetRow();
+        iter.GetRow(row_pointers, row_stride);
+        png_write_row(png_ptr, row_pointers);
+    } while(iter.PrevRow());
+    
+    delete[] row_pointers;
+    
+    /* write the rest of the file */
+    png_write_end(png_ptr, info_ptr);
+    
+    /* clean up after the write, and free any memory allocated */
     png_write_destroy(png_ptr);
-    fclose(fp);
+    
+    /* if you malloced the palette, free it here */
+    if (info_ptr->palette)
+        delete[] (info_ptr->palette);
+    
+    /* free the structures */
     delete png_ptr;
     delete info_ptr;
-
-    /* If we get here, we had a problem reading the file */
-    return FALSE;
-  }
-        //png_set_error(ima_png_error, NULL);
-
-//  printf("writig pg %s ", filename);
-   /* initialize the structures */
-  png_info_init(info_ptr);
-  png_write_init(png_ptr);
-
-  int row_stride = GetWidth() * ((GetDepth()+7)>>3);
-  /* set up the output control */
-   png_init_io(png_ptr, fp);
-
-  /* set the file information here */
-  info_ptr->width = GetWidth();
-  info_ptr->height = GetHeight();
-  info_ptr->pixel_depth = GetDepth();
-  info_ptr->channels = (GetDepth()>8) ? 3: 1;
-  info_ptr->bit_depth = GetDepth()/info_ptr->channels;
-  info_ptr->color_type = GetColorType();
-  info_ptr->compression_type = info_ptr->filter_type = info_ptr->interlace_type=0;
-  info_ptr->valid = 0;
-  info_ptr->rowbytes = row_stride;
-
-
-// printf("P = %d D = %d RS= %d GD= %d CH= %d ", info_ptr->pixel_depth, info_ptr->bit_depth, row_stride, GetDepth(), info_ptr->channels);
-  /* set the palette if there is one */
-  if ((GetColorType() & COLORTYPE_PALETTE) && GetPalette())
-  {
-//    printf("writing paleta[%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
-    info_ptr->valid |= PNG_INFO_PLTE;
-    info_ptr->palette = new png_color[256];
-    info_ptr->num_palette = 256;
-    for (int i=0; i<256; i++)
-     GetPalette()->GetRGB(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
-  }
-//    printf("Paleta [%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
-
-
-   /* optional significant bit chunk */
-//   info_ptr->valid |= PNG_INFO_sBIT;
-//   info_ptr->sig_bit = true_bit_depth;
-
-  /* optional gamma chunk */
-//   info_ptr->valid |= PNG_INFO_gAMA;
-//   info_ptr->gamma = gamma;
-
-  /* other optional chunks */
-
-   /* write the file information */
-   png_write_info(png_ptr, info_ptr);
-
-   /* set up the transformations you want.  Note that these are
-      all optional.  Only call them if you want them */
-
-  /* shift the pixels up to a legal bit depth and fill in
-      as appropriate to correctly scale the image */
-//   png_set_shift(png_ptr, &(info_ptr->sig_bit));
-
-  /* pack pixels into bytes */
-//   png_set_packing(png_ptr);
-
-  /* flip bgr pixels to rgb */
-//   png_set_bgr(png_ptr);
-
-   /* swap bytes of 16 bit files to most significant bit first */
-//   png_set_swap(png_ptr);
-
-   /* get rid of filler bytes, pack rgb into 3 bytes */
-//   png_set_rgbx(png_ptr);
-
-/* If you are only writing one row at a time, this works */
-
-  byte *row_pointers = new byte[row_stride];
-    iter.upset();
-  do  {
-//    (unsigned char *)iter.GetRow();
-    iter.GetRow(row_pointers, row_stride);
-    png_write_row(png_ptr, row_pointers);
-  } while(iter.PrevRow());
-
-        delete[] row_pointers;
-
-/* write the rest of the file */
-   png_write_end(png_ptr, info_ptr);
-
-  /* clean up after the write, and free any memory allocated */
-   png_write_destroy(png_ptr);
-
-   /* if you malloced the palette, free it here */
-   if (info_ptr->palette)
-    delete[] (info_ptr->palette);
-
-  /* free the structures */
-  delete png_ptr;
-  delete info_ptr;
-
-  /* close the file */
-  fclose(fp);
-
-  /* that's it */
-  return TRUE;
+    
+    /* close the file */
+    fclose(fp);
+    
+    /* that's it */
+    return TRUE;
 }
 
 static int Power(int x, int y)
@@ -800,15 +800,15 @@ static int Power(int x, int y)
 }
 
 static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
-  'C', 'D', 'E', 'F' };
+'C', 'D', 'E', 'F' };
 
 static void DecToHex(int dec, char *buf)
 {
-  int firstDigit = (int)(dec/16.0);
-  int secondDigit = (int)(dec - (firstDigit*16.0));
-  buf[0] = hexArray[firstDigit];
-  buf[1] = hexArray[secondDigit];
-  buf[2] = 0;
+    int firstDigit = (int)(dec/16.0);
+    int secondDigit = (int)(dec - (firstDigit*16.0));
+    buf[0] = hexArray[firstDigit];
+    buf[1] = hexArray[secondDigit];
+    buf[2] = 0;
 }
 
 
@@ -822,30 +822,30 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         strcpy(nameStr, filename);
         wxStripExtension(nameStr);
     }
-
+    
     if ( GetDepth() > 4 )
     {
         // Only a depth of 4 and below allowed
         return FALSE;
     }
-
+    
     if ( !GetPalette() )
         return FALSE;
-
+    
     wxSTD ofstream str(filename);
     if ( str.bad() )
         return FALSE;
-
+    
     int noColours = Power(2, GetDepth());
-
+    
     // Output header
     str << "/* XPM */\n";
     str << "static char * " << nameStr << "_xpm[] = {\n";
     str << "\"" << GetWidth() << " " << GetHeight() << " " << noColours << " 1\",\n";
-
+    
     // Output colourmap
     int base = 97 ; // start from 'a'
-
+    
     unsigned char red, green, blue;
     char hexBuf[4];
     int i;
@@ -861,7 +861,7 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         str << hexBuf;
         str << "\",\n";
     }
-
+    
     // Output the data
     int x, y;
     for ( y = 0; y < GetHeight(); y++)
@@ -874,10 +874,10 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         }
         str << "\",\n";
     }
-
+    
     str << "};\n";
     str.flush();
-
+    
     return TRUE;
 }
 
@@ -885,7 +885,7 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
 IMPLEMENT_DYNAMIC_CLASS(wxPNGFileHandler, wxBitmapHandler)
 
 bool wxPNGFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
-    int desiredWidth, int desiredHeight)
+                                int desiredWidth, int desiredHeight)
 {
     wxPNGReader reader;
     if (reader.ReadFile((char*) (const char*) name))
index 7261f5576fc16934d932c35c7a4e63f3b96872e8..779ee74edd7a2c27ba1d09366e982bbb660df3cb 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -19,7 +19,7 @@
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 #ifndef __DARWIN__
-    #include "Printing.h"
+#include "Printing.h"
 #endif
 
 #if defined(TARGET_CARBON) && !defined(__DARWIN__)
@@ -53,7 +53,7 @@ wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
     wxPrintDialogData data2;
     if ( data )
         data2 = *data;
-
+    
     Create(p, &data2);
 }
 
@@ -62,10 +62,10 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
     m_dialogParent = p;
     m_printerDC = NULL;
     m_destroyDC = TRUE;
-
+    
     if ( data )
         m_printDialogData = *data;
-
+    
     return TRUE;
 }
 
@@ -79,31 +79,31 @@ wxPrintDialog::~wxPrintDialog()
 
 int wxPrintDialog::ShowModal()
 {
-       int result = wxID_CANCEL ;
-       OSErr err ;
-       wxString message ;
-
-#if !TARGET_CARBON     
-       err = ::UMAPrOpen(NULL) ;
-       if ( err == noErr )
-       {
-               m_printDialogData.ConvertToNative() ;
-               if  ( ::PrJobDialog( (THPrint) m_printDialogData.GetPrintData().m_macPrintSettings ) )
-               {
-                       m_printDialogData.ConvertFromNative() ;
-                       result = wxID_OK ;
-               }
-
-       }
-       else
-       {
-               message.Printf( "Print Error %d", err ) ;
-               wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-       }
-       ::UMAPrClose(NULL) ;
+    int result = wxID_CANCEL ;
+    OSErr err ;
+    wxString message ;
+    
+#if !TARGET_CARBON    
+    err = ::UMAPrOpen(NULL) ;
+    if ( err == noErr )
+    {
+        m_printDialogData.ConvertToNative() ;
+        if  ( ::PrJobDialog( (THPrint) m_printDialogData.GetPrintData().m_macPrintSettings ) )
+        {
+            m_printDialogData.ConvertFromNative() ;
+            result = wxID_OK ;
+        }
+        
+    }
+    else
+    {
+        message.Printf( "Print Error %d", err ) ;
+        wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+    }
+    ::UMAPrClose(NULL) ;
 #else
-  #if PM_USE_SESSION_APIS
+#if PM_USE_SESSION_APIS
     Boolean        accepted;
     
     {
@@ -121,16 +121,16 @@ int wxPrintDialog::ShowModal()
                 (m_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
                 err = PMSessionDefaultPageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                                 (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
+                    (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
             err = PMSessionValidatePageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                              (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
-                                              kPMDontWantBoolean);
+                (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
+                kPMDontWantBoolean);
         }
-       
+        
         //  Set up a valid PrintSettings object.
         if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings)
         {
@@ -143,14 +143,14 @@ int wxPrintDialog::ShowModal()
                 (m_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings))
             {
                 err = PMSessionDefaultPrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                                    (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
+                    (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
             }
         }
         else
         {
             err = PMSessionValidatePrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                                 (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
-                                                 kPMDontWantBoolean);
+                (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
+                kPMDontWantBoolean);
         }
         //  Set a valid page range before displaying the Print dialog
         if (err == noErr)
@@ -163,9 +163,9 @@ int wxPrintDialog::ShowModal()
         if (err == noErr)
         {
             err = PMSessionPrintDialog((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                       (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
-                                       (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
-                                       &accepted);
+                (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
+                (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
+                &accepted);
             if ((err == noErr) && !accepted)
             {
                 err = kPMCancel; // user clicked Cancel button
@@ -183,11 +183,11 @@ int wxPrintDialog::ShowModal()
         wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
-  #else
-    #pragma warning "TODO: Printing for carbon without session apis"
-  #endif
+#else
+#pragma warning "TODO: Printing for carbon without session apis"
 #endif
-       return result ;
+#endif
+    return result ;
 }
 
 wxDC *wxPrintDialog::GetPrintDC()
@@ -196,17 +196,17 @@ wxDC *wxPrintDialog::GetPrintDC()
 }
 
 /*
- * wxPageSetupDialog
- */
+* wxPageSetupDialog
+*/
 
 wxPageSetupDialog::wxPageSetupDialog():
- wxDialog()
+wxDialog()
 {
-  m_dialogParent = NULL;
+    m_dialogParent = NULL;
 }
 
 wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
- wxDialog()
+wxDialog()
 {
     Create(p, data);
 }
@@ -214,10 +214,10 @@ wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
 bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
 {
     m_dialogParent = p;
-
+    
     if (data)
         m_pageSetupData = (*data);
-
+    
     return TRUE;
 }
 
@@ -227,31 +227,31 @@ wxPageSetupDialog::~wxPageSetupDialog()
 
 int wxPageSetupDialog::ShowModal()
 {
-       int      result = wxID_CANCEL ;
-       OSErr    err ;
-       wxString message ;
-
+    int      result = wxID_CANCEL ;
+    OSErr    err ;
+    wxString message ;
+    
 #if !TARGET_CARBON
-       err = ::UMAPrOpen(NULL) ;
-       if ( err == noErr )
-       {
-               m_pageSetupData.ConvertToNative() ;
-               if  ( ::PrStlDialog(  (THPrint) m_pageSetupData.GetPrintData().m_macPrintSettings ) )
-               {
-                       m_pageSetupData.ConvertFromNative() ;
-                       result = wxID_OK ;
-               }
-
-       }
-       else
-       {
-               message.Printf( "Print Error %d", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-       }
-       ::UMAPrClose(NULL) ;
+    err = ::UMAPrOpen(NULL) ;
+    if ( err == noErr )
+    {
+        m_pageSetupData.ConvertToNative() ;
+        if  ( ::PrStlDialog(  (THPrint) m_pageSetupData.GetPrintData().m_macPrintSettings ) )
+        {
+            m_pageSetupData.ConvertFromNative() ;
+            result = wxID_OK ;
+        }
+        
+    }
+    else
+    {
+        message.Printf( "Print Error %d", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+    }
+    ::UMAPrClose(NULL) ;
 #else
-  #if PM_USE_SESSION_APIS
+#if PM_USE_SESSION_APIS
     Boolean        accepted;
     
     {
@@ -269,22 +269,22 @@ int wxPageSetupDialog::ShowModal()
                 (m_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
                 err = PMSessionDefaultPageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
-                                                 (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
+                    (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
             err = PMSessionValidatePageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
-                                              (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
-                                              kPMDontWantBoolean);
+                (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
+                kPMDontWantBoolean);
         }
         
         //  Display the Page Setup dialog.
         if (err == noErr)
         {
             err = PMSessionPageSetupDialog((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
-                                           (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
-                                           &accepted);
+                (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
+                &accepted);
             if ((err == noErr) && !accepted)
             {
                 err = kPMCancel; // user clicked Cancel button
@@ -305,10 +305,10 @@ int wxPageSetupDialog::ShowModal()
         wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
-  #else
-    #pragma warning "TODO: Printing for carbon without session apis"
-  #endif
+#else
+#pragma warning "TODO: Printing for carbon without session apis"
+#endif
 #endif
-       return result ;
+    return result ;
 }
 
index 60d15137cff0c1269f91d9f91133a0d9174d1b0f..20ea4968011c5db61d417ca3c776a7b1c3d77f54 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:       wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -43,11 +43,11 @@ IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase)
 #endif
 
 /*
- * Printer
- */
+* Printer
+*/
+
 wxMacPrinter::wxMacPrinter(wxPrintDialogData *data):
-  wxPrinterBase(data)
+wxPrinterBase(data)
 {
 }
 
@@ -57,170 +57,170 @@ wxMacPrinter::~wxMacPrinter(void)
 
 bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
 {
-  sm_abortIt = FALSE;
-  sm_abortWindow = NULL;
-
-  if (!printout)
-    return FALSE;
+    sm_abortIt = FALSE;
+    sm_abortWindow = NULL;
     
-  printout->SetIsPreview(FALSE);
-  printout->OnPreparePrinting();
-
-  // Get some parameters from the printout, if defined
-  int fromPage, toPage;
-  int minPage, maxPage;
-  printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-
-  if (maxPage == 0)
-    return FALSE;
-
-  m_printDialogData.SetMinPage(minPage);
-  m_printDialogData.SetMaxPage(maxPage);
-  if (fromPage != 0)
-    m_printDialogData.SetFromPage(fromPage);
-  if (toPage != 0)
-    m_printDialogData.SetToPage(toPage);
-
-  if (minPage != 0)
-  {
-    m_printDialogData.EnablePageNumbers(TRUE);
-    if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
-      m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
-    else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
-      m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
-    if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
-      m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
-    else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
-      m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
-  }
-  else
-    m_printDialogData.EnablePageNumbers(FALSE);
-
- // Create a suitable device context  
-  wxDC *dc = NULL;
-  if (prompt)
-  {
+    if (!printout)
+        return FALSE;
+    
+    printout->SetIsPreview(FALSE);
+    printout->OnPreparePrinting();
+    
+    // Get some parameters from the printout, if defined
+    int fromPage, toPage;
+    int minPage, maxPage;
+    printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
+    
+    if (maxPage == 0)
+        return FALSE;
+    
+    m_printDialogData.SetMinPage(minPage);
+    m_printDialogData.SetMaxPage(maxPage);
+    if (fromPage != 0)
+        m_printDialogData.SetFromPage(fromPage);
+    if (toPage != 0)
+        m_printDialogData.SetToPage(toPage);
+    
+    if (minPage != 0)
+    {
+        m_printDialogData.EnablePageNumbers(TRUE);
+        if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
+            m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
+        else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
+            m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
+        if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
+            m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
+        else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
+            m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
+    }
+    else
+        m_printDialogData.EnablePageNumbers(FALSE);
+    
+    // Create a suitable device context  
+    wxDC *dc = NULL;
+    if (prompt)
+    {
         wxPrintDialog dialog(parent, & m_printDialogData);
         if (dialog.ShowModal() == wxID_OK)
-               {
-                    dc = dialog.GetPrintDC();
-                    m_printDialogData = dialog.GetPrintData();
-               }
-  }
-  else
-  {
-               dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
-  }
-
-
-  // May have pressed cancel.
-  if (!dc || !dc->Ok())
-  {
-    if (dc) delete dc;
-    return FALSE;
-  }
-  
-       // on the mac we have always pixels as addressing mode with 72 dpi
-
-  printout->SetPPIScreen(72, 72);
-  printout->SetPPIPrinter(72, 72);
-
-  // Set printout parameters  
-  printout->SetDC(dc);
-
-  int w, h;
-  wxCoord ww, hh;
-  dc->GetSize(&w, &h);
-  printout->SetPageSizePixels((int)w, (int)h);
-  dc->GetSizeMM(&ww, &hh);
-  printout->SetPageSizeMM((int)ww, (int)hh);
-
-  // Create an abort window
-  wxBeginBusyCursor();
-
-  wxWindow *win = CreateAbortWindow(parent, printout);
-  wxSafeYield(win,true);
-
-  if (!win)
-  {
-    wxEndBusyCursor();
-    wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
-    delete dc;
-    return FALSE;
-  }
-  sm_abortWindow = win;
-  sm_abortWindow->Show(TRUE);
-  wxSafeYield(win,true);
-
-  printout->OnBeginPrinting();
-  
-  bool keepGoing = TRUE;
-
-  int copyCount;
-  for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
-  {
-    if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
+        {
+            dc = dialog.GetPrintDC();
+            m_printDialogData = dialog.GetPrintData();
+        }
+    }
+    else
     {
-      wxEndBusyCursor();
-      wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
-      break;
+        dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
     }
-    if (sm_abortIt)
-      break;
-
-    int pn;
-    for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
-         pn++)
+    
+    
+    // May have pressed cancel.
+    if (!dc || !dc->Ok())
     {
-      if (sm_abortIt)
-      {
-        keepGoing = FALSE;
-        break;
-      }
-      else
-      {
-               GrafPtr thePort ;
-               GetPort( &thePort ) ;
-               wxSafeYield(win,true);
-        SetPort( thePort ) ;
-
-        dc->StartPage();
-        keepGoing = printout->OnPrintPage(pn);
-        dc->EndPage();
-      }
+        if (dc) delete dc;
+        return FALSE;
     }
-    printout->OnEndDocument();
-  }
-
-  printout->OnEndPrinting();
-
-  if (sm_abortWindow)
-  {
-    sm_abortWindow->Show(FALSE);
-    delete sm_abortWindow;
-    sm_abortWindow = NULL;
-  }
-
-  wxEndBusyCursor();
-
-  delete dc;
-  
-  return TRUE;
+    
+    // on the mac we have always pixels as addressing mode with 72 dpi
+    
+    printout->SetPPIScreen(72, 72);
+    printout->SetPPIPrinter(72, 72);
+    
+    // Set printout parameters  
+    printout->SetDC(dc);
+    
+    int w, h;
+    wxCoord ww, hh;
+    dc->GetSize(&w, &h);
+    printout->SetPageSizePixels((int)w, (int)h);
+    dc->GetSizeMM(&ww, &hh);
+    printout->SetPageSizeMM((int)ww, (int)hh);
+    
+    // Create an abort window
+    wxBeginBusyCursor();
+    
+    wxWindow *win = CreateAbortWindow(parent, printout);
+    wxSafeYield(win,true);
+    
+    if (!win)
+    {
+        wxEndBusyCursor();
+        wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
+        delete dc;
+        return FALSE;
+    }
+    sm_abortWindow = win;
+    sm_abortWindow->Show(TRUE);
+    wxSafeYield(win,true);
+    
+    printout->OnBeginPrinting();
+    
+    bool keepGoing = TRUE;
+    
+    int copyCount;
+    for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
+    {
+        if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
+        {
+            wxEndBusyCursor();
+            wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
+            break;
+        }
+        if (sm_abortIt)
+            break;
+        
+        int pn;
+        for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
+        pn++)
+        {
+            if (sm_abortIt)
+            {
+                keepGoing = FALSE;
+                break;
+            }
+            else
+            {
+                GrafPtr thePort ;
+                GetPort( &thePort ) ;
+                wxSafeYield(win,true);
+                SetPort( thePort ) ;
+                
+                dc->StartPage();
+                keepGoing = printout->OnPrintPage(pn);
+                dc->EndPage();
+            }
+        }
+        printout->OnEndDocument();
+    }
+    
+    printout->OnEndPrinting();
+    
+    if (sm_abortWindow)
+    {
+        sm_abortWindow->Show(FALSE);
+        delete sm_abortWindow;
+        sm_abortWindow = NULL;
+    }
+    
+    wxEndBusyCursor();
+    
+    delete dc;
+    
+    return TRUE;
 }
 
 wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
 {
     wxDC* dc = (wxDC*) NULL;
-
+    
     wxPrintDialog dialog(parent, & m_printDialogData);
     int ret = dialog.ShowModal();
-
+    
     if (ret == wxID_OK)
     {
         dc = dialog.GetPrintDC();
         m_printDialogData = dialog.GetPrintDialogData();
     }
-
+    
     return dc;
 }
 
@@ -228,33 +228,33 @@ bool wxMacPrinter::Setup(wxWindow *parent)
 {
     wxPrintDialog dialog(parent, & m_printDialogData);
     dialog.GetPrintDialogData().SetSetupDialog(TRUE);
-
+    
     int ret = dialog.ShowModal();
-
+    
     if (ret == wxID_OK)
     {
         m_printDialogData = dialog.GetPrintDialogData();
     }
-
+    
     return (ret == wxID_OK);
 }
 
 /*
- * Print preview
- */
+* Print preview
+*/
 
 wxMacPrintPreview::wxMacPrintPreview(wxPrintout *printout,
-                                             wxPrintout *printoutForPrinting,
-                                             wxPrintDialogData *data)
-                     : wxPrintPreviewBase(printout, printoutForPrinting, data)
+                                     wxPrintout *printoutForPrinting,
+                                     wxPrintDialogData *data)
+                                     : wxPrintPreviewBase(printout, printoutForPrinting, data)
 {
     DetermineScaling();
 }
 
 wxMacPrintPreview::wxMacPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data):
-  wxPrintPreviewBase(printout, printoutForPrinting, data)
+wxPrintPreviewBase(printout, printoutForPrinting, data)
 {
-  DetermineScaling();
+    DetermineScaling();
 }
 
 wxMacPrintPreview::~wxMacPrintPreview(void)
@@ -263,43 +263,43 @@ wxMacPrintPreview::~wxMacPrintPreview(void)
 
 bool wxMacPrintPreview::Print(bool interactive)
 {
-  if (!m_printPrintout)
-    return FALSE;
-  wxMacPrinter printer(&m_printDialogData);
-  return printer.Print(m_previewFrame, m_printPrintout, interactive);
+    if (!m_printPrintout)
+        return FALSE;
+    wxMacPrinter printer(&m_printDialogData);
+    return printer.Print(m_previewFrame, m_printPrintout, interactive);
 }
 
 void wxMacPrintPreview::DetermineScaling(void)
 {
-       int screenWidth , screenHeight ;
-       wxDisplaySize( &screenWidth , &screenHeight ) ;
-       
-       m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
-       m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
-       m_previewPrintout->SetPageSizeMM( (int) (8.0 * 25.6), (int) (11.0 * 25.6) );
-       m_previewPrintout->SetPageSizePixels( 8 * 72 , 11 * 72 ) ;
+    int screenWidth , screenHeight ;
+    wxDisplaySize( &screenWidth , &screenHeight ) ;
+    
+    m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
+    m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
+    m_previewPrintout->SetPageSizeMM( (int) (8.0 * 25.6), (int) (11.0 * 25.6) );
+    m_previewPrintout->SetPageSizePixels( 8 * 72 , 11 * 72 ) ;
     m_pageWidth = 8 * 72 ;
     m_pageHeight = 11 * 72 ;
     m_previewScale = 1 ;
-
+    
     // Get a device context for the currently selected printer
     wxPrinterDC printerDC(m_printDialogData.GetPrintData());
     if (printerDC.Ok())
     {
-               int x , y ;
-               wxCoord ww, hh;
-               printerDC.GetSizeMM(&ww, &hh);
-               printerDC.GetSize( &x , &y ) ;
-               m_previewPrintout->SetPageSizeMM((int)ww, (int)hh);
-               m_previewPrintout->SetPageSizePixels( x , y) ;
-               m_pageWidth = x ;
-               m_pageHeight =  y ;
-               m_isOk = true ;
-       }
-       else
-       {
-         m_isOk = false ;
-       }
+        int x , y ;
+        wxCoord ww, hh;
+        printerDC.GetSizeMM(&ww, &hh);
+        printerDC.GetSize( &x , &y ) ;
+        m_previewPrintout->SetPageSizeMM((int)ww, (int)hh);
+        m_previewPrintout->SetPageSizePixels( x , y) ;
+        m_pageWidth = x ;
+        m_pageHeight =  y ;
+        m_isOk = true ;
+    }
+    else
+    {
+        m_isOk = false ;
+    }
     // At 100%, the page should look about page-size on the screen.
     // m_previewScale = (float)((float)screenWidth/(float)printerWidth);
     // m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
index 61e8561c2822b0e1bb3a4a7ea60d6c7b3ae6c2cf..15ac067af755ea432c02602078fc028bb05af95c 100644 (file)
@@ -6,16 +6,16 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-  #pragma implementation "radioboxbase.h"
-  #pragma implementation "radiobox.h"
+#pragma implementation "radioboxbase.h"
+#pragma implementation "radiobox.h"
 #endif
 
 //-------------------------------------------------------------------------------------
-//             headers
+//         headers
 //-------------------------------------------------------------------------------------
 
 #include "wx/defs.h"
@@ -32,7 +32,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 #pragma mark ### Constructors & destructor ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ wxRadioBox()
+//         Â¥ wxRadioBox()
 //-------------------------------------------------------------------------------------
 // Default constructor
 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
@@ -41,15 +41,15 @@ END_EVENT_TABLE()
 
 void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
 {
-  if ( outer.IsChecked() )
-  {
-    wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
-    int i = GetSelection() ;
-    event.SetInt( i );
-    event.SetString( GetString( i ) );
-    event.SetEventObject( this );
-    ProcessCommand(event);
-  }
+    if ( outer.IsChecked() )
+    {
+        wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
+        int i = GetSelection() ;
+        event.SetInt( i );
+        event.SetString( GetString( i ) );
+        event.SetEventObject( this );
+        ProcessCommand(event);
+    }
 }
 
 wxRadioBox::wxRadioBox()
@@ -61,9 +61,9 @@ wxRadioBox::wxRadioBox()
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ wxRadioBox(wxWindow*, wxWindowID, const wxString&, const wxPoint&, 
-//                                             const wxSize&, int, const wxString[], int, long, 
-//                                             const wxValidator&, const wxString&)
+//         Â¥ wxRadioBox(wxWindow*, wxWindowID, const wxString&, const wxPoint&, 
+//                        const wxSize&, int, const wxString[], int, long, 
+//                        const wxValidator&, const wxString&)
 //-------------------------------------------------------------------------------------
 // Contructor, creating and showing a radiobox
 //
@@ -71,67 +71,67 @@ wxRadioBox::wxRadioBox()
 //
 
 //-------------------------------------------------------------------------------------
-//             Â¥ ~wxRadioBox
+//         Â¥ ~wxRadioBox
 //-------------------------------------------------------------------------------------
 // Destructor, destroying the radiobox item
 
 wxRadioBox::~wxRadioBox()
 {
-       wxRadioButton *next,*current;
-       
+    wxRadioButton *next,*current;
+    
     current=m_radioButtonCycle->NextInCycle();
     next=current->NextInCycle();
     while (current!=m_radioButtonCycle) {
-       delete current;
-       current=next;
-       next=current->NextInCycle();
-       }
+        delete current;
+        current=next;
+        next=current->NextInCycle();
+    }
     delete current;    
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Create
+//         Â¥ Create
 //-------------------------------------------------------------------------------------
 // Create the radiobox for two-step construction
 
 bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
-             const wxPoint& pos, const wxSize& size,
-             int n, const wxString choices[],
-             int majorDim, long style,
-             const wxValidator& val, const wxString& name)
+                        const wxPoint& pos, const wxSize& size,
+                        int n, const wxString choices[],
+                        int majorDim, long style,
+                        const wxValidator& val, const wxString& name)
 {
     int i;
     
     m_noItems = n;
     m_noRowsOrCols = majorDim;
     m_radioButtonCycle = NULL;
-
+    
     if (majorDim==0)
         m_majorDim = n ;
     else
         m_majorDim = majorDim ;
-
-
+    
+    
     Rect bounds ;
     Str255 title ;
     
     MacPreControlCreate( parent , id ,  wxStripMenuCodes(label) , pos , size ,style, val , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-                                 kControlGroupBoxTextTitleProc , (long) this ) ;
+        kControlGroupBoxTextTitleProc , (long) this ) ;
     
     for (i = 0; i < n; i++)
     {
         wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(), wxStripMenuCodes(choices[i]),wxPoint(5,20*i+10),
-                                                  wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ;
+            wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ;
         if ( i == 0 )
-          m_radioButtonCycle = radBtn ;
-//        m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle);
+            m_radioButtonCycle = radBtn ;
+        //        m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle);
     }
-
+    
     SetSelection(0);
     MacPostControlCreate() ;
-
+    
     return TRUE;
 }
 
@@ -140,7 +140,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 #pragma mark ### Specific functions (reference v2) ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Enable(bool)
+//         Â¥ Enable(bool)
 //-------------------------------------------------------------------------------------
 // Enables or disables the entire radiobox
 
@@ -150,18 +150,18 @@ bool wxRadioBox::Enable(bool enable)
     wxRadioButton *current;
     
     if (!wxControl::Enable(enable))
-       return false;
+        return false;
     
     current = m_radioButtonCycle;
     for (i = 0; i < m_noItems; i++) {
-       current->Enable(enable);
-       current = current->NextInCycle();
+        current->Enable(enable);
+        current = current->NextInCycle();
     }
     return true;
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Enable(int, bool)
+//         Â¥ Enable(int, bool)
 //-------------------------------------------------------------------------------------
 // Enables or disables an given button
 
@@ -176,14 +176,14 @@ void wxRadioBox::Enable(int item, bool enable)
     i = 0;
     current = m_radioButtonCycle;
     while (i != item) {
-       i++;
-       current = current->NextInCycle();
+        i++;
+        current = current->NextInCycle();
     }
     current->Enable(enable);
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetLabel()
+//         Â¥ GetLabel()
 //-------------------------------------------------------------------------------------
 // Returns the radiobox label
 
@@ -193,7 +193,7 @@ wxString wxRadioBox::GetLabel() const
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetLabel(int)
+//         Â¥ GetLabel(int)
 //-------------------------------------------------------------------------------------
 // Returns the label for the given button
 
@@ -208,14 +208,14 @@ wxString wxRadioBox::GetString(int item) const
     i = 0;
     current = m_radioButtonCycle;
     while (i != item) {
-       i++;
-       current = current->NextInCycle();
+        i++;
+        current = current->NextInCycle();
     }
     return current->GetLabel();
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetSelection
+//         Â¥ GetSelection
 //-------------------------------------------------------------------------------------
 // Returns the zero-based position of the selected button
 
@@ -227,15 +227,15 @@ int wxRadioBox::GetSelection() const
     i=0;
     current=m_radioButtonCycle;
     while (!current->GetValue()) {
-       i++;
-       current=current->NextInCycle();
-       }
-
+        i++;
+        current=current->NextInCycle();
+    }
+    
     return i;
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Number
+//         Â¥ Number
 //-------------------------------------------------------------------------------------
 // Returns the number of buttons in the radiobox
 //
@@ -243,7 +243,7 @@ int wxRadioBox::GetSelection() const
 //
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetLabel(const wxString&)
+//         Â¥ SetLabel(const wxString&)
 //-------------------------------------------------------------------------------------
 // Sets the radiobox label
 
@@ -253,28 +253,28 @@ void wxRadioBox::SetLabel(const wxString& label)
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetLabel(int, const wxString&)
+//         Â¥ SetLabel(int, const wxString&)
 //-------------------------------------------------------------------------------------
 // Sets the label of a given button
 
 void wxRadioBox::SetString(int item,const wxString& label)
 {
-       int i;
+       int i;
     wxRadioButton *current;
     
     if ((item < 0) || (item >= m_noItems))
         return;
-       i=0;
+    i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
-       i++;
-       current=current->NextInCycle();
-       }
+        i++;
+        current=current->NextInCycle();
+    }
     return current->SetLabel(label);
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetSelection
+//         Â¥ SetSelection
 //-------------------------------------------------------------------------------------
 // Sets a button by passing the desired position. This does not cause 
 // wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
@@ -289,15 +289,15 @@ void wxRadioBox::SetSelection(int item)
     i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
-       i++;
-       current=current->NextInCycle();
-       }
+        i++;
+        current=current->NextInCycle();
+    }
     current->SetValue(true);
     
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Show(bool)
+//         Â¥ Show(bool)
 //-------------------------------------------------------------------------------------
 // Shows or hides the entire radiobox 
 
@@ -307,23 +307,23 @@ bool wxRadioBox::Show(bool show)
     wxRadioButton *current;
     
     wxControl::Show(show);
-
+    
     current=m_radioButtonCycle;
-       for (i=0;i<m_noItems;i++) {
-       current->Show(show);
-       current=current->NextInCycle();
-       }
+       for (i=0;i<m_noItems;i++) {
+        current->Show(show);
+        current=current->NextInCycle();
+    }
     return true;
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Show(int, bool)
+//         Â¥ Show(int, bool)
 //-------------------------------------------------------------------------------------
 // Shows or hides the given button 
 
 void wxRadioBox::Show(int item, bool show)
 {
-       int i;
+       int i;
     wxRadioButton *current;
     
     if ((item < 0) || (item >= m_noItems))
@@ -331,9 +331,9 @@ void wxRadioBox::Show(int item, bool show)
     i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
-       i++;
-       current=current->NextInCycle();
-       }
+        i++;
+        current=current->NextInCycle();
+    }
     current->Show(show);
 }
 
@@ -341,7 +341,7 @@ void wxRadioBox::Show(int item, bool show)
 #pragma mark ### Other external functions ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Command
+//         Â¥ Command
 //-------------------------------------------------------------------------------------
 // Simulates the effect of the user issuing a command to the item
 
@@ -352,7 +352,7 @@ void wxRadioBox::Command (wxCommandEvent & event)
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetFocus
+//         Â¥ SetFocus
 //-------------------------------------------------------------------------------------
 // Sets the selected button to receive keyboard input
 
@@ -364,10 +364,10 @@ void wxRadioBox::SetFocus()
     i=0;
     current=m_radioButtonCycle;
     while (!current->GetValue()) {
-       i++;
-       current=current->NextInCycle();
-       }
-       current->SetFocus();
+        i++;
+        current=current->NextInCycle();
+    }
+    current->SetFocus();
 }
 
 
@@ -375,7 +375,7 @@ void wxRadioBox::SetFocus()
 #pragma mark ### Internal functions ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ DoSetSize
+//         Â¥ DoSetSize
 //-------------------------------------------------------------------------------------
 // Simulates the effect of the user issuing a command to the item
 
@@ -383,49 +383,49 @@ void wxRadioBox::SetFocus()
 
 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
-       int i;
-       wxRadioButton *current;
-
-// define the position
-
-       int x_current, y_current;
-       int x_offset,y_offset;
+    int i;
+    wxRadioButton *current;
+    
+    // define the position
+    
+    int x_current, y_current;
+    int x_offset,y_offset;
     int widthOld, heightOld;
     GetSize(&widthOld, &heightOld);
-
-       x_offset = x;
-       y_offset = y;
-       GetPosition(&x_current, &y_current);
-       if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-               x_offset = x_current;
-       if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-               y_offset = y_current;
-
-// define size
-
-       int charWidth,charHeight;
-       int maxWidth,maxHeight;
-       int eachWidth[128],eachHeight[128];
+    
+    x_offset = x;
+    y_offset = y;
+    GetPosition(&x_current, &y_current);
+    if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+        x_offset = x_current;
+    if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+        y_offset = y_current;
+    
+    // define size
+    
+    int charWidth,charHeight;
+    int maxWidth,maxHeight;
+    int eachWidth[128],eachHeight[128];
     int totWidth,totHeight;
-
-       SetFont(GetParent()->GetFont());
-       GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
-       charWidth/=52;
-
-       maxWidth=-1;
-       maxHeight=-1;
-       for (i = 0 ; i < m_noItems; i++)
-               {
-               GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]);
-               eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
-               eachHeight[i] = (int)((3*eachHeight[i])/2);
-               if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
-               if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
-               }
-
-       totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight*3/2;
-       totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
-
+    
+    SetFont(GetParent()->GetFont());
+    GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
+    charWidth/=52;
+    
+    maxWidth=-1;
+    maxHeight=-1;
+    for (i = 0 ; i < m_noItems; i++)
+    {
+        GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]);
+        eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
+        eachHeight[i] = (int)((3*eachHeight[i])/2);
+        if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
+        if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
+          }
+    
+    totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight*3/2;
+    totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
+    
     // only change our width/height if asked for
     if ( width == -1 )
     {
@@ -434,7 +434,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         else
             width = widthOld;
     }
-
+    
     if ( height == -1 )
     {
         if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
@@ -442,44 +442,44 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         else
             height = heightOld;
     }
-
-       wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
-
-// arrange radiobuttons
-
-       int x_start,y_start;
-       
-       
-       x_start = charWidth;
-       y_start = 15 ;
-       x_offset = x_start;
-       y_offset = y_start;
-       
-       current=m_radioButtonCycle;  
-       for ( i = 0 ; i < m_noItems; i++)
-               {
-               if (i&&((i%m_majorDim)==0)) // not to do for the zero button!
-               {
-               if (m_windowStyle & wxRA_VERTICAL)
-                       {
-                           x_offset += maxWidth + charWidth;
-                       y_offset = y_start;
-                               }
-               else
-                       {
-                               x_offset = x_start;
-                       y_offset += maxHeight ; /*+ charHeight/2;*/
-                               }
-                       }
-
-               current->SetSize(x_offset,y_offset,eachWidth[i],eachHeight[i]);
-               current=current->NextInCycle();
-               
-               if (m_windowStyle & wxRA_SPECIFY_ROWS)
-                       y_offset += maxHeight ; /*+ charHeight/2;*/
-               else
-                       x_offset += maxWidth + charWidth;
-               }
+    
+    wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
+    
+    // arrange radiobuttons
+    
+    int x_start,y_start;
+    
+    
+    x_start = charWidth;
+    y_start = 15 ;
+    x_offset = x_start;
+    y_offset = y_start;
+    
+    current=m_radioButtonCycle;  
+    for ( i = 0 ; i < m_noItems; i++)
+    {
+        if (i&&((i%m_majorDim)==0)) // not to do for the zero button!
+        {
+            if (m_windowStyle & wxRA_VERTICAL)
+            {
+                x_offset += maxWidth + charWidth;
+                y_offset = y_start;
+            }
+            else
+            {
+                x_offset = x_start;
+                y_offset += maxHeight ; /*+ charHeight/2;*/
+            }
+        }
+        
+        current->SetSize(x_offset,y_offset,eachWidth[i],eachHeight[i]);
+        current=current->NextInCycle();
+        
+        if (m_windowStyle & wxRA_SPECIFY_ROWS)
+            y_offset += maxHeight ; /*+ charHeight/2;*/
+        else
+            x_offset += maxWidth + charWidth;
+    }
 }
 
 wxSize wxRadioBox::DoGetBestSize() const
@@ -488,37 +488,37 @@ wxSize wxRadioBox::DoGetBestSize() const
     int maxWidth, maxHeight;
     int eachWidth, eachHeight;
     int totWidth, totHeight;
-
+    
     wxFont font = GetParent()->GetFont();
     GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
-                  &charWidth, &charHeight, NULL, NULL, &font);
+        &charWidth, &charHeight, NULL, NULL, &font);
     charWidth /= 52;
-
-   maxWidth = -1;
-   maxHeight = -1;
-
-   for (int i = 0 ; i < m_noItems; i++)
-   {
+    
+    maxWidth = -1;
+    maxHeight = -1;
+    
+    for (int i = 0 ; i < m_noItems; i++)
+    {
         GetTextExtent(GetString(i), &eachWidth, &eachHeight);
         eachWidth  = (int)(eachWidth + RADIO_SIZE) ;
         eachHeight = (int)((3 * eachHeight) / 2);
         if (maxWidth < eachWidth)     maxWidth = eachWidth;
         if (maxHeight < eachHeight)   maxHeight = eachHeight;
     }
-
+    
     totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight * 3/2;
     totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
-
+    
     // handle radio box title as well
     GetTextExtent(GetTitle(), &eachWidth, NULL);
     eachWidth  = (int)(eachWidth + RADIO_SIZE) + 3 * charWidth ;
     if (totWidth < eachWidth)     
         totWidth = eachWidth;
-
-   return wxSize(totWidth, totHeight);
+    
+    return wxSize(totWidth, totHeight);
 }
 //-------------------------------------------------------------------------------------
-//             Â¥ GetNumVer
+//         Â¥ GetNumVer
 //-------------------------------------------------------------------------------------
 // return the number of buttons in the vertical direction
 
@@ -535,7 +535,7 @@ int wxRadioBox::GetRowCount() const
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetNumHor
+//         Â¥ GetNumHor
 //-------------------------------------------------------------------------------------
 // return the number of buttons in the horizontal direction
 
index e94c762f1d6ac5c8564b1410efd55713ba10a1d2..46014e45765ca13a3c14446ed58a56ccff26f18c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -24,27 +24,27 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
 #include "wx/mac/uma.h"
 
 bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
-                  const wxString& label,
+           const wxString& label,
            const wxPoint& pos,
            const wxSize& size, long style,
            const wxValidator& validator,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlRadioButtonProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlRadioButtonProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
 
   m_cycle = this ;
   
   if (HasFlag(wxRB_GROUP))
   {
-         AddInCycle( NULL ) ;
+      AddInCycle( NULL ) ;
   }
   else
   {
@@ -68,21 +68,21 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
 
 void wxRadioButton::SetValue(bool val)
 {
-       wxRadioButton *cycle;
-         if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val )
-           return ;
-           
+    wxRadioButton *cycle;
+      if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val )
+        return ;
+        
    ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ;
    if (val) 
    {
-               cycle=this->NextInCycle();
-               if (cycle!=NULL) {
-                       while (cycle!=this) {
-                               cycle->SetValue(false);
-                               cycle=cycle->NextInCycle();
-                               }
-                       }
-               }
+           cycle=this->NextInCycle();
+          if (cycle!=NULL) {
+               while (cycle!=this) {
+                   cycle->SetValue(false);
+                   cycle=cycle->NextInCycle();
+                   }
+               }
+           }
    MacRedrawControl() ;
 }
 
@@ -102,19 +102,19 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar
     if ( GetValue() )
       return ;
       
-         wxRadioButton *cycle, *old = NULL ;
+      wxRadioButton *cycle, *old = NULL ;
     cycle=this->NextInCycle();
     if (cycle!=NULL) {
-         while (cycle!=this) {
-           if ( cycle->GetValue() ) {
-             old = cycle ;
-                   cycle->SetValue(false);
-                 }
-                 cycle=cycle->NextInCycle();
-               }
+          while (cycle!=this) {
+            if ( cycle->GetValue() ) {
+              old = cycle ;
+                cycle->SetValue(false);
+              }
+              cycle=cycle->NextInCycle();
+            }
     }
 
-         SetValue(true) ;
+      SetValue(true) ;
 
     if ( old ) {
       wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, old->m_windowId );
@@ -130,18 +130,18 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar
 
 wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
 {
-       wxRadioButton *next,*current;
-               
-       if (cycle==NULL) {
-               m_cycle=this;
-               return(this);
-               }
-       else {
-               current=cycle;
-               while ((next=current->m_cycle)!=cycle) 
-                 current=current->m_cycle;
-               m_cycle=cycle;
-               current->m_cycle=this;
-               return(cycle);
-       }
+    wxRadioButton *next,*current;
+        
+    if (cycle==NULL) {
+        m_cycle=this;
+        return(this);
+        }
+    else {
+        current=cycle;
+          while ((next=current->m_cycle)!=cycle) 
+            current=current->m_cycle;
+          m_cycle=cycle;
+          current->m_cycle=this;
+          return(cycle);
+      }
 }  
index 6c1ef13da2dc1b969ca3470b7a9cef84c670fb1b..b151987990a8bdcf0def42afd4e8291e07405c27 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:   Region class
 // Author:    Markus Holzem/Julian Smart/Stefan Csomor
 // Created:   Fri Oct 24 10:46:34 MET 1997
-// RCS-ID:       $Id$
+// RCS-ID:      $Id$
 // Copyright: (c) 1997 Markus Holzem/Julian Smart/Stefan Csomor
 // Licence:   wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -17,8 +17,8 @@
 #include "wx/mac/uma.h"
 
 #if !USE_SHARED_LIBRARY
-       IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
-       IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
 #endif
 
 //-----------------------------------------------------------------------------
@@ -43,7 +43,7 @@ public:
     {
         DisposeRgn( m_macRgn ) ;
     }
-    RgnHandle  m_macRgn ;
+    RgnHandle    m_macRgn ;
 };
 
 #define M_REGION (((wxRegionRefData*)m_refData)->m_macRgn)
@@ -106,20 +106,20 @@ void wxRegion::Clear()
 //! Combine rectangle (x, y, w, h) with this.
 bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
 {
-       // Don't change shared data
-       if (!m_refData) 
-       {
-               m_refData = new wxRegionRefData();
-       
-       else if (m_refData->GetRefCount() > 1) 
-       {
-               wxRegionRefData* ref = (wxRegionRefData*)m_refData;
-               UnRef();
-               m_refData = new wxRegionRefData(*ref);
-       }
+    // Don't change shared data
+    if (!m_refData) 
+    {
+        m_refData = new wxRegionRefData();
+    } 
+    else if (m_refData->GetRefCount() > 1) 
+    {
+        wxRegionRefData* ref = (wxRegionRefData*)m_refData;
+        UnRef();
+        m_refData = new wxRegionRefData(*ref);
+    }
     RgnHandle rgn = NewRgn() ;
-               SetRectRgn( rgn , x , y, x+width,y + height ) ;
-               
+        SetRectRgn( rgn , x , y, x+width,y + height ) ;
+        
     switch (op)
     {
         case wxRGN_AND:
@@ -136,11 +136,11 @@ bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
             break ;
         case wxRGN_COPY:
         default:
-                               CopyRgn( rgn ,M_REGION ) ;
+                   CopyRgn( rgn ,M_REGION ) ;
             break ;
     }
 
-               DisposeRgn( rgn ) ;
+        DisposeRgn( rgn ) ;
 
     return TRUE;
 }
@@ -148,19 +148,19 @@ bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
 //! Union /e region with this.
 bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
 {
-       if (region.Empty())
-               return FALSE;
-
-       // Don't change shared data
-       if (!m_refData) {
-               m_refData = new wxRegionRefData();
-       
-       else    if (m_refData->GetRefCount() > 1) 
-       {
-               wxRegionRefData* ref = (wxRegionRefData*)m_refData;
-               UnRef();
-               m_refData = new wxRegionRefData(*ref);
-       }
+    if (region.Empty())
+        return FALSE;
+
+    // Don't change shared data
+    if (!m_refData) {
+        m_refData = new wxRegionRefData();
+    } 
+    else    if (m_refData->GetRefCount() > 1) 
+    {
+        wxRegionRefData* ref = (wxRegionRefData*)m_refData;
+        UnRef();
+        m_refData = new wxRegionRefData(*ref);
+    }
 
     switch (op)
     {
@@ -178,11 +178,11 @@ bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
             break ;
         case wxRGN_COPY:
         default:
-                               CopyRgn( OTHER_M_REGION(region) ,M_REGION ) ;
+                   CopyRgn( OTHER_M_REGION(region) ,M_REGION ) ;
             break ;
     }
 
-       return TRUE;
+    return TRUE;
 }
 
 bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
@@ -197,19 +197,19 @@ bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
 // Outer bounds of region
 void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const
 {
-       if (m_refData) 
-       {
-               Rect box ;
-               GetRegionBounds( M_REGION , &box ) ;
+    if (m_refData) 
+    {
+        Rect box ;
+        GetRegionBounds( M_REGION , &box ) ;
         x = box.left ;
         y = box.top ;
         w = box.right - box.left ;
         h = box.bottom - box.top ;
-       
-       else 
-       {
-               x = y = w = h = 0;
-       }
+    } 
+    else 
+    {
+        x = y = w = h = 0;
+    }
 }
 
 wxRect wxRegion::GetBox() const
@@ -227,7 +227,7 @@ bool wxRegion::Empty() const
 
 const WXHRGN wxRegion::GetWXHRGN() const
 {
-       return M_REGION ;
+    return M_REGION ;
 }
 
 //-----------------------------------------------------------------------------
@@ -237,8 +237,8 @@ const WXHRGN wxRegion::GetWXHRGN() const
 // Does the region contain the point (x,y)?
 wxRegionContain wxRegion::Contains(long x, long y) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     // TODO. Return wxInRegion if within region.
     if (0)
@@ -249,8 +249,8 @@ wxRegionContain wxRegion::Contains(long x, long y) const
 // Does the region contain the point pt?
 wxRegionContain wxRegion::Contains(const wxPoint& pt) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     Point p = { pt.y , pt.x } ;
     if (PtInRgn( p , M_REGION ) )
@@ -262,8 +262,8 @@ wxRegionContain wxRegion::Contains(const wxPoint& pt) const
 // Does the region contain the rectangle (x, y, w, h)?
 wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     Rect rect = { y , x , y + h , x + w } ;
     if (RectInRgn( &rect , M_REGION ) )
@@ -275,8 +275,8 @@ wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
 // Does the region contain the rectangle rect
 wxRegionContain wxRegion::Contains(const wxRect& rect) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     long x, y, w, h;
     x = rect.x;
@@ -370,7 +370,7 @@ void wxRegionIterator::Reset(const wxRegion& region)
         m_numRects = 0;
     else
     {
-       // we cannot dissolve it into rects on mac
+        // we cannot dissolve it into rects on mac
         m_rects = new wxRect[1];
         Rect rect ;
         GetRegionBounds( OTHER_M_REGION( region ) , &rect ) ;
@@ -409,29 +409,29 @@ wxRegionIterator wxRegionIterator::operator ++ (int)
 
 long wxRegionIterator::GetX() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].x;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].x;
+    return 0;
 }
 
 long wxRegionIterator::GetY() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].y;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].y;
+    return 0;
 }
 
 long wxRegionIterator::GetW() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].width ;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].width ;
+    return 0;
 }
 
 long wxRegionIterator::GetH() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].height;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].height;
+    return 0;
 }
 
index d341b03c4a801b81121c32b35b4ca2cc8a1943cc..6f57b2c40dd86fdcdc818bd583a24773fae410ca 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -43,19 +43,19 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
   if (!parent)
       return FALSE;
     
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, 
-               kControlScrollBarLiveProc , (long) this ) ;
-       
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, 
+        kControlScrollBarLiveProc , (long) this ) ;
+    
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
 
-       ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
+    ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
 
-       MacPostControlCreate() ;
+    MacPostControlCreate() ;
 
   return TRUE;
 }
@@ -81,7 +81,7 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
     m_viewSize = thumbSize;
     m_objectSize = range;
 
-       int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
+      int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
 
     SetControl32BitMaximum( (ControlHandle) m_macControl , range1 ) ;
     SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
@@ -91,7 +91,7 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
     {
         if ( SetControlViewSize != (void*) kUnresolvedCFragSymbolAddress )
         {
-                           SetControlViewSize( (ControlHandle) m_macControl , m_viewSize ) ;
+                SetControlViewSize( (ControlHandle) m_macControl , m_viewSize ) ;
         }
     }
     if ( refresh )
@@ -107,70 +107,70 @@ void wxScrollBar::Command(wxCommandEvent& event)
 
 void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-       
-  int position = GetControl32BitValue( (ControlHandle) m_macControl) ;
-  int minPos = GetControl32BitMinimum( (ControlHandle) m_macControl) ;
-  int maxPos = GetControl32BitMaximum( (ControlHandle) m_macControl) ;
-
-  wxEventType scrollEvent = wxEVT_NULL;
-  int nScrollInc;
-
-       switch( controlpart )
-       {
-               case kControlUpButtonPart :
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+    
+    int position = GetControl32BitValue( (ControlHandle) m_macControl) ;
+    int minPos = GetControl32BitMinimum( (ControlHandle) m_macControl) ;
+    int maxPos = GetControl32BitMaximum( (ControlHandle) m_macControl) ;
+    
+    wxEventType scrollEvent = wxEVT_NULL;
+    int nScrollInc;
+    
+    switch( controlpart )
+    {
+    case kControlUpButtonPart :
         nScrollInc = -1;
         scrollEvent = wxEVT_SCROLL_LINEUP;
-                       break ;
-               case kControlDownButtonPart :
+        break ;
+    case kControlDownButtonPart :
         nScrollInc = 1;
         scrollEvent = wxEVT_SCROLL_LINEDOWN;
-                       break ;
-               case kControlPageUpPart :
+        break ;
+    case kControlPageUpPart :
         nScrollInc = -m_pageSize;
         scrollEvent = wxEVT_SCROLL_PAGEUP;
-                       break ;
-               case kControlPageDownPart :
+        break ;
+    case kControlPageDownPart :
         nScrollInc = m_pageSize;
         scrollEvent = wxEVT_SCROLL_PAGEDOWN;
-                       break ;
-               case kControlIndicatorPart :
+        break ;
+    case kControlIndicatorPart :
         nScrollInc = 0 ;
         scrollEvent = wxEVT_SCROLL_THUMBTRACK;
-                       break ;
-                default :
-                        wxFAIL_MSG(wxT("illegal scrollbar selector"));
-                        break ;
-       }
-
-  int new_pos = position + nScrollInc;
-
-  if (new_pos < minPos)
-      new_pos = minPos;
-  if (new_pos > maxPos)
-      new_pos = maxPos;
-       if ( nScrollInc )
-       SetThumbPosition(new_pos);
-       
-  wxScrollEvent event(scrollEvent, m_windowId);
-       if ( m_windowStyle & wxHORIZONTAL )
-       {
-               event.SetOrientation( wxHORIZONTAL ) ;
-       }
-       else
-       {
-               event.SetOrientation( wxVERTICAL ) ;
-       }
-  event.SetPosition(new_pos);
-  event.SetEventObject( this );
-  wxWindow* window = GetParent() ;
-  if (window && window->MacIsWindowScrollbar(this) )
-  {
-       // this is hardcoded
-       window->MacOnScroll(event);
-  }
-  else
-       GetEventHandler()->ProcessEvent(event);
+        break ;
+    default :
+        wxFAIL_MSG(wxT("illegal scrollbar selector"));
+        break ;
+    }
+    
+    int new_pos = position + nScrollInc;
+    
+    if (new_pos < minPos)
+        new_pos = minPos;
+    if (new_pos > maxPos)
+        new_pos = maxPos;
+    if ( nScrollInc )
+        SetThumbPosition(new_pos);
+    
+    wxScrollEvent event(scrollEvent, m_windowId);
+    if ( m_windowStyle & wxHORIZONTAL )
+    {
+        event.SetOrientation( wxHORIZONTAL ) ;
+    }
+    else
+    {
+        event.SetOrientation( wxVERTICAL ) ;
+    }
+    event.SetPosition(new_pos);
+    event.SetEventObject( this );
+    wxWindow* window = GetParent() ;
+    if (window && window->MacIsWindowScrollbar(this) )
+    {
+        // this is hardcoded
+        window->MacOnScroll(event);
+    }
+    else
+        GetEventHandler()->ProcessEvent(event);
 }
 
index f27d107c8308de6c3fa30287ac2c018a5f5bee9f..2a95191da231177787ef538b918480d750a81c37 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -24,101 +24,100 @@ END_EVENT_TABLE()
 #endif
 
  // The dimensions of the different styles of sliders (From Aqua document)
- #define wxSLIDER_DIMENSIONACROSS 15
- #define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
- #define wxSLIDER_DIMENSIONACROSS_ARROW 18
+#define wxSLIDER_DIMENSIONACROSS 15
+#define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
+#define wxSLIDER_DIMENSIONACROSS_ARROW 18
  
- // Distance between slider and text
- #define wxSLIDER_BORDERTEXT 5
+// Distance between slider and text
+#define wxSLIDER_BORDERTEXT 5
  
- /* NB!  The default orientation for a slider is horizontal however if the user specifies
-  * some slider styles but dosen't specify the orientation we have to assume he wants a
-  * horizontal one.  Therefore in this file when testing for the sliders orientation
-  * vertical is tested for if this is not set then we use the horizontal one
-  * eg.  if(GetWindowStyle() & wxSL_VERTICAL) {}  else { horizontal case }>  
-  */
-
-
-// Slider
-wxSlider::wxSlider()
+/* NB!  The default orientation for a slider is horizontal however if the user specifies
+ * some slider styles but dosen't specify the orientation we have to assume he wants a
+ * horizontal one.  Therefore in this file when testing for the sliders orientation
+ * vertical is tested for if this is not set then we use the horizontal one
+ * eg.  if(GetWindowStyle() & wxSL_VERTICAL) {}  else { horizontal case }>  
+ */
+
+ // Slider
+ wxSlider::wxSlider()
 {
-  m_pageSize = 1;
-  m_lineSize = 1;
-  m_rangeMax = 0;
-  m_rangeMin = 0;
-  m_tickFreq = 0;
+    m_pageSize = 1;
+    m_lineSize = 1;
+    m_rangeMax = 0;
+    m_rangeMin = 0;
+    m_tickFreq = 0;
 }
 
 extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
 
 bool wxSlider::Create(wxWindow *parent, wxWindowID id,
-           int value, int minValue, int maxValue,
-           const wxPoint& pos,
-           const wxSize& size, long style,
-           const wxValidator& validator,
-           const wxString& name)
+                      int value, int minValue, int maxValue,
+                      const wxPoint& pos,
+                      const wxSize& size, long style,
+                      const wxValidator& validator,
+                      const wxString& name)
 {
-     Rect bounds ;
-     Str255 title ;
-     SInt16 procID;
-
-     m_macMinimumStatic = NULL ;
-     m_macMaximumStatic = NULL ;
-     m_macValueStatic = NULL ;
-
-
-     m_lineSize = 1;
-     m_tickFreq = 0;
-     m_rangeMax = maxValue;
-     m_rangeMin = minValue;
-     m_pageSize = (int)((maxValue-minValue)/10);
-     MacPreControlCreate( parent, id, "", pos, size, style,
-                          validator, name, &bounds, title );
-     procID = kControlSliderProc + kControlSliderLiveFeedback;
-     if(style & wxSL_AUTOTICKS) {
-         procID += kControlSliderHasTickMarks;
+    Rect bounds ;
+    Str255 title ;
+    SInt16 procID;
+    
+    m_macMinimumStatic = NULL ;
+    m_macMaximumStatic = NULL ;
+    m_macValueStatic = NULL ;
+    
+    
+    m_lineSize = 1;
+    m_tickFreq = 0;
+    
+    m_rangeMax = maxValue;
+    m_rangeMin = minValue;
+    
+    m_pageSize = (int)((maxValue-minValue)/10);
+    
+    MacPreControlCreate( parent, id, "", pos, size, style,
+        validator, name, &bounds, title );
+    
+    procID = kControlSliderProc + kControlSliderLiveFeedback;
+    if(style & wxSL_AUTOTICKS) {
+        procID += kControlSliderHasTickMarks;
     }
-  
-
-     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
-                                   value, minValue, maxValue, procID, (long) this);
-     wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-     ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
-     if(style & wxSL_LABELS)
-     {
-         m_macMinimumStatic = new wxStaticText( this, -1, "" );
-         m_macMaximumStatic = new wxStaticText( this, -1, "" );
-         m_macValueStatic = new wxStaticText( this, -1, "" );
-         SetRange(minValue, maxValue);
-         SetValue(value);
+    
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
+        value, minValue, maxValue, procID, (long) this);
+    
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
+    
+    if(style & wxSL_LABELS)
+    {
+        m_macMinimumStatic = new wxStaticText( this, -1, "" );
+        m_macMaximumStatic = new wxStaticText( this, -1, "" );
+        m_macValueStatic = new wxStaticText( this, -1, "" );
+        SetRange(minValue, maxValue);
+        SetValue(value);
     }
-  
-     else {
-         m_macMinimumStatic = NULL ;
-         m_macMaximumStatic = NULL ;
-         m_macValueStatic = NULL ;
-     }
-     if(style & wxSL_VERTICAL) {
-         SetSizeHints(10, -1, 10, -1);  // Forces SetSize to use the proper width
-     }
-     else {
-         SetSizeHints(-1, 10, -1, 10);  // Forces SetSize to use the proper height
-     }
-     // NB!  SetSizeHints is overloaded by wxSlider and will substitute 10 with the
-     // proper dimensions, it also means other people cannot bugger the slider with
-     // other values
-     MacPostControlCreate() ;
-     return true;
+    
+    else {
+        m_macMinimumStatic = NULL ;
+        m_macMaximumStatic = NULL ;
+        m_macValueStatic = NULL ;
+    }
+    
+    if(style & wxSL_VERTICAL) {
+        SetSizeHints(10, -1, 10, -1);  // Forces SetSize to use the proper width
+    }
+    else {
+        SetSizeHints(-1, 10, -1, 10);  // Forces SetSize to use the proper height
+    }
+    // NB!  SetSizeHints is overloaded by wxSlider and will substitute 10 with the
+    // proper dimensions, it also means other people cannot bugger the slider with
+    // other values
+    
+    MacPostControlCreate() ;
+    
+    return true;
 }
 
 wxSlider::~wxSlider()
@@ -127,37 +126,37 @@ wxSlider::~wxSlider()
 
 int wxSlider::GetValue() const
 {
-       return GetControl32BitValue( (ControlHandle) m_macControl) ;
+    return GetControl32BitValue( (ControlHandle) m_macControl) ;
 }
 
 void wxSlider::SetValue(int value)
 {
-       wxString valuestring ;
-       valuestring.Printf( "%d" , value ) ;    
-       if ( m_macValueStatic )
-               m_macValueStatic->SetLabel( valuestring ) ;
-       SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
+    wxString valuestring ;
+    valuestring.Printf( "%d" , value ) ;    
+    if ( m_macValueStatic )
+        m_macValueStatic->SetLabel( valuestring ) ;
+    SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
 }
 
 void wxSlider::SetRange(int minValue, int maxValue)
 {
-  wxString value;
-
-  m_rangeMin = minValue;
-  m_rangeMax = maxValue;
-
-  SetControl32BitMinimum( (ControlHandle) m_macControl, m_rangeMin);
-  SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
-  
-  if(m_macMinimumStatic) {
-    value.Printf("%d", m_rangeMin);
-    m_macMinimumStatic->SetLabel(value);
-  }
-  if(m_macMaximumStatic) {
-    value.Printf("%d", m_rangeMax);
-    m_macMaximumStatic->SetLabel(value);
-  }
-  SetValue(m_rangeMin);
+    wxString value;
+    
+    m_rangeMin = minValue;
+    m_rangeMax = maxValue;
+    
+    SetControl32BitMinimum( (ControlHandle) m_macControl, m_rangeMin);
+    SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
+    
+    if(m_macMinimumStatic) {
+        value.Printf("%d", m_rangeMin);
+        m_macMinimumStatic->SetLabel(value);
+    }
+    if(m_macMaximumStatic) {
+        value.Printf("%d", m_rangeMax);
+        m_macMaximumStatic->SetLabel(value);
+    }
+    SetValue(m_rangeMin);
 }
 
 // For trackbars only
@@ -235,164 +234,164 @@ void wxSlider::SetTick(int tickPos)
 
 void wxSlider::Command (wxCommandEvent & event)
 {
-  SetValue (event.GetInt());
-  ProcessCommand (event);
+    SetValue (event.GetInt());
+    ProcessCommand (event);
 }
 
 void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-       SInt16 value = ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
-       
-       SetValue( value ) ;             
-       
-       wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
-       event.SetPosition(value);
-       event.SetEventObject( this );
-       GetEventHandler()->ProcessEvent(event);
-
-  wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
-  cevent.SetInt( value );
-  cevent.SetEventObject( this );
-
-  GetEventHandler()->ProcessEvent( cevent );
+    SInt16 value = ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
+    
+    SetValue( value ) ;        
+    
+    wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
+    event.SetPosition(value);
+    event.SetEventObject( this );
+    GetEventHandler()->ProcessEvent(event);
+    
+    wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
+    cevent.SetInt( value );
+    cevent.SetEventObject( this );
+    
+    GetEventHandler()->ProcessEvent( cevent );
+}
+
+/* This is overloaded in wxSlider so that the proper width/height will always be used
+* for the slider different values would cause redrawing and mouse detection problems */
+void wxSlider::SetSizeHints( int minW, int minH,
+                            int maxW , int maxH ,
+                            int incW , int incH )
+{
+    wxSize size = GetBestSize();
+    
+    if(GetWindowStyle() & wxSL_VERTICAL) {
+        wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
+    }
+    else {
+        wxWindow::SetSizeHints(minW, size.y, maxW, size.y, incW, incH);
+    }
 }
 
- /* This is overloaded in wxSlider so that the proper width/height will always be used
-  * for the slider different values would cause redrawing and mouse detection problems */
- void wxSlider::SetSizeHints( int minW, int minH,
-                              int maxW , int maxH ,
-                              int incW , int incH )
- {
-     wxSize size = GetBestSize();
-     if(GetWindowStyle() & wxSL_VERTICAL) {
-         wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
-     }
-     else {
-         wxWindow::SetSizeHints(minW, size.y, maxW, size.y, incW, incH);
-     }
- }
- wxSize wxSlider::DoGetBestSize() const
- {
-     wxSize size;
-     int textwidth, textheight;
-     if(GetWindowStyle() & wxSL_LABELS)
-     {
-         wxString text;
-         int ht, wd;
-         // Get maximum text label width and height
-         text.Printf("%d", m_rangeMin);
-         GetTextExtent(text, &textwidth, &textheight);
-         text.Printf("%d", m_rangeMax);
-         GetTextExtent(text, &wd, &ht);
-         if(ht > textheight) {
-             textheight = ht;
-         }
-         if (wd > textwidth) {
-             textwidth = wd;
-         }
-     }
-     if(GetWindowStyle() & wxSL_VERTICAL)
-     {
-         if(GetWindowStyle() & wxSL_AUTOTICKS) {
-             size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
-         }
-         else {
-             size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
-         }
-         if(GetWindowStyle() & wxSL_LABELS) {
-             size.x += textwidth + wxSLIDER_BORDERTEXT;
-         }
-         size.y = 150;
-     }
-     else
-     {
-         if(GetWindowStyle() & wxSL_AUTOTICKS) {
-             size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
-         }
-         else {
-             size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
-         }
-         if(GetWindowStyle() & wxSL_LABELS) {
-             size.y += textheight + wxSLIDER_BORDERTEXT;
-         }
-         size.x = 150;
-     }
-     return size;
- }
- void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
- {
+wxSize wxSlider::DoGetBestSize() const
+{
+    wxSize size;
+    int textwidth, textheight;
+    
+    if(GetWindowStyle() & wxSL_LABELS)
+    {
+        wxString text;
+        int ht, wd;
+        
+        // Get maximum text label width and height
+        text.Printf("%d", m_rangeMin);
+        GetTextExtent(text, &textwidth, &textheight);
+        text.Printf("%d", m_rangeMax);
+        GetTextExtent(text, &wd, &ht);
+        if(ht > textheight) {
+            textheight = ht;
+        }
+        if (wd > textwidth) {
+            textwidth = wd;
+        }
+    }
+    
+    if(GetWindowStyle() & wxSL_VERTICAL)
+    {
+        if(GetWindowStyle() & wxSL_AUTOTICKS) {
+            size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+        }
+        else {
+            size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
+        }
+        if(GetWindowStyle() & wxSL_LABELS) {
+            size.x += textwidth + wxSLIDER_BORDERTEXT;
+        }
+        size.y = 150;
+    }
+    else
+    {
+        if(GetWindowStyle() & wxSL_AUTOTICKS) {
+            size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+        }
+        else {
+            size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
+        }
+        if(GetWindowStyle() & wxSL_LABELS) {
+            size.y += textheight + wxSLIDER_BORDERTEXT;
+        }
+        size.x = 150;
+    }
+    return size;
+}
+
+void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{
     wxControl::DoSetSize( x, y , width , height ,sizeFlags ) ;
- }
- void wxSlider::MacUpdateDimensions() 
+}
+
+void wxSlider::MacUpdateDimensions() 
 {
-       // actually in the current systems this should never be possible, but later reparenting
-       // may become a reality
-       
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-               
-       if ( GetParent() == NULL )
-               return ;
-               
+    // actually in the current systems this should never be possible, but later reparenting
+    // may become a reality
+    
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+    
+    if ( GetParent() == NULL )
+        return ;
+    
     WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
     if ( rootwindow == NULL )
-       return ;
-       
-     int  xborder, yborder;
-     int  minValWidth, maxValWidth, textwidth, textheight;
-     int  sliderBreadth;
-     xborder = yborder = 0;
-
-     if (GetWindowStyle() & wxSL_LABELS)
-     {
-         wxString text;
-         int ht;
-         // Get maximum text label width and height
-         text.Printf("%d", m_rangeMin);
-         GetTextExtent(text, &minValWidth, &textheight);
-         text.Printf("%d", m_rangeMax);
-         GetTextExtent(text, &maxValWidth, &ht);
-         if(ht > textheight) {
-             textheight = ht;
-         }
-         textwidth = (minValWidth > maxValWidth ? minValWidth : maxValWidth);
-         xborder = textwidth + wxSLIDER_BORDERTEXT;
-         yborder = textheight + wxSLIDER_BORDERTEXT;
-         // Get slider breadth
-         if(GetWindowStyle() & wxSL_AUTOTICKS) {
-             sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
-         }
-         else {
-             sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
-         }
-         if(GetWindowStyle() & wxSL_VERTICAL)
-         {
-             m_macMinimumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT,
-                                      m_height - yborder - textheight);
-             m_macMaximumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT, 0);
-             m_macValueStatic->Move(0, m_height - textheight);
-         }
-         else
-         {
-             m_macMinimumStatic->Move(0, sliderBreadth + wxSLIDER_BORDERTEXT);
-             m_macMaximumStatic->Move(m_width - xborder - maxValWidth / 2,
-                                      sliderBreadth + wxSLIDER_BORDERTEXT);
-             m_macValueStatic->Move(m_width - textwidth, 0);
-         }
-     }
-
+        return ;
+    
+    int  xborder, yborder;
+    int  minValWidth, maxValWidth, textwidth, textheight;
+    int  sliderBreadth;
+    
+    xborder = yborder = 0;
+    
+    if (GetWindowStyle() & wxSL_LABELS)
+    {
+        wxString text;
+        int ht;
+        
+        // Get maximum text label width and height
+        text.Printf("%d", m_rangeMin);
+        GetTextExtent(text, &minValWidth, &textheight);
+        text.Printf("%d", m_rangeMax);
+        GetTextExtent(text, &maxValWidth, &ht);
+        if(ht > textheight) {
+            textheight = ht;
+        }
+        textwidth = (minValWidth > maxValWidth ? minValWidth : maxValWidth);
+        
+        xborder = textwidth + wxSLIDER_BORDERTEXT;
+        yborder = textheight + wxSLIDER_BORDERTEXT;
+        
+        // Get slider breadth
+        if(GetWindowStyle() & wxSL_AUTOTICKS) {
+            sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+        }
+        else {
+            sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
+        }
+        
+        if(GetWindowStyle() & wxSL_VERTICAL)
+        {
+            m_macMinimumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT,
+                m_height - yborder - textheight);
+            m_macMaximumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT, 0);
+            m_macValueStatic->Move(0, m_height - textheight);
+        }
+        else
+        {
+            m_macMinimumStatic->Move(0, sliderBreadth + wxSLIDER_BORDERTEXT);
+            m_macMaximumStatic->Move(m_width - xborder - maxValWidth / 2,
+                sliderBreadth + wxSLIDER_BORDERTEXT);
+            m_macValueStatic->Move(m_width - textwidth, 0);
+        }
+    }
+    
     Rect oldBounds ;       
     GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ; 
     
@@ -404,18 +403,18 @@ void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
     GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
     bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
     bool doResize =  ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
-       if ( doMove || doResize )
-       {
-               InvalWindowRect( rootwindow, &oldBounds ) ;
-               if ( doMove )
-               {
-                       UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
-               }
-               if ( doResize )
-               {
-                       UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
-               }
-       }
+    if ( doMove || doResize )
+    {
+        InvalWindowRect( rootwindow, &oldBounds ) ;
+        if ( doMove )
+        {
+            UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
+        }
+        if ( doResize )
+        {
+            UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
+        }
+    }
 }
 
 void wxSlider::DoMoveWindow(int x, int y, int width, int height)
index 85fd2d0b0835639b024aaa137e67c6e73b78eaca..b36c755f7e44ae3c9b67811d613fe4b64947c140 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -36,29 +36,29 @@ wxSpinButton::wxSpinButton()
 }
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
-            long style, const wxString& name)
+        long style, const wxString& name)
 {
     m_min = 0;
     m_max = 100;
-
-  if (!parent)
-      return FALSE;
     
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, 
-               kControlLittleArrowsProc , (long) this ) ;
-       
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-
-       MacPostControlCreate() ;
-
-  return TRUE;
+    if (!parent)
+        return FALSE;
+    
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, 
+        kControlLittleArrowsProc , (long) this ) ;
+    
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    MacPostControlCreate() ;
+    
+    return TRUE;
 }
-
+    
 wxSpinButton::~wxSpinButton()
 {
 }
@@ -68,12 +68,12 @@ wxSpinButton::~wxSpinButton()
 
 int wxSpinButton::GetMin() const
 {
-   return m_min;
+    return m_min;
 }
 
 int wxSpinButton::GetMax() const
 {
-   return m_max;
+    return m_max;
 }
 
 int wxSpinButton::GetValue() const
@@ -83,50 +83,50 @@ int wxSpinButton::GetValue() const
 
 void wxSpinButton::SetValue(int val)
 {
-       m_value = val ;
+    m_value = val ;
 }
 
 void wxSpinButton::SetRange(int minVal, int maxVal)
 {
-       m_min = minVal;
-       m_max = maxVal;
+    m_min = minVal;
+    m_max = maxVal;
     SetControl32BitMaximum( (ControlHandle) m_macControl , maxVal ) ;
     SetControl32BitMinimum((ControlHandle) m_macControl , minVal ) ;
 }
 
 void wxSpinButton::MacHandleValueChanged( int inc )
 {
-     
+    
     wxEventType scrollEvent = wxEVT_NULL;
-       int oldValue = m_value ;
-
+    int oldValue = m_value ;
+    
     m_value = oldValue + inc;
-
+    
     if (m_value < m_min)
     {
-    if ( m_windowStyle & wxSP_WRAP )
-      m_value = m_max;
-    else
-      m_value = m_min;
+        if ( m_windowStyle & wxSP_WRAP )
+            m_value = m_max;
+        else
+            m_value = m_min;
     }
-
+    
     if (m_value > m_max)
     {
-    if ( m_windowStyle & wxSP_WRAP )
-      m_value = m_min;
-    else
-      m_value = m_max;
+        if ( m_windowStyle & wxSP_WRAP )
+            m_value = m_min;
+        else
+            m_value = m_max;
     }
-
+    
     if ( m_value - oldValue == -1 )
         scrollEvent = wxEVT_SCROLL_LINEDOWN ;
     else if ( m_value - oldValue == 1 )
         scrollEvent = wxEVT_SCROLL_LINEUP ;
     else
         scrollEvent = wxEVT_SCROLL_THUMBTRACK ;
-        
+    
     wxSpinEvent event(scrollEvent, m_windowId);
-
+    
     event.SetPosition(m_value);
     event.SetEventObject( this );
     if ((GetEventHandler()->ProcessEvent( event )) &&
@@ -135,7 +135,7 @@ void wxSpinButton::MacHandleValueChanged( int inc )
         m_value = oldValue ;
     }
     SetControl32BitValue( (ControlHandle) m_macControl , m_value ) ;
-
+    
     /* always send a thumbtrack event */
     if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
     {
@@ -149,22 +149,22 @@ void wxSpinButton::MacHandleValueChanged( int inc )
 
 void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-       
-  int nScrollInc = 0;
-
-       switch( controlpart )
-       {
-               case kControlUpButtonPart :
-            nScrollInc = 1;
-                       break ;
-               case kControlDownButtonPart :
-            nScrollInc = -1;
-                       break ;
-       }
-       MacHandleValueChanged( nScrollInc ) ;
-
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+    
+    int nScrollInc = 0;
+    
+    switch( controlpart )
+    {
+    case kControlUpButtonPart :
+        nScrollInc = 1;
+        break ;
+    case kControlDownButtonPart :
+        nScrollInc = -1;
+        break ;
+    }
+    MacHandleValueChanged( nScrollInc ) ;
+    
 }
 
 // ----------------------------------------------------------------------------
@@ -173,6 +173,6 @@ void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart
 
 wxSize wxSpinButton::DoGetBestSize() const
 {
-  return wxSize(16,24);
+    return wxSize(16,24);
 }
 
index ab37567e8847f2ee31262d2e5064faf8667299f4..68bc4efa6ac16f137f7604be33f235dfddf12ae3 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -38,13 +38,13 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
            const wxString& name)
 {
     SetName(name);
-       wxSize size = s ;
-       if ( bitmap.Ok() )
-       {
-       if ( size.x == -1 )
-           size.x = bitmap.GetWidth() ;
-       if ( size.y == -1 )
-           size.y = bitmap.GetHeight() ;
+    wxSize size = s ;
+    if ( bitmap.Ok() )
+    {
+        if ( size.x == -1 )
+            size.x = bitmap.GetWidth() ;
+        if ( size.y == -1 )
+            size.y = bitmap.GetHeight() ;
     }
 
     m_backgroundColour = parent->GetBackgroundColour() ;
@@ -52,14 +52,14 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
 
     m_bitmap = bitmap;
     if ( id == -1 )
-           m_windowId = (int)NewControlId();
+          m_windowId = (int)NewControlId();
     else
-           m_windowId = id;
+        m_windowId = id;
 
     m_windowStyle = style;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
-       SetBestSize( size ) ;
+    SetBestSize( size ) ;
     
     return ret;
 }
index cef41efca71b196cf8bd19d551f83a408bc1d60a..e494e9e709d3bfec985ac4488bdd6ca7c03c880a 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -22,7 +22,7 @@
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
-       EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
+    EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
 END_EVENT_TABLE()
 
 #endif
@@ -38,15 +38,15 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
            long style,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlGroupBoxTextTitleProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
-
-  return TRUE;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+        kControlGroupBoxTextTitleProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    
+    return TRUE;
 }
index d3fef290a39031c7b878e10fa0527a39f956a20b..e39e83bb81765060a4d7f16e22c331cd556ca547 100644 (file)
@@ -22,7 +22,7 @@
 #include "wx/dcclient.h"
 
 BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
-       EVT_PAINT(wxStatusBarMac::OnPaint)
+    EVT_PAINT(wxStatusBarMac::OnPaint)
 END_EVENT_TABLE()
 
 #ifdef __WXMAC__
@@ -47,38 +47,38 @@ wxStatusBarMac::~wxStatusBarMac()
 }
 
 bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
-           long style ,
-           const wxString& name)
+                            long style ,
+                            const wxString& name)
 {
-       return wxStatusBarGeneric::Create( parent , id , style , name ) ;
+    return wxStatusBarGeneric::Create( parent , id , style , name ) ;
 }
 
 void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
 {
-  int leftMargin = 2;
-
-  wxRect rect;
-  GetFieldRect(i, rect);
-  
-  if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
-  {
-    dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
-  }
-
-  wxString text(GetStatusText(i));
-
-  long x, y;
-
-  dc.GetTextExtent(text, &x, &y);
-
-  int xpos = rect.x + leftMargin + 1 ;
-  int ypos = 2 ;
-  
-  dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
-
-  dc.DrawText(text, xpos, ypos);
-
-  dc.DestroyClippingRegion();
+    int leftMargin = 2;
+    
+    wxRect rect;
+    GetFieldRect(i, rect);
+    
+    if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
+    {
+        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
+    }
+    
+    wxString text(GetStatusText(i));
+    
+    long x, y;
+    
+    dc.GetTextExtent(text, &x, &y);
+    
+    int xpos = rect.x + leftMargin + 1 ;
+    int ypos = 2 ;
+    
+    dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
+    
+    dc.DrawText(text, xpos, ypos);
+    
+    dc.DestroyClippingRegion();
 }
 
 void wxStatusBarMac::DrawField(wxDC& dc, int i)
@@ -89,8 +89,8 @@ void wxStatusBarMac::DrawField(wxDC& dc, int i)
 void wxStatusBarMac::SetStatusText(const wxString& text, int number)
 {
     wxCHECK_RET( (number >= 0) && (number < m_nFields),
-                 _T("invalid status bar field index") );
-
+        _T("invalid status bar field index") );
+    
     m_statusStrings[number] = text;
     wxRect rect;
     GetFieldRect(number, rect);
@@ -101,35 +101,35 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number)
 
 void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
 {
-       wxPaintDC dc(this);
-       dc.Clear() ;
-
-       if ( IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
-       {
-               wxPen black( wxBLACK , 1 , wxSOLID ) ;
-               wxPen white( wxWHITE , 1 , wxSOLID ) ;
-
-               dc.SetPen(black);
-               dc.DrawLine(0, 0 ,
-                      m_width , 0);
-               dc.SetPen(white);
-               dc.DrawLine(0, 1 ,
-                      m_width , 1);
-       }
-       else
-       {
-               dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));
-               dc.DrawLine(0, 0 ,
-                      m_width , 0);
-       }
-
-       int i;
-       if ( GetFont().Ok() )
-               dc.SetFont(GetFont());
-       dc.SetBackgroundMode(wxTRANSPARENT);
-
-       for ( i = 0; i < m_nFields; i ++ )
-               DrawField(dc, i);
+    wxPaintDC dc(this);
+    dc.Clear() ;
+    
+    if ( IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
+    {
+        wxPen black( wxBLACK , 1 , wxSOLID ) ;
+        wxPen white( wxWHITE , 1 , wxSOLID ) ;
+        
+        dc.SetPen(black);
+        dc.DrawLine(0, 0 ,
+            m_width , 0);
+        dc.SetPen(white);
+        dc.DrawLine(0, 1 ,
+            m_width , 1);
+    }
+    else
+    {
+        dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));
+        dc.DrawLine(0, 0 ,
+            m_width , 0);
+    }
+    
+    int i;
+    if ( GetFont().Ok() )
+        dc.SetFont(GetFont());
+    dc.SetBackgroundMode(wxTRANSPARENT);
+    
+    for ( i = 0; i < m_nFields; i ++ )
+        DrawField(dc, i);
 }
 
 void wxStatusBarMac::MacSuperEnabled( bool enabled ) 
index 2c01893e846d4c303f2281cdf6c65429e5986682..dc00dcca0f136c56ba4db1822c73dbba1e9c7108 100644 (file)
@@ -49,15 +49,15 @@ bool wxStaticLine::Create( wxWindow *parent,
                            long style,
                            const wxString &name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlSeparatorLineProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlSeparatorLineProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
 
     return TRUE;
 }
index f0175deaf35a7d2e0f1f8154e4ee943c797422f9..fc0a5726f933914d9b86e7d4dc090cb9c1f221dc 100644 (file)
@@ -137,44 +137,44 @@ void wxStaticText::OnDraw( wxDC &dc )
 {
     if (m_width <= 0 || m_height <= 0)
         return;
-/*
-    dc.Clear() ;
-    wxRect rect(0,0,m_width,m_height) ;
-    dc.SetFont(*wxSMALL_FONT) ;
-
-    dc.DrawRectangle(rect) ;
-*/
-  if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) &&
-    ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
-      || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) )
-  {
-    dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
-  }
-  else
-  {
-    dc.SetTextForeground( GetForegroundColour() ) ;
-  }
-
-  wxString paragraph;
-  size_t i = 0 ;
-  wxString text = m_label;
-  int y = 0 ;
-  while (i < text.Length())
-  {
-
-    if (text[i] == 13 || text[i] == 10)
+    /*
+        dc.Clear() ;
+        wxRect rect(0,0,m_width,m_height) ;
+        dc.SetFont(*wxSMALL_FONT) ;
+        
+          dc.DrawRectangle(rect) ;
+    */
+    if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) &&
+        ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
+        || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) )
     {
-        DrawParagraph(dc, paragraph,y);
-        paragraph = "" ;
+        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
     }
     else
     {
-        paragraph += text[i];
+        dc.SetTextForeground( GetForegroundColour() ) ;
+    }
+    
+    wxString paragraph;
+    size_t i = 0 ;
+    wxString text = m_label;
+    int y = 0 ;
+    while (i < text.Length())
+    {
+        
+        if (text[i] == 13 || text[i] == 10)
+        {
+            DrawParagraph(dc, paragraph,y);
+            paragraph = "" ;
+        }
+        else
+        {
+            paragraph += text[i];
+        }
+        ++i;
     }
-    ++i;
-  }
-  if (paragraph.Length() > 0)
-      DrawParagraph(dc, paragraph,y);
+    if (paragraph.Length() > 0)
+        DrawParagraph(dc, paragraph,y);
 }
 
 void wxStaticText::OnPaint( wxPaintEvent & WXUNUSED(event) )
index 08b7204373be78a97d1e9f51f86996fc8009ad57..6e79c8838681839edd60c613af033d4e388b9dff 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -34,18 +34,18 @@ wxTabCtrl::wxTabCtrl()
 bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-
-  m_imageList = NULL;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlTabSmallProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
-       return TRUE ;
+    Rect bounds ;
+    Str255 title ;
+    
+    m_imageList = NULL;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+        kControlTabSmallProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    return TRUE ;
 }
 
 wxTabCtrl::~wxTabCtrl()
index 7213103b0447d6404eadc5bcf1702c9097743126..df0eb5a9b76bb798d4ecb8641e6f5afe008eb40f 100644 (file)
@@ -1,13 +1,13 @@
 /////////////////////////////////////////////////////////////////////////
 // File:        taskbar.cpp
-// Purpose:        Implements wxTaskBarIcon class for manipulating icons on
+// Purpose:        Implements wxTaskBarIcon class for manipulating icons on
 //              the task bar. Optional.
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c)
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index a6eb64f05cf9f074e9eb1b2755e7f6559cd744cc..ae6063d20c4bdabdc2a75c439e2af6fe191bb251 100644 (file)
@@ -299,8 +299,8 @@ static pascal ControlPartCode TPPaneTrackingProc(ControlHandle theControl, Point
 #if !TARGET_CARBON 
                     TXNClick( varsp->fTXNRec, (const EventRecord*) wxTheApp->MacGetCurrentEvent());
 #else
-                                       EventRecord rec ;
-                                       ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
+                    EventRecord rec ;
+                    ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
                     TXNClick( varsp->fTXNRec, &rec );
 #endif
                 }
@@ -662,15 +662,15 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
-  m_macTE = NULL ;
-  m_macTXN = NULL ;
-  m_macTXNvars = NULL ;
-  m_macUsesTXN = false ;
-  m_editable = true ;
-
-  m_macUsesTXN = ! (style & wxTE_PASSWORD ) ; 
-
-  m_macUsesTXN &= (TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress) ;
+    m_macTE = NULL ;
+    m_macTXN = NULL ;
+    m_macTXNvars = NULL ;
+    m_macUsesTXN = false ;
+    m_editable = true ;
+    
+    m_macUsesTXN = ! (style & wxTE_PASSWORD ) ; 
+    
+    m_macUsesTXN &= (TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress) ;
     
     // base initialization
     if ( !CreateBase(parent, id, pos, size, style, validator, name) )
@@ -764,7 +764,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
     }
   
-  return TRUE;
+    return TRUE;
 }
 
 wxString wxTextCtrl::GetValue() const
@@ -774,21 +774,21 @@ wxString wxTextCtrl::GetValue() const
     OSStatus err ;
     if ( !m_macUsesTXN )
     {
-       err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
+        err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
             ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
        
-               if ( err )
-                       return wxEmptyString ;
-               
-               if ( actualSize > 0 )
-               {
-               wxChar *ptr = result.GetWriteBuf(actualSize) ;
-               
-               ::GetControlData( (ControlHandle) m_macControl, 0,
-                   ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, 
-                   actualSize , ptr , &actualSize ) ;
-               ptr[actualSize] = 0 ;
-               result.UngetWriteBuf(actualSize) ;
+           if ( err )
+               return wxEmptyString ;
+           
+           if ( actualSize > 0 )
+           {
+            wxChar *ptr = result.GetWriteBuf(actualSize) ;
+            
+            ::GetControlData( (ControlHandle) m_macControl, 0,
+                ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, 
+                actualSize , ptr , &actualSize ) ;
+            ptr[actualSize] = 0 ;
+            result.UngetWriteBuf(actualSize) ;
         }
         
     }
@@ -804,14 +804,14 @@ wxString wxTextCtrl::GetValue() const
         else
         {
             actualSize = GetHandleSize( theText ) ;
-               if ( actualSize > 0 )
-               {
-                       wxChar *ptr = result.GetWriteBuf(actualSize) ;
-                   strncpy( ptr , *theText , actualSize ) ;
-                   ptr[actualSize] = 0 ;
-                   result.UngetWriteBuf( actualSize ) ;
-               }
-               DisposeHandle( theText ) ;
+               if ( actualSize > 0 )
+               {
+                wxChar *ptr = result.GetWriteBuf(actualSize) ;
+                strncpy( ptr , *theText , actualSize ) ;
+                ptr[actualSize] = 0 ;
+                result.UngetWriteBuf( actualSize ) ;
+            }
+            DisposeHandle( theText ) ;
         }
     }
     
@@ -1090,42 +1090,42 @@ void wxTextCtrl::SetInsertionPointEnd()
 
 long wxTextCtrl::GetInsertionPoint() const
 {
-  long begin,end ;
-  GetSelection( &begin , &end ) ;
-  return begin ;
+    long begin,end ;
+    GetSelection( &begin , &end ) ;
+    return begin ;
 }
 
 long wxTextCtrl::GetLastPosition() const
 {
     if ( !m_macUsesTXN )
-  {
-    return (**((TEHandle) m_macTE)).teLength ;
-  }
-  else
-  {
-    Handle theText ;
-    long actualsize ;
-    OSErr err = TXNGetDataEncoded( (TXNObject) m_macTXN, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
-        /* all done */
-    if ( err )
     {
-      actualsize = 0 ;
+        return (**((TEHandle) m_macTE)).teLength ;
     }
     else
     {
-      actualsize = GetHandleSize( theText ) ;
-      DisposeHandle( theText ) ;
+        Handle theText ;
+        long actualsize ;
+        OSErr err = TXNGetDataEncoded( (TXNObject) m_macTXN, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
+        /* all done */
+        if ( err )
+        {
+            actualsize = 0 ;
+        }
+        else
+        {
+            actualsize = GetHandleSize( theText ) ;
+            DisposeHandle( theText ) ;
+        }
+        return actualsize ;
     }
-    return actualsize ;
-  }
 }
 
 void wxTextCtrl::Replace(long from, long to, const wxString& value)
 {
-  if ( !m_macUsesTXN )
-  {
+    if ( !m_macUsesTXN )
+    {
         ControlEditTextSelectionRec selection ;
-   
+        
         selection.selStart = from ;
         selection.selEnd = to ;
         ::SetControlData((ControlHandle)  m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
@@ -1141,7 +1141,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
         TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
         TXNClear( ((TXNObject) m_macTXN) ) ;
         TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)value.c_str(), value.Length(),
-        kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+            kTXNUseCurrentSelection, kTXNUseCurrentSelection);
         if ( !formerEditable )
             SetEditable( formerEditable ) ;
     }
@@ -1150,52 +1150,52 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
 
 void wxTextCtrl::Remove(long from, long to)
 {
-  if ( !m_macUsesTXN )
-  {
-    ControlEditTextSelectionRec selection ;
-   
-    selection.selStart = from ;
-    selection.selEnd = to ;
-    ::SetControlData( (ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
-    TEDelete( ((TEHandle) m_macTE) ) ;
-  }
-  else
-  {
-    bool formerEditable = IsEditable() ;
-    if ( !formerEditable )
-        SetEditable(true) ;
-    TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ; 
-    TXNClear( ((TXNObject) m_macTXN) ) ; 
-    if ( !formerEditable )
-        SetEditable( formerEditable ) ;
-  }
+    if ( !m_macUsesTXN )
+    {
+        ControlEditTextSelectionRec selection ;
+        
+        selection.selStart = from ;
+        selection.selEnd = to ;
+        ::SetControlData( (ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
+        TEDelete( ((TEHandle) m_macTE) ) ;
+    }
+    else
+    {
+        bool formerEditable = IsEditable() ;
+        if ( !formerEditable )
+            SetEditable(true) ;
+        TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ; 
+        TXNClear( ((TXNObject) m_macTXN) ) ; 
+        if ( !formerEditable )
+            SetEditable( formerEditable ) ;
+    }
     Refresh() ;
 }
 
 void wxTextCtrl::SetSelection(long from, long to)
 {
-
-  if ( !m_macUsesTXN )
-  {
-   ControlEditTextSelectionRec selection ;
-   selection.selStart = from ;
-   selection.selEnd = to ;
-   
-   TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
-   ::SetControlData((ControlHandle)  m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
-  }
-  else
-  {
-    STPTextPaneVars **tpvars;
+    
+    if ( !m_macUsesTXN )
+    {
+        ControlEditTextSelectionRec selection ;
+        selection.selStart = from ;
+        selection.selEnd = to ;
+        
+        TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
+        ::SetControlData((ControlHandle)  m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
+    }
+    else
+    {
+        STPTextPaneVars **tpvars;
         /* set up our locals */
-    tpvars = (STPTextPaneVars **) GetControlReference((ControlHandle) m_macControl);
+        tpvars = (STPTextPaneVars **) GetControlReference((ControlHandle) m_macControl);
         /* and our drawing environment as the operation
         may force a redraw in the text area. */
-    SetPort((**tpvars).fDrawingEnvironment);
+        SetPort((**tpvars).fDrawingEnvironment);
         /* change the selection */
-    TXNSetSelection( (**tpvars).fTXNRec, from, to);
-    TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
-  }
+        TXNSetSelection( (**tpvars).fTXNRec, from, to);
+        TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
+    }
 }
 
 bool wxTextCtrl::LoadFile(const wxString& file)
@@ -1252,15 +1252,15 @@ void wxTextCtrl::Clear()
     {
         return ;
     }
-  if ( !m_macUsesTXN )
-  {
-    ::SetControlData((ControlHandle)  m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
-  }
-  else
-  {
+    if ( !m_macUsesTXN )
+    {
+        ::SetControlData((ControlHandle)  m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
+    }
+    else
+    {
         TXNSetSelection( (TXNObject)m_macTXN , kTXNStartOffset , kTXNEndOffset ) ;
         TXNClear((TXNObject)m_macTXN); 
-  }
+    }
     Refresh() ;
 }
 
@@ -1349,8 +1349,8 @@ void wxTextCtrl::DiscardEdits()
 
 int wxTextCtrl::GetNumberOfLines() const
 {
-  // TODO change this if possible to reflect real lines
-  wxString content = GetValue() ;
+    // TODO change this if possible to reflect real lines
+    wxString content = GetValue() ;
     
     int count = 1;
     for (size_t i = 0; i < content.Length() ; i++)
@@ -1379,8 +1379,8 @@ void wxTextCtrl::ShowPosition(long pos)
 
 int wxTextCtrl::GetLineLength(long lineNo) const
 {
-  // TODO change this if possible to reflect real lines
-  wxString content = GetValue() ;
+    // TODO change this if possible to reflect real lines
+    wxString content = GetValue() ;
     
     // Find line first
     int count = 0;
@@ -1405,8 +1405,8 @@ int wxTextCtrl::GetLineLength(long lineNo) const
 
 wxString wxTextCtrl::GetLineText(long lineNo) const
 {
-  // TODO change this if possible to reflect real lines
-  wxString content = GetValue() ;
+    // TODO change this if possible to reflect real lines
+    wxString content = GetValue() ;
 
     // Find line first
     int count = 0;
index 474b92a22f79fb6d36f63e07b7c57e02cecf75a1..23a72037529fc718ccf96605f5a9d16ecc321457 100644 (file)
@@ -902,5 +902,3 @@ bool WXDLLEXPORT wxIsWaitingForThread()
 #include "wx/thrimpl.cpp"
 
 #endif // wxUSE_THREADS
-
-// vi:sts=4:sw=4:et
index 4d96abef874823d4428b0df2dce8b2bb1ea71921..3d43a7ca27f3846ecadd399b701452a0efa4fd93 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -39,24 +39,24 @@ static void wxProcessTimer( unsigned long event , void *data ) ;
 
 static pascal void MacTimerProc( TMTask * t )
 {
-       MacTimerInfo * tm = (MacTimerInfo*)  t ;
-       wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ;
+    MacTimerInfo * tm = (MacTimerInfo*)  t ;
+    wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ;
 }
 
 wxArrayPtrVoid gTimersInProcess ;
 
 static void wxProcessTimer( unsigned long event , void *data )
 {
-       if ( !data )
-               return ;
-               
-       wxTimer* timer = (wxTimer*) data ;
-       
-       if ( timer->IsOneShot() )
-               timer->Stop() ;
-               
-       gTimersInProcess.Add( timer ) ;
-        
+    if ( !data )
+        return ;
+        
+    wxTimer* timer = (wxTimer*) data ;
+    
+    if ( timer->IsOneShot() )
+        timer->Stop() ;
+        
+    gTimersInProcess.Add( timer ) ;
+     
     timer->Notify();
 
     int index = gTimersInProcess.Index( timer ) ;
@@ -67,7 +67,7 @@ static void wxProcessTimer( unsigned long event , void *data )
         
         if ( !timer->IsOneShot() && timer->m_info->m_task.tmAddr )
         {
-           PrimeTime( (QElemPtr)  &timer->m_info->m_task , timer->GetInterval() ) ;
+            PrimeTime( (QElemPtr)  &timer->m_info->m_task , timer->GetInterval() ) ;
         }
     
     }
@@ -76,17 +76,17 @@ static void wxProcessTimer( unsigned long event , void *data )
 void wxTimer::Init()
 {
     m_info = new MacTimerInfo() ;
-       m_info->m_task.tmAddr = NULL ;
-       m_info->m_task.tmWakeUp = 0 ;
-       m_info->m_task.tmReserved = 0 ;
-       m_info->m_task.qType = 0 ;
-       m_info->m_table = wxMacGetNotifierTable() ;
-       m_info->m_timer = this ;
+    m_info->m_task.tmAddr = NULL ;
+    m_info->m_task.tmWakeUp = 0 ;
+    m_info->m_task.tmReserved = 0 ;
+    m_info->m_task.qType = 0 ;
+    m_info->m_table = wxMacGetNotifierTable() ;
+    m_info->m_timer = this ;
 }
 
 bool wxTimer::IsRunning() const 
 {
-       return ( m_info->m_task.qType & kTMTaskActive ) ;
+    return ( m_info->m_task.qType & kTMTaskActive ) ;
 }
 
 wxTimer::~wxTimer()
@@ -116,8 +116,8 @@ bool wxTimer::Start(int milliseconds,bool mode)
 #endif
     m_info->m_task.tmWakeUp = 0 ;
     m_info->m_task.tmReserved = 0 ;
-       m_info->m_task.qType = 0 ;
-       m_info->m_timer = this ;
+    m_info->m_task.qType = 0 ;
+    m_info->m_timer = this ;
     InsXTime((QElemPtr) &m_info->m_task ) ;
     PrimeTime( (QElemPtr) &m_info->m_task , m_milli ) ;
     return FALSE;
@@ -128,9 +128,9 @@ void wxTimer::Stop()
     m_milli = 0 ;
     if ( m_info->m_task.tmAddr )
     {
-       RmvTime(  (QElemPtr) &m_info->m_task ) ;
-       DisposeTimerUPP(m_info->m_task.tmAddr) ;
-       m_info->m_task.tmAddr = NULL ;
+        RmvTime(  (QElemPtr) &m_info->m_task ) ;
+        DisposeTimerUPP(m_info->m_task.tmAddr) ;
+        m_info->m_task.tmAddr = NULL ;
     }
     wxMacRemoveAllNotifiersForData( wxMacGetNotifierTable() , this ) ;
 }
index 8b8d56b70a033f817b3216567b753b28ba1259f5..33da0a2d4b9c80d4e16770b8c68c1835ced25f66 100644 (file)
@@ -107,54 +107,53 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
 
 void wxToolBar::Init()
 {
-  m_maxWidth = -1;
-  m_maxHeight = -1;
-  m_defaultWidth = kwxMacToolBarToolDefaultWidth;
-  m_defaultHeight = kwxMacToolBarToolDefaultHeight;
+    m_maxWidth = -1;
+    m_maxHeight = -1;
+    m_defaultWidth = kwxMacToolBarToolDefaultWidth;
+    m_defaultHeight = kwxMacToolBarToolDefaultHeight;
 }
 
 bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
-{
-  
-  int x = pos.x;
-  int y = pos.y;
-  int width = size.x;
-  int height = size.y;
-
-  if (width <= 0)
-    width = 100;
-  if (height <= 0)
-    height = 30;
-  if (x < 0)
-    x = 0;
-  if (y < 0)
-    y = 0;
-
-  SetName(name);
-
-  m_windowStyle = style;
-  parent->AddChild(this);
-
-  m_backgroundColour = parent->GetBackgroundColour() ;
-  m_foregroundColour = parent->GetForegroundColour() ;
-
-  if (id == -1)
-      m_windowId = NewControlId();
-  else
-      m_windowId = id;
-
-  {
-    m_width = size.x ;
-    m_height = size.y ;
-    int x = pos.x ;
-    int y = pos.y ;
-    AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
-    m_x = x ;
-    m_y = y ;
-  }
-  
-  return TRUE;
+{  
+    int x = pos.x;
+    int y = pos.y;
+    int width = size.x;
+    int height = size.y;
+    
+    if (width <= 0)
+        width = 100;
+    if (height <= 0)
+        height = 30;
+    if (x < 0)
+        x = 0;
+    if (y < 0)
+        y = 0;
+    
+    SetName(name);
+    
+    m_windowStyle = style;
+    parent->AddChild(this);
+    
+    m_backgroundColour = parent->GetBackgroundColour() ;
+    m_foregroundColour = parent->GetForegroundColour() ;
+    
+    if (id == -1)
+        m_windowId = NewControlId();
+    else
+        m_windowId = id;
+    
+    {
+        m_width = size.x ;
+        m_height = size.y ;
+        int x = pos.x ;
+        int y = pos.y ;
+        AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
+        m_x = x ;
+        m_y = y ;
+    }
+    
+    return TRUE;
 }
 
 wxToolBar::~wxToolBar()
@@ -363,119 +362,119 @@ void wxToolBar::SetRows(int nRows)
 
 void wxToolBar::MacSuperChangedPosition() 
 {
-  if (m_tools.GetCount() > 0)
-  {
-
-    Point localOrigin ;
-    //    Rect clipRect ;
-    //    WindowRef window ;
-    //    wxWindow *win ;
-    int lx , ly ;
-    lx = ly = 0 ;
-    MacWindowToRootWindow( &lx , &ly ) ;
-    localOrigin.v = ly ;
-    localOrigin.h = lx ;
-    
-//    GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
-
-    Rect toolbarrect = { localOrigin.v ,localOrigin.h , 
-        m_height + localOrigin.v  , m_width + localOrigin.h} ;
-    ControlFontStyleRec     controlstyle ;
-
-    controlstyle.flags = kControlUseFontMask ;
-    controlstyle.font = kControlFontSmallSystemFont ;
-    
-    wxToolBarToolsList::Node *node = m_tools.GetFirst();
-    int noButtons = 0;
-    int x = 0 ;
-    wxSize toolSize = GetToolSize() ;
-    int tw, th;
-    GetSize(& tw, & th);
-    
-    int maxWidth = 0 ;
-    int maxHeight = 0 ;
-    int toolcount = 0 ;
+    if (m_tools.GetCount() > 0)
     {
-      WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
-        while (node)
+        
+        Point localOrigin ;
+        //    Rect clipRect ;
+        //    WindowRef window ;
+        //    wxWindow *win ;
+        int lx , ly ;
+        lx = ly = 0 ;
+        MacWindowToRootWindow( &lx , &ly ) ;
+        localOrigin.v = ly ;
+        localOrigin.h = lx ;
+        
+        //    GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
+        
+        Rect toolbarrect = { localOrigin.v ,localOrigin.h , 
+            m_height + localOrigin.v  , m_width + localOrigin.h} ;
+        ControlFontStyleRec     controlstyle ;
+        
+        controlstyle.flags = kControlUseFontMask ;
+        controlstyle.font = kControlFontSmallSystemFont ;
+        
+        wxToolBarToolsList::Node *node = m_tools.GetFirst();
+        int noButtons = 0;
+        int x = 0 ;
+        wxSize toolSize = GetToolSize() ;
+        int tw, th;
+        GetSize(& tw, & th);
+        
+        int maxWidth = 0 ;
+        int maxHeight = 0 ;
+        int toolcount = 0 ;
         {
-            wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-            
-            if(  !tool->IsSeparator()  )
+            WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
+            while (node)
             {
-                Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
-                toolrect.right = toolrect.left + toolSize.x ;
-                toolrect.bottom = toolrect.top + toolSize.y ;
-                            
-                ControlHandle m_macToolHandle = (ControlHandle) m_macToolHandles[toolcount++] ;
+                wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
                 
+                if(  !tool->IsSeparator()  )
                 {
-                    Rect contrlRect ;       
-                    GetControlBounds( m_macToolHandle , &contrlRect ) ; 
-                    int former_mac_x = contrlRect.left ;
-                    int former_mac_y = contrlRect.top ;
-                    int mac_x = toolrect.left ;
-                    int mac_y = toolrect.top ;
-                                
-                    if ( mac_x != former_mac_x || mac_y != former_mac_y )
+                    Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
+                    toolrect.right = toolrect.left + toolSize.x ;
+                    toolrect.bottom = toolrect.top + toolSize.y ;
+                    
+                    ControlHandle m_macToolHandle = (ControlHandle) m_macToolHandles[toolcount++] ;
+                    
                     {
+                        Rect contrlRect ;       
+                        GetControlBounds( m_macToolHandle , &contrlRect ) ; 
+                        int former_mac_x = contrlRect.left ;
+                        int former_mac_y = contrlRect.top ;
+                        int mac_x = toolrect.left ;
+                        int mac_y = toolrect.top ;
+                        
+                        if ( mac_x != former_mac_x || mac_y != former_mac_y )
                         {
-                            Rect inval = { former_mac_y , former_mac_x , former_mac_y + toolSize.y , former_mac_x + toolSize.y } ;
-                            InvalWindowRect( rootwindow , &inval ) ;
-                        }
-                        UMAMoveControl( m_macToolHandle , mac_x , mac_y ) ;
-                        {
-                            Rect inval = { mac_y , mac_x , mac_y + toolSize.y , mac_x + toolSize.y } ;
-                            InvalWindowRect( rootwindow , &inval ) ;
+                            {
+                                Rect inval = { former_mac_y , former_mac_x , former_mac_y + toolSize.y , former_mac_x + toolSize.y } ;
+                                InvalWindowRect( rootwindow , &inval ) ;
+                            }
+                            UMAMoveControl( m_macToolHandle , mac_x , mac_y ) ;
+                            {
+                                Rect inval = { mac_y , mac_x , mac_y + toolSize.y , mac_x + toolSize.y } ;
+                                InvalWindowRect( rootwindow , &inval ) ;
+                            }
                         }
                     }
+                    
+                    x += (int)toolSize.x;
+                    noButtons ++;
+                }
+                else
+                {
+                    toolcount++ ;
+                    x += (int)toolSize.x / 4;
                 }
+                if ( toolbarrect.left + x + m_xMargin  + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
+                    maxWidth = toolbarrect.left + x  + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
+                if (toolbarrect.top + m_yMargin  + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
+                    maxHeight = toolbarrect.top  + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
                 
-                x += (int)toolSize.x;
-                noButtons ++;
+                node = node->GetNext();
             }
-            else
+        }
+        
+        if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+        {
+            if ( m_maxRows == 0 )
             {
-                toolcount++ ;
-                x += (int)toolSize.x / 4;
+                // if not set yet, only one row
+                SetRows(1);
             }
-            if ( toolbarrect.left + x + m_xMargin  + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
-                maxWidth = toolbarrect.left + x  + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
-            if (toolbarrect.top + m_yMargin  + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
-                maxHeight = toolbarrect.top  + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
-
-            node = node->GetNext();
+            maxWidth = tw ; 
+            maxHeight += toolSize.y;
+            maxHeight += m_yMargin + kwxMacToolBarTopMargin;
+            m_maxHeight = maxHeight ;
         }
+        else
+        {
+            if ( noButtons > 0 && m_maxRows == 0 )
+            {
+                // if not set yet, have one column
+                SetRows(noButtons);
+            }
+            maxHeight = th ;
+            maxWidth += toolSize.x;
+            maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
+            m_maxWidth = maxWidth ;
+        }
+        
+        SetSize(maxWidth, maxHeight);
     }
-
-     if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
-     {
-       if ( m_maxRows == 0 )
-       {
-           // if not set yet, only one row
-           SetRows(1);
-       }
-        maxWidth = tw ; 
-       maxHeight += toolSize.y;
-        maxHeight += m_yMargin + kwxMacToolBarTopMargin;
-        m_maxHeight = maxHeight ;
-     }
-     else
-     {
-       if ( noButtons > 0 && m_maxRows == 0 )
-       {
-           // if not set yet, have one column
-           SetRows(noButtons);
-       }
-       maxHeight = th ;
-       maxWidth += toolSize.x;
-        maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
-        m_maxWidth = maxWidth ;
-     }
-
-     SetSize(maxWidth, maxHeight);
-    }
-
+    
     wxWindow::MacSuperChangedPosition() ;
 }
 
@@ -564,9 +563,9 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *WXUNUSED(t
 
 void wxToolBar::OnPaint(wxPaintEvent& event)
 {
-  wxPaintDC dc(this) ;
-  wxMacPortSetter helper(&dc) ;
-  
+    wxPaintDC dc(this) ;
+    wxMacPortSetter helper(&dc) ;
+    
     Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , 
         dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
     UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
index 5d072cb098cf8a45ad64630dabe311c1e63700a9..4b00c6f7500684f1761436796ea04c56cd0ca717 100644 (file)
@@ -31,27 +31,27 @@ class wxMacToolTipTimer ;
 
 class wxMacToolTip
 {
-       public :
-               wxMacToolTip( ) ;
-               ~wxMacToolTip() ;
-               
-               void                    Setup( WindowRef window  , wxString text , wxPoint localPosition ) ;
-               long                    GetMark() { return m_mark ; }
-               void                    Draw() ;
-               void                    Clear() ;
-               bool                    IsShown() { return m_shown  ; }
-       private :
-               
-               wxString        m_label ;
-               wxPoint m_position ;
-               Rect                    m_rect ;
-               WindowRef       m_window ;      
-               PicHandle       m_backpict ;
-               bool            m_shown ;
-               long            m_mark ;
-               wxMacToolTipTimer* m_timer ;
+    public :
+        wxMacToolTip( ) ;
+        ~wxMacToolTip() ;
+        
+        void            Setup( WindowRef window  , wxString text , wxPoint localPosition ) ;
+        long            GetMark() { return m_mark ; }
+        void             Draw() ;
+        void            Clear() ;
+        bool            IsShown() { return m_shown  ; }
+    private :
+        
+        wxString    m_label ;
+        wxPoint m_position ;
+        Rect            m_rect ;
+        WindowRef    m_window ;    
+        PicHandle    m_backpict ;
+        bool        m_shown ;
+        long        m_mark ;
+        wxMacToolTipTimer* m_timer ;
 #ifdef TARGET_CARBON
-               CFStringRef m_helpTextRef ;
+        CFStringRef m_helpTextRef ;
 #endif
 } ;
 
@@ -67,8 +67,8 @@ public:
             m_tip->Draw() ;    
     }
 protected:
-    wxMacToolTip*      m_tip;
-    long               m_mark ;
+    wxMacToolTip*     m_tip;
+    long        m_mark ;
 };
 
 //-----------------------------------------------------------------------------
@@ -95,16 +95,16 @@ wxToolTip::~wxToolTip()
 
 void wxToolTip::SetTip( const wxString &tip )
 {
-     m_text = tip;
-
+    m_text = tip;
+    
     if ( m_window )
     {
-       /*
-        // update it immediately
-        wxToolInfo ti(GetHwndOf(m_window));
-        ti.lpszText = (wxChar *)m_text.c_str();
-
-        (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
+    /*
+    // update it immediately
+    wxToolInfo ti(GetHwndOf(m_window));
+    ti.lpszText = (wxChar *)m_text.c_str();
+    
+      (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
         */
     }
 }
@@ -116,94 +116,94 @@ void wxToolTip::SetWindow( wxWindow *win )
 
 void wxToolTip::Enable( bool flag )
 {
-       if ( s_ShowToolTips != flag )
-       {
-               s_ShowToolTips = flag ;
-               if ( s_ShowToolTips )
-               {
-               }
-               else
-               {
-                       s_ToolTip.Clear() ;
-               }
-       }
+    if ( s_ShowToolTips != flag )
+    {
+        s_ShowToolTips = flag ;
+        if ( s_ShowToolTips )
+        {
+        }
+        else
+        {
+            s_ToolTip.Clear() ;
+        }
+    }
 }
 
 void wxToolTip::SetDelay( long msecs )
 {
-       s_ToolTipDelay = msecs ;
+    s_ToolTipDelay = msecs ;
 }
 
 void wxToolTip::RelayEvent( wxWindow *win , wxMouseEvent &event )
 {
-       if ( s_ShowToolTips )
-       {
-               if ( event.GetEventType() == wxEVT_LEAVE_WINDOW )
-               {
-                       s_ToolTip.Clear() ;
-               }
-               else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION )
-               {
-                       wxPoint2DInt where( event.m_x , event.m_y ) ;
-                       if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) )
-                       {
-                       }
-                       else
-                       {
-                               s_ToolTip.Clear() ;
-                               s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
-                               s_LastWindowEntered = win ;
-                               
-                               WindowRef window = MAC_WXHWND( win->MacGetRootWindow() ) ;
-                               int x = event.m_x ;
-                               int y = event.m_y ;
-                               wxPoint local( x , y ) ;
-                               win->MacClientToRootWindow( &x, &y ) ;
-                               wxPoint windowlocal( x , y ) ;
-                               s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ;
-                       }
-               }
-       }
+    if ( s_ShowToolTips )
+    {
+        if ( event.GetEventType() == wxEVT_LEAVE_WINDOW )
+        {
+            s_ToolTip.Clear() ;
+        }
+        else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION )
+        {
+            wxPoint2DInt where( event.m_x , event.m_y ) ;
+            if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) )
+            {
+            }
+            else
+            {
+                s_ToolTip.Clear() ;
+                s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
+                s_LastWindowEntered = win ;
+                
+                WindowRef window = MAC_WXHWND( win->MacGetRootWindow() ) ;
+                int x = event.m_x ;
+                int y = event.m_y ;
+                wxPoint local( x , y ) ;
+                win->MacClientToRootWindow( &x, &y ) ;
+                wxPoint windowlocal( x , y ) ;
+                s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ;
+            }
+        }
+    }
 }
 
 void wxToolTip::RemoveToolTips()
 {
-       s_ToolTip.Clear() ;
+    s_ToolTip.Clear() ;
 }
 // --- mac specific
 
 wxMacToolTipTimer::wxMacToolTipTimer( wxMacToolTip *tip , int msec )
 {
-       m_tip = tip;
-       m_mark = tip->GetMark() ;
-       Start(msec, true);
+    m_tip = tip;
+    m_mark = tip->GetMark() ;
+    Start(msec, true);
 }
 
 wxMacToolTip::wxMacToolTip()
 {
-       m_window = NULL ;
-       m_backpict = NULL ;
-       m_mark = 0 ;
-       m_shown = false ;
+    m_window = NULL ;
+    m_backpict = NULL ;
+    m_mark = 0 ;
+    m_shown = false ;
     m_timer = NULL ;
     m_helpTextRef = NULL ;
 }
 
 void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition ) 
 {
-       m_mark++ ;
-       Clear() ;
-       m_position = localPosition ;
+    m_mark++ ;
+    Clear() ;
+    m_position = localPosition ;
     if( wxApp::s_macDefaultEncodingIsPC )
         m_label = wxMacMakeMacStringFromPC( text ) ;
-       else
+     else
         m_label = text ;
     m_window =win;
-       s_ToolTipWindowRef = m_window ;
-       m_backpict = NULL ;
-       if ( m_timer )
-           delete m_timer ;
-       m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
+    s_ToolTipWindowRef = m_window ;
+    m_backpict = NULL ;
+    if ( m_timer )
+        delete m_timer ;
+    m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
 }
 
 wxMacToolTip::~wxMacToolTip() 
@@ -221,257 +221,257 @@ const short kTipOffset = 5 ;
 
 void wxMacToolTip::Draw()
 {
-       if ( m_label.Length() == 0 )
-               return ;
-               
-       if ( m_window == s_ToolTipWindowRef )
-       {
-               m_shown = true ;
+    if ( m_label.Length() == 0 )
+        return ;
+    
+    if ( m_window == s_ToolTipWindowRef )
+    {
+        m_shown = true ;
 #if TARGET_CARBON
-         if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
-         {
-               HMHelpContentRec tag ;
-               tag.version = kMacHelpVersion;
-               SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
-        GrafPtr port ;
-        GetPort( &port ) ;
-        SetPortWindowPort(m_window) ;
-               LocalToGlobal( (Point *) &tag.absHotRect.top );
-               LocalToGlobal( (Point *) &tag.absHotRect.bottom );
-               SetPort( port );
-               if( m_helpTextRef )
-               {
-                       CFRelease( m_helpTextRef ) ;
-                       m_helpTextRef = NULL ;
-               }
-               m_helpTextRef = wxMacCreateCFString(m_label) ;
-               tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
-               tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
-               tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
-               tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
-               tag.tagSide = kHMDefaultSide;
-               HMDisplayTag( &tag );
-         }
-         else
+        if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
+        {
+            HMHelpContentRec tag ;
+            tag.version = kMacHelpVersion;
+            SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
+            GrafPtr port ;
+            GetPort( &port ) ;
+            SetPortWindowPort(m_window) ;
+            LocalToGlobal( (Point *) &tag.absHotRect.top );
+            LocalToGlobal( (Point *) &tag.absHotRect.bottom );
+            SetPort( port );
+            if( m_helpTextRef )
+            {
+                CFRelease( m_helpTextRef ) ;
+                m_helpTextRef = NULL ;
+            }
+            m_helpTextRef = wxMacCreateCFString(m_label) ;
+            tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
+            tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
+            tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
+            tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
+            tag.tagSide = kHMDefaultSide;
+            HMDisplayTag( &tag );
+        }
+        else
 #endif
-         {
-               wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
-#if TARGET_CARBON      
-               bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-#endif         
-
-        FontFamilyID fontId ;
-        Str255 fontName ;
-        SInt16 fontSize ;
-        Style fontStyle ;
-        GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
-        GetFNum( fontName, &fontId );
-
-               TextFont( fontId ) ;
-               TextSize( fontSize ) ;
-               TextFace( fontStyle ) ;
-               FontInfo fontInfo;
-               ::GetFontInfo(&fontInfo);
-               short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
-               short height = 0 ;
-       //      short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
-               
-               int i = 0 ;
-               int length = m_label.Length() ;
-               int width = 0 ;
-               int thiswidth = 0 ;
-               int laststop = 0 ;
-               const char *text = m_label ;
-               while( i < length )
-               {
-                       if( text[i] == 13 || text[i] == 10)
-                       {
-                               thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
-                               if ( thiswidth > width )
-                                       width = thiswidth ;
-                                       
-                               height += lineh ;
-                               laststop = i+1 ;
-                       }
-                       i++ ;
-               }
-               if ( i - laststop > 0 )
-               {
-                       thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
-                       if ( thiswidth > width )
-                               width = thiswidth ;
-                       height += lineh ;
-               }
-
-
-               m_rect.left = m_position.x + kTipOffset;
-               m_rect.top = m_position.y + kTipOffset;
-               m_rect.right = m_rect.left + width + 2 * kTipBorder;
-#if TARGET_CARBON      
-               if ( useDrawThemeText )
-                   m_rect.right += kTipBorder ;
+        {
+            wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
+#if TARGET_CARBON    
+            bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
+#endif        
+            
+            FontFamilyID fontId ;
+            Str255 fontName ;
+            SInt16 fontSize ;
+            Style fontStyle ;
+            GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+            GetFNum( fontName, &fontId );
+            
+            TextFont( fontId ) ;
+            TextSize( fontSize ) ;
+            TextFace( fontStyle ) ;
+            FontInfo fontInfo;
+            ::GetFontInfo(&fontInfo);
+            short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
+            short height = 0 ;
+            //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
+            
+            int i = 0 ;
+            int length = m_label.Length() ;
+            int width = 0 ;
+            int thiswidth = 0 ;
+            int laststop = 0 ;
+            const char *text = m_label ;
+            while( i < length )
+            {
+                if( text[i] == 13 || text[i] == 10)
+                {
+                    thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
+                    if ( thiswidth > width )
+                        width = thiswidth ;
+                    
+                    height += lineh ;
+                    laststop = i+1 ;
+                }
+                i++ ;
+            }
+            if ( i - laststop > 0 )
+            {
+                thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
+                if ( thiswidth > width )
+                    width = thiswidth ;
+                height += lineh ;
+            }
+            
+            
+            m_rect.left = m_position.x + kTipOffset;
+            m_rect.top = m_position.y + kTipOffset;
+            m_rect.right = m_rect.left + width + 2 * kTipBorder;
+#if TARGET_CARBON    
+            if ( useDrawThemeText )
+                m_rect.right += kTipBorder ;
 #endif
-               m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
-               Rect r ;
-               GetPortBounds( GetWindowPort( m_window ) , &r ) ;
-               if ( m_rect.top < 0 )
-               {
-                   m_rect.bottom += -m_rect.top ;
-                   m_rect.top = 0 ;
-               }
-               if ( m_rect.left < 0 )
-               {
-                   m_rect.right += -m_rect.left ;
-                   m_rect.left = 0 ;
-               }
-               if ( m_rect.right > r.right )
-               {
-                   m_rect.left -= (m_rect.right - r.right ) ;
-                   m_rect.right = r.right ;
-               }
-               if ( m_rect.bottom > r.bottom )
-               {
-                   m_rect.top -= (m_rect.bottom - r.bottom) ;
-                   m_rect.bottom = r.bottom ;
-               }
-               ClipRect( &m_rect ) ;
-               BackColor( whiteColor ) ;
-               ForeColor(blackColor ) ;
-        GWorldPtr port ;               
-        NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
-        CGrafPtr    origPort ;
-        GDHandle    origDevice ;
-
-        GetGWorld( &origPort , &origDevice ) ;
-        SetGWorld( port , NULL ) ;
-           
-               m_backpict = OpenPicture(&m_rect);
-
-               CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
-                                  GetPortBitMapForCopyBits(port), 
-                                  &m_rect, 
-                                  &m_rect, 
-                                  srcCopy, 
-                                  NULL);
-                ClosePicture();
-                SetGWorld( origPort , origDevice ) ;
-               DisposeGWorld( port ) ;
-                PenNormal() ;
-
-               RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
-               BackColor( whiteColor ) ;
-                RGBForeColor( &tooltipbackground ) ;
-
-               PaintRect( &m_rect ) ;
-               ForeColor(blackColor ) ;
-               FrameRect( &m_rect ) ;
-               SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
-               ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
-
-               i = 0 ;
-               laststop = 0 ;
-               height = 0 ;
-               
-               while( i < length )
-               {
-                       if( text[i] == 13 || text[i] == 10)
-                       {
+            m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
+            Rect r ;
+            GetPortBounds( GetWindowPort( m_window ) , &r ) ;
+            if ( m_rect.top < 0 )
+            {
+                m_rect.bottom += -m_rect.top ;
+                m_rect.top = 0 ;
+            }
+            if ( m_rect.left < 0 )
+            {
+                m_rect.right += -m_rect.left ;
+                m_rect.left = 0 ;
+            }
+            if ( m_rect.right > r.right )
+            {
+                m_rect.left -= (m_rect.right - r.right ) ;
+                m_rect.right = r.right ;
+            }
+            if ( m_rect.bottom > r.bottom )
+            {
+                m_rect.top -= (m_rect.bottom - r.bottom) ;
+                m_rect.bottom = r.bottom ;
+            }
+            ClipRect( &m_rect ) ;
+            BackColor( whiteColor ) ;
+            ForeColor(blackColor ) ;
+            GWorldPtr port ;            
+            NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
+            CGrafPtr    origPort ;
+            GDHandle    origDevice ;
+            
+            GetGWorld( &origPort , &origDevice ) ;
+            SetGWorld( port , NULL ) ;
+            
+            m_backpict = OpenPicture(&m_rect);
+            
+            CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
+                GetPortBitMapForCopyBits(port), 
+                &m_rect, 
+                &m_rect, 
+                srcCopy, 
+                NULL);
+            ClosePicture();
+            SetGWorld( origPort , origDevice ) ;
+            DisposeGWorld( port ) ;
+            PenNormal() ;
+            
+            RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
+            BackColor( whiteColor ) ;
+            RGBForeColor( &tooltipbackground ) ;
+            
+            PaintRect( &m_rect ) ;
+            ForeColor(blackColor ) ;
+            FrameRect( &m_rect ) ;
+            SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
+            ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
+            
+            i = 0 ;
+            laststop = 0 ;
+            height = 0 ;
+            
+            while( i < length )
+            {
+                if( text[i] == 13 || text[i] == 10)
+                {
 #if TARGET_CARBON
-               if ( useDrawThemeText )
-               {
-                   Rect frame ;
-                   frame.top = m_rect.top + kTipBorder + height ;
-                   frame.left = m_rect.left + kTipBorder ;
-                   frame.bottom = frame.top + 1000 ;
-                   frame.right = frame.left + 1000 ;
-                    CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                       ::DrawThemeTextBox( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               true,
-                                                               &frame,
-                                                               teJustLeft,
-                                                               nil );
-                   CFRelease( mString ) ;
-                                   height += lineh ;
-               }
-                else
+                    if ( useDrawThemeText )
+                    {
+                        Rect frame ;
+                        frame.top = m_rect.top + kTipBorder + height ;
+                        frame.left = m_rect.left + kTipBorder ;
+                        frame.bottom = frame.top + 1000 ;
+                        frame.right = frame.left + 1000 ;
+                        CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+                        ::DrawThemeTextBox( mString,
+                            kThemeCurrentPortFont,
+                            kThemeStateActive,
+                            true,
+                            &frame,
+                            teJustLeft,
+                            nil );
+                        CFRelease( mString ) ;
+                        height += lineh ;
+                    }
+                    else
 #endif
-                {
-                                   ::DrawText( text , laststop , i - laststop ) ;
-                                   height += lineh ;
-                                   ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
-                               }
-                               laststop = i+1 ;
-                       }
-                       i++ ;
-               }
+                    {
+                        ::DrawText( text , laststop , i - laststop ) ;
+                        height += lineh ;
+                        ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
+                    }
+                    laststop = i+1 ;
+                }
+                i++ ;
+            }
 #if TARGET_CARBON
-        if ( useDrawThemeText )
-        {
-            Rect frame ;
-            frame.top = m_rect.top + kTipBorder + height ;
-            frame.left = m_rect.left + kTipBorder ;
-            frame.bottom = frame.top + 1000 ;
-            frame.right = frame.left + 1000 ;
-            CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
-               ::DrawThemeTextBox( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       true,
-                                                       &frame,
-                                                       teJustLeft,
-                                                       nil );
-            CFRelease( mString ) ;
-        }
-        else
+            if ( useDrawThemeText )
+            {
+                Rect frame ;
+                frame.top = m_rect.top + kTipBorder + height ;
+                frame.left = m_rect.left + kTipBorder ;
+                frame.bottom = frame.top + 1000 ;
+                frame.right = frame.left + 1000 ;
+                CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
+                ::DrawThemeTextBox( mString,
+                    kThemeCurrentPortFont,
+                    kThemeStateActive,
+                    true,
+                    &frame,
+                    teJustLeft,
+                    nil );
+                CFRelease( mString ) ;
+            }
+            else
 #endif
-        {
-                   ::DrawText( text , laststop , i - laststop ) ;
-               }
-               ::TextMode( srcOr ) ;           
-        }
-       }
+            {
+                ::DrawText( text , laststop , i - laststop ) ;
+            }
+            ::TextMode( srcOr ) ;        
+       }
+    }
 }
 
 void wxToolTip::NotifyWindowDelete( WXHWND win ) 
 {
-       if ( win == s_ToolTipWindowRef )
-       {
-               s_ToolTipWindowRef = NULL ;
-       }
+    if ( win == s_ToolTipWindowRef )
+    {
+        s_ToolTipWindowRef = NULL ;
+    }
 }
 
 void wxMacToolTip::Clear()
 {
-       m_mark++ ;
-       if ( m_timer )
-       {
-           delete m_timer ;
-           m_timer = NULL ;
-       }
-       if ( !m_shown )
-               return ;
+    m_mark++ ;
+    if ( m_timer )
+    {
+        delete m_timer ;
+        m_timer = NULL ;
+    }
+    if ( !m_shown )
+        return ;
 #if TARGET_CARBON
-       HMHideTag() ;
-       if( m_helpTextRef )
-       {
-               CFRelease( m_helpTextRef ) ;
-               m_helpTextRef = NULL ;
-       }
-#else           
-       if ( m_window == s_ToolTipWindowRef && m_backpict )
-       {
-               wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;
+    HMHideTag() ;
+    if( m_helpTextRef )
+    {
+        CFRelease( m_helpTextRef ) ;
+        m_helpTextRef = NULL ;
+    }
+#else         
+    if ( m_window == s_ToolTipWindowRef && m_backpict )
+    {
+        wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;
 
-               m_shown = false ;
+        m_shown = false ;
 
-               BackColor( whiteColor ) ;
-               ForeColor(blackColor ) ;
-               DrawPicture(m_backpict, &m_rect);
-               KillPicture(m_backpict);
-               m_backpict = NULL ;
-       }
+        BackColor( whiteColor ) ;
+        ForeColor(blackColor ) ;
+        DrawPicture(m_backpict, &m_rect);
+        KillPicture(m_backpict);
+        m_backpict = NULL ;
+    }
 #endif
 }
 
index d053a98ab1dfc60563751936499d461223016f40..76051b7079177bb9f124a7831b97abd0f5727451 100644 (file)
@@ -75,7 +75,7 @@ static const EventTypeSpec eventList[] =
 {
     { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
 
-       { kEventClassKeyboard, kEventRawKeyDown } ,
+    { kEventClassKeyboard, kEventRawKeyDown } ,
     { kEventClassKeyboard, kEventRawKeyRepeat } ,
     { kEventClassKeyboard, kEventRawKeyUp } ,
     { kEventClassKeyboard, kEventRawKeyModifiersChanged } ,
@@ -99,34 +99,34 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
     OSStatus result = eventNotHandledErr ;
 
     wxWindow* focus = wxWindow::FindFocus() ;
-       char charCode ;
-       UInt32 keyCode ;        
+    char charCode ;
+    UInt32 keyCode ;    
     UInt32 modifiers ;
-       Point point ;
-       UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
+    Point point ;
+    UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
 
     EventRef rawEvent ;
     
     GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ;
     
-       GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
-       GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
-       GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
-       GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL,
-               sizeof( Point ), NULL, &point );
-
-       UInt32 message = (keyCode << 8) + charCode;
-
-       switch ( GetEventKind( event ) )
-       {
-               case kEventTextInputUnicodeForKeyEvent :
-               if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
-                       focus , message , modifiers , when , point.h , point.v ) )
-               {
-                   result = noErr ;
-               }
-                       break ;
-       }
+    GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
+    GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
+       GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL,
+        sizeof( Point ), NULL, &point );
+
+    UInt32 message = (keyCode << 8) + charCode;
+
+    switch ( GetEventKind( event ) )
+    {
+        case kEventTextInputUnicodeForKeyEvent :
+            if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
+                focus , message , modifiers , when , point.h , point.v ) )
+            {
+                result = noErr ;
+            }
+            break ;
+    }
 
     return result ;
 }
@@ -136,73 +136,73 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
     OSStatus result = eventNotHandledErr ;
 
     wxWindow* focus = wxWindow::FindFocus() ;
-       char charCode ;
-       UInt32 keyCode ;        
+    char charCode ;
+    UInt32 keyCode ;    
     UInt32 modifiers ;
-       Point point ;
-       UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
-
-       GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
-       GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
-       GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
-       GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
-               sizeof( Point ), NULL, &point );
-
-       UInt32 message = (keyCode << 8) + charCode;
-       switch( GetEventKind( event ) )
-       {
-               case kEventRawKeyRepeat :
-               case kEventRawKeyDown :
-               if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
-                       focus , message , modifiers , when , point.h , point.v ) )
-               {
-                   result = noErr ;
-               }
-                       break ;
-               case kEventRawKeyUp :
-               if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent( 
-                       focus , message , modifiers , when , point.h , point.v ) )
-               {
-                   result = noErr ;
-               }
-                       break ;
-               case kEventRawKeyModifiersChanged :
-                       {
-                       wxKeyEvent event(wxEVT_KEY_DOWN);
-
-                       event.m_shiftDown = modifiers & shiftKey;
-                       event.m_controlDown = modifiers & controlKey;
-                       event.m_altDown = modifiers & optionKey;
-                       event.m_metaDown = modifiers & cmdKey;
-
-                       event.m_x = point.h;
-                       event.m_y = point.v;
-                       event.m_timeStamp = when;
-                       wxWindow* focus = wxWindow::FindFocus() ;
-                       event.SetEventObject(focus);
-
-                       if ( (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
-                       {
-                           event.m_keyCode = WXK_CONTROL ;
-                           event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
-                           focus->GetEventHandler()->ProcessEvent( event ) ;
-                       }
-                       if ( (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
-                       {
-                           event.m_keyCode = WXK_SHIFT ;
-                           event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
-                           focus->GetEventHandler()->ProcessEvent( event ) ;
-                       }
-                       if ( (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
-                       {
-                           event.m_keyCode = WXK_ALT ;
-                           event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
-                           focus->GetEventHandler()->ProcessEvent( event ) ;
-                       }
-                       wxTheApp->s_lastModifiers = modifiers ;
-                   }
-                       break ;
-       }
+    Point point ;
+    UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
+
+    GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
+    GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
+       GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
+        sizeof( Point ), NULL, &point );
+
+    UInt32 message = (keyCode << 8) + charCode;
+    switch( GetEventKind( event ) )
+    {
+        case kEventRawKeyRepeat :
+        case kEventRawKeyDown :
+            if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
+                focus , message , modifiers , when , point.h , point.v ) )
+            {
+                result = noErr ;
+            }
+            break ;
+        case kEventRawKeyUp :
+            if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent( 
+                focus , message , modifiers , when , point.h , point.v ) )
+            {
+                result = noErr ;
+            }
+            break ;
+        case kEventRawKeyModifiersChanged :
+            {
+                wxKeyEvent event(wxEVT_KEY_DOWN);
+
+                event.m_shiftDown = modifiers & shiftKey;
+                event.m_controlDown = modifiers & controlKey;
+                event.m_altDown = modifiers & optionKey;
+                event.m_metaDown = modifiers & cmdKey;
+
+                event.m_x = point.h;
+                event.m_y = point.v;
+                event.m_timeStamp = when;
+                wxWindow* focus = wxWindow::FindFocus() ;
+                event.SetEventObject(focus);
+
+                if ( (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
+                {
+                    event.m_keyCode = WXK_CONTROL ;
+                    event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
+                {
+                    event.m_keyCode = WXK_SHIFT ;
+                    event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
+                {
+                    event.m_keyCode = WXK_ALT ;
+                    event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                wxTheApp->s_lastModifiers = modifiers ;
+            }
+             break ;
+    }
 
     return result ;
 }
@@ -211,54 +211,54 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
 {
     OSStatus result = eventNotHandledErr ;
 
-       wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
-       Point point ;
-       UInt32 modifiers = 0;
-       EventMouseButton button = 0 ;
-       UInt32 click = 0 ;
-       
-       GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
-               sizeof( Point ), NULL, &point );
-       GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL,
-               sizeof( UInt32 ), NULL, &modifiers );
-       GetEventParameter( event, kEventParamMouseButton, typeMouseButton, NULL,
-               sizeof( EventMouseButton ), NULL, &button );
-       GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL,
-               sizeof( UInt32 ), NULL, &click );
-               
-       if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
-               modifiers += btnState ;
-       
-       WindowRef window ;
+    wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
+    Point point ;
+    UInt32 modifiers = 0;
+    EventMouseButton button = 0 ;
+    UInt32 click = 0 ;
+    
+    GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
+        sizeof( Point ), NULL, &point );
+    GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL,
+        sizeof( UInt32 ), NULL, &modifiers );
+    GetEventParameter( event, kEventParamMouseButton, typeMouseButton, NULL,
+        sizeof( EventMouseButton ), NULL, &button );
+    GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL,
+        sizeof( UInt32 ), NULL, &click );
+        
+    if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
+        modifiers += btnState ;
+    
+    WindowRef window ;
     short windowPart = ::FindWindow(point, &window);
 
-       if ( IsWindowActive(window) && windowPart == inContent )
+    if ( IsWindowActive(window) && windowPart == inContent )
     {
-               switch ( GetEventKind( event ) )
-               {
-                       case kEventMouseDown :
-                               toplevelWindow->MacFireMouseEvent( mouseDown , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       case kEventMouseUp :
-                               toplevelWindow->MacFireMouseEvent( mouseUp , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       case kEventMouseMoved :
-                               toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       case kEventMouseDragged :
-                               toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       default :
-                               break ;
-               }
-       }
-       
-       return result ;
-       
+        switch ( GetEventKind( event ) )
+        {
+            case kEventMouseDown :
+                toplevelWindow->MacFireMouseEvent( mouseDown , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            case kEventMouseUp :
+                toplevelWindow->MacFireMouseEvent( mouseUp , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            case kEventMouseMoved :
+                toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            case kEventMouseDragged :
+                toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            default :
+                break ;
+        }
+    }
+    
+    return result ;
+    
 
 }
 static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
@@ -266,53 +266,53 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
     OSStatus result = eventNotHandledErr ;
     OSStatus err = noErr ;
 
-       UInt32          attributes;
-       WindowRef windowRef ;
-       wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
-       
-       GetEventParameter( event, kEventParamDirectObject, typeWindowRef, NULL,
-               sizeof( WindowRef ), NULL, &windowRef );
-               
-       switch( GetEventKind( event ) )
-       {
-               case kEventWindowUpdate :
-               if ( !wxPendingDelete.Member(toplevelWindow) )
-                               toplevelWindow->MacUpdate( EventTimeToTicks( GetEventTime( event ) ) ) ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowActivated :
-                               toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , true) ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowDeactivated :
-                               toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , false) ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowClose :
-               toplevelWindow->Close() ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowBoundsChanged :
-                       err = GetEventParameter( event, kEventParamAttributes, typeUInt32,
-                                               NULL, sizeof( UInt32 ), NULL, &attributes );
-                       if ( err == noErr )
-                       {
-                               Rect newContentRect ;
-
-                               GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
-                                       sizeof( newContentRect ), NULL, &newContentRect );
-                               
+    UInt32        attributes;
+    WindowRef windowRef ;
+    wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
+    
+    GetEventParameter( event, kEventParamDirectObject, typeWindowRef, NULL,
+        sizeof( WindowRef ), NULL, &windowRef );
+        
+    switch( GetEventKind( event ) )
+    {
+        case kEventWindowUpdate :
+            if ( !wxPendingDelete.Member(toplevelWindow) )
+                toplevelWindow->MacUpdate( EventTimeToTicks( GetEventTime( event ) ) ) ;
+            result = noErr ;
+            break ;
+        case kEventWindowActivated :
+                toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , true) ;
+            result = noErr ;
+            break ;
+        case kEventWindowDeactivated :
+                toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , false) ;
+            result = noErr ;
+            break ;
+        case kEventWindowClose :
+                toplevelWindow->Close() ;
+            result = noErr ;
+            break ;
+        case kEventWindowBoundsChanged :
+            err = GetEventParameter( event, kEventParamAttributes, typeUInt32,
+                        NULL, sizeof( UInt32 ), NULL, &attributes );
+            if ( err == noErr )
+            {
+                Rect newContentRect ;
+
+                GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
+                    sizeof( newContentRect ), NULL, &newContentRect );
+                
                 toplevelWindow->SetSize( newContentRect.left , newContentRect.top , 
                     newContentRect.right - newContentRect.left , 
                     newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
 
-                               result = noErr;
-                       }
-                       break ;
-               default :
-                       break ;
-       }
-       return result ;
+                result = noErr;
+            }
+            break ;
+        default :
+            break ;
+    }
+    return result ;
 }
 
 pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
@@ -322,17 +322,17 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef
     switch ( GetEventClass( event ) )
     {
         case kEventClassKeyboard :
-               result = KeyboardEventHandler( handler, event , data ) ;
+            result = KeyboardEventHandler( handler, event , data ) ;
             break ;
         case kEventClassTextInput :
-               result = TextInputEventHandler( handler, event , data ) ;
+            result = TextInputEventHandler( handler, event , data ) ;
             break ;
         case kEventClassWindow :
-               result = WindowEventHandler( handler, event , data ) ;
-               break ;
+            result = WindowEventHandler( handler, event , data ) ;
+            break ;
         case kEventClassMouse :
-               result = MouseEventHandler( handler, event , data ) ;
-               break ;
+            result = MouseEventHandler( handler, event , data ) ;
+            break ;
         default :
             break ;
     }
@@ -503,32 +503,32 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
            long style,
            const wxString& name ) 
 {
-  SetName(name);
-  m_windowStyle = style;
-  m_isShown = FALSE;
-
-  // create frame.
-
+    SetName(name);
+    m_windowStyle = style;
+    m_isShown = FALSE;
+    
+    // create frame.
+    
     Rect theBoundsRect;
-
-  m_x = (int)pos.x;
-  m_y = (int)pos.y;
-  if ( m_y < 50 )
-    m_y = 50 ;
-  if ( m_x < 20 )
-    m_x = 20 ;
     
-  m_width = size.x;
+    m_x = (int)pos.x;
+    m_y = (int)pos.y;
+    if ( m_y < 50 )
+        m_y = 50 ;
+    if ( m_x < 20 )
+        m_x = 20 ;
+    
+    m_width = size.x;
     if (m_width == -1) 
         m_width = 20;
-  m_height = size.y;
+    m_height = size.y;
     if (m_height == -1) 
         m_height = 20;
-
+    
     ::SetRect(&theBoundsRect, m_x, m_y , m_x + m_width, m_y + m_height);
-
+    
     // translate the window attributes in the appropriate window class and attributes
-
+    
     WindowClass wclass = 0;
     WindowAttributes attr = kWindowNoAttributes ;
     
@@ -538,7 +538,7 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
             HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
             HasFlag( wxSYSTEM_MENU ) || HasFlag( wxCAPTION ) ||
             HasFlag(wxTINY_CAPTION_HORIZ) ||  HasFlag(wxTINY_CAPTION_VERT)
-             )
+            )
         {
             wclass = kFloatingWindowClass ;
             if ( HasFlag(wxTINY_CAPTION_VERT) )
@@ -557,12 +557,12 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     }
     else if ( HasFlag( wxCAPTION ) )
     {
-       wclass = kDocumentWindowClass ; 
+        wclass = kDocumentWindowClass ; 
     }
     else
     {
         if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
-             HasFlag( wxSYSTEM_MENU ) )
+            HasFlag( wxSYSTEM_MENU ) )
         {
             wclass = kDocumentWindowClass ;
         }
@@ -600,9 +600,9 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     UMASetWTitleC( (WindowRef)m_macWindow , label ) ;
     ::CreateRootControl( (WindowRef)m_macWindow , (ControlHandle*)&m_macRootControl ) ;
 #if TARGET_CARBON
-       InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
-       InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(), 
-               GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));    
+    InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
+    InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(), 
+        GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));    
 #endif
     m_macFocus = NULL ;
 }
@@ -621,7 +621,7 @@ void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR cli
 
 void wxTopLevelWindowMac::Clear()
 {
-  wxWindow::Clear() ;
+    wxWindow::Clear() ;
 }
 
 WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding() 
@@ -632,7 +632,6 @@ WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
 
 void wxTopLevelWindowMac::MacUpdate( long timestamp)
 {
-
     wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
 
     BeginUpdate( (WindowRef)m_macWindow ) ;
@@ -671,7 +670,7 @@ void wxTopLevelWindowMac::Lower()
 }
 
 void wxTopLevelWindowMac::MacFireMouseEvent( 
-       wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp )
+    wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp )
 {
     wxMouseEvent event(wxEVT_LEFT_DOWN);
     bool isDown = !(modifiers & btnState) ; // 1 is for up
@@ -770,12 +769,13 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
         MacDispatchMouseEvent( event ) ;
     }
 }
+
 #if !TARGET_CARBON
 
 void wxTopLevelWindowMac::MacMouseDown( WXEVENTREF ev , short part)
 {
     MacFireMouseEvent( mouseDown , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
-       ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
+        ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
 }
 
 void wxTopLevelWindowMac::MacMouseUp( WXEVENTREF ev , short part)
@@ -784,8 +784,8 @@ void wxTopLevelWindowMac::MacMouseUp( WXEVENTREF ev , short part)
     {
         case inContent:     
             {
-                           MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
-                               ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
+                MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
+                    ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
             }
             break ;
     }
@@ -797,8 +797,8 @@ void wxTopLevelWindowMac::MacMouseMoved( WXEVENTREF ev , short part)
     {
         case inContent:     
             {
-                           MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
-                               ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
+                MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
+                    ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
             }
             break ;
     }
@@ -886,11 +886,11 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
     int former_w = m_width ;
     int former_h = m_height ;
     
-  int actualWidth = width;
-  int actualHeight = height;
-  int actualX = x;
-  int actualY = y;
-  
+    int actualWidth = width;
+    int actualHeight = height;
+    int actualX = x;
+    int actualY = y;
+    
     if ((m_minWidth != -1) && (actualWidth < m_minWidth)) 
         actualWidth = m_minWidth;
     if ((m_minHeight != -1) && (actualHeight < m_minHeight)) 
@@ -977,51 +977,51 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
  
 void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground ) 
 {
-  GrafPtr formerPort ;
-  GetPort( &formerPort ) ;
-  SetPortWindowPort( (WindowRef)m_macWindow ) ;
-  
-  m_macNeedsErasing |= eraseBackground ;
-  
-  // if we already know that we will have to erase, there's no need to track the rest
-  if ( !m_macNeedsErasing)
-  {
-    // we end only here if eraseBackground is false
-    // if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
-    // we will have to erase anyway
-      
-    RgnHandle       updateRgn = NewRgn();    
-    RgnHandle       diffRgn = NewRgn() ;
-    if ( updateRgn && diffRgn )
+    GrafPtr formerPort ;
+    GetPort( &formerPort ) ;
+    SetPortWindowPort( (WindowRef)m_macWindow ) ;
+    
+    m_macNeedsErasing |= eraseBackground ;
+    
+    // if we already know that we will have to erase, there's no need to track the rest
+    if ( !m_macNeedsErasing)
     {
-        GetWindowUpdateRgn( (WindowRef)m_macWindow , updateRgn );
-        Point pt = {0,0} ;
-        LocalToGlobal( &pt ) ;
-        OffsetRgn( updateRgn , -pt.h , -pt.v ) ;
-        DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
-        if ( !EmptyRgn( diffRgn ) )
+        // we end only here if eraseBackground is false
+        // if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
+        // we will have to erase anyway
+        
+        RgnHandle       updateRgn = NewRgn();    
+        RgnHandle       diffRgn = NewRgn() ;
+        if ( updateRgn && diffRgn )
+        {
+            GetWindowUpdateRgn( (WindowRef)m_macWindow , updateRgn );
+            Point pt = {0,0} ;
+            LocalToGlobal( &pt ) ;
+            OffsetRgn( updateRgn , -pt.h , -pt.v ) ;
+            DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
+            if ( !EmptyRgn( diffRgn ) )
+            {
+                m_macNeedsErasing = true ;
+            }
+        }
+        if ( updateRgn )
+            DisposeRgn( updateRgn );
+        if ( diffRgn )
+            DisposeRgn( diffRgn );
+        
+        if ( !m_macNeedsErasing )
         {
-            m_macNeedsErasing = true ;
+            RgnHandle rectRgn = NewRgn() ;
+            SetRectRgn( rectRgn , ((Rect*)rect)->left , ((Rect*)rect)->top , ((Rect*)rect)->right , ((Rect*)rect)->bottom ) ;
+            UnionRgn( (RgnHandle) m_macNoEraseUpdateRgn , rectRgn , (RgnHandle) m_macNoEraseUpdateRgn ) ;
+            DisposeRgn( rectRgn ) ;
         }
     }
-    if ( updateRgn )
-        DisposeRgn( updateRgn );
-    if ( diffRgn )
-        DisposeRgn( diffRgn );
-
-    if ( !m_macNeedsErasing )
-    {
-      RgnHandle rectRgn = NewRgn() ;
-      SetRectRgn( rectRgn , ((Rect*)rect)->left , ((Rect*)rect)->top , ((Rect*)rect)->right , ((Rect*)rect)->bottom ) ;
-      UnionRgn( (RgnHandle) m_macNoEraseUpdateRgn , rectRgn , (RgnHandle) m_macNoEraseUpdateRgn ) ;
-      DisposeRgn( rectRgn ) ;
-    }
-  }
-  InvalWindowRect( (WindowRef)m_macWindow , (Rect*)rect ) ;
-  // turn this on to debug the refreshing cycle
+    InvalWindowRect( (WindowRef)m_macWindow , (Rect*)rect ) ;
+    // turn this on to debug the refreshing cycle
 #if wxMAC_DEBUG_REDRAW
-  PaintRect( rect ) ;
+    PaintRect( rect ) ;
 #endif
-  SetPort( formerPort ) ;
+    SetPort( formerPort ) ;
 }
 
index 2677a1efde6762ea09f5ac081c53958a6c9ef3f5..7a548a743646328e7e24f73973c8ef446102337f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -81,15 +81,15 @@ void wxTreeCtrl::SetIndent(int indent)
 
 wxImageList *wxTreeCtrl::GetImageList(int which) const
 {
-  if ( which == wxIMAGE_LIST_NORMAL )
+    if ( which == wxIMAGE_LIST_NORMAL )
     {
-    return m_imageListNormal;
-  }
-  else if ( which == wxIMAGE_LIST_STATE )
+        return m_imageListNormal;
+    }
+    else if ( which == wxIMAGE_LIST_STATE )
     {
-    return m_imageListState;
-  }
-  return NULL;
+        return m_imageListState;
+    }
+    return NULL;
 }
 
 void wxTreeCtrl::SetImageList(wxImageList *imageList, int which)
@@ -274,50 +274,50 @@ bool wxTreeCtrl::DeleteItem(long item)
 bool wxTreeCtrl::ExpandItem(long item, int action)
 {
     // TODO
-  switch ( action )
-  {
+    switch ( action )
+    {
     case wxTREE_EXPAND_EXPAND:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_COLLAPSE:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_COLLAPSE_RESET:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_TOGGLE:
-      break;
-
+        break;
+        
     default:
-      wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
-  }
-
-  bool bOk = FALSE; // TODO expand item
-
-  // May not send messages, so emulate them
-  if ( bOk ) {
-    wxTreeEvent event(wxEVT_NULL, m_windowId);
-    event.m_item.m_itemId  = item;
-    event.m_item.m_mask      =
-    event.m_item.m_stateMask = 0xffff; // get all
-    GetItem(event.m_item);
-
-    bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
-
-    event.m_code = action;
-    event.SetEventObject(this);
-
-    // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
-    event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
-                                   : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
-    GetEventHandler()->ProcessEvent(event);
-
-    event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
-                                   : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
-    GetEventHandler()->ProcessEvent(event);
-  }
-
-  return bOk;
+        wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
+    }
+    
+    bool bOk = FALSE; // TODO expand item
+    
+    // May not send messages, so emulate them
+    if ( bOk ) {
+        wxTreeEvent event(wxEVT_NULL, m_windowId);
+        event.m_item.m_itemId  = item;
+        event.m_item.m_mask      =
+            event.m_item.m_stateMask = 0xffff; // get all
+        GetItem(event.m_item);
+        
+        bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
+        
+        event.m_code = action;
+        event.SetEventObject(this);
+        
+        // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
+        event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
+            : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
+        GetEventHandler()->ProcessEvent(event);
+        
+        event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
+            : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
+        GetEventHandler()->ProcessEvent(event);
+    }
+    
+    return bOk;
 }
 
 long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter)
index 43e9cf7e4427dff94e993c1dd3e1d284c64092b8..59daa769db71de98da9e688e22ca1b9bb342bc60 100644 (file)
@@ -25,7 +25,7 @@
 // windows manager, control manager, navigation services etc. are 
 // present
 
-static bool    sUMAHasAppearance = false ;
+static bool    sUMAHasAppearance = false ;
 static long sUMAAppearanceVersion = 0 ;
 static long sUMASystemVersion = 0 ;
 static bool sUMAHasAquaLayout = false ;
@@ -36,7 +36,7 @@ bool UMAHasAppearance() { return sUMAHasAppearance ; }
 long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
 long UMAGetSystemVersion() { return sUMASystemVersion ; }
 
-static bool    sUMAHasWindowManager = false ;
+static bool    sUMAHasWindowManager = false ;
 static long sUMAWindowManagerAttr = 0 ;
 
 bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
@@ -46,72 +46,72 @@ bool UMASystemIsInitialized() { return sUMASystemInitialized ; }
 
 void UMACleanupToolbox()
 {
-       if ( sUMAHasAppearance )
-       {
-               UnregisterAppearanceClient() ;
-       }
-       if ( NavServicesAvailable() )
-       {
-               NavUnload() ;
-       }
+    if ( sUMAHasAppearance )
+    {
+        UnregisterAppearanceClient() ;
+    }
+    if ( NavServicesAvailable() )
+    {
+        NavUnload() ;
+    }
   if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
-         TXNTerminateTextension( ) ;
+      TXNTerminateTextension( ) ;
 }
 void UMAInitToolbox( UInt16 inMoreMastersCalls )
 {
 #if !TARGET_CARBON
-       ::MaxApplZone();
-       for (long i = 1; i <= inMoreMastersCalls; i++)
-               ::MoreMasters();
-
-       ::InitGraf(&qd.thePort);
-       ::InitFonts();
-       ::InitMenus();
-       ::TEInit();
-       ::InitDialogs(0L);
-       ::FlushEvents(everyEvent, 0);
-       ::InitCursor();
-       long total,contig;
-       PurgeSpace(&total, &contig);
+    ::MaxApplZone();
+    for (long i = 1; i <= inMoreMastersCalls; i++)
+        ::MoreMasters();
+
+    ::InitGraf(&qd.thePort);
+    ::InitFonts();
+    ::InitMenus();
+    ::TEInit();
+    ::InitDialogs(0L);
+    ::FlushEvents(everyEvent, 0);
+    ::InitCursor();
+    long total,contig;
+    PurgeSpace(&total, &contig);
 #else
-       InitCursor();
+    InitCursor();
 #endif
 
     if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
-       sUMASystemVersion = 0x0000 ;
-       
-       long theAppearance ;
-       if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
-       {
-               sUMAHasAppearance = true ;
-               RegisterAppearanceClient();
-               if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
-               {
-                       sUMAAppearanceVersion = theAppearance ;
-               }
-               else
-               {
-                       sUMAAppearanceVersion = 0x0100 ;
-               }
-       }
-       if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr )
-       {
-               sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
-       }
-               
+        sUMASystemVersion = 0x0000 ;
+        
+    long theAppearance ;
+    if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
+    {
+        sUMAHasAppearance = true ;
+        RegisterAppearanceClient();
+        if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
+        {
+            sUMAAppearanceVersion = theAppearance ;
+        }
+        else
+        {
+            sUMAAppearanceVersion = 0x0100 ;
+        }
+    }
+    if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr )
+    {
+        sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
+    }
+        
 #if TARGET_CARBON
-// Call currently implicitely done :           InitFloatingWindows() ;
+// Call currently implicitely done :        InitFloatingWindows() ;
 #else
-       if ( sUMAHasWindowManager )
-               InitFloatingWindows() ;
-       else
-               InitWindows();
+    if ( sUMAHasWindowManager )
+        InitFloatingWindows() ;
+    else
+        InitWindows();
 #endif
 
-       if ( NavServicesAvailable() )
-       {
-               NavLoad() ;
-       }
+    if ( NavServicesAvailable() )
+    {
+        NavLoad() ;
+    }
 
   long menuMgrAttr ;
   Gestalt( gestaltMenuMgrAttr , &menuMgrAttr ) ;
@@ -121,10 +121,10 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
   if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress )
   { 
     FontFamilyID fontId ;
-       Str255 fontName ;
-       SInt16 fontSize ;
-       Style fontStyle ;
-       GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+    Str255 fontName ;
+    SInt16 fontSize ;
+    Style fontStyle ;
+    GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
     GetFNum( fontName, &fontId );
 
     TXNMacOSPreferredFontDescription fontDescriptions[] =
@@ -135,15 +135,15 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
 #if 0 // TARGET_CARBON  
     --noOfFontDescriptions ;
 #endif
-       // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
-       OptionBits options = kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask ;
+      // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
+      OptionBits options = kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask ;
 #if TARGET_CARBON
     if ( !UMAHasAquaLayout() )
 #endif
     {
         options |= kTXNAlwaysUseQuickDrawTextMask ;
     }
-       TXNInitTextension(fontDescriptions,  noOfFontDescriptions, options );
+      TXNInitTextension(fontDescriptions,  noOfFontDescriptions, options );
   }
 
 
@@ -153,286 +153,286 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
 
 /*
 Boolean CanUseATSUI()
-       {
-       long result;
-       OSErr err = Gestalt(gestaltATSUVersion, &result);
-       return (err == noErr);
-       }
+    {
+    long result;
+    OSErr err = Gestalt(gestaltATSUVersion, &result);
+    return (err == noErr);
+    }
 */
 // process manager
 long UMAGetProcessMode() 
 {
-       OSErr err ; 
-       ProcessInfoRec processinfo;
-       ProcessSerialNumber procno ;
-       
-       procno.highLongOfPSN = NULL ;
-       procno.lowLongOfPSN = kCurrentProcess ;
-       processinfo.processInfoLength = sizeof(ProcessInfoRec);
-       processinfo.processName = NULL;
-       processinfo.processAppSpec = NULL;
+    OSErr err ; 
+    ProcessInfoRec processinfo;
+    ProcessSerialNumber procno ;
+    
+    procno.highLongOfPSN = NULL ;
+    procno.lowLongOfPSN = kCurrentProcess ;
+    processinfo.processInfoLength = sizeof(ProcessInfoRec);
+    processinfo.processName = NULL;
+    processinfo.processAppSpec = NULL;
 
-       err = ::GetProcessInformation( &procno , &processinfo ) ;
-       wxASSERT( err == noErr ) ;
-       return processinfo.processMode ;
+    err = ::GetProcessInformation( &procno , &processinfo ) ;
+    wxASSERT( err == noErr ) ;
+    return processinfo.processMode ;
 }
 
 bool UMAGetProcessModeDoesActivateOnFGSwitch() 
 {
-       return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
+    return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
 }
 
 // menu manager
 
 MenuRef UMANewMenu( SInt16 id , const wxString& title )
 {
-       wxString str = wxStripMenuCodes( title ) ;
-       MenuRef menu ;
+    wxString str = wxStripMenuCodes( title ) ;
+    MenuRef menu ;
 #if TARGET_CARBON
-       CFStringRef cfs = wxMacCreateCFString( str ) ;
-       CreateNewMenu( id , 0 , &menu ) ;
-       SetMenuTitleWithCFString( menu , cfs ) ;
-       CFRelease( cfs ) ;
+    CFStringRef cfs = wxMacCreateCFString( str ) ;
+    CreateNewMenu( id , 0 , &menu ) ;
+    SetMenuTitleWithCFString( menu , cfs ) ;
+    CFRelease( cfs ) ;
 #else
-       Str255 ptitle ;
-       wxMacStringToPascal( str , ptitle ) ;
-       menu = ::NewMenu( id , ptitle ) ;
+    Str255 ptitle ;
+    wxMacStringToPascal( str , ptitle ) ;
+    menu = ::NewMenu( id , ptitle ) ;
 #endif
-       return menu ;
+    return menu ;
 }
 
 void UMASetMenuTitle( MenuRef menu , const wxString& title )
 {
-       wxString str = wxStripMenuCodes( title ) ;
+    wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-       CFStringRef cfs = wxMacCreateCFString( str ) ;
-       SetMenuTitleWithCFString( menu , cfs ) ;
-       CFRelease( cfs ) ;
+    CFStringRef cfs = wxMacCreateCFString( str ) ;
+    SetMenuTitleWithCFString( menu , cfs ) ;
+    CFRelease( cfs ) ;
 #else
-       Str255 ptitle ;
-       wxMacStringToPascal( str , ptitle ) ;
-       SetMenuTitle( menu , ptitle ) ;
+    Str255 ptitle ;
+    wxMacStringToPascal( str , ptitle ) ;
+    SetMenuTitle( menu , ptitle ) ;
 #endif
 }
 
 void UMASetMenuItemText(  MenuRef menu,  MenuItemIndex item, const wxString& title ) 
 {
-       wxString str = wxStripMenuCodes( title ) ;
+    wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-       CFStringRef cfs = wxMacCreateCFString( str ) ;
-       SetMenuItemTextWithCFString( menu , item , cfs ) ;
-       CFRelease( cfs ) ;
+    CFStringRef cfs = wxMacCreateCFString( str ) ;
+    SetMenuItemTextWithCFString( menu , item , cfs ) ;
+    CFRelease( cfs ) ;
 #else
-       Str255 ptitle ;
-       wxMacStringToPascal( str , ptitle ) ;
-       SetMenuItemText( menu , item , ptitle ) ;
+    Str255 ptitle ;
+    wxMacStringToPascal( str , ptitle ) ;
+    SetMenuItemText( menu , item , ptitle ) ;
 #endif
 }
 
 
 UInt32 UMAMenuEvent( EventRecord *inEvent )
 {
-               return MenuEvent( inEvent ) ;
+        return MenuEvent( inEvent ) ;
 }
 
 void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem , bool enable) 
 {
-       if ( enable )
-               EnableMenuItem( inMenu , inItem ) ;
-       else
-               DisableMenuItem( inMenu , inItem ) ;
+    if ( enable )
+        EnableMenuItem( inMenu , inItem ) ;
+    else
+        DisableMenuItem( inMenu , inItem ) ;
 }
 
 void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 id ) 
 {
-       MacAppendMenu(menu, "\pA");
-       UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
-       SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
+    MacAppendMenu(menu, "\pA");
+    UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
+    SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
 }
 
 void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 id  ) 
 {
-       MacInsertMenuItem(menu, "\pA" , item);
-       UMASetMenuItemText(menu, item , title );
-       SetMenuItemHierarchicalID( menu , item , id ) ;
+    MacInsertMenuItem(menu, "\pA" , item);
+    UMASetMenuItemText(menu, item , title );
+    SetMenuItemHierarchicalID( menu , item , id ) ;
 }
 
 void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry )
 {
-       if ( !entry )
-               return ;
-               
-       UInt8 modifiers = 0 ;
-       SInt16 key = entry->GetKeyCode() ;
-       if ( key )
-       {
-               bool explicitCommandKey = false ;
-
-               if ( entry->GetFlags() & wxACCEL_CTRL ) 
-               {
-                       explicitCommandKey = true ;
-               }
-
-               if (entry->GetFlags() & wxACCEL_ALT ) 
-               {
-                       modifiers |= kMenuOptionModifier ;
-               }
-
-               if (entry->GetFlags() & wxACCEL_SHIFT) 
-               {
-                       modifiers |= kMenuShiftModifier ;
-               }
-
-           SInt16 glyph = 0 ;
-           SInt16 macKey = key ;
-           if ( key >= WXK_F1 && key <= WXK_F15 )
-           {
-               macKey = kFunctionKeyCharCode ;
-               glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
-               if ( key >= WXK_F13 )
-                   glyph += 13 ;
+    if ( !entry )
+        return ;
+        
+    UInt8 modifiers = 0 ;
+    SInt16 key = entry->GetKeyCode() ;
+    if ( key )
+    {
+        bool explicitCommandKey = false ;
+
+        if ( entry->GetFlags() & wxACCEL_CTRL ) 
+        {
+            explicitCommandKey = true ;
+        }
+
+        if (entry->GetFlags() & wxACCEL_ALT ) 
+        {
+            modifiers |= kMenuOptionModifier ;
+        }
+
+        if (entry->GetFlags() & wxACCEL_SHIFT) 
+        {
+            modifiers |= kMenuShiftModifier ;
+        }
+
+        SInt16 glyph = 0 ;
+        SInt16 macKey = key ;
+        if ( key >= WXK_F1 && key <= WXK_F15 )
+        {
+            macKey = kFunctionKeyCharCode ;
+            glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
+            if ( key >= WXK_F13 )
+                glyph += 13 ;
             if ( !explicitCommandKey )
-               modifiers |= kMenuNoCommandModifier ;
-               
-                       switch( key )
-               {
-                   case WXK_F1 :
-                       macKey += ( 0x7a << 8 ) ;
-                       break ;
-                   case WXK_F2 :
-                       macKey += ( 0x78 << 8 ) ;
-                       break ;
-                   case WXK_F3 :
-                       macKey += ( 0x63 << 8 ) ;
-                       break ;
-                   case WXK_F4 :
-                       macKey += ( 0x76 << 8 ) ;
-                       break ;
-                   case WXK_F5 :
-                       macKey += ( 0x60 << 8 ) ;
-                       break ;
-                   case WXK_F6 :
-                       macKey += ( 0x61 << 8 ) ;
-                       break ;
-                   case WXK_F7 :
-                       macKey += ( 0x62 << 8 ) ;
-                       break ;
-                   case WXK_F8 :
-                       macKey += ( 0x64 << 8 ) ;
-                       break ;
-                   case WXK_F9 :
-                       macKey += ( 0x65 << 8 ) ;
-                       break ;
-                   case WXK_F10 :
-                       macKey += ( 0x6D << 8 ) ;
-                       break ;
-                   case WXK_F11 :
-                       macKey += ( 0x67 << 8 ) ;
-                       break ;
-                   case WXK_F12 :
-                       macKey += ( 0x6F << 8 ) ;
-                       break ;
-                   case WXK_F13 :
-                       macKey += ( 0x69 << 8 ) ;
-                       break ;
-                   case WXK_F14 :
-                       macKey += ( 0x6B << 8 ) ;
-                       break ;
-                   case WXK_F15 :
-                       macKey += ( 0x71 << 8 ) ;
-                       break ;
-                   default :
-                       break ;
-               } ;
-               // unfortunately this does not yet trigger the right key ,
-               // for some reason mac justs picks the first function key menu
-               // defined, so we turn this off
-               macKey = 0 ;
-               glyph = 0 ;
-           }
-           else
-       {
-           switch( key )
-           {
-               case WXK_BACK :
-                   macKey = kBackspaceCharCode ;
-                   glyph = kMenuDeleteLeftGlyph ;
-                   break ;
-               case WXK_TAB :
-                   macKey = kTabCharCode ;
-                   glyph = kMenuTabRightGlyph ;
-                   break ;
-               case kEnterCharCode :
-                   macKey = kEnterCharCode ;
-                   glyph = kMenuEnterGlyph ;
-                   break ;
-               case WXK_RETURN :
-                   macKey = kReturnCharCode ;
-                   glyph = kMenuReturnGlyph ;
-                   break ;
-               case WXK_ESCAPE :
-                   macKey = kEscapeCharCode ;
-                   glyph = kMenuEscapeGlyph ;
-                   break ;
-               case WXK_SPACE :
-                   macKey = ' ' ;
-                   glyph = kMenuSpaceGlyph ;
-                   break ;
-               case WXK_DELETE :
-                   macKey = kDeleteCharCode ;
-                   glyph = kMenuDeleteRightGlyph ;
-                   break ;
-               case WXK_CLEAR :
-                   macKey = kClearCharCode ;
-                   glyph = kMenuClearGlyph ;
-                   break ;
-               case WXK_PRIOR : // PAGE UP
-                   macKey = kPageUpCharCode ;
-                   glyph = kMenuPageUpGlyph ;
-                   break ;
-               case WXK_NEXT :
-                   macKey = kPageDownCharCode ;
-                   glyph = kMenuPageDownGlyph ;
-                   break ;
-               case WXK_LEFT :
-                   macKey = kLeftArrowCharCode ;
-                   glyph = kMenuLeftArrowGlyph ;
-                   break ;
-               case WXK_UP :
-                   macKey = kUpArrowCharCode ;
-                   glyph = kMenuUpArrowGlyph ;
-                   break ;
-               case WXK_RIGHT :
-                   macKey = kRightArrowCharCode ;
-                   glyph = kMenuRightArrowGlyph ;
-                   break ;
-               case WXK_DOWN :
-                   macKey = kDownArrowCharCode ;
-                   glyph = kMenuDownArrowGlyph ;
-                   break ;
+                modifiers |= kMenuNoCommandModifier ;
+                
+            switch( key )
+            {
+                case WXK_F1 :
+                    macKey += ( 0x7a << 8 ) ;
+                    break ;
+                case WXK_F2 :
+                    macKey += ( 0x78 << 8 ) ;
+                    break ;
+                case WXK_F3 :
+                    macKey += ( 0x63 << 8 ) ;
+                    break ;
+                case WXK_F4 :
+                    macKey += ( 0x76 << 8 ) ;
+                    break ;
+                case WXK_F5 :
+                    macKey += ( 0x60 << 8 ) ;
+                    break ;
+                case WXK_F6 :
+                    macKey += ( 0x61 << 8 ) ;
+                    break ;
+                case WXK_F7 :
+                    macKey += ( 0x62 << 8 ) ;
+                    break ;
+                case WXK_F8 :
+                    macKey += ( 0x64 << 8 ) ;
+                    break ;
+                case WXK_F9 :
+                    macKey += ( 0x65 << 8 ) ;
+                    break ;
+                case WXK_F10 :
+                    macKey += ( 0x6D << 8 ) ;
+                    break ;
+                case WXK_F11 :
+                    macKey += ( 0x67 << 8 ) ;
+                    break ;
+                case WXK_F12 :
+                    macKey += ( 0x6F << 8 ) ;
+                    break ;
+                case WXK_F13 :
+                    macKey += ( 0x69 << 8 ) ;
+                    break ;
+                case WXK_F14 :
+                    macKey += ( 0x6B << 8 ) ;
+                    break ;
+                case WXK_F15 :
+                    macKey += ( 0x71 << 8 ) ;
+                    break ;
+                default :
+                    break ;
+            } ;
+            // unfortunately this does not yet trigger the right key ,
+            // for some reason mac justs picks the first function key menu
+            // defined, so we turn this off
+            macKey = 0 ;
+            glyph = 0 ;
+          }
+        else
+        {
+            switch( key )
+            {
+                case WXK_BACK :
+                    macKey = kBackspaceCharCode ;
+                    glyph = kMenuDeleteLeftGlyph ;
+                    break ;
+                case WXK_TAB :
+                    macKey = kTabCharCode ;
+                    glyph = kMenuTabRightGlyph ;
+                    break ;
+                case kEnterCharCode :
+                    macKey = kEnterCharCode ;
+                    glyph = kMenuEnterGlyph ;
+                    break ;
+                case WXK_RETURN :
+                    macKey = kReturnCharCode ;
+                    glyph = kMenuReturnGlyph ;
+                    break ;
+                case WXK_ESCAPE :
+                    macKey = kEscapeCharCode ;
+                    glyph = kMenuEscapeGlyph ;
+                    break ;
+                case WXK_SPACE :
+                    macKey = ' ' ;
+                    glyph = kMenuSpaceGlyph ;
+                    break ;
+                case WXK_DELETE :
+                    macKey = kDeleteCharCode ;
+                    glyph = kMenuDeleteRightGlyph ;
+                    break ;
+                case WXK_CLEAR :
+                    macKey = kClearCharCode ;
+                    glyph = kMenuClearGlyph ;
+                    break ;
+                case WXK_PRIOR : // PAGE UP
+                    macKey = kPageUpCharCode ;
+                    glyph = kMenuPageUpGlyph ;
+                    break ;
+                case WXK_NEXT :
+                    macKey = kPageDownCharCode ;
+                    glyph = kMenuPageDownGlyph ;
+                    break ;
+                case WXK_LEFT :
+                    macKey = kLeftArrowCharCode ;
+                    glyph = kMenuLeftArrowGlyph ;
+                    break ;
+                case WXK_UP :
+                    macKey = kUpArrowCharCode ;
+                    glyph = kMenuUpArrowGlyph ;
+                    break ;
+                case WXK_RIGHT :
+                    macKey = kRightArrowCharCode ;
+                    glyph = kMenuRightArrowGlyph ;
+                    break ;
+                case WXK_DOWN :
+                    macKey = kDownArrowCharCode ;
+                    glyph = kMenuDownArrowGlyph ;
+                    break ;
             }
         }
 
-           SetItemCmd( menu, item , macKey );
-           SetMenuItemModifiers(menu, item , modifiers ) ;
+        SetItemCmd( menu, item , macKey );
+        SetMenuItemModifiers(menu, item , modifiers ) ;
 
         if ( glyph )
             SetMenuItemKeyGlyph(menu, item , glyph ) ;
-       }
+    }
 }
 
 void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry ) 
 {
-       MacAppendMenu(menu, "\pA");
-       UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
-       UMASetMenuItemShortcut( menu ,  (SInt16) ::CountMenuItems(menu), entry ) ;
+    MacAppendMenu(menu, "\pA");
+    UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
+    UMASetMenuItemShortcut( menu ,  (SInt16) ::CountMenuItems(menu), entry ) ;
 }
 
 void UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry ) 
 {
-       MacInsertMenuItem( menu , "\p" , item) ;
-       UMASetMenuItemText(menu, item , title );
-       UMASetMenuItemShortcut( menu , item , entry ) ;
+    MacInsertMenuItem( menu , "\p" , item) ;
+    UMASetMenuItemText(menu, item , title );
+    UMASetMenuItemShortcut( menu , item , entry ) ;
 }
 
 // quickdraw
@@ -442,58 +442,58 @@ int gPrOpenCounter = 0 ;
 OSStatus UMAPrOpen(void *macPrintSession)
 {
 #if !TARGET_CARBON
-       OSErr err = noErr ;
-       ++gPrOpenCounter ;
-       if ( gPrOpenCounter == 1 )
-       {
-               PrOpen() ;
-               err = PrError() ;
-               wxASSERT( err == noErr ) ;
-       }
-       return err ;
+    OSErr err = noErr ;
+    ++gPrOpenCounter ;
+    if ( gPrOpenCounter == 1 )
+    {
+        PrOpen() ;
+        err = PrError() ;
+        wxASSERT( err == noErr ) ;
+    }
+    return err ;
 #else
-       OSStatus err = noErr ;
-       ++gPrOpenCounter ;
-       if ( gPrOpenCounter == 1 )
-       {
+    OSStatus err = noErr ;
+    ++gPrOpenCounter ;
+    if ( gPrOpenCounter == 1 )
+    {
   #if PM_USE_SESSION_APIS
-           err = PMCreateSession((PMPrintSession *)macPrintSession) ;
+        err = PMCreateSession((PMPrintSession *)macPrintSession) ;
   #else
-           err = PMBegin() ;
+        err = PMBegin() ;
   #endif
-               wxASSERT( err == noErr ) ;
-       }
-       return err ;
+        wxASSERT( err == noErr ) ;
+    }
+    return err ;
 #endif
 }
 
 OSStatus UMAPrClose(void *macPrintSession)
 {
 #if !TARGET_CARBON
-       OSErr err = noErr ;
-       wxASSERT( gPrOpenCounter >= 1 ) ;
-       if ( gPrOpenCounter == 1 )
-       {
-               PrClose() ;
-               err = PrError() ;
-               wxASSERT( err == noErr ) ;
-       }
-       --gPrOpenCounter ;
-       return err ;
+    OSErr err = noErr ;
+    wxASSERT( gPrOpenCounter >= 1 ) ;
+    if ( gPrOpenCounter == 1 )
+    {
+        PrClose() ;
+        err = PrError() ;
+        wxASSERT( err == noErr ) ;
+    }
+    --gPrOpenCounter ;
+    return err ;
 #else
-       OSStatus err = noErr ;
-       wxASSERT( gPrOpenCounter >= 1 ) ;
-       if ( gPrOpenCounter == 1 )
-       {
+    OSStatus err = noErr ;
+    wxASSERT( gPrOpenCounter >= 1 ) ;
+    if ( gPrOpenCounter == 1 )
+    {
   #if PM_USE_SESSION_APIS
-           err = PMRelease(*(PMPrintSession *)macPrintSession) ;
-           *(PMPrintSession *)macPrintSession = kPMNoReference;
+        err = PMRelease(*(PMPrintSession *)macPrintSession) ;
+        *(PMPrintSession *)macPrintSession = kPMNoReference;
   #else
-           err = PMEnd() ;
+        err = PMEnd() ;
   #endif
-       }
-       --gPrOpenCounter ;
-       return err ;
+    }
+    --gPrOpenCounter ;
+    return err ;
 #endif
 }
 
@@ -502,82 +502,82 @@ OSStatus UMAPrClose(void *macPrintSession)
 pascal QDGlobalsPtr GetQDGlobalsPtr (void) ;
 pascal QDGlobalsPtr GetQDGlobalsPtr (void)
 {
-       return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
+    return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
 }
 
 #endif
 
 void UMAShowWatchCursor() 
 {
-       OSErr err = noErr;
+    OSErr err = noErr;
 
-       CursHandle watchFob = GetCursor (watchCursor);
+    CursHandle watchFob = GetCursor (watchCursor);
 
-       if (!watchFob)
-               err = nilHandleErr;
-       else
-       {
-       #if TARGET_CARBON
-//             Cursor preservedArrow;
-//             GetQDGlobalsArrow (&preservedArrow);
-//             SetQDGlobalsArrow (*watchFob);
-//             InitCursor ( );
-//             SetQDGlobalsArrow (&preservedArrow);
-               SetCursor (*watchFob);  
-       #else
-               SetCursor (*watchFob);  
-       #endif
-       }
+    if (!watchFob)
+        err = nilHandleErr;
+    else
+    {
+    #if TARGET_CARBON
+//        Cursor preservedArrow;
+//        GetQDGlobalsArrow (&preservedArrow);
+//        SetQDGlobalsArrow (*watchFob);
+//        InitCursor ( );
+//        SetQDGlobalsArrow (&preservedArrow);
+        SetCursor (*watchFob);    
+    #else
+        SetCursor (*watchFob);    
+    #endif
+    }
 }
 
-void                   UMAShowArrowCursor() 
+void            UMAShowArrowCursor() 
 {
 #if TARGET_CARBON
-       Cursor arrow;
-       SetCursor (GetQDGlobalsArrow (&arrow));
+    Cursor arrow;
+    SetCursor (GetQDGlobalsArrow (&arrow));
 #else
-       SetCursor (&(qd.arrow));
+    SetCursor (&(qd.arrow));
 #endif
 }
 
 // window manager
 
-GrafPtr                UMAGetWindowPort( WindowRef inWindowRef ) 
+GrafPtr        UMAGetWindowPort( WindowRef inWindowRef ) 
 {
-       wxASSERT( inWindowRef != NULL ) ;
+    wxASSERT( inWindowRef != NULL ) ;
 #if TARGET_CARBON 
-       return (GrafPtr) GetWindowPort( inWindowRef ) ; 
+    return (GrafPtr) GetWindowPort( inWindowRef ) ; 
 #else
-       return (GrafPtr) inWindowRef ;
+    return (GrafPtr) inWindowRef ;
 #endif
 }
 
-void                   UMADisposeWindow( WindowRef inWindowRef ) 
+void             UMADisposeWindow( WindowRef inWindowRef ) 
 {
-       wxASSERT( inWindowRef != NULL ) ;
-       DisposeWindow( inWindowRef ) ;
+    wxASSERT( inWindowRef != NULL ) ;
+    DisposeWindow( inWindowRef ) ;
 }
 
-void                   UMASetWTitleC( WindowRef inWindowRef , const char *title ) 
+void             UMASetWTitleC( WindowRef inWindowRef , const char *title ) 
 {
-       Str255  ptitle ;
-       strncpy( (char*)ptitle , title , 96 ) ;
-       ptitle[96] = 0 ;
+    Str255    ptitle ;
+    strncpy( (char*)ptitle , title , 96 ) ;
+    ptitle[96] = 0 ;
 #if TARGET_CARBON
-       c2pstrcpy( ptitle, (char *)ptitle ) ;
+    c2pstrcpy( ptitle, (char *)ptitle ) ;
 #else
-       c2pstr( (char*)ptitle ) ;
+    c2pstr( (char*)ptitle ) ;
 #endif
-       SetWTitle( inWindowRef , ptitle ) ;
+    SetWTitle( inWindowRef , ptitle ) ;
 }
 
-void                   UMAGetWTitleC( WindowRef inWindowRef , char *title ) 
+void             UMAGetWTitleC( WindowRef inWindowRef , char *title ) 
 {
-       GetWTitle( inWindowRef , (unsigned char*)title ) ;
+    GetWTitle( inWindowRef , (unsigned char*)title ) ;
 #if TARGET_CARBON
-       p2cstrcpy( title, (unsigned char *)title ) ;
+    p2cstrcpy( title, (unsigned char *)title ) ;
 #else
-       p2cstr( (unsigned char*)title ) ;
+    p2cstr( (unsigned char*)title ) ;
 #endif
 }
 
@@ -587,18 +587,18 @@ void UMAActivateControl( ControlHandle inControl )
 {
     // we have to add the control after again to the update rgn
     // otherwise updates get lost
-  if ( !IsControlActive( inControl ) )
-  {
+    if ( !IsControlActive( inControl ) )
+    {
         bool visible = IsControlVisible( inControl ) ;
         if ( visible )
-          SetControlVisibility( inControl , false , false ) ;
+            SetControlVisibility( inControl , false , false ) ;
         ::ActivateControl( inControl ) ;
         if ( visible ) {
-          SetControlVisibility( inControl , true , false ) ;
-          Rect ctrlBounds ;
-          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+            SetControlVisibility( inControl , true , false ) ;
+            Rect ctrlBounds ;
+            InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
-  }
+    }
 }
 
 void UMADrawControl( ControlHandle inControl ) 
@@ -606,153 +606,151 @@ void UMADrawControl( ControlHandle inControl )
     WindowRef theWindow = GetControlOwner(inControl) ;
     RgnHandle updateRgn = NewRgn() ;
     GetWindowUpdateRgn( theWindow , updateRgn ) ;
-         Point zero = { 0 , 0 } ;
-         LocalToGlobal( &zero ) ;
-         OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
+    Point zero = { 0 , 0 } ;
+    LocalToGlobal( &zero ) ;
+    OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
     ::DrawControlInCurrentPort( inControl ) ;
     InvalWindowRgn( theWindow, updateRgn) ;
-         DisposeRgn( updateRgn ) ;
+    DisposeRgn( updateRgn ) ;
 }
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) 
 {
-  bool visible = IsControlVisible( inControl ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , false , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  }
-  ::MoveControl( inControl , x , y ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , true , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  }
+    bool visible = IsControlVisible( inControl ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , false , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
+    ::MoveControl( inControl , x , y ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , true , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
 }
 
 void UMASizeControl( ControlHandle inControl , short x , short y ) 
 {
-  bool visible = IsControlVisible( inControl ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , false , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  } 
-  ::SizeControl( inControl , x , y ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , true , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  }
+    bool visible = IsControlVisible( inControl ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , false , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    
+    ::SizeControl( inControl , x , y ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , true , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
 }
 
 void UMADeactivateControl( ControlHandle inControl ) 
 {
     // we have to add the control after again to the update rgn
     // otherwise updates get lost
-     bool visible = IsControlVisible( inControl ) ;
-     if ( visible )
-       SetControlVisibility( inControl , false , false ) ;
-     ::DeactivateControl( inControl ) ;
-     if ( visible ) {
-       SetControlVisibility( inControl , true , false ) ;
-       Rect ctrlBounds ;
-       InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-     }
-}
-// shows the control and adds the region to the update region
-void UMAShowControl                                            (ControlHandle                  inControl)
-{
+    bool visible = IsControlVisible( inControl ) ;
+    if ( visible )
+        SetControlVisibility( inControl , false , false ) ;
+    ::DeactivateControl( inControl ) ;
+    if ( visible ) {
         SetControlVisibility( inControl , true , false ) ;
         Rect ctrlBounds ;
         InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
+}
+// shows the control and adds the region to the update region
+void UMAShowControl                        (ControlHandle             inControl)
+{
+    SetControlVisibility( inControl , true , false ) ;
+    Rect ctrlBounds ;
+    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
 }
 
 // shows the control and adds the region to the update region
-void UMAHideControl                                            (ControlHandle                  inControl)
+void UMAHideControl                        (ControlHandle             inControl)
 {
-        SetControlVisibility( inControl , false , false ) ;
-        Rect ctrlBounds ;
-        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    SetControlVisibility( inControl , false , false ) ;
+    Rect ctrlBounds ;
+    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
 }
 // keyboard focus
-OSErr UMASetKeyboardFocus                              (WindowPtr                              inWindow,
-                                                                ControlHandle                  inControl,
-                                                                ControlFocusPart               inPart)
+OSErr UMASetKeyboardFocus                (WindowPtr                 inWindow,
+                                 ControlHandle             inControl,
+                                 ControlFocusPart         inPart)
 {
-       OSErr err = noErr;
-       GrafPtr port ;
-       GetPort( &port ) ;
+    OSErr err = noErr;
+    GrafPtr port ;
+    GetPort( &port ) ;
 
-       SetPortWindowPort( inWindow ) ;
+    SetPortWindowPort( inWindow ) ;
 
-  err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
-       SetPort( port ) ;
-       return err ;
+    err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
+    SetPort( port ) ;
+    return err ;
 }
 
 
-
-
 // events
 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) 
 {
-  RgnHandle updateRgn = NewRgn() ;
-  GetWindowUpdateRgn( inWindow , updateRgn ) ;
-
-       Point zero = { 0 , 0 } ;
-       LocalToGlobal( &zero ) ;
-       OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-
-  UpdateControls( inWindow , inRgn ) ;
-  InvalWindowRgn( inWindow, updateRgn) ;
-       DisposeRgn( updateRgn ) ;
-
+    RgnHandle updateRgn = NewRgn() ;
+    GetWindowUpdateRgn( inWindow , updateRgn ) ;
+    
+    Point zero = { 0 , 0 } ;
+    LocalToGlobal( &zero ) ;
+    OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
+    
+    UpdateControls( inWindow , inRgn ) ;
+    InvalWindowRgn( inWindow, updateRgn) ;
+    DisposeRgn( updateRgn ) ;
 }
 
 bool UMAIsWindowFloating( WindowRef inWindow ) 
 {
-       WindowClass cl ;
-       
-       GetWindowClass( inWindow , &cl ) ;
-       return cl == kFloatingWindowClass ;
+    WindowClass cl ;
+    
+    GetWindowClass( inWindow , &cl ) ;
+    return cl == kFloatingWindowClass ;
 }
 
 bool UMAIsWindowModal( WindowRef inWindow ) 
 {
-       WindowClass cl ;
-       
-       GetWindowClass( inWindow , &cl ) ;
-       return cl < kFloatingWindowClass ;
+    WindowClass cl ;
+    
+    GetWindowClass( inWindow , &cl ) ;
+    return cl < kFloatingWindowClass ;
 }
 
 // others
 
 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 {
-       if ( inWindowRef )
-       {
-//             bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
-//             if ( inActivate != isHightlited )
-               GrafPtr port ;
-               GetPort( &port ) ;
-               SetPortWindowPort( inWindowRef ) ;
-               HiliteWindow( inWindowRef , inActivate ) ;
-               ControlHandle control = NULL ;
-               ::GetRootControl( inWindowRef , & control ) ;
-               if ( control )
-               {
-                       if ( inActivate )
-                               UMAActivateControl( control ) ;
-                       else
-                               UMADeactivateControl( control ) ;
-               }       
-               SetPort( port ) ;
-       }
+    if ( inWindowRef )
+    {
+//        bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
+//        if ( inActivate != isHightlited )
+        GrafPtr port ;
+        GetPort( &port ) ;
+        SetPortWindowPort( inWindowRef ) ;
+        HiliteWindow( inWindowRef , inActivate ) ;
+        ControlHandle control = NULL ;
+        ::GetRootControl( inWindowRef , & control ) ;
+        if ( control )
+        {
+            if ( inActivate )
+                UMAActivateControl( control ) ;
+            else
+                UMADeactivateControl( control ) ;
+        }    
+        SetPort( port ) ;
+    }
 }
+
 OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) 
 {
-  return ::DrawThemePlacard( inRect , inState ) ;
+    return ::DrawThemePlacard( inRect , inState ) ;
 }
 
 #if !TARGET_CARBON
@@ -765,77 +763,77 @@ OSStatus UMAGetHelpMenu(
   MenuItemIndex *  outFirstCustomItemIndex)
 {
 #if TARGET_CARBON
-  return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
+    return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
 #else
-  MenuRef helpMenuHandle ;
-  helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
-  if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr )
-  {
-    firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
-  }
-  if ( outFirstCustomItemIndex )
-  {
-    *outFirstCustomItemIndex = firstCustomItemIndex ;
-  }
-  *outHelpMenu = helpMenuHandle ;
-  return helpMenuStatus ;
+    MenuRef helpMenuHandle ;
+    helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
+    if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr )
+    {
+        firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
+    }
+    if ( outFirstCustomItemIndex )
+    {
+        *outFirstCustomItemIndex = firstCustomItemIndex ;
+    }
+    *outHelpMenu = helpMenuHandle ;
+    return helpMenuStatus ;
 #endif
 }
 
 wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport) 
 {
-  m_clip = NULL ;
-  Setup( newport ) ;
+    m_clip = NULL ;
+    Setup( newport ) ;
 }
 
 wxMacPortStateHelper::wxMacPortStateHelper()
 {
-       m_clip = NULL ;
+    m_clip = NULL ;
 }
 
 void wxMacPortStateHelper::Setup( GrafPtr newport )
 {
-       GetPort( &m_oldPort ) ;
-       SetPort( newport ) ;
-       wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
-       m_clip = NewRgn() ;
-       GetClip( m_clip );
-       m_textFont = GetPortTextFont( (CGrafPtr) newport);
-       m_textSize = GetPortTextSize( (CGrafPtr) newport);
-       m_textStyle = GetPortTextFace( (CGrafPtr) newport);
-       m_textMode = GetPortTextMode( (CGrafPtr) newport);      
-       GetThemeDrawingState( &m_drawingState ) ;
-       m_currentPort = newport ;
+    GetPort( &m_oldPort ) ;
+    SetPort( newport ) ;
+    wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
+    m_clip = NewRgn() ;
+    GetClip( m_clip );
+    m_textFont = GetPortTextFont( (CGrafPtr) newport);
+    m_textSize = GetPortTextSize( (CGrafPtr) newport);
+    m_textStyle = GetPortTextFace( (CGrafPtr) newport);
+    m_textMode = GetPortTextMode( (CGrafPtr) newport);    
+    GetThemeDrawingState( &m_drawingState ) ;
+    m_currentPort = newport ;
 }
 void wxMacPortStateHelper::Clear()
 {
-       if ( m_clip )
-       {
-               DisposeRgn( m_clip ) ;
-               DisposeThemeDrawingState( m_drawingState ) ;
-               m_clip = NULL ;
-       }
+    if ( m_clip )
+    {
+        DisposeRgn( m_clip ) ;
+        DisposeThemeDrawingState( m_drawingState ) ;
+        m_clip = NULL ;
+    }
 }
 
 wxMacPortStateHelper::~wxMacPortStateHelper()
 {
-       if ( m_clip )
-       {
-               SetPort( m_currentPort ) ;
-               SetClip( m_clip ) ;
-               DisposeRgn( m_clip ) ;
-               TextFont( m_textFont );
-               TextSize( m_textSize );
-               TextFace( m_textStyle );
-               TextMode( m_textMode );
-               SetThemeDrawingState( m_drawingState , true ) ;
-               SetPort( m_oldPort ) ;
-       }
+    if ( m_clip )
+    {
+        SetPort( m_currentPort ) ;
+        SetClip( m_clip ) ;
+        DisposeRgn( m_clip ) ;
+        TextFont( m_textFont );
+        TextSize( m_textSize );
+        TextFace( m_textStyle );
+        TextMode( m_textMode );
+        SetThemeDrawingState( m_drawingState , true ) ;
+        SetPort( m_oldPort ) ;
+    }
 }
 
 OSStatus UMAPutScrap( Size size , OSType type , void *data )
 {
-       OSStatus err = noErr ;
+    OSStatus err = noErr ;
 #if !TARGET_CARBON
     err = PutScrap( size , type , data ) ;
 #else
@@ -846,6 +844,6 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
         err = PutScrapFlavor (scrap, type , 0, size, data);
     }
 #endif
-       return err ;
+    return err ;
 }
 
index f308faf2dff089ccda78e8c72f1311799819e8c5..a3f95679a95680d9a2db9eef54dfb66aeffafaaf 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -50,27 +50,27 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
 // Get hostname only (without domain name)
 bool wxGetHostName(char *buf, int maxSize)
 {
-       // Gets Chooser name of user by examining a System resource.
-
-       const short kComputerNameID = -16413;
-       
-       short oldResFile = CurResFile() ;
-       UseResFile(0);
-       StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
-       UseResFile(oldResFile);
-
-       if (chooserName && *chooserName)
-       {
-         int length = (*chooserName)[0] ;
-         if ( length + 1 > maxSize )
-         {
-           length = maxSize - 1 ;
-         }
-         strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-         buf[length] = 0 ;
-       }
-       else
-               buf[0] = 0 ;
+    // Gets Chooser name of user by examining a System resource.
+
+    const short kComputerNameID = -16413;
+    
+    short oldResFile = CurResFile() ;
+    UseResFile(0);
+    StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
+    UseResFile(oldResFile);
+
+    if (chooserName && *chooserName)
+    {
+      int length = (*chooserName)[0] ;
+      if ( length + 1 > maxSize )
+      {
+        length = maxSize - 1 ;
+      }
+      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
+      buf[length] = 0 ;
+    }
+    else
+        buf[0] = 0 ;
 
   return TRUE;
 }
@@ -83,34 +83,34 @@ bool wxGetUserId(char *buf, int maxSize)
 
 const wxChar* wxGetHomeDir(wxString *pstr)
 {
-       *pstr = wxMacFindFolder(  (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
-       return pstr->c_str() ;
+    *pstr = wxMacFindFolder(  (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
+    return pstr->c_str() ;
 }
 
 // Get user name e.g. Stefan Csomor
 bool wxGetUserName(char *buf, int maxSize)
 {
-       // Gets Chooser name of user by examining a System resource.
-
-       const short kChooserNameID = -16096;
-       
-       short oldResFile = CurResFile() ;
-       UseResFile(0);
-       StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
-       UseResFile(oldResFile);
-
-       if (chooserName && *chooserName)
-       {
-         int length = (*chooserName)[0] ;
-         if ( length + 1 > maxSize )
-         {
-           length = maxSize - 1 ;
-         }
-         strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-         buf[length] = 0 ;
-       }
-       else
-               buf[0] = 0 ;
+    // Gets Chooser name of user by examining a System resource.
+
+    const short kChooserNameID = -16096;
+    
+    short oldResFile = CurResFile() ;
+    UseResFile(0);
+    StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
+    UseResFile(oldResFile);
+
+    if (chooserName && *chooserName)
+    {
+      int length = (*chooserName)[0] ;
+      if ( length + 1 > maxSize )
+      {
+        length = maxSize - 1 ;
+      }
+      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
+      buf[length] = 0 ;
+    }
+    else
+        buf[0] = 0 ;
 
   return TRUE;
 }
@@ -123,15 +123,15 @@ int wxKill(long pid, wxSignal sig , wxKillError *rc )
 
 WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
 {
-  // TODO : under classic there is no environement support, under X yes
-  return false ;
+    // TODO : under classic there is no environement support, under X yes
+    return false ;
 }
 
 // set the env var name to the given value, return TRUE on success
 WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
 {
-  // TODO : under classic there is no environement support, under X yes
-  return false ;
+    // TODO : under classic there is no environement support, under X yes
+    return false ;
 }
 
 //
@@ -161,7 +161,7 @@ void wxUsleep(unsigned long milliseconds)
     clock_t start = clock() ;
     do 
     {
-       YieldToAnyThread() ;
+        YieldToAnyThread() ;
     } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
 }
 
@@ -180,34 +180,34 @@ void wxFlushEvents()
 // Output a debug message, in a system dependent fashion.
 void wxDebugMsg(const char *fmt ...)
 {
-  va_list ap;
-  static char buffer[512];
-
-  if (!wxTheApp->GetWantDebugOutput())
-    return ;
-
-  va_start(ap, fmt);
-
-  vsprintf(buffer,fmt,ap) ;
-  strcat(buffer,";g") ;
-  c2pstr(buffer) ;
-  DebugStr((unsigned char*) buffer) ;
-
-  va_end(ap);
+    va_list ap;
+    static char buffer[512];
+    
+    if (!wxTheApp->GetWantDebugOutput())
+        return ;
+    
+    va_start(ap, fmt);
+    
+    vsprintf(buffer,fmt,ap) ;
+    strcat(buffer,";g") ;
+    c2pstr(buffer) ;
+    DebugStr((unsigned char*) buffer) ;
+    
+    va_end(ap);
 }
 
 // Non-fatal error: pop up message box and (possibly) continue
 void wxError(const wxString& msg, const wxString& title)
 {
-       if (wxMessageBox(wxString::Format(wxT("%s\nContinue?"),msg), title, wxYES_NO) == wxID_NO )
-               wxExit();
+      if (wxMessageBox(wxString::Format(wxT("%s\nContinue?"),msg), title, wxYES_NO) == wxID_NO )
+        wxExit();
 }
 
 // Fatal error: pop up message box and abort
 void wxFatalError(const wxString& msg, const wxString& title)
 {
-  wxMessageBox(wxString::Format(wxT("%s: %s"),title,msg));
-  wxExit();
+    wxMessageBox(wxString::Format(wxT("%s: %s"),title,msg));
+    wxExit();
 }
 
 #endif // WXWIN_COMPATIBILITY_2_2
@@ -225,13 +225,13 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
     long theSystem ;
     
     // are there x-platform conventions ?
-
+    
     Gestalt(gestaltSystemVersion, &theSystem) ;
     if (minorVsn != NULL) {
-       *minorVsn = (theSystem & 0xFF ) ;
+        *minorVsn = (theSystem & 0xFF ) ;
     }
     if (majorVsn != NULL) {
-       *majorVsn = (theSystem >> 8 ) ;
+        *majorVsn = (theSystem >> 8 ) ;
     }
 #ifdef __DARWIN__
     return wxMAC_DARWIN;
@@ -250,23 +250,23 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
 
 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
 {
-  char buf[50];
-  sprintf(buf, "%.4f", value);
-  return wxWriteResource(section, entry, buf, file);
+    char buf[50];
+    sprintf(buf, "%.4f", value);
+    return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
 {
-  char buf[50];
-  sprintf(buf, "%ld", value);
-  return wxWriteResource(section, entry, buf, file);
+    char buf[50];
+    sprintf(buf, "%ld", value);
+    return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
 {
-  char buf[50];
-  sprintf(buf, "%d", value);
-  return wxWriteResource(section, entry, buf, file);
+    char buf[50];
+    sprintf(buf, "%d", value);
+    return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
@@ -277,81 +277,81 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
 
 bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
 {
-  char *s = NULL;
-  bool succ = wxGetResource(section, entry, (char **)&s, file);
-  if (succ)
-  {
-    *value = (float)strtod(s, NULL);
-    delete[] s;
-    return TRUE;
-  }
-  else return FALSE;
+    char *s = NULL;
+    bool succ = wxGetResource(section, entry, (char **)&s, file);
+    if (succ)
+    {
+        *value = (float)strtod(s, NULL);
+        delete[] s;
+        return TRUE;
+    }
+    else return FALSE;
 }
 
 bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
 {
-  char *s = NULL;
-  bool succ = wxGetResource(section, entry, (char **)&s, file);
-  if (succ)
-  {
-    *value = strtol(s, NULL, 10);
-    delete[] s;
-    return TRUE;
-  }
-  else return FALSE;
+    char *s = NULL;
+    bool succ = wxGetResource(section, entry, (char **)&s, file);
+    if (succ)
+    {
+        *value = strtol(s, NULL, 10);
+        delete[] s;
+        return TRUE;
+    }
+    else return FALSE;
 }
 
 bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
 {
-  char *s = NULL;
-  bool succ = wxGetResource(section, entry, (char **)&s, file);
-  if (succ)
-  {
-    *value = (int)strtol(s, NULL, 10);
-    delete[] s;
-    return TRUE;
-  }
-  else return FALSE;
+    char *s = NULL;
+    bool succ = wxGetResource(section, entry, (char **)&s, file);
+    if (succ)
+    {
+        *value = (int)strtol(s, NULL, 10);
+        delete[] s;
+        return TRUE;
+    }
+    else return FALSE;
 }
 #endif // wxUSE_RESOURCES
 
 int gs_wxBusyCursorCount = 0;
-extern wxCursor        gMacCurrentCursor ;
-wxCursor               gMacStoredActiveCursor ;
+extern wxCursor    gMacCurrentCursor ;
+wxCursor        gMacStoredActiveCursor ;
 
 // Set the cursor to the busy cursor for all windows
 void wxBeginBusyCursor(wxCursor *cursor)
 {
-  if (gs_wxBusyCursorCount++ == 0)
-  {
-       gMacStoredActiveCursor = gMacCurrentCursor ;
-       cursor->MacInstall() ;
-  }
-  //else: nothing to do, already set
+    if (gs_wxBusyCursorCount++ == 0)
+    {
+        gMacStoredActiveCursor = gMacCurrentCursor ;
+        cursor->MacInstall() ;
+    }
+    //else: nothing to do, already set
 }
 
 // Restore cursor to normal
 void wxEndBusyCursor()
 {
     wxCHECK_RET( gs_wxBusyCursorCount > 0,
-                 wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
-
-  if (--gs_wxBusyCursorCount == 0)
-  {
-       gMacStoredActiveCursor.MacInstall() ;
-       gMacStoredActiveCursor = wxNullCursor ;
-  }
+        wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
+    
+    if (--gs_wxBusyCursorCount == 0)
+    {
+        gMacStoredActiveCursor.MacInstall() ;
+        gMacStoredActiveCursor = wxNullCursor ;
+    }
 }
 
 // TRUE if we're between the above two calls
 bool wxIsBusy()
 {
-  return (gs_wxBusyCursorCount > 0);
+    return (gs_wxBusyCursorCount > 0);
 }
 
 wxString wxMacFindFolder( short        vol,
-                         OSType       folderType,
-                         Boolean      createFolder)
+              OSType       folderType,
+              Boolean      createFolder)
 {
     short    vRefNum  ;
     long     dirID ;
@@ -437,24 +437,24 @@ bool wxColourDisplay()
 // Returns depth of screen
 int wxDisplayDepth()
 {
-       Rect globRect ;
-       SetRect(&globRect, -32760, -32760, 32760, 32760);
-       GDHandle        theMaxDevice;
+    Rect globRect ;
+    SetRect(&globRect, -32760, -32760, 32760, 32760);
+    GDHandle    theMaxDevice;
 
-       int theDepth = 8;
-       theMaxDevice = GetMaxDevice(&globRect);
-       if (theMaxDevice != nil)
-               theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
+    int theDepth = 8;
+    theMaxDevice = GetMaxDevice(&globRect);
+    if (theMaxDevice != nil)
+        theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
 
-       return theDepth ;
+    return theDepth ;
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
-       BitMap screenBits;
-       GetQDGlobalsScreenBits( &screenBits );
-
+    BitMap screenBits;
+    GetQDGlobalsScreenBits( &screenBits );
+    
     *width = screenBits.bounds.right - screenBits.bounds.left  ;
     *height = screenBits.bounds.bottom - screenBits.bounds.top ;
 }
@@ -595,29 +595,29 @@ void wxMacConvertToPC( const char *from , char *to , int len )
 
 wxString wxMacMakeMacStringFromPC( const char * p )
 {
-       wxString result ;
+    wxString result ;
     int len = strlen ( p ) ;
-       if ( len > 0 )
-       {
-               wxChar* ptr = result.GetWriteBuf(len) ;
-           wxMacConvertFromPC( p , ptr , len ) ;
-               ptr[len] = 0 ;
-           result.UngetWriteBuf( len ) ;
-       }
+    if ( len > 0 )
+    {
+        wxChar* ptr = result.GetWriteBuf(len) ;
+        wxMacConvertFromPC( p , ptr , len ) ;
+        ptr[len] = 0 ;
+        result.UngetWriteBuf( len ) ;
+    }
     return result ;
 }
 
 wxString wxMacMakePCStringFromMac( const char * p )
 {
-       wxString result ;
+    wxString result ;
     int len = strlen ( p ) ;
-       if ( len > 0 )
-       {
-               wxChar* ptr = result.GetWriteBuf(len) ;
-           wxMacConvertToPC( p , ptr , len ) ;
-               ptr[len] = 0 ;
-           result.UngetWriteBuf( len ) ;
-       }
+    if ( len > 0 )
+    {
+        wxChar* ptr = result.GetWriteBuf(len) ;
+        wxMacConvertToPC( p , ptr , len ) ;
+        ptr[len] = 0 ;
+        result.UngetWriteBuf( len ) ;
+    }
     return result ;
 }
 
@@ -639,9 +639,9 @@ wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding )
 
 wxString wxMacMakeStringFromPascal( ConstStringPtr from , bool mac2pcEncoding )
 {
-       // this is safe since a pascal string can never be larger than 256 bytes
-       char s[256] ;
-       CopyPascalStringToC( from , s ) ;
+      // this is safe since a pascal string can never be larger than 256 bytes
+      char s[256] ;
+      CopyPascalStringToC( from , s ) ;
     if (mac2pcEncoding)
     {
       return wxMacMakePCStringFromMac( s ) ;
@@ -672,9 +672,9 @@ void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding
 // converts this string into a carbon foundation string with optional pc 2 mac encoding
 CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) 
 {
-       return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
-               pc2macEncoding ? 
-               kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
+    return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
+        pc2macEncoding ? 
+        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
 }
 
 #endif //TARGET_CARBON
index a9e84f42ed88d094d6355530c962525dcbab3924..229ad654f783b4b81e323dd908140f965f5bf120 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index c325db04c638d8bcfb55b5efaebd87b164e9e7ac..0c5aac8bfcc5fee2bbc1a495ac24e6804cfc1305 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -51,128 +51,128 @@ wxWave::wxWave(int size, const wxByte* data)
 
 bool wxWave::Create(const wxString& fileName, bool isResource)
 {
-       bool ret = false;
-       m_sndname = fileName;
-       m_isResource = isResource;
-
-       if (m_isResource)
-               ret = true;
-       else
-       { /*
-               if (sndChan)
-               {                                                                                                                                       // we're playing
-                       FSClose(SndRefNum);
-                       SndRefNum = 0;
-                       SndDisposeChannel(sndChan, TRUE);
-                       free(sndChan);
-                       sndChan = 0;
-                       KillTimer(0,timerID);
-               }
-
-               if (!lpSnd)
-                       return true;
-
-               if (_access(lpSnd,0))                                                   // no file, no service
-                       return false;
-
-               // Allocate SndChannel
-               sndChan = (SndChannelPtr) malloc (sizeof(SndChannel));
-
-               if (!sndChan)
-                       return false;
-
-               sndChan->qLength = 128;
-
-               if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
-               {
-                       free(sndChan);
-                       sndChan = 0;
-                       return false;
-               }
-
-               if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
-               {
-                       SndDisposeChannel(sndChan, TRUE);
-                       free(sndChan);
-                       sndChan = 0;
-
-                       return false;
-               }
-
-               bool async = false;
-
-               if (fdwSound & SND_ASYNC)
-                       async = true;
-
-               if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
-               {
-                       FSClose (SndRefNum);
-                       SndRefNum = 0;
-                       SndDisposeChannel (sndChan, TRUE);
-                       free (sndChan);
-                       sndChan = 0;
-                       return false;
-               }
-
-               if (async)
-               {  // haven't finish yet
-                       timerID = SetTimer(0, 0, 250, TimerCallBack);
-               }
-               else
-               {
-                       FSClose (SndRefNum);
-                       SndRefNum = 0;
-                       SndDisposeChannel (sndChan, TRUE);
-                       free (sndChan);
-                       sndChan = 0;
-               }*/
-       }
-
-       return ret;
+    bool ret = false;
+    m_sndname = fileName;
+    m_isResource = isResource;
+
+    if (m_isResource)
+        ret = true;
+    else
+    { /*
+        if (sndChan)
+        {                                                                    // we're playing
+            FSClose(SndRefNum);
+            SndRefNum = 0;
+            SndDisposeChannel(sndChan, TRUE);
+            free(sndChan);
+            sndChan = 0;
+            KillTimer(0,timerID);
+        }
+
+        if (!lpSnd)
+            return true;
+
+        if (_access(lpSnd,0))                            // no file, no service
+            return false;
+
+        // Allocate SndChannel
+        sndChan = (SndChannelPtr) malloc (sizeof(SndChannel));
+
+        if (!sndChan)
+            return false;
+
+        sndChan->qLength = 128;
+
+        if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
+        {
+            free(sndChan);
+            sndChan = 0;
+            return false;
+        }
+
+        if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
+        {
+            SndDisposeChannel(sndChan, TRUE);
+            free(sndChan);
+            sndChan = 0;
+
+            return false;
+        }
+
+        bool async = false;
+
+        if (fdwSound & SND_ASYNC)
+            async = true;
+
+        if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
+        {
+            FSClose (SndRefNum);
+            SndRefNum = 0;
+            SndDisposeChannel (sndChan, TRUE);
+            free (sndChan);
+            sndChan = 0;
+            return false;
+        }
+
+        if (async)
+        {  // haven't finish yet
+            timerID = SetTimer(0, 0, 250, TimerCallBack);
+        }
+        else
+        {
+            FSClose (SndRefNum);
+            SndRefNum = 0;
+            SndDisposeChannel (sndChan, TRUE);
+            free (sndChan);
+            sndChan = 0;
+        }*/
+    }
+
+    return ret;
 }
 
 
 //don't know what to do with looped, wth
 bool wxWave::Play(bool async, bool looped) const
 {
-       char lpSnd[32];
-       bool ret = false;
+    char lpSnd[32];
+    bool ret = false;
 
-       if (m_isResource)
-       {
+    if (m_isResource)
+    {
 #if TARGET_CARBON
-         c2pstrcpy((unsigned char *)lpSnd, m_sndname);
+      c2pstrcpy((unsigned char *)lpSnd, m_sndname);
 #else
-         strcpy(lpSnd, m_sndname);
-         c2pstr((char *) lpSnd);
+      strcpy(lpSnd, m_sndname);
+      c2pstr((char *) lpSnd);
 #endif
-         SndListHandle hSnd;
+      SndListHandle hSnd;
 
-         hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
+      hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
 
-         if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
-           ret = true;
-       }
+      if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
+        ret = true;
+    }
 
-       return ret;
+    return ret;
 }
 
 
 bool wxWave::FreeData()
 {
-       bool ret = false;
-
-       if (m_isResource)
-       {
-               m_sndname.Empty();
-               ret = true;
-       }
-       else
-       {
-               //TODO,
-       }
-
-       return ret;
+    bool ret = false;
+
+    if (m_isResource)
+    {
+        m_sndname.Empty();
+        ret = true;
+    }
+    else
+    {
+        //TODO,
+    }
+
+    return ret;
 }
 
 
@@ -182,66 +182,66 @@ bool wxWave::FreeData()
 
 /*static short MacOpenSndFile (char * path)
 {
-       VolumeParam vp;
-       FSSpec fspec;
-       Str255 name;
-       char *c;
-
-       // first, get the volume reference number for the file.  Start by
-       // making a Pstring with just the volume name
-       strcpy ((char *) name, path);
-       if (c = strchr ((char *) name, ':'))
-       {
-               c++;
-               *c = '\0';
-       }
-
-       c2pstr ((char *) name);
-       vp.ioCompletion = 0;
-       vp.ioVolIndex   = -1;
-       vp.ioNamePtr    = name;
-       vp.ioVRefNum    = 0;
-
-       if (PBGetVInfo((ParamBlockRec *)&vp, 0) != noErr)
-               return 0;
-
-       // next, buld an FSSpec for the file
-       strcpy ((char *) name, path);
-       c2pstr ((char *) name);
-       if (FSMakeFSSpec (vp.ioVRefNum, 0, name, &fspec) != noErr)
-               return 0;
-
-       short frefnum;
-       // now open the file, and return it's reference number
-       if (FSpOpenDF(&fspec, fsRdPerm, &frefnum) != noErr)
-               return 0;
-
-       return frefnum;
+    VolumeParam vp;
+    FSSpec fspec;
+    Str255 name;
+    char *c;
+
+    // first, get the volume reference number for the file.  Start by
+    // making a Pstring with just the volume name
+    strcpy ((char *) name, path);
+    if (c = strchr ((char *) name, ':'))
+    {
+        c++;
+        *c = '\0';
+    }
+
+    c2pstr ((char *) name);
+    vp.ioCompletion = 0;
+    vp.ioVolIndex    = -1;
+    vp.ioNamePtr    = name;
+    vp.ioVRefNum    = 0;
+
+    if (PBGetVInfo((ParamBlockRec *)&vp, 0) != noErr)
+        return 0;
+
+    // next, buld an FSSpec for the file
+    strcpy ((char *) name, path);
+    c2pstr ((char *) name);
+    if (FSMakeFSSpec (vp.ioVRefNum, 0, name, &fspec) != noErr)
+        return 0;
+
+    short frefnum;
+    // now open the file, and return it's reference number
+    if (FSpOpenDF(&fspec, fsRdPerm, &frefnum) != noErr)
+        return 0;
+
+    return frefnum;
 }
 
 
 void TimerCallBack(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
 {
-       if(!sndChan)
-       {
-               KillTimer(0,timerID);
-               return;
-       }
-
-       SCStatus        scstat;
-
-       if (noErr == SndChannelStatus (sndChan, sizeof (SCStatus), &scstat)) {
-               if (scstat.scChannelPaused || scstat.scChannelBusy)
-                       return;                                                 // not done yet
-       }
-
-       // either error or done.
-       FSClose (SndRefNum);
-       SndRefNum = 0;
-       SndDisposeChannel (sndChan, TRUE);
-       free (sndChan);
-       sndChan = 0;
-       KillTimer(0,timerID);
+    if(!sndChan)
+    {
+        KillTimer(0,timerID);
+        return;
+    }
+
+    SCStatus    scstat;
+
+    if (noErr == SndChannelStatus (sndChan, sizeof (SCStatus), &scstat)) {
+        if (scstat.scChannelPaused || scstat.scChannelBusy)
+            return;                            // not done yet
+    }
+
+    // either error or done.
+    FSClose (SndRefNum);
+    SndRefNum = 0;
+    SndDisposeChannel (sndChan, TRUE);
+    free (sndChan);
+    sndChan = 0;
+    KillTimer(0,timerID);
 }*/
 
 
index 9eded8e45a35c56da596c00fae7a5c1aa312612c..4592280816f4752d240f4a567832e3d33fc6ba2b 100644 (file)
@@ -175,8 +175,8 @@ wxWindowMac::~wxWindowMac()
     wxFrame* frame = wxDynamicCast( wxGetTopLevelParent( this ) , wxFrame ) ;
     if ( frame )
     {
-       if ( frame->GetLastFocus() == this )
-               frame->SetLastFocus( NULL ) ;
+        if ( frame->GetLastFocus() == this )
+            frame->SetLastFocus( NULL ) ;
     }
 
     if ( gFocusWindow == this )
@@ -323,15 +323,15 @@ void wxWindowMac::DoReleaseMouse()
 
 void wxWindowMac::SetDropTarget(wxDropTarget *pDropTarget)
 {
-  if ( m_dropTarget != 0 ) {
-    delete m_dropTarget;
-  }
-
-  m_dropTarget = pDropTarget;
-  if ( m_dropTarget != 0 )
-  {
-    // TODO
-  }
+    if ( m_dropTarget != 0 ) {
+        delete m_dropTarget;
+    }
+    
+    m_dropTarget = pDropTarget;
+    if ( m_dropTarget != 0 )
+    {
+        // TODO
+    }
 }
 
 #endif
@@ -409,12 +409,12 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
 
     if(x)   *x = localwhere.h ;
     if(y)   *y = localwhere.v ;
-
+    
     MacRootWindowToWindow( x , y ) ;
     if ( x )
-            *x -= MacGetLeftBorderSize() ;
+        *x -= MacGetLeftBorderSize() ;
     if ( y )
-            *y -= MacGetTopBorderSize() ;
+        *y -= MacGetTopBorderSize() ;
 }
 
 void wxWindowMac::DoClientToScreen(int *x, int *y) const
@@ -422,9 +422,9 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
     WindowRef window = (WindowRef) MacGetRootWindow() ;
 
     if ( x )
-            *x += MacGetLeftBorderSize() ;
+        *x += MacGetLeftBorderSize() ;
     if ( y )
-            *y += MacGetTopBorderSize() ;
+        *y += MacGetTopBorderSize() ;
 
     MacWindowToRootWindow( x , y ) ;
 
@@ -482,37 +482,37 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const
 bool wxWindowMac::SetCursor(const wxCursor& cursor)
 {
     if (m_cursor == cursor)
-       return FALSE;
-
+        return FALSE;
+    
     if (wxNullCursor == cursor)
     {
-       if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
-        return FALSE ;
+        if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
+            return FALSE ;
     }
     else
     {
-       if ( ! wxWindowBase::SetCursor( cursor ) )
-        return FALSE ;
-    }
-
-  wxASSERT_MSG( m_cursor.Ok(),
-                  wxT("cursor must be valid after call to the base version"));
-
-  Point pt ;
-  wxWindowMac *mouseWin ;
-  GetMouse( &pt ) ;
-
-  // Change the cursor NOW if we're within the correct window
-
-  if ( MacGetWindowFromPoint( wxPoint( pt.h , pt.v ) , &mouseWin ) )
-  {
-    if ( mouseWin == this && !wxIsBusy() )
-    {
-        m_cursor.MacInstall() ;
+        if ( ! wxWindowBase::SetCursor( cursor ) )
+            return FALSE ;
+    }
+    
+    wxASSERT_MSG( m_cursor.Ok(),
+        wxT("cursor must be valid after call to the base version"));
+    
+    Point pt ;
+    wxWindowMac *mouseWin ;
+    GetMouse( &pt ) ;
+    
+    // Change the cursor NOW if we're within the correct window
+    
+    if ( MacGetWindowFromPoint( wxPoint( pt.h , pt.v ) , &mouseWin ) )
+    {
+        if ( mouseWin == this && !wxIsBusy() )
+        {
+            m_cursor.MacInstall() ;
+        }
     }
-  }
-
-  return TRUE ;
+    
+    return TRUE ;
 }
 
 
@@ -522,54 +522,54 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
     int ww, hh;
     ww = m_width ;
     hh = m_height ;
-
+    
     ww -= MacGetLeftBorderSize(  )  + MacGetRightBorderSize(  ) ;
     hh -= MacGetTopBorderSize(  ) + MacGetBottomBorderSize( );
-
-  if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar  && m_hScrollBar->IsShown()) )
-  {
-    int x1 = 0 ;
-    int y1 = 0 ;
-    int w = m_width ;
-    int h = m_height ;
-
-    MacClientToRootWindow( &x1 , &y1 ) ;
-    MacClientToRootWindow( &w , &h ) ;
-
-    wxWindowMac *iter = (wxWindowMac*)this ;
-
-    int totW = 10000 , totH = 10000;
-    while( iter )
-    {
-        if ( iter->IsTopLevel() )
+    
+    if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar  && m_hScrollBar->IsShown()) )
+    {
+        int x1 = 0 ;
+        int y1 = 0 ;
+        int w = m_width ;
+        int h = m_height ;
+        
+        MacClientToRootWindow( &x1 , &y1 ) ;
+        MacClientToRootWindow( &w , &h ) ;
+        
+        wxWindowMac *iter = (wxWindowMac*)this ;
+        
+        int totW = 10000 , totH = 10000;
+        while( iter )
         {
-            totW = iter->m_width ;
-            totH = iter->m_height ;
-            break ;
+            if ( iter->IsTopLevel() )
+            {
+                totW = iter->m_width ;
+                totH = iter->m_height ;
+                break ;
+            }
+            
+            iter = iter->GetParent() ;
         }
-
-        iter = iter->GetParent() ;
-    }
-
-    if (m_hScrollBar  && m_hScrollBar->IsShown() )
-    {
-        hh -= MAC_SCROLLBAR_SIZE;
-        if ( h-y1 >= totH )
+        
+        if (m_hScrollBar  && m_hScrollBar->IsShown() )
         {
-            hh += 1 ;
+            hh -= MAC_SCROLLBAR_SIZE;
+            if ( h-y1 >= totH )
+            {
+                hh += 1 ;
+            }
         }
-    }
-    if (m_vScrollBar  && m_vScrollBar->IsShown() )
-    {
-        ww -= MAC_SCROLLBAR_SIZE;
-        if ( w-x1 >= totW )
+        if (m_vScrollBar  && m_vScrollBar->IsShown() )
         {
-            ww += 1 ;
+            ww -= MAC_SCROLLBAR_SIZE;
+            if ( w-x1 >= totW )
+            {
+                ww += 1 ;
+            }
         }
     }
-  }
-  if(x)   *x = ww;
-  if(y)   *y = hh;
+    if(x)   *x = ww;
+    if(y)   *y = hh;
 }
 
 
@@ -582,7 +582,7 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
 void wxWindowMac::DoSetToolTip(wxToolTip *tooltip)
 {
     wxWindowBase::DoSetToolTip(tooltip);
-
+    
     if ( m_tooltip )
         m_tooltip->SetWindow(this);
 }
@@ -595,12 +595,12 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
     int former_y = m_y ;
     int former_w = m_width ;
     int former_h = m_height ;
-
-  int actualWidth = width;
-  int actualHeight = height;
-  int actualX = x;
-  int actualY = y;
-
+    
+    int actualWidth = width;
+    int actualHeight = height;
+    int actualX = x;
+    int actualY = y;
+    
     if ((m_minWidth != -1) && (actualWidth < m_minWidth))
         actualWidth = m_minWidth;
     if ((m_minHeight != -1) && (actualHeight < m_minHeight))
@@ -609,10 +609,10 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         actualWidth = m_maxWidth;
     if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
         actualHeight = m_maxHeight;
-
+    
     bool doMove = false ;
     bool doResize = false ;
-
+    
     if ( actualX != former_x || actualY != former_y )
     {
         doMove = true ;
@@ -621,13 +621,13 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
     {
         doResize = true ;
     }
-
+    
     if ( doMove || doResize )
     {
         // erase former position
-
+        
         bool partialRepaint = false ;
-
+        
         if ( HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
         {
             wxPoint oldPos( m_x , m_y ) ;
@@ -652,25 +652,25 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
                 DisposeRgn(diffRgn) ;
             }
         }
-
+        
         if ( !partialRepaint )
             Refresh() ;
-
+        
         m_x = actualX ;
         m_y = actualY ;
         m_width = actualWidth ;
         m_height = actualHeight ;
-
-               // update any low-level frame-relative positions
-
-               MacUpdateDimensions() ;
+        
+        // update any low-level frame-relative positions
+        
+        MacUpdateDimensions() ;
         // erase new position
-
+        
         if ( !partialRepaint )
             Refresh() ;
         if ( doMove )
             wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
-
+        
         MacRepositionScrollBars() ;
         if ( doMove )
         {
@@ -681,14 +681,14 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         }
         if ( doResize )
         {
-             MacRepositionScrollBars() ;
-             wxSize size(m_width, m_height);
-             wxSizeEvent event(size, m_windowId);
-             event.SetEventObject(this);
-             GetEventHandler()->ProcessEvent(event);
+            MacRepositionScrollBars() ;
+            wxSize size(m_width, m_height);
+            wxSizeEvent event(size, m_windowId);
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
         }
     }
-
+    
 }
 
 // set the size of the window: if the dimensions are positive, just use them,
@@ -704,25 +704,25 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     // get the current size and position...
     int currentX, currentY;
     GetPosition(&currentX, &currentY);
-
+    
     int currentW,currentH;
     GetSize(&currentW, &currentH);
-
+    
     // ... and don't do anything (avoiding flicker) if it's already ok
     if ( x == currentX && y == currentY &&
-         width == currentW && height == currentH )
+        width == currentW && height == currentH )
     {
         MacRepositionScrollBars() ; // we might have a real position shift
         return;
     }
-
+    
     if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
         x = currentX;
     if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
         y = currentY;
-
+    
     AdjustForParentClientOrigin(x, y, sizeFlags);
-
+    
     wxSize size(-1, -1);
     if ( width == -1 )
     {
@@ -737,7 +737,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
             width = currentW;
         }
     }
-
+    
     if ( height == -1 )
     {
         if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
@@ -747,7 +747,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                 size = DoGetBestSize();
             }
             //else: already called DoGetBestSize() above
-
+            
             height = size.y;
         }
         else
@@ -756,9 +756,9 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
             height = currentH;
         }
     }
-
+    
     DoMoveWindow(x, y, width, height);
-
+    
 }
 // For implementation purposes - sometimes decorations make the client area
 // smaller
@@ -980,7 +980,7 @@ wxWindowMac *wxGetActiveWindow()
 // Coordinates relative to the window
 void wxWindowMac::WarpPointer (int x_pos, int y_pos)
 {
-    // We really dont move the mouse programmatically under mac
+    // We really don't move the mouse programmatically under Mac.
 }
 
 const wxBrush& wxWindowMac::MacGetBackgroundBrush()
@@ -994,58 +994,57 @@ const wxBrush& wxWindowMac::MacGetBackgroundBrush()
         // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
         // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
         // either a non gray background color or a non control window
-
-            WindowRef window = (WindowRef) MacGetRootWindow() ;
-
-            wxWindowMac* parent = GetParent() ;
-            while( parent )
+        
+        WindowRef window = (WindowRef) MacGetRootWindow() ;
+        
+        wxWindowMac* parent = GetParent() ;
+        while( parent )
+        {
+            if ( parent->MacGetRootWindow() != window )
+            {
+                // we are in a different window on the mac system
+                parent = NULL ;
+                break ;
+            }
+            
             {
-                if ( parent->MacGetRootWindow() != window )
+                if ( parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
+                    && parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) )
                 {
-                    // we are in a different window on the mac system
-                    parent = NULL ;
+                    // if we have any other colours in the hierarchy
+                    m_macBackgroundBrush.SetColour( parent->m_backgroundColour ) ;
                     break ;
                 }
-
+                // if we have the normal colours in the hierarchy but another control etc. -> use it's background
+                if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                 {
-                    if ( parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
-                      && parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) )
-                    {
-                        // if we have any other colours in the hierarchy
-                        m_macBackgroundBrush.SetColour( parent->m_backgroundColour ) ;
-                        break ;
-                    }
-                    // if we have the normal colours in the hierarchy but another control etc. -> use it's background
-                    if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
-                    {
-                        Rect extent = { 0 , 0 , 0 , 0 } ;
-                        int x , y ;
-                        x = y = 0 ;
-                        wxSize size = parent->GetSize() ;
-                        parent->MacClientToRootWindow( &x , &y ) ;
-                        extent.left = x ;
-                        extent.top = y ;
-                        extent.top-- ;
-                        extent.right = x + size.x ;
-                        extent.bottom = y + size.y ;
-                        m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , (WXRECTPTR) &extent ) ; // todo eventually change for inactive
-                        break ;
-                    }
+                    Rect extent = { 0 , 0 , 0 , 0 } ;
+                    int x , y ;
+                    x = y = 0 ;
+                    wxSize size = parent->GetSize() ;
+                    parent->MacClientToRootWindow( &x , &y ) ;
+                    extent.left = x ;
+                    extent.top = y ;
+                    extent.top-- ;
+                    extent.right = x + size.x ;
+                    extent.bottom = y + size.y ;
+                    m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , (WXRECTPTR) &extent ) ; // todo eventually change for inactive
+                    break ;
                 }
-                parent = parent->GetParent() ;
-            }
-            if ( !parent )
-            {
-              m_macBackgroundBrush.SetMacTheme( kThemeBrushDialogBackgroundActive ) ; // todo eventually change for inactive
             }
+            parent = parent->GetParent() ;
+        }
+        if ( !parent )
+        {
+            m_macBackgroundBrush.SetMacTheme( kThemeBrushDialogBackgroundActive ) ; // todo eventually change for inactive
+        }
     }
     else
     {
         m_macBackgroundBrush.SetColour( m_backgroundColour ) ;
     }
-
-    return m_macBackgroundBrush ;
-
+    
+    return m_macBackgroundBrush ;    
 }
 
 void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
@@ -1199,41 +1198,41 @@ void wxWindowMac::RemoveChild( wxWindowBase *child )
 void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
     int range, bool refresh)
 {
-        if ( orient == wxHORIZONTAL )
+    if ( orient == wxHORIZONTAL )
+    {
+        if ( m_hScrollBar )
         {
-            if ( m_hScrollBar )
+            if ( range == 0 || thumbVisible >= range )
             {
-                if ( range == 0 || thumbVisible >= range )
-                {
-                    if ( m_hScrollBar->IsShown() )
-                        m_hScrollBar->Show(false) ;
-                }
-                else
-                {
-                    if ( !m_hScrollBar->IsShown() )
-                        m_hScrollBar->Show(true) ;
-                    m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
-                }
+                if ( m_hScrollBar->IsShown() )
+                    m_hScrollBar->Show(false) ;
+            }
+            else
+            {
+                if ( !m_hScrollBar->IsShown() )
+                    m_hScrollBar->Show(true) ;
+                m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
             }
         }
-        else
+    }
+    else
+    {
+        if ( m_vScrollBar )
         {
-            if ( m_vScrollBar )
+            if ( range == 0 || thumbVisible >= range )
             {
-                if ( range == 0 || thumbVisible >= range )
-                {
-                    if ( m_vScrollBar->IsShown() )
-                        m_vScrollBar->Show(false) ;
-                }
-                else
-                {
-                    if ( !m_vScrollBar->IsShown() )
-                        m_vScrollBar->Show(true) ;
-                    m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
-                }
+                if ( m_vScrollBar->IsShown() )
+                    m_vScrollBar->Show(false) ;
+            }
+            else
+            {
+                if ( !m_vScrollBar->IsShown() )
+                    m_vScrollBar->Show(true) ;
+                m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
             }
         }
-        MacRepositionScrollBars() ;
+    }
+    MacRepositionScrollBars() ;
 }
 
 // Does a physical scroll
@@ -1241,39 +1240,39 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
     wxClientDC dc(this) ;
     wxMacPortSetter helper(&dc) ;
-
+    
     {
         int width , height ;
         GetClientSize( &width , &height ) ;
-
+        
         Rect scrollrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , dc.YLOG2DEVMAC(height) , dc.XLOG2DEVMAC(width) } ;
         RgnHandle updateRgn = NewRgn() ;
         ClipRect( &scrollrect ) ;
         if ( rect )
         {
             Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) ,
-              dc.XLOG2DEVMAC(rect->x + rect->width) } ;
+                dc.XLOG2DEVMAC(rect->x + rect->width) } ;
             SectRect( &scrollrect , &r , &scrollrect ) ;
         }
         ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
         InvalWindowRgn( (WindowRef) MacGetRootWindow() ,  updateRgn ) ;
         DisposeRgn( updateRgn ) ;
     }
-
+    
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
         wxWindowMac *child = (wxWindowMac*)node->GetData();
         if (child == m_vScrollBar) continue;
         if (child == m_hScrollBar) continue;
         if (child->IsTopLevel()) continue;
-
+        
         int x,y;
         child->GetPosition( &x, &y );
         int w,h;
         child->GetSize( &w, &h );
         child->SetSize( x+dx, y+dy, w, h );
     }
-
+    
 }
 
 void wxWindowMac::MacOnScroll(wxScrollEvent &event )
@@ -1284,30 +1283,30 @@ void wxWindowMac::MacOnScroll(wxScrollEvent &event )
         wevent.SetPosition(event.GetPosition());
         wevent.SetOrientation(event.GetOrientation());
         wevent.m_eventObject = this;
-
+        
         if (event.m_eventType == wxEVT_SCROLL_TOP) {
             wevent.m_eventType = wxEVT_SCROLLWIN_TOP;
         } else
-        if (event.m_eventType == wxEVT_SCROLL_BOTTOM) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_LINEUP) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_LINEDOWN) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_PAGEUP) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_PAGEDOWN) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_THUMBTRACK) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
-        }
-
-        GetEventHandler()->ProcessEvent(wevent);
+            if (event.m_eventType == wxEVT_SCROLL_BOTTOM) {
+                wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM;
+            } else
+                if (event.m_eventType == wxEVT_SCROLL_LINEUP) {
+                    wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+                } else
+                    if (event.m_eventType == wxEVT_SCROLL_LINEDOWN) {
+                        wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
+                    } else
+                        if (event.m_eventType == wxEVT_SCROLL_PAGEUP) {
+                            wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+                        } else
+                            if (event.m_eventType == wxEVT_SCROLL_PAGEDOWN) {
+                                wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+                            } else
+                                if (event.m_eventType == wxEVT_SCROLL_THUMBTRACK) {
+                                    wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
+                                }
+                                
+                                GetEventHandler()->ProcessEvent(wevent);
     }
 }
 
@@ -1356,7 +1355,7 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
     // notice that it's also important to do it upwards the tree becaus
     // otherwise when the top level panel gets focus, it won't set it back to
     // us, but to some other sibling
-
+    
     // CS:don't know if this is still needed:
     //wxChildFocusEvent eventFocus(this);
     //(void)GetEventHandler()->ProcessEvent(eventFocus);
@@ -1435,27 +1434,27 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
 {
     if ( IsTopLevel() )
     {
-      if ((point.x < 0) || (point.y < 0) ||
-          (point.x > (m_width)) || (point.y > (m_height)))
-          return FALSE;
+        if ((point.x < 0) || (point.y < 0) ||
+            (point.x > (m_width)) || (point.y > (m_height)))
+            return FALSE;
     }
     else
     {
-      if ((point.x < m_x) || (point.y < m_y) ||
-          (point.x > (m_x + m_width)) || (point.y > (m_y + m_height)))
-          return FALSE;
+        if ((point.x < m_x) || (point.y < m_y) ||
+            (point.x > (m_x + m_width)) || (point.y > (m_y + m_height)))
+            return FALSE;
     }
-
+    
     WindowRef window = (WindowRef) MacGetRootWindow() ;
-
+    
     wxPoint newPoint( point ) ;
-
+    
     if ( !IsTopLevel() )
     {
-      newPoint.x -= m_x;
-      newPoint.y -= m_y;
+        newPoint.x -= m_x;
+        newPoint.y -= m_y;
     }
-
+    
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
         wxWindowMac *child = (wxWindowMac*)node->GetData();
@@ -1466,7 +1465,7 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
                 return TRUE;
         }
     }
-
+    
     *outWin = this ;
     return TRUE;
 }
@@ -1474,25 +1473,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
 bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
 {
     WindowRef window ;
-
+    
     Point pt = { screenpoint.y , screenpoint.x } ;
     if ( ::FindWindow( pt , &window ) == 3 )
     {
-
+        
         wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
         if ( win )
         {
             // No, this yields the CLIENT are, we need the whole frame. RR.
             // point = win->ScreenToClient( point ) ;
-
+            
             GrafPtr     port;
             ::GetPort( &port ) ;
             ::SetPort( UMAGetWindowPort( window ) ) ;
             ::GlobalToLocal( &pt ) ;
             ::SetPort( port ) ;
-
+            
             wxPoint point( pt.h, pt.v ) ;
-
+            
             return win->MacGetWindowFromPointSub( point , outWin ) ;
         }
     }
@@ -1504,22 +1503,22 @@ static wxWindow *gs_lastWhich = NULL;
 bool wxWindowMac::MacSetupCursor( const wxPoint& pt)
 {
     // first trigger a set cursor event
-
+    
     wxPoint clientorigin = GetClientAreaOrigin() ;
     wxSize clientsize = GetClientSize() ;
     wxCursor cursor ;
     if ( wxRect2DInt( clientorigin.x , clientorigin.y , clientsize.x , clientsize.y ).Contains( wxPoint2DInt( pt ) ) )
     {
         wxSetCursorEvent event( pt.x , pt.y );
-
+        
         bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event);
         if ( processedEvtSetCursor && event.HasCursor() )
         {
-           cursor = event.GetCursor() ;
+            cursor = event.GetCursor() ;
         }
         else
         {
-
+            
             // the test for processedEvtSetCursor is here to prevent using m_cursor
             // if the user code caught EVT_SET_CURSOR() and returned nothing from
             // it - this is a way to say that our cursor shouldn't be used for this
@@ -1548,19 +1547,19 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
     if ((event.m_x < m_x) || (event.m_y < m_y) ||
         (event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
         return FALSE;
-
-
+    
+    
     if ( IsKindOf( CLASSINFO ( wxStaticBox ) ) /* || IsKindOf( CLASSINFO( wxSpinCtrl ) ) */)
         return FALSE ;
-
+    
     WindowRef window = (WindowRef) MacGetRootWindow() ;
-
+    
     event.m_x -= m_x;
     event.m_y -= m_y;
-
+    
     int x = event.m_x ;
     int y = event.m_y ;
-
+    
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
         wxWindowMac *child = (wxWindowMac*)node->GetData();
@@ -1570,10 +1569,10 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
                 return TRUE;
         }
     }
-
+    
     wxWindow* cursorTarget = this ;
     wxPoint cursorPoint( x , y ) ;
-
+    
     while( cursorTarget && !cursorTarget->MacSetupCursor( cursorPoint ) )
     {
         cursorTarget = cursorTarget->GetParent() ;
@@ -1583,40 +1582,40 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
     event.m_x = x ;
     event.m_y = y ;
     event.SetEventObject( this ) ;
-
+    
     if ( event.GetEventType() == wxEVT_LEFT_DOWN )
     {
         // set focus to this window
         if (AcceptsFocus() && FindFocus()!=this)
             SetFocus();
     }
-
+    
 #if wxUSE_TOOLTIPS
     if ( event.GetEventType() == wxEVT_MOTION
-            || event.GetEventType() == wxEVT_ENTER_WINDOW
-            || event.GetEventType() == wxEVT_LEAVE_WINDOW )
+        || event.GetEventType() == wxEVT_ENTER_WINDOW
+        || event.GetEventType() == wxEVT_LEAVE_WINDOW )
         wxToolTip::RelayEvent( this , event);
 #endif // wxUSE_TOOLTIPS
-
+    
     if (gs_lastWhich != this)
     {
         gs_lastWhich = this;
-
+        
         // Double clicks must always occur on the same window
         if (event.GetEventType() == wxEVT_LEFT_DCLICK)
             event.SetEventType( wxEVT_LEFT_DOWN );
         if (event.GetEventType() == wxEVT_RIGHT_DCLICK)
             event.SetEventType( wxEVT_RIGHT_DOWN );
-
+        
         // Same for mouse up events
         if (event.GetEventType() == wxEVT_LEFT_UP)
             return TRUE;
         if (event.GetEventType() == wxEVT_RIGHT_UP)
             return TRUE;
     }
-
+    
     GetEventHandler()->ProcessEvent( event ) ;
-
+    
     return TRUE;
 }
 
@@ -1657,105 +1656,105 @@ wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
 
 const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSiblings )
 {
-  RgnHandle visRgn = NewRgn() ;
-  RgnHandle tempRgn = NewRgn() ;
-  RgnHandle tempStaticBoxRgn = NewRgn() ;
-
-  SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
-
-  //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
-  if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
-  {
-    int borderTop = 14 ;
-    int borderOther = 4 ;
-
-    SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
-    DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
-  }
-
-  if ( !IsTopLevel() )
-  {
-    wxWindow* parent = GetParent() ;
-    while( parent )
-    {
-      wxSize size = parent->GetSize() ;
-      int x , y ;
-      x = y = 0 ;
-      parent->MacWindowToRootWindow( &x, &y ) ;
-      MacRootWindowToWindow( &x , &y ) ;
-
-      SetRectRgn( tempRgn ,
-       x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
-       x + size.x - parent->MacGetRightBorderSize(),
-       y + size.y - parent->MacGetBottomBorderSize()) ;
-
-      SectRgn( visRgn , tempRgn , visRgn ) ;
-      if ( parent->IsTopLevel() )
-        break ;
-      parent = parent->GetParent() ;
-    }
-  }
-  if ( respectChildrenAndSiblings )
-  {
-      if ( GetWindowStyle() & wxCLIP_CHILDREN )
-      {
-        for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
+    RgnHandle visRgn = NewRgn() ;
+    RgnHandle tempRgn = NewRgn() ;
+    RgnHandle tempStaticBoxRgn = NewRgn() ;
+    
+    SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
+    
+    //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
+    if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
+    {
+        int borderTop = 14 ;
+        int borderOther = 4 ;
+        
+        SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
+        DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
+    }
+    
+    if ( !IsTopLevel() )
+    {
+        wxWindow* parent = GetParent() ;
+        while( parent )
         {
-            wxWindowMac *child = (wxWindowMac*)node->GetData();
-
-            if ( !child->IsTopLevel() && child->IsShown() )
+            wxSize size = parent->GetSize() ;
+            int x , y ;
+            x = y = 0 ;
+            parent->MacWindowToRootWindow( &x, &y ) ;
+            MacRootWindowToWindow( &x , &y ) ;
+            
+            SetRectRgn( tempRgn ,
+                x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
+                x + size.x - parent->MacGetRightBorderSize(),
+                y + size.y - parent->MacGetBottomBorderSize()) ;
+            
+            SectRgn( visRgn , tempRgn , visRgn ) ;
+            if ( parent->IsTopLevel() )
+                break ;
+            parent = parent->GetParent() ;
+        }
+    }
+    if ( respectChildrenAndSiblings )
+    {
+        if ( GetWindowStyle() & wxCLIP_CHILDREN )
+        {
+            for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
             {
-                SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width ,  child->m_y + child->m_height ) ;
-                if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                wxWindowMac *child = (wxWindowMac*)node->GetData();
+                
+                if ( !child->IsTopLevel() && child->IsShown() )
                 {
-                    int borderTop = 14 ;
-                    int borderOther = 4 ;
-
-                    SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ;
-                    DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width ,  child->m_y + child->m_height ) ;
+                    if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                    {
+                        int borderTop = 14 ;
+                        int borderOther = 4 ;
+                        
+                        SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ;
+                        DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    }
+                    DiffRgn( visRgn , tempRgn , visRgn ) ;
                 }
-                DiffRgn( visRgn , tempRgn , visRgn ) ;
             }
         }
-      }
-
-      if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
-      {
-        bool thisWindowThrough = false ;
-        for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
+        
+        if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
         {
-            wxWindowMac *sibling = (wxWindowMac*)node->GetData();
-            if ( sibling == this )
-            {
-              thisWindowThrough = true ;
-              continue ;
-            }
-            if( !thisWindowThrough )
-            {
-              continue ;
-            }
-
-            if ( !sibling->IsTopLevel() && sibling->IsShown() )
+            bool thisWindowThrough = false ;
+            for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
             {
-                SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x ,  sibling->m_y + sibling->m_height - m_y ) ;
-                if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                wxWindowMac *sibling = (wxWindowMac*)node->GetData();
+                if ( sibling == this )
                 {
-                    int borderTop = 14 ;
-                    int borderOther = 4 ;
-
-                    SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ;
-                    DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    thisWindowThrough = true ;
+                    continue ;
+                }
+                if( !thisWindowThrough )
+                {
+                    continue ;
+                }
+                
+                if ( !sibling->IsTopLevel() && sibling->IsShown() )
+                {
+                    SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x ,  sibling->m_y + sibling->m_height - m_y ) ;
+                    if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                    {
+                        int borderTop = 14 ;
+                        int borderOther = 4 ;
+                        
+                        SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ;
+                        DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    }
+                    DiffRgn( visRgn , tempRgn , visRgn ) ;
                 }
-                DiffRgn( visRgn , tempRgn , visRgn ) ;
             }
         }
-      }
-  }
-  m_macVisibleRegion = visRgn ;
-  DisposeRgn( visRgn ) ;
-  DisposeRgn( tempRgn ) ;
-  DisposeRgn( tempStaticBoxRgn ) ;
-  return m_macVisibleRegion ;
+    }
+    m_macVisibleRegion = visRgn ;
+    DisposeRgn( visRgn ) ;
+    DisposeRgn( tempRgn ) ;
+    DisposeRgn( tempStaticBoxRgn ) ;
+    return m_macVisibleRegion ;
 }
 
 void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
@@ -1763,16 +1762,16 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
     RgnHandle updatergn = (RgnHandle) updatergnr ;
     // updatergn is always already clipped to our boundaries
     // it is in window coordinates, not in client coordinates
-
+    
     WindowRef window = (WindowRef) MacGetRootWindow() ;
-
+    
     {
         // ownUpdateRgn is the area that this window has to repaint, it is in window coordinates
         RgnHandle ownUpdateRgn = NewRgn() ;
         CopyRgn( updatergn , ownUpdateRgn ) ;
-
+        
         SectRgn( ownUpdateRgn , (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , ownUpdateRgn ) ;
-
+        
         // newupdate is the update region in client coordinates
         RgnHandle newupdate = NewRgn() ;
         wxSize point = GetClientSize() ;
@@ -1782,32 +1781,32 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
         OffsetRgn( newupdate , -origin.x , -origin.y ) ;
         m_updateRegion = newupdate ;
         DisposeRgn( newupdate ) ; // it's been cloned to m_updateRegion
-
+        
         if ( erase && !EmptyRgn(ownUpdateRgn) )
         {
-          wxWindowDC dc(this);
-          if (!EmptyRgn(ownUpdateRgn))
-              dc.SetClippingRegion(wxRegion(ownUpdateRgn));
-          wxEraseEvent eevent( GetId(), &dc );
-          eevent.SetEventObject( this );
-          GetEventHandler()->ProcessEvent( eevent );
-
-          wxNcPaintEvent eventNc( GetId() );
-          eventNc.SetEventObject( this );
-          GetEventHandler()->ProcessEvent( eventNc );
+            wxWindowDC dc(this);
+            if (!EmptyRgn(ownUpdateRgn))
+                dc.SetClippingRegion(wxRegion(ownUpdateRgn));
+            wxEraseEvent eevent( GetId(), &dc );
+            eevent.SetEventObject( this );
+            GetEventHandler()->ProcessEvent( eevent );
+            
+            wxNcPaintEvent eventNc( GetId() );
+            eventNc.SetEventObject( this );
+            GetEventHandler()->ProcessEvent( eventNc );
         }
         DisposeRgn( ownUpdateRgn ) ;
         if ( !m_updateRegion.Empty() )
         {
-          wxPaintEvent event;
-          event.m_timeStamp = time ;
-          event.SetEventObject(this);
-          GetEventHandler()->ProcessEvent(event);
+            wxPaintEvent event;
+            event.m_timeStamp = time ;
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
         }
     }
-
+    
     // now intersect for each of the children their rect with the updateRgn and call MacRedraw recursively
-
+    
     RgnHandle childupdate = NewRgn() ;
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
@@ -1825,7 +1824,7 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
     }
     DisposeRgn( childupdate ) ;
     // eventually a draw grow box here
-
+    
 }
 
 WXHWND wxWindowMac::MacGetRootWindow() const
index 60035000ddf2e7179975089afeaf423c221caac6..f1bc26ccc6c2d7bcb7ae97e19a1c7d9a4624c545 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -31,15 +31,15 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
            const wxValidator& validator,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlCheckBoxProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlCheckBoxProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
 
   return TRUE;
 }
@@ -63,7 +63,7 @@ void wxCheckBox::Command (wxCommandEvent & event)
 
 void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) ) 
 {
-       SetValue( !GetValue() ) ;
+    SetValue( !GetValue() ) ;
     wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
     event.SetInt(GetValue());
     event.SetEventObject(this);
index 33dba7507c997bbe0e132822c008ec8bdcd2cfbf..c50773b137ed9ff0bd6e24380e6a75030a63d6be 100644 (file)
@@ -73,9 +73,9 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
     RgnHandle savedClipRegion;
     SInt32 savedPenMode;
     wxCheckListBox*          list;
-  GetPort(&savePort);
-  SetPort((**listHandle).port);
-  grafPtr = (**listHandle).port ;
+    GetPort(&savePort);
+    SetPort((**listHandle).port);
+    grafPtr = (**listHandle).port ;
     // typecast our refCon
     list = (wxCheckListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
     
@@ -102,13 +102,13 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
             ClipRect( drawRect );
             EraseRect( drawRect );
             
-                       wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
+            wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
 
-                       if ( font )
-                       {
-                               ::TextFont( font->m_macFontNum ) ;
-                               ::TextSize( font->m_macFontSize)  ;
-                               ::TextFace( font->m_macFontStyle ) ;
+            if ( font )
+            {
+                ::TextFont( font->m_macFontNum ) ;
+                ::TextSize( font->m_macFontSize)  ;
+                ::TextFace( font->m_macFontStyle ) ;
             }
                        
             ThemeButtonDrawInfo info ;
@@ -123,11 +123,11 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
             checkRect.right = checkRect.left + list->m_checkBoxWidth ;
             checkRect.bottom = checkRect.top + list->m_checkBoxHeight ;
             DrawThemeButton(&checkRect,kThemeCheckBox,
-              &info,NULL,NULL, NULL,0);
-
-        MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
-        DrawText(text, 0 , text.Length());
+                &info,NULL,NULL, NULL,0);
+            
+            MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
+            
+            DrawText(text, 0 , text.Length());
             //  If the cell is hilited, do the hilite now. Paint the cell contents with the
             //  appropriate QuickDraw transform mode.
             
@@ -142,8 +142,8 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
             
             SetClip( savedClipRegion );
             DisposeRgn( savedClipRegion );
-            }
-            break;
+        }
+        break;
         case lHiliteMsg:
             
             //  Hilite or unhilite the cell. Paint the cell contents with the
@@ -194,7 +194,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
     GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);    
     GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
 #endif
-         wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
+      wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
 
     FontInfo finfo;
     FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo);
@@ -202,12 +202,12 @@ bool wxCheckListBox::Create(wxWindow *parent,
     m_TextBaseLineOffset= finfo.leading+finfo.ascent;
     m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;
     
-       if (m_checkBoxHeight<h)
-       {
-               m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
-               m_checkBoxHeight= h;
-       }
-               
+    if (m_checkBoxHeight<h)
+    {
+        m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
+        m_checkBoxHeight= h;
+    }
+        
     Rect bounds ;
     Str255 title ;
     
@@ -376,55 +376,55 @@ END_EVENT_TABLE()
 
 void wxCheckListBox::OnChar(wxKeyEvent& event)
 {
-  if ( event.GetKeyCode() == WXK_SPACE )
-  {
-    int index = GetSelection() ;
-    if ( index >= 0 )
+    if ( event.GetKeyCode() == WXK_SPACE )
     {
-      Check(index, !IsChecked(index) ) ;
-      wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
-      event.SetInt(index);
-      event.SetEventObject(this);
-      GetEventHandler()->ProcessEvent(event);
+        int index = GetSelection() ;
+        if ( index >= 0 )
+        {
+            Check(index, !IsChecked(index) ) ;
+            wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
+            event.SetInt(index);
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
+        }
     }
-  }
-  else
-    event.Skip();
+    else
+        event.Skip();
 }
 
 void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
 {
-  // clicking on the item selects it, clicking on the checkmark toggles
-  if ( event.GetX() <= 20 /*check width*/ ) {
-    int lineheight ;
-    int topcell ;
+    // clicking on the item selects it, clicking on the checkmark toggles
+    if ( event.GetX() <= 20 /*check width*/ ) {
+        int lineheight ;
+        int topcell ;
 #if TARGET_CARBON
-    Point pt ;
-    GetListCellSize( (ListHandle)m_macList , &pt ) ;
-    lineheight = pt.v ;
-    ListBounds visible ;
-    GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
-    topcell = visible.top ;
+        Point pt ;
+        GetListCellSize( (ListHandle)m_macList , &pt ) ;
+        lineheight = pt.v ;
+        ListBounds visible ;
+        GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
+        topcell = visible.top ;
 #else
-    lineheight =  (**(ListHandle)m_macList).cellSize.v ;
-    topcell = (**(ListHandle)m_macList).visible.top ;
+        lineheight =  (**(ListHandle)m_macList).cellSize.v ;
+        topcell = (**(ListHandle)m_macList).visible.top ;
 #endif
-    size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
-    
-    if ( nItem < (size_t)m_noItems )
-    {
-      Check(nItem, !IsChecked(nItem) ) ;
-      wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
-      event.SetInt(nItem);
-      event.SetEventObject(this);
-      GetEventHandler()->ProcessEvent(event);
+        size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
+        
+        if ( nItem < (size_t)m_noItems )
+        {
+            Check(nItem, !IsChecked(nItem) ) ;
+            wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
+            event.SetInt(nItem);
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
+        }
+        //else: it's not an error, just click outside of client zone
+    }
+    else {
+        // implement default behaviour: clicking on the item selects it
+        event.Skip();
     }
-    //else: it's not an error, just click outside of client zone
-  }
-  else {
-    // implement default behaviour: clicking on the item selects it
-    event.Skip();
-  }
 }
 
 #endif // wxUSE_CHECKLISTBOX
index 4074699ed54cc289279b2fa67c6b2513920bc27d..a53b5715cea7d8a82ca338c2e0de2ae51cd06dce 100644 (file)
@@ -6,19 +6,24 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 #pragma implementation "choice.h"
 #endif
+
 #include "wx/defs.h"
 #include "wx/choice.h"
 #include "wx/menu.h"
 #include "wx/mac/uma.h"
+
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
 #endif
+
 extern MenuHandle NewUniqueMenu() ;
+
 wxChoice::~wxChoice()
 {
     if ( HasClientObjectData() )
@@ -30,49 +35,52 @@ wxChoice::~wxChoice()
     }
 
         // DeleteMenu( m_macPopUpMenuId ) ;
-       // DisposeMenu( m_macPopUpMenuHandle ) ;
+    // DisposeMenu( m_macPopUpMenuHandle ) ;
 }
+
 bool wxChoice::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
            const wxSize& size,
-                  int n, const wxString choices[],
-                  long style,
+           int n, const wxString choices[],
+           long style,
            const wxValidator& validator,
            const wxString& name)
 {
-               Rect bounds ;
-               Str255 title ;
-       
-               MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
-               m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , 
-               kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
-       
-               m_macPopUpMenuHandle =  NewUniqueMenu() ;
-               SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
-               SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
-               SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
-               if ( n > 0 )
-                       SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
-               MacPostControlCreate() ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , 
+        kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
+    
+    m_macPopUpMenuHandle =  NewUniqueMenu() ;
+    SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
+    SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
+    SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
+    if ( n > 0 )
+        SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
+    MacPostControlCreate() ;
     for ( int i = 0; i < n; i++ )
     {
         Append(choices[i]);
     }
-       return TRUE;
+    return TRUE;
 }
+
 // ----------------------------------------------------------------------------
 // adding/deleting items to/from the list
 // ----------------------------------------------------------------------------
 int wxChoice::DoAppend(const wxString& item)
 {
-       UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
-       m_strings.Add( item ) ;
-       m_datas.Add( NULL ) ;
-       int index = m_strings.GetCount()  - 1  ;
-       DoSetItemClientData( index , NULL ) ;
-       SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
-       return index ;
+    UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
+    m_strings.Add( item ) ;
+    m_datas.Add( NULL ) ;
+    int index = m_strings.GetCount()  - 1  ;
+    DoSetItemClientData( index , NULL ) ;
+    SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
+    return index ;
 }
+
 void wxChoice::Delete(int n)
 {
     wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
@@ -83,19 +91,21 @@ void wxChoice::Delete(int n)
     ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
     m_strings.Remove( n ) ;
     m_datas.RemoveAt( n ) ;
-       SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
+    SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
 }
+
 void wxChoice::Clear()
 {
     FreeData();
     for ( int i = 0 ; i < GetCount() ; i++ )
     {
-       ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
+        ::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
     }
     m_strings.Empty() ;
     m_datas.Empty() ;
     SetControl32BitMaximum( (ControlHandle) m_macControl , 0 ) ;
 }
+
 void wxChoice::FreeData()
 {
     if ( HasClientObjectData() )
@@ -107,6 +117,7 @@ void wxChoice::FreeData()
         }
     }
 }
+
 // ----------------------------------------------------------------------------
 // selection
 // ----------------------------------------------------------------------------
@@ -114,26 +125,31 @@ int wxChoice::GetSelection() const
 {
     return GetControl32BitValue( (ControlHandle) m_macControl ) -1 ;
 }
+
 void wxChoice::SetSelection(int n)
 {
     SetControl32BitValue( (ControlHandle) m_macControl , n + 1 ) ;
 }
+
 // ----------------------------------------------------------------------------
 // string list functions
 // ----------------------------------------------------------------------------
+
 int wxChoice::GetCount() const
 {
     return m_strings.GetCount() ;
 }
+
 int wxChoice::FindString(const wxString& s) const
 {
     for( int i = 0 ; i < GetCount() ; i++ )
     {
-       if ( GetString( i ).IsSameAs(s, FALSE) )
-               return i ; 
+        if ( GetString( i ).IsSameAs(s, FALSE) )
+            return i ; 
     }
     return wxNOT_FOUND ;
 }
+
 void wxChoice::SetString(int n, const wxString& s)
 {
     wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented"));
@@ -145,7 +161,7 @@ void wxChoice::SetString(int n, const wxString& s)
 
 wxString wxChoice::GetString(int n) const
 {
-       return m_strings[n] ;
+    return m_strings[n] ;
 }
 // ----------------------------------------------------------------------------
 // client data
@@ -154,23 +170,27 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
                  "invalid index in wxChoice::SetClientData" );
-       
+    
     m_datas[n] = (char*) clientData ;
 }
+
 void *wxChoice::DoGetItemClientData(int n) const
 {
     wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
                  "invalid index in wxChoice::GetClientData" );
     return (void *)m_datas[n];
 }
+
 void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
 {
     DoSetItemClientData(n, clientData);
 }
+
 wxClientData* wxChoice::DoGetItemClientObject( int n ) const
 {
     return (wxClientData *)DoGetItemClientData(n);
 }
+
 void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
     wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
@@ -188,6 +208,7 @@ void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
         ProcessCommand(event);
     }
 }
+
 wxSize wxChoice::DoGetBestSize() const
 {
     int lbWidth = 100;  // some defaults
@@ -198,35 +219,35 @@ wxSize wxChoice::DoGetBestSize() const
     GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );   
     lbHeight = metric ; 
 #endif
-       {
-               wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
-               Rect drawRect ;
-               wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-               if ( font )
-               {
-                       ::TextFont( font->m_macFontNum ) ;
-                       ::TextSize( short(font->m_macFontSize) ) ;
-                       ::TextFace( font->m_macFontStyle ) ;
-               }
-               else
-               {
-               ::TextFont( kFontIDMonaco ) ;
-               ::TextSize( 9  );
-               ::TextFace( 0 ) ;
-               }
-           // Find the widest line
-           for(int i = 0; i < GetCount(); i++) {
-               wxString str(GetString(i));
-               wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
-               lbWidth = wxMax(lbWidth, wLine);
-           }
-           // Add room for the popup arrow
-           lbWidth += 2 * lbHeight ;
-           // And just a bit more
-           int cy = 12 ;
-           int cx = ::TextWidth( "X" , 0 , 1 ) ;
-           lbWidth += cx ;
-           
-       }
+    {
+        wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
+         Rect drawRect ;
+        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+        if ( font )
+        {
+            ::TextFont( font->m_macFontNum ) ;
+            ::TextSize( short(font->m_macFontSize) ) ;
+            ::TextFace( font->m_macFontStyle ) ;
+        }
+        else
+        {
+            ::TextFont( kFontIDMonaco ) ;
+            ::TextSize( 9  );
+            ::TextFace( 0 ) ;
+        }
+        // Find the widest line
+        for(int i = 0; i < GetCount(); i++) {
+            wxString str(GetString(i));
+            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+            lbWidth = wxMax(lbWidth, wLine);
+        }
+        // Add room for the popup arrow
+        lbWidth += 2 * lbHeight ;
+        // And just a bit more
+        int cy = 12 ;
+        int cx = ::TextWidth( "X" , 0 , 1 ) ;
+        lbWidth += cx ;
+        
+    }
     return wxSize(lbWidth, lbHeight);
 }
index 7854006d09bfe35239bf1f1e9012b50f0fec0fc5..47a2b428f909abd55e8b862526c1b3b2858de434 100644 (file)
@@ -44,27 +44,27 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 #else
     OSStatus err = noErr ;
 #endif
-       void * data = NULL ;
-       Size byteCount;
+    void * data = NULL ;
+    Size byteCount;
     
     switch (dataFormat.GetType())
     {
-        case wxDF_OEMTEXT:
-            dataFormat = wxDF_TEXT;
-            // fall through
-
-        case wxDF_TEXT:
-                break;
-        case wxDF_BITMAP :
-        case wxDF_METAFILE :
-                       break ;
-        default:
-            {
-                wxLogError(_("Unsupported clipboard format."));
-                return NULL;
-            }
+    case wxDF_OEMTEXT:
+        dataFormat = wxDF_TEXT;
+        // fall through
+        
+    case wxDF_TEXT:
+        break;
+    case wxDF_BITMAP :
+    case wxDF_METAFILE :
+        break ;
+    default:
+        {
+            wxLogError(_("Unsupported clipboard format."));
+            return NULL;
+        }
     }
-
+    
 #if TARGET_CARBON
     ScrapRef scrapRef;
     
@@ -77,21 +77,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         {
             if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
             {
-              if ( dataFormat.GetType() == wxDF_TEXT )
-                byteCount++ ;
+                if ( dataFormat.GetType() == wxDF_TEXT )
+                    byteCount++ ;
                 
-          data = new char[ byteCount ] ;
-          if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
-          {
-            *len = byteCount ;
-                if ( dataFormat.GetType() == wxDF_TEXT )  
-                ((char*)data)[byteCount] = 0 ;
-          }
-          else
-          {
-            delete[] ((char *)data) ;
-            data = NULL ;
-          }
+                data = new char[ byteCount ] ;
+                if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
+                {
+                    *len = byteCount ;
+                    if ( dataFormat.GetType() == wxDF_TEXT )  
+                        ((char*)data)[byteCount] = 0 ;
+                }
+                else
+                {
+                    delete[] ((char *)data) ;
+                    data = NULL ;
+                }
             }
         }
     }
@@ -104,28 +104,28 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     HUnlock( datahandle ) ;
     if ( GetHandleSize( datahandle ) > 0 )
     {
-      byteCount = GetHandleSize( datahandle ) ;
-      if ( dataFormat.GetType() == wxDF_TEXT )  
-        data = new char[ byteCount + 1] ;
-      else
-        data = new char[ byteCount ] ;
-
-      memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
-      if ( dataFormat.GetType() == wxDF_TEXT )  
-          ((char*)data)[byteCount] = 0 ;
-      *len = byteCount ;
+        byteCount = GetHandleSize( datahandle ) ;
+        if ( dataFormat.GetType() == wxDF_TEXT )  
+            data = new char[ byteCount + 1] ;
+        else
+            data = new char[ byteCount ] ;
+        
+        memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
+        if ( dataFormat.GetType() == wxDF_TEXT )  
+            ((char*)data)[byteCount] = 0 ;
+        *len = byteCount ;
     }
     DisposeHandle( datahandle ) ;
 #endif
     if ( err )
     {
         wxLogSysError(_("Failed to get clipboard data."));
-
+        
         return NULL ;
     }
     if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
     {
-      wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
+        wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
     }
     return data;
 }
@@ -139,8 +139,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
 
 wxClipboard::wxClipboard()
 {
-  m_open = false ;
-  m_data = NULL ;
+    m_open = false ;
+    m_data = NULL ;
 }
 
 wxClipboard::~wxClipboard()
@@ -250,30 +250,30 @@ bool wxClipboard::AddData( wxDataObject *data )
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
            {
-                               wxMetafileDataObject* metaFileDataObject =
+                wxMetafileDataObject* metaFileDataObject =
                 (wxMetafileDataObject*) data;
-               wxMetafile metaFile = metaFileDataObject->GetMetafile();
-               PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
-               HLock( (Handle) pict ) ;
-               err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
-               HUnlock(  (Handle) pict ) ;
+                  wxMetafile metaFile = metaFileDataObject->GetMetafile();
+                PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
+                  HLock( (Handle) pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  HUnlock(  (Handle) pict ) ;
            }
            break ;
 #endif
            case wxDF_BITMAP:
            case wxDF_DIB:
            {
-                       bool created = false ;
-                       PicHandle pict = NULL ;
-                       
-                       wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
-                       pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
-
-               HLock( (Handle) pict ) ;
-               err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
-               HUnlock(  (Handle) pict ) ;
-               if ( created )
-                       KillPicture( pict ) ;
+                   bool created = false ;
+                   PicHandle pict = NULL ;
+                   
+                   wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
+                   pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
+
+                  HLock( (Handle) pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  HUnlock(  (Handle) pict ) ;
+                  if ( created )
+                      KillPicture( pict ) ;
            }
            default:
                 break ;
@@ -388,7 +388,7 @@ bool wxClipboard::GetData( wxDataObject& data )
                     transferred = true ;
                   }
               }
-                                                       break ;
+                            break ;
 
               default :
                 break ;
index bb2361b3ff096d28c5586c20217c94b71fff0f46..134e40f445d2a60f13e5d72894b7f8fa70fe2124 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -50,20 +50,20 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
 
 int wxColourDialog::ShowModal()
 {
-       Point where ;
-       RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
-       
-       where.h = where.v = -1;
+    Point where ;
+    RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
+    
+    where.h = where.v = -1;
 
-       if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
-       {
-               m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
-       return wxID_OK;
-       }
-       else
-       {
-       return wxID_CANCEL;
-       }
+    if (GetColor( where, "\pSelect a new palette color.", &currentColor, &newColor ))
+    {
+        m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
+        return wxID_OK;
+    }
+    else
+    {
+        return wxID_CANCEL;
+    }
 
     return wxID_CANCEL;
 }
index b9a18e9ca9665ace528dfe672336cb6c49eb4ff5..12a65e02a53125240a4c8d68cc0c943447bcfd82 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -28,17 +28,17 @@ static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green
 static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green ) 
 {
     RGBColor* col = (RGBColor*) color ;
-       col->red = (red << 8) + red;
-       col->blue = (blue << 8) + blue;
-       col->green = (green << 8) + green;
+    col->red = (red << 8) + red;
+    col->blue = (blue << 8) + blue;
+    col->green = (green << 8) + green;
 }
 
 wxColour::wxColour ()
 {
-  m_isInit = FALSE;
-  m_red = m_blue = m_green = 0;
-
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    m_isInit = FALSE;
+    m_red = m_blue = m_green = 0;
+    
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
@@ -48,7 +48,7 @@ wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
     m_blue = b;
     m_isInit = TRUE;
 
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 wxColour::wxColour (const wxColour& col)
@@ -74,14 +74,14 @@ wxColour::wxColour (const wxColour* col)
 
 wxColour& wxColour::operator =(const wxColour& col)
 {
-  m_red = col.m_red;
-  m_green = col.m_green;
-  m_blue = col.m_blue;
-  m_isInit = col.m_isInit;
-  memcpy( &m_pixel , &col.m_pixel , 6 ) ;
-
-  return *this;
+    m_red = col.m_red;
+    m_green = col.m_green;
+    m_blue = col.m_blue;
+    m_isInit = col.m_isInit;
+    
+    memcpy( &m_pixel , &col.m_pixel , 6 ) ;
+    
+    return *this;
 }
 
 void wxColour::InitFromName(const wxString& col)
@@ -102,7 +102,7 @@ void wxColour::InitFromName(const wxString& col)
         m_isInit = FALSE;
     }
 
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 wxColour::~wxColour ()
@@ -116,7 +116,7 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
     m_blue = b;
     m_isInit = TRUE;
 
-       wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
+    wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
 }
 
 void wxColour::Set( const WXCOLORREF* color )
index 2c000f3b0b41319f1e81f3c8ce5a8729695f3736..7d2a6819ea93aff36c36c0f1310ae2c6050770f2 100644 (file)
@@ -96,7 +96,7 @@ protected:
 
                 wxWindow *parent = GetParent();
                 while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
-                  parent = parent->GetParent() ;
+                    parent = parent->GetParent() ;
                 }
                 if ( parent && parent->GetDefaultItem() )
                 {
@@ -314,9 +314,9 @@ void wxComboBox::SetValue(const wxString& value)
     int s = FindString (value);
     if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
     {
-       m_choice->Append(value) ;
+        m_choice->Append(value) ;
     }
-       SetStringSelection( value ) ;
+    SetStringSelection( value ) ;
 }
 
 // Clipboard operations
index 0ba0c065218f80ac3329955090ee03260715c3c6..2dd89c2b5542e5c2726e4e73292e5b227f49fbdc 100644 (file)
@@ -89,54 +89,54 @@ ControlDefUPP wxMacControlActionUPP = NULL ;
 pascal SInt32  wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
 {
     
-       wxControl*  wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
-       if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
-       {
-           if( message == drawCntl )
-           {
-               wxMacWindowClipper clip( wx ) ;
-               return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
-           }
-           else
-               return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
-       }
-       return  NULL ;
+    wxControl*  wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
+    if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+    {
+        if( message == drawCntl )
+        {
+            wxMacWindowClipper clip( wx ) ;
+            return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+        }
+        else
+            return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
+    }
+    return  NULL ;
 }
 
 pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
 {
-       OSStatus status = noErr ;
-       switch( iMessage )
-       {
-               case kControlMsgSetUpBackground :
-                       {
-                       wxControl*  wx = (wxControl*) GetControlReference( iControl ) ;
-                       if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
-                       {
-                               wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
+    OSStatus status = noErr ;
+    switch( iMessage )
+    {
+        case kControlMsgSetUpBackground :
+            {
+                wxControl*  wx = (wxControl*) GetControlReference( iControl ) ;
+                if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
+                {
+                    wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
 #if TARGET_CARBON
-                                       // under classic this would lead to partial redraws
-                                       RgnHandle clip = NewRgn() ;
-                               int x = 0 , y = 0;
-
-                               wx->MacWindowToRootWindow( &x,&y ) ;
-                               CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
-                               OffsetRgn( clip , x , y ) ;
-                               SetClip( clip ) ;
-                               DisposeRgn( clip ) ;
+                    // under classic this would lead to partial redraws
+                    RgnHandle clip = NewRgn() ;
+                    int x = 0 , y = 0;
+
+                    wx->MacWindowToRootWindow( &x,&y ) ;
+                    CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
+                    OffsetRgn( clip , x , y ) ;
+                    SetClip( clip ) ;
+                    DisposeRgn( clip ) ;
 #endif
-                               }
-                               else
-                               {
-                                       status = paramErr ;
-                               }
-                       }
-                       break ;
-               default :
-                       status = paramErr ;
-                       break ;
-       }
-       return status ;
+                }
+                else
+                {
+                    status = paramErr ;
+                }
+            }
+            break ;
+        default :
+            status = paramErr ;
+            break ;
+    }
+    return status ;
 }
  
 wxControl::wxControl()
@@ -389,14 +389,14 @@ void wxControl::MacPostControlCreate()
     m_macControlIsShown  = true ;
 
     wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
-       if ( wxMacSetupControlBackgroundUPP == NULL )
-       {
-               wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
-       }
-       if ( wxMacControlActionUPP == NULL )
-       {
-           wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
-       }
+    if ( wxMacSetupControlBackgroundUPP == NULL )
+    {
+        wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
+    }
+    if ( wxMacControlActionUPP == NULL )
+    {
+        wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
+    }
     // The following block of code is responsible for crashes when switching
     // back to windows, which can be seen in the dialogs sample.
     // It is disabled until a proper solution can be found.
@@ -414,35 +414,35 @@ void wxControl::MacPostControlCreate()
     cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ;
     if (  (**(ControlHandle)m_macControl).contrlDefProc != NULL )
     {
-      (**cdef).instruction = 0x4EF9;  /* JMP instruction */
-      (**cdef).function = (void(*)()) wxMacControlActionUPP;
-      (**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
+        (**cdef).instruction = 0x4EF9;  /* JMP instruction */
+        (**cdef).function = (void(*)()) wxMacControlActionUPP;
+        (**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
     }
 #endif
 #endif
-       SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
-     // Adjust the controls size and position
-     wxPoint pos(m_x, m_y);
-     wxSize best_size( DoGetBestSize() );
-     wxSize new_size( m_width, m_height );
-     m_x = m_y = m_width = m_height = -1;  // Forces SetSize to move/size the control
-     if (new_size.x == -1) {
+    SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
+    
+    // Adjust the controls size and position
+    wxPoint pos(m_x, m_y);
+    wxSize best_size( DoGetBestSize() );
+    wxSize new_size( m_width, m_height );
+    
+    m_x = m_y = m_width = m_height = -1;  // Forces SetSize to move/size the control
+    
+    if (new_size.x == -1) {
         new_size.x = best_size.x;
-     }
-     if (new_size.y == -1) {
-         new_size.y = best_size.y;
-     }
-     SetSize(pos.x, pos.y, new_size.x, new_size.y);
-     UMAShowControl( (ControlHandle) m_macControl ) ;
-     
-     SetCursor( *wxSTANDARD_CURSOR ) ;
-     
-     Refresh() ;
+    }
+    if (new_size.y == -1) {
+        new_size.y = best_size.y;
+    }
+    
+    SetSize(pos.x, pos.y, new_size.x, new_size.y);
+    
+    UMAShowControl( (ControlHandle) m_macControl ) ;
+    
+    SetCursor( *wxSTANDARD_CURSOR ) ;
+    
+    Refresh() ;
 }
 
 void wxControl::MacAdjustControlRect() 
@@ -496,7 +496,7 @@ void wxControl::MacAdjustControlRect()
 
             m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
         }
-               MacUpdateDimensions() ;      
+          MacUpdateDimensions() ;      
 //        UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height -  2 * m_macVerticalBorder ) ;
     }
 }
@@ -511,19 +511,19 @@ WXWidget wxControl::MacGetContainerForEmbedding()
 
 void wxControl::MacUpdateDimensions() 
 {
-       // actually in the current systems this should never be possible, but later reparenting
-       // may become a reality
-       
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-               
-       if ( GetParent() == NULL )
-               return ;
-               
+    // actually in the current systems this should never be possible, but later reparenting
+    // may become a reality
+    
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+        
+    if ( GetParent() == NULL )
+        return ;
+        
     WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
     if ( rootwindow == NULL )
-       return ;
-       
+        return ;
+        
     Rect oldBounds ;       
     GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ; 
     
@@ -535,23 +535,23 @@ void wxControl::MacUpdateDimensions()
     GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
     bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
     bool doResize =  ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
-       if ( doMove || doResize )
-       {
-               InvalWindowRect( rootwindow, &oldBounds ) ;
-               if ( doMove )
-               {
-                       UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
-               }
-               if ( doResize )
-               {
-                       UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
-               }
-       }
+    if ( doMove || doResize )
+    {
+        InvalWindowRect( rootwindow, &oldBounds ) ;
+        if ( doMove )
+        {
+            UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
+        }
+        if ( doResize )
+        {
+            UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
+        }
+    }
 }
 
 void wxControl::MacSuperChangedPosition() 
 {
-       MacUpdateDimensions() ;
+     MacUpdateDimensions() ;
     wxWindow::MacSuperChangedPosition() ;
 }
 
@@ -561,7 +561,7 @@ void wxControl::MacSuperEnabled( bool enabled )
     wxWindow::MacSuperEnabled( enabled ) ;
 }
 
-void  wxControl::MacSuperShown( bool show ) 
+void wxControl::MacSuperShown( bool show ) 
 {
     if ( (ControlHandle) m_macControl )
     {
@@ -593,19 +593,19 @@ void  wxControl::DoSetSize(int x, int y,
     wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
 #if 0
     {
-       Rect meta , control ;
-       GetControlBounds( (ControlHandle) m_macControl , &control ) ;
-       RgnHandle rgn = NewRgn() ;
-       GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
-       GetRegionBounds( rgn , &meta ) ;
-       if ( !EmptyRect( &meta ) )
-       {
-                       wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
-                       wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
-                       wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
-                       wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
-               }
-       DisposeRgn( rgn ) ;
+        Rect meta , control ;
+        GetControlBounds( (ControlHandle) m_macControl , &control ) ;
+        RgnHandle rgn = NewRgn() ;
+        GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
+        GetRegionBounds( rgn , &meta ) ;
+        if ( !EmptyRect( &meta ) )
+        {
+            wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
+            wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
+            wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
+            wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
+        }
+        DisposeRgn( rgn ) ;
     }
 #endif
     return ;
@@ -814,16 +814,16 @@ void  wxControl::OnKeyDown( wxKeyEvent &event )
     
 #if TARGET_CARBON
 
-       char charCode ;
-       UInt32 keyCode ;        
+    char charCode ;
+    UInt32 keyCode ;    
     UInt32 modifiers ;
 
-       GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
-       GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
-       GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
+    GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
+       GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
 
     ::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
-       
+    
 #else
     EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
     short keycode ;
@@ -895,11 +895,10 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
 
 bool wxControl::MacCanFocus() const
 {
-        { if ( (ControlHandle) m_macControl == NULL ) 
-                return true ; 
-            else
-            return false ; 
-        }
+    if ( (ControlHandle) m_macControl == NULL ) 
+        return true ; 
+    else
+        return false ; 
 }
 
 void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
index df3f6dd7cbfcbee9512af5869b2cbbb117ec1924..79633bf14da10cf8df5decc7b699f5558d375851 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -41,7 +41,7 @@ const short kwxCursorSizeNESW = 22 ;
 const short kwxCursorSizeNWSE = 23 ;
 const short kwxCursorRoller = 24 ;
 
-wxCursor       gMacCurrentCursor ;
+wxCursor    gMacCurrentCursor ;
 
 wxCursorRefData::wxCursorRefData()
 {
@@ -60,15 +60,15 @@ wxCursorRefData::~wxCursorRefData()
     {
         ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
     }
-       else if ( m_disposeHandle )
-       {
-               ::DisposeHandle( (Handle ) m_hCursor ) ;
-       
-       else if ( m_releaseHandle )
-       {
-               // we don't release the resource since it may already
-               // be in use again
-       }
+    else if ( m_disposeHandle )
+    {
+        ::DisposeHandle( (Handle ) m_hCursor ) ;
+    } 
+    else if ( m_releaseHandle )
+    {
+        // we don't release the resource since it may already
+        // be in use again
+    }
 }
 
 // Cursors
@@ -91,14 +91,14 @@ void wxCursor::CreateFromImage(const wxImage & image)
     m_refData = new wxCursorRefData;
 
     wxImage image16 = image.Scale(16,16) ;
-       unsigned char * rgbBits = image16.GetData();
+       unsigned char * rgbBits = image16.GetData();
  
-       
+    
     int w = image16.GetWidth()  ;
     int h = image16.GetHeight() ;
     bool bHasMask = image16.HasMask() ;
 
-       int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
+       int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
     int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
     if (hotSpotX < 0 || hotSpotX >= w)
             hotSpotX = 0;
@@ -112,40 +112,40 @@ void wxCursor::CreateFromImage(const wxImage & image)
     memset( cp->data , 0 , sizeof( Bits16 ) ) ;
     memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
     
-       unsigned char mr = image16.GetMaskRed() ;
-       unsigned char mg = image16.GetMaskGreen() ;
-       unsigned char mb = image16.GetMaskBlue() ;
+    unsigned char mr = image16.GetMaskRed() ;
+    unsigned char mg = image16.GetMaskGreen() ;
+    unsigned char mb = image16.GetMaskBlue() ;
     for ( int y = 0 ; y < h ; ++y )
     {
-       short rowbits = 0 ;
-       short maskbits = 0 ;
-       
-       for ( int x = 0 ; x < w ; ++x )
-       {
-               long pos = (y * w + x) * 3;
+        short rowbits = 0 ;
+        short maskbits = 0 ;
+        
+        for ( int x = 0 ; x < w ; ++x )
+        {
+            long pos = (y * w + x) * 3;
 
-               unsigned char r = rgbBits[pos] ;
-               unsigned char g = rgbBits[pos+1] ;
-               unsigned char b = rgbBits[pos+2] ;
-               if ( bHasMask && r==mr && g==mg && b==mb )
-               {
-                       // masked area, does not appear anywhere
-               }
-               else
-               {
-                       if ( (int)r + (int)g + (int)b < 0x60 )
-                       {
-                               rowbits |= ( 1 << (15-x) ) ;
-                       }
-                       maskbits |= ( 1 << (15-x) ) ;
-               }
-       }
-       cp->data[y] = rowbits ;
-       cp->mask[y] = maskbits ;
+            unsigned char r = rgbBits[pos] ;
+            unsigned char g = rgbBits[pos+1] ;
+            unsigned char b = rgbBits[pos+2] ;
+            if ( bHasMask && r==mr && g==mg && b==mb )
+            {
+                // masked area, does not appear anywhere
+            }
+            else
+            {
+                if ( (int)r + (int)g + (int)b < 0x60 )
+                {
+                    rowbits |= ( 1 << (15-x) ) ;
+                }
+                maskbits |= ( 1 << (15-x) ) ;
+            }
+        }
+        cp->data[y] = rowbits ;
+        cp->mask[y] = maskbits ;
     }
     if ( !bHasMask )
     {
-       memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
+        memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
     }
     
     cp->hotSpot.h = hotSpotX ;
@@ -158,40 +158,40 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
     m_refData = new wxCursorRefData;
     if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
     {
-       Str255 theName ;
+        Str255 theName ;
 
     #if TARGET_CARBON
-       c2pstrcpy( (StringPtr) theName , cursor_file ) ;
+        c2pstrcpy( (StringPtr) theName , cursor_file ) ;
     #else
-       strcpy( (char *) theName , cursor_file ) ;
-       c2pstr( (char *) theName ) ;
+        strcpy( (char *) theName , cursor_file ) ;
+        c2pstr( (char *) theName ) ;
     #endif
-       
+        
         wxStAppResource resload ;
-       Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
-       if ( resHandle )
-       {
-                       short theId = -1 ;
-               OSType theType ;
-               GetResInfo( resHandle , &theId , &theType , theName ) ;
-               ReleaseResource( resHandle ) ;
-               M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
-               if ( M_CURSORDATA->m_hCursor )
-                       M_CURSORDATA->m_isColorCursor = true ;
-       }
-       else
-       {       
-               Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
-               if ( resHandle )
-               {
-                               short theId = -1 ;
-                       OSType theType ;
-                       GetResInfo( resHandle , &theId , &theType , theName ) ;
-                       ReleaseResource( resHandle ) ;
-                       M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
-                       if ( M_CURSORDATA->m_hCursor )
-                               M_CURSORDATA->m_releaseHandle = true ;
-               }
+        Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
+        if ( resHandle )
+        {
+            short theId = -1 ;
+            OSType theType ;
+            GetResInfo( resHandle , &theId , &theType , theName ) ;
+            ReleaseResource( resHandle ) ;
+            M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
+            if ( M_CURSORDATA->m_hCursor )
+                M_CURSORDATA->m_isColorCursor = true ;
+        }
+        else
+        {       
+            Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
+            if ( resHandle )
+            {
+                short theId = -1 ;
+                OSType theType ;
+                GetResInfo( resHandle , &theId , &theType , theName ) ;
+                ReleaseResource( resHandle ) ;
+                 M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
+                if ( M_CURSORDATA->m_hCursor )
+                    M_CURSORDATA->m_releaseHandle = true ;
+            }
         }
     }
     else
@@ -211,155 +211,155 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
 // Cursors by stock number
 wxCursor::wxCursor(int cursor_type)
 {
-  m_refData = new wxCursorRefData;
-
-  switch (cursor_type)
-  {
+    m_refData = new wxCursorRefData;
+    
+    switch (cursor_type)
+    {
     case wxCURSOR_WAIT:
-      M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
-      break;
+        M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
+        break;
     case wxCURSOR_IBEAM:
-      M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
-      break;
+        M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
+        break;
     case wxCURSOR_CROSS:
-      M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
-      break;
+        M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
+        break;
     case wxCURSOR_SIZENWSE:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
-      }
-      break;
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
+        }
+        break;
     case wxCURSOR_SIZENESW:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
-      }
-      break;
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
+        }
+        break;
     case wxCURSOR_SIZEWE:
-      {
-       M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
-      }
-      break;
+        {
+            M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
+        }
+        break;
     case wxCURSOR_SIZENS:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
-      }
-      break;
-   case wxCURSOR_SIZING:
-      {
-        wxStAppResource resload ;
-        M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
-      }
-      break;
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
+        }
+        break;
+    case wxCURSOR_SIZING:
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
+        }
+        break;
     case wxCURSOR_HAND:
-      {
-        M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
-      }
-      break;
+        {
+            M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
+        }
+        break;
     case wxCURSOR_BULLSEYE:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
         }
         break;
     case wxCURSOR_PENCIL:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
         }
         break;
     case wxCURSOR_MAGNIFIER:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
         }
         break;
     case wxCURSOR_NO_ENTRY:
         {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
         }
         break;
     case wxCURSOR_WATCH:
-    {
-      M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
-      break;
-    }
+        {
+            M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
+            break;
+        }
     case wxCURSOR_PAINT_BRUSH:
-    {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
+            break;
+        }
     case wxCURSOR_POINT_LEFT:
-    {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
+            break;
+        }
     case wxCURSOR_POINT_RIGHT:
-    {
-          wxStAppResource resload ;
-          M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
+            break;
+        }
     case wxCURSOR_QUESTION_ARROW:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
+            break;
+        }
     case wxCURSOR_BLANK:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
+            break;
+        }
     case wxCURSOR_RIGHT_ARROW:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
+            break;
+        }
     case wxCURSOR_SPRAYCAN:
-    {
-      wxStAppResource resload ;
-      M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
-      break;
-    }
+        {
+            wxStAppResource resload ;
+            M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
+            break;
+        }
     case wxCURSOR_CHAR:
     case wxCURSOR_ARROW:
     case wxCURSOR_LEFT_BUTTON:
     case wxCURSOR_RIGHT_BUTTON:
     case wxCURSOR_MIDDLE_BUTTON:
-     default:
-      M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
-      break;
-       }
-       if ( M_CURSORDATA->m_themeCursor == -1 )
-               M_CURSORDATA->m_releaseHandle = true ;
+    default:
+        M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
+        break;
+    }
+    if ( M_CURSORDATA->m_themeCursor == -1 )
+        M_CURSORDATA->m_releaseHandle = true ;
 }
 
 void wxCursor::MacInstall() const 
 {
-       gMacCurrentCursor = *this ;
-       if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
-       {
-               SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
-       }
-       else if ( m_refData && M_CURSORDATA->m_hCursor )
-       {
-           if ( M_CURSORDATA->m_isColorCursor )
-                   ::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
-           else
-                   ::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
-       }
-       else
-       {
-               SetThemeCursor( kThemeArrowCursor ) ;
-       }
+    gMacCurrentCursor = *this ;
+    if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
+    {
+        SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
+    }
+    else if ( m_refData && M_CURSORDATA->m_hCursor )
+    {
+        if ( M_CURSORDATA->m_isColorCursor )
+            ::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
+        else
+            ::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
+    }
+    else
+    {
+        SetThemeCursor( kThemeArrowCursor ) ;
+    }
 }
 
 wxCursor::~wxCursor()
@@ -369,7 +369,7 @@ wxCursor::~wxCursor()
 // Global cursor setting
 void wxSetCursor(const wxCursor& cursor)
 {
-       cursor.MacInstall() ;
+    cursor.MacInstall() ;
 }
 
 
index c6471c8b0bfbd8a113f38a4188bf376dceaba2bd..6b56b896dcfbfa8b4e5f53f716a3513e85e4f921 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -137,7 +137,7 @@ const wxChar *wxDoubleToStringStr = wxT("%.2f");
 const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
 
 const wxEventTable wxEvtHandler::sm_eventTable =
-       { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
+    { NULL, &wxEvtHandler::sm_eventTableEntries[0] };
 
 const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
 #endif
index 3d6437c7b743c73646dd0d5d4533f3708f4cd96e..15377f7f5b0644fa060758504d1461077c803d99 100644 (file)
@@ -141,7 +141,7 @@ bool wxDataObject::IsSupportedFormat(
     }
     else
     {
-        wxDataFormat*               pFormats = new wxDataFormat[nFormatCount];
+        wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
         GetAllFormats( pFormats
                       ,vDir
                      );
@@ -183,7 +183,7 @@ bool wxFileDataObject::GetDataHere(
 
 size_t wxFileDataObject::GetDataSize() const
 {
-    size_t                          nRes = 0;
+    size_t nRes = 0;
 
     for (size_t i = 0; i < m_filenames.GetCount(); i++)
     {
@@ -201,7 +201,7 @@ bool wxFileDataObject::SetData(
 {
     m_filenames.Empty();
 
-    wxString                        sFile( (const char *)pBuf);  /* char, not wxChar */
+    wxString sFile( (const char *)pBuf);  /* char, not wxChar */
 
     AddFile(sFile);
 
@@ -225,15 +225,15 @@ wxBitmapDataObject::wxBitmapDataObject()
 }
 
 wxBitmapDataObject::wxBitmapDataObject(
-  const wxBitmap&                   rBitmap
+  const wxBitmap& rBitmap
 )
 : wxBitmapDataObjectBase(rBitmap)
 {
     Init();
     if ( m_bitmap.Ok() )
     {
-               m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
-       }
+        m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
+    }
 }
 
 wxBitmapDataObject::~wxBitmapDataObject()
@@ -249,23 +249,23 @@ void wxBitmapDataObject::SetBitmap(
     wxBitmapDataObjectBase::SetBitmap(rBitmap);
     if ( m_bitmap.Ok() )
     {
-               m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
-       }
+        m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
+    }
 }
 
 void wxBitmapDataObject::Init() 
 { 
-       m_pictHandle = NULL ;
-       m_pictCreated = false ;
+    m_pictHandle = NULL ;
+    m_pictCreated = false ;
 } 
 
 void wxBitmapDataObject::Clear() 
 {
-       if ( m_pictCreated && m_pictHandle )
-       {
-               KillPicture( (PicHandle) m_pictHandle ) ;
-       }
-       m_pictHandle = NULL ;
+    if ( m_pictCreated && m_pictHandle )
+    {
+        KillPicture( (PicHandle) m_pictHandle ) ;
+    }
+    m_pictHandle = NULL ;
 }
 
 bool wxBitmapDataObject::GetDataHere(
@@ -283,7 +283,7 @@ bool wxBitmapDataObject::GetDataHere(
 
 size_t wxBitmapDataObject::GetDataSize() const
 {
-       return GetHandleSize((Handle)m_pictHandle) ;
+    return GetHandleSize((Handle)m_pictHandle) ;
 }
 
 bool wxBitmapDataObject::SetData(
@@ -299,7 +299,7 @@ bool wxBitmapDataObject::SetData(
     Rect frame = (**picHandle).picFrame ;
     
     m_bitmap.SetPict( picHandle ) ;
-       m_bitmap.SetWidth( frame.right - frame.left ) ;
-       m_bitmap.SetHeight( frame.bottom - frame.top ) ;
+    m_bitmap.SetWidth( frame.right - frame.left ) ;
+    m_bitmap.SetHeight( frame.bottom - frame.top ) ;
     return m_bitmap.Ok();
 }
index 9e84d5f4aa7ac7215d08f95b06bb542ca27e086f..9dff84e4d3800fe11a16ff5d6fcb1b377d9335f6 100644 (file)
@@ -6,11 +6,13 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 #pragma implementation "dc.h"
 #endif
+
 #include "wx/dc.h"
 #include "wx/app.h"
 #include "wx/mac/uma.h"
@@ -30,32 +32,37 @@ using namespace std ;
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 #endif
+
 //-----------------------------------------------------------------------------
 // constants
 //-----------------------------------------------------------------------------
-#define mm2inches              0.0393700787402
-#define inches2mm              25.4
-#define mm2twips               56.6929133859
-#define twips2mm               0.0176388888889
-#define mm2pt                  2.83464566929
-#define pt2mm                  0.352777777778
+
+#define mm2inches        0.0393700787402
+#define inches2mm        25.4
+#define mm2twips        56.6929133859
+#define twips2mm        0.0176388888889
+#define mm2pt            2.83464566929
+#define pt2mm            0.352777777778
 #ifndef __DARWIN__
 const double M_PI = 3.14159265358979 ;
 #endif
 const double RAD2DEG  = 180.0 / M_PI;
 const short kEmulatedMode = -1 ;
 const short kUnsupportedMode = -2 ;
+
 wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) :
-       m_ph( (GrafPtr) dc->m_macPort )
+    m_ph( (GrafPtr) dc->m_macPort )
 {
-       wxASSERT( dc->Ok() ) ;
-       m_dc = dc ;
-       dc->MacSetupPort(&m_ph) ;
+    wxASSERT( dc->Ok() ) ;
+    m_dc = dc ;
+    dc->MacSetupPort(&m_ph) ;
 }
+
 wxMacPortSetter::~wxMacPortSetter()
 {
-       m_dc->MacCleanupPort(&m_ph) ;
+    m_dc->MacCleanupPort(&m_ph) ;
 }
+
 wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) 
 {
     m_formerClip = NewRgn() ;
@@ -65,21 +72,21 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
     if ( win )
     {
 #if 0
-       // this clipping area was set to the parent window's drawing area, lead to problems
-       // with MacOSX controls drawing outside their wx' rectangle
+        // this clipping area was set to the parent window's drawing area, lead to problems
+        // with MacOSX controls drawing outside their wx' rectangle
         RgnHandle insidergn = NewRgn() ;
         int x = 0 , y = 0;
         wxWindow *parent = win->GetParent() ;
         parent->MacWindowToRootWindow( &x,&y ) ;
         wxSize size = parent->GetSize() ;
         SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() , 
-         size.x - parent->MacGetRightBorderSize(), 
-         size.y - parent->MacGetBottomBorderSize()) ;
+            size.x - parent->MacGetRightBorderSize(), 
+            size.y - parent->MacGetBottomBorderSize()) ;
         CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , m_newClip ) ;
-       SectRgn( m_newClip , insidergn , m_newClip ) ;
+        SectRgn( m_newClip , insidergn , m_newClip ) ;
         OffsetRgn( m_newClip , x , y ) ;
         SetClip( m_newClip ) ;
-       DisposeRgn( insidergn ) ;
+        DisposeRgn( insidergn ) ;
 #endif
         RgnHandle insidergn = NewRgn() ;
         int x = 0 , y = 0;
@@ -87,138 +94,143 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
         CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion().GetWXHRGN() , m_newClip ) ;
         OffsetRgn( m_newClip , x , y ) ;
         SetClip( m_newClip ) ;
-       }
+    }
 }
+
 wxMacWindowClipper::~wxMacWindowClipper() 
 {
     SetClip( m_formerClip ) ;
-       DisposeRgn( m_newClip ) ;
-       DisposeRgn( m_formerClip ) ;
+    DisposeRgn( m_newClip ) ;
+    DisposeRgn( m_formerClip ) ;
 }
+
 //-----------------------------------------------------------------------------
 // Local functions
 //-----------------------------------------------------------------------------
 static inline double dmin(double a, double b) { return a < b ? a : b; }
 static inline double dmax(double a, double b) { return a > b ? a : b; }
 static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
+
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
 // this function emulates all wx colour manipulations, used to verify the implementation
 // by setting the mode in the blitting functions to kEmulatedMode
 void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColor &dstColor ) ;
+
 void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColor &dstColor )
 {
     switch ( logical_func )
     {
-       case wxAND:        // src AND dst
-           dstColor.red = dstColor.red & srcColor.red ;
-           dstColor.green = dstColor.green & srcColor.green ;
-           dstColor.blue = dstColor.blue & srcColor.blue ;
-           break ;
-       case wxAND_INVERT: // (NOT src) AND dst
-           dstColor.red = dstColor.red & ~srcColor.red ;
-           dstColor.green = dstColor.green & ~srcColor.green ;
-           dstColor.blue = dstColor.blue & ~srcColor.blue ;
-           break ;
-       case wxAND_REVERSE:// src AND (NOT dst)
-           dstColor.red = ~dstColor.red & srcColor.red ;
-           dstColor.green = ~dstColor.green & srcColor.green ;
-           dstColor.blue = ~dstColor.blue & srcColor.blue ;
-           break ;
-       case wxCLEAR:      // 0
-           dstColor.red = 0 ;
-           dstColor.green = 0 ;
-           dstColor.blue = 0 ;
-           break ;
+        case wxAND:        // src AND dst
+            dstColor.red = dstColor.red & srcColor.red ;
+            dstColor.green = dstColor.green & srcColor.green ;
+            dstColor.blue = dstColor.blue & srcColor.blue ;
+            break ;
+        case wxAND_INVERT: // (NOT src) AND dst
+            dstColor.red = dstColor.red & ~srcColor.red ;
+            dstColor.green = dstColor.green & ~srcColor.green ;
+            dstColor.blue = dstColor.blue & ~srcColor.blue ;
+            break ;
+        case wxAND_REVERSE:// src AND (NOT dst)
+            dstColor.red = ~dstColor.red & srcColor.red ;
+            dstColor.green = ~dstColor.green & srcColor.green ;
+            dstColor.blue = ~dstColor.blue & srcColor.blue ;
+            break ;
+        case wxCLEAR:      // 0
+            dstColor.red = 0 ;
+            dstColor.green = 0 ;
+            dstColor.blue = 0 ;
+            break ;
         case wxCOPY:       // src
-           dstColor.red = srcColor.red ;
-           dstColor.green = srcColor.green ;
-           dstColor.blue = srcColor.blue ;
-               break ;
-       case wxEQUIV:      // (NOT src) XOR dst
-           dstColor.red = dstColor.red ^ ~srcColor.red ;
-           dstColor.green = dstColor.green ^ ~srcColor.green ;
-           dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
-           break ;
-       case wxINVERT:     // NOT dst
-           dstColor.red = ~dstColor.red ;
-           dstColor.green = ~dstColor.green ;
-           dstColor.blue = ~dstColor.blue ;
-               break ;
-       case wxNAND:       // (NOT src) OR (NOT dst)
-           dstColor.red = ~dstColor.red | ~srcColor.red ;
-           dstColor.green = ~dstColor.green | ~srcColor.green ;
-           dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
-           break ;
-       case wxNOR:        // (NOT src) AND (NOT dst)
-           dstColor.red = ~dstColor.red & ~srcColor.red ;
-           dstColor.green = ~dstColor.green & ~srcColor.green ;
-           dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
-           break ;
-       case wxNO_OP:      // dst
-           break ;
-       case wxOR:         // src OR dst
-           dstColor.red = dstColor.red | srcColor.red ;
-           dstColor.green = dstColor.green | srcColor.green ;
-           dstColor.blue = dstColor.blue | srcColor.blue ;
-           break ;
-       case wxOR_INVERT:  // (NOT src) OR dst
-           dstColor.red = dstColor.red | ~srcColor.red ;
-           dstColor.green = dstColor.green | ~srcColor.green ;
-           dstColor.blue = dstColor.blue | ~srcColor.blue ;
-           break ;
-       case wxOR_REVERSE: // src OR (NOT dst)
-           dstColor.red = ~dstColor.red | srcColor.red ;
-           dstColor.green = ~dstColor.green | srcColor.green ;
-           dstColor.blue = ~dstColor.blue | srcColor.blue ;
-               break ;
-       case wxSET:        // 1
-           dstColor.red = 0xFFFF ;
-           dstColor.green = 0xFFFF ;
-           dstColor.blue = 0xFFFF ;
-           break ;
-       case wxSRC_INVERT: // (NOT src)
-           dstColor.red = ~srcColor.red ;
-           dstColor.green = ~srcColor.green ;
-           dstColor.blue = ~srcColor.blue ;
-               break ;
-       case wxXOR:        // src XOR dst
-           dstColor.red = dstColor.red ^ srcColor.red ;
-           dstColor.green = dstColor.green ^ srcColor.green ;
-           dstColor.blue = dstColor.blue ^ srcColor.blue ;
-               break ;
+            dstColor.red = srcColor.red ;
+            dstColor.green = srcColor.green ;
+            dstColor.blue = srcColor.blue ;
+            break ;
+        case wxEQUIV:      // (NOT src) XOR dst
+            dstColor.red = dstColor.red ^ ~srcColor.red ;
+            dstColor.green = dstColor.green ^ ~srcColor.green ;
+            dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
+            break ;
+        case wxINVERT:     // NOT dst
+            dstColor.red = ~dstColor.red ;
+            dstColor.green = ~dstColor.green ;
+            dstColor.blue = ~dstColor.blue ;
+            break ;
+        case wxNAND:       // (NOT src) OR (NOT dst)
+            dstColor.red = ~dstColor.red | ~srcColor.red ;
+            dstColor.green = ~dstColor.green | ~srcColor.green ;
+            dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
+            break ;
+        case wxNOR:        // (NOT src) AND (NOT dst)
+            dstColor.red = ~dstColor.red & ~srcColor.red ;
+            dstColor.green = ~dstColor.green & ~srcColor.green ;
+            dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
+            break ;
+        case wxNO_OP:      // dst
+            break ;
+        case wxOR:         // src OR dst
+            dstColor.red = dstColor.red | srcColor.red ;
+            dstColor.green = dstColor.green | srcColor.green ;
+            dstColor.blue = dstColor.blue | srcColor.blue ;
+            break ;
+        case wxOR_INVERT:  // (NOT src) OR dst
+            dstColor.red = dstColor.red | ~srcColor.red ;
+            dstColor.green = dstColor.green | ~srcColor.green ;
+            dstColor.blue = dstColor.blue | ~srcColor.blue ;
+            break ;
+        case wxOR_REVERSE: // src OR (NOT dst)
+            dstColor.red = ~dstColor.red | srcColor.red ;
+            dstColor.green = ~dstColor.green | srcColor.green ;
+            dstColor.blue = ~dstColor.blue | srcColor.blue ;
+            break ;
+        case wxSET:        // 1
+            dstColor.red = 0xFFFF ;
+            dstColor.green = 0xFFFF ;
+            dstColor.blue = 0xFFFF ;
+            break ;
+        case wxSRC_INVERT: // (NOT src)
+            dstColor.red = ~srcColor.red ;
+            dstColor.green = ~srcColor.green ;
+            dstColor.blue = ~srcColor.blue ;
+            break ;
+        case wxXOR:        // src XOR dst
+            dstColor.red = dstColor.red ^ srcColor.red ;
+            dstColor.green = dstColor.green ^ srcColor.green ;
+            dstColor.blue = dstColor.blue ^ srcColor.blue ;
+            break ;
     }
 }
+
 wxDC::wxDC()
 {
-  m_ok = FALSE;
-  m_colour = TRUE;
-  m_mm_to_pix_x = mm2pt;
-  m_mm_to_pix_y = mm2pt;
-  m_internalDeviceOriginX = 0;
-  m_internalDeviceOriginY = 0;
-  m_externalDeviceOriginX = 0;
-  m_externalDeviceOriginY = 0;
-  m_logicalScaleX = 1.0;
-  m_logicalScaleY = 1.0;
-  m_userScaleX = 1.0;
-  m_userScaleY = 1.0;
-  m_scaleX = 1.0;
-  m_scaleY = 1.0;
-  m_needComputeScaleX = FALSE;
-  m_needComputeScaleY = FALSE;
-  m_macPort = NULL ;
-  m_macMask = NULL ;
-  m_ok = FALSE ;
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
-       m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
-       m_macBoundaryClipRgn = NewRgn() ;
-       m_macCurrentClipRgn = NewRgn() ;
-       SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
-       SetRectRgn( (RgnHandle) m_macCurrentClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
+    m_ok = FALSE;
+    m_colour = TRUE;
+    m_mm_to_pix_x = mm2pt;
+    m_mm_to_pix_y = mm2pt;
+    m_internalDeviceOriginX = 0;
+    m_internalDeviceOriginY = 0;
+    m_externalDeviceOriginX = 0;
+    m_externalDeviceOriginY = 0;
+    m_logicalScaleX = 1.0;
+    m_logicalScaleY = 1.0;
+    m_userScaleX = 1.0;
+    m_userScaleY = 1.0;
+    m_scaleX = 1.0;
+    m_scaleY = 1.0;
+    m_needComputeScaleX = FALSE;
+    m_needComputeScaleY = FALSE;
+    m_macPort = NULL ;
+    m_macMask = NULL ;
+    m_ok = FALSE ;
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
+    m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
+    m_macBoundaryClipRgn = NewRgn() ;
+    m_macCurrentClipRgn = NewRgn() ;
+    SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
+    SetRectRgn( (RgnHandle) m_macCurrentClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
     m_pen = *wxBLACK_PEN;
     m_font = *wxNORMAL_FONT;
     m_brush = *wxWHITE_BRUSH;
@@ -228,20 +240,23 @@ wxDC::wxDC()
     m_macForegroundPixMap = NULL ;
     m_macBackgroundPixMap = NULL ;
 }
+
 wxDC::~wxDC(void)
 {
     DisposeRgn( (RgnHandle) m_macBoundaryClipRgn ) ;
     DisposeRgn( (RgnHandle) m_macCurrentClipRgn ) ;
 }
+
 void wxDC::MacSetupPort(wxMacPortStateHelper* help) const
 {
     wxASSERT( m_macCurrentPortStateHelper == NULL ) ;
     m_macCurrentPortStateHelper = help ;
-       SetClip( (RgnHandle) m_macCurrentClipRgn);
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
+    SetClip( (RgnHandle) m_macCurrentClipRgn);
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
 }
+
 void wxDC::MacCleanupPort(wxMacPortStateHelper* help) const
 {
     wxASSERT( m_macCurrentPortStateHelper == help ) ;
@@ -271,6 +286,7 @@ void wxDC::MacCleanupPort(wxMacPortStateHelper* help) const
         m_macBackgroundPixMap = NULL ;
     }
 }
+
 void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
 {
      wxCHECK_RET( Ok(), wxT("invalid window dc") );
@@ -356,12 +372,14 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
      m_macBrushInstalled = false ;
      m_macFontInstalled = false ;
 }
+
 void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
 {
-     wxCHECK_RET(Ok(), wxT("Invalid dc  wxDC::DoDrawIcon"));
-     wxCHECK_RET(icon.Ok(), wxT("Invalid icon wxDC::DoDrawIcon"));
+    wxCHECK_RET(Ok(), wxT("Invalid dc  wxDC::DoDrawIcon"));
+    wxCHECK_RET(icon.Ok(), wxT("Invalid icon wxDC::DoDrawIcon"));
     DoDrawBitmap( icon , x , y , icon.GetMask() != NULL ) ;
 }
+
 void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion  Invalid DC"));
@@ -388,10 +406,11 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
         m_clipY2 = yy + hh;
     }
 }
+
 void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
 {
     wxCHECK_RET( Ok(), wxT("invalid window dc") ) ;
-       wxMacPortSetter helper(this) ;
+      wxMacPortSetter helper(this) ;
     if (region.Empty())
     {
         DestroyClippingRegion();
@@ -435,113 +454,127 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
         }
     }
 }
+
 void wxDC::DestroyClippingRegion()
 {
-  wxMacPortSetter helper(this) ;
-  CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
-  m_clipping = FALSE;
+    wxMacPortSetter helper(this) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_clipping = FALSE;
 }
+
 void wxDC::DoGetSize( int* width, int* height ) const
 {
-  *width = m_maxX-m_minX;
-  *height = m_maxY-m_minY;
+    *width = m_maxX-m_minX;
+    *height = m_maxY-m_minY;
 }
+
 void wxDC::DoGetSizeMM( int* width, int* height ) const
 {
-  int w = 0;
-  int h = 0;
-  GetSize( &w, &h );
-  *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
-  *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
+    int w = 0;
+    int h = 0;
+    GetSize( &w, &h );
+    *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
+    *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
 }
+
 void wxDC::SetTextForeground( const wxColour &col )
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     m_textForegroundColour = col;
     m_macFontInstalled = false ;
 }
+
 void wxDC::SetTextBackground( const wxColour &col )
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     m_textBackgroundColour = col;
     m_macFontInstalled = false ;
 }
+
 void wxDC::SetMapMode( int mode )
 {
-  switch (mode)
-  {
+    switch (mode)
+    {
     case wxMM_TWIPS:
-      SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-      break;
+        SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
+        break;
     case wxMM_POINTS:
-      SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-      break;
+        SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
+        break;
     case wxMM_METRIC:
-      SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-      break;
+        SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
+        break;
     case wxMM_LOMETRIC:
-      SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-      break;
+        SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
+        break;
     default:
     case wxMM_TEXT:
-      SetLogicalScale( 1.0, 1.0 );
-      break;
-  }
-  if (mode != wxMM_TEXT)
-  {
-    m_needComputeScaleX = TRUE;
-    m_needComputeScaleY = TRUE;
-  }
+        SetLogicalScale( 1.0, 1.0 );
+        break;
+    }
+    if (mode != wxMM_TEXT)
+    {
+        m_needComputeScaleX = TRUE;
+        m_needComputeScaleY = TRUE;
+    }
 }
+
 void wxDC::SetUserScale( double x, double y )
 {
-  // allow negative ? -> no
-  m_userScaleX = x;
-  m_userScaleY = y;
-  ComputeScaleAndOrigin();
+    // allow negative ? -> no
+    m_userScaleX = x;
+    m_userScaleY = y;
+    ComputeScaleAndOrigin();
 }
+
 void wxDC::SetLogicalScale( double x, double y )
 {
-  // allow negative ?
-  m_logicalScaleX = x;
-  m_logicalScaleY = y;
-  ComputeScaleAndOrigin();
+    // allow negative ?
+    m_logicalScaleX = x;
+    m_logicalScaleY = y;
+    ComputeScaleAndOrigin();
 }
+
 void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
 {
-  m_logicalOriginX = x * m_signX;   // is this still correct ?
-  m_logicalOriginY = y * m_signY;
-  ComputeScaleAndOrigin();
+    m_logicalOriginX = x * m_signX;   // is this still correct ?
+    m_logicalOriginY = y * m_signY;
+    ComputeScaleAndOrigin();
 }
+
 void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
 {
-  m_externalDeviceOriginX = x;
-  m_externalDeviceOriginY = y;
-  ComputeScaleAndOrigin();
+    m_externalDeviceOriginX = x;
+    m_externalDeviceOriginY = y;
+    ComputeScaleAndOrigin();
 }
+
 #if 0
 void wxDC::SetInternalDeviceOrigin( long x, long y )
 {
-  m_internalDeviceOriginX = x;
-  m_internalDeviceOriginY = y;
-  ComputeScaleAndOrigin();
+    m_internalDeviceOriginX = x;
+    m_internalDeviceOriginY = y;
+    ComputeScaleAndOrigin();
 }
 void wxDC::GetInternalDeviceOrigin( long *x, long *y )
 {
-  if (x) *x = m_internalDeviceOriginX;
-  if (y) *y = m_internalDeviceOriginY;
+    if (x) *x = m_internalDeviceOriginX;
+    if (y) *y = m_internalDeviceOriginY;
 }
 #endif
+
 void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
-  m_signX = (xLeftRight ?  1 : -1);
-  m_signY = (yBottomUp  ? -1 :  1);
-  ComputeScaleAndOrigin();
+    m_signX = (xLeftRight ?  1 : -1);
+    m_signY = (yBottomUp  ? -1 :  1);
+    ComputeScaleAndOrigin();
 }
+
 wxSize wxDC::GetPPI() const
 {
     return wxSize(72, 72);
 }
+
 int wxDC::GetDepth() const
 {
     if ( IsPortColor( (CGrafPtr) m_macPort ) )
@@ -550,77 +583,88 @@ int wxDC::GetDepth() const
     }
     return 1 ;
 }
+
 void wxDC::ComputeScaleAndOrigin()
 {
-  // CMB: copy scale to see if it changes
-  double origScaleX = m_scaleX;
-  double origScaleY = m_scaleY;
-  m_scaleX = m_logicalScaleX * m_userScaleX;
-  m_scaleY = m_logicalScaleY * m_userScaleY;
-  m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
-  m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
-  // CMB: if scale has changed call SetPen to recalulate the line width
-  if (m_scaleX != origScaleX || m_scaleY != origScaleY)
-  {
-    // this is a bit artificial, but we need to force wxDC to think
-    // the pen has changed
-    wxPen* pen = & GetPen();
-    wxPen tempPen;
-    m_pen = tempPen;
-    SetPen(* pen);
-  }
+    // CMB: copy scale to see if it changes
+    double origScaleX = m_scaleX;
+    double origScaleY = m_scaleY;
+    m_scaleX = m_logicalScaleX * m_userScaleX;
+    m_scaleY = m_logicalScaleY * m_userScaleY;
+    m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
+    m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
+    // CMB: if scale has changed call SetPen to recalulate the line width
+    if (m_scaleX != origScaleX || m_scaleY != origScaleY)
+    {
+        // this is a bit artificial, but we need to force wxDC to think
+        // the pen has changed
+        wxPen* pen = & GetPen();
+        wxPen tempPen;
+        m_pen = tempPen;
+        SetPen(* pen);
+    }
 }
+
 void  wxDC::SetPalette( const wxPalette& palette )
 {
 }
+
 void  wxDC::SetBackgroundMode( int mode )
 {
-       m_backgroundMode = mode ;
+    m_backgroundMode = mode ;
 }
+
 void  wxDC::SetFont( const wxFont &font )
 {
     m_font = font;
     m_macFontInstalled = false ;
 }
+
 void  wxDC::SetPen( const wxPen &pen )
 {
-       if ( m_pen == pen )
-               return ;
-  m_pen = pen;
-  m_macPenInstalled = false ;
+    if ( m_pen == pen )
+        return ;
+    m_pen = pen;
+    m_macPenInstalled = false ;
 }
+
 void  wxDC::SetBrush( const wxBrush &brush )
 {
-  if (m_brush == brush)
-       return;
-  m_brush = brush;
-  m_macBrushInstalled = false ;
+    if (m_brush == brush)
+        return;
+    m_brush = brush;
+    m_macBrushInstalled = false ;
 }
+
 void  wxDC::SetBackground( const wxBrush &brush )
 {
-  if (m_backgroundBrush == brush)
-       return;
-  m_backgroundBrush = brush;
-  if (!m_backgroundBrush.Ok())
-       return;
-   m_macBrushInstalled = false ;
+    if (m_backgroundBrush == brush)
+        return;
+    m_backgroundBrush = brush;
+    if (!m_backgroundBrush.Ok())
+        return;
+    m_macBrushInstalled = false ;
 }
+
 void  wxDC::SetLogicalFunction( int function )
 {
-       if (m_logicalFunction == function)
-               return;
-       m_logicalFunction = function ;
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
+    if (m_logicalFunction == function)
+        return;
+    m_logicalFunction = function ;
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
 }
+
 extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
                           const wxColour & col, int style);
+
 bool wxDC::DoFloodFill(wxCoord x, wxCoord y,
                        const wxColour& col, int style)
 {
     return wxDoFloodFill(this, x, y, col, style);
 }
+
 bool  wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
 {
     wxCHECK_MSG( Ok(), false, wxT("wxDC::DoGetPixel  Invalid DC") );
@@ -629,47 +673,49 @@ bool  wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
     GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
     // Convert from Mac colour to wx
     col->Set( colour.red   >> 8,
-              colour.green >> 8,
-              colour.blue  >> 8);
+        colour.green >> 8,
+        colour.blue  >> 8);
     return true ;
 }
+
 void  wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
 {
-  wxCHECK_RET(Ok(), wxT("Invalid DC"));
-  wxMacPortSetter helper(this) ;
-  if (m_pen.GetStyle() != wxTRANSPARENT)
-  {
-               MacInstallPen() ;
-               wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
-                            m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
+        m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
         wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
         wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
         wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
         wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
         if ((m_pen.GetCap() == wxCAP_ROUND) &&
             (m_pen.GetWidth() <= 1))
-       {
-           // Implement LAST_NOT for MAC at least for
-           // orthogonal lines. RR.
-               if (xx1 == xx2)
-               {
-                       if (yy1 < yy2)
-                               yy2--;
-                   if (yy1 > yy2)
-                       yy2++;
-               }
-               if (yy1 == yy2)
-               {
-                       if (xx1 < xx2)
-                               xx2--;
-                   if (xx1 > xx2)
-                       xx2++;
-               }
-       }
-               ::MoveTo(xx1, yy1);
-               ::LineTo(xx2, yy2);
-  }
+        {
+            // Implement LAST_NOT for MAC at least for
+            // orthogonal lines. RR.
+            if (xx1 == xx2)
+            {
+                if (yy1 < yy2)
+                    yy2--;
+                if (yy1 > yy2)
+                    yy2++;
+            }
+            if (yy1 == yy2)
+            {
+                if (xx1 < xx2)
+                    xx2--;
+                if (xx1 > xx2)
+                    xx2++;
+            }
+        }
+        ::MoveTo(xx1, yy1);
+        ::LineTo(xx2, yy2);
+    }
 }
+
 void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
 {
     wxCHECK_RET( Ok(), wxT("wxDC::DoCrossHair  Invalid window dc") );
@@ -690,14 +736,16 @@ void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
         CalcBoundingBox(x+w, y+h);
     }
 }
+
 /*
- * To draw arcs properly the angles need to be converted from the WX style:
- * Angles start on the +ve X axis and go anti-clockwise (As you would draw on
- * a normal axis on paper).
- * TO
- * the Mac style:
- * Angles start on the +ve y axis and go clockwise.
- */
+* To draw arcs properly the angles need to be converted from the WX style:
+* Angles start on the +ve X axis and go anti-clockwise (As you would draw on
+* a normal axis on paper).
+* TO
+* the Mac style:
+* Angles start on the +ve y axis and go clockwise.
+*/
+
 static double wxConvertWXangleToMACangle(double angle)
 {
     double newAngle = 90 - angle ;
@@ -705,9 +753,10 @@ static double wxConvertWXangleToMACangle(double angle)
         newAngle += 360 ;
     return newAngle ;
 }
+
 void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
-                           wxCoord x2, wxCoord y2,
-                           wxCoord xc, wxCoord yc )
+                      wxCoord x2, wxCoord y2,
+                      wxCoord xc, wxCoord yc )
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc  Invalid DC"));
     wxMacPortSetter helper(this) ;
@@ -735,14 +784,14 @@ void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
     {
         radius1 = (xx1 - xxc == 0) ?
             (yy1 - yyc < 0) ? 90.0 : -90.0 :
-            -atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
-         radius2 = (xx2 - xxc == 0) ?
+        -atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
+        radius2 = (xx2 - xxc == 0) ?
             (yy2 - yyc < 0) ? 90.0 : -90.0 :
-            -atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
-     }
-     wxCoord alpha2 = wxCoord(radius2 - radius1);
+        -atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
+    }
+    wxCoord alpha2 = wxCoord(radius2 - radius1);
     wxCoord alpha1 = wxCoord(wxConvertWXangleToMACangle(radius1));
-     if( (xx1 > xx2) || (yy1 > yy2) ) {
+    if( (xx1 > xx2) || (yy1 > yy2) ) {
         alpha2 *= -1;
     }
     Rect r = { yyc - rad, xxc - rad, yyc + rad, xxc + rad };
@@ -755,8 +804,9 @@ void  wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
         FrameArc(&r, alpha1, alpha2);
     }
 }
+
 void  wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
-                                   double sa, double ea )
+                              double sa, double ea )
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawEllepticArc  Invalid DC"));
     wxMacPortSetter helper(this) ;
@@ -786,193 +836,198 @@ void  wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
         FrameArc(&r, (short)sa, (short)angle);
     }
 }
+
 void  wxDC::DoDrawPoint( wxCoord x, wxCoord y )
 {
-  wxCHECK_RET(Ok(), wxT("Invalid DC"));
-  wxMacPortSetter helper(this) ;
-  if (m_pen.GetStyle() != wxTRANSPARENT)
-  {
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
         wxCoord xx1 = XLOG2DEVMAC(x);
         wxCoord yy1 = YLOG2DEVMAC(y);
         RGBColor pencolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
         ::SetCPixel( xx1,yy1,&pencolor) ;
         CalcBoundingBox(x, y);
-  }
+    }
 }
+
 void  wxDC::DoDrawLines(int n, wxPoint points[],
-                             wxCoord xoffset, wxCoord yoffset)
-{
-  wxCHECK_RET(Ok(), wxT("Invalid DC"));
-  wxMacPortSetter helper(this) ;
-  if (m_pen.GetStyle() == wxTRANSPARENT)
-       return;
-  MacInstallPen() ;
-  wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
-                      m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
-  wxCoord x1, x2 , y1 , y2 ;
-  x1 = XLOG2DEVMAC(points[0].x + xoffset);
-  y1 = YLOG2DEVMAC(points[0].y + yoffset);
-  ::MoveTo(x1 - offset, y1 - offset );
-  for (int i = 0; i < n-1; i++)
-  {
-    x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
-    y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
-    ::LineTo( x2 - offset, y2 - offset );
-  }
+                        wxCoord xoffset, wxCoord yoffset)
+{
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    if (m_pen.GetStyle() == wxTRANSPARENT)
+        return;
+    MacInstallPen() ;
+    wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
+    m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
+    wxCoord x1, x2 , y1 , y2 ;
+    x1 = XLOG2DEVMAC(points[0].x + xoffset);
+    y1 = YLOG2DEVMAC(points[0].y + yoffset);
+    ::MoveTo(x1 - offset, y1 - offset );
+    for (int i = 0; i < n-1; i++)
+    {
+        x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+        y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
+        ::LineTo( x2 - offset, y2 - offset );
+    }
 }
+
 void  wxDC::DoDrawPolygon(int n, wxPoint points[],
                           wxCoord xoffset, wxCoord yoffset,
                           int fillStyle )
 {
-       wxCHECK_RET(Ok(), wxT("Invalid DC"));
-       wxMacPortSetter helper(this) ;
-       wxCoord x1, x2 , y1 , y2 ;
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    wxCoord x1, x2 , y1 , y2 ;
     if ( m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT )
         return ;
-       PolyHandle polygon = OpenPoly();
-       x2 = x1 = XLOG2DEVMAC(points[0].x + xoffset);
-       y2 = y1 = YLOG2DEVMAC(points[0].y + yoffset);
-       ::MoveTo(x1,y1);
-       for (int i = 1; i < n; i++)
-       {
-               x2 = XLOG2DEVMAC(points[i].x + xoffset);
-               y2 = YLOG2DEVMAC(points[i].y + yoffset);
-               ::LineTo(x2, y2);
-       }
+    PolyHandle polygon = OpenPoly();
+    x2 = x1 = XLOG2DEVMAC(points[0].x + xoffset);
+    y2 = y1 = YLOG2DEVMAC(points[0].y + yoffset);
+    ::MoveTo(x1,y1);
+    for (int i = 1; i < n; i++)
+    {
+        x2 = XLOG2DEVMAC(points[i].x + xoffset);
+        y2 = YLOG2DEVMAC(points[i].y + yoffset);
+        ::LineTo(x2, y2);
+    }
     // close the polyline if necessary
     if ( x1 != x2 || y1 != y2 )
     {
         ::LineTo(x1,y1 ) ;
     }
-       ClosePoly();
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush();
-               ::PaintPoly( polygon );
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FramePoly( polygon ) ;
-       }
-       KillPoly( polygon );
+    ClosePoly();
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush();
+        ::PaintPoly( polygon );
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FramePoly( polygon ) ;
+    }
+    KillPoly( polygon );
 }
+
 void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       wxCoord xx = XLOG2DEVMAC(x);
-       wxCoord yy = YLOG2DEVMAC(y);
-       wxCoord ww = m_signX * XLOG2DEVREL(width);
-       wxCoord hh = m_signY * YLOG2DEVREL(height);
-       // CMB: draw nothing if transformed w or h is 0
-       if (ww == 0 || hh == 0)
-               return;
-       // CMB: handle -ve width and/or height
-       if (ww < 0)
-       {
-               ww = -ww;
-               xx = xx - ww;
-       }
-       if (hh < 0)
-       {
-               hh = -hh;
-               yy = yy - hh;
-       }
-       Rect rect = { yy , xx , yy + hh , xx + ww } ;
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush() ;
-               ::PaintRect( &rect ) ;
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FrameRect( &rect ) ;
-       }
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
+    wxCoord ww = m_signX * XLOG2DEVREL(width);
+    wxCoord hh = m_signY * YLOG2DEVREL(height);
+    // CMB: draw nothing if transformed w or h is 0
+    if (ww == 0 || hh == 0)
+        return;
+    // CMB: handle -ve width and/or height
+    if (ww < 0)
+    {
+        ww = -ww;
+        xx = xx - ww;
+    }
+    if (hh < 0)
+    {
+        hh = -hh;
+        yy = yy - hh;
+    }
+    Rect rect = { yy , xx , yy + hh , xx + ww } ;
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush() ;
+        ::PaintRect( &rect ) ;
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FrameRect( &rect ) ;
+    }
 }
+
 void  wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
-                                        wxCoord width, wxCoord height,
-                                        double radius)
+                                   wxCoord width, wxCoord height,
+                                   double radius)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
     if (radius < 0.0)
-           radius = - radius * ((width < height) ? width : height);
-       wxCoord xx = XLOG2DEVMAC(x);
-       wxCoord yy = YLOG2DEVMAC(y);
-       wxCoord ww = m_signX * XLOG2DEVREL(width);
-       wxCoord hh = m_signY * YLOG2DEVREL(height);
-       // CMB: draw nothing if transformed w or h is 0
-       if (ww == 0 || hh == 0)
-               return;
-       // CMB: handle -ve width and/or height
-       if (ww < 0)
-       {
-               ww = -ww;
-               xx = xx - ww;
-       }
-       if (hh < 0)
-       {
-               hh = -hh;
-               yy = yy - hh;
-       }
-       Rect rect = { yy , xx , yy + hh , xx + ww } ;
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush() ;
-               ::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
-       }
+        radius = - radius * ((width < height) ? width : height);
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
+    wxCoord ww = m_signX * XLOG2DEVREL(width);
+    wxCoord hh = m_signY * YLOG2DEVREL(height);
+    // CMB: draw nothing if transformed w or h is 0
+    if (ww == 0 || hh == 0)
+        return;
+    // CMB: handle -ve width and/or height
+    if (ww < 0)
+    {
+        ww = -ww;
+        xx = xx - ww;
+    }
+    if (hh < 0)
+    {
+        hh = -hh;
+        yy = yy - hh;
+    }
+    Rect rect = { yy , xx , yy + hh , xx + ww } ;
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush() ;
+        ::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
+    }
 }
+
 void  wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       wxCoord xx = XLOG2DEVMAC(x);
-       wxCoord yy = YLOG2DEVMAC(y);
-       wxCoord ww = m_signX * XLOG2DEVREL(width);
-       wxCoord hh = m_signY * YLOG2DEVREL(height);
-       // CMB: draw nothing if transformed w or h is 0
-       if (ww == 0 || hh == 0)
-               return;
-       // CMB: handle -ve width and/or height
-       if (ww < 0)
-       {
-               ww = -ww;
-               xx = xx - ww;
-       }
-       if (hh < 0)
-       {
-               hh = -hh;
-               yy = yy - hh;
-       }
-       Rect rect = { yy , xx , yy + hh , xx + ww } ;
-       if (m_brush.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallBrush() ;
-               ::PaintOval( &rect ) ;
-       }
-       if (m_pen.GetStyle() != wxTRANSPARENT)
-       {
-               MacInstallPen() ;
-               ::FrameOval( &rect ) ;
-       }
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
+    wxCoord ww = m_signX * XLOG2DEVREL(width);
+    wxCoord hh = m_signY * YLOG2DEVREL(height);
+    // CMB: draw nothing if transformed w or h is 0
+    if (ww == 0 || hh == 0)
+        return;
+    // CMB: handle -ve width and/or height
+    if (ww < 0)
+    {
+        ww = -ww;
+        xx = xx - ww;
+    }
+    if (hh < 0)
+    {
+        hh = -hh;
+        yy = yy - hh;
+    }
+    Rect rect = { yy , xx , yy + hh , xx + ww } ;
+    if (m_brush.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallBrush() ;
+        ::PaintOval( &rect ) ;
+    }
+    if (m_pen.GetStyle() != wxTRANSPARENT)
+    {
+        MacInstallPen() ;
+        ::FrameOval( &rect ) ;
+    }
 }
 
-
 bool  wxDC::CanDrawBitmap(void) const
 {
-       return true ;
+    return true ;
 }
 
 bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
-                        wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
-                        wxCoord xsrcMask,  wxCoord ysrcMask )
+                   wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
+                   wxCoord xsrcMask,  wxCoord ysrcMask )
 {
     wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
     wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit  Illegal source DC"));
@@ -985,112 +1040,112 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
     // correct the parameter in case this dc does not have a mask at all
     if ( useMask && !source->m_macMask )
         useMask = false ;
-       Rect srcrect , dstrect ;
-       srcrect.top = source->YLOG2DEVMAC(ysrc) ;
-       srcrect.left = source->XLOG2DEVMAC(xsrc)  ;
-       srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
-       srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
-       dstrect.top = YLOG2DEVMAC(ydest) ;
-       dstrect.left = XLOG2DEVMAC(xdest) ;
-       dstrect.bottom = YLOG2DEVMAC(ydest + height )  ;
-       dstrect.right = XLOG2DEVMAC(xdest + width ) ;
+    Rect srcrect , dstrect ;
+    srcrect.top = source->YLOG2DEVMAC(ysrc) ;
+    srcrect.left = source->XLOG2DEVMAC(xsrc)  ;
+    srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
+    srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+    dstrect.top = YLOG2DEVMAC(ydest) ;
+    dstrect.left = XLOG2DEVMAC(xdest) ;
+    dstrect.bottom = YLOG2DEVMAC(ydest + height )  ;
+    dstrect.right = XLOG2DEVMAC(xdest + width ) ;
     short mode = kUnsupportedMode ;
     bool invertDestinationFirst = false ;
     switch ( logical_func )
     {
-               case wxAND:        // src AND dst
-                   mode = srcOr ; // ok
-                   break ;
-               case wxAND_INVERT: // (NOT src) AND dst
-                   mode = notSrcOr  ; // ok
-                   break ;
-               case wxAND_REVERSE:// src AND (NOT dst)
-                   invertDestinationFirst = true ;
-                   mode = srcOr ;
-                   break ;
-               case wxCLEAR:      // 0
-                   mode = kEmulatedMode ;
-                   break ;
-        case wxCOPY:       // src
-                       mode = srcCopy ; // ok
-                       break ;
-               case wxEQUIV:      // (NOT src) XOR dst
-                   mode = srcXor ; // ok
-                   break ;
-               case wxINVERT:     // NOT dst
-                       mode = kEmulatedMode ; //or hilite ;
-                       break ;
-               case wxNAND:       // (NOT src) OR (NOT dst)
-                   invertDestinationFirst = true ;
-                   mode = srcBic ;
-                   break ;
-               case wxNOR:        // (NOT src) AND (NOT dst)
-                   invertDestinationFirst = true ;
-                   mode = notSrcOr ;
-                   break ;
-               case wxNO_OP:      // dst
-                   mode = kEmulatedMode ; // this has already been handled upon entry
-                   break ;
-               case wxOR:         // src OR dst
-                   mode = notSrcBic ;
-                   break ;
-               case wxOR_INVERT:  // (NOT src) OR dst
-                   mode = srcBic ;
-                   break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                   invertDestinationFirst = true ;
-                       mode = notSrcBic ;
-                       break ;
-               case wxSET:        // 1
-                   mode = kEmulatedMode ;
-                   break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notSrcCopy ; // ok
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = notSrcXor ; // ok
-                       break ;
-        default :
-                       break ;
+    case wxAND:        // src AND dst
+        mode = srcOr ; // ok
+        break ;
+    case wxAND_INVERT: // (NOT src) AND dst
+        mode = notSrcOr  ; // ok
+        break ;
+    case wxAND_REVERSE:// src AND (NOT dst)
+        invertDestinationFirst = true ;
+        mode = srcOr ;
+        break ;
+    case wxCLEAR:      // 0
+        mode = kEmulatedMode ;
+        break ;
+    case wxCOPY:       // src
+        mode = srcCopy ; // ok
+        break ;
+    case wxEQUIV:      // (NOT src) XOR dst
+        mode = srcXor ; // ok
+        break ;
+    case wxINVERT:     // NOT dst
+        mode = kEmulatedMode ; //or hilite ;
+        break ;
+    case wxNAND:       // (NOT src) OR (NOT dst)
+        invertDestinationFirst = true ;
+        mode = srcBic ;
+        break ;
+    case wxNOR:        // (NOT src) AND (NOT dst)
+        invertDestinationFirst = true ;
+        mode = notSrcOr ;
+        break ;
+    case wxNO_OP:      // dst
+        mode = kEmulatedMode ; // this has already been handled upon entry
+        break ;
+    case wxOR:         // src OR dst
+        mode = notSrcBic ;
+        break ;
+    case wxOR_INVERT:  // (NOT src) OR dst
+        mode = srcBic ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        invertDestinationFirst = true ;
+        mode = notSrcBic ;
+        break ;
+    case wxSET:        // 1
+        mode = kEmulatedMode ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notSrcCopy ; // ok
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = notSrcXor ; // ok
+        break ;
+    default :
+        break ;
     }
     if ( mode == kUnsupportedMode )
     {
         wxFAIL_MSG("unsupported blitting mode" );
         return FALSE ;
     }
-       CGrafPtr                        sourcePort = (CGrafPtr) source->m_macPort ;
-       PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ;
-       if ( LockPixels(bmappixels) )
-       {
+    CGrafPtr            sourcePort = (CGrafPtr) source->m_macPort ;
+    PixMapHandle    bmappixels =  GetGWorldPixMap( sourcePort ) ;
+    if ( LockPixels(bmappixels) )
+    {
         wxMacPortSetter helper(this) ;
-       if ( source->GetDepth() == 1 )
-       {
-           RGBForeColor( &MAC_WXCOLORREF(m_textForegroundColour.GetPixel()) ) ;
-           RGBBackColor( &MAC_WXCOLORREF(m_textBackgroundColour.GetPixel()) ) ;
+        if ( source->GetDepth() == 1 )
+        {
+            RGBForeColor( &MAC_WXCOLORREF(m_textForegroundColour.GetPixel()) ) ;
+            RGBBackColor( &MAC_WXCOLORREF(m_textBackgroundColour.GetPixel()) ) ;
         }
         else
         {
             // the modes need this, otherwise we'll end up having really nice colors...
-           RGBColor    white = { 0xFFFF, 0xFFFF,0xFFFF} ;
-           RGBColor    black = { 0,0,0} ;
-           RGBForeColor( &black ) ;
-           RGBBackColor( &white ) ;
+            RGBColor    white = { 0xFFFF, 0xFFFF,0xFFFF} ;
+            RGBColor    black = { 0,0,0} ;
+            RGBForeColor( &black ) ;
+            RGBBackColor( &white ) ;
         }
-               if ( useMask && source->m_macMask )
-               {
-                   if ( mode == srcCopy )
-                   {
-                       if ( LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) )
-                       {
-                               CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
-                                           GetPortBitMapForCopyBits( MAC_WXHBITMAP(source->m_macMask) ) ,
-                                           GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
-                                               &srcrect, &srcrect , &dstrect ) ;
-                               UnlockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) )  ) ;
-                       }
-                   }
-                   else
-                   {
+        if ( useMask && source->m_macMask )
+        {
+            if ( mode == srcCopy )
+            {
+                if ( LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) )
+                {
+                    CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
+                        GetPortBitMapForCopyBits( MAC_WXHBITMAP(source->m_macMask) ) ,
+                        GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+                        &srcrect, &srcrect , &dstrect ) ;
+                    UnlockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) )  ) ;
+                }
+            }
+            else
+            {
                 RgnHandle clipRgn = NewRgn() ;
                 LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) ;
                 BitMapToRegion( clipRgn , (BitMap*) *GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) ;
@@ -1099,17 +1154,17 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                 if ( mode == kEmulatedMode )
                 {
                     Pattern pat ;
-                           ::PenPat(GetQDGlobalsBlack(&pat));
+                    ::PenPat(GetQDGlobalsBlack(&pat));
                     if ( logical_func == wxSET )
                     {
                         RGBColor col= { 0xFFFF, 0xFFFF, 0xFFFF } ;
-                               ::RGBForeColor( &col  ) ;
+                        ::RGBForeColor( &col  ) ;
                         ::PaintRgn( clipRgn ) ;
                     }
                     else if ( logical_func == wxCLEAR )
                     {
                         RGBColor col= { 0x0000, 0x0000, 0x0000 } ;
-                               ::RGBForeColor( &col  ) ;
+                        ::RGBForeColor( &col  ) ;
                         ::PaintRgn( clipRgn ) ;
                     }
                     else if ( logical_func == wxINVERT )
@@ -1145,31 +1200,31 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                     {
                         MacInvertRgn( clipRgn ) ;
                     }
-                               CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
-                                   GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
-                                       &srcrect, &dstrect, mode, clipRgn ) ;
-                   }
-                   DisposeRgn( clipRgn ) ;
-               }
-               }
-               else
-               {
+                    CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
+                        GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+                        &srcrect, &dstrect, mode, clipRgn ) ;
+                }
+                DisposeRgn( clipRgn ) ;
+            }
+        }
+        else
+        {
             RgnHandle clipRgn = NewRgn() ;
             SetRectRgn( clipRgn , dstrect.left , dstrect.top , dstrect.right , dstrect.bottom ) ;
-                   if ( mode == kEmulatedMode )
-                   {
+            if ( mode == kEmulatedMode )
+            {
                 Pattern pat ;
-                   ::PenPat(GetQDGlobalsBlack(&pat));
+                ::PenPat(GetQDGlobalsBlack(&pat));
                 if ( logical_func == wxSET )
                 {
                     RGBColor col= { 0xFFFF, 0xFFFF, 0xFFFF } ;
-                       ::RGBForeColor( &col  ) ;
+                    ::RGBForeColor( &col  ) ;
                     ::PaintRgn( clipRgn ) ;
                 }
                 else if ( logical_func == wxCLEAR )
                 {
                     RGBColor col= { 0x0000, 0x0000, 0x0000 } ;
-                       ::RGBForeColor( &col  ) ;
+                    ::RGBForeColor( &col  ) ;
                     ::PaintRgn( clipRgn ) ;
                 }
                 else if ( logical_func == wxINVERT )
@@ -1197,34 +1252,36 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
                         }
                     }
                 }
-               }
-               else
-               {
+            }
+            else
+            {
                 if ( invertDestinationFirst )
                 {
                     MacInvertRgn( clipRgn ) ;
                 }
-                       CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
-                           GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
-                               &srcrect, &dstrect, mode, NULL ) ;
-               }
-               DisposeRgn( clipRgn ) ;
-               }
-               UnlockPixels( bmappixels ) ;
-       }
-       m_macPenInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macFontInstalled = false ;
-  return TRUE;
-}
-inline Fixed   IntToFixed( int inInt )
-       {
-               return (((SInt32) inInt) << 16);
-       }
-inline int     FixedToInt( Fixed inFixed )
-       {
-               return (((SInt32) inFixed) >> 16);
-       }
+                CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
+                    GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+                    &srcrect, &dstrect, mode, NULL ) ;
+            }
+            DisposeRgn( clipRgn ) ;
+        }
+        UnlockPixels( bmappixels ) ;
+    }
+    m_macPenInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macFontInstalled = false ;
+    return TRUE;
+}
+
+inline Fixed    IntToFixed( int inInt )
+{
+    return (((SInt32) inInt) << 16);
+}
+
+inline int    FixedToInt( Fixed inFixed )
+{
+    return (((SInt32) inFixed) >> 16);
+}
 
 void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
                               double angle)
@@ -1239,16 +1296,16 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         return ;
     wxMacPortSetter helper(this) ;
     MacInstallFont() ;
-       wxString text ;
-       if ( wxApp::s_macDefaultEncodingIsPC )
-       {
-               text = wxMacMakeMacStringFromPC( str ) ;
-       }
-       else
-       {
-               text = str ;
-       }
-       wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+    wxString text ;
+    if ( wxApp::s_macDefaultEncodingIsPC )
+    {
+        text = wxMacMakeMacStringFromPC( str ) ;
+    }
+    else
+    {
+        text = str ;
+    }
+    wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
     if ( 0 )
     {
         m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
@@ -1256,23 +1313,23 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         m_macAliasWasEnabled = true ;
     }
     OSStatus status = noErr ;
-       TECObjectRef ec;
-       status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
-       wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
+    TECObjectRef ec;
+    status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+    wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
     ByteCount byteOutLen ;
     ByteCount byteInLen = text.Length() ;
     ByteCount byteBufferLen = byteInLen *2 ;
     char* buf = new char[byteBufferLen] ;
-       status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
-           (TextPtr)buf, byteBufferLen, &byteOutLen);
-       wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
-       status = TECDisposeConverter(ec);
-       wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
-       ATSUTextLayout atsuLayout ;
-       UniCharCount chars = byteOutLen / 2 ;
+    status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
+        (TextPtr)buf, byteBufferLen, &byteOutLen);
+    wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
+    status = TECDisposeConverter(ec);
+    wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
+    ATSUTextLayout atsuLayout ;
+    UniCharCount chars = byteOutLen / 2 ;
     status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) buf , 0 , byteOutLen / 2 , byteOutLen / 2 , 1 ,
         &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
-       wxASSERT_MSG( status == noErr , "couldn't create the layout of the rotated text" );
+    wxASSERT_MSG( status == noErr , "couldn't create the layout of the rotated text" );
     int iAngle = int( angle );
     int drawX = XLOG2DEVMAC(x) ;
     int drawY = YLOG2DEVMAC(y) ;
@@ -1286,708 +1343,720 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     if ( abs(iAngle) > 0 )
     {
         Fixed atsuAngle = IntToFixed( iAngle ) ;
-               ATSUAttributeTag atsuTags[] =
-               {
-                   kATSULineRotationTag ,
-               } ;
-           ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
-           {
-               sizeof( Fixed ) ,
-           } ;
-               ATSUAttributeValuePtr   atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
-               {
-                   &atsuAngle ,
-               } ;
-       status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag),
-                   atsuTags, atsuSizes, atsuValues ) ;
-    }
-       status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-                                       &textBefore , &textAfter, &ascent , &descent );
+        ATSUAttributeTag atsuTags[] =
+        {
+            kATSULineRotationTag ,
+        } ;
+        ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+        {
+            sizeof( Fixed ) ,
+        } ;
+        ATSUAttributeValuePtr    atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+        {
+            &atsuAngle ,
+        } ;
+        status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+            atsuTags, atsuSizes, atsuValues ) ;
+    }
+    status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+        &textBefore , &textAfter, &ascent , &descent );
     
     drawX += sin(angle/RAD2DEG) * FixedToInt(ascent) ;
     drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
     status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-                               IntToFixed(drawX) , IntToFixed(drawY) );
-       wxASSERT_MSG( status == noErr , "couldn't draw the rotated text" );
+        IntToFixed(drawX) , IntToFixed(drawY) );
+    wxASSERT_MSG( status == noErr , "couldn't draw the rotated text" );
     Rect rect ;
-       status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
-                                       IntToFixed(drawX) , IntToFixed(drawY) , &rect );
-       wxASSERT_MSG( status == noErr , "couldn't measure the rotated text" );
+    status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
+        IntToFixed(drawX) , IntToFixed(drawY) , &rect );
+    wxASSERT_MSG( status == noErr , "couldn't measure the rotated text" );
     OffsetRect( &rect , -m_macLocalOrigin.x , -m_macLocalOrigin.y ) ;
     CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
     CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
     ::ATSUDisposeTextLayout(atsuLayout);
     delete[] buf ;
 }
+
 void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
 {
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText  Invalid DC"));
     wxMacPortSetter helper(this) ;
-       long xx = XLOG2DEVMAC(x);
-       long yy = YLOG2DEVMAC(y);
+    long xx = XLOG2DEVMAC(x);
+    long yy = YLOG2DEVMAC(y);
 #if TARGET_CARBON
-       bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-       if ( m_font.GetNoAntiAliasing() )
-           useDrawThemeText = false ;
+    bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
+    if ( m_font.GetNoAntiAliasing() )
+        useDrawThemeText = false ;
 #endif
-       MacInstallFont() ;
+    MacInstallFont() ;
     if ( 0 )
     {
         m_macFormerAliasState = IsAntiAliasedTextEnabled(&m_macFormerAliasSize);
         SetAntiAliasedTextEnabled(true, 8);
         m_macAliasWasEnabled = true ;
     }
-       FontInfo fi ;
-       ::GetFontInfo( &fi ) ;
+    FontInfo fi ;
+    ::GetFontInfo( &fi ) ;
 #if TARGET_CARBON
-       if ( !useDrawThemeText )
+    if ( !useDrawThemeText )
 #endif
-           yy += fi.ascent ;
-       ::MoveTo( xx , yy );
-       if (  m_backgroundMode == wxTRANSPARENT )
-       {
-               ::TextMode( srcOr) ;
-       }
-       else
-       {
-               ::TextMode( srcCopy ) ;
-       }
-       const char *text = NULL ;
-       int length = 0 ;
-       wxString macText ;
-       if ( wxApp::s_macDefaultEncodingIsPC )
-       {
-               macText = wxMacMakeMacStringFromPC( strtext ) ;
-               text = macText ;
-               length = macText.Length() ;
-       }
-       else
-       {
-               text = strtext ;
-               length = strtext.Length() ;
-       }
-       int laststop = 0 ;
-       int i = 0 ;
-       int line = 0 ;
-    {
-       while( i < length )
-       {
-               if( text[i] == 13 || text[i] == 10)
-               {
+        yy += fi.ascent ;
+    ::MoveTo( xx , yy );
+    if (  m_backgroundMode == wxTRANSPARENT )
+    {
+        ::TextMode( srcOr) ;
+    }
+    else
+    {
+        ::TextMode( srcCopy ) ;
+    }
+    const char *text = NULL ;
+    int length = 0 ;
+    wxString macText ;
+    if ( wxApp::s_macDefaultEncodingIsPC )
+    {
+        macText = wxMacMakeMacStringFromPC( strtext ) ;
+        text = macText ;
+        length = macText.Length() ;
+    }
+    else
+    {
+        text = strtext ;
+        length = strtext.Length() ;
+    }
+    int laststop = 0 ;
+    int i = 0 ;
+    int line = 0 ;
+    {
+        while( i < length )
+        {
+            if( text[i] == 13 || text[i] == 10)
+            {
 #if TARGET_CARBON
-               if ( useDrawThemeText )
-               {
-                   Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+                if ( useDrawThemeText )
+                {
+                    Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
                     CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                           if ( m_backgroundMode != wxTRANSPARENT )
-                           {
-                                   Point bounds={0,0} ;
-                                   Rect background = frame ;
-                                   SInt16 baseline ;
-                                       ::GetThemeTextDimensions( mString,
-                                                                               kThemeCurrentPortFont,
-                                                                               kThemeStateActive,
-                                                                               false,
-                                                                               &bounds,
-                                                                               &baseline );
-                                       background.right = background.left + bounds.h ;
-                                       background.bottom = background.top + bounds.v ;
-                                       ::EraseRect( &background ) ;
-                           }
-                       ::DrawThemeTextBox( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &frame,
-                                                               teJustLeft,
-                                                               nil );
-                   CFRelease( mString ) ;
-                   line++ ;
+                    if ( m_backgroundMode != wxTRANSPARENT )
+                    {
+                        Point bounds={0,0} ;
+                        Rect background = frame ;
+                        SInt16 baseline ;
+                        ::GetThemeTextDimensions( mString,
+                            kThemeCurrentPortFont,
+                            kThemeStateActive,
+                            false,
+                            &bounds,
+                            &baseline );
+                        background.right = background.left + bounds.h ;
+                        background.bottom = background.top + bounds.v ;
+                        ::EraseRect( &background ) ;
+                    }
+                    ::DrawThemeTextBox( mString,
+                        kThemeCurrentPortFont,
+                        kThemeStateActive,
+                        false,
+                        &frame,
+                        teJustLeft,
+                        nil );
+                    CFRelease( mString ) ;
+                    line++ ;
                 }
-                   else
+                else
 #endif
-                   {
-                               ::DrawText( text , laststop , i - laststop ) ;
-                   line++ ;
-                               ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
-                       }
-                       laststop = i+1 ;
-               }
-               i++ ;
-       }
+                {
+                    ::DrawText( text , laststop , i - laststop ) ;
+                    line++ ;
+                    ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
+                }
+                laststop = i+1 ;
+            }
+            i++ ;
+        }
 #if TARGET_CARBON
         if ( useDrawThemeText )
-       {
-           Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+        {
+            Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
             CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
             if ( m_backgroundMode != wxTRANSPARENT )
             {
-                   Point bounds={0,0} ;
-                   Rect background = frame ;
-                   SInt16 baseline ;
-                       ::GetThemeTextDimensions( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &bounds,
-                                                               &baseline );
-                       background.right = background.left + bounds.h ;
-                       background.bottom = background.top + bounds.v ;
-                       ::EraseRect( &background ) ;
+                Point bounds={0,0} ;
+                Rect background = frame ;
+                SInt16 baseline ;
+                ::GetThemeTextDimensions( mString,
+                    kThemeCurrentPortFont,
+                    kThemeStateActive,
+                    false,
+                    &bounds,
+                    &baseline );
+                background.right = background.left + bounds.h ;
+                background.bottom = background.top + bounds.v ;
+                ::EraseRect( &background ) ;
             }
-               ::DrawThemeTextBox( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       false,
-                                                       &frame,
-                                                       teJustLeft,
-                                                       nil );
+            ::DrawThemeTextBox( mString,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &frame,
+                teJustLeft,
+                nil );
             CFRelease( mString ) ;
         }
         else
 #endif
         {
-           ::DrawText( text , laststop , i - laststop ) ;
+            ::DrawText( text , laststop , i - laststop ) ;
         }
-       }
-       ::TextMode( srcOr ) ;
+    }
+    ::TextMode( srcOr ) ;
 }
+
 bool  wxDC::CanGetTextExtent() const
 {
-       wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
-       return true ;
+    wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
+    return true ;
 }
+
 void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
-                     wxCoord *descent, wxCoord *externalLeading ,
-                     wxFont *theFont ) const
-{
-   wxCHECK_RET(Ok(), wxT("Invalid DC"));
-   wxMacPortSetter helper(this) ;
-       wxFont formerFont = m_font ;
-       if ( theFont )
-       {
-           // work around the constness
-       *((wxFont*)(&m_font)) = *theFont ;
-       }
-       MacInstallFont() ;
-       FontInfo fi ;
-       ::GetFontInfo( &fi ) ;
-#if TARGET_CARBON      
-       bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
-       if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
-           useGetThemeText = false ;
+                            wxCoord *descent, wxCoord *externalLeading ,
+                            wxFont *theFont ) const
+{
+    wxCHECK_RET(Ok(), wxT("Invalid DC"));
+    wxMacPortSetter helper(this) ;
+    wxFont formerFont = m_font ;
+    if ( theFont )
+    {
+        // work around the constness
+        *((wxFont*)(&m_font)) = *theFont ;
+    }
+    MacInstallFont() ;
+    FontInfo fi ;
+    ::GetFontInfo( &fi ) ;
+#if TARGET_CARBON    
+    bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
+    if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
+        useGetThemeText = false ;
 #endif
-       if ( height )
-               *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
-       if ( descent )
-               *descent =YDEV2LOGREL( fi.descent );
-       if ( externalLeading )
-               *externalLeading = YDEV2LOGREL( fi.leading ) ;
-       const char *text = NULL ;
-       int length = 0 ;
-       wxString macText ;
-       if ( wxApp::s_macDefaultEncodingIsPC )
-       {
-               macText = wxMacMakeMacStringFromPC( string ) ;
-               text = macText ;
-               length = macText.Length() ;
-       
-       else
-       {
-               text = string ;
-               length = string.Length() ;
-       }
-       int laststop = 0 ;
-       int i = 0 ;
-       int curwidth = 0 ;
-       if ( width )
-       {
-               *width = 0 ;
-               while( i < length )
-               {
-                       if( text[i] == 13 || text[i] == 10)
-                       {
-                               if ( height )
-                                       *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
+    if ( height )
+        *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
+    if ( descent )
+        *descent =YDEV2LOGREL( fi.descent );
+    if ( externalLeading )
+        *externalLeading = YDEV2LOGREL( fi.leading ) ;
+    const char *text = NULL ;
+    int length = 0 ;
+    wxString macText ;
+    if ( wxApp::s_macDefaultEncodingIsPC )
+    {
+        macText = wxMacMakeMacStringFromPC( string ) ;
+        text = macText ;
+        length = macText.Length() ;
+    } 
+    else
+    {
+        text = string ;
+        length = string.Length() ;
+    }
+    int laststop = 0 ;
+    int i = 0 ;
+    int curwidth = 0 ;
+    if ( width )
+    {
+        *width = 0 ;
+        while( i < length )
+        {
+            if( text[i] == 13 || text[i] == 10)
+            {
+                if ( height )
+                    *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
 #if TARGET_CARBON
                 if ( useGetThemeText )
                 {
                     Point bounds={0,0} ;
                     SInt16 baseline ;
                     CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                       ::GetThemeTextDimensions( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &bounds,
-                                                               &baseline );
-                   CFRelease( mString ) ;
-                   curwidth = bounds.h ;
+                    ::GetThemeTextDimensions( mString,
+                        kThemeCurrentPortFont,
+                        kThemeStateActive,
+                        false,
+                        &bounds,
+                        &baseline );
+                    CFRelease( mString ) ;
+                    curwidth = bounds.h ;
                 }
                 else
 #endif
                 {
-                                   curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-                               }
-                               if ( curwidth > *width )
-                                       *width = XDEV2LOGREL( curwidth ) ;
-                               laststop = i+1 ;
-                       }
-                       i++ ;
-               }
-                               
+                    curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                }
+                if ( curwidth > *width )
+                    *width = XDEV2LOGREL( curwidth ) ;
+                laststop = i+1 ;
+            }
+            i++ ;
+        }
+        
 #if TARGET_CARBON
         if ( useGetThemeText )
         {
             Point bounds={0,0} ;
             SInt16 baseline ;
             CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-               ::GetThemeTextDimensions( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       false,
-                                                       &bounds,
-                                                       &baseline );
-           CFRelease( mString ) ;
-           curwidth = bounds.h ;
+            ::GetThemeTextDimensions( mString,
+                kThemeCurrentPortFont,
+                kThemeStateActive,
+                false,
+                &bounds,
+                &baseline );
+            CFRelease( mString ) ;
+            curwidth = bounds.h ;
         }
         else
 #endif
         {
-                   curwidth = ::TextWidth( text , laststop , i - laststop ) ;
-               }
-               if ( curwidth > *width )
-                       *width = XDEV2LOGREL( curwidth ) ;
-       }
-       if ( theFont )
-       {
-           // work around the constness
-       *((wxFont*)(&m_font)) = formerFont ;
-               m_macFontInstalled = false ;
-       }
+            curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+        }
+        if ( curwidth > *width )
+            *width = XDEV2LOGREL( curwidth ) ;
+    }
+    if ( theFont )
+    {
+        // work around the constness
+        *((wxFont*)(&m_font)) = formerFont ;
+        m_macFontInstalled = false ;
+    }
 }
+
 wxCoord   wxDC::GetCharWidth(void) const
 {
     wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
-   wxMacPortSetter helper(this) ;
-       MacInstallFont() ;
+    wxMacPortSetter helper(this) ;
+    MacInstallFont() ;
     int width = 0 ;
 #if TARGET_CARBON
-       bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
-       if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
-               useGetThemeText = false ;
+    bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
+    if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
+        useGetThemeText = false ;
 #endif
-       char text[] = "H" ;
+    char text[] = "H" ;
 #if TARGET_CARBON
     if ( useGetThemeText )
     {
         Point bounds={0,0} ;
         SInt16 baseline ;
         CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text , 1 , CFStringGetSystemEncoding(), false ) ;
-               ::GetThemeTextDimensions( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       false,
-                                                       &bounds,
-                                                       &baseline );
-           CFRelease( mString ) ;
-           width = bounds.h ;
+        ::GetThemeTextDimensions( mString,
+            kThemeCurrentPortFont,
+            kThemeStateActive,
+            false,
+            &bounds,
+            &baseline );
+        CFRelease( mString ) ;
+        width = bounds.h ;
     }
     else
 #endif
     {
-           width = ::TextWidth( text , 0 , 1 ) ;
-       }
-       return YDEV2LOGREL(width) ;
+        width = ::TextWidth( text , 0 , 1 ) ;
+    }
+    return YDEV2LOGREL(width) ;
 }
+
 wxCoord   wxDC::GetCharHeight(void) const
 {
     wxCHECK_MSG(Ok(), 1, wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       MacInstallFont() ;
-       FontInfo fi ;
-       ::GetFontInfo( &fi ) ;
-       return YDEV2LOGREL( fi.descent + fi.ascent );
+    MacInstallFont() ;
+    FontInfo fi ;
+    ::GetFontInfo( &fi ) ;
+    return YDEV2LOGREL( fi.descent + fi.ascent );
 }
+
 void  wxDC::Clear(void)
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
-       Rect rect = { -31000 , -31000 , 31000 , 31000 } ;
-       if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
-       {
-           ::PenNormal() ;
-           //MacInstallBrush() ;
+    Rect rect = { -31000 , -31000 , 31000 , 31000 } ;
+    if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
+    {
+        ::PenNormal() ;
+        //MacInstallBrush() ;
         MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ;
-               ::EraseRect( &rect ) ;
-       }
+        ::EraseRect( &rect ) ;
+    }
 }
+
 void wxDC::MacInstallFont() const
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
-//     if ( m_macFontInstalled )
-//             return ;
-       Pattern blackColor ;
-       MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
-       wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-       if ( font )
-       {
-               ::TextFont( font->m_macFontNum ) ;
-               ::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
-               ::TextFace( font->m_macFontStyle ) ;
-               m_macFontInstalled = true ;
-               m_macBrushInstalled = false ;
-               m_macPenInstalled = false ;
-               RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
-               RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
-               ::RGBForeColor( &forecolor );
-               ::RGBBackColor( &backcolor );
-       }
-       else
-       {
+    //    if ( m_macFontInstalled )
+    //        return ;
+    Pattern blackColor ;
+    MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
+    wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+    if ( font )
+    {
+        ::TextFont( font->m_macFontNum ) ;
+        ::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
+        ::TextFace( font->m_macFontStyle ) ;
+        m_macFontInstalled = true ;
+        m_macBrushInstalled = false ;
+        m_macPenInstalled = false ;
+        RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
+        RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
+        ::RGBForeColor( &forecolor );
+        ::RGBBackColor( &backcolor );
+    }
+    else
+    {
         FontFamilyID fontId ;
-       Str255 fontName ;
-       SInt16 fontSize ;
-       Style fontStyle ;
-       GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+        Str255 fontName ;
+        SInt16 fontSize ;
+        Style fontStyle ;
+        GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
         GetFNum( fontName, &fontId );
-               ::TextFont( fontId ) ;
-               ::TextSize( short(m_scaleY * fontSize) ) ;
-               ::TextFace( fontStyle ) ;
-               // todo reset after spacing changes - or store the current spacing somewhere
-               m_macFontInstalled = true ;
-               m_macBrushInstalled = false ;
-               m_macPenInstalled = false ;
-               RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
-               RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
-               ::RGBForeColor( &forecolor );
-               ::RGBBackColor( &backcolor );
-       }
-       short mode = patCopy ;
-       // todo :
-       switch( m_logicalFunction )
-       {
-               case wxCOPY:       // src
-                       mode = patCopy ;
-                       break ;
-               case wxINVERT:     // NOT dst
-                       ::PenPat(GetQDGlobalsBlack(&blackColor));
-                       mode = patXor ;
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = patXor ;
-                       break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                       mode = notPatOr ;
-                       break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notPatCopy ;
-                       break ;
-               // unsupported TODO
-               case wxCLEAR:      // 0
-               case wxAND_REVERSE:// src AND (NOT dst)
-               case wxAND:        // src AND dst
-               case wxAND_INVERT: // (NOT src) AND dst
-               case wxNO_OP:      // dst
-               case wxNOR:        // (NOT src) AND (NOT dst)
-               case wxEQUIV:      // (NOT src) XOR dst
-               case wxOR_INVERT:  // (NOT src) OR dst
-               case wxNAND:       // (NOT src) OR (NOT dst)
-               case wxOR:         // src OR dst
-               case wxSET:        // 1
-//             case wxSRC_OR:     // source _bitmap_ OR destination
-//             case wxSRC_AND:     // source _bitmap_ AND destination
-                       break ;
-       }
-       ::PenMode( mode ) ;
+        ::TextFont( fontId ) ;
+        ::TextSize( short(m_scaleY * fontSize) ) ;
+        ::TextFace( fontStyle ) ;
+        // todo reset after spacing changes - or store the current spacing somewhere
+        m_macFontInstalled = true ;
+        m_macBrushInstalled = false ;
+        m_macPenInstalled = false ;
+        RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
+        RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
+        ::RGBForeColor( &forecolor );
+        ::RGBBackColor( &backcolor );
+    }
+    short mode = patCopy ;
+    // todo :
+    switch( m_logicalFunction )
+    {
+    case wxCOPY:       // src
+        mode = patCopy ;
+        break ;
+    case wxINVERT:     // NOT dst
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+        mode = patXor ;
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = patXor ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        mode = notPatOr ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notPatCopy ;
+        break ;
+        // unsupported TODO
+    case wxCLEAR:      // 0
+    case wxAND_REVERSE:// src AND (NOT dst)
+    case wxAND:        // src AND dst
+    case wxAND_INVERT: // (NOT src) AND dst
+    case wxNO_OP:      // dst
+    case wxNOR:        // (NOT src) AND (NOT dst)
+    case wxEQUIV:      // (NOT src) XOR dst
+    case wxOR_INVERT:  // (NOT src) OR dst
+    case wxNAND:       // (NOT src) OR (NOT dst)
+    case wxOR:         // src OR dst
+    case wxSET:        // 1
+        //        case wxSRC_OR:     // source _bitmap_ OR destination
+        //        case wxSRC_AND:     // source _bitmap_ AND destination
+        break ;
+    }
+    ::PenMode( mode ) ;
     OSStatus status = noErr ;
     Fixed atsuSize = IntToFixed( int(m_scaleY * font->m_macFontSize) ) ;
     Style qdStyle = font->m_macFontStyle ;
-       ATSUFontID      atsuFont = font->m_macATSUFontID ;
+    ATSUFontID    atsuFont = font->m_macATSUFontID ;
     status = ::ATSUCreateStyle(&(ATSUStyle)m_macATSUIStyle) ;
-       wxASSERT_MSG( status == noErr , "couldn't create ATSU style" ) ;
-       ATSUAttributeTag atsuTags[] =
-       {
-           kATSUFontTag ,
-           kATSUSizeTag ,
-//         kATSUColorTag ,
-//         kATSUBaselineClassTag ,
-           kATSUVerticalCharacterTag,
-           kATSUQDBoldfaceTag ,
-           kATSUQDItalicTag ,
-           kATSUQDUnderlineTag ,
-           kATSUQDCondensedTag ,
-           kATSUQDExtendedTag ,
-       } ;
+    wxASSERT_MSG( status == noErr , "couldn't create ATSU style" ) ;
+    ATSUAttributeTag atsuTags[] =
+    {
+        kATSUFontTag ,
+            kATSUSizeTag ,
+            //        kATSUColorTag ,
+            //        kATSUBaselineClassTag ,
+            kATSUVerticalCharacterTag,
+            kATSUQDBoldfaceTag ,
+            kATSUQDItalicTag ,
+            kATSUQDUnderlineTag ,
+            kATSUQDCondensedTag ,
+            kATSUQDExtendedTag ,
+    } ;
     ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
     {
         sizeof( ATSUFontID ) ,
-        sizeof( Fixed ) ,
-//        sizeof( RGBColor ) ,
-//        sizeof( BslnBaselineClass ) ,
-        sizeof( ATSUVerticalCharacterType),
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
-        sizeof( Boolean ) ,
+            sizeof( Fixed ) ,
+            //        sizeof( RGBColor ) ,
+            //        sizeof( BslnBaselineClass ) ,
+            sizeof( ATSUVerticalCharacterType),
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
+            sizeof( Boolean ) ,
     } ;
     Boolean kTrue = true ;
     Boolean kFalse = false ;
     BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
     ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
-       ATSUAttributeValuePtr   atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
-       {
-           &atsuFont ,
-           &atsuSize ,
-//         &MAC_WXCOLORREF( m_textForegroundColour.GetPixel() ) ,
-//         &kBaselineDefault ,
-           &kHorizontal,
-           (qdStyle & bold) ? &kTrue : &kFalse ,
-           (qdStyle & italic) ? &kTrue : &kFalse ,
-           (qdStyle & underline) ? &kTrue : &kFalse ,
-           (qdStyle & condense) ? &kTrue : &kFalse ,
-           (qdStyle & extend) ? &kTrue : &kFalse ,
-       } ;
-       status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
-           atsuTags, atsuSizes, atsuValues);
-       wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
+    ATSUAttributeValuePtr    atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+    {
+        &atsuFont ,
+            &atsuSize ,
+            //        &MAC_WXCOLORREF( m_textForegroundColour.GetPixel() ) ,
+            //        &kBaselineDefault ,
+            &kHorizontal,
+            (qdStyle & bold) ? &kTrue : &kFalse ,
+            (qdStyle & italic) ? &kTrue : &kFalse ,
+            (qdStyle & underline) ? &kTrue : &kFalse ,
+            (qdStyle & condense) ? &kTrue : &kFalse ,
+            (qdStyle & extend) ? &kTrue : &kFalse ,
+    } ;
+    status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+        atsuTags, atsuSizes, atsuValues);
+    wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
 }
+
 Pattern gHatchPatterns[] =
 {
-     { { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
-     { { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
-     { { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
-     { { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
-     { { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
-     { { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
-     { { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } } 
+    { { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
+    { { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
+    { { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
+    { { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
+    { { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
+    { { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
+    { { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } } 
 } ;
+
 static void wxMacGetHatchPattern(int hatchStyle, Pattern *pattern)
 {
-       int theIndex = 1 ;
-       switch(hatchStyle)
-       {
-               case wxBDIAGONAL_HATCH:
-                       theIndex = 2;
-                       break;
-               case wxFDIAGONAL_HATCH:
-                       theIndex = 3;
-                       break;
-               case wxCROSS_HATCH:
-                       theIndex = 4;
-                       break;
-               case wxHORIZONTAL_HATCH:
-                       theIndex = 5;
-                       break;
-               case wxVERTICAL_HATCH:
-                       theIndex = 6;
-                       break;
-               case wxCROSSDIAG_HATCH:
-                       theIndex = 7;
-                       break;
-               default:
-                       theIndex = 1; // solid pattern
-                       break;
-       }
-       *pattern = gHatchPatterns[theIndex-1] ;
+    int theIndex = 1 ;
+    switch(hatchStyle)
+    {
+    case wxBDIAGONAL_HATCH:
+        theIndex = 2;
+        break;
+    case wxFDIAGONAL_HATCH:
+        theIndex = 3;
+        break;
+    case wxCROSS_HATCH:
+        theIndex = 4;
+        break;
+    case wxHORIZONTAL_HATCH:
+        theIndex = 5;
+        break;
+    case wxVERTICAL_HATCH:
+        theIndex = 6;
+        break;
+    case wxCROSSDIAG_HATCH:
+        theIndex = 7;
+        break;
+    default:
+        theIndex = 1; // solid pattern
+        break;
+    }
+    *pattern = gHatchPatterns[theIndex-1] ;
 }
+
 void wxDC::MacInstallPen() const
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
-       Pattern  blackColor;
-//     if ( m_macPenInstalled )
-//             return ;
-       RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
-       RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
-       ::RGBForeColor( &forecolor );
-       ::RGBBackColor( &backcolor );
-       ::PenNormal() ;
-       int penWidth = m_pen.GetWidth() * (int) m_scaleX ;
-       // null means only one pixel, at whatever resolution
-       if ( penWidth == 0 )
-               penWidth = 1 ;
-       ::PenSize(penWidth, penWidth);
-       int penStyle = m_pen.GetStyle();
-       if (penStyle == wxSOLID)
-       {
-               ::PenPat(GetQDGlobalsBlack(&blackColor));
-       }
-       else if (IS_HATCH(penStyle))
-       {
-               Pattern pat ;
-               wxMacGetHatchPattern(penStyle, &pat);
-               ::PenPat(&pat);
-       }
-       else
-       {
-           Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
-           switch( penStyle )
-           {
-               case wxDOT :
-                for ( int i = 0 ; i < 8 ; ++i )
-                {
-                    pat.pat[i] = 0xCC ;
-                }
-                   break ;
-               case wxLONG_DASH :
-                for ( int i = 0 ; i < 8 ; ++i )
-                {
-                    pat.pat[i] = 0xFE ;
-                }
-                   break ;
-               case wxSHORT_DASH :
-                for ( int i = 0 ; i < 8 ; ++i )
-                {
-                    pat.pat[i] = 0xEE ;
-                }
-                   break ;
-               case wxDOT_DASH :
+    Pattern     blackColor;
+    //    if ( m_macPenInstalled )
+    //        return ;
+    RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
+    RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
+    ::RGBForeColor( &forecolor );
+    ::RGBBackColor( &backcolor );
+    ::PenNormal() ;
+    int penWidth = m_pen.GetWidth() * (int) m_scaleX ;
+    // null means only one pixel, at whatever resolution
+    if ( penWidth == 0 )
+        penWidth = 1 ;
+    ::PenSize(penWidth, penWidth);
+    int penStyle = m_pen.GetStyle();
+    if (penStyle == wxSOLID)
+    {
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+    }
+    else if (IS_HATCH(penStyle))
+    {
+        Pattern pat ;
+        wxMacGetHatchPattern(penStyle, &pat);
+        ::PenPat(&pat);
+    }
+    else
+    {
+        Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
+        switch( penStyle )
+        {
+        case wxDOT :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0xCC ;
+            }
+            break ;
+        case wxLONG_DASH :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0xFE ;
+            }
+            break ;
+        case wxSHORT_DASH :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0xEE ;
+            }
+            break ;
+        case wxDOT_DASH :
+            for ( int i = 0 ; i < 8 ; ++i )
+            {
+                pat.pat[i] = 0x6F ;
+            }
+            break ;
+        case wxUSER_DASH :
+            {
+                wxDash* dash ;
+                m_pen.GetDashes(&dash) ;
+                // right now we don't allocate larger pixmaps
+                // int number = 
+                m_pen.GetDashes(&dash) ;
                 for ( int i = 0 ; i < 8 ; ++i )
                 {
-                    pat.pat[i] = 0x6F ;
+                    pat.pat[i] = dash[0] ;
                 }
-                   break ;
-               case wxUSER_DASH :
-                   {
-                       wxDash* dash ;
-                    m_pen.GetDashes(&dash) ;
-                       // right now we don't allocate larger pixmaps
-                       // int number = 
-                       m_pen.GetDashes(&dash) ;
-                       for ( int i = 0 ; i < 8 ; ++i )
-                       {
-                           pat.pat[i] = dash[0] ;
-                       }
-                   }
-                   break ;
-           }
-               ::PenPat(&pat);
-       }
-       short mode = patCopy ;
-       // todo :
-       switch( m_logicalFunction )
-       {
-               case wxCOPY:       // only foreground color, leave background (thus not patCopy)
-                       mode = patOr ;
-                       break ;
-               case wxINVERT:     // NOT dst
-//                     ::PenPat(GetQDGlobalsBlack(&blackColor));
-                       mode = patXor ;
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = patXor ;
-                       break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                       mode = notPatOr ;
-                       break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notPatCopy ;
-                       break ;
-               // unsupported TODO
-               case wxCLEAR:      // 0
-               case wxAND_REVERSE:// src AND (NOT dst)
-               case wxAND:        // src AND dst
-               case wxAND_INVERT: // (NOT src) AND dst
-               case wxNO_OP:      // dst
-               case wxNOR:        // (NOT src) AND (NOT dst)
-               case wxEQUIV:      // (NOT src) XOR dst
-               case wxOR_INVERT:  // (NOT src) OR dst
-               case wxNAND:       // (NOT src) OR (NOT dst)
-               case wxOR:         // src OR dst
-               case wxSET:        // 1
-//             case wxSRC_OR:     // source _bitmap_ OR destination
-//             case wxSRC_AND:     // source _bitmap_ AND destination
-                       break ;
-       }
-       ::PenMode( mode ) ;
-       m_macPenInstalled = true ;
-       m_macBrushInstalled = false ;
-       m_macFontInstalled = false ;
+            }
+            break ;
+        }
+        ::PenPat(&pat);
+    }
+    short mode = patCopy ;
+    // todo :
+    switch( m_logicalFunction )
+    {
+    case wxCOPY:       // only foreground color, leave background (thus not patCopy)
+        mode = patOr ;
+        break ;
+    case wxINVERT:     // NOT dst
+        //            ::PenPat(GetQDGlobalsBlack(&blackColor));
+        mode = patXor ;
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = patXor ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        mode = notPatOr ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notPatCopy ;
+        break ;
+        // unsupported TODO
+    case wxCLEAR:      // 0
+    case wxAND_REVERSE:// src AND (NOT dst)
+    case wxAND:        // src AND dst
+    case wxAND_INVERT: // (NOT src) AND dst
+    case wxNO_OP:      // dst
+    case wxNOR:        // (NOT src) AND (NOT dst)
+    case wxEQUIV:      // (NOT src) XOR dst
+    case wxOR_INVERT:  // (NOT src) OR dst
+    case wxNAND:       // (NOT src) OR (NOT dst)
+    case wxOR:         // src OR dst
+    case wxSET:        // 1
+        //        case wxSRC_OR:     // source _bitmap_ OR destination
+        //        case wxSRC_AND:     // source _bitmap_ AND destination
+        break ;
+    }
+    ::PenMode( mode ) ;
+    m_macPenInstalled = true ;
+    m_macBrushInstalled = false ;
+    m_macFontInstalled = false ;
 }
+
 void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
 {
     Pattern whiteColor ;
     switch( background.MacGetBrushKind() )
     {
-      case kwxMacBrushTheme :
+    case kwxMacBrushTheme :
         {
-               ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
-          break ;
+            ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
+            break ;
         }
-      case kwxMacBrushThemeBackground :
+    case kwxMacBrushThemeBackground :
         {
-               Rect extent ;
-               ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
-               ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
-          break ;
+            Rect extent ;
+            ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
+            ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
+            break ;
         }
-      case kwxMacBrushColour :
+    case kwxMacBrushColour :
         {
-                   ::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
-               int brushStyle = background.GetStyle();
-               if (brushStyle == wxSOLID)
-                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
-               else if (IS_HATCH(brushStyle))
-               {
-                       Pattern pat ;
-                       wxMacGetHatchPattern(brushStyle, &pat);
-                       ::BackPat(&pat);
-               }
-               else
-               {
-                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
-               }
-          break ;
+               ::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
+            int brushStyle = background.GetStyle();
+            if (brushStyle == wxSOLID)
+                ::BackPat(GetQDGlobalsWhite(&whiteColor));
+            else if (IS_HATCH(brushStyle))
+            {
+                Pattern pat ;
+                wxMacGetHatchPattern(brushStyle, &pat);
+                ::BackPat(&pat);
+            }
+            else
+            {
+                ::BackPat(GetQDGlobalsWhite(&whiteColor));
+            }
+            break ;
         }
     }
 }
+
 void wxDC::MacInstallBrush() const
 {
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
-       Pattern  blackColor ;
-//     if ( m_macBrushInstalled )
-//             return ;
-       // foreground
-       bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
-       ::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
-       ::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
-       int brushStyle = m_brush.GetStyle();
-       if (brushStyle == wxSOLID)
-       {
-               ::PenPat(GetQDGlobalsBlack(&blackColor));
-    }
-       else if (IS_HATCH(brushStyle))
-       {
-               Pattern pat ;
-               wxMacGetHatchPattern(brushStyle, &pat);
-               ::PenPat(&pat);
-       }
-       else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
-       {
-           // we force this in order to be compliant with wxMSW
-           backgroundTransparent = false ;
-           // for these the text fore (and back for MASK_OPAQUE) colors are used
-           wxBitmap* bitmap = m_brush.GetStipple() ;
-           int width = bitmap->GetWidth() ;
-           int height = bitmap->GetHeight() ;
+    Pattern     blackColor ;
+    //    if ( m_macBrushInstalled )
+    //        return ;
+    // foreground
+    bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
+    ::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
+    ::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
+    int brushStyle = m_brush.GetStyle();
+    if (brushStyle == wxSOLID)
+    {
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+    }
+    else if (IS_HATCH(brushStyle))
+    {
+        Pattern pat ;
+        wxMacGetHatchPattern(brushStyle, &pat);
+        ::PenPat(&pat);
+    }
+    else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
+    {
+        // we force this in order to be compliant with wxMSW
+        backgroundTransparent = false ;
+        // for these the text fore (and back for MASK_OPAQUE) colors are used
+        wxBitmap* bitmap = m_brush.GetStipple() ;
+        int width = bitmap->GetWidth() ;
+        int height = bitmap->GetHeight() ;
         GWorldPtr gw = NULL ;
-           if ( m_brush.GetStyle() == wxSTIPPLE )
-               gw = MAC_WXHBITMAP(bitmap->GetHBITMAP())  ;
-           else
-               gw = MAC_WXHBITMAP(bitmap->GetMask()->GetMaskBitmap()) ;
+        if ( m_brush.GetStyle() == wxSTIPPLE )
+            gw = MAC_WXHBITMAP(bitmap->GetHBITMAP())  ;
+        else
+            gw = MAC_WXHBITMAP(bitmap->GetMask()->GetMaskBitmap()) ;
         PixMapHandle gwpixmaphandle = GetGWorldPixMap( gw ) ;
         LockPixels( gwpixmaphandle ) ;
-           bool isMonochrome = !IsPortColor( gw ) ;
+        bool isMonochrome = !IsPortColor( gw ) ;
         if ( !isMonochrome )
         {
             if ( (**gwpixmaphandle).pixelSize == 1 )
                 isMonochrome = true ;
         }
         if ( isMonochrome && width == 8 && height == 8 )
-           {
-               ::RGBForeColor( &MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) );
-               ::RGBForeColor( &MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) );
+        {
+            ::RGBForeColor( &MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) );
+            ::RGBForeColor( &MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) );
             BitMap* gwbitmap = (BitMap*) *gwpixmaphandle ; // since the color depth is 1 it is a BitMap
             UInt8 *gwbits = (UInt8*) gwbitmap->baseAddr ;
             int alignment = gwbitmap->rowBytes & 0x7FFF ;
@@ -1998,91 +2067,92 @@ void wxDC::MacInstallBrush() const
             }
             UnlockPixels( GetGWorldPixMap( gw ) ) ;
             ::PenPat( &pat ) ;
-           }
-           else
-           {
- // this will be the code to handle power of 2 patterns, we will have to arrive at a nice
- // caching scheme before putting this into production
-               Handle      image;
-               long            imageSize;
-               PixPatHandle pixpat = NewPixPat() ;
-               CopyPixMap(gwpixmaphandle, (**pixpat).patMap);
+        }
+        else
+        {
           // this will be the code to handle power of 2 patterns, we will have to arrive at a nice
           // caching scheme before putting this into production
+            Handle      image;
+            long        imageSize;
+            PixPatHandle pixpat = NewPixPat() ;
+            CopyPixMap(gwpixmaphandle, (**pixpat).patMap);
             imageSize = GetPixRowBytes((**pixpat).patMap) *
-                           ((**(**pixpat).patMap).bounds.bottom -
-                           (**(**pixpat).patMap).bounds.top);
+                ((**(**pixpat).patMap).bounds.bottom -
+                (**(**pixpat).patMap).bounds.top);
             PtrToHand( (**gwpixmaphandle).baseAddr, &image, imageSize );
             (**pixpat).patData = image;
             if ( isMonochrome )
             {
-                   CTabHandle ctable = ((**((**pixpat).patMap)).pmTable) ;
-                   ColorSpecPtr ctspec = (ColorSpecPtr) &(**ctable).ctTable ;
-                   if ( ctspec[0].rgb.red == 0x0000 )
-                   {
-                       ctspec[1].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
-                       ctspec[0].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
-                   }
-                   else
-                   {
-                       ctspec[0].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
-                       ctspec[1].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
-                   }
-                   ::CTabChanged( ctable ) ;
+                CTabHandle ctable = ((**((**pixpat).patMap)).pmTable) ;
+                ColorSpecPtr ctspec = (ColorSpecPtr) &(**ctable).ctTable ;
+                if ( ctspec[0].rgb.red == 0x0000 )
+                {
+                    ctspec[1].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
+                    ctspec[0].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
+                }
+                else
+                {
+                    ctspec[0].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
+                    ctspec[1].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
+                }
+                ::CTabChanged( ctable ) ;
             }
             ::PenPixPat(pixpat);
             m_macForegroundPixMap = pixpat ;
-           }
-           UnlockPixels( gwpixmaphandle ) ;
-       }
+        }
+        UnlockPixels( gwpixmaphandle ) ;
+    }
     else
     {
-           ::PenPat(GetQDGlobalsBlack(&blackColor));
-       }
-       short mode = patCopy ;
-       switch( m_logicalFunction )
-       {
-               case wxCOPY:       // src
-                   if ( backgroundTransparent )
-                       mode = patOr ;
-                   else
-                           mode = patCopy ;
-                       break ;
-               case wxINVERT:     // NOT dst
-                   if ( !backgroundTransparent )
-                   {
-                           ::PenPat(GetQDGlobalsBlack(&blackColor));
-                       }
-                       mode = patXor ;
-                       break ;
-               case wxXOR:        // src XOR dst
-                       mode = patXor ;
-                       break ;
-               case wxOR_REVERSE: // src OR (NOT dst)
-                       mode = notPatOr ;
-                       break ;
-               case wxSRC_INVERT: // (NOT src)
-                       mode = notPatCopy ;
-                       break ;
-               // unsupported TODO
-               case wxCLEAR:      // 0
-               case wxAND_REVERSE:// src AND (NOT dst)
-               case wxAND:        // src AND dst
-               case wxAND_INVERT: // (NOT src) AND dst
-               case wxNO_OP:      // dst
-               case wxNOR:        // (NOT src) AND (NOT dst)
-               case wxEQUIV:      // (NOT src) XOR dst
-               case wxOR_INVERT:  // (NOT src) OR dst
-               case wxNAND:       // (NOT src) OR (NOT dst)
-               case wxOR:         // src OR dst
-               case wxSET:        // 1
-//             case wxSRC_OR:     // source _bitmap_ OR destination
-//             case wxSRC_AND:     // source _bitmap_ AND destination
-                       break ;
-       }
-       ::PenMode( mode ) ;
-       m_macBrushInstalled = true ;
-       m_macPenInstalled = false ;
-       m_macFontInstalled = false ;
+        ::PenPat(GetQDGlobalsBlack(&blackColor));
+    }
+    short mode = patCopy ;
+    switch( m_logicalFunction )
+    {
+    case wxCOPY:       // src
+        if ( backgroundTransparent )
+            mode = patOr ;
+        else
+            mode = patCopy ;
+        break ;
+    case wxINVERT:     // NOT dst
+        if ( !backgroundTransparent )
+        {
+            ::PenPat(GetQDGlobalsBlack(&blackColor));
+        }
+        mode = patXor ;
+        break ;
+    case wxXOR:        // src XOR dst
+        mode = patXor ;
+        break ;
+    case wxOR_REVERSE: // src OR (NOT dst)
+        mode = notPatOr ;
+        break ;
+    case wxSRC_INVERT: // (NOT src)
+        mode = notPatCopy ;
+        break ;
+        // unsupported TODO
+    case wxCLEAR:      // 0
+    case wxAND_REVERSE:// src AND (NOT dst)
+    case wxAND:        // src AND dst
+    case wxAND_INVERT: // (NOT src) AND dst
+    case wxNO_OP:      // dst
+    case wxNOR:        // (NOT src) AND (NOT dst)
+    case wxEQUIV:      // (NOT src) XOR dst
+    case wxOR_INVERT:  // (NOT src) OR dst
+    case wxNAND:       // (NOT src) OR (NOT dst)
+    case wxOR:         // src OR dst
+    case wxSET:        // 1
+        //        case wxSRC_OR:     // source _bitmap_ OR destination
+        //        case wxSRC_AND:     // source _bitmap_ AND destination
+        break ;
+    }
+    ::PenMode( mode ) ;
+    m_macBrushInstalled = true ;
+    m_macPenInstalled = false ;
+    m_macFontInstalled = false ;
 }
+
 // ---------------------------------------------------------------------------
 // coordinates transformations
 // ---------------------------------------------------------------------------
@@ -2091,30 +2161,37 @@ wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
 {
     return ((wxDC *)this)->XDEV2LOG(x);
 }
+
 wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
 {
     return ((wxDC *)this)->YDEV2LOG(y);
 }
+
 wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
 {
     return ((wxDC *)this)->XDEV2LOGREL(x);
 }
+
 wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
 {
     return ((wxDC *)this)->YDEV2LOGREL(y);
 }
+
 wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
 {
     return ((wxDC *)this)->XLOG2DEV(x);
 }
+
 wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
 {
     return ((wxDC *)this)->YLOG2DEV(y);
 }
+
 wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
 {
     return ((wxDC *)this)->XLOG2DEVREL(x);
 }
+
 wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
 {
     return ((wxDC *)this)->YLOG2DEVREL(y);
index 1a878857f70126ec0b86fa31ee08e2ccac9a4a61..8e85da2cf5f311eea8d19167278461ebc8ba8d2f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -49,24 +49,24 @@ wxWindowDC::wxWindowDC()
 
 wxWindowDC::wxWindowDC(wxWindow *the_canvas) 
 {
-       wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
-       WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
-       
-       int x , y ;
-       x = y = 0 ;
-       the_canvas->MacWindowToRootWindow( &x , &y ) ;
-       m_macLocalOrigin.x = x ;
-       m_macLocalOrigin.y = y ;
-       CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
-       m_macPort = UMAGetWindowPort( windowref ) ;
-       m_minY = m_minX =  0;
-       wxSize size = the_canvas->GetSize() ;
-       m_maxX = size.x  ;
-       m_maxY = size.y ; 
-
-       m_ok = TRUE ;
+    wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
+    WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
+    
+    int x , y ;
+    x = y = 0 ;
+    the_canvas->MacWindowToRootWindow( &x , &y ) ;
+    m_macLocalOrigin.x = x ;
+    m_macLocalOrigin.y = y ;
+    CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_macPort = UMAGetWindowPort( windowref ) ;
+    m_minY = m_minX =  0;
+    wxSize size = the_canvas->GetSize() ;
+    m_maxX = size.x  ;
+    m_maxY = size.y ; 
+
+     m_ok = TRUE ;
   SetBackground(the_canvas->MacGetBackgroundBrush());
 }
 
@@ -84,30 +84,30 @@ wxClientDC::wxClientDC()
 
 wxClientDC::wxClientDC(wxWindow *window)
 {
-       wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
-        if (!rootwindow)
-            return;
-       WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
-       wxPoint origin = window->GetClientAreaOrigin() ;
-       wxSize size = window->GetClientSize() ;
-       int x , y ;
-       x = origin.x ;
-       y = origin.y ;
-       window->MacWindowToRootWindow( &x , &y ) ;
-       m_macLocalOrigin.x = x ;
-       m_macLocalOrigin.y = y ;
-       SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
-       SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
-       m_macPort = UMAGetWindowPort( windowref ) ;
-       m_minY = m_minX =  0;
-       m_maxX = size.x  ;
-       m_maxY = size.y ; 
-       m_ok = TRUE ;
-  SetBackground(window->MacGetBackgroundBrush());
-       SetFont( window->GetFont() ) ;
+    wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
+    if (!rootwindow)
+        return;
+    WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
+    wxPoint origin = window->GetClientAreaOrigin() ;
+    wxSize size = window->GetClientSize() ;
+    int x , y ;
+    x = origin.x ;
+    y = origin.y ;
+    window->MacWindowToRootWindow( &x , &y ) ;
+    m_macLocalOrigin.x = x ;
+    m_macLocalOrigin.y = y ;
+    SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
+    SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
+    m_macPort = UMAGetWindowPort( windowref ) ;
+    m_minY = m_minX =  0;
+    m_maxX = size.x  ;
+    m_maxY = size.y ; 
+    m_ok = TRUE ;
+    SetBackground(window->MacGetBackgroundBrush());
+    SetFont( window->GetFont() ) ;
 }
 
 wxClientDC::~wxClientDC()
@@ -124,29 +124,29 @@ wxPaintDC::wxPaintDC()
 
 wxPaintDC::wxPaintDC(wxWindow *window)
 {
-       wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
-       WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
-       wxPoint origin = window->GetClientAreaOrigin() ;
-       wxSize size = window->GetClientSize() ;
-       int x , y ;
-       x = origin.x ;
-       y = origin.y ;
-       window->MacWindowToRootWindow( &x , &y ) ;
-       m_macLocalOrigin.x = x ;
-       m_macLocalOrigin.y = y ;
-       SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
-       SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
-  SectRgn( (RgnHandle) m_macBoundaryClipRgn  , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
-       m_macPort = UMAGetWindowPort( windowref ) ;
-       m_minY = m_minX =  0;
-       m_maxX = size.x  ;
-       m_maxY = size.y ; 
-       m_ok = TRUE ;
-  SetBackground(window->MacGetBackgroundBrush());
-       SetFont( window->GetFont() ) ;
+    wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
+    WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
+    wxPoint origin = window->GetClientAreaOrigin() ;
+    wxSize size = window->GetClientSize() ;
+    int x , y ;
+    x = origin.x ;
+    y = origin.y ;
+    window->MacWindowToRootWindow( &x , &y ) ;
+    m_macLocalOrigin.x = x ;
+    m_macLocalOrigin.y = y ;
+    SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
+    SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+    SectRgn( (RgnHandle) m_macBoundaryClipRgn  , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_macPort = UMAGetWindowPort( windowref ) ;
+    m_minY = m_minX =  0;
+    m_maxX = size.x  ;
+    m_maxY = size.y ; 
+    m_ok = TRUE ;
+    SetBackground(window->MacGetBackgroundBrush());
+    SetFont( window->GetFont() ) ;
 }
 
 wxPaintDC::~wxPaintDC()
index d4db46174e6cce6ae64ea89c95322db5cd9c0ddb..e850a59e4d431a92a96d7ef2ff3a6fad623c913c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
 
 wxMemoryDC::wxMemoryDC(void)
-    : m_selected()
+: m_selected()
 {
-  m_ok = TRUE;
+    m_ok = TRUE;
     SetBackground(*wxWHITE_BRUSH);
     SetBrush(*wxWHITE_BRUSH);
     SetPen(*wxBLACK_PEN);
-  m_ok = FALSE;
+    m_ok = FALSE;
 };
 
 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
-    : m_selected()
+: m_selected()
 {
-  m_ok = TRUE;
+    m_ok = TRUE;
     SetBackground(*wxWHITE_BRUSH);
     SetBrush(*wxWHITE_BRUSH);
     SetPen(*wxBLACK_PEN);
-  m_ok = FALSE;
+    m_ok = FALSE;
 };
 
 wxMemoryDC::~wxMemoryDC()
 {
-       if ( m_selected.Ok() )
-       {
-               UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
-       }
+    if ( m_selected.Ok() )
+    {
+        UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
+    }
 };
 
 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
 {
-       if ( m_selected.Ok() )
-       {
-               UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
-       }
+    if ( m_selected.Ok() )
+    {
+        UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
+    }
     m_selected = bitmap;
     if (m_selected.Ok())
     {
-               if ( m_selected.GetHBITMAP() )
-               {
-                       m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
-                       LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
-                       wxMask * mask = bitmap.GetMask() ;
-                       if ( mask )
-                       {
-                               m_macMask = mask->GetMaskBitmap() ;
-                       }
-               SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
-               CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
-                       m_ok = TRUE ;
-               }
-               else
-               {
-               m_ok = FALSE;
-               }
-  }
-  else
-  {
-    m_ok = FALSE;
-  }
+        if ( m_selected.GetHBITMAP() )
+        {
+            m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
+            LockPixels( GetGWorldPixMap(  (CGrafPtr)  m_macPort ) ) ;
+            wxMask * mask = bitmap.GetMask() ;
+            if ( mask )
+            {
+                m_macMask = mask->GetMaskBitmap() ;
+            }
+            SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
+            CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
+            m_ok = TRUE ;
+        }
+        else
+        {
+            m_ok = FALSE;
+        }
+    }
+    else
+    {
+        m_ok = FALSE;
+    }
 }
 
 void wxMemoryDC::DoGetSize( int *width, int *height ) const
 {
-  if (m_selected.Ok())
-  {
-    if (width) (*width) = m_selected.GetWidth();
-    if (height) (*height) = m_selected.GetHeight();
-  }
-  else
-  {
-    if (width) (*width) = 0;
-    if (height) (*height) = 0;
-  }
+    if (m_selected.Ok())
+    {
+        if (width) (*width) = m_selected.GetWidth();
+        if (height) (*height) = m_selected.GetHeight();
+    }
+    else
+    {
+        if (width) (*width) = 0;
+        if (height) (*height) = 0;
+    }
 }
 
 
index 6c32de8ad07f773c2225d7efd676509f24a34f64..2e822438347f4484c863e7f5118996373ee34cbe 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -46,172 +46,172 @@ GrafPtr macPrintFormerPort = NULL ;
 
 wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
 {
-       OSStatus err ;
-       wxString message ;
-       
-       m_printData = printdata ;
-       m_printData.ConvertToNative() ;
+    OSStatus err ;
+    wxString message ;
+    
+    m_printData = printdata ;
+    m_printData.ConvertToNative() ;
 
 #if TARGET_CARBON && PM_USE_SESSION_APIS
-       err = UMAPrOpen(&m_macPrintSessionPort) ;
-       if ( err != noErr || m_macPrintSessionPort == kPMNoData )
+    err = UMAPrOpen(&m_macPrintSessionPort) ;
+    if ( err != noErr || m_macPrintSessionPort == kPMNoData )
 #else
-       err = UMAPrOpen(NULL) ;
-       if ( err != noErr )
+    err = UMAPrOpen(NULL) ;
+    if ( err != noErr )
 #endif
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
 #if TARGET_CARBON && PM_USE_SESSION_APIS
-               UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
 #else
-               UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
 #endif
-               m_ok = FALSE;
-               return;
-       }
-       
+        m_ok = FALSE;
+        return;
+    }
+    
 #if !TARGET_CARBON
-       if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
-       {
-               ::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
-               // the driver has changed in the mean time, should we pop up a page setup dialog ?
-       }
-       err = PrError() ;
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               UMAPrClose(NULL) ;
-               m_ok = FALSE;
-               return;
-       }
-       ::GetPort( &macPrintFormerPort ) ;
-       m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
-       err = PrError() ;
-       if ( err )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               UMAPrClose(NULL) ;
-               m_ok = FALSE;
-               return;
-       }
-       // sets current port
-       m_macPort = (GrafPtr ) m_macPrintSessionPort ;
+    if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
+    {
+        ::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
+        // the driver has changed in the mean time, should we pop up a page setup dialog ?
+    }
+    err = PrError() ;
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+        UMAPrClose(NULL) ;
+        m_ok = FALSE;
+        return;
+    }
+    ::GetPort( &macPrintFormerPort ) ;
+    m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
+    err = PrError() ;
+    if ( err )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+        UMAPrClose(NULL) ;
+        m_ok = FALSE;
+        return;
+    }
+    // sets current port
+    m_macPort = (GrafPtr ) m_macPrintSessionPort ;
 #else
   #if PM_USE_SESSION_APIS
     err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort,
               (PMPrintSettings)m_printData.m_macPrintSettings, 
-             (PMPageFormat)m_printData.m_macPageFormat);
+              (PMPageFormat)m_printData.m_macPageFormat);
     if ( err != noErr )
   #else
-       m_macPrintSessionPort = kPMNoReference ;
+    m_macPrintSessionPort = kPMNoReference ;
     err = PMBeginDocument(
-             m_printData.m_macPrintSettings, 
-             m_printData.m_macPageFormat, 
-             &m_macPrintSessionPort);
+              m_printData.m_macPrintSettings, 
+              m_printData.m_macPageFormat, 
+              &m_macPrintSessionPort);
     if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
   #endif
     {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
-               UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
   #endif
-               m_ok = FALSE;
-               return;
+        m_ok = FALSE;
+        return;
     }
-       // sets current port
-       ::GetPort( (GrafPtr *)&m_macPort ) ;
+    // sets current port
+    ::GetPort( (GrafPtr *)&m_macPort ) ;
 #endif
-       m_ok = TRUE ;
-       m_minY = m_minX = 0 ;
+    m_ok = TRUE ;
+    m_minY = m_minX = 0 ;
 #if TARGET_CARBON
-       PMRect rPaper;
-       
-       err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
+    PMRect rPaper;
+    
+    err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
     if ( err != noErr )
     {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
-               UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
   #endif
-               m_ok = FALSE;
-               return;
+        m_ok = FALSE;
+        return;
     }
-       m_maxX = wxCoord(rPaper.right - rPaper.left) ;
-       m_maxY = wxCoord(rPaper.bottom - rPaper.top);
+    m_maxX = wxCoord(rPaper.right - rPaper.left) ;
+    m_maxY = wxCoord(rPaper.bottom - rPaper.top);
 #else
-       m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
-       m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
+    m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
+    m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
 #endif
 }
 
 wxPrinterDC::~wxPrinterDC(void)
 {
-       OSStatus err ;
-       wxString message ;
+    OSStatus err ;
+    wxString message ;
 #if !TARGET_CARBON
-       if ( m_ok )
-       {
-               ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
-               err = PrError() ;
-               
-               if ( err == noErr )
-               {
-                       if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
-                       {
-                               TPrStatus status ;
-                               ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
-                       }
-               }
-               else
-               {
-                       message.Printf( "Print Error %ld", err ) ;
-                       wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-                   dialog.ShowModal();
-               }
-               ::UMAPrClose(NULL) ;
-//       ::SetPort( macPrintFormerPort ) ;
-               ::SetPort( LMGetWMgrPort() ) ;
-       }
+    if ( m_ok )
+    {
+        ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
+        err = PrError() ;
+        
+        if ( err == noErr )
+        {
+            if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
+            {
+                TPrStatus status ;
+                ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
+            }
+        }
+        else
+        {
+            message.Printf( "Print Error %ld", err ) ;
+            wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+            dialog.ShowModal();
+        }
+        ::UMAPrClose(NULL) ;
+//      ::SetPort( macPrintFormerPort ) ;
+        ::SetPort( LMGetWMgrPort() ) ;
+    }
 #else
-       if ( m_ok ) 
-       {
+    if ( m_ok ) 
+    {
   #if PM_USE_SESSION_APIS
-           err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
+        err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
   #else
-           err = PMEndDocument(m_macPrintSessionPort);
+        err = PMEndDocument(m_macPrintSessionPort);
   #endif
-       if ( err != noErr )
-       {
-                       message.Printf( "Print Error %ld", err ) ;
-                       wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-                   dialog.ShowModal();
-       }
+         if ( err != noErr )
+         {
+            message.Printf( "Print Error %ld", err ) ;
+            wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+            dialog.ShowModal();
+         }
   #if TARGET_CARBON && PM_USE_SESSION_APIS
-           UMAPrClose(&m_macPrintSessionPort) ;
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-           UMAPrClose(NULL) ;
+        UMAPrClose(NULL) ;
   #endif
-       }
+    }
 #endif
 }
 
 bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) ) 
 {
-       return m_ok ;
+    return m_ok ;
 }
 
 void wxPrinterDC::EndDoc(void) 
@@ -220,117 +220,117 @@ void wxPrinterDC::EndDoc(void)
 
 void wxPrinterDC::StartPage(void) 
 {
-       if ( !m_ok )
-               return ;
+    if ( !m_ok )
+        return ;
 
-       m_logicalFunction = wxCOPY;
+      m_logicalFunction = wxCOPY;
 //  m_textAlignment = wxALIGN_TOP_LEFT;
-       m_backgroundMode = wxTRANSPARENT;
+      m_backgroundMode = wxTRANSPARENT;
   
-       m_textForegroundColour = *wxBLACK;
-       m_textBackgroundColour = *wxWHITE;
-       m_pen = *wxBLACK_PEN;
-       m_font = *wxNORMAL_FONT;
-       m_brush = *wxTRANSPARENT_BRUSH;
-       m_backgroundBrush = *wxWHITE_BRUSH;
+      m_textForegroundColour = *wxBLACK;
+      m_textBackgroundColour = *wxWHITE;
+      m_pen = *wxBLACK_PEN;
+      m_font = *wxNORMAL_FONT;
+      m_brush = *wxTRANSPARENT_BRUSH;
+      m_backgroundBrush = *wxWHITE_BRUSH;
     
-       m_macFontInstalled = false ;
-       m_macBrushInstalled = false ;
-       m_macPenInstalled = false ;
+    m_macFontInstalled = false ;
+    m_macBrushInstalled = false ;
+    m_macPenInstalled = false ;
 
-               
-       OSStatus err ;
-       wxString message ;
+        
+    OSStatus err ;
+    wxString message ;
 
 #if !TARGET_CARBON
-       PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
-       m_macLocalOrigin.x =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
-       m_macLocalOrigin.y =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
-       
-       Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
-       ::ClipRect( &clip ) ;
-       err = PrError() ;
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
-               ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
-               ::UMAPrClose(NULL) ;
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+      PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
+      m_macLocalOrigin.x =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
+      m_macLocalOrigin.y =  (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
+      
+    Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
+    ::ClipRect( &clip ) ;
+    err = PrError() ;
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+           ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
+        ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
+        ::UMAPrClose(NULL) ;
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #else
   #if PM_USE_SESSION_APIS
-       err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
-                                (PMPageFormat)m_printData.m_macPageFormat,
-                                nil);
+    err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
+                 (PMPageFormat)m_printData.m_macPageFormat,
+                 nil);
   #else
-       err = PMBeginPage(m_macPrintSessionPort, nil);
+    err = PMBeginPage(m_macPrintSessionPort, nil);
   #endif
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if PM_USE_SESSION_APIS
-               PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
-               PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
-               UMAPrClose(&m_macPrintSessionPort) ;
+           PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
+        PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               PMEndPage(m_macPrintSessionPort);
-               PMEndDocument(m_macPrintSessionPort);
-               UMAPrClose(NULL) ;
+           PMEndPage(m_macPrintSessionPort);
+        PMEndDocument(m_macPrintSessionPort);
+        UMAPrClose(NULL) ;
   #endif
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #endif
 }
 
 void wxPrinterDC::EndPage(void) 
 {
-       if ( !m_ok )
-               return ;
+    if ( !m_ok )
+        return ;
 
-       OSStatus err ;
-       wxString message ;
+    OSStatus err ;
+    wxString message ;
 
 #if !TARGET_CARBON
-       PrClosePage(  (TPPrPort) m_macPort ) ;
-       err = PrError() ;
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-               ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
-               ::UMAPrClose(NULL) ;
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+       PrClosePage(  (TPPrPort) m_macPort ) ;
+    err = PrError() ;
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+        ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
+        ::UMAPrClose(NULL) ;
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #else
   #if PM_USE_SESSION_APIS
-       err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
+    err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
   #else
-       err = PMEndPage(m_macPrintSessionPort);
+    err = PMEndPage(m_macPrintSessionPort);
   #endif
-       if ( err != noErr )
-       {
-               message.Printf( "Print Error %ld", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
+    if ( err != noErr )
+    {
+        message.Printf( "Print Error %ld", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
   #if PM_USE_SESSION_APIS
-               PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
-               UMAPrClose(&m_macPrintSessionPort) ;
+        PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
+        UMAPrClose(&m_macPrintSessionPort) ;
   #else
-               PMEndDocument(m_macPrintSessionPort);
-               UMAPrClose(NULL) ;
+        PMEndDocument(m_macPrintSessionPort);
+        UMAPrClose(NULL) ;
   #endif
-               ::SetPort( macPrintFormerPort ) ;
-               m_ok = FALSE ;
-       }
+           ::SetPort( macPrintFormerPort ) ;
+           m_ok = FALSE ;
+    }
 #endif
 
 }
index 0e12102f6f5dfbd0a2fe3bd1b96a298968041992..03d769a05b41ddf5987b5ac71122aac8a4e4da83 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -24,36 +24,36 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
 wxScreenDC::wxScreenDC()
 {
 #if TARGET_CARBON
-       m_macPort = GetQDGlobalsThePort() ;
-       GrafPtr port ;
-       GetPort( &port ) ;
-       SetPort( (GrafPtr) m_macPort ) ;
-       Point pt = { 0,0 } ;
-    LocalToGlobal( &pt ) ;     
-       SetPort( port ) ;
-       m_macLocalOrigin.x = -pt.h ;
-       m_macLocalOrigin.y = -pt.v ;
+    m_macPort = GetQDGlobalsThePort() ;
+    GrafPtr port ;
+    GetPort( &port ) ;
+    SetPort( (GrafPtr) m_macPort ) ;
+    Point pt = { 0,0 } ;
+    LocalToGlobal( &pt ) ;     
+    SetPort( port ) ;
+    m_macLocalOrigin.x = -pt.h ;
+    m_macLocalOrigin.y = -pt.v ;
 #else
-       m_macPort = LMGetWMgrPort() ;
-       m_macLocalOrigin.x = 0 ;
-       m_macLocalOrigin.y = 0 ;
+    m_macPort = LMGetWMgrPort() ;
+    m_macLocalOrigin.x = 0 ;
+    m_macLocalOrigin.y = 0 ;
 #endif
-       m_ok = TRUE ;
-       BitMap screenBits;
-       GetQDGlobalsScreenBits( &screenBits );
-       m_minX = screenBits.bounds.left ;
+     m_ok = TRUE ;
+    BitMap screenBits;
+    GetQDGlobalsScreenBits( &screenBits );
+     m_minX = screenBits.bounds.left ;
  #if TARGET_CARBON
-       SInt16 height ;
-       GetThemeMenuBarHeight( &height ) ;
-       m_minY = screenBits.bounds.top + height ;
+     SInt16 height ;
+     GetThemeMenuBarHeight( &height ) ;
+     m_minY = screenBits.bounds.top + height ;
  #else
-       m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
+     m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
  #endif
-       m_maxX = screenBits.bounds.right  ;
-       m_maxY = screenBits.bounds.bottom ;
-       MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
-       OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
-       CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
+    m_maxX = screenBits.bounds.right  ;
+    m_maxY = screenBits.bounds.bottom ;
+    MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
 }
 
 wxScreenDC::~wxScreenDC()
index 506e3399adb3cfdef236cc571b420b32fb5f90e7..7b7bfc024b7899c5636d789022edcb6947d7ef24 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -46,7 +46,7 @@ END_EVENT_TABLE()
 
 wxDialog::wxDialog()
 {
-       m_isShown = FALSE;
+      m_isShown = FALSE;
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
 }
 
@@ -57,60 +57,59 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
            long style,
            const wxString& name)
 {
-
-  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
-  
-
-  if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    
+    
+    if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
         return FALSE;
+    
+    MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style)  , name ) ;
+    
+    m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
+    SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
 
-       MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style)  , name ) ;
-
-       m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
-       SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-  return TRUE;
+    return TRUE;
 }
 
 void wxDialog::SetModal(bool flag)
 {
-  if ( flag )
+    if ( flag )
     {
         m_windowStyle |= wxDIALOG_MODAL;
-
+        
         wxModelessWindows.DeleteObject(this);
     }
     else
     {
         m_windowStyle &= ~wxDIALOG_MODAL;
-
+        
         wxModelessWindows.Append(this);
     }
 }
 
 wxDialog::~wxDialog()
 {
-       m_isBeingDeleted = TRUE ;
-  Show(FALSE);
+    m_isBeingDeleted = TRUE ;
+    Show(FALSE);
 }
 
 // By default, pressing escape cancels the dialog , on mac command-stop does the same thing
 void wxDialog::OnCharHook(wxKeyEvent& event)
 {
-  if (
-    ( event.m_keyCode == WXK_ESCAPE || 
-      ( event.m_keyCode == '.' && event.MetaDown() ) )
-     && FindWindow(wxID_CANCEL) )
-  {
-               // Behaviour changed in 2.0: we'll send a Cancel message
-               // to the dialog instead of Close.
-               wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
-               cancelEvent.SetEventObject( this );
-               GetEventHandler()->ProcessEvent(cancelEvent);
-
-               return;
-  }
-  // We didn't process this event.
-  event.Skip();
+    if (( event.m_keyCode == WXK_ESCAPE || 
+        ( event.m_keyCode == '.' && event.MetaDown() ) )
+        && FindWindow(wxID_CANCEL) )
+    {
+        // Behaviour changed in 2.0: we'll send a Cancel message
+        // to the dialog instead of Close.
+        wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+        cancelEvent.SetEventObject( this );
+        GetEventHandler()->ProcessEvent(cancelEvent);
+        
+        return;
+    }
+    // We didn't process this event.
+    event.Skip();
 }
 
 bool wxDialog::IsModal() const
@@ -165,7 +164,7 @@ void wxDialog::DoShowModal()
 
     wxModalDialogs.Append(this);
 
-       wxWindow *parent = GetParent();
+      wxWindow *parent = GetParent();
 
     // remember where the focus was
     wxWindow *winFocus = FindFocus();
@@ -178,23 +177,23 @@ void wxDialog::DoShowModal()
         winFocus = wxTheApp->GetTopWindow();
     }
 #if TARGET_CARBON
-       BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
+    BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
 #else
-       // TODO : test whether parent gets disabled
-       bool formerModal = s_macIsInModalLoop ;
-       s_macIsInModalLoop = true ;
+    // TODO : test whether parent gets disabled
+    bool formerModal = s_macIsInModalLoop ;
+    s_macIsInModalLoop = true ;
 #endif
-       while ( IsModalShowing() )
-       {
-               wxTheApp->MacDoOneEvent() ;
-               // calls process idle itself
-       }
-       
+    while ( IsModalShowing() )
+    {
+        wxTheApp->MacDoOneEvent() ;
+        // calls process idle itself
+    }
+    
 #if TARGET_CARBON
-       EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
+    EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
 #else
     // TODO probably reenable the parent window if any
-       s_macIsInModalLoop = formerModal ;
+    s_macIsInModalLoop = formerModal ;
 #endif
 
 
@@ -209,13 +208,13 @@ void wxDialog::DoShowModal()
 // Replacement for Show(TRUE) for modal dialogs - returns return code
 int wxDialog::ShowModal()
 {
-       if ( !IsModal() )
-       {
-           SetModal(TRUE);
-       }
+    if ( !IsModal() )
+    {
+        SetModal(TRUE);
+    }
 
-       Show(TRUE);
-       return GetReturnCode();
+    Show(TRUE);
+    return GetReturnCode();
 }
 
 // NB: this function (surprizingly) may be called for both modal and modeless
index 9c6c131e68f976f13a5e2d2a0e5f81d5a4a0a947..686405423442d2f944726f597cb2fe81a25d904a 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -40,107 +40,107 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
                          const wxSize& WXUNUSED(size),
                          const wxString& WXUNUSED(name))
 {
-       wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
-       m_path = defaultPath;
+    m_path = defaultPath;
 }
 
 int wxDirDialog::ShowModal()
 {
-       NavDialogOptions                mNavOptions;
-       NavObjectFilterUPP              mNavFilterUPP = NULL;
-       NavPreviewUPP                   mNavPreviewUPP = NULL ;
-       NavReplyRecord                  mNavReply;
-       AEDesc*                                 mDefaultLocation = NULL ;
-       bool                                    mSelectDefault = false ;
-       
-       ::NavGetDefaultDialogOptions(&mNavOptions);
+    NavDialogOptions        mNavOptions;
+    NavObjectFilterUPP        mNavFilterUPP = NULL;
+    NavPreviewUPP            mNavPreviewUPP = NULL ;
+    NavReplyRecord            mNavReply;
+    AEDesc*                    mDefaultLocation = NULL ;
+    bool                    mSelectDefault = false ;
+    
+    ::NavGetDefaultDialogOptions(&mNavOptions);
 
-       mNavFilterUPP   = nil;
-       mNavPreviewUPP  = nil;
-       mSelectDefault  = false;
-       mNavReply.validRecord                           = false;
-       mNavReply.replacing                                     = false;
-       mNavReply.isStationery                          = false;
-       mNavReply.translationNeeded                     = false;
-       mNavReply.selection.descriptorType = typeNull;
-       mNavReply.selection.dataHandle          = nil;
-       mNavReply.keyScript                                     = smSystemScript;
-       mNavReply.fileTranslation                       = nil;
-       
-       // Set default location, the location
-       //   that's displayed when the dialog
-       //   first appears
-       
-       if ( mDefaultLocation ) {
-               
-               if (mSelectDefault) {
-                       mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
-               } else {
-                       mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
-               }
-       }
-       
-       OSErr err = ::NavChooseFolder(
-                                               mDefaultLocation,
-                                               &mNavReply,
-                                               &mNavOptions,
-                                               NULL,
-                                               mNavFilterUPP,
-                                               0L);                                                    // User Data
-       
-       if ( (err != noErr) && (err != userCanceledErr) ) {
-               m_path = "" ;
-               return wxID_CANCEL ;
-       }
+    mNavFilterUPP    = nil;
+    mNavPreviewUPP    = nil;
+    mSelectDefault    = false;
+    mNavReply.validRecord                = false;
+    mNavReply.replacing                    = false;
+    mNavReply.isStationery                = false;
+    mNavReply.translationNeeded            = false;
+    mNavReply.selection.descriptorType = typeNull;
+    mNavReply.selection.dataHandle        = nil;
+    mNavReply.keyScript                    = smSystemScript;
+    mNavReply.fileTranslation            = nil;
+    
+    // Set default location, the location
+    //   that's displayed when the dialog
+    //   first appears
+    
+    if ( mDefaultLocation ) {
+        
+        if (mSelectDefault) {
+            mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
+        } else {
+            mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
+        }
+    }
+    
+    OSErr err = ::NavChooseFolder(
+                        mDefaultLocation,
+                        &mNavReply,
+                        &mNavOptions,
+                        NULL,
+                        mNavFilterUPP,
+                        0L);                            // User Data
+    
+    if ( (err != noErr) && (err != userCanceledErr) ) {
+        m_path = "" ;
+        return wxID_CANCEL ;
+    }
 
-       if (mNavReply.validRecord) {            // User chose a folder
-       
-               FSSpec  folderInfo;
-               FSSpec  outFileSpec ;
-               AEDesc specDesc ;
-               
-               OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
-               if ( err != noErr ) {
-                       m_path = "" ;
-                       return wxID_CANCEL ;
-               }                       
-               folderInfo = **(FSSpec**) specDesc.dataHandle;
-               if (specDesc.dataHandle != nil) {
-                       ::AEDisposeDesc(&specDesc);
-               }
+    if (mNavReply.validRecord) {        // User chose a folder
+    
+        FSSpec    folderInfo;
+        FSSpec  outFileSpec ;
+        AEDesc specDesc ;
+        
+        OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
+        if ( err != noErr ) {
+            m_path = "" ;
+            return wxID_CANCEL ;
+        }            
+        folderInfo = **(FSSpec**) specDesc.dataHandle;
+        if (specDesc.dataHandle != nil) {
+            ::AEDisposeDesc(&specDesc);
+        }
 
-//                     mNavReply.GetFileSpec(folderInfo);
-               
-                       // The FSSpec from NavChooseFolder is NOT the file spec
-                       // for the folder. The parID field is actually the DirID
-                       // of the folder itself, not the folder's parent, and
-                       // the name field is empty. We must call PBGetCatInfo
-                       // to get the parent DirID and folder name
-               
-               Str255          name;
-               CInfoPBRec      thePB;                  // Directory Info Parameter Block
-               thePB.dirInfo.ioCompletion      = nil;
-               thePB.dirInfo.ioVRefNum         = folderInfo.vRefNum;   // Volume is right
-               thePB.dirInfo.ioDrDirID         = folderInfo.parID;             // Folder's DirID
-               thePB.dirInfo.ioNamePtr         = name;
-               thePB.dirInfo.ioFDirIndex       = -1;   // Lookup using Volume and DirID
-               
-               err = ::PBGetCatInfoSync(&thePB);
-               if ( err != noErr ) {
-                       m_path = "" ;
-                       return wxID_CANCEL ;
-               }                       
-                                                                                       // Create cannonical FSSpec
-               ::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
-                                          name, &outFileSpec);
-                                               
-               // outFolderDirID = thePB.dirInfo.ioDrDirID;
-               m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
-               return wxID_OK ;
-       }
-       return wxID_CANCEL;
+//            mNavReply.GetFileSpec(folderInfo);
+        
+            // The FSSpec from NavChooseFolder is NOT the file spec
+            // for the folder. The parID field is actually the DirID
+            // of the folder itself, not the folder's parent, and
+            // the name field is empty. We must call PBGetCatInfo
+            // to get the parent DirID and folder name
+        
+        Str255        name;
+        CInfoPBRec    thePB;            // Directory Info Parameter Block
+        thePB.dirInfo.ioCompletion    = nil;
+        thePB.dirInfo.ioVRefNum        = folderInfo.vRefNum;    // Volume is right
+        thePB.dirInfo.ioDrDirID        = folderInfo.parID;        // Folder's DirID
+        thePB.dirInfo.ioNamePtr        = name;
+        thePB.dirInfo.ioFDirIndex    = -1;    // Lookup using Volume and DirID
+        
+        err = ::PBGetCatInfoSync(&thePB);
+        if ( err != noErr ) {
+            m_path = "" ;
+            return wxID_CANCEL ;
+        }            
+                                            // Create cannonical FSSpec
+        ::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
+                       name, &outFileSpec);
+                        
+        // outFolderDirID = thePB.dirInfo.ioDrDirID;
+        m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
+        return wxID_OK ;
+    }
+    return wxID_CANCEL;
 }
 
index 0f250ccd5ec17ed9f1e2fa38afb3fbfdf57aec91..53e9dcbd68b4ef2f34d0a4c00f7e031035d12d49 100644 (file)
@@ -83,11 +83,11 @@ public:
     const wxString& GetName() const { return m_dirname; }
 
 private:
-       CInfoPBRec                      m_CPB ;
-       wxInt16                         m_index ;
-       long                            m_dirId ;
-       Str255                          m_name ;
-       Boolean                         m_isDir ;
+    CInfoPBRec            m_CPB ;
+    wxInt16                m_index ;
+    long                m_dirId ;
+    Str255                m_name ;
+    Boolean                m_isDir ;
 
     wxString m_dirname;
     wxString m_filespec;
@@ -145,26 +145,26 @@ wxDirData::~wxDirData()
 
 void wxDirData::Rewind() 
 {
-       m_index = 0 ;
+    m_index = 0 ;
 }
 
 bool wxDirData::Read(wxString *filename)
 {
     if ( !m_isDir )
         return FALSE ;
-               
+        
 #if TARGET_CARBON
-       char c_name[256] ;
+    char c_name[256] ;
 #endif
     wxString result;
 
     short err = noErr ;
-       
+    
     while ( err == noErr )
     {
         m_index++ ;
         m_CPB.dirInfo.ioFDirIndex = m_index;
-        m_CPB.dirInfo.ioDrDirID = m_dirId;     /* we need to do this every time */
+        m_CPB.dirInfo.ioDrDirID = m_dirId;    /* we need to do this every time */
         err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
         if ( err != noErr )
             break ;
@@ -270,12 +270,12 @@ wxString wxDir::GetName() const
     wxString name;
     if ( m_data )
     {
-       name = M_DIR->GetName();
-       if ( !name.empty() && (name.Last() == _T('/')) )
-       {
-           // chop off the last (back)slash
-           name.Truncate(name.length() - 1);
-       }
+    name = M_DIR->GetName();
+    if ( !name.empty() && (name.Last() == _T('/')) )
+    {
+        // chop off the last (back)slash
+        name.Truncate(name.length() - 1);
+    }
     }
 
     return name;
index e25b2486e3fbe1fe4226caa3fb3acc86cd343d3d..3502ac55f53159d95850fbf5541859bf85c89f22 100644 (file)
@@ -44,7 +44,7 @@
 class wxDisplayMacPriv
 {
 public:
-       GDHandle m_hndl;
+    GDHandle m_hndl;
 };
 
 size_t wxDisplayBase::GetCount()
index 68b372cb851755a767dc77ce0f4c6c34aa3a4200..b9df2ac0049fdbb811a6fcb96d3642ab1b8b3076 100644 (file)
@@ -82,47 +82,47 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
     bool supported = false ;
     if ( gTrackingGlobals.m_currentSource != NULL )
     {
-      wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
-      
-      if ( data )
-      {
-        size_t formatcount = data->GetFormatCount() ;
-        wxDataFormat *array = new wxDataFormat[ formatcount  ];
-        data->GetAllFormats( array );
-        for (size_t i = 0; !supported && i < formatcount ; i++)
+        wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
+        
+        if ( data )
         {
-            wxDataFormat format = array[i] ;
-            if ( m_dataObject->IsSupported( format ) ) 
+            size_t formatcount = data->GetFormatCount() ;
+            wxDataFormat *array = new wxDataFormat[ formatcount  ];
+            data->GetAllFormats( array );
+            for (size_t i = 0; !supported && i < formatcount ; i++)
             {
-              supported = true ;
-              break ;
+                wxDataFormat format = array[i] ;
+                if ( m_dataObject->IsSupported( format ) ) 
+                {
+                    supported = true ;
+                    break ;
+                }
             }
+            delete[] array ;
         }
-        delete[] array ;
-      }
     }
     if ( !supported )
     {
-      UInt16 items ;
-      OSErr result;
-      CountDragItems((DragReference)m_currentDrag, &items);
-      for (UInt16 index = 1; index <= items && supported == false ; ++index) 
-      {
-          ItemReference theItem;
-          FlavorType theType ;
-          UInt16 flavors = 0 ;
-          GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
-          CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
-          for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
-          {
-            result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
-            if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
+        UInt16 items ;
+        OSErr result;
+        CountDragItems((DragReference)m_currentDrag, &items);
+        for (UInt16 index = 1; index <= items && supported == false ; ++index) 
+        {
+            ItemReference theItem;
+            FlavorType theType ;
+            UInt16 flavors = 0 ;
+            GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
+            CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
+            for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
             {
-              supported = true ;
-              break ;
+                result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
+                if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
+                {
+                    supported = true ;
+                    break ;
+                }
             }
-          }
-      }
+        }
     }
     return supported ;   
 }
@@ -131,109 +131,109 @@ bool wxDropTarget::GetData()
 {
     if (!m_dataObject)
         return FALSE;
-        
+    
     if ( !CurrentDragHasSupportedFormat() )
         return FALSE ;
-     
+    
     bool transferred = false ;   
     if ( gTrackingGlobals.m_currentSource != NULL )
     {
-      wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
-      
-      if ( data )
-      {
-        size_t formatcount = data->GetFormatCount() ;
-        wxDataFormat *array = new wxDataFormat[ formatcount  ];
-        data->GetAllFormats( array );
-        for (size_t i = 0; !transferred && i < formatcount ; i++)
+        wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
+        
+        if ( data )
         {
-            wxDataFormat format = array[i] ;
-            if ( m_dataObject->IsSupported( format ) ) 
+            size_t formatcount = data->GetFormatCount() ;
+            wxDataFormat *array = new wxDataFormat[ formatcount  ];
+            data->GetAllFormats( array );
+            for (size_t i = 0; !transferred && i < formatcount ; i++)
             {
-              int size = data->GetDataSize( format );
-              transferred = true ;
-
-              if (size == 0) 
-              {
-                m_dataObject->SetData(format , 0 , 0 ) ;
-              }
-              else
-              {
-                char *d = new char[size];
-                data->GetDataHere( format , (void*) d );
-                m_dataObject->SetData( format , size , d ) ;
-                delete[] d ;
-              }
+                wxDataFormat format = array[i] ;
+                if ( m_dataObject->IsSupported( format ) ) 
+                {
+                    int size = data->GetDataSize( format );
+                    transferred = true ;
+                    
+                    if (size == 0) 
+                    {
+                        m_dataObject->SetData(format , 0 , 0 ) ;
+                    }
+                    else
+                    {
+                        char *d = new char[size];
+                        data->GetDataHere( format , (void*) d );
+                        m_dataObject->SetData( format , size , d ) ;
+                        delete[] d ;
+                    }
+                }
             }
-         }
-        delete[] array ;
-      }
+            delete[] array ;
+        }
     }
     if ( !transferred )
     {
-      UInt16 items ;
-      OSErr result;
-      bool firstFileAdded = false ;
-      CountDragItems((DragReference)m_currentDrag, &items);
-      for (UInt16 index = 1; index <= items; ++index) 
-      {
-          ItemReference theItem;
-          FlavorType theType ;
-          UInt16 flavors = 0 ;
-          GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
-          CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
-          for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
-          {
-            result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
-            wxDataFormat format(theType) ;
-            if ( m_dataObject->IsSupportedFormat( format ) )
+        UInt16 items ;
+        OSErr result;
+        bool firstFileAdded = false ;
+        CountDragItems((DragReference)m_currentDrag, &items);
+        for (UInt16 index = 1; index <= items; ++index) 
+        {
+            ItemReference theItem;
+            FlavorType theType ;
+            UInt16 flavors = 0 ;
+            GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
+            CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
+            for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
             {
-              FlavorFlags theFlags;
-              result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
-              if (result == noErr) 
-              {
-                  Size dataSize ;
-                  Ptr theData ;
-                  GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
-                         if ( theType == 'TEXT' )
-                         {
-                               // this increment is only valid for allocating, on the next GetFlavorData
-                               // call it is reset again to the original value
-                           dataSize++ ;
-                         }
-                  theData = new char[dataSize];
-                  GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); 
-                  if( theType == 'TEXT' )
-                  {
-                    theData[dataSize]=0 ;       
-                    if ( wxApp::s_macDefaultEncodingIsPC )
-                    {
-                      wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
-                    }
-                    m_dataObject->SetData( format, dataSize, theData );
-                  }
-                  else if ( theType == kDragFlavorTypeHFS )
-                  {
-                    HFSFlavor* theFile = (HFSFlavor*) theData ;
-                    wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
-                    if (  firstFileAdded )
-                       ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
-                    else
+                result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
+                wxDataFormat format(theType) ;
+                if ( m_dataObject->IsSupportedFormat( format ) )
+                {
+                    FlavorFlags theFlags;
+                    result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
+                    if (result == noErr) 
                     {
-                       ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
-                       firstFileAdded = true ; 
+                        Size dataSize ;
+                        Ptr theData ;
+                        GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
+                        if ( theType == 'TEXT' )
+                        {
+                            // this increment is only valid for allocating, on the next GetFlavorData
+                            // call it is reset again to the original value
+                            dataSize++ ;
+                        }
+                        theData = new char[dataSize];
+                        GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); 
+                        if( theType == 'TEXT' )
+                        {
+                            theData[dataSize]=0 ;       
+                            if ( wxApp::s_macDefaultEncodingIsPC )
+                            {
+                                wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
+                            }
+                            m_dataObject->SetData( format, dataSize, theData );
+                        }
+                        else if ( theType == kDragFlavorTypeHFS )
+                        {
+                            HFSFlavor* theFile = (HFSFlavor*) theData ;
+                            wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
+                            if (  firstFileAdded )
+                                ((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
+                            else
+                            {
+                                ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
+                                firstFileAdded = true ;    
+                            }
+                        }
+                        else
+                        {
+                            m_dataObject->SetData( format, dataSize, theData );
+                        }
+                        delete[] theData;
                     }
-                  }
-                  else
-                  {
-                    m_dataObject->SetData( format, dataSize, theData );
-                  }
-                  delete[] theData;
-              }
-              break ;
+                    break ;
+                }
             }
-          }
-      }
+        }
     }
     return TRUE ;   
 }
@@ -273,13 +273,13 @@ wxDropSource::~wxDropSource()
 wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
 {
     wxASSERT_MSG( m_data, wxT("Drop source: no data") );
-
+    
     if (!m_data)
         return (wxDragResult) wxDragNone;
-
+    
     if (m_data->GetFormatCount() == 0)
         return (wxDragResult) wxDragNone;
-
+    
     OSErr result;
     DragReference theDrag;
     RgnHandle dragRegion;
@@ -300,45 +300,45 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
         OSType type = formats[i].GetFormatId() ;
         if ( type == 'TEXT' )
         {
-          dataSize-- ;
-          if ( wxApp::s_macDefaultEncodingIsPC )
-          {
-            wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
-          }
-          AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
+            dataSize-- ;
+            if ( wxApp::s_macDefaultEncodingIsPC )
+            {
+                wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
+            }
+            AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
         }
         else if (type == kDragFlavorTypeHFS )
         {
-          HFSFlavor  theFlavor ;
-               OSErr err = noErr;
-               CInfoPBRec cat;
-          wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
-
-               cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
-               cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
-               cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
-               cat.hFileInfo.ioFDirIndex = 0;
-               err = PBGetCatInfoSync(&cat);
-               if (err == noErr )
-               {
-               theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
-               if (theFlavor.fileSpec.parID == fsRtParID) {
-                       theFlavor.fileCreator = 'MACS';
-                       theFlavor.fileType = 'disk';
-               } else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
-                       theFlavor.fileCreator = 'MACS';
-                       theFlavor.fileType = 'fold';
-               } else {
-                       theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
-                       theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
-               }
-            AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);  
-          }    
+            HFSFlavor  theFlavor ;
+            OSErr err = noErr;
+            CInfoPBRec cat;
+            
+            wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
+            
+            cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
+            cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
+            cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
+            cat.hFileInfo.ioFDirIndex = 0;
+            err = PBGetCatInfoSync(&cat);
+            if (err == noErr )
+            {
+                theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
+                if (theFlavor.fileSpec.parID == fsRtParID) {
+                    theFlavor.fileCreator = 'MACS';
+                    theFlavor.fileType = 'disk';
+                } else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
+                    theFlavor.fileCreator = 'MACS';
+                    theFlavor.fileType = 'fold';
+                } else {
+                    theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
+                    theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
+                }
+                AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);  
+            }    
         }
         else
         {
-          AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);      
+            AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);      
         }
         delete[] dataPtr ;
     }
@@ -349,37 +349,37 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
     
     EventRecord* ev = NULL ;
 #if !TARGET_CARBON // TODO
-       ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
+    ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
 #else
-       EventRecord rec ;
-       ev = &rec ;
-       wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
+    EventRecord rec ;
+    ev = &rec ;
+    wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
 #endif
     const short dragRegionOuterBoundary = 10 ;
     const short dragRegionInnerBoundary = 9 ;
     
     SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary , 
-      ev->where.v  - dragRegionOuterBoundary ,
-      ev->where.h + dragRegionOuterBoundary , 
-      ev->where.v + dragRegionOuterBoundary ) ;
-
+        ev->where.v  - dragRegionOuterBoundary ,
+        ev->where.h + dragRegionOuterBoundary , 
+        ev->where.v + dragRegionOuterBoundary ) ;
+    
     SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary , 
-      ev->where.v  - dragRegionInnerBoundary ,
-      ev->where.h + dragRegionInnerBoundary , 
-      ev->where.v + dragRegionInnerBoundary ) ;
-
+        ev->where.v  - dragRegionInnerBoundary ,
+        ev->where.h + dragRegionInnerBoundary , 
+        ev->where.v + dragRegionInnerBoundary ) ;
+    
     DiffRgn( dragRegion , tempRgn , dragRegion ) ;
     DisposeRgn( tempRgn ) ;    
-      
+    
     // TODO:work with promises in order to return data only when drag
     // was successfully completed
-
+    
     gTrackingGlobals.m_currentSource = this ;
     result = TrackDrag(theDrag, ev , dragRegion);
     DisposeRgn(dragRegion);
     DisposeDrag(theDrag);
     gTrackingGlobals.m_currentSource = NULL ;
-
+    
     return wxDragCopy ;
 }
 
@@ -423,7 +423,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
         case kDragTrackingLeaveHandler:
             break;
         case kDragTrackingEnterWindow:
-           trackingGlobals->m_currentTargetWindow = NULL ;
+            trackingGlobals->m_currentTargetWindow = NULL ;
             trackingGlobals->m_currentTarget = NULL ;
             break;
         case kDragTrackingInWindow:
index 841dc9936a222a456ebc7121ae84d01a62d4a961..b2a2cb240620e8730a5f22707b4e3a944d81cc5c 100644 (file)
@@ -52,160 +52,160 @@ extern bool gUseNavServices ;
 
 struct OpenUserDataRec {
   int           currentfilter ;
-  bool                         saveMode ;
+  bool                saveMode ;
   wxArrayString      name ;
   wxArrayString      extensions ;
-  wxArrayLong          filtermactypes ;
+  wxArrayLong        filtermactypes ;
   NavMenuItemSpecArrayHandle menuitems ;
 };
 
 typedef struct OpenUserDataRec
-       OpenUserDataRec, *OpenUserDataRecPtr;
+    OpenUserDataRec, *OpenUserDataRecPtr;
 
-static pascal void     NavEventProc(
-                                                               NavEventCallbackMessage         inSelector,
-                                                               NavCBRecPtr                                     ioParams,
-                                                               NavCallBackUserData                     ioUserData);
+static pascal void    NavEventProc(
+                                NavEventCallbackMessage        inSelector,
+                                NavCBRecPtr                    ioParams,
+                                NavCallBackUserData            ioUserData);
 
 #if TARGET_CARBON
-               static NavEventUPP      sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
+        static NavEventUPP    sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
 #else
-               static NavEventUPP      sStandardNavEventFilter = NewNavEventProc(NavEventProc);
+        static NavEventUPP    sStandardNavEventFilter = NewNavEventProc(NavEventProc);
 #endif
 
 static pascal void
 NavEventProc(
-       NavEventCallbackMessage         inSelector,
-       NavCBRecPtr                                     ioParams,
-       NavCallBackUserData     ioUserData      )
+    NavEventCallbackMessage        inSelector,
+    NavCBRecPtr                    ioParams,
+    NavCallBackUserData    ioUserData    )
 {
-       OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
-       if (inSelector == kNavCBEvent) {        
+    OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
+    if (inSelector == kNavCBEvent) {    
 #if !TARGET_CARBON
          wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
 #endif
-       
-       else if ( inSelector == kNavCBStart )
-       {
-               if ( data->menuitems )
-                       NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
-       }
-       else if ( inSelector == kNavCBPopupMenuSelect )
-       {
-               NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
-               if ( menu->menuCreator == 'WXNG' )
-               {
-                       data->currentfilter = menu->menuType ;
-                       if ( data->saveMode )
-                       {
-                               int i = menu->menuType ;
-                               wxString extension =  data->extensions[i].AfterLast('.') ;
-                               extension.MakeLower() ;
-                               Str255 filename ;
-                               // get the current filename
-                               NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
-                               CopyPascalStringToC( filename , (char*) filename ) ;
-                               wxString sfilename( filename ) ;
-                               int pos = sfilename.Find('.',TRUE) ;
-                               if ( pos != wxNOT_FOUND )
-                               {
-                                       sfilename = sfilename.Left(pos+1)+extension ;
-                                       CopyCStringToPascal( sfilename.c_str() , filename ) ;
-                                       NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
-                               }
-                       }
-               }
-       }
+    } 
+    else if ( inSelector == kNavCBStart )
+    {
+        if ( data->menuitems )
+            NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
+    }
+    else if ( inSelector == kNavCBPopupMenuSelect )
+    {
+        NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
+        if ( menu->menuCreator == 'WXNG' )
+        {
+            data->currentfilter = menu->menuType ;
+            if ( data->saveMode )
+            {
+                int i = menu->menuType ;
+                wxString extension =  data->extensions[i].AfterLast('.') ;
+                extension.MakeLower() ;
+                Str255 filename ;
+                // get the current filename
+                NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
+                CopyPascalStringToC( filename , (char*) filename ) ;
+                wxString sfilename( filename ) ;
+                int pos = sfilename.Find('.',TRUE) ;
+                if ( pos != wxNOT_FOUND )
+                {
+                    sfilename = sfilename.Left(pos+1)+extension ;
+                    CopyCStringToPascal( sfilename.c_str() , filename ) ;
+                    NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
+                }
+            }
+          }
+    }
 }
 
 const char * gfilters[] =
 {
-       "*.TXT" ,
-       "*.TIF" ,
-       "*.JPG" ,
-       
-       NULL 
+    "*.TXT" ,
+    "*.TIF" ,
+    "*.JPG" ,
+    
+    NULL 
 } ;
 
 OSType gfiltersmac[] =
 {
-       'TEXT' ,
-       'TIFF' ,
-       'JPEG' ,
-       
-       '****'
+    'TEXT' ,
+    'TIFF' ,
+    'JPEG' ,
+    
+    '****'
 } ;
 
 
 
-void MakeUserDataRec(OpenUserDataRec   *myData , const wxString& filter )
+void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
 {
-       myData->menuitems = NULL ;
-       myData->currentfilter = 0 ;
-       myData->saveMode = FALSE ;
-       
-       if ( filter && filter[0] )
-       {
-         wxString filter2(filter) ;
-    int filterIndex = 0;
-    bool isName = true ;
-    wxString current ;
-    for( unsigned int i = 0; i < filter2.Len() ; i++ )
+    myData->menuitems = NULL ;
+    myData->currentfilter = 0 ;
+    myData->saveMode = FALSE ;
+    
+    if ( filter && filter[0] )
     {
-       if( filter2.GetChar(i) == wxT('|') )
-       {
-        if( isName ) {
-          myData->name.Add( current ) ;
-        }
-        else {
-          myData->extensions.Add( current.MakeUpper() ) ;
-          ++filterIndex ;
+        wxString filter2(filter) ;
+        int filterIndex = 0;
+        bool isName = true ;
+        wxString current ;
+        for( unsigned int i = 0; i < filter2.Len() ; i++ )
+        {
+            if( filter2.GetChar(i) == wxT('|') )
+            {
+                if( isName ) {
+                    myData->name.Add( current ) ;
+                }
+                else {
+                    myData->extensions.Add( current.MakeUpper() ) ;
+                    ++filterIndex ;
+                }
+                isName = !isName ;
+                current = "" ;
+            }
+            else
+            {
+                current += filter2.GetChar(i) ;
+            }
         }
-        isName = !isName ;
-         current = "" ;
-       }
-       else
-       {
-        current += filter2.GetChar(i) ;
-       }
-    }
-    // we allow for compatibility reason to have a single filter expression (like *.*) without
-    // an explanatory text, in that case the first part is name and extension at the same time
-      
-    wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
-    if ( current.IsEmpty() )
-        myData->extensions.Add( myData->name[filterIndex] ) ;
-    else
-        myData->extensions.Add( current.MakeUpper() ) ;
-    if ( filterIndex == 0 || isName )
-        myData->name.Add( current.MakeUpper() ) ;
+        // we allow for compatibility reason to have a single filter expression (like *.*) without
+        // an explanatory text, in that case the first part is name and extension at the same time
+        
+        wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
+        if ( current.IsEmpty() )
+            myData->extensions.Add( myData->name[filterIndex] ) ;
+        else
+            myData->extensions.Add( current.MakeUpper() ) ;
+        if ( filterIndex == 0 || isName )
+            myData->name.Add( current.MakeUpper() ) ;
+        
+        ++filterIndex ;
+        
         
-    ++filterIndex ;
-
-
         const size_t extCount = myData->extensions.GetCount();
-               for ( size_t i = 0 ; i < extCount; i++ )
-               {
-                       int j ;
-                       for ( j = 0 ; gfilters[j] ; j++ )
-                       {
-                               if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
-                               {
-                                   myData->filtermactypes.Add( gfiltersmac[j] ) ;
-                                       break ;
-                               }
-                       }
-                       if( gfilters[j] == NULL )
-                       {
-                               myData->filtermactypes.Add( '****' ) ;
-                       }
-               }
-       }
+        for ( size_t i = 0 ; i < extCount; i++ )
+        {
+            int j ;
+            for ( j = 0 ; gfilters[j] ; j++ )
+            {
+                if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
+                {
+                    myData->filtermactypes.Add( gfiltersmac[j] ) ;
+                    break ;
+                }
+            }
+            if( gfilters[j] == NULL )
+            {
+                myData->filtermactypes.Add( '****' ) ;
+            }
+        }
+    }
 }
 
 static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
 {
-    Str255                     filename ;
+    Str255             filename ;
     
 #if TARGET_CARBON
     p2cstrcpy((char *)filename, name) ;
@@ -218,55 +218,55 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
     
     if ( data->extensions.GetCount() > 0 )
     {
-       //for ( int i = 0 ; i < data->numfilters ; ++i )
-           int i = data->currentfilter ;
-           if ( data->extensions[i].Right(2) == ".*" )
-             return true ;
-       
-           {
-             if ( type == (OSType)data->filtermactypes[i] )
-                     return true ;
-           
-             wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
-             while( tokenizer.HasMoreTokens() )
-             {
-               wxString extension = tokenizer.GetNextToken() ;
-             if ( extension.GetChar(0) == '*' )
-                     extension = extension.Mid(1) ;
-           
-             if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
-                     return true ;
-                   }
-           }
-           return false ;
+        //for ( int i = 0 ; i < data->numfilters ; ++i )
+        int i = data->currentfilter ;
+        if ( data->extensions[i].Right(2) == ".*" )
+            return true ;
+        
+        {
+            if ( type == (OSType)data->filtermactypes[i] )
+                return true ;
+            
+            wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
+            while( tokenizer.HasMoreTokens() )
+            {
+                wxString extension = tokenizer.GetNextToken() ;
+                if ( extension.GetChar(0) == '*' )
+                    extension = extension.Mid(1) ;
+                
+                if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
+                    return true ;
+            }
+        }
+        return false ;
     }
     return true ;
 }
 
 #ifndef __DARWIN__
 static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
-{      
-       OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
-       // return true if this item is invisible or a file
-
-       Boolean visibleFlag;
-       Boolean folderFlag;
-       
-       visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
-       folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
-       
-       // because the semantics of the filter proc are "true means don't show
-       // it" we need to invert the result that we return
-       
-       if ( !visibleFlag )
-               return true ;
-               
-       if ( !folderFlag )
-       {
-               return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
-       }       
-               
-       return false ;
+{    
+    OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
+    // return true if this item is invisible or a file
+
+    Boolean visibleFlag;
+    Boolean folderFlag;
+    
+    visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
+    folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
+    
+    // because the semantics of the filter proc are "true means don't show
+    // it" we need to invert the result that we return
+    
+    if ( !visibleFlag )
+        return true ;
+        
+    if ( !folderFlag )
+    {
+        return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
+    }    
+        
+    return false ;
 }
 #endif
 
@@ -335,7 +335,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
         long style, const wxPoint& pos)
 {
-       wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
@@ -362,7 +362,7 @@ pascal Boolean CrossPlatformFilterCallback (
         NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
         if (theItem->descriptorType == typeFSS && !theInfo->isFolder)
         {
-            FSSpec     spec;
+            FSSpec    spec;
             memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
             display = CheckFile( spec.name , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
         }
@@ -373,58 +373,58 @@ pascal Boolean CrossPlatformFilterCallback (
 
 int wxFileDialog::ShowModal()
 {
-    NavDialogOptions          mNavOptions;
-    NavObjectFilterUPP        mNavFilterUPP = NULL;
-    NavPreviewUPP             mNavPreviewUPP = NULL ;
-    NavReplyRecord            mNavReply;
-    AEDesc                    mDefaultLocation ;
-    bool                      mSelectDefault = false ;
-               
-       // zero all data
-       
-       m_path = wxEmptyString ;
-       m_fileName = wxEmptyString ;
-       m_paths.Empty();
-       m_fileNames.Empty();
-
-       // setup dialog
-               
+    NavDialogOptions           mNavOptions;
+    NavObjectFilterUPP           mNavFilterUPP = NULL;
+    NavPreviewUPP           mNavPreviewUPP = NULL ;
+    NavReplyRecord           mNavReply;
+    AEDesc               mDefaultLocation ;
+    bool               mSelectDefault = false ;
+        
+    // zero all data
+    
+    m_path = wxEmptyString ;
+    m_fileName = wxEmptyString ;
+    m_paths.Empty();
+    m_fileNames.Empty();
+
+    // setup dialog
+        
     ::NavGetDefaultDialogOptions(&mNavOptions);
-       
-    mNavFilterUPP      = nil;
-    mNavPreviewUPP     = nil;
-    mSelectDefault     = false;
+    
+    mNavFilterUPP    = nil;
+    mNavPreviewUPP    = nil;
+    mSelectDefault    = false;
     mNavReply.validRecord              = false;
-    mNavReply.replacing                       = false;
+    mNavReply.replacing                   = false;
     mNavReply.isStationery             = false;
-    mNavReply.translationNeeded               = false;
+    mNavReply.translationNeeded           = false;
     mNavReply.selection.descriptorType = typeNull;
     mNavReply.selection.dataHandle     = nil;
-    mNavReply.keyScript                       = smSystemScript;
+    mNavReply.keyScript                   = smSystemScript;
     mNavReply.fileTranslation          = nil;
-               
+        
     // Set default location, the location
     //   that's displayed when the dialog
     //   first appears
-               
+        
     FSSpec location ;
     wxMacFilename2FSSpec( m_dir , &location ) ;
     OSErr err = noErr ;
-               
+        
     mDefaultLocation.descriptorType = typeNull;
     mDefaultLocation.dataHandle     = nil;
 
     err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
 
     if ( mDefaultLocation.dataHandle ) {
-                       
+            
         if (mSelectDefault) {
             mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
         } else {
             mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
         }
     }
-               
+        
 #if TARGET_CARBON
     c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
 #else
@@ -438,7 +438,7 @@ int wxFileDialog::ShowModal()
     c2pstr((char *)mNavOptions.savedFileName ) ;
 #endif
 
-    OpenUserDataRec                    myData;
+    OpenUserDataRec            myData;
     MakeUserDataRec( &myData , m_wildCard ) ;
     myData.currentfilter = m_filterIndex ;
     if ( myData.extensions.GetCount() > 0 )
@@ -464,7 +464,7 @@ int wxFileDialog::ShowModal()
 
         mNavOptions.dialogOptionFlags |= kNavDontAutoTranslate ;
         mNavOptions.dialogOptionFlags |= kNavDontAddTranslateItems ;
-                       
+            
         err = ::NavPutFile(
                            &mDefaultLocation,
                            &mNavReply,
@@ -472,7 +472,7 @@ int wxFileDialog::ShowModal()
                            sStandardNavEventFilter ,
                            NULL,
                            kNavGenericSignature,
-                           &myData);                                   // User Data
+                           &myData);                    // User Data
         m_filterIndex = myData.currentfilter ;
     }
     else
@@ -484,7 +484,7 @@ int wxFileDialog::ShowModal()
             mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
         else
             mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
-                       
+            
         err = ::NavGetFile(
                            &mDefaultLocation,
                            &mNavReply,
@@ -496,23 +496,23 @@ int wxFileDialog::ShowModal()
                            &myData);
         m_filterIndex = myData.currentfilter ;
     }
-               
+        
     DisposeNavObjectFilterUPP(mNavFilterUPP);
     if ( mDefaultLocation.dataHandle != nil )
     {
         ::AEDisposeDesc(&mDefaultLocation);
     }
-               
+        
     if ( (err != noErr) && (err != userCanceledErr) ) {
         return wxID_CANCEL ;
     }
 
     if (mNavReply.validRecord) {
-               
+        
         FSSpec  outFileSpec ;
         AEDesc specDesc ;
         AEKeyword keyWord ;
-                       
+            
         long count ;
         ::AECountItems( &mNavReply.selection , &count ) ;
         for ( long i = 1 ; i <= count ; ++i )
@@ -521,7 +521,7 @@ int wxFileDialog::ShowModal()
             if ( err != noErr ) {
                 m_path = "" ;
                 return wxID_CANCEL ;
-            }                  
+            }            
             outFileSpec = **(FSSpec**) specDesc.dataHandle;
             if (specDesc.dataHandle != nil) {
                 ::AEDisposeDesc(&specDesc);
@@ -566,7 +566,7 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
 wxString
 wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
 {
-  return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
+    return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
 }
 
 
@@ -574,7 +574,7 @@ wxLoadFileSelector(const char *what, const char *extension, const char *default_
 wxString
 wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
 {
-  return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
+    return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
 }
 
 
index 1c6b6518bbf24be2bc8cd249696c0f1c84ba77bb..e134003482a5b61f689b823db36d2135eeedd0a2 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -67,66 +67,66 @@ wxFontRefData::~wxFontRefData()
 
 void wxFontRefData::MacFindFont()
 {
-       if( m_faceName == "" )
-       {
-               switch( m_family )
-               {
-                       case wxDEFAULT :
-                               m_macFontNum = ::GetAppFont() ;
-                               break ;
-                       case wxDECORATIVE :
-                               ::GetFNum( "\pTimes" , &m_macFontNum) ;
-                               break ;
-                       case wxROMAN :
-                               ::GetFNum( "\pTimes" , &m_macFontNum) ;
-                               break ;
-                       case wxSCRIPT :
-                               ::GetFNum( "\pTimes" , &m_macFontNum) ;
-                               break ;
-                       case wxSWISS :
-                               ::GetFNum( "\pGeneva" , &m_macFontNum) ;
-                               break ;
-                       case wxMODERN :
-                               ::GetFNum( "\pMonaco" , &m_macFontNum) ;
-                               break ;
-               }
-               Str255 name ;
-               GetFontName( m_macFontNum , name ) ;
-               CopyPascalStringToC( name , (char*) name ) ;
-               m_faceName = (char*) name ;
-       }
-       else
-       {
-               if ( m_faceName == "systemfont" )
-                       m_macFontNum = ::GetSysFont() ;
-               else if ( m_faceName == "applicationfont" )
-                       m_macFontNum = ::GetAppFont() ;
-               else
-               {
-                       Str255 fontname ;
-                       wxMacStringToPascal( m_faceName , fontname ) ;
-                       ::GetFNum( fontname, &m_macFontNum);
-               }
-       }
-
-       m_macFontStyle = 0;
-       if (m_weight == wxBOLD)
-                m_macFontStyle |= bold;
-       if (m_style == wxITALIC || m_style == wxSLANT) 
-               m_macFontStyle |= italic;
-       if (m_underlined) 
-               m_macFontStyle |= underline;
-       m_macFontSize = m_pointSize ;
-       
-       //TODO:if we supply the style as an additional parameter we must make a testing
-       //sequence in order to degrade gracefully while trying to maintain most of the style
-       //information, meanwhile we just take the normal font and apply the features after
-       OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID); 
+    if( m_faceName == "" )
+    {
+        switch( m_family )
+        {
+            case wxDEFAULT :
+                m_macFontNum = ::GetAppFont() ;
+                break ;
+            case wxDECORATIVE :
+                ::GetFNum( "\pTimes" , &m_macFontNum) ;
+                break ;
+            case wxROMAN :
+                ::GetFNum( "\pTimes" , &m_macFontNum) ;
+                break ;
+            case wxSCRIPT :
+                ::GetFNum( "\pTimes" , &m_macFontNum) ;
+                break ;
+            case wxSWISS :
+                ::GetFNum( "\pGeneva" , &m_macFontNum) ;
+                break ;
+            case wxMODERN :
+                ::GetFNum( "\pMonaco" , &m_macFontNum) ;
+                break ;
+        }
+        Str255 name ;
+        GetFontName( m_macFontNum , name ) ;
+        CopyPascalStringToC( name , (char*) name ) ;
+        m_faceName = (char*) name ;
+    }
+    else
+    {
+        if ( m_faceName == "systemfont" )
+            m_macFontNum = ::GetSysFont() ;
+        else if ( m_faceName == "applicationfont" )
+            m_macFontNum = ::GetAppFont() ;
+        else
+        {
+            Str255 fontname ;
+            wxMacStringToPascal( m_faceName , fontname ) ;
+            ::GetFNum( fontname, &m_macFontNum);
+        }
+    }
+
+    m_macFontStyle = 0;
+    if (m_weight == wxBOLD)
+         m_macFontStyle |= bold;
+    if (m_style == wxITALIC || m_style == wxSLANT) 
+        m_macFontStyle |= italic;
+    if (m_underlined) 
+        m_macFontStyle |= underline;
+    m_macFontSize = m_pointSize ;
+    
+    //TODO:if we supply the style as an additional parameter we must make a testing
+    //sequence in order to degrade gracefully while trying to maintain most of the style
+    //information, meanwhile we just take the normal font and apply the features after
+    OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID); 
     /*
     status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
-        kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage  ,  (UInt32*)&m_macATSUFontID ) ;
+        kFontFullName,    kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage  ,  (UInt32*)&m_macATSUFontID ) ;
     */
-       wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
+    wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
 }
 
 // ----------------------------------------------------------------------------
@@ -173,7 +173,7 @@ wxFont::~wxFont()
 
 bool wxFont::RealizeResource()
 {
-       M_FONTDATA->MacFindFont() ;
+    M_FONTDATA->MacFindFont() ;
     return TRUE;
 }
 
@@ -188,17 +188,17 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
 
 void wxFont::Unshare()
 {
-       // Don't change shared data
-       if (!m_refData)
+    // Don't change shared data
+    if (!m_refData)
     {
-               m_refData = new wxFontRefData();
-       }
+        m_refData = new wxFontRefData();
+    }
     else
     {
-               wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
-               UnRef();
-               m_refData = ref;
-       }
+        wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
+        UnRef();
+        m_refData = ref;
+    }
 }
 
 void wxFont::SetPointSize(int pointSize)
index 5924ed4a9eac0802891a3675914bdbbb203d47d7..03c894c553ad13863823f1d986cb9ec31abe7957 100644 (file)
@@ -7,7 +7,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index 4a91e5703f1bee306fd2166efeb7f78a3bdb2df1..5e9987348e33f3f5c06115e5ef5d2b2903622ea4 100644 (file)
@@ -103,46 +103,46 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
 
 void wxFontEnumeratorHelper::DoEnumerate()
 {
-       MenuHandle      menu ;
-       Str255          p_name ;
-
-       short           lines ;
-       
-       menu = NewMenu( 32000 , "\pFont" )  ;
-       AppendResMenu( menu , 'FONT' ) ;
-       lines = CountMenuItems( menu ) ;
-
-       for ( int i = 1 ; i < lines+1  ; i ++ )
-       {
-           GetMenuItemText( menu , i , p_name ) ;
-           wxString c_name = wxMacMakeStringFromPascal(p_name) ;
-
-           /*
-             
-             if ( m_fixedOnly )
-           {
-               // check that it's a fixed pitch font (there is *no* error here, the
-               // flag name is misleading!)
-               if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
-               {
-                   // not a fixed pitch font
-                   return TRUE;
-               }
-           }
-       
-           if ( m_charset != -1 )
-           {
-               // check that we have the right encoding
-               if ( lf->lfCharSet != m_charset )
-               {
-                   return TRUE;
-               }
-           }
-       
-               */
-               m_fontEnum->OnFacename( c_name ) ;
-       }
-       DisposeMenu( menu ) ;
+    MenuHandle    menu ;
+    Str255        p_name ;
+
+    short         lines ;
+    
+    menu = NewMenu( 32000 , "\pFont" )  ;
+    AppendResMenu( menu , 'FONT' ) ;
+    lines = CountMenuItems( menu ) ;
+
+    for ( int i = 1 ; i < lines+1  ; i ++ )
+    {
+        GetMenuItemText( menu , i , p_name ) ;
+        wxString c_name = wxMacMakeStringFromPascal(p_name) ;
+
+        /*
+          
+          if ( m_fixedOnly )
+        {
+            // check that it's a fixed pitch font (there is *no* error here, the
+            // flag name is misleading!)
+            if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
+            {
+                // not a fixed pitch font
+                return TRUE;
+            }
+        }
+    
+        if ( m_charset != -1 )
+        {
+            // check that we have the right encoding
+            if ( lf->lfCharSet != m_charset )
+            {
+                return TRUE;
+            }
+        }
+    
+        */
+        m_fontEnum->OnFacename( c_name ) ;
+    }
+    DisposeMenu( menu ) ;
 }
 
 // ----------------------------------------------------------------------------
index f8347b5ddd86e64d02387204544cd7d8ad56b43e..e3824f30bba9cabc8f7f96a432eca64eb7bd7d3f 100644 (file)
@@ -53,16 +53,16 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
 
 void wxFrame::Init()
 {
-  m_frameMenuBar = NULL;
-
+    m_frameMenuBar = NULL;
+    
 #if wxUSE_TOOLBAR
-  m_frameToolBar = NULL ;
+    m_frameToolBar = NULL ;
 #endif
-  m_frameStatusBar = NULL;
-  m_winLastFocused = NULL ;
-
+    m_frameStatusBar = NULL;
+    m_winLastFocused = NULL ;
+    
     m_iconized = FALSE;
-
+    
 #if wxUSE_TOOLTIPS
     m_hwndToolTip = 0;
 #endif
@@ -70,7 +70,7 @@ void wxFrame::Init()
 
 wxPoint wxFrame::GetClientAreaOrigin() const
 {
-       // on mac we are at position -1,-1 with the control
+    // on mac we are at position -1,-1 with the control
     wxPoint pt(0, 0);
 
 #if wxUSE_TOOLBAR
@@ -101,27 +101,26 @@ bool wxFrame::Create(wxWindow *parent,
            long style,
            const wxString& name)
 {
-  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
-
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
+    
     if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
         return FALSE;
-
-  MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
-  
-       m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
-       SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-
-  wxModelessWindows.Append(this);
-
-  return TRUE;
+    
+    MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+    
+    m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
+    SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
+    
+    wxModelessWindows.Append(this);
+    
+    return TRUE;
 }
 
 wxFrame::~wxFrame()
 {
-  m_isBeingDeleted = TRUE;
-
-  DeleteAllBars();
-
+    m_isBeingDeleted = TRUE;
+    
+    DeleteAllBars();
 }
 
 
@@ -130,14 +129,14 @@ bool wxFrame::Enable(bool enable)
     if ( !wxWindow::Enable(enable) )
         return FALSE;
 
-       if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
-       {
-               int iMaxMenu = m_frameMenuBar->GetMenuCount(); 
-               for ( int i = 0 ; i < iMaxMenu ; ++ i )
-               {
-                       m_frameMenuBar->EnableTop( i , enable ) ;
-               }
-       }
+    if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
+    {
+         int iMaxMenu = m_frameMenuBar->GetMenuCount(); 
+        for ( int i = 0 ; i < iMaxMenu ; ++ i )
+        {
+            m_frameMenuBar->EnableTop( i , enable ) ;
+        }
+    }
 
     return TRUE;
 }
@@ -149,24 +148,24 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
 
     statusBar = new wxStatusBar(this, id,
         style, name);
-       statusBar->SetSize( 100 , 15 ) ;
+    statusBar->SetSize( 100 , 15 ) ;
     statusBar->SetFieldsCount(number);
     return statusBar;
 }
 
 void wxFrame::PositionStatusBar()
 {
-  if (m_frameStatusBar )
-  {
-    int w, h;
-    GetClientSize(&w, &h);
-    int sw, sh;
-    m_frameStatusBar->GetSize(&sw, &sh);
-
-    // Since we wish the status bar to be directly under the client area,
-    // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
-    m_frameStatusBar->SetSize(0, h, w, sh);
-   }
+    if (m_frameStatusBar )
+    {
+        int w, h;
+        GetClientSize(&w, &h);
+        int sw, sh;
+        m_frameStatusBar->GetSize(&sw, &sh);
+        
+        // Since we wish the status bar to be directly under the client area,
+        // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
+        m_frameStatusBar->SetSize(0, h, w, sh);
+    }
 }
 
 // Responds to colour changes, and passes event on to children.
@@ -215,8 +214,8 @@ void wxFrame::OnActivate(wxActivateEvent& event)
 
         event.Skip();
     }
-       else
-       {
+    else
+    {
         // restore focus to the child which was last focused
         wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
                                             : NULL;
@@ -225,19 +224,19 @@ void wxFrame::OnActivate(wxActivateEvent& event)
             parent = this;
         }
 
-       wxSetFocusToChild(parent, &m_winLastFocused);
+        wxSetFocusToChild(parent, &m_winLastFocused);
 
-           if ( m_frameMenuBar != NULL )
-           {
-               m_frameMenuBar->MacInstallMenuBar() ;
-           }
-           else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
+        if ( m_frameMenuBar != NULL )
+        {
+            m_frameMenuBar->MacInstallMenuBar() ;
+        }
+        else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
         {
             // Trying toplevel frame menbar
             if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
-                   ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
-           }
-       }
+                ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
+         }
+    }
 }
 
 void wxFrame::DetachMenuBar()
@@ -262,40 +261,40 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
 
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
-       wxWindow::DoGetClientSize( x , y ) ;
-
+    wxWindow::DoGetClientSize( x , y ) ;
+    
 #if wxUSE_STATUSBAR
-  if ( GetStatusBar() && y )
-  {
-    int statusX, statusY;
-    GetStatusBar()->GetClientSize(&statusX, &statusY);
-    *y -= statusY;
-  }
+    if ( GetStatusBar() && y )
+    {
+        int statusX, statusY;
+        GetStatusBar()->GetClientSize(&statusX, &statusY);
+        *y -= statusY;
+    }
 #endif // wxUSE_STATUSBAR
-
-  wxPoint pt(GetClientAreaOrigin());
-  if ( y )
-    *y -= pt.y;
-  if ( x ) 
-    *x -= pt.x;
+    
+    wxPoint pt(GetClientAreaOrigin());
+    if ( y )
+        *y -= pt.y;
+    if ( x ) 
+        *x -= pt.x;
 }
 
 void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
 {
-       int currentclientwidth , currentclientheight ;
-       int currentwidth , currentheight ;
-       
-       GetClientSize( &currentclientwidth , &currentclientheight ) ;
-       GetSize( &currentwidth , &currentheight ) ;
-       
-       // find the current client size
+    int currentclientwidth , currentclientheight ;
+    int currentwidth , currentheight ;
+    
+    GetClientSize( &currentclientwidth , &currentclientheight ) ;
+    GetSize( &currentwidth , &currentheight ) ;
+    
+    // find the current client size
 
   // Find the difference between the entire window (title bar and all)
   // and the client area; add this to the new client size to move the
   // window
 
-       DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
-               currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
+    DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
+        currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
 }
 
 
@@ -314,8 +313,8 @@ void wxFrame::PositionToolBar()
 {
     int cw, ch;
 
-       cw = m_width ;
-       ch = m_height ;
+    cw = m_width ;
+    ch = m_height ;
 
     if ( GetStatusBar() )
     {
index 4757f6ca43ecd462d84023acded9bc88e6767386..1a61e4f72378546570d84cdc7b25db76bba3a708 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -29,25 +29,25 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
-       wxSize size = s ;
-       Rect bounds ;
-       Str255 title ;
-       m_rangeMax = range ;
-       m_gaugePos = 0 ;
-       
-       if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
-       {
-               size = wxSize( 200 , 16 ) ;
-       }
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range, 
-               kControlProgressBarProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
-
-  return TRUE;
+    wxSize size = s ;
+    Rect bounds ;
+    Str255 title ;
+    m_rangeMax = range ;
+    m_gaugePos = 0 ;
+    
+    if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
+    {
+        size = wxSize( 200 , 16 ) ;
+    }
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range, 
+        kControlProgressBarProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    
+    return TRUE;
 }
 
 void wxGauge::SetShadowWidth(int w)
@@ -67,7 +67,7 @@ void wxGauge::SetRange(int r)
 void wxGauge::SetValue(int pos)
 {
     m_gaugePos = pos;
-       ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
+       ::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
 }
 
 int wxGauge::GetShadowWidth() const
index 76bc6a264ea7fb6cc25d338c382f19371339adc7..528c5a7efe4467940b2f65a72bdbcec3b76aa440 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index 027bc28a8aada4d0842fbc16d26b26e9062182c6..345fc2aeaf3a6ae42169cb09488275a277fcd203 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #include "wx/mac/uma.h"
 
 /*
- * GLContext implementation
- */
+* GLContext implementation
+*/
 
 wxGLContext::wxGLContext(
-               AGLPixelFormat fmt, wxGLCanvas *win,
-               const wxPalette& palette,
-               const wxGLContext *other        /* for sharing display lists */
-)
+                         AGLPixelFormat fmt, wxGLCanvas *win,
+                         const wxPalette& palette,
+                         const wxGLContext *other        /* for sharing display lists */
+                         )
 {
     m_window = win;
-
+    
     m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetRootWindow()));
-
+    
     m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL);
     wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
-
-       GLboolean b;
+    
+    GLboolean b;
     b = aglSetDrawable(m_glContext, m_drawable);
     wxCHECK_RET( b, wxT("Couldn't bind OpenGl context") );
-       aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
+    aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
     b = aglSetCurrentContext(m_glContext);
     wxCHECK_RET( b, wxT("Couldn't activate OpenGl context") );
 }
 
 wxGLContext::~wxGLContext()
 {
-  if (m_glContext)
-  {
-    aglSetCurrentContext(NULL);
-       aglDestroyContext(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglSetCurrentContext(NULL);
+        aglDestroyContext(m_glContext);
+    }
 }
 
 void wxGLContext::SwapBuffers()
 {
-  if (m_glContext)
-  {
-    aglSwapBuffers(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglSwapBuffers(m_glContext);
+    }
 }
 
 void wxGLContext::SetCurrent()
 {
-  if (m_glContext)
-  {
-    aglSetCurrentContext(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglSetCurrentContext(m_glContext);
+    }
 }
 
 void wxGLContext::Update()
 {
-  if (m_glContext)
-  {
-    aglUpdateContext(m_glContext);
-  }
+    if (m_glContext)
+    {
+        aglUpdateContext(m_glContext);
+    }
 }
 
 void wxGLContext::SetColour(const char *colour)
 {
-  float r = 0.0;
-  float g = 0.0;
-  float b = 0.0;
-  wxColour *col = wxTheColourDatabase->FindColour(colour);
-  if (col)
-  {
-    r = (float)(col->Red()/256.0);
-    g = (float)(col->Green()/256.0);
-    b = (float)(col->Blue()/256.0);
-    glColor3f( r, g, b);
-  }
+    float r = 0.0;
+    float g = 0.0;
+    float b = 0.0;
+    wxColour *col = wxTheColourDatabase->FindColour(colour);
+    if (col)
+    {
+        r = (float)(col->Red()/256.0);
+        g = (float)(col->Green()/256.0);
+        b = (float)(col->Blue()/256.0);
+        glColor3f( r, g, b);
+    }
 }
 
 
 /*
- * wxGLCanvas implementation
- */
+* wxGLCanvas implementation
+*/
 
 IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
 
@@ -118,23 +118,23 @@ BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
 END_EVENT_TABLE()
 
 wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
-    const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-    int *attribList, const wxPalette& palette)
+                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                       int *attribList, const wxPalette& palette)
 {
     Create(parent, NULL, id, pos, size, style, name, attribList, palette);
 }
 
 wxGLCanvas::wxGLCanvas( wxWindow *parent,
-              const wxGLContext *shared, wxWindowID id,
-              const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-              int *attribList, const wxPalette& palette )
+                       const wxGLContext *shared, wxWindowID id,
+                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                       int *attribList, const wxPalette& palette )
 {
     Create(parent, shared, id, pos, size, style, name, attribList, palette);
 }
 
 wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
-                        const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-                        int *attribList, const wxPalette& palette )
+                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                       int *attribList, const wxPalette& palette )
 {
     Create(parent, shared ? shared->GetContext() : NULL, id, pos, size, style, name, attribList, palette);
 }
@@ -151,80 +151,80 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
 {
     GLint data[512];
     GLint defaultAttribs[] = { AGL_RGBA, 
-                    AGL_DOUBLEBUFFER, 
-                    AGL_MINIMUM_POLICY, 
-                    AGL_DEPTH_SIZE, 1,  // use largest available depth buffer
-                    AGL_RED_SIZE, 1, 
-                    AGL_GREEN_SIZE, 1, 
-                    AGL_BLUE_SIZE, 1, 
-                    AGL_ALPHA_SIZE, 0, 
-                    AGL_NONE };
+        AGL_DOUBLEBUFFER, 
+        AGL_MINIMUM_POLICY, 
+        AGL_DEPTH_SIZE, 1,  // use largest available depth buffer
+        AGL_RED_SIZE, 1, 
+        AGL_GREEN_SIZE, 1, 
+        AGL_BLUE_SIZE, 1, 
+        AGL_ALPHA_SIZE, 0, 
+        AGL_NONE };
     GLint *attribs;
     if (!attribList)
     {
-         attribs = defaultAttribs;
+        attribs = defaultAttribs;
     }
     else
     {
-      int arg=0, p=0;
-
-      data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
-      while( (attribList[arg]!=0) && (p<512) )
-      {
-        switch( attribList[arg++] )
+        int arg=0, p=0;
+        
+        data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
+        while( (attribList[arg]!=0) && (p<512) )
         {
-          case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
-          case WX_GL_BUFFER_SIZE:
-            data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_LEVEL:
-            data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
-          case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
-          case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
-          case WX_GL_AUX_BUFFERS:
-            data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_RED:
-            data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_GREEN:
-            data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_BLUE:
-            data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ALPHA:
-            data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_DEPTH_SIZE: 
-            data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_STENCIL_SIZE: 
-            data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_RED:
-            data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_GREEN:
-            data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_BLUE:
-            data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
-          case WX_GL_MIN_ACCUM_ALPHA:
-            data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
-          default:
-            break;
-        }
-      }       
-      data[p] = 0; 
-
-      attribs = data;
+            switch( attribList[arg++] )
+            {
+            case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
+            case WX_GL_BUFFER_SIZE:
+                data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_LEVEL:
+                data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
+            case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
+            case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
+            case WX_GL_AUX_BUFFERS:
+                data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_RED:
+                data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_GREEN:
+                data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_BLUE:
+                data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ALPHA:
+                data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_DEPTH_SIZE: 
+                data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_STENCIL_SIZE: 
+                data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_RED:
+                data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_GREEN:
+                data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_BLUE:
+                data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
+            case WX_GL_MIN_ACCUM_ALPHA:
+                data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
+            default:
+                break;
+            }
+        }       
+        data[p] = 0; 
+        
+        attribs = data;
     }
     
     return aglChoosePixelFormat(NULL, 0, attribs);
 }
 
 bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
-                       const wxPoint& pos, const wxSize& size, long style, const wxString& name,
-                       int *attribList, const wxPalette& palette)
+                        const wxPoint& pos, const wxSize& size, long style, const wxString& name,
+                        int *attribList, const wxPalette& palette)
 {
     wxWindow::Create( parent, id, pos, size, style, name );
-
+    
     AGLPixelFormat fmt = ChoosePixelFormat(attribList);
     wxCHECK_MSG( fmt, false, wxT("Couldn't create OpenGl pixel format") );
-
+    
     m_glContext = new wxGLContext(fmt, this, palette, shared);
-
+    
     aglDestroyPixelFormat(fmt);
     
     return true;
@@ -232,20 +232,20 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID
 
 void wxGLCanvas::SwapBuffers()
 {
-  if (m_glContext)
-    m_glContext->SwapBuffers();
+    if (m_glContext)
+        m_glContext->SwapBuffers();
 }
 
 void wxGLCanvas::UpdateContext()
 {
-  if (m_glContext)
-    m_glContext->Update();
+    if (m_glContext)
+        m_glContext->Update();
 }
 
 void wxGLCanvas::SetViewport()
 {
-  // viewport is initially set to entire port
-  // adjust glViewport to just this window
+    // viewport is initially set to entire port
+    // adjust glViewport to just this window
     int x = 0 ;
     int y = 0 ;
     
@@ -259,49 +259,49 @@ void wxGLCanvas::SetViewport()
     parms[1] = bounds.bottom - bounds.top - ( y + height ) ;
     parms[2] = width ;
     parms[3] = height ;
-  
-       aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
+    
+       aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
 }
 
 void wxGLCanvas::OnSize(wxSizeEvent& event)
 {
-  MacUpdateView() ;
+    MacUpdateView() ;
 }
 
 void wxGLCanvas::MacUpdateView()
 {
-  if (m_glContext)
-  {
-    UpdateContext();
-    m_glContext->SetCurrent();
-    SetViewport();
-  }
+    if (m_glContext)
+    {
+        UpdateContext();
+        m_glContext->SetCurrent();
+        SetViewport();
+    }
 }
 
 void wxGLCanvas::MacSuperChangedPosition()
 {
-  MacUpdateView() ;
-  wxWindow::MacSuperChangedPosition() ;
+    MacUpdateView() ;
+    wxWindow::MacSuperChangedPosition() ;
 }
 
 void wxGLCanvas::MacTopLevelWindowChangedPosition()
 {
-  MacUpdateView() ;
-  wxWindow::MacTopLevelWindowChangedPosition() ;
+    MacUpdateView() ;
+    wxWindow::MacTopLevelWindowChangedPosition() ;
 }
 
 void wxGLCanvas::SetCurrent()
 {
-  if (m_glContext)
-  {
-    m_glContext->SetCurrent();
-  }
+    if (m_glContext)
+    {
+        m_glContext->SetCurrent();
+    }
 }
 
 void wxGLCanvas::SetColour(const char *colour)
 {
-  if (m_glContext)
-    m_glContext->SetColour(colour);
+    if (m_glContext)
+        m_glContext->SetColour(colour);
 }
 
 
index 8428f4fa7b40a9ab95f7e25cf0f24bdb914e5944..f41727e61b661f78ece72e15c30a1fd960361ace 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -47,7 +47,7 @@ bool wxXXXXHelpController::LoadFile(const wxString& file)
 bool wxXXXXHelpController::DisplayContents()
 {
     // TODO
-       return FALSE;
+    return FALSE;
 }
 
 bool wxXXXXHelpController::DisplaySection(int section)
index df10cf7b459cb77c32371a96af5fc16c7f61fcdc..ef4526a6705916e0a4a04c720f8287c3701a074f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -59,16 +59,16 @@ wxIcon::~wxIcon()
 bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
     int desiredWidth, int desiredHeight)
 {
-  UnRef();
-
-  m_refData = new wxBitmapRefData;
-
-  wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
-
-  if ( handler )
-       return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
-  else
-       return FALSE;
+    UnRef();
+    
+    m_refData = new wxBitmapRefData;
+    
+    wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
+    
+    if ( handler )
+        return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
+    else
+        return FALSE;
 }
 
 void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
@@ -80,9 +80,9 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
 IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
 
 bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
-          int desiredWidth, int desiredHeight)
+                                      int desiredWidth, int desiredHeight)
 {
-       short theId = -1 ;
+    short theId = -1 ;
     if ( name == "wxICON_INFORMATION" )
     {
         theId = kNoteIcon ;
@@ -93,46 +93,46 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
     }
     else if ( name == "wxICON_WARNING" )
     {
-         theId = kCautionIcon ;
-   }
+        theId = kCautionIcon ;
+    }
     else if ( name == "wxICON_ERROR" )
     {
         theId = kStopIcon ;
     }
     else
     {
-       Str255 theName ;
-       OSType theType ;
-
-    #if TARGET_CARBON
-       c2pstrcpy( (StringPtr) theName , name ) ;
-    #else
-       strcpy( (char *) theName , name ) ;
-       c2pstr( (char *) theName ) ;
-    #endif
-       
-       Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
-       if ( resHandle != 0L )
-       {
-               GetResInfo( resHandle , &theId , &theType , theName ) ;
-               ReleaseResource( resHandle ) ;
-       }
+        Str255 theName ;
+        OSType theType ;
+        
+#if TARGET_CARBON
+        c2pstrcpy( (StringPtr) theName , name ) ;
+#else
+        strcpy( (char *) theName , name ) ;
+        c2pstr( (char *) theName ) ;
+#endif
+        
+        Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
+        if ( resHandle != 0L )
+        {
+            GetResInfo( resHandle , &theId , &theType , theName ) ;
+            ReleaseResource( resHandle ) ;
+        }
+    }
+    if ( theId != -1 )
+    {
+        CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
+        if ( theIcon )
+        {
+            M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
+            M_BITMAPHANDLERDATA->m_width =  32 ;
+            M_BITMAPHANDLERDATA->m_height = 32 ;
+            
+            M_BITMAPHANDLERDATA->m_depth = 8 ;
+            M_BITMAPHANDLERDATA->m_ok = true ;
+            M_BITMAPHANDLERDATA->m_numColors = 256 ;
+            M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
+            return TRUE ;
+        }
     }
-       if ( theId != -1 )
-       {
-               CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
-               if ( theIcon )
-               {
-                       M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
-                       M_BITMAPHANDLERDATA->m_width =  32 ;
-                       M_BITMAPHANDLERDATA->m_height = 32 ;
-                       
-                       M_BITMAPHANDLERDATA->m_depth = 8 ;
-                       M_BITMAPHANDLERDATA->m_ok = true ;
-                       M_BITMAPHANDLERDATA->m_numColors = 256 ;
-                       M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
-                       return TRUE ;
-               }
-       }
-       return FALSE ;
+    return FALSE ;
 }
index 5a39ba118be58a1b68276499a04eed5b14e5d7a1..6a45f419fdc0a85c422b9a1e68fda81f0f7bdeff 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -282,5 +282,5 @@ bool wxJoystick::ReleaseCapture()
 }
 
 #endif
-       // wxUSE_JOYSTICK
+    // wxUSE_JOYSTICK
 
index 67704b9660bc8b4f049090dffd7212543a25c637..2d7dff4fbcea8bdc3ad2b4f73c6e89a2ab90bd6f 100644 (file)
 #include "wx/utils.h"
 
 #if !USE_SHARED_LIBRARY
-  IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
-       EVT_SIZE( wxListBox::OnSize )
-       EVT_CHAR( wxListBox::OnChar )
+    EVT_SIZE( wxListBox::OnSize )
+    EVT_CHAR( wxListBox::OnChar )
 END_EVENT_TABLE()
 #endif
 
@@ -43,8 +43,8 @@ END_EVENT_TABLE()
 #endif
 
 typedef struct {
- unsigned short instruction;
- void (*function)();
   unsigned short instruction;
   void (*function)();
 } ldefRec, *ldefPtr, **ldefHandle;
 
 #if PRAGMA_STRUCT_ALIGN
@@ -77,105 +77,105 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
     RgnHandle savedClipRegion;
     SInt32 savedPenMode;
     wxListBox*          list;
-  GetPort(&savePort);
-  SetPort((**listHandle).port);
-  grafPtr = (**listHandle).port ;
+    GetPort(&savePort);
+    SetPort((**listHandle).port);
+    grafPtr = (**listHandle).port ;
     // typecast our refCon
     list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
-
+    
     //  Calculate the cell rect.
-
+    
     switch( message ) {
-        case lInitMsg:
-            break;
-
-        case lCloseMsg:
-            break;
-
-        case lDrawMsg:
+    case lInitMsg:
+        break;
+        
+    case lCloseMsg:
+        break;
+        
+    case lDrawMsg:
         {
             const wxString text = list->m_stringArray[cell.v] ;
-
+            
             //  Save the current clip region, and set the clip region to the area we are about
             //  to draw.
-
+            
             savedClipRegion = NewRgn();
             GetClip( savedClipRegion );
-
+            
             ClipRect( drawRect );
             EraseRect( drawRect );
-
-                       wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
-
-                       if ( font )
-                       {
-                               ::TextFont( font->m_macFontNum ) ;
-                               ::TextSize( short(font->m_macFontSize) ) ;
-                               ::TextFace( font->m_macFontStyle ) ;
-                       }
-                       else
-                       {
-                       ::TextFont( kFontIDMonaco ) ;
-                       ::TextSize( 9  );
-                       ::TextFace( 0 ) ;
-                       }
-
+            
+            wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
+            
+            if ( font )
+            {
+                ::TextFont( font->m_macFontNum ) ;
+                ::TextSize( short(font->m_macFontSize) ) ;
+                ::TextFace( font->m_macFontStyle ) ;
+            }
+            else
+            {
+                ::TextFont( kFontIDMonaco ) ;
+                ::TextSize( 9  );
+                ::TextFace( 0 ) ;
+            }
+            
 #if TARGET_CARBON
-               bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-
-               if ( useDrawThemeText )
-               {
-                   Rect frame = { drawRect->top, drawRect->left + 4,
-                                  drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
+            bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
+            
+               if ( useDrawThemeText )
+               {
+                Rect frame = { drawRect->top, drawRect->left + 4,
+                    drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
                 CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
                 CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
-                   CFRelease( sString ) ;
-                               ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
-                       ::DrawThemeTextBox( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               false,
-                                                               &frame,
-                                                               teJustLeft,
-                                                               nil );
-                   CFRelease( mString ) ;
+                CFRelease( sString ) ;
+                ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
+                ::DrawThemeTextBox( mString,
+                    kThemeCurrentPortFont,
+                    kThemeStateActive,
+                    false,
+                    &frame,
+                    teJustLeft,
+                    nil );
+                CFRelease( mString ) ;
             }
-                   else
+            else
 #endif
-                   {
-                       MoveTo(drawRect->left + 4 , drawRect->top + 10 );
-                       DrawText(text, 0 , text.Length());
-                   }
-
+            {
+                MoveTo(drawRect->left + 4 , drawRect->top + 10 );
+                DrawText(text, 0 , text.Length());
+            }
+            
             //  If the cell is hilited, do the hilite now. Paint the cell contents with the
             //  appropriate QuickDraw transform mode.
-
+            
             if( isSelected ) {
                 savedPenMode = GetPortPenMode( (CGrafPtr) grafPtr );
                 SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
                 PaintRect( drawRect );
                 SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
             }
-
+            
             //  Restore the saved clip region.
-
+            
             SetClip( savedClipRegion );
             DisposeRgn( savedClipRegion );
-            }
-            break;
-        case lHiliteMsg:
-
-            //  Hilite or unhilite the cell. Paint the cell contents with the
-            //  appropriate QuickDraw transform mode.
-
-            GetPort( &grafPtr );
-            savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
-            SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
-            PaintRect( drawRect );
-            SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
-            break;
-        default :
-          break ;
+        }
+        break;
+    case lHiliteMsg:
+        
+        //  Hilite or unhilite the cell. Paint the cell contents with the
+        //  appropriate QuickDraw transform mode.
+        
+        GetPort( &grafPtr );
+        savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
+        SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
+        PaintRect( drawRect );
+        SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
+        break;
+    default :
+        break ;
     }
     SetPort(savePort);
 }
@@ -212,27 +212,27 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
 
     Rect bounds ;
     Str255 title ;
-
+    
     MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
-
+    
     ListDefSpec listDef;
     listDef.defType = kListDefUserProcType;
     if ( macListDefUPP == NULL )
     {
-      macListDefUPP = NewListDefUPP( wxMacListDefinition );
+        macListDefUPP = NewListDefUPP( wxMacListDefinition );
     }
-        listDef.u.userProc = macListDefUPP ;
-
+    listDef.u.userProc = macListDefUPP ;
+    
     Str255 fontName ;
     SInt16 fontSize ;
     Style fontStyle ;
-       SInt16 fontNum ;
+    SInt16 fontNum ;
 #if TARGET_CARBON
-       GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+    GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
 #else
-       GetFontName( kFontIDMonaco , fontName ) ;
-       fontSize = 9 ;
-       fontStyle = normal ;
+    GetFontName( kFontIDMonaco , fontName ) ;
+    fontSize = 9 ;
+    fontStyle = normal ;
 #endif 
     CopyPascalStringToC( fontName , (char*) fontName ) ;
     SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
@@ -307,8 +307,8 @@ wxListBox::~wxListBox()
     if ( m_macList )
     {
 #if !TARGET_CARBON
-      DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
-      (**(ListHandle)m_macList).listDefProc = NULL ;
+        DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
+        (**(ListHandle)m_macList).listDefProc = NULL ;
 #endif
         m_macList = NULL ;
     }
@@ -406,25 +406,25 @@ int wxListBox::DoAppend(const wxString& item)
 
 void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
 {
-  MacSetRedraw( false ) ;
-  Clear() ;
-  int n = choices.GetCount();
-
-  for( int i = 0 ; i < n ; ++i )
-  {
-    if ( clientData )
+    MacSetRedraw( false ) ;
+    Clear() ;
+    int n = choices.GetCount();
+    
+    for( int i = 0 ; i < n ; ++i )
     {
+        if ( clientData )
+        {
 #if wxUSE_OWNER_DRAWN
             wxASSERT_MSG(clientData[i] == NULL,
-                         wxT("Can't use client data with owner-drawn listboxes"));
+                wxT("Can't use client data with owner-drawn listboxes"));
 #else // !wxUSE_OWNER_DRAWN
-        Append( choices[i] , clientData[i] ) ;
- #endif
+            Append( choices[i] , clientData[i] ) ;
+#endif
+        }
+        else
+            Append( choices[i] ) ;
     }
-    else
-        Append( choices[i] ) ;
-  }
-
+    
 #if wxUSE_OWNER_DRAWN
     if ( m_windowStyle & wxLB_OWNERDRAW ) {
         // first delete old items
@@ -434,7 +434,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
             m_aItems[ui] = NULL;
         }
         m_aItems.Empty();
-
+        
         // then create new ones
         for ( ui = 0; ui < (size_t)m_noItems; ui++ ) {
             wxOwnerDrawn *pNewItem = CreateItem(ui);
@@ -443,7 +443,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
         }
     }
 #endif // wxUSE_OWNER_DRAWN
-  MacSetRedraw( true ) ;
+    MacSetRedraw( true ) ;
 }
 
 bool wxListBox::HasMultipleSelection() const
@@ -460,20 +460,20 @@ int wxListBox::FindString(const wxString& st) const
     }
     else
         s = st ;
-
+    
     if ( s.Right(1) == "*" )
     {
         wxString search = s.Left( s.Length() - 1 ) ;
         int len = search.Length() ;
         Str255 s1 , s2 ;
-
+        
 #if TARGET_CARBON
         c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
 #else
         strcpy( (char *) s2 , search.c_str() ) ;
         c2pstr( (char *) s2 ) ;
 #endif
-
+        
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
 #if TARGET_CARBON
@@ -495,19 +495,19 @@ int wxListBox::FindString(const wxString& st) const
                     return i ;
             }
         }
-
+        
     }
     else
     {
         Str255 s1 , s2 ;
-
+        
 #if TARGET_CARBON
         c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
 #else
         strcpy( (char *) s2 , s.c_str() ) ;
         c2pstr( (char *) s2 ) ;
 #endif
-
+        
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
 #if TARGET_CARBON
@@ -519,40 +519,40 @@ int wxListBox::FindString(const wxString& st) const
             if ( EqualString( s1 , s2 , false , false ) )
                 return i ;
         }
-   }
-   return -1;
+    }
+    return -1;
 }
 
 void wxListBox::Clear()
 {
-  FreeData();
-  m_noItems = 0;
-  m_stringArray.Empty() ;
-  m_dataArray.Empty() ;
-  MacClear() ;
+    FreeData();
+    m_noItems = 0;
+    m_stringArray.Empty() ;
+    m_dataArray.Empty() ;
+    MacClear() ;
 }
 
 void wxListBox::SetSelection(int N, bool select)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-                 "invalid index in wxListBox::SetSelection" );
-      MacSetSelection( N , select ) ;
-      GetSelections( m_selectionPreImage ) ;
+        "invalid index in wxListBox::SetSelection" );
+    MacSetSelection( N , select ) ;
+    GetSelections( m_selectionPreImage ) ;
 }
 
 bool wxListBox::IsSelected(int N) const
 {
     wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
-                 "invalid index in wxListBox::Selected" );
-
-      return MacIsSelected( N ) ;
+        "invalid index in wxListBox::Selected" );
+    
+    return MacIsSelected( N ) ;
 }
 
 void *wxListBox::DoGetItemClientData(int N) const
 {
     wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
-                 wxT("invalid index in wxListBox::GetClientData"));
-
+        wxT("invalid index in wxListBox::GetClientData"));
+    
     return (void *)m_dataArray[N];
 }
 
@@ -564,8 +564,8 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
 void wxListBox::DoSetItemClientData(int N, void *Client_data)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-                 "invalid index in wxListBox::SetClientData" );
-
+        "invalid index in wxListBox::SetClientData" );
+    
 #if wxUSE_OWNER_DRAWN
     if ( m_windowStyle & wxLB_OWNERDRAW )
     {
@@ -575,7 +575,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
     }
 #endif // wxUSE_OWNER_DRAWN
     wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , "invalid client_data array" ) ;
-
+    
     if ( m_dataArray.GetCount() > (size_t) N )
     {
         m_dataArray[N] = (char*) Client_data ;
@@ -617,17 +617,17 @@ wxString wxListBox::GetString(int N) const
 void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
 {
     wxCHECK_RET( pos >= 0 && pos <= m_noItems,
-                 wxT("invalid index in wxListBox::InsertItems") );
-
+        wxT("invalid index in wxListBox::InsertItems") );
+    
     int nItems = items.GetCount();
-
+    
     for ( int i = 0 ; i < nItems ; i++ )
     {
         m_stringArray.Insert( items[i] , pos + i ) ;
         m_dataArray.Insert( NULL , pos + i ) ;
         MacInsert( pos + i , items[i] ) ;
     }
-
+    
     m_noItems += nItems;
 }
 
@@ -649,44 +649,44 @@ wxSize wxListBox::DoGetBestSize() const
     int lbWidth = 100;  // some defaults
     int lbHeight = 110;
     int wLine;
-
-       {
-               wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
-
-               wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-
-               if ( font )
-               {
-                       ::TextFont( font->m_macFontNum ) ;
-                       ::TextSize( short(font->m_macFontSize) ) ;
-                       ::TextFace( font->m_macFontStyle ) ;
-               }
-               else
-               {
-               ::TextFont( kFontIDMonaco ) ;
-               ::TextSize( 9  );
-               ::TextFace( 0 ) ;
-               }
-
-           // Find the widest line
-           for(int i = 0; i < GetCount(); i++) {
-               wxString str(GetString(i));
-               wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
-               lbWidth = wxMax(lbWidth, wLine);
-           }
-
-           // Add room for the scrollbar
-           lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
-
-           // And just a bit more
-           int cy = 12 ;
-           int cx = ::TextWidth( "X" , 0 , 1 ) ;
-           lbWidth += cx ;
-           
-           // don't make the listbox too tall (limit height to around 10 items) but don't
-           // make it too small neither
-           lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
-       }
+    
+    {
+        wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ; 
+        
+        wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+        
+        if ( font )
+        {
+            ::TextFont( font->m_macFontNum ) ;
+            ::TextSize( short(font->m_macFontSize) ) ;
+            ::TextFace( font->m_macFontStyle ) ;
+        }
+        else
+        {
+            ::TextFont( kFontIDMonaco ) ;
+            ::TextSize( 9  );
+            ::TextFace( 0 ) ;
+        }
+        
+        // Find the widest line
+        for(int i = 0; i < GetCount(); i++) {
+            wxString str(GetString(i));
+            wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
+            lbWidth = wxMax(lbWidth, wLine);
+        }
+        
+        // Add room for the scrollbar
+        lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
+        
+        // And just a bit more
+        int cy = 12 ;
+        int cx = ::TextWidth( "X" , 0 , 1 ) ;
+        lbWidth += cx ;
+        
+        // don't make the listbox too tall (limit height to around 10 items) but don't
+        // make it too small neither
+        lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
+    }
     return wxSize(lbWidth, lbHeight);
 }
 
@@ -704,7 +704,7 @@ void wxListBox::SetupColours()
 void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
 {
     wxControl::Refresh( eraseBack , rect ) ;
-//    MacRedrawControl() ;
+    //    MacRedrawControl() ;
 }
 
 #if wxUSE_OWNER_DRAWN
@@ -735,18 +735,18 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
 /*
 void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
 {
-    wxListBox*          list;
-    // typecast our refCon
-    list = (wxListBox*)refCon;
-
-    MoveTo(cellRect->left + 4 , cellRect->top + 10 );
-    const wxString text = list->m_stringArray[lCell.v] ;
-    ::TextFont( kFontIDMonaco ) ;
-    ::TextSize( 9  );
-    ::TextFace( 0 ) ;
-    DrawText(text, 0 , text.Length());
-
-}
+wxListBox*          list;
+// typecast our refCon
+list = (wxListBox*)refCon;
+
+  MoveTo(cellRect->left + 4 , cellRect->top + 10 );
+  const wxString text = list->m_stringArray[lCell.v] ;
+  ::TextFont( kFontIDMonaco ) ;
+  ::TextSize( 9  );
+  ::TextFace( 0 ) ;
+  DrawText(text, 0 , text.Length());
+  
+    }
 */
 void wxListBox::MacDelete( int N )
 {
@@ -759,7 +759,7 @@ void wxListBox::MacInsert( int n , const char * text)
     Cell cell = { 0 , 0 } ;
     cell.v = n ;
     LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
-//    LSetCell(text, strlen(text), cell, m_macList);
+    //    LSetCell(text, strlen(text), cell, m_macList);
     Refresh();
 }
 
@@ -768,7 +768,7 @@ void wxListBox::MacAppend( const char * text)
     Cell cell = { 0 , 0 } ;
     cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
     LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
- //   LSetCell(text, strlen(text), cell, m_macList);
   //   LSetCell(text, strlen(text), cell, m_macList);
     Refresh();
 }
 
@@ -788,7 +788,7 @@ void wxListBox::MacSetSelection( int n , bool select )
             LSetSelect( false , cell , (ListHandle)m_macList ) ;
         }
     }
-
+    
     cell.v = n ;
     LSetSelect( select , cell , (ListHandle)m_macList ) ;
     LAutoScroll( (ListHandle)m_macList ) ;
@@ -804,7 +804,7 @@ bool wxListBox::MacIsSelected( int n ) const
 
 void wxListBox::MacDestroy()
 {
-//    DisposeExtLDEFInfo( m_macList ) ;
+    //    DisposeExtLDEFInfo( m_macList ) ;
 }
 
 int wxListBox::MacGetSelection() const
@@ -819,12 +819,12 @@ int wxListBox::MacGetSelection() const
 int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
 {
     int no_sel = 0 ;
-
+    
     aSelections.Empty();
-
+    
     Cell cell = { 0 , 0 } ;
     cell.v = 0 ;
-
+    
     while ( LGetSelect( true , &cell ,(ListHandle) m_macList ) )
     {
         aSelections.Add( cell.v ) ;
@@ -840,7 +840,7 @@ void wxListBox::MacSet( int n , const char * text )
     // so we just have to redraw
     Cell cell = { 0 , 0 } ;
     cell.v = n ;
-//  LSetCell(text, strlen(text), cell, m_macList);
+    //  LSetCell(text, strlen(text), cell, m_macList);
     Refresh();
 }
 
@@ -852,7 +852,7 @@ void wxListBox::MacScrollTo( int n )
 void wxListBox::OnSize( const wxSizeEvent &event)
 {
     Point pt;
-
+    
 #if TARGET_CARBON
     GetListCellSize((ListHandle)m_macList, &pt);
 #else
@@ -866,7 +866,7 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
 {
     Boolean wasDoubleClick = false ;
     long    result ;
-
+    
     ::GetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlListBoxDoubleClickTag , sizeof( wasDoubleClick ) , (char*) &wasDoubleClick  , &result ) ;
     if ( !wasDoubleClick )
     {
@@ -881,7 +881,7 @@ void wxListBox::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
 void wxListBox::MacSetRedraw( bool doDraw )
 {
     LSetDrawingMode( doDraw , (ListHandle)m_macList ) ;
-
+    
 }
 
 void wxListBox::MacDoClick()
@@ -889,7 +889,7 @@ void wxListBox::MacDoClick()
     wxArrayInt aSelections;
     int n ;
     size_t count = GetSelections(aSelections);
-
+    
     if ( count == m_selectionPreImage.GetCount() )
     {
         bool hasChanged = false ;
@@ -906,12 +906,12 @@ void wxListBox::MacDoClick()
             return ;
         }
     }
-
+    
     m_selectionPreImage = aSelections;
-
+    
     wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
     event.SetEventObject( this );
-
+    
     if ( count > 0 )
     {
         n = aSelections[0];
@@ -923,11 +923,11 @@ void wxListBox::MacDoClick()
     }
     else
     {
-         n = -1;
+        n = -1;
     }
-
+    
     event.m_commandInt = n;
-
+    
     GetEventHandler()->ProcessEvent(event);
 }
 
@@ -935,35 +935,35 @@ void wxListBox::MacDoDoubleClick()
 {
     wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
     event.SetEventObject( this );
-       GetEventHandler()->ProcessEvent(event) ;
+    GetEventHandler()->ProcessEvent(event) ;
 }
 
 void wxListBox::OnChar(wxKeyEvent& event)
 {
     if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)
     {
-       wxWindow* parent = GetParent() ;
-       while( parent  && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
-               parent = parent->GetParent() ;
-
-       if ( parent && parent->GetDefaultItem() )
-       {
-               wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
-                                               wxButton);
-               if ( def && def->IsEnabled() )
-               {
-                    wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
-                    event.SetEventObject(def);
-                    def->Command(event);
-                    return ;
-               }
-           }
-           event.Skip() ;
+        wxWindow* parent = GetParent() ;
+        while( parent  && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
+            parent = parent->GetParent() ;
+        
+        if ( parent && parent->GetDefaultItem() )
+        {
+            wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
+                wxButton);
+            if ( def && def->IsEnabled() )
+            {
+                wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                event.SetEventObject(def);
+                def->Command(event);
+                return ;
+            }
+        }
+        event.Skip() ;
     }
     /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
     else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
     {
-       wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
+        wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
         wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
         new_event.SetEventObject( win );
         win->GetEventHandler()->ProcessEvent( new_event );
@@ -977,64 +977,64 @@ void wxListBox::OnChar(wxKeyEvent& event)
         new_event.SetWindowChange( event.ControlDown() );
         new_event.SetCurrentFocus( this );
         if ( !GetEventHandler()->ProcessEvent( new_event ) )
-               event.Skip() ;
+            event.Skip() ;
     }
-       else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
-       {
-               // perform the default key handling first
-               wxControl::OnKeyDown( event ) ;
-
+    else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
+    {
+        // perform the default key handling first
+        wxControl::OnKeyDown( event ) ;
+        
         wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
         event.SetEventObject( this );
-
+        
         wxArrayInt aSelections;
         int n, count = GetSelections(aSelections);
         if ( count > 0 )
         {
-               n = aSelections[0];
-               if ( HasClientObjectData() )
-                  event.SetClientObject( GetClientObject(n) );
-              else if ( HasClientUntypedData() )
-                  event.SetClientData( GetClientData(n) );
-              event.SetString( GetString(n) );
+            n = aSelections[0];
+            if ( HasClientObjectData() )
+                event.SetClientObject( GetClientObject(n) );
+            else if ( HasClientUntypedData() )
+                event.SetClientData( GetClientData(n) );
+            event.SetString( GetString(n) );
         }
         else
         {
-             n = -1;
+            n = -1;
         }
-
+        
         event.m_commandInt = n;
-
+        
         GetEventHandler()->ProcessEvent(event);
-       }
-       else
-       {
-         if ( event.GetTimestamp() > m_lastTypeIn + 60 )
-         {
-           m_typeIn = "" ;
-         }
-         m_lastTypeIn = event.GetTimestamp() ;
-         m_typeIn += (char) event.GetKeyCode() ;
-         int line = FindString("*"+m_typeIn+"*") ;
-         if ( line >= 0 )
-         {
-               if ( GetSelection() != line )
-               {
-               SetSelection(line) ;
-               wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
-               event.SetEventObject( this );
-
-            if ( HasClientObjectData() )
-              event.SetClientObject( GetClientObject( line ) );
-               else if ( HasClientUntypedData() )
-              event.SetClientData( GetClientData(line) );
-               event.SetString( GetString(line) );
-
-               event.m_commandInt = line ;
-
-               GetEventHandler()->ProcessEvent(event);
-           }
-         }
-       }
+    }
+    else
+    {
+        if ( event.GetTimestamp() > m_lastTypeIn + 60 )
+        {
+            m_typeIn = "" ;
+        }
+        m_lastTypeIn = event.GetTimestamp() ;
+        m_typeIn += (char) event.GetKeyCode() ;
+        int line = FindString("*"+m_typeIn+"*") ;
+        if ( line >= 0 )
+        {
+            if ( GetSelection() != line )
+            {
+                SetSelection(line) ;
+                wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
+                event.SetEventObject( this );
+                
+                if ( HasClientObjectData() )
+                    event.SetClientObject( GetClientObject( line ) );
+                else if ( HasClientUntypedData() )
+                    event.SetClientData( GetClientData(line) );
+                event.SetString( GetString(line) );
+                
+                event.m_commandInt = line ;
+                
+                GetEventHandler()->ProcessEvent(event);
+            }
+        }
+    }
 }
 
index c01f4deaf0cc189dd8cf8d79622dac2524f23e87..b6a170c8ee6b5ac400b66cee34e074c8ccc8d8be 100644 (file)
@@ -17,12 +17,12 @@ const short kMaxEvents = 1000 ;
 
 struct wxMacNotificationEvents
 {
-       short top ;
-       short bottom ;
-       
-       wxMacNotificationProcPtr proc[kMaxEvents] ;
-       unsigned long events[kMaxEvents] ;
-       void* data[kMaxEvents] ;
+    short top ;
+    short bottom ;
+    
+    wxMacNotificationProcPtr proc[kMaxEvents] ;
+    unsigned long events[kMaxEvents] ;
+    void* data[kMaxEvents] ;
 } ;
 
 typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
@@ -32,43 +32,43 @@ ProcessSerialNumber gAppProcess ;
 
 void wxMacWakeUp()
 {
-       ProcessSerialNumber psn ;
-       Boolean isSame ;
-       psn.highLongOfPSN = 0 ;
-       psn.lowLongOfPSN = kCurrentProcess ;
-       SameProcess( &gAppProcess , &psn , &isSame ) ;
-       if ( isSame )
-       {
+    ProcessSerialNumber psn ;
+    Boolean isSame ;
+    psn.highLongOfPSN = 0 ;
+    psn.lowLongOfPSN = kCurrentProcess ;
+    SameProcess( &gAppProcess , &psn , &isSame ) ;
+    if ( isSame )
+    {
 #if TARGET_CARBON
-               EventRef dummyEvent ;
-               OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
+        EventRef dummyEvent ;
+        OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
                         kEventAttributeNone, &dummyEvent);
         if (err == noErr) 
         {
-               err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
+            err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
                                   kEventPriorityHigh);
         } 
 #else
-               PostEvent( nullEvent , 0 ) ;
+        PostEvent( nullEvent , 0 ) ;
 #endif
-       }
-       else
-       {
-               WakeUpProcess( &gAppProcess ) ;
-       }
+    }
+    else
+    {
+        WakeUpProcess( &gAppProcess ) ;
+    }
 }
 
 void wxMacCreateNotifierTable()
 {
-       GetCurrentProcess(&gAppProcess);
-       gMacNotificationEvents.top = 0 ;
-       gMacNotificationEvents.bottom = 0 ;
-       for ( int i = 0 ; i < kMaxEvents ; ++i )
-       {
-               gMacNotificationEvents.proc[i] = NULL ;
-               gMacNotificationEvents.events[i] = NULL ;
-               gMacNotificationEvents.data[i] = NULL ;
-       }
+      GetCurrentProcess(&gAppProcess);
+    gMacNotificationEvents.top = 0 ;
+    gMacNotificationEvents.bottom = 0 ;
+    for ( int i = 0 ; i < kMaxEvents ; ++i )
+    {
+        gMacNotificationEvents.proc[i] = NULL ;
+        gMacNotificationEvents.events[i] = NULL ;
+        gMacNotificationEvents.data[i] = NULL ;
+    }
 }
 
 void wxMacDestroyNotifierTable() 
@@ -77,86 +77,86 @@ void wxMacDestroyNotifierTable()
 
 wxMacNotifierTableRef wxMacGetNotifierTable() 
 {
-       return (wxMacNotifierTableRef) &gMacNotificationEvents ;
+    return (wxMacNotifierTableRef) &gMacNotificationEvents ;
 }
 
 void wxMacAddEvent( 
-       wxMacNotifierTableRef table , 
-       wxMacNotificationProcPtr handler , 
-       unsigned long event , 
-       void* data , 
-       short wakeUp ) 
+    wxMacNotifierTableRef table , 
+    wxMacNotificationProcPtr handler , 
+    unsigned long event , 
+    void* data , 
+    short wakeUp ) 
 {
-       wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
-       wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
-       /* this should be protected eventually */
-       short index = e->top++ ;
-       
-       if ( e->top == kMaxEvents )
-               e->top = 0 ;
-
-       e->proc[index] = handler ;
-       e->events[index] = event ;
-       e->data[index] = data ;
-       if ( wakeUp )
-               wxMacWakeUp() ;
+    wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
+    wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
+    /* this should be protected eventually */
+    short index = e->top++ ;
+    
+    if ( e->top == kMaxEvents )
+        e->top = 0 ;
+
+    e->proc[index] = handler ;
+    e->events[index] = event ;
+    e->data[index] = data ;
+    if ( wakeUp )
+        wxMacWakeUp() ;
 }
 
 bool gInProcessing = false ;
 
 void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data ) 
 {
-       wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
-       /* this should be protected eventually */
-       short index = e->bottom ;
-       
-  while ( e->top != index )
-  {
-    if ( index == kMaxEvents )
-      index = 0 ;
-    if ( e->data[index] == data )
-       e->data[index] = NULL ;
-       index++ ;
-  }
+    wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
+    /* this should be protected eventually */
+    short index = e->bottom ;
+    
+    while ( e->top != index )
+    {
+        if ( index == kMaxEvents )
+            index = 0 ;
+        if ( e->data[index] == data )
+            e->data[index] = NULL ;
+        index++ ;
+    }
 }
 
 void wxMacProcessNotifierEvents()
 {
-//  if ( gInProcessing )
-//     return ;
-       
-  gInProcessing = true ;
-  if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
-  {
-    // we only should process the notifiers that were here when we entered it
-    // otherwise we might never get out...  
-       short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
-       if ( count < 0 )
-        count += kMaxEvents ;
-        
-    while ( count-- )
+    //  if ( gInProcessing )
+    //      return ;
+    
+    gInProcessing = true ;
+    if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
     {
-        // consume event at bottom
-       short index = gMacNotificationEvents.bottom++ ;
-        if ( gMacNotificationEvents.bottom == kMaxEvents )
-          gMacNotificationEvents.bottom = 0 ;
-        void* data = gMacNotificationEvents.data[index] ;
-        unsigned long event = gMacNotificationEvents.events[index] ;
-       wxMacNotificationProcPtr handler =  gMacNotificationEvents.proc[index] ;
-       
-       gMacNotificationEvents.data[index] = NULL ;
-       gMacNotificationEvents.events[index] = NULL ;
-       gMacNotificationEvents.proc[index]  = NULL ;
+        // we only should process the notifiers that were here when we entered it
+        // otherwise we might never get out...  
+        short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
+        if ( count < 0 )
+            count += kMaxEvents ;
         
-        if ( handler )
-           handler( event , data  ) ;
-       }
-  }
-  gInProcessing = false ;
+        while ( count-- )
+        {
+            // consume event at bottom
+            short index = gMacNotificationEvents.bottom++ ;
+            if ( gMacNotificationEvents.bottom == kMaxEvents )
+                gMacNotificationEvents.bottom = 0 ;
+            void* data = gMacNotificationEvents.data[index] ;
+            unsigned long event = gMacNotificationEvents.events[index] ;
+            wxMacNotificationProcPtr handler =  gMacNotificationEvents.proc[index] ;
+            
+            gMacNotificationEvents.data[index] = NULL ;
+            gMacNotificationEvents.events[index] = NULL ;
+            gMacNotificationEvents.proc[index]  = NULL ;
+            
+            if ( handler )
+                handler( event , data  ) ;
+        }
+    }
+    gInProcessing = false ;
 }
 
 void wxMacProcessNotifierAndPendingEvents() 
 {
-       wxMacProcessNotifierEvents() ;
-       wxTheApp->ProcessPendingEvents() ;
+    wxMacProcessNotifierEvents() ;
+    wxTheApp->ProcessPendingEvents() ;
 }
index e2cb64e8f5c59124e8dde4ab16dc18611ee970fd..724d53723d1e0ef765fa3f9e52244e7d09dc6d03 100644 (file)
@@ -6,13 +6,13 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/app.h"
 
 WXDLLEXPORT int main(int argc, char* argv[])
 {
-  return wxEntry(argc, argv);
+    return wxEntry(argc, argv);
 }
 
index 9c9a725b48274bbc5a5e98673b80dd193798776d..1d9e43f170c86a14636671a306d98c522ddd3356 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -71,33 +71,33 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
            long style,
            const wxString& name)
 {
-  m_clientWindow = NULL;
-  m_currentChild = NULL;
-
-  // this style can be used to prevent a window from having the standard MDI
-  // "Window" menu
-  if ( style & wxFRAME_NO_WINDOW_MENU )
-  {
-      m_windowMenu = (wxMenu *)NULL;
-      style -= wxFRAME_NO_WINDOW_MENU ;
-  }
-  else // normal case: we have the window menu, so construct it
-  {
-      m_windowMenu = new wxMenu;
-
-      m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
-      m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
-      m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
-      m_windowMenu->AppendSeparator();
-      m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
-      m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
-  }
-
-  wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
-  m_parentFrameActive = TRUE;
+    m_clientWindow = NULL;
+    m_currentChild = NULL;
+    
+    // this style can be used to prevent a window from having the standard MDI
+    // "Window" menu
+    if ( style & wxFRAME_NO_WINDOW_MENU )
+    {
+        m_windowMenu = (wxMenu *)NULL;
+        style -= wxFRAME_NO_WINDOW_MENU ;
+    }
+    else // normal case: we have the window menu, so construct it
+    {
+        m_windowMenu = new wxMenu;
         
-  OnCreateClient();
-
+        m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
+        m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
+        m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
+        m_windowMenu->AppendSeparator();
+        m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
+        m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
+    }
+    
+    wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
+    m_parentFrameActive = TRUE;
+    
+    OnCreateClient();
+    
     return TRUE;
 }
 
@@ -108,13 +108,13 @@ wxMDIParentFrame::~wxMDIParentFrame()
     m_frameToolBar = NULL;
     m_frameStatusBar = NULL;
     m_clientWindow = NULL ;
-
+    
     if (m_windowMenu)
     {
         delete m_windowMenu;
         m_windowMenu = (wxMenu*) NULL;
     }
-
+    
     if ( m_clientWindow )
     {
         delete m_clientWindow;
@@ -126,51 +126,51 @@ wxMDIParentFrame::~wxMDIParentFrame()
 // Get size *available for subwindows* i.e. excluding menu bar.
 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
 {
-       wxDisplaySize( x , y ) ;
+    wxDisplaySize( x , y ) ;
 }
 
 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
 {
-       wxFrame::SetMenuBar( menu_bar ) ;
+    wxFrame::SetMenuBar( menu_bar ) ;
 }
 
 void wxMDIParentFrame::OnSize(wxSizeEvent& event)
 {
 #if wxUSE_CONSTRAINTS
     if (GetAutoLayout())
-      Layout();
+        Layout();
 #endif
     int x = 0;
     int y = 0;
     int width, height;
     GetClientSize(&width, &height);
-
+    
     if ( GetClientWindow() )
         GetClientWindow()->SetSize(x, y, width, height);
 }
 
 void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
 {
-  if ( m_currentChild && event.GetActive() )
-  {
-    wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
-    event.SetEventObject( m_currentChild );
-    m_currentChild->GetEventHandler()->ProcessEvent(event) ;
-  }
-  else if ( event.GetActive() )
-  {
-         if ( m_frameMenuBar != NULL )
-           {
-                 m_frameMenuBar->MacInstallMenuBar() ;
-           }
-
-  }
+    if ( m_currentChild && event.GetActive() )
+    {
+        wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
+        event.SetEventObject( m_currentChild );
+        m_currentChild->GetEventHandler()->ProcessEvent(event) ;
+    }
+    else if ( event.GetActive() )
+    {
+        if ( m_frameMenuBar != NULL )
+        {
+            m_frameMenuBar->MacInstallMenuBar() ;
+        }
+        
+    }
 }
 
 // Returns the active MDI child window
 wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
 {
-  return m_currentChild ;
+    return m_currentChild ;
 }
 
 // Create the client window class (don't Create the window,
@@ -185,7 +185,7 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
     // TODO
-
+    
     // Propagate the event to the non-top-level children
     wxFrame::OnSysColourChanged(event);
 }
@@ -227,27 +227,27 @@ void wxMDIChildFrame::Init()
 }
 
 bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
-           wxWindowID id,
-           const wxString& title,
-           const wxPoint& pos,
-           const wxSize& size,
-           long style,
-           const wxString& name)
+                             wxWindowID id,
+                             const wxString& title,
+                             const wxPoint& pos,
+                             const wxSize& size,
+                             long style,
+                             const wxString& name)
 {
     SetName(name);
-
+    
     if ( id > -1 )
         m_windowId = id;
     else
         m_windowId = (int)NewControlId();
-
+    
     if (parent) parent->AddChild(this);
-
-       MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
-  
-       m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
-       SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-
+    
+    MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
+    
+    m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
+    SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
+    
     wxModelessWindows.Append(this);
     return FALSE;
 }
@@ -262,7 +262,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
 
 void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
 {
-       return wxFrame::SetMenuBar( menu_bar ) ;
+    return wxFrame::SetMenuBar( menu_bar ) ;
 }
 
 // MDI operations
@@ -295,15 +295,15 @@ wxMDIClientWindow::~wxMDIClientWindow()
 
 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
 {
-
+    
     m_windowId = (int)NewControlId();
-
+    
     if ( parent )
     {
-       parent->AddChild(this);
+        parent->AddChild(this);
     }
     m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
-
+    
     wxModelessWindows.Append(this);
     return TRUE;
 }
index a5fe24d23bff812659057b834ba7b999293ad045..1d3195a6a70e5c343f6aded2d055084df4d43918 100644 (file)
@@ -6,10 +6,9 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-
 #ifdef __GNUG__
 #pragma implementation "menu.h"
 #pragma implementation "menuitem.h"
@@ -70,8 +69,8 @@ void wxMenu::Init()
     m_startRadioGroup = -1;
 
     // create the menu
-       m_macMenuId = s_macNextMenuId++; 
-       m_hMenu = UMANewMenu(m_macMenuId, m_title);
+    m_macMenuId = s_macNextMenuId++; 
+    m_hMenu = UMANewMenu(m_macMenuId, m_title);
 
     if ( !m_hMenu )
     {
@@ -88,13 +87,13 @@ void wxMenu::Init()
 
 wxMenu::~wxMenu()
 {
-       if (MAC_WXHMENU(m_hMenu))
-               ::DisposeMenu(MAC_WXHMENU(m_hMenu));
+    if (MAC_WXHMENU(m_hMenu))
+        ::DisposeMenu(MAC_WXHMENU(m_hMenu));
 }
 
 void wxMenu::Break()
 {
-       // not available on the mac platform
+    // not available on the mac platform
 }
 
 void wxMenu::Attach(wxMenuBarBase *menubar)
@@ -110,60 +109,60 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
 {
     wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
 
-       if ( pItem->IsSeparator() )
-       {
-               if ( pos == (size_t)-1 )
-                       MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
-               else
-                       MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
-       }
-       else 
-       {
-               wxMenu *pSubMenu = pItem->GetSubMenu() ;
-               if ( pSubMenu != NULL )
-               {
-                       wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
-                   pSubMenu->m_menuParent = this ;
-               
-                       if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
-                               ::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
-                       
-                       if ( pos == (size_t)-1 )
-                               UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
-                       else
-                               UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
-                       pItem->UpdateItemBitmap() ;
-                       pItem->UpdateItemStatus() ;
-               }
-               else
-               {
-                       if ( pos == (size_t)-1 )
-                       {
-                               UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
-                               pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
-                       }
-                       else
-                       {
-                               UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
-                       }
-
-                       SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
-                       pItem->UpdateItemText() ;
-                       pItem->UpdateItemBitmap() ;
-                       pItem->UpdateItemStatus() ;
-
-                       if ( pItem->GetId() == idMenuTitle ) 
-                       {
-                               UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
-                       }
-               }
-       }
+    if ( pItem->IsSeparator() )
+    {
+        if ( pos == (size_t)-1 )
+            MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
+        else
+            MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
+    }
+    else 
+    {
+        wxMenu *pSubMenu = pItem->GetSubMenu() ;
+        if ( pSubMenu != NULL )
+        {
+               wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
+            pSubMenu->m_menuParent = this ;
+        
+            if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
+                ::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
+            
+            if ( pos == (size_t)-1 )
+                UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
+            else
+                UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
+            pItem->UpdateItemBitmap() ;
+            pItem->UpdateItemStatus() ;
+        }
+        else
+        {
+            if ( pos == (size_t)-1 )
+            {
+                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
+                pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
+            }
+            else
+            {
+                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
+            }
+
+            SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
+            pItem->UpdateItemText() ;
+            pItem->UpdateItemBitmap() ;
+            pItem->UpdateItemStatus() ;
+
+              if ( pItem->GetId() == idMenuTitle ) 
+              {
+                UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
+              }
+        }
+    }
     // if we're already attached to the menubar, we must update it
     if ( IsAttached() )
     {
         m_menuBar->Refresh();
     }
-       return TRUE ;
+    return TRUE ;
 }
 
 void wxMenu::EndRadioGroup()
@@ -250,7 +249,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
     // DoRemove() (unlike Remove) can only be called for existing item!
     wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
 
-       ::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
+    ::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
 
     if ( IsAttached() )
     {
@@ -264,8 +263,8 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
 
 void wxMenu::SetTitle(const wxString& label)
 {
-       m_title = label ;
-       UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
+       m_title = label ;
+    UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
 }
 bool wxMenu::ProcessCommand(wxCommandEvent & event)
 {
@@ -324,11 +323,11 @@ int wxMenu::MacGetIndexFromId( int id )
 
         node = node->GetNext();
     }
-       
+    
     if (!node)
-               return 0;
-               
-       return pos + 1 ;
+        return 0;
+        
+    return pos + 1 ;
 }
 
 int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem ) 
@@ -344,16 +343,16 @@ int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
     }
 
     if (!node)
-               return 0;
-               
-       return pos + 1 ;
+        return 0;
+        
+    return pos + 1 ;
 }
 
 void wxMenu::MacEnableMenu( bool bDoEnable ) 
 {
-       UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
-               
-       ::DrawMenuBar() ;
+    UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
+        
+    ::DrawMenuBar() ;
 }
 
 // Menu Bar
@@ -412,11 +411,11 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
 
 wxMenuBar::~wxMenuBar()
 {
-       if (s_macInstalledMenuBar == this)
-       {
-               ::ClearMenuBar();
-               s_macInstalledMenuBar = NULL;
-       }
+    if (s_macInstalledMenuBar == this)
+    {
+        ::ClearMenuBar();
+        s_macInstalledMenuBar = NULL;
+    }
 
 }
 
@@ -431,9 +430,9 @@ void wxMenuBar::MacInstallMenuBar()
 {
     if ( s_macInstalledMenuBar == this )
         return ;
-               
+        
     wxStAppResource resload ;
-               
+        
     Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
     wxString message ;
     wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
@@ -453,142 +452,142 @@ void wxMenuBar::MacInstallMenuBar()
 #endif
  
     // clean-up the help menu before adding new items
-       MenuHandle mh = NULL ;
-       if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
-       {
-           for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
-           {
-               DeleteMenuItem( mh , i ) ;
-           }
-       }
-       else
-       {
-           mh = NULL ;
-       }
+    MenuHandle mh = NULL ;
+    if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
+    {
+        for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
+        {
+            DeleteMenuItem( mh , i ) ;
+        }
+    }
+    else
+    {
+        mh = NULL ;
+    }
 #if TARGET_CARBON
-       if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
-       {
-               wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
-               if ( item == NULL || !(item->IsEnabled()) )
-                       DisableMenuCommand( NULL , kHICommandPreferences ) ;
-               else
-                       EnableMenuCommand( NULL , kHICommandPreferences ) ;
-       }
+    if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
+    {
+        wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
+        if ( item == NULL || !(item->IsEnabled()) )
+            DisableMenuCommand( NULL , kHICommandPreferences ) ;
+        else
+            EnableMenuCommand( NULL , kHICommandPreferences ) ;
+    }
 #endif
-       for (size_t i = 0; i < m_menus.GetCount(); i++)
-       {
-        Str255         label;
+       for (size_t i = 0; i < m_menus.GetCount(); i++)
+      {
+        Str255     label;
         wxMenuItemList::Node *node;
         wxMenuItem *item;
         int pos ;
-       wxMenu* menu = m_menus[i] , *subMenu = NULL ;
-
-       if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
-       {
-                       if ( mh == NULL )
-                       {
-                           continue ;
-                       }
-                               
-                       for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
-                       {
-                               item = (wxMenuItem *)node->GetData();
-                               subMenu = item->GetSubMenu() ;
-                               if (subMenu)                    
-                               {
-                                       // we don't support hierarchical menus in the help menu yet
-                               }
-                               else            
-                               {
-                                       if ( item->IsSeparator() )
-                                       {
-                                               if ( mh )
-                                                       MacAppendMenu(mh, "\p-" );
-                                       }
-                                       else
-                                       {
-                                               wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
-
-                                               if ( item->GetId() == wxApp::s_macAboutMenuItemId )
-                                               
-                                                               UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText()  );
-                                                               UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
-                                                               SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
-                                                               UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
-                                               }
-                                               else
-                                               {
-                                                       if ( mh )
-                                                       {
-                                                               UMAAppendMenuItem(mh, item->GetText()  , entry );
-                                                               SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
-                                                       }
-                                               }
-                                               
-                                               delete entry ;
-                                       }
-                               }
-                       }
-               }
-               else
-               {
-                       UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
-                       wxArrayPtrVoid submenus ;
-                       wxMenuItem* previousItem = NULL ;
-                       for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
-                       {
-                               item = (wxMenuItem *)node->GetData();
-                               subMenu = item->GetSubMenu() ;
-                               if (subMenu)                    
-                               {
-                                 submenus.Add(subMenu) ;
-                               }
-                               else
-                               {
+        wxMenu* menu = m_menus[i] , *subMenu = NULL ;
+
+        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
+        {
+            if ( mh == NULL )
+            {
+                continue ;
+            }
+                
+              for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
+              {
+                 item = (wxMenuItem *)node->GetData();
+                 subMenu = item->GetSubMenu() ;
+                if (subMenu)             
+                {
+                    // we don't support hierarchical menus in the help menu yet
+                }
+                else        
+                {
+                    if ( item->IsSeparator() )
+                    {
+                        if ( mh )
+                            MacAppendMenu(mh, "\p-" );
+                    }
+                    else
+                    {
+                        wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
+
+                        if ( item->GetId() == wxApp::s_macAboutMenuItemId )
+                        { 
+                                UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText()  );
+                                UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
+                                SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
+                                UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
+                         }
+                        else
+                        {
+                            if ( mh )
+                            {
+                                UMAAppendMenuItem(mh, item->GetText()  , entry );
+                                SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
+                            }
+                        }
+                        
+                        delete entry ;
+                    }
+                }
+            }
+        }
+        else
+        {
+            UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
+            wxArrayPtrVoid submenus ;
+            wxMenuItem* previousItem = NULL ;
+              for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 
+              {
+                 item = (wxMenuItem *)node->GetData();
+                 subMenu = item->GetSubMenu() ;
+                if (subMenu)             
+                {
+                  submenus.Add(subMenu) ;
+                }
+                else
+                {
 #if TARGET_CARBON
-                                       if ( UMAGetSystemVersion() >= 0x1000 )
-                                       {
-                                               if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
-                                               {
-                                                       ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
-                                                       if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
-                                                       {
-                                                               ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
-                                                       }
-                                               }
-                                       }
-#endif 
-                               }
-                               previousItem = item ;
-                       }
-                       ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
-                       for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
-                       {
-                           wxMenu* submenu = (wxMenu*) submenus[i] ;
-               wxMenuItemList::Node *subnode;
-               wxMenuItem *subitem;
-               int subpos ;
+                    if ( UMAGetSystemVersion() >= 0x1000 )
+                    {
+                        if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
+                        {
+                            ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
+                            if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
+                            {
+                                ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
+                            }
+                        }
+                    }
+#endif    
+                }
+                previousItem = item ;
+            }
+            ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
+            for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
+            {
+                wxMenu* submenu = (wxMenu*) submenus[i] ;
+                wxMenuItemList::Node *subnode;
+                wxMenuItem *subitem;
+                int subpos ;
                 for ( subpos = 0 , subnode = submenu->GetMenuItems().GetFirst(); subnode; subnode = subnode->GetNext(), subpos++) 
-                               {
-                                       subitem = (wxMenuItem *)subnode->GetData();
-                                       wxMenu* itsSubMenu = subitem->GetSubMenu() ;
-                                       if (itsSubMenu)                 
-                                       {
-                                               submenus.Add(itsSubMenu) ;
-                                       }                               
-                               }
-                               ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
-                   }
-               }
-       }
-       ::DrawMenuBar() ;
-       s_macInstalledMenuBar = this;
+                  {
+                       subitem = (wxMenuItem *)subnode->GetData();
+                       wxMenu* itsSubMenu = subitem->GetSubMenu() ;
+                      if (itsSubMenu)             
+                      {
+                          submenus.Add(itsSubMenu) ;
+                      }                  
+                  }
+                ::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
+            }
+        }
+    }
+    ::DrawMenuBar() ;
+    s_macInstalledMenuBar = this;
 }
 
 void wxMenuBar::EnableTop(size_t pos, bool enable)
 {
     wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
-       m_menus[pos]->MacEnableMenu( enable ) ;
+    m_menus[pos]->MacEnableMenu( enable ) ;
     Refresh();
 }
 
@@ -604,11 +603,11 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
     }
 
     m_menus[pos]->SetTitle( label ) ;
-       if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
-       {
-               ::SetMenuBar( GetMenuBar() ) ;
-               ::InvalMenuBar() ;
-       }
+    if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
+    {
+        ::SetMenuBar( GetMenuBar() ) ;
+        ::InvalMenuBar() ;
+    }
 }
 
 wxString wxMenuBar::GetLabelTop(size_t pos) const
@@ -653,21 +652,21 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
 
     if ( IsAttached() )
     {
-               if (s_macInstalledMenuBar == this)
-               {
-                       ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
-                       {
-                               UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
-                               if ( pos == m_menus.GetCount() - 1)
-                               {
-                                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
-                               }
-                               else
-                               {
-                                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
-                               }
-                       }
-               }
+        if (s_macInstalledMenuBar == this)
+        {
+            ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
+            {
+                UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+                if ( pos == m_menus.GetCount() - 1)
+                {
+                    ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+                }
+                else
+                {
+                    ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
+                }
+            }
+        }
 
         Refresh();
     }
@@ -682,18 +681,18 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
 
     m_titles.Insert(title, pos);
 
-       UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+    UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
 
     if ( IsAttached() )
     {
-       if ( pos == (size_t) -1  || pos + 1 == m_menus.GetCount() )
-               {
-                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
-               }
-               else
-               {
-                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
-               }
+        if ( pos == (size_t) -1  || pos + 1 == m_menus.GetCount() )
+        {
+            ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+        }
+        else
+        {
+            ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
+        }
         Refresh();
     }
 
@@ -708,10 +707,10 @@ wxMenu *wxMenuBar::Remove(size_t pos)
 
     if ( IsAttached() )
     {
-               if (s_macInstalledMenuBar == this)
-               {
-                       ::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
-               }
+        if (s_macInstalledMenuBar == this)
+        {
+            ::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
+        }
 
         menu->Detach();
 
@@ -733,14 +732,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
 
     m_titles.Add(title);
     
-       UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
+    UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
 
     if ( IsAttached() )
     {
-               if (s_macInstalledMenuBar == this)
-               {
-                       ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
-               }
+        if (s_macInstalledMenuBar == this)
+        {
+            ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
+        }
 
         Refresh();
     }
index 423440458cc7eba0833ce692bbdf62be6de09c58..ce04c08eda6796d67935ecfa83f9c6ae1cc5f4af 100644 (file)
@@ -66,144 +66,144 @@ wxMenuItem::~wxMenuItem()
 
 void wxMenuItem::SetBitmap(const wxBitmap& bitmap) 
 { 
-       m_bitmap = bitmap; 
-       UpdateItemBitmap() ;
+      m_bitmap = bitmap; 
+      UpdateItemBitmap() ;
 }
 
 void wxMenuItem::UpdateItemBitmap() 
 {
-       if ( !m_parentMenu )
-               return ;
-               
-       MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
-       MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
-       if( mhandle == NULL || index == 0)
-               return ;
-               
-       if ( m_bitmap.Ok() )
-       {
-               ControlButtonContentInfo info ;
-               wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
-               if ( info.contentType != kControlNoContent )
-               {
-                       if ( info.contentType == kControlContentCIconHandle )
-                               SetMenuItemIconHandle( mhandle , index , 
-                                       kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
-           }
-                       
-       }
+    if ( !m_parentMenu )
+        return ;
+        
+    MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
+    MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
+    if( mhandle == NULL || index == 0)
+        return ;
+        
+    if ( m_bitmap.Ok() )
+    {
+        ControlButtonContentInfo info ;
+        wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
+        if ( info.contentType != kControlNoContent )
+        {
+            if ( info.contentType == kControlContentCIconHandle )
+                SetMenuItemIconHandle( mhandle , index , 
+                    kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
+        }
+            
+    }
 }
 
 void wxMenuItem::UpdateItemStatus() 
 {
-       if ( !m_parentMenu )
-               return ;
-               
-       MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
-       MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
-       if( mhandle == NULL || index == 0)
-               return ;
-
-       UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
-       if ( IsCheckable() && IsChecked() )
-               ::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
-       else
-               ::SetItemMark( mhandle , index , 0 ) ; // no mark
-
-       UMASetMenuItemText( mhandle , index , m_text ) ; 
-       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
-       UMASetMenuItemShortcut( mhandle , index , entry ) ;
-       delete entry ;
+    if ( !m_parentMenu )
+        return ;
+        
+    MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
+    MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
+    if( mhandle == NULL || index == 0)
+        return ;
+
+      UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
+      if ( IsCheckable() && IsChecked() )
+        ::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
+    else
+        ::SetItemMark( mhandle , index , 0 ) ; // no mark
+
+       UMASetMenuItemText( mhandle , index , m_text ) ; 
+       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
+    UMASetMenuItemShortcut( mhandle , index , entry ) ;
+    delete entry ;
 }
 
 void wxMenuItem::UpdateItemText() 
 {
-       if ( !m_parentMenu )
-               return ;
-               
-       MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
-       MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
-       if( mhandle == NULL || index == 0)
-               return ;
-
-       UMASetMenuItemText( mhandle , index , m_text ) ; 
-       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
-       UMASetMenuItemShortcut( mhandle , index , entry ) ;
-       delete entry ;
+    if ( !m_parentMenu )
+        return ;
+        
+    MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
+    MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
+    if( mhandle == NULL || index == 0)
+        return ;
+
+       UMASetMenuItemText( mhandle , index , m_text ) ; 
+       wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
+    UMASetMenuItemShortcut( mhandle , index , entry ) ;
+    delete entry ;
 }
 
 
 void wxMenuItem::Enable(bool bDoEnable)
 {
-       if ( m_isEnabled != bDoEnable ) 
-       {
-               wxMenuItemBase::Enable( bDoEnable ) ;
-               UpdateItemStatus() ;
-       }
+    if ( m_isEnabled != bDoEnable ) 
+    {
+        wxMenuItemBase::Enable( bDoEnable ) ;
+        UpdateItemStatus() ;
+    }
 }
 void wxMenuItem::UncheckRadio()
 {
-       if ( m_isChecked ) 
-       {
-               wxMenuItemBase::Check( false ) ;
-               UpdateItemStatus() ;
-       }
+    if ( m_isChecked ) 
+    {
+        wxMenuItemBase::Check( false ) ;
+        UpdateItemStatus() ;
+    }
 }
 
 void wxMenuItem::Check(bool bDoCheck)
 {
-       wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
-
-       if ( m_isChecked != bDoCheck ) 
-       {
-               if ( GetKind() == wxITEM_RADIO )
-               {
-                       if ( bDoCheck )
-                       {
-                               wxMenuItemBase::Check( bDoCheck ) ;
-                               UpdateItemStatus() ;
-                               
-                       // get the index of this item in the menu
-                       const wxMenuItemList& items = m_parentMenu->GetMenuItems();
-                       int pos = items.IndexOf(this);
-                       wxCHECK_RET( pos != wxNOT_FOUND,
-                                    _T("menuitem not found in the menu items list?") );
-
-                       // get the radio group range
-                       int start,
-                           end;
-
-                       if ( m_isRadioGroupStart )
-                       {
-                           // we already have all information we need
-                           start = pos;
-                           end = m_radioGroup.end;
-                       }
-                       else // next radio group item
-                       {
-                           // get the radio group end from the start item
-                           start = m_radioGroup.start;
-                           end = items.Item(start)->GetData()->m_radioGroup.end;
-                       }
-
-                       // also uncheck all the other items in this radio group
-                       wxMenuItemList::Node *node = items.Item(start);
-                       for ( int n = start; n <= end && node; n++ )
-                       {
-                           if ( n != pos )
-                           {
-                               ((wxMenuItem*)node->GetData())->UncheckRadio();
-                           }
-                           node = node->GetNext();
-                       }
-                       }
-               }
-               else
-               {
-                       wxMenuItemBase::Check( bDoCheck ) ;
-                       UpdateItemStatus() ;
-               }
-       }
+    wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
+
+    if ( m_isChecked != bDoCheck ) 
+    {
+        if ( GetKind() == wxITEM_RADIO )
+        {
+            if ( bDoCheck )
+            {
+                wxMenuItemBase::Check( bDoCheck ) ;
+                UpdateItemStatus() ;
+                
+                // get the index of this item in the menu
+                const wxMenuItemList& items = m_parentMenu->GetMenuItems();
+                int pos = items.IndexOf(this);
+                wxCHECK_RET( pos != wxNOT_FOUND,
+                             _T("menuitem not found in the menu items list?") );
+
+                // get the radio group range
+                int start,
+                    end;
+
+                if ( m_isRadioGroupStart )
+                {
+                    // we already have all information we need
+                    start = pos;
+                    end = m_radioGroup.end;
+                }
+                else // next radio group item
+                {
+                    // get the radio group end from the start item
+                    start = m_radioGroup.start;
+                    end = items.Item(start)->GetData()->m_radioGroup.end;
+                }
+
+                // also uncheck all the other items in this radio group
+                wxMenuItemList::Node *node = items.Item(start);
+                for ( int n = start; n <= end && node; n++ )
+                {
+                    if ( n != pos )
+                    {
+                        ((wxMenuItem*)node->GetData())->UncheckRadio();
+                    }
+                    node = node->GetNext();
+                }
+            }
+        }
+        else
+        {
+            wxMenuItemBase::Check( bDoCheck ) ;
+            UpdateItemStatus() ;
+        }
+    }
 }
 
 void wxMenuItem::SetText(const wxString& text)
index 1d38499628de470f00b9488c32395e96459b85c7..1f87cb9f4a76c3e472673b1a1da235ffed71805d 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -61,7 +61,7 @@ wxMetafileRefData::~wxMetafileRefData(void)
 {
     if (m_metafile)
     {
-               KillPicture( (PicHandle) m_metafile ) ;
+        KillPicture( (PicHandle) m_metafile ) ;
         m_metafile = 0;
     }
 }
@@ -86,10 +86,10 @@ wxMetaFile::~wxMetaFile()
 bool wxMetaFile::SetClipboard(int width, int height)
 {
 #if wxUSE_DRAG_AND_DROP
-//TODO finishi this port , we need the data obj first
+    //TODO finishi this port , we need the data obj first
     if (!m_refData)
         return FALSE;
-
+    
     bool alreadyOpen=wxTheClipboard->IsOpened() ;
     if (!alreadyOpen)
     {
@@ -97,11 +97,11 @@ bool wxMetaFile::SetClipboard(int width, int height)
         wxTheClipboard->Clear();
     }
     wxDataObject *data =
-      new wxMetafileDataObject( *this) ;
+        new wxMetafileDataObject( *this) ;
     bool success = wxTheClipboard->SetData(data);
     if (!alreadyOpen) 
-      wxTheClipboard->Close();
-           return (bool) success;
+        wxTheClipboard->Close();
+    return (bool) success;
 #endif
     return TRUE ;
 }
@@ -116,17 +116,17 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
 
 bool wxMetaFile::Play(wxDC *dc)
 {
-  if (!m_refData)
-    return FALSE;
-
-       if (!dc->Ok() )
-               return FALSE;
-               
-       {
-               wxMacPortSetter helper( dc ) ;
-               PicHandle pict = (PicHandle) GetHMETAFILE() ;
-               DrawPicture( pict , &(**pict).picFrame ) ;
-       }
+    if (!m_refData)
+        return FALSE;
+    
+    if (!dc->Ok() )
+        return FALSE;
+        
+    {
+        wxMacPortSetter helper( dc ) ;
+        PicHandle pict = (PicHandle) GetHMETAFILE() ;
+        DrawPicture( pict , &(**pict).picFrame ) ;
+    }
     return TRUE;
 }
 
@@ -139,22 +139,22 @@ bool wxMetaFile::Play(wxDC *dc)
 // *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
 wxMetaFileDC::wxMetaFileDC(const wxString& file)
 {
-  m_metaFile = NULL;
-  m_minX = 10000;
-  m_minY = 10000;
-  m_maxX = -10000;
-  m_maxY = -10000;
-
-  wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
-
-  m_metaFile = new wxMetaFile("") ;
-  Rect r={0,0,1000,1000} ;
-       
-  m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
-  ::GetPort( (GrafPtr*) &m_macPort ) ; 
-  m_ok = TRUE ;
-
-  SetMapMode(wxMM_TEXT); 
+    m_metaFile = NULL;
+    m_minX = 10000;
+    m_minY = 10000;
+    m_maxX = -10000;
+    m_maxY = -10000;
+    
+    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    
+    m_metaFile = new wxMetaFile("") ;
+    Rect r={0,0,1000,1000} ;
+    
+    m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
+    ::GetPort( (GrafPtr*) &m_macPort ) ;    
+    m_ok = TRUE ;
+    
+    SetMapMode(wxMM_TEXT); 
 }
 
 // New constructor that takes origin and extent. If you use this, don't
@@ -162,21 +162,21 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
 
 wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
 {
-  m_minX = 10000;
-  m_minY = 10000;
-  m_maxX = -10000;
-  m_maxY = -10000;
-
-  wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
-
-       m_metaFile = new wxMetaFile("") ;
-       Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
-       
-       m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
-       ::GetPort( (GrafPtr*) &m_macPort ) ;    
-  m_ok = TRUE ;
-
-  SetMapMode(wxMM_TEXT); 
+    m_minX = 10000;
+    m_minY = 10000;
+    m_maxX = -10000;
+    m_maxY = -10000;
+    
+    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    
+    m_metaFile = new wxMetaFile("") ;
+    Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
+    
+    m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
+    ::GetPort( (GrafPtr*) &m_macPort ) ;    
+    m_ok = TRUE ;
+    
+    SetMapMode(wxMM_TEXT); 
 }
 
 wxMetaFileDC::~wxMetaFileDC()
@@ -185,29 +185,29 @@ wxMetaFileDC::~wxMetaFileDC()
 
 wxMetaFile *wxMetaFileDC::Close()
 {
-       ClosePicture() ;
-       return m_metaFile;
+    ClosePicture() ;
+    return m_metaFile;
 }
 
 #if wxUSE_DATAOBJ
 size_t wxMetafileDataObject::GetDataSize() const
 {
-  return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
+    return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
 }
 
 bool wxMetafileDataObject::GetDataHere(void *buf) const
 {
-  memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
-    GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
-  return true ;
+    memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
+        GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
+    return true ;
 }
 
 bool wxMetafileDataObject::SetData(size_t len, const void *buf)
 {
-  Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
-  SetHandleSize( handle , len ) ;
-  memcpy( *handle , buf , len ) ;
-  return true ;
+    Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
+    SetHandleSize( handle , len ) ;
+    memcpy( *handle , buf , len ) ;
+    return true ;
 }
 #endif
 
index 0306d07f2c75aace22699292b4dc2c0d7c7d0086..de41b17423833e54f979857dd1f20ca0f00f1389 100644 (file)
@@ -105,7 +105,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const
 
 size_t
 wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
-                              const wxFileType::MessageParameters& params) const
+                   const wxFileType::MessageParameters& params) const
 {
     wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
     return 0;
index 4cd78d710037aa875b4df5b285ac747e9e1d95e1..6b49b9bdc74542e9dc97c5b87d83b06901742a35 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index c7f38f17b7815555dd95fd49b19c2f2a66f26488..f7a4a0a7248189ccbb5de42250e094bbcc469a35 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -27,33 +27,33 @@ short language = 0 ;
 void wxMacConvertNewlines( const char *source , char * destination ) ;
 void wxMacConvertNewlines( const char *source , char * destination )
 {
-       const char *s = source ;
-       char *d = destination ;
-       
-       while( *s  )
-       {
-               switch( *s )
-               {
-                       case 0x0a :
-                               *d++ = 0x0d ;
-                               ++s ;
-                               break ;
-                       case 0x0d :
-                               *d++ = 0x0d ;
-                               ++s ;
-                               if ( *s == 0x0a )
-                                       ++s ;
-                               break ;
-                       default :
-                               *d++ = *s++ ;
-                               break ;
-               }
-       }
-       *d = 0 ;
+    const char *s = source ;
+    char *d = destination ;
+    
+    while( *s  )
+    {
+        switch( *s )
+        {
+        case 0x0a :
+            *d++ = 0x0d ;
+            ++s ;
+            break ;
+        case 0x0d :
+            *d++ = 0x0d ;
+            ++s ;
+            if ( *s == 0x0a )
+                ++s ;
+            break ;
+        default :
+            *d++ = *s++ ;
+            break ;
+        }
+    }
+    *d = 0 ;
 }
 
 wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
-        long style, const wxPoint& pos)
+                                 long style, const wxPoint& pos)
 {
     m_caption = caption;
     m_message = message;
@@ -63,252 +63,252 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
 
 int wxMessageDialog::ShowModal()
 {
-       int resultbutton = wxID_CANCEL ;
-
-       short result ;
-
-       wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
-
-       AlertType alertType = kAlertPlainAlert ;
-       if (m_dialogStyle & wxICON_EXCLAMATION)
-               alertType = kAlertNoteAlert ;
-       else if (m_dialogStyle & wxICON_HAND)
-               alertType = kAlertStopAlert ;
-       else if (m_dialogStyle & wxICON_INFORMATION)
-               alertType = kAlertNoteAlert ;
-       else if (m_dialogStyle & wxICON_QUESTION)
-               alertType = kAlertCautionAlert ;
-
+    int resultbutton = wxID_CANCEL ;
+    
+    short result ;
+    
+    wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
+    
+    AlertType alertType = kAlertPlainAlert ;
+    if (m_dialogStyle & wxICON_EXCLAMATION)
+        alertType = kAlertNoteAlert ;
+    else if (m_dialogStyle & wxICON_HAND)
+        alertType = kAlertStopAlert ;
+    else if (m_dialogStyle & wxICON_INFORMATION)
+        alertType = kAlertNoteAlert ;
+    else if (m_dialogStyle & wxICON_QUESTION)
+        alertType = kAlertCautionAlert ;
+    
 #if TARGET_CARBON
-       if ( UMAGetSystemVersion() >= 0x1000 )
-       {
-               AlertStdCFStringAlertParamRec param ;
-               CFStringRef cfNoString = NULL ;
-               CFStringRef cfYesString = NULL ;
-
-               CFStringRef cfTitle = NULL;
-               CFStringRef cfText = NULL;
-               
-               cfTitle = wxMacCreateCFString( m_caption ) ;
-               cfText = wxMacCreateCFString( m_message ) ;
-               cfNoString = wxMacCreateCFString( _("No") ) ;
-               cfYesString = wxMacCreateCFString( _("Yes") ) ;
-               
-               param.movable = true;
-               param.flags = 0 ;
-               
-               bool skipDialog = false ;
-               
-               if (m_dialogStyle & wxYES_NO)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-                               param.defaultText       = cfYesString ;
-                               param.cancelText        = (CFStringRef) kAlertDefaultCancelText;
-                               param.otherText         = cfNoString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = kAlertStdAlertCancelButton;
-                   }
-                   else
-                   {
-                               param.defaultText       = cfYesString ;
-                               param.cancelText        = NULL;
-                               param.otherText         = cfNoString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-               }
-               else if (m_dialogStyle & wxOK)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-               // thats a cancel missing
-                               param.defaultText       = (CFStringRef) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-                   else
-                   {
-                               param.defaultText       = (CFStringRef) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                       }
-               }
-               else
-               {
-                       skipDialog = true ;
-               }
-               
-               param.position = kWindowDefaultPosition;
-               if ( !skipDialog )
-               {
-                       DialogRef alertRef ;
-                       CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
-                       RunStandardAlert( alertRef , NULL , &result ) ;
-               }
-               if(cfTitle != NULL)
-               CFRelease(cfTitle);   
-               if(cfText != NULL)
-               CFRelease(cfText);   
-               if(cfNoString != NULL)
-               CFRelease(cfNoString);   
-               if(cfYesString != NULL)
-               CFRelease(cfYesString);   
-       if ( skipDialog )
-               return wxID_CANCEL ;
-  }
-  else
+    if ( UMAGetSystemVersion() >= 0x1000 )
+    {
+        AlertStdCFStringAlertParamRec param ;
+        CFStringRef cfNoString = NULL ;
+        CFStringRef cfYesString = NULL ;
+        
+        CFStringRef cfTitle = NULL;
+        CFStringRef cfText = NULL;
+        
+        cfTitle = wxMacCreateCFString( m_caption ) ;
+        cfText = wxMacCreateCFString( m_message ) ;
+        cfNoString = wxMacCreateCFString( _("No") ) ;
+        cfYesString = wxMacCreateCFString( _("Yes") ) ;
+        
+        param.movable = true;
+        param.flags = 0 ;
+        
+        bool skipDialog = false ;
+        
+        if (m_dialogStyle & wxYES_NO)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                param.defaultText     = cfYesString ;
+                param.cancelText     = (CFStringRef) kAlertDefaultCancelText;
+                param.otherText     = cfNoString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = kAlertStdAlertCancelButton;
+            }
+            else
+            {
+                param.defaultText     = cfYesString ;
+                param.cancelText     = NULL;
+                param.otherText     = cfNoString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else if (m_dialogStyle & wxOK)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                // thats a cancel missing
+                param.defaultText     = (CFStringRef) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+            else
+            {
+                param.defaultText     = (CFStringRef) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else
+        {
+            skipDialog = true ;
+        }
+        
+        param.position = kWindowDefaultPosition;
+        if ( !skipDialog )
+        {
+            DialogRef alertRef ;
+            CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
+            RunStandardAlert( alertRef , NULL , &result ) ;
+        }
+        if(cfTitle != NULL)
+            CFRelease(cfTitle);   
+        if(cfText != NULL)
+            CFRelease(cfText);   
+        if(cfNoString != NULL)
+            CFRelease(cfNoString);   
+        if(cfYesString != NULL)
+            CFRelease(cfYesString);   
+        if ( skipDialog )
+            return wxID_CANCEL ;
+    }
+    else
 #endif
-  {
-               AlertStdAlertParamRec   param;
-               char   cText[2048] ;
-               
-               if (wxApp::s_macDefaultEncodingIsPC)
-               {
-                       strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
-               }
-               else
-               {
-                       strcpy( cText , m_message ) ;
-               }
-               wxMacConvertNewlines( cText , cText ) ;
-       
-               Str255 yesPString ;
-               Str255 noPString ;
-
-               Str255 pascalTitle ;
-               Str255 pascalText ;
-               wxMacStringToPascal( m_caption , pascalTitle ) ;
-               wxMacStringToPascal( _("Yes") , yesPString ) ;
-               wxMacStringToPascal(  _("No") , noPString ) ;
-               CopyCStringToPascal( cText , pascalText ) ;
-               
-               param.movable           = true;
-       param.filterProc        = NULL ;
-               if (m_dialogStyle & wxYES_NO)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-                               param.defaultText       = yesPString ;
-                               param.cancelText        = (StringPtr) kAlertDefaultCancelText;
-                               param.otherText         = noPString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = kAlertStdAlertCancelButton;
-                   }
-                   else
-                   {
-                               param.defaultText       = yesPString ;
-                               param.cancelText        = NULL;
-                               param.otherText         = noPString ;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-               }
-               else if (m_dialogStyle & wxOK)
-               {
-                   if (m_dialogStyle & wxCANCEL)
-                   {
-               // thats a cancel missing
-                               param.defaultText       = (StringPtr) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                   }
-                   else
-                   {
-                               param.defaultText       = (StringPtr) kAlertDefaultOKText ;
-                               param.cancelText        = NULL;
-                               param.otherText         = NULL;
-                               param.helpButton        = false ;
-                               param.defaultButton = kAlertStdAlertOKButton;
-                               param.cancelButton      = 0;
-                       }
-               }
-               else
-               {
-                       return resultbutton ;
-               }
-
-               param.position          = 0;
-
-               StandardAlert( alertType, pascalTitle, pascalText, &param, &result );
-       }
-
-       if (m_dialogStyle & wxOK)
-       {
-               if (m_dialogStyle & wxCANCEL)                           
-               {
-                       //TODO add Cancelbutton
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_OK ;
-                                       break ;
-                               case 2 :
-                                       break ;
-                               case 3 :
-                                       break ;
-                       }
-               }
-               else
-               {
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_OK ;
-                                       break ;
-                               case 2 :
-                                       break ;
-                               case 3 :
-                                       break ;
-                       }
-               }
-       }
-       else if (m_dialogStyle & wxYES_NO)
-       {
-               if (m_dialogStyle & wxCANCEL)
-               {
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_YES ;
-                                       break ;
-                               case 2 :
-                                       resultbutton = wxID_CANCEL ;
-                                       break ;
-                               case 3 :
-                                       resultbutton = wxID_NO ;
-                                       break ;
-                       }
-               }
-               else
-               {
-                       switch( result )
-                       {
-                               case 1 :
-                                       resultbutton = wxID_YES ;
-                                       break ;
-                               case 2 :
-                                       break ;
-                               case 3 :
-                                       resultbutton = wxID_NO ;
-                                       break ;
-                       }
-               }
-       
-
-       return resultbutton ;
+    {
+        AlertStdAlertParamRec    param;
+        char   cText[2048] ;
+        
+        if (wxApp::s_macDefaultEncodingIsPC)
+        {
+            strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
+        }
+        else
+        {
+            strcpy( cText , m_message ) ;
+        }
+        wxMacConvertNewlines( cText , cText ) ;
+        
+        Str255 yesPString ;
+        Str255 noPString ;
+        
+        Str255 pascalTitle ;
+        Str255 pascalText ;
+        wxMacStringToPascal( m_caption , pascalTitle ) ;
+        wxMacStringToPascal( _("Yes") , yesPString ) ;
+        wxMacStringToPascal(  _("No") , noPString ) ;
+        CopyCStringToPascal( cText , pascalText ) ;
+        
+        param.movable         = true;
+        param.filterProc     = NULL ;
+        if (m_dialogStyle & wxYES_NO)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                param.defaultText     = yesPString ;
+                param.cancelText     = (StringPtr) kAlertDefaultCancelText;
+                param.otherText     = noPString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = kAlertStdAlertCancelButton;
+            }
+            else
+            {
+                param.defaultText     = yesPString ;
+                param.cancelText     = NULL;
+                param.otherText     = noPString ;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else if (m_dialogStyle & wxOK)
+        {
+            if (m_dialogStyle & wxCANCEL)
+            {
+                // thats a cancel missing
+                param.defaultText     = (StringPtr) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+            else
+            {
+                param.defaultText     = (StringPtr) kAlertDefaultOKText ;
+                param.cancelText     = NULL;
+                param.otherText     = NULL;
+                param.helpButton     = false ;
+                param.defaultButton = kAlertStdAlertOKButton;
+                param.cancelButton     = 0;
+            }
+        }
+        else
+        {
+            return resultbutton ;
+        }
+        
+        param.position         = 0;
+        
+        StandardAlert( alertType, pascalTitle, pascalText, &param, &result );
+    }
+    
+    if (m_dialogStyle & wxOK)
+    {
+        if (m_dialogStyle & wxCANCEL)                
+        {
+            //TODO add Cancelbutton
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_OK ;
+                break ;
+            case 2 :
+                break ;
+            case 3 :
+                break ;
+            }
+        }
+        else
+        {
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_OK ;
+                break ;
+            case 2 :
+                break ;
+            case 3 :
+                break ;
+            }
+        }
+    }
+    else if (m_dialogStyle & wxYES_NO)
+    {
+        if (m_dialogStyle & wxCANCEL)
+        {
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_YES ;
+                break ;
+            case 2 :
+                resultbutton = wxID_CANCEL ;
+                break ;
+            case 3 :
+                resultbutton = wxID_NO ;
+                break ;
+            }
+        }
+        else
+        {
+            switch( result )
+            {
+            case 1 :
+                resultbutton = wxID_YES ;
+                break ;
+            case 2 :
+                break ;
+            case 3 :
+                resultbutton = wxID_NO ;
+                break ;
+            }
+        }
+    } 
+    
+    return resultbutton ;
 }
 
index 6ba640fe91e0b2778e60ce795e692bc870f25386..33c40fe4486fe485d9e4d1b1794fdf8cbe507394 100644 (file)
@@ -10,7 +10,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-  #pragma implementation "notebook.h"
+#pragma implementation "notebook.h"
 #endif
 
 // ============================================================================
 
 static bool constantsSet = false ;
 
- short kwxMacTabLeftMargin = 0 ;
- short kwxMacTabTopMargin = 0 ;
- short kwxMacTabRightMargin = 0 ;
- short kwxMacTabBottomMargin = 0 ;
+short kwxMacTabLeftMargin = 0 ;
+short kwxMacTabTopMargin = 0 ;
+short kwxMacTabRightMargin = 0 ;
+short kwxMacTabBottomMargin = 0 ;
 
 // ----------------------------------------------------------------------------
 // event table
@@ -49,12 +49,12 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
 
 BEGIN_EVENT_TABLE(wxNotebook, wxControl)
-    EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
-    EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
-    
-    EVT_SIZE(wxNotebook::OnSize)
-    EVT_SET_FOCUS(wxNotebook::OnSetFocus)
-    EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
+EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
+EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
+
+EVT_SIZE(wxNotebook::OnSize)
+EVT_SET_FOCUS(wxNotebook::OnSetFocus)
+EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
@@ -76,7 +76,7 @@ void wxNotebook::Init()
     {
         if ( UMAHasAquaLayout() )
         {
-      // I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
+            // I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
             kwxMacTabLeftMargin = 20 ;
             kwxMacTabTopMargin = 38 ;
             kwxMacTabRightMargin = 20 ;
@@ -96,7 +96,7 @@ void wxNotebook::Init()
         m_macHorizontalBorder = 7;
         m_macVerticalBorder = 8;
     }
-
+    
     m_nSelection = -1;
 }
 
@@ -115,7 +115,7 @@ wxNotebook::wxNotebook(wxWindow *parent,
                        const wxString& name)
 {
     Init();
-
+    
     Create(parent, id, pos, size, style, name);
 }
 
@@ -127,31 +127,31 @@ bool wxNotebook::Create(wxWindow *parent,
                         long style,
                         const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       int tabstyle = kControlTabSmallNorthProc ;
-       if ( HasFlag(wxNB_LEFT) )
-               tabstyle = kControlTabSmallWestProc ;
-       else if ( HasFlag( wxNB_RIGHT ) )
-               tabstyle = kControlTabSmallEastProc ;
-       else if ( HasFlag( wxNB_BOTTOM ) )
-               tabstyle = kControlTabSmallSouthProc ;
-
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               tabstyle , (long) this ) ;
-       
-       MacPostControlCreate() ;
-       return TRUE ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    
+    int tabstyle = kControlTabSmallNorthProc ;
+    if ( HasFlag(wxNB_LEFT) )
+        tabstyle = kControlTabSmallWestProc ;
+    else if ( HasFlag( wxNB_RIGHT ) )
+        tabstyle = kControlTabSmallEastProc ;
+    else if ( HasFlag( wxNB_BOTTOM ) )
+        tabstyle = kControlTabSmallSouthProc ;
+    
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+        tabstyle , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    return TRUE ;
 }
 
 // dtor
 wxNotebook::~wxNotebook()
 {
-       m_macControl = NULL ;
+    m_macControl = NULL ;
 }
 
 wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
@@ -162,7 +162,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
     wxGetOsVersion( &major, &minor );
     
     // Mac has large notebook borders. Aqua even more so.
-
+    
     if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
     {
         sizeTotal.x += 90;
@@ -185,7 +185,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
             sizeTotal.y += 44;
         }
     }
-
+    
     return sizeTotal;
 }
 
@@ -195,7 +195,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
 
 void wxNotebook::SetPadding(const wxSize& padding)
 {
-   wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
+    wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
 }
 
 void wxNotebook::SetTabSize(const wxSize& sz)
@@ -210,12 +210,12 @@ void wxNotebook::SetPageSize(const wxSize& size)
 
 int wxNotebook::SetSelection(int nPage)
 {
-  if( !IS_VALID_PAGE(nPage) ) 
-    return m_nSelection ;
-
+    if( !IS_VALID_PAGE(nPage) ) 
+        return m_nSelection ;
+    
     ChangePage(m_nSelection, nPage);
-       SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
-
+    SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
+    
     Refresh();
     return m_nSelection;
 }
@@ -223,18 +223,18 @@ int wxNotebook::SetSelection(int nPage)
 bool wxNotebook::SetPageText(int nPage, const wxString& strText)
 {
     wxASSERT( IS_VALID_PAGE(nPage) );
-
+    
     wxNotebookPage *page = m_pages[nPage];
     page->SetLabel(strText);
     MacSetupTabs();
-
+    
     return true;
 }
 
 wxString wxNotebook::GetPageText(int nPage) const
 {
     wxASSERT( IS_VALID_PAGE(nPage) );
-
+    
     wxNotebookPage *page = m_pages[nPage];
     return page->GetLabel();
 }
@@ -242,27 +242,27 @@ wxString wxNotebook::GetPageText(int nPage) const
 int wxNotebook::GetPageImage(int nPage) const
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("invalid notebook page") );
-
+    
     return m_images[nPage];
 }
 
 bool wxNotebook::SetPageImage(int nPage, int nImage)
 {
     wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
-
+    
     wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
-                 _T("invalid image index in SetPageImage()") );
-
+        _T("invalid image index in SetPageImage()") );
+    
     if ( nImage != m_images[nPage] )
     {
         // if the item didn't have an icon before or, on the contrary, did have
         // it but has lost it now, its size will change - but if the icon just
         // changes, it won't
         m_images[nPage] = nImage;
-
-               MacSetupTabs() ;
+        
+        MacSetupTabs() ;
     }
-
+    
     return TRUE;
 }
 
@@ -276,9 +276,9 @@ wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
     wxCHECK( IS_VALID_PAGE(nPage), NULL );
     wxNotebookPage* page = m_pages[nPage] ;
     m_pages.RemoveAt(nPage);
-
+    
     MacSetupTabs();
-
+    
     if(m_nSelection >= GetPageCount()) {
         m_nSelection = GetPageCount() - 1;
     }
@@ -292,10 +292,10 @@ wxNotebookPage* wxNotebook::DoRemovePage(int nPage)
 bool wxNotebook::DeleteAllPages()
 {
     // TODO: delete native widget pages
-
+    
     WX_CLEAR_ARRAY(m_pages) ;
     MacSetupTabs();
-
+    
     return TRUE;
 }
 
@@ -309,16 +309,16 @@ bool wxNotebook::InsertPage(int nPage,
 {
     wxASSERT( pPage != NULL );
     wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
-
+    
     pPage->SetLabel(strText);
-
+    
     // save the pointer to the page
     m_pages.Insert(pPage, nPage);
-
+    
     m_images.Insert(imageId, nPage);
-
+    
     MacSetupTabs();
-
+    
     if ( bSelect ) {
         m_nSelection = nPage;
     }
@@ -330,69 +330,69 @@ bool wxNotebook::InsertPage(int nPage,
     }
     // don't show pages by default (we'll need to adjust their size first)
     pPage->Show( false ) ;
-
+    
     int h, w;
     GetSize(&w, &h);
     pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
-                   w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
-                   h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
+        w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
+        h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
     if ( pPage->GetAutoLayout() ) {
         pPage->Layout();
     }
-
+    
     return true;
 }
 
 /* Added by Mark Newsam
- * When a page is added or deleted to the notebook this function updates
- * information held in the m_macControl so that it matches the order
- * the user would expect.
- */
+* When a page is added or deleted to the notebook this function updates
+* information held in the m_macControl so that it matches the order
+* the user would expect.
+*/
 void wxNotebook::MacSetupTabs()
 {
     SetControl32BitMaximum( (ControlHandle) m_macControl , GetPageCount() ) ;
-
+    
     wxNotebookPage *page;
     ControlTabInfoRec info;
-
+    
     for(int ii = 0; ii < GetPageCount(); ii++)
     {
         page = m_pages[ii];
         info.version = 0;
         info.iconSuiteID = 0;
 #if TARGET_CARBON
-               c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
+        c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
 #else
-               strcpy( (char *) info.name , page->GetLabel() ) ;
-               c2pstr( (char *) info.name ) ;
+        strcpy( (char *) info.name , page->GetLabel() ) ;
+        c2pstr( (char *) info.name ) ;
 #endif
         SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
-                        sizeof( ControlTabInfoRec) , (char*) &info ) ;
+            sizeof( ControlTabInfoRec) , (char*) &info ) ;
         SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
-
+        
 #if TARGET_CARBON
         if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
         {
-               // tab controls only support very specific types of images, therefore we are doing an odyssee
-               // accross the icon worlds (even Apple DTS did not find a shorter path)
-               // in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
-               // afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we 
-               // unregister it) in case this will ever lead to having the same icon everywhere add some kind
-               // of static counter 
-               ControlButtonContentInfo info ;
-               wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
-               IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
-               OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
+            // tab controls only support very specific types of images, therefore we are doing an odyssee
+            // accross the icon worlds (even Apple DTS did not find a shorter path)
+            // in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
+            // afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we 
+            // unregister it) in case this will ever lead to having the same icon everywhere add some kind
+            // of static counter 
+            ControlButtonContentInfo info ;
+            wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
+            IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
+            OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
             wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
-               IconRef iconRef ;
-               err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
+            IconRef iconRef ;
+            err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
             wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
-               info.contentType = kControlContentIconRef ;
-               info.u.iconRef = iconRef ;
-               SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
-                        sizeof( info ), (Ptr)&info );
+            info.contentType = kControlContentIconRef ;
+            info.u.iconRef = iconRef ;
+            SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
+                sizeof( info ), (Ptr)&info );
             wxASSERT_MSG( err == noErr , "Error when setting icon on tab" ) ;
-               UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
+               UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
             ReleaseIconRef( iconRef ) ;
             DisposeHandle( (Handle) iconFamily ) ;
         }
@@ -416,22 +416,22 @@ void wxNotebook::OnSize(wxSizeEvent& event)
     int nSel = m_nSelection;
     m_nSelection = -1;
     SetSelection(nSel);
-
+    
     // fit the notebook page to the tab control's display area
     int w, h;
     GetSize(&w, &h);
-
+    
     unsigned int nCount = m_pages.Count();
     for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
         wxNotebookPage *pPage = m_pages[nPage];
         pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
-                       w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
-                       h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
+            w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
+            h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
         if ( pPage->GetAutoLayout() ) {
             pPage->Layout();
         }
     }
-
+    
     // Processing continues to next OnSize
     event.Skip();
 }
@@ -441,7 +441,7 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event)
     // is it our tab control?
     if ( event.GetEventObject() == this )
         ChangePage(event.GetOldSelection(), event.GetSelection());
-
+    
     // we want to give others a chance to process this message as well
     event.Skip();
 }
@@ -451,7 +451,7 @@ void wxNotebook::OnSetFocus(wxFocusEvent& event)
     // set focus to the currently selected page if any
     if ( m_nSelection != -1 )
         m_pages[m_nSelection]->SetFocus();
-
+    
     event.Skip();
 }
 
@@ -509,93 +509,93 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
         pPage->SetFocus();
         return;
     }
-
+    
     // Hide previous page
     if ( nOldSel != -1 ) {
         m_pages[nOldSel]->Show(FALSE);
     }
-
+    
     wxNotebookPage *pPage = m_pages[nSel];
     pPage->Show(TRUE);
     pPage->SetFocus();
-
+    
     m_nSelection = nSel;
 }
 
 
 void  wxNotebook::OnMouse( wxMouseEvent &event )
 {
-   if ( (ControlHandle) m_macControl == NULL )
-   {
-      event.Skip() ;
-      return ;
-   }
-
-   if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
-   {
-      int x = event.m_x ;
-      int y = event.m_y ;
-
-      MacClientToRootWindow( &x , &y ) ;
-
-      ControlHandle   control ;
-      Point       localwhere ;
-      SInt16      controlpart ;
-
-      localwhere.h = x ;
-      localwhere.v = y ;
-
-      short modifiers = 0;
-
-      if ( !event.m_leftDown && !event.m_rightDown )
-           modifiers  |= btnState ;
-
-      if ( event.m_shiftDown )
-           modifiers |= shiftKey ;
-
-      if ( event.m_controlDown )
-           modifiers |= controlKey ;
-
-      if ( event.m_altDown )
-           modifiers |= optionKey ;
-
-      if ( event.m_metaDown )
-           modifiers |= cmdKey ;
-
-      control = (ControlHandle) m_macControl ;
-      if ( control && ::IsControlActive( control ) )
-      {
-           {
-            wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
-                                    ::GetControl32BitValue(control) - 1, m_nSelection);
-               changing.SetEventObject(this);
-               ProcessEvent(changing);
-               if(changing.IsAllowed())
-               {
-              controlpart = ::HandleControlClick(control, localwhere, modifiers,
-                                                 (ControlActionUPP) -1);
-              wxTheApp->s_lastMouseDown = 0 ;
-     
-              wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
-                                    ::GetControl32BitValue(control) - 1, m_nSelection);
-              event.SetEventObject(this);
-     
-              ProcessEvent(event);
-               }
-           }
-       }
-   }
+    if ( (ControlHandle) m_macControl == NULL )
+    {
+        event.Skip() ;
+        return ;
+    }
+    
+    if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
+    {
+        int x = event.m_x ;
+        int y = event.m_y ;
+        
+        MacClientToRootWindow( &x , &y ) ;
+        
+        ControlHandle   control ;
+        Point       localwhere ;
+        SInt16      controlpart ;
+        
+        localwhere.h = x ;
+        localwhere.v = y ;
+        
+        short modifiers = 0;
+        
+        if ( !event.m_leftDown && !event.m_rightDown )
+            modifiers  |= btnState ;
+        
+        if ( event.m_shiftDown )
+            modifiers |= shiftKey ;
+        
+        if ( event.m_controlDown )
+            modifiers |= controlKey ;
+        
+        if ( event.m_altDown )
+            modifiers |= optionKey ;
+        
+        if ( event.m_metaDown )
+            modifiers |= cmdKey ;
+        
+        control = (ControlHandle) m_macControl ;
+        if ( control && ::IsControlActive( control ) )
+        {
+            {
+                wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
+                    ::GetControl32BitValue(control) - 1, m_nSelection);
+                changing.SetEventObject(this);
+                ProcessEvent(changing);
+                
+                if(changing.IsAllowed())
+                {
+                    controlpart = ::HandleControlClick(control, localwhere, modifiers,
+                        (ControlActionUPP) -1);
+                    wxTheApp->s_lastMouseDown = 0 ;
+                    
+                    wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
+                        ::GetControl32BitValue(control) - 1, m_nSelection);
+                    event.SetEventObject(this);
+                    
+                    ProcessEvent(event);
+                }
+            }
+        }
+    }
 }
+
 
 void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
 #if 0
-  wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
-  event.SetEventObject(this);
-
-  ProcessEvent(event);
+    wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
+    event.SetEventObject(this);
+    
+    ProcessEvent(event);
 #endif
 }
 
index 5fd459da77c82208aa2cd55d9189ef2b398db854..60a0de6a8a57792b32270aa48ef3b1c3f21f9748 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -30,8 +30,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
 
 wxPaletteRefData::wxPaletteRefData()
 {
-       m_palette = NULL ;
-       m_count = 0 ;
+    m_palette = NULL ;
+    m_count = 0 ;
 }
 
 wxPaletteRefData::~wxPaletteRefData()
@@ -57,41 +57,41 @@ wxPalette::~wxPalette()
 
 bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
 {
-  UnRef();
-
-  m_refData = new wxPaletteRefData;
-
-  M_PALETTEDATA->m_count = n ;
-  M_PALETTEDATA->m_palette = new wxColour[n] ;
-  
-  for ( int i = 0 ; i < n ; ++i)
-  {
-       M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
-       }
-
-  return FALSE;
+    UnRef();
+    
+    m_refData = new wxPaletteRefData;
+    
+    M_PALETTEDATA->m_count = n ;
+    M_PALETTEDATA->m_palette = new wxColour[n] ;
+    
+    for ( int i = 0 ; i < n ; ++i)
+    {
+        M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
+    }
+    
+    return FALSE;
 }
 
 int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
 {
     if ( !m_refData )
-       return -1;
-
+        return -1;
+    
     long bestdiff = 3 * 256 ;
     long bestpos = 0 ;
     long currentdiff ;
     
     for ( int i = 0  ; i < M_PALETTEDATA->m_count ; ++i )
     {
-       const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
-       currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue )  ;
-       if ( currentdiff < bestdiff )
-       {
-               bestdiff = currentdiff ;
-               bestpos = i ;
-               if ( bestdiff == 0 )
-                       break ; 
-       }
+        const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
+        currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue )  ;
+        if ( currentdiff < bestdiff )
+        {
+            bestdiff = currentdiff ;
+            bestpos = i ;
+            if ( bestdiff == 0 )
+                break ; 
+        }
     }
     
     return bestpos;
@@ -100,11 +100,11 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
 bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
 {
     if ( !m_refData )
-           return FALSE;
-
+        return FALSE;
+    
     if (index < 0 || index >= M_PALETTEDATA->m_count)
         return FALSE;
-
+    
     const wxColour& col = &M_PALETTEDATA->m_palette[index] ;
     *red = col.Red() ;
     *green = col.Green() ;
@@ -114,5 +114,5 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi
 }
 
 #endif
-    // wxUSE_PALETTE
+// wxUSE_PALETTE
 
index 3c3d9f033b40341f57fe56c31dc5c9764a1d42b0..fea55ab34eb7394f3f30661355ad70238b4056af 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -32,7 +32,7 @@ wxPenRefData::wxPenRefData()
 }
 
 wxPenRefData::wxPenRefData(const wxPenRefData& data)
-    : wxGDIRefData()
+: wxGDIRefData()
 {
     m_style = data.m_style;
     m_width = data.m_width;
@@ -61,7 +61,7 @@ wxPen::~wxPen()
 wxPen::wxPen(const wxColour& col, int Width, int Style)
 {
     m_refData = new wxPenRefData;
-
+    
     M_PENDATA->m_colour = col;
     M_PENDATA->m_width = Width;
     M_PENDATA->m_style = Style;
@@ -69,14 +69,14 @@ wxPen::wxPen(const wxColour& col, int Width, int Style)
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_dash = 0 ;
-
+    
     RealizeResource();
 }
 
 wxPen::wxPen(const wxBitmap& stipple, int Width)
 {
     m_refData = new wxPenRefData;
-
+    
     M_PENDATA->m_stipple = stipple;
     M_PENDATA->m_width = Width;
     M_PENDATA->m_style = wxSTIPPLE;
@@ -84,102 +84,102 @@ wxPen::wxPen(const wxBitmap& stipple, int Width)
     M_PENDATA->m_cap = wxCAP_ROUND ;
     M_PENDATA->m_nbDash = 0 ;
     M_PENDATA->m_dash = 0 ;
-
+    
     RealizeResource();
 }
 
 void wxPen::Unshare()
 {
-       // Don't change shared data
-       if (!m_refData)
+    // Don't change shared data
+    if (!m_refData)
     {
-               m_refData = new wxPenRefData();
-       }
+        m_refData = new wxPenRefData();
+    }
     else
     {
-               wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
-               UnRef();
-               m_refData = ref;
-       }
+        wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
+        UnRef();
+        m_refData = ref;
+    }
 }
 
 void wxPen::SetColour(const wxColour& col)
 {
     Unshare();
-
+    
     M_PENDATA->m_colour = col;
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b)
 {
     Unshare();
-
+    
     M_PENDATA->m_colour.Set(r, g, b);
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetWidth(int Width)
 {
     Unshare();
-
+    
     M_PENDATA->m_width = Width;
-
+    
     RealizeResource();
 }
 
 void wxPen::SetStyle(int Style)
 {
     Unshare();
-
+    
     M_PENDATA->m_style = Style;
-
+    
     RealizeResource();
 }
 
 void wxPen::SetStipple(const wxBitmap& Stipple)
 {
     Unshare();
-
+    
     M_PENDATA->m_stipple = Stipple;
     M_PENDATA->m_style = wxSTIPPLE;
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
 {
     Unshare();
-
+    
     M_PENDATA->m_nbDash = nb_dashes;
     M_PENDATA->m_dash = (wxDash *)Dash;
-  
+    
     RealizeResource();
 }
 
 void wxPen::SetJoin(int Join)
 {
     Unshare();
-
+    
     M_PENDATA->m_join = Join;
-
+    
     RealizeResource();
 }
 
 void wxPen::SetCap(int Cap)
 {
     Unshare();
-
+    
     M_PENDATA->m_cap = Cap;
-
+    
     RealizeResource();
 }
 
 bool wxPen::RealizeResource()
 {
-       // nothing to do here for mac
+    // nothing to do here for mac
     return TRUE;
 }
 
index 52b07f6e600227ebe5ba3b31c500000c76e0edce..4f33c04b1e2988e434c1b12386dd3c1b0d8505ac 100644 (file)
@@ -57,8 +57,8 @@ extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
 void
 ima_png_error(png_struct *png_ptr, char *message)
 {
-       wxMessageBox(message, "PNG error");
-  longjmp(png_ptr->jmpbuf, 1);
+    wxMessageBox(message, "PNG error");
+    longjmp(png_ptr->jmpbuf, 1);
 }
 
 
@@ -67,68 +67,68 @@ wxPalette *wxCopyPalette(const wxPalette *cmap);
 
 wxPNGReader::wxPNGReader(void)
 {
-  filetype = 0;
-  RawImage = NULL;      //  Image data
-
-  Width = 0; Height = 0;       //  Dimensions
-  Depth = 0;           // (bits x pixel)
-  ColorType = 0;        // Bit 1 = Palette used
-                  // Bit 2 = Color used
-                  // Bit 3 = Alpha used
-
-  EfeWidth = 0;         // Efective Width
-
-  lpbi = NULL;
-  bgindex = -1;
-  m_palette = 0;
-  imageOK = FALSE;
+    filetype = 0;
+    RawImage = NULL;      //  Image data
+    
+    Width = 0; Height = 0;       //  Dimensions
+    Depth = 0;           // (bits x pixel)
+    ColorType = 0;        // Bit 1 = Palette used
+    // Bit 2 = Color used
+    // Bit 3 = Alpha used
+    
+    EfeWidth = 0;         // Efective Width
+    
+    lpbi = NULL;
+    bgindex = -1;
+    m_palette = 0;
+    imageOK = FALSE;
 }
 
 wxPNGReader::wxPNGReader ( char* ImageFileName )
 {
-  imageOK = FALSE;
-  filetype = 0;
-  RawImage = NULL;      //  Image data
-
-  Width = 0; Height = 0;       //  Dimensions
-  Depth = 0;           // (bits x pixel)
-  ColorType = 0;        // Bit 1 = m_palette used
-                  // Bit 2 = Color used
-                  // Bit 3 = Alpha used
-
-  EfeWidth = 0;         // Efective Width
-
-  lpbi = NULL;
-  bgindex = -1;
-  m_palette = 0;
-
-  imageOK = ReadFile (ImageFileName);
+    imageOK = FALSE;
+    filetype = 0;
+    RawImage = NULL;      //  Image data
+    
+    Width = 0; Height = 0;       //  Dimensions
+    Depth = 0;           // (bits x pixel)
+    ColorType = 0;        // Bit 1 = m_palette used
+    // Bit 2 = Color used
+    // Bit 3 = Alpha used
+    
+    EfeWidth = 0;         // Efective Width
+    
+    lpbi = NULL;
+    bgindex = -1;
+    m_palette = 0;
+    
+    imageOK = ReadFile (ImageFileName);
 }
 
 void
 wxPNGReader::Create(int width, int height, int depth, int colortype)
 {
-  Width = width; Height = height; Depth = depth;
-  ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
-  delete m_palette;
-  m_palette = NULL;
-  delete[] RawImage;
-  RawImage = NULL;
-
-  if (lpbi) {
-       wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
-  }
-  lpbi = wxMacCreateGWorld( Width , Height , Depth);
-  if (lpbi)
-  {
-    EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
-    int bitwidth = width ;
-    if ( EfeWidth > bitwidth )
-       bitwidth = EfeWidth ;
-       
-               RawImage = (byte*) new char[ ( bitwidth * Height * ((Depth+7)>>3) ) ];
-    imageOK = TRUE;
-  }
+    Width = width; Height = height; Depth = depth;
+    ColorType = (colortype>=0) ? colortype: ((Depth>8) ? COLORTYPE_COLOR: 0);
+    delete m_palette;
+    m_palette = NULL;
+    delete[] RawImage;
+    RawImage = NULL;
+    
+    if (lpbi) {
+        wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+    }
+    lpbi = wxMacCreateGWorld( Width , Height , Depth);
+    if (lpbi)
+    {
+        EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
+        int bitwidth = width ;
+        if ( EfeWidth > bitwidth )
+            bitwidth = EfeWidth ;
+        
+        RawImage = (byte*) new char[ ( bitwidth * Height * ((Depth+7)>>3) ) ];
+        imageOK = TRUE;
+    }
 }
 
 wxPNGReader::~wxPNGReader ( )
@@ -138,7 +138,7 @@ wxPNGReader::~wxPNGReader ( )
         RawImage = NULL;
     }
     if (lpbi)  {
-       wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+        wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
         lpbi = NULL;
     }
     if (m_palette != NULL) {
@@ -150,128 +150,128 @@ wxPNGReader::~wxPNGReader ( )
 
 int wxPNGReader::GetIndex(int x, int y)
 {
-  if (!Inside(x, y) || (Depth>8)) return -1;
-
-  ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-  int index = (int)(*ImagePointer);
-  return index;
+    if (!Inside(x, y) || (Depth>8)) return -1;
+    
+    ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+    int index = (int)(*ImagePointer);
+    return index;
 }
 
 bool wxPNGReader::GetRGB(int x, int y, byte* r, byte* g, byte* b)
 {
-  if (!Inside(x, y)) return FALSE;
-
-  if (m_palette) {
-   return m_palette->GetRGB(GetIndex(x, y), r, g, b);
-/*   PALETTEENTRY entry;
-   ::GetPaletteEntries((HPALETTE) m_palette->GetHPALETTE(), GetIndex(x, y), 1, &entry);
-   *r = entry.peRed;
-   *g = entry.peGreen;
-   *b = entry.peBlue;  */
-  } else {
-   ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-   *b = ImagePointer[0];
-   *g = ImagePointer[1];
-   *r = ImagePointer[2];
-  }
-  return TRUE;
+    if (!Inside(x, y)) return FALSE;
+    
+    if (m_palette) {
+        return m_palette->GetRGB(GetIndex(x, y), r, g, b);
+        /*   PALETTEENTRY entry;
+        ::GetPaletteEntries((HPALETTE) m_palette->GetHPALETTE(), GetIndex(x, y), 1, &entry);
+        *r = entry.peRed;
+        *g = entry.peGreen;
+        *b = entry.peBlue;  */
+    } else {
+        ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+        *b = ImagePointer[0];
+        *g = ImagePointer[1];
+        *r = ImagePointer[2];
+    }
+    return TRUE;
 }
 
 
 bool wxPNGReader::SetIndex(int x, int y, int index)
 {
-  if (!Inside(x, y) || (Depth>8)) return FALSE;
-
-  ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-  *ImagePointer = index;
-
-  return TRUE;
+    if (!Inside(x, y) || (Depth>8)) return FALSE;
+    
+    ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+    *ImagePointer = index;
+    
+    return TRUE;
 }
 
 bool wxPNGReader::SetRGB(int x, int y, byte r, byte g, byte b)
 {
-  if (!Inside(x, y)) return FALSE;
-
-  if (ColorType & COLORTYPE_PALETTE)
-  {
-   if (!m_palette) return FALSE;
-   SetIndex(x, y, m_palette->GetPixel(r, g, b));
-
-  } else {
-   ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
-   ImagePointer[0] = b;
-   ImagePointer[1] = g;
-   ImagePointer[2] = r;
-  }
-
-  return TRUE;
+    if (!Inside(x, y)) return FALSE;
+    
+    if (ColorType & COLORTYPE_PALETTE)
+    {
+        if (!m_palette) return FALSE;
+        SetIndex(x, y, m_palette->GetPixel(r, g, b));
+        
+    } else {
+        ImagePointerType ImagePointer = RawImage + EfeWidth*y + (x*Depth >> 3);
+        ImagePointer[0] = b;
+        ImagePointer[1] = g;
+        ImagePointer[2] = r;
+    }
+    
+    return TRUE;
 }
 
 bool wxPNGReader::SetPalette(wxPalette* colourmap)
 {
-  delete m_palette ;
-  if (!colourmap)
-   return FALSE;
-  ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
-  m_palette = new wxPalette( *colourmap );
-       return true ;
-//  return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+    delete m_palette ;
+    if (!colourmap)
+        return FALSE;
+    ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
+    m_palette = new wxPalette( *colourmap );
+    return true ;
+    //  return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
 }
 
 bool
 wxPNGReader::SetPalette(int n, byte *r, byte *g, byte *b)
 {
-  delete m_palette ;
-  m_palette = new wxPalette();
-  if (!m_palette)
-   return FALSE;
-
-  if (!g) g = r;
-  if (!b) b = g;
-  m_palette->Create(n, r, g, b);
-  ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
-       return true ;
-//    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+    delete m_palette ;
+    m_palette = new wxPalette();
+    if (!m_palette)
+        return FALSE;
+    
+    if (!g) g = r;
+    if (!b) b = g;
+    m_palette->Create(n, r, g, b);
+    ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
+    return true ;
+    //    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
 }
 
 bool
 wxPNGReader::SetPalette(int n, rgb_color_struct *rgb_struct)
 {
-  delete m_palette ;
-  m_palette = new wxPalette();
-  if (!m_palette)
-   return FALSE;
-
-  byte r[256], g[256], b[256];
-
-  for(int i=0; i<n; i++)
-  {
-   r[i] = rgb_struct[i].red;
-   g[i] = rgb_struct[i].green;
-   b[i] = rgb_struct[i].blue;
-  }
-  // Added by JACS copying from Andrew Davison's additions
-  // to GIF-reading code
-  // Make transparency colour black...
-  if (bgindex != -1)
-    r[bgindex] = g[bgindex] = b[bgindex] = 0;
-
-  m_palette->Create(n, r, g, b);
-  ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
-       return true ;
-//    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+    delete m_palette ;
+    m_palette = new wxPalette();
+    if (!m_palette)
+        return FALSE;
+    
+    byte r[256], g[256], b[256];
+    
+    for(int i=0; i<n; i++)
+    {
+        r[i] = rgb_struct[i].red;
+        g[i] = rgb_struct[i].green;
+        b[i] = rgb_struct[i].blue;
+    }
+    // Added by JACS copying from Andrew Davison's additions
+    // to GIF-reading code
+    // Make transparency colour black...
+    if (bgindex != -1)
+        r[bgindex] = g[bgindex] = b[bgindex] = 0;
+    
+    m_palette->Create(n, r, g, b);
+    ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
+    return true ;
+    //    return (DibSetUsage(lpbi, (HPALETTE) m_palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
 }
 
 void wxPNGReader::NullData()
 {
-  if (lpbi)  {
-       wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
+    if (lpbi)  {
+        wxMacDestroyGWorld( (GWorldPtr) lpbi ) ;
         lpbi = NULL;
-  }
-  if (m_palette != NULL) {
-      delete m_palette;
-      m_palette = NULL;
-  }
+    }
+    if (m_palette != NULL) {
+        delete m_palette;
+        m_palette = NULL;
+    }
 }
 
 wxBitmap* wxPNGReader::GetBitmap(void)
@@ -290,353 +290,353 @@ bool wxPNGReader::InstantiateBitmap(wxBitmap *bitmap)
 {
     if ( lpbi )
     {
-      bitmap->SetHBITMAP((WXHBITMAP) lpbi);
-      bitmap->SetWidth(GetWidth());
-      bitmap->SetHeight(GetHeight());
-      bitmap->SetDepth(GetDepth());
-      if ( GetDepth() > 1 && m_palette )
-        bitmap->SetPalette(*m_palette);
-      bitmap->SetOk(TRUE);
-
-
-      // Make a mask if appropriate
-      /*
-      if ( bgindex > -1 )
-      {
+        bitmap->SetHBITMAP((WXHBITMAP) lpbi);
+        bitmap->SetWidth(GetWidth());
+        bitmap->SetHeight(GetHeight());
+        bitmap->SetDepth(GetDepth());
+        if ( GetDepth() > 1 && m_palette )
+            bitmap->SetPalette(*m_palette);
+        bitmap->SetOk(TRUE);
+        
+        
+        // Make a mask if appropriate
+        /*
+        if ( bgindex > -1 )
+        {
         wxMask *mask = CreateMask();
         bitmap->SetMask(mask);
-      }
-      */
-      lpbi = NULL ; // bitmap has taken over ownership
-               return TRUE;
+        }
+        */
+        lpbi = NULL ; // bitmap has taken over ownership
+        return TRUE;
     }
     else
     {
-      return FALSE;
+        return FALSE;
     }
-/*
-  HDC dc = ::CreateCompatibleDC(NULL);
-
-  if (dc)
-  {
-        // tmpBitmap is a dummy, to satisfy ::CreateCompatibleDC (it
-        // is a memory dc that must have a bitmap selected into it)
-        HDC dc2 = GetDC(NULL);
-        HBITMAP tmpBitmap = ::CreateCompatibleBitmap(dc2, GetWidth(), GetHeight());
-        ReleaseDC(NULL, dc2);
-        HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, tmpBitmap);
-
+    /*
+    HDC dc = ::CreateCompatibleDC(NULL);
+    
+      if (dc)
+      {
+      // tmpBitmap is a dummy, to satisfy ::CreateCompatibleDC (it
+      // is a memory dc that must have a bitmap selected into it)
+      HDC dc2 = GetDC(NULL);
+      HBITMAP tmpBitmap = ::CreateCompatibleBitmap(dc2, GetWidth(), GetHeight());
+      ReleaseDC(NULL, dc2);
+      HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, tmpBitmap);
+      
         if ( m_palette )
         {
-            HPALETTE oldPal = ::SelectPalette(dc, (HPALETTE) m_palette->GetHPALETTE(), FALSE);
+        HPALETTE oldPal = ::SelectPalette(dc, (HPALETTE) m_palette->GetHPALETTE(), FALSE);
         ::RealizePalette(dc);
         }
-
-    HBITMAP hBitmap = ::CreateDIBitmap(dc, lpbi,
-        CBM_INIT, RawImage, (LPBITMAPINFO) lpbi, DIB_PAL_COLORS);
-
-        ::SelectPalette(dc, NULL, TRUE);
-        ::SelectObject(dc, oldBitmap);
-        ::DeleteObject(tmpBitmap);
-        ::DeleteDC(dc);
-
-        if ( hBitmap )
-        {
-          bitmap->SetHBITMAP((WXHBITMAP) hBitmap);
-          bitmap->SetWidth(GetWidth());
-          bitmap->SetHeight(GetHeight());
-          bitmap->SetDepth(GetDepth());
-          if ( GetDepth() > 1 && m_palette )
-            bitmap->SetPalette(*m_palette);
-          bitmap->SetOk(TRUE);
-
-
-          // Make a mask if appropriate
-          if ( bgindex > -1 )
-          {
-            wxMask *mask = CreateMask();
-            bitmap->SetMask(mask);
-          }
-      return TRUE;
-        }
-        else
-        {
-          return FALSE;
-        }
-  }
-  else
-    {
-    return FALSE;
-    }
-  */
-  return false ;
+        
+          HBITMAP hBitmap = ::CreateDIBitmap(dc, lpbi,
+          CBM_INIT, RawImage, (LPBITMAPINFO) lpbi, DIB_PAL_COLORS);
+          
+            ::SelectPalette(dc, NULL, TRUE);
+            ::SelectObject(dc, oldBitmap);
+            ::DeleteObject(tmpBitmap);
+            ::DeleteDC(dc);
+            
+              if ( hBitmap )
+              {
+              bitmap->SetHBITMAP((WXHBITMAP) hBitmap);
+              bitmap->SetWidth(GetWidth());
+              bitmap->SetHeight(GetHeight());
+              bitmap->SetDepth(GetDepth());
+              if ( GetDepth() > 1 && m_palette )
+              bitmap->SetPalette(*m_palette);
+              bitmap->SetOk(TRUE);
+              
+                
+                  // Make a mask if appropriate
+                  if ( bgindex > -1 )
+                  {
+                  wxMask *mask = CreateMask();
+                  bitmap->SetMask(mask);
+                  }
+                  return TRUE;
+                  }
+                  else
+                  {
+                  return FALSE;
+                  }
+                  }
+                  else
+                  {
+                  return FALSE;
+                  }
+    */
+    return false ;
 }
 
 wxPalette *wxCopyPalette(const wxPalette *cmap)
 {
-  wxPalette *newCmap = new wxPalette( *cmap ) ;
-  return newCmap;
+    wxPalette *newCmap = new wxPalette( *cmap ) ;
+    return newCmap;
 }
 
 wxMask *wxPNGReader::CreateMask(void)
 {
 /*
-    HBITMAP hBitmap = ::CreateBitmap(GetWidth(), GetHeight(), 1, 1, NULL);
+HBITMAP hBitmap = ::CreateBitmap(GetWidth(), GetHeight(), 1, 1, NULL);
 
   HDC dc = ::CreateCompatibleDC(NULL);
-    HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, hBitmap);
-
+  HBITMAP oldBitmap = (HBITMAP) ::SelectObject(dc, hBitmap);
+  
     int bgIndex = GetBGIndex();
-
-    int x,y;
-
-    for (x=0; x<GetWidth(); x++)
-    {
+    
+      int x,y;
+      
+        for (x=0; x<GetWidth(); x++)
+        {
         for (y=0; y<GetHeight(); y++)
         {
-            int index = GetIndex(x, y);
-            if ( index == bgIndex )
-                ::SetPixel(dc, x, GetHeight() - y - 1, RGB(0, 0, 0));
-            else
-                ::SetPixel(dc, x, GetHeight() - y - 1, RGB(255, 255, 255));
-
-      }
-    }
-    ::SelectObject(dc, oldBitmap);
-    wxMask *mask = new wxMask;
-    mask->SetMaskBitmap((WXHBITMAP) hBitmap);
-    return mask;
-   */
-   return NULL ;
+        int index = GetIndex(x, y);
+        if ( index == bgIndex )
+        ::SetPixel(dc, x, GetHeight() - y - 1, RGB(0, 0, 0));
+        else
+        ::SetPixel(dc, x, GetHeight() - y - 1, RGB(255, 255, 255));
+        
+          }
+          }
+          ::SelectObject(dc, oldBitmap);
+          wxMask *mask = new wxMask;
+          mask->SetMaskBitmap((WXHBITMAP) hBitmap);
+          return mask;
+    */
+    return NULL ;
 }
 
 bool wxPNGReader::ReadFile(char * ImageFileName)
 {
-  int number_passes;
-
-  if (ImageFileName)
-   strcpy(filename, ImageFileName);
-
-  FILE *fp;
-  png_struct *png_ptr;
-   png_info *info_ptr;
-  wxPNGReaderIter iter(this);
-
-  /* open the file */
-  fp = fopen( ImageFileName , "rb" );
-
-  if (!fp)
-    return FALSE;
-
-  /* allocate the necessary structures */
-  png_ptr = new (png_struct);
-  if (!png_ptr)
-  {
-    fclose(fp);
-    return FALSE;
-  }
-
-  info_ptr = new (png_info);
-  if (!info_ptr)
-  {
-    fclose(fp);
-    delete png_ptr;
-    return FALSE;
-  }
-  /* set error handling */
-  if (setjmp(png_ptr->jmpbuf))
-  {
-    png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-    fclose(fp);
-    delete png_ptr;
-    delete info_ptr;
-
-    /* If we get here, we had a problem reading the file */
-    return FALSE;
-  }
-        //png_set_error(ima_png_error, NULL);
-
-  /* initialize the structures, info first for error handling */
-  png_info_init(info_ptr);
-  png_read_init(png_ptr);
-
-  /* set up the input control */
-  png_init_io(png_ptr, fp);
-
-  /* read the file information */
-  png_read_info(png_ptr, info_ptr);
-
-  /* allocate the memory to hold the image using the fields
+    int number_passes;
+    
+    if (ImageFileName)
+        strcpy(filename, ImageFileName);
+    
+    FILE *fp;
+    png_struct *png_ptr;
+    png_info *info_ptr;
+    wxPNGReaderIter iter(this);
+    
+    /* open the file */
+    fp = fopen( ImageFileName , "rb" );
+    
+    if (!fp)
+        return FALSE;
+    
+    /* allocate the necessary structures */
+    png_ptr = new (png_struct);
+    if (!png_ptr)
+    {
+        fclose(fp);
+        return FALSE;
+    }
+    
+    info_ptr = new (png_info);
+    if (!info_ptr)
+    {
+        fclose(fp);
+        delete png_ptr;
+        return FALSE;
+    }
+    /* set error handling */
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_read_destroy(png_ptr, info_ptr, (png_info *)0);
+        fclose(fp);
+        delete png_ptr;
+        delete info_ptr;
+        
+        /* If we get here, we had a problem reading the file */
+        return FALSE;
+    }
+    //png_set_error(ima_png_error, NULL);
+    
+    /* initialize the structures, info first for error handling */
+    png_info_init(info_ptr);
+    png_read_init(png_ptr);
+    
+    /* set up the input control */
+    png_init_io(png_ptr, fp);
+    
+    /* read the file information */
+    png_read_info(png_ptr, info_ptr);
+    
+    /* allocate the memory to hold the image using the fields
     of png_info. */
-  png_color_16 my_background={ 0, 31, 127, 255, 0 };
-
-  if (info_ptr->valid & PNG_INFO_bKGD)
+    png_color_16 my_background={ 0, 31, 127, 255, 0 };
+    
+    if (info_ptr->valid & PNG_INFO_bKGD)
     {
-    png_set_background(png_ptr, &(info_ptr->background),
-      PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
+        png_set_background(png_ptr, &(info_ptr->background),
+            PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
         if ( info_ptr->num_palette > 0 )
             bgindex = info_ptr->background.index;
     }
-  else   {
-    png_set_background(png_ptr, &my_background,
-      PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
-
+    else   {
+        png_set_background(png_ptr, &my_background,
+            PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
+        
         // Added by JACS: guesswork!
         if ( info_ptr->num_trans != 0 )
             bgindex = info_ptr->num_trans - 1 ;
-   }
-
-  /* tell libpng to strip 16 bit depth files down to 8 bits */
-  if (info_ptr->bit_depth == 16)
-    png_set_strip_16(png_ptr);
-
-  int pixel_depth=(info_ptr->pixel_depth<24) ? info_ptr->pixel_depth: 24;
-  Create(info_ptr->width, info_ptr->height, pixel_depth,
-    info_ptr->color_type);
-
-  if (info_ptr->num_palette>0)
+    }
+    
+    /* tell libpng to strip 16 bit depth files down to 8 bits */
+    if (info_ptr->bit_depth == 16)
+        png_set_strip_16(png_ptr);
+    
+    int pixel_depth=(info_ptr->pixel_depth<24) ? info_ptr->pixel_depth: 24;
+    Create(info_ptr->width, info_ptr->height, pixel_depth,
+        info_ptr->color_type);
+    
+    if (info_ptr->num_palette>0)
     {
-      SetPalette((int)info_ptr->num_palette, (rgb_color_struct*)info_ptr->palette);
+        SetPalette((int)info_ptr->num_palette, (rgb_color_struct*)info_ptr->palette);
     }
-
-  int row_stride = info_ptr->width * ((pixel_depth+7)>>3);
- //  printf("P = %d D = %d RS= %d ", info_ptr->num_palette, info_ptr->pixel_depth,row_stride);
-//  printf("CT = %d TRS = %d BD= %d ", info_ptr->color_type, info_ptr->valid & PNG_INFO_tRNS,info_ptr->bit_depth);
-
-  byte *row_pointers = new byte[row_stride];
-
-  /* turn on interlace handling */
-  if (info_ptr->interlace_type)
-    number_passes = png_set_interlace_handling(png_ptr);
-  else
-    number_passes = 1;
-//  printf("NP = %d ", number_passes);
-
-  for (int pass=0; pass< number_passes; pass++) 
-  {
-         iter.upset();
-         int y=0;
-               CGrafPtr        origPort ;
-               GDHandle        origDevice ;
-               
-               GetGWorld( &origPort , &origDevice ) ;
-               // ignore shapedc
-               SetGWorld( (GWorldPtr) lpbi , NULL ) ;
-         do  
-         {
-       //    (unsigned char *)iter.GetRow();
-           if (info_ptr->interlace_type)  
-           {
-            if (pass>0)
-             iter.GetRow(row_pointers, row_stride);
-            png_read_row(png_ptr, row_pointers, NULL);
-           }
-           else
-            png_read_row(png_ptr, row_pointers, NULL);
-                       
-                       if ( info_ptr->palette )
-                       {
-                               if ( pixel_depth == 8 )
-                               {
-                                       for ( size_t i = 0 ; i < info_ptr->width ; ++i )
-                                       {
-                                               png_color_struct* color ; 
-                                               RGBColor col ;
-
-                                               int index = row_pointers[i] ;
-                                               color = &info_ptr->palette[index] ;
-                                               col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                               col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                               col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                               SetCPixel( i, y, &col);
-                                       }
-                                       /*
-                                       png_color_struct* color ; 
-                                       RGBColor col ;
-                                       unsigned char* p = &row_pointers[0] ;
-                                       PenNormal() ;
-                                       MoveTo( 0 , y ) ;
-                                       int index = *p ;
-                                       color = &info_ptr->palette[index] ;
-                                       col.red = (color->red << 8) | color->red ;
-                                       col.green = (color->green << 8) | color->green ;
-                                       col.blue = (color->blue << 8) | color->blue ;
-                                       RGBForeColor( &col ) ;
-                                       col.red = col.green = col.blue = 0xFFFF ;
-                                       RGBBackColor( &col ) ;
-                                       for ( int i = 0 ; i < info_ptr->width ; ++i , ++p)
-                                       {
-                                               if ( *p != index )
-                                               {
-                                                       LineTo( i , y ) ;
-                                                       index = *p ;
-                                                       color = &info_ptr->palette[index] ;
-                                                       col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                                       col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                                       col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                                       RGBForeColor( &col ) ;
-                                               }
-                                       }
-                                       LineTo( info_ptr->width  , y ) ;
-                                       */
-                               }
-                               else
-                               {
-                                       for ( size_t i = 0 ; i < info_ptr->width ; ++i )
-                                       {
-                                               png_color_struct* color ; 
-                                               RGBColor col ;
-
-                                               int byte = ( i * pixel_depth ) / 8 ;
-                                               int offset = ( 8 - pixel_depth ) - ( i * pixel_depth ) % 8 ;
-                                                       
-                                               int index = ( row_pointers[byte] >> offset ) & ( 0xFF >> ( 8 - pixel_depth ) );
-                                               color = &info_ptr->palette[index] ;
-                                               col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                               col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                               col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                               SetCPixel( i, y, &col);
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               for ( size_t i = 0 ; i < info_ptr->width ; ++i )
-                               {
-                                       png_color_struct* color ; 
-                                       RGBColor col ;
-                                       color =(png_color_struct*) (&row_pointers[i*3]) ;
-                                       col.red = (((int)color->red) << 8) | ((int)color->red) ;
-                                       col.green = (((int)color->green) << 8) | ((int)color->green) ;
-                                       col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
-                                       SetCPixel( i, y, &col);
-                               }
-                       }
-                       if (number_passes)
-                               iter.SetRow(row_pointers, row_stride);
-           y++;
-         
-         while(iter.PrevRow());
-         SetGWorld( origPort , origDevice ) ;
-
-//  printf("Y=%d ",y);
+    
+    int row_stride = info_ptr->width * ((pixel_depth+7)>>3);
   //  printf("P = %d D = %d RS= %d ", info_ptr->num_palette, info_ptr->pixel_depth,row_stride);
+    //  printf("CT = %d TRS = %d BD= %d ", info_ptr->color_type, info_ptr->valid & PNG_INFO_tRNS,info_ptr->bit_depth);
+    
+    byte *row_pointers = new byte[row_stride];
+    
+    /* turn on interlace handling */
+    if (info_ptr->interlace_type)
+        number_passes = png_set_interlace_handling(png_ptr);
+    else
+        number_passes = 1;
+    //  printf("NP = %d ", number_passes);
+    
+    for (int pass=0; pass< number_passes; pass++) 
+    {
+        iter.upset();
+        int y=0;
+        CGrafPtr     origPort ;
+        GDHandle    origDevice ;
+        
+        GetGWorld( &origPort , &origDevice ) ;
+        // ignore shapedc
+        SetGWorld( (GWorldPtr) lpbi , NULL ) ;
+        do  
+        {
+            //    (unsigned char *)iter.GetRow();
+            if (info_ptr->interlace_type)  
+            {
+                if (pass>0)
+                    iter.GetRow(row_pointers, row_stride);
+                png_read_row(png_ptr, row_pointers, NULL);
+            }
+            else
+                png_read_row(png_ptr, row_pointers, NULL);
+            
+            if ( info_ptr->palette )
+            {
+                if ( pixel_depth == 8 )
+                {
+                    for ( size_t i = 0 ; i < info_ptr->width ; ++i )
+                    {
+                        png_color_struct* color ; 
+                        RGBColor col ;
+                        
+                        int index = row_pointers[i] ;
+                        color = &info_ptr->palette[index] ;
+                        col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                        col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                        col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                        SetCPixel( i, y, &col);
+                    }
+                    /*
+                    png_color_struct* color ; 
+                    RGBColor col ;
+                    unsigned char* p = &row_pointers[0] ;
+                    PenNormal() ;
+                    MoveTo( 0 , y ) ;
+                    int index = *p ;
+                    color = &info_ptr->palette[index] ;
+                    col.red = (color->red << 8) | color->red ;
+                    col.green = (color->green << 8) | color->green ;
+                    col.blue = (color->blue << 8) | color->blue ;
+                    RGBForeColor( &col ) ;
+                    col.red = col.green = col.blue = 0xFFFF ;
+                    RGBBackColor( &col ) ;
+                    for ( int i = 0 ; i < info_ptr->width ; ++i , ++p)
+                    {
+                    if ( *p != index )
+                    {
+                    LineTo( i , y ) ;
+                    index = *p ;
+                    color = &info_ptr->palette[index] ;
+                    col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                    col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                    col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                    RGBForeColor( &col ) ;
+                    }
+                    }
+                    LineTo( info_ptr->width  , y ) ;
+                    */
+                }
+                else
+                {
+                    for ( size_t i = 0 ; i < info_ptr->width ; ++i )
+                    {
+                        png_color_struct* color ; 
+                        RGBColor col ;
+                        
+                        int byte = ( i * pixel_depth ) / 8 ;
+                        int offset = ( 8 - pixel_depth ) - ( i * pixel_depth ) % 8 ;
+                        
+                        int index = ( row_pointers[byte] >> offset ) & ( 0xFF >> ( 8 - pixel_depth ) );
+                        color = &info_ptr->palette[index] ;
+                        col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                        col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                        col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                        SetCPixel( i, y, &col);
+                    }
+                }
+            }
+            else
+            {
+                for ( size_t i = 0 ; i < info_ptr->width ; ++i )
+                {
+                    png_color_struct* color ; 
+                    RGBColor col ;
+                    color =(png_color_struct*) (&row_pointers[i*3]) ;
+                    col.red = (((int)color->red) << 8) | ((int)color->red) ;
+                    col.green = (((int)color->green) << 8) | ((int)color->green) ;
+                    col.blue = (((int)color->blue) << 8) | ((int)color->blue) ;
+                    SetCPixel( i, y, &col);
+                }
+            }
+            if (number_passes)
+                iter.SetRow(row_pointers, row_stride);
+            y++;
+        } 
+        while(iter.PrevRow());
+        SetGWorld( origPort , origDevice ) ;
+        
+        //  printf("Y=%d ",y);
   }
   delete[] row_pointers;
-
+  
   /* read the rest of the file, getting any additional chunks
-    in info_ptr */
+  in info_ptr */
   png_read_end(png_ptr, info_ptr);
-
+  
   /* clean up after the read, and free any memory allocated */
   png_read_destroy(png_ptr, info_ptr, (png_info *)0);
-
+  
   /* free the structures */
   delete png_ptr;
   delete info_ptr;
-
+  
   /* close the file */
   fclose(fp);
-
+  
   /* that's it */
   return TRUE;
 }
@@ -646,146 +646,146 @@ bool wxPNGReader::ReadFile(char * ImageFileName)
 
 bool wxPNGReader::SaveFile(char * ImageFileName)
 {
-  if (ImageFileName)
-   strcpy(filename, ImageFileName);
-
-  wxPNGReaderIter iter(this);
-  FILE *fp;
-   png_struct *png_ptr;
-  png_info *info_ptr;
-
-   /* open the file */
-  fp = fopen(filename, "wb");
-  if (!fp)
-    return FALSE;
-
-  /* allocate the necessary structures */
-  png_ptr = new (png_struct);
-  if (!png_ptr)
-  {
-    fclose(fp);
-    return FALSE;
-  }
-
-  info_ptr = new (png_info);
-  if (!info_ptr)
-  {
-    fclose(fp);
-    delete png_ptr;
-    return FALSE;
-  }
-
-  /* set error handling */
-  if (setjmp(png_ptr->jmpbuf))
-  {
+    if (ImageFileName)
+        strcpy(filename, ImageFileName);
+    
+    wxPNGReaderIter iter(this);
+    FILE *fp;
+    png_struct *png_ptr;
+    png_info *info_ptr;
+    
+    /* open the file */
+    fp = fopen(filename, "wb");
+    if (!fp)
+        return FALSE;
+    
+    /* allocate the necessary structures */
+    png_ptr = new (png_struct);
+    if (!png_ptr)
+    {
+        fclose(fp);
+        return FALSE;
+    }
+    
+    info_ptr = new (png_info);
+    if (!info_ptr)
+    {
+        fclose(fp);
+        delete png_ptr;
+        return FALSE;
+    }
+    
+    /* set error handling */
+    if (setjmp(png_ptr->jmpbuf))
+    {
+        png_write_destroy(png_ptr);
+        fclose(fp);
+        delete png_ptr;
+        delete info_ptr;
+        
+        /* If we get here, we had a problem reading the file */
+        return FALSE;
+    }
+    //png_set_error(ima_png_error, NULL);
+    
+    //  printf("writig pg %s ", filename);
+    /* initialize the structures */
+    png_info_init(info_ptr);
+    png_write_init(png_ptr);
+    
+    int row_stride = GetWidth() * ((GetDepth()+7)>>3);
+    /* set up the output control */
+    png_init_io(png_ptr, fp);
+    
+    /* set the file information here */
+    info_ptr->width = GetWidth();
+    info_ptr->height = GetHeight();
+    info_ptr->pixel_depth = GetDepth();
+    info_ptr->channels = (GetDepth()>8) ? 3: 1;
+    info_ptr->bit_depth = GetDepth()/info_ptr->channels;
+    info_ptr->color_type = GetColorType();
+    info_ptr->compression_type = info_ptr->filter_type = info_ptr->interlace_type=0;
+    info_ptr->valid = 0;
+    info_ptr->rowbytes = row_stride;
+    
+    
+    // printf("P = %d D = %d RS= %d GD= %d CH= %d ", info_ptr->pixel_depth, info_ptr->bit_depth, row_stride, GetDepth(), info_ptr->channels);
+    /* set the palette if there is one */
+    if ((GetColorType() & COLORTYPE_PALETTE) && GetPalette())
+    {
+        //    printf("writing paleta[%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
+        info_ptr->valid |= PNG_INFO_PLTE;
+        info_ptr->palette = new png_color[256];
+        info_ptr->num_palette = 256;
+        for (int i=0; i<256; i++)
+            GetPalette()->GetRGB(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+    }
+    //    printf("Paleta [%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
+    
+    
+    /* optional significant bit chunk */
+    //   info_ptr->valid |= PNG_INFO_sBIT;
+    //   info_ptr->sig_bit = true_bit_depth;
+    
+    /* optional gamma chunk */
+    //   info_ptr->valid |= PNG_INFO_gAMA;
+    //   info_ptr->gamma = gamma;
+    
+    /* other optional chunks */
+    
+    /* write the file information */
+    png_write_info(png_ptr, info_ptr);
+    
+    /* set up the transformations you want.  Note that these are
+    all optional.  Only call them if you want them */
+    
+    /* shift the pixels up to a legal bit depth and fill in
+    as appropriate to correctly scale the image */
+    //   png_set_shift(png_ptr, &(info_ptr->sig_bit));
+    
+    /* pack pixels into bytes */
+    //   png_set_packing(png_ptr);
+    
+    /* flip bgr pixels to rgb */
+    //   png_set_bgr(png_ptr);
+    
+    /* swap bytes of 16 bit files to most significant bit first */
+    //   png_set_swap(png_ptr);
+    
+    /* get rid of filler bytes, pack rgb into 3 bytes */
+    //   png_set_rgbx(png_ptr);
+    
+    /* If you are only writing one row at a time, this works */
+    
+    byte *row_pointers = new byte[row_stride];
+    iter.upset();
+    do  {
+        //    (unsigned char *)iter.GetRow();
+        iter.GetRow(row_pointers, row_stride);
+        png_write_row(png_ptr, row_pointers);
+    } while(iter.PrevRow());
+    
+    delete[] row_pointers;
+    
+    /* write the rest of the file */
+    png_write_end(png_ptr, info_ptr);
+    
+    /* clean up after the write, and free any memory allocated */
     png_write_destroy(png_ptr);
-    fclose(fp);
+    
+    /* if you malloced the palette, free it here */
+    if (info_ptr->palette)
+        delete[] (info_ptr->palette);
+    
+    /* free the structures */
     delete png_ptr;
     delete info_ptr;
-
-    /* If we get here, we had a problem reading the file */
-    return FALSE;
-  }
-        //png_set_error(ima_png_error, NULL);
-
-//  printf("writig pg %s ", filename);
-   /* initialize the structures */
-  png_info_init(info_ptr);
-  png_write_init(png_ptr);
-
-  int row_stride = GetWidth() * ((GetDepth()+7)>>3);
-  /* set up the output control */
-   png_init_io(png_ptr, fp);
-
-  /* set the file information here */
-  info_ptr->width = GetWidth();
-  info_ptr->height = GetHeight();
-  info_ptr->pixel_depth = GetDepth();
-  info_ptr->channels = (GetDepth()>8) ? 3: 1;
-  info_ptr->bit_depth = GetDepth()/info_ptr->channels;
-  info_ptr->color_type = GetColorType();
-  info_ptr->compression_type = info_ptr->filter_type = info_ptr->interlace_type=0;
-  info_ptr->valid = 0;
-  info_ptr->rowbytes = row_stride;
-
-
-// printf("P = %d D = %d RS= %d GD= %d CH= %d ", info_ptr->pixel_depth, info_ptr->bit_depth, row_stride, GetDepth(), info_ptr->channels);
-  /* set the palette if there is one */
-  if ((GetColorType() & COLORTYPE_PALETTE) && GetPalette())
-  {
-//    printf("writing paleta[%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
-    info_ptr->valid |= PNG_INFO_PLTE;
-    info_ptr->palette = new png_color[256];
-    info_ptr->num_palette = 256;
-    for (int i=0; i<256; i++)
-     GetPalette()->GetRGB(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
-  }
-//    printf("Paleta [%d %d %x]",GetColorType() ,COLORTYPE_PALETTE, GetPalette());
-
-
-   /* optional significant bit chunk */
-//   info_ptr->valid |= PNG_INFO_sBIT;
-//   info_ptr->sig_bit = true_bit_depth;
-
-  /* optional gamma chunk */
-//   info_ptr->valid |= PNG_INFO_gAMA;
-//   info_ptr->gamma = gamma;
-
-  /* other optional chunks */
-
-   /* write the file information */
-   png_write_info(png_ptr, info_ptr);
-
-   /* set up the transformations you want.  Note that these are
-      all optional.  Only call them if you want them */
-
-  /* shift the pixels up to a legal bit depth and fill in
-      as appropriate to correctly scale the image */
-//   png_set_shift(png_ptr, &(info_ptr->sig_bit));
-
-  /* pack pixels into bytes */
-//   png_set_packing(png_ptr);
-
-  /* flip bgr pixels to rgb */
-//   png_set_bgr(png_ptr);
-
-   /* swap bytes of 16 bit files to most significant bit first */
-//   png_set_swap(png_ptr);
-
-   /* get rid of filler bytes, pack rgb into 3 bytes */
-//   png_set_rgbx(png_ptr);
-
-/* If you are only writing one row at a time, this works */
-
-  byte *row_pointers = new byte[row_stride];
-    iter.upset();
-  do  {
-//    (unsigned char *)iter.GetRow();
-    iter.GetRow(row_pointers, row_stride);
-    png_write_row(png_ptr, row_pointers);
-  } while(iter.PrevRow());
-
-        delete[] row_pointers;
-
-/* write the rest of the file */
-   png_write_end(png_ptr, info_ptr);
-
-  /* clean up after the write, and free any memory allocated */
-   png_write_destroy(png_ptr);
-
-   /* if you malloced the palette, free it here */
-   if (info_ptr->palette)
-    delete[] (info_ptr->palette);
-
-  /* free the structures */
-  delete png_ptr;
-  delete info_ptr;
-
-  /* close the file */
-  fclose(fp);
-
-  /* that's it */
-  return TRUE;
+    
+    /* close the file */
+    fclose(fp);
+    
+    /* that's it */
+    return TRUE;
 }
 
 static int Power(int x, int y)
@@ -800,15 +800,15 @@ static int Power(int x, int y)
 }
 
 static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
-  'C', 'D', 'E', 'F' };
+'C', 'D', 'E', 'F' };
 
 static void DecToHex(int dec, char *buf)
 {
-  int firstDigit = (int)(dec/16.0);
-  int secondDigit = (int)(dec - (firstDigit*16.0));
-  buf[0] = hexArray[firstDigit];
-  buf[1] = hexArray[secondDigit];
-  buf[2] = 0;
+    int firstDigit = (int)(dec/16.0);
+    int secondDigit = (int)(dec - (firstDigit*16.0));
+    buf[0] = hexArray[firstDigit];
+    buf[1] = hexArray[secondDigit];
+    buf[2] = 0;
 }
 
 
@@ -822,30 +822,30 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         strcpy(nameStr, filename);
         wxStripExtension(nameStr);
     }
-
+    
     if ( GetDepth() > 4 )
     {
         // Only a depth of 4 and below allowed
         return FALSE;
     }
-
+    
     if ( !GetPalette() )
         return FALSE;
-
+    
     wxSTD ofstream str(filename);
     if ( str.bad() )
         return FALSE;
-
+    
     int noColours = Power(2, GetDepth());
-
+    
     // Output header
     str << "/* XPM */\n";
     str << "static char * " << nameStr << "_xpm[] = {\n";
     str << "\"" << GetWidth() << " " << GetHeight() << " " << noColours << " 1\",\n";
-
+    
     // Output colourmap
     int base = 97 ; // start from 'a'
-
+    
     unsigned char red, green, blue;
     char hexBuf[4];
     int i;
@@ -861,7 +861,7 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         str << hexBuf;
         str << "\",\n";
     }
-
+    
     // Output the data
     int x, y;
     for ( y = 0; y < GetHeight(); y++)
@@ -874,10 +874,10 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         }
         str << "\",\n";
     }
-
+    
     str << "};\n";
     str.flush();
-
+    
     return TRUE;
 }
 
@@ -885,7 +885,7 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
 IMPLEMENT_DYNAMIC_CLASS(wxPNGFileHandler, wxBitmapHandler)
 
 bool wxPNGFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
-    int desiredWidth, int desiredHeight)
+                                int desiredWidth, int desiredHeight)
 {
     wxPNGReader reader;
     if (reader.ReadFile((char*) (const char*) name))
index 7261f5576fc16934d932c35c7a4e63f3b96872e8..779ee74edd7a2c27ba1d09366e982bbb660df3cb 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -19,7 +19,7 @@
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 #ifndef __DARWIN__
-    #include "Printing.h"
+#include "Printing.h"
 #endif
 
 #if defined(TARGET_CARBON) && !defined(__DARWIN__)
@@ -53,7 +53,7 @@ wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
     wxPrintDialogData data2;
     if ( data )
         data2 = *data;
-
+    
     Create(p, &data2);
 }
 
@@ -62,10 +62,10 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
     m_dialogParent = p;
     m_printerDC = NULL;
     m_destroyDC = TRUE;
-
+    
     if ( data )
         m_printDialogData = *data;
-
+    
     return TRUE;
 }
 
@@ -79,31 +79,31 @@ wxPrintDialog::~wxPrintDialog()
 
 int wxPrintDialog::ShowModal()
 {
-       int result = wxID_CANCEL ;
-       OSErr err ;
-       wxString message ;
-
-#if !TARGET_CARBON     
-       err = ::UMAPrOpen(NULL) ;
-       if ( err == noErr )
-       {
-               m_printDialogData.ConvertToNative() ;
-               if  ( ::PrJobDialog( (THPrint) m_printDialogData.GetPrintData().m_macPrintSettings ) )
-               {
-                       m_printDialogData.ConvertFromNative() ;
-                       result = wxID_OK ;
-               }
-
-       }
-       else
-       {
-               message.Printf( "Print Error %d", err ) ;
-               wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-       }
-       ::UMAPrClose(NULL) ;
+    int result = wxID_CANCEL ;
+    OSErr err ;
+    wxString message ;
+    
+#if !TARGET_CARBON    
+    err = ::UMAPrOpen(NULL) ;
+    if ( err == noErr )
+    {
+        m_printDialogData.ConvertToNative() ;
+        if  ( ::PrJobDialog( (THPrint) m_printDialogData.GetPrintData().m_macPrintSettings ) )
+        {
+            m_printDialogData.ConvertFromNative() ;
+            result = wxID_OK ;
+        }
+        
+    }
+    else
+    {
+        message.Printf( "Print Error %d", err ) ;
+        wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+    }
+    ::UMAPrClose(NULL) ;
 #else
-  #if PM_USE_SESSION_APIS
+#if PM_USE_SESSION_APIS
     Boolean        accepted;
     
     {
@@ -121,16 +121,16 @@ int wxPrintDialog::ShowModal()
                 (m_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
                 err = PMSessionDefaultPageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                                 (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
+                    (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
             err = PMSessionValidatePageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                              (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
-                                              kPMDontWantBoolean);
+                (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
+                kPMDontWantBoolean);
         }
-       
+        
         //  Set up a valid PrintSettings object.
         if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings)
         {
@@ -143,14 +143,14 @@ int wxPrintDialog::ShowModal()
                 (m_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings))
             {
                 err = PMSessionDefaultPrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                                    (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
+                    (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
             }
         }
         else
         {
             err = PMSessionValidatePrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                                 (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
-                                                 kPMDontWantBoolean);
+                (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
+                kPMDontWantBoolean);
         }
         //  Set a valid page range before displaying the Print dialog
         if (err == noErr)
@@ -163,9 +163,9 @@ int wxPrintDialog::ShowModal()
         if (err == noErr)
         {
             err = PMSessionPrintDialog((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
-                                       (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
-                                       (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
-                                       &accepted);
+                (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
+                (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
+                &accepted);
             if ((err == noErr) && !accepted)
             {
                 err = kPMCancel; // user clicked Cancel button
@@ -183,11 +183,11 @@ int wxPrintDialog::ShowModal()
         wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
-  #else
-    #pragma warning "TODO: Printing for carbon without session apis"
-  #endif
+#else
+#pragma warning "TODO: Printing for carbon without session apis"
 #endif
-       return result ;
+#endif
+    return result ;
 }
 
 wxDC *wxPrintDialog::GetPrintDC()
@@ -196,17 +196,17 @@ wxDC *wxPrintDialog::GetPrintDC()
 }
 
 /*
- * wxPageSetupDialog
- */
+* wxPageSetupDialog
+*/
 
 wxPageSetupDialog::wxPageSetupDialog():
- wxDialog()
+wxDialog()
 {
-  m_dialogParent = NULL;
+    m_dialogParent = NULL;
 }
 
 wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
- wxDialog()
+wxDialog()
 {
     Create(p, data);
 }
@@ -214,10 +214,10 @@ wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
 bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
 {
     m_dialogParent = p;
-
+    
     if (data)
         m_pageSetupData = (*data);
-
+    
     return TRUE;
 }
 
@@ -227,31 +227,31 @@ wxPageSetupDialog::~wxPageSetupDialog()
 
 int wxPageSetupDialog::ShowModal()
 {
-       int      result = wxID_CANCEL ;
-       OSErr    err ;
-       wxString message ;
-
+    int      result = wxID_CANCEL ;
+    OSErr    err ;
+    wxString message ;
+    
 #if !TARGET_CARBON
-       err = ::UMAPrOpen(NULL) ;
-       if ( err == noErr )
-       {
-               m_pageSetupData.ConvertToNative() ;
-               if  ( ::PrStlDialog(  (THPrint) m_pageSetupData.GetPrintData().m_macPrintSettings ) )
-               {
-                       m_pageSetupData.ConvertFromNative() ;
-                       result = wxID_OK ;
-               }
-
-       }
-       else
-       {
-               message.Printf( "Print Error %d", err ) ;
-               wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
-               dialog.ShowModal();
-       }
-       ::UMAPrClose(NULL) ;
+    err = ::UMAPrOpen(NULL) ;
+    if ( err == noErr )
+    {
+        m_pageSetupData.ConvertToNative() ;
+        if  ( ::PrStlDialog(  (THPrint) m_pageSetupData.GetPrintData().m_macPrintSettings ) )
+        {
+            m_pageSetupData.ConvertFromNative() ;
+            result = wxID_OK ;
+        }
+        
+    }
+    else
+    {
+        message.Printf( "Print Error %d", err ) ;
+        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        dialog.ShowModal();
+    }
+    ::UMAPrClose(NULL) ;
 #else
-  #if PM_USE_SESSION_APIS
+#if PM_USE_SESSION_APIS
     Boolean        accepted;
     
     {
@@ -269,22 +269,22 @@ int wxPageSetupDialog::ShowModal()
                 (m_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
                 err = PMSessionDefaultPageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
-                                                 (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
+                    (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
             err = PMSessionValidatePageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
-                                              (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
-                                              kPMDontWantBoolean);
+                (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
+                kPMDontWantBoolean);
         }
         
         //  Display the Page Setup dialog.
         if (err == noErr)
         {
             err = PMSessionPageSetupDialog((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
-                                           (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
-                                           &accepted);
+                (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
+                &accepted);
             if ((err == noErr) && !accepted)
             {
                 err = kPMCancel; // user clicked Cancel button
@@ -305,10 +305,10 @@ int wxPageSetupDialog::ShowModal()
         wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
-  #else
-    #pragma warning "TODO: Printing for carbon without session apis"
-  #endif
+#else
+#pragma warning "TODO: Printing for carbon without session apis"
+#endif
 #endif
-       return result ;
+    return result ;
 }
 
index 60d15137cff0c1269f91d9f91133a0d9174d1b0f..20ea4968011c5db61d417ca3c776a7b1c3d77f54 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:       wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -43,11 +43,11 @@ IMPLEMENT_CLASS(wxMacPrintPreview, wxPrintPreviewBase)
 #endif
 
 /*
- * Printer
- */
+* Printer
+*/
+
 wxMacPrinter::wxMacPrinter(wxPrintDialogData *data):
-  wxPrinterBase(data)
+wxPrinterBase(data)
 {
 }
 
@@ -57,170 +57,170 @@ wxMacPrinter::~wxMacPrinter(void)
 
 bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
 {
-  sm_abortIt = FALSE;
-  sm_abortWindow = NULL;
-
-  if (!printout)
-    return FALSE;
+    sm_abortIt = FALSE;
+    sm_abortWindow = NULL;
     
-  printout->SetIsPreview(FALSE);
-  printout->OnPreparePrinting();
-
-  // Get some parameters from the printout, if defined
-  int fromPage, toPage;
-  int minPage, maxPage;
-  printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-
-  if (maxPage == 0)
-    return FALSE;
-
-  m_printDialogData.SetMinPage(minPage);
-  m_printDialogData.SetMaxPage(maxPage);
-  if (fromPage != 0)
-    m_printDialogData.SetFromPage(fromPage);
-  if (toPage != 0)
-    m_printDialogData.SetToPage(toPage);
-
-  if (minPage != 0)
-  {
-    m_printDialogData.EnablePageNumbers(TRUE);
-    if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
-      m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
-    else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
-      m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
-    if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
-      m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
-    else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
-      m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
-  }
-  else
-    m_printDialogData.EnablePageNumbers(FALSE);
-
- // Create a suitable device context  
-  wxDC *dc = NULL;
-  if (prompt)
-  {
+    if (!printout)
+        return FALSE;
+    
+    printout->SetIsPreview(FALSE);
+    printout->OnPreparePrinting();
+    
+    // Get some parameters from the printout, if defined
+    int fromPage, toPage;
+    int minPage, maxPage;
+    printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
+    
+    if (maxPage == 0)
+        return FALSE;
+    
+    m_printDialogData.SetMinPage(minPage);
+    m_printDialogData.SetMaxPage(maxPage);
+    if (fromPage != 0)
+        m_printDialogData.SetFromPage(fromPage);
+    if (toPage != 0)
+        m_printDialogData.SetToPage(toPage);
+    
+    if (minPage != 0)
+    {
+        m_printDialogData.EnablePageNumbers(TRUE);
+        if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
+            m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
+        else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
+            m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
+        if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
+            m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
+        else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
+            m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
+    }
+    else
+        m_printDialogData.EnablePageNumbers(FALSE);
+    
+    // Create a suitable device context  
+    wxDC *dc = NULL;
+    if (prompt)
+    {
         wxPrintDialog dialog(parent, & m_printDialogData);
         if (dialog.ShowModal() == wxID_OK)
-               {
-                    dc = dialog.GetPrintDC();
-                    m_printDialogData = dialog.GetPrintData();
-               }
-  }
-  else
-  {
-               dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
-  }
-
-
-  // May have pressed cancel.
-  if (!dc || !dc->Ok())
-  {
-    if (dc) delete dc;
-    return FALSE;
-  }
-  
-       // on the mac we have always pixels as addressing mode with 72 dpi
-
-  printout->SetPPIScreen(72, 72);
-  printout->SetPPIPrinter(72, 72);
-
-  // Set printout parameters  
-  printout->SetDC(dc);
-
-  int w, h;
-  wxCoord ww, hh;
-  dc->GetSize(&w, &h);
-  printout->SetPageSizePixels((int)w, (int)h);
-  dc->GetSizeMM(&ww, &hh);
-  printout->SetPageSizeMM((int)ww, (int)hh);
-
-  // Create an abort window
-  wxBeginBusyCursor();
-
-  wxWindow *win = CreateAbortWindow(parent, printout);
-  wxSafeYield(win,true);
-
-  if (!win)
-  {
-    wxEndBusyCursor();
-    wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
-    delete dc;
-    return FALSE;
-  }
-  sm_abortWindow = win;
-  sm_abortWindow->Show(TRUE);
-  wxSafeYield(win,true);
-
-  printout->OnBeginPrinting();
-  
-  bool keepGoing = TRUE;
-
-  int copyCount;
-  for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
-  {
-    if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
+        {
+            dc = dialog.GetPrintDC();
+            m_printDialogData = dialog.GetPrintData();
+        }
+    }
+    else
     {
-      wxEndBusyCursor();
-      wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
-      break;
+        dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
     }
-    if (sm_abortIt)
-      break;
-
-    int pn;
-    for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
-         pn++)
+    
+    
+    // May have pressed cancel.
+    if (!dc || !dc->Ok())
     {
-      if (sm_abortIt)
-      {
-        keepGoing = FALSE;
-        break;
-      }
-      else
-      {
-               GrafPtr thePort ;
-               GetPort( &thePort ) ;
-               wxSafeYield(win,true);
-        SetPort( thePort ) ;
-
-        dc->StartPage();
-        keepGoing = printout->OnPrintPage(pn);
-        dc->EndPage();
-      }
+        if (dc) delete dc;
+        return FALSE;
     }
-    printout->OnEndDocument();
-  }
-
-  printout->OnEndPrinting();
-
-  if (sm_abortWindow)
-  {
-    sm_abortWindow->Show(FALSE);
-    delete sm_abortWindow;
-    sm_abortWindow = NULL;
-  }
-
-  wxEndBusyCursor();
-
-  delete dc;
-  
-  return TRUE;
+    
+    // on the mac we have always pixels as addressing mode with 72 dpi
+    
+    printout->SetPPIScreen(72, 72);
+    printout->SetPPIPrinter(72, 72);
+    
+    // Set printout parameters  
+    printout->SetDC(dc);
+    
+    int w, h;
+    wxCoord ww, hh;
+    dc->GetSize(&w, &h);
+    printout->SetPageSizePixels((int)w, (int)h);
+    dc->GetSizeMM(&ww, &hh);
+    printout->SetPageSizeMM((int)ww, (int)hh);
+    
+    // Create an abort window
+    wxBeginBusyCursor();
+    
+    wxWindow *win = CreateAbortWindow(parent, printout);
+    wxSafeYield(win,true);
+    
+    if (!win)
+    {
+        wxEndBusyCursor();
+        wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
+        delete dc;
+        return FALSE;
+    }
+    sm_abortWindow = win;
+    sm_abortWindow->Show(TRUE);
+    wxSafeYield(win,true);
+    
+    printout->OnBeginPrinting();
+    
+    bool keepGoing = TRUE;
+    
+    int copyCount;
+    for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++)
+    {
+        if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
+        {
+            wxEndBusyCursor();
+            wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
+            break;
+        }
+        if (sm_abortIt)
+            break;
+        
+        int pn;
+        for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn);
+        pn++)
+        {
+            if (sm_abortIt)
+            {
+                keepGoing = FALSE;
+                break;
+            }
+            else
+            {
+                GrafPtr thePort ;
+                GetPort( &thePort ) ;
+                wxSafeYield(win,true);
+                SetPort( thePort ) ;
+                
+                dc->StartPage();
+                keepGoing = printout->OnPrintPage(pn);
+                dc->EndPage();
+            }
+        }
+        printout->OnEndDocument();
+    }
+    
+    printout->OnEndPrinting();
+    
+    if (sm_abortWindow)
+    {
+        sm_abortWindow->Show(FALSE);
+        delete sm_abortWindow;
+        sm_abortWindow = NULL;
+    }
+    
+    wxEndBusyCursor();
+    
+    delete dc;
+    
+    return TRUE;
 }
 
 wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
 {
     wxDC* dc = (wxDC*) NULL;
-
+    
     wxPrintDialog dialog(parent, & m_printDialogData);
     int ret = dialog.ShowModal();
-
+    
     if (ret == wxID_OK)
     {
         dc = dialog.GetPrintDC();
         m_printDialogData = dialog.GetPrintDialogData();
     }
-
+    
     return dc;
 }
 
@@ -228,33 +228,33 @@ bool wxMacPrinter::Setup(wxWindow *parent)
 {
     wxPrintDialog dialog(parent, & m_printDialogData);
     dialog.GetPrintDialogData().SetSetupDialog(TRUE);
-
+    
     int ret = dialog.ShowModal();
-
+    
     if (ret == wxID_OK)
     {
         m_printDialogData = dialog.GetPrintDialogData();
     }
-
+    
     return (ret == wxID_OK);
 }
 
 /*
- * Print preview
- */
+* Print preview
+*/
 
 wxMacPrintPreview::wxMacPrintPreview(wxPrintout *printout,
-                                             wxPrintout *printoutForPrinting,
-                                             wxPrintDialogData *data)
-                     : wxPrintPreviewBase(printout, printoutForPrinting, data)
+                                     wxPrintout *printoutForPrinting,
+                                     wxPrintDialogData *data)
+                                     : wxPrintPreviewBase(printout, printoutForPrinting, data)
 {
     DetermineScaling();
 }
 
 wxMacPrintPreview::wxMacPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting, wxPrintData *data):
-  wxPrintPreviewBase(printout, printoutForPrinting, data)
+wxPrintPreviewBase(printout, printoutForPrinting, data)
 {
-  DetermineScaling();
+    DetermineScaling();
 }
 
 wxMacPrintPreview::~wxMacPrintPreview(void)
@@ -263,43 +263,43 @@ wxMacPrintPreview::~wxMacPrintPreview(void)
 
 bool wxMacPrintPreview::Print(bool interactive)
 {
-  if (!m_printPrintout)
-    return FALSE;
-  wxMacPrinter printer(&m_printDialogData);
-  return printer.Print(m_previewFrame, m_printPrintout, interactive);
+    if (!m_printPrintout)
+        return FALSE;
+    wxMacPrinter printer(&m_printDialogData);
+    return printer.Print(m_previewFrame, m_printPrintout, interactive);
 }
 
 void wxMacPrintPreview::DetermineScaling(void)
 {
-       int screenWidth , screenHeight ;
-       wxDisplaySize( &screenWidth , &screenHeight ) ;
-       
-       m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
-       m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
-       m_previewPrintout->SetPageSizeMM( (int) (8.0 * 25.6), (int) (11.0 * 25.6) );
-       m_previewPrintout->SetPageSizePixels( 8 * 72 , 11 * 72 ) ;
+    int screenWidth , screenHeight ;
+    wxDisplaySize( &screenWidth , &screenHeight ) ;
+    
+    m_previewPrintout->SetPPIScreen( 72 , 72 ) ;
+    m_previewPrintout->SetPPIPrinter( 72 , 72 ) ;
+    m_previewPrintout->SetPageSizeMM( (int) (8.0 * 25.6), (int) (11.0 * 25.6) );
+    m_previewPrintout->SetPageSizePixels( 8 * 72 , 11 * 72 ) ;
     m_pageWidth = 8 * 72 ;
     m_pageHeight = 11 * 72 ;
     m_previewScale = 1 ;
-
+    
     // Get a device context for the currently selected printer
     wxPrinterDC printerDC(m_printDialogData.GetPrintData());
     if (printerDC.Ok())
     {
-               int x , y ;
-               wxCoord ww, hh;
-               printerDC.GetSizeMM(&ww, &hh);
-               printerDC.GetSize( &x , &y ) ;
-               m_previewPrintout->SetPageSizeMM((int)ww, (int)hh);
-               m_previewPrintout->SetPageSizePixels( x , y) ;
-               m_pageWidth = x ;
-               m_pageHeight =  y ;
-               m_isOk = true ;
-       }
-       else
-       {
-         m_isOk = false ;
-       }
+        int x , y ;
+        wxCoord ww, hh;
+        printerDC.GetSizeMM(&ww, &hh);
+        printerDC.GetSize( &x , &y ) ;
+        m_previewPrintout->SetPageSizeMM((int)ww, (int)hh);
+        m_previewPrintout->SetPageSizePixels( x , y) ;
+        m_pageWidth = x ;
+        m_pageHeight =  y ;
+        m_isOk = true ;
+    }
+    else
+    {
+        m_isOk = false ;
+    }
     // At 100%, the page should look about page-size on the screen.
     // m_previewScale = (float)((float)screenWidth/(float)printerWidth);
     // m_previewScale = m_previewScale * (float)((float)screenXRes/(float)printerXRes);
index 61e8561c2822b0e1bb3a4a7ea60d6c7b3ae6c2cf..15ac067af755ea432c02602078fc028bb05af95c 100644 (file)
@@ -6,16 +6,16 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-  #pragma implementation "radioboxbase.h"
-  #pragma implementation "radiobox.h"
+#pragma implementation "radioboxbase.h"
+#pragma implementation "radiobox.h"
 #endif
 
 //-------------------------------------------------------------------------------------
-//             headers
+//         headers
 //-------------------------------------------------------------------------------------
 
 #include "wx/defs.h"
@@ -32,7 +32,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
 #pragma mark ### Constructors & destructor ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ wxRadioBox()
+//         Â¥ wxRadioBox()
 //-------------------------------------------------------------------------------------
 // Default constructor
 BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
@@ -41,15 +41,15 @@ END_EVENT_TABLE()
 
 void wxRadioBox::OnRadioButton( wxCommandEvent &outer )
 {
-  if ( outer.IsChecked() )
-  {
-    wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
-    int i = GetSelection() ;
-    event.SetInt( i );
-    event.SetString( GetString( i ) );
-    event.SetEventObject( this );
-    ProcessCommand(event);
-  }
+    if ( outer.IsChecked() )
+    {
+        wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
+        int i = GetSelection() ;
+        event.SetInt( i );
+        event.SetString( GetString( i ) );
+        event.SetEventObject( this );
+        ProcessCommand(event);
+    }
 }
 
 wxRadioBox::wxRadioBox()
@@ -61,9 +61,9 @@ wxRadioBox::wxRadioBox()
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ wxRadioBox(wxWindow*, wxWindowID, const wxString&, const wxPoint&, 
-//                                             const wxSize&, int, const wxString[], int, long, 
-//                                             const wxValidator&, const wxString&)
+//         Â¥ wxRadioBox(wxWindow*, wxWindowID, const wxString&, const wxPoint&, 
+//                        const wxSize&, int, const wxString[], int, long, 
+//                        const wxValidator&, const wxString&)
 //-------------------------------------------------------------------------------------
 // Contructor, creating and showing a radiobox
 //
@@ -71,67 +71,67 @@ wxRadioBox::wxRadioBox()
 //
 
 //-------------------------------------------------------------------------------------
-//             Â¥ ~wxRadioBox
+//         Â¥ ~wxRadioBox
 //-------------------------------------------------------------------------------------
 // Destructor, destroying the radiobox item
 
 wxRadioBox::~wxRadioBox()
 {
-       wxRadioButton *next,*current;
-       
+    wxRadioButton *next,*current;
+    
     current=m_radioButtonCycle->NextInCycle();
     next=current->NextInCycle();
     while (current!=m_radioButtonCycle) {
-       delete current;
-       current=next;
-       next=current->NextInCycle();
-       }
+        delete current;
+        current=next;
+        next=current->NextInCycle();
+    }
     delete current;    
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Create
+//         Â¥ Create
 //-------------------------------------------------------------------------------------
 // Create the radiobox for two-step construction
 
 bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
-             const wxPoint& pos, const wxSize& size,
-             int n, const wxString choices[],
-             int majorDim, long style,
-             const wxValidator& val, const wxString& name)
+                        const wxPoint& pos, const wxSize& size,
+                        int n, const wxString choices[],
+                        int majorDim, long style,
+                        const wxValidator& val, const wxString& name)
 {
     int i;
     
     m_noItems = n;
     m_noRowsOrCols = majorDim;
     m_radioButtonCycle = NULL;
-
+    
     if (majorDim==0)
         m_majorDim = n ;
     else
         m_majorDim = majorDim ;
-
-
+    
+    
     Rect bounds ;
     Str255 title ;
     
     MacPreControlCreate( parent , id ,  wxStripMenuCodes(label) , pos , size ,style, val , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-                                 kControlGroupBoxTextTitleProc , (long) this ) ;
+        kControlGroupBoxTextTitleProc , (long) this ) ;
     
     for (i = 0; i < n; i++)
     {
         wxRadioButton *radBtn = new wxRadioButton(this, NewControlId(), wxStripMenuCodes(choices[i]),wxPoint(5,20*i+10),
-                                                  wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ;
+            wxDefaultSize , i == 0 ? wxRB_GROUP : 0 ) ;
         if ( i == 0 )
-          m_radioButtonCycle = radBtn ;
-//        m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle);
+            m_radioButtonCycle = radBtn ;
+        //        m_radioButtonCycle=radBtn->AddInCycle(m_radioButtonCycle);
     }
-
+    
     SetSelection(0);
     MacPostControlCreate() ;
-
+    
     return TRUE;
 }
 
@@ -140,7 +140,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 #pragma mark ### Specific functions (reference v2) ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Enable(bool)
+//         Â¥ Enable(bool)
 //-------------------------------------------------------------------------------------
 // Enables or disables the entire radiobox
 
@@ -150,18 +150,18 @@ bool wxRadioBox::Enable(bool enable)
     wxRadioButton *current;
     
     if (!wxControl::Enable(enable))
-       return false;
+        return false;
     
     current = m_radioButtonCycle;
     for (i = 0; i < m_noItems; i++) {
-       current->Enable(enable);
-       current = current->NextInCycle();
+        current->Enable(enable);
+        current = current->NextInCycle();
     }
     return true;
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Enable(int, bool)
+//         Â¥ Enable(int, bool)
 //-------------------------------------------------------------------------------------
 // Enables or disables an given button
 
@@ -176,14 +176,14 @@ void wxRadioBox::Enable(int item, bool enable)
     i = 0;
     current = m_radioButtonCycle;
     while (i != item) {
-       i++;
-       current = current->NextInCycle();
+        i++;
+        current = current->NextInCycle();
     }
     current->Enable(enable);
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetLabel()
+//         Â¥ GetLabel()
 //-------------------------------------------------------------------------------------
 // Returns the radiobox label
 
@@ -193,7 +193,7 @@ wxString wxRadioBox::GetLabel() const
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetLabel(int)
+//         Â¥ GetLabel(int)
 //-------------------------------------------------------------------------------------
 // Returns the label for the given button
 
@@ -208,14 +208,14 @@ wxString wxRadioBox::GetString(int item) const
     i = 0;
     current = m_radioButtonCycle;
     while (i != item) {
-       i++;
-       current = current->NextInCycle();
+        i++;
+        current = current->NextInCycle();
     }
     return current->GetLabel();
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetSelection
+//         Â¥ GetSelection
 //-------------------------------------------------------------------------------------
 // Returns the zero-based position of the selected button
 
@@ -227,15 +227,15 @@ int wxRadioBox::GetSelection() const
     i=0;
     current=m_radioButtonCycle;
     while (!current->GetValue()) {
-       i++;
-       current=current->NextInCycle();
-       }
-
+        i++;
+        current=current->NextInCycle();
+    }
+    
     return i;
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Number
+//         Â¥ Number
 //-------------------------------------------------------------------------------------
 // Returns the number of buttons in the radiobox
 //
@@ -243,7 +243,7 @@ int wxRadioBox::GetSelection() const
 //
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetLabel(const wxString&)
+//         Â¥ SetLabel(const wxString&)
 //-------------------------------------------------------------------------------------
 // Sets the radiobox label
 
@@ -253,28 +253,28 @@ void wxRadioBox::SetLabel(const wxString& label)
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetLabel(int, const wxString&)
+//         Â¥ SetLabel(int, const wxString&)
 //-------------------------------------------------------------------------------------
 // Sets the label of a given button
 
 void wxRadioBox::SetString(int item,const wxString& label)
 {
-       int i;
+       int i;
     wxRadioButton *current;
     
     if ((item < 0) || (item >= m_noItems))
         return;
-       i=0;
+    i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
-       i++;
-       current=current->NextInCycle();
-       }
+        i++;
+        current=current->NextInCycle();
+    }
     return current->SetLabel(label);
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetSelection
+//         Â¥ SetSelection
 //-------------------------------------------------------------------------------------
 // Sets a button by passing the desired position. This does not cause 
 // wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted
@@ -289,15 +289,15 @@ void wxRadioBox::SetSelection(int item)
     i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
-       i++;
-       current=current->NextInCycle();
-       }
+        i++;
+        current=current->NextInCycle();
+    }
     current->SetValue(true);
     
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Show(bool)
+//         Â¥ Show(bool)
 //-------------------------------------------------------------------------------------
 // Shows or hides the entire radiobox 
 
@@ -307,23 +307,23 @@ bool wxRadioBox::Show(bool show)
     wxRadioButton *current;
     
     wxControl::Show(show);
-
+    
     current=m_radioButtonCycle;
-       for (i=0;i<m_noItems;i++) {
-       current->Show(show);
-       current=current->NextInCycle();
-       }
+       for (i=0;i<m_noItems;i++) {
+        current->Show(show);
+        current=current->NextInCycle();
+    }
     return true;
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Show(int, bool)
+//         Â¥ Show(int, bool)
 //-------------------------------------------------------------------------------------
 // Shows or hides the given button 
 
 void wxRadioBox::Show(int item, bool show)
 {
-       int i;
+       int i;
     wxRadioButton *current;
     
     if ((item < 0) || (item >= m_noItems))
@@ -331,9 +331,9 @@ void wxRadioBox::Show(int item, bool show)
     i=0;
     current=m_radioButtonCycle;
     while (i!=item) {
-       i++;
-       current=current->NextInCycle();
-       }
+        i++;
+        current=current->NextInCycle();
+    }
     current->Show(show);
 }
 
@@ -341,7 +341,7 @@ void wxRadioBox::Show(int item, bool show)
 #pragma mark ### Other external functions ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ Command
+//         Â¥ Command
 //-------------------------------------------------------------------------------------
 // Simulates the effect of the user issuing a command to the item
 
@@ -352,7 +352,7 @@ void wxRadioBox::Command (wxCommandEvent & event)
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ SetFocus
+//         Â¥ SetFocus
 //-------------------------------------------------------------------------------------
 // Sets the selected button to receive keyboard input
 
@@ -364,10 +364,10 @@ void wxRadioBox::SetFocus()
     i=0;
     current=m_radioButtonCycle;
     while (!current->GetValue()) {
-       i++;
-       current=current->NextInCycle();
-       }
-       current->SetFocus();
+        i++;
+        current=current->NextInCycle();
+    }
+    current->SetFocus();
 }
 
 
@@ -375,7 +375,7 @@ void wxRadioBox::SetFocus()
 #pragma mark ### Internal functions ###
 
 //-------------------------------------------------------------------------------------
-//             Â¥ DoSetSize
+//         Â¥ DoSetSize
 //-------------------------------------------------------------------------------------
 // Simulates the effect of the user issuing a command to the item
 
@@ -383,49 +383,49 @@ void wxRadioBox::SetFocus()
 
 void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
 {
-       int i;
-       wxRadioButton *current;
-
-// define the position
-
-       int x_current, y_current;
-       int x_offset,y_offset;
+    int i;
+    wxRadioButton *current;
+    
+    // define the position
+    
+    int x_current, y_current;
+    int x_offset,y_offset;
     int widthOld, heightOld;
     GetSize(&widthOld, &heightOld);
-
-       x_offset = x;
-       y_offset = y;
-       GetPosition(&x_current, &y_current);
-       if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-               x_offset = x_current;
-       if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
-               y_offset = y_current;
-
-// define size
-
-       int charWidth,charHeight;
-       int maxWidth,maxHeight;
-       int eachWidth[128],eachHeight[128];
+    
+    x_offset = x;
+    y_offset = y;
+    GetPosition(&x_current, &y_current);
+    if ((x == -1) && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+        x_offset = x_current;
+    if ((y == -1)&& !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+        y_offset = y_current;
+    
+    // define size
+    
+    int charWidth,charHeight;
+    int maxWidth,maxHeight;
+    int eachWidth[128],eachHeight[128];
     int totWidth,totHeight;
-
-       SetFont(GetParent()->GetFont());
-       GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
-       charWidth/=52;
-
-       maxWidth=-1;
-       maxHeight=-1;
-       for (i = 0 ; i < m_noItems; i++)
-               {
-               GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]);
-               eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
-               eachHeight[i] = (int)((3*eachHeight[i])/2);
-               if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
-               if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
-               }
-
-       totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight*3/2;
-       totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
-
+    
+    SetFont(GetParent()->GetFont());
+    GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
+    charWidth/=52;
+    
+    maxWidth=-1;
+    maxHeight=-1;
+    for (i = 0 ; i < m_noItems; i++)
+    {
+        GetTextExtent(GetString(i), &eachWidth[i], &eachHeight[i]);
+        eachWidth[i] = (int)(eachWidth[i] + RADIO_SIZE);
+        eachHeight[i] = (int)((3*eachHeight[i])/2);
+        if (maxWidth<eachWidth[i]) maxWidth = eachWidth[i];
+        if (maxHeight<eachHeight[i]) maxHeight = eachHeight[i];
+          }
+    
+    totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight*3/2;
+    totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
+    
     // only change our width/height if asked for
     if ( width == -1 )
     {
@@ -434,7 +434,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         else
             width = widthOld;
     }
-
+    
     if ( height == -1 )
     {
         if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
@@ -442,44 +442,44 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
         else
             height = heightOld;
     }
-
-       wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
-
-// arrange radiobuttons
-
-       int x_start,y_start;
-       
-       
-       x_start = charWidth;
-       y_start = 15 ;
-       x_offset = x_start;
-       y_offset = y_start;
-       
-       current=m_radioButtonCycle;  
-       for ( i = 0 ; i < m_noItems; i++)
-               {
-               if (i&&((i%m_majorDim)==0)) // not to do for the zero button!
-               {
-               if (m_windowStyle & wxRA_VERTICAL)
-                       {
-                           x_offset += maxWidth + charWidth;
-                       y_offset = y_start;
-                               }
-               else
-                       {
-                               x_offset = x_start;
-                       y_offset += maxHeight ; /*+ charHeight/2;*/
-                               }
-                       }
-
-               current->SetSize(x_offset,y_offset,eachWidth[i],eachHeight[i]);
-               current=current->NextInCycle();
-               
-               if (m_windowStyle & wxRA_SPECIFY_ROWS)
-                       y_offset += maxHeight ; /*+ charHeight/2;*/
-               else
-                       x_offset += maxWidth + charWidth;
-               }
+    
+    wxControl::DoSetSize(x_offset,y_offset,width,height,wxSIZE_AUTO);
+    
+    // arrange radiobuttons
+    
+    int x_start,y_start;
+    
+    
+    x_start = charWidth;
+    y_start = 15 ;
+    x_offset = x_start;
+    y_offset = y_start;
+    
+    current=m_radioButtonCycle;  
+    for ( i = 0 ; i < m_noItems; i++)
+    {
+        if (i&&((i%m_majorDim)==0)) // not to do for the zero button!
+        {
+            if (m_windowStyle & wxRA_VERTICAL)
+            {
+                x_offset += maxWidth + charWidth;
+                y_offset = y_start;
+            }
+            else
+            {
+                x_offset = x_start;
+                y_offset += maxHeight ; /*+ charHeight/2;*/
+            }
+        }
+        
+        current->SetSize(x_offset,y_offset,eachWidth[i],eachHeight[i]);
+        current=current->NextInCycle();
+        
+        if (m_windowStyle & wxRA_SPECIFY_ROWS)
+            y_offset += maxHeight ; /*+ charHeight/2;*/
+        else
+            x_offset += maxWidth + charWidth;
+    }
 }
 
 wxSize wxRadioBox::DoGetBestSize() const
@@ -488,37 +488,37 @@ wxSize wxRadioBox::DoGetBestSize() const
     int maxWidth, maxHeight;
     int eachWidth, eachHeight;
     int totWidth, totHeight;
-
+    
     wxFont font = GetParent()->GetFont();
     GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
-                  &charWidth, &charHeight, NULL, NULL, &font);
+        &charWidth, &charHeight, NULL, NULL, &font);
     charWidth /= 52;
-
-   maxWidth = -1;
-   maxHeight = -1;
-
-   for (int i = 0 ; i < m_noItems; i++)
-   {
+    
+    maxWidth = -1;
+    maxHeight = -1;
+    
+    for (int i = 0 ; i < m_noItems; i++)
+    {
         GetTextExtent(GetString(i), &eachWidth, &eachHeight);
         eachWidth  = (int)(eachWidth + RADIO_SIZE) ;
         eachHeight = (int)((3 * eachHeight) / 2);
         if (maxWidth < eachWidth)     maxWidth = eachWidth;
         if (maxHeight < eachHeight)   maxHeight = eachHeight;
     }
-
+    
     totHeight = GetRowCount() * (maxHeight + charHeight/2) + charHeight * 3/2;
     totWidth  = GetColumnCount() * (maxWidth + charWidth) + charWidth;
-
+    
     // handle radio box title as well
     GetTextExtent(GetTitle(), &eachWidth, NULL);
     eachWidth  = (int)(eachWidth + RADIO_SIZE) + 3 * charWidth ;
     if (totWidth < eachWidth)     
         totWidth = eachWidth;
-
-   return wxSize(totWidth, totHeight);
+    
+    return wxSize(totWidth, totHeight);
 }
 //-------------------------------------------------------------------------------------
-//             Â¥ GetNumVer
+//         Â¥ GetNumVer
 //-------------------------------------------------------------------------------------
 // return the number of buttons in the vertical direction
 
@@ -535,7 +535,7 @@ int wxRadioBox::GetRowCount() const
 }
 
 //-------------------------------------------------------------------------------------
-//             Â¥ GetNumHor
+//         Â¥ GetNumHor
 //-------------------------------------------------------------------------------------
 // return the number of buttons in the horizontal direction
 
index e94c762f1d6ac5c8564b1410efd55713ba10a1d2..46014e45765ca13a3c14446ed58a56ccff26f18c 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     ??/??/98
 // RCS-ID:      $Id$
 // Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -24,27 +24,27 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
 #include "wx/mac/uma.h"
 
 bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
-                  const wxString& label,
+           const wxString& label,
            const wxPoint& pos,
            const wxSize& size, long style,
            const wxValidator& validator,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlRadioButtonProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlRadioButtonProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
 
   m_cycle = this ;
   
   if (HasFlag(wxRB_GROUP))
   {
-         AddInCycle( NULL ) ;
+      AddInCycle( NULL ) ;
   }
   else
   {
@@ -68,21 +68,21 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
 
 void wxRadioButton::SetValue(bool val)
 {
-       wxRadioButton *cycle;
-         if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val )
-           return ;
-           
+    wxRadioButton *cycle;
+      if ( GetControl32BitValue( (ControlHandle) m_macControl ) == val )
+        return ;
+        
    ::SetControl32BitValue( (ControlHandle) m_macControl , val ) ;
    if (val) 
    {
-               cycle=this->NextInCycle();
-               if (cycle!=NULL) {
-                       while (cycle!=this) {
-                               cycle->SetValue(false);
-                               cycle=cycle->NextInCycle();
-                               }
-                       }
-               }
+           cycle=this->NextInCycle();
+          if (cycle!=NULL) {
+               while (cycle!=this) {
+                   cycle->SetValue(false);
+                   cycle=cycle->NextInCycle();
+                   }
+               }
+           }
    MacRedrawControl() ;
 }
 
@@ -102,19 +102,19 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar
     if ( GetValue() )
       return ;
       
-         wxRadioButton *cycle, *old = NULL ;
+      wxRadioButton *cycle, *old = NULL ;
     cycle=this->NextInCycle();
     if (cycle!=NULL) {
-         while (cycle!=this) {
-           if ( cycle->GetValue() ) {
-             old = cycle ;
-                   cycle->SetValue(false);
-                 }
-                 cycle=cycle->NextInCycle();
-               }
+          while (cycle!=this) {
+            if ( cycle->GetValue() ) {
+              old = cycle ;
+                cycle->SetValue(false);
+              }
+              cycle=cycle->NextInCycle();
+            }
     }
 
-         SetValue(true) ;
+      SetValue(true) ;
 
     if ( old ) {
       wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, old->m_windowId );
@@ -130,18 +130,18 @@ void wxRadioButton::MacHandleControlClick( WXWidget control , wxInt16 controlpar
 
 wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
 {
-       wxRadioButton *next,*current;
-               
-       if (cycle==NULL) {
-               m_cycle=this;
-               return(this);
-               }
-       else {
-               current=cycle;
-               while ((next=current->m_cycle)!=cycle) 
-                 current=current->m_cycle;
-               m_cycle=cycle;
-               current->m_cycle=this;
-               return(cycle);
-       }
+    wxRadioButton *next,*current;
+        
+    if (cycle==NULL) {
+        m_cycle=this;
+        return(this);
+        }
+    else {
+        current=cycle;
+          while ((next=current->m_cycle)!=cycle) 
+            current=current->m_cycle;
+          m_cycle=cycle;
+          current->m_cycle=this;
+          return(cycle);
+      }
 }  
index 6c1ef13da2dc1b969ca3470b7a9cef84c670fb1b..b151987990a8bdcf0def42afd4e8291e07405c27 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:   Region class
 // Author:    Markus Holzem/Julian Smart/Stefan Csomor
 // Created:   Fri Oct 24 10:46:34 MET 1997
-// RCS-ID:       $Id$
+// RCS-ID:      $Id$
 // Copyright: (c) 1997 Markus Holzem/Julian Smart/Stefan Csomor
 // Licence:   wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -17,8 +17,8 @@
 #include "wx/mac/uma.h"
 
 #if !USE_SHARED_LIBRARY
-       IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
-       IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
+    IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
 #endif
 
 //-----------------------------------------------------------------------------
@@ -43,7 +43,7 @@ public:
     {
         DisposeRgn( m_macRgn ) ;
     }
-    RgnHandle  m_macRgn ;
+    RgnHandle    m_macRgn ;
 };
 
 #define M_REGION (((wxRegionRefData*)m_refData)->m_macRgn)
@@ -106,20 +106,20 @@ void wxRegion::Clear()
 //! Combine rectangle (x, y, w, h) with this.
 bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
 {
-       // Don't change shared data
-       if (!m_refData) 
-       {
-               m_refData = new wxRegionRefData();
-       
-       else if (m_refData->GetRefCount() > 1) 
-       {
-               wxRegionRefData* ref = (wxRegionRefData*)m_refData;
-               UnRef();
-               m_refData = new wxRegionRefData(*ref);
-       }
+    // Don't change shared data
+    if (!m_refData) 
+    {
+        m_refData = new wxRegionRefData();
+    } 
+    else if (m_refData->GetRefCount() > 1) 
+    {
+        wxRegionRefData* ref = (wxRegionRefData*)m_refData;
+        UnRef();
+        m_refData = new wxRegionRefData(*ref);
+    }
     RgnHandle rgn = NewRgn() ;
-               SetRectRgn( rgn , x , y, x+width,y + height ) ;
-               
+        SetRectRgn( rgn , x , y, x+width,y + height ) ;
+        
     switch (op)
     {
         case wxRGN_AND:
@@ -136,11 +136,11 @@ bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
             break ;
         case wxRGN_COPY:
         default:
-                               CopyRgn( rgn ,M_REGION ) ;
+                   CopyRgn( rgn ,M_REGION ) ;
             break ;
     }
 
-               DisposeRgn( rgn ) ;
+        DisposeRgn( rgn ) ;
 
     return TRUE;
 }
@@ -148,19 +148,19 @@ bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
 //! Union /e region with this.
 bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
 {
-       if (region.Empty())
-               return FALSE;
-
-       // Don't change shared data
-       if (!m_refData) {
-               m_refData = new wxRegionRefData();
-       
-       else    if (m_refData->GetRefCount() > 1) 
-       {
-               wxRegionRefData* ref = (wxRegionRefData*)m_refData;
-               UnRef();
-               m_refData = new wxRegionRefData(*ref);
-       }
+    if (region.Empty())
+        return FALSE;
+
+    // Don't change shared data
+    if (!m_refData) {
+        m_refData = new wxRegionRefData();
+    } 
+    else    if (m_refData->GetRefCount() > 1) 
+    {
+        wxRegionRefData* ref = (wxRegionRefData*)m_refData;
+        UnRef();
+        m_refData = new wxRegionRefData(*ref);
+    }
 
     switch (op)
     {
@@ -178,11 +178,11 @@ bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
             break ;
         case wxRGN_COPY:
         default:
-                               CopyRgn( OTHER_M_REGION(region) ,M_REGION ) ;
+                   CopyRgn( OTHER_M_REGION(region) ,M_REGION ) ;
             break ;
     }
 
-       return TRUE;
+    return TRUE;
 }
 
 bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
@@ -197,19 +197,19 @@ bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
 // Outer bounds of region
 void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const
 {
-       if (m_refData) 
-       {
-               Rect box ;
-               GetRegionBounds( M_REGION , &box ) ;
+    if (m_refData) 
+    {
+        Rect box ;
+        GetRegionBounds( M_REGION , &box ) ;
         x = box.left ;
         y = box.top ;
         w = box.right - box.left ;
         h = box.bottom - box.top ;
-       
-       else 
-       {
-               x = y = w = h = 0;
-       }
+    } 
+    else 
+    {
+        x = y = w = h = 0;
+    }
 }
 
 wxRect wxRegion::GetBox() const
@@ -227,7 +227,7 @@ bool wxRegion::Empty() const
 
 const WXHRGN wxRegion::GetWXHRGN() const
 {
-       return M_REGION ;
+    return M_REGION ;
 }
 
 //-----------------------------------------------------------------------------
@@ -237,8 +237,8 @@ const WXHRGN wxRegion::GetWXHRGN() const
 // Does the region contain the point (x,y)?
 wxRegionContain wxRegion::Contains(long x, long y) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     // TODO. Return wxInRegion if within region.
     if (0)
@@ -249,8 +249,8 @@ wxRegionContain wxRegion::Contains(long x, long y) const
 // Does the region contain the point pt?
 wxRegionContain wxRegion::Contains(const wxPoint& pt) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     Point p = { pt.y , pt.x } ;
     if (PtInRgn( p , M_REGION ) )
@@ -262,8 +262,8 @@ wxRegionContain wxRegion::Contains(const wxPoint& pt) const
 // Does the region contain the rectangle (x, y, w, h)?
 wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     Rect rect = { y , x , y + h , x + w } ;
     if (RectInRgn( &rect , M_REGION ) )
@@ -275,8 +275,8 @@ wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
 // Does the region contain the rectangle rect
 wxRegionContain wxRegion::Contains(const wxRect& rect) const
 {
-       if (!m_refData)
-               return wxOutRegion;
+    if (!m_refData)
+        return wxOutRegion;
 
     long x, y, w, h;
     x = rect.x;
@@ -370,7 +370,7 @@ void wxRegionIterator::Reset(const wxRegion& region)
         m_numRects = 0;
     else
     {
-       // we cannot dissolve it into rects on mac
+        // we cannot dissolve it into rects on mac
         m_rects = new wxRect[1];
         Rect rect ;
         GetRegionBounds( OTHER_M_REGION( region ) , &rect ) ;
@@ -409,29 +409,29 @@ wxRegionIterator wxRegionIterator::operator ++ (int)
 
 long wxRegionIterator::GetX() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].x;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].x;
+    return 0;
 }
 
 long wxRegionIterator::GetY() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].y;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].y;
+    return 0;
 }
 
 long wxRegionIterator::GetW() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].width ;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].width ;
+    return 0;
 }
 
 long wxRegionIterator::GetH() const
 {
-       if (m_current < m_numRects)
-               return m_rects[m_current].height;
-       return 0;
+    if (m_current < m_numRects)
+        return m_rects[m_current].height;
+    return 0;
 }
 
index d341b03c4a801b81121c32b35b4ca2cc8a1943cc..6f57b2c40dd86fdcdc818bd583a24773fae410ca 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -43,19 +43,19 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
   if (!parent)
       return FALSE;
     
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
 
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, 
-               kControlScrollBarLiveProc , (long) this ) ;
-       
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, 
+        kControlScrollBarLiveProc , (long) this ) ;
+    
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
 
-       ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
+    ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
 
-       MacPostControlCreate() ;
+    MacPostControlCreate() ;
 
   return TRUE;
 }
@@ -81,7 +81,7 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
     m_viewSize = thumbSize;
     m_objectSize = range;
 
-       int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
+      int range1 = wxMax((m_objectSize - m_viewSize), 0) ;
 
     SetControl32BitMaximum( (ControlHandle) m_macControl , range1 ) ;
     SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
@@ -91,7 +91,7 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
     {
         if ( SetControlViewSize != (void*) kUnresolvedCFragSymbolAddress )
         {
-                           SetControlViewSize( (ControlHandle) m_macControl , m_viewSize ) ;
+                SetControlViewSize( (ControlHandle) m_macControl , m_viewSize ) ;
         }
     }
     if ( refresh )
@@ -107,70 +107,70 @@ void wxScrollBar::Command(wxCommandEvent& event)
 
 void wxScrollBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-       
-  int position = GetControl32BitValue( (ControlHandle) m_macControl) ;
-  int minPos = GetControl32BitMinimum( (ControlHandle) m_macControl) ;
-  int maxPos = GetControl32BitMaximum( (ControlHandle) m_macControl) ;
-
-  wxEventType scrollEvent = wxEVT_NULL;
-  int nScrollInc;
-
-       switch( controlpart )
-       {
-               case kControlUpButtonPart :
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+    
+    int position = GetControl32BitValue( (ControlHandle) m_macControl) ;
+    int minPos = GetControl32BitMinimum( (ControlHandle) m_macControl) ;
+    int maxPos = GetControl32BitMaximum( (ControlHandle) m_macControl) ;
+    
+    wxEventType scrollEvent = wxEVT_NULL;
+    int nScrollInc;
+    
+    switch( controlpart )
+    {
+    case kControlUpButtonPart :
         nScrollInc = -1;
         scrollEvent = wxEVT_SCROLL_LINEUP;
-                       break ;
-               case kControlDownButtonPart :
+        break ;
+    case kControlDownButtonPart :
         nScrollInc = 1;
         scrollEvent = wxEVT_SCROLL_LINEDOWN;
-                       break ;
-               case kControlPageUpPart :
+        break ;
+    case kControlPageUpPart :
         nScrollInc = -m_pageSize;
         scrollEvent = wxEVT_SCROLL_PAGEUP;
-                       break ;
-               case kControlPageDownPart :
+        break ;
+    case kControlPageDownPart :
         nScrollInc = m_pageSize;
         scrollEvent = wxEVT_SCROLL_PAGEDOWN;
-                       break ;
-               case kControlIndicatorPart :
+        break ;
+    case kControlIndicatorPart :
         nScrollInc = 0 ;
         scrollEvent = wxEVT_SCROLL_THUMBTRACK;
-                       break ;
-                default :
-                        wxFAIL_MSG(wxT("illegal scrollbar selector"));
-                        break ;
-       }
-
-  int new_pos = position + nScrollInc;
-
-  if (new_pos < minPos)
-      new_pos = minPos;
-  if (new_pos > maxPos)
-      new_pos = maxPos;
-       if ( nScrollInc )
-       SetThumbPosition(new_pos);
-       
-  wxScrollEvent event(scrollEvent, m_windowId);
-       if ( m_windowStyle & wxHORIZONTAL )
-       {
-               event.SetOrientation( wxHORIZONTAL ) ;
-       }
-       else
-       {
-               event.SetOrientation( wxVERTICAL ) ;
-       }
-  event.SetPosition(new_pos);
-  event.SetEventObject( this );
-  wxWindow* window = GetParent() ;
-  if (window && window->MacIsWindowScrollbar(this) )
-  {
-       // this is hardcoded
-       window->MacOnScroll(event);
-  }
-  else
-       GetEventHandler()->ProcessEvent(event);
+        break ;
+    default :
+        wxFAIL_MSG(wxT("illegal scrollbar selector"));
+        break ;
+    }
+    
+    int new_pos = position + nScrollInc;
+    
+    if (new_pos < minPos)
+        new_pos = minPos;
+    if (new_pos > maxPos)
+        new_pos = maxPos;
+    if ( nScrollInc )
+        SetThumbPosition(new_pos);
+    
+    wxScrollEvent event(scrollEvent, m_windowId);
+    if ( m_windowStyle & wxHORIZONTAL )
+    {
+        event.SetOrientation( wxHORIZONTAL ) ;
+    }
+    else
+    {
+        event.SetOrientation( wxVERTICAL ) ;
+    }
+    event.SetPosition(new_pos);
+    event.SetEventObject( this );
+    wxWindow* window = GetParent() ;
+    if (window && window->MacIsWindowScrollbar(this) )
+    {
+        // this is hardcoded
+        window->MacOnScroll(event);
+    }
+    else
+        GetEventHandler()->ProcessEvent(event);
 }
 
index f27d107c8308de6c3fa30287ac2c018a5f5bee9f..2a95191da231177787ef538b918480d750a81c37 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -24,101 +24,100 @@ END_EVENT_TABLE()
 #endif
 
  // The dimensions of the different styles of sliders (From Aqua document)
- #define wxSLIDER_DIMENSIONACROSS 15
- #define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
- #define wxSLIDER_DIMENSIONACROSS_ARROW 18
+#define wxSLIDER_DIMENSIONACROSS 15
+#define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24
+#define wxSLIDER_DIMENSIONACROSS_ARROW 18
  
- // Distance between slider and text
- #define wxSLIDER_BORDERTEXT 5
+// Distance between slider and text
+#define wxSLIDER_BORDERTEXT 5
  
- /* NB!  The default orientation for a slider is horizontal however if the user specifies
-  * some slider styles but dosen't specify the orientation we have to assume he wants a
-  * horizontal one.  Therefore in this file when testing for the sliders orientation
-  * vertical is tested for if this is not set then we use the horizontal one
-  * eg.  if(GetWindowStyle() & wxSL_VERTICAL) {}  else { horizontal case }>  
-  */
-
-
-// Slider
-wxSlider::wxSlider()
+/* NB!  The default orientation for a slider is horizontal however if the user specifies
+ * some slider styles but dosen't specify the orientation we have to assume he wants a
+ * horizontal one.  Therefore in this file when testing for the sliders orientation
+ * vertical is tested for if this is not set then we use the horizontal one
+ * eg.  if(GetWindowStyle() & wxSL_VERTICAL) {}  else { horizontal case }>  
+ */
+
+ // Slider
+ wxSlider::wxSlider()
 {
-  m_pageSize = 1;
-  m_lineSize = 1;
-  m_rangeMax = 0;
-  m_rangeMin = 0;
-  m_tickFreq = 0;
+    m_pageSize = 1;
+    m_lineSize = 1;
+    m_rangeMax = 0;
+    m_rangeMin = 0;
+    m_tickFreq = 0;
 }
 
 extern ControlActionUPP wxMacLiveScrollbarActionUPP ;
 
 bool wxSlider::Create(wxWindow *parent, wxWindowID id,
-           int value, int minValue, int maxValue,
-           const wxPoint& pos,
-           const wxSize& size, long style,
-           const wxValidator& validator,
-           const wxString& name)
+                      int value, int minValue, int maxValue,
+                      const wxPoint& pos,
+                      const wxSize& size, long style,
+                      const wxValidator& validator,
+                      const wxString& name)
 {
-     Rect bounds ;
-     Str255 title ;
-     SInt16 procID;
-
-     m_macMinimumStatic = NULL ;
-     m_macMaximumStatic = NULL ;
-     m_macValueStatic = NULL ;
-
-
-     m_lineSize = 1;
-     m_tickFreq = 0;
-     m_rangeMax = maxValue;
-     m_rangeMin = minValue;
-     m_pageSize = (int)((maxValue-minValue)/10);
-     MacPreControlCreate( parent, id, "", pos, size, style,
-                          validator, name, &bounds, title );
-     procID = kControlSliderProc + kControlSliderLiveFeedback;
-     if(style & wxSL_AUTOTICKS) {
-         procID += kControlSliderHasTickMarks;
+    Rect bounds ;
+    Str255 title ;
+    SInt16 procID;
+    
+    m_macMinimumStatic = NULL ;
+    m_macMaximumStatic = NULL ;
+    m_macValueStatic = NULL ;
+    
+    
+    m_lineSize = 1;
+    m_tickFreq = 0;
+    
+    m_rangeMax = maxValue;
+    m_rangeMin = minValue;
+    
+    m_pageSize = (int)((maxValue-minValue)/10);
+    
+    MacPreControlCreate( parent, id, "", pos, size, style,
+        validator, name, &bounds, title );
+    
+    procID = kControlSliderProc + kControlSliderLiveFeedback;
+    if(style & wxSL_AUTOTICKS) {
+        procID += kControlSliderHasTickMarks;
     }
-  
-
-     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
-                                   value, minValue, maxValue, procID, (long) this);
-     wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-     ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
-     if(style & wxSL_LABELS)
-     {
-         m_macMinimumStatic = new wxStaticText( this, -1, "" );
-         m_macMaximumStatic = new wxStaticText( this, -1, "" );
-         m_macValueStatic = new wxStaticText( this, -1, "" );
-         SetRange(minValue, maxValue);
-         SetValue(value);
+    
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
+        value, minValue, maxValue, procID, (long) this);
+    
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
+    
+    if(style & wxSL_LABELS)
+    {
+        m_macMinimumStatic = new wxStaticText( this, -1, "" );
+        m_macMaximumStatic = new wxStaticText( this, -1, "" );
+        m_macValueStatic = new wxStaticText( this, -1, "" );
+        SetRange(minValue, maxValue);
+        SetValue(value);
     }
-  
-     else {
-         m_macMinimumStatic = NULL ;
-         m_macMaximumStatic = NULL ;
-         m_macValueStatic = NULL ;
-     }
-     if(style & wxSL_VERTICAL) {
-         SetSizeHints(10, -1, 10, -1);  // Forces SetSize to use the proper width
-     }
-     else {
-         SetSizeHints(-1, 10, -1, 10);  // Forces SetSize to use the proper height
-     }
-     // NB!  SetSizeHints is overloaded by wxSlider and will substitute 10 with the
-     // proper dimensions, it also means other people cannot bugger the slider with
-     // other values
-     MacPostControlCreate() ;
-     return true;
+    
+    else {
+        m_macMinimumStatic = NULL ;
+        m_macMaximumStatic = NULL ;
+        m_macValueStatic = NULL ;
+    }
+    
+    if(style & wxSL_VERTICAL) {
+        SetSizeHints(10, -1, 10, -1);  // Forces SetSize to use the proper width
+    }
+    else {
+        SetSizeHints(-1, 10, -1, 10);  // Forces SetSize to use the proper height
+    }
+    // NB!  SetSizeHints is overloaded by wxSlider and will substitute 10 with the
+    // proper dimensions, it also means other people cannot bugger the slider with
+    // other values
+    
+    MacPostControlCreate() ;
+    
+    return true;
 }
 
 wxSlider::~wxSlider()
@@ -127,37 +126,37 @@ wxSlider::~wxSlider()
 
 int wxSlider::GetValue() const
 {
-       return GetControl32BitValue( (ControlHandle) m_macControl) ;
+    return GetControl32BitValue( (ControlHandle) m_macControl) ;
 }
 
 void wxSlider::SetValue(int value)
 {
-       wxString valuestring ;
-       valuestring.Printf( "%d" , value ) ;    
-       if ( m_macValueStatic )
-               m_macValueStatic->SetLabel( valuestring ) ;
-       SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
+    wxString valuestring ;
+    valuestring.Printf( "%d" , value ) ;    
+    if ( m_macValueStatic )
+        m_macValueStatic->SetLabel( valuestring ) ;
+    SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
 }
 
 void wxSlider::SetRange(int minValue, int maxValue)
 {
-  wxString value;
-
-  m_rangeMin = minValue;
-  m_rangeMax = maxValue;
-
-  SetControl32BitMinimum( (ControlHandle) m_macControl, m_rangeMin);
-  SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
-  
-  if(m_macMinimumStatic) {
-    value.Printf("%d", m_rangeMin);
-    m_macMinimumStatic->SetLabel(value);
-  }
-  if(m_macMaximumStatic) {
-    value.Printf("%d", m_rangeMax);
-    m_macMaximumStatic->SetLabel(value);
-  }
-  SetValue(m_rangeMin);
+    wxString value;
+    
+    m_rangeMin = minValue;
+    m_rangeMax = maxValue;
+    
+    SetControl32BitMinimum( (ControlHandle) m_macControl, m_rangeMin);
+    SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
+    
+    if(m_macMinimumStatic) {
+        value.Printf("%d", m_rangeMin);
+        m_macMinimumStatic->SetLabel(value);
+    }
+    if(m_macMaximumStatic) {
+        value.Printf("%d", m_rangeMax);
+        m_macMaximumStatic->SetLabel(value);
+    }
+    SetValue(m_rangeMin);
 }
 
 // For trackbars only
@@ -235,164 +234,164 @@ void wxSlider::SetTick(int tickPos)
 
 void wxSlider::Command (wxCommandEvent & event)
 {
-  SetValue (event.GetInt());
-  ProcessCommand (event);
+    SetValue (event.GetInt());
+    ProcessCommand (event);
 }
 
 void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-       SInt16 value = ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
-       
-       SetValue( value ) ;             
-       
-       wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
-       event.SetPosition(value);
-       event.SetEventObject( this );
-       GetEventHandler()->ProcessEvent(event);
-
-  wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
-  cevent.SetInt( value );
-  cevent.SetEventObject( this );
-
-  GetEventHandler()->ProcessEvent( cevent );
+    SInt16 value = ::GetControl32BitValue( (ControlHandle) m_macControl ) ;
+    
+    SetValue( value ) ;        
+    
+    wxScrollEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
+    event.SetPosition(value);
+    event.SetEventObject( this );
+    GetEventHandler()->ProcessEvent(event);
+    
+    wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, m_windowId );
+    cevent.SetInt( value );
+    cevent.SetEventObject( this );
+    
+    GetEventHandler()->ProcessEvent( cevent );
+}
+
+/* This is overloaded in wxSlider so that the proper width/height will always be used
+* for the slider different values would cause redrawing and mouse detection problems */
+void wxSlider::SetSizeHints( int minW, int minH,
+                            int maxW , int maxH ,
+                            int incW , int incH )
+{
+    wxSize size = GetBestSize();
+    
+    if(GetWindowStyle() & wxSL_VERTICAL) {
+        wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
+    }
+    else {
+        wxWindow::SetSizeHints(minW, size.y, maxW, size.y, incW, incH);
+    }
 }
 
- /* This is overloaded in wxSlider so that the proper width/height will always be used
-  * for the slider different values would cause redrawing and mouse detection problems */
- void wxSlider::SetSizeHints( int minW, int minH,
-                              int maxW , int maxH ,
-                              int incW , int incH )
- {
-     wxSize size = GetBestSize();
-     if(GetWindowStyle() & wxSL_VERTICAL) {
-         wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
-     }
-     else {
-         wxWindow::SetSizeHints(minW, size.y, maxW, size.y, incW, incH);
-     }
- }
- wxSize wxSlider::DoGetBestSize() const
- {
-     wxSize size;
-     int textwidth, textheight;
-     if(GetWindowStyle() & wxSL_LABELS)
-     {
-         wxString text;
-         int ht, wd;
-         // Get maximum text label width and height
-         text.Printf("%d", m_rangeMin);
-         GetTextExtent(text, &textwidth, &textheight);
-         text.Printf("%d", m_rangeMax);
-         GetTextExtent(text, &wd, &ht);
-         if(ht > textheight) {
-             textheight = ht;
-         }
-         if (wd > textwidth) {
-             textwidth = wd;
-         }
-     }
-     if(GetWindowStyle() & wxSL_VERTICAL)
-     {
-         if(GetWindowStyle() & wxSL_AUTOTICKS) {
-             size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
-         }
-         else {
-             size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
-         }
-         if(GetWindowStyle() & wxSL_LABELS) {
-             size.x += textwidth + wxSLIDER_BORDERTEXT;
-         }
-         size.y = 150;
-     }
-     else
-     {
-         if(GetWindowStyle() & wxSL_AUTOTICKS) {
-             size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
-         }
-         else {
-             size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
-         }
-         if(GetWindowStyle() & wxSL_LABELS) {
-             size.y += textheight + wxSLIDER_BORDERTEXT;
-         }
-         size.x = 150;
-     }
-     return size;
- }
- void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
- {
+wxSize wxSlider::DoGetBestSize() const
+{
+    wxSize size;
+    int textwidth, textheight;
+    
+    if(GetWindowStyle() & wxSL_LABELS)
+    {
+        wxString text;
+        int ht, wd;
+        
+        // Get maximum text label width and height
+        text.Printf("%d", m_rangeMin);
+        GetTextExtent(text, &textwidth, &textheight);
+        text.Printf("%d", m_rangeMax);
+        GetTextExtent(text, &wd, &ht);
+        if(ht > textheight) {
+            textheight = ht;
+        }
+        if (wd > textwidth) {
+            textwidth = wd;
+        }
+    }
+    
+    if(GetWindowStyle() & wxSL_VERTICAL)
+    {
+        if(GetWindowStyle() & wxSL_AUTOTICKS) {
+            size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+        }
+        else {
+            size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
+        }
+        if(GetWindowStyle() & wxSL_LABELS) {
+            size.x += textwidth + wxSLIDER_BORDERTEXT;
+        }
+        size.y = 150;
+    }
+    else
+    {
+        if(GetWindowStyle() & wxSL_AUTOTICKS) {
+            size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+        }
+        else {
+            size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
+        }
+        if(GetWindowStyle() & wxSL_LABELS) {
+            size.y += textheight + wxSLIDER_BORDERTEXT;
+        }
+        size.x = 150;
+    }
+    return size;
+}
+
+void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{
     wxControl::DoSetSize( x, y , width , height ,sizeFlags ) ;
- }
- void wxSlider::MacUpdateDimensions() 
+}
+
+void wxSlider::MacUpdateDimensions() 
 {
-       // actually in the current systems this should never be possible, but later reparenting
-       // may become a reality
-       
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-               
-       if ( GetParent() == NULL )
-               return ;
-               
+    // actually in the current systems this should never be possible, but later reparenting
+    // may become a reality
+    
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+    
+    if ( GetParent() == NULL )
+        return ;
+    
     WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
     if ( rootwindow == NULL )
-       return ;
-       
-     int  xborder, yborder;
-     int  minValWidth, maxValWidth, textwidth, textheight;
-     int  sliderBreadth;
-     xborder = yborder = 0;
-
-     if (GetWindowStyle() & wxSL_LABELS)
-     {
-         wxString text;
-         int ht;
-         // Get maximum text label width and height
-         text.Printf("%d", m_rangeMin);
-         GetTextExtent(text, &minValWidth, &textheight);
-         text.Printf("%d", m_rangeMax);
-         GetTextExtent(text, &maxValWidth, &ht);
-         if(ht > textheight) {
-             textheight = ht;
-         }
-         textwidth = (minValWidth > maxValWidth ? minValWidth : maxValWidth);
-         xborder = textwidth + wxSLIDER_BORDERTEXT;
-         yborder = textheight + wxSLIDER_BORDERTEXT;
-         // Get slider breadth
-         if(GetWindowStyle() & wxSL_AUTOTICKS) {
-             sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
-         }
-         else {
-             sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
-         }
-         if(GetWindowStyle() & wxSL_VERTICAL)
-         {
-             m_macMinimumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT,
-                                      m_height - yborder - textheight);
-             m_macMaximumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT, 0);
-             m_macValueStatic->Move(0, m_height - textheight);
-         }
-         else
-         {
-             m_macMinimumStatic->Move(0, sliderBreadth + wxSLIDER_BORDERTEXT);
-             m_macMaximumStatic->Move(m_width - xborder - maxValWidth / 2,
-                                      sliderBreadth + wxSLIDER_BORDERTEXT);
-             m_macValueStatic->Move(m_width - textwidth, 0);
-         }
-     }
-
+        return ;
+    
+    int  xborder, yborder;
+    int  minValWidth, maxValWidth, textwidth, textheight;
+    int  sliderBreadth;
+    
+    xborder = yborder = 0;
+    
+    if (GetWindowStyle() & wxSL_LABELS)
+    {
+        wxString text;
+        int ht;
+        
+        // Get maximum text label width and height
+        text.Printf("%d", m_rangeMin);
+        GetTextExtent(text, &minValWidth, &textheight);
+        text.Printf("%d", m_rangeMax);
+        GetTextExtent(text, &maxValWidth, &ht);
+        if(ht > textheight) {
+            textheight = ht;
+        }
+        textwidth = (minValWidth > maxValWidth ? minValWidth : maxValWidth);
+        
+        xborder = textwidth + wxSLIDER_BORDERTEXT;
+        yborder = textheight + wxSLIDER_BORDERTEXT;
+        
+        // Get slider breadth
+        if(GetWindowStyle() & wxSL_AUTOTICKS) {
+            sliderBreadth = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+        }
+        else {
+            sliderBreadth = wxSLIDER_DIMENSIONACROSS_ARROW;
+        }
+        
+        if(GetWindowStyle() & wxSL_VERTICAL)
+        {
+            m_macMinimumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT,
+                m_height - yborder - textheight);
+            m_macMaximumStatic->Move(sliderBreadth + wxSLIDER_BORDERTEXT, 0);
+            m_macValueStatic->Move(0, m_height - textheight);
+        }
+        else
+        {
+            m_macMinimumStatic->Move(0, sliderBreadth + wxSLIDER_BORDERTEXT);
+            m_macMaximumStatic->Move(m_width - xborder - maxValWidth / 2,
+                sliderBreadth + wxSLIDER_BORDERTEXT);
+            m_macValueStatic->Move(m_width - textwidth, 0);
+        }
+    }
+    
     Rect oldBounds ;       
     GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ; 
     
@@ -404,18 +403,18 @@ void wxSlider::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
     GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
     bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
     bool doResize =  ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
-       if ( doMove || doResize )
-       {
-               InvalWindowRect( rootwindow, &oldBounds ) ;
-               if ( doMove )
-               {
-                       UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
-               }
-               if ( doResize )
-               {
-                       UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
-               }
-       }
+    if ( doMove || doResize )
+    {
+        InvalWindowRect( rootwindow, &oldBounds ) ;
+        if ( doMove )
+        {
+            UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
+        }
+        if ( doResize )
+        {
+            UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
+        }
+    }
 }
 
 void wxSlider::DoMoveWindow(int x, int y, int width, int height)
index 85fd2d0b0835639b024aaa137e67c6e73b78eaca..b36c755f7e44ae3c9b67811d613fe4b64947c140 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -36,29 +36,29 @@ wxSpinButton::wxSpinButton()
 }
 
 bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
-            long style, const wxString& name)
+        long style, const wxString& name)
 {
     m_min = 0;
     m_max = 100;
-
-  if (!parent)
-      return FALSE;
     
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, 
-               kControlLittleArrowsProc , (long) this ) ;
-       
-       wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-
-       MacPostControlCreate() ;
-
-  return TRUE;
+    if (!parent)
+        return FALSE;
+    
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, 
+        kControlLittleArrowsProc , (long) this ) ;
+    
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    
+    MacPostControlCreate() ;
+    
+    return TRUE;
 }
-
+    
 wxSpinButton::~wxSpinButton()
 {
 }
@@ -68,12 +68,12 @@ wxSpinButton::~wxSpinButton()
 
 int wxSpinButton::GetMin() const
 {
-   return m_min;
+    return m_min;
 }
 
 int wxSpinButton::GetMax() const
 {
-   return m_max;
+    return m_max;
 }
 
 int wxSpinButton::GetValue() const
@@ -83,50 +83,50 @@ int wxSpinButton::GetValue() const
 
 void wxSpinButton::SetValue(int val)
 {
-       m_value = val ;
+    m_value = val ;
 }
 
 void wxSpinButton::SetRange(int minVal, int maxVal)
 {
-       m_min = minVal;
-       m_max = maxVal;
+    m_min = minVal;
+    m_max = maxVal;
     SetControl32BitMaximum( (ControlHandle) m_macControl , maxVal ) ;
     SetControl32BitMinimum((ControlHandle) m_macControl , minVal ) ;
 }
 
 void wxSpinButton::MacHandleValueChanged( int inc )
 {
-     
+    
     wxEventType scrollEvent = wxEVT_NULL;
-       int oldValue = m_value ;
-
+    int oldValue = m_value ;
+    
     m_value = oldValue + inc;
-
+    
     if (m_value < m_min)
     {
-    if ( m_windowStyle & wxSP_WRAP )
-      m_value = m_max;
-    else
-      m_value = m_min;
+        if ( m_windowStyle & wxSP_WRAP )
+            m_value = m_max;
+        else
+            m_value = m_min;
     }
-
+    
     if (m_value > m_max)
     {
-    if ( m_windowStyle & wxSP_WRAP )
-      m_value = m_min;
-    else
-      m_value = m_max;
+        if ( m_windowStyle & wxSP_WRAP )
+            m_value = m_min;
+        else
+            m_value = m_max;
     }
-
+    
     if ( m_value - oldValue == -1 )
         scrollEvent = wxEVT_SCROLL_LINEDOWN ;
     else if ( m_value - oldValue == 1 )
         scrollEvent = wxEVT_SCROLL_LINEUP ;
     else
         scrollEvent = wxEVT_SCROLL_THUMBTRACK ;
-        
+    
     wxSpinEvent event(scrollEvent, m_windowId);
-
+    
     event.SetPosition(m_value);
     event.SetEventObject( this );
     if ((GetEventHandler()->ProcessEvent( event )) &&
@@ -135,7 +135,7 @@ void wxSpinButton::MacHandleValueChanged( int inc )
         m_value = oldValue ;
     }
     SetControl32BitValue( (ControlHandle) m_macControl , m_value ) ;
-
+    
     /* always send a thumbtrack event */
     if (scrollEvent != wxEVT_SCROLL_THUMBTRACK)
     {
@@ -149,22 +149,22 @@ void wxSpinButton::MacHandleValueChanged( int inc )
 
 void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-       if ( (ControlHandle) m_macControl == NULL )
-               return ;
-       
-  int nScrollInc = 0;
-
-       switch( controlpart )
-       {
-               case kControlUpButtonPart :
-            nScrollInc = 1;
-                       break ;
-               case kControlDownButtonPart :
-            nScrollInc = -1;
-                       break ;
-       }
-       MacHandleValueChanged( nScrollInc ) ;
-
+    if ( (ControlHandle) m_macControl == NULL )
+        return ;
+    
+    int nScrollInc = 0;
+    
+    switch( controlpart )
+    {
+    case kControlUpButtonPart :
+        nScrollInc = 1;
+        break ;
+    case kControlDownButtonPart :
+        nScrollInc = -1;
+        break ;
+    }
+    MacHandleValueChanged( nScrollInc ) ;
+    
 }
 
 // ----------------------------------------------------------------------------
@@ -173,6 +173,6 @@ void wxSpinButton::MacHandleControlClick( WXWidget control , wxInt16 controlpart
 
 wxSize wxSpinButton::DoGetBestSize() const
 {
-  return wxSize(16,24);
+    return wxSize(16,24);
 }
 
index ab37567e8847f2ee31262d2e5064faf8667299f4..68bc4efa6ac16f137f7604be33f235dfddf12ae3 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -38,13 +38,13 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
            const wxString& name)
 {
     SetName(name);
-       wxSize size = s ;
-       if ( bitmap.Ok() )
-       {
-       if ( size.x == -1 )
-           size.x = bitmap.GetWidth() ;
-       if ( size.y == -1 )
-           size.y = bitmap.GetHeight() ;
+    wxSize size = s ;
+    if ( bitmap.Ok() )
+    {
+        if ( size.x == -1 )
+            size.x = bitmap.GetWidth() ;
+        if ( size.y == -1 )
+            size.y = bitmap.GetHeight() ;
     }
 
     m_backgroundColour = parent->GetBackgroundColour() ;
@@ -52,14 +52,14 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
 
     m_bitmap = bitmap;
     if ( id == -1 )
-           m_windowId = (int)NewControlId();
+          m_windowId = (int)NewControlId();
     else
-           m_windowId = id;
+        m_windowId = id;
 
     m_windowStyle = style;
 
     bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
-       SetBestSize( size ) ;
+    SetBestSize( size ) ;
     
     return ret;
 }
index cef41efca71b196cf8bd19d551f83a408bc1d60a..e494e9e709d3bfec985ac4488bdd6ca7c03c880a 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -22,7 +22,7 @@
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
 BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
-       EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
+    EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
 END_EVENT_TABLE()
 
 #endif
@@ -38,15 +38,15 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
            long style,
            const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlGroupBoxTextTitleProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
-
-  return TRUE;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  label , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+        kControlGroupBoxTextTitleProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    
+    return TRUE;
 }
index d3fef290a39031c7b878e10fa0527a39f956a20b..e39e83bb81765060a4d7f16e22c331cd556ca547 100644 (file)
@@ -22,7 +22,7 @@
 #include "wx/dcclient.h"
 
 BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
-       EVT_PAINT(wxStatusBarMac::OnPaint)
+    EVT_PAINT(wxStatusBarMac::OnPaint)
 END_EVENT_TABLE()
 
 #ifdef __WXMAC__
@@ -47,38 +47,38 @@ wxStatusBarMac::~wxStatusBarMac()
 }
 
 bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
-           long style ,
-           const wxString& name)
+                            long style ,
+                            const wxString& name)
 {
-       return wxStatusBarGeneric::Create( parent , id , style , name ) ;
+    return wxStatusBarGeneric::Create( parent , id , style , name ) ;
 }
 
 void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
 {
-  int leftMargin = 2;
-
-  wxRect rect;
-  GetFieldRect(i, rect);
-  
-  if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
-  {
-    dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
-  }
-
-  wxString text(GetStatusText(i));
-
-  long x, y;
-
-  dc.GetTextExtent(text, &x, &y);
-
-  int xpos = rect.x + leftMargin + 1 ;
-  int ypos = 2 ;
-  
-  dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
-
-  dc.DrawText(text, xpos, ypos);
-
-  dc.DestroyClippingRegion();
+    int leftMargin = 2;
+    
+    wxRect rect;
+    GetFieldRect(i, rect);
+    
+    if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
+    {
+        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
+    }
+    
+    wxString text(GetStatusText(i));
+    
+    long x, y;
+    
+    dc.GetTextExtent(text, &x, &y);
+    
+    int xpos = rect.x + leftMargin + 1 ;
+    int ypos = 2 ;
+    
+    dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
+    
+    dc.DrawText(text, xpos, ypos);
+    
+    dc.DestroyClippingRegion();
 }
 
 void wxStatusBarMac::DrawField(wxDC& dc, int i)
@@ -89,8 +89,8 @@ void wxStatusBarMac::DrawField(wxDC& dc, int i)
 void wxStatusBarMac::SetStatusText(const wxString& text, int number)
 {
     wxCHECK_RET( (number >= 0) && (number < m_nFields),
-                 _T("invalid status bar field index") );
-
+        _T("invalid status bar field index") );
+    
     m_statusStrings[number] = text;
     wxRect rect;
     GetFieldRect(number, rect);
@@ -101,35 +101,35 @@ void wxStatusBarMac::SetStatusText(const wxString& text, int number)
 
 void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
 {
-       wxPaintDC dc(this);
-       dc.Clear() ;
-
-       if ( IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
-       {
-               wxPen black( wxBLACK , 1 , wxSOLID ) ;
-               wxPen white( wxWHITE , 1 , wxSOLID ) ;
-
-               dc.SetPen(black);
-               dc.DrawLine(0, 0 ,
-                      m_width , 0);
-               dc.SetPen(white);
-               dc.DrawLine(0, 1 ,
-                      m_width , 1);
-       }
-       else
-       {
-               dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));
-               dc.DrawLine(0, 0 ,
-                      m_width , 0);
-       }
-
-       int i;
-       if ( GetFont().Ok() )
-               dc.SetFont(GetFont());
-       dc.SetBackgroundMode(wxTRANSPARENT);
-
-       for ( i = 0; i < m_nFields; i ++ )
-               DrawField(dc, i);
+    wxPaintDC dc(this);
+    dc.Clear() ;
+    
+    if ( IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
+    {
+        wxPen black( wxBLACK , 1 , wxSOLID ) ;
+        wxPen white( wxWHITE , 1 , wxSOLID ) ;
+        
+        dc.SetPen(black);
+        dc.DrawLine(0, 0 ,
+            m_width , 0);
+        dc.SetPen(white);
+        dc.DrawLine(0, 1 ,
+            m_width , 1);
+    }
+    else
+    {
+        dc.SetPen(wxPen(wxColour(0x80,0x80,0x80),1,wxSOLID));
+        dc.DrawLine(0, 0 ,
+            m_width , 0);
+    }
+    
+    int i;
+    if ( GetFont().Ok() )
+        dc.SetFont(GetFont());
+    dc.SetBackgroundMode(wxTRANSPARENT);
+    
+    for ( i = 0; i < m_nFields; i ++ )
+        DrawField(dc, i);
 }
 
 void wxStatusBarMac::MacSuperEnabled( bool enabled ) 
index 2c01893e846d4c303f2281cdf6c65429e5986682..dc00dcca0f136c56ba4db1822c73dbba1e9c7108 100644 (file)
@@ -49,15 +49,15 @@ bool wxStaticLine::Create( wxWindow *parent,
                            long style,
                            const wxString &name)
 {
-       Rect bounds ;
-       Str255 title ;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlSeparatorLineProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
+    Rect bounds ;
+    Str255 title ;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+          kControlSeparatorLineProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
 
     return TRUE;
 }
index f0175deaf35a7d2e0f1f8154e4ee943c797422f9..fc0a5726f933914d9b86e7d4dc090cb9c1f221dc 100644 (file)
@@ -137,44 +137,44 @@ void wxStaticText::OnDraw( wxDC &dc )
 {
     if (m_width <= 0 || m_height <= 0)
         return;
-/*
-    dc.Clear() ;
-    wxRect rect(0,0,m_width,m_height) ;
-    dc.SetFont(*wxSMALL_FONT) ;
-
-    dc.DrawRectangle(rect) ;
-*/
-  if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) &&
-    ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
-      || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) )
-  {
-    dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
-  }
-  else
-  {
-    dc.SetTextForeground( GetForegroundColour() ) ;
-  }
-
-  wxString paragraph;
-  size_t i = 0 ;
-  wxString text = m_label;
-  int y = 0 ;
-  while (i < text.Length())
-  {
-
-    if (text[i] == 13 || text[i] == 10)
+    /*
+        dc.Clear() ;
+        wxRect rect(0,0,m_width,m_height) ;
+        dc.SetFont(*wxSMALL_FONT) ;
+        
+          dc.DrawRectangle(rect) ;
+    */
+    if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) &&
+        ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
+        || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) )
     {
-        DrawParagraph(dc, paragraph,y);
-        paragraph = "" ;
+        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
     }
     else
     {
-        paragraph += text[i];
+        dc.SetTextForeground( GetForegroundColour() ) ;
+    }
+    
+    wxString paragraph;
+    size_t i = 0 ;
+    wxString text = m_label;
+    int y = 0 ;
+    while (i < text.Length())
+    {
+        
+        if (text[i] == 13 || text[i] == 10)
+        {
+            DrawParagraph(dc, paragraph,y);
+            paragraph = "" ;
+        }
+        else
+        {
+            paragraph += text[i];
+        }
+        ++i;
     }
-    ++i;
-  }
-  if (paragraph.Length() > 0)
-      DrawParagraph(dc, paragraph,y);
+    if (paragraph.Length() > 0)
+        DrawParagraph(dc, paragraph,y);
 }
 
 void wxStaticText::OnPaint( wxPaintEvent & WXUNUSED(event) )
index 08b7204373be78a97d1e9f51f86996fc8009ad57..6e79c8838681839edd60c613af033d4e388b9dff 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -34,18 +34,18 @@ wxTabCtrl::wxTabCtrl()
 bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
 {
-       Rect bounds ;
-       Str255 title ;
-
-  m_imageList = NULL;
-       
-       MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
-
-       m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
-               kControlTabSmallProc , (long) this ) ;
-       
-       MacPostControlCreate() ;
-       return TRUE ;
+    Rect bounds ;
+    Str255 title ;
+    
+    m_imageList = NULL;
+    
+    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    
+    m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
+        kControlTabSmallProc , (long) this ) ;
+    
+    MacPostControlCreate() ;
+    return TRUE ;
 }
 
 wxTabCtrl::~wxTabCtrl()
index 7213103b0447d6404eadc5bcf1702c9097743126..df0eb5a9b76bb798d4ecb8641e6f5afe008eb40f 100644 (file)
@@ -1,13 +1,13 @@
 /////////////////////////////////////////////////////////////////////////
 // File:        taskbar.cpp
-// Purpose:        Implements wxTaskBarIcon class for manipulating icons on
+// Purpose:        Implements wxTaskBarIcon class for manipulating icons on
 //              the task bar. Optional.
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c)
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index a6eb64f05cf9f074e9eb1b2755e7f6559cd744cc..ae6063d20c4bdabdc2a75c439e2af6fe191bb251 100644 (file)
@@ -299,8 +299,8 @@ static pascal ControlPartCode TPPaneTrackingProc(ControlHandle theControl, Point
 #if !TARGET_CARBON 
                     TXNClick( varsp->fTXNRec, (const EventRecord*) wxTheApp->MacGetCurrentEvent());
 #else
-                                       EventRecord rec ;
-                                       ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
+                    EventRecord rec ;
+                    ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
                     TXNClick( varsp->fTXNRec, &rec );
 #endif
                 }
@@ -662,15 +662,15 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
            const wxValidator& validator,
            const wxString& name)
 {
-  m_macTE = NULL ;
-  m_macTXN = NULL ;
-  m_macTXNvars = NULL ;
-  m_macUsesTXN = false ;
-  m_editable = true ;
-
-  m_macUsesTXN = ! (style & wxTE_PASSWORD ) ; 
-
-  m_macUsesTXN &= (TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress) ;
+    m_macTE = NULL ;
+    m_macTXN = NULL ;
+    m_macTXNvars = NULL ;
+    m_macUsesTXN = false ;
+    m_editable = true ;
+    
+    m_macUsesTXN = ! (style & wxTE_PASSWORD ) ; 
+    
+    m_macUsesTXN &= (TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress) ;
     
     // base initialization
     if ( !CreateBase(parent, id, pos, size, style, validator, name) )
@@ -764,7 +764,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
     }
   
-  return TRUE;
+    return TRUE;
 }
 
 wxString wxTextCtrl::GetValue() const
@@ -774,21 +774,21 @@ wxString wxTextCtrl::GetValue() const
     OSStatus err ;
     if ( !m_macUsesTXN )
     {
-       err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
+        err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
             ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
        
-               if ( err )
-                       return wxEmptyString ;
-               
-               if ( actualSize > 0 )
-               {
-               wxChar *ptr = result.GetWriteBuf(actualSize) ;
-               
-               ::GetControlData( (ControlHandle) m_macControl, 0,
-                   ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, 
-                   actualSize , ptr , &actualSize ) ;
-               ptr[actualSize] = 0 ;
-               result.UngetWriteBuf(actualSize) ;
+           if ( err )
+               return wxEmptyString ;
+           
+           if ( actualSize > 0 )
+           {
+            wxChar *ptr = result.GetWriteBuf(actualSize) ;
+            
+            ::GetControlData( (ControlHandle) m_macControl, 0,
+                ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, 
+                actualSize , ptr , &actualSize ) ;
+            ptr[actualSize] = 0 ;
+            result.UngetWriteBuf(actualSize) ;
         }
         
     }
@@ -804,14 +804,14 @@ wxString wxTextCtrl::GetValue() const
         else
         {
             actualSize = GetHandleSize( theText ) ;
-               if ( actualSize > 0 )
-               {
-                       wxChar *ptr = result.GetWriteBuf(actualSize) ;
-                   strncpy( ptr , *theText , actualSize ) ;
-                   ptr[actualSize] = 0 ;
-                   result.UngetWriteBuf( actualSize ) ;
-               }
-               DisposeHandle( theText ) ;
+               if ( actualSize > 0 )
+               {
+                wxChar *ptr = result.GetWriteBuf(actualSize) ;
+                strncpy( ptr , *theText , actualSize ) ;
+                ptr[actualSize] = 0 ;
+                result.UngetWriteBuf( actualSize ) ;
+            }
+            DisposeHandle( theText ) ;
         }
     }
     
@@ -1090,42 +1090,42 @@ void wxTextCtrl::SetInsertionPointEnd()
 
 long wxTextCtrl::GetInsertionPoint() const
 {
-  long begin,end ;
-  GetSelection( &begin , &end ) ;
-  return begin ;
+    long begin,end ;
+    GetSelection( &begin , &end ) ;
+    return begin ;
 }
 
 long wxTextCtrl::GetLastPosition() const
 {
     if ( !m_macUsesTXN )
-  {
-    return (**((TEHandle) m_macTE)).teLength ;
-  }
-  else
-  {
-    Handle theText ;
-    long actualsize ;
-    OSErr err = TXNGetDataEncoded( (TXNObject) m_macTXN, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
-        /* all done */
-    if ( err )
     {
-      actualsize = 0 ;
+        return (**((TEHandle) m_macTE)).teLength ;
     }
     else
     {
-      actualsize = GetHandleSize( theText ) ;
-      DisposeHandle( theText ) ;
+        Handle theText ;
+        long actualsize ;
+        OSErr err = TXNGetDataEncoded( (TXNObject) m_macTXN, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
+        /* all done */
+        if ( err )
+        {
+            actualsize = 0 ;
+        }
+        else
+        {
+            actualsize = GetHandleSize( theText ) ;
+            DisposeHandle( theText ) ;
+        }
+        return actualsize ;
     }
-    return actualsize ;
-  }
 }
 
 void wxTextCtrl::Replace(long from, long to, const wxString& value)
 {
-  if ( !m_macUsesTXN )
-  {
+    if ( !m_macUsesTXN )
+    {
         ControlEditTextSelectionRec selection ;
-   
+        
         selection.selStart = from ;
         selection.selEnd = to ;
         ::SetControlData((ControlHandle)  m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
@@ -1141,7 +1141,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
         TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
         TXNClear( ((TXNObject) m_macTXN) ) ;
         TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)value.c_str(), value.Length(),
-        kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+            kTXNUseCurrentSelection, kTXNUseCurrentSelection);
         if ( !formerEditable )
             SetEditable( formerEditable ) ;
     }
@@ -1150,52 +1150,52 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
 
 void wxTextCtrl::Remove(long from, long to)
 {
-  if ( !m_macUsesTXN )
-  {
-    ControlEditTextSelectionRec selection ;
-   
-    selection.selStart = from ;
-    selection.selEnd = to ;
-    ::SetControlData( (ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
-    TEDelete( ((TEHandle) m_macTE) ) ;
-  }
-  else
-  {
-    bool formerEditable = IsEditable() ;
-    if ( !formerEditable )
-        SetEditable(true) ;
-    TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ; 
-    TXNClear( ((TXNObject) m_macTXN) ) ; 
-    if ( !formerEditable )
-        SetEditable( formerEditable ) ;
-  }
+    if ( !m_macUsesTXN )
+    {
+        ControlEditTextSelectionRec selection ;
+        
+        selection.selStart = from ;
+        selection.selEnd = to ;
+        ::SetControlData( (ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
+        TEDelete( ((TEHandle) m_macTE) ) ;
+    }
+    else
+    {
+        bool formerEditable = IsEditable() ;
+        if ( !formerEditable )
+            SetEditable(true) ;
+        TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ; 
+        TXNClear( ((TXNObject) m_macTXN) ) ; 
+        if ( !formerEditable )
+            SetEditable( formerEditable ) ;
+    }
     Refresh() ;
 }
 
 void wxTextCtrl::SetSelection(long from, long to)
 {
-
-  if ( !m_macUsesTXN )
-  {
-   ControlEditTextSelectionRec selection ;
-   selection.selStart = from ;
-   selection.selEnd = to ;
-   
-   TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
-   ::SetControlData((ControlHandle)  m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
-  }
-  else
-  {
-    STPTextPaneVars **tpvars;
+    
+    if ( !m_macUsesTXN )
+    {
+        ControlEditTextSelectionRec selection ;
+        selection.selStart = from ;
+        selection.selEnd = to ;
+        
+        TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
+        ::SetControlData((ControlHandle)  m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
+    }
+    else
+    {
+        STPTextPaneVars **tpvars;
         /* set up our locals */
-    tpvars = (STPTextPaneVars **) GetControlReference((ControlHandle) m_macControl);
+        tpvars = (STPTextPaneVars **) GetControlReference((ControlHandle) m_macControl);
         /* and our drawing environment as the operation
         may force a redraw in the text area. */
-    SetPort((**tpvars).fDrawingEnvironment);
+        SetPort((**tpvars).fDrawingEnvironment);
         /* change the selection */
-    TXNSetSelection( (**tpvars).fTXNRec, from, to);
-    TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
-  }
+        TXNSetSelection( (**tpvars).fTXNRec, from, to);
+        TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
+    }
 }
 
 bool wxTextCtrl::LoadFile(const wxString& file)
@@ -1252,15 +1252,15 @@ void wxTextCtrl::Clear()
     {
         return ;
     }
-  if ( !m_macUsesTXN )
-  {
-    ::SetControlData((ControlHandle)  m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
-  }
-  else
-  {
+    if ( !m_macUsesTXN )
+    {
+        ::SetControlData((ControlHandle)  m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
+    }
+    else
+    {
         TXNSetSelection( (TXNObject)m_macTXN , kTXNStartOffset , kTXNEndOffset ) ;
         TXNClear((TXNObject)m_macTXN); 
-  }
+    }
     Refresh() ;
 }
 
@@ -1349,8 +1349,8 @@ void wxTextCtrl::DiscardEdits()
 
 int wxTextCtrl::GetNumberOfLines() const
 {
-  // TODO change this if possible to reflect real lines
-  wxString content = GetValue() ;
+    // TODO change this if possible to reflect real lines
+    wxString content = GetValue() ;
     
     int count = 1;
     for (size_t i = 0; i < content.Length() ; i++)
@@ -1379,8 +1379,8 @@ void wxTextCtrl::ShowPosition(long pos)
 
 int wxTextCtrl::GetLineLength(long lineNo) const
 {
-  // TODO change this if possible to reflect real lines
-  wxString content = GetValue() ;
+    // TODO change this if possible to reflect real lines
+    wxString content = GetValue() ;
     
     // Find line first
     int count = 0;
@@ -1405,8 +1405,8 @@ int wxTextCtrl::GetLineLength(long lineNo) const
 
 wxString wxTextCtrl::GetLineText(long lineNo) const
 {
-  // TODO change this if possible to reflect real lines
-  wxString content = GetValue() ;
+    // TODO change this if possible to reflect real lines
+    wxString content = GetValue() ;
 
     // Find line first
     int count = 0;
index 474b92a22f79fb6d36f63e07b7c57e02cecf75a1..23a72037529fc718ccf96605f5a9d16ecc321457 100644 (file)
@@ -902,5 +902,3 @@ bool WXDLLEXPORT wxIsWaitingForThread()
 #include "wx/thrimpl.cpp"
 
 #endif // wxUSE_THREADS
-
-// vi:sts=4:sw=4:et
index 4d96abef874823d4428b0df2dce8b2bb1ea71921..3d43a7ca27f3846ecadd399b701452a0efa4fd93 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -39,24 +39,24 @@ static void wxProcessTimer( unsigned long event , void *data ) ;
 
 static pascal void MacTimerProc( TMTask * t )
 {
-       MacTimerInfo * tm = (MacTimerInfo*)  t ;
-       wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ;
+    MacTimerInfo * tm = (MacTimerInfo*)  t ;
+    wxMacAddEvent( tm->m_table , wxProcessTimer, 0 , (void*) tm->m_timer , TRUE ) ;
 }
 
 wxArrayPtrVoid gTimersInProcess ;
 
 static void wxProcessTimer( unsigned long event , void *data )
 {
-       if ( !data )
-               return ;
-               
-       wxTimer* timer = (wxTimer*) data ;
-       
-       if ( timer->IsOneShot() )
-               timer->Stop() ;
-               
-       gTimersInProcess.Add( timer ) ;
-        
+    if ( !data )
+        return ;
+        
+    wxTimer* timer = (wxTimer*) data ;
+    
+    if ( timer->IsOneShot() )
+        timer->Stop() ;
+        
+    gTimersInProcess.Add( timer ) ;
+     
     timer->Notify();
 
     int index = gTimersInProcess.Index( timer ) ;
@@ -67,7 +67,7 @@ static void wxProcessTimer( unsigned long event , void *data )
         
         if ( !timer->IsOneShot() && timer->m_info->m_task.tmAddr )
         {
-           PrimeTime( (QElemPtr)  &timer->m_info->m_task , timer->GetInterval() ) ;
+            PrimeTime( (QElemPtr)  &timer->m_info->m_task , timer->GetInterval() ) ;
         }
     
     }
@@ -76,17 +76,17 @@ static void wxProcessTimer( unsigned long event , void *data )
 void wxTimer::Init()
 {
     m_info = new MacTimerInfo() ;
-       m_info->m_task.tmAddr = NULL ;
-       m_info->m_task.tmWakeUp = 0 ;
-       m_info->m_task.tmReserved = 0 ;
-       m_info->m_task.qType = 0 ;
-       m_info->m_table = wxMacGetNotifierTable() ;
-       m_info->m_timer = this ;
+    m_info->m_task.tmAddr = NULL ;
+    m_info->m_task.tmWakeUp = 0 ;
+    m_info->m_task.tmReserved = 0 ;
+    m_info->m_task.qType = 0 ;
+    m_info->m_table = wxMacGetNotifierTable() ;
+    m_info->m_timer = this ;
 }
 
 bool wxTimer::IsRunning() const 
 {
-       return ( m_info->m_task.qType & kTMTaskActive ) ;
+    return ( m_info->m_task.qType & kTMTaskActive ) ;
 }
 
 wxTimer::~wxTimer()
@@ -116,8 +116,8 @@ bool wxTimer::Start(int milliseconds,bool mode)
 #endif
     m_info->m_task.tmWakeUp = 0 ;
     m_info->m_task.tmReserved = 0 ;
-       m_info->m_task.qType = 0 ;
-       m_info->m_timer = this ;
+    m_info->m_task.qType = 0 ;
+    m_info->m_timer = this ;
     InsXTime((QElemPtr) &m_info->m_task ) ;
     PrimeTime( (QElemPtr) &m_info->m_task , m_milli ) ;
     return FALSE;
@@ -128,9 +128,9 @@ void wxTimer::Stop()
     m_milli = 0 ;
     if ( m_info->m_task.tmAddr )
     {
-       RmvTime(  (QElemPtr) &m_info->m_task ) ;
-       DisposeTimerUPP(m_info->m_task.tmAddr) ;
-       m_info->m_task.tmAddr = NULL ;
+        RmvTime(  (QElemPtr) &m_info->m_task ) ;
+        DisposeTimerUPP(m_info->m_task.tmAddr) ;
+        m_info->m_task.tmAddr = NULL ;
     }
     wxMacRemoveAllNotifiersForData( wxMacGetNotifierTable() , this ) ;
 }
index 8b8d56b70a033f817b3216567b753b28ba1259f5..33da0a2d4b9c80d4e16770b8c68c1835ced25f66 100644 (file)
@@ -107,54 +107,53 @@ wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
 
 void wxToolBar::Init()
 {
-  m_maxWidth = -1;
-  m_maxHeight = -1;
-  m_defaultWidth = kwxMacToolBarToolDefaultWidth;
-  m_defaultHeight = kwxMacToolBarToolDefaultHeight;
+    m_maxWidth = -1;
+    m_maxHeight = -1;
+    m_defaultWidth = kwxMacToolBarToolDefaultWidth;
+    m_defaultHeight = kwxMacToolBarToolDefaultHeight;
 }
 
 bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
-{
-  
-  int x = pos.x;
-  int y = pos.y;
-  int width = size.x;
-  int height = size.y;
-
-  if (width <= 0)
-    width = 100;
-  if (height <= 0)
-    height = 30;
-  if (x < 0)
-    x = 0;
-  if (y < 0)
-    y = 0;
-
-  SetName(name);
-
-  m_windowStyle = style;
-  parent->AddChild(this);
-
-  m_backgroundColour = parent->GetBackgroundColour() ;
-  m_foregroundColour = parent->GetForegroundColour() ;
-
-  if (id == -1)
-      m_windowId = NewControlId();
-  else
-      m_windowId = id;
-
-  {
-    m_width = size.x ;
-    m_height = size.y ;
-    int x = pos.x ;
-    int y = pos.y ;
-    AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
-    m_x = x ;
-    m_y = y ;
-  }
-  
-  return TRUE;
+{  
+    int x = pos.x;
+    int y = pos.y;
+    int width = size.x;
+    int height = size.y;
+    
+    if (width <= 0)
+        width = 100;
+    if (height <= 0)
+        height = 30;
+    if (x < 0)
+        x = 0;
+    if (y < 0)
+        y = 0;
+    
+    SetName(name);
+    
+    m_windowStyle = style;
+    parent->AddChild(this);
+    
+    m_backgroundColour = parent->GetBackgroundColour() ;
+    m_foregroundColour = parent->GetForegroundColour() ;
+    
+    if (id == -1)
+        m_windowId = NewControlId();
+    else
+        m_windowId = id;
+    
+    {
+        m_width = size.x ;
+        m_height = size.y ;
+        int x = pos.x ;
+        int y = pos.y ;
+        AdjustForParentClientOrigin(x, y, wxSIZE_USE_EXISTING);
+        m_x = x ;
+        m_y = y ;
+    }
+    
+    return TRUE;
 }
 
 wxToolBar::~wxToolBar()
@@ -363,119 +362,119 @@ void wxToolBar::SetRows(int nRows)
 
 void wxToolBar::MacSuperChangedPosition() 
 {
-  if (m_tools.GetCount() > 0)
-  {
-
-    Point localOrigin ;
-    //    Rect clipRect ;
-    //    WindowRef window ;
-    //    wxWindow *win ;
-    int lx , ly ;
-    lx = ly = 0 ;
-    MacWindowToRootWindow( &lx , &ly ) ;
-    localOrigin.v = ly ;
-    localOrigin.h = lx ;
-    
-//    GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
-
-    Rect toolbarrect = { localOrigin.v ,localOrigin.h , 
-        m_height + localOrigin.v  , m_width + localOrigin.h} ;
-    ControlFontStyleRec     controlstyle ;
-
-    controlstyle.flags = kControlUseFontMask ;
-    controlstyle.font = kControlFontSmallSystemFont ;
-    
-    wxToolBarToolsList::Node *node = m_tools.GetFirst();
-    int noButtons = 0;
-    int x = 0 ;
-    wxSize toolSize = GetToolSize() ;
-    int tw, th;
-    GetSize(& tw, & th);
-    
-    int maxWidth = 0 ;
-    int maxHeight = 0 ;
-    int toolcount = 0 ;
+    if (m_tools.GetCount() > 0)
     {
-      WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
-        while (node)
+        
+        Point localOrigin ;
+        //    Rect clipRect ;
+        //    WindowRef window ;
+        //    wxWindow *win ;
+        int lx , ly ;
+        lx = ly = 0 ;
+        MacWindowToRootWindow( &lx , &ly ) ;
+        localOrigin.v = ly ;
+        localOrigin.h = lx ;
+        
+        //    GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
+        
+        Rect toolbarrect = { localOrigin.v ,localOrigin.h , 
+            m_height + localOrigin.v  , m_width + localOrigin.h} ;
+        ControlFontStyleRec     controlstyle ;
+        
+        controlstyle.flags = kControlUseFontMask ;
+        controlstyle.font = kControlFontSmallSystemFont ;
+        
+        wxToolBarToolsList::Node *node = m_tools.GetFirst();
+        int noButtons = 0;
+        int x = 0 ;
+        wxSize toolSize = GetToolSize() ;
+        int tw, th;
+        GetSize(& tw, & th);
+        
+        int maxWidth = 0 ;
+        int maxHeight = 0 ;
+        int toolcount = 0 ;
         {
-            wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-            
-            if(  !tool->IsSeparator()  )
+            WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
+            while (node)
             {
-                Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
-                toolrect.right = toolrect.left + toolSize.x ;
-                toolrect.bottom = toolrect.top + toolSize.y ;
-                            
-                ControlHandle m_macToolHandle = (ControlHandle) m_macToolHandles[toolcount++] ;
+                wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
                 
+                if(  !tool->IsSeparator()  )
                 {
-                    Rect contrlRect ;       
-                    GetControlBounds( m_macToolHandle , &contrlRect ) ; 
-                    int former_mac_x = contrlRect.left ;
-                    int former_mac_y = contrlRect.top ;
-                    int mac_x = toolrect.left ;
-                    int mac_y = toolrect.top ;
-                                
-                    if ( mac_x != former_mac_x || mac_y != former_mac_y )
+                    Rect toolrect = { toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin, toolbarrect.left + x + m_xMargin + kwxMacToolBarLeftMargin , 0 , 0 } ;
+                    toolrect.right = toolrect.left + toolSize.x ;
+                    toolrect.bottom = toolrect.top + toolSize.y ;
+                    
+                    ControlHandle m_macToolHandle = (ControlHandle) m_macToolHandles[toolcount++] ;
+                    
                     {
+                        Rect contrlRect ;       
+                        GetControlBounds( m_macToolHandle , &contrlRect ) ; 
+                        int former_mac_x = contrlRect.left ;
+                        int former_mac_y = contrlRect.top ;
+                        int mac_x = toolrect.left ;
+                        int mac_y = toolrect.top ;
+                        
+                        if ( mac_x != former_mac_x || mac_y != former_mac_y )
                         {
-                            Rect inval = { former_mac_y , former_mac_x , former_mac_y + toolSize.y , former_mac_x + toolSize.y } ;
-                            InvalWindowRect( rootwindow , &inval ) ;
-                        }
-                        UMAMoveControl( m_macToolHandle , mac_x , mac_y ) ;
-                        {
-                            Rect inval = { mac_y , mac_x , mac_y + toolSize.y , mac_x + toolSize.y } ;
-                            InvalWindowRect( rootwindow , &inval ) ;
+                            {
+                                Rect inval = { former_mac_y , former_mac_x , former_mac_y + toolSize.y , former_mac_x + toolSize.y } ;
+                                InvalWindowRect( rootwindow , &inval ) ;
+                            }
+                            UMAMoveControl( m_macToolHandle , mac_x , mac_y ) ;
+                            {
+                                Rect inval = { mac_y , mac_x , mac_y + toolSize.y , mac_x + toolSize.y } ;
+                                InvalWindowRect( rootwindow , &inval ) ;
+                            }
                         }
                     }
+                    
+                    x += (int)toolSize.x;
+                    noButtons ++;
+                }
+                else
+                {
+                    toolcount++ ;
+                    x += (int)toolSize.x / 4;
                 }
+                if ( toolbarrect.left + x + m_xMargin  + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
+                    maxWidth = toolbarrect.left + x  + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
+                if (toolbarrect.top + m_yMargin  + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
+                    maxHeight = toolbarrect.top  + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
                 
-                x += (int)toolSize.x;
-                noButtons ++;
+                node = node->GetNext();
             }
-            else
+        }
+        
+        if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+        {
+            if ( m_maxRows == 0 )
             {
-                toolcount++ ;
-                x += (int)toolSize.x / 4;
+                // if not set yet, only one row
+                SetRows(1);
             }
-            if ( toolbarrect.left + x + m_xMargin  + kwxMacToolBarLeftMargin- m_x - localOrigin.h > maxWidth)
-                maxWidth = toolbarrect.left + x  + kwxMacToolBarLeftMargin+ m_xMargin - m_x - localOrigin.h;
-            if (toolbarrect.top + m_yMargin  + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight)
-                maxHeight = toolbarrect.top  + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ;
-
-            node = node->GetNext();
+            maxWidth = tw ; 
+            maxHeight += toolSize.y;
+            maxHeight += m_yMargin + kwxMacToolBarTopMargin;
+            m_maxHeight = maxHeight ;
         }
+        else
+        {
+            if ( noButtons > 0 && m_maxRows == 0 )
+            {
+                // if not set yet, have one column
+                SetRows(noButtons);
+            }
+            maxHeight = th ;
+            maxWidth += toolSize.x;
+            maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
+            m_maxWidth = maxWidth ;
+        }
+        
+        SetSize(maxWidth, maxHeight);
     }
-
-     if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
-     {
-       if ( m_maxRows == 0 )
-       {
-           // if not set yet, only one row
-           SetRows(1);
-       }
-        maxWidth = tw ; 
-       maxHeight += toolSize.y;
-        maxHeight += m_yMargin + kwxMacToolBarTopMargin;
-        m_maxHeight = maxHeight ;
-     }
-     else
-     {
-       if ( noButtons > 0 && m_maxRows == 0 )
-       {
-           // if not set yet, have one column
-           SetRows(noButtons);
-       }
-       maxHeight = th ;
-       maxWidth += toolSize.x;
-        maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
-        m_maxWidth = maxWidth ;
-     }
-
-     SetSize(maxWidth, maxHeight);
-    }
-
+    
     wxWindow::MacSuperChangedPosition() ;
 }
 
@@ -564,9 +563,9 @@ bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *WXUNUSED(t
 
 void wxToolBar::OnPaint(wxPaintEvent& event)
 {
-  wxPaintDC dc(this) ;
-  wxMacPortSetter helper(&dc) ;
-  
+    wxPaintDC dc(this) ;
+    wxMacPortSetter helper(&dc) ;
+    
     Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , 
         dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
     UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
index 5d072cb098cf8a45ad64630dabe311c1e63700a9..4b00c6f7500684f1761436796ea04c56cd0ca717 100644 (file)
@@ -31,27 +31,27 @@ class wxMacToolTipTimer ;
 
 class wxMacToolTip
 {
-       public :
-               wxMacToolTip( ) ;
-               ~wxMacToolTip() ;
-               
-               void                    Setup( WindowRef window  , wxString text , wxPoint localPosition ) ;
-               long                    GetMark() { return m_mark ; }
-               void                    Draw() ;
-               void                    Clear() ;
-               bool                    IsShown() { return m_shown  ; }
-       private :
-               
-               wxString        m_label ;
-               wxPoint m_position ;
-               Rect                    m_rect ;
-               WindowRef       m_window ;      
-               PicHandle       m_backpict ;
-               bool            m_shown ;
-               long            m_mark ;
-               wxMacToolTipTimer* m_timer ;
+    public :
+        wxMacToolTip( ) ;
+        ~wxMacToolTip() ;
+        
+        void            Setup( WindowRef window  , wxString text , wxPoint localPosition ) ;
+        long            GetMark() { return m_mark ; }
+        void             Draw() ;
+        void            Clear() ;
+        bool            IsShown() { return m_shown  ; }
+    private :
+        
+        wxString    m_label ;
+        wxPoint m_position ;
+        Rect            m_rect ;
+        WindowRef    m_window ;    
+        PicHandle    m_backpict ;
+        bool        m_shown ;
+        long        m_mark ;
+        wxMacToolTipTimer* m_timer ;
 #ifdef TARGET_CARBON
-               CFStringRef m_helpTextRef ;
+        CFStringRef m_helpTextRef ;
 #endif
 } ;
 
@@ -67,8 +67,8 @@ public:
             m_tip->Draw() ;    
     }
 protected:
-    wxMacToolTip*      m_tip;
-    long               m_mark ;
+    wxMacToolTip*     m_tip;
+    long        m_mark ;
 };
 
 //-----------------------------------------------------------------------------
@@ -95,16 +95,16 @@ wxToolTip::~wxToolTip()
 
 void wxToolTip::SetTip( const wxString &tip )
 {
-     m_text = tip;
-
+    m_text = tip;
+    
     if ( m_window )
     {
-       /*
-        // update it immediately
-        wxToolInfo ti(GetHwndOf(m_window));
-        ti.lpszText = (wxChar *)m_text.c_str();
-
-        (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
+    /*
+    // update it immediately
+    wxToolInfo ti(GetHwndOf(m_window));
+    ti.lpszText = (wxChar *)m_text.c_str();
+    
+      (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
         */
     }
 }
@@ -116,94 +116,94 @@ void wxToolTip::SetWindow( wxWindow *win )
 
 void wxToolTip::Enable( bool flag )
 {
-       if ( s_ShowToolTips != flag )
-       {
-               s_ShowToolTips = flag ;
-               if ( s_ShowToolTips )
-               {
-               }
-               else
-               {
-                       s_ToolTip.Clear() ;
-               }
-       }
+    if ( s_ShowToolTips != flag )
+    {
+        s_ShowToolTips = flag ;
+        if ( s_ShowToolTips )
+        {
+        }
+        else
+        {
+            s_ToolTip.Clear() ;
+        }
+    }
 }
 
 void wxToolTip::SetDelay( long msecs )
 {
-       s_ToolTipDelay = msecs ;
+    s_ToolTipDelay = msecs ;
 }
 
 void wxToolTip::RelayEvent( wxWindow *win , wxMouseEvent &event )
 {
-       if ( s_ShowToolTips )
-       {
-               if ( event.GetEventType() == wxEVT_LEAVE_WINDOW )
-               {
-                       s_ToolTip.Clear() ;
-               }
-               else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION )
-               {
-                       wxPoint2DInt where( event.m_x , event.m_y ) ;
-                       if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) )
-                       {
-                       }
-                       else
-                       {
-                               s_ToolTip.Clear() ;
-                               s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
-                               s_LastWindowEntered = win ;
-                               
-                               WindowRef window = MAC_WXHWND( win->MacGetRootWindow() ) ;
-                               int x = event.m_x ;
-                               int y = event.m_y ;
-                               wxPoint local( x , y ) ;
-                               win->MacClientToRootWindow( &x, &y ) ;
-                               wxPoint windowlocal( x , y ) ;
-                               s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ;
-                       }
-               }
-       }
+    if ( s_ShowToolTips )
+    {
+        if ( event.GetEventType() == wxEVT_LEAVE_WINDOW )
+        {
+            s_ToolTip.Clear() ;
+        }
+        else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION )
+        {
+            wxPoint2DInt where( event.m_x , event.m_y ) ;
+            if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) )
+            {
+            }
+            else
+            {
+                s_ToolTip.Clear() ;
+                s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
+                s_LastWindowEntered = win ;
+                
+                WindowRef window = MAC_WXHWND( win->MacGetRootWindow() ) ;
+                int x = event.m_x ;
+                int y = event.m_y ;
+                wxPoint local( x , y ) ;
+                win->MacClientToRootWindow( &x, &y ) ;
+                wxPoint windowlocal( x , y ) ;
+                s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ;
+            }
+        }
+    }
 }
 
 void wxToolTip::RemoveToolTips()
 {
-       s_ToolTip.Clear() ;
+    s_ToolTip.Clear() ;
 }
 // --- mac specific
 
 wxMacToolTipTimer::wxMacToolTipTimer( wxMacToolTip *tip , int msec )
 {
-       m_tip = tip;
-       m_mark = tip->GetMark() ;
-       Start(msec, true);
+    m_tip = tip;
+    m_mark = tip->GetMark() ;
+    Start(msec, true);
 }
 
 wxMacToolTip::wxMacToolTip()
 {
-       m_window = NULL ;
-       m_backpict = NULL ;
-       m_mark = 0 ;
-       m_shown = false ;
+    m_window = NULL ;
+    m_backpict = NULL ;
+    m_mark = 0 ;
+    m_shown = false ;
     m_timer = NULL ;
     m_helpTextRef = NULL ;
 }
 
 void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition ) 
 {
-       m_mark++ ;
-       Clear() ;
-       m_position = localPosition ;
+    m_mark++ ;
+    Clear() ;
+    m_position = localPosition ;
     if( wxApp::s_macDefaultEncodingIsPC )
         m_label = wxMacMakeMacStringFromPC( text ) ;
-       else
+     else
         m_label = text ;
     m_window =win;
-       s_ToolTipWindowRef = m_window ;
-       m_backpict = NULL ;
-       if ( m_timer )
-           delete m_timer ;
-       m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
+    s_ToolTipWindowRef = m_window ;
+    m_backpict = NULL ;
+    if ( m_timer )
+        delete m_timer ;
+    m_timer = new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
 }
 
 wxMacToolTip::~wxMacToolTip() 
@@ -221,257 +221,257 @@ const short kTipOffset = 5 ;
 
 void wxMacToolTip::Draw()
 {
-       if ( m_label.Length() == 0 )
-               return ;
-               
-       if ( m_window == s_ToolTipWindowRef )
-       {
-               m_shown = true ;
+    if ( m_label.Length() == 0 )
+        return ;
+    
+    if ( m_window == s_ToolTipWindowRef )
+    {
+        m_shown = true ;
 #if TARGET_CARBON
-         if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
-         {
-               HMHelpContentRec tag ;
-               tag.version = kMacHelpVersion;
-               SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
-        GrafPtr port ;
-        GetPort( &port ) ;
-        SetPortWindowPort(m_window) ;
-               LocalToGlobal( (Point *) &tag.absHotRect.top );
-               LocalToGlobal( (Point *) &tag.absHotRect.bottom );
-               SetPort( port );
-               if( m_helpTextRef )
-               {
-                       CFRelease( m_helpTextRef ) ;
-                       m_helpTextRef = NULL ;
-               }
-               m_helpTextRef = wxMacCreateCFString(m_label) ;
-               tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
-               tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
-               tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
-               tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
-               tag.tagSide = kHMDefaultSide;
-               HMDisplayTag( &tag );
-         }
-         else
+        if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
+        {
+            HMHelpContentRec tag ;
+            tag.version = kMacHelpVersion;
+            SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
+            GrafPtr port ;
+            GetPort( &port ) ;
+            SetPortWindowPort(m_window) ;
+            LocalToGlobal( (Point *) &tag.absHotRect.top );
+            LocalToGlobal( (Point *) &tag.absHotRect.bottom );
+            SetPort( port );
+            if( m_helpTextRef )
+            {
+                CFRelease( m_helpTextRef ) ;
+                m_helpTextRef = NULL ;
+            }
+            m_helpTextRef = wxMacCreateCFString(m_label) ;
+            tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
+            tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
+            tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
+            tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
+            tag.tagSide = kHMDefaultSide;
+            HMDisplayTag( &tag );
+        }
+        else
 #endif
-         {
-               wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
-#if TARGET_CARBON      
-               bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-#endif         
-
-        FontFamilyID fontId ;
-        Str255 fontName ;
-        SInt16 fontSize ;
-        Style fontStyle ;
-        GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
-        GetFNum( fontName, &fontId );
-
-               TextFont( fontId ) ;
-               TextSize( fontSize ) ;
-               TextFace( fontStyle ) ;
-               FontInfo fontInfo;
-               ::GetFontInfo(&fontInfo);
-               short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
-               short height = 0 ;
-       //      short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
-               
-               int i = 0 ;
-               int length = m_label.Length() ;
-               int width = 0 ;
-               int thiswidth = 0 ;
-               int laststop = 0 ;
-               const char *text = m_label ;
-               while( i < length )
-               {
-                       if( text[i] == 13 || text[i] == 10)
-                       {
-                               thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
-                               if ( thiswidth > width )
-                                       width = thiswidth ;
-                                       
-                               height += lineh ;
-                               laststop = i+1 ;
-                       }
-                       i++ ;
-               }
-               if ( i - laststop > 0 )
-               {
-                       thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
-                       if ( thiswidth > width )
-                               width = thiswidth ;
-                       height += lineh ;
-               }
-
-
-               m_rect.left = m_position.x + kTipOffset;
-               m_rect.top = m_position.y + kTipOffset;
-               m_rect.right = m_rect.left + width + 2 * kTipBorder;
-#if TARGET_CARBON      
-               if ( useDrawThemeText )
-                   m_rect.right += kTipBorder ;
+        {
+            wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
+#if TARGET_CARBON    
+            bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
+#endif        
+            
+            FontFamilyID fontId ;
+            Str255 fontName ;
+            SInt16 fontSize ;
+            Style fontStyle ;
+            GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+            GetFNum( fontName, &fontId );
+            
+            TextFont( fontId ) ;
+            TextSize( fontSize ) ;
+            TextFace( fontStyle ) ;
+            FontInfo fontInfo;
+            ::GetFontInfo(&fontInfo);
+            short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
+            short height = 0 ;
+            //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
+            
+            int i = 0 ;
+            int length = m_label.Length() ;
+            int width = 0 ;
+            int thiswidth = 0 ;
+            int laststop = 0 ;
+            const char *text = m_label ;
+            while( i < length )
+            {
+                if( text[i] == 13 || text[i] == 10)
+                {
+                    thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
+                    if ( thiswidth > width )
+                        width = thiswidth ;
+                    
+                    height += lineh ;
+                    laststop = i+1 ;
+                }
+                i++ ;
+            }
+            if ( i - laststop > 0 )
+            {
+                thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
+                if ( thiswidth > width )
+                    width = thiswidth ;
+                height += lineh ;
+            }
+            
+            
+            m_rect.left = m_position.x + kTipOffset;
+            m_rect.top = m_position.y + kTipOffset;
+            m_rect.right = m_rect.left + width + 2 * kTipBorder;
+#if TARGET_CARBON    
+            if ( useDrawThemeText )
+                m_rect.right += kTipBorder ;
 #endif
-               m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
-               Rect r ;
-               GetPortBounds( GetWindowPort( m_window ) , &r ) ;
-               if ( m_rect.top < 0 )
-               {
-                   m_rect.bottom += -m_rect.top ;
-                   m_rect.top = 0 ;
-               }
-               if ( m_rect.left < 0 )
-               {
-                   m_rect.right += -m_rect.left ;
-                   m_rect.left = 0 ;
-               }
-               if ( m_rect.right > r.right )
-               {
-                   m_rect.left -= (m_rect.right - r.right ) ;
-                   m_rect.right = r.right ;
-               }
-               if ( m_rect.bottom > r.bottom )
-               {
-                   m_rect.top -= (m_rect.bottom - r.bottom) ;
-                   m_rect.bottom = r.bottom ;
-               }
-               ClipRect( &m_rect ) ;
-               BackColor( whiteColor ) ;
-               ForeColor(blackColor ) ;
-        GWorldPtr port ;               
-        NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
-        CGrafPtr    origPort ;
-        GDHandle    origDevice ;
-
-        GetGWorld( &origPort , &origDevice ) ;
-        SetGWorld( port , NULL ) ;
-           
-               m_backpict = OpenPicture(&m_rect);
-
-               CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
-                                  GetPortBitMapForCopyBits(port), 
-                                  &m_rect, 
-                                  &m_rect, 
-                                  srcCopy, 
-                                  NULL);
-                ClosePicture();
-                SetGWorld( origPort , origDevice ) ;
-               DisposeGWorld( port ) ;
-                PenNormal() ;
-
-               RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
-               BackColor( whiteColor ) ;
-                RGBForeColor( &tooltipbackground ) ;
-
-               PaintRect( &m_rect ) ;
-               ForeColor(blackColor ) ;
-               FrameRect( &m_rect ) ;
-               SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
-               ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
-
-               i = 0 ;
-               laststop = 0 ;
-               height = 0 ;
-               
-               while( i < length )
-               {
-                       if( text[i] == 13 || text[i] == 10)
-                       {
+            m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
+            Rect r ;
+            GetPortBounds( GetWindowPort( m_window ) , &r ) ;
+            if ( m_rect.top < 0 )
+            {
+                m_rect.bottom += -m_rect.top ;
+                m_rect.top = 0 ;
+            }
+            if ( m_rect.left < 0 )
+            {
+                m_rect.right += -m_rect.left ;
+                m_rect.left = 0 ;
+            }
+            if ( m_rect.right > r.right )
+            {
+                m_rect.left -= (m_rect.right - r.right ) ;
+                m_rect.right = r.right ;
+            }
+            if ( m_rect.bottom > r.bottom )
+            {
+                m_rect.top -= (m_rect.bottom - r.bottom) ;
+                m_rect.bottom = r.bottom ;
+            }
+            ClipRect( &m_rect ) ;
+            BackColor( whiteColor ) ;
+            ForeColor(blackColor ) ;
+            GWorldPtr port ;            
+            NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
+            CGrafPtr    origPort ;
+            GDHandle    origDevice ;
+            
+            GetGWorld( &origPort , &origDevice ) ;
+            SetGWorld( port , NULL ) ;
+            
+            m_backpict = OpenPicture(&m_rect);
+            
+            CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
+                GetPortBitMapForCopyBits(port), 
+                &m_rect, 
+                &m_rect, 
+                srcCopy, 
+                NULL);
+            ClosePicture();
+            SetGWorld( origPort , origDevice ) ;
+            DisposeGWorld( port ) ;
+            PenNormal() ;
+            
+            RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
+            BackColor( whiteColor ) ;
+            RGBForeColor( &tooltipbackground ) ;
+            
+            PaintRect( &m_rect ) ;
+            ForeColor(blackColor ) ;
+            FrameRect( &m_rect ) ;
+            SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
+            ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
+            
+            i = 0 ;
+            laststop = 0 ;
+            height = 0 ;
+            
+            while( i < length )
+            {
+                if( text[i] == 13 || text[i] == 10)
+                {
 #if TARGET_CARBON
-               if ( useDrawThemeText )
-               {
-                   Rect frame ;
-                   frame.top = m_rect.top + kTipBorder + height ;
-                   frame.left = m_rect.left + kTipBorder ;
-                   frame.bottom = frame.top + 1000 ;
-                   frame.right = frame.left + 1000 ;
-                    CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                       ::DrawThemeTextBox( mString,
-                                                               kThemeCurrentPortFont,
-                                                               kThemeStateActive,
-                                                               true,
-                                                               &frame,
-                                                               teJustLeft,
-                                                               nil );
-                   CFRelease( mString ) ;
-                                   height += lineh ;
-               }
-                else
+                    if ( useDrawThemeText )
+                    {
+                        Rect frame ;
+                        frame.top = m_rect.top + kTipBorder + height ;
+                        frame.left = m_rect.left + kTipBorder ;
+                        frame.bottom = frame.top + 1000 ;
+                        frame.right = frame.left + 1000 ;
+                        CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+                        ::DrawThemeTextBox( mString,
+                            kThemeCurrentPortFont,
+                            kThemeStateActive,
+                            true,
+                            &frame,
+                            teJustLeft,
+                            nil );
+                        CFRelease( mString ) ;
+                        height += lineh ;
+                    }
+                    else
 #endif
-                {
-                                   ::DrawText( text , laststop , i - laststop ) ;
-                                   height += lineh ;
-                                   ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
-                               }
-                               laststop = i+1 ;
-                       }
-                       i++ ;
-               }
+                    {
+                        ::DrawText( text , laststop , i - laststop ) ;
+                        height += lineh ;
+                        ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
+                    }
+                    laststop = i+1 ;
+                }
+                i++ ;
+            }
 #if TARGET_CARBON
-        if ( useDrawThemeText )
-        {
-            Rect frame ;
-            frame.top = m_rect.top + kTipBorder + height ;
-            frame.left = m_rect.left + kTipBorder ;
-            frame.bottom = frame.top + 1000 ;
-            frame.right = frame.left + 1000 ;
-            CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
-               ::DrawThemeTextBox( mString,
-                                                       kThemeCurrentPortFont,
-                                                       kThemeStateActive,
-                                                       true,
-                                                       &frame,
-                                                       teJustLeft,
-                                                       nil );
-            CFRelease( mString ) ;
-        }
-        else
+            if ( useDrawThemeText )
+            {
+                Rect frame ;
+                frame.top = m_rect.top + kTipBorder + height ;
+                frame.left = m_rect.left + kTipBorder ;
+                frame.bottom = frame.top + 1000 ;
+                frame.right = frame.left + 1000 ;
+                CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
+                ::DrawThemeTextBox( mString,
+                    kThemeCurrentPortFont,
+                    kThemeStateActive,
+                    true,
+                    &frame,
+                    teJustLeft,
+                    nil );
+                CFRelease( mString ) ;
+            }
+            else
 #endif
-        {
-                   ::DrawText( text , laststop , i - laststop ) ;
-               }
-               ::TextMode( srcOr ) ;           
-        }
-       }
+            {
+                ::DrawText( text , laststop , i - laststop ) ;
+            }
+            ::TextMode( srcOr ) ;        
+       }
+    }
 }
 
 void wxToolTip::NotifyWindowDelete( WXHWND win ) 
 {
-       if ( win == s_ToolTipWindowRef )
-       {
-               s_ToolTipWindowRef = NULL ;
-       }
+    if ( win == s_ToolTipWindowRef )
+    {
+        s_ToolTipWindowRef = NULL ;
+    }
 }
 
 void wxMacToolTip::Clear()
 {
-       m_mark++ ;
-       if ( m_timer )
-       {
-           delete m_timer ;
-           m_timer = NULL ;
-       }
-       if ( !m_shown )
-               return ;
+    m_mark++ ;
+    if ( m_timer )
+    {
+        delete m_timer ;
+        m_timer = NULL ;
+    }
+    if ( !m_shown )
+        return ;
 #if TARGET_CARBON
-       HMHideTag() ;
-       if( m_helpTextRef )
-       {
-               CFRelease( m_helpTextRef ) ;
-               m_helpTextRef = NULL ;
-       }
-#else           
-       if ( m_window == s_ToolTipWindowRef && m_backpict )
-       {
-               wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;
+    HMHideTag() ;
+    if( m_helpTextRef )
+    {
+        CFRelease( m_helpTextRef ) ;
+        m_helpTextRef = NULL ;
+    }
+#else         
+    if ( m_window == s_ToolTipWindowRef && m_backpict )
+    {
+        wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;
 
-               m_shown = false ;
+        m_shown = false ;
 
-               BackColor( whiteColor ) ;
-               ForeColor(blackColor ) ;
-               DrawPicture(m_backpict, &m_rect);
-               KillPicture(m_backpict);
-               m_backpict = NULL ;
-       }
+        BackColor( whiteColor ) ;
+        ForeColor(blackColor ) ;
+        DrawPicture(m_backpict, &m_rect);
+        KillPicture(m_backpict);
+        m_backpict = NULL ;
+    }
 #endif
 }
 
index d053a98ab1dfc60563751936499d461223016f40..76051b7079177bb9f124a7831b97abd0f5727451 100644 (file)
@@ -75,7 +75,7 @@ static const EventTypeSpec eventList[] =
 {
     { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
 
-       { kEventClassKeyboard, kEventRawKeyDown } ,
+    { kEventClassKeyboard, kEventRawKeyDown } ,
     { kEventClassKeyboard, kEventRawKeyRepeat } ,
     { kEventClassKeyboard, kEventRawKeyUp } ,
     { kEventClassKeyboard, kEventRawKeyModifiersChanged } ,
@@ -99,34 +99,34 @@ static pascal OSStatus TextInputEventHandler( EventHandlerCallRef handler , Even
     OSStatus result = eventNotHandledErr ;
 
     wxWindow* focus = wxWindow::FindFocus() ;
-       char charCode ;
-       UInt32 keyCode ;        
+    char charCode ;
+    UInt32 keyCode ;    
     UInt32 modifiers ;
-       Point point ;
-       UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
+    Point point ;
+    UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
 
     EventRef rawEvent ;
     
     GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ;
     
-       GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
-       GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
-       GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
-       GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL,
-               sizeof( Point ), NULL, &point );
-
-       UInt32 message = (keyCode << 8) + charCode;
-
-       switch ( GetEventKind( event ) )
-       {
-               case kEventTextInputUnicodeForKeyEvent :
-               if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
-                       focus , message , modifiers , when , point.h , point.v ) )
-               {
-                   result = noErr ;
-               }
-                       break ;
-       }
+    GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
+    GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
+       GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL,
+        sizeof( Point ), NULL, &point );
+
+    UInt32 message = (keyCode << 8) + charCode;
+
+    switch ( GetEventKind( event ) )
+    {
+        case kEventTextInputUnicodeForKeyEvent :
+            if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
+                focus , message , modifiers , when , point.h , point.v ) )
+            {
+                result = noErr ;
+            }
+            break ;
+    }
 
     return result ;
 }
@@ -136,73 +136,73 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
     OSStatus result = eventNotHandledErr ;
 
     wxWindow* focus = wxWindow::FindFocus() ;
-       char charCode ;
-       UInt32 keyCode ;        
+    char charCode ;
+    UInt32 keyCode ;    
     UInt32 modifiers ;
-       Point point ;
-       UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
-
-       GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
-       GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
-       GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
-       GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
-               sizeof( Point ), NULL, &point );
-
-       UInt32 message = (keyCode << 8) + charCode;
-       switch( GetEventKind( event ) )
-       {
-               case kEventRawKeyRepeat :
-               case kEventRawKeyDown :
-               if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
-                       focus , message , modifiers , when , point.h , point.v ) )
-               {
-                   result = noErr ;
-               }
-                       break ;
-               case kEventRawKeyUp :
-               if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent( 
-                       focus , message , modifiers , when , point.h , point.v ) )
-               {
-                   result = noErr ;
-               }
-                       break ;
-               case kEventRawKeyModifiersChanged :
-                       {
-                       wxKeyEvent event(wxEVT_KEY_DOWN);
-
-                       event.m_shiftDown = modifiers & shiftKey;
-                       event.m_controlDown = modifiers & controlKey;
-                       event.m_altDown = modifiers & optionKey;
-                       event.m_metaDown = modifiers & cmdKey;
-
-                       event.m_x = point.h;
-                       event.m_y = point.v;
-                       event.m_timeStamp = when;
-                       wxWindow* focus = wxWindow::FindFocus() ;
-                       event.SetEventObject(focus);
-
-                       if ( (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
-                       {
-                           event.m_keyCode = WXK_CONTROL ;
-                           event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
-                           focus->GetEventHandler()->ProcessEvent( event ) ;
-                       }
-                       if ( (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
-                       {
-                           event.m_keyCode = WXK_SHIFT ;
-                           event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
-                           focus->GetEventHandler()->ProcessEvent( event ) ;
-                       }
-                       if ( (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
-                       {
-                           event.m_keyCode = WXK_ALT ;
-                           event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
-                           focus->GetEventHandler()->ProcessEvent( event ) ;
-                       }
-                       wxTheApp->s_lastModifiers = modifiers ;
-                   }
-                       break ;
-       }
+    Point point ;
+    UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ;
+
+    GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
+    GetEventParameter( event, kEventParamKeyCode, typeUInt32, NULL,  sizeof(UInt32), NULL, &keyCode );
+       GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
+    GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
+        sizeof( Point ), NULL, &point );
+
+    UInt32 message = (keyCode << 8) + charCode;
+    switch( GetEventKind( event ) )
+    {
+        case kEventRawKeyRepeat :
+        case kEventRawKeyDown :
+            if ( (focus != NULL) && wxTheApp->MacSendKeyDownEvent( 
+                focus , message , modifiers , when , point.h , point.v ) )
+            {
+                result = noErr ;
+            }
+            break ;
+        case kEventRawKeyUp :
+            if ( (focus != NULL) && wxTheApp->MacSendKeyUpEvent( 
+                focus , message , modifiers , when , point.h , point.v ) )
+            {
+                result = noErr ;
+            }
+            break ;
+        case kEventRawKeyModifiersChanged :
+            {
+                wxKeyEvent event(wxEVT_KEY_DOWN);
+
+                event.m_shiftDown = modifiers & shiftKey;
+                event.m_controlDown = modifiers & controlKey;
+                event.m_altDown = modifiers & optionKey;
+                event.m_metaDown = modifiers & cmdKey;
+
+                event.m_x = point.h;
+                event.m_y = point.v;
+                event.m_timeStamp = when;
+                wxWindow* focus = wxWindow::FindFocus() ;
+                event.SetEventObject(focus);
+
+                if ( (modifiers ^ wxTheApp->s_lastModifiers ) & controlKey )
+                {
+                    event.m_keyCode = WXK_CONTROL ;
+                    event.SetEventType( ( modifiers & controlKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( (modifiers ^ wxTheApp->s_lastModifiers ) & shiftKey )
+                {
+                    event.m_keyCode = WXK_SHIFT ;
+                    event.SetEventType( ( modifiers & shiftKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                if ( (modifiers ^ wxTheApp->s_lastModifiers ) & optionKey )
+                {
+                    event.m_keyCode = WXK_ALT ;
+                    event.SetEventType( ( modifiers & optionKey ) ? wxEVT_KEY_DOWN : wxEVT_KEY_UP ) ;
+                    focus->GetEventHandler()->ProcessEvent( event ) ;
+                }
+                wxTheApp->s_lastModifiers = modifiers ;
+            }
+             break ;
+    }
 
     return result ;
 }
@@ -211,54 +211,54 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
 {
     OSStatus result = eventNotHandledErr ;
 
-       wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
-       Point point ;
-       UInt32 modifiers = 0;
-       EventMouseButton button = 0 ;
-       UInt32 click = 0 ;
-       
-       GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
-               sizeof( Point ), NULL, &point );
-       GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL,
-               sizeof( UInt32 ), NULL, &modifiers );
-       GetEventParameter( event, kEventParamMouseButton, typeMouseButton, NULL,
-               sizeof( EventMouseButton ), NULL, &button );
-       GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL,
-               sizeof( UInt32 ), NULL, &click );
-               
-       if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
-               modifiers += btnState ;
-       
-       WindowRef window ;
+    wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
+    Point point ;
+    UInt32 modifiers = 0;
+    EventMouseButton button = 0 ;
+    UInt32 click = 0 ;
+    
+    GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
+        sizeof( Point ), NULL, &point );
+    GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, NULL,
+        sizeof( UInt32 ), NULL, &modifiers );
+    GetEventParameter( event, kEventParamMouseButton, typeMouseButton, NULL,
+        sizeof( EventMouseButton ), NULL, &button );
+    GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL,
+        sizeof( UInt32 ), NULL, &click );
+        
+    if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
+        modifiers += btnState ;
+    
+    WindowRef window ;
     short windowPart = ::FindWindow(point, &window);
 
-       if ( IsWindowActive(window) && windowPart == inContent )
+    if ( IsWindowActive(window) && windowPart == inContent )
     {
-               switch ( GetEventKind( event ) )
-               {
-                       case kEventMouseDown :
-                               toplevelWindow->MacFireMouseEvent( mouseDown , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       case kEventMouseUp :
-                               toplevelWindow->MacFireMouseEvent( mouseUp , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       case kEventMouseMoved :
-                               toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       case kEventMouseDragged :
-                               toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
-                               result = noErr ;
-                               break ;
-                       default :
-                               break ;
-               }
-       }
-       
-       return result ;
-       
+        switch ( GetEventKind( event ) )
+        {
+            case kEventMouseDown :
+                toplevelWindow->MacFireMouseEvent( mouseDown , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            case kEventMouseUp :
+                toplevelWindow->MacFireMouseEvent( mouseUp , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            case kEventMouseMoved :
+                toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            case kEventMouseDragged :
+                toplevelWindow->MacFireMouseEvent( nullEvent , point.h , point.v , modifiers , EventTimeToTicks( GetEventTime( event ) ) ) ;
+                result = noErr ;
+                break ;
+            default :
+                break ;
+        }
+    }
+    
+    return result ;
+    
 
 }
 static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
@@ -266,53 +266,53 @@ static pascal OSStatus WindowEventHandler( EventHandlerCallRef handler , EventRe
     OSStatus result = eventNotHandledErr ;
     OSStatus err = noErr ;
 
-       UInt32          attributes;
-       WindowRef windowRef ;
-       wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
-       
-       GetEventParameter( event, kEventParamDirectObject, typeWindowRef, NULL,
-               sizeof( WindowRef ), NULL, &windowRef );
-               
-       switch( GetEventKind( event ) )
-       {
-               case kEventWindowUpdate :
-               if ( !wxPendingDelete.Member(toplevelWindow) )
-                               toplevelWindow->MacUpdate( EventTimeToTicks( GetEventTime( event ) ) ) ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowActivated :
-                               toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , true) ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowDeactivated :
-                               toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , false) ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowClose :
-               toplevelWindow->Close() ;
-                       result = noErr ;
-                       break ;
-               case kEventWindowBoundsChanged :
-                       err = GetEventParameter( event, kEventParamAttributes, typeUInt32,
-                                               NULL, sizeof( UInt32 ), NULL, &attributes );
-                       if ( err == noErr )
-                       {
-                               Rect newContentRect ;
-
-                               GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
-                                       sizeof( newContentRect ), NULL, &newContentRect );
-                               
+    UInt32        attributes;
+    WindowRef windowRef ;
+    wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
+    
+    GetEventParameter( event, kEventParamDirectObject, typeWindowRef, NULL,
+        sizeof( WindowRef ), NULL, &windowRef );
+        
+    switch( GetEventKind( event ) )
+    {
+        case kEventWindowUpdate :
+            if ( !wxPendingDelete.Member(toplevelWindow) )
+                toplevelWindow->MacUpdate( EventTimeToTicks( GetEventTime( event ) ) ) ;
+            result = noErr ;
+            break ;
+        case kEventWindowActivated :
+                toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , true) ;
+            result = noErr ;
+            break ;
+        case kEventWindowDeactivated :
+                toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , false) ;
+            result = noErr ;
+            break ;
+        case kEventWindowClose :
+                toplevelWindow->Close() ;
+            result = noErr ;
+            break ;
+        case kEventWindowBoundsChanged :
+            err = GetEventParameter( event, kEventParamAttributes, typeUInt32,
+                        NULL, sizeof( UInt32 ), NULL, &attributes );
+            if ( err == noErr )
+            {
+                Rect newContentRect ;
+
+                GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL,
+                    sizeof( newContentRect ), NULL, &newContentRect );
+                
                 toplevelWindow->SetSize( newContentRect.left , newContentRect.top , 
                     newContentRect.right - newContentRect.left , 
                     newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
 
-                               result = noErr;
-                       }
-                       break ;
-               default :
-                       break ;
-       }
-       return result ;
+                result = noErr;
+            }
+            break ;
+        default :
+            break ;
+    }
+    return result ;
 }
 
 pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
@@ -322,17 +322,17 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef
     switch ( GetEventClass( event ) )
     {
         case kEventClassKeyboard :
-               result = KeyboardEventHandler( handler, event , data ) ;
+            result = KeyboardEventHandler( handler, event , data ) ;
             break ;
         case kEventClassTextInput :
-               result = TextInputEventHandler( handler, event , data ) ;
+            result = TextInputEventHandler( handler, event , data ) ;
             break ;
         case kEventClassWindow :
-               result = WindowEventHandler( handler, event , data ) ;
-               break ;
+            result = WindowEventHandler( handler, event , data ) ;
+            break ;
         case kEventClassMouse :
-               result = MouseEventHandler( handler, event , data ) ;
-               break ;
+            result = MouseEventHandler( handler, event , data ) ;
+            break ;
         default :
             break ;
     }
@@ -503,32 +503,32 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
            long style,
            const wxString& name ) 
 {
-  SetName(name);
-  m_windowStyle = style;
-  m_isShown = FALSE;
-
-  // create frame.
-
+    SetName(name);
+    m_windowStyle = style;
+    m_isShown = FALSE;
+    
+    // create frame.
+    
     Rect theBoundsRect;
-
-  m_x = (int)pos.x;
-  m_y = (int)pos.y;
-  if ( m_y < 50 )
-    m_y = 50 ;
-  if ( m_x < 20 )
-    m_x = 20 ;
     
-  m_width = size.x;
+    m_x = (int)pos.x;
+    m_y = (int)pos.y;
+    if ( m_y < 50 )
+        m_y = 50 ;
+    if ( m_x < 20 )
+        m_x = 20 ;
+    
+    m_width = size.x;
     if (m_width == -1) 
         m_width = 20;
-  m_height = size.y;
+    m_height = size.y;
     if (m_height == -1) 
         m_height = 20;
-
+    
     ::SetRect(&theBoundsRect, m_x, m_y , m_x + m_width, m_y + m_height);
-
+    
     // translate the window attributes in the appropriate window class and attributes
-
+    
     WindowClass wclass = 0;
     WindowAttributes attr = kWindowNoAttributes ;
     
@@ -538,7 +538,7 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
             HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
             HasFlag( wxSYSTEM_MENU ) || HasFlag( wxCAPTION ) ||
             HasFlag(wxTINY_CAPTION_HORIZ) ||  HasFlag(wxTINY_CAPTION_VERT)
-             )
+            )
         {
             wclass = kFloatingWindowClass ;
             if ( HasFlag(wxTINY_CAPTION_VERT) )
@@ -557,12 +557,12 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     }
     else if ( HasFlag( wxCAPTION ) )
     {
-       wclass = kDocumentWindowClass ; 
+        wclass = kDocumentWindowClass ; 
     }
     else
     {
         if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
-             HasFlag( wxSYSTEM_MENU ) )
+            HasFlag( wxSYSTEM_MENU ) )
         {
             wclass = kDocumentWindowClass ;
         }
@@ -600,9 +600,9 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     UMASetWTitleC( (WindowRef)m_macWindow , label ) ;
     ::CreateRootControl( (WindowRef)m_macWindow , (ControlHandle*)&m_macRootControl ) ;
 #if TARGET_CARBON
-       InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
-       InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(), 
-               GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));    
+    InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
+    InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacWindowEventHandlerUPP(), 
+        GetEventTypeCount(eventList), eventList, this, &((EventHandlerRef)m_macEventHandler));    
 #endif
     m_macFocus = NULL ;
 }
@@ -621,7 +621,7 @@ void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR cli
 
 void wxTopLevelWindowMac::Clear()
 {
-  wxWindow::Clear() ;
+    wxWindow::Clear() ;
 }
 
 WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding() 
@@ -632,7 +632,6 @@ WXWidget wxTopLevelWindowMac::MacGetContainerForEmbedding()
 
 void wxTopLevelWindowMac::MacUpdate( long timestamp)
 {
-
     wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
 
     BeginUpdate( (WindowRef)m_macWindow ) ;
@@ -671,7 +670,7 @@ void wxTopLevelWindowMac::Lower()
 }
 
 void wxTopLevelWindowMac::MacFireMouseEvent( 
-       wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp )
+    wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp )
 {
     wxMouseEvent event(wxEVT_LEFT_DOWN);
     bool isDown = !(modifiers & btnState) ; // 1 is for up
@@ -770,12 +769,13 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
         MacDispatchMouseEvent( event ) ;
     }
 }
+
 #if !TARGET_CARBON
 
 void wxTopLevelWindowMac::MacMouseDown( WXEVENTREF ev , short part)
 {
     MacFireMouseEvent( mouseDown , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
-       ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
+        ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
 }
 
 void wxTopLevelWindowMac::MacMouseUp( WXEVENTREF ev , short part)
@@ -784,8 +784,8 @@ void wxTopLevelWindowMac::MacMouseUp( WXEVENTREF ev , short part)
     {
         case inContent:     
             {
-                           MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
-                               ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
+                MacFireMouseEvent( mouseUp , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
+                    ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
             }
             break ;
     }
@@ -797,8 +797,8 @@ void wxTopLevelWindowMac::MacMouseMoved( WXEVENTREF ev , short part)
     {
         case inContent:     
             {
-                           MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
-                               ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
+                MacFireMouseEvent( nullEvent /*moved*/ , ((EventRecord*)ev)->where.h , ((EventRecord*)ev)->where.v , 
+                    ((EventRecord*)ev)->modifiers , ((EventRecord*)ev)->when ) ;
             }
             break ;
     }
@@ -886,11 +886,11 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
     int former_w = m_width ;
     int former_h = m_height ;
     
-  int actualWidth = width;
-  int actualHeight = height;
-  int actualX = x;
-  int actualY = y;
-  
+    int actualWidth = width;
+    int actualHeight = height;
+    int actualX = x;
+    int actualY = y;
+    
     if ((m_minWidth != -1) && (actualWidth < m_minWidth)) 
         actualWidth = m_minWidth;
     if ((m_minHeight != -1) && (actualHeight < m_minHeight)) 
@@ -977,51 +977,51 @@ void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
  
 void wxTopLevelWindowMac::MacInvalidate( const WXRECTPTR rect, bool eraseBackground ) 
 {
-  GrafPtr formerPort ;
-  GetPort( &formerPort ) ;
-  SetPortWindowPort( (WindowRef)m_macWindow ) ;
-  
-  m_macNeedsErasing |= eraseBackground ;
-  
-  // if we already know that we will have to erase, there's no need to track the rest
-  if ( !m_macNeedsErasing)
-  {
-    // we end only here if eraseBackground is false
-    // if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
-    // we will have to erase anyway
-      
-    RgnHandle       updateRgn = NewRgn();    
-    RgnHandle       diffRgn = NewRgn() ;
-    if ( updateRgn && diffRgn )
+    GrafPtr formerPort ;
+    GetPort( &formerPort ) ;
+    SetPortWindowPort( (WindowRef)m_macWindow ) ;
+    
+    m_macNeedsErasing |= eraseBackground ;
+    
+    // if we already know that we will have to erase, there's no need to track the rest
+    if ( !m_macNeedsErasing)
     {
-        GetWindowUpdateRgn( (WindowRef)m_macWindow , updateRgn );
-        Point pt = {0,0} ;
-        LocalToGlobal( &pt ) ;
-        OffsetRgn( updateRgn , -pt.h , -pt.v ) ;
-        DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
-        if ( !EmptyRgn( diffRgn ) )
+        // we end only here if eraseBackground is false
+        // if we already have a difference between m_macNoEraseUpdateRgn and UpdateRgn
+        // we will have to erase anyway
+        
+        RgnHandle       updateRgn = NewRgn();    
+        RgnHandle       diffRgn = NewRgn() ;
+        if ( updateRgn && diffRgn )
+        {
+            GetWindowUpdateRgn( (WindowRef)m_macWindow , updateRgn );
+            Point pt = {0,0} ;
+            LocalToGlobal( &pt ) ;
+            OffsetRgn( updateRgn , -pt.h , -pt.v ) ;
+            DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
+            if ( !EmptyRgn( diffRgn ) )
+            {
+                m_macNeedsErasing = true ;
+            }
+        }
+        if ( updateRgn )
+            DisposeRgn( updateRgn );
+        if ( diffRgn )
+            DisposeRgn( diffRgn );
+        
+        if ( !m_macNeedsErasing )
         {
-            m_macNeedsErasing = true ;
+            RgnHandle rectRgn = NewRgn() ;
+            SetRectRgn( rectRgn , ((Rect*)rect)->left , ((Rect*)rect)->top , ((Rect*)rect)->right , ((Rect*)rect)->bottom ) ;
+            UnionRgn( (RgnHandle) m_macNoEraseUpdateRgn , rectRgn , (RgnHandle) m_macNoEraseUpdateRgn ) ;
+            DisposeRgn( rectRgn ) ;
         }
     }
-    if ( updateRgn )
-        DisposeRgn( updateRgn );
-    if ( diffRgn )
-        DisposeRgn( diffRgn );
-
-    if ( !m_macNeedsErasing )
-    {
-      RgnHandle rectRgn = NewRgn() ;
-      SetRectRgn( rectRgn , ((Rect*)rect)->left , ((Rect*)rect)->top , ((Rect*)rect)->right , ((Rect*)rect)->bottom ) ;
-      UnionRgn( (RgnHandle) m_macNoEraseUpdateRgn , rectRgn , (RgnHandle) m_macNoEraseUpdateRgn ) ;
-      DisposeRgn( rectRgn ) ;
-    }
-  }
-  InvalWindowRect( (WindowRef)m_macWindow , (Rect*)rect ) ;
-  // turn this on to debug the refreshing cycle
+    InvalWindowRect( (WindowRef)m_macWindow , (Rect*)rect ) ;
+    // turn this on to debug the refreshing cycle
 #if wxMAC_DEBUG_REDRAW
-  PaintRect( rect ) ;
+    PaintRect( rect ) ;
 #endif
-  SetPort( formerPort ) ;
+    SetPort( formerPort ) ;
 }
 
index 2677a1efde6762ea09f5ac081c53958a6c9ef3f5..7a548a743646328e7e24f73973c8ef446102337f 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -81,15 +81,15 @@ void wxTreeCtrl::SetIndent(int indent)
 
 wxImageList *wxTreeCtrl::GetImageList(int which) const
 {
-  if ( which == wxIMAGE_LIST_NORMAL )
+    if ( which == wxIMAGE_LIST_NORMAL )
     {
-    return m_imageListNormal;
-  }
-  else if ( which == wxIMAGE_LIST_STATE )
+        return m_imageListNormal;
+    }
+    else if ( which == wxIMAGE_LIST_STATE )
     {
-    return m_imageListState;
-  }
-  return NULL;
+        return m_imageListState;
+    }
+    return NULL;
 }
 
 void wxTreeCtrl::SetImageList(wxImageList *imageList, int which)
@@ -274,50 +274,50 @@ bool wxTreeCtrl::DeleteItem(long item)
 bool wxTreeCtrl::ExpandItem(long item, int action)
 {
     // TODO
-  switch ( action )
-  {
+    switch ( action )
+    {
     case wxTREE_EXPAND_EXPAND:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_COLLAPSE:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_COLLAPSE_RESET:
-      break;
-
+        break;
+        
     case wxTREE_EXPAND_TOGGLE:
-      break;
-
+        break;
+        
     default:
-      wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
-  }
-
-  bool bOk = FALSE; // TODO expand item
-
-  // May not send messages, so emulate them
-  if ( bOk ) {
-    wxTreeEvent event(wxEVT_NULL, m_windowId);
-    event.m_item.m_itemId  = item;
-    event.m_item.m_mask      =
-    event.m_item.m_stateMask = 0xffff; // get all
-    GetItem(event.m_item);
-
-    bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
-
-    event.m_code = action;
-    event.SetEventObject(this);
-
-    // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
-    event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
-                                   : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
-    GetEventHandler()->ProcessEvent(event);
-
-    event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
-                                   : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
-    GetEventHandler()->ProcessEvent(event);
-  }
-
-  return bOk;
+        wxFAIL_MSG("unknown action in wxTreeCtrl::ExpandItem");
+    }
+    
+    bool bOk = FALSE; // TODO expand item
+    
+    // May not send messages, so emulate them
+    if ( bOk ) {
+        wxTreeEvent event(wxEVT_NULL, m_windowId);
+        event.m_item.m_itemId  = item;
+        event.m_item.m_mask      =
+            event.m_item.m_stateMask = 0xffff; // get all
+        GetItem(event.m_item);
+        
+        bool bIsExpanded = (event.m_item.m_state & wxTREE_STATE_EXPANDED) != 0;
+        
+        event.m_code = action;
+        event.SetEventObject(this);
+        
+        // @@@ return values of {EXPAND|COLLAPS}ING event handler is discarded
+        event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDING
+            : wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
+        GetEventHandler()->ProcessEvent(event);
+        
+        event.SetEventType(bIsExpanded ? wxEVT_COMMAND_TREE_ITEM_EXPANDED
+            : wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
+        GetEventHandler()->ProcessEvent(event);
+    }
+    
+    return bOk;
 }
 
 long wxTreeCtrl::InsertItem(long parent, wxTreeItem& info, long insertAfter)
index 43e9cf7e4427dff94e993c1dd3e1d284c64092b8..59daa769db71de98da9e688e22ca1b9bb342bc60 100644 (file)
@@ -25,7 +25,7 @@
 // windows manager, control manager, navigation services etc. are 
 // present
 
-static bool    sUMAHasAppearance = false ;
+static bool    sUMAHasAppearance = false ;
 static long sUMAAppearanceVersion = 0 ;
 static long sUMASystemVersion = 0 ;
 static bool sUMAHasAquaLayout = false ;
@@ -36,7 +36,7 @@ bool UMAHasAppearance() { return sUMAHasAppearance ; }
 long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; }
 long UMAGetSystemVersion() { return sUMASystemVersion ; }
 
-static bool    sUMAHasWindowManager = false ;
+static bool    sUMAHasWindowManager = false ;
 static long sUMAWindowManagerAttr = 0 ;
 
 bool UMAHasWindowManager() { return sUMAHasWindowManager ; }
@@ -46,72 +46,72 @@ bool UMASystemIsInitialized() { return sUMASystemInitialized ; }
 
 void UMACleanupToolbox()
 {
-       if ( sUMAHasAppearance )
-       {
-               UnregisterAppearanceClient() ;
-       }
-       if ( NavServicesAvailable() )
-       {
-               NavUnload() ;
-       }
+    if ( sUMAHasAppearance )
+    {
+        UnregisterAppearanceClient() ;
+    }
+    if ( NavServicesAvailable() )
+    {
+        NavUnload() ;
+    }
   if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress )
-         TXNTerminateTextension( ) ;
+      TXNTerminateTextension( ) ;
 }
 void UMAInitToolbox( UInt16 inMoreMastersCalls )
 {
 #if !TARGET_CARBON
-       ::MaxApplZone();
-       for (long i = 1; i <= inMoreMastersCalls; i++)
-               ::MoreMasters();
-
-       ::InitGraf(&qd.thePort);
-       ::InitFonts();
-       ::InitMenus();
-       ::TEInit();
-       ::InitDialogs(0L);
-       ::FlushEvents(everyEvent, 0);
-       ::InitCursor();
-       long total,contig;
-       PurgeSpace(&total, &contig);
+    ::MaxApplZone();
+    for (long i = 1; i <= inMoreMastersCalls; i++)
+        ::MoreMasters();
+
+    ::InitGraf(&qd.thePort);
+    ::InitFonts();
+    ::InitMenus();
+    ::TEInit();
+    ::InitDialogs(0L);
+    ::FlushEvents(everyEvent, 0);
+    ::InitCursor();
+    long total,contig;
+    PurgeSpace(&total, &contig);
 #else
-       InitCursor();
+    InitCursor();
 #endif
 
     if ( Gestalt(gestaltSystemVersion, &sUMASystemVersion) != noErr)
-       sUMASystemVersion = 0x0000 ;
-       
-       long theAppearance ;
-       if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
-       {
-               sUMAHasAppearance = true ;
-               RegisterAppearanceClient();
-               if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
-               {
-                       sUMAAppearanceVersion = theAppearance ;
-               }
-               else
-               {
-                       sUMAAppearanceVersion = 0x0100 ;
-               }
-       }
-       if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr )
-       {
-               sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
-       }
-               
+        sUMASystemVersion = 0x0000 ;
+        
+    long theAppearance ;
+    if ( Gestalt( gestaltAppearanceAttr, &theAppearance ) == noErr )
+    {
+        sUMAHasAppearance = true ;
+        RegisterAppearanceClient();
+        if ( Gestalt( gestaltAppearanceVersion, &theAppearance ) == noErr )
+        {
+            sUMAAppearanceVersion = theAppearance ;
+        }
+        else
+        {
+            sUMAAppearanceVersion = 0x0100 ;
+        }
+    }
+    if ( Gestalt( gestaltWindowMgrAttr, &sUMAWindowManagerAttr ) == noErr )
+    {
+        sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ;
+    }
+        
 #if TARGET_CARBON
-// Call currently implicitely done :           InitFloatingWindows() ;
+// Call currently implicitely done :        InitFloatingWindows() ;
 #else
-       if ( sUMAHasWindowManager )
-               InitFloatingWindows() ;
-       else
-               InitWindows();
+    if ( sUMAHasWindowManager )
+        InitFloatingWindows() ;
+    else
+        InitWindows();
 #endif
 
-       if ( NavServicesAvailable() )
-       {
-               NavLoad() ;
-       }
+    if ( NavServicesAvailable() )
+    {
+        NavLoad() ;
+    }
 
   long menuMgrAttr ;
   Gestalt( gestaltMenuMgrAttr , &menuMgrAttr ) ;
@@ -121,10 +121,10 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
   if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress )
   { 
     FontFamilyID fontId ;
-       Str255 fontName ;
-       SInt16 fontSize ;
-       Style fontStyle ;
-       GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+    Str255 fontName ;
+    SInt16 fontSize ;
+    Style fontStyle ;
+    GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
     GetFNum( fontName, &fontId );
 
     TXNMacOSPreferredFontDescription fontDescriptions[] =
@@ -135,15 +135,15 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
 #if 0 // TARGET_CARBON  
     --noOfFontDescriptions ;
 #endif
-       // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
-       OptionBits options = kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask ;
+      // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke
+      OptionBits options = kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask ;
 #if TARGET_CARBON
     if ( !UMAHasAquaLayout() )
 #endif
     {
         options |= kTXNAlwaysUseQuickDrawTextMask ;
     }
-       TXNInitTextension(fontDescriptions,  noOfFontDescriptions, options );
+      TXNInitTextension(fontDescriptions,  noOfFontDescriptions, options );
   }
 
 
@@ -153,286 +153,286 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
 
 /*
 Boolean CanUseATSUI()
-       {
-       long result;
-       OSErr err = Gestalt(gestaltATSUVersion, &result);
-       return (err == noErr);
-       }
+    {
+    long result;
+    OSErr err = Gestalt(gestaltATSUVersion, &result);
+    return (err == noErr);
+    }
 */
 // process manager
 long UMAGetProcessMode() 
 {
-       OSErr err ; 
-       ProcessInfoRec processinfo;
-       ProcessSerialNumber procno ;
-       
-       procno.highLongOfPSN = NULL ;
-       procno.lowLongOfPSN = kCurrentProcess ;
-       processinfo.processInfoLength = sizeof(ProcessInfoRec);
-       processinfo.processName = NULL;
-       processinfo.processAppSpec = NULL;
+    OSErr err ; 
+    ProcessInfoRec processinfo;
+    ProcessSerialNumber procno ;
+    
+    procno.highLongOfPSN = NULL ;
+    procno.lowLongOfPSN = kCurrentProcess ;
+    processinfo.processInfoLength = sizeof(ProcessInfoRec);
+    processinfo.processName = NULL;
+    processinfo.processAppSpec = NULL;
 
-       err = ::GetProcessInformation( &procno , &processinfo ) ;
-       wxASSERT( err == noErr ) ;
-       return processinfo.processMode ;
+    err = ::GetProcessInformation( &procno , &processinfo ) ;
+    wxASSERT( err == noErr ) ;
+    return processinfo.processMode ;
 }
 
 bool UMAGetProcessModeDoesActivateOnFGSwitch() 
 {
-       return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
+    return UMAGetProcessMode() & modeDoesActivateOnFGSwitch ;
 }
 
 // menu manager
 
 MenuRef UMANewMenu( SInt16 id , const wxString& title )
 {
-       wxString str = wxStripMenuCodes( title ) ;
-       MenuRef menu ;
+    wxString str = wxStripMenuCodes( title ) ;
+    MenuRef menu ;
 #if TARGET_CARBON
-       CFStringRef cfs = wxMacCreateCFString( str ) ;
-       CreateNewMenu( id , 0 , &menu ) ;
-       SetMenuTitleWithCFString( menu , cfs ) ;
-       CFRelease( cfs ) ;
+    CFStringRef cfs = wxMacCreateCFString( str ) ;
+    CreateNewMenu( id , 0 , &menu ) ;
+    SetMenuTitleWithCFString( menu , cfs ) ;
+    CFRelease( cfs ) ;
 #else
-       Str255 ptitle ;
-       wxMacStringToPascal( str , ptitle ) ;
-       menu = ::NewMenu( id , ptitle ) ;
+    Str255 ptitle ;
+    wxMacStringToPascal( str , ptitle ) ;
+    menu = ::NewMenu( id , ptitle ) ;
 #endif
-       return menu ;
+    return menu ;
 }
 
 void UMASetMenuTitle( MenuRef menu , const wxString& title )
 {
-       wxString str = wxStripMenuCodes( title ) ;
+    wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-       CFStringRef cfs = wxMacCreateCFString( str ) ;
-       SetMenuTitleWithCFString( menu , cfs ) ;
-       CFRelease( cfs ) ;
+    CFStringRef cfs = wxMacCreateCFString( str ) ;
+    SetMenuTitleWithCFString( menu , cfs ) ;
+    CFRelease( cfs ) ;
 #else
-       Str255 ptitle ;
-       wxMacStringToPascal( str , ptitle ) ;
-       SetMenuTitle( menu , ptitle ) ;
+    Str255 ptitle ;
+    wxMacStringToPascal( str , ptitle ) ;
+    SetMenuTitle( menu , ptitle ) ;
 #endif
 }
 
 void UMASetMenuItemText(  MenuRef menu,  MenuItemIndex item, const wxString& title ) 
 {
-       wxString str = wxStripMenuCodes( title ) ;
+    wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-       CFStringRef cfs = wxMacCreateCFString( str ) ;
-       SetMenuItemTextWithCFString( menu , item , cfs ) ;
-       CFRelease( cfs ) ;
+    CFStringRef cfs = wxMacCreateCFString( str ) ;
+    SetMenuItemTextWithCFString( menu , item , cfs ) ;
+    CFRelease( cfs ) ;
 #else
-       Str255 ptitle ;
-       wxMacStringToPascal( str , ptitle ) ;
-       SetMenuItemText( menu , item , ptitle ) ;
+    Str255 ptitle ;
+    wxMacStringToPascal( str , ptitle ) ;
+    SetMenuItemText( menu , item , ptitle ) ;
 #endif
 }
 
 
 UInt32 UMAMenuEvent( EventRecord *inEvent )
 {
-               return MenuEvent( inEvent ) ;
+        return MenuEvent( inEvent ) ;
 }
 
 void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex inItem , bool enable) 
 {
-       if ( enable )
-               EnableMenuItem( inMenu , inItem ) ;
-       else
-               DisableMenuItem( inMenu , inItem ) ;
+    if ( enable )
+        EnableMenuItem( inMenu , inItem ) ;
+    else
+        DisableMenuItem( inMenu , inItem ) ;
 }
 
 void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 id ) 
 {
-       MacAppendMenu(menu, "\pA");
-       UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
-       SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
+    MacAppendMenu(menu, "\pA");
+    UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
+    SetMenuItemHierarchicalID( menu , CountMenuItems( menu ) , id ) ;
 }
 
 void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 id  ) 
 {
-       MacInsertMenuItem(menu, "\pA" , item);
-       UMASetMenuItemText(menu, item , title );
-       SetMenuItemHierarchicalID( menu , item , id ) ;
+    MacInsertMenuItem(menu, "\pA" , item);
+    UMASetMenuItemText(menu, item , title );
+    SetMenuItemHierarchicalID( menu , item , id ) ;
 }
 
 void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry )
 {
-       if ( !entry )
-               return ;
-               
-       UInt8 modifiers = 0 ;
-       SInt16 key = entry->GetKeyCode() ;
-       if ( key )
-       {
-               bool explicitCommandKey = false ;
-
-               if ( entry->GetFlags() & wxACCEL_CTRL ) 
-               {
-                       explicitCommandKey = true ;
-               }
-
-               if (entry->GetFlags() & wxACCEL_ALT ) 
-               {
-                       modifiers |= kMenuOptionModifier ;
-               }
-
-               if (entry->GetFlags() & wxACCEL_SHIFT) 
-               {
-                       modifiers |= kMenuShiftModifier ;
-               }
-
-           SInt16 glyph = 0 ;
-           SInt16 macKey = key ;
-           if ( key >= WXK_F1 && key <= WXK_F15 )
-           {
-               macKey = kFunctionKeyCharCode ;
-               glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
-               if ( key >= WXK_F13 )
-                   glyph += 13 ;
+    if ( !entry )
+        return ;
+        
+    UInt8 modifiers = 0 ;
+    SInt16 key = entry->GetKeyCode() ;
+    if ( key )
+    {
+        bool explicitCommandKey = false ;
+
+        if ( entry->GetFlags() & wxACCEL_CTRL ) 
+        {
+            explicitCommandKey = true ;
+        }
+
+        if (entry->GetFlags() & wxACCEL_ALT ) 
+        {
+            modifiers |= kMenuOptionModifier ;
+        }
+
+        if (entry->GetFlags() & wxACCEL_SHIFT) 
+        {
+            modifiers |= kMenuShiftModifier ;
+        }
+
+        SInt16 glyph = 0 ;
+        SInt16 macKey = key ;
+        if ( key >= WXK_F1 && key <= WXK_F15 )
+        {
+            macKey = kFunctionKeyCharCode ;
+            glyph = kMenuF1Glyph + ( key - WXK_F1 ) ;
+            if ( key >= WXK_F13 )
+                glyph += 13 ;
             if ( !explicitCommandKey )
-               modifiers |= kMenuNoCommandModifier ;
-               
-                       switch( key )
-               {
-                   case WXK_F1 :
-                       macKey += ( 0x7a << 8 ) ;
-                       break ;
-                   case WXK_F2 :
-                       macKey += ( 0x78 << 8 ) ;
-                       break ;
-                   case WXK_F3 :
-                       macKey += ( 0x63 << 8 ) ;
-                       break ;
-                   case WXK_F4 :
-                       macKey += ( 0x76 << 8 ) ;
-                       break ;
-                   case WXK_F5 :
-                       macKey += ( 0x60 << 8 ) ;
-                       break ;
-                   case WXK_F6 :
-                       macKey += ( 0x61 << 8 ) ;
-                       break ;
-                   case WXK_F7 :
-                       macKey += ( 0x62 << 8 ) ;
-                       break ;
-                   case WXK_F8 :
-                       macKey += ( 0x64 << 8 ) ;
-                       break ;
-                   case WXK_F9 :
-                       macKey += ( 0x65 << 8 ) ;
-                       break ;
-                   case WXK_F10 :
-                       macKey += ( 0x6D << 8 ) ;
-                       break ;
-                   case WXK_F11 :
-                       macKey += ( 0x67 << 8 ) ;
-                       break ;
-                   case WXK_F12 :
-                       macKey += ( 0x6F << 8 ) ;
-                       break ;
-                   case WXK_F13 :
-                       macKey += ( 0x69 << 8 ) ;
-                       break ;
-                   case WXK_F14 :
-                       macKey += ( 0x6B << 8 ) ;
-                       break ;
-                   case WXK_F15 :
-                       macKey += ( 0x71 << 8 ) ;
-                       break ;
-                   default :
-                       break ;
-               } ;
-               // unfortunately this does not yet trigger the right key ,
-               // for some reason mac justs picks the first function key menu
-               // defined, so we turn this off
-               macKey = 0 ;
-               glyph = 0 ;
-           }
-           else
-       {
-           switch( key )
-           {
-               case WXK_BACK :
-                   macKey = kBackspaceCharCode ;
-                   glyph = kMenuDeleteLeftGlyph ;
-                   break ;
-               case WXK_TAB :
-                   macKey = kTabCharCode ;
-                   glyph = kMenuTabRightGlyph ;
-                   break ;
-               case kEnterCharCode :
-                   macKey = kEnterCharCode ;
-                   glyph = kMenuEnterGlyph ;
-                   break ;
-               case WXK_RETURN :
-                   macKey = kReturnCharCode ;
-                   glyph = kMenuReturnGlyph ;
-                   break ;
-               case WXK_ESCAPE :
-                   macKey = kEscapeCharCode ;
-                   glyph = kMenuEscapeGlyph ;
-                   break ;
-               case WXK_SPACE :
-                   macKey = ' ' ;
-                   glyph = kMenuSpaceGlyph ;
-                   break ;
-               case WXK_DELETE :
-                   macKey = kDeleteCharCode ;
-                   glyph = kMenuDeleteRightGlyph ;
-                   break ;
-               case WXK_CLEAR :
-                   macKey = kClearCharCode ;
-                   glyph = kMenuClearGlyph ;
-                   break ;
-               case WXK_PRIOR : // PAGE UP
-                   macKey = kPageUpCharCode ;
-                   glyph = kMenuPageUpGlyph ;
-                   break ;
-               case WXK_NEXT :
-                   macKey = kPageDownCharCode ;
-                   glyph = kMenuPageDownGlyph ;
-                   break ;
-               case WXK_LEFT :
-                   macKey = kLeftArrowCharCode ;
-                   glyph = kMenuLeftArrowGlyph ;
-                   break ;
-               case WXK_UP :
-                   macKey = kUpArrowCharCode ;
-                   glyph = kMenuUpArrowGlyph ;
-                   break ;
-               case WXK_RIGHT :
-                   macKey = kRightArrowCharCode ;
-                   glyph = kMenuRightArrowGlyph ;
-                   break ;
-               case WXK_DOWN :
-                   macKey = kDownArrowCharCode ;
-                   glyph = kMenuDownArrowGlyph ;
-                   break ;
+                modifiers |= kMenuNoCommandModifier ;
+                
+            switch( key )
+            {
+                case WXK_F1 :
+                    macKey += ( 0x7a << 8 ) ;
+                    break ;
+                case WXK_F2 :
+                    macKey += ( 0x78 << 8 ) ;
+                    break ;
+                case WXK_F3 :
+                    macKey += ( 0x63 << 8 ) ;
+                    break ;
+                case WXK_F4 :
+                    macKey += ( 0x76 << 8 ) ;
+                    break ;
+                case WXK_F5 :
+                    macKey += ( 0x60 << 8 ) ;
+                    break ;
+                case WXK_F6 :
+                    macKey += ( 0x61 << 8 ) ;
+                    break ;
+                case WXK_F7 :
+                    macKey += ( 0x62 << 8 ) ;
+                    break ;
+                case WXK_F8 :
+                    macKey += ( 0x64 << 8 ) ;
+                    break ;
+                case WXK_F9 :
+                    macKey += ( 0x65 << 8 ) ;
+                    break ;
+                case WXK_F10 :
+                    macKey += ( 0x6D << 8 ) ;
+                    break ;
+                case WXK_F11 :
+                    macKey += ( 0x67 << 8 ) ;
+                    break ;
+                case WXK_F12 :
+                    macKey += ( 0x6F << 8 ) ;
+                    break ;
+                case WXK_F13 :
+                    macKey += ( 0x69 << 8 ) ;
+                    break ;
+                case WXK_F14 :
+                    macKey += ( 0x6B << 8 ) ;
+                    break ;
+                case WXK_F15 :
+                    macKey += ( 0x71 << 8 ) ;
+                    break ;
+                default :
+                    break ;
+            } ;
+            // unfortunately this does not yet trigger the right key ,
+            // for some reason mac justs picks the first function key menu
+            // defined, so we turn this off
+            macKey = 0 ;
+            glyph = 0 ;
+          }
+        else
+        {
+            switch( key )
+            {
+                case WXK_BACK :
+                    macKey = kBackspaceCharCode ;
+                    glyph = kMenuDeleteLeftGlyph ;
+                    break ;
+                case WXK_TAB :
+                    macKey = kTabCharCode ;
+                    glyph = kMenuTabRightGlyph ;
+                    break ;
+                case kEnterCharCode :
+                    macKey = kEnterCharCode ;
+                    glyph = kMenuEnterGlyph ;
+                    break ;
+                case WXK_RETURN :
+                    macKey = kReturnCharCode ;
+                    glyph = kMenuReturnGlyph ;
+                    break ;
+                case WXK_ESCAPE :
+                    macKey = kEscapeCharCode ;
+                    glyph = kMenuEscapeGlyph ;
+                    break ;
+                case WXK_SPACE :
+                    macKey = ' ' ;
+                    glyph = kMenuSpaceGlyph ;
+                    break ;
+                case WXK_DELETE :
+                    macKey = kDeleteCharCode ;
+                    glyph = kMenuDeleteRightGlyph ;
+                    break ;
+                case WXK_CLEAR :
+                    macKey = kClearCharCode ;
+                    glyph = kMenuClearGlyph ;
+                    break ;
+                case WXK_PRIOR : // PAGE UP
+                    macKey = kPageUpCharCode ;
+                    glyph = kMenuPageUpGlyph ;
+                    break ;
+                case WXK_NEXT :
+                    macKey = kPageDownCharCode ;
+                    glyph = kMenuPageDownGlyph ;
+                    break ;
+                case WXK_LEFT :
+                    macKey = kLeftArrowCharCode ;
+                    glyph = kMenuLeftArrowGlyph ;
+                    break ;
+                case WXK_UP :
+                    macKey = kUpArrowCharCode ;
+                    glyph = kMenuUpArrowGlyph ;
+                    break ;
+                case WXK_RIGHT :
+                    macKey = kRightArrowCharCode ;
+                    glyph = kMenuRightArrowGlyph ;
+                    break ;
+                case WXK_DOWN :
+                    macKey = kDownArrowCharCode ;
+                    glyph = kMenuDownArrowGlyph ;
+                    break ;
             }
         }
 
-           SetItemCmd( menu, item , macKey );
-           SetMenuItemModifiers(menu, item , modifiers ) ;
+        SetItemCmd( menu, item , macKey );
+        SetMenuItemModifiers(menu, item , modifiers ) ;
 
         if ( glyph )
             SetMenuItemKeyGlyph(menu, item , glyph ) ;
-       }
+    }
 }
 
 void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry ) 
 {
-       MacAppendMenu(menu, "\pA");
-       UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
-       UMASetMenuItemShortcut( menu ,  (SInt16) ::CountMenuItems(menu), entry ) ;
+    MacAppendMenu(menu, "\pA");
+    UMASetMenuItemText(menu, (SInt16) ::CountMenuItems(menu), title );
+    UMASetMenuItemShortcut( menu ,  (SInt16) ::CountMenuItems(menu), entry ) ;
 }
 
 void UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry ) 
 {
-       MacInsertMenuItem( menu , "\p" , item) ;
-       UMASetMenuItemText(menu, item , title );
-       UMASetMenuItemShortcut( menu , item , entry ) ;
+    MacInsertMenuItem( menu , "\p" , item) ;
+    UMASetMenuItemText(menu, item , title );
+    UMASetMenuItemShortcut( menu , item , entry ) ;
 }
 
 // quickdraw
@@ -442,58 +442,58 @@ int gPrOpenCounter = 0 ;
 OSStatus UMAPrOpen(void *macPrintSession)
 {
 #if !TARGET_CARBON
-       OSErr err = noErr ;
-       ++gPrOpenCounter ;
-       if ( gPrOpenCounter == 1 )
-       {
-               PrOpen() ;
-               err = PrError() ;
-               wxASSERT( err == noErr ) ;
-       }
-       return err ;
+    OSErr err = noErr ;
+    ++gPrOpenCounter ;
+    if ( gPrOpenCounter == 1 )
+    {
+        PrOpen() ;
+        err = PrError() ;
+        wxASSERT( err == noErr ) ;
+    }
+    return err ;
 #else
-       OSStatus err = noErr ;
-       ++gPrOpenCounter ;
-       if ( gPrOpenCounter == 1 )
-       {
+    OSStatus err = noErr ;
+    ++gPrOpenCounter ;
+    if ( gPrOpenCounter == 1 )
+    {
   #if PM_USE_SESSION_APIS
-           err = PMCreateSession((PMPrintSession *)macPrintSession) ;
+        err = PMCreateSession((PMPrintSession *)macPrintSession) ;
   #else
-           err = PMBegin() ;
+        err = PMBegin() ;
   #endif
-               wxASSERT( err == noErr ) ;
-       }
-       return err ;
+        wxASSERT( err == noErr ) ;
+    }
+    return err ;
 #endif
 }
 
 OSStatus UMAPrClose(void *macPrintSession)
 {
 #if !TARGET_CARBON
-       OSErr err = noErr ;
-       wxASSERT( gPrOpenCounter >= 1 ) ;
-       if ( gPrOpenCounter == 1 )
-       {
-               PrClose() ;
-               err = PrError() ;
-               wxASSERT( err == noErr ) ;
-       }
-       --gPrOpenCounter ;
-       return err ;
+    OSErr err = noErr ;
+    wxASSERT( gPrOpenCounter >= 1 ) ;
+    if ( gPrOpenCounter == 1 )
+    {
+        PrClose() ;
+        err = PrError() ;
+        wxASSERT( err == noErr ) ;
+    }
+    --gPrOpenCounter ;
+    return err ;
 #else
-       OSStatus err = noErr ;
-       wxASSERT( gPrOpenCounter >= 1 ) ;
-       if ( gPrOpenCounter == 1 )
-       {
+    OSStatus err = noErr ;
+    wxASSERT( gPrOpenCounter >= 1 ) ;
+    if ( gPrOpenCounter == 1 )
+    {
   #if PM_USE_SESSION_APIS
-           err = PMRelease(*(PMPrintSession *)macPrintSession) ;
-           *(PMPrintSession *)macPrintSession = kPMNoReference;
+        err = PMRelease(*(PMPrintSession *)macPrintSession) ;
+        *(PMPrintSession *)macPrintSession = kPMNoReference;
   #else
-           err = PMEnd() ;
+        err = PMEnd() ;
   #endif
-       }
-       --gPrOpenCounter ;
-       return err ;
+    }
+    --gPrOpenCounter ;
+    return err ;
 #endif
 }
 
@@ -502,82 +502,82 @@ OSStatus UMAPrClose(void *macPrintSession)
 pascal QDGlobalsPtr GetQDGlobalsPtr (void) ;
 pascal QDGlobalsPtr GetQDGlobalsPtr (void)
 {
-       return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
+    return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
 }
 
 #endif
 
 void UMAShowWatchCursor() 
 {
-       OSErr err = noErr;
+    OSErr err = noErr;
 
-       CursHandle watchFob = GetCursor (watchCursor);
+    CursHandle watchFob = GetCursor (watchCursor);
 
-       if (!watchFob)
-               err = nilHandleErr;
-       else
-       {
-       #if TARGET_CARBON
-//             Cursor preservedArrow;
-//             GetQDGlobalsArrow (&preservedArrow);
-//             SetQDGlobalsArrow (*watchFob);
-//             InitCursor ( );
-//             SetQDGlobalsArrow (&preservedArrow);
-               SetCursor (*watchFob);  
-       #else
-               SetCursor (*watchFob);  
-       #endif
-       }
+    if (!watchFob)
+        err = nilHandleErr;
+    else
+    {
+    #if TARGET_CARBON
+//        Cursor preservedArrow;
+//        GetQDGlobalsArrow (&preservedArrow);
+//        SetQDGlobalsArrow (*watchFob);
+//        InitCursor ( );
+//        SetQDGlobalsArrow (&preservedArrow);
+        SetCursor (*watchFob);    
+    #else
+        SetCursor (*watchFob);    
+    #endif
+    }
 }
 
-void                   UMAShowArrowCursor() 
+void            UMAShowArrowCursor() 
 {
 #if TARGET_CARBON
-       Cursor arrow;
-       SetCursor (GetQDGlobalsArrow (&arrow));
+    Cursor arrow;
+    SetCursor (GetQDGlobalsArrow (&arrow));
 #else
-       SetCursor (&(qd.arrow));
+    SetCursor (&(qd.arrow));
 #endif
 }
 
 // window manager
 
-GrafPtr                UMAGetWindowPort( WindowRef inWindowRef ) 
+GrafPtr        UMAGetWindowPort( WindowRef inWindowRef ) 
 {
-       wxASSERT( inWindowRef != NULL ) ;
+    wxASSERT( inWindowRef != NULL ) ;
 #if TARGET_CARBON 
-       return (GrafPtr) GetWindowPort( inWindowRef ) ; 
+    return (GrafPtr) GetWindowPort( inWindowRef ) ; 
 #else
-       return (GrafPtr) inWindowRef ;
+    return (GrafPtr) inWindowRef ;
 #endif
 }
 
-void                   UMADisposeWindow( WindowRef inWindowRef ) 
+void             UMADisposeWindow( WindowRef inWindowRef ) 
 {
-       wxASSERT( inWindowRef != NULL ) ;
-       DisposeWindow( inWindowRef ) ;
+    wxASSERT( inWindowRef != NULL ) ;
+    DisposeWindow( inWindowRef ) ;
 }
 
-void                   UMASetWTitleC( WindowRef inWindowRef , const char *title ) 
+void             UMASetWTitleC( WindowRef inWindowRef , const char *title ) 
 {
-       Str255  ptitle ;
-       strncpy( (char*)ptitle , title , 96 ) ;
-       ptitle[96] = 0 ;
+    Str255    ptitle ;
+    strncpy( (char*)ptitle , title , 96 ) ;
+    ptitle[96] = 0 ;
 #if TARGET_CARBON
-       c2pstrcpy( ptitle, (char *)ptitle ) ;
+    c2pstrcpy( ptitle, (char *)ptitle ) ;
 #else
-       c2pstr( (char*)ptitle ) ;
+    c2pstr( (char*)ptitle ) ;
 #endif
-       SetWTitle( inWindowRef , ptitle ) ;
+    SetWTitle( inWindowRef , ptitle ) ;
 }
 
-void                   UMAGetWTitleC( WindowRef inWindowRef , char *title ) 
+void             UMAGetWTitleC( WindowRef inWindowRef , char *title ) 
 {
-       GetWTitle( inWindowRef , (unsigned char*)title ) ;
+    GetWTitle( inWindowRef , (unsigned char*)title ) ;
 #if TARGET_CARBON
-       p2cstrcpy( title, (unsigned char *)title ) ;
+    p2cstrcpy( title, (unsigned char *)title ) ;
 #else
-       p2cstr( (unsigned char*)title ) ;
+    p2cstr( (unsigned char*)title ) ;
 #endif
 }
 
@@ -587,18 +587,18 @@ void UMAActivateControl( ControlHandle inControl )
 {
     // we have to add the control after again to the update rgn
     // otherwise updates get lost
-  if ( !IsControlActive( inControl ) )
-  {
+    if ( !IsControlActive( inControl ) )
+    {
         bool visible = IsControlVisible( inControl ) ;
         if ( visible )
-          SetControlVisibility( inControl , false , false ) ;
+            SetControlVisibility( inControl , false , false ) ;
         ::ActivateControl( inControl ) ;
         if ( visible ) {
-          SetControlVisibility( inControl , true , false ) ;
-          Rect ctrlBounds ;
-          InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+            SetControlVisibility( inControl , true , false ) ;
+            Rect ctrlBounds ;
+            InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
         }
-  }
+    }
 }
 
 void UMADrawControl( ControlHandle inControl ) 
@@ -606,153 +606,151 @@ void UMADrawControl( ControlHandle inControl )
     WindowRef theWindow = GetControlOwner(inControl) ;
     RgnHandle updateRgn = NewRgn() ;
     GetWindowUpdateRgn( theWindow , updateRgn ) ;
-         Point zero = { 0 , 0 } ;
-         LocalToGlobal( &zero ) ;
-         OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
+    Point zero = { 0 , 0 } ;
+    LocalToGlobal( &zero ) ;
+    OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
     ::DrawControlInCurrentPort( inControl ) ;
     InvalWindowRgn( theWindow, updateRgn) ;
-         DisposeRgn( updateRgn ) ;
+    DisposeRgn( updateRgn ) ;
 }
 
 void UMAMoveControl( ControlHandle inControl , short x , short y ) 
 {
-  bool visible = IsControlVisible( inControl ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , false , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  }
-  ::MoveControl( inControl , x , y ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , true , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  }
+    bool visible = IsControlVisible( inControl ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , false , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
+    ::MoveControl( inControl , x , y ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , true , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
 }
 
 void UMASizeControl( ControlHandle inControl , short x , short y ) 
 {
-  bool visible = IsControlVisible( inControl ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , false , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  } 
-  ::SizeControl( inControl , x , y ) ;
-  if ( visible ) {
-    SetControlVisibility( inControl , true , false ) ;
-    Rect ctrlBounds ;
-    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-  }
+    bool visible = IsControlVisible( inControl ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , false , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    
+    ::SizeControl( inControl , x , y ) ;
+    if ( visible ) {
+        SetControlVisibility( inControl , true , false ) ;
+        Rect ctrlBounds ;
+        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
 }
 
 void UMADeactivateControl( ControlHandle inControl ) 
 {
     // we have to add the control after again to the update rgn
     // otherwise updates get lost
-     bool visible = IsControlVisible( inControl ) ;
-     if ( visible )
-       SetControlVisibility( inControl , false , false ) ;
-     ::DeactivateControl( inControl ) ;
-     if ( visible ) {
-       SetControlVisibility( inControl , true , false ) ;
-       Rect ctrlBounds ;
-       InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
-     }
-}
-// shows the control and adds the region to the update region
-void UMAShowControl                                            (ControlHandle                  inControl)
-{
+    bool visible = IsControlVisible( inControl ) ;
+    if ( visible )
+        SetControlVisibility( inControl , false , false ) ;
+    ::DeactivateControl( inControl ) ;
+    if ( visible ) {
         SetControlVisibility( inControl , true , false ) ;
         Rect ctrlBounds ;
         InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    }
+}
+// shows the control and adds the region to the update region
+void UMAShowControl                        (ControlHandle             inControl)
+{
+    SetControlVisibility( inControl , true , false ) ;
+    Rect ctrlBounds ;
+    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
 }
 
 // shows the control and adds the region to the update region
-void UMAHideControl                                            (ControlHandle                  inControl)
+void UMAHideControl                        (ControlHandle             inControl)
 {
-        SetControlVisibility( inControl , false , false ) ;
-        Rect ctrlBounds ;
-        InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
+    SetControlVisibility( inControl , false , false ) ;
+    Rect ctrlBounds ;
+    InvalWindowRect(GetControlOwner(inControl),GetControlBounds(inControl,&ctrlBounds) ) ;
 }
 // keyboard focus
-OSErr UMASetKeyboardFocus                              (WindowPtr                              inWindow,
-                                                                ControlHandle                  inControl,
-                                                                ControlFocusPart               inPart)
+OSErr UMASetKeyboardFocus                (WindowPtr                 inWindow,
+                                 ControlHandle             inControl,
+                                 ControlFocusPart         inPart)
 {
-       OSErr err = noErr;
-       GrafPtr port ;
-       GetPort( &port ) ;
+    OSErr err = noErr;
+    GrafPtr port ;
+    GetPort( &port ) ;
 
-       SetPortWindowPort( inWindow ) ;
+    SetPortWindowPort( inWindow ) ;
 
-  err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
-       SetPort( port ) ;
-       return err ;
+    err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
+    SetPort( port ) ;
+    return err ;
 }
 
 
-
-
 // events
 void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) 
 {
-  RgnHandle updateRgn = NewRgn() ;
-  GetWindowUpdateRgn( inWindow , updateRgn ) ;
-
-       Point zero = { 0 , 0 } ;
-       LocalToGlobal( &zero ) ;
-       OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
-
-  UpdateControls( inWindow , inRgn ) ;
-  InvalWindowRgn( inWindow, updateRgn) ;
-       DisposeRgn( updateRgn ) ;
-
+    RgnHandle updateRgn = NewRgn() ;
+    GetWindowUpdateRgn( inWindow , updateRgn ) ;
+    
+    Point zero = { 0 , 0 } ;
+    LocalToGlobal( &zero ) ;
+    OffsetRgn( updateRgn , -zero.h , -zero.v ) ;
+    
+    UpdateControls( inWindow , inRgn ) ;
+    InvalWindowRgn( inWindow, updateRgn) ;
+    DisposeRgn( updateRgn ) ;
 }
 
 bool UMAIsWindowFloating( WindowRef inWindow ) 
 {
-       WindowClass cl ;
-       
-       GetWindowClass( inWindow , &cl ) ;
-       return cl == kFloatingWindowClass ;
+    WindowClass cl ;
+    
+    GetWindowClass( inWindow , &cl ) ;
+    return cl == kFloatingWindowClass ;
 }
 
 bool UMAIsWindowModal( WindowRef inWindow ) 
 {
-       WindowClass cl ;
-       
-       GetWindowClass( inWindow , &cl ) ;
-       return cl < kFloatingWindowClass ;
+    WindowClass cl ;
+    
+    GetWindowClass( inWindow , &cl ) ;
+    return cl < kFloatingWindowClass ;
 }
 
 // others
 
 void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
 {
-       if ( inWindowRef )
-       {
-//             bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
-//             if ( inActivate != isHightlited )
-               GrafPtr port ;
-               GetPort( &port ) ;
-               SetPortWindowPort( inWindowRef ) ;
-               HiliteWindow( inWindowRef , inActivate ) ;
-               ControlHandle control = NULL ;
-               ::GetRootControl( inWindowRef , & control ) ;
-               if ( control )
-               {
-                       if ( inActivate )
-                               UMAActivateControl( control ) ;
-                       else
-                               UMADeactivateControl( control ) ;
-               }       
-               SetPort( port ) ;
-       }
+    if ( inWindowRef )
+    {
+//        bool isHighlighted = IsWindowHighlited( inWindowRef ) ;
+//        if ( inActivate != isHightlited )
+        GrafPtr port ;
+        GetPort( &port ) ;
+        SetPortWindowPort( inWindowRef ) ;
+        HiliteWindow( inWindowRef , inActivate ) ;
+        ControlHandle control = NULL ;
+        ::GetRootControl( inWindowRef , & control ) ;
+        if ( control )
+        {
+            if ( inActivate )
+                UMAActivateControl( control ) ;
+            else
+                UMADeactivateControl( control ) ;
+        }    
+        SetPort( port ) ;
+    }
 }
+
 OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) 
 {
-  return ::DrawThemePlacard( inRect , inState ) ;
+    return ::DrawThemePlacard( inRect , inState ) ;
 }
 
 #if !TARGET_CARBON
@@ -765,77 +763,77 @@ OSStatus UMAGetHelpMenu(
   MenuItemIndex *  outFirstCustomItemIndex)
 {
 #if TARGET_CARBON
-  return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
+    return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
 #else
-  MenuRef helpMenuHandle ;
-  helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
-  if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr )
-  {
-    firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
-  }
-  if ( outFirstCustomItemIndex )
-  {
-    *outFirstCustomItemIndex = firstCustomItemIndex ;
-  }
-  *outHelpMenu = helpMenuHandle ;
-  return helpMenuStatus ;
+    MenuRef helpMenuHandle ;
+    helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
+    if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr )
+    {
+        firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
+    }
+    if ( outFirstCustomItemIndex )
+    {
+        *outFirstCustomItemIndex = firstCustomItemIndex ;
+    }
+    *outHelpMenu = helpMenuHandle ;
+    return helpMenuStatus ;
 #endif
 }
 
 wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport) 
 {
-  m_clip = NULL ;
-  Setup( newport ) ;
+    m_clip = NULL ;
+    Setup( newport ) ;
 }
 
 wxMacPortStateHelper::wxMacPortStateHelper()
 {
-       m_clip = NULL ;
+    m_clip = NULL ;
 }
 
 void wxMacPortStateHelper::Setup( GrafPtr newport )
 {
-       GetPort( &m_oldPort ) ;
-       SetPort( newport ) ;
-       wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
-       m_clip = NewRgn() ;
-       GetClip( m_clip );
-       m_textFont = GetPortTextFont( (CGrafPtr) newport);
-       m_textSize = GetPortTextSize( (CGrafPtr) newport);
-       m_textStyle = GetPortTextFace( (CGrafPtr) newport);
-       m_textMode = GetPortTextMode( (CGrafPtr) newport);      
-       GetThemeDrawingState( &m_drawingState ) ;
-       m_currentPort = newport ;
+    GetPort( &m_oldPort ) ;
+    SetPort( newport ) ;
+    wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
+    m_clip = NewRgn() ;
+    GetClip( m_clip );
+    m_textFont = GetPortTextFont( (CGrafPtr) newport);
+    m_textSize = GetPortTextSize( (CGrafPtr) newport);
+    m_textStyle = GetPortTextFace( (CGrafPtr) newport);
+    m_textMode = GetPortTextMode( (CGrafPtr) newport);    
+    GetThemeDrawingState( &m_drawingState ) ;
+    m_currentPort = newport ;
 }
 void wxMacPortStateHelper::Clear()
 {
-       if ( m_clip )
-       {
-               DisposeRgn( m_clip ) ;
-               DisposeThemeDrawingState( m_drawingState ) ;
-               m_clip = NULL ;
-       }
+    if ( m_clip )
+    {
+        DisposeRgn( m_clip ) ;
+        DisposeThemeDrawingState( m_drawingState ) ;
+        m_clip = NULL ;
+    }
 }
 
 wxMacPortStateHelper::~wxMacPortStateHelper()
 {
-       if ( m_clip )
-       {
-               SetPort( m_currentPort ) ;
-               SetClip( m_clip ) ;
-               DisposeRgn( m_clip ) ;
-               TextFont( m_textFont );
-               TextSize( m_textSize );
-               TextFace( m_textStyle );
-               TextMode( m_textMode );
-               SetThemeDrawingState( m_drawingState , true ) ;
-               SetPort( m_oldPort ) ;
-       }
+    if ( m_clip )
+    {
+        SetPort( m_currentPort ) ;
+        SetClip( m_clip ) ;
+        DisposeRgn( m_clip ) ;
+        TextFont( m_textFont );
+        TextSize( m_textSize );
+        TextFace( m_textStyle );
+        TextMode( m_textMode );
+        SetThemeDrawingState( m_drawingState , true ) ;
+        SetPort( m_oldPort ) ;
+    }
 }
 
 OSStatus UMAPutScrap( Size size , OSType type , void *data )
 {
-       OSStatus err = noErr ;
+    OSStatus err = noErr ;
 #if !TARGET_CARBON
     err = PutScrap( size , type , data ) ;
 #else
@@ -846,6 +844,6 @@ OSStatus UMAPutScrap( Size size , OSType type , void *data )
         err = PutScrapFlavor (scrap, type , 0, size, data);
     }
 #endif
-       return err ;
+    return err ;
 }
 
index f308faf2dff089ccda78e8c72f1311799819e8c5..a3f95679a95680d9a2db9eef54dfb66aeffafaaf 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -50,27 +50,27 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
 // Get hostname only (without domain name)
 bool wxGetHostName(char *buf, int maxSize)
 {
-       // Gets Chooser name of user by examining a System resource.
-
-       const short kComputerNameID = -16413;
-       
-       short oldResFile = CurResFile() ;
-       UseResFile(0);
-       StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
-       UseResFile(oldResFile);
-
-       if (chooserName && *chooserName)
-       {
-         int length = (*chooserName)[0] ;
-         if ( length + 1 > maxSize )
-         {
-           length = maxSize - 1 ;
-         }
-         strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-         buf[length] = 0 ;
-       }
-       else
-               buf[0] = 0 ;
+    // Gets Chooser name of user by examining a System resource.
+
+    const short kComputerNameID = -16413;
+    
+    short oldResFile = CurResFile() ;
+    UseResFile(0);
+    StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
+    UseResFile(oldResFile);
+
+    if (chooserName && *chooserName)
+    {
+      int length = (*chooserName)[0] ;
+      if ( length + 1 > maxSize )
+      {
+        length = maxSize - 1 ;
+      }
+      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
+      buf[length] = 0 ;
+    }
+    else
+        buf[0] = 0 ;
 
   return TRUE;
 }
@@ -83,34 +83,34 @@ bool wxGetUserId(char *buf, int maxSize)
 
 const wxChar* wxGetHomeDir(wxString *pstr)
 {
-       *pstr = wxMacFindFolder(  (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
-       return pstr->c_str() ;
+    *pstr = wxMacFindFolder(  (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
+    return pstr->c_str() ;
 }
 
 // Get user name e.g. Stefan Csomor
 bool wxGetUserName(char *buf, int maxSize)
 {
-       // Gets Chooser name of user by examining a System resource.
-
-       const short kChooserNameID = -16096;
-       
-       short oldResFile = CurResFile() ;
-       UseResFile(0);
-       StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
-       UseResFile(oldResFile);
-
-       if (chooserName && *chooserName)
-       {
-         int length = (*chooserName)[0] ;
-         if ( length + 1 > maxSize )
-         {
-           length = maxSize - 1 ;
-         }
-         strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-         buf[length] = 0 ;
-       }
-       else
-               buf[0] = 0 ;
+    // Gets Chooser name of user by examining a System resource.
+
+    const short kChooserNameID = -16096;
+    
+    short oldResFile = CurResFile() ;
+    UseResFile(0);
+    StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
+    UseResFile(oldResFile);
+
+    if (chooserName && *chooserName)
+    {
+      int length = (*chooserName)[0] ;
+      if ( length + 1 > maxSize )
+      {
+        length = maxSize - 1 ;
+      }
+      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
+      buf[length] = 0 ;
+    }
+    else
+        buf[0] = 0 ;
 
   return TRUE;
 }
@@ -123,15 +123,15 @@ int wxKill(long pid, wxSignal sig , wxKillError *rc )
 
 WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
 {
-  // TODO : under classic there is no environement support, under X yes
-  return false ;
+    // TODO : under classic there is no environement support, under X yes
+    return false ;
 }
 
 // set the env var name to the given value, return TRUE on success
 WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxChar *value)
 {
-  // TODO : under classic there is no environement support, under X yes
-  return false ;
+    // TODO : under classic there is no environement support, under X yes
+    return false ;
 }
 
 //
@@ -161,7 +161,7 @@ void wxUsleep(unsigned long milliseconds)
     clock_t start = clock() ;
     do 
     {
-       YieldToAnyThread() ;
+        YieldToAnyThread() ;
     } while( clock() - start < milliseconds / CLOCKS_PER_SEC ) ;
 }
 
@@ -180,34 +180,34 @@ void wxFlushEvents()
 // Output a debug message, in a system dependent fashion.
 void wxDebugMsg(const char *fmt ...)
 {
-  va_list ap;
-  static char buffer[512];
-
-  if (!wxTheApp->GetWantDebugOutput())
-    return ;
-
-  va_start(ap, fmt);
-
-  vsprintf(buffer,fmt,ap) ;
-  strcat(buffer,";g") ;
-  c2pstr(buffer) ;
-  DebugStr((unsigned char*) buffer) ;
-
-  va_end(ap);
+    va_list ap;
+    static char buffer[512];
+    
+    if (!wxTheApp->GetWantDebugOutput())
+        return ;
+    
+    va_start(ap, fmt);
+    
+    vsprintf(buffer,fmt,ap) ;
+    strcat(buffer,";g") ;
+    c2pstr(buffer) ;
+    DebugStr((unsigned char*) buffer) ;
+    
+    va_end(ap);
 }
 
 // Non-fatal error: pop up message box and (possibly) continue
 void wxError(const wxString& msg, const wxString& title)
 {
-       if (wxMessageBox(wxString::Format(wxT("%s\nContinue?"),msg), title, wxYES_NO) == wxID_NO )
-               wxExit();
+      if (wxMessageBox(wxString::Format(wxT("%s\nContinue?"),msg), title, wxYES_NO) == wxID_NO )
+        wxExit();
 }
 
 // Fatal error: pop up message box and abort
 void wxFatalError(const wxString& msg, const wxString& title)
 {
-  wxMessageBox(wxString::Format(wxT("%s: %s"),title,msg));
-  wxExit();
+    wxMessageBox(wxString::Format(wxT("%s: %s"),title,msg));
+    wxExit();
 }
 
 #endif // WXWIN_COMPATIBILITY_2_2
@@ -225,13 +225,13 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
     long theSystem ;
     
     // are there x-platform conventions ?
-
+    
     Gestalt(gestaltSystemVersion, &theSystem) ;
     if (minorVsn != NULL) {
-       *minorVsn = (theSystem & 0xFF ) ;
+        *minorVsn = (theSystem & 0xFF ) ;
     }
     if (majorVsn != NULL) {
-       *majorVsn = (theSystem >> 8 ) ;
+        *majorVsn = (theSystem >> 8 ) ;
     }
 #ifdef __DARWIN__
     return wxMAC_DARWIN;
@@ -250,23 +250,23 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
 
 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
 {
-  char buf[50];
-  sprintf(buf, "%.4f", value);
-  return wxWriteResource(section, entry, buf, file);
+    char buf[50];
+    sprintf(buf, "%.4f", value);
+    return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
 {
-  char buf[50];
-  sprintf(buf, "%ld", value);
-  return wxWriteResource(section, entry, buf, file);
+    char buf[50];
+    sprintf(buf, "%ld", value);
+    return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
 {
-  char buf[50];
-  sprintf(buf, "%d", value);
-  return wxWriteResource(section, entry, buf, file);
+    char buf[50];
+    sprintf(buf, "%d", value);
+    return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
@@ -277,81 +277,81 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value,
 
 bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
 {
-  char *s = NULL;
-  bool succ = wxGetResource(section, entry, (char **)&s, file);
-  if (succ)
-  {
-    *value = (float)strtod(s, NULL);
-    delete[] s;
-    return TRUE;
-  }
-  else return FALSE;
+    char *s = NULL;
+    bool succ = wxGetResource(section, entry, (char **)&s, file);
+    if (succ)
+    {
+        *value = (float)strtod(s, NULL);
+        delete[] s;
+        return TRUE;
+    }
+    else return FALSE;
 }
 
 bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
 {
-  char *s = NULL;
-  bool succ = wxGetResource(section, entry, (char **)&s, file);
-  if (succ)
-  {
-    *value = strtol(s, NULL, 10);
-    delete[] s;
-    return TRUE;
-  }
-  else return FALSE;
+    char *s = NULL;
+    bool succ = wxGetResource(section, entry, (char **)&s, file);
+    if (succ)
+    {
+        *value = strtol(s, NULL, 10);
+        delete[] s;
+        return TRUE;
+    }
+    else return FALSE;
 }
 
 bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
 {
-  char *s = NULL;
-  bool succ = wxGetResource(section, entry, (char **)&s, file);
-  if (succ)
-  {
-    *value = (int)strtol(s, NULL, 10);
-    delete[] s;
-    return TRUE;
-  }
-  else return FALSE;
+    char *s = NULL;
+    bool succ = wxGetResource(section, entry, (char **)&s, file);
+    if (succ)
+    {
+        *value = (int)strtol(s, NULL, 10);
+        delete[] s;
+        return TRUE;
+    }
+    else return FALSE;
 }
 #endif // wxUSE_RESOURCES
 
 int gs_wxBusyCursorCount = 0;
-extern wxCursor        gMacCurrentCursor ;
-wxCursor               gMacStoredActiveCursor ;
+extern wxCursor    gMacCurrentCursor ;
+wxCursor        gMacStoredActiveCursor ;
 
 // Set the cursor to the busy cursor for all windows
 void wxBeginBusyCursor(wxCursor *cursor)
 {
-  if (gs_wxBusyCursorCount++ == 0)
-  {
-       gMacStoredActiveCursor = gMacCurrentCursor ;
-       cursor->MacInstall() ;
-  }
-  //else: nothing to do, already set
+    if (gs_wxBusyCursorCount++ == 0)
+    {
+        gMacStoredActiveCursor = gMacCurrentCursor ;
+        cursor->MacInstall() ;
+    }
+    //else: nothing to do, already set
 }
 
 // Restore cursor to normal
 void wxEndBusyCursor()
 {
     wxCHECK_RET( gs_wxBusyCursorCount > 0,
-                 wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
-
-  if (--gs_wxBusyCursorCount == 0)
-  {
-       gMacStoredActiveCursor.MacInstall() ;
-       gMacStoredActiveCursor = wxNullCursor ;
-  }
+        wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
+    
+    if (--gs_wxBusyCursorCount == 0)
+    {
+        gMacStoredActiveCursor.MacInstall() ;
+        gMacStoredActiveCursor = wxNullCursor ;
+    }
 }
 
 // TRUE if we're between the above two calls
 bool wxIsBusy()
 {
-  return (gs_wxBusyCursorCount > 0);
+    return (gs_wxBusyCursorCount > 0);
 }
 
 wxString wxMacFindFolder( short        vol,
-                         OSType       folderType,
-                         Boolean      createFolder)
+              OSType       folderType,
+              Boolean      createFolder)
 {
     short    vRefNum  ;
     long     dirID ;
@@ -437,24 +437,24 @@ bool wxColourDisplay()
 // Returns depth of screen
 int wxDisplayDepth()
 {
-       Rect globRect ;
-       SetRect(&globRect, -32760, -32760, 32760, 32760);
-       GDHandle        theMaxDevice;
+    Rect globRect ;
+    SetRect(&globRect, -32760, -32760, 32760, 32760);
+    GDHandle    theMaxDevice;
 
-       int theDepth = 8;
-       theMaxDevice = GetMaxDevice(&globRect);
-       if (theMaxDevice != nil)
-               theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
+    int theDepth = 8;
+    theMaxDevice = GetMaxDevice(&globRect);
+    if (theMaxDevice != nil)
+        theDepth = (**(**theMaxDevice).gdPMap).pixelSize;
 
-       return theDepth ;
+    return theDepth ;
 }
 
 // Get size of display
 void wxDisplaySize(int *width, int *height)
 {
-       BitMap screenBits;
-       GetQDGlobalsScreenBits( &screenBits );
-
+    BitMap screenBits;
+    GetQDGlobalsScreenBits( &screenBits );
+    
     *width = screenBits.bounds.right - screenBits.bounds.left  ;
     *height = screenBits.bounds.bottom - screenBits.bounds.top ;
 }
@@ -595,29 +595,29 @@ void wxMacConvertToPC( const char *from , char *to , int len )
 
 wxString wxMacMakeMacStringFromPC( const char * p )
 {
-       wxString result ;
+    wxString result ;
     int len = strlen ( p ) ;
-       if ( len > 0 )
-       {
-               wxChar* ptr = result.GetWriteBuf(len) ;
-           wxMacConvertFromPC( p , ptr , len ) ;
-               ptr[len] = 0 ;
-           result.UngetWriteBuf( len ) ;
-       }
+    if ( len > 0 )
+    {
+        wxChar* ptr = result.GetWriteBuf(len) ;
+        wxMacConvertFromPC( p , ptr , len ) ;
+        ptr[len] = 0 ;
+        result.UngetWriteBuf( len ) ;
+    }
     return result ;
 }
 
 wxString wxMacMakePCStringFromMac( const char * p )
 {
-       wxString result ;
+    wxString result ;
     int len = strlen ( p ) ;
-       if ( len > 0 )
-       {
-               wxChar* ptr = result.GetWriteBuf(len) ;
-           wxMacConvertToPC( p , ptr , len ) ;
-               ptr[len] = 0 ;
-           result.UngetWriteBuf( len ) ;
-       }
+    if ( len > 0 )
+    {
+        wxChar* ptr = result.GetWriteBuf(len) ;
+        wxMacConvertToPC( p , ptr , len ) ;
+        ptr[len] = 0 ;
+        result.UngetWriteBuf( len ) ;
+    }
     return result ;
 }
 
@@ -639,9 +639,9 @@ wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding )
 
 wxString wxMacMakeStringFromPascal( ConstStringPtr from , bool mac2pcEncoding )
 {
-       // this is safe since a pascal string can never be larger than 256 bytes
-       char s[256] ;
-       CopyPascalStringToC( from , s ) ;
+      // this is safe since a pascal string can never be larger than 256 bytes
+      char s[256] ;
+      CopyPascalStringToC( from , s ) ;
     if (mac2pcEncoding)
     {
       return wxMacMakePCStringFromMac( s ) ;
@@ -672,9 +672,9 @@ void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding
 // converts this string into a carbon foundation string with optional pc 2 mac encoding
 CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) 
 {
-       return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
-               pc2macEncoding ? 
-               kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
+    return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
+        pc2macEncoding ? 
+        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
 }
 
 #endif //TARGET_CARBON
index a9e84f42ed88d094d6355530c962525dcbab3924..229ad654f783b4b81e323dd908140f965f5bf120 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
index c325db04c638d8bcfb55b5efaebd87b164e9e7ac..0c5aac8bfcc5fee2bbc1a495ac24e6804cfc1305 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:    wxWindows licence
+// Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -51,128 +51,128 @@ wxWave::wxWave(int size, const wxByte* data)
 
 bool wxWave::Create(const wxString& fileName, bool isResource)
 {
-       bool ret = false;
-       m_sndname = fileName;
-       m_isResource = isResource;
-
-       if (m_isResource)
-               ret = true;
-       else
-       { /*
-               if (sndChan)
-               {                                                                                                                                       // we're playing
-                       FSClose(SndRefNum);
-                       SndRefNum = 0;
-                       SndDisposeChannel(sndChan, TRUE);
-                       free(sndChan);
-                       sndChan = 0;
-                       KillTimer(0,timerID);
-               }
-
-               if (!lpSnd)
-                       return true;
-
-               if (_access(lpSnd,0))                                                   // no file, no service
-                       return false;
-
-               // Allocate SndChannel
-               sndChan = (SndChannelPtr) malloc (sizeof(SndChannel));
-
-               if (!sndChan)
-                       return false;
-
-               sndChan->qLength = 128;
-
-               if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
-               {
-                       free(sndChan);
-                       sndChan = 0;
-                       return false;
-               }
-
-               if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
-               {
-                       SndDisposeChannel(sndChan, TRUE);
-                       free(sndChan);
-                       sndChan = 0;
-
-                       return false;
-               }
-
-               bool async = false;
-
-               if (fdwSound & SND_ASYNC)
-                       async = true;
-
-               if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
-               {
-                       FSClose (SndRefNum);
-                       SndRefNum = 0;
-                       SndDisposeChannel (sndChan, TRUE);
-                       free (sndChan);
-                       sndChan = 0;
-                       return false;
-               }
-
-               if (async)
-               {  // haven't finish yet
-                       timerID = SetTimer(0, 0, 250, TimerCallBack);
-               }
-               else
-               {
-                       FSClose (SndRefNum);
-                       SndRefNum = 0;
-                       SndDisposeChannel (sndChan, TRUE);
-                       free (sndChan);
-                       sndChan = 0;
-               }*/
-       }
-
-       return ret;
+    bool ret = false;
+    m_sndname = fileName;
+    m_isResource = isResource;
+
+    if (m_isResource)
+        ret = true;
+    else
+    { /*
+        if (sndChan)
+        {                                                                    // we're playing
+            FSClose(SndRefNum);
+            SndRefNum = 0;
+            SndDisposeChannel(sndChan, TRUE);
+            free(sndChan);
+            sndChan = 0;
+            KillTimer(0,timerID);
+        }
+
+        if (!lpSnd)
+            return true;
+
+        if (_access(lpSnd,0))                            // no file, no service
+            return false;
+
+        // Allocate SndChannel
+        sndChan = (SndChannelPtr) malloc (sizeof(SndChannel));
+
+        if (!sndChan)
+            return false;
+
+        sndChan->qLength = 128;
+
+        if (noErr != SndNewChannel (&sndChan, sampledSynth, initMono | initNoInterp, 0))
+        {
+            free(sndChan);
+            sndChan = 0;
+            return false;
+        }
+
+        if (!(SndRefNum = MacOpenSndFile ((char *)lpSnd)))
+        {
+            SndDisposeChannel(sndChan, TRUE);
+            free(sndChan);
+            sndChan = 0;
+
+            return false;
+        }
+
+        bool async = false;
+
+        if (fdwSound & SND_ASYNC)
+            async = true;
+
+        if (SndStartFilePlay(sndChan, SndRefNum, 0, 81920, 0, 0, 0, async) != noErr)
+        {
+            FSClose (SndRefNum);
+            SndRefNum = 0;
+            SndDisposeChannel (sndChan, TRUE);
+            free (sndChan);
+            sndChan = 0;
+            return false;
+        }
+
+        if (async)
+        {  // haven't finish yet
+            timerID = SetTimer(0, 0, 250, TimerCallBack);
+        }
+        else
+        {
+            FSClose (SndRefNum);
+            SndRefNum = 0;
+            SndDisposeChannel (sndChan, TRUE);
+            free (sndChan);
+            sndChan = 0;
+        }*/
+    }
+
+    return ret;
 }
 
 
 //don't know what to do with looped, wth
 bool wxWave::Play(bool async, bool looped) const
 {
-       char lpSnd[32];
-       bool ret = false;
+    char lpSnd[32];
+    bool ret = false;
 
-       if (m_isResource)
-       {
+    if (m_isResource)
+    {
 #if TARGET_CARBON
-         c2pstrcpy((unsigned char *)lpSnd, m_sndname);
+      c2pstrcpy((unsigned char *)lpSnd, m_sndname);
 #else
-         strcpy(lpSnd, m_sndname);
-         c2pstr((char *) lpSnd);
+      strcpy(lpSnd, m_sndname);
+      c2pstr((char *) lpSnd);
 #endif
-         SndListHandle hSnd;
+      SndListHandle hSnd;
 
-         hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
+      hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
 
-         if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
-           ret = true;
-       }
+      if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
+        ret = true;
+    }
 
-       return ret;
+    return ret;
 }
 
 
 bool wxWave::FreeData()
 {
-       bool ret = false;
-
-       if (m_isResource)
-       {
-               m_sndname.Empty();
-               ret = true;
-       }
-       else
-       {
-               //TODO,
-       }
-
-       return ret;
+    bool ret = false;
+
+    if (m_isResource)
+    {
+        m_sndname.Empty();
+        ret = true;
+    }
+    else
+    {
+        //TODO,
+    }
+
+    return ret;
 }
 
 
@@ -182,66 +182,66 @@ bool wxWave::FreeData()
 
 /*static short MacOpenSndFile (char * path)
 {
-       VolumeParam vp;
-       FSSpec fspec;
-       Str255 name;
-       char *c;
-
-       // first, get the volume reference number for the file.  Start by
-       // making a Pstring with just the volume name
-       strcpy ((char *) name, path);
-       if (c = strchr ((char *) name, ':'))
-       {
-               c++;
-               *c = '\0';
-       }
-
-       c2pstr ((char *) name);
-       vp.ioCompletion = 0;
-       vp.ioVolIndex   = -1;
-       vp.ioNamePtr    = name;
-       vp.ioVRefNum    = 0;
-
-       if (PBGetVInfo((ParamBlockRec *)&vp, 0) != noErr)
-               return 0;
-
-       // next, buld an FSSpec for the file
-       strcpy ((char *) name, path);
-       c2pstr ((char *) name);
-       if (FSMakeFSSpec (vp.ioVRefNum, 0, name, &fspec) != noErr)
-               return 0;
-
-       short frefnum;
-       // now open the file, and return it's reference number
-       if (FSpOpenDF(&fspec, fsRdPerm, &frefnum) != noErr)
-               return 0;
-
-       return frefnum;
+    VolumeParam vp;
+    FSSpec fspec;
+    Str255 name;
+    char *c;
+
+    // first, get the volume reference number for the file.  Start by
+    // making a Pstring with just the volume name
+    strcpy ((char *) name, path);
+    if (c = strchr ((char *) name, ':'))
+    {
+        c++;
+        *c = '\0';
+    }
+
+    c2pstr ((char *) name);
+    vp.ioCompletion = 0;
+    vp.ioVolIndex    = -1;
+    vp.ioNamePtr    = name;
+    vp.ioVRefNum    = 0;
+
+    if (PBGetVInfo((ParamBlockRec *)&vp, 0) != noErr)
+        return 0;
+
+    // next, buld an FSSpec for the file
+    strcpy ((char *) name, path);
+    c2pstr ((char *) name);
+    if (FSMakeFSSpec (vp.ioVRefNum, 0, name, &fspec) != noErr)
+        return 0;
+
+    short frefnum;
+    // now open the file, and return it's reference number
+    if (FSpOpenDF(&fspec, fsRdPerm, &frefnum) != noErr)
+        return 0;
+
+    return frefnum;
 }
 
 
 void TimerCallBack(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
 {
-       if(!sndChan)
-       {
-               KillTimer(0,timerID);
-               return;
-       }
-
-       SCStatus        scstat;
-
-       if (noErr == SndChannelStatus (sndChan, sizeof (SCStatus), &scstat)) {
-               if (scstat.scChannelPaused || scstat.scChannelBusy)
-                       return;                                                 // not done yet
-       }
-
-       // either error or done.
-       FSClose (SndRefNum);
-       SndRefNum = 0;
-       SndDisposeChannel (sndChan, TRUE);
-       free (sndChan);
-       sndChan = 0;
-       KillTimer(0,timerID);
+    if(!sndChan)
+    {
+        KillTimer(0,timerID);
+        return;
+    }
+
+    SCStatus    scstat;
+
+    if (noErr == SndChannelStatus (sndChan, sizeof (SCStatus), &scstat)) {
+        if (scstat.scChannelPaused || scstat.scChannelBusy)
+            return;                            // not done yet
+    }
+
+    // either error or done.
+    FSClose (SndRefNum);
+    SndRefNum = 0;
+    SndDisposeChannel (sndChan, TRUE);
+    free (sndChan);
+    sndChan = 0;
+    KillTimer(0,timerID);
 }*/
 
 
index 9eded8e45a35c56da596c00fae7a5c1aa312612c..4592280816f4752d240f4a567832e3d33fc6ba2b 100644 (file)
@@ -175,8 +175,8 @@ wxWindowMac::~wxWindowMac()
     wxFrame* frame = wxDynamicCast( wxGetTopLevelParent( this ) , wxFrame ) ;
     if ( frame )
     {
-       if ( frame->GetLastFocus() == this )
-               frame->SetLastFocus( NULL ) ;
+        if ( frame->GetLastFocus() == this )
+            frame->SetLastFocus( NULL ) ;
     }
 
     if ( gFocusWindow == this )
@@ -323,15 +323,15 @@ void wxWindowMac::DoReleaseMouse()
 
 void wxWindowMac::SetDropTarget(wxDropTarget *pDropTarget)
 {
-  if ( m_dropTarget != 0 ) {
-    delete m_dropTarget;
-  }
-
-  m_dropTarget = pDropTarget;
-  if ( m_dropTarget != 0 )
-  {
-    // TODO
-  }
+    if ( m_dropTarget != 0 ) {
+        delete m_dropTarget;
+    }
+    
+    m_dropTarget = pDropTarget;
+    if ( m_dropTarget != 0 )
+    {
+        // TODO
+    }
 }
 
 #endif
@@ -409,12 +409,12 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
 
     if(x)   *x = localwhere.h ;
     if(y)   *y = localwhere.v ;
-
+    
     MacRootWindowToWindow( x , y ) ;
     if ( x )
-            *x -= MacGetLeftBorderSize() ;
+        *x -= MacGetLeftBorderSize() ;
     if ( y )
-            *y -= MacGetTopBorderSize() ;
+        *y -= MacGetTopBorderSize() ;
 }
 
 void wxWindowMac::DoClientToScreen(int *x, int *y) const
@@ -422,9 +422,9 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
     WindowRef window = (WindowRef) MacGetRootWindow() ;
 
     if ( x )
-            *x += MacGetLeftBorderSize() ;
+        *x += MacGetLeftBorderSize() ;
     if ( y )
-            *y += MacGetTopBorderSize() ;
+        *y += MacGetTopBorderSize() ;
 
     MacWindowToRootWindow( x , y ) ;
 
@@ -482,37 +482,37 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const
 bool wxWindowMac::SetCursor(const wxCursor& cursor)
 {
     if (m_cursor == cursor)
-       return FALSE;
-
+        return FALSE;
+    
     if (wxNullCursor == cursor)
     {
-       if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
-        return FALSE ;
+        if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) )
+            return FALSE ;
     }
     else
     {
-       if ( ! wxWindowBase::SetCursor( cursor ) )
-        return FALSE ;
-    }
-
-  wxASSERT_MSG( m_cursor.Ok(),
-                  wxT("cursor must be valid after call to the base version"));
-
-  Point pt ;
-  wxWindowMac *mouseWin ;
-  GetMouse( &pt ) ;
-
-  // Change the cursor NOW if we're within the correct window
-
-  if ( MacGetWindowFromPoint( wxPoint( pt.h , pt.v ) , &mouseWin ) )
-  {
-    if ( mouseWin == this && !wxIsBusy() )
-    {
-        m_cursor.MacInstall() ;
+        if ( ! wxWindowBase::SetCursor( cursor ) )
+            return FALSE ;
+    }
+    
+    wxASSERT_MSG( m_cursor.Ok(),
+        wxT("cursor must be valid after call to the base version"));
+    
+    Point pt ;
+    wxWindowMac *mouseWin ;
+    GetMouse( &pt ) ;
+    
+    // Change the cursor NOW if we're within the correct window
+    
+    if ( MacGetWindowFromPoint( wxPoint( pt.h , pt.v ) , &mouseWin ) )
+    {
+        if ( mouseWin == this && !wxIsBusy() )
+        {
+            m_cursor.MacInstall() ;
+        }
     }
-  }
-
-  return TRUE ;
+    
+    return TRUE ;
 }
 
 
@@ -522,54 +522,54 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
     int ww, hh;
     ww = m_width ;
     hh = m_height ;
-
+    
     ww -= MacGetLeftBorderSize(  )  + MacGetRightBorderSize(  ) ;
     hh -= MacGetTopBorderSize(  ) + MacGetBottomBorderSize( );
-
-  if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar  && m_hScrollBar->IsShown()) )
-  {
-    int x1 = 0 ;
-    int y1 = 0 ;
-    int w = m_width ;
-    int h = m_height ;
-
-    MacClientToRootWindow( &x1 , &y1 ) ;
-    MacClientToRootWindow( &w , &h ) ;
-
-    wxWindowMac *iter = (wxWindowMac*)this ;
-
-    int totW = 10000 , totH = 10000;
-    while( iter )
-    {
-        if ( iter->IsTopLevel() )
+    
+    if ( (m_vScrollBar && m_vScrollBar->IsShown()) || (m_hScrollBar  && m_hScrollBar->IsShown()) )
+    {
+        int x1 = 0 ;
+        int y1 = 0 ;
+        int w = m_width ;
+        int h = m_height ;
+        
+        MacClientToRootWindow( &x1 , &y1 ) ;
+        MacClientToRootWindow( &w , &h ) ;
+        
+        wxWindowMac *iter = (wxWindowMac*)this ;
+        
+        int totW = 10000 , totH = 10000;
+        while( iter )
         {
-            totW = iter->m_width ;
-            totH = iter->m_height ;
-            break ;
+            if ( iter->IsTopLevel() )
+            {
+                totW = iter->m_width ;
+                totH = iter->m_height ;
+                break ;
+            }
+            
+            iter = iter->GetParent() ;
         }
-
-        iter = iter->GetParent() ;
-    }
-
-    if (m_hScrollBar  && m_hScrollBar->IsShown() )
-    {
-        hh -= MAC_SCROLLBAR_SIZE;
-        if ( h-y1 >= totH )
+        
+        if (m_hScrollBar  && m_hScrollBar->IsShown() )
         {
-            hh += 1 ;
+            hh -= MAC_SCROLLBAR_SIZE;
+            if ( h-y1 >= totH )
+            {
+                hh += 1 ;
+            }
         }
-    }
-    if (m_vScrollBar  && m_vScrollBar->IsShown() )
-    {
-        ww -= MAC_SCROLLBAR_SIZE;
-        if ( w-x1 >= totW )
+        if (m_vScrollBar  && m_vScrollBar->IsShown() )
         {
-            ww += 1 ;
+            ww -= MAC_SCROLLBAR_SIZE;
+            if ( w-x1 >= totW )
+            {
+                ww += 1 ;
+            }
         }
     }
-  }
-  if(x)   *x = ww;
-  if(y)   *y = hh;
+    if(x)   *x = ww;
+    if(y)   *y = hh;
 }
 
 
@@ -582,7 +582,7 @@ void wxWindowMac::DoGetClientSize(int *x, int *y) const
 void wxWindowMac::DoSetToolTip(wxToolTip *tooltip)
 {
     wxWindowBase::DoSetToolTip(tooltip);
-
+    
     if ( m_tooltip )
         m_tooltip->SetWindow(this);
 }
@@ -595,12 +595,12 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
     int former_y = m_y ;
     int former_w = m_width ;
     int former_h = m_height ;
-
-  int actualWidth = width;
-  int actualHeight = height;
-  int actualX = x;
-  int actualY = y;
-
+    
+    int actualWidth = width;
+    int actualHeight = height;
+    int actualX = x;
+    int actualY = y;
+    
     if ((m_minWidth != -1) && (actualWidth < m_minWidth))
         actualWidth = m_minWidth;
     if ((m_minHeight != -1) && (actualHeight < m_minHeight))
@@ -609,10 +609,10 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         actualWidth = m_maxWidth;
     if ((m_maxHeight != -1) && (actualHeight > m_maxHeight))
         actualHeight = m_maxHeight;
-
+    
     bool doMove = false ;
     bool doResize = false ;
-
+    
     if ( actualX != former_x || actualY != former_y )
     {
         doMove = true ;
@@ -621,13 +621,13 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
     {
         doResize = true ;
     }
-
+    
     if ( doMove || doResize )
     {
         // erase former position
-
+        
         bool partialRepaint = false ;
-
+        
         if ( HasFlag(wxNO_FULL_REPAINT_ON_RESIZE) )
         {
             wxPoint oldPos( m_x , m_y ) ;
@@ -652,25 +652,25 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
                 DisposeRgn(diffRgn) ;
             }
         }
-
+        
         if ( !partialRepaint )
             Refresh() ;
-
+        
         m_x = actualX ;
         m_y = actualY ;
         m_width = actualWidth ;
         m_height = actualHeight ;
-
-               // update any low-level frame-relative positions
-
-               MacUpdateDimensions() ;
+        
+        // update any low-level frame-relative positions
+        
+        MacUpdateDimensions() ;
         // erase new position
-
+        
         if ( !partialRepaint )
             Refresh() ;
         if ( doMove )
             wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
-
+        
         MacRepositionScrollBars() ;
         if ( doMove )
         {
@@ -681,14 +681,14 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         }
         if ( doResize )
         {
-             MacRepositionScrollBars() ;
-             wxSize size(m_width, m_height);
-             wxSizeEvent event(size, m_windowId);
-             event.SetEventObject(this);
-             GetEventHandler()->ProcessEvent(event);
+            MacRepositionScrollBars() ;
+            wxSize size(m_width, m_height);
+            wxSizeEvent event(size, m_windowId);
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
         }
     }
-
+    
 }
 
 // set the size of the window: if the dimensions are positive, just use them,
@@ -704,25 +704,25 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     // get the current size and position...
     int currentX, currentY;
     GetPosition(&currentX, &currentY);
-
+    
     int currentW,currentH;
     GetSize(&currentW, &currentH);
-
+    
     // ... and don't do anything (avoiding flicker) if it's already ok
     if ( x == currentX && y == currentY &&
-         width == currentW && height == currentH )
+        width == currentW && height == currentH )
     {
         MacRepositionScrollBars() ; // we might have a real position shift
         return;
     }
-
+    
     if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
         x = currentX;
     if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
         y = currentY;
-
+    
     AdjustForParentClientOrigin(x, y, sizeFlags);
-
+    
     wxSize size(-1, -1);
     if ( width == -1 )
     {
@@ -737,7 +737,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
             width = currentW;
         }
     }
-
+    
     if ( height == -1 )
     {
         if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
@@ -747,7 +747,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
                 size = DoGetBestSize();
             }
             //else: already called DoGetBestSize() above
-
+            
             height = size.y;
         }
         else
@@ -756,9 +756,9 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags)
             height = currentH;
         }
     }
-
+    
     DoMoveWindow(x, y, width, height);
-
+    
 }
 // For implementation purposes - sometimes decorations make the client area
 // smaller
@@ -980,7 +980,7 @@ wxWindowMac *wxGetActiveWindow()
 // Coordinates relative to the window
 void wxWindowMac::WarpPointer (int x_pos, int y_pos)
 {
-    // We really dont move the mouse programmatically under mac
+    // We really don't move the mouse programmatically under Mac.
 }
 
 const wxBrush& wxWindowMac::MacGetBackgroundBrush()
@@ -994,58 +994,57 @@ const wxBrush& wxWindowMac::MacGetBackgroundBrush()
         // on mac we have the difficult situation, that 3dface gray can be different colours, depending whether
         // it is on a notebook panel or not, in order to take care of that we walk up the hierarchy until we have
         // either a non gray background color or a non control window
-
-            WindowRef window = (WindowRef) MacGetRootWindow() ;
-
-            wxWindowMac* parent = GetParent() ;
-            while( parent )
+        
+        WindowRef window = (WindowRef) MacGetRootWindow() ;
+        
+        wxWindowMac* parent = GetParent() ;
+        while( parent )
+        {
+            if ( parent->MacGetRootWindow() != window )
+            {
+                // we are in a different window on the mac system
+                parent = NULL ;
+                break ;
+            }
+            
             {
-                if ( parent->MacGetRootWindow() != window )
+                if ( parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
+                    && parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) )
                 {
-                    // we are in a different window on the mac system
-                    parent = NULL ;
+                    // if we have any other colours in the hierarchy
+                    m_macBackgroundBrush.SetColour( parent->m_backgroundColour ) ;
                     break ;
                 }
-
+                // if we have the normal colours in the hierarchy but another control etc. -> use it's background
+                if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                 {
-                    if ( parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
-                      && parent->m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) )
-                    {
-                        // if we have any other colours in the hierarchy
-                        m_macBackgroundBrush.SetColour( parent->m_backgroundColour ) ;
-                        break ;
-                    }
-                    // if we have the normal colours in the hierarchy but another control etc. -> use it's background
-                    if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
-                    {
-                        Rect extent = { 0 , 0 , 0 , 0 } ;
-                        int x , y ;
-                        x = y = 0 ;
-                        wxSize size = parent->GetSize() ;
-                        parent->MacClientToRootWindow( &x , &y ) ;
-                        extent.left = x ;
-                        extent.top = y ;
-                        extent.top-- ;
-                        extent.right = x + size.x ;
-                        extent.bottom = y + size.y ;
-                        m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , (WXRECTPTR) &extent ) ; // todo eventually change for inactive
-                        break ;
-                    }
+                    Rect extent = { 0 , 0 , 0 , 0 } ;
+                    int x , y ;
+                    x = y = 0 ;
+                    wxSize size = parent->GetSize() ;
+                    parent->MacClientToRootWindow( &x , &y ) ;
+                    extent.left = x ;
+                    extent.top = y ;
+                    extent.top-- ;
+                    extent.right = x + size.x ;
+                    extent.bottom = y + size.y ;
+                    m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , (WXRECTPTR) &extent ) ; // todo eventually change for inactive
+                    break ;
                 }
-                parent = parent->GetParent() ;
-            }
-            if ( !parent )
-            {
-              m_macBackgroundBrush.SetMacTheme( kThemeBrushDialogBackgroundActive ) ; // todo eventually change for inactive
             }
+            parent = parent->GetParent() ;
+        }
+        if ( !parent )
+        {
+            m_macBackgroundBrush.SetMacTheme( kThemeBrushDialogBackgroundActive ) ; // todo eventually change for inactive
+        }
     }
     else
     {
         m_macBackgroundBrush.SetColour( m_backgroundColour ) ;
     }
-
-    return m_macBackgroundBrush ;
-
+    
+    return m_macBackgroundBrush ;    
 }
 
 void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
@@ -1199,41 +1198,41 @@ void wxWindowMac::RemoveChild( wxWindowBase *child )
 void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
     int range, bool refresh)
 {
-        if ( orient == wxHORIZONTAL )
+    if ( orient == wxHORIZONTAL )
+    {
+        if ( m_hScrollBar )
         {
-            if ( m_hScrollBar )
+            if ( range == 0 || thumbVisible >= range )
             {
-                if ( range == 0 || thumbVisible >= range )
-                {
-                    if ( m_hScrollBar->IsShown() )
-                        m_hScrollBar->Show(false) ;
-                }
-                else
-                {
-                    if ( !m_hScrollBar->IsShown() )
-                        m_hScrollBar->Show(true) ;
-                    m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
-                }
+                if ( m_hScrollBar->IsShown() )
+                    m_hScrollBar->Show(false) ;
+            }
+            else
+            {
+                if ( !m_hScrollBar->IsShown() )
+                    m_hScrollBar->Show(true) ;
+                m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
             }
         }
-        else
+    }
+    else
+    {
+        if ( m_vScrollBar )
         {
-            if ( m_vScrollBar )
+            if ( range == 0 || thumbVisible >= range )
             {
-                if ( range == 0 || thumbVisible >= range )
-                {
-                    if ( m_vScrollBar->IsShown() )
-                        m_vScrollBar->Show(false) ;
-                }
-                else
-                {
-                    if ( !m_vScrollBar->IsShown() )
-                        m_vScrollBar->Show(true) ;
-                    m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
-                }
+                if ( m_vScrollBar->IsShown() )
+                    m_vScrollBar->Show(false) ;
+            }
+            else
+            {
+                if ( !m_vScrollBar->IsShown() )
+                    m_vScrollBar->Show(true) ;
+                m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
             }
         }
-        MacRepositionScrollBars() ;
+    }
+    MacRepositionScrollBars() ;
 }
 
 // Does a physical scroll
@@ -1241,39 +1240,39 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
     wxClientDC dc(this) ;
     wxMacPortSetter helper(&dc) ;
-
+    
     {
         int width , height ;
         GetClientSize( &width , &height ) ;
-
+        
         Rect scrollrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , dc.YLOG2DEVMAC(height) , dc.XLOG2DEVMAC(width) } ;
         RgnHandle updateRgn = NewRgn() ;
         ClipRect( &scrollrect ) ;
         if ( rect )
         {
             Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) ,
-              dc.XLOG2DEVMAC(rect->x + rect->width) } ;
+                dc.XLOG2DEVMAC(rect->x + rect->width) } ;
             SectRect( &scrollrect , &r , &scrollrect ) ;
         }
         ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
         InvalWindowRgn( (WindowRef) MacGetRootWindow() ,  updateRgn ) ;
         DisposeRgn( updateRgn ) ;
     }
-
+    
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
         wxWindowMac *child = (wxWindowMac*)node->GetData();
         if (child == m_vScrollBar) continue;
         if (child == m_hScrollBar) continue;
         if (child->IsTopLevel()) continue;
-
+        
         int x,y;
         child->GetPosition( &x, &y );
         int w,h;
         child->GetSize( &w, &h );
         child->SetSize( x+dx, y+dy, w, h );
     }
-
+    
 }
 
 void wxWindowMac::MacOnScroll(wxScrollEvent &event )
@@ -1284,30 +1283,30 @@ void wxWindowMac::MacOnScroll(wxScrollEvent &event )
         wevent.SetPosition(event.GetPosition());
         wevent.SetOrientation(event.GetOrientation());
         wevent.m_eventObject = this;
-
+        
         if (event.m_eventType == wxEVT_SCROLL_TOP) {
             wevent.m_eventType = wxEVT_SCROLLWIN_TOP;
         } else
-        if (event.m_eventType == wxEVT_SCROLL_BOTTOM) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_LINEUP) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_LINEDOWN) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_PAGEUP) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_PAGEDOWN) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
-        } else
-        if (event.m_eventType == wxEVT_SCROLL_THUMBTRACK) {
-            wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
-        }
-
-        GetEventHandler()->ProcessEvent(wevent);
+            if (event.m_eventType == wxEVT_SCROLL_BOTTOM) {
+                wevent.m_eventType = wxEVT_SCROLLWIN_BOTTOM;
+            } else
+                if (event.m_eventType == wxEVT_SCROLL_LINEUP) {
+                    wevent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+                } else
+                    if (event.m_eventType == wxEVT_SCROLL_LINEDOWN) {
+                        wevent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
+                    } else
+                        if (event.m_eventType == wxEVT_SCROLL_PAGEUP) {
+                            wevent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+                        } else
+                            if (event.m_eventType == wxEVT_SCROLL_PAGEDOWN) {
+                                wevent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+                            } else
+                                if (event.m_eventType == wxEVT_SCROLL_THUMBTRACK) {
+                                    wevent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
+                                }
+                                
+                                GetEventHandler()->ProcessEvent(wevent);
     }
 }
 
@@ -1356,7 +1355,7 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event)
     // notice that it's also important to do it upwards the tree becaus
     // otherwise when the top level panel gets focus, it won't set it back to
     // us, but to some other sibling
-
+    
     // CS:don't know if this is still needed:
     //wxChildFocusEvent eventFocus(this);
     //(void)GetEventHandler()->ProcessEvent(eventFocus);
@@ -1435,27 +1434,27 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
 {
     if ( IsTopLevel() )
     {
-      if ((point.x < 0) || (point.y < 0) ||
-          (point.x > (m_width)) || (point.y > (m_height)))
-          return FALSE;
+        if ((point.x < 0) || (point.y < 0) ||
+            (point.x > (m_width)) || (point.y > (m_height)))
+            return FALSE;
     }
     else
     {
-      if ((point.x < m_x) || (point.y < m_y) ||
-          (point.x > (m_x + m_width)) || (point.y > (m_y + m_height)))
-          return FALSE;
+        if ((point.x < m_x) || (point.y < m_y) ||
+            (point.x > (m_x + m_width)) || (point.y > (m_y + m_height)))
+            return FALSE;
     }
-
+    
     WindowRef window = (WindowRef) MacGetRootWindow() ;
-
+    
     wxPoint newPoint( point ) ;
-
+    
     if ( !IsTopLevel() )
     {
-      newPoint.x -= m_x;
-      newPoint.y -= m_y;
+        newPoint.x -= m_x;
+        newPoint.y -= m_y;
     }
-
+    
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
         wxWindowMac *child = (wxWindowMac*)node->GetData();
@@ -1466,7 +1465,7 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
                 return TRUE;
         }
     }
-
+    
     *outWin = this ;
     return TRUE;
 }
@@ -1474,25 +1473,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
 bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
 {
     WindowRef window ;
-
+    
     Point pt = { screenpoint.y , screenpoint.x } ;
     if ( ::FindWindow( pt , &window ) == 3 )
     {
-
+        
         wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
         if ( win )
         {
             // No, this yields the CLIENT are, we need the whole frame. RR.
             // point = win->ScreenToClient( point ) ;
-
+            
             GrafPtr     port;
             ::GetPort( &port ) ;
             ::SetPort( UMAGetWindowPort( window ) ) ;
             ::GlobalToLocal( &pt ) ;
             ::SetPort( port ) ;
-
+            
             wxPoint point( pt.h, pt.v ) ;
-
+            
             return win->MacGetWindowFromPointSub( point , outWin ) ;
         }
     }
@@ -1504,22 +1503,22 @@ static wxWindow *gs_lastWhich = NULL;
 bool wxWindowMac::MacSetupCursor( const wxPoint& pt)
 {
     // first trigger a set cursor event
-
+    
     wxPoint clientorigin = GetClientAreaOrigin() ;
     wxSize clientsize = GetClientSize() ;
     wxCursor cursor ;
     if ( wxRect2DInt( clientorigin.x , clientorigin.y , clientsize.x , clientsize.y ).Contains( wxPoint2DInt( pt ) ) )
     {
         wxSetCursorEvent event( pt.x , pt.y );
-
+        
         bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event);
         if ( processedEvtSetCursor && event.HasCursor() )
         {
-           cursor = event.GetCursor() ;
+            cursor = event.GetCursor() ;
         }
         else
         {
-
+            
             // the test for processedEvtSetCursor is here to prevent using m_cursor
             // if the user code caught EVT_SET_CURSOR() and returned nothing from
             // it - this is a way to say that our cursor shouldn't be used for this
@@ -1548,19 +1547,19 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
     if ((event.m_x < m_x) || (event.m_y < m_y) ||
         (event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
         return FALSE;
-
-
+    
+    
     if ( IsKindOf( CLASSINFO ( wxStaticBox ) ) /* || IsKindOf( CLASSINFO( wxSpinCtrl ) ) */)
         return FALSE ;
-
+    
     WindowRef window = (WindowRef) MacGetRootWindow() ;
-
+    
     event.m_x -= m_x;
     event.m_y -= m_y;
-
+    
     int x = event.m_x ;
     int y = event.m_y ;
-
+    
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
         wxWindowMac *child = (wxWindowMac*)node->GetData();
@@ -1570,10 +1569,10 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
                 return TRUE;
         }
     }
-
+    
     wxWindow* cursorTarget = this ;
     wxPoint cursorPoint( x , y ) ;
-
+    
     while( cursorTarget && !cursorTarget->MacSetupCursor( cursorPoint ) )
     {
         cursorTarget = cursorTarget->GetParent() ;
@@ -1583,40 +1582,40 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
     event.m_x = x ;
     event.m_y = y ;
     event.SetEventObject( this ) ;
-
+    
     if ( event.GetEventType() == wxEVT_LEFT_DOWN )
     {
         // set focus to this window
         if (AcceptsFocus() && FindFocus()!=this)
             SetFocus();
     }
-
+    
 #if wxUSE_TOOLTIPS
     if ( event.GetEventType() == wxEVT_MOTION
-            || event.GetEventType() == wxEVT_ENTER_WINDOW
-            || event.GetEventType() == wxEVT_LEAVE_WINDOW )
+        || event.GetEventType() == wxEVT_ENTER_WINDOW
+        || event.GetEventType() == wxEVT_LEAVE_WINDOW )
         wxToolTip::RelayEvent( this , event);
 #endif // wxUSE_TOOLTIPS
-
+    
     if (gs_lastWhich != this)
     {
         gs_lastWhich = this;
-
+        
         // Double clicks must always occur on the same window
         if (event.GetEventType() == wxEVT_LEFT_DCLICK)
             event.SetEventType( wxEVT_LEFT_DOWN );
         if (event.GetEventType() == wxEVT_RIGHT_DCLICK)
             event.SetEventType( wxEVT_RIGHT_DOWN );
-
+        
         // Same for mouse up events
         if (event.GetEventType() == wxEVT_LEFT_UP)
             return TRUE;
         if (event.GetEventType() == wxEVT_RIGHT_UP)
             return TRUE;
     }
-
+    
     GetEventHandler()->ProcessEvent( event ) ;
-
+    
     return TRUE;
 }
 
@@ -1657,105 +1656,105 @@ wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
 
 const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSiblings )
 {
-  RgnHandle visRgn = NewRgn() ;
-  RgnHandle tempRgn = NewRgn() ;
-  RgnHandle tempStaticBoxRgn = NewRgn() ;
-
-  SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
-
-  //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
-  if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
-  {
-    int borderTop = 14 ;
-    int borderOther = 4 ;
-
-    SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
-    DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
-  }
-
-  if ( !IsTopLevel() )
-  {
-    wxWindow* parent = GetParent() ;
-    while( parent )
-    {
-      wxSize size = parent->GetSize() ;
-      int x , y ;
-      x = y = 0 ;
-      parent->MacWindowToRootWindow( &x, &y ) ;
-      MacRootWindowToWindow( &x , &y ) ;
-
-      SetRectRgn( tempRgn ,
-       x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
-       x + size.x - parent->MacGetRightBorderSize(),
-       y + size.y - parent->MacGetBottomBorderSize()) ;
-
-      SectRgn( visRgn , tempRgn , visRgn ) ;
-      if ( parent->IsTopLevel() )
-        break ;
-      parent = parent->GetParent() ;
-    }
-  }
-  if ( respectChildrenAndSiblings )
-  {
-      if ( GetWindowStyle() & wxCLIP_CHILDREN )
-      {
-        for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
+    RgnHandle visRgn = NewRgn() ;
+    RgnHandle tempRgn = NewRgn() ;
+    RgnHandle tempStaticBoxRgn = NewRgn() ;
+    
+    SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
+    
+    //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
+    if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
+    {
+        int borderTop = 14 ;
+        int borderOther = 4 ;
+        
+        SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
+        DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
+    }
+    
+    if ( !IsTopLevel() )
+    {
+        wxWindow* parent = GetParent() ;
+        while( parent )
         {
-            wxWindowMac *child = (wxWindowMac*)node->GetData();
-
-            if ( !child->IsTopLevel() && child->IsShown() )
+            wxSize size = parent->GetSize() ;
+            int x , y ;
+            x = y = 0 ;
+            parent->MacWindowToRootWindow( &x, &y ) ;
+            MacRootWindowToWindow( &x , &y ) ;
+            
+            SetRectRgn( tempRgn ,
+                x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
+                x + size.x - parent->MacGetRightBorderSize(),
+                y + size.y - parent->MacGetBottomBorderSize()) ;
+            
+            SectRgn( visRgn , tempRgn , visRgn ) ;
+            if ( parent->IsTopLevel() )
+                break ;
+            parent = parent->GetParent() ;
+        }
+    }
+    if ( respectChildrenAndSiblings )
+    {
+        if ( GetWindowStyle() & wxCLIP_CHILDREN )
+        {
+            for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
             {
-                SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width ,  child->m_y + child->m_height ) ;
-                if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                wxWindowMac *child = (wxWindowMac*)node->GetData();
+                
+                if ( !child->IsTopLevel() && child->IsShown() )
                 {
-                    int borderTop = 14 ;
-                    int borderOther = 4 ;
-
-                    SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ;
-                    DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width ,  child->m_y + child->m_height ) ;
+                    if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                    {
+                        int borderTop = 14 ;
+                        int borderOther = 4 ;
+                        
+                        SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ;
+                        DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    }
+                    DiffRgn( visRgn , tempRgn , visRgn ) ;
                 }
-                DiffRgn( visRgn , tempRgn , visRgn ) ;
             }
         }
-      }
-
-      if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
-      {
-        bool thisWindowThrough = false ;
-        for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
+        
+        if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
         {
-            wxWindowMac *sibling = (wxWindowMac*)node->GetData();
-            if ( sibling == this )
-            {
-              thisWindowThrough = true ;
-              continue ;
-            }
-            if( !thisWindowThrough )
-            {
-              continue ;
-            }
-
-            if ( !sibling->IsTopLevel() && sibling->IsShown() )
+            bool thisWindowThrough = false ;
+            for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
             {
-                SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x ,  sibling->m_y + sibling->m_height - m_y ) ;
-                if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                wxWindowMac *sibling = (wxWindowMac*)node->GetData();
+                if ( sibling == this )
                 {
-                    int borderTop = 14 ;
-                    int borderOther = 4 ;
-
-                    SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ;
-                    DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    thisWindowThrough = true ;
+                    continue ;
+                }
+                if( !thisWindowThrough )
+                {
+                    continue ;
+                }
+                
+                if ( !sibling->IsTopLevel() && sibling->IsShown() )
+                {
+                    SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x ,  sibling->m_y + sibling->m_height - m_y ) ;
+                    if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+                    {
+                        int borderTop = 14 ;
+                        int borderOther = 4 ;
+                        
+                        SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ;
+                        DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+                    }
+                    DiffRgn( visRgn , tempRgn , visRgn ) ;
                 }
-                DiffRgn( visRgn , tempRgn , visRgn ) ;
             }
         }
-      }
-  }
-  m_macVisibleRegion = visRgn ;
-  DisposeRgn( visRgn ) ;
-  DisposeRgn( tempRgn ) ;
-  DisposeRgn( tempStaticBoxRgn ) ;
-  return m_macVisibleRegion ;
+    }
+    m_macVisibleRegion = visRgn ;
+    DisposeRgn( visRgn ) ;
+    DisposeRgn( tempRgn ) ;
+    DisposeRgn( tempStaticBoxRgn ) ;
+    return m_macVisibleRegion ;
 }
 
 void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
@@ -1763,16 +1762,16 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
     RgnHandle updatergn = (RgnHandle) updatergnr ;
     // updatergn is always already clipped to our boundaries
     // it is in window coordinates, not in client coordinates
-
+    
     WindowRef window = (WindowRef) MacGetRootWindow() ;
-
+    
     {
         // ownUpdateRgn is the area that this window has to repaint, it is in window coordinates
         RgnHandle ownUpdateRgn = NewRgn() ;
         CopyRgn( updatergn , ownUpdateRgn ) ;
-
+        
         SectRgn( ownUpdateRgn , (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , ownUpdateRgn ) ;
-
+        
         // newupdate is the update region in client coordinates
         RgnHandle newupdate = NewRgn() ;
         wxSize point = GetClientSize() ;
@@ -1782,32 +1781,32 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
         OffsetRgn( newupdate , -origin.x , -origin.y ) ;
         m_updateRegion = newupdate ;
         DisposeRgn( newupdate ) ; // it's been cloned to m_updateRegion
-
+        
         if ( erase && !EmptyRgn(ownUpdateRgn) )
         {
-          wxWindowDC dc(this);
-          if (!EmptyRgn(ownUpdateRgn))
-              dc.SetClippingRegion(wxRegion(ownUpdateRgn));
-          wxEraseEvent eevent( GetId(), &dc );
-          eevent.SetEventObject( this );
-          GetEventHandler()->ProcessEvent( eevent );
-
-          wxNcPaintEvent eventNc( GetId() );
-          eventNc.SetEventObject( this );
-          GetEventHandler()->ProcessEvent( eventNc );
+            wxWindowDC dc(this);
+            if (!EmptyRgn(ownUpdateRgn))
+                dc.SetClippingRegion(wxRegion(ownUpdateRgn));
+            wxEraseEvent eevent( GetId(), &dc );
+            eevent.SetEventObject( this );
+            GetEventHandler()->ProcessEvent( eevent );
+            
+            wxNcPaintEvent eventNc( GetId() );
+            eventNc.SetEventObject( this );
+            GetEventHandler()->ProcessEvent( eventNc );
         }
         DisposeRgn( ownUpdateRgn ) ;
         if ( !m_updateRegion.Empty() )
         {
-          wxPaintEvent event;
-          event.m_timeStamp = time ;
-          event.SetEventObject(this);
-          GetEventHandler()->ProcessEvent(event);
+            wxPaintEvent event;
+            event.m_timeStamp = time ;
+            event.SetEventObject(this);
+            GetEventHandler()->ProcessEvent(event);
         }
     }
-
+    
     // now intersect for each of the children their rect with the updateRgn and call MacRedraw recursively
-
+    
     RgnHandle childupdate = NewRgn() ;
     for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
     {
@@ -1825,7 +1824,7 @@ void wxWindowMac::MacRedraw( WXHRGN updatergnr , long time, bool erase)
     }
     DisposeRgn( childupdate ) ;
     // eventually a draw grow box here
-
+    
 }
 
 WXHWND wxWindowMac::MacGetRootWindow() const