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 | object FormDesigner: TFormDesigner | 1 | object FormDesigner: TFormDesigner |
2 | - Left = 327 | 2 | + Left = 291 |
3 | Height = 635 | 3 | Height = 635 |
4 | - Top = 106 | 4 | + Top = 44 |
5 | Width = 656 | 5 | Width = 656 |
6 | - HorzScrollBar.Page = 387 | ||
7 | - VertScrollBar.Page = 520 | 6 | + HorzScrollBar.Page = 346 |
7 | + VertScrollBar.Page = 616 | ||
8 | AutoScroll = True | 8 | AutoScroll = True |
9 | Caption = 'Planejar Experimento' | 9 | Caption = 'Planejar Experimento' |
10 | ClientHeight = 616 | 10 | ClientHeight = 616 |
11 | - ClientWidth = 656 | 11 | + ClientWidth = 646 |
12 | Menu = MainMenu1 | 12 | Menu = MainMenu1 |
13 | OnActivate = FormActivate | 13 | OnActivate = FormActivate |
14 | OnCreate = FormCreate | 14 | OnCreate = FormCreate |
@@ -18,12 +18,12 @@ object FormDesigner: TFormDesigner | @@ -18,12 +18,12 @@ object FormDesigner: TFormDesigner | ||
18 | LCLVersion = '1.6.2.0' | 18 | LCLVersion = '1.6.2.0' |
19 | object PageControl: TPageControl | 19 | object PageControl: TPageControl |
20 | Left = 0 | 20 | Left = 0 |
21 | - Height = 616 | 21 | + Height = 744 |
22 | Top = 0 | 22 | Top = 0 |
23 | - Width = 656 | ||
24 | - ActivePage = TabSheetContingencies | 23 | + Width = 646 |
24 | + ActivePage = TabSheetExperiment | ||
25 | Align = alClient | 25 | Align = alClient |
26 | - TabIndex = 2 | 26 | + TabIndex = 0 |
27 | TabOrder = 0 | 27 | TabOrder = 0 |
28 | object TabSheetExperiment: TTabSheet | 28 | object TabSheetExperiment: TTabSheet |
29 | Caption = 'Experimento' | 29 | Caption = 'Experimento' |
@@ -32,8 +32,8 @@ object FormDesigner: TFormDesigner | @@ -32,8 +32,8 @@ object FormDesigner: TFormDesigner | ||
32 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize | 32 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
33 | ChildSizing.Layout = cclLeftToRightThenTopToBottom | 33 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
34 | ChildSizing.ControlsPerLine = 1 | 34 | ChildSizing.ControlsPerLine = 1 |
35 | - ClientHeight = 583 | ||
36 | - ClientWidth = 650 | 35 | + ClientHeight = 711 |
36 | + ClientWidth = 640 | ||
37 | object LabelResearcherName: TLabel | 37 | object LabelResearcherName: TLabel |
38 | Left = 0 | 38 | Left = 0 |
39 | Height = 15 | 39 | Height = 15 |
@@ -140,21 +140,21 @@ object FormDesigner: TFormDesigner | @@ -140,21 +140,21 @@ object FormDesigner: TFormDesigner | ||
140 | end | 140 | end |
141 | object GBMatrix: TGroupBox | 141 | object GBMatrix: TGroupBox |
142 | Left = 0 | 142 | Left = 0 |
143 | - Height = 122 | 143 | + Height = 143 |
144 | Top = 456 | 144 | Top = 456 |
145 | Width = 640 | 145 | Width = 640 |
146 | Caption = 'Tipo da Matrix' | 146 | Caption = 'Tipo da Matrix' |
147 | ChildSizing.LeftRightSpacing = 5 | 147 | ChildSizing.LeftRightSpacing = 5 |
148 | ChildSizing.Layout = cclLeftToRightThenTopToBottom | 148 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
149 | ChildSizing.ControlsPerLine = 1 | 149 | ChildSizing.ControlsPerLine = 1 |
150 | - ClientHeight = 105 | 150 | + ClientHeight = 126 |
151 | ClientWidth = 636 | 151 | ClientWidth = 636 |
152 | TabOrder = 6 | 152 | TabOrder = 6 |
153 | object ChkColors: TCheckBox | 153 | object ChkColors: TCheckBox |
154 | Left = 5 | 154 | Left = 5 |
155 | Height = 21 | 155 | Height = 21 |
156 | Top = 0 | 156 | Top = 0 |
157 | - Width = 169 | 157 | + Width = 239 |
158 | Caption = '5 cores' | 158 | Caption = '5 cores' |
159 | Checked = True | 159 | Checked = True |
160 | Enabled = False | 160 | Enabled = False |
@@ -165,7 +165,7 @@ object FormDesigner: TFormDesigner | @@ -165,7 +165,7 @@ object FormDesigner: TFormDesigner | ||
165 | Left = 5 | 165 | Left = 5 |
166 | Height = 21 | 166 | Height = 21 |
167 | Top = 21 | 167 | Top = 21 |
168 | - Width = 169 | 168 | + Width = 239 |
169 | Caption = '10 linhas' | 169 | Caption = '10 linhas' |
170 | Checked = True | 170 | Checked = True |
171 | Enabled = False | 171 | Enabled = False |
@@ -176,7 +176,7 @@ object FormDesigner: TFormDesigner | @@ -176,7 +176,7 @@ object FormDesigner: TFormDesigner | ||
176 | Left = 5 | 176 | Left = 5 |
177 | Height = 21 | 177 | Height = 21 |
178 | Top = 42 | 178 | Top = 42 |
179 | - Width = 169 | 179 | + Width = 239 |
180 | Caption = '10 colunas' | 180 | Caption = '10 colunas' |
181 | TabOrder = 2 | 181 | TabOrder = 2 |
182 | end | 182 | end |
@@ -184,7 +184,7 @@ object FormDesigner: TFormDesigner | @@ -184,7 +184,7 @@ object FormDesigner: TFormDesigner | ||
184 | Left = 5 | 184 | Left = 5 |
185 | Height = 21 | 185 | Height = 21 |
186 | Top = 63 | 186 | Top = 63 |
187 | - Width = 169 | 187 | + Width = 239 |
188 | Caption = 'Com Círculos Preechidos' | 188 | Caption = 'Com Círculos Preechidos' |
189 | OnChange = ChkDotsChange | 189 | OnChange = ChkDotsChange |
190 | TabOrder = 3 | 190 | TabOrder = 3 |
@@ -193,16 +193,25 @@ object FormDesigner: TFormDesigner | @@ -193,16 +193,25 @@ object FormDesigner: TFormDesigner | ||
193 | Left = 5 | 193 | Left = 5 |
194 | Height = 21 | 194 | Height = 21 |
195 | Top = 84 | 195 | Top = 84 |
196 | - Width = 169 | 196 | + Width = 239 |
197 | Caption = 'Com Círculos Vazados' | 197 | Caption = 'Com Círculos Vazados' |
198 | OnChange = ChkCleanDotsChange | 198 | OnChange = ChkCleanDotsChange |
199 | TabOrder = 4 | 199 | TabOrder = 4 |
200 | end | 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 | end | 210 | end |
202 | object GBConditions: TGroupBox | 211 | object GBConditions: TGroupBox |
203 | Left = 0 | 212 | Left = 0 |
204 | Height = 97 | 213 | Height = 97 |
205 | - Top = 583 | 214 | + Top = 604 |
206 | Width = 640 | 215 | Width = 640 |
207 | Caption = 'Condições' | 216 | Caption = 'Condições' |
208 | ClientHeight = 80 | 217 | ClientHeight = 80 |
@@ -228,8 +237,8 @@ object FormDesigner: TFormDesigner | @@ -228,8 +237,8 @@ object FormDesigner: TFormDesigner | ||
228 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize | 237 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
229 | ChildSizing.Layout = cclLeftToRightThenTopToBottom | 238 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
230 | ChildSizing.ControlsPerLine = 1 | 239 | ChildSizing.ControlsPerLine = 1 |
231 | - ClientHeight = 583 | ||
232 | - ClientWidth = 650 | 240 | + ClientHeight = 711 |
241 | + ClientWidth = 640 | ||
233 | object ComboCurrentCondition: TComboBox | 242 | object ComboCurrentCondition: TComboBox |
234 | Left = 0 | 243 | Left = 0 |
235 | Height = 27 | 244 | Height = 27 |
@@ -277,6 +286,7 @@ object FormDesigner: TFormDesigner | @@ -277,6 +286,7 @@ object FormDesigner: TFormDesigner | ||
277 | Top = 0 | 286 | Top = 0 |
278 | Width = 169 | 287 | Width = 169 |
279 | Caption = 'Reordenar' | 288 | Caption = 'Reordenar' |
289 | + OnClick = BtnReorderCondClick | ||
280 | TabOrder = 2 | 290 | TabOrder = 2 |
281 | end | 291 | end |
282 | end | 292 | end |
@@ -353,7 +363,7 @@ object FormDesigner: TFormDesigner | @@ -353,7 +363,7 @@ object FormDesigner: TFormDesigner | ||
353 | end | 363 | end |
354 | object GBQuestion: TGroupBox | 364 | object GBQuestion: TGroupBox |
355 | Left = 0 | 365 | Left = 0 |
356 | - Height = 144 | 366 | + Height = 164 |
357 | Top = 273 | 367 | Top = 273 |
358 | Width = 640 | 368 | Width = 640 |
359 | Caption = 'Apresentar pergunta ao final do ciclo' | 369 | Caption = 'Apresentar pergunta ao final do ciclo' |
@@ -362,7 +372,7 @@ object FormDesigner: TFormDesigner | @@ -362,7 +372,7 @@ object FormDesigner: TFormDesigner | ||
362 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize | 372 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
363 | ChildSizing.Layout = cclLeftToRightThenTopToBottom | 373 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
364 | ChildSizing.ControlsPerLine = 1 | 374 | ChildSizing.ControlsPerLine = 1 |
365 | - ClientHeight = 127 | 375 | + ClientHeight = 147 |
366 | ClientWidth = 636 | 376 | ClientWidth = 636 |
367 | TabOrder = 5 | 377 | TabOrder = 5 |
368 | object CheckBoxShouldAskQuestion: TCheckBox | 378 | object CheckBoxShouldAskQuestion: TCheckBox |
@@ -374,10 +384,18 @@ object FormDesigner: TFormDesigner | @@ -374,10 +384,18 @@ object FormDesigner: TFormDesigner | ||
374 | OnChange = CheckBoxShouldAskQuestionChange | 384 | OnChange = CheckBoxShouldAskQuestionChange |
375 | TabOrder = 0 | 385 | TabOrder = 0 |
376 | end | 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 | object EditQuestion: TEdit | 395 | object EditQuestion: TEdit |
378 | Left = 50 | 396 | Left = 50 |
379 | Height = 25 | 397 | Height = 25 |
380 | - Top = 26 | 398 | + Top = 46 |
381 | Width = 536 | 399 | Width = 536 |
382 | OnEditingDone = EditQuestionEditingDone | 400 | OnEditingDone = EditQuestionEditingDone |
383 | TabOrder = 1 | 401 | TabOrder = 1 |
@@ -387,7 +405,7 @@ object FormDesigner: TFormDesigner | @@ -387,7 +405,7 @@ object FormDesigner: TFormDesigner | ||
387 | object CGQuestion: TCheckGroup | 405 | object CGQuestion: TCheckGroup |
388 | Left = 50 | 406 | Left = 50 |
389 | Height = 71 | 407 | Height = 71 |
390 | - Top = 56 | 408 | + Top = 76 |
391 | Width = 536 | 409 | Width = 536 |
392 | AutoFill = True | 410 | AutoFill = True |
393 | Caption = 'O que deve acontecer quando todos responderem sim?' | 411 | Caption = 'O que deve acontecer quando todos responderem sim?' |
@@ -416,7 +434,7 @@ object FormDesigner: TFormDesigner | @@ -416,7 +434,7 @@ object FormDesigner: TFormDesigner | ||
416 | object RGEndCriteriaStyle: TRadioGroup | 434 | object RGEndCriteriaStyle: TRadioGroup |
417 | Left = 0 | 435 | Left = 0 |
418 | Height = 80 | 436 | Height = 80 |
419 | - Top = 422 | 437 | + Top = 442 |
420 | Width = 640 | 438 | Width = 640 |
421 | AutoFill = True | 439 | AutoFill = True |
422 | Caption = 'Estilo do critério de finalização da condição' | 440 | Caption = 'Estilo do critério de finalização da condição' |
@@ -441,7 +459,7 @@ object FormDesigner: TFormDesigner | @@ -441,7 +459,7 @@ object FormDesigner: TFormDesigner | ||
441 | object GBEndCriteria: TGroupBox | 459 | object GBEndCriteria: TGroupBox |
442 | Left = 0 | 460 | Left = 0 |
443 | Height = 109 | 461 | Height = 109 |
444 | - Top = 507 | 462 | + Top = 527 |
445 | Width = 640 | 463 | Width = 640 |
446 | Caption = 'Valores do critério de finalização da condição' | 464 | Caption = 'Valores do critério de finalização da condição' |
447 | ChildSizing.LeftRightSpacing = 50 | 465 | ChildSizing.LeftRightSpacing = 50 |
@@ -527,7 +545,7 @@ object FormDesigner: TFormDesigner | @@ -527,7 +545,7 @@ object FormDesigner: TFormDesigner | ||
527 | object GBContingencies: TGroupBox | 545 | object GBContingencies: TGroupBox |
528 | Left = 0 | 546 | Left = 0 |
529 | Height = 97 | 547 | Height = 97 |
530 | - Top = 621 | 548 | + Top = 641 |
531 | Width = 640 | 549 | Width = 640 |
532 | Caption = 'Contingências e Metacontingências' | 550 | Caption = 'Contingências e Metacontingências' |
533 | ClientHeight = 80 | 551 | ClientHeight = 80 |
@@ -553,8 +571,8 @@ object FormDesigner: TFormDesigner | @@ -553,8 +571,8 @@ object FormDesigner: TFormDesigner | ||
553 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize | 571 | ChildSizing.EnlargeHorizontal = crsHomogenousChildResize |
554 | ChildSizing.Layout = cclLeftToRightThenTopToBottom | 572 | ChildSizing.Layout = cclLeftToRightThenTopToBottom |
555 | ChildSizing.ControlsPerLine = 1 | 573 | ChildSizing.ControlsPerLine = 1 |
556 | - ClientHeight = 583 | ||
557 | - ClientWidth = 650 | 574 | + ClientHeight = 711 |
575 | + ClientWidth = 640 | ||
558 | Enabled = False | 576 | Enabled = False |
559 | object RGContingencyType: TRadioGroup | 577 | object RGContingencyType: TRadioGroup |
560 | Left = 0 | 578 | Left = 0 |
@@ -626,6 +644,7 @@ object FormDesigner: TFormDesigner | @@ -626,6 +644,7 @@ object FormDesigner: TFormDesigner | ||
626 | Top = 0 | 644 | Top = 0 |
627 | Width = 171 | 645 | Width = 171 |
628 | Caption = 'Reordenar' | 646 | Caption = 'Reordenar' |
647 | + OnClick = BtnReorderContingencyClick | ||
629 | TabOrder = 2 | 648 | TabOrder = 2 |
630 | end | 649 | end |
631 | end | 650 | end |
experiment_designer/form_main.pas
@@ -20,6 +20,7 @@ type | @@ -20,6 +20,7 @@ type | ||
20 | BtnReorderCond: TButton; | 20 | BtnReorderCond: TButton; |
21 | BtnReorderContingency: TButton; | 21 | BtnReorderContingency: TButton; |
22 | CGGlobal: TCheckGroup; | 22 | CGGlobal: TCheckGroup; |
23 | + ChkDotsCleanDots: TCheckBox; | ||
23 | ChkColors: TCheckBox; | 24 | ChkColors: TCheckBox; |
24 | ChkRows: TCheckBox; | 25 | ChkRows: TCheckBox; |
25 | ChkCols: TCheckBox; | 26 | ChkCols: TCheckBox; |
@@ -48,6 +49,7 @@ type | @@ -48,6 +49,7 @@ type | ||
48 | GBContingencyRows: TGroupBox; | 49 | GBContingencyRows: TGroupBox; |
49 | GBContingencyConsequence: TGroupBox; | 50 | GBContingencyConsequence: TGroupBox; |
50 | GBMatrix: TGroupBox; | 51 | GBMatrix: TGroupBox; |
52 | + LabelQuestion: TLabel; | ||
51 | LabelPointsOnConditionBegin: TLabel; | 53 | LabelPointsOnConditionBegin: TLabel; |
52 | LabelC1: TLabel; | 54 | LabelC1: TLabel; |
53 | LabelC2: TLabel; | 55 | LabelC2: TLabel; |
@@ -97,6 +99,9 @@ type | @@ -97,6 +99,9 @@ type | ||
97 | procedure BtnAppendContingencyClick(Sender: TObject); | 99 | procedure BtnAppendContingencyClick(Sender: TObject); |
98 | procedure BtnRemoveCondClick(Sender: TObject); | 100 | procedure BtnRemoveCondClick(Sender: TObject); |
99 | procedure BtnRemoveContingencyClick(Sender: TObject); | 101 | procedure BtnRemoveContingencyClick(Sender: TObject); |
102 | + procedure BtnReorderCondClick(Sender: TObject); | ||
103 | + procedure BtnReorderContingencyClick(Sender: TObject); | ||
104 | + procedure ChkDotsCleanDotsChange(Sender: TObject); | ||
100 | // | 105 | // |
101 | procedure ConsequenceMessageEditingDone(Sender: TObject); | 106 | procedure ConsequenceMessageEditingDone(Sender: TObject); |
102 | procedure ConsequenceStyleChange(Sender: TObject); | 107 | procedure ConsequenceStyleChange(Sender: TObject); |
@@ -321,7 +326,10 @@ begin | @@ -321,7 +326,10 @@ begin | ||
321 | LC += '1'; | 326 | LC += '1'; |
322 | with FExperiment do | 327 | with FExperiment do |
323 | if ValueExists(LS,LC+KEY_CONT_NAME) and (not FLoading) then | 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 | end; | 334 | end; |
327 | end; | 335 | end; |
@@ -1126,13 +1134,28 @@ end; | @@ -1126,13 +1134,28 @@ end; | ||
1126 | procedure TFormDesigner.ChkCleanDotsChange(Sender: TObject); | 1134 | procedure TFormDesigner.ChkCleanDotsChange(Sender: TObject); |
1127 | begin | 1135 | begin |
1128 | if ChkCleanDots.Checked then | 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 | end; | 1141 | end; |
1131 | 1142 | ||
1132 | procedure TFormDesigner.ChkDotsChange(Sender: TObject); | 1143 | procedure TFormDesigner.ChkDotsChange(Sender: TObject); |
1133 | begin | 1144 | begin |
1134 | if ChkDots.Checked then | 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 | end; | 1159 | end; |
1137 | 1160 | ||
1138 | procedure TFormDesigner.ComboCurrentConditionChange(Sender: TObject); | 1161 | procedure TFormDesigner.ComboCurrentConditionChange(Sender: TObject); |
@@ -1239,13 +1262,14 @@ begin | @@ -1239,13 +1262,14 @@ begin | ||
1239 | LC + '|' + EditContingencyName.Text; | 1262 | LC + '|' + EditContingencyName.Text; |
1240 | ComboCurrentContingency.ItemIndex := i; | 1263 | ComboCurrentContingency.ItemIndex := i; |
1241 | SaveContingency(LS,LC); | 1264 | SaveContingency(LS,LC); |
1242 | - ListBoxContingencies.Items.Text := ComboCurrentContingency.Items.Text; | 1265 | + UpdateContingencyList(LS); |
1243 | end; | 1266 | end; |
1244 | 1267 | ||
1245 | procedure TFormDesigner.BtnRemoveCondClick(Sender: TObject); | 1268 | procedure TFormDesigner.BtnRemoveCondClick(Sender: TObject); |
1246 | var | 1269 | var |
1247 | i: integer; | 1270 | i: integer; |
1248 | MustReorder: boolean; | 1271 | MustReorder: boolean; |
1272 | + LS: String; | ||
1249 | 1273 | ||
1250 | procedure Reorder(index : integer); | 1274 | procedure Reorder(index : integer); |
1251 | var | 1275 | var |
@@ -1277,27 +1301,34 @@ var | @@ -1277,27 +1301,34 @@ var | ||
1277 | end; | 1301 | end; |
1278 | 1302 | ||
1279 | begin | 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 | end; | 1325 | end; |
1296 | 1326 | ||
1297 | procedure TFormDesigner.BtnRemoveContingencyClick(Sender: TObject); | 1327 | procedure TFormDesigner.BtnRemoveContingencyClick(Sender: TObject); |
1298 | var | 1328 | var |
1299 | i: integer; | 1329 | i: integer; |
1300 | MustReorder: boolean; | 1330 | MustReorder: boolean; |
1331 | + LS, LC: String; | ||
1301 | 1332 | ||
1302 | procedure ReadContingencyValuesInSection(LS,LC : string; var Keys : TStringList); | 1333 | procedure ReadContingencyValuesInSection(LS,LC : string; var Keys : TStringList); |
1303 | begin | 1334 | begin |
@@ -1322,43 +1353,65 @@ var | @@ -1322,43 +1353,65 @@ var | ||
1322 | begin | 1353 | begin |
1323 | SectionKeys := TStringList.Create; | 1354 | SectionKeys := TStringList.Create; |
1324 | with FExperiment do | 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 | SectionKeys.Free; | 1374 | SectionKeys.Free; |
1343 | end; | 1375 | end; |
1344 | 1376 | ||
1345 | begin | 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 | end; | 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 | procedure TFormDesigner.ConsequenceStyleChange(Sender: TObject); | 1415 | procedure TFormDesigner.ConsequenceStyleChange(Sender: TObject); |
1363 | var | 1416 | var |
1364 | LS, LC: String; | 1417 | LS, LC: String; |