Changeset 116
- Timestamp:
- Nov 27, 2017, 10:04:52 AM (7 years ago)
- Location:
- branches/generator
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormRule.lfm
r114 r116 1 1 object FormRule: TFormRule 2 2 Left = 507 3 Height = 5 053 Height = 514 4 4 Top = 293 5 Width = 66 05 Width = 663 6 6 ActiveControl = ButtonOk 7 7 Caption = 'Rule' 8 ClientHeight = 505 9 ClientWidth = 660 8 ClientHeight = 514 9 ClientWidth = 663 10 OnCreate = FormCreate 10 11 OnShow = FormShow 11 12 LCLVersion = '1.6.4.0' … … 13 14 Left = 376 14 15 Height = 25 15 Top = 4 6716 Top = 476 16 17 Width = 75 17 18 Anchors = [akLeft, akBottom] … … 23 24 Left = 168 24 25 Height = 25 25 Top = 4 6726 Top = 476 26 27 Width = 75 27 28 Anchors = [akLeft, akBottom] … … 31 32 end 32 33 object Label1: TLabel 33 Left = 2434 Left = 16 34 35 Height = 20 35 Top = 2936 Top = 16 36 37 Width = 43 37 38 Caption = 'Name:' 38 39 ParentColor = False 39 40 end 40 object EditName: TEdit 41 Left = 184 42 Height = 28 43 Top = 19 44 Width = 392 41 object PageControl1: TPageControl 42 Left = 16 43 Height = 421 44 Top = 48 45 Width = 640 46 ActivePage = TabSheet1 47 Anchors = [akTop, akLeft, akRight, akBottom] 48 TabIndex = 0 45 49 TabOrder = 2 46 end 47 object ListView: TListView 48 Left = 16 49 Height = 307 50 Top = 112 51 Width = 624 52 Anchors = [akTop, akLeft, akRight, akBottom] 53 Columns = < 54 item 55 Caption = 'Name' 56 Width = 604 57 end> 58 MultiSelect = True 59 OwnerData = True 60 PopupMenu = PopupMenu1 61 ReadOnly = True 62 RowSelect = True 63 TabOrder = 3 64 ViewStyle = vsReport 65 OnData = ListViewData 66 OnDblClick = ListViewDblClick 67 OnKeyPress = ListViewKeyPress 68 OnSelectItem = ListViewSelectItem 69 end 70 object Label2: TLabel 71 Left = 24 72 Height = 20 73 Top = 64 74 Width = 63 75 Caption = 'Operator:' 76 ParentColor = False 77 end 78 object ComboBox1: TComboBox 79 Left = 186 80 Height = 28 81 Top = 61 82 Width = 390 83 ItemHeight = 20 84 Items.Strings = ( 85 'And' 86 'Or' 87 ) 88 Style = csDropDownList 89 TabOrder = 4 90 end 91 object ToolBar1: TToolBar 92 Left = 16 93 Height = 26 94 Top = 424 95 Width = 624 96 Align = alCustom 97 Anchors = [akLeft, akRight, akBottom] 98 Caption = 'ToolBar1' 99 Images = Core.ImageList1 100 TabOrder = 5 101 object ToolButton1: TToolButton 102 Left = 1 103 Top = 2 104 Action = AAdd 50 object TabSheet1: TTabSheet 51 Caption = 'Items' 105 52 end 106 object ToolButton2: TToolButton 107 Left = 24 108 Top = 2 109 Action = AModify 110 end 111 object ToolButton3: TToolButton 112 Left = 47 113 Top = 2 114 Action = ARemove 115 end 116 object ToolButton4: TToolButton 117 Left = 70 118 Top = 2 119 Action = AMoveUp 120 end 121 object ToolButton5: TToolButton 122 Left = 93 123 Top = 2 124 Action = AMoveDown 53 object TabSheet2: TTabSheet 54 Caption = 'Links' 125 55 end 126 56 end 127 object ActionList1: TActionList 128 Images = Core.ImageList1 129 left = 347 130 top = 187 131 object AAdd: TAction 132 Caption = 'Add' 133 ImageIndex = 0 134 OnExecute = AAddExecute 135 end 136 object AModify: TAction 137 Caption = 'Modify' 138 ImageIndex = 3 139 OnExecute = AModifyExecute 140 end 141 object ARemove: TAction 142 Caption = 'Remove' 143 ImageIndex = 1 144 OnExecute = ARemoveExecute 145 end 146 object AMoveUp: TAction 147 Caption = 'Move up' 148 ImageIndex = 7 149 OnExecute = AMoveUpExecute 150 end 151 object AMoveDown: TAction 152 Caption = 'Move down' 153 ImageIndex = 6 154 OnExecute = AMoveDownExecute 155 end 156 end 157 object PopupMenu1: TPopupMenu 158 Images = Core.ImageList1 159 left = 118 160 top = 187 161 object MenuItem1: TMenuItem 162 Action = AAdd 163 Bitmap.Data = { 164 36040000424D3604000000000000360000002800000010000000100000000100 165 2000000000000004000064000000640000000000000000000000000000000000 166 0000000000000000000000000000000000000000000000000000000000000000 167 0000000000000000000000000000000000000000000000000000000000000000 168 000000000000000000000000000000000000D4D4D4FFB2B2B2FFB2B2B2FFD4D4 169 D4FF000000000000000000000000000000000000000000000000000000000000 170 0000000000000000000000000000709B70FF004A00FF004800FF4E764EFFB2B2 171 B2FF000000000000000000000000000000000000000000000000000000000000 172 0000000000000000000000000000004E00FF00C800FF00C400FF004800FFB2B2 173 B2FF000000000000000000000000000000000000000000000000000000000000 174 0000000000000000000000000000005000FF00CA00FF00C600FF004A00FFB2B2 175 B2FF000000000000000000000000000000000000000000000000000000000000 176 0000000000000000000000000000005300FF00CE00FF00CA00FF004C00FFB2B2 177 B2FF00000000000000000000000000000000000000000000000000000000D4D4 178 D4FFB2B2B2FFB2B2B2FFB2B2B2FF005400FF00D200FF00CE00FF004E00FFB2B2 179 B2FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2B2FFD4D4D4FF0000000070A670FF005E 180 00FF005C00FF005A00FF005800FF005600FF00D600FF00D000FF005000FF004E 181 00FF004C00FF004A00FF004A00FF4E764EFFB2B2B2FF00000000006200FF8CFE 182 8CFF00EA00FF00E600FF00E200FF00DE00FF00DA00FF00D400FF00D000FF00CC 183 00FF00C800FF00C400FF00C200FF004800FFB2B2B2FF00000000006400FFECFF 184 ECFF8CFE8CFF8CFE8CFF8CFE8CFF8CFE8CFF00DE00FF00D900FF00D400FF00D0 185 00FF00CC00FF00C800FF00C400FF004A00FFD4D4D4FF0000000070A970FF0064 186 00FF006400FF006200FF006000FF006000FF8CFE8CFF00DD00FF005800FF0056 187 00FF005400FF005300FF005000FF709C70FF0000000000000000000000000000 188 0000000000000000000000000000006000FF8CFE8CFF00E000FF005A00FFB2B2 189 B2FF000000000000000000000000000000000000000000000000000000000000 190 0000000000000000000000000000006200FF8CFE8CFF00E500FF005C00FFB2B2 191 B2FF000000000000000000000000000000000000000000000000000000000000 192 0000000000000000000000000000006400FF8CFE8CFF00E800FF005E00FFB2B2 193 B2FF000000000000000000000000000000000000000000000000000000000000 194 0000000000000000000000000000006400FFECFFECFF8CFE8CFF006000FFD4D4 195 D4FF000000000000000000000000000000000000000000000000000000000000 196 000000000000000000000000000070A970FF006400FF006200FF70A670FF0000 197 0000000000000000000000000000000000000000000000000000 198 } 199 end 200 object MenuItem2: TMenuItem 201 Action = AModify 202 Bitmap.Data = { 203 36040000424D3604000000000000360000002800000010000000100000000100 204 2000000000000004000064000000640000000000000000000000986B37FF976A 205 36FF966935FF966734FF956633FF946532FF946531FF936430FF92622FFF9261 206 2EFF91602DFF90602CFF905F2BFF8F5D2AFF8E5C29FF8D5B28FF996C38FFF8F7 207 F6FFF8F7F5FFF7F6F5FFF6F6F4FFF6F5F3FFF5F5F3FFF5F4F2FFF4F3F1FFF4F3 208 F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F0EEFFF1F0EDFF8E5D29FF996D3AFFF9F8 209 F7FF959594FF878787FF9B9A9AFFF7F6F4FFF6F5F3FFF6F5F3FFF5F4F2FFF4F3 210 F1FFF4F3F1FFF3F2F0FFF3F2EFFFF2F1EFFFF2F1EEFF8F5E2AFF9A6E3BFFF9F9 211 F8FF7C7C7CFFC4C4C4FF878787FFF7F6F5FF7A7A7AFF787878FF747474FF7171 212 70FF6D6D6CFF696968FF656565FF616161FFF2F1EFFF905F2BFF9B6F3CFFFAF9 213 F8FFBEBEBDFF929292FFBCBCBBFFF8F7F6FFF7F7F5FFF7F6F4FFF6F5F4FFF6F5 214 F3FFF5F4F2FFF5F4F2FFF4F3F1FFF4F2F0FFF3F2F0FF91602DFF9C703DFFFAFA 215 F9FFFAF9F9FFF9F9F8FFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6F5FFF6F5 216 F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FFF4F3F0FF92612EFF9D723EFFFBFB 217 FAFF9F9F9EFF7F7F7FFFAEAEADFFF9F8F7FFF8F8F7FFF8F7F6FFF7F7F5FFF7F6 218 F5FFF6F6F4FFF6F5F3FFF5F4F3FFF5F4F2FFF4F3F1FF92622FFF9D7340FFFCFB 219 FBFF818181FFC4C4C4FF8F8F8FFFFAF9F8FF7B7B7AFF797979FF757574FF7271 220 71FF6D6D6DFF696969FF666665FF626261FFF5F4F2FF936430FF9E7441FFFCFC 221 FCFFB5B5B5FF848484FFBEBDBDFFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FFF8F8 222 F6FFF8F7F5FFF7F6F5FFF7F6F4FFF6F5F3FFF6F5F3FF946531FF9F7542FFFDFD 223 FCFFFCFCFCFFFCFCFBFFFBFBFAFFFBFAFAFFFAFAF9FFFAF9F8FFF9F9F8FFF9F8 224 F7FFF8F8F6FFF8F7F6FFF7F6F5FFF7F6F4FFF6F5F4FF956633FFA07643FFFEFD 225 FDFF8C8C8CFF525252FFA4A4A4FFFBFBFAFFFBFBFAFFFAFAF9FFFAF9F8FFF9F9 226 F8FFF9F8F7FFF8F8F6FFF8F7F6FFF7F7F5FFF7F6F4FF966734FFA17844FFFEFE 227 FEFF5F5F5FFF949494FF535353FFFCFCFBFF7B7B7BFF797979FF757575FF7272 228 72FF6E6E6EFF6A6A69FF666666FF626262FFF7F7F5FF966935FFA17946FFFFFF 229 FFFF878787FF5D5D5DFFA0A0A0FFFDFCFCFFFCFCFBFFFCFBFBFFFBFBFAFFFBFA 230 F9FFFAFAF9FFFAF9F8FFF9F8F7FFF8F8F7FFF8F7F6FF976A36FFA27A47FFFFFF 231 FFFFFFFFFFFFFEFEFEFFFEFEFEFFFDFDFDFFFDFDFCFFFCFCFBFFFCFBFBFFFBFB 232 FAFFFBFAF9FFFAFAF9FFFAF9F8FFF9F9F7FFF9F8F7FF986B37FFA37B48FFBEA2 233 7FFFBEA17EFFBDA17DFFBDA07CFFBD9F7CFFBC9F7BFFBB9E7AFFBB9D7AFFBB9D 234 79FFBA9C78FFB99B78FFB99A77FFB89A76FFB89975FF996C39FFA37B48FFA37B 235 48FFA27A47FFA27946FFA17845FFA07744FFA07643FF9F7542FF9E7441FF9E73 236 40FF9D723FFF9C713EFF9C703DFF9B6F3CFF9A6E3BFF9A6D3AFF 237 } 238 end 239 object MenuItem3: TMenuItem 240 Action = ARemove 241 Bitmap.Data = { 242 36040000424D3604000000000000360000002800000010000000100000000100 243 2000000000000004000064000000640000000000000000000000000000000000 244 0000000000000000000000000000000000000000000000000000000000000000 245 0000000000000000000000000000000000000000000000000000000000000000 246 0000000000000000000000000000000000000000000000000000000000000000 247 0000000000000000000000000000000000003A3AE2FFC0C0C0FF000000000000 248 000000000000000000003A3AE2FFC0C0C0FF0000000000000000000000000000 249 0000000000000000000000000000000000000000000000000000000000000000 250 0000000000003A3AE2FF3A3AE2FF3A3AE2FFC0C0C0FF00000000000000000000 251 00000000000000000000000000003A3AE2FFC0C0C0FF00000000000000000000 252 0000000000003A3AE2FF3A3AE2FF3A3AE2FFC0C0C0FF00000000000000000000 253 000000000000000000003A3AE2FFC0C0C0FF0000000000000000000000000000 254 000000000000000000003838E0FF3838E0FF3838E0FFC0C0C0FF000000000000 255 0000000000003838E0FF3838E0FFC0C0C0FF0000000000000000000000000000 256 00000000000000000000000000003535DDFF3535DDFF3535DDFFC0C0C0FF0000 257 00003535DDFF3535DDFFC0C0C0FF000000000000000000000000000000000000 258 0000000000000000000000000000000000003232DAFF3232DAFF3232DAFF3232 259 DAFF3232DAFFC0C0C0FF00000000000000000000000000000000000000000000 260 000000000000000000000000000000000000000000002F2FD7FF2F2FD7FF2F2F 261 D7FFC0C0C0FF0000000000000000000000000000000000000000000000000000 262 0000000000000000000000000000000000002C2CD4FF2C2CD4FF2C2CD4FF2C2C 263 D4FF2C2CD4FFC0C0C0FF00000000000000000000000000000000000000000000 264 00000000000000000000000000002929D1FF2929D1FF2929D1FFC0C0C0FF0000 265 00002929D1FFC0C0C0FF00000000000000000000000000000000000000000000 266 0000000000002626CEFF2626CEFF2626CEFF2626CEFFC0C0C0FF000000000000 267 0000000000002626CEFF2626CEFFC0C0C0FF0000000000000000000000000000 268 00002020C8FF2020C8FF2020C8FF2020C8FFC0C0C0FF00000000000000000000 269 000000000000000000002020C8FF2020C8FFC0C0C0FF00000000000000000000 270 00001818C0FF1818C0FFC0C0C0FF000000000000000000000000000000000000 271 00000000000000000000000000001818C0FF1818C0FFC0C0C0FF000000000000 272 0000000000000000000000000000000000000000000000000000000000000000 273 0000000000000000000000000000000000000000000000000000000000000000 274 0000000000000000000000000000000000000000000000000000000000000000 275 0000000000000000000000000000000000000000000000000000 276 } 277 end 278 object MenuItem4: TMenuItem 279 Action = AMoveUp 280 Bitmap.Data = { 281 36040000424D3604000000000000360000002800000010000000100000000100 282 2000000000000004000064000000640000000000000000000000000000000000 283 0000000000000000000000000000000000000000000000000000000000000000 284 0000000000000000000000000000000000000000000000000000000000000000 285 0000000000000000000000000000000000FF000000FF000000FF000000FF0000 286 00FF000000FF000000FF00000000000000000000000000000000000000000000 287 0000000000000000000000000000000000FFFF442CFFFF3C28FFFF3522FFFF2E 288 1EFFFF2619FF000000FF00000000000000000000000000000000000000000000 289 0000000000000000000000000000000000FFFF5337FFFF4C32FFFF442CFFFF3C 290 28FFFF3623FF000000FF00000000000000000000000000000000000000000000 291 0000000000000000000000000000000000FFFF6341FFFF5C3BFFFF5437FFFF4C 292 32FFFF442CFF000000FF00000000000000000000000000000000000000000000 293 0000000000000000000000000000000000FFFF724AFFFF6B46FFFF6441FFFF5D 294 3CFFFF5437FF000000FF00000000000000000000000000000000000000000000 295 0000000000000000000000000000000000FFFF8255FFFF7A4FFFFF744BFFFF6C 296 46FFFF6441FF000000FF00000000000000000000000000000000000000000000 297 0000000000000000000000000000000000FFFF915FFFFF8A5AFFFF8255FFFF7C 298 51FFFF744CFF000000FF00000000000000000000000000000000000000000000 299 00FF000000FF000000FF000000FF000000FFFFA169FFFF9A65FFFF9360FFFF8A 300 5AFFFF8456FF000000FF000000FF000000FF000000FF000000FF000000000000 301 0000000000FFFFC681FFFFBF7DFFFFB878FFFFB073FFFFAA6EFFFFA269FFFF9A 302 65FFFF9360FFFF8C5BFFFF8456FFFF7C51FF000000FF00000000000000000000 303 000000000000000000FFFFCF87FFFFC882FFFFC17DFFFFB878FFFFB174FFFFAA 304 6EFFFFA269FFFF9A65FFFF9461FF000000FF0000000000000000000000000000 305 00000000000000000000000000FFFFD78CFFFFD088FFFFC882FFFFC17DFFFFBA 306 79FFFFB374FFFFAA6EFF000000FF000000000000000000000000000000000000 307 0000000000000000000000000000000000FFFFE092FFFFD88CFFFFD088FFFFC8 308 82FFFFC27EFF000000FF00000000000000000000000000000000000000000000 309 000000000000000000000000000000000000000000FFFFE797FFFFE092FFFFD8 310 8CFF000000FF0000000000000000000000000000000000000000000000000000 311 00000000000000000000000000000000000000000000000000FFFFF09CFF0000 312 00FF000000000000000000000000000000000000000000000000000000000000 313 0000000000000000000000000000000000000000000000000000000000FF0000 314 0000000000000000000000000000000000000000000000000000 315 } 316 end 317 object MenuItem5: TMenuItem 318 Action = AMoveDown 319 Bitmap.Data = { 320 36040000424D3604000000000000360000002800000010000000100000000100 321 2000000000000004000064000000640000000000000000000000000000000000 322 00000000000000000000000000000000000000000000000000FF000000000000 323 0000000000000000000000000000000000000000000000000000000000000000 324 000000000000000000000000000000000000000000FFFFF09CFF000000FF0000 325 0000000000000000000000000000000000000000000000000000000000000000 326 0000000000000000000000000000000000FFFFD88CFFFFE092FFFFE797FF0000 327 00FF000000000000000000000000000000000000000000000000000000000000 328 00000000000000000000000000FFFFC27EFFFFC882FFFFD088FFFFD88CFFFFE0 329 92FF000000FF0000000000000000000000000000000000000000000000000000 330 000000000000000000FFFFAA6EFFFFB374FFFFBA79FFFFC17DFFFFC882FFFFD0 331 88FFFFD78CFF000000FF00000000000000000000000000000000000000000000 332 0000000000FFFF9461FFFF9A65FFFFA269FFFFAA6EFFFFB174FFFFB878FFFFC1 333 7DFFFFC882FFFFCF87FF000000FF000000000000000000000000000000000000 334 00FFFF7C51FFFF8456FFFF8C5BFFFF9360FFFF9A65FFFFA269FFFFAA6EFFFFB0 335 73FFFFB878FFFFBF7DFFFFC681FF000000FF0000000000000000000000FF0000 336 00FF000000FF000000FF000000FFFF8456FFFF8A5AFFFF9360FFFF9A65FFFFA1 337 69FF000000FF000000FF000000FF000000FF000000FF00000000000000000000 338 00000000000000000000000000FFFF744CFFFF7C51FFFF8255FFFF8A5AFFFF91 339 5FFF000000FF0000000000000000000000000000000000000000000000000000 340 00000000000000000000000000FFFF6441FFFF6C46FFFF744BFFFF7A4FFFFF82 341 55FF000000FF0000000000000000000000000000000000000000000000000000 342 00000000000000000000000000FFFF5437FFFF5D3CFFFF6441FFFF6B46FFFF72 343 4AFF000000FF0000000000000000000000000000000000000000000000000000 344 00000000000000000000000000FFFF442CFFFF4C32FFFF5437FFFF5C3BFFFF63 345 41FF000000FF0000000000000000000000000000000000000000000000000000 346 00000000000000000000000000FFFF3623FFFF3C28FFFF442CFFFF4C32FFFF53 347 37FF000000FF0000000000000000000000000000000000000000000000000000 348 00000000000000000000000000FFFF2619FFFF2E1EFFFF3522FFFF3C28FFFF44 349 2CFF000000FF0000000000000000000000000000000000000000000000000000 350 00000000000000000000000000FF000000FF000000FF000000FF000000FF0000 351 00FF000000FF0000000000000000000000000000000000000000000000000000 352 0000000000000000000000000000000000000000000000000000000000000000 353 0000000000000000000000000000000000000000000000000000 354 } 355 end 57 object EditName: TEdit 58 Left = 135 59 Height = 28 60 Top = 11 61 Width = 433 62 TabOrder = 3 356 63 end 357 64 end -
branches/generator/Forms/UFormRule.pas
r113 r116 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, ActnList, Menus, URules ;9 ComCtrls, ActnList, Menus, URules, UFormRuleItems; 10 10 11 11 type … … 14 14 15 15 TFormRule = class(TForm) 16 AAdd: TAction;17 AMoveUp: TAction;18 AMoveDown: TAction;19 AModify: TAction;20 ARemove: TAction;21 ActionList1: TActionList;22 16 ButtonOk: TButton; 23 17 ButtonCancel: TButton; 24 ComboBox1: TComboBox;25 18 EditName: TEdit; 26 19 Label1: TLabel; 27 Label2: TLabel; 28 ListView: TListView; 29 MenuItem1: TMenuItem; 30 MenuItem2: TMenuItem; 31 MenuItem3: TMenuItem; 32 MenuItem4: TMenuItem; 33 MenuItem5: TMenuItem; 34 PopupMenu1: TPopupMenu; 35 ToolBar1: TToolBar; 36 ToolButton1: TToolButton; 37 ToolButton2: TToolButton; 38 ToolButton3: TToolButton; 39 ToolButton4: TToolButton; 40 ToolButton5: TToolButton; 41 procedure AAddExecute(Sender: TObject); 42 procedure AModifyExecute(Sender: TObject); 43 procedure AMoveDownExecute(Sender: TObject); 44 procedure AMoveUpExecute(Sender: TObject); 45 procedure ARemoveExecute(Sender: TObject); 20 PageControl1: TPageControl; 21 TabSheet1: TTabSheet; 22 TabSheet2: TTabSheet; 23 procedure FormCreate(Sender: TObject); 46 24 procedure FormShow(Sender: TObject); 47 procedure ListViewData(Sender: TObject; Item: TListItem);48 procedure ListViewDblClick(Sender: TObject);49 procedure ListViewKeyPress(Sender: TObject; var Key: char);50 procedure ListViewSelectItem(Sender: TObject; Item: TListItem;51 Selected: Boolean);52 25 private 53 { private declarations }26 FormRuleItems: TFormRuleItems; 54 27 public 55 28 Rule: TRule; 56 procedure UpdateInterface;57 procedure ReloadList;58 29 procedure LoadData(Rule: TRule); 59 30 procedure SaveData(Rule: TRule); … … 76 47 begin 77 48 EditName.SetFocus; 78 ReloadList;79 UpdateInterface;80 49 end; 81 50 82 procedure TFormRule. ListViewData(Sender: TObject; Item: TListItem);51 procedure TFormRule.FormCreate(Sender: TObject); 83 52 begin 84 if (Item.Index >= 0) and (Item.Index < Rule.Items.Count) then begin 85 Item.Caption := Rule.Items[Item.Index].GetBNF; 86 Item.Data := Rule.Items[Item.Index]; 87 end; 88 end; 89 90 procedure TFormRule.ListViewDblClick(Sender: TObject); 91 begin 92 AModify.Execute; 93 end; 94 95 procedure TFormRule.ListViewKeyPress(Sender: TObject; var Key: char); 96 begin 97 if Key = #13 then AModify.Execute; 98 end; 99 100 procedure TFormRule.ListViewSelectItem(Sender: TObject; Item: TListItem; 101 Selected: Boolean); 102 begin 103 UpdateInterface; 104 end; 105 106 procedure TFormRule.AAddExecute(Sender: TObject); 107 var 108 NewRuleItem: TRuleItem; 109 begin 110 NewRuleItem := TRuleItem.Create; 111 NewRuleItem.Grammer := Rule.Grammer; 112 FormRuleItem.LoadData(NewRuleItem); 113 if FormRuleItem.ShowModal = mrOk then begin 114 FormRuleItem.SaveData(NewRuleItem); 115 NewRuleItem.ParentRule := Rule; 116 Rule.Items.Add(NewRuleItem); 117 ReloadList; 118 end else FreeAndNil(NewRuleItem); 119 end; 120 121 procedure TFormRule.AModifyExecute(Sender: TObject); 122 var 123 RuleItem: TRuleItem; 124 begin 125 RuleItem := TRuleItem(ListView.Selected.Data); 126 FormRuleItem.LoadData(RuleItem); 127 if FormRuleItem.ShowModal = mrOk then begin 128 FormRuleItem.SaveData(RuleItem); 129 ReloadList; 130 end; 131 end; 132 133 procedure TFormRule.AMoveDownExecute(Sender: TObject); 134 begin 135 Rule.Items.Move(ListView.Selected.Index, ListView.Selected.Index + 1); 136 // ShowMessage(IntToStr(ListView.ItemIndex)); 137 ListView.ItemIndex := ListView.Selected.Index + 1; 138 // ShowMessage(IntToStr(ListView.ItemIndex)); 139 ReloadList; 140 end; 141 142 procedure TFormRule.AMoveUpExecute(Sender: TObject); 143 begin 144 Rule.Items.Move(ListView.Selected.Index, ListView.Selected.Index - 1); 145 ListView.ItemIndex := ListView.Selected.Index - 1; 146 ReloadList; 147 end; 148 149 procedure TFormRule.ARemoveExecute(Sender: TObject); 150 var 151 Item: TListItem; 152 begin 153 for Item in ListView.Items do 154 if Item.Selected then 155 Rule.Items.Remove(TRuleItem(Item.Data)); 156 ReloadList; 157 end; 158 159 procedure TFormRule.UpdateInterface; 160 begin 161 AModify.Enabled := Assigned(ListView.Selected); 162 ARemove.Enabled := Assigned(ListView.Selected); 163 AMoveUp.Enabled := Assigned(ListView.Selected) and (ListView.Selected.Index > 0); 164 AMoveDown.Enabled := Assigned(ListView.Selected) and (ListView.Selected.Index < (ListView.Items.Count - 1)); 165 end; 166 167 procedure TFormRule.ReloadList; 168 begin 169 ListView.Items.Count := Rule.Items.Count; 170 ListView.Refresh; 53 FormRuleItems := TFormRuleItems.Create(nil); 54 FormRuleItems.ManualDock(TabSheet1); 55 FormRuleItems.Align := alClient; 56 FormRuleItems.Show; 171 57 end; 172 58 … … 174 60 begin 175 61 Self.Rule := Rule; 176 ComboBox1.ItemIndex := Integer(Rule.RuleType);177 62 EditName.Text := Rule.Name; 178 Rule.Items := Rule.Items;63 FormRuleItems.LoadData(Rule.Items); 179 64 end; 180 65 181 66 procedure TFormRule.SaveData(Rule: TRule); 182 67 begin 183 Rule.RuleType := TRuleType(ComboBox1.ItemIndex);184 68 Rule.Name := EditName.Text; 69 FormRuleItems.SaveData(Rule.Items); 185 70 end; 186 71 -
branches/generator/Forms/UFormRules.lfm
r115 r116 8 8 ClientWidth = 857 9 9 OnClose = FormClose 10 OnCreate = FormCreate 10 11 OnShow = FormShow 11 12 LCLVersion = '1.6.4.0' -
branches/generator/Forms/UFormRules.pas
r114 r116 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, 9 9 ComCtrls, ActnList, Menus, URules; 10 10 … … 32 32 procedure ARemoveExecute(Sender: TObject); 33 33 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 34 procedure FormCreate(Sender: TObject); 34 35 procedure FormShow(Sender: TObject); 35 36 procedure ListView1Data(Sender: TObject; Item: TListItem); … … 107 108 end; 108 109 110 procedure TFormRules.FormCreate(Sender: TObject); 111 begin 112 Rules := nil; 113 end; 114 109 115 procedure TFormRules.ListView1Data(Sender: TObject; Item: TListItem); 110 116 begin … … 112 118 Item.Caption := Rules[Item.Index].Name; 113 119 Item.Data := Rules[Item.Index]; 114 Item.SubItems.Add(Rules[Item.Index].Items.GetBNF(Rules[Item.Index]. RuleType));120 Item.SubItems.Add(Rules[Item.Index].Items.GetBNF(Rules[Item.Index].Items.RuleType)); 115 121 end; 116 122 end; … … 140 146 procedure TFormRules.ReloadList; 141 147 begin 142 ListView1.Items.Count := Rules.Count; 148 if Assigned(Rules) then ListView1.Items.Count := Rules.Count 149 else ListView1.Items.Count := 0; 143 150 ListView1.Refresh; 144 151 end; -
branches/generator/URules.pas
r113 r116 34 34 35 35 TRuleItems = class(TFPGObjectList<TRuleItem>) 36 ParentRule: TRule; 36 37 Grammer: TGrammer; 38 RuleType: TRuleType; 37 39 procedure LoadFromXmlNode(Node: TDOMNode); 38 40 procedure SaveToXmlNode(Node: TDOMNode); 39 41 function GetBNF(RuleType: TRuleType): string; 42 end; 43 44 TRuleLinkType = (ltRequire); 45 46 TRuleLink = class 47 LinkType: TRuleLinkType; 48 Rule: TRule; 49 end; 50 51 TRuleLinks = class(TFPGObjectList<TRuleLink>) 52 40 53 end; 41 54 … … 49 62 Name: string; 50 63 Items: TRuleItems; 51 RuleType: TRuleType;64 Links: TRuleLinks; 52 65 property Grammer: TGrammer read GetGrammer write SetGrammer; 53 66 constructor Create; … … 184 197 RuleItemNode: TDOMNode; 185 198 begin 199 WriteInteger(Node, 'Type', Integer(RuleType)); 200 186 201 for RuleItem in Self do begin 187 202 RuleItemNode := Node.OwnerDocument.CreateElement('RuleItem'); … … 210 225 RuleItem: TRuleItem; 211 226 begin 227 RuleType := TRuleType(ReadInteger(Node, 'Type', Integer(rtAnd))); 228 212 229 RuleItemNode := Node.FirstChild; 213 230 while Assigned(RuleItemNode) do begin … … 229 246 begin 230 247 WriteString(Node, 'Name', Name); 231 WriteInteger(Node, 'Type', Integer(RuleType));232 248 233 249 RuleItemsNode := Node.OwnerDocument.CreateElement('RuleItems'); … … 238 254 function TRule.GetBNF: string; 239 255 begin 240 Result := Name + ' ::= ' + Items.GetBNF( RuleType);256 Result := Name + ' ::= ' + Items.GetBNF(Items.RuleType); 241 257 end; 242 258 … … 254 270 begin 255 271 Items := TRuleItems.Create; 272 Items.ParentRule := Self; 273 Links := TRuleLinks.Create; 256 274 end; 257 275 258 276 destructor TRule.Destroy; 259 277 begin 278 FreeAndNil(Links); 260 279 FreeAndNil(Items); 261 280 inherited Destroy; … … 267 286 begin 268 287 Name := ReadString(Node, 'Name', ''); 269 RuleType := TRuleType(ReadInteger(Node, 'Type', Integer(rtAnd)));270 288 271 289 ItemsNode := Node.FindNode('RuleItems'); -
branches/generator/generator.lpi
r115 r116 84 84 </Item3> 85 85 </RequiredPackages> 86 <Units Count=" 7">86 <Units Count="8"> 87 87 <Unit0> 88 88 <Filename Value="generator.lpr"/> … … 128 128 <ResourceBaseClass Value="Form"/> 129 129 </Unit6> 130 <Unit7> 131 <Filename Value="Forms/UFormRuleItems.pas"/> 132 <IsPartOfProject Value="True"/> 133 <ComponentName Value="FormRuleItems"/> 134 <ResourceBaseClass Value="Form"/> 135 </Unit7> 130 136 </Units> 131 137 </ProjectOptions> -
branches/generator/generator.lpr
r114 r116 9 9 Interfaces, // this includes the LCL widgetset 10 10 Forms, UCore, URules, Common, TemplateGenerics, UFormRule, UFormMain, 11 UFormRules, UFormRuleItem 11 UFormRules, UFormRuleItem, UFormRuleItems 12 12 { you can add units after this }; 13 13 … … 22 22 Application.CreateForm(TFormRules, FormRules); 23 23 Application.CreateForm(TFormRuleItem, FormRuleItem); 24 Application.CreateForm(TFormRuleItems, FormRuleItems); 24 25 Application.Run; 25 26 end. -
branches/generator/pascal.grm
r114 r116 4 4 <Rule> 5 5 <Name>BeginEnd</Name> 6 < Type>0</Type>7 <RuleItems>6 <RuleItems> 7 <Type>0</Type> 8 8 <RuleItem> 9 9 <Type>0</Type> … … 22 22 <Rule> 23 23 <Name>IfThenElse</Name> 24 < Type>0</Type>25 <RuleItems>24 <RuleItems> 25 <Type>0</Type> 26 26 <RuleItem> 27 27 <Type>0</Type> … … 56 56 <Rule> 57 57 <Name>WhileDo</Name> 58 < Type>0</Type>59 <RuleItems>58 <RuleItems> 59 <Type>0</Type> 60 60 <RuleItem> 61 61 <Type>0</Type> … … 78 78 <Rule> 79 79 <Name>RepeatUntil</Name> 80 < Type>0</Type>81 <RuleItems>80 <RuleItems> 81 <Type>0</Type> 82 82 <RuleItem> 83 83 <Type>0</Type> … … 100 100 <Rule> 101 101 <Name>ForToDo</Name> 102 < Type>0</Type>103 <RuleItems>102 <RuleItems> 103 <Type>0</Type> 104 104 <RuleItem> 105 105 <Type>0</Type> … … 138 138 <Rule> 139 139 <Name>WithDo</Name> 140 < Type>0</Type>141 <RuleItems>140 <RuleItems> 141 <Type>0</Type> 142 142 <RuleItem> 143 143 <Type>0</Type> … … 160 160 <Rule> 161 161 <Name>CaseOf</Name> 162 < Type>0</Type>163 <RuleItems>162 <RuleItems> 163 <Type>0</Type> 164 164 <RuleItem> 165 165 <Type>0</Type> … … 182 182 <Rule> 183 183 <Name>Assignment</Name> 184 < Type>0</Type>185 <RuleItems>184 <RuleItems> 185 <Type>0</Type> 186 186 <RuleItem> 187 187 <Type>1</Type> … … 200 200 <Rule> 201 201 <Name>Statement</Name> 202 < Type>1</Type>203 <RuleItems>202 <RuleItems> 203 <Type>0</Type> 204 204 <RuleItem> 205 205 <Type>1</Type> … … 238 238 <Rule> 239 239 <Name>Expression</Name> 240 <Type>0</Type> 241 <RuleItems/> 240 <RuleItems> 241 <Type>0</Type> 242 </RuleItems> 242 243 </Rule> 243 244 <Rule> 244 245 <Name>VariableRef</Name> 245 <Type>0</Type> 246 <RuleItems/> 246 <RuleItems> 247 <Type>0</Type> 248 </RuleItems> 247 249 </Rule> 248 250 <Rule> 249 251 <Name>Program</Name> 250 < Type>0</Type>251 <RuleItems>252 <RuleItems> 253 <Type>0</Type> 252 254 <RuleItem> 253 255 <Type>1</Type> … … 262 264 <Rule> 263 265 <Name>Uses</Name> 264 < Type>0</Type>265 <RuleItems>266 <RuleItems> 267 <Type>0</Type> 266 268 <RuleItem> 267 269 <Type>0</Type> … … 270 272 <RuleItem> 271 273 <Type>1</Type> 274 <NonTerminal>UnitReference</NonTerminal> 275 </RuleItem> 276 <RuleItem> 277 <Type>0</Type> 278 <Terminal>,</Terminal> 279 </RuleItem> 280 </RuleItems> 281 </Rule> 282 <Rule> 283 <Name>UnitName</Name> 284 <RuleItems> 285 <Type>0</Type> 286 </RuleItems> 287 </Rule> 288 <Rule> 289 <Name>Function</Name> 290 <RuleItems> 291 <Type>0</Type> 292 <RuleItem> 293 <Type>0</Type> 294 <Terminal>function</Terminal> 295 </RuleItem> 296 <RuleItem> 297 <Type>1</Type> 298 <NonTerminal>Identifier</NonTerminal> 299 </RuleItem> 300 <RuleItem> 301 <Type>0</Type> 302 <Terminal>;</Terminal> 303 </RuleItem> 304 <RuleItem> 305 <Type>1</Type> 306 <NonTerminal>BeginEnd</NonTerminal> 307 </RuleItem> 308 <RuleItem> 309 <Type>0</Type> 310 <Terminal>;</Terminal> 311 </RuleItem> 312 </RuleItems> 313 </Rule> 314 <Rule> 315 <Name>Identifier</Name> 316 <RuleItems> 317 <Type>0</Type> 318 </RuleItems> 319 </Rule> 320 <Rule> 321 <Name>VarSection</Name> 322 <RuleItems> 323 <Type>0</Type> 324 <RuleItem> 325 <Type>0</Type> 326 <Terminal>var</Terminal> 327 </RuleItem> 328 <RuleItem> 329 <Type>1</Type> 330 <NonTerminal>VariableDefinition</NonTerminal> 331 </RuleItem> 332 </RuleItems> 333 </Rule> 334 <Rule> 335 <Name>FunctionParameters</Name> 336 <RuleItems> 337 <Type>0</Type> 338 <RuleItem> 339 <Type>0</Type> 340 <Terminal>(</Terminal> 341 </RuleItem> 342 <RuleItem> 343 <Type>1</Type> 344 <NonTerminal>FunctionParameter</NonTerminal> 345 </RuleItem> 346 <RuleItem> 347 <Type>0</Type> 348 <Terminal>)</Terminal> 349 </RuleItem> 350 </RuleItems> 351 </Rule> 352 <Rule> 353 <Name>FunctionParameter</Name> 354 <RuleItems> 355 <Type>0</Type> 356 </RuleItems> 357 </Rule> 358 <Rule> 359 <Name>VariableDefinition</Name> 360 <RuleItems> 361 <Type>0</Type> 362 <RuleItem> 363 <Type>1</Type> 364 <NonTerminal>VariableName</NonTerminal> 365 </RuleItem> 366 <RuleItem> 367 <Type>0</Type> 368 <Terminal>:</Terminal> 369 </RuleItem> 370 <RuleItem> 371 <Type>1</Type> 372 <NonTerminal>TypeReference</NonTerminal> 373 </RuleItem> 374 <RuleItem> 375 <Type>0</Type> 376 <Terminal>;</Terminal> 377 </RuleItem> 378 </RuleItems> 379 </Rule> 380 <Rule> 381 <Name>TypeReference</Name> 382 <RuleItems> 383 <Type>0</Type> 384 </RuleItems> 385 </Rule> 386 <Rule> 387 <Name>VariableName</Name> 388 <RuleItems> 389 <Type>0</Type> 390 </RuleItems> 391 </Rule> 392 <Rule> 393 <Name>Unit</Name> 394 <RuleItems> 395 <Type>0</Type> 396 <RuleItem> 397 <Type>0</Type> 398 <Terminal>unit</Terminal> 399 </RuleItem> 400 <RuleItem> 401 <Type>1</Type> 272 402 <NonTerminal>UnitName</NonTerminal> 273 403 </RuleItem> 274 404 <RuleItem> 275 405 <Type>0</Type> 276 <Terminal>,</Terminal>277 </RuleItem>278 </RuleItems>279 </Rule>280 <Rule>281 <Name>UnitName</Name>282 <Type>0</Type>283 <RuleItems/>284 </Rule>285 <Rule>286 <Name>Function</Name>287 <Type>0</Type>288 <RuleItems>289 <RuleItem>290 <Type>0</Type>291 <Terminal>function</Terminal>292 </RuleItem>293 <RuleItem>294 <Type>1</Type>295 <NonTerminal>Identifier</NonTerminal>296 </RuleItem>297 <RuleItem>298 <Type>0</Type>299 406 <Terminal>;</Terminal> 300 407 </RuleItem> 301 <RuleItem> 302 <Type>1</Type> 303 <NonTerminal>BeginEnd</NonTerminal> 304 </RuleItem> 305 <RuleItem> 306 <Type>0</Type> 307 <Terminal>;</Terminal> 308 </RuleItem> 309 </RuleItems> 310 </Rule> 311 <Rule> 312 <Name>Identifier</Name> 313 <Type>0</Type> 314 <RuleItems/> 315 </Rule> 316 <Rule> 317 <Name>VarSection</Name> 318 <Type>0</Type> 319 <RuleItems> 320 <RuleItem> 321 <Type>0</Type> 322 <Terminal>var</Terminal> 323 </RuleItem> 408 </RuleItems> 409 </Rule> 410 <Rule> 411 <Name>UnitReference</Name> 412 <RuleItems> 413 <Type>0</Type> 324 414 </RuleItems> 325 415 </Rule>
Note:
See TracChangeset
for help on using the changeset viewer.