Revision: 7484
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7484&view=rev
Author:   vadz
Date:     2008-06-24 05:28:18 -0700 (Tue, 24 Jun 2008)

Log Message:
-----------
don't use functions deprecated in latest wx svn trunk; remove unnecessary 
progress dialog from wxIconManager

Modified Paths:
--------------
    trunk/M/include/gui/wxIconManager.h
    trunk/M/src/gui/wxIconManager.cpp
    trunk/M/src/modules/Migrate.cpp

Modified: trunk/M/include/gui/wxIconManager.h
===================================================================
--- trunk/M/include/gui/wxIconManager.h 2008-05-23 02:15:37 UTC (rev 7483)
+++ trunk/M/include/gui/wxIconManager.h 2008-06-24 12:28:18 UTC (rev 7484)
@@ -131,7 +131,7 @@
    /// have we checked for supported formats?
    static bool m_knowHandlers;
    /// list of supported types, terminated with -1
-   static long m_wxBitmapHandlers[];
+   static wxBitmapType m_wxBitmapHandlers[];
    /// number of handlers
    static int ms_NumOfHandlers;
    /// check this path first

Modified: trunk/M/src/gui/wxIconManager.cpp
===================================================================
--- trunk/M/src/gui/wxIconManager.cpp   2008-05-23 02:15:37 UTC (rev 7483)
+++ trunk/M/src/gui/wxIconManager.cpp   2008-06-24 12:28:18 UTC (rev 7484)
@@ -101,20 +101,20 @@
 #define NUMBER_OF_FORMATS 4
 
 bool wxIconManager::m_knowHandlers = false;
-long wxIconManager::m_wxBitmapHandlers[] =
+wxBitmapType wxIconManager::m_wxBitmapHandlers[] =
 {
-   wxBITMAP_TYPE_XPM,  // XPM must be first entry!
-   wxBITMAP_TYPE_PNG,  //wxGTK
-   wxBITMAP_TYPE_BMP,  //wxGTK
-   wxBITMAP_TYPE_JPEG, //wxGTK optional
+   wxBITMAP_TYPE_XPM,
+   wxBITMAP_TYPE_PNG,
+   wxBITMAP_TYPE_BMP,
+   wxBITMAP_TYPE_JPEG,
    wxBITMAP_TYPE_GIF,
    wxBITMAP_TYPE_PNM,
    wxBITMAP_TYPE_PCX,
    wxBITMAP_TYPE_TIF,
    wxBITMAP_TYPE_ANY,
    wxBITMAP_TYPE_CUR,
-   wxBITMAP_TYPE_ICO,  //wxGTK ??
-   -1
+   wxBITMAP_TYPE_ICO,
+   wxBITMAP_TYPE_MAX
 };
 
 static const wxChar *HandlerNames[]    =
@@ -144,44 +144,32 @@
    if(! m_knowHandlers) // first time initialisation
    {
       ms_NumOfHandlers = 0;
-      for(int i = 0; m_wxBitmapHandlers[i] != -1; i++)
-         if(wxImage::FindHandler( m_wxBitmapHandlers[i] ) == NULL)
-            m_wxBitmapHandlers[i] = 0; // not available
+      for ( int i = 0; m_wxBitmapHandlers[i] != wxBITMAP_TYPE_MAX; i++ )
+      {
+         if ( !wxImage::FindHandler(m_wxBitmapHandlers[i]) )
+            m_wxBitmapHandlers[i] = wxBITMAP_TYPE_INVALID; // not available
          else
-         {
             ms_NumOfHandlers ++;
-         }
+      }
 
       m_knowHandlers = true;
    }
 
-   MProgressDialog *pdlg = NULL;
-   int   step = 0;
-   if(showDlg)
-   {
-      pdlg = new MProgressDialog(_("Please wait"), _("Loading image..."),
-                                 ms_NumOfHandlers+3);
-   }
    // suppress any error logging from image handlers, some of them
    // will fail.
    {
       wxLogNull logNo;
 
-      for(int i = 0; (!loaded) && m_wxBitmapHandlers[i] != -1; i++)
-         if(m_wxBitmapHandlers[i])
+      for ( int i = 0; m_wxBitmapHandlers[i] != wxBITMAP_TYPE_MAX; i++ )
+      {
+         if ( m_wxBitmapHandlers[i] != wxBITMAP_TYPE_INVALID )
          {
-            loaded = img->LoadFile(filename, m_wxBitmapHandlers[i]);
-            if(pdlg)
-            {
-               if(!pdlg->Update(++step))
-               {
-                  if(success) *success = loaded;
-                  delete pdlg;
-                  return *img;
-               }
-            }
+            if ( img->LoadFile(filename, m_wxBitmapHandlers[i]) )
+               break;
          }
-   }// normal logging again
+      }
+   } // normal logging again
+
 #ifdef OS_UNIX
    if(! loaded) // try to use imageMagick to convert image to another format:
    {
@@ -189,7 +177,8 @@
       String tempfile = filename;
       int format = READ_APPCONFIG(MP_TMPGFXFORMAT);
       if((format < 0 || format > NUMBER_OF_FORMATS)
-         || (format != 0 && m_wxBitmapHandlers[format] == 0)) //xpm we do 
ourselves
+         || (format != 0 &&
+             m_wxBitmapHandlers[format] == wxBITMAP_TYPE_XPM)) //xpm we do 
ourselves
       {
          wxLogInfo(_("Unsupported intermediary image format '%s' specified,\n"
                      "reset to '%s'."),
@@ -229,15 +218,6 @@
                     command.c_str());
          if(wxSystem(command) == 0)
          {
-            if(pdlg)
-            {
-               if(!pdlg->Update(++step))
-               {
-                  if(success) *success = false;
-                  delete pdlg;
-                  return *img;
-               }
-            }
             wxLogNull lo; // suppress error messages
             if(format != 0) // not xpm which we handle internally
             {
@@ -258,24 +238,13 @@
          if(tempfile.length()) // using a temporary file
             wxRemoveFile(tempfile);
       }// if(wxFile::Exists())
-      if(pdlg)
-      {
-         if(!pdlg->Update(++step))
-         {
-            if(success) *success = loaded;
-            delete pdlg;
-            return *img;
-         }
-      }
    }//! loaded
 #endif // OS_UNIX
 
    // if everything else failed, try xpm loading:
-   if((! loaded) /*&& m_wxBitmapHandlers[0] == 0*/) // try our own XPM loading 
code
+   if( !loaded ) // try our own XPM loading code
    {
       char ** cpptr = LoadImageXpm(filename);
-      if(pdlg)
-         pdlg->Update(++step); // ignore break here
       if(cpptr)
       {
          *img = wxBitmap(cpptr).ConvertToImage();
@@ -285,7 +254,6 @@
    }
    if(success)
       *success = loaded;
-   if(pdlg) delete pdlg;
    return *img;
 }
 

Modified: trunk/M/src/modules/Migrate.cpp
===================================================================
--- trunk/M/src/modules/Migrate.cpp     2008-05-23 02:15:37 UTC (rev 7483)
+++ trunk/M/src/modules/Migrate.cpp     2008-06-24 12:28:18 UTC (rev 7484)
@@ -1738,7 +1738,11 @@
 
 void MigrateWizardProgressPage::OnShow(wxShowEvent& event)
 {
+#if wxCHECK_VERSION(2, 9, 0)
+   if ( event.IsShown() )
+#else
    if ( event.GetShow() )
+#endif
    {
       wxCommandEvent eventOk(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
       wxPostEvent(this, eventOk);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to