Code enhancement proposal

Nov 13, 2011 at 4:02 PM

Hello Jason,

I have done some small changes to Hieroglyph 3. Small but fundamental IMO.

Basically, I have managed to have the WindowProc being a method of the Application object. This way we can use the full power of OOP to use Hieroglyph 3 to our own requirements. The user can easily create his own custom message handler

I also created Application::MessageLoop which is the new home for the application message pump (PeekMessage/GetMessage/translateMessage/DispatchMessage). Again we can now use the full power of OOP to tailor Hieroglyph 3 to our own needs.

The main advantage, beside being OOP, is that it is now possible to adapt Hieroglyph 3 to a number of new applications without requiring to change the source code within the framework. My changes also do not require too much changes at the demo application level, if any.

Now that i've done those changes, how do we proceed so that you can review/approve/modify/reject my changes ?

For developping that code, I made a simple "hello world" application using a single source file (not even a header file). I have taken the bases classes from Hieroglyph 3 (IEventListener, RenderWindow, Win32RenderWindow, Application and App classes), removing unecessary code for the purpose of tests. I have a new WinMain which basically is the same as in main.cpp.

I can send you that code for review, or I can inject it in Hieroglyph 3 source code and send you a diff file or directly commit to the subversion repository (Easy to go back should any serious problem occurs).

What do you think ?

-- Francois Piette


Nov 14, 2011 at 7:02 AM

Hi Francois,

That sounds great - thank you for putting together the changes!  I will take a look at the file you sent to me, and then if I have any questions then I'll post them here.  If all goes well, we should be able to incorporate the changes fairly quickly, especially if the main changes were the WindowProc and the message loop.

For now, we can simply do the changes manually.  This will allow us to quickly integrate the changes, but still maintain coherence with the rest of the library.  If we find in the future that you will be contributing lots of code, then we would consider adding you with commit access to the repository.

Thanks again for the contribution, and I will get the changes incorporated as quickly as possible (most likely after the current commit I have been working on).

- Jason

Nov 14, 2011 at 5:02 PM

Hi Jason,

OK, I will insert the changes to my local copy (currently it is only in the single file demo) and send the diff file to you. Or maybe you prefer to receive complete files instead of a diff ?

-- Francois Piette


Nov 15, 2011 at 4:01 AM

I haven't ever used a diff file before, but I am willing to try out either possibility.  How does one apply a diff file to the repository???

Nov 15, 2011 at 5:06 AM

It very easy. I use Tortoise Subversion Client which integrates with Windows Explorer (righ click menu on a file or folder).

A diff file is a simple text file telling the differences between two source files (by the way: any text file is OK). Using Tortoise, you right click on the folder containg you local working copy of the repository, select "TortoiseSVN" and then "Apply Patch". You then navigate to the diff file which contains in the first lines the relative path into the working directory and then the line removed/added. Very easy.

You may create yourself a diff file and see what's in. Instead of apply patch, you select create patch. Open the resulting diff file with a text editor and you'll understand how it works and what it does. Create a diff file after having uncommited changes so that the file is not empty of course.

-- Francois Piette


Nov 15, 2011 at 7:01 PM

Hi Jason,

Update (diff file) sent by email. Let me know if it reached you.

-- Francois Piette


Nov 16, 2011 at 5:31 AM

Hi Francois,

I just got the email, and I will take a look at it later tonight.  I'm giving a presentation tomorrow at a conference, so the next couple days are likely not going to be very productive - but as soon as I integrate everything I will let you know.

Thanks again for contributing!

- Jason

Nov 16, 2011 at 4:40 PM

OK, no problem.

-- Francois


Nov 28, 2011 at 1:15 PM

Hi Francois,

I just pushed the commit with you patch included (with a few other unrelated changes too).  It worked perfectly - nice job!  Thank you for the contribution, and let me know if there are other items that need my attention.

- Jason

Dec 3, 2011 at 7:31 AM

I updated my local copy today. I will let you know if I find any problem.

btw: Thanks for the credit in the SVN log. I would have appreciated to have credit in the readme.txt file in the "Acknowledgements" section with my name and email address  (or in a new section "Contributors").

Dec 3, 2011 at 2:08 PM

That sounds like a good idea - I will add a section on contributors and add your name to it.  Can you please let me know how you would like your name to appear, as well as which email you would like to be listed?

Dec 3, 2011 at 4:18 PM

Since my email address contains my name, specifying it is probably enough depending on how you want to structure the contributors section.

As you probably know, my first name is Francois (By the way the correct typography is François but not everyone has the c-cedilla available on his keyboard), my lastname is Piette and my email is francois dot piette at overbyte dot be. My website is www dot overbyte dot be.