Commit b0979fbab8c2dbbbe8d198bcd16fe14ae5a60568
1 parent
b38409b5
Exists in
master
complete gui - second prototype
Showing
2 changed files
with
152 additions
and
80 deletions
Show diff stats
experiment_designer/form_main.lfm
1 | 1 | object FormDesigner: TFormDesigner |
2 | - Left = 327 | |
2 | + Left = 291 | |
3 | 3 | Height = 635 |
4 | - Top = 106 | |
4 | + Top = 44 | |
5 | 5 | Width = 656 |
6 | - HorzScrollBar.Page = 387 | |
7 | - VertScrollBar.Page = 520 | |
6 | + HorzScrollBar.Page = 346 | |
7 | + VertScrollBar.Page = 616 | |
8 | 8 | AutoScroll = True |
9 | 9 | Caption = 'Planejar Experimento' |
10 | 10 | ClientHeight = 616 |
11 | - ClientWidth = 656 | |
11 | + ClientWidth = 646 | |
12 | 12 | Menu = MainMenu1 |
13 | 13 | OnActivate = FormActivate |
14 | 14 | OnCreate = FormCreate |
... | ... | @@ -18,12 +18,12 @@ object FormDesigner: TFormDesigner |
18 | 18 | LCLVersion = '1.6.2.0' |
19 | 19 | object PageControl: TPageControl |
20 | 20 | Left = 0 |
21 | - Height = 616 | |
21 | + Height = 744 | |
22 | 22 | Top = 0 |
23 | - Width = 656 | |
24 | - ActivePage = TabSheetContingencies | |
23 | + Width = 646 | |
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,8 +32,8 @@ object FormDesigner: TFormDesigner |
32 | 32 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
33 | 33 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
34 | 34 | ChildSizing.ControlsPerLine = 1 |
35 | - ClientHeight = 583 | |
36 | - ClientWidth = 650 | |
35 | + ClientHeight = 711 | |
36 | + ClientWidth = 640 | |
37 | 37 | object LabelResearcherName: TLabel |
38 | 38 | Left = 0 |
39 | 39 | Height = 15 |
... | ... | @@ -140,21 +140,21 @@ object FormDesigner: TFormDesigner |
140 | 140 | end |
141 | 141 | object GBMatrix: TGroupBox |
142 | 142 | Left = 0 |
143 | - Height = 122 | |
143 | + Height = 143 | |
144 | 144 | Top = 456 |
145 | 145 | Width = 640 |
146 | 146 | Caption = 'Tipo da Matrix' |
147 | 147 | ChildSizing.LeftRightSpacing = 5 |
148 | 148 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
149 | 149 | ChildSizing.ControlsPerLine = 1 |
150 | - ClientHeight = 105 | |
150 | + ClientHeight = 126 | |
151 | 151 | ClientWidth = 636 |
152 | 152 | TabOrder = 6 |
153 | 153 | object ChkColors: TCheckBox |
154 | 154 | Left = 5 |
155 | 155 | Height = 21 |
156 | 156 | Top = 0 |
157 | - Width = 169 | |
157 | + Width = 239 | |
158 | 158 | Caption = '5 cores' |
159 | 159 | Checked = True |
160 | 160 | Enabled = False |
... | ... | @@ -165,7 +165,7 @@ object FormDesigner: TFormDesigner |
165 | 165 | Left = 5 |
166 | 166 | Height = 21 |
167 | 167 | Top = 21 |
168 | - Width = 169 | |
168 | + Width = 239 | |
169 | 169 | Caption = '10 linhas' |
170 | 170 | Checked = True |
171 | 171 | Enabled = False |
... | ... | @@ -176,7 +176,7 @@ object FormDesigner: TFormDesigner |
176 | 176 | Left = 5 |
177 | 177 | Height = 21 |
178 | 178 | Top = 42 |
179 | - Width = 169 | |
179 | + Width = 239 | |
180 | 180 | Caption = '10 colunas' |
181 | 181 | TabOrder = 2 |
182 | 182 | end |
... | ... | @@ -184,7 +184,7 @@ object FormDesigner: TFormDesigner |
184 | 184 | Left = 5 |
185 | 185 | Height = 21 |
186 | 186 | Top = 63 |
187 | - Width = 169 | |
187 | + Width = 239 | |
188 | 188 | Caption = 'Com Círculos Preechidos' |
189 | 189 | OnChange = ChkDotsChange |
190 | 190 | TabOrder = 3 |
... | ... | @@ -193,16 +193,25 @@ object FormDesigner: TFormDesigner |
193 | 193 | Left = 5 |
194 | 194 | Height = 21 |
195 | 195 | Top = 84 |
196 | - Width = 169 | |
196 | + Width = 239 | |
197 | 197 | Caption = 'Com Círculos Vazados' |
198 | 198 | OnChange = ChkCleanDotsChange |
199 | 199 | TabOrder = 4 |
200 | 200 | end |
201 | + object ChkDotsCleanDots: TCheckBox | |
202 | + Left = 5 | |
203 | + Height = 21 | |
204 | + Top = 105 | |
205 | + Width = 239 | |
206 | + Caption = 'Com Círculos Vazados e Preenchidos' | |
207 | + OnChange = ChkDotsCleanDotsChange | |
208 | + TabOrder = 5 | |
209 | + end | |
201 | 210 | end |
202 | 211 | object GBConditions: TGroupBox |
203 | 212 | Left = 0 |
204 | 213 | Height = 97 |
205 | - Top = 583 | |
214 | + Top = 604 | |
206 | 215 | Width = 640 |
207 | 216 | Caption = 'Condições' |
208 | 217 | ClientHeight = 80 |
... | ... | @@ -228,8 +237,8 @@ object FormDesigner: TFormDesigner |
228 | 237 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
229 | 238 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
230 | 239 | ChildSizing.ControlsPerLine = 1 |
231 | - ClientHeight = 583 | |
232 | - ClientWidth = 650 | |
240 | + ClientHeight = 711 | |
241 | + ClientWidth = 640 | |
233 | 242 | object ComboCurrentCondition: TComboBox |
234 | 243 | Left = 0 |
235 | 244 | Height = 27 |
... | ... | @@ -277,6 +286,7 @@ object FormDesigner: TFormDesigner |
277 | 286 | Top = 0 |
278 | 287 | Width = 169 |
279 | 288 | Caption = 'Reordenar' |
289 | + OnClick = BtnReorderCondClick | |
280 | 290 | TabOrder = 2 |
281 | 291 | end |
282 | 292 | end |
... | ... | @@ -353,7 +363,7 @@ object FormDesigner: TFormDesigner |
353 | 363 | end |
354 | 364 | object GBQuestion: TGroupBox |
355 | 365 | Left = 0 |
356 | - Height = 144 | |
366 | + Height = 164 | |
357 | 367 | Top = 273 |
358 | 368 | Width = 640 |
359 | 369 | Caption = 'Apresentar pergunta ao final do ciclo' |
... | ... | @@ -362,7 +372,7 @@ object FormDesigner: TFormDesigner |
362 | 372 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
363 | 373 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
364 | 374 | ChildSizing.ControlsPerLine = 1 |
365 | - ClientHeight = 127 | |
375 | + ClientHeight = 147 | |
366 | 376 | ClientWidth = 636 |
367 | 377 | TabOrder = 5 |
368 | 378 | object CheckBoxShouldAskQuestion: TCheckBox |
... | ... | @@ -374,10 +384,18 @@ object FormDesigner: TFormDesigner |
374 | 384 | OnChange = CheckBoxShouldAskQuestionChange |
375 | 385 | TabOrder = 0 |
376 | 386 | end |
387 | + object LabelQuestion: TLabel | |
388 | + Left = 50 | |
389 | + Height = 15 | |
390 | + Top = 26 | |
391 | + Width = 536 | |
392 | + Caption = 'Texto da Pergunta' | |
393 | + ParentColor = False | |
394 | + end | |
377 | 395 | object EditQuestion: TEdit |
378 | 396 | Left = 50 |
379 | 397 | Height = 25 |
380 | - Top = 26 | |
398 | + Top = 46 | |
381 | 399 | Width = 536 |
382 | 400 | OnEditingDone = EditQuestionEditingDone |
383 | 401 | TabOrder = 1 |
... | ... | @@ -387,7 +405,7 @@ object FormDesigner: TFormDesigner |
387 | 405 | object CGQuestion: TCheckGroup |
388 | 406 | Left = 50 |
389 | 407 | Height = 71 |
390 | - Top = 56 | |
408 | + Top = 76 | |
391 | 409 | Width = 536 |
392 | 410 | AutoFill = True |
393 | 411 | Caption = 'O que deve acontecer quando todos responderem sim?' |
... | ... | @@ -416,7 +434,7 @@ object FormDesigner: TFormDesigner |
416 | 434 | object RGEndCriteriaStyle: TRadioGroup |
417 | 435 | Left = 0 |
418 | 436 | Height = 80 |
419 | - Top = 422 | |
437 | + Top = 442 | |
420 | 438 | Width = 640 |
421 | 439 | AutoFill = True |
422 | 440 | Caption = 'Estilo do critério de finalização da condição' |
... | ... | @@ -441,7 +459,7 @@ object FormDesigner: TFormDesigner |
441 | 459 | object GBEndCriteria: TGroupBox |
442 | 460 | Left = 0 |
443 | 461 | Height = 109 |
444 | - Top = 507 | |
462 | + Top = 527 | |
445 | 463 | Width = 640 |
446 | 464 | Caption = 'Valores do critério de finalização da condição' |
447 | 465 | ChildSizing.LeftRightSpacing = 50 |
... | ... | @@ -527,7 +545,7 @@ object FormDesigner: TFormDesigner |
527 | 545 | object GBContingencies: TGroupBox |
528 | 546 | Left = 0 |
529 | 547 | Height = 97 |
530 | - Top = 621 | |
548 | + Top = 641 | |
531 | 549 | Width = 640 |
532 | 550 | Caption = 'Contingências e Metacontingências' |
533 | 551 | ClientHeight = 80 |
... | ... | @@ -553,8 +571,8 @@ object FormDesigner: TFormDesigner |
553 | 571 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
554 | 572 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
555 | 573 | ChildSizing.ControlsPerLine = 1 |
556 | - ClientHeight = 583 | |
557 | - ClientWidth = 650 | |
574 | + ClientHeight = 711 | |
575 | + ClientWidth = 640 | |
558 | 576 | Enabled = False |
559 | 577 | object RGContingencyType: TRadioGroup |
560 | 578 | Left = 0 |
... | ... | @@ -626,6 +644,7 @@ object FormDesigner: TFormDesigner |
626 | 644 | Top = 0 |
627 | 645 | Width = 171 |
628 | 646 | Caption = 'Reordenar' |
647 | + OnClick = BtnReorderContingencyClick | |
629 | 648 | TabOrder = 2 |
630 | 649 | end |
631 | 650 | end | ... | ... |
experiment_designer/form_main.pas
... | ... | @@ -20,6 +20,7 @@ type |
20 | 20 | BtnReorderCond: TButton; |
21 | 21 | BtnReorderContingency: TButton; |
22 | 22 | CGGlobal: TCheckGroup; |
23 | + ChkDotsCleanDots: TCheckBox; | |
23 | 24 | ChkColors: TCheckBox; |
24 | 25 | ChkRows: TCheckBox; |
25 | 26 | ChkCols: TCheckBox; |
... | ... | @@ -48,6 +49,7 @@ type |
48 | 49 | GBContingencyRows: TGroupBox; |
49 | 50 | GBContingencyConsequence: TGroupBox; |
50 | 51 | GBMatrix: TGroupBox; |
52 | + LabelQuestion: TLabel; | |
51 | 53 | LabelPointsOnConditionBegin: TLabel; |
52 | 54 | LabelC1: TLabel; |
53 | 55 | LabelC2: TLabel; |
... | ... | @@ -97,6 +99,9 @@ type |
97 | 99 | procedure BtnAppendContingencyClick(Sender: TObject); |
98 | 100 | procedure BtnRemoveCondClick(Sender: TObject); |
99 | 101 | procedure BtnRemoveContingencyClick(Sender: TObject); |
102 | + procedure BtnReorderCondClick(Sender: TObject); | |
103 | + procedure BtnReorderContingencyClick(Sender: TObject); | |
104 | + procedure ChkDotsCleanDotsChange(Sender: TObject); | |
100 | 105 | // |
101 | 106 | procedure ConsequenceMessageEditingDone(Sender: TObject); |
102 | 107 | procedure ConsequenceStyleChange(Sender: TObject); |
... | ... | @@ -321,7 +326,10 @@ begin |
321 | 326 | LC += '1'; |
322 | 327 | with FExperiment do |
323 | 328 | if ValueExists(LS,LC+KEY_CONT_NAME) and (not FLoading) then |
324 | - LoadContingency(LS,LC); | |
329 | + begin | |
330 | + LoadContingency(LS,LC); | |
331 | + ComboCurrentContingency.ItemIndex:=0; | |
332 | + end; | |
325 | 333 | |
326 | 334 | end; |
327 | 335 | end; |
... | ... | @@ -1126,13 +1134,28 @@ end; |
1126 | 1134 | procedure TFormDesigner.ChkCleanDotsChange(Sender: TObject); |
1127 | 1135 | begin |
1128 | 1136 | if ChkCleanDots.Checked then |
1129 | - ChkDots.Checked := not ChkCleanDots.Checked; | |
1137 | + begin | |
1138 | + ChkDots.Checked := not ChkCleanDots.Checked; | |
1139 | + ChkDotsCleanDots.Checked := not ChkCleanDots.Checked; | |
1140 | + end; | |
1130 | 1141 | end; |
1131 | 1142 | |
1132 | 1143 | procedure TFormDesigner.ChkDotsChange(Sender: TObject); |
1133 | 1144 | begin |
1134 | 1145 | if ChkDots.Checked then |
1135 | - ChkCleanDots.Checked := not ChkDots.Checked; | |
1146 | + begin | |
1147 | + ChkCleanDots.Checked := not ChkDots.Checked; | |
1148 | + ChkDotsCleanDots.Checked := not ChkDots.Checked; | |
1149 | + end; | |
1150 | +end; | |
1151 | + | |
1152 | +procedure TFormDesigner.ChkDotsCleanDotsChange(Sender: TObject); | |
1153 | +begin | |
1154 | + if ChkDotsCleanDots.Checked then | |
1155 | + begin | |
1156 | + ChkCleanDots.Checked := not ChkDotsCleanDots.Checked; | |
1157 | + ChkDots.Checked := not ChkDotsCleanDots.Checked; | |
1158 | + end; | |
1136 | 1159 | end; |
1137 | 1160 | |
1138 | 1161 | procedure TFormDesigner.ComboCurrentConditionChange(Sender: TObject); |
... | ... | @@ -1239,13 +1262,14 @@ begin |
1239 | 1262 | LC + '|' + EditContingencyName.Text; |
1240 | 1263 | ComboCurrentContingency.ItemIndex := i; |
1241 | 1264 | SaveContingency(LS,LC); |
1242 | - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | |
1265 | + UpdateContingencyList(LS); | |
1243 | 1266 | end; |
1244 | 1267 | |
1245 | 1268 | procedure TFormDesigner.BtnRemoveCondClick(Sender: TObject); |
1246 | 1269 | var |
1247 | 1270 | i: integer; |
1248 | 1271 | MustReorder: boolean; |
1272 | + LS: String; | |
1249 | 1273 | |
1250 | 1274 | procedure Reorder(index : integer); |
1251 | 1275 | var |
... | ... | @@ -1277,27 +1301,34 @@ var |
1277 | 1301 | end; |
1278 | 1302 | |
1279 | 1303 | begin |
1280 | - i := ComboCurrentCondition.ItemIndex; | |
1281 | - MustReorder := i < ComboCurrentCondition.Items.Count - 1; | |
1282 | - ComboCurrentCondition.Items.Delete(i); | |
1283 | - if MustReorder then | |
1284 | - Reorder(i); | |
1285 | - case ComboCurrentCondition.Items.Count of | |
1286 | - 0: {do nothing}; | |
1287 | - 1..MaxInt: | |
1288 | - if i = 1 then | |
1289 | - ComboCurrentCondition.ItemIndex := i | |
1290 | - else | |
1291 | - ComboCurrentCondition.ItemIndex := i -1; | |
1292 | - end; | |
1293 | - ListBoxContingencies.Items.Text := ComboCurrentCondition.Items.Text; | |
1294 | - TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0; | |
1304 | + if ComboCurrentCondition.ItemIndex > -1 then | |
1305 | + begin | |
1306 | + i := ComboCurrentCondition.ItemIndex; | |
1307 | + MustReorder := i < ComboCurrentCondition.Items.Count - 1; | |
1308 | + LS := ExtractDelimited(1, ComboCurrentCondition.Text, ['|']); | |
1309 | + ComboCurrentCondition.Items.Delete(i); | |
1310 | + FExperiment.EraseSection(LS); | |
1311 | + | |
1312 | + if MustReorder then | |
1313 | + Reorder(i); | |
1314 | + case ComboCurrentCondition.Items.Count of | |
1315 | + 0: {do nothing}; | |
1316 | + 1..MaxInt: | |
1317 | + if i = 1 then | |
1318 | + ComboCurrentCondition.ItemIndex := i | |
1319 | + else | |
1320 | + ComboCurrentCondition.ItemIndex := i -1; | |
1321 | + end; | |
1322 | + ListBoxContingencies.Items.Text := ComboCurrentCondition.Items.Text; | |
1323 | + TabSheetContingencies.Enabled := ComboCurrentCondition.Items.Count > 0; | |
1324 | + end; | |
1295 | 1325 | end; |
1296 | 1326 | |
1297 | 1327 | procedure TFormDesigner.BtnRemoveContingencyClick(Sender: TObject); |
1298 | 1328 | var |
1299 | 1329 | i: integer; |
1300 | 1330 | MustReorder: boolean; |
1331 | + LS, LC: String; | |
1301 | 1332 | |
1302 | 1333 | procedure ReadContingencyValuesInSection(LS,LC : string; var Keys : TStringList); |
1303 | 1334 | begin |
... | ... | @@ -1322,43 +1353,65 @@ var |
1322 | 1353 | begin |
1323 | 1354 | SectionKeys := TStringList.Create; |
1324 | 1355 | with FExperiment do |
1325 | - for i := Index to ComboCurrentContingency.Items.Count - 1 do | |
1326 | - begin | |
1327 | - SectionName := ExtractDelimited(1, ComboCurrentCondition.Items[ComboCurrentCondition.ItemIndex], ['|']); | |
1328 | - KeyPrefix := ExtractDelimited(1, ComboCurrentContingency.Items[i], ['|']); | |
1329 | - ReadContingencyValuesInSection(SectionName,KeyPrefix, SectionKeys); | |
1330 | - EraseContingency(SectionName,KeyPrefix); | |
1331 | - // todo: contingencies on top, meta on bootom... | |
1332 | - KeyPrefix := GetContingencyName(ExtractFileNameWithoutExt(KeyPrefix) = ExtractFileNameWithoutExt(KEY_METACONTINGENCY)); | |
1333 | - for Line in SectionKeys do | |
1334 | - begin | |
1335 | - KeyName := SectionKeys.ExtractName(Line); | |
1336 | - WriteString(SectionName, KeyName, SectionKeys.Values[KeyName]); | |
1337 | - end; | |
1338 | - SectionKeys.Clear; | |
1339 | - ComboCurrentContingency.Items[i] := | |
1340 | - KeyPrefix + '|' + ExtractDelimited(2, ComboCurrentContingency.Items[i], ['|']); | |
1341 | - end; | |
1356 | + begin | |
1357 | + SectionName := ExtractDelimited(1, ComboCurrentCondition.Text, ['|']); | |
1358 | + for i := Index to ComboCurrentContingency.Items.Count - 1 do | |
1359 | + begin | |
1360 | + KeyPrefix := ExtractDelimited(1, ComboCurrentContingency.Items[i], ['|']); | |
1361 | + ReadContingencyValuesInSection(SectionName,KeyPrefix, SectionKeys); | |
1362 | + EraseContingency(SectionName,KeyPrefix); | |
1363 | + KeyPrefix := ExtractFileNameWithoutExt(KeyPrefix) + '.' + IntToStr(i); | |
1364 | + for Line in SectionKeys do | |
1365 | + begin | |
1366 | + KeyName := SectionKeys.ExtractName(Line); | |
1367 | + WriteString(SectionName, KeyName, SectionKeys.Values[KeyName]); | |
1368 | + end; | |
1369 | + SectionKeys.Clear; | |
1370 | + ComboCurrentContingency.Items[i] := | |
1371 | + KeyPrefix + '|' + ExtractDelimited(2, ComboCurrentContingency.Items[i], ['|']); | |
1372 | + end; | |
1373 | + end; | |
1342 | 1374 | SectionKeys.Free; |
1343 | 1375 | end; |
1344 | 1376 | |
1345 | 1377 | begin |
1346 | - i := ComboCurrentContingency.ItemIndex; | |
1347 | - MustReorder := i < ComboCurrentContingency.Items.Count - 1; | |
1348 | - ComboCurrentContingency.Items.Delete(i); | |
1349 | - if MustReorder then | |
1350 | - Reorder(i); | |
1351 | - case ComboCurrentContingency.Items.Count of | |
1352 | - 0: {do nothing}; | |
1353 | - 1..MaxInt: | |
1354 | - if i = 1 then | |
1355 | - ComboCurrentContingency.ItemIndex := i | |
1356 | - else | |
1357 | - ComboCurrentContingency.ItemIndex := i -1; | |
1358 | - end; | |
1359 | - UpdateContingencyList(ExtractDelimited(1,ComboCurrentCondition.Text,['|'])); | |
1378 | + if ComboCurrentContingency.ItemIndex > -1 then | |
1379 | + begin | |
1380 | + i := ComboCurrentContingency.ItemIndex; | |
1381 | + MustReorder := i < ComboCurrentContingency.Items.Count - 1; | |
1382 | + LS := ExtractDelimited(1, ComboCurrentCondition.Text, ['|']); | |
1383 | + LC := ExtractDelimited(1, ComboCurrentContingency.Text, ['|']); | |
1384 | + ComboCurrentContingency.Items.Delete(i); | |
1385 | + EraseContingency(LS,LC); | |
1386 | + | |
1387 | + if MustReorder then | |
1388 | + Reorder(i); | |
1389 | + | |
1390 | + case ComboCurrentContingency.Items.Count of | |
1391 | + 0: {do nothing}; | |
1392 | + 1..MaxInt: | |
1393 | + if i = 1 then | |
1394 | + ComboCurrentContingency.ItemIndex := i | |
1395 | + else | |
1396 | + ComboCurrentContingency.ItemIndex := i -1; | |
1397 | + end; | |
1398 | + UpdateContingencyList(LS); | |
1399 | + end; | |
1400 | +end; | |
1401 | + | |
1402 | +procedure TFormDesigner.BtnReorderCondClick(Sender: TObject); | |
1403 | +begin | |
1404 | + // todo: custom reorder contingencies | |
1405 | + ShowMessage('Não implementado.'); | |
1360 | 1406 | end; |
1361 | 1407 | |
1408 | +procedure TFormDesigner.BtnReorderContingencyClick(Sender: TObject); | |
1409 | +begin | |
1410 | + // todo: custom reorder contingencies | |
1411 | + ShowMessage('Não implementado.'); | |
1412 | +end; | |
1413 | + | |
1414 | + | |
1362 | 1415 | procedure TFormDesigner.ConsequenceStyleChange(Sender: TObject); |
1363 | 1416 | var |
1364 | 1417 | LS, LC: String; | ... | ... |