Welcome, Guest. Please login or register.

Author Topic: Wouldn't it be nice if...  (Read 3629 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Wouldn't it be nice if...
« on: September 19, 2003, 12:43:52 AM »
I was thinking about something earlier today.

Imagine, if you will, a library compiled for OS4, MOS and AROS.

This library abstracts the common MUI and Reaction (ie those of comparable functionality) classes behind a common interface. In addition it abstracts the event handling and other mechanims involved behind a simple, consistent API.

A user of the libray can use its functions to open their windows, add gadgets, modify them, query them etc.

I realise this isn't going to appeal to hardcore fans on either side of the GUI divide, but think of the advantage to the common middle ground programmer who wants to write applications quickly, without having to choose one over the other (MUI in particular is not everybodies cup of tea).

So, what do you guys reckon? It's a worthwhile job for the open amiga team if you ask me :-)
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #1 on: September 19, 2003, 01:50:50 AM »
Quote

Lo wrote:
Nice Avatar!
But it conflicts with your question?  MOS?
Yes, It would be nice! :-)
-edit-

doesn't look like that blue butterfly is giving up soon!
 :-P


Well, it's only a wee joke and supposed to represent the 'conflict' between the two camps, which is why neither side is winning or losing. Anybody who's known me for long can verify I'm not anti MorphOS or its userbase.

Back on topic, I think the above idea has merit. I am aware of technical differences between MUI and Reaction in terms of threads etc (MUI does its gadget work in the context of the applications thread, whereas Reaction does so on the input.device thread), but a good abstraction layer should be able to cope with this.
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #2 on: September 19, 2003, 10:47:37 AM »
Quote

iamaboringperson wrote:
That's what I've been talking/thinking about for a long time.

I think it's a great idea, and I honestly believe it can be done.


It would be nice to have a kind of C++ touch to it, if you know what I mean! ;-)


I getcha :-) As it goes, however, the existing amigaOS shared library thing is not an ideal candidate for a C++ system.

My take is to go for a normal shared library approach (OS4 version could use an Interface instead) and provide two headers.

Specifically there could be a opengui.h for C abd opengui.hpp for C++.

The latter could use some class wrappers and factory methods and such for people who prefer the paragdim.

More than likely, a small stub link library might be required - ideally what we need to do is to prevent the opengui header (that is the user header) from having to include any mui or reaction stuff. Only the library source should do that.

In other words, the abstraction would be total.

Abstraction techniques are kind of my thing but unfortunately MUI and Reaction are not.
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #3 on: September 19, 2003, 11:18:43 AM »
Quote

iamaboringperson wrote:
...
I think if we were to look at the similarities between the different systems we could map out which functions can be used in common between them.


That's the basic idea, yes. However, by designing an API 'from scratch', we can get away with matching up slightly less compatible classes from each system since we define what access level the end user has. Additionally, in each specific implementation, we can fill in the gaps to make the overall behaviour consistent.

Realistically we need to get the common buttons, menus, lists, scrollers, choosers and other gui elements under our umbrella. Support for more exotic classes (and for MUI this is quite a lot, I guess) is of lesser importance to the target audience.

Quote

Data structures might need to be unique to this new gui thing.


Well that's an implentation detail and is probably inevitable as most abstraction layers need to track data not belonging to the layer beneath.

Such things should, wherever possible, be hidden from the end user. What most people want are simple methods for opening windows, creating gadgets, binding them and suchlike. Our handles to said gadgets can be abstract (a pointer or whatever) that is given as an argument to our functions.
A C++ version would simply use a wrapper class for this instead.

Eg C interface

OGWindow* guiWindow;

guiWindow = OGWindow_Create( ... );

if (guiWindow!=NULL && OGWindow_Open(guiWindow) == TRUE)
{
    /* stuff here */
}

A C++ version could look a little different, depending on how OOP you want it to be...

OGWindow* guiWindow;

guiWindow = OGWindow::Create(..); // factory method

if (guiWindow!=0 && guiWindow->Open() == TRUE)
{
    // ...
}

Both versions would offer the same abilites, just differ in how they are presented to the programmer.

Quote

I imagine compareing two string gadget(as an example) classes, and looking for similar methods etc. and then writing new functions that will in turn call either of the MUI or ReAction functions.
It might be a bit inefficient to begin with, but with faster machines in the futre it shouldn't matter too much.


Well, the overhead is far smaller than you might think and it's usually not time critical either. How many people would notice a delay of an additional hundred clock cycles after clicking something for a forwarding function that does a little interim work?
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #4 on: September 19, 2003, 11:30:59 AM »
Quote

bloodline wrote:
One idea bouncing around the AROS Team right now is to build a reaction wrapper for Zune (MUI)...

Thus, one would be able to run Reaction apps in Zune (MUI) :-)


Cool. However, supporting commonality of both GUI systems is only half the goal of this idea. Creating a simple (that is not relying on much knowledge of either GUI system), unified interface for programmers is just as important.

-edit-

My gut feeling is that a lot of (especially new) programmers are slightly put off by the way these guis are implemented.

Hell, I've been coding for some time and it still irritates me too :-)
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #5 on: September 19, 2003, 11:53:58 AM »
Quote

Kronos wrote:
Sorry, but I have to disagree here ;-)


Yeah, I thought you might ;-) :lol:

Quote

The 3rd-party-classes are one of the biggest arguments for MUI (and sometimes the
biggest against it :-o ).

Coding a "real" MUI-app without useing those, is next to impossible, unless
you create your own classes inside your project, which would most
likely break the compabilty with your ReAction-layer.


Well, that depends on what you mean by a "real" MUI app, or even a "real" Reaction app for that matter. Is a simple MUI app using a popup list, a few radio buttons, some checkboxes a menu and couple of buttons so different from a reaction app using the same equivalent set of controls?

Quote

MUI and ReAction are just to far apart for your idea to turn into reality(without adding lots of bloat).


Well, I dunno - I'd rather try and die than listen to a record by Olivia Newton John...
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #6 on: September 20, 2003, 11:43:28 AM »
@Ima...

To hell with the nay sayers :lol: I'm actually considering the deployment details of it already ;-)

I don't expect to have a great deal of time to work on it however :-(
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #7 on: September 20, 2003, 09:26:55 PM »
Quote

iamaboringperson wrote:
@bloodline

That's very nice about Zune, but we are talking about somthing that will appeal to MUI haters! ;-)


Also, people like myself who actually like reaction but would like to support MUI also.
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #8 on: September 21, 2003, 01:12:59 AM »
@jaokim

The basic idea is to provide an API that is simply a common interface to the overlapping features of different GUIs (in this case MUI / Reaction). The interface I'm thinking of will be implemented in a C (and C++ via wrapper classes perhaps) style compliant way without the orgy of macros, boopsi style method calls etc.

The idea is that you include only this header (not anything for MUI or Reaction) and use only this interface for your applicaton.

There are two realistic alternatives for this

1) A statically linked library that you build into your project. It uses conditional compilation to generate the appropriate code for each system.

+ easy to implement and test
- underlying GUI developer materials are required
- GUI becomes 'hard coded' into application
- Impossible for end user to choose gui

2) A shared library that you open and it itself delegates to the underlying GUI

- trickier to implement
- Common API library plus GUI specific sub libraries may be required
+ equivalent shared libraries can be created for various GUIs
+ possible for end user to use alternative GUIs (which library to use could be an env var etc)
+ Original GUI developer resources are not required to develop with library.

As you can probably tell, I'm inclined to go for option 2...
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #9 on: September 21, 2003, 12:14:38 PM »
-edited-

@Ima - sorry didn't parse youre last sentence correctly (expected ',' found 'GUI') :-P

For a minute I misinterpreted you as saying:

"I think when designing this GUI, builder programs should be considered"

I was about to say "What GUI? I'm not writing a GUI...."

To address your point, if we had a single GUI builder program that catered for both reaction and mui, there may not be any point in this API anyway other than for runtime compatibility...

Dont get too carried away with C++. The API should cater for both, not everybody is a C++ fan and the amiga shared library system isn't exactly ideal for C++ code.

For C++ support, a seperate header that exposes the API interface through wrapper classes is about as good as it will get. This will also probably incur a small linker library too.
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #10 on: September 21, 2003, 12:58:03 PM »
SDL eh? I don't code for the competition (joke)...
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #11 on: September 21, 2003, 01:45:51 PM »
I am working on an abstract gui system for my portability project but its nothing at all to do with OS native GUIs.
It defines the control interface, the drawing methods and such are pure virtual functions that must be defined by the application designer. It is only meant to do the basic event control donkeywork for an otherwise totally 'free to implement as you wish' gui system...

int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #12 on: September 21, 2003, 10:11:35 PM »
Are you serious?

The avatar I made here wouldn't fit. It's still just a joke dude, check the tag line there. Big deal the dude with the chaincannon won the animation allowing me to squeeze it into 5k. So am I an anti-MOS troll now then?
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show all replies
Re: Wouldn't it be nice if...
« Reply #13 on: September 21, 2003, 10:17:10 PM »
Thanks ;-) - jeez people are wound up too tight these days :lol:

Seriously, some bridges need to be built between the 'camps'. I had thought this might be an interesting way to make a start...

-edit-

BTW, I'm referring to GUI abstaction, not ballistics tests on butterflies ;-)
int p; // A