Changeset 136 for branches/generator/Forms
- Timestamp:
- Dec 26, 2017, 6:59:40 PM (7 years ago)
- Location:
- branches/generator/Forms
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormGrammer.lfm
r129 r136 7 7 ClientHeight = 346 8 8 ClientWidth = 548 9 DesignTimePPI = 12010 9 OnShow = FormShow 11 LCLVersion = '1.8.0. 6'10 LCLVersion = '1.8.0.4' 12 11 object Label1: TLabel 13 12 Left = 15 14 Height = 2 013 Height = 23 15 14 Top = 22 16 Width = 6315 Width = 75 17 16 Caption = 'Start rule:' 18 17 ParentColor = False 19 18 end 20 19 object ComboBoxStartRule: TComboBox 21 Left = 1 2022 Height = 2823 Top = 2 420 Left = 168 21 Height = 37 22 Top = 22 24 23 Width = 272 25 ItemHeight = 2024 ItemHeight = 0 26 25 Style = csDropDownList 27 26 TabOrder = 0 … … 47 46 TabOrder = 2 48 47 end 48 object Label2: TLabel 49 Left = 16 50 Height = 23 51 Top = 80 52 Width = 130 53 Caption = 'White space rule:' 54 ParentColor = False 55 end 56 object ComboBoxWhiteSpaceRule: TComboBox 57 Left = 168 58 Height = 37 59 Top = 72 60 Width = 272 61 ItemHeight = 0 62 Style = csDropDownList 63 TabOrder = 3 64 end 49 65 end -
branches/generator/Forms/UFormGrammer.pas
r129 r136 17 17 ButtonOk: TButton; 18 18 ComboBoxStartRule: TComboBox; 19 ComboBoxWhiteSpaceRule: TComboBox; 19 20 Label1: TLabel; 21 Label2: TLabel; 20 22 procedure FormShow(Sender: TObject); 21 23 private … … 49 51 end; 50 52 ComboBoxStartRule.Sorted := True; 53 54 ComboBoxWhiteSpaceRule.Items.Clear; 55 for Rule in Grammer.Rules do begin 56 ComboBoxWhiteSpaceRule.Items.AddObject(Rule.Name, Rule); 57 end; 58 ComboBoxWhiteSpaceRule.Sorted := True; 51 59 end; 52 60 … … 58 66 ComboBoxStartRule.ItemIndex := ComboBoxStartRule.Items.IndexOfObject(Grammer.TopRule); 59 67 end else ComboBoxStartRule.ItemIndex := -1; 68 if Assigned(Grammer.WhiteSpaceRule) then begin 69 ComboBoxWhiteSpaceRule.ItemIndex := ComboBoxWhiteSpaceRule.Items.IndexOfObject(Grammer.WhiteSpaceRule); 70 end else ComboBoxWhiteSpaceRule.ItemIndex := -1; 60 71 end; 61 72 … … 66 77 Grammer.TopRule := TRule(ComboBoxStartRule.Items.Objects[ComboBoxStartRule.ItemIndex]) 67 78 else Grammer.TopRule := nil; 79 if ComboBoxWhiteSpaceRule.ItemIndex <> -1 then 80 Grammer.WhiteSpaceRule := TRule(ComboBoxWhiteSpaceRule.Items.Objects[ComboBoxWhiteSpaceRule.ItemIndex]) 81 else Grammer.WhiteSpaceRule := nil; 68 82 end; 69 83 -
branches/generator/Forms/UFormMain.pas
r131 r136 271 271 procedure TFormMain.AProjectOpenRecentExecute(Sender: TObject); 272 272 begin 273 if Sender is TMenuItem then ProjectOpen(TMenuItem(Sender).Caption); 273 if Sender is TMenuItem then begin 274 AProjectClose.Execute; 275 if not Assigned(Core.Grammer) then begin 276 ProjectOpen(TMenuItem(Sender).Caption); 277 end; 278 end; 274 279 end; 275 280 -
branches/generator/Forms/UFormRuleItem.lfm
r131 r136 161 161 end 162 162 object CheckBoxRepetitive: TCheckBox 163 Left = 216163 Left = 184 164 164 Height = 27 165 165 Top = 56 … … 169 169 end 170 170 object CheckBoxAnyExcept: TCheckBox 171 Left = 400171 Left = 344 172 172 Height = 27 173 173 Top = 56 … … 176 176 TabOrder = 6 177 177 end 178 object CheckBoxEscapedString: TCheckBox 179 Left = 488 180 Height = 27 181 Top = 56 182 Width = 144 183 Caption = 'Escaped strings' 184 TabOrder = 7 185 end 178 186 end -
branches/generator/Forms/UFormRuleItem.pas
r129 r136 17 17 ButtonOk: TButton; 18 18 CheckBoxAnyExcept: TCheckBox; 19 CheckBoxEscapedString: TCheckBox; 19 20 CheckBoxOptional: TCheckBox; 20 21 CheckBoxRepetitive: TCheckBox; … … 123 124 ListBox1.Visible := RuleItem.RuleItemType = ritNonTerminal; 124 125 LabelNonTerminal.Visible := RuleItem.RuleItemType = ritNonTerminal; 126 CheckBoxOptional.Enabled := RuleItem.ParentRule.Items.RuleType = rtAnd; 127 CheckBoxRepetitive.Enabled := RuleItem.ParentRule.Items.RuleType = rtAnd; 128 CheckBoxEscapedString.Enabled := (RuleItem.RuleItemType = ritTerminal) or 129 (RuleItem.RuleItemType = ritTerminalRange); 125 130 end; 126 131 … … 138 143 CheckBoxAnyExcept.Checked := RuleItem.AnyExcept; 139 144 TFormRuleItems(FormRuleItems).LoadData(RuleItem.SubItems); 145 CheckBoxEscapedString.Checked := RuleItem.EscapedStrings; 140 146 UpdateInterface; 141 147 end; … … 155 161 RuleItem.Repetitive := CheckBoxRepetitive.Checked; 156 162 RuleItem.AnyExcept := CheckBoxAnyExcept.Checked; 163 RuleItem.EscapedStrings := CheckBoxEscapedString.Checked; 157 164 end; 158 165 -
branches/generator/Forms/UFormRuleItems.lfm
r129 r136 7 7 ClientHeight = 467 8 8 ClientWidth = 636 9 DesignTimePPI = 12010 9 OnCreate = FormCreate 11 10 OnShow = FormShow 12 LCLVersion = '1.8.0. 6'11 LCLVersion = '1.8.0.4' 13 12 object ListView1: TListView 14 13 Left = 8 15 Height = 3 9216 Top = 4 014 Height = 384 15 Top = 48 17 16 Width = 624 18 17 Anchors = [akTop, akLeft, akRight, akBottom] … … 50 49 end 51 50 object ToolButton2: TToolButton 52 Left = 2451 Left = 30 53 52 Top = 2 54 53 Action = AModify 55 54 end 56 55 object ToolButton3: TToolButton 57 Left = 4756 Left = 59 58 57 Top = 2 59 58 Action = ARemove 60 59 end 61 60 object ToolButton4: TToolButton 62 Left = 7061 Left = 88 63 62 Top = 2 64 63 Action = AMoveUp 65 64 end 66 65 object ToolButton5: TToolButton 67 Left = 9366 Left = 117 68 67 Top = 2 69 68 Action = AMoveDown … … 72 71 object Label1: TLabel 73 72 Left = 10 74 Height = 2 073 Height = 23 75 74 Top = 10 76 Width = 6375 Width = 75 77 76 Caption = 'Operator:' 78 77 ParentColor = False 79 78 end 80 object ComboBox 1: TComboBox79 object ComboBoxOperator: TComboBox 81 80 Left = 153 82 Height = 2881 Height = 33 83 82 Top = 9 84 83 Width = 231 85 ItemHeight = 2084 ItemHeight = 0 86 85 Items.Strings = ( 87 86 'And' 88 87 'Or' 89 88 ) 89 OnChange = ComboBoxOperatorChange 90 90 Style = csDropDownList 91 91 TabOrder = 2 92 end 93 object CheckBoxWhiteSpace: TCheckBox 94 Left = 408 95 Height = 27 96 Top = 10 97 Width = 161 98 Caption = 'With white spaces' 99 TabOrder = 3 92 100 end 93 101 object PopupMenu1: TPopupMenu -
branches/generator/Forms/UFormRuleItems.pas
r129 r136 20 20 AMoveUp: TAction; 21 21 ARemove: TAction; 22 ComboBox1: TComboBox; 22 CheckBoxWhiteSpace: TCheckBox; 23 ComboBoxOperator: TComboBox; 23 24 Label1: TLabel; 24 25 ListView1: TListView; … … 40 41 procedure AMoveUpExecute(Sender: TObject); 41 42 procedure ARemoveExecute(Sender: TObject); 43 procedure ComboBoxOperatorChange(Sender: TObject); 42 44 procedure FormCreate(Sender: TObject); 43 45 procedure FormShow(Sender: TObject); … … 82 84 NewRuleItem := TRuleItem.Create; 83 85 NewRuleItem.Grammer := RuleItems.Grammer; 86 NewRuleItem.ParentRule := RuleItems.ParentRule; 84 87 FormRuleItem := TFormRuleItem.Create(nil); 85 88 FormRuleItem.LoadData(NewRuleItem); … … 141 144 end; 142 145 146 procedure TFormRuleItems.ComboBoxOperatorChange(Sender: TObject); 147 begin 148 UpdateInterface; 149 end; 150 143 151 procedure TFormRuleItems.FormCreate(Sender: TObject); 144 152 begin … … 174 182 AMoveUp.Enabled := Assigned(ListView1.Selected) and (ListView1.Selected.Index > 0); 175 183 AMoveDown.Enabled := Assigned(ListView1.Selected) and (ListView1.Selected.Index < (ListView1.Items.Count - 1)); 184 CheckBoxWhiteSpace.Enabled := ComboBoxOperator.ItemIndex = 0; 176 185 end; 177 186 … … 186 195 begin 187 196 Self.RuleItems := RuleItems; 188 ComboBox1.ItemIndex := Integer(RuleItems.RuleType); 197 ComboBoxOperator.ItemIndex := Integer(RuleItems.RuleType); 198 CheckBoxWhiteSpace.Checked := RuleItems.WithWhiteSpeaces; 189 199 end; 190 200 191 201 procedure TFormRuleItems.SaveData(RuleItems: TRuleItems); 192 202 begin 193 RuleItems.RuleType := TRuleType(ComboBox1.ItemIndex); 203 RuleItems.RuleType := TRuleType(ComboBoxOperator.ItemIndex); 204 RuleItems.WithWhiteSpeaces := CheckBoxWhiteSpace.Checked; 194 205 end; 195 206
Note:
See TracChangeset
for help on using the changeset viewer.