The International Simutrans Forum

 

Author Topic: New GUI komponenten, may be useful for refining user interface.  (Read 6274 times)

0 Members and 1 Guest are viewing this topic.

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
I wrote 2 GUI components for TTT (Tiny Timetable, my private extension).
I think these may be useful for creators who are writing or refining user interface of Simutrans.

I'll expose these to the Community:
  - to need help!!: tune, grain, or correct behavior of these.
  - to give something for developers who are writing new extensions.

These are still in rough coded, still have a lot of points to be modified,
making constant value to be parameterized, caching coordinates to fasten zeichnen, ...

Current source files are attached in following replies.

Tiny introduction of these are following:

(1) "Hypertext Panel" - a sequence of texts and widgets.
  used in TTT: "Easy Setting Assistant" panel (like a simple "Wizard").
  (likes help viewers, but it can hold more sort of components.)
  Its sample view is top half of the attached image.

  gui_hypertext_t:  IS-A gui_container_t
    - appending text and GUI component (button, textinput, ...) sequentially.
    - appending line-break, vertical gap, separator.
    - texts can be aligned {left, center, right}
    - each text fragments are translated, and calculated width by translated text,
      then appending-cursor advance horizontally by the width.


(2) "Spreadsheet" - a 2D-array (row * column) of cells with row/column labels.
  used in TTT: "Timetable View" pane.
  Its sample view is bottom half of the attached image.

  gui_spreadsheet_t:  IS-A gui_komponente (implements gui_action_creater_t)
    - with adoptive X-Y scrollbar (none, auto, force)
    - each cell pointed by (C,R) is a subclass of ...::cell_t.
      view creators can implement own cell-view by inheriting cell_t.
    - set width and height for each row/column.
    - switch visibility of each row/column.
    - select row/column/cell by either mouse-click or cursor keys.
    - send 'action' to listeners when the selection is changed.


If you think name of these is not precise with its functionality,
please advise me better name for these.
And any comments are welcome.

(Current my version of source files are attached in following replies.)
« Last Edit: July 08, 2012, 11:08:47 PM by wackdone »

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
gui_hypertext_t
« Reply #1 on: July 08, 2012, 09:01:59 PM »
Attaching current source code of gui_hypertext_t.

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #2 on: July 08, 2012, 09:02:51 PM »
Attaching current source code of gui_spreadsheet_t.

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #3 on: July 08, 2012, 09:06:14 PM »
Wackdone
your work it intresting.
Gives A Simutrans.exe how that i can test it?

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #4 on: July 08, 2012, 09:20:11 PM »
Thanks your interests, greenling.

I'm developing my private extension on NetBSD (sorry, it's too minor OS X-)
I can make a executables for Windows or MacOSX by cross-buidling.

Currently, I'm exporting binaries for Japanese Community upon Up-loader service in Japanese.
I've not found international (or English) Up-loader site to present executable binaries.

Could you recommend which site is better to upload binaries?

(or, if you can read Japanese texts, I'll upload latest executable on Japanese uploader I'm using.)

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2346
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #5 on: July 08, 2012, 09:21:15 PM »
Impressive! :) Next there'll be a way of inputting formula into simutrans :p

If you zip the files you can upload them to the simutrans-germany site.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #6 on: July 08, 2012, 09:31:49 PM »
Finance dialog could make use of spreadsheet, and maybe even the (vehicles, stations, cities, goods, etc...) lists.

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #7 on: July 08, 2012, 09:32:29 PM »
Oh, excuse me, Community.
I've not known uploading facility of Germany site.

Please wait a while.
I'll build a Windows (GDI) executable based r5788 nightly with my latest patch.

But, sorry, I've not finished to write English README for TTT.
For writing it, please wait more time.

Again, Please wait a little bit time for executable.

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #8 on: July 08, 2012, 09:53:21 PM »
While building Windows binary, I'll post the current TTT patch.
It can be example usages of my components.
It has two parts enhancements.

(1) Basic logic to keep planned trip-time: CFLAGS += -DSCHEDULE_TIMETABLE
  user can specify split time between departure to departure for each stop of convoy (lined).
  If a convoy arrives halt too early than planned time:
    the convoy wait at halt until the time to go-on.
  If a convoy arrives halt with late:
    the convoy starts ASAP (and remember time delayed).

(2) Lot of codes to make TTT convenient: CFLAGS += -DSCHEDULE_TIMETABLE_TTV
  to use above logic.
  "Timetable view" button is added in line-management window.
 clicking the button, Timetable view window will expose.
  In this window, you can set something to adjust time planning: planned departure time, timetable cycle, split time between halts,...

I'm wandering to pick better words in English (mapping each concept).
Terms in transportation service are quite different between cultures, countries, I think.
If you give me advice about it, I thank you so much!


(There is no space to attach whole patch and documents (zipped), 64kBytes is narrow space.
 Okay, I attach patch only.)
« Last Edit: July 08, 2012, 11:37:46 PM by wackdone »

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #9 on: July 08, 2012, 09:59:48 PM »
kierongreen, please teach me URL of uploadable site in DE.
I'm looking simutrans.de.
Sorry, I understand very little German language.

Offline isidoro

  • Devotee
  • *
  • Posts: 1140
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #10 on: July 08, 2012, 10:28:51 PM »
I think the URL is: http://files.simutrans-germany.com/

Very nice job!  One of the parts where I think it could be useful is in depot window when you have to select a vehicle among dozens and want the data sorted by a certain property (speed, maintenance, etc.)

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #11 on: July 08, 2012, 10:37:19 PM »
Thank you for teaching me the URL.

I've uploaded the binary for Windows:
http://simutrans-germany.com/files/upload/simutrans-wackdone-20120709.zip

and tiny demonstration video which I've created in early development:
http://www.youtube.com/watch?v=XtmyXlTxvM4&feature=plcp

Use with caution:
  The executable using UNOFFICIAL savefile version number.
  Saving with this executable, it cannot be readable by original Simutrans.

Excuse me:
  all documents (except RRC) are prepared only in Japanese.
  but some expression, formulas can be read in English in UTF-8'ed document.

The executable binary is not well tested.
If it crashes, please report me.
« Last Edit: July 08, 2012, 11:03:08 PM by wackdone »

Offline wackdone

  • *
  • Posts: 35
  • Languages: JA, EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #12 on: July 17, 2012, 02:17:28 AM »
There were many bugs in spreadsheet component code I've posted before.
One of them is a serious problem around memory allocation.

I've re-written over half of codes, and it now under testing with my TTT extension.

Newer version of code is attached in this post.
To make code readable better,  class definitions of cell in spreadsheet were separated from sheet (cell container).
  gui_spreadsheet_t : is a gui_komponente_t
  gui_spreadsheet_cell_t and its children:  instances held by spreadsheet.

orcinusorca

  • Guest
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #13 on: September 18, 2012, 04:46:29 PM »
Great job done  ;)
Please, can you write as well some manual to install this feature?
Thanks a lot

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10641
  • Languages: De,EN,JP
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #14 on: September 18, 2012, 08:50:25 PM »
As we have CSV capabilities, one could this of marking spreadsheets of the statistics and copy them to Excel ...

Offline hreintke

  • *
  • Posts: 168
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #15 on: March 10, 2013, 02:37:47 PM »
@wackdone : Is this the latest version of your gui_spreadsheet ? I had to include some defines from the old version to make it compile without errors.

@All : Did anyone do some testing with these ? If so, can you share some example usage code ?

Herman

Online Yona-TYT

  • Devotee
  • *
  • Posts: 1613
    • Simutrans-BLOG
  • Languages: ES
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #16 on: March 10, 2013, 05:26:48 PM »
I would like someone  continue to this project ::'(

Offline greenling

  • Lounger
  • *
  • Posts: 1728
  • Simutransarchology it my hobby!
  • Languages: DE,EN
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #17 on: March 10, 2013, 05:36:36 PM »

Offline hreintke

  • *
  • Posts: 168
Re: New GUI komponenten, may be useful for refining user interface.
« Reply #18 on: March 19, 2013, 10:59:45 AM »
LS,

I tried to use the gui_spreadsheet_t in the halt_detail window using this code :

Code: [Select]
gui_spreadsheet_t *s = new gui_spreadsheet_t(gui_spreadsheet_t::none,gui_spreadsheet_t::none,3,halt->registered_lines.get_count());
s->set_pos( koord(D_MARGIN_LEFT+D_BUTTON_HEIGHT+D_H_SPACE,offset_y-LINESPACE ) );
s->set_col_width(0,200);
s->set_col_width(1,50);
s->set_col_width(2,100);
s->set_cell_border(0,0);
s->set_row_label_width(10);
s->set_rule(0,0);
s->request_groesse(koord(1000,LINESPACE*(halt->registered_lines.get_count()+2)));

cont.add_komponente( s );


Last statement adds the spreadsheet to the gui_container element of the window.

Looks good at first sight (needs refinement to get it really aligned with buttons) but the element is not limited to the main window (see picture 2).

Can you give me some hints on getting the window show correctly ?

Herman