Changeset 137 for branches/generator/Forms
- Timestamp:
- Dec 27, 2017, 6:05:11 PM (7 years ago)
- Location:
- branches/generator/Forms
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormMain.lfm
r132 r137 29 29 Height = 28 30 30 Top = 5 31 Width = 1 6931 Width = 198 32 32 Align = alNone 33 33 AutoSize = True … … 74 74 Action = AGrammerSettings 75 75 end 76 object ToolButton7: TToolButton 77 Left = 169 78 Top = 0 79 Action = ALookupTables 80 end 76 81 end 77 82 end … … 154 159 end 155 160 object MenuItem8: TMenuItem 156 Caption = ' Tools'161 Caption = 'Grammer' 157 162 object MenuItem9: TMenuItem 158 163 Action = ABuildCompiler 164 end 165 object MenuItem3: TMenuItem 166 Action = ALookupTables 159 167 end 160 168 end … … 228 236 OnExecute = AToolbarVisibleExecute 229 237 end 238 object ALookupTables: TAction 239 Caption = 'Lookup tables' 240 ImageIndex = 8 241 OnExecute = ALookupTablesExecute 242 end 230 243 end 231 244 object OpenDialog1: TOpenDialog -
branches/generator/Forms/UFormMain.pas
r136 r137 16 16 TFormMain = class(TForm) 17 17 ABuildCompiler: TAction; 18 ALookupTables: TAction; 18 19 AToolbarVisible: TAction; 19 20 AProjectOpenRecent: TAction; … … 38 39 MenuItem13: TMenuItem; 39 40 MenuItem2: TMenuItem; 41 MenuItem3: TMenuItem; 40 42 MenuItemRecent: TMenuItem; 41 43 MenuItemToolbar: TMenuItem; … … 60 62 ToolButton5: TToolButton; 61 63 ToolButton6: TToolButton; 64 ToolButton7: TToolButton; 62 65 procedure ABuildCompilerExecute(Sender: TObject); 66 procedure ALookupTablesExecute(Sender: TObject); 63 67 procedure AToolbarVisibleExecute(Sender: TObject); 64 68 procedure AExitExecute(Sender: TObject); … … 96 100 97 101 uses 98 UFormRules, UCore, UFormGrammer, UBuilder ;102 UFormRules, UCore, UFormGrammer, UBuilder, UFormLookupTables; 99 103 100 104 resourcestring … … 300 304 end; 301 305 306 procedure TFormMain.ALookupTablesExecute(Sender: TObject); 307 var 308 FormLookupTables: TFormLookupTables; 309 begin 310 FormLookupTables := TFormLookupTables.Create(nil); 311 try 312 FormLookupTables.LookupTables := Core.Grammer.LookupTables; 313 if FormLookupTables.ShowModal = mrOk then begin 314 315 end; 316 finally 317 FreeAndNil(FormLookupTables); 318 end; 319 end; 320 302 321 procedure TFormMain.AToolbarVisibleExecute(Sender: TObject); 303 322 begin -
branches/generator/Forms/UFormRuleItem.lfm
r136 r137 61 61 Top = 88 62 62 Width = 632 63 ActivePage = TabSheet TerminalRange63 ActivePage = TabSheetNonTerminal 64 64 Anchors = [akTop, akLeft, akRight, akBottom] 65 65 ShowTabs = False 66 TabIndex = 366 TabIndex = 1 67 67 TabOrder = 3 68 68 object TabSheetTerminal: TTabSheet … … 93 93 object LabelNonTerminal: TLabel 94 94 Left = 8 95 Height = 2 096 Top = 1697 Width = 9295 Height = 23 96 Top = 8 97 Width = 105 98 98 Caption = 'Non-terminal:' 99 99 ParentColor = False 100 100 end 101 object ListBox 1: TListBox102 Left = 128103 Height = 2 32104 Top = 16105 Width = 484101 object ListBoxNonTerminals: TListBox 102 Left = 8 103 Height = 210 104 Top = 40 105 Width = 304 106 106 Anchors = [akTop, akLeft, akRight, akBottom] 107 107 ItemHeight = 0 108 ScrollWidth = 482108 ScrollWidth = 302 109 109 TabOrder = 0 110 110 TopIndex = -1 111 end 112 object CheckBoxLookupTable: TCheckBox 113 Left = 352 114 Height = 27 115 Top = 8 116 Width = 152 117 Caption = 'Use lookup table' 118 OnChange = CheckBoxLookupTableChange 119 TabOrder = 1 120 end 121 object ListBoxLookupTable: TListBox 122 Left = 352 123 Height = 176 124 Top = 40 125 Width = 248 126 Anchors = [akTop, akLeft, akRight, akBottom] 127 ItemHeight = 0 128 ScrollWidth = 246 129 TabOrder = 2 130 TopIndex = -1 131 end 132 object Label1: TLabel 133 Left = 352 134 Height = 23 135 Top = 224 136 Width = 90 137 Caption = 'Item action:' 138 ParentColor = False 139 end 140 object ComboBoxLookupTableAction: TComboBox 141 Left = 464 142 Height = 35 143 Top = 224 144 Width = 134 145 ItemHeight = 0 146 ItemIndex = 0 147 Items.Strings = ( 148 'Create' 149 'Reference' 150 ) 151 Style = csDropDownList 152 TabOrder = 3 153 Text = 'Create' 111 154 end 112 155 end -
branches/generator/Forms/UFormRuleItem.pas
r136 r137 16 16 ButtonCancel: TButton; 17 17 ButtonOk: TButton; 18 CheckBoxLookupTable: TCheckBox; 18 19 CheckBoxAnyExcept: TCheckBox; 19 20 CheckBoxEscapedString: TCheckBox; 20 21 CheckBoxOptional: TCheckBox; 21 22 CheckBoxRepetitive: TCheckBox; 23 ComboBoxLookupTableAction: TComboBox; 22 24 ComboBoxType: TComboBox; 23 25 EditTerminal: TEdit; 24 26 EditTerminalFrom: TEdit; 25 27 EditTerminalTo: TEdit; 28 Label1: TLabel; 26 29 Label2: TLabel; 27 30 LabelNonTerminal: TLabel; … … 29 32 LabelTerminal1: TLabel; 30 33 LabelTerminal2: TLabel; 31 ListBox1: TListBox; 34 ListBoxNonTerminals: TListBox; 35 ListBoxLookupTable: TListBox; 32 36 PageControl1: TPageControl; 33 37 TabSheetTerminalRange: TTabSheet; … … 35 39 TabSheetNonTerminal: TTabSheet; 36 40 TabSheetSubItems: TTabSheet; 41 procedure CheckBoxLookupTableChange(Sender: TObject); 37 42 procedure ComboBoxTypeChange(Sender: TObject); 38 43 procedure EditTerminalKeyPress(Sender: TObject; var Key: char); … … 44 49 FormRuleItems: TForm; 45 50 procedure ReloadNonTerminals(Grammer: TGrammer); 51 procedure ReloadLookupTables(Grammer: TGrammer); 46 52 public 47 53 RuleItem: TRuleItem; … … 70 76 end; 71 77 78 procedure TFormRuleItem.CheckBoxLookupTableChange(Sender: TObject); 79 begin 80 UpdateInterface; 81 end; 82 72 83 procedure TFormRuleItem.EditTerminalKeyPress(Sender: TObject; var Key: char); 73 84 begin … … 99 110 case RuleItem.RuleItemType of 100 111 ritTerminal: EditTerminal.SetFocus; 101 ritNonTerminal: ListBox 1.SetFocus;112 ritNonTerminal: ListBoxNonTerminals.SetFocus; 102 113 ritSubItems: TFormRuleItems(FormRuleItems).ListView1.SetFocus; 103 114 ritTerminalRange: EditTerminalFrom.SetFocus; … … 110 121 Rule: TRule; 111 122 begin 112 ListBox 1.Items.Clear;123 ListBoxNonTerminals.Items.Clear; 113 124 for Rule in Grammer.Rules do begin 114 ListBox1.Items.AddObject(Rule.Name, Rule); 115 end; 116 ListBox1.Sorted := True; 125 ListBoxNonTerminals.Items.AddObject(Rule.Name, Rule); 126 end; 127 ListBoxNonTerminals.Sorted := True; 128 end; 129 130 procedure TFormRuleItem.ReloadLookupTables(Grammer: TGrammer); 131 var 132 Item: TLookupTable; 133 begin 134 ListBoxLookupTable.Items.Clear; 135 for Item in Grammer.LookupTables do begin 136 ListBoxLookupTable.Items.AddObject(Item.Name, Item); 137 end; 138 ListBoxLookupTable.Sorted := True; 117 139 end; 118 140 … … 122 144 EditTerminal.Visible := RuleItem.RuleItemType = ritTerminal; 123 145 LabelTerminal.Visible := RuleItem.RuleItemType = ritTerminal; 124 ListBox 1.Visible := RuleItem.RuleItemType = ritNonTerminal;146 ListBoxNonTerminals.Visible := RuleItem.RuleItemType = ritNonTerminal; 125 147 LabelNonTerminal.Visible := RuleItem.RuleItemType = ritNonTerminal; 126 148 CheckBoxOptional.Enabled := RuleItem.ParentRule.Items.RuleType = rtAnd; … … 128 150 CheckBoxEscapedString.Enabled := (RuleItem.RuleItemType = ritTerminal) or 129 151 (RuleItem.RuleItemType = ritTerminalRange); 152 ListBoxLookupTable.Enabled := CheckBoxLookupTable.Checked; 153 ComboBoxLookupTableAction.Enabled := CheckBoxLookupTable.Checked; 130 154 end; 131 155 … … 135 159 ReloadNonTerminals(RuleItem.Grammer); 136 160 ComboBoxType.ItemIndex := Integer(RuleItem.RuleItemType); 137 ListBox 1.ItemIndex := ListBox1.Items.IndexOfObject(RuleItem.NonTerminal);161 ListBoxNonTerminals.ItemIndex := ListBoxNonTerminals.Items.IndexOfObject(RuleItem.NonTerminal); 138 162 EditTerminal.Text := RuleItem.Terminal; 139 163 EditTerminalFrom.Text := RuleItem.TerminalFrom; … … 144 168 TFormRuleItems(FormRuleItems).LoadData(RuleItem.SubItems); 145 169 CheckBoxEscapedString.Checked := RuleItem.EscapedStrings; 170 // Lookup table 171 CheckBoxLookupTable.Checked := RuleItem.LookupTableUsed; 172 ReloadLookupTables(RuleItem.Grammer); 173 ComboBoxLookupTableAction.ItemIndex := Integer(RuleItem.LookupTableAction); 174 ListBoxLookupTable.ItemIndex := ListBoxLookupTable.Items.IndexOfObject(RuleItem.LookupTable); 146 175 UpdateInterface; 147 176 end; … … 155 184 RuleItem.TerminalFrom := EditTerminalFrom.Text; 156 185 RuleItem.TerminalTo := EditTerminalTo.Text; 157 if ListBox 1.ItemIndex <> -1 then158 RuleItem.NonTerminal := TRule(ListBox 1.Items.Objects[ListBox1.ItemIndex])186 if ListBoxNonTerminals.ItemIndex <> -1 then 187 RuleItem.NonTerminal := TRule(ListBoxNonTerminals.Items.Objects[ListBoxNonTerminals.ItemIndex]) 159 188 else RuleItem.NonTerminal := nil; 160 189 RuleItem.Optional := CheckBoxOptional.Checked; … … 162 191 RuleItem.AnyExcept := CheckBoxAnyExcept.Checked; 163 192 RuleItem.EscapedStrings := CheckBoxEscapedString.Checked; 193 // Lookup table 194 RuleItem.LookupTableUsed := CheckBoxLookupTable.Checked; 195 RuleItem.LookupTableAction := TLookupTableAction(ComboBoxLookupTableAction.ItemIndex); 196 if ListBoxLookupTable.ItemIndex <> -1 then 197 RuleItem.LookupTable := TLookupTable(ListBoxLookupTable.Items.Objects[ListBoxLookupTable.ItemIndex]) 198 else RuleItem.LookupTable := nil; 164 199 end; 165 200 -
branches/generator/Forms/UFormRules.lfm
r129 r137 7 7 ClientHeight = 611 8 8 ClientWidth = 857 9 DesignTimePPI = 12010 9 OnClose = FormClose 11 10 OnCreate = FormCreate 12 11 OnShow = FormShow 13 LCLVersion = '1.8.0. 6'12 LCLVersion = '1.8.0.4' 14 13 object CoolBar1: TCoolBar 15 14 Left = 0 … … 28 27 AnchorSideTop.Control = CoolBar1 29 28 Left = 24 30 Height = 2 229 Height = 28 31 30 Top = 5 32 Width = 7031 Width = 88 33 32 Align = alNone 34 33 AutoSize = True … … 48 47 end 49 48 object ToolButton2: TToolButton 50 Left = 2449 Left = 30 51 50 Top = 0 52 51 Action = AModify 53 52 end 54 53 object ToolButton3: TToolButton 55 Left = 4754 Left = 59 56 55 Top = 0 57 56 Action = ARemove … … 94 93 TabOrder = 1 95 94 ViewStyle = vsReport 96 OnCompare = ListView1Compare97 95 OnData = ListView1Data 98 96 OnDblClick = ListView1DblClick -
branches/generator/Forms/UFormRules.pas
r130 r137 35 35 procedure FormCreate(Sender: TObject); 36 36 procedure FormShow(Sender: TObject); 37 procedure ListView1Compare(Sender: TObject; Item1, Item2: TListItem;38 Data: Integer; var Compare: Integer);39 37 procedure ListView1Data(Sender: TObject; Item: TListItem); 40 38 procedure ListView1DblClick(Sender: TObject); … … 73 71 ReloadList; 74 72 UpdateInterface; 75 end;76 77 procedure TFormRules.ListView1Compare(Sender: TObject; Item1, Item2: TListItem;78 Data: Integer; var Compare: Integer);79 begin80 81 73 end; 82 74
Note:
See TracChangeset
for help on using the changeset viewer.