News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

New GUI komponenten, may be useful for refining user interface.

Started by wackdone, July 08, 2012, 08:59:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wackdone

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.)

wackdone

Attaching current source code of gui_hypertext_t.

wackdone

Attaching current source code of gui_spreadsheet_t.

greenling

Wackdone
your work it intresting.
Gives A Simutrans.exe how that i can test it?
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

wackdone

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.)

kierongreen

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.

Fabio

Finance dialog could make use of spreadsheet, and maybe even the (vehicles, stations, cities, goods, etc...) lists.

wackdone

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.

wackdone

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.)

wackdone

kierongreen, please teach me URL of uploadable site in DE.
I'm looking simutrans.de.
Sorry, I understand very little German language.

isidoro

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.)

wackdone

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.

wackdone

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

Great job done  ;)
Please, can you write as well some manual to install this feature?
Thanks a lot

prissi

As we have CSV capabilities, one could this of marking spreadsheets of the statistics and copy them to Excel ...

hreintke

@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

Yona-TYT


greenling

Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

hreintke

LS,

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


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