Skip to content

13. Repository window

RhettTR edited this page May 30, 2024 · 1 revision

The repository window can now be generated with script. Counters can be grouped with tabs, combo boxes and list boxes. You may combine tabs, combos and lists in any order. They can be nested inside each other.

In the following I will give a few examples of a resulting repository window and the script that generated it. The C++ (windows.cpp) can be found here.

Note that code for the counters themselves are not shown to keep code length down. In general a counter is generated with Luau code like this:

Repository["German/12R-51R"] = Repository:new({"German/12R-51R", "German/12R-51R_f"})


First the simplest example. The repository window consists only of two counters. Note that code for the counters are not included. The code for counters follow root(0). Else it can follow a listitem, a comboitem or a tab.

example1

The code is simply

-- set the content of the repository window

    root(0)

Then a larger example.

example2

-- set the content of the repository window

root(0)
    tabs(1)	
	    tab(2, "German")
			    listbox(3)
				    listitem(4, "Markers")
					    listbox(5)
						    listitem(6, "Markers")
                                                    listitem(6, "Targets")
				    listitem(4, "Units")
				    listitem(4, "Artillery")
					    listbox(5)
						    listitem(6, "5/77 2")
						    listitem(6, "5/77 3")
				    listitem(4, "Korps")
	    tab(2, "French") 
	    tab(2, "Markers") 

Here a tab box has three tabs: German, French and Markers. Nested inside the German tab is a list box. It has four items: Markers, Units, Artillery and Korps. Two of the items, Markers and Artillery, have a list box.


A more complex example.

example3

- set the content of the repository window

root(0)
    tabs(1) 
	    tab(2, "A") 
		    tabs(3) 
			    tab(4, "German") 
				    combobox(5) 
					    comboitem(6, "German")
					    comboitem(6, "French")
					            listbox(7)
						            listitem(8, "German")
							            listbox(9)
								           listitem(10, "12R")
								           listitem(10, "38")
						            listitem(8, "French")
			    tab(4, "French") 
			    tab(4, "Markers") 
	    tab(2, "B") 

A tabs box is nested inside another tabs box. Inside this tabs box again is nested a combo box. Inside here again is nested a pair of list boxes.


Finally an even more complex example. The possibilities are endless.

example4

-- set the content of the repository window

root(0)
    tabs(1) 
	    tab(2, "A") 
		    combobox(3)			 
				comboitem(4, "German")			    
					tabs(5)
						tab(6, "a")
							tabs(7)							
								tab(8, "1")							
									listbox(9)
										listitem(10, "German")
											listbox(11)
												listitem(12, "12R")
												listitem(12, "38")
										listitem(10, "French")
								tab(8, "2") 
								tab(8, "3") 
								tab(8, "4") 
								tab(8, "5") 
								tab(8, "6") 
						tab(6, "b")
						tab(6, "c")
						tab(6, "d") 
						tab(6, "e") 
						tab(6, "f") 
						tab(6, "e") 
						tab(6, "f")  
				comboitem(4, "French") 
	    tab(2, "B")
	    tab(2, "C")
	    tab(2, "D")
	    tab(2, "E")
	    tab(2, "F")

CPLUS_INCLUDE_PATH=/home/me/Qt/6.6.2/gcc_64/include;export CPLUS_INCLUDE_PATH

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/home/me/Qt/6.6.2/gcc_64/lib;export LD_LIBRARY_PATH

g++ -Wall -o main main.cpp luau.cpp counter.cpp window.cpp frame.cpp overlay.cpp io.cpp scale.cpp -I/home/me/luau/VM/include -I/home/me/luau/Compiler/include -I/home/me/Qt/6.6.2/gcc_64/include/QtWidgets -Wl,--copy-dt-needed-entries -L/home/me/Qt/6.6.2/gcc_64/lib -lQt6Core -lQt6Widgets -L/home/me/luau -lLuau.VM -lLuau.Compiler -lLuau.Ast -lisocline