View previous topic :: View next topic |
Author |
Message |
Wienczny
Joined: 10 Apr 2004 Posts: 35
|
Posted: Thu May 06, 2004 8:16 pm Post subject: GTK |
|
|
As the GTK modules are online now, I looked at the widgets directory. How do you want to include the GTK version into the source? |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Thu May 06, 2004 8:48 pm Post subject: |
|
|
This is definitely something that needs to be discussed again. I'm not quite sure what is best since the source for both is so different.
Method #1 is to just separate the files as include different directories for each port:
./widgets/win32
./widgets/gtk
... and so on with each directory.
This would allow future ports to be added fairly easily.
Method #2 would be to cram each module with version statements delineating the ports. I think the differences between the gtk and win32 sources are significant, so we could count on the modules growing quite large for any new port added.
Discuss away. I'm actually thinking that method #1 above is the only sane way. But there could be another good solution out there. |
|
Back to top |
|
|
Wienczny
Joined: 10 Apr 2004 Posts: 35
|
Posted: Fri May 07, 2004 8:09 am Post subject: |
|
|
I would suggest to have an interface for every API class in dwt.widgets.interface. Then we would have platform specific implementations in dwt.widgets.gtk dwt.widgest.win32 etc.
Then we could inherit the version we are using in dwt.widgets.
Platformindepenend code should be in dwt.widgets.
[/code] |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Fri May 07, 2004 8:53 am Post subject: |
|
|
That sounds like a useful idea.
Brad and Andy? What do you guys think? |
|
Back to top |
|
|
brad Site Admin
Joined: 22 Feb 2004 Posts: 490 Location: Atlanta, GA USA
|
Posted: Fri May 07, 2004 9:15 am Post subject: |
|
|
It sounds pretty good to me. I'm just bummed that widgets wasn't already "inherited up" - I guess this is what Ant was saying a while back. So, I guess we have to do this.
Maybe we could deviate a bit from SWT, and see where the differences could be combined in DWT (dwt.widgets). However, there may be very good reasons why the IBMers kept the two sets of widget classes separate by platform, like a fundamental different approach to drawing something on the different platforms.
We'll know more as we get into the code for both platforms. _________________ I really like the vest! |
|
Back to top |
|
|
andy
Joined: 15 Mar 2004 Posts: 71
|
Posted: Sat May 08, 2004 10:15 am Post subject: |
|
|
Since the implementation to be used is chosen at compile-time, interfaces only really make sense from a contractual standpoint. (so that we can assert that every implementation has all the proper public methods)
I'm not sure whether that's reason enough or not. It could certainly be thrown in later, though. _________________ "Complacency is a far more dangerous attitude than outrage." - Naomi Littlebear |
|
Back to top |
|
|
Wienczny
Joined: 10 Apr 2004 Posts: 35
|
Posted: Sat May 08, 2004 9:04 pm Post subject: |
|
|
Should we start doing it this way? Any more arguments pro or con? |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Sat May 08, 2004 10:00 pm Post subject: |
|
|
andy wrote: | Since the implementation to be used is chosen at compile-time, interfaces only really make sense from a contractual standpoint. (so that we can assert that every implementation has all the proper public methods)
I'm not sure whether that's reason enough or not. It could certainly be thrown in later, though. |
Steve's suggestion is indeed a compile-time solution; but that was the point the suggestion; it adds nothing of advantage to the programmer using the interface. It's just a useful construct for organizing different platform versions.
If we go this route we can more easily amalgamate the different platforms into one source tree that simply imports modules based on which OS it's to be compiled for. Then we don't have to have massive source files with multiple versions (method 1) or separate makefiles and completely separated platform projects (method 2; similar to the origina SWT). Here we still can install platform specific directories within the widgets tree, but still maintain a common widget class in the base widgets directory(?).
I'm not quite sure what is meant by using "interfaces" here. Maybe Steve could show an example. I may be interpreting this wrong.
We should get this figured out before we continue on... |
|
Back to top |
|
|
JJR
Joined: 22 Feb 2004 Posts: 1104
|
Posted: Thu May 13, 2004 11:51 pm Post subject: |
|
|
Since there hasn't been too much discussion going on here on the above solution, I'm going to go ahead and submit an "in the meantime" change to the svn. I'm just going to add two directories in ./widgets : widgets/gtk and widgets/win32. We can start filling these directories up with the appropriate platform widget implementations for now. Separate build files (makefiles and Scons conscript) for compilation will be necessary for each platform anyway, so we shouldn't absolutely require a higher level interface yet as long as we can build separately for each platform. Yet this update will still accomodate such changes later if they are to be done.
I may follow this directory structure with the other directories eventually too. It's easy enough to add extra platforms this way.
If anyone is interested in getting Scons setup for each DWT platform, that would be great. I know Andy had something working for the dwt/internal and dwt/graphics directories.
I'll be away tomorrow morning for 7 days or so. I'll catch up with this again later. |
|
Back to top |
|
|
andy
Joined: 15 Mar 2004 Posts: 71
|
Posted: Fri May 14, 2004 11:26 am Post subject: |
|
|
It wouldn't be hard to have a single SCons build script for all platforms, actually. You could just do something like this:
Code: |
from glob import glob
import os
import sys
env = Environment(ENV=os.environ)
SRC = (
glob('dwt/internal/*.d') +
glob('dwt/internal/*/*.d') +
glob('dwt/graphics/*.d')
)
if 'win32' in sys.platform:
env.Append(DVERSIONS='Win32')
SRC += glob('dwt/*/win32/*.d') # ooo
elif 'win64' in sys.platform:
env.Append(DVERSIONS='Win64')
SRC += glob('dwt/*/win64/*.d')
elif 'linux' in sys.platform:
env.Append(DVERSIONS=['Unix', 'Linux'])
...
env.Program(SRC)
|
_________________ "Complacency is a far more dangerous attitude than outrage." - Naomi Littlebear |
|
Back to top |
|
|
|