Commit b38409b544bcaf4012fb9e182292e64edbfe7976
1 parent
46b2a955
Exists in
master
gui incremental work
Showing
2 changed files
with
428 additions
and
293 deletions
Show diff stats
experiment_designer/form_main.lfm
1 | 1 | object FormDesigner: TFormDesigner |
2 | - Left = 469 | |
2 | + Left = 327 | |
3 | 3 | Height = 635 |
4 | - Top = 57 | |
4 | + Top = 106 | |
5 | 5 | Width = 656 |
6 | 6 | HorzScrollBar.Page = 387 |
7 | - VertScrollBar.Page = 482 | |
7 | + VertScrollBar.Page = 520 | |
8 | 8 | AutoScroll = True |
9 | 9 | Caption = 'Planejar Experimento' |
10 | 10 | ClientHeight = 616 |
11 | 11 | ClientWidth = 656 |
12 | 12 | Menu = MainMenu1 |
13 | + OnActivate = FormActivate | |
13 | 14 | OnCreate = FormCreate |
14 | 15 | OnDestroy = FormDestroy |
15 | - SessionProperties = 'Caption;ComboCurrentCondition.ItemIndex;ComboCurrentCondition.Items;ComboCurrentContingency.ItemIndex;ComboCurrentContingency.Items;Height;LabelIf.Caption;Left;PageControl.TabIndex;Top;Width;WindowState;ComboCurrentCondition.Text;ComboCurrentContingency.Text' | |
16 | + SessionProperties = 'Caption;ComboCurrentCondition.ItemIndex;ComboCurrentCondition.Items;ComboCurrentCondition.Text;ComboCurrentContingency.ItemIndex;ComboCurrentContingency.Items;ComboCurrentContingency.Text;Height;LabelIf.Caption;Left;PageControl.TabIndex;Top;Width;WindowState;RGContingencyType.ItemIndex' | |
16 | 17 | ShowHint = True |
17 | 18 | LCLVersion = '1.6.2.0' |
18 | 19 | object PageControl: TPageControl |
... | ... | @@ -555,10 +556,33 @@ object FormDesigner: TFormDesigner |
555 | 556 | ClientHeight = 583 |
556 | 557 | ClientWidth = 650 |
557 | 558 | Enabled = False |
559 | + object RGContingencyType: TRadioGroup | |
560 | + Left = 0 | |
561 | + Height = 59 | |
562 | + Top = 10 | |
563 | + Width = 650 | |
564 | + AutoFill = True | |
565 | + Caption = 'Mostrar' | |
566 | + ChildSizing.LeftRightSpacing = 6 | |
567 | + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize | |
568 | + ChildSizing.EnlargeVertical = crsHomogenousChildResize | |
569 | + ChildSizing.ShrinkHorizontal = crsScaleChilds | |
570 | + ChildSizing.ShrinkVertical = crsScaleChilds | |
571 | + ChildSizing.Layout = cclLeftToRightThenTopToBottom | |
572 | + ChildSizing.ControlsPerLine = 1 | |
573 | + ClientHeight = 42 | |
574 | + ClientWidth = 646 | |
575 | + Items.Strings = ( | |
576 | + 'Contingências Operantes' | |
577 | + 'Metacontingências' | |
578 | + ) | |
579 | + OnClick = RGContingencyTypeClick | |
580 | + TabOrder = 7 | |
581 | + end | |
558 | 582 | object ComboCurrentContingency: TComboBox |
559 | 583 | Left = 0 |
560 | 584 | Height = 27 |
561 | - Top = 10 | |
585 | + Top = 74 | |
562 | 586 | Width = 650 |
563 | 587 | ItemHeight = 0 |
564 | 588 | OnChange = ComboCurrentContingencyChange |
... | ... | @@ -568,7 +592,7 @@ object FormDesigner: TFormDesigner |
568 | 592 | object PanelContingenciesButtons: TPanel |
569 | 593 | Left = 0 |
570 | 594 | Height = 26 |
571 | - Top = 42 | |
595 | + Top = 106 | |
572 | 596 | Width = 650 |
573 | 597 | ChildSizing.LeftRightSpacing = 25 |
574 | 598 | ChildSizing.HorizontalSpacing = 50 |
... | ... | @@ -605,19 +629,10 @@ object FormDesigner: TFormDesigner |
605 | 629 | TabOrder = 2 |
606 | 630 | end |
607 | 631 | end |
608 | - object CheckBoxIsMeta: TCheckBox | |
609 | - Left = 0 | |
610 | - Height = 21 | |
611 | - Top = 73 | |
612 | - Width = 650 | |
613 | - Caption = 'Meta' | |
614 | - OnChange = CheckBoxIsMetaChange | |
615 | - TabOrder = 2 | |
616 | - end | |
617 | 632 | object LabelContingencyName: TLabel |
618 | 633 | Left = 0 |
619 | 634 | Height = 15 |
620 | - Top = 99 | |
635 | + Top = 137 | |
621 | 636 | Width = 650 |
622 | 637 | Caption = 'Nome da contingência' |
623 | 638 | ParentColor = False |
... | ... | @@ -625,15 +640,15 @@ object FormDesigner: TFormDesigner |
625 | 640 | object EditContingencyName: TEdit |
626 | 641 | Left = 0 |
627 | 642 | Height = 25 |
628 | - Top = 119 | |
643 | + Top = 157 | |
629 | 644 | Width = 650 |
630 | 645 | OnEditingDone = EditContingencyNameEditingDone |
631 | - TabOrder = 3 | |
646 | + TabOrder = 2 | |
632 | 647 | end |
633 | 648 | object RGContingencyStyle: TRadioGroup |
634 | 649 | Left = 0 |
635 | 650 | Height = 122 |
636 | - Top = 149 | |
651 | + Top = 187 | |
637 | 652 | Width = 650 |
638 | 653 | AutoFill = True |
639 | 654 | Caption = 'Estilo da Resposta' |
... | ... | @@ -655,12 +670,13 @@ object FormDesigner: TFormDesigner |
655 | 670 | 'Linhas ou Cores' |
656 | 671 | ) |
657 | 672 | OnClick = RGContingencyStyleClick |
658 | - TabOrder = 4 | |
673 | + OnExit = RGContingencyStyleExit | |
674 | + TabOrder = 3 | |
659 | 675 | end |
660 | 676 | object LabelIf: TLabel |
661 | 677 | Left = 0 |
662 | 678 | Height = 15 |
663 | - Top = 276 | |
679 | + Top = 314 | |
664 | 680 | Width = 650 |
665 | 681 | Alignment = taCenter |
666 | 682 | Caption = 'SE O PARTICIPANTE ESCOLHER' |
... | ... | @@ -670,20 +686,20 @@ object FormDesigner: TFormDesigner |
670 | 686 | object GBContingencyRows: TGroupBox |
671 | 687 | Left = 0 |
672 | 688 | Height = 17 |
673 | - Top = 296 | |
689 | + Top = 334 | |
674 | 690 | Width = 650 |
675 | 691 | Caption = 'Linhas' |
676 | 692 | ChildSizing.LeftRightSpacing = 5 |
677 | 693 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
678 | 694 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
679 | 695 | ChildSizing.ControlsPerLine = 4 |
680 | - TabOrder = 5 | |
696 | + TabOrder = 4 | |
681 | 697 | Visible = False |
682 | 698 | end |
683 | 699 | object LabelOperator: TLabel |
684 | 700 | Left = 0 |
685 | 701 | Height = 15 |
686 | - Top = 318 | |
702 | + Top = 356 | |
687 | 703 | Width = 650 |
688 | 704 | Alignment = taCenter |
689 | 705 | Caption = 'E' |
... | ... | @@ -693,20 +709,20 @@ object FormDesigner: TFormDesigner |
693 | 709 | object GBContingencyColors: TGroupBox |
694 | 710 | Left = 0 |
695 | 711 | Height = 17 |
696 | - Top = 338 | |
712 | + Top = 376 | |
697 | 713 | Width = 650 |
698 | 714 | Caption = 'Cores' |
699 | 715 | ChildSizing.HorizontalSpacing = 5 |
700 | 716 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
701 | 717 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
702 | 718 | ChildSizing.ControlsPerLine = 5 |
703 | - TabOrder = 6 | |
719 | + TabOrder = 5 | |
704 | 720 | Visible = False |
705 | 721 | end |
706 | 722 | object LabelThen: TLabel |
707 | 723 | Left = 0 |
708 | 724 | Height = 15 |
709 | - Top = 360 | |
725 | + Top = 398 | |
710 | 726 | Width = 650 |
711 | 727 | Alignment = taCenter |
712 | 728 | Caption = 'ENTÃO' |
... | ... | @@ -716,7 +732,7 @@ object FormDesigner: TFormDesigner |
716 | 732 | object GBContingencyConsequence: TGroupBox |
717 | 733 | Left = 0 |
718 | 734 | Height = 59 |
719 | - Top = 380 | |
735 | + Top = 418 | |
720 | 736 | Width = 650 |
721 | 737 | Caption = 'Consequência' |
722 | 738 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
... | ... | @@ -724,7 +740,7 @@ object FormDesigner: TFormDesigner |
724 | 740 | ChildSizing.ControlsPerLine = 2 |
725 | 741 | ClientHeight = 42 |
726 | 742 | ClientWidth = 646 |
727 | - TabOrder = 7 | |
743 | + TabOrder = 6 | |
728 | 744 | Visible = False |
729 | 745 | object LabelC6: TLabel |
730 | 746 | Left = 0 |
... | ... | @@ -740,7 +756,7 @@ object FormDesigner: TFormDesigner |
740 | 756 | Top = 15 |
741 | 757 | Width = 154 |
742 | 758 | ItemHeight = 0 |
743 | - OnChange = CBPointsTypeChange | |
759 | + OnChange = ConsequenceStyleChange | |
744 | 760 | Style = csDropDownList |
745 | 761 | TabOrder = 4 |
746 | 762 | end |
... | ... | @@ -774,6 +790,7 @@ object FormDesigner: TFormDesigner |
774 | 790 | Top = 15 |
775 | 791 | Width = 104 |
776 | 792 | MaxValue = 0 |
793 | + OnEditingDone = ConsequenceStyleChange | |
777 | 794 | TabOrder = 2 |
778 | 795 | Value = 1 |
779 | 796 | end | ... | ... |
experiment_designer/form_main.pas
... | ... | @@ -26,7 +26,6 @@ type |
26 | 26 | ChkDots: TCheckBox; |
27 | 27 | ChkCleanDots: TCheckBox; |
28 | 28 | CheckBoxBroadcast: TCheckBox; |
29 | - CheckBoxIsMeta: TCheckBox; | |
30 | 29 | CheckBoxShouldAskQuestion: TCheckBox; |
31 | 30 | CGQuestion: TCheckGroup; |
32 | 31 | CBPointsType: TComboBox; |
... | ... | @@ -79,6 +78,7 @@ type |
79 | 78 | PageControl: TPageControl; |
80 | 79 | PanelConditionButtons: TPanel; |
81 | 80 | PanelContingenciesButtons: TPanel; |
81 | + RGContingencyType: TRadioGroup; | |
82 | 82 | RGContingencyStyle: TRadioGroup; |
83 | 83 | RGEndCriteriaStyle: TRadioGroup; |
84 | 84 | RGPoints: TRadioGroup; |
... | ... | @@ -97,10 +97,12 @@ type |
97 | 97 | procedure BtnAppendContingencyClick(Sender: TObject); |
98 | 98 | procedure BtnRemoveCondClick(Sender: TObject); |
99 | 99 | procedure BtnRemoveContingencyClick(Sender: TObject); |
100 | - procedure CBPointsTypeChange(Sender: TObject); | |
100 | + // | |
101 | + procedure ConsequenceMessageEditingDone(Sender: TObject); | |
102 | + procedure ConsequenceStyleChange(Sender: TObject); | |
103 | + | |
101 | 104 | procedure CGQuestionItemClick(Sender: TObject; Index: integer); |
102 | 105 | procedure CheckBoxBroadcastChange(Sender: TObject); |
103 | - procedure CheckBoxIsMetaChange(Sender: TObject); | |
104 | 106 | procedure CheckBoxColorsRowsChange(Sender: TObject); |
105 | 107 | procedure CheckBoxShouldAskQuestionChange(Sender: TObject); |
106 | 108 | procedure ChkCleanDotsChange(Sender: TObject); |
... | ... | @@ -109,13 +111,16 @@ type |
109 | 111 | procedure ComboCurrentContingencyChange(Sender: TObject); |
110 | 112 | procedure EditConditionNameEditingDone(Sender: TObject); |
111 | 113 | procedure EditContingencyNameEditingDone(Sender: TObject); |
112 | - procedure EditQuestionChange(Sender: TObject); | |
113 | 114 | procedure EditQuestionEditingDone(Sender: TObject); |
115 | + procedure FormActivate(Sender: TObject); | |
114 | 116 | procedure FormCreate(Sender: TObject); |
115 | 117 | procedure FormDestroy(Sender: TObject); |
116 | 118 | procedure MenuItemExitClick(Sender: TObject); |
117 | 119 | procedure MenuItemOpenClick(Sender: TObject); |
118 | 120 | procedure RGContingencyStyleClick(Sender: TObject); |
121 | + procedure RGContingencyStyleExit(Sender: TObject); | |
122 | + | |
123 | + procedure RGContingencyTypeClick(Sender: TObject); | |
119 | 124 | procedure RGEndCriteriaStyleClick(Sender: TObject); |
120 | 125 | procedure RGPointsClick(Sender: TObject); |
121 | 126 | procedure SpinEditCyclesValueEditingDone(Sender: TObject); |
... | ... | @@ -133,15 +138,14 @@ type |
133 | 138 | FExperiment: TIniFile; |
134 | 139 | procedure LoadExperiment; |
135 | 140 | procedure LoadSectionExperiment; |
136 | - procedure LoadSectionCondition(LS: string); | |
137 | - procedure LoadContingency(LS, LC: string); | |
141 | + procedure LoadSectionCondition(ASection: string); | |
142 | + procedure LoadContingency(ASection, AContingency: string);// A condition section and a contingency key prefix | |
138 | 143 | procedure SaveExperiment; |
139 | 144 | procedure SaveSectionExperiment; |
140 | - procedure SaveSectionCondition(LS: string); | |
141 | - procedure SaveContingency(LS, LC: string); | |
142 | - procedure EraseContingency(LS, LC : string); | |
145 | + procedure SaveSectionCondition(ASection: string); | |
146 | + procedure SaveContingency(ASection, AContingency: string); | |
147 | + procedure EraseContingency(ASection, AContingency : string); | |
143 | 148 | private |
144 | - function GetLC(IsMeta:Boolean; MustIncrement:Boolean=True):string; | |
145 | 149 | function GetConsequenceStyle: string; |
146 | 150 | function GetContingencyCriteria: string; |
147 | 151 | function GetEndCriteriaPorcentage: string; |
... | ... | @@ -153,7 +157,13 @@ type |
153 | 157 | procedure SetRGEndCriteriaStyle(AStyle: string); |
154 | 158 | procedure SetContingencyCriteria(S: string); |
155 | 159 | procedure SetConsequenceStyle(S:string); |
156 | - procedure SetContingencyStyle(S:string); | |
160 | + procedure UpdateContingencyList(ASection: String); | |
161 | + procedure UpdateContingencyCombo(ASection: String); | |
162 | + private | |
163 | + FLoading : Boolean; | |
164 | + function GetContingencyName(IsMeta:Boolean; MustIncrement:Boolean=True):string; | |
165 | + procedure IncContingencyName(var AContingency : string; N : integer = 1); | |
166 | + procedure ReadContingencyNames(ASection, AContingency, AKeySuffix:string; S:TStrings); | |
157 | 167 | public |
158 | 168 | { public declarations } |
159 | 169 | end; |
... | ... | @@ -185,113 +195,193 @@ procedure TFormDesigner.RGContingencyStyleClick(Sender: TObject); |
185 | 195 | var |
186 | 196 | LVisible: boolean; |
187 | 197 | begin |
188 | - LVisible := True; | |
189 | - case TRadioGroup(Sender).ItemIndex of | |
190 | - 0: | |
198 | + if Sender = RGContingencyStyle then | |
191 | 199 | begin |
192 | - LabelIf.Visible := not LVisible; | |
193 | - LabelThen.Visible := not LVisible; | |
194 | - LabelOperator.Visible := not LVisible; | |
195 | - GBContingencyRows.Visible := not LVisible; | |
196 | - GBContingencyColors.Visible := not LVisible; | |
197 | - GBContingencyConsequence.Visible := not LVisible; | |
198 | - end; | |
200 | + LVisible := True; | |
199 | 201 | |
200 | - 1: | |
201 | - begin | |
202 | - LabelIf.Visible := LVisible; | |
203 | - LabelThen.Visible := LVisible; | |
204 | - LabelOperator.Visible := not LVisible; | |
205 | - GBContingencyRows.Visible := LVisible; | |
206 | - GBContingencyColors.Visible := not LVisible; | |
207 | - GBContingencyConsequence.Visible := LVisible; | |
208 | - end; | |
202 | + case TRadioGroup(Sender).ItemIndex of | |
203 | + 0: | |
204 | + begin | |
205 | + LabelIf.Visible := not LVisible; | |
206 | + LabelThen.Visible := not LVisible; | |
207 | + LabelOperator.Visible := not LVisible; | |
208 | + GBContingencyRows.Visible := not LVisible; | |
209 | + GBContingencyColors.Visible := not LVisible; | |
210 | + GBContingencyConsequence.Visible := not LVisible; | |
211 | + end; | |
209 | 212 | |
210 | - 2: | |
211 | - begin | |
212 | - LabelIf.Visible := LVisible; | |
213 | - LabelThen.Visible := LVisible; | |
214 | - LabelOperator.Visible := not LVisible; | |
215 | - GBContingencyRows.Visible := not LVisible; | |
216 | - GBContingencyColors.Visible := LVisible; | |
217 | - GBContingencyConsequence.Visible := LVisible; | |
218 | - end; | |
219 | - 3: | |
220 | - begin | |
221 | - LabelIf.Visible := LVisible; | |
222 | - LabelThen.Visible := LVisible; | |
223 | - LabelOperator.Caption := 'E'; | |
224 | - LabelOperator.Visible := LVisible; | |
225 | - GBContingencyRows.Visible := LVisible; | |
226 | - GBContingencyColors.Visible := LVisible; | |
227 | - GBContingencyConsequence.Visible := LVisible; | |
213 | + 1: | |
214 | + begin | |
215 | + LabelIf.Visible := LVisible; | |
216 | + LabelThen.Visible := LVisible; | |
217 | + LabelOperator.Visible := not LVisible; | |
218 | + GBContingencyRows.Visible := LVisible; | |
219 | + GBContingencyColors.Visible := not LVisible; | |
220 | + GBContingencyConsequence.Visible := LVisible; | |
221 | + end; | |
222 | + | |
223 | + 2: | |
224 | + begin | |
225 | + LabelIf.Visible := LVisible; | |
226 | + LabelThen.Visible := LVisible; | |
227 | + LabelOperator.Visible := not LVisible; | |
228 | + GBContingencyRows.Visible := not LVisible; | |
229 | + GBContingencyColors.Visible := LVisible; | |
230 | + GBContingencyConsequence.Visible := LVisible; | |
231 | + end; | |
232 | + 3: | |
233 | + begin | |
234 | + LabelIf.Visible := LVisible; | |
235 | + LabelThen.Visible := LVisible; | |
236 | + LabelOperator.Caption := 'E'; | |
237 | + LabelOperator.Visible := LVisible; | |
238 | + GBContingencyRows.Visible := LVisible; | |
239 | + GBContingencyColors.Visible := LVisible; | |
240 | + GBContingencyConsequence.Visible := LVisible; | |
241 | + end; | |
242 | + 4: | |
243 | + begin | |
244 | + LabelIf.Visible := LVisible; | |
245 | + LabelThen.Visible := LVisible; | |
246 | + LabelOperator.Caption := 'OU'; | |
247 | + LabelOperator.Visible := LVisible; | |
248 | + GBContingencyRows.Visible := LVisible; | |
249 | + GBContingencyColors.Visible := LVisible; | |
250 | + GBContingencyConsequence.Visible := LVisible; | |
251 | + end; | |
252 | + end; | |
228 | 253 | end; |
229 | - 4: | |
254 | +end; | |
255 | + | |
256 | +procedure TFormDesigner.RGContingencyStyleExit(Sender: TObject); | |
257 | +begin | |
258 | + SaveContingency(ExtractDelimited(1,ComboCurrentCondition.Text,['|']),ExtractDelimited(1,ComboCurrentContingency.Text,['|'])); | |
259 | +end; | |
260 | + | |
261 | + | |
262 | +procedure TFormDesigner.RGContingencyTypeClick(Sender: TObject); | |
263 | +var | |
264 | + i: integer; | |
265 | + CH: TCheckBox; | |
266 | + LS,LC : string; | |
267 | + | |
268 | + procedure CreateChkBox(N, C: string; AOwner: TWinControl); | |
269 | + begin | |
270 | + CH := TCheckBox.Create(AOwner); | |
271 | + CH.Name := N; | |
272 | + CH.Caption := C; | |
273 | + CH.Parent := AOwner; | |
274 | + CH.ShowHint := True; | |
275 | + CH.Hint := C; | |
276 | + CH.OnChange := @CheckBoxColorsRowsChange; | |
277 | + end; | |
278 | + | |
279 | +begin | |
280 | + if Sender = RGContingencyType then | |
230 | 281 | begin |
231 | - LabelIf.Visible := LVisible; | |
232 | - LabelThen.Visible := LVisible; | |
233 | - LabelOperator.Caption := 'OU'; | |
234 | - LabelOperator.Visible := LVisible; | |
235 | - GBContingencyRows.Visible := LVisible; | |
236 | - GBContingencyColors.Visible := LVisible; | |
237 | - GBContingencyConsequence.Visible := LVisible; | |
282 | + while GBContingencyRows.ComponentCount > 0 do | |
283 | + GBContingencyRows.Components[0].Free; | |
284 | + | |
285 | + while GBContingencyColors.ComponentCount > 0 do | |
286 | + GBContingencyColors.Components[0].Free; | |
287 | + | |
288 | + case TRadioGroup(Sender).ItemIndex of | |
289 | + 0: | |
290 | + begin | |
291 | + for i := 0 to 9 do | |
292 | + CreateChkBox('Chk' + IntToStr(i + 1), IntToStr(i + 1), GBContingencyRows); | |
293 | + | |
294 | + CreateChkBox('ChkEven', 'PAR', GBContingencyRows); | |
295 | + CreateChkBox('ChkOdd', 'IMPAR', GBContingencyRows); | |
296 | + | |
297 | + CreateChkBox('ChkY', 'AMARELO', GBContingencyColors); | |
298 | + CreateChkBox('ChkR', 'VERMELHO', GBContingencyColors); | |
299 | + CreateChkBox('ChkM', 'ROXO', GBContingencyColors); | |
300 | + CreateChkBox('ChkB', 'AZUL', GBContingencyColors); | |
301 | + CreateChkBox('ChkG', 'VERDE', GBContingencyColors); | |
302 | + LabelIf.Caption := 'SE O PARTICIPANTE ESCOLHER'; | |
303 | + LC := KEY_CONTINGENCY; | |
304 | + end; | |
305 | + 1: | |
306 | + begin | |
307 | + CreateChkBox('ChkEven', 'PARES', GBContingencyRows); | |
308 | + CreateChkBox('ChkOdd', 'IMPARES', GBContingencyRows); | |
309 | + | |
310 | + CreateChkBox('ChkNot', 'TUDO EXCETO', GBContingencyColors); | |
311 | + CreateChkBox('ChkEqual', 'CORES IGUAIS', GBContingencyColors); | |
312 | + CreateChkBox('ChkDiff', 'CORES DIFERENTES', GBContingencyColors); | |
313 | + LabelIf.Caption := 'SE OS PARTICIPANTES ESCOLHEREM'; | |
314 | + LC := KEY_METACONTINGENCY; | |
315 | + end; | |
316 | + else Exit; | |
317 | + end; | |
318 | + | |
319 | + LS := ExtractDelimited(1, ComboCurrentCondition.Text,['|']); | |
320 | + UpdateContingencyCombo(LS); | |
321 | + LC += '1'; | |
322 | + with FExperiment do | |
323 | + if ValueExists(LS,LC+KEY_CONT_NAME) and (not FLoading) then | |
324 | + LoadContingency(LS,LC); | |
325 | + | |
238 | 326 | end; |
239 | - end; | |
240 | - CheckBoxIsMetaChange(CheckBoxIsMeta); | |
241 | 327 | end; |
242 | 328 | |
243 | 329 | procedure TFormDesigner.RGEndCriteriaStyleClick(Sender: TObject); |
244 | 330 | var |
245 | 331 | LS: String; |
246 | 332 | begin |
247 | - case TRadioGroup(Sender).ItemIndex of | |
248 | - 0: | |
249 | - begin | |
250 | - LabelEndCriteriaAbsCycles.Visible := True; | |
251 | - SpinEditEndCriteriaAbsCycles.Visible := True; | |
252 | - GBEndCriteriaLastCycles.Visible := False; | |
253 | - | |
254 | - end; | |
255 | - 1: | |
256 | - begin | |
257 | - LabelEndCriteriaAbsCycles.Visible := False; | |
258 | - SpinEditEndCriteriaAbsCycles.Visible := False; | |
259 | - GBEndCriteriaLastCycles.Visible := True; | |
260 | - end; | |
261 | - 2: | |
333 | + if Sender = RGEndCriteriaStyle then | |
262 | 334 | begin |
263 | - LabelEndCriteriaAbsCycles.Visible := True; | |
264 | - SpinEditEndCriteriaAbsCycles.Visible := True; | |
265 | - GBEndCriteriaLastCycles.Visible := True; | |
266 | - end; | |
267 | - end; | |
335 | + case TRadioGroup(Sender).ItemIndex of | |
336 | + 0: | |
337 | + begin | |
338 | + LabelEndCriteriaAbsCycles.Visible := True; | |
339 | + SpinEditEndCriteriaAbsCycles.Visible := True; | |
340 | + GBEndCriteriaLastCycles.Visible := False; | |
268 | 341 | |
269 | - with FExperiment do | |
270 | - if ComboCurrentCondition.ItemIndex <> -1 then | |
271 | - begin | |
272 | - LS := SEC_CONDITION+IntToStr(ComboCurrentCondition.ItemIndex+1); | |
273 | - WriteString(LS, KEY_ENDCRITERIA, GetEndCriteriaStyleFromRGEndCriteriaStyle); | |
342 | + end; | |
343 | + 1: | |
344 | + begin | |
345 | + LabelEndCriteriaAbsCycles.Visible := False; | |
346 | + SpinEditEndCriteriaAbsCycles.Visible := False; | |
347 | + GBEndCriteriaLastCycles.Visible := True; | |
348 | + end; | |
349 | + 2: | |
350 | + begin | |
351 | + LabelEndCriteriaAbsCycles.Visible := True; | |
352 | + SpinEditEndCriteriaAbsCycles.Visible := True; | |
353 | + GBEndCriteriaLastCycles.Visible := True; | |
354 | + end; | |
274 | 355 | end; |
356 | + | |
357 | + with FExperiment do | |
358 | + if ComboCurrentCondition.ItemIndex <> -1 then | |
359 | + begin | |
360 | + LS := SEC_CONDITION+IntToStr(ComboCurrentCondition.ItemIndex+1); | |
361 | + WriteString(LS, KEY_ENDCRITERIA, GetEndCriteriaStyleFromRGEndCriteriaStyle); | |
362 | + end; | |
363 | + end; | |
275 | 364 | end; |
276 | 365 | |
277 | 366 | procedure TFormDesigner.RGPointsClick(Sender: TObject); |
278 | 367 | begin |
279 | - case TRadioGroup(Sender).ItemIndex of | |
280 | - 0: | |
281 | - begin | |
282 | - CBPointsType.Items.Clear; | |
283 | - CBPointsType.Items.Append('Individual A'); | |
284 | - CBPointsType.Items.Append('Individual B'); | |
285 | - CBPointsType.Items.Append('Para o Grupo'); | |
286 | - end; | |
368 | + if Sender = RGPoints then | |
369 | + case TRadioGroup(Sender).ItemIndex of | |
370 | + 0: | |
371 | + begin | |
372 | + CBPointsType.Items.Clear; | |
373 | + CBPointsType.Items.Append('Individual A'); | |
374 | + CBPointsType.Items.Append('Individual B'); | |
375 | + CBPointsType.Items.Append('Para o Grupo'); | |
376 | + end; | |
287 | 377 | |
288 | - 1: | |
289 | - begin | |
290 | - CBPointsType.Items.Clear; | |
291 | - CBPointsType.Items.Append('Individual'); | |
292 | - CBPointsType.Items.Append('Para o Grupo'); | |
378 | + 1: | |
379 | + begin | |
380 | + CBPointsType.Items.Clear; | |
381 | + CBPointsType.Items.Append('Individual'); | |
382 | + CBPointsType.Items.Append('Para o Grupo'); | |
383 | + end; | |
293 | 384 | end; |
294 | - end; | |
295 | 385 | end; |
296 | 386 | |
297 | 387 | procedure TFormDesigner.SpinEditCyclesValueEditingDone(Sender: TObject); |
... | ... | @@ -569,7 +659,8 @@ var |
569 | 659 | //LVariation : integer; |
570 | 660 | SCode, |
571 | 661 | SPoints : string; |
572 | - LPoints : integer; | |
662 | + LPoints //, temp, t2 | |
663 | + : integer; | |
573 | 664 | begin |
574 | 665 | SPoints := ExtractDelimited(1,S,['|']); |
575 | 666 | LPoints := StrToInt(ExtractDelimited(1,SPoints,[','])); |
... | ... | @@ -591,19 +682,88 @@ begin |
591 | 682 | if gscG in CS then CBPointsType.ItemIndex := 1; |
592 | 683 | end; |
593 | 684 | end; |
594 | - CBPointsType.Text := CBPointsType.Items[CBPointsType.ItemIndex]; | |
595 | - CheckBoxBroadcast.State := cbUnchecked; | |
596 | 685 | |
597 | - if gscBroadcastMessage in CS then | |
598 | - CheckBoxBroadcast.State := cbChecked; | |
686 | + //if RGContingencyStyle.ItemIndex > 0 then | |
687 | + // if CBPointsType.ItemIndex > 0 then | |
688 | + // begin | |
689 | + // temp := CBPointsType.ItemIndex; | |
690 | + // t2 := CBPointsType.Items.Count; | |
691 | + // CBPointsType.Text := CBPointsType.Items[CBPointsType.ItemIndex]; | |
692 | + // end; | |
599 | 693 | |
694 | + if gscBroadcastMessage in CS then | |
695 | + CheckBoxBroadcast.State := cbChecked | |
696 | + else | |
600 | 697 | if gscMessage in CS then |
601 | - CheckBoxBroadcast.State := cbGrayed; | |
698 | + CheckBoxBroadcast.State := cbGrayed | |
699 | + else | |
700 | + CheckBoxBroadcast.State := cbUnchecked; | |
701 | + | |
702 | + | |
703 | + case CheckBoxBroadcast.State of | |
704 | + cbChecked: CheckBoxBroadcast.Caption := 'a todos'; | |
705 | + cbUnchecked: CheckBoxBroadcast.Caption := 'ao participante'; | |
706 | + cbGrayed: CheckBoxBroadcast.Caption := 'a ninguém'; | |
707 | + end; | |
708 | +end; | |
709 | + | |
710 | +procedure TFormDesigner.UpdateContingencyList(ASection: String); | |
711 | +var | |
712 | + LC: String; | |
713 | + //S : TStringList; | |
714 | +begin | |
715 | + //S := TStringList.Create; | |
716 | + ListBoxContingencies.Items.Clear; | |
717 | + LC := KEY_CONTINGENCY+'1'; | |
718 | + ReadContingencyNames(ASection,LC,KEY_CONT_NAME,ListBoxContingencies.Items); | |
719 | + LC := KEY_METACONTINGENCY+'1'; | |
720 | + ReadContingencyNames(ASection,LC,KEY_CONT_NAME,ListBoxContingencies.Items); | |
721 | + //ListBoxContingencies.Items.Text := S.Text; | |
722 | + //S.Free; | |
723 | +end; | |
724 | + | |
725 | +procedure TFormDesigner.UpdateContingencyCombo(ASection: String); | |
726 | +var | |
727 | + LC: String; | |
728 | +begin | |
729 | + ComboCurrentContingency.Items.Clear; | |
730 | + case RGContingencyType.ItemIndex of | |
731 | + 0: | |
732 | + begin | |
733 | + LC := KEY_CONTINGENCY+'1'; | |
734 | + ReadContingencyNames(ASection,LC,KEY_CONT_NAME,ComboCurrentContingency.Items); | |
735 | + end; | |
736 | + 1: | |
737 | + begin | |
738 | + LC := KEY_METACONTINGENCY+'1'; | |
739 | + ReadContingencyNames(ASection,LC,KEY_CONT_NAME,ComboCurrentContingency.Items); | |
740 | + end; | |
741 | + end; | |
602 | 742 | end; |
603 | 743 | |
604 | -procedure TFormDesigner.SetContingencyStyle(S: string); | |
744 | +procedure TFormDesigner.IncContingencyName(var AContingency: string; N: integer); | |
745 | +var | |
746 | + LContingencyType: String; | |
747 | + LExtension: RawByteString; | |
748 | + LCount: LongInt; | |
605 | 749 | begin |
750 | + LContingencyType := ExtractFileNameWithoutExt(AContingency); | |
751 | + LExtension := ExtractFileExt(AContingency); | |
752 | + Delete(LExtension,1,1); | |
753 | + LCount := StrToInt(LExtension); | |
754 | + Inc(LCount,N); | |
755 | + AContingency := LContingencyType + '.' + IntToStr(LCount); | |
756 | +end; | |
606 | 757 | |
758 | +procedure TFormDesigner.ReadContingencyNames(ASection, AContingency, | |
759 | + AKeySuffix: string; S: TStrings); | |
760 | +begin | |
761 | + with FExperiment do | |
762 | + while ValueExists(ASection,AContingency+AKeySuffix) do | |
763 | + begin | |
764 | + S.Append(AContingency+'|'+ReadString(ASection,AContingency+AKeySuffix,'')); | |
765 | + IncContingencyName(AContingency); | |
766 | + end; | |
607 | 767 | end; |
608 | 768 | |
609 | 769 | procedure TFormDesigner.SaveSectionExperiment; |
... | ... | @@ -628,73 +788,74 @@ end; |
628 | 788 | procedure TFormDesigner.LoadSectionExperiment; |
629 | 789 | begin |
630 | 790 | with FExperiment do |
631 | - begin | |
632 | - EditResearcherName.Text := ReadString(SEC_EXPERIMENT, KEY_RESEARCHER, ''); | |
633 | - EditExperimentName.Text := ReadString(SEC_EXPERIMENT, KEY_NAME, ''); | |
634 | - MemoExperimentAim.Text := ReadString(SEC_EXPERIMENT, KEY_AIM, ''); | |
635 | - CGGlobal.Checked[0] := | |
636 | - ReadBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, False); | |
637 | - CGGlobal.Checked[1] := ReadBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED, False); | |
638 | - CGGlobal.Checked[2] := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY, False); | |
639 | - CGGlobal.Checked[3] := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT, False); | |
640 | - if ReadBool(SEC_EXPERIMENT, KEY_POINTS_TYPE, True) then | |
641 | - RGPoints.ItemIndex := 0 | |
642 | - else | |
643 | - RGPoints.ItemIndex := 1; | |
644 | - SetCGMatrix(ReadString(SEC_EXPERIMENT, KEY_MATRIX_TYPE, 'CORES,LINHAS')); | |
645 | - end; | |
791 | + begin | |
792 | + EditResearcherName.Text := ReadString(SEC_EXPERIMENT, KEY_RESEARCHER, ''); | |
793 | + EditExperimentName.Text := ReadString(SEC_EXPERIMENT, KEY_NAME, ''); | |
794 | + MemoExperimentAim.Text := ReadString(SEC_EXPERIMENT, KEY_AIM, ''); | |
795 | + CGGlobal.Checked[0] := | |
796 | + ReadBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, False); | |
797 | + CGGlobal.Checked[1] := ReadBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED, False); | |
798 | + CGGlobal.Checked[2] := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY, False); | |
799 | + CGGlobal.Checked[3] := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT, False); | |
800 | + if ReadBool(SEC_EXPERIMENT, KEY_POINTS_TYPE, True) then | |
801 | + RGPoints.ItemIndex := 0 | |
802 | + else | |
803 | + RGPoints.ItemIndex := 1; | |
804 | + RGPointsClick(RGPoints); | |
805 | + SetCGMatrix(ReadString(SEC_EXPERIMENT, KEY_MATRIX_TYPE, 'CORES,LINHAS')); | |
806 | + end; | |
646 | 807 | end; |
647 | 808 | |
648 | -procedure TFormDesigner.SaveSectionCondition(LS: string); | |
809 | +procedure TFormDesigner.SaveSectionCondition(ASection: string); | |
649 | 810 | begin |
650 | 811 | with FExperiment do |
651 | - begin | |
652 | - WriteString(LS, KEY_COND_NAME, EditConditionName.Text); | |
653 | - WriteInteger(LS, KEY_TURN_VALUE, SpinEditTurnValue.Value); | |
654 | - WriteInteger(LS, KEY_POINTS_ONSTART,SpinEditOnConditionBegin.Value); | |
655 | - WriteInteger(LS, KEY_CYCLES_VALUE, SpinEditCyclesValue.Value); | |
656 | - WriteString(LS, KEY_PROMPT_MESSAGE, EditQuestion.Text); | |
657 | - WriteString(LS, KEY_PROMPT_STYLE, GetPromptQuestionStringFromCGQuestion); | |
658 | - WriteString(LS, KEY_ENDCRITERIA, GetEndCriteriaStyleFromRGEndCriteriaStyle); | |
659 | - WriteInteger(LS, KEY_ENDCRITERIA_CYCLES, SpinEditEndCriteriaAbsCycles.Value); | |
660 | - WriteString(LS, KEY_ENDCRITERIA_PORCENTAGE, GetEndCriteriaPorcentage); | |
661 | - end; | |
812 | + begin | |
813 | + WriteString(ASection, KEY_COND_NAME, EditConditionName.Text); | |
814 | + WriteInteger(ASection, KEY_TURN_VALUE, SpinEditTurnValue.Value); | |
815 | + WriteInteger(ASection, KEY_POINTS_ONSTART,SpinEditOnConditionBegin.Value); | |
816 | + WriteInteger(ASection, KEY_CYCLES_VALUE, SpinEditCyclesValue.Value); | |
817 | + WriteString(ASection, KEY_PROMPT_MESSAGE, EditQuestion.Text); | |
818 | + WriteString(ASection, KEY_PROMPT_STYLE, GetPromptQuestionStringFromCGQuestion); | |
819 | + WriteString(ASection, KEY_ENDCRITERIA, GetEndCriteriaStyleFromRGEndCriteriaStyle); | |
820 | + WriteInteger(ASection, KEY_ENDCRITERIA_CYCLES, SpinEditEndCriteriaAbsCycles.Value); | |
821 | + WriteString(ASection, KEY_ENDCRITERIA_PORCENTAGE, GetEndCriteriaPorcentage); | |
822 | + end; | |
662 | 823 | end; |
663 | 824 | |
664 | -procedure TFormDesigner.SaveContingency(LS, LC: string); | |
825 | +procedure TFormDesigner.SaveContingency(ASection, AContingency: string); | |
665 | 826 | begin |
666 | 827 | with FExperiment do |
667 | - begin | |
668 | - WriteString(LS, LC + KEY_CONT_NAME, EditContingencyName.Text); | |
669 | - WriteString(LS, LC + KEY_CRITERIA, GetContingencyCriteria); | |
670 | - WriteString(LS, LC + KEY_CONSEQUE, GetConsequenceStyle); | |
671 | - WriteString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND, EditMessPrefix.Text); | |
672 | - try | |
673 | - WriteString(LS, LC + KEY_CONSEQUE_MESSAGE_APPENDS, ExtractDelimited(1,EditMessSufix.Text,['|'])); | |
674 | - WriteString(LS, LC + KEY_CONSEQUE_MESSAGE_APPENDP, ExtractDelimited(2,EditMessSufix.Text,['|'])); | |
675 | - except | |
676 | - on E: Exception do | |
677 | - Exit; | |
678 | - //if E.Message = 'E'; | |
828 | + begin | |
829 | + WriteString(ASection, AContingency + KEY_CONT_NAME, EditContingencyName.Text); | |
830 | + WriteString(ASection, AContingency + KEY_CRITERIA, GetContingencyCriteria); | |
831 | + WriteString(ASection, AContingency + KEY_CONSEQUE, GetConsequenceStyle); | |
832 | + WriteString(ASection, AContingency + KEY_CONSEQUE_MESSAGE_PREPEND, EditMessPrefix.Text); | |
833 | + try | |
834 | + WriteString(ASection, AContingency + KEY_CONSEQUE_MESSAGE_APPENDS, ExtractDelimited(1,EditMessSufix.Text,['|'])); | |
835 | + WriteString(ASection, AContingency + KEY_CONSEQUE_MESSAGE_APPENDP, ExtractDelimited(2,EditMessSufix.Text,['|'])); | |
836 | + except | |
837 | + on E: Exception do | |
838 | + Exit; | |
839 | + //if E.Message = 'E'; | |
679 | 840 | |
841 | + end; | |
680 | 842 | end; |
681 | - end; | |
682 | 843 | end; |
683 | 844 | |
684 | -procedure TFormDesigner.EraseContingency(LS, LC: string); | |
845 | +procedure TFormDesigner.EraseContingency(ASection, AContingency: string); | |
685 | 846 | begin |
686 | 847 | with FExperiment do |
687 | 848 | begin |
688 | - DeleteKey(LS, LC + KEY_CONT_NAME); | |
689 | - DeleteKey(LS, LC + KEY_CRITERIA); | |
690 | - DeleteKey(LS, LC + KEY_CONSEQUE); | |
691 | - DeleteKey(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND); | |
692 | - DeleteKey(LS, LC + KEY_CONSEQUE_MESSAGE_APPENDS); | |
693 | - DeleteKey(LS, LC + KEY_CONSEQUE_MESSAGE_APPENDP); | |
849 | + DeleteKey(ASection, AContingency + KEY_CONT_NAME); | |
850 | + DeleteKey(ASection, AContingency + KEY_CRITERIA); | |
851 | + DeleteKey(ASection, AContingency + KEY_CONSEQUE); | |
852 | + DeleteKey(ASection, AContingency + KEY_CONSEQUE_MESSAGE_PREPEND); | |
853 | + DeleteKey(ASection, AContingency + KEY_CONSEQUE_MESSAGE_APPENDS); | |
854 | + DeleteKey(ASection, AContingency + KEY_CONSEQUE_MESSAGE_APPENDP); | |
694 | 855 | end; |
695 | 856 | end; |
696 | 857 | |
697 | -function TFormDesigner.GetLC(IsMeta: Boolean; MustIncrement: Boolean): string; | |
858 | +function TFormDesigner.GetContingencyName(IsMeta: Boolean; MustIncrement: Boolean): string; | |
698 | 859 | var |
699 | 860 | LCount, |
700 | 861 | i : integer; |
... | ... | @@ -869,52 +1030,44 @@ begin |
869 | 1030 | Result := GetCriteriaString(C); |
870 | 1031 | end; |
871 | 1032 | |
872 | -procedure TFormDesigner.LoadSectionCondition(LS: string); | |
1033 | +procedure TFormDesigner.LoadSectionCondition(ASection: string); | |
873 | 1034 | begin |
874 | 1035 | with FExperiment do |
875 | 1036 | begin |
876 | - EditConditionName.Text := ReadString(LS, KEY_COND_NAME, LS); | |
877 | - SpinEditTurnValue.Value := ReadInteger(LS, KEY_TURN_VALUE, 2); | |
878 | - SpinEditOnConditionBegin.Value := ReadInteger(LS, KEY_POINTS_ONSTART,0); | |
879 | - SpinEditCyclesValue.Value := ReadInteger(LS, KEY_CYCLES_VALUE, 2); | |
1037 | + EditConditionName.Text := ReadString(ASection, KEY_COND_NAME, ASection); | |
1038 | + SpinEditTurnValue.Value := ReadInteger(ASection, KEY_TURN_VALUE, 2); | |
1039 | + SpinEditOnConditionBegin.Value := ReadInteger(ASection, KEY_POINTS_ONSTART,0); | |
1040 | + SpinEditCyclesValue.Value := ReadInteger(ASection, KEY_CYCLES_VALUE, 2); | |
880 | 1041 | |
881 | 1042 | CheckBoxShouldAskQuestion.Checked := False; |
882 | - if ValueExists(LS, KEY_PROMPT_STYLE) and ValueExists(LS, KEY_PROMPT_MESSAGE) then | |
1043 | + if ValueExists(ASection, KEY_PROMPT_STYLE) and ValueExists(ASection, KEY_PROMPT_MESSAGE) then | |
883 | 1044 | begin |
884 | - EditQuestion.Text := ReadString(LS, KEY_PROMPT_MESSAGE, ''); | |
885 | - SetCGQuestion(ReadString(LS, KEY_PROMPT_STYLE, '')); | |
886 | - if (EditQuestion.Text <> '') or (ReadString(LS, KEY_PROMPT_STYLE, '') <> '') then | |
1045 | + EditQuestion.Text := ReadString(ASection, KEY_PROMPT_MESSAGE, ''); | |
1046 | + SetCGQuestion(ReadString(ASection, KEY_PROMPT_STYLE, '')); | |
1047 | + if (EditQuestion.Text <> '') or (ReadString(ASection, KEY_PROMPT_STYLE, '') <> '') then | |
887 | 1048 | CheckBoxShouldAskQuestion.Checked := True; |
888 | 1049 | end; |
889 | 1050 | |
890 | - SetRGEndCriteriaStyle(ReadString(LS, KEY_ENDCRITERIA, 'O QUE OCORRER PRIMEIRO')); | |
891 | - SpinEditEndCriteriaAbsCycles.Value := ReadInteger(LS, KEY_ENDCRITERIA_CYCLES, 20); | |
1051 | + SetRGEndCriteriaStyle(ReadString(ASection, KEY_ENDCRITERIA, 'O QUE OCORRER PRIMEIRO')); | |
1052 | + SpinEditEndCriteriaAbsCycles.Value := ReadInteger(ASection, KEY_ENDCRITERIA_CYCLES, 20); | |
892 | 1053 | SpinEditEndCriteriaLastCycles.Value := |
893 | - GetEndCriteriaLastCyclesFromString(ReadString(LS, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | |
1054 | + GetEndCriteriaLastCyclesFromString(ReadString(ASection, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | |
894 | 1055 | SpinEditEndCriteriaInterlockingPorcentage.Value := |
895 | - GetEndCriteriaPorcentageFromString(ReadString(LS, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | |
1056 | + GetEndCriteriaPorcentageFromString(ReadString(ASection, KEY_ENDCRITERIA_PORCENTAGE, '80,20')); | |
896 | 1057 | end; |
897 | 1058 | end; |
898 | 1059 | |
899 | -procedure TFormDesigner.LoadContingency(LS, LC: string); | |
900 | -var | |
901 | - Temp: String; | |
1060 | +procedure TFormDesigner.LoadContingency(ASection, AContingency: string); | |
902 | 1061 | begin |
903 | - CheckBoxIsMeta.OnChange := nil; | |
904 | - if Pos(KEY_METACONTINGENCY, LC) > 0 then | |
905 | - CheckBoxIsMeta.Checked := True | |
906 | - else | |
907 | - CheckBoxIsMeta.Checked := False; | |
908 | - CheckBoxIsMeta.OnChange:=@CheckBoxIsMetaChange; | |
909 | 1062 | with FExperiment do |
910 | - if ValueExists(LS, LC + KEY_CONSEQUE) and ValueExists(LS, LC + KEY_CRITERIA) then | |
1063 | + if ValueExists(ASection, AContingency + KEY_CONSEQUE) and ValueExists(ASection, AContingency + KEY_CRITERIA) then | |
911 | 1064 | begin |
912 | - Temp := ReadString(LS, LC + KEY_CONT_NAME, ''); | |
913 | - EditContingencyName.Text := ReadString(LS, LC + KEY_CONT_NAME, ''); | |
914 | - SetContingencyCriteria(ReadString(LS, LC + KEY_CRITERIA, '')); | |
915 | - SetContingencyStyle(ReadString(LS, LC + KEY_CONSEQUE, '')); | |
916 | - EditMessPrefix.Text := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND,''); | |
917 | - EditMessSufix.Text := ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPENDS,'')+'|'+ReadString(LS, LC + KEY_CONSEQUE_MESSAGE_APPENDP,''); | |
1065 | + EditContingencyName.Text := ReadString(ASection, AContingency + KEY_CONT_NAME, ''); | |
1066 | + SetContingencyCriteria(ReadString(ASection, AContingency + KEY_CRITERIA, '')); | |
1067 | + SetConsequenceStyle(ReadString(ASection, AContingency + KEY_CONSEQUE, '')); | |
1068 | + EditMessPrefix.Text := ReadString(ASection, AContingency + KEY_CONSEQUE_MESSAGE_PREPEND,''); | |
1069 | + EditMessSufix.Text := ReadString(ASection, AContingency + KEY_CONSEQUE_MESSAGE_APPENDS,'')+'|'+ | |
1070 | + ReadString(ASection, AContingency + KEY_CONSEQUE_MESSAGE_APPENDP,''); | |
918 | 1071 | end; |
919 | 1072 | end; |
920 | 1073 | |
... | ... | @@ -940,10 +1093,7 @@ end; |
940 | 1093 | |
941 | 1094 | procedure TFormDesigner.FormCreate(Sender: TObject); |
942 | 1095 | begin |
943 | - //IPSExperiment.IniSection := SEC_EXPERIMENT; | |
944 | - //IPSConditions.IniSection := SEC_CONDITION; | |
945 | - //IPSPlayers.IniSection := SEC_PLAYER; | |
946 | - | |
1096 | + FLoading := True; | |
947 | 1097 | end; |
948 | 1098 | |
949 | 1099 | procedure TFormDesigner.FormDestroy(Sender: TObject); |
... | ... | @@ -1026,9 +1176,13 @@ begin |
1026 | 1176 | end; |
1027 | 1177 | end; |
1028 | 1178 | |
1029 | -procedure TFormDesigner.EditQuestionChange(Sender: TObject); | |
1179 | +procedure TFormDesigner.ConsequenceMessageEditingDone(Sender: TObject); | |
1180 | +var | |
1181 | + LS, LC: String; | |
1030 | 1182 | begin |
1031 | - | |
1183 | + LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']); | |
1184 | + LC := ExtractDelimited(1,ComboCurrentContingency.Text,['|']); | |
1185 | + FExperiment.WriteString(LS, LC + KEY_CONSEQUE_MESSAGE_PREPEND, EditMessPrefix.Text); | |
1032 | 1186 | end; |
1033 | 1187 | |
1034 | 1188 | procedure TFormDesigner.EditQuestionEditingDone(Sender: TObject); |
... | ... | @@ -1043,6 +1197,11 @@ begin |
1043 | 1197 | end; |
1044 | 1198 | end; |
1045 | 1199 | |
1200 | +procedure TFormDesigner.FormActivate(Sender: TObject); | |
1201 | +begin | |
1202 | + FLoading := False; | |
1203 | +end; | |
1204 | + | |
1046 | 1205 | procedure TFormDesigner.CheckBoxBroadcastChange(Sender: TObject); |
1047 | 1206 | begin |
1048 | 1207 | case TCheckBox(Sender).State of |
... | ... | @@ -1050,8 +1209,10 @@ begin |
1050 | 1209 | cbUnchecked: TCheckBox(Sender).Caption := 'ao participante'; |
1051 | 1210 | cbGrayed: TCheckBox(Sender).Caption := 'a ninguém'; |
1052 | 1211 | end; |
1212 | + ConsequenceStyleChange(CheckBoxBroadcast); | |
1053 | 1213 | end; |
1054 | 1214 | |
1215 | + | |
1055 | 1216 | procedure TFormDesigner.BtnAppendCondClick(Sender: TObject); |
1056 | 1217 | var |
1057 | 1218 | i: integer; |
... | ... | @@ -1072,7 +1233,7 @@ var |
1072 | 1233 | |
1073 | 1234 | begin |
1074 | 1235 | LS := ExtractDelimited(1,ComboCurrentCondition.Items[ComboCurrentCondition.ItemIndex],['|']); |
1075 | - LC := GetLC(CheckBoxIsMeta.Checked); | |
1236 | + LC := GetContingencyName(RGContingencyType.ItemIndex = 1); | |
1076 | 1237 | i := ComboCurrentContingency.Items.Add(''); |
1077 | 1238 | ComboCurrentContingency.Items[i] := |
1078 | 1239 | LC + '|' + EditContingencyName.Text; |
... | ... | @@ -1153,22 +1314,22 @@ var |
1153 | 1314 | Keys.EndUpdate; |
1154 | 1315 | end; |
1155 | 1316 | |
1156 | - procedure Reorder(index : integer); | |
1317 | + procedure Reorder(Index:integer); | |
1157 | 1318 | var |
1158 | 1319 | i: integer; |
1159 | 1320 | SectionKeys: TStringList; |
1160 | - KeyName,Line,SectionName: string; | |
1321 | + KeyName,KeyPrefix,Line,SectionName: string; | |
1161 | 1322 | begin |
1162 | 1323 | SectionKeys := TStringList.Create; |
1163 | 1324 | with FExperiment do |
1164 | - for i := index to ComboCurrentContingency.Items.Count - 1 do | |
1325 | + for i := Index to ComboCurrentContingency.Items.Count - 1 do | |
1165 | 1326 | begin |
1166 | 1327 | SectionName := ExtractDelimited(1, ComboCurrentCondition.Items[ComboCurrentCondition.ItemIndex], ['|']); |
1167 | - KeyName := ExtractDelimited(1, ComboCurrentContingency.Items[i], ['|']); | |
1168 | - ReadContingencyValuesInSection(SectionName,KeyName, SectionKeys); | |
1169 | - EraseContingency(SectionName,KeyName); | |
1328 | + KeyPrefix := ExtractDelimited(1, ComboCurrentContingency.Items[i], ['|']); | |
1329 | + ReadContingencyValuesInSection(SectionName,KeyPrefix, SectionKeys); | |
1330 | + EraseContingency(SectionName,KeyPrefix); | |
1170 | 1331 | // todo: contingencies on top, meta on bootom... |
1171 | - KeyName := GetLC(ExtractFileNameWithoutExt(KeyName) = ExtractFileNameWithoutExt(KEY_METACONTINGENCY)); | |
1332 | + KeyPrefix := GetContingencyName(ExtractFileNameWithoutExt(KeyPrefix) = ExtractFileNameWithoutExt(KEY_METACONTINGENCY)); | |
1172 | 1333 | for Line in SectionKeys do |
1173 | 1334 | begin |
1174 | 1335 | KeyName := SectionKeys.ExtractName(Line); |
... | ... | @@ -1176,7 +1337,7 @@ var |
1176 | 1337 | end; |
1177 | 1338 | SectionKeys.Clear; |
1178 | 1339 | ComboCurrentContingency.Items[i] := |
1179 | - KeyName + '|' + ExtractDelimited(2, ComboCurrentContingency.Items[i], ['|']); | |
1340 | + KeyPrefix + '|' + ExtractDelimited(2, ComboCurrentContingency.Items[i], ['|']); | |
1180 | 1341 | end; |
1181 | 1342 | SectionKeys.Free; |
1182 | 1343 | end; |
... | ... | @@ -1195,15 +1356,18 @@ begin |
1195 | 1356 | else |
1196 | 1357 | ComboCurrentContingency.ItemIndex := i -1; |
1197 | 1358 | end; |
1198 | - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | |
1359 | + UpdateContingencyList(ExtractDelimited(1,ComboCurrentCondition.Text,['|'])); | |
1199 | 1360 | end; |
1200 | 1361 | |
1201 | -procedure TFormDesigner.CBPointsTypeChange(Sender: TObject); | |
1362 | +procedure TFormDesigner.ConsequenceStyleChange(Sender: TObject); | |
1363 | +var | |
1364 | + LS, LC: String; | |
1202 | 1365 | begin |
1203 | - | |
1366 | + LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']); | |
1367 | + LC := ExtractDelimited(1,ComboCurrentContingency.Text,['|']); | |
1368 | + FExperiment.WriteString(LS, LC+KEY_CONSEQUE, GetConsequenceStyle); | |
1204 | 1369 | end; |
1205 | 1370 | |
1206 | - | |
1207 | 1371 | procedure TFormDesigner.CGQuestionItemClick(Sender: TObject; Index: integer); |
1208 | 1372 | var |
1209 | 1373 | LS: String; |
... | ... | @@ -1216,68 +1380,22 @@ begin |
1216 | 1380 | end; |
1217 | 1381 | end; |
1218 | 1382 | |
1219 | -procedure TFormDesigner.CheckBoxIsMetaChange(Sender: TObject); | |
1220 | -var | |
1221 | - i: integer; | |
1222 | - CH: TCheckBox; | |
1223 | - LS,LC : string; | |
1224 | - | |
1225 | - procedure CreateChkBox(N, C: string; AOwner: TWinControl); | |
1226 | - begin | |
1227 | - CH := TCheckBox.Create(AOwner); | |
1228 | - CH.Name := N; | |
1229 | - CH.Caption := C; | |
1230 | - CH.Parent := AOwner; | |
1231 | - CH.ShowHint := True; | |
1232 | - CH.Hint := C; | |
1233 | - CH.OnChange := @CheckBoxColorsRowsChange; | |
1234 | - end; | |
1235 | - | |
1236 | -begin | |
1237 | - while GBContingencyRows.ComponentCount > 0 do | |
1238 | - GBContingencyRows.Components[0].Free; | |
1239 | - | |
1240 | - while GBContingencyColors.ComponentCount > 0 do | |
1241 | - GBContingencyColors.Components[0].Free; | |
1242 | - | |
1243 | - if TCheckBox(Sender).Checked then | |
1244 | - begin | |
1245 | - CreateChkBox('ChkEven', 'PARES', GBContingencyRows); | |
1246 | - CreateChkBox('ChkOdd', 'IMPARES', GBContingencyRows); | |
1247 | - | |
1248 | - CreateChkBox('ChkNot', 'TUDO EXCETO', GBContingencyColors); | |
1249 | - CreateChkBox('ChkEqual', 'CORES IGUAIS', GBContingencyColors); | |
1250 | - CreateChkBox('ChkDiff', 'CORES DIFERENTES', GBContingencyColors); | |
1251 | - LabelIf.Caption := 'SE OS PARTICIPANTES ESCOLHEREM'; | |
1252 | - end | |
1253 | - else | |
1254 | - begin | |
1255 | - for i := 0 to 9 do | |
1256 | - CreateChkBox('Chk' + IntToStr(i + 1), IntToStr(i + 1), GBContingencyRows); | |
1257 | - | |
1258 | - CreateChkBox('ChkEven', 'PAR', GBContingencyRows); | |
1259 | - CreateChkBox('ChkOdd', 'IMPAR', GBContingencyRows); | |
1260 | - | |
1261 | - CreateChkBox('ChkY', 'AMARELO', GBContingencyColors); | |
1262 | - CreateChkBox('ChkR', 'VERMELHO', GBContingencyColors); | |
1263 | - CreateChkBox('ChkM', 'ROXO', GBContingencyColors); | |
1264 | - CreateChkBox('ChkB', 'AZUL', GBContingencyColors); | |
1265 | - CreateChkBox('ChkG', 'VERDE', GBContingencyColors); | |
1266 | - LabelIf.Caption := 'SE O PARTICIPANTE ESCOLHER'; | |
1267 | - end; | |
1268 | - | |
1269 | - if ComboCurrentCondition.Items.Count > 0 then | |
1270 | - if ComboCurrentContingency.Items.Count > 0 then | |
1271 | - begin | |
1272 | - LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']); | |
1273 | - LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']); | |
1274 | - EraseContingency(LS,LC); | |
1275 | - LC := GetLC(TCheckBox(Sender).Checked,False); | |
1276 | - SaveContingency(LS,LC); | |
1277 | - ComboCurrentContingency.Items[ComboCurrentContingency.ItemIndex] := LC +'|'+ EditContingencyName.Text; | |
1278 | - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | |
1279 | - end; | |
1280 | -end; | |
1383 | +//procedure TFormDesigner.CheckBoxIsMetaClick(Sender: TObject); | |
1384 | +//var | |
1385 | +// LS, LC: String; | |
1386 | +//begin | |
1387 | +// if ComboCurrentCondition.Items.Count > 0 then | |
1388 | +// if ComboCurrentContingency.Items.Count > 0 then | |
1389 | +// begin | |
1390 | +// LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']); | |
1391 | +// LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']); | |
1392 | +// EraseContingency(LS,LC); | |
1393 | +// LC := GetLC(CheckBoxIsMeta.Checked,False); | |
1394 | +// SaveContingency(LS,LC); | |
1395 | +// ComboCurrentContingency.Items[ComboCurrentContingency.ItemIndex] := LC +'|'+ EditContingencyName.Text; | |
1396 | +// ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | |
1397 | +// end; | |
1398 | +//end; | |
1281 | 1399 | |
1282 | 1400 | procedure TFormDesigner.CheckBoxColorsRowsChange(Sender: TObject); |
1283 | 1401 | var | ... | ... |