Thomas Fjellstrom: > Parts of a platform's implementation is included in the portability library, > when imo, it should all be in the individual platform's code. All the ifdef > PLAT_GTK etc.
The initial section of Platform.h that defines the PLAT_* is there to get a clean idea of the current platform in the presence of various conditions such as platform layering (wx on GTK or GTK on Windows). > In my view, it would make more sense for the "portability library" to include > nothing but some virtual interfaces, and have the specific platform code > subclass those. This would allow the platform code to use the objects as the > subclassed objects, while the editor can just assume the base features exist. There are costs to making all of these interfaces and requiring explicit allocations. Some classes (Point, PRectangle, Colour*) are very simple and adding a vptr to their implementations and requiring dynamic allocation appears unwise. These definitions can be reasonably applied on most platforms while not quite universal in the face of platforms that use floating point coordinates or 48 bit colour. Surface is an interface with no fields defined and with a factory method returning an implementation subclass. The other classes are wrappers around an ID which is typed as a void*. This allows platform code to either use a platform ID or define an implementation class that encapsulates multiple pieces of state (pimpl). The exceptions are Palette and Font which have multiple fields and #ifdefs. It would be better if these just had an ID field or were interfaces. > I'm really wondering what led to the current design, it seems like what I > suggest was intended originally, but other things were happhazardly hacked in > on top of things, making rather more difficult to add a new platform (in my > case, Qt4). Its more back and forth than that with both more and less platform checking over time. The original code had many platform artifacts. If there is a good case for adding platform dependent code then I'll allow it but will also try to remove platform dependent code over time. Surface became too crusty with #ifdefs so was changed to an interface. I think it is actually possible to add a new platform without changing Platform.h but it may be more work. Palette could cause trouble but it is rare for people to care much about paletted displays any more. Neil _______________________________________________ Scintilla-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scintilla-interest
