Commit ddf310afe3bd37bac4aacc09ea5910ef941564a7

Authored by Carlos Picanco
1 parent 84ecb738
Exists in master

experiment designer - improve gui and persistence

- Add Gui to OnStart A,B,Individual and Group Points
- Add Open and SaveAs MenuItems
- fix some persistence bugs
experiment_designer/form_main.lfm
1 1 object FormDesigner: TFormDesigner
2   - Left = 127
  2 + Left = 0
3 3 Height = 712
4 4 Top = 29
5 5 Width = 674
6   - HorzScrollBar.Page = 387
  6 + HorzScrollBar.Page = 346
7 7 VertScrollBar.Page = 693
8 8 AutoScroll = True
9 9 Caption = 'Planejar Experimento'
... ... @@ -13,17 +13,17 @@ object FormDesigner: TFormDesigner
13 13 OnActivate = FormActivate
14 14 OnCreate = FormCreate
15 15 OnDestroy = FormDestroy
16   - SessionProperties = 'Caption;ComboCurrentCondition.ItemIndex;ComboCurrentCondition.Items;ComboCurrentCondition.Text;ComboCurrentContingency.ItemIndex;ComboCurrentContingency.Items;ComboCurrentContingency.Text;Height;LabelIf.Caption;Left;PageControl.TabIndex;RGContingencyType.ItemIndex;Top;Width;WindowState;LabelCsq3.Caption'
  16 + SessionProperties = 'Caption;ComboCurrentCondition.ItemIndex;ComboCurrentCondition.Items;ComboCurrentCondition.Text;ComboCurrentContingency.ItemIndex;ComboCurrentContingency.Items;ComboCurrentContingency.Text;Height;LabelCsq3.Caption;LabelIf.Caption;Left;PageControl.TabIndex;RGContingencyType.ItemIndex;Top;Width;WindowState;XMLPropStorage.FileName;OpenDialog.InitialDir;SaveDialog.InitialDir'
17 17 ShowHint = True
18 18 LCLVersion = '1.6.2.0'
19 19 object PageControl: TPageControl
20 20 Left = 0
21   - Height = 825
  21 + Height = 744
22 22 Top = 0
23 23 Width = 664
24   - ActivePage = TabSheetContingencies
  24 + ActivePage = TabSheetExperiment
25 25 Align = alClient
26   - TabIndex = 2
  26 + TabIndex = 0
27 27 TabOrder = 0
28 28 object TabSheetExperiment: TTabSheet
29 29 Caption = 'Experimento'
... ... @@ -32,13 +32,34 @@ object FormDesigner: TFormDesigner
32 32 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
33 33 ChildSizing.Layout = cclLeftToRightThenTopToBottom
34 34 ChildSizing.ControlsPerLine = 1
35   - ClientHeight = 792
  35 + ClientHeight = 711
36 36 ClientWidth = 658
  37 + object GBConditions: TGroupBox
  38 + Left = 0
  39 + Height = 97
  40 + Top = 10
  41 + Width = 658
  42 + Caption = 'Condições'
  43 + ClientHeight = 80
  44 + ClientWidth = 654
  45 + TabOrder = 5
  46 + object ListBoxConditions: TListBox
  47 + Left = 0
  48 + Height = 80
  49 + Top = 0
  50 + Width = 654
  51 + Anchors = [akTop, akLeft, akRight]
  52 + ItemHeight = 0
  53 + ScrollWidth = 652
  54 + TabOrder = 0
  55 + TopIndex = -1
  56 + end
  57 + end
37 58 object LabelResearcherName: TLabel
38 59 Left = 0
39 60 Height = 15
40   - Top = 10
41   - Width = 640
  61 + Top = 112
  62 + Width = 658
42 63 Caption = 'Nome do Pesquisador'
43 64 ParentColor = False
44 65 end
... ... @@ -46,15 +67,16 @@ object FormDesigner: TFormDesigner
46 67 Left = 0
47 68 Height = 25
48 69 Hint = 'Uma pasta será criada com o seu nome. Os seus experimentos serão salvos dentro dela.'
49   - Top = 30
50   - Width = 640
  70 + Top = 132
  71 + Width = 658
  72 + OnEditingDone = EditExperimentEditingDone
51 73 TabOrder = 0
52 74 end
53 75 object LabelExperimentName: TLabel
54 76 Left = 0
55 77 Height = 15
56   - Top = 60
57   - Width = 640
  78 + Top = 162
  79 + Width = 658
58 80 Caption = 'Nome do Experimento'
59 81 ParentColor = False
60 82 end
... ... @@ -62,26 +84,28 @@ object FormDesigner: TFormDesigner
62 84 Left = 0
63 85 Height = 25
64 86 Hint = 'Uma pasta será criada com o nome do experimento. Os dados desse experimento serão salvos dentro dela.'
65   - Top = 80
66   - Width = 640
  87 + Top = 182
  88 + Width = 658
  89 + OnEditingDone = EditExperimentEditingDone
67 90 TabOrder = 1
68 91 end
69 92 object GBExperimentAim: TGroupBox
70 93 Left = 0
71 94 Height = 159
72   - Top = 110
73   - Width = 640
  95 + Top = 212
  96 + Width = 658
74 97 Caption = 'Objetivo do Experimento'
75 98 ClientHeight = 142
76   - ClientWidth = 636
  99 + ClientWidth = 654
77 100 TabOrder = 2
78 101 object MemoExperimentAim: TMemo
79 102 Left = 0
80 103 Height = 142
81 104 Top = 0
82   - Width = 636
  105 + Width = 654
83 106 Align = alCustom
84 107 Anchors = [akTop, akLeft, akRight]
  108 + OnEditingDone = EditExperimentEditingDone
85 109 TabOrder = 0
86 110 end
87 111 end
... ... @@ -89,8 +113,8 @@ object FormDesigner: TFormDesigner
89 113 Left = 0
90 114 Height = 113
91 115 Hint = 'Aplicáveis ao longo de todo o experimento'
92   - Top = 274
93   - Width = 640
  116 + Top = 376
  117 + Width = 658
94 118 AutoFill = True
95 119 Caption = 'Configurações globais'
96 120 ChildSizing.LeftRightSpacing = 6
... ... @@ -102,13 +126,14 @@ object FormDesigner: TFormDesigner
102 126 ChildSizing.Layout = cclLeftToRightThenTopToBottom
103 127 ChildSizing.ControlsPerLine = 1
104 128 ClientHeight = 96
105   - ClientWidth = 636
  129 + ClientWidth = 654
106 130 Items.Strings = (
107 131 'Enviar histórico do bate-papo a novos participantes'
108 132 'Gerar participantes automaticamente'
109 133 'Habilitar matrix para o pesquisador jogar'
110 134 'Habilitar bate-papo para o pesquisador'
111 135 )
  136 + OnItemClick = CGGlobalItemClick
112 137 TabOrder = 3
113 138 Data = {
114 139 0400000002030202
... ... @@ -117,10 +142,10 @@ object FormDesigner: TFormDesigner
117 142 object RGPoints: TRadioGroup
118 143 Left = 0
119 144 Height = 59
120   - Top = 392
121   - Width = 640
  145 + Top = 494
  146 + Width = 658
122 147 AutoFill = True
123   - Caption = 'Tipo de pontuação'
  148 + Caption = 'Tipo de pontuação Individual'
124 149 ChildSizing.LeftRightSpacing = 6
125 150 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
126 151 ChildSizing.EnlargeVertical = crsHomogenousChildResize
... ... @@ -129,7 +154,7 @@ object FormDesigner: TFormDesigner
129 154 ChildSizing.Layout = cclLeftToRightThenTopToBottom
130 155 ChildSizing.ControlsPerLine = 1
131 156 ClientHeight = 42
132   - ClientWidth = 636
  157 + ClientWidth = 654
133 158 ItemIndex = 0
134 159 Items.Strings = (
135 160 'A e B'
... ... @@ -141,14 +166,14 @@ object FormDesigner: TFormDesigner
141 166 object GBMatrix: TGroupBox
142 167 Left = 0
143 168 Height = 143
144   - Top = 456
145   - Width = 640
  169 + Top = 558
  170 + Width = 658
146 171 Caption = 'Tipo da Matrix'
147 172 ChildSizing.LeftRightSpacing = 5
148 173 ChildSizing.Layout = cclLeftToRightThenTopToBottom
149 174 ChildSizing.ControlsPerLine = 1
150 175 ClientHeight = 126
151   - ClientWidth = 636
  176 + ClientWidth = 654
152 177 TabOrder = 6
153 178 object ChkColors: TCheckBox
154 179 Left = 5
... ... @@ -158,6 +183,7 @@ object FormDesigner: TFormDesigner
158 183 Caption = '5 cores'
159 184 Checked = True
160 185 Enabled = False
  186 + OnClick = ChkMatrixTypeClick
161 187 State = cbChecked
162 188 TabOrder = 0
163 189 end
... ... @@ -169,6 +195,7 @@ object FormDesigner: TFormDesigner
169 195 Caption = '10 linhas'
170 196 Checked = True
171 197 Enabled = False
  198 + OnClick = ChkMatrixTypeClick
172 199 State = cbChecked
173 200 TabOrder = 1
174 201 end
... ... @@ -178,6 +205,7 @@ object FormDesigner: TFormDesigner
178 205 Top = 42
179 206 Width = 239
180 207 Caption = '10 colunas'
  208 + OnClick = ChkMatrixTypeClick
181 209 TabOrder = 2
182 210 end
183 211 object ChkDots: TCheckBox
... ... @@ -187,6 +215,7 @@ object FormDesigner: TFormDesigner
187 215 Width = 239
188 216 Caption = 'Com Círculos Preechidos'
189 217 OnChange = ChkDotsChange
  218 + OnClick = ChkMatrixTypeClick
190 219 TabOrder = 3
191 220 end
192 221 object ChkCleanDots: TCheckBox
... ... @@ -196,6 +225,7 @@ object FormDesigner: TFormDesigner
196 225 Width = 239
197 226 Caption = 'Com Círculos Vazados'
198 227 OnChange = ChkCleanDotsChange
  228 + OnClick = ChkMatrixTypeClick
199 229 TabOrder = 4
200 230 end
201 231 object ChkDotsCleanDots: TCheckBox
... ... @@ -205,30 +235,10 @@ object FormDesigner: TFormDesigner
205 235 Width = 239
206 236 Caption = 'Com Círculos Vazados e Preenchidos'
207 237 OnChange = ChkDotsCleanDotsChange
  238 + OnClick = ChkMatrixTypeClick
208 239 TabOrder = 5
209 240 end
210 241 end
211   - object GBConditions: TGroupBox
212   - Left = 0
213   - Height = 97
214   - Top = 604
215   - Width = 640
216   - Caption = 'Condições'
217   - ClientHeight = 80
218   - ClientWidth = 636
219   - TabOrder = 5
220   - object ListBoxConditions: TListBox
221   - Left = 0
222   - Height = 80
223   - Top = 0
224   - Width = 636
225   - Anchors = [akTop, akLeft, akRight]
226   - ItemHeight = 0
227   - ScrollWidth = 634
228   - TabOrder = 0
229   - TopIndex = -1
230   - end
231   - end
232 242 end
233 243 object TabSheetConditions: TTabSheet
234 244 Caption = 'Condições'
... ... @@ -237,13 +247,13 @@ object FormDesigner: TFormDesigner
237 247 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
238 248 ChildSizing.Layout = cclLeftToRightThenTopToBottom
239 249 ChildSizing.ControlsPerLine = 1
240   - ClientHeight = 792
  250 + ClientHeight = 711
241 251 ClientWidth = 658
242 252 object ComboCurrentCondition: TComboBox
243 253 Left = 0
244   - Height = 23
  254 + Height = 27
245 255 Top = 10
246   - Width = 640
  256 + Width = 658
247 257 ItemHeight = 0
248 258 OnChange = ComboCurrentConditionChange
249 259 Style = csDropDownList
... ... @@ -253,108 +263,199 @@ object FormDesigner: TFormDesigner
253 263 Left = 0
254 264 Height = 26
255 265 Top = 42
256   - Width = 640
  266 + Width = 658
257 267 ChildSizing.LeftRightSpacing = 25
258 268 ChildSizing.HorizontalSpacing = 50
259 269 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
260 270 ChildSizing.Layout = cclLeftToRightThenTopToBottom
261 271 ChildSizing.ControlsPerLine = 3
262 272 ClientHeight = 26
263   - ClientWidth = 640
  273 + ClientWidth = 658
264 274 TabOrder = 1
265 275 object BtnAppendCond: TButton
266 276 Left = 25
267 277 Height = 25
  278 + Hint = 'Selecione contingências na lista abaixo se deseja inclui-las na condição a ser adicionada.'
268 279 Top = 0
269   - Width = 162
  280 + Width = 168
270 281 Caption = 'Adicionar'
271 282 OnClick = BtnAppendCondClick
272 283 TabOrder = 0
273 284 end
274 285 object BtnRemoveCond: TButton
275   - Left = 237
  286 + Left = 243
276 287 Height = 25
277 288 Top = 0
278   - Width = 159
  289 + Width = 165
279 290 Caption = 'Remover'
280 291 OnClick = BtnRemoveCondClick
281 292 TabOrder = 1
282 293 end
283 294 object BtnReorderCond: TButton
284   - Left = 446
  295 + Left = 458
285 296 Height = 25
286 297 Top = 0
287   - Width = 169
  298 + Width = 175
288 299 Caption = 'Reordenar'
289 300 OnClick = BtnReorderCondClick
290 301 TabOrder = 2
  302 + Visible = False
  303 + end
  304 + end
  305 + object GBContingencies: TGroupBox
  306 + Left = 0
  307 + Height = 97
  308 + Top = 73
  309 + Width = 658
  310 + Caption = 'Contingências e Metacontingências da Condição Selecionada'
  311 + ClientHeight = 80
  312 + ClientWidth = 654
  313 + TabOrder = 8
  314 + object ListBoxContingencies: TListBox
  315 + Left = 0
  316 + Height = 80
  317 + Hint = 'CTRL+Clique para selecionar múltiplas contingências.'
  318 + Top = 0
  319 + Width = 654
  320 + Anchors = [akTop, akLeft, akRight]
  321 + ItemHeight = 0
  322 + MultiSelect = True
  323 + ScrollWidth = 652
  324 + TabOrder = 0
  325 + TopIndex = -1
291 326 end
292 327 end
293 328 object LabelConditionName: TLabel
294 329 Left = 0
295 330 Height = 15
296 331 Hint = 'Nome da condição no relatório.'
297   - Top = 73
298   - Width = 640
  332 + Top = 175
  333 + Width = 658
299 334 Caption = 'Nome da Condição'
300 335 ParentColor = False
301 336 end
302 337 object EditConditionName: TEdit
303 338 Left = 0
304 339 Height = 25
305   - Top = 93
306   - Width = 640
  340 + Top = 195
  341 + Width = 658
307 342 OnEditingDone = EditConditionNameEditingDone
308 343 TabOrder = 2
309 344 end
310 345 object LabelTurnValue: TLabel
311 346 Left = 0
312 347 Height = 15
313   - Top = 123
314   - Width = 640
  348 + Top = 225
  349 + Width = 658
315 350 Caption = 'Número de Jogadores / Turnos'
316 351 ParentColor = False
317 352 end
318 353 object SpinEditTurnValue: TSpinEdit
319 354 Left = 0
320 355 Height = 25
321   - Top = 143
322   - Width = 640
  356 + Top = 245
  357 + Width = 658
323 358 MaxValue = 5
324 359 MinValue = 2
325 360 OnEditingDone = SpinEditTurnValueEditingDone
326 361 TabOrder = 3
327 362 Value = 2
328 363 end
329   - object LabelPointsOnConditionBegin: TLabel
  364 + object GroupBox1: TGroupBox
330 365 Left = 0
331   - Height = 15
332   - Top = 173
333   - Width = 640
334   - Caption = 'Pontos ao início da Condição'
335   - ParentColor = False
336   - end
337   - object SpinEditOnConditionBegin: TSpinEdit
338   - Left = 0
339   - Height = 25
340   - Top = 193
341   - Width = 640
342   - MaxValue = 0
  366 + Height = 57
  367 + Top = 275
  368 + Width = 658
  369 + Caption = 'Somar pontos ao iniciar condição'
  370 + ChildSizing.LeftRightSpacing = 50
  371 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
  372 + ChildSizing.Layout = cclTopToBottomThenLeftToRight
  373 + ChildSizing.ControlsPerLine = 2
  374 + ClientHeight = 40
  375 + ClientWidth = 654
343 376 TabOrder = 9
  377 + object LabelPA: TLabel
  378 + Left = 50
  379 + Height = 15
  380 + Top = 0
  381 + Width = 137
  382 + Caption = 'A'
  383 + ParentColor = False
  384 + end
  385 + object SpinEditOnConditionBeginA: TSpinEdit
  386 + Left = 50
  387 + Height = 25
  388 + Top = 15
  389 + Width = 137
  390 + MaxValue = 0
  391 + OnEditingDone = SpinEditOnConditionBeginAEditingDone
  392 + TabOrder = 0
  393 + end
  394 + object LabelPB: TLabel
  395 + Left = 187
  396 + Height = 15
  397 + Top = 0
  398 + Width = 137
  399 + Caption = 'B'
  400 + ParentColor = False
  401 + end
  402 + object SpinEditOnConditionBeginB: TSpinEdit
  403 + Left = 187
  404 + Height = 25
  405 + Top = 15
  406 + Width = 137
  407 + MaxValue = 0
  408 + OnEditingDone = SpinEditOnConditionBeginAEditingDone
  409 + TabOrder = 1
  410 + end
  411 + object LabelPI: TLabel
  412 + Left = 324
  413 + Height = 15
  414 + Top = 0
  415 + Width = 145
  416 + Caption = 'Individual'
  417 + ParentColor = False
  418 + end
  419 + object SpinEditOnConditionBeginI: TSpinEdit
  420 + Left = 324
  421 + Height = 25
  422 + Top = 15
  423 + Width = 145
  424 + MaxValue = 0
  425 + OnEditingDone = SpinEditOnConditionBeginAEditingDone
  426 + TabOrder = 2
  427 + end
  428 + object LabelPG: TLabel
  429 + Left = 469
  430 + Height = 15
  431 + Top = 0
  432 + Width = 135
  433 + Caption = 'Grupo'
  434 + ParentColor = False
  435 + end
  436 + object SpinEditOnConditionBeginG: TSpinEdit
  437 + Left = 469
  438 + Height = 25
  439 + Top = 15
  440 + Width = 135
  441 + MaxValue = 0
  442 + OnEditingDone = SpinEditOnConditionBeginAEditingDone
  443 + TabOrder = 3
  444 + end
344 445 end
345 446 object LabelCyclesValue: TLabel
346 447 Left = 0
347 448 Height = 15
348   - Top = 223
349   - Width = 640
  449 + Top = 337
  450 + Width = 658
350 451 Caption = 'Ciclos para mudança de geração / linhagem'
351 452 ParentColor = False
352 453 end
353 454 object SpinEditCyclesValue: TSpinEdit
354 455 Left = 0
355 456 Height = 25
356   - Top = 243
357   - Width = 640
  457 + Top = 357
  458 + Width = 658
358 459 MaxValue = 1000
359 460 MinValue = 1
360 461 OnEditingDone = SpinEditCyclesValueEditingDone
... ... @@ -364,8 +465,8 @@ object FormDesigner: TFormDesigner
364 465 object GBQuestion: TGroupBox
365 466 Left = 0
366 467 Height = 164
367   - Top = 273
368   - Width = 640
  468 + Top = 387
  469 + Width = 658
369 470 Caption = 'Apresentar pergunta ao final do ciclo'
370 471 ChildSizing.LeftRightSpacing = 50
371 472 ChildSizing.VerticalSpacing = 5
... ... @@ -373,13 +474,13 @@ object FormDesigner: TFormDesigner
373 474 ChildSizing.Layout = cclLeftToRightThenTopToBottom
374 475 ChildSizing.ControlsPerLine = 1
375 476 ClientHeight = 147
376   - ClientWidth = 636
  477 + ClientWidth = 654
377 478 TabOrder = 5
378 479 object CheckBoxShouldAskQuestion: TCheckBox
379 480 Left = 50
380 481 Height = 21
381 482 Top = 0
382   - Width = 536
  483 + Width = 554
383 484 Caption = 'Não'
384 485 OnChange = CheckBoxShouldAskQuestionChange
385 486 TabOrder = 0
... ... @@ -388,7 +489,7 @@ object FormDesigner: TFormDesigner
388 489 Left = 50
389 490 Height = 15
390 491 Top = 26
391   - Width = 536
  492 + Width = 554
392 493 Caption = 'Texto da Pergunta'
393 494 ParentColor = False
394 495 end
... ... @@ -396,7 +497,7 @@ object FormDesigner: TFormDesigner
396 497 Left = 50
397 498 Height = 25
398 499 Top = 46
399   - Width = 536
  500 + Width = 554
400 501 OnEditingDone = EditQuestionEditingDone
401 502 TabOrder = 1
402 503 Text = 'Um item escolar foi perdido, desejam recuperá-lo gastando pontos do Tipo A?'
... ... @@ -406,7 +507,7 @@ object FormDesigner: TFormDesigner
406 507 Left = 50
407 508 Height = 71
408 509 Top = 76
409   - Width = 536
  510 + Width = 554
410 511 AutoFill = True
411 512 Caption = 'O que deve acontecer quando todos responderem sim?'
412 513 ChildSizing.LeftRightSpacing = 6
... ... @@ -418,7 +519,7 @@ object FormDesigner: TFormDesigner
418 519 ChildSizing.Layout = cclLeftToRightThenTopToBottom
419 520 ChildSizing.ControlsPerLine = 1
420 521 ClientHeight = 54
421   - ClientWidth = 532
  522 + ClientWidth = 550
422 523 Items.Strings = (
423 524 'Reverter consequências das metacontingências e contingências'
424 525 'Inverter pontos A e B quando pontos B forem consequências'
... ... @@ -434,8 +535,8 @@ object FormDesigner: TFormDesigner
434 535 object RGEndCriteriaStyle: TRadioGroup
435 536 Left = 0
436 537 Height = 80
437   - Top = 442
438   - Width = 640
  538 + Top = 556
  539 + Width = 658
439 540 AutoFill = True
440 541 Caption = 'Estilo do critério de finalização da condição'
441 542 ChildSizing.LeftRightSpacing = 6
... ... @@ -446,7 +547,7 @@ object FormDesigner: TFormDesigner
446 547 ChildSizing.Layout = cclLeftToRightThenTopToBottom
447 548 ChildSizing.ControlsPerLine = 1
448 549 ClientHeight = 63
449   - ClientWidth = 636
  550 + ClientWidth = 654
450 551 ItemIndex = 2
451 552 Items.Strings = (
452 553 'Finalizar após um número de ciclos'
... ... @@ -459,8 +560,8 @@ object FormDesigner: TFormDesigner
459 560 object GBEndCriteria: TGroupBox
460 561 Left = 0
461 562 Height = 109
462   - Top = 527
463   - Width = 640
  563 + Top = 641
  564 + Width = 658
464 565 Caption = 'Valores do critério de finalização da condição'
465 566 ChildSizing.LeftRightSpacing = 50
466 567 ChildSizing.VerticalSpacing = 5
... ... @@ -468,13 +569,13 @@ object FormDesigner: TFormDesigner
468 569 ChildSizing.Layout = cclLeftToRightThenTopToBottom
469 570 ChildSizing.ControlsPerLine = 1
470 571 ClientHeight = 92
471   - ClientWidth = 636
  572 + ClientWidth = 654
472 573 TabOrder = 7
473 574 object LabelEndCriteriaAbsCycles: TLabel
474 575 Left = 50
475 576 Height = 15
476 577 Top = 0
477   - Width = 536
  578 + Width = 554
478 579 Caption = 'Número de ciclos'
479 580 ParentColor = False
480 581 end
... ... @@ -482,7 +583,7 @@ object FormDesigner: TFormDesigner
482 583 Left = 50
483 584 Height = 25
484 585 Top = 20
485   - Width = 536
  586 + Width = 554
486 587 MaxValue = 1000
487 588 OnEditingDone = SpinEditEndCriteriaAbsCyclesEditingDone
488 589 TabOrder = 0
... ... @@ -492,13 +593,13 @@ object FormDesigner: TFormDesigner
492 593 Left = 50
493 594 Height = 42
494 595 Top = 50
495   - Width = 536
  596 + Width = 554
496 597 Caption = 'Porcentagem de entrelaçamentos'
497 598 ChildSizing.HorizontalSpacing = 5
498 599 ChildSizing.Layout = cclLeftToRightThenTopToBottom
499 600 ChildSizing.ControlsPerLine = 4
500 601 ClientHeight = 25
501   - ClientWidth = 532
  602 + ClientWidth = 550
502 603 TabOrder = 1
503 604 object SpinEditEndCriteriaInterlockingPorcentage: TSpinEdit
504 605 Left = 0
... ... @@ -542,27 +643,6 @@ object FormDesigner: TFormDesigner
542 643 end
543 644 end
544 645 end
545   - object GBContingencies: TGroupBox
546   - Left = 0
547   - Height = 97
548   - Top = 641
549   - Width = 640
550   - Caption = 'Contingências e Metacontingências'
551   - ClientHeight = 80
552   - ClientWidth = 636
553   - TabOrder = 8
554   - object ListBoxContingencies: TListBox
555   - Left = 0
556   - Height = 80
557   - Top = 0
558   - Width = 636
559   - Anchors = [akTop, akLeft, akRight]
560   - ItemHeight = 0
561   - ScrollWidth = 634
562   - TabOrder = 0
563   - TopIndex = -1
564   - end
565   - end
566 646 end
567 647 object TabSheetContingencies: TTabSheet
568 648 Caption = 'Contingências'
... ... @@ -571,7 +651,7 @@ object FormDesigner: TFormDesigner
571 651 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
572 652 ChildSizing.Layout = cclLeftToRightThenTopToBottom
573 653 ChildSizing.ControlsPerLine = 1
574   - ClientHeight = 792
  654 + ClientHeight = 711
575 655 ClientWidth = 658
576 656 Enabled = False
577 657 object RGContingencyType: TRadioGroup
... ... @@ -646,6 +726,7 @@ object FormDesigner: TFormDesigner
646 726 Caption = 'Reordenar'
647 727 OnClick = BtnReorderContingencyClick
648 728 TabOrder = 2
  729 + Visible = False
649 730 end
650 731 end
651 732 object LabelContingencyName: TLabel
... ... @@ -765,15 +846,15 @@ object FormDesigner: TFormDesigner
765 846 Left = 0
766 847 Height = 15
767 848 Top = 0
768   - Width = 416
  849 + Width = 420
769 850 Caption = 'Pontos'
770 851 ParentColor = False
771 852 end
772 853 object LabelCsq2: TLabel
773   - Left = 416
  854 + Left = 420
774 855 Height = 15
775 856 Top = 0
776   - Width = 238
  857 + Width = 234
777 858 Caption = 'do Tipo'
778 859 ParentColor = False
779 860 end
... ... @@ -781,17 +862,16 @@ object FormDesigner: TFormDesigner
781 862 Left = 0
782 863 Height = 27
783 864 Top = 15
784   - Width = 416
  865 + Width = 420
785 866 MaxValue = 0
786 867 OnEditingDone = ConsequenceStyleChange
787 868 TabOrder = 0
788   - Value = 1
789 869 end
790 870 object CBPointsType: TComboBox
791   - Left = 416
  871 + Left = 420
792 872 Height = 27
793 873 Top = 15
794   - Width = 238
  874 + Width = 234
795 875 ItemHeight = 0
796 876 OnChange = ConsequenceStyleChange
797 877 Style = csDropDownList
... ... @@ -801,13 +881,18 @@ object FormDesigner: TFormDesigner
801 881 Left = 0
802 882 Height = 80
803 883 Top = 42
804   - Width = 416
  884 + Width = 420
805 885 AutoFill = True
806 886 Caption = 'Apresentar mensagem de notificação'
  887 + ChildSizing.LeftRightSpacing = 6
  888 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
  889 + ChildSizing.EnlargeVertical = crsHomogenousChildResize
  890 + ChildSizing.ShrinkHorizontal = crsScaleChilds
  891 + ChildSizing.ShrinkVertical = crsScaleChilds
807 892 ChildSizing.Layout = cclLeftToRightThenTopToBottom
808 893 ChildSizing.ControlsPerLine = 1
809 894 ClientHeight = 63
810   - ClientWidth = 412
  895 + ClientWidth = 416
811 896 ItemIndex = 0
812 897 Items.Strings = (
813 898 'a todos os participantes'
... ... @@ -818,11 +903,11 @@ object FormDesigner: TFormDesigner
818 903 TabOrder = 9
819 904 end
820 905 object CheckBoxImutableMessage: TCheckBox
821   - Left = 416
  906 + Left = 420
822 907 Height = 80
823 908 Hint = 'Marque se deseja uma mensagem fixa; o programa não atualizará o texto da mensagem caso o valor da pontuação mude ao longo do experimento.'
824 909 Top = 42
825   - Width = 238
  910 + Width = 234
826 911 AutoSize = False
827 912 Caption = 'imutável'
828 913 OnChange = CheckBoxImutableMessageChange
... ... @@ -832,15 +917,16 @@ object FormDesigner: TFormDesigner
832 917 Left = 0
833 918 Height = 25
834 919 Top = 122
835   - Width = 416
  920 + Width = 420
836 921 Caption = 'Texto no início da mensagem'
837 922 ParentColor = False
838 923 end
839 924 object EditMessPrefix: TEdit
840   - Left = 416
  925 + Left = 420
841 926 Height = 25
842 927 Top = 122
843   - Width = 238
  928 + Width = 234
  929 + OnEditingDone = EditMessDone
844 930 TabOrder = 2
845 931 Text = '$NICNAME'
846 932 end
... ... @@ -848,15 +934,16 @@ object FormDesigner: TFormDesigner
848 934 Left = 0
849 935 Height = 25
850 936 Top = 147
851   - Width = 416
  937 + Width = 420
852 938 Caption = 'Prefixo ao perder pontos'
853 939 ParentColor = False
854 940 end
855 941 object EditMessPrefixLoss: TEdit
856   - Left = 416
  942 + Left = 420
857 943 Height = 25
858 944 Top = 147
859   - Width = 238
  945 + Width = 234
  946 + OnEditingDone = EditMessDone
860 947 TabOrder = 3
861 948 Text = 'perdeu'
862 949 end
... ... @@ -864,15 +951,16 @@ object FormDesigner: TFormDesigner
864 951 Left = 0
865 952 Height = 25
866 953 Top = 172
867   - Width = 416
  954 + Width = 420
868 955 Caption = 'Sufixo ao perder pontos (Singular)'
869 956 ParentColor = False
870 957 end
871 958 object EditMessSufixLossSingular: TEdit
872   - Left = 416
  959 + Left = 420
873 960 Height = 25
874 961 Top = 172
875   - Width = 238
  962 + Width = 234
  963 + OnEditingDone = EditMessDone
876 964 TabOrder = 4
877 965 Text = 'ponto.'
878 966 end
... ... @@ -880,15 +968,16 @@ object FormDesigner: TFormDesigner
880 968 Left = 0
881 969 Height = 25
882 970 Top = 197
883   - Width = 416
  971 + Width = 420
884 972 Caption = 'Sufixo ao perder pontos (Plural)'
885 973 ParentColor = False
886 974 end
887 975 object EditMessSufixLossPlural: TEdit
888   - Left = 416
  976 + Left = 420
889 977 Height = 25
890 978 Top = 197
891   - Width = 238
  979 + Width = 234
  980 + OnEditingDone = EditMessDone
892 981 TabOrder = 5
893 982 Text = 'pontos.'
894 983 end
... ... @@ -896,15 +985,16 @@ object FormDesigner: TFormDesigner
896 985 Left = 0
897 986 Height = 25
898 987 Top = 222
899   - Width = 416
  988 + Width = 420
900 989 Caption = 'Prefixo ao ganhar pontos'
901 990 ParentColor = False
902 991 end
903 992 object EditMessPrefixEarn: TEdit
904   - Left = 416
  993 + Left = 420
905 994 Height = 25
906 995 Top = 222
907   - Width = 238
  996 + Width = 234
  997 + OnEditingDone = EditMessDone
908 998 TabOrder = 6
909 999 Text = 'ganhou'
910 1000 end
... ... @@ -912,15 +1002,16 @@ object FormDesigner: TFormDesigner
912 1002 Left = 0
913 1003 Height = 25
914 1004 Top = 247
915   - Width = 416
  1005 + Width = 420
916 1006 Caption = 'Sufixo ao ganhar pontos (Singular)'
917 1007 ParentColor = False
918 1008 end
919 1009 object EditMessSufixEarnSingular: TEdit
920   - Left = 416
  1010 + Left = 420
921 1011 Height = 25
922 1012 Top = 247
923   - Width = 238
  1013 + Width = 234
  1014 + OnEditingDone = EditMessDone
924 1015 TabOrder = 7
925 1016 Text = 'ponto.'
926 1017 end
... ... @@ -928,15 +1019,16 @@ object FormDesigner: TFormDesigner
928 1019 Left = 0
929 1020 Height = 25
930 1021 Top = 272
931   - Width = 416
  1022 + Width = 420
932 1023 Caption = 'Sufixo ao ganhar pontos (Plural)'
933 1024 ParentColor = False
934 1025 end
935 1026 object EditMessSufixEarnPlural: TEdit
936   - Left = 416
  1027 + Left = 420
937 1028 Height = 25
938 1029 Top = 272
939   - Width = 238
  1030 + Width = 234
  1031 + OnEditingDone = EditMessDone
940 1032 TabOrder = 8
941 1033 Text = 'pontos.'
942 1034 end
... ... @@ -944,16 +1036,16 @@ object FormDesigner: TFormDesigner
944 1036 Left = 0
945 1037 Height = 25
946 1038 Top = 297
947   - Width = 416
948   - Caption = 'Sufixo ao ganhar pontos (Plural)'
  1039 + Width = 420
  1040 + Caption = 'Sufixo 0 pontos'
949 1041 ParentColor = False
950 1042 end
951 1043 object EditMessSufixZero: TEdit
952   - Left = 416
  1044 + Left = 420
953 1045 Height = 25
954 1046 Top = 297
955   - Width = 238
956   - OnChange = EditMessSufixZeroChange
  1047 + Width = 234
  1048 + OnEditingDone = EditMessDone
957 1049 TabOrder = 11
958 1050 Text = 'não ganhou nem perdeu pontos.'
959 1051 end
... ... @@ -961,7 +1053,7 @@ object FormDesigner: TFormDesigner
961 1053 Left = 0
962 1054 Height = 25
963 1055 Top = 322
964   - Width = 416
  1056 + Width = 420
965 1057 Caption = 'Ver como a mensagem pode ser apresentada'
966 1058 OnClick = ButtonPreviewMessageClick
967 1059 TabOrder = 12
... ... @@ -978,6 +1070,10 @@ object FormDesigner: TFormDesigner
978 1070 Caption = 'Abrir'
979 1071 OnClick = MenuItemOpenClick
980 1072 end
  1073 + object MenuItemSaveAs: TMenuItem
  1074 + Caption = 'Salvar Como'
  1075 + OnClick = MenuItemSaveAsClick
  1076 + end
981 1077 object MenuItemSeparator1: TMenuItem
982 1078 Caption = '-'
983 1079 end
... ... @@ -988,21 +1084,31 @@ object FormDesigner: TFormDesigner
988 1084 end
989 1085 end
990 1086 object OpenDialog: TOpenDialog
991   - left = 464
  1087 + Title = 'Abrir arquivo de configuração'
  1088 + DefaultExt = '.ini'
  1089 + Filter = 'ini|*.ini|txt|*.txt'
  1090 + Options = [ofFileMustExist]
  1091 + left = 376
992 1092 top = 8
993 1093 end
994 1094 object XMLPropStorage: TXMLPropStorage
995 1095 StoredValues = <
996 1096 item
997   - Name = 'FileName'
998   - Value = 'persistence.ini'
  1097 + Name = 'Filename'
999 1098 OnSave = XMLPropStorageStoredValuesFileNameSave
1000 1099 OnRestore = XMLPropStorageStoredValuesFileNameRestore
1001 1100 end>
1002   - FileName = 'persistence.xml'
1003 1101 OnSavingProperties = XMLPropStorageSavingProperties
1004 1102 OnRestoreProperties = XMLPropStorageRestoreProperties
1005 1103 left = 464
1006   - top = 64
  1104 + top = 8
  1105 + end
  1106 + object SaveDialog: TSaveDialog
  1107 + Width = 862
  1108 + Height = 468
  1109 + DefaultExt = '.ini'
  1110 + Filter = 'ini|*.ini|txt|*.txt'
  1111 + left = 304
  1112 + top = 8
1007 1113 end
1008 1114 end
... ...
experiment_designer/form_main.pas
... ... @@ -11,6 +11,8 @@ unit form_main;
11 11  
12 12 {$mode objfpc}{$H+}
13 13  
  14 +{$DEFINE DEBUG}
  15 +
14 16 interface
15 17  
16 18 uses
... ... @@ -66,6 +68,11 @@ type
66 68 GBContingencyRows: TGroupBox;
67 69 GBContingencyConsequence: TGroupBox;
68 70 GBMatrix: TGroupBox;
  71 + GroupBox1: TGroupBox;
  72 + LabelPA: TLabel;
  73 + LabelPB: TLabel;
  74 + LabelPI: TLabel;
  75 + LabelPG: TLabel;
69 76 LabelCsq10: TLabel;
70 77 LabelCsq3: TLabel;
71 78 LabelCsq5: TLabel;
... ... @@ -75,7 +82,6 @@ type
75 82 LabelCsq4: TLabel;
76 83 LabelCsq7: TLabel;
77 84 LabelQuestion: TLabel;
78   - LabelPointsOnConditionBegin: TLabel;
79 85 LabelCsq1: TLabel;
80 86 LabelCsq2: TLabel;
81 87 LabelThen: TLabel;
... ... @@ -94,6 +100,7 @@ type
94 100 ListBoxContingencies: TListBox;
95 101 MainMenu1: TMainMenu;
96 102 MemoExperimentAim: TMemo;
  103 + MenuItemSaveAs: TMenuItem;
97 104 MenuItemFile: TMenuItem;
98 105 MenuItemExit: TMenuItem;
99 106 MenuItemOpen: TMenuItem;
... ... @@ -107,12 +114,16 @@ type
107 114 RGContingencyStyle: TRadioGroup;
108 115 RGEndCriteriaStyle: TRadioGroup;
109 116 RGPoints: TRadioGroup;
  117 + SaveDialog: TSaveDialog;
110 118 SpinEditContingencyPoints: TSpinEdit;
111 119 SpinEditEndCriteriaInterlockingPorcentage: TSpinEdit;
112 120 SpinEditEndCriteriaLastCycles: TSpinEdit;
113 121 SpinEditEndCriteriaAbsCycles: TSpinEdit;
114 122 SpinEditCyclesValue: TSpinEdit;
115   - SpinEditOnConditionBegin: TSpinEdit;
  123 + SpinEditOnConditionBeginA: TSpinEdit;
  124 + SpinEditOnConditionBeginB: TSpinEdit;
  125 + SpinEditOnConditionBeginI: TSpinEdit;
  126 + SpinEditOnConditionBeginG: TSpinEdit;
116 127 SpinEditTurnValue: TSpinEdit;
117 128 TabSheetContingencies: TTabSheet;
118 129 TabSheetConditions: TTabSheet;
... ... @@ -125,7 +136,9 @@ type
125 136 procedure BtnReorderCondClick(Sender: TObject);
126 137 procedure BtnReorderContingencyClick(Sender: TObject);
127 138 procedure ButtonPreviewMessageClick(Sender: TObject);
  139 + procedure CGGlobalItemClick(Sender: TObject; Index: integer);
128 140 procedure CheckBoxImutableMessageChange(Sender: TObject);
  141 + procedure ChkMatrixTypeClick(Sender: TObject);
129 142 procedure ChkDotsCleanDotsChange(Sender: TObject);
130 143 //
131 144 procedure ConsequenceMessageEditingDone(Sender: TObject);
... ... @@ -140,13 +153,15 @@ type
140 153 procedure ComboCurrentContingencyChange(Sender: TObject);
141 154 procedure EditConditionNameEditingDone(Sender: TObject);
142 155 procedure EditContingencyNameEditingDone(Sender: TObject);
143   - procedure EditMessSufixZeroChange(Sender: TObject);
  156 + procedure EditMessDone(Sender: TObject);
144 157 procedure EditQuestionEditingDone(Sender: TObject);
  158 + procedure EditExperimentEditingDone(Sender: TObject);
145 159 procedure FormActivate(Sender: TObject);
146 160 procedure FormCreate(Sender: TObject);
147 161 procedure FormDestroy(Sender: TObject);
148 162 procedure MenuItemExitClick(Sender: TObject);
149 163 procedure MenuItemOpenClick(Sender: TObject);
  164 + procedure MenuItemSaveAsClick(Sender: TObject);
150 165 procedure RGBroadcastMessageClick(Sender: TObject);
151 166 procedure RGContingencyStyleClick(Sender: TObject);
152 167 procedure RGContingencyStyleExit(Sender: TObject);
... ... @@ -158,6 +173,7 @@ type
158 173 procedure SpinEditEndCriteriaAbsCyclesEditingDone(Sender: TObject);
159 174 procedure SpinEditEndCriteriaInterlockingEditingDone(
160 175 Sender: TObject);
  176 + procedure SpinEditOnConditionBeginAEditingDone(Sender: TObject);
161 177 procedure SpinEditTurnValueEditingDone(Sender: TObject);
162 178 procedure XMLPropStorageRestoreProperties(Sender: TObject);
163 179 procedure XMLPropStorageSavingProperties(Sender: TObject);
... ... @@ -170,7 +186,7 @@ type
170 186 procedure LoadExperiment;
171 187 procedure LoadSectionExperiment;
172 188 procedure LoadSectionCondition(ASection: string);
173   - procedure LoadContingency(ASection, AContingency: string);// A condition section and a contingency key prefix
  189 + procedure LoadContingency(ASection, AContingency: string);// LabelPA condition section and LabelPA contingency key prefix
174 190 procedure SaveExperiment;
175 191 procedure SaveSectionExperiment;
176 192 procedure SaveSectionCondition(ASection: string);
... ... @@ -192,9 +208,11 @@ type
192 208 procedure UpdateContingencyCombo(ASection: String);
193 209 private
194 210 FLoading : Boolean;
  211 + FPersistentTXTFilename : string;
195 212 function GetContingencyName(IsMeta:Boolean; MustIncrement:Boolean=True):string;
196 213 procedure IncContingencyName(var AContingency : string; N : integer = 1);
197 214 procedure ReadContingencyNames(ASection, AContingency, AKeySuffix:string; S:TStrings);
  215 + procedure ReadContingencyValuesInSection(LS, LC : string; Keys:TStrings);
198 216 public
199 217 { public declarations }
200 218 end;
... ... @@ -206,6 +224,8 @@ implementation
206 224  
207 225 uses game_resources, game_actors, game_actors_point, string_methods, strutils;
208 226  
  227 +const SV_FILENAME : string = 'Filename';
  228 +
209 229 {$R *.lfm}
210 230  
211 231 { TFormDesigner }
... ... @@ -213,13 +233,41 @@ uses game_resources, game_actors, game_actors_point, string_methods, strutils;
213 233 procedure TFormDesigner.MenuItemOpenClick(Sender: TObject);
214 234 begin
215 235 if OpenDialog.Execute then
216   - begin
217   - if FExperiment.FileName = OpenDialog.FileName then
218   - Exit;
219   - FExperiment.Free;
220   - FExperiment := TIniFile.Create(OpenDialog.FileName);
221   - XMLPropStorage.StoredValue['FileName'] := FExperiment.FileName;
222   - end;
  236 + begin
  237 + if FExperiment.FileName = OpenDialog.FileName then
  238 + Exit;
  239 + SaveExperiment;
  240 + FExperiment.Free;
  241 + FExperiment := TIniFile.Create(OpenDialog.FileName);
  242 + XMLPropStorage.StoredValue[SV_FILENAME] := FExperiment.FileName;
  243 + XMLPropStorage.FileName := ExtractFilePath(FExperiment.FileName)+'persistence.xml';
  244 + LoadExperiment;
  245 +
  246 + OpenDialog.InitialDir:=ExtractFilePath(FExperiment.FileName);
  247 + SaveDialog.InitialDir:=ExtractFilePath(FExperiment.FileName);
  248 + end;
  249 +end;
  250 +
  251 +procedure TFormDesigner.MenuItemSaveAsClick(Sender: TObject);
  252 +var
  253 + LOldExperimentPath : string;
  254 +begin
  255 + if SaveDialog.Execute then
  256 + begin
  257 + if FExperiment.FileName = SaveDialog.FileName then
  258 + Exit;
  259 + LOldExperimentPath := FExperiment.FileName;
  260 + SaveExperiment;
  261 + FExperiment.Free;
  262 + CopyFile(LOldExperimentPath,SaveDialog.FileName);
  263 + FExperiment := TIniFile.Create(SaveDialog.FileName);
  264 + XMLPropStorage.StoredValue[SV_FILENAME] := FExperiment.FileName;
  265 +
  266 + XMLPropStorage.FileName := ExtractFilePath(FExperiment.FileName)+'persistence.xml';
  267 +
  268 + OpenDialog.InitialDir:=ExtractFilePath(FExperiment.FileName);
  269 + SaveDialog.InitialDir:=ExtractFilePath(FExperiment.FileName);
  270 + end;
223 271 end;
224 272  
225 273 procedure TFormDesigner.RGBroadcastMessageClick(Sender: TObject);
... ... @@ -427,6 +475,8 @@ begin
427 475 end;
428 476  
429 477 procedure TFormDesigner.RGPointsClick(Sender: TObject);
  478 +var
  479 + LVisible : Boolean;
430 480 begin
431 481 if Sender = RGPoints then
432 482 case TRadioGroup(Sender).ItemIndex of
... ... @@ -436,6 +486,13 @@ begin
436 486 CBPointsType.Items.Append('Individual A');
437 487 CBPointsType.Items.Append('Individual B');
438 488 CBPointsType.Items.Append('Para o Grupo');
  489 + LVisible := True;
  490 + SpinEditOnConditionBeginA.Visible:=LVisible;
  491 + SpinEditOnConditionBeginB.Visible:=LVisible;
  492 + SpinEditOnConditionBeginI.Visible:=not LVisible;
  493 + LabelPA.Visible:=LVisible;
  494 + LabelPB.Visible:=LVisible;
  495 + LabelPI.Visible:=not LVisible;
439 496 end;
440 497  
441 498 1:
... ... @@ -443,8 +500,22 @@ begin
443 500 CBPointsType.Items.Clear;
444 501 CBPointsType.Items.Append('Individual');
445 502 CBPointsType.Items.Append('Para o Grupo');
  503 + LVisible := False;
  504 + SpinEditOnConditionBeginA.Visible:=LVisible;
  505 + SpinEditOnConditionBeginB.Visible:=LVisible;
  506 + SpinEditOnConditionBeginI.Visible:=not LVisible;
  507 + LabelPA.Visible:=LVisible;
  508 + LabelPB.Visible:=LVisible;
  509 + LabelPI.Visible:=not LVisible;
446 510 end;
447 511 end;
  512 +
  513 + if not FLoading then
  514 + with FExperiment do
  515 + case RGPoints.ItemIndex of
  516 + 0: WriteBool(SEC_EXPERIMENT, KEY_POINTS_TYPE, True);
  517 + 1: WriteBool(SEC_EXPERIMENT, KEY_POINTS_TYPE, False);
  518 + end;
448 519 end;
449 520  
450 521 procedure TFormDesigner.SpinEditCyclesValueEditingDone(Sender: TObject);
... ... @@ -485,6 +556,30 @@ begin
485 556 end;
486 557 end;
487 558  
  559 +procedure TFormDesigner.SpinEditOnConditionBeginAEditingDone(Sender: TObject);
  560 +var
  561 + LS: string;
  562 +begin
  563 + if Sender is TSpinEdit then
  564 + with FExperiment do
  565 + if ComboCurrentCondition.ItemIndex <> -1 then
  566 + begin
  567 + LS := SEC_CONDITION+IntToStr(ComboCurrentCondition.ItemIndex+1);
  568 +
  569 + if TSpinEdit(Sender) = SpinEditOnConditionBeginA then
  570 + WriteInteger(LS, KEY_POINTS_ONSTART_A, SpinEditOnConditionBeginA.Value);
  571 +
  572 + if TSpinEdit(Sender) = SpinEditOnConditionBeginB then
  573 + WriteInteger(LS, KEY_POINTS_ONSTART_B, SpinEditOnConditionBeginB.Value);
  574 +
  575 + if TSpinEdit(Sender) = SpinEditOnConditionBeginI then
  576 + WriteInteger(LS, KEY_POINTS_ONSTART_I, SpinEditOnConditionBeginI.Value);
  577 +
  578 + if TSpinEdit(Sender) = SpinEditOnConditionBeginG then
  579 + WriteInteger(LS, KEY_POINTS_ONSTART_G, SpinEditOnConditionBeginG.Value);
  580 + end;
  581 +end;
  582 +
488 583 procedure TFormDesigner.SpinEditTurnValueEditingDone(Sender: TObject);
489 584 var
490 585 LS: string;
... ... @@ -498,17 +593,31 @@ begin
498 593 end;
499 594  
500 595 procedure TFormDesigner.XMLPropStorageRestoreProperties(Sender: TObject);
  596 +
501 597 begin
502 598 LoadExperiment;
503 599 ListBoxConditions.Items.Text := ComboCurrentCondition.Items.Text;
504   - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text;
505   - RGPointsClick(RGPoints);
506   - RGEndCriteriaStyleClick(RGEndCriteriaStyle);
  600 + UpdateContingencyList(ExtractDelimited(1,ComboCurrentCondition.Text,['|']));
  601 + //RGPointsClick(RGPoints);
  602 + //RGEndCriteriaStyleClick(RGEndCriteriaStyle);
507 603 TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0;
508 604 end;
509 605  
510 606 procedure TFormDesigner.XMLPropStorageSavingProperties(Sender: TObject);
  607 + procedure SavePropStorageFilename;
  608 + var
  609 + S : TStringList;
  610 + begin
  611 + S := TStringList.Create;
  612 + try
  613 + S.Text := XMLPropStorage.FileName;
  614 + S.SaveToFile(FPersistentTXTFilename);
  615 + finally
  616 + S.Free;
  617 + end;
  618 + end;
511 619 begin
  620 + SavePropStorageFilename;
512 621 SaveExperiment;
513 622 end;
514 623  
... ... @@ -738,9 +847,9 @@ begin
738 847 SpinEditContingencyPoints.Value := LPoints;
739 848  
740 849 SCode := ExtractDelimited(2,S,['|']);
741   - CS := GetConsequenceStylesFromString(SCode);
  850 + CS := GetConsequenceStyleFromString(SCode);
742 851 case RGPoints.ItemIndex of
743   - 0: { A & B }
  852 + 0: { LabelPA & B }
744 853 begin
745 854 if gscA in CS then CBPointsType.ItemIndex := 0;
746 855 if gscB in CS then CBPointsType.ItemIndex := 1;
... ... @@ -768,8 +877,6 @@ begin
768 877 RGBroadcastMessage.ItemIndex := 1
769 878 else
770 879 RGBroadcastMessage.ItemIndex := 2;
771   -
772   -
773 880 end;
774 881  
775 882 procedure TFormDesigner.UpdateContingencyList(ASection: String);
... ... @@ -831,6 +938,27 @@ begin
831 938 end;
832 939 end;
833 940  
  941 +procedure TFormDesigner.ReadContingencyValuesInSection(LS, LC: string;
  942 + Keys: TStrings);
  943 +begin
  944 + with FExperiment do
  945 + begin
  946 + Keys.BeginUpdate;
  947 + Keys.Values[LC + KEY_CONT_NAME] := ReadString(LS,LC+KEY_CONT_NAME,'');
  948 + Keys.Values[LC + KEY_CRITERIA] := ReadString(LS, LC + KEY_CRITERIA,'');
  949 + Keys.Values[LC + KEY_CONSEQUE] := ReadString(LS, LC + KEY_CONSEQUE,'');
  950 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_PREPEND] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND,'');
  951 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_PREPEND_LOSS] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,'');
  952 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,'');
  953 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,'');
  954 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_PREPEND_EARN] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND_EARN,'');
  955 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_S] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,'');
  956 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_P] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,'');
  957 + Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_ZERO] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_ZERO,'');
  958 + Keys.EndUpdate;
  959 + end;
  960 +end;
  961 +
834 962 procedure TFormDesigner.SaveSectionExperiment;
835 963 begin
836 964 with FExperiment do
... ... @@ -857,8 +985,7 @@ begin
857 985 EditResearcherName.Text := ReadString(SEC_EXPERIMENT, KEY_RESEARCHER, '');
858 986 EditExperimentName.Text := ReadString(SEC_EXPERIMENT, KEY_NAME, '');
859 987 MemoExperimentAim.Text := ReadString(SEC_EXPERIMENT, KEY_AIM, '');
860   - CGGlobal.Checked[0] :=
861   - ReadBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, False);
  988 + CGGlobal.Checked[0] := ReadBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, False);
862 989 CGGlobal.Checked[1] := ReadBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED, False);
863 990 CGGlobal.Checked[2] := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY, False);
864 991 CGGlobal.Checked[3] := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT, False);
... ... @@ -877,7 +1004,10 @@ begin
877 1004 begin
878 1005 WriteString(ASection, KEY_COND_NAME, EditConditionName.Text);
879 1006 WriteInteger(ASection, KEY_TURN_VALUE, SpinEditTurnValue.Value);
880   - WriteInteger(ASection, KEY_POINTS_ONSTART,SpinEditOnConditionBegin.Value);
  1007 + WriteInteger(ASection, KEY_POINTS_ONSTART_A,SpinEditOnConditionBeginA.Value);
  1008 + WriteInteger(ASection, KEY_POINTS_ONSTART_B,SpinEditOnConditionBeginB.Value);
  1009 + WriteInteger(ASection, KEY_POINTS_ONSTART_I,SpinEditOnConditionBeginI.Value);
  1010 + WriteInteger(ASection, KEY_POINTS_ONSTART_G,SpinEditOnConditionBeginG.Value);
881 1011 WriteInteger(ASection, KEY_CYCLES_VALUE, SpinEditCyclesValue.Value);
882 1012 WriteString(ASection, KEY_PROMPT_MESSAGE, EditQuestion.Text);
883 1013 WriteString(ASection, KEY_PROMPT_STYLE, GetPromptQuestionStringFromCGQuestion);
... ... @@ -1007,7 +1137,7 @@ var
1007 1137 begin
1008 1138 CS := [gscMessage,gscPoints];
1009 1139 case RGPoints.ItemIndex of
1010   - 0: { A & B }
  1140 + 0: { LabelPA & B }
1011 1141 case CBPointsType.ItemIndex of
1012 1142 0 {'Individual A'} : CS += [gscA];
1013 1143 1 {'Individual B'} : CS += [gscB];
... ... @@ -1027,7 +1157,7 @@ begin
1027 1157 end;
1028 1158  
1029 1159 Result := IntToStr(SpinEditContingencyPoints.Value)+',0|';
1030   - Result += GetConsequenceStylesString(CS);
  1160 + Result += GetConsequenceStyleString(CS);
1031 1161 end;
1032 1162  
1033 1163 function TFormDesigner.GetContingencyCriteria: string;
... ... @@ -1112,7 +1242,6 @@ begin
1112 1242 begin
1113 1243 EditConditionName.Text := ReadString(ASection, KEY_COND_NAME, ASection);
1114 1244 SpinEditTurnValue.Value := ReadInteger(ASection, KEY_TURN_VALUE, 2);
1115   - SpinEditOnConditionBegin.Value := ReadInteger(ASection, KEY_POINTS_ONSTART,0);
1116 1245 SpinEditCyclesValue.Value := ReadInteger(ASection, KEY_CYCLES_VALUE, 2);
1117 1246  
1118 1247 CheckBoxShouldAskQuestion.Checked := False;
... ... @@ -1123,6 +1252,11 @@ begin
1123 1252 if (EditQuestion.Text <> '') or (ReadString(ASection, KEY_PROMPT_STYLE, '') <> '') then
1124 1253 CheckBoxShouldAskQuestion.Checked := True;
1125 1254 end;
  1255 + LabelQuestion.Visible:= CheckBoxShouldAskQuestion.Checked;
  1256 + SpinEditOnConditionBeginA.Value := ReadInteger(ASection, KEY_POINTS_ONSTART_A, 0);
  1257 + SpinEditOnConditionBeginB.Value := ReadInteger(ASection, KEY_POINTS_ONSTART_B, 0);
  1258 + SpinEditOnConditionBeginI.Value := ReadInteger(ASection, KEY_POINTS_ONSTART_I, 0);
  1259 + SpinEditOnConditionBeginG.Value := ReadInteger(ASection, KEY_POINTS_ONSTART_G, 0);
1126 1260  
1127 1261 SetRGEndCriteriaStyle(ReadString(ASection, KEY_ENDCRITERIA, 'O QUE OCORRER PRIMEIRO'));
1128 1262 SpinEditEndCriteriaAbsCycles.Value := ReadInteger(ASection, KEY_ENDCRITERIA_CYCLES, 20);
... ... @@ -1180,8 +1314,47 @@ begin
1180 1314 end;
1181 1315  
1182 1316 procedure TFormDesigner.FormCreate(Sender: TObject);
  1317 +var
  1318 + LRootPath: RawByteString;
  1319 +
  1320 + function ReadLnFromFile(AFilename:string;ALine : integer):string;
  1321 + var
  1322 + S : TStringList;
  1323 + begin
  1324 + Result := '';
  1325 + if FileExists(AFilename) then
  1326 + begin
  1327 + S := TStringList.Create;
  1328 + try
  1329 + S.LoadFromFile(AFilename);
  1330 + if S.Count > 0 then
  1331 + Result := S[ALine];
  1332 + finally
  1333 + S.Free;
  1334 + end;
  1335 + end
  1336 + end;
1183 1337 begin
  1338 + // TRadioGroup OnClick events are triggered programmatically by LCL code, not by us
  1339 + // FLoading is a temporary workaround to avoid
  1340 + // calls for SaveProcedures while loading FExperiment
1184 1341 FLoading := True;
  1342 +
  1343 +
  1344 + LRootPath := ExtractFilePath(Application.ExeName);
  1345 +
  1346 + // FPersistentTXTFilename must not change during runtime.
  1347 + FPersistentTXTFilename := LRootPath+'persistence.txt';
  1348 +
  1349 + // XMLPropStorage.FileName may change during runtime
  1350 + XMLPropStorage.FileName := ReadLnFromFile(FPersistentTXTFilename,0);
  1351 + if XMLPropStorage.FileName = '' then
  1352 + XMLPropStorage.FileName := LRootPath+'persistence.xml';
  1353 +
  1354 + // XMLPropStorage.StoredValue[SV_FILENAME] may change during runtime
  1355 + XMLPropStorage.StoredValue[SV_FILENAME] := LRootPath+'persistence.ini';
  1356 + OpenDialog.InitialDir:=LRootPath;
  1357 + SaveDialog.InitialDir:=LRootPath;
1185 1358 end;
1186 1359  
1187 1360 procedure TFormDesigner.FormDestroy(Sender: TObject);
... ... @@ -1202,11 +1375,12 @@ begin
1202 1375 if ComboCurrentCondition.ItemIndex <> -1 then
1203 1376 begin
1204 1377 LS := SEC_CONDITION+IntToStr(ComboCurrentCondition.ItemIndex+1);
  1378 + EditQuestion.Text:='';
1205 1379 WriteString(LS, KEY_PROMPT_MESSAGE, '');
1206 1380 WriteString(LS, KEY_PROMPT_STYLE, '');
1207 1381 end;
1208 1382 end;
1209   -
  1383 + LabelQuestion.Visible:= CheckBoxShouldAskQuestion.Checked;
1210 1384 EditQuestion.Visible := CheckBoxShouldAskQuestion.Checked;
1211 1385 CGQuestion.Visible := CheckBoxShouldAskQuestion.Checked;
1212 1386 end;
... ... @@ -1239,8 +1413,22 @@ begin
1239 1413 end;
1240 1414  
1241 1415 procedure TFormDesigner.ComboCurrentConditionChange(Sender: TObject);
  1416 +var
  1417 + LS, LC: String;
1242 1418 begin
1243   - LoadSectionCondition(SEC_CONDITION + IntToStr(ComboCurrentCondition.ItemIndex + 1));
  1419 + LS := SEC_CONDITION + IntToStr(ComboCurrentCondition.ItemIndex + 1);
  1420 + LoadSectionCondition(LS);
  1421 + UpdateContingencyList(LS);
  1422 + if ListBoxContingencies.Items.Count > 0 then
  1423 + begin
  1424 + LC := ExtractDelimited(1,ListBoxContingencies.Items[0],['|']);
  1425 + if Pos(KEY_METACONTINGENCY,LC) > 0 then
  1426 + RGContingencyType.ItemIndex := 1
  1427 + else
  1428 + RGContingencyType.ItemIndex := 0;
  1429 + RGContingencyTypeClick(ComboCurrentCondition);
  1430 + LoadContingency(LS,LC);
  1431 + end;
1244 1432 end;
1245 1433  
1246 1434 procedure TFormDesigner.ComboCurrentContingencyChange(Sender: TObject);
... ... @@ -1275,13 +1463,44 @@ begin
1275 1463 WriteString(LS, LC+ KEY_CONT_NAME, EditContingencyName.Text);
1276 1464 ComboCurrentContingency.Items[ComboCurrentContingency.ItemIndex] :=
1277 1465 LC + '|' + EditContingencyName.Text;
1278   - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text;
  1466 + UpdateContingencyList(LS);
1279 1467 end;
1280 1468 end;
1281 1469  
1282   -procedure TFormDesigner.EditMessSufixZeroChange(Sender: TObject);
  1470 +procedure TFormDesigner.EditMessDone(Sender: TObject);
  1471 +var
  1472 + LSection, LContingency: String;
1283 1473 begin
  1474 + LSection := SEC_CONDITION+IntToStr(ComboCurrentCondition.ItemIndex+1);
  1475 + LContingency := ExtractDelimited(1,ComboCurrentContingency.Text,['|']);
  1476 +
  1477 + if Sender is TEdit then
  1478 + with FExperiment do
  1479 + begin
  1480 + if TEdit(Sender) = EditMessPrefix then
  1481 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_PREPEND, EditMessPrefix.Text);
  1482 +
  1483 + if TEdit(Sender) = EditMessPrefixLoss then
  1484 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,EditMessPrefixLoss.Text);
  1485 +
  1486 + if TEdit(Sender) = EditMessSufixLossSingular then
  1487 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,EditMessSufixLossSingular.Text);
1284 1488  
  1489 + if TEdit(Sender) = EditMessSufixLossPlural then
  1490 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,EditMessSufixLossPlural.Text);
  1491 +
  1492 + if TEdit(Sender) = EditMessPrefixEarn then
  1493 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_PREPEND_EARN,EditMessPrefixEarn.Text);
  1494 +
  1495 + if TEdit(Sender) = EditMessSufixEarnSingular then
  1496 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,EditMessSufixEarnSingular.Text);
  1497 +
  1498 + if TEdit(Sender) = EditMessSufixEarnPlural then
  1499 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,EditMessSufixEarnPlural.Text);
  1500 +
  1501 + if TEdit(Sender) = EditMessSufixZero then
  1502 + WriteString(LSection, LContingency + KEY_CONSEQUE_MESSAGE_APPEND_ZERO, EditMessSufixZero.Text);
  1503 + end;
1285 1504 end;
1286 1505  
1287 1506 procedure TFormDesigner.ConsequenceMessageEditingDone(Sender: TObject);
... ... @@ -1305,6 +1524,27 @@ begin
1305 1524 end;
1306 1525 end;
1307 1526  
  1527 +procedure TFormDesigner.EditExperimentEditingDone(Sender: TObject);
  1528 +begin
  1529 + with FExperiment do
  1530 + begin
  1531 + if Sender is TEdit then
  1532 + begin
  1533 + if TEdit(Sender) = EditResearcherName then
  1534 + WriteString(SEC_EXPERIMENT, KEY_RESEARCHER, EditResearcherName.Text);
  1535 +
  1536 + if TEdit(Sender) = EditExperimentName then
  1537 + WriteString(SEC_EXPERIMENT, KEY_NAME, EditExperimentName.Text);
  1538 + end;
  1539 +
  1540 + if Sender is TMemo then
  1541 + begin
  1542 + if TMemo(Sender) = MemoExperimentAim then
  1543 + WriteString(SEC_EXPERIMENT, KEY_AIM, MemoExperimentAim.Text);
  1544 + end;
  1545 + end;
  1546 +end;
  1547 +
1308 1548 procedure TFormDesigner.FormActivate(Sender: TObject);
1309 1549 begin
1310 1550 FLoading := False;
... ... @@ -1313,15 +1553,48 @@ end;
1313 1553  
1314 1554 procedure TFormDesigner.BtnAppendCondClick(Sender: TObject);
1315 1555 var
1316   - i: integer;
  1556 + i, LOldSection: integer;
  1557 + LContingency : TStringList;
  1558 + LS, KeyNameValue, LSectionToRead, LContingencyToRead, KeyName: String;
1317 1559 begin
  1560 + // make LabelPA copy of old components
  1561 + LOldSection := ComboCurrentCondition.ItemIndex;
  1562 +
  1563 + // add new condition
1318 1564 i := ComboCurrentCondition.Items.Add('');
1319 1565 ComboCurrentCondition.Items[i] :=
1320 1566 SEC_CONDITION + IntToStr(i + 1) + '|' + EditConditionName.Text;
1321 1567 ComboCurrentCondition.ItemIndex := i;
1322   - SaveSectionCondition(SEC_CONDITION + IntToStr(i + 1));
  1568 + LS := SEC_CONDITION + IntToStr(i + 1);
  1569 + SaveSectionCondition(LS);
1323 1570 ListBoxConditions.Items.Text := ComboCurrentCondition.Items.Text;
1324 1571 TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0;
  1572 +
  1573 + // handle selection of contingencies
  1574 + if LOldSection > -1 then
  1575 + if ListBoxContingencies.Items.Count > 0 then
  1576 + if ListBoxContingencies.SelCount > 0 then
  1577 + begin
  1578 + LContingency := TStringList.Create;
  1579 + LSectionToRead := SEC_CONDITION+IntToStr(LOldSection+1);
  1580 + try
  1581 + for i := 0 to ListBoxContingencies.Items.Count -1 do
  1582 + if ListBoxContingencies.Selected[i] then
  1583 + begin
  1584 + LContingency.Clear;
  1585 + LContingencyToRead := ExtractDelimited(1,ListBoxContingencies.Items[i],['|']);
  1586 + ReadContingencyValuesInSection(LSectionToRead,LContingencyToRead,LContingency);
  1587 + for KeyNameValue in LContingency do
  1588 + begin
  1589 + KeyName := LContingency.ExtractName(KeyNameValue);
  1590 + FExperiment.WriteString(LS,KeyName,LContingency.Values[KeyName]);
  1591 + end;
  1592 + end;
  1593 + finally
  1594 + LContingency.Free;
  1595 + end;
  1596 + end;
  1597 + UpdateContingencyList(LS);
1325 1598 end;
1326 1599  
1327 1600 procedure TFormDesigner.BtnAppendContingencyClick(Sender: TObject);
... ... @@ -1344,7 +1617,7 @@ procedure TFormDesigner.BtnRemoveCondClick(Sender: TObject);
1344 1617 var
1345 1618 i: integer;
1346 1619 MustReorder: boolean;
1347   - LS: String;
  1620 + LS, LC: String;
1348 1621  
1349 1622 procedure Reorder(index : integer);
1350 1623 var
... ... @@ -1396,6 +1669,18 @@ begin
1396 1669 end;
1397 1670 ListBoxConditions.Items.Text := ComboCurrentCondition.Items.Text;
1398 1671 TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0;
  1672 + if ComboCurrentCondition.Items.Count > 0 then
  1673 + if ComboCurrentCondition.ItemIndex <> -1 then
  1674 + begin
  1675 + LS := ExtractDelimited(1, ComboCurrentCondition.Text, ['|']);
  1676 + LoadSectionCondition(LS);
  1677 + UpdateContingencyList(LS);
  1678 + if ListBoxContingencies.Items.Count > 0 then
  1679 + begin
  1680 + LC := ExtractDelimited(1, ListBoxContingencies.Items[0], ['|']);
  1681 + LoadContingency(LS,LC);
  1682 + end;
  1683 + end;
1399 1684 end;
1400 1685 end;
1401 1686  
... ... @@ -1405,25 +1690,6 @@ var
1405 1690 MustReorder: boolean;
1406 1691 LS, LC: String;
1407 1692  
1408   - procedure ReadContingencyValuesInSection(LS,LC : string; var Keys : TStringList);
1409   - begin
1410   - Keys.BeginUpdate;
1411   - with FExperiment do
1412   - begin
1413   - Keys.Values[LC + KEY_CONT_NAME] := ReadString(LS,LC+KEY_CONT_NAME,'');
1414   - Keys.Values[LC + KEY_CRITERIA] := ReadString(LS, LC + KEY_CRITERIA,'');
1415   - Keys.Values[LC + KEY_CONSEQUE] := ReadString(LS, LC + KEY_CONSEQUE,'');
1416   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_PREPEND] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND,'');
1417   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_PREPEND_LOSS] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,'');
1418   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,'');
1419   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,'');
1420   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_PREPEND_EARN] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND_EARN,'');
1421   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_S] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,'');
1422   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_P] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,'');
1423   - Keys.Values[LC + KEY_CONSEQUE_MESSAGE_APPEND_ZERO] := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPEND_ZERO,'');
1424   - end;
1425   - Keys.EndUpdate;
1426   - end;
1427 1693 //todo:fix bug in here
1428 1694 procedure Reorder(Index:integer);
1429 1695 var
... ... @@ -1476,12 +1742,19 @@ begin
1476 1742 ComboCurrentContingency.ItemIndex := i -1;
1477 1743 end;
1478 1744 UpdateContingencyList(LS);
  1745 + if ComboCurrentContingency.Items.Count > 0 then
  1746 + if (ComboCurrentContingency.ItemIndex > -1) and
  1747 + (ComboCurrentContingency.ItemIndex < ComboCurrentContingency.Items.Count) then
  1748 + begin
  1749 + LC := ExtractDelimited(1, ComboCurrentContingency.Text, ['|']);
  1750 + LoadContingency(LS,LC);
  1751 + end;
1479 1752 end;
1480 1753 end;
1481 1754  
1482 1755 procedure TFormDesigner.BtnReorderCondClick(Sender: TObject);
1483 1756 begin
1484   - // todo: custom reorder contingencies
  1757 + // todo: custom reorder conditions
1485 1758 ShowMessage('Não implementado.');
1486 1759 end;
1487 1760  
... ... @@ -1522,6 +1795,26 @@ begin
1522 1795 CreateMessage(i);
1523 1796 end;
1524 1797  
  1798 +procedure TFormDesigner.CGGlobalItemClick(Sender: TObject; Index: integer);
  1799 +begin
  1800 + if not FLoading then
  1801 + if Sender is TCheckGroup then
  1802 + with FExperiment do
  1803 + begin
  1804 + if Index = 0 then
  1805 + WriteBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, CGGlobal.Checked[Index]);
  1806 +
  1807 + if Index = 1 then
  1808 + WriteBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED, CGGlobal.Checked[Index]);
  1809 +
  1810 + if Index = 2 then
  1811 + WriteBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY, CGGlobal.Checked[Index]);
  1812 +
  1813 + if Index = 3 then
  1814 + WriteBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT, CGGlobal.Checked[Index]);
  1815 + end;
  1816 +end;
  1817 +
1525 1818 procedure TFormDesigner.CheckBoxImutableMessageChange(Sender: TObject);
1526 1819 var
1527 1820 LVisible : Boolean;
... ... @@ -1531,24 +1824,46 @@ begin
1531 1824 if LVisible then
1532 1825 begin
1533 1826 LabelCsq3.Caption := 'Texto da mensagem de notificação';
1534   - LGamePoint := TGamePoint.Create(Self,IntToStr(SpinEditContingencyPoints.Value));
1535   - if not FLoading then
1536   - case RGContingencyType.ItemIndex of
1537   - 0:EditMessPrefix.Text := LGamePoint.PointMessage('','','','','','','','',False);
1538   - 1:EditMessPrefix.Text := LGamePoint.PointMessage('','','','','','','','',True);
1539   - end;
1540   - LGamePoint.Free;
1541 1827 ButtonPreviewMessage.Caption:= 'Ver como a mensagem será apresentada';
  1828 + LGamePoint := TGamePoint.Create(nil,IntToStr(SpinEditContingencyPoints.Value));
  1829 + try
  1830 + if not FLoading then
  1831 + begin
  1832 + case RGContingencyType.ItemIndex of
  1833 + 0:EditMessPrefix.Text := LGamePoint.PointMessage('','','','','','','','',False);
  1834 + 1:EditMessPrefix.Text := LGamePoint.PointMessage('','','','','','','','',True);
  1835 + end;
  1836 +
  1837 + EditMessPrefixLoss.Text := '';
  1838 + EditMessSufixLossPlural.Text := '';
  1839 + EditMessSufixLossSingular.Text := '';
  1840 + EditMessPrefixEarn.Text := '';
  1841 + EditMessSufixEarnPlural.Text := '';
  1842 + EditMessSufixEarnSingular.Text := '';
  1843 + EditMessSufixZero.Text := '';
  1844 + end;
  1845 + finally
  1846 + LGamePoint.Free;
  1847 + end;
1542 1848 end
1543 1849 else
1544 1850 begin
1545 1851 LabelCsq3.Caption := 'Texto no início da mensagem';
1546 1852 if not FLoading then
1547   - case RGContingencyType.ItemIndex of
1548   - 0:EditMessPrefix.Text := '$NICNAME';
1549   - 1:EditMessPrefix.Text := 'Vocês';
1550   - end;
1551   - ButtonPreviewMessage.Caption:= 'Ver como a mensagem pode ser apresentada';
  1853 + begin
  1854 + case RGContingencyType.ItemIndex of
  1855 + 0:EditMessPrefix.Text := '$NICNAME';
  1856 + 1:EditMessPrefix.Text := 'Vocês';
  1857 + end;
  1858 + EditMessPrefixLoss.Text := 'retiraram';
  1859 + EditMessSufixLossSingular.Text := 'item escolar de uma escola pública.';
  1860 + EditMessSufixLossPlural.Text := 'itens escolares de uma escola pública.';
  1861 + EditMessPrefixEarn.Text := 'doaram';
  1862 + EditMessSufixEarnSingular.Text := 'item escolar a uma escola pública.';
  1863 + EditMessSufixEarnPlural.Text := 'itens escolares a uma escola pública.';
  1864 + EditMessSufixZero.Text := 'não doaram nem retiram itens escolares.';
  1865 + ButtonPreviewMessage.Caption:= 'Ver como a mensagem poderá ser apresentada';
  1866 + end;
1552 1867 end;
1553 1868  
1554 1869 LabelCsq4.Visible := not LVisible;
... ... @@ -1559,19 +1874,26 @@ begin
1559 1874 LabelCsq9.Visible := not LVisible;
1560 1875 LabelCsq10.Visible := not LVisible;
1561 1876 EditMessPrefixLoss.Visible:= not LVisible;
1562   - EditMessPrefixLoss.Text := '';
1563 1877 EditMessSufixLossPlural.Visible:= not LVisible;
1564   - EditMessSufixLossPlural.Text := '';
1565 1878 EditMessSufixLossSingular.Visible:= not LVisible;
1566   - EditMessSufixLossSingular.Text := '';
1567 1879 EditMessPrefixEarn.Visible:= not LVisible;
1568   - EditMessPrefixEarn.Text := '';
1569 1880 EditMessSufixEarnPlural.Visible:= not LVisible;
1570   - EditMessSufixEarnPlural.Text := '';
1571 1881 EditMessSufixEarnSingular.Visible:= not LVisible;
1572   - EditMessSufixEarnSingular.Text := '';
1573 1882 EditMessSufixZero.Visible:= not LVisible;
1574   - EditMessSufixZero.Text := '';
  1883 + EditMessDone(EditMessPrefix);
  1884 + EditMessDone(EditMessPrefixLoss);
  1885 + EditMessDone(EditMessSufixLossSingular);
  1886 + EditMessDone(EditMessSufixLossPlural);
  1887 + EditMessDone(EditMessPrefixEarn);
  1888 + EditMessDone(EditMessSufixEarnSingular);
  1889 + EditMessDone(EditMessSufixEarnPlural);
  1890 + EditMessDone(EditMessSufixZero);
  1891 +end;
  1892 +
  1893 +procedure TFormDesigner.ChkMatrixTypeClick(Sender: TObject);
  1894 +begin
  1895 + if Sender is TCheckBox then
  1896 + FExperiment.WriteString(SEC_EXPERIMENT, KEY_MATRIX_TYPE, GetMatrixTypeStringFromCGMatrix);
1575 1897 end;
1576 1898  
1577 1899  
... ...
units/game_actors.pas
... ... @@ -107,7 +107,7 @@ type
107 107 procedure StopTimer(Sender:TObject;var ACloseAction:TCloseAction);
108 108 procedure SelfDestroy(Sender:TOBject);virtual;
109 109 public
110   - constructor Create(AOwner:TComponent; AP:TGamePoint; AStyle:TConsequenceStyle; ANicname,
  110 + constructor Create(AOwner:TComponent; ACsqString, ANicname,
111 111 APrependLoss,AAppendiceLossSingular,AAppendiceLossPlural,
112 112 APrependEarn,AAppendiceEarnSingular,AAppendiceEarnPlural,AAppendiceZero:string);overload;
113 113 constructor Create(AOwner:TComponent; AP:integer; AStyle: TConsequenceStyle; AMessage:array of string);overload;
... ... @@ -533,7 +533,7 @@ var
533 533  
534 534 LConsequence := S + '+' +
535 535 IntToStr(Pts) +'|'+
536   - GetConsequenceStylesString(LCsqStyle) +'|'+
  536 + GetConsequenceStyleString(LCsqStyle) +'|'+
537 537 ExtractDelimited(3,LConsequence, ['|']) +'|'+
538 538 LPrependLoss +'|'+
539 539 LAppendiceLossSingular +'|'+
... ... @@ -554,7 +554,7 @@ begin
554 554 begin
555 555 LID := FPromptTargets[i].Consequence.ConsequenseByPlayerID.Names[j];
556 556 LConsequence := FPromptTargets[i].Consequence.ConsequenseByPlayerID.Values[LID];
557   - LCsqStyle := GetConsequenceStylesFromString(ExtractDelimited(2,LConsequence, ['|']));
  557 + LCsqStyle := GetConsequenceStyleFromString(ExtractDelimited(2,LConsequence, ['|']));
558 558  
559 559 // BasA must revert message variables
560 560 LPrependLoss := ExtractDelimited(4,LConsequence, ['|']);
... ... @@ -582,12 +582,15 @@ end;
582 582  
583 583 { TConsequence }
584 584  
585   -constructor TConsequence.Create(AOwner: TComponent; AP: TGamePoint;AStyle: TConsequenceStyle; ANicname,
586   - APrependLoss, AAppendiceLossSingular, AAppendiceLossPlural,
587   - APrependEarn, AAppendiceEarnSingular, AAppendiceEarnPlural, AAppendiceZero: string);
  585 +constructor TConsequence.Create(AOwner: TComponent; ACsqString, ANicname,
  586 + APrependLoss, AAppendiceLossSingular, AAppendiceLossPlural, APrependEarn,
  587 + AAppendiceEarnSingular, AAppendiceEarnPlural, AAppendiceZero: string);
  588 +var
  589 + LP : string;
588 590 begin
589 591 inherited Create(AOwner);
590   - FStyle:=AStyle;
  592 +
  593 + // custom message
591 594 FNicname:=ANicname;
592 595 FPrependLoss:=APrependLoss;
593 596 FAppendiceLossSingular:=AAppendiceLossSingular;
... ... @@ -597,7 +600,15 @@ begin
597 600 FAppendiceEarnPlural:=AAppendiceEarnPlural;
598 601 FAppendiceZero:=AAppendiceZero;
599 602  
600   - FP := AP;
  603 + // extract game point string
  604 + LP := ExtractDelimited(1,ACsqString,['|']);
  605 +
  606 + // [value,variation]
  607 + FP := TGamePoint.Create(AOwner,[StrToInt(ExtractDelimited(1,LP,[','])),StrToInt(ExtractDelimited(2,LP,[',']))]);
  608 +
  609 + // consequesen style string
  610 + FStyle := GetConsequenceStyleFromString(ExtractDelimited(2,ACsqString,['|']));
  611 +
601 612 FMessage := TPopupNotifier.Create(AOwner);
602 613 FConsequenceByPlayerID := TStringList.Create;
603 614 end;
... ... @@ -625,7 +636,7 @@ constructor TConsequence.Create(AOwner: TComponent;
625 636 begin
626 637 inherited Create(AOwner);
627 638 FP := TGamePoint.Create(AOwner,ExtractDelimited(1,AConsequenceString,['|']));
628   - FStyle:=GetConsequenceStylesFromString(ExtractDelimited(2,AConsequenceString,['|']));
  639 + FStyle:=GetConsequenceStyleFromString(ExtractDelimited(2,AConsequenceString,['|']));
629 640 FNicname:=ExtractDelimited(3,AConsequenceString,['|']);
630 641 FPrependLoss:=ExtractDelimited(4,AConsequenceString,['|']);
631 642 FAppendiceLossSingular:=ExtractDelimited(5,AConsequenceString,['|']);
... ... @@ -652,7 +663,7 @@ end;
652 663 function TConsequence.AsString(AID: string): string;
653 664 begin
654 665 Result := IntToStr(FP.ValueWithVariation) + '|';
655   - Result += GetConsequenceStylesString(FStyle)+'|';
  666 + Result += GetConsequenceStyleString(FStyle)+'|';
656 667 Result += FNicname +'|';
657 668 Result += FPrependLoss + '|';
658 669 Result += FAppendiceLossSingular + '|';
... ...
units/game_file_methods.pas
... ... @@ -202,8 +202,21 @@ var
202 202 with LIniFile do
203 203 while ValueExists(LS, LCK+KEY_CONSEQUE) and ValueExists(LS, LCK+KEY_CRITERIA)do
204 204 begin
205   - LConsequence := TConsequence.Create(AExperiment,ReadString(LS,LCK+KEY_CONSEQUE,DEF_CONSEQUENCE));
206   - LCriteria := GetCriteriaFromString(ReadString(LS,LCK+KEY_CRITERIA,DEF_CRITERIA));
  205 + AExperiment.Condition[ACondition].Contingencies[i].ContingencyName := ReadString(LS, LCK+KEY_CONT_NAME, '');
  206 + ReadString(LS, LCK+KEY_CONSEQUE, '');
  207 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND,'');
  208 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,'');
  209 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,'');
  210 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,'');
  211 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND_EARN,'');
  212 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,'');
  213 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,'');
  214 + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_ZERO, '');
  215 +
  216 +
  217 + LConsequence := TConsequence.Create(AExperiment,
  218 + ReadString(LS,LCK+KEY_CONSEQUE,DEF_CONSEQUENCE));
  219 + LCriteria := GetCriteriaFromString(ReadString(LS, LCK+KEY_CRITERIA, ''));
207 220 AExperiment.Condition[ACondition].Contingencies[i] := TContingency.Create(AExperiment,LConsequence,LCriteria,IsMeta);
208 221 i := AExperiment.AppendContingency(ACondition);
209 222 SetLCK(i);
... ... @@ -277,11 +290,13 @@ var
277 290 Choice := GetChoiceFromString(ReadString(LS,KEY_PLAYER_CHOICE_LAST,'0,NONE,'));
278 291 ID := ReadString(LS,KEY_PLAYER_ID,'ID');
279 292 Nicname := ReadString(LS,KEY_PLAYER_NICNAME,GenResourceName(i));
280   - Login := ReadString(LS,KEY_PLAYER_LOGIN,'jogador'+IntToStr(i+1));
281   - Password := ReadString(LS,KEY_PLAYER_PASSWORD,'1234');
282   - Points := GetPPointsFromString(ReadString(LS,KEY_PLAYER_POINTS,'0,0,'));
283   - Status := GetStatusFromString(ReadString(LS,KEY_PLAYER_STATUS,'esperando'));
284   - Data.Values[KEY_PLAYER_TEMP] := ReadString(LS,KEY_PLAYER_TEMP,'');
  293 +
  294 + // currently not in use
  295 + //Login := ReadString(LS,KEY_PLAYER_LOGIN,'jogador'+IntToStr(i+1));
  296 + //Password := ReadString(LS,KEY_PLAYER_PASSWORD,'1234');
  297 + //Points := GetPPointsFromString(ReadString(LS,KEY_PLAYER_POINTS,'0,0,'));
  298 + //Status := GetStatusFromString(ReadString(LS,KEY_PLAYER_STATUS,'esperando'));
  299 + //Data.Values[KEY_PLAYER_TEMP] := ReadString(LS,KEY_PLAYER_TEMP,'');
285 300 end;
286 301 AExperiment.Player[i] := P;
287 302 i := AExperiment.AppendPlayer;
... ...
units/game_resources.pas
... ... @@ -52,7 +52,10 @@ resourcestring
52 52 KEY_TURN_RANDOM = 'Rodada.OrdemDeJogadaAleatória'; // Sim
53 53  
54 54 KEY_POINTS_COUNT = 'Pontos.AoRecomeço';
55   - KEY_POINTS_ONSTART = 'Pontos.SomarAoComeço';
  55 + KEY_POINTS_ONSTART_A = 'Pontos.Somar_ao_iniciar_condição.A';
  56 + KEY_POINTS_ONSTART_B = 'Pontos.Somar_ao_iniciar_condição.B';
  57 + KEY_POINTS_ONSTART_I = 'Pontos.Somar_ao_iniciar_condição.I';
  58 + KEY_POINTS_ONSTART_G = 'Pontos.Somar_ao_iniciar_condição.G';
56 59  
57 60 KEY_CYCLES_VALUE = 'Ciclos.MudançaDeGeração';
58 61 KEY_CYCLES_COUNT = 'Ciclos.AoRecomeço';
... ...
units/string_methods.pas
... ... @@ -33,10 +33,10 @@ function GetPromptStyleFromString(S : string) : TPromptStyle;
33 33 function GetPromptStyleString(AStyle : TPromptStyle) : string;
34 34 function GetGamePromptStyleFromString(S : string) : TGamePromptStyle;
35 35  
36   -function GetConsequenceStyleFromString(s : string):TGameConsequenceStyle;
37   -function GetConsequenceStyleString(AStyle : TGameConsequenceStyle): string;
38   -function GetConsequenceStylesFromString(S : string):TConsequenceStyle;
39   -function GetConsequenceStylesString(CS : TConsequenceStyle): string;
  36 +function GetGConsequenceStyleFromString(s : string):TGameConsequenceStyle;
  37 +function GetGConsequenceStyleString(AStyle : TGameConsequenceStyle): string;
  38 +function GetConsequenceStyleFromString(S : string):TConsequenceStyle;
  39 +function GetConsequenceStyleString(CS : TConsequenceStyle): string;
40 40  
41 41 function GetCriteriaString(ACriteria : TCriteria) : string;
42 42 function GetCriteriaFromString(S : string) : TCriteria;
... ... @@ -236,7 +236,7 @@ begin
236 236 end;
237 237 end;
238 238  
239   -function GetConsequenceStyleFromString(s: string): TGameConsequenceStyle;
  239 +function GetGConsequenceStyleFromString(s: string): TGameConsequenceStyle;
240 240 begin
241 241 case UpperCase(S) of
242 242 'NADA': Result:= gscNone;
... ... @@ -251,7 +251,7 @@ begin
251 251 end;
252 252 end;
253 253  
254   -function GetConsequenceStyleString(AStyle: TGameConsequenceStyle): string;
  254 +function GetGConsequenceStyleString(AStyle: TGameConsequenceStyle): string;
255 255 begin
256 256 Result := '';
257 257 case AStyle of
... ... @@ -343,7 +343,7 @@ begin
343 343 end;
344 344 end;
345 345  
346   -function GetConsequenceStylesFromString(S:string):TConsequenceStyle;
  346 +function GetConsequenceStyleFromString(S:string):TConsequenceStyle;
347 347 var
348 348 LCount,
349 349 i : integer;
... ... @@ -363,7 +363,7 @@ begin
363 363 end;
364 364 end;
365 365  
366   -function GetConsequenceStylesString(CS: TConsequenceStyle): string;
  366 +function GetConsequenceStyleString(CS: TConsequenceStyle): string;
367 367 var ConsequenceStyle : TGameConsequenceStyle;
368 368 begin
369 369 Result := '';
... ...