Sunday, June 15, 2008

Saying goodbye to wxWidgets (partially)

Turns out there were a lot more wxWidgets functions used in the backend than I expected.

After a few hours of rewriting code, I managed to almost replace all. However, I'm left with a few stubs (I only committed a zipfile with the changes, I don't want to break the build in SVN). Here's a list of the new functions and changes:

  • static std::string ioCommon::GetPathname(std::string fullpath); // UNFINISHED
  • static std::string ioCommon::GetFilename(std::string fullpath); // UNFINISHED
  • static bool ioCommon::FileExists(std::string filename);
  • static bool ioCommon::FileExists(const char* filename);
  • class BufferedFile; // UNFINISHED
  • class TempFile; // UNFINISHED
  • const std::string syString::Format(const char* format, ... );
  • const std::string syString::FormatBig(unsigned long bufsize, const char* format, ... );
  • enum sayaEventType;
  • enum sayaYesNoCancel;
  • class sayaEvtHandler; // This will be used for handling the events coming from the backend.
  • class sayaConfig; // A wxConfig wrapper, it's an abstract class.
  • class sayaConfigProvider; // abstract class. UNFINISHED; needs an implementation (wrapping) done in wxWidgets.
  • const wxString std2wx(const std::string& str);
  • const wxString std2wx(const char* str);
  • ALL wxString references in ProjectManager were replaced by std::string
  • Since wxWidgets uses the _() macro, all literal strings will have to be surrounded by gettext().
For now it seems that we have to implement the stubs I created. But after that, the code architecture will be much more robust and cleaner, because the ProjectManager and related classes now only depend on the STL and some basic libraries like stdio. This means that if someone wants to make a frontend for the project in QT, it will be much easier for him to do it now.

Now I have to go to sleep. I'm dead.

1 comment:

Huy Phan said...

Look like that you have the same idea as mine... trying to be less dependency on wxWidgets so that:
+ (1) Easy to switch to other GUI framework such as QT.
+ (2) Easy to integrate with other programs through STD ++ Libraries..

(mine is http://hoxchess.googlecode.com/)