Page 1 of 2

GUI Toolkit NF (under development)

Unread postPosted: 28 Jul 2021, 06:48
by SlyVTT
Dear Ti-Planet Members,

I hope you are all doing well. Long time no write ... I have been extremely busy at work during these last two months and hence was tied up far from my keyboard, ... and from the GUI Toolkit effective development.
But now this period is over and I am returning back to coding, with new ideas ... and maybe more important, a new project.

During this period without coding, I thought a lot on how I can improve the Toolkit and solve some issues/misconceptions. I then decided to restart the project from scratch, taking benefit of building a new architecture able to reuse concepts that where proven to work and implement new ones for parts that where not very good in my first attempt.

So I am now coding the root of the GUI Toolkit NF (with NF standing for "New Foundation"). This is new the "hardware layer" that is under consideration with 3 managers recoded from scratch :
- KeyManager to handle the events linked to keys (all except one of the TouchPad) : all keys can be checked one by one (pressed status true/false) as well as Press Event / Release Event (transitional state)
- MouseManager to handle the events linked to the Touchpad (including the arrows and click keys) : for keys, same as above + position x/y of the mouse cursor. With user able to define the sensibility of the movement.
- Renderer able to render various geometrical primitives AND able to handle SDL or nGC (based on a #define preprocessor directive)

One of the problem of the first GUI Toolkit was that several instances of the keyboard/mouse handlers could be created by user, leading to some strange behavior. So now it is written using Singleton approach.

For the renderer, this is the very begining and I am learning how to use nGC.

As usual, more news to come very soon.

Regards and keep safe

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 28 Jul 2021, 20:42
by SlyVTT
A new Github repository has been created accordingly.

Everything can be found her : https://github.com/SlyVTT/Widgets-Spire-NF

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 04 Aug 2021, 19:09
by SlyVTT
Dear All,

This is a brief overview of the current status of the development of the GUI Toolkit NF.

One week after the start of the project, things are moving forward at a relatively good pace, considering that I do not spend that much time coding.
Right now, I am working on the foundation of the Toolkit, meaning the classes needed to properly interact with either the hardware and the main classes of the application.

The GUI Toolkit NF has reached an important milestone (in my development roadmap :p ) :
- the KeyManager class is now finished - all keys are correctly captured as well as transient events (Press and Release event)
- the MouseManager class is also now finished - cursor position and clicks are correctly captured as well as all arrow keys (*). As for KeyManager, all transient events for keys are also captured.

(*) as the arrow keys are physically linked to the touchpad, I was a bit concerned by the class to be used to track their status. I finally decided to use the MouseManager to be inline with the actual way of getting the information from the hardware and improve the performances.

- the two renderers used in the Toolkit, i.e. ScreenRenderer for on screen visual drawing and DepthBufferRenderer for off screen operations are working and are able to use both SDL and nGC.

We can choose the rendering mode by commuting a single #define preprocessing directive into a header file :
If SDL is used for rendering the primitive, we use :
Code: Select all
//RENDER_MODE To be set to 1 if SDL is used as the renderer, and to 0 otherwise
#define RENDER_WITH_SDL 1


if nGC is chosen for rendering, we switch to :
Code: Select all
//RENDER_MODE To be set to 1 if SDL is used as the renderer, and to 0 otherwise
#define RENDER_WITH_SDL 0


Quite easy, isn't it ? B-)

Of course, this is a balance between performance / portability of code and size of the executable.

For example, the same application (very simple PoC as depicted by the following pictures) gives the following figures :
- compiled for use with SDL rendering : size of the executable : 280kb
- compiled for use with nGC rendering : size of the executable : 130kb

Visuals are very similar. This is the great part of my current job to have a sufficiently robust ScreenRenderer class able to perfectly translate the Toolkit Drawcalls either to SDL or nGC in a smooth way and without visual artefacts. Following are two pictures of the same program, compiled once for use with SDL and once for use with nGC.

Image Image

As usual, the target is to get a simple way to code applications, so for the end user, it means a minimum code to write.

This simple app is coded with the following lines :

Code: Select all
#include "ToolkitNF/GUIToolkitNF.hpp"

int main( void )
{
       WidgetApplication::Initialize();

       DesktopWidget* desktop = new DesktopWidget( "I am a Desktop", 0, 0, SCREEN_WIDTH_GUI, SCREEN_HEIGHT_GUI, nullptr );
       ButtonWidget* button = new ButtonWidget( "Hello World !!!", 25, 25, 250, 20, desktop );

#if RENDER_WITH_SDL == 1
       ButtonWidget* button2 = new ButtonWidget( "We are rendered with SDL", 25, 50, 250, 20, desktop );
#else
       ButtonWidget* button2 = new ButtonWidget( "We are rendered with GC", 25, 50, 250, 20, desktop );
#endif
       button2->Disable();



       WidgetApplication::AddChild( desktop );

       WidgetApplication::SetBackgroundPicture( "/documents/Widget/Wallpapers/002.bmp.tns" );

       WidgetApplication::PrepareForRun();

       while (!WidgetApplication::AskForClosure() && !button->IsPressed()  )
       {
              WidgetApplication::Run( WidgetApplication::Normal );
       }

       WidgetApplication::Close();

       return 0;
}


As you can read, the second button uses a condition to get its text content updated :D

Now the big part of my job is to convert all the code of all the widget of the GUI Toolkit (not NF) to the GUI Toolkit NF ... May be a bit long.

Ciao

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 09 Aug 2021, 20:45
by SlyVTT
Hello,

This is a status of the current development of the GUI Toolkit NF for the TI nSpire, right before taking some days off for summer vacations.

The conversion of the Toolkit from the "old fashioned" structure to the new "NF concept" is moving forward and almost all the widgets of the revision 0.9b are now available for the GUI Toolkit NF. The only exception is the GraphicContextWidget that needs to be heavily reimplemented to be compliant with the NF structure. It may take some time (and also some brain juice), especially considering the version using the nGC library for which some very low level portions of code will be needed to create specific drawing primitives able to handle the context (= a memory buffer).

To demonstrate what the various versions of the toolkit(s) can actually do, I put hereafter some screenshots (all done through internal routines of the toolkits). The application is a simple text editor able to handle various styles. It is far from being finished and there are still bugs to track and some parts of the Toolkit routines to be correctly tuned...

... But this is enough speach, let's go for the pictures ...

Version made with the "old fashion" GUI Toolkit rev 0.9beta : size 576ko - Need SDL - Functional / very limited bugs (but still some :p )
Image Image Image Image Image Image

Version made with the "new" GUI Toolkit NF using SDL for rendering : size 300ko - Need SDL - Some bugs to be corrected, making behaviour quite hazardous right now (but improving >:] - Under debugging phase)
Image Image Image

Version made with the "new" GUI Toolkit NF using nGC for rendering : size 147ko - No Need for SDL - Some bugs to be corrected (the same as for the above version, making behaviour quite hazardous right now (but improving >:] - Under debugging phase + Need for developping some conversion routines based on nGC )
Image Image Image Image

For the two NF versions, I tried to take the same screen captures, to let you see the (almost) similar rendering of the application. There are some artefacts in the drawing primitives (especially the rounded rectangles) in the nGC version that will be improved later on.

Performance wise, all versions behave almost similarly, but I need to perform some accurate benchmarks when all features will be correctly implemented without "big bugs".

I am still in the process of making something easily useable, this is tested on my machine (a CX II-T CAS with OS 5.2), but I would be very happy in the future (let says when its done) if some volunteers could test on some other hardware and/or OS version. The target is CX/CX-II (to have color rendering).

Let me know you toughts,

Ciao and Bonnes Vacances

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 09 Aug 2021, 20:50
by Adriweb
Great job :D Looking forward to the next update.

Re: GUI Toolkit NF (under development)

Unread postPosted: 25 Sep 2021, 12:44
by SlyVTT
Hello,

so that's a long time since my last update in this post.

Many changes have been done in the GUI Toolkit NF, it would be much too long to explain everything here, so I will explain the main one : PC compatibility.

The Internal code has been updated to be able to run on both the nSpire architecture and a PC (tested on linux, but should also be compatible with windows when compiled with the appropriate toolchain).

This allow a quicker development, testing and debugging.

As PC can have larger screen resolution than the nSpire (320x240), the Toolkit is able to take this into consideration when the build target is PC.

I am now working on debugging heavily the Toolkit in order to make it as perfect as possible (still some work to be done).

Below are some examples of what is currently (almost) working (screenshot using internal Toolkit routines with a resolution of 640x480) :

Image Image
Image Image

More to come soon.

Ciao

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 11 Nov 2021, 10:19
by SlyVTT
Hello,

suite à des échanges avec Bernard Parisse, j'ai pu upgrader quelques fonctions intéressantes afin d'implémenter à terme un widget "Horloge".

Dans ma classe "TimeManager" j'ai désormais diverses méthodes qui retournent les infos sur l'heure courante :

  • int TimeManager::GetCurrentHour() qui donne HH courant entre 0 et 23
  • int TimeManager::GetCurrentMinute() qui donne MM courant entre 0 et 59
  • int TimeManager::GetCurrentSecond() qui donne SS courant entre 0 et 59
  • void TimeManager::GetCurrentHour( int* HH, int* MM, int* SS) qui donne HH:MM:SS courant entre 00:00:00 et 23:59:59

C'est multi-cible, sur Nspire cela passe par tes indications (via le RTC) et sur PC, ça passe par les fonctions de <time.h>.

Voici ce que ça donne sur la cible de rendu PC (juste affichage sans passer par un widget spécifique, il faudra que je code spécifiquement un DigitalClockWidget) :
Image

et sur la nSpire :
Image

Merci beaucoup à Bernard.

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 13 Nov 2021, 00:16
by Adriweb
Bien joué, ca avance bien !

Re: GUI Toolkit NF (under development)

Unread postPosted: 20 Jan 2022, 21:56
by SlyVTT
Hello,

Pour ceux qui se poseraient la question, le développement du GUI Toolkit NF n'est pas stoppé, il a juste été mis quelques temps en pause, par excès de flemme (un peu :) ), par manque de temps (pas mal :| ) et par manque d'idée face à un gros problème de crash (vraiment beaucoup :( ).

Après ces quelques semaines à laisser décanter et à programmer Magic Light, je me remets désormais dans le dur du Toolkit. Retour au C++ pur et dur pour implémenter un GarbageCollector lié à la classe WidgetApplication dont le rôle sera de faire le ménage lors de la suppression dynamique de Widget, mais aussi en fin d'application pour rendre la main proprement au système.

Autant dire que quelques soirée prises de chou sur les bugs sont déjà prévues dans les semaines à venir :bang:

Je vous en dis un peu plus dans les jours qui viennent.

Ciao

Sly

Re: GUI Toolkit NF (under development)

Unread postPosted: 23 Jan 2022, 18:28
by SlyVTT
Hello,

voici un petit point d'avancement du GUI Toolkit NF dans son état courant sous forme d'une courte vidéo.

La démo tourne sur PC, ce qui facilite l'enregistrement, mais est tout aussi fonctionnelle sur nSpire, passer d'une architecture à l'autre se faisant juste via une recompilation avec le Makefile ad-hoc.

Sans plus attendre voici la démo :



Vous pouvez y voir illustrées quelques fonctionnalités :
- menus, barres d'icones
- multi-fenêtrage avec agrandissement/restauration/minimisation de la taille de fenêtre,
- "graphical context" avec affichage d'une image (logo du projet) et une autre avec traçage d'un cercle (par exemple pour créer un logiciel de dessin/CAO)
- Rich Text Multiline pour par exemple créer un traitement de text ou un IDE de programmation

Encore quelques bugs à tracker/corriger, mais déjà une base solide.

More to come soon B-)

Ciao

Sly