Commit a0f3a52d9b2a6187fd9349d46518ea4e08eb0aed

Authored by Carlos Picanco
1 parent 176d0a72
Exists in master

designer: fix opening from clean enviroment

experiment_designer/form_main.lfm
1 1 object FormDesigner: TFormDesigner
2 2 Left = 348
3 3 Height = 656
4   - Top = 27
  4 + Top = 29
5 5 Width = 653
6   - HorzScrollBar.Page = 315
7   - VertScrollBar.Page = 636
  6 + HorzScrollBar.Page = 346
  7 + VertScrollBar.Page = 637
8 8 AutoScroll = True
9 9 Caption = 'Planejar Experimento'
10   - ClientHeight = 636
11   - ClientWidth = 636
  10 + ClientHeight = 637
  11 + ClientWidth = 643
12 12 Menu = MainMenu1
13 13 OnActivate = FormActivate
14 14 OnCreate = FormCreate
... ... @@ -18,9 +18,9 @@ object FormDesigner: TFormDesigner
18 18 LCLVersion = '1.6.2.0'
19 19 object PageControl: TPageControl
20 20 Left = 0
21   - Height = 726
  21 + Height = 744
22 22 Top = 0
23   - Width = 636
  23 + Width = 643
24 24 ActivePage = TabSheetExperiment
25 25 Align = alClient
26 26 TabIndex = 0
... ... @@ -32,76 +32,77 @@ object FormDesigner: TFormDesigner
32 32 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
33 33 ChildSizing.Layout = cclLeftToRightThenTopToBottom
34 34 ChildSizing.ControlsPerLine = 1
35   - ClientHeight = 698
36   - ClientWidth = 628
  35 + ClientHeight = 711
  36 + ClientWidth = 637
37 37 object GBConditions: TGroupBox
38 38 Left = 0
39   - Height = 100
  39 + Height = 97
40 40 Top = 10
41   - Width = 628
  41 + Width = 637
42 42 Caption = 'Condições'
43 43 ClientHeight = 80
44   - ClientWidth = 624
  44 + ClientWidth = 633
45 45 TabOrder = 5
46 46 object ListBoxConditions: TListBox
47 47 Left = 0
48 48 Height = 80
49 49 Top = 0
50   - Width = 624
  50 + Width = 633
51 51 Anchors = [akTop, akLeft, akRight]
52 52 ItemHeight = 0
53   - ScrollWidth = 652
  53 + ScrollWidth = 631
54 54 TabOrder = 0
  55 + TopIndex = -1
55 56 end
56 57 end
57 58 object LabelResearcherName: TLabel
58 59 Left = 0
59 60 Height = 15
60   - Top = 115
61   - Width = 628
  61 + Top = 112
  62 + Width = 637
62 63 Caption = 'Nome do Pesquisador'
63 64 ParentColor = False
64 65 end
65 66 object EditResearcherName: TEdit
66 67 Left = 0
67   - Height = 23
  68 + Height = 25
68 69 Hint = 'Uma pasta será criada com o seu nome. Os seus experimentos serão salvos dentro dela.'
69   - Top = 135
70   - Width = 628
  70 + Top = 132
  71 + Width = 637
71 72 OnEditingDone = EditExperimentEditingDone
72 73 TabOrder = 0
73 74 end
74 75 object LabelExperimentName: TLabel
75 76 Left = 0
76 77 Height = 15
77   - Top = 163
78   - Width = 628
  78 + Top = 162
  79 + Width = 637
79 80 Caption = 'Nome do Experimento'
80 81 ParentColor = False
81 82 end
82 83 object EditExperimentName: TEdit
83 84 Left = 0
84   - Height = 23
  85 + Height = 25
85 86 Hint = 'Uma pasta será criada com o nome do experimento. Os dados desse experimento serão salvos dentro dela.'
86   - Top = 183
87   - Width = 628
  87 + Top = 182
  88 + Width = 637
88 89 OnEditingDone = EditExperimentEditingDone
89 90 TabOrder = 1
90 91 end
91 92 object GBExperimentAim: TGroupBox
92 93 Left = 0
93   - Height = 162
94   - Top = 211
95   - Width = 628
  94 + Height = 159
  95 + Top = 212
  96 + Width = 637
96 97 Caption = 'Objetivo do Experimento'
97 98 ClientHeight = 142
98   - ClientWidth = 624
  99 + ClientWidth = 633
99 100 TabOrder = 2
100 101 object MemoExperimentAim: TMemo
101 102 Left = 0
102 103 Height = 142
103 104 Top = 0
104   - Width = 624
  105 + Width = 633
105 106 Align = alCustom
106 107 Anchors = [akTop, akLeft, akRight]
107 108 OnEditingDone = EditExperimentEditingDone
... ... @@ -110,10 +111,10 @@ object FormDesigner: TFormDesigner
110 111 end
111 112 object CGGlobal: TCheckGroup
112 113 Left = 0
113   - Height = 108
  114 + Height = 113
114 115 Hint = 'Aplicáveis ao longo de todo o experimento'
115   - Top = 378
116   - Width = 628
  116 + Top = 376
  117 + Width = 637
117 118 AutoFill = True
118 119 Caption = 'Configurações globais'
119 120 ChildSizing.LeftRightSpacing = 6
... ... @@ -124,8 +125,8 @@ object FormDesigner: TFormDesigner
124 125 ChildSizing.ShrinkVertical = crsScaleChilds
125 126 ChildSizing.Layout = cclLeftToRightThenTopToBottom
126 127 ChildSizing.ControlsPerLine = 1
127   - ClientHeight = 88
128   - ClientWidth = 624
  128 + ClientHeight = 96
  129 + ClientWidth = 633
129 130 Items.Strings = (
130 131 'Enviar histórico do bate-papo a novos participantes'
131 132 'Gerar participantes automaticamente'
... ... @@ -140,9 +141,9 @@ object FormDesigner: TFormDesigner
140 141 end
141 142 object RGPoints: TRadioGroup
142 143 Left = 0
143   - Height = 58
144   - Top = 491
145   - Width = 628
  144 + Height = 59
  145 + Top = 494
  146 + Width = 637
146 147 AutoFill = True
147 148 Caption = 'Tipo de pontuação Individual'
148 149 ChildSizing.LeftRightSpacing = 6
... ... @@ -152,8 +153,8 @@ object FormDesigner: TFormDesigner
152 153 ChildSizing.ShrinkVertical = crsScaleChilds
153 154 ChildSizing.Layout = cclLeftToRightThenTopToBottom
154 155 ChildSizing.ControlsPerLine = 1
155   - ClientHeight = 38
156   - ClientWidth = 624
  156 + ClientHeight = 42
  157 + ClientWidth = 633
157 158 ItemIndex = 0
158 159 Items.Strings = (
159 160 'A e B'
... ... @@ -164,21 +165,21 @@ object FormDesigner: TFormDesigner
164 165 end
165 166 object GBMatrix: TGroupBox
166 167 Left = 0
167   - Height = 134
168   - Top = 554
169   - Width = 628
  168 + Height = 143
  169 + Top = 558
  170 + Width = 637
170 171 Caption = 'Tipo da Matrix'
171 172 ChildSizing.LeftRightSpacing = 5
172 173 ChildSizing.Layout = cclLeftToRightThenTopToBottom
173 174 ChildSizing.ControlsPerLine = 1
174   - ClientHeight = 114
175   - ClientWidth = 624
  175 + ClientHeight = 126
  176 + ClientWidth = 633
176 177 TabOrder = 6
177 178 object ChkColors: TCheckBox
178 179 Left = 5
179   - Height = 19
  180 + Height = 21
180 181 Top = 0
181   - Width = 215
  182 + Width = 239
182 183 Caption = '5 cores'
183 184 Checked = True
184 185 Enabled = False
... ... @@ -188,9 +189,9 @@ object FormDesigner: TFormDesigner
188 189 end
189 190 object ChkRows: TCheckBox
190 191 Left = 5
191   - Height = 19
192   - Top = 19
193   - Width = 215
  192 + Height = 21
  193 + Top = 21
  194 + Width = 239
194 195 Caption = '10 linhas'
195 196 Checked = True
196 197 Enabled = False
... ... @@ -200,18 +201,18 @@ object FormDesigner: TFormDesigner
200 201 end
201 202 object ChkCols: TCheckBox
202 203 Left = 5
203   - Height = 19
204   - Top = 38
205   - Width = 215
  204 + Height = 21
  205 + Top = 42
  206 + Width = 239
206 207 Caption = '10 colunas'
207 208 OnClick = ChkMatrixTypeClick
208 209 TabOrder = 2
209 210 end
210 211 object ChkDots: TCheckBox
211 212 Left = 5
212   - Height = 19
213   - Top = 57
214   - Width = 215
  213 + Height = 21
  214 + Top = 63
  215 + Width = 239
215 216 Caption = 'Com Círculos Preechidos'
216 217 OnChange = ChkDotsChange
217 218 OnClick = ChkMatrixTypeClick
... ... @@ -219,9 +220,9 @@ object FormDesigner: TFormDesigner
219 220 end
220 221 object ChkCleanDots: TCheckBox
221 222 Left = 5
222   - Height = 19
223   - Top = 76
224   - Width = 215
  223 + Height = 21
  224 + Top = 84
  225 + Width = 239
225 226 Caption = 'Com Círculos Vazados'
226 227 OnChange = ChkCleanDotsChange
227 228 OnClick = ChkMatrixTypeClick
... ... @@ -229,9 +230,9 @@ object FormDesigner: TFormDesigner
229 230 end
230 231 object ChkDotsCleanDots: TCheckBox
231 232 Left = 5
232   - Height = 19
233   - Top = 95
234   - Width = 215
  233 + Height = 21
  234 + Top = 105
  235 + Width = 239
235 236 Caption = 'Com Círculos Vazados e Preenchidos'
236 237 OnChange = ChkDotsCleanDotsChange
237 238 OnClick = ChkMatrixTypeClick
... ... @@ -246,14 +247,14 @@ object FormDesigner: TFormDesigner
246 247 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
247 248 ChildSizing.Layout = cclLeftToRightThenTopToBottom
248 249 ChildSizing.ControlsPerLine = 1
249   - ClientHeight = 751
250   - ClientWidth = 649
  250 + ClientHeight = 711
  251 + ClientWidth = 637
251 252 object ComboCurrentCondition: TComboBox
252 253 Left = 0
253 254 Height = 23
254 255 Top = 10
255 256 Width = 649
256   - ItemHeight = 15
  257 + ItemHeight = 0
257 258 OnChange = ComboCurrentConditionChange
258 259 Style = csDropDownList
259 260 TabOrder = 0
... ... @@ -307,7 +308,7 @@ object FormDesigner: TFormDesigner
307 308 Top = 69
308 309 Width = 649
309 310 Caption = 'Contingências e Metacontingências da Condição Selecionada'
310   - ClientHeight = 80
  311 + ClientHeight = 83
311 312 ClientWidth = 645
312 313 TabOrder = 8
313 314 object ListBoxContingencies: TListBox
... ... @@ -319,8 +320,9 @@ object FormDesigner: TFormDesigner
319 320 Anchors = [akTop, akLeft, akRight]
320 321 ItemHeight = 0
321 322 MultiSelect = True
322   - ScrollWidth = 652
  323 + ScrollWidth = 643
323 324 TabOrder = 0
  325 + TopIndex = -1
324 326 end
325 327 end
326 328 object LabelConditionName: TLabel
... ... @@ -369,7 +371,7 @@ object FormDesigner: TFormDesigner
369 371 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
370 372 ChildSizing.Layout = cclTopToBottomThenLeftToRight
371 373 ChildSizing.ControlsPerLine = 2
372   - ClientHeight = 38
  374 + ClientHeight = 41
373 375 ClientWidth = 645
374 376 TabOrder = 9
375 377 object LabelPA: TLabel
... ... @@ -471,7 +473,7 @@ object FormDesigner: TFormDesigner
471 473 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
472 474 ChildSizing.Layout = cclLeftToRightThenTopToBottom
473 475 ChildSizing.ControlsPerLine = 1
474   - ClientHeight = 142
  476 + ClientHeight = 145
475 477 ClientWidth = 645
476 478 TabOrder = 5
477 479 object CheckBoxShouldAskQuestion: TCheckBox
... ... @@ -517,7 +519,7 @@ object FormDesigner: TFormDesigner
517 519 ChildSizing.ShrinkVertical = crsScaleChilds
518 520 ChildSizing.Layout = cclLeftToRightThenTopToBottom
519 521 ChildSizing.ControlsPerLine = 1
520   - ClientHeight = 50
  522 + ClientHeight = 53
521 523 ClientWidth = 541
522 524 Items.Strings = (
523 525 'Reverter consequências das metacontingências e contingências'
... ... @@ -545,7 +547,7 @@ object FormDesigner: TFormDesigner
545 547 ChildSizing.ShrinkVertical = crsScaleChilds
546 548 ChildSizing.Layout = cclLeftToRightThenTopToBottom
547 549 ChildSizing.ControlsPerLine = 1
548   - ClientHeight = 57
  550 + ClientHeight = 60
549 551 ClientWidth = 645
550 552 ItemIndex = 2
551 553 Items.Strings = (
... ... @@ -567,7 +569,7 @@ object FormDesigner: TFormDesigner
567 569 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
568 570 ChildSizing.Layout = cclLeftToRightThenTopToBottom
569 571 ChildSizing.ControlsPerLine = 1
570   - ClientHeight = 91
  572 + ClientHeight = 94
571 573 ClientWidth = 645
572 574 TabOrder = 7
573 575 object LabelEndCriteriaAbsCycles: TLabel
... ... @@ -597,7 +599,7 @@ object FormDesigner: TFormDesigner
597 599 ChildSizing.HorizontalSpacing = 5
598 600 ChildSizing.Layout = cclLeftToRightThenTopToBottom
599 601 ChildSizing.ControlsPerLine = 4
600   - ClientHeight = 23
  602 + ClientHeight = 26
601 603 ClientWidth = 541
602 604 TabOrder = 1
603 605 object SpinEditEndCriteriaInterlockingPorcentage: TSpinEdit
... ... @@ -650,8 +652,8 @@ object FormDesigner: TFormDesigner
650 652 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
651 653 ChildSizing.Layout = cclLeftToRightThenTopToBottom
652 654 ChildSizing.ControlsPerLine = 1
653   - ClientHeight = 762
654   - ClientWidth = 628
  655 + ClientHeight = 711
  656 + ClientWidth = 637
655 657 Enabled = False
656 658 object RGContingencyType: TRadioGroup
657 659 Left = 0
... ... @@ -667,7 +669,7 @@ object FormDesigner: TFormDesigner
667 669 ChildSizing.ShrinkVertical = crsScaleChilds
668 670 ChildSizing.Layout = cclLeftToRightThenTopToBottom
669 671 ChildSizing.ControlsPerLine = 1
670   - ClientHeight = 38
  672 + ClientHeight = 41
671 673 ClientWidth = 624
672 674 Items.Strings = (
673 675 'Contingências Operantes'
... ... @@ -681,7 +683,7 @@ object FormDesigner: TFormDesigner
681 683 Height = 23
682 684 Top = 73
683 685 Width = 628
684   - ItemHeight = 15
  686 + ItemHeight = 0
685 687 OnChange = ComboCurrentContingencyChange
686 688 Style = csDropDownList
687 689 TabOrder = 0
... ... @@ -758,7 +760,7 @@ object FormDesigner: TFormDesigner
758 760 ChildSizing.ShrinkVertical = crsScaleChilds
759 761 ChildSizing.Layout = cclLeftToRightThenTopToBottom
760 762 ChildSizing.ControlsPerLine = 1
761   - ClientHeight = 95
  763 + ClientHeight = 98
762 764 ClientWidth = 624
763 765 ItemIndex = 0
764 766 Items.Strings = (
... ... @@ -837,7 +839,7 @@ object FormDesigner: TFormDesigner
837 839 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
838 840 ChildSizing.Layout = cclLeftToRightThenTopToBottom
839 841 ChildSizing.ControlsPerLine = 2
840   - ClientHeight = 324
  842 + ClientHeight = 327
841 843 ClientWidth = 624
842 844 TabOrder = 6
843 845 Visible = False
... ... @@ -871,7 +873,7 @@ object FormDesigner: TFormDesigner
871 873 Height = 23
872 874 Top = 15
873 875 Width = 230
874   - ItemHeight = 15
  876 + ItemHeight = 0
875 877 OnChange = ConsequenceStyleChange
876 878 Style = csDropDownList
877 879 TabOrder = 1
... ... @@ -890,7 +892,7 @@ object FormDesigner: TFormDesigner
890 892 ChildSizing.ShrinkVertical = crsScaleChilds
891 893 ChildSizing.Layout = cclLeftToRightThenTopToBottom
892 894 ChildSizing.ControlsPerLine = 1
893   - ClientHeight = 57
  895 + ClientHeight = 60
894 896 ClientWidth = 390
895 897 ItemIndex = 0
896 898 Items.Strings = (
... ...
experiment_designer/form_main.pas
... ... @@ -202,13 +202,17 @@ type
202 202 procedure SetRGEndCriteriaStyle(AStyle: string);
203 203 procedure SetContingencyCriteria(S: string);
204 204 procedure SetConsequenceStyle(S:string);
205   - procedure UpdateContingencyList(ASection: String);
  205 + procedure UpdateConditionsCombo;
  206 + procedure UpdateConditionsList;
206 207 procedure UpdateContingencyCombo(ASection: String);
  208 + procedure UpdateContingencyList(ASection: String);
207 209 private
208 210 FLoading : Boolean;
209 211 FPersistentTXTFilename : string;
210 212 function GetContingencyName(IsMeta:Boolean; MustIncrement:Boolean=True):string;
  213 + procedure IncConditionName(var ACondition: string; N : integer = 1);
211 214 procedure IncContingencyName(var AContingency : string; N : integer = 1);
  215 + procedure ReadCondintionNames(S:TStrings);
212 216 procedure ReadContingencyNames(ASection, AContingency, AKeySuffix:string; S:TStrings);
213 217 procedure ReadContingencyValuesInSection(LS, LC : string; Keys:TStrings);
214 218 procedure SetPropstorageFilename;
... ... @@ -642,19 +646,39 @@ var
642 646 LC: string;
643 647 begin
644 648 LoadSectionExperiment;
645   -
646 649 if ComboCurrentCondition.ItemIndex <> -1 then
647   - begin
648   - LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']);
649   - LoadSectionCondition(LS);
650   - if ComboCurrentContingency.ItemIndex <> -1 then
651   - begin
652   - LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']);
653   - LoadContingency(LS, LC);
654   - end;
655   - end;
  650 + begin
  651 + LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']);
  652 + LoadSectionCondition(LS);
  653 + if ComboCurrentContingency.ItemIndex = -1 then
  654 + begin
  655 + LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']);
  656 + LoadContingency(LS, LC);
  657 + end;
  658 + end
  659 + else
  660 + begin
  661 + UpdateConditionsCombo;
  662 + UpdateConditionsList;
  663 + if ComboCurrentCondition.Items.Count > 0 then
  664 + begin
  665 + TabSheetContingencies.Enabled := True;
  666 + ComboCurrentCondition.ItemIndex := 0;
  667 + LS := ExtractDelimited(1,ComboCurrentCondition.Text,['|']);
  668 + LoadSectionCondition(LS);
  669 + UpdateContingencyCombo(LS);
  670 + UpdateContingencyList(LS);
  671 + if ComboCurrentContingency.Items.Count > 0 then
  672 + begin
  673 + ComboCurrentContingency.ItemIndex := 0;
  674 + LC := ExtractDelimited(1, ComboCurrentContingency.Text,['|']);
  675 + LoadContingency(LS, LC);
  676 + end;
  677 + end;
  678 + end;
656 679 end;
657 680  
  681 +
658 682 procedure TFormDesigner.SaveExperiment;
659 683 var
660 684 LS, LC: string;
... ... @@ -880,6 +904,18 @@ begin
880 904 RGBroadcastMessage.ItemIndex := 2;
881 905 end;
882 906  
  907 +procedure TFormDesigner.UpdateConditionsCombo;
  908 +begin
  909 + ComboCurrentCondition.Items.Clear;
  910 + ReadCondintionNames(ComboCurrentCondition.Items);
  911 +end;
  912 +
  913 +procedure TFormDesigner.UpdateConditionsList;
  914 +begin
  915 + ListBoxConditions.Items.Clear;
  916 + ReadCondintionNames(ListBoxConditions.Items);
  917 +end;
  918 +
883 919 procedure TFormDesigner.UpdateContingencyList(ASection: String);
884 920 var
885 921 LC: String;
... ... @@ -914,6 +950,20 @@ begin
914 950 end;
915 951 end;
916 952  
  953 +procedure TFormDesigner.IncConditionName(var ACondition: string; N: integer);
  954 +var
  955 + LConditionName: String;
  956 + LExtension: RawByteString;
  957 + LCount: LongInt;
  958 +begin
  959 + LConditionName := ExtractFileNameWithoutExt(ACondition);
  960 + LExtension := ExtractFileExt(ACondition);
  961 + Delete(LExtension,1,1);
  962 + LCount := StrToInt(LExtension);
  963 + Inc(LCount,N);
  964 + ACondition := LConditionName + '.' + IntToStr(LCount);
  965 +end;
  966 +
917 967 procedure TFormDesigner.IncContingencyName(var AContingency: string; N: integer);
918 968 var
919 969 LContingencyType: String;
... ... @@ -928,6 +978,19 @@ begin
928 978 AContingency := LContingencyType + '.' + IntToStr(LCount);
929 979 end;
930 980  
  981 +procedure TFormDesigner.ReadCondintionNames(S: TStrings);
  982 +var
  983 + ASection: string;
  984 +begin
  985 + ASection := SEC_CONDITION+'1';
  986 + with FExperiment do
  987 + while SectionExists(ASection) do
  988 + begin
  989 + S.Append(ASection+'|'+ReadString(ASection,KEY_COND_NAME,''));
  990 + IncConditionName(ASection);
  991 + end;
  992 +end;
  993 +
931 994 procedure TFormDesigner.ReadContingencyNames(ASection, AContingency,
932 995 AKeySuffix: string; S: TStrings);
933 996 begin
... ...