Changeset 130 for branches/generator
- Timestamp:
- Dec 24, 2017, 11:13:05 AM (7 years ago)
- Location:
- branches/generator
- Files:
-
- 9 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.lfm
r129 r130 5 5 Width = 1050 6 6 Caption = 'Language generator' 7 ClientHeight = 6 537 ClientHeight = 647 8 8 ClientWidth = 1050 9 DesignTimePPI = 12010 9 Menu = MainMenu1 11 10 OnClose = FormClose 12 11 OnCloseQuery = FormCloseQuery 13 12 OnShow = FormShow 14 LCLVersion = '1.8.0.6' 15 object MemoBNF: TMemo 16 Left = 0 17 Height = 618 18 Top = 35 19 Width = 1050 20 Align = alClient 21 ReadOnly = True 22 ScrollBars = ssAutoBoth 23 TabOrder = 0 24 end 13 LCLVersion = '1.8.0.4' 25 14 object CoolBar1: TCoolBar 26 15 Left = 0 … … 38 27 AnchorSideTop.Control = CoolBar1 39 28 Left = 24 40 Height = 2 229 Height = 28 41 30 Top = 5 42 Width = 12 431 Width = 125 43 32 Align = alNone 44 33 AutoSize = True … … 52 41 TabOrder = 0 53 42 Transparent = True 54 object ToolButton1: TToolButton55 Left = 7856 Top = 057 Action = ARules58 end59 43 object ToolButton2: TToolButton 60 Left = 10144 Left = 96 61 45 Top = 0 62 46 Action = ABuildCompiler … … 68 52 end 69 53 object ToolButton4: TToolButton 70 Left = 2454 Left = 30 71 55 Top = 0 72 56 Action = AProjectOpen 73 57 end 74 58 object ToolButton5: TToolButton 75 Left = 4759 Left = 59 76 60 Top = 0 77 61 Action = AProjectSave 78 62 end 79 63 object ToolButton6: TToolButton 80 Left = 7081 Height = 2 264 Left = 88 65 Height = 28 82 66 Top = 0 83 67 Style = tbsSeparator 68 end 69 end 70 end 71 object PageControl1: TPageControl 72 Left = 0 73 Height = 612 74 Top = 35 75 Width = 1050 76 ActivePage = TabSheetEbnf 77 Align = alClient 78 TabIndex = 2 79 TabOrder = 1 80 object TabSheetRules: TTabSheet 81 Caption = 'Rules' 82 end 83 object TabSheetBnf: TTabSheet 84 Caption = 'BNF' 85 ClientHeight = 571 86 ClientWidth = 1044 87 object MemoBnf: TMemo 88 Left = 0 89 Height = 571 90 Top = 0 91 Width = 1044 92 Align = alClient 93 ReadOnly = True 94 ScrollBars = ssAutoBoth 95 TabOrder = 0 96 end 97 end 98 object TabSheetEbnf: TTabSheet 99 Caption = 'EBNF' 100 ClientHeight = 571 101 ClientWidth = 1044 102 object MemoEbnf: TMemo 103 Left = 0 104 Height = 571 105 Top = 0 106 Width = 1044 107 Align = alClient 108 ReadOnly = True 109 ScrollBars = ssAutoBoth 110 TabOrder = 0 84 111 end 85 112 end … … 124 151 object MenuItem1: TMenuItem 125 152 Caption = 'View' 126 object MenuItem3: TMenuItem127 Action = ARules128 end129 153 end 130 154 end -
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; -
branches/generator/Forms/UFormRules.pas
r129 r130 189 189 I: Integer; 190 190 begin 191 ListViewSort1.List.Count := Rules.Count; 192 for I := 0 to Rules.Count - 1 do 193 ListViewSort1.List[I] := Rules[I]; 194 //FilterList(ListViewSort1.List); 191 if Assigned(Rules) then begin 192 ListViewSort1.List.Count := Rules.Count; 193 for I := 0 to Rules.Count - 1 do 194 ListViewSort1.List[I] := Rules[I]; 195 //FilterList(ListViewSort1.List); 196 end else ListViewSort1.List.Count := 0; 195 197 end; 196 198 197 199 procedure TFormRules.UpdateInterface; 198 200 begin 199 AModify.Enabled := Assigned(ListView1.Selected); 200 ARemove.Enabled := Assigned(ListView1.Selected); 201 AAdd.Enabled := Assigned(Rules); 202 AModify.Enabled := Assigned(Rules) and Assigned(ListView1.Selected); 203 ARemove.Enabled := Assigned(Rules) and Assigned(ListView1.Selected); 201 204 end; 202 205 203 206 procedure TFormRules.ReloadList; 204 207 begin 205 if Assigned(Rules) then ListViewSort1.Refresh 206 else ListViewSort1.List.Count := 0; 208 ListViewSort1.Refresh; 207 209 ListView1.Refresh; 208 210 end; -
branches/generator/Languages/generator.cs.po
r129 r130 105 105 msgstr "Nástroje" 106 106 107 #: tformmain.tabsheetbnf.caption 108 msgid "BNF" 109 msgstr "" 110 111 #: tformmain.tabsheetebnf.caption 112 msgid "EBNF" 113 msgstr "" 114 115 #: tformmain.tabsheetrules.caption 116 #, fuzzy 117 msgctxt "tformmain.tabsheetrules.caption" 118 msgid "Rules" 119 msgstr "Pravidla" 120 107 121 #: tformrule.buttoncancel.caption 108 122 msgctxt "tformrule.buttoncancel.caption" -
branches/generator/Languages/generator.po
r129 r130 95 95 msgstr "" 96 96 97 #: tformmain.tabsheetbnf.caption 98 msgid "BNF" 99 msgstr "" 100 101 #: tformmain.tabsheetebnf.caption 102 msgid "EBNF" 103 msgstr "" 104 105 #: tformmain.tabsheetrules.caption 106 msgctxt "tformmain.tabsheetrules.caption" 107 msgid "Rules" 108 msgstr "" 109 97 110 #: tformrule.buttoncancel.caption 98 111 msgctxt "tformrule.buttoncancel.caption" -
branches/generator/UGrammer.pas
r129 r130 113 113 private 114 114 FModified: Boolean; 115 FOnChange: TNotifyEvent; 116 FOnDestroy: TNotifyEvent; 115 117 procedure SetModified(AValue: Boolean); 118 procedure DoChange; 119 procedure DoDestroy; 116 120 public 117 121 FileName: string; … … 125 129 procedure GetUsedByRule(RefRule: TRule; UsedByRules: TStrings); 126 130 function GetString: string; 131 procedure Change; 127 132 property Modified: Boolean read FModified write SetModified; 133 property OnChange: TNotifyEvent read FOnChange write FOnChange; 134 property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy; 128 135 end; 129 136 … … 141 148 if FModified = AValue then Exit; 142 149 FModified := AValue; 150 if AValue then DoChange; 151 end; 152 153 procedure TGrammer.DoChange; 154 begin 155 if Assigned(FOnChange) then FOnChange(Self); 156 end; 157 158 procedure TGrammer.DoDestroy; 159 begin 160 if Assigned(FOnDestroy) then FOnDestroy(Self); 143 161 end; 144 162 … … 165 183 end; 166 184 finally 167 Doc.Free;185 FreeAndNil(Doc); 168 186 end; 169 187 … … 195 213 Modified := False; 196 214 finally 197 Doc.Free;215 FreeAndNil(Doc); 198 216 end; 199 217 end; … … 213 231 destructor TGrammer.Destroy; 214 232 begin 233 DoDestroy; 215 234 FreeAndNil(Rules); 216 235 inherited Destroy; … … 229 248 begin 230 249 Result := Rules.GetString; 250 end; 251 252 procedure TGrammer.Change; 253 begin 254 DoChange; 231 255 end; 232 256 -
branches/generator/generator.lpr
r129 r130 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UCore, Common, TemplateGenerics, UFormMain, SysUtils, UBuilder 10 Forms, UCore, Common, TemplateGenerics, UFormMain, SysUtils, UBuilder, 11 UFormRules 11 12 { you can add units after this }; 12 13 … … 30 31 Application.CreateForm(TCore, Core); 31 32 Application.CreateForm(TFormMain, FormMain); 33 Application.CreateForm(TFormRules, FormRules); 32 34 Application.Run; 33 35 end.
Note:
See TracChangeset
for help on using the changeset viewer.