Compilation Error Mac Os X

Help
Josh
2009-03-20
2013-04-08
  • Josh
    Josh
    2009-03-20

    I am compiling on mac os 10.5.6 using wxwidgets 2.8.10.  I get an error that I can't figure out.

    ./src/ScaledDC.cpp: In member function ‘virtual wxBitmap wxSFScaledDC::GetSelectedBitmap() const’:
    ./src/ScaledDC.cpp:528: error: ‘class wxWindowDC’ has no member named ‘GetSelectedBitmap’

    Any ideas?

     
    • Hi Josh,
      unfortunately, I have no opportunity to test the wxSF on Mac (i hope it will change in a near future). If you experienced this problem only in new wx version (2.8.10) then it means that wx API has changed and the bug will be fixed in a next wxSF release.

      Regards
      M.

       
      • Josh
        Josh
        2009-03-20

        What version of wx iw wxSF known to work with?

         
    • wxSF works without any problem on Linux and MS Windows with wxWidgets <= 2.8.9. I haven't installed wxWidgets 2.8.10 yet so I don't know whether you problem is caused by some API change in wxWidgets 2.8.10.

      Regards
      Michal

       
    • Josh
      Josh
      2009-03-23

      I have gotten the same error when compiling against 2.8.9 as well as 2.8.10.  Seems to be mac related.  Can anyone else confirm?

      Thanks

      Josh

       
    • Brucey
      Brucey
      2009-04-07

      Hi. It does indeed have build issues on the Mac.

      I have a working (or rather, build-able) version in my wxMax (a BlitzMax language binding for wxWidgets) repository.
      There are issues with ScaledDC.cpp, ShapeCanvas.cpp and ShapeCanvas.h - well, those are the files I had to modify.

      I'll post a quick summary of my changes here. Some of them are not ideal, but I was mainly concerned with getting everything to build, rather than finding correct solutions.

      ScaledDC.cpp :

      wxBitmap wxSFScaledDC::GetSelectedBitmap() const
      {
      // BaH
      #ifndef __WXMAC__
          return m_pTargetDC->GetSelectedBitmap();
      #else
          return wxNullBitmap;
      #endif
      }

      The issue here is that on Mac, wxWindowDC is not a subclass of whatever it is on Win32/Linux. (Not sure if that changes with 2.9.0 - I haven't tried building against it yet).

      ShapeCanvas.h :

      // BaH
      #ifdef __WXMAC__
      #include <wx/mac/carbon/printdlg.h>
      #endif

      (again, this might need changing for 2.9.0)

      ShapeCanvas.cpp :

      Changed #ifdef __WXGTK__ to #ifndef __WXMSW__ at the top of the file.

      in DoDragDrop() ...

              #ifdef __WXGTK__
              wxDropSource dndSrc(this, wxIcon(page_xpm), wxIcon(page_xpm), wxIcon(page_xpm));
              dndSrc.SetData(dataObj);
              #elif __WXMAC__
              // BaH
              wxDropSource dndSrc(dataObj, this, wxDROP_ICON(page), wxDROP_ICON(page), wxDROP_ICON(page));
              #else
              wxDropSource dndSrc(dataObj);
              #endif

      and PageMargins() ...

      #ifdef __WXMAC__
      void wxSFShapeCanvas::PageMargins()
      {
          (*g_pageSetupData) = *g_printData;

          // BaH
          wxWindow * win = this;
          while (!win->IsTopLevel()) {
              win = win->GetParent();
              if (!win) break;
          }

          wxMacPageMarginsDialog pageMarginsDialog((win)?(wxFrame*)win : NULL, g_pageSetupData);
          pageMarginsDialog.ShowModal();

          (*g_printData) = pageMarginsDialog.GetPageSetupDialogData().GetPrintData();
          (*g_pageSetupData) = pageMarginsDialog.GetPageSetupDialogData();
      }
      #endif

      Yes, the last change is a bit hacky... but wxMacPageMarginsDialog() wouldn't take a wxSFShapeCanvas (this)...

      Those are all I've come across so far. I'm still porting the examples and API to BlitzMax, so there may be further outstanding issues, but it's working so far.

      Anyway, apologies for messy code... I'm no expert, just a hacker....

       
    • Hi,
      thank you very much for the patche! Since I haven't any Mac available for a testing now, it is definitely useful information for me. Fortunately, my boss promised me to buy one MiniMac for me soon (hopefully this week!) so I think I'll be able to make the library usable also on Mac in the near future.

      Regards
      Michal

       
    • Hi, I'd like to announce that most of (all?) wxMac related bugs have been fixed in SVN 223 so you can test and used the wxSF with wxMAC as well now!!!