Changeset 130 for branches/generator/Forms/UFormMain.pas
- Timestamp:
- Dec 24, 2017, 11:13:05 AM (7 years ago)
- Location:
- branches/generator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator
- Property svn:ignore
-
old new 1 generator 1 2 generator.exe 2 3 generator.lps 3 4 lib 4 5 heaptrclog.trc 6 Generated
-
- Property svn:ignore
-
branches/generator/Forms
-
Property svn:ignore
set to
*.lrj
-
Property svn:ignore
set to
-
branches/generator/Forms/UFormMain.pas
r129 r130 26 26 CoolBar1: TCoolBar; 27 27 MainMenu1: TMainMenu; 28 MemoBNF: TMemo; 28 MemoEbnf: TMemo; 29 MemoBnf: TMemo; 29 30 MenuItem1: TMenuItem; 30 31 MenuItem10: TMenuItem; … … 33 34 MenuItem13: TMenuItem; 34 35 MenuItem2: TMenuItem; 35 MenuItem3: TMenuItem;36 36 MenuItem4: TMenuItem; 37 37 MenuItem5: TMenuItem; … … 41 41 MenuItem9: TMenuItem; 42 42 OpenDialog1: TOpenDialog; 43 PageControl1: TPageControl; 43 44 SaveDialog1: TSaveDialog; 45 TabSheetRules: TTabSheet; 46 TabSheetBnf: TTabSheet; 47 TabSheetEbnf: TTabSheet; 44 48 ToolBar1: TToolBar; 45 ToolButton1: TToolButton;46 49 ToolButton2: TToolButton; 47 50 ToolButton3: TToolButton; … … 64 67 procedure ReloadMemo; 65 68 procedure UpdateInterface; 69 procedure GrammerChange(Sender: TObject); 70 procedure GrammerDestroy(Sender: TObject); 66 71 public 67 72 { public declarations } … … 130 135 Core.PersistentForm1.Load(Self, True); 131 136 Core.Initialize; 132 ReloadMemo; 133 UpdateInterface; 137 PageControl1.TabIndex := 0; 138 ReloadMemo; 139 UpdateInterface; 140 141 FormRules.Rules := Core.Grammer.Rules; 142 FormRules.ManualDock(TabSheetRules, nil, alClient); 143 FormRules.Align := alClient; 144 FormRules.Show; 134 145 end; 135 146 136 147 procedure TFormMain.ReloadMemo; 137 148 begin 138 if Assigned(Core.Grammer) then 139 MemoBNF.Lines.Text := Core.Grammer.GetString 140 else MemoBNF.Lines.Clear; 149 if Assigned(Core.Grammer) then begin 150 MemoBnf.Lines.Text := Core.Grammer.GetString; 151 MemoEbnf.Lines.Text := Core.Grammer.GetString; 152 end else begin 153 MemoBnf.Lines.Clear; 154 MemoEbnf.Lines.Clear; 155 end; 141 156 end; 142 157 … … 159 174 end; 160 175 176 procedure TFormMain.GrammerChange(Sender: TObject); 177 begin 178 ReloadMemo; 179 UpdateInterface; 180 if Assigned(FormRules) then begin 181 FormRules.Rules := Core.Grammer.Rules; 182 FormRules.ReloadList; 183 FormRules.UpdateInterface; 184 end; 185 end; 186 187 procedure TFormMain.GrammerDestroy(Sender: TObject); 188 begin 189 ReloadMemo; 190 UpdateInterface; 191 if Assigned(FormRules) then begin 192 FormRules.Rules := nil; 193 FormRules.ReloadList; 194 FormRules.UpdateInterface; 195 end; 196 end; 197 161 198 procedure TFormMain.AExitExecute(Sender: TObject); 162 199 begin … … 183 220 Core.Grammer := TGrammer.Create; 184 221 Core.Grammer.FileName := SNewGrammer; 185 ReloadMemo; 186 UpdateInterface; 222 Core.Grammer.OnChange := GrammerChange; 223 Core.Grammer.OnDestroy := GrammerDestroy; 224 Core.Grammer.Change; 187 225 end; 188 226 end; … … 210 248 Core.LastOpenedFile := OpenDialog1.FileName; 211 249 Core.Grammer := TGrammer.Create; 250 Core.Grammer.OnChange := GrammerChange; 251 Core.Grammer.OnDestroy := GrammerDestroy; 212 252 Core.Grammer.LoadFromXmlFile(OpenDialog1.FileName); 213 ReloadMemo; 214 UpdateInterface; 253 Core.Grammer.Change; 215 254 end; 216 255 end; … … 232 271 if (DialogResult = mrNo) or (DialogResult = mrYes) then begin 233 272 FreeAndNil(Core.Grammer); 234 ReloadMemo;235 UpdateInterface;236 273 end; 237 274 end;
Note:
See TracChangeset
for help on using the changeset viewer.