Tips, tricks, and rants from the wxWidgets
and project management expert, Bryan Petty.
Home DeviantArt Study Gallery Anime Dump

Backporting wxFontDialog for wxMac 2.6 · 2006-10-09 20:30

If you work on a Mac OS X port of your application in wxWidgets, chances are pretty good that you’ve run into the same problem as everyone else on wxWidgets 2.6: there is no native standard font dialog. Instead, you get this really ugly generic font dialog with no option to select a font face.

No application wants to ship a product using that generic dialog, especially if you use it as much as I do. But since we’re working on Mac here, and we have to either distribute new wxWidgets dynamic libraries or statically link against our own build (to make up for the lack of 2.6 binaries on 10.4), we have the ability to change this. The latest and greatest code in wxWidgets CVS (2.7) has already solved our problem. Stefan was kind enough to put together some hacks to add OK and Cancel buttons to the native non-modal standard font dialog, and force it to behave like a modal dialog.

If you’re working on some new open source application, this is great because you’re probably just going to grab the latest testing release, build against that, and make it a minimum requirement for your application. If you’re not so lucky like me, you don’t have a choice but to stick to the latest stable release (2.6) and deal with it. I personally can’t just jump to 2.7 because we have 130k lines of code that was built specifically to run on wxWidgets 2.6 (a small portion of the code still there was even initially written for 2.4 a long time ago), and I have to carefully pick a time for pushing upgrades downstream other than around release time for any of our supported platforms so we have time to test all of our incredibly numerous and complicated features. Instead, we simply backport the new font dialog changes from 2.7 to our 2.6 copy. This is a common task I’ve run into on a few different occasions now, sometimes it’s easy, other times it can get messy.

So how do we backport wxFontDialog? Knowing it’s been fixed in CVS, you find out any information regarding how it was fixed and what issues were in the way by looking through wx-dev mailing list archives searching for posts about wxFontDialog. You will find that when it was written, it was added with the mac specific configuration option called “wxMAC_USE_EXPERIMENTAL_FONTDIALOG”. A simple command can find us everywhere in CVS that this is used thus finding all the locations where code was changed to add support for this:

tierra@aramaki ~/cvsroot/wxWidgets $ grep -rn wxMAC_USE_EXPERIMENTAL_FONTDIALOG .
./include/wx/mac/carbon/fontdlg.h:22:#ifndef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
./include/wx/mac/carbon/fontdlg.h:23:#define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 1
./include/wx/mac/carbon/fontdlg.h:26:#if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
./include/wx/mac/carbon/fontdlg.h:48:#else // wxMAC_USE_EXPERIMENTAL_FONTDIALOG
./src/mac/carbon/fontdlg.cpp:43:#if wxMAC_USE_EXPERIMENTAL_FONTDIALOG
./src/mac/carbon/fontdlgosx.mm:40:#if wxMAC_USE_EXPERIMENTAL_FONTDIALOG

Now we just need to go through the files, diff them against our 2.6 version, make changes appropriately, and pray that there aren’t new dependancies we have to deal with. I’ll save you the suprise and let you know up front that you’ll need to change a couple “FromRGBColor” function calls back to using the old “Set” funtions used for the same purpose in 2.6. You’ll also want to add the new wxMacGetEventParamType functions needed in include/wx/mac/carbon/private.h.

Comment

Netjuke on PHP5 · 2005-08-26 16:34

This became troublesome for me, and I barely managed to find the solution for fixing up Netjuke to work on PHP5 using a Google cache of a post on the Netjuke site (which is currently down, and has been for a while).

These instructions have been tested on 1.0-rc1 and 1.0-rc2. As found in the cache, I'll post it here so it isn't lost when the cache disappears. I'd like to thank Daniel Stammler for the work. You can download Netjuke here.

My configuration is: Win XP SP1
Apache 2.0.48 / Php 5.0.0b2 as module / Mysql 4.0.16

I had to change some things in order to make it work:

== adodb.inc.php ====================

==> I don't know if it is important, but added for PHP5 compatibility

93 if (strnatcmp(PHP_VERSION,'5.0.0')>=0) {
94 define('ADODB_PHPVER',0x5000);
95 } else if (strnatcmp(PHP_VERSION,'4.3.0')>=0) {
96 define('ADODB_PHPVER',0x4300);

==> Changed from / to \ as it did'nt load the mysql
driver (I think there must be another way as I might
lose compatibility with Linux based servers. I will
check with this magic quote thing...)

3165 return @include_once(ADODB_DIR."\drivers\adodb-".$ADODB_Database.".inc.php");

== adodb-mysql.inc.php ====================

==> Changed from &GetRowAssoc to
GetRowAssoc (generated a fatal error on passing
variables as reference)

447 function GetRowAssoc($upper = true)

== inc-common.php ====================

==> Changed because it asked to upgrade from
PHP 5.0.0 to PHP 4.1.0 or higher!!!

19 if (((int) substr (PHP_VERSION, 0, 1)) * 10 + ((int) substr (PHP_VERSION, 2, 1))<41)

==> Changed PRIVATE to JUKE_PRIVATEas it was
issuing a parse error with T_PRIVATE conflict

681 if ( (JUKE_PRIVATE == true) && ($NETJUKE_SESSION_VARS["email"] == "") ) {

== login.php ====================

==> Changed PRIVATE to JUKE_PRIVATE as it was
creating a Parse error with T_PRIVATE

4 define( "JUKE_PRIVATE", false );

Well, that's what I did. I am not an Apache/Php
configuration specialist. Maybe there is something
in the configuration that I missed that lead to those
changes or not. If you have some time and
advises... All I can say is that it works great and
that netjuke is what I was looking for since a long
time. Great job

I hope those informations are helpful
_______________
Daniel Stammler

As a small note, if your installing Netjuke on Linux, you don't need the second change to adodb.inc.php.

Comment