1// ==================
2// PRODUCTION MENU
3// ==================
4window production
5{
6	{
7		background	"background/base_bg"
8	}
9
10	cmpBaseHeader baseHeader {
11	}
12
13	// ==================
14	// tab
15	// ==================
16
17	panel tab_background {
18		pos		"24 96"
19		size	"986 56"
20		background	"ui/panel_tab"
21	}
22
23	tab market_navigation {
24		{
25			pos		"47 106"
26			size	"938 39"
27			cvar	*cvar:mn_itemtype
28			onChange {
29				cmd "prod_type <cvar:mn_itemtype>;"
30			}
31		}
32
33		option primary {
34			label	"_Primary"
35			value	"primary"
36		}
37		option secondary {
38			label	"_Secondary"
39			value	"secondary"
40		}
41		option description {
42			label	"_Heavy"
43			value	"heavy"
44		}
45		option misc {
46			label	"_Misc"
47			value	"misc"
48		}
49		option armour {
50			label	"_Armour"
51			value	"armour"
52		}
53		option craftitem {
54			label	"_Craft items"
55			value	"craftitem"
56		}
57		option aircraft {
58			label	"_Aircraft"
59			value	"aircraft"
60		}
61		option dummy {
62			label	"_Other"
63			value	"dummy"
64		}
65		option disassembly {
66			label	"_Disassembly"
67			value	"disassembly"
68		}
69	}
70
71	// ==================
72	// lists
73	// ==================
74
75	rows lines {
76		pos			"28 175"
77		size		"530 568"
78		color1		"0 0.08 0 1"
79		color2		"0 0.16 0 1"
80		lineheight	25
81	}
82
83	panel scroll_bg {
84		pos			"421 175"
85		size		"31 568"
86		bgcolor		"0 0 0 0.5"
87	}
88
89	panel verticalline {
90		pos		"451 175"
91		size	"4 565"
92		bgcolor	"0.03 0.42 0.03 1"
93	}
94
95	panel itemlist {
96		pos		"12 160"
97		size	"553 597"
98		background	"ui/panel_grey_green_large2"
99	}
100
101	// ==================
102	// info panel
103	// ==================
104	panel basedescription {
105		{
106			pos		"588 160"
107			size	"410 135"
108			background	"ui/panel_grey_green"
109		}
110
111		string header_capacity {
112			string 		"_Capacity"
113			pos			"15 20"
114			size		"230 20"
115			font		"f_small_bold"
116			contentalign	ALIGN_CL
117		}
118		string header_free {
119			string 		"_free"
120			pos			"245 20"
121			size		"75 20"
122			font		"f_small_bold"
123			contentalign	ALIGN_CR
124		}
125		string header_all {
126			string 		"_all"
127			pos			"320 20"
128			size		"75 20"
129			font		"f_small_bold"
130			contentalign	ALIGN_CR
131		}
132
133		string storage_caption {
134			string 		"_Storage"
135			pos			"15 40"
136			size		"230 20"
137			font		"f_small"
138		}
139		string storage_free {
140			pos			"245 40"
141			size		"75 20"
142			font		"f_small"
143			contentalign	ALIGN_CR
144		}
145		string storage_all {
146			pos			"320 40"
147			size		"75 20"
148			font		"f_small"
149			contentalign	ALIGN_CR
150		}
151		string interceptor_caption {
152			string 		"_Interceptor Hangar"
153			pos			"15 60"
154			size		"230 20"
155			font		"f_small"
156		}
157		string interceptor_free {
158			pos			"245 60"
159			size		"75 20"
160			font		"f_small"
161			contentalign	ALIGN_CR
162		}
163		string interceptor_all {
164			pos			"320 60"
165			size		"75 20"
166			font		"f_small"
167			contentalign	ALIGN_CR
168		}
169		string dropship_caption {
170			string 		"_Dropship Hangar"
171			pos			"15 80"
172			size		"230 20"
173			font		"f_small"
174		}
175		string dropship_free {
176			pos			"245 80"
177			size		"75 20"
178			font		"f_small"
179			contentalign	ALIGN_CR
180		}
181		string dropship_all {
182			pos			"320 80"
183			size		"75 20"
184			font		"f_small"
185			contentalign	ALIGN_CR
186		}
187		string workshop_caption {
188			string 		"_Workshop space"
189			pos			"15 100"
190			size		"230 20"
191			font		"f_small"
192		}
193		string workshop_free {
194			pos			"245 100"
195			size		"75 20"
196			font		"f_small"
197			contentalign	ALIGN_CR
198		}
199		string workshop_all {
200			pos			"320 100"
201			size		"75 20"
202			font		"f_small"
203			contentalign	ALIGN_CR
204		}
205
206		confunc ui_prod_update_caps {
207			*node:parent.storage_free@string = "<1>"
208			*node:parent.storage_all@string = "<2>"
209			*node:parent.interceptor_free@string = "<3>"
210			*node:parent.interceptor_all@string = "<4>"
211			*node:parent.dropship_free@string = "<5>"
212			*node:parent.dropship_all@string = "<6>"
213			*node:parent.workshop_free@string = "<7>"
214			*node:parent.workshop_all@string = "<8>"
215			if ( <7> < 0 ) {
216				*node:parent.workshop_free@color = "1 0 0 1"
217			} else {
218				*node:parent.workshop_free@color = "1 1 1 1"
219			}
220		}
221
222	}
223
224	// ==================
225	// list
226	// ==================
227	textlist prodlist
228	{
229		dataid		TEXT_PRODUCTION_LIST
230		color		"0 .78 0 1"
231		rows		"22"
232		lineheight	"25"
233		pos			"55 180"
234		size		"250 550"
235		longlines	LONGLINES_PRETTYCHOP
236		onClick		{
237			*node:root.prodlist_amount@lineselected = <node:this@lineselected>
238			*node:root.prodlist_queued@lineselected = <node:this@lineselected>
239			cmd "prodlist_click <lineselected>;"
240		}
241		onRClick	{
242			*node:root.prodlist_amount@lineselected = <node:this@lineselected>
243			*node:root.prodlist_queued@lineselected = <node:this@lineselected>
244			cmd "prodlist_rclick <lineselected>;"
245		}
246		onViewChange	{
247			*node:root.prodlist_scroll@fullsize = <fullsize>
248			*node:root.prodlist_scroll@current = <viewpos>
249			*node:root.prodlist_scroll@viewsize = <viewsize>
250			*node:root.prodlist_amount@viewpos = <viewpos>
251			*node:root.prodlist_queued@viewpos = <viewpos>
252		}
253	}
254
255	textlist prodlist_amount
256	{
257		dataid		TEXT_PRODUCTION_AMOUNT
258		color		"0 .78 0 1"
259		contentalign	ALIGN_CR
260		pos			"310 180"
261		rows		"22"
262		size		"60 550"
263		lineheight	"25"
264		onClick		{
265			*node:root.prodlist@lineselected = <node:this@lineselected>
266			*node:root.prodlist_queued@lineselected = <node:this@lineselected>
267			cmd "prodlist_click <lineselected>;"
268		}
269		onRClick	{
270			*node:root.prodlist@lineselected = <node:this@lineselected>
271			*node:root.prodlist_queued@lineselected = <node:this@lineselected>
272			cmd "prodlist_rclick <lineselected>;"
273		}
274		onViewChange	{
275			*node:root.prodlist_scroll@fullsize = <fullsize>
276			*node:root.prodlist_scroll@current = <viewpos>
277			*node:root.prodlist_scroll@viewsize = <viewsize>
278			*node:root.prodlist@viewpos = <viewpos>
279			*node:root.prodlist_queued@viewpos = <viewpos>
280		}
281	}
282
283	textlist prodlist_queued
284	{
285		dataid		TEXT_PRODUCTION_QUEUED
286		pos			"465 180"
287		size		"60 550"
288		color		"0 .78 0 1"
289		lineheight	"25"
290		rows		"22"
291		onClick		{
292			*node:root.prodlist@lineselected = <node:this@lineselected>
293			*node:root.prodlist_amount@lineselected = <node:this@lineselected>
294			cmd "prodlist_click <lineselected>;"
295		}
296		onRClick	{
297			*node:root.prodlist@lineselected = <node:this@lineselected>
298			*node:root.prodlist_queued@lineselected = <node:this@lineselected>
299			cmd "prodlist_rclick <lineselected>;"
300		}
301		onViewChange	{
302			*node:root.prodlist_scroll@fullsize = <fullsize>
303			*node:root.prodlist_scroll@current = <viewpos>
304			*node:root.prodlist_scroll@viewsize = <viewsize>
305			*node:root.prodlist_amount@viewpos = <viewpos>
306			*node:root.prodlist@viewpos = <viewpos>
307		}
308	}
309
310	vscrollbar prodlist_scroll {
311		image		"ui/scrollbar_v_green"
312		pos			"428 180"
313		height		"556"
314		current		0
315		viewsize	30
316		fullsize	30
317		onChange	{
318			*node:root.prodlist@viewpos = <current>
319			*node:root.prodlist_amount@viewpos = <current>
320			*node:root.prodlist_queued@viewpos = <current>
321		}
322	}
323
324	confunc prod_selectline {
325		*node:root.prodlist@lineselected = <1>
326		*node:root.prodlist_amount@lineselected = <1>
327		*node:root.prodlist_queued@lineselected = <1>
328	}
329	// ==================
330	// item
331	// ==================
332
333	panel itempanel {
334		{
335			pos		"580 310"
336			size	"420 447"
337			background	"ui/panel_grey_green_large"
338		}
339
340		item itemmodel
341		{
342			src			*cvar:mn_item
343			pos			"17 17"
344			size		"386 152"
345			angles		"0 180 90"
346			omega		"0 10 0"
347			autoscale	true
348		}
349
350	}
351
352	// ==================
353	// info
354	// @todo move it into the item panel
355	// ==================
356
357	string prod_amount {
358		string		*cvar:mn_production_amount
359		pos			"730 505"
360		size		"40 20"
361		color		"0 .78 0 1"
362		font		"f_small"
363		contentalign	ALIGN_UR
364	}
365
366	string label_1 {
367		string		"x1"
368		pos			"786 505"
369		size		"24 20"
370		color		"0 .78 0 1"
371		font		"f_small"
372		contentalign	ALIGN_UR
373	}
374
375	string label_10 {
376		string		"x10"
377		pos			"824 505"
378		size		"36 20"
379		color		"0 .78 0 1"
380		font		"f_small"
381		contentalign	ALIGN_UR
382	}
383
384	spinner_blue prod_change {
385		tooltip		"_Change the production amount"
386		pos			"810 505"
387		min			1
388		current		*cvar:mn_production_amount
389		max			1000
390		delta		1
391		onChange	{ cmd "prod_change <lastdiff>;" }
392	}
393
394	spinner_blue prod_change_10 {
395		tooltip		"_Change the production amount"
396		pos			"860 505"
397		min			1
398		current		*cvar:mn_production_amount
399		max			1000
400		delta		10
401		onChange	{ cmd "prod_change <lastdiff>;" }
402	}
403
404	button prod_new
405	{
406		string		"_Start this production"
407		background		"ui/button_green_small"
408		pos			"670 480"
409		size		"250 32"
410		font		"f_small"
411		color		"0 .78 0 1"
412		onClick		{ cmd "prod_inc;" }
413	}
414
415	button prod_stop
416	{
417		tooltip		"_Stop production"
418		icon		"icons/bordered_cross"
419		pos			"900 505"
420		size		"16 16"
421		padding		0
422		onClick		{ cmd "prod_stop;" }
423	}
424
425	button prod_up
426	{
427		tooltip		"_Increase priority"
428		icon		"icons/arrow_top"
429		pos			"615 400"
430		size		"16 16"
431		padding		"0"
432		onClick		{ cmd "prod_up;" }
433		onWheelUp	{ cmd "prod_up;" }
434		onWheelDown	{ cmd "prod_down;" }
435	}
436
437	button prod_down
438	{
439		tooltip		"_Decrease priority"
440		icon		"icons/arrow_bottom"
441		pos			"615 420"
442		size		"16 16"
443		padding		0
444		onClick		{ cmd "prod_down;" }
445		onWheelUp	{ cmd "prod_up;" }
446		onWheelDown	{ cmd "prod_down;" }
447	}
448
449	/**
450	 * @brief nothing is selected
451	 */
452	confunc prod_nothingselected
453	{
454		*node:root.prod_stop@invis = true
455		*node:root.prod_down@invis = true
456		*node:root.prod_up@invis = true
457		*node:root.prod_change@invis = true
458		*node:root.prod_change_10@invis = true
459		*node:root.prod_new@invis = true
460		*node:root.prod_amount@invis = true
461		*node:root.label_1@invis = true
462		*node:root.label_10@invis = true
463	}
464
465	/**
466	 * @brief an available production is selected
467	 */
468	confunc prod_availableselected
469	{
470		*node:root.prod_stop@invis = true
471		*node:root.prod_down@invis = true
472		*node:root.prod_up@invis = true
473		*node:root.prod_change@invis = true
474		*node:root.prod_change_10@invis = true
475		*node:root.prod_amount@invis = true
476		*node:root.prod_new@invis = false
477		*node:root.label_1@invis = true
478		*node:root.label_10@invis = true
479	}
480
481	/**
482	 * @brief a production task is selected
483	 */
484	confunc prod_taskselected
485	{
486		*node:root.prod_stop@invis = false
487		*node:root.prod_down@invis = false
488		*node:root.prod_up@invis = false
489		*node:root.prod_change@invis = false
490		*node:root.prod_change_10@invis = false
491		*node:root.prod_amount@invis = false
492		*node:root.prod_new@invis = true
493		*node:root.label_1@invis = false
494		*node:root.label_10@invis = false
495	}
496
497	// ==================
498	// item description
499	// ==================
500
501
502	panel requirement {
503		{
504			pos		"610 610"
505			size	"346 120"
506		}
507
508		string label {
509			pos "5 5"
510			size "336 20"
511			font	"f_verysmall"
512			string "_Requirements"
513		}
514
515		optiontree prodreq
516		{
517			cvar		*cvar:ui_prreq
518			dataid		OPTION_PRODUCTION_REQUIREMENTS
519			pos			"5 26"
520			size		"320 92"
521			font		"f_verysmall"
522			color		"0 .78 0 1"
523			selectcolor	"0 .78 0 1"
524			onViewChange	{
525				*node:parent.prodreq_scroll@fullsize = <fullsize>
526				*node:parent.prodreq_scroll@current = <viewpos>
527				*node:parent.prodreq_scroll@viewsize = <viewsize>
528			}
529		}
530
531		vscrollbar prodreq_scroll {
532			image		"ui/scrollbar_v_green"
533			pos			"326 26"
534			height		"92"
535			current		0
536			viewsize	6
537			fullsize	6
538			hidewhenunused true
539			onChange	{ *node:parent.prodreq@viewpos = <current> }
540		}
541	}
542
543	panel proddesc {
544		{
545			pos			"610 528"
546			size		"346 80"
547			layout		LAYOUT_BORDER
548		}
549
550		text description
551		{
552			dataid		TEXT_PRODUCTION_INFO
553			align		LAYOUTALIGN_MIDDLE
554			lineheight	20
555			tabwidth	260
556			rows		4
557			onChange
558			{
559				*node:root.proddesc.description_scroll@current = 0
560				*node:root.proddesc.description@viewpos = 0
561			}
562			onViewChange	{
563				*node:root.proddesc.description_scroll@fullsize = <fullsize>
564				*node:root.proddesc.description_scroll@current = <viewpos>
565				*node:root.proddesc.description_scroll@viewsize = <viewsize>
566			}
567		}
568
569		vscrollbar description_scroll {
570			image		"ui/scrollbar_v_green"
571			align		LAYOUTALIGN_RIGHT
572			current		0
573			viewsize	4
574			fullsize	4
575			hidewhenunused true
576			onChange	{ *node:root.proddesc.description@viewpos = <current> }
577		}
578	}
579
580	confunc show_requirements {
581		*cvar:parm = <1>
582
583		if ( *cvar:parm > 0 ) {
584			*node:root.requirement@invis = false
585			*node:root.proddesc@height = 80
586		} else {
587			*node:root.requirement@invis = true
588			*node:root.proddesc@height = 200
589		}
590		delete *cvar:parm
591	}
592
593	// ==================
594	// init function
595	// ==================
596
597	confunc amountsetter {
598		*cvar:tmp = "<1>"
599		if ( *cvar:tmp eq "disable" ) {
600			*node:root.prod_change@disabled = true
601			*node:root.prod_change_10@disabled = true
602		} else {
603			*node:root.prod_change@disabled = false
604			*node:root.prod_change_10@disabled = false
605		}
606		delete *cvar:tmp
607	}
608
609	func onWindowOpened
610	{
611		cmd "prod_init; prod_type *cvar:mn_itemtype;"
612		*cvar:ui_prreq = ""
613		*cvar:mn_lastsubmenu = "production"
614	}
615	func onWindowClosed
616	{
617		delete *cvar:ui_prreq
618		// call base init function because the amount of workers, scientists and
619		// so on can also change the button state in the base view
620		cmd "base_init;"
621	}
622}
623