Changeset 131 for branches/generator/Forms
- Timestamp:
- Dec 24, 2017, 3:54:08 PM (7 years ago)
- Location:
- branches/generator/Forms
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/Forms/UFormMain.lfm
r130 r131 29 29 Height = 28 30 30 Top = 5 31 Width = 1 2531 Width = 171 32 32 Align = alNone 33 33 AutoSize = True … … 42 42 Transparent = True 43 43 object ToolButton2: TToolButton 44 Left = 9644 Left = 142 45 45 Top = 0 46 46 Action = ABuildCompiler … … 55 55 Top = 0 56 56 Action = AProjectOpen 57 DropdownMenu = PopupMenuOpenRecent 58 Style = tbsButtonDrop 57 59 end 58 60 object ToolButton5: TToolButton 59 Left = 5961 Left = 76 60 62 Top = 0 61 63 Action = AProjectSave 62 64 end 63 65 object ToolButton6: TToolButton 64 Left = 8866 Left = 134 65 67 Height = 28 66 68 Top = 0 67 69 Style = tbsSeparator 70 end 71 object ToolButton1: TToolButton 72 Left = 105 73 Top = 0 74 Action = AGrammerSettings 68 75 end 69 76 end … … 124 131 Action = AProjectOpen 125 132 end 133 object MenuItemRecent: TMenuItem 134 Caption = 'Open recent' 135 end 126 136 object MenuItem10: TMenuItem 127 137 Action = AProjectSave … … 151 161 object MenuItem1: TMenuItem 152 162 Caption = 'View' 163 object MenuItemToolbar: TMenuItem 164 Action = AToolbarVisible 165 AutoCheck = True 166 end 153 167 end 154 168 end … … 175 189 OnExecute = AProjectOpenExecute 176 190 end 191 object AProjectOpenRecent: TAction 192 Caption = 'Open recent' 193 OnExecute = AProjectOpenRecentExecute 194 end 177 195 object AProjectSaveAs: TAction 178 196 Caption = 'Save as...' … … 181 199 OnExecute = AProjectSaveAsExecute 182 200 end 201 object AProjectSave: TAction 202 Caption = 'Save' 203 ImageIndex = 5 204 OnExecute = AProjectSaveExecute 205 end 206 object AProjectNew: TAction 207 Caption = 'New' 208 ImageIndex = 10 209 OnExecute = AProjectNewExecute 210 end 211 object AProjectClose: TAction 212 Caption = 'Close' 213 OnExecute = AProjectCloseExecute 214 end 215 object AGrammerSettings: TAction 216 Caption = 'Settings' 217 ImageIndex = 3 218 OnExecute = AGrammerSettingsExecute 219 end 183 220 object ABuildCompiler: TAction 184 221 Caption = 'Build compiler' … … 186 223 OnExecute = ABuildCompilerExecute 187 224 end 188 object AProjectSave: TAction 189 Caption = 'Save' 190 ImageIndex = 5 191 OnExecute = AProjectSaveExecute 192 end 193 object AProjectNew: TAction 194 Caption = 'New' 195 ImageIndex = 10 196 OnExecute = AProjectNewExecute 197 end 198 object AGrammerSettings: TAction 199 Caption = 'Settings' 200 OnExecute = AGrammerSettingsExecute 201 end 202 object AProjectClose: TAction 203 Caption = 'Close' 204 OnExecute = AProjectCloseExecute 225 object AToolbarVisible: TAction 226 AutoCheck = True 227 Caption = 'Toolbar' 228 OnExecute = AToolbarVisibleExecute 205 229 end 206 230 end … … 217 241 top = 414 218 242 end 243 object LastOpenedList1: TLastOpenedList 244 MaxCount = 10 245 OnChange = LastOpenedList1Change 246 left = 155 247 top = 131 248 end 249 object PopupMenuOpenRecent: TPopupMenu 250 left = 149 251 top = 234 252 end 219 253 end -
branches/generator/Forms/UFormMain.pas
r130 r131 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Menus, ActnList, ComCtrls, UPersistentForm, UGrammer; 9 Menus, ActnList, ComCtrls, UPersistentForm, ULastOpenedList, UGrammer, 10 XMLConf; 10 11 11 12 type … … 15 16 TFormMain = class(TForm) 16 17 ABuildCompiler: TAction; 18 AToolbarVisible: TAction; 19 AProjectOpenRecent: TAction; 17 20 AProjectClose: TAction; 18 21 AGrammerSettings: TAction; … … 25 28 ActionList1: TActionList; 26 29 CoolBar1: TCoolBar; 30 LastOpenedList1: TLastOpenedList; 27 31 MainMenu1: TMainMenu; 28 32 MemoEbnf: TMemo; … … 34 38 MenuItem13: TMenuItem; 35 39 MenuItem2: TMenuItem; 40 MenuItemRecent: TMenuItem; 41 MenuItemToolbar: TMenuItem; 36 42 MenuItem4: TMenuItem; 37 43 MenuItem5: TMenuItem; … … 42 48 OpenDialog1: TOpenDialog; 43 49 PageControl1: TPageControl; 50 PopupMenuOpenRecent: TPopupMenu; 44 51 SaveDialog1: TSaveDialog; 45 52 TabSheetRules: TTabSheet; … … 47 54 TabSheetEbnf: TTabSheet; 48 55 ToolBar1: TToolBar; 56 ToolButton1: TToolButton; 49 57 ToolButton2: TToolButton; 50 58 ToolButton3: TToolButton; … … 53 61 ToolButton6: TToolButton; 54 62 procedure ABuildCompilerExecute(Sender: TObject); 63 procedure AToolbarVisibleExecute(Sender: TObject); 55 64 procedure AExitExecute(Sender: TObject); 56 65 procedure AGrammerSettingsExecute(Sender: TObject); … … 58 67 procedure AProjectNewExecute(Sender: TObject); 59 68 procedure AProjectOpenExecute(Sender: TObject); 69 procedure AProjectOpenRecentExecute(Sender: TObject); 60 70 procedure AProjectCloseExecute(Sender: TObject); 61 71 procedure AProjectSaveAsExecute(Sender: TObject); … … 64 74 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); 65 75 procedure FormShow(Sender: TObject); 76 procedure LastOpenedList1Change(Sender: TObject); 66 77 private 67 procedure ReloadMemo;68 procedure UpdateInterface;69 78 procedure GrammerChange(Sender: TObject); 70 79 procedure GrammerDestroy(Sender: TObject); 71 80 public 72 { public declarations } 81 procedure ReloadMemo; 82 procedure UpdateInterface; 83 procedure ProjectOpen(FileName: string); 84 procedure ProjectNew; 85 procedure LoadConfig(XmlConfig: TXmlConfig); 86 procedure SaveConfig(XmlConfig: TXmlConfig); 73 87 end; 74 88 … … 108 122 SaveDialog1.FileName := ExtractFileName(Core.Grammer.FileName); 109 123 if SaveDialog1.Execute then begin 110 Core.LastOpenedFile := SaveDialog1.FileName;124 LastOpenedList1.AddItem(SaveDialog1.FileName); 111 125 Core.Grammer.SaveToXmlFile(SaveDialog1.FileName); 112 126 UpdateInterface; … … 123 137 begin 124 138 Core.PersistentForm1.Save(Self); 139 Core.Finalize; 125 140 end; 126 141 … … 145 160 end; 146 161 162 procedure TFormMain.LastOpenedList1Change(Sender: TObject); 163 begin 164 LastOpenedList1.LoadToMenuItem(MenuItemRecent, AProjectOpenRecentExecute); 165 LastOpenedList1.LoadToMenuItem(PopupMenuOpenRecent.Items, AProjectOpenRecentExecute); 166 end; 167 147 168 procedure TFormMain.ReloadMemo; 148 169 begin 149 170 if Assigned(Core.Grammer) then begin 150 MemoBnf.Lines.Text := Core.Grammer. GetString;151 MemoEbnf.Lines.Text := Core.Grammer. GetString;171 MemoBnf.Lines.Text := Core.Grammer.ExportAsString(gnBnf); 172 MemoEbnf.Lines.Text := Core.Grammer.ExportAsString(gnEbnf); 152 173 end else begin 153 174 MemoBnf.Lines.Clear; … … 172 193 ABuildCompiler.Enabled := Assigned(Core.Grammer); 173 194 ARules.Enabled := Assigned(Core.Grammer); 195 CoolBar1.Visible := AToolbarVisible.Checked; 174 196 end; 175 197 … … 194 216 FormRules.UpdateInterface; 195 217 end; 218 end; 219 220 procedure TFormMain.ProjectOpen(FileName: string); 221 begin 222 if Assigned(Core.Grammer) then FreeAndNil(Core.Grammer); 223 LastOpenedList1.AddItem(FileName); 224 Core.Grammer := TGrammer.Create; 225 Core.Grammer.OnChange := GrammerChange; 226 Core.Grammer.OnDestroy := GrammerDestroy; 227 Core.Grammer.LoadFromXmlFile(FileName); 228 Core.Grammer.Change; 229 end; 230 231 procedure TFormMain.ProjectNew; 232 begin 233 if Assigned(Core.Grammer) then FreeAndNil(Core.Grammer); 234 Core.Grammer := TGrammer.Create; 235 Core.Grammer.OnChange := GrammerChange; 236 Core.Grammer.OnDestroy := GrammerDestroy; 237 Core.Grammer.FileName := SNewGrammer; 238 Core.Grammer.Change; 239 end; 240 241 procedure TFormMain.LoadConfig(XmlConfig: TXmlConfig); 242 begin 243 AToolbarVisible.Checked := XmlConfig.GetValue('ToolbarVisible', True); 244 LastOpenedList1.LoadFromXMLConfig(XMLConfig, 'LastOpenedFiles'); 245 end; 246 247 procedure TFormMain.SaveConfig(XmlConfig: TXmlConfig); 248 begin 249 XmlConfig.SetValue('ToolbarVisible', AToolbarVisible.Checked); 250 LastOpenedList1.SaveToXMLConfig(XMLConfig, 'LastOpenedFiles'); 196 251 end; 197 252 … … 214 269 end; 215 270 271 procedure TFormMain.AProjectOpenRecentExecute(Sender: TObject); 272 begin 273 if Sender is TMenuItem then ProjectOpen(TMenuItem(Sender).Caption); 274 end; 275 216 276 procedure TFormMain.AProjectNewExecute(Sender: TObject); 217 277 begin 218 278 AProjectClose.Execute; 219 279 if not Assigned(Core.Grammer) then begin 220 Core.Grammer := TGrammer.Create; 221 Core.Grammer.FileName := SNewGrammer; 222 Core.Grammer.OnChange := GrammerChange; 223 Core.Grammer.OnDestroy := GrammerDestroy; 224 Core.Grammer.Change; 280 ProjectNew; 225 281 end; 226 282 end; … … 239 295 end; 240 296 297 procedure TFormMain.AToolbarVisibleExecute(Sender: TObject); 298 begin 299 UpdateInterface; 300 end; 301 241 302 procedure TFormMain.AProjectOpenExecute(Sender: TObject); 242 303 begin 243 304 AProjectClose.Execute; 244 305 if not Assigned(Core.Grammer) then begin 245 OpenDialog1.InitialDir := ExtractFileDir( Core.LastOpenedFile);246 OpenDialog1.FileName := ExtractFileName( Core.LastOpenedFile);306 OpenDialog1.InitialDir := ExtractFileDir(LastOpenedList1.GetFirstFileName); 307 OpenDialog1.FileName := ExtractFileName(LastOpenedList1.GetFirstFileName); 247 308 if OpenDialog1.Execute then begin 248 Core.LastOpenedFile := OpenDialog1.FileName; 249 Core.Grammer := TGrammer.Create; 250 Core.Grammer.OnChange := GrammerChange; 251 Core.Grammer.OnDestroy := GrammerDestroy; 252 Core.Grammer.LoadFromXmlFile(OpenDialog1.FileName); 253 Core.Grammer.Change; 309 ProjectOpen(OpenDialog1.FileName); 254 310 end; 255 311 end; -
branches/generator/Forms/UFormRule.lfm
r129 r131 8 8 ClientHeight = 514 9 9 ClientWidth = 663 10 DesignTimePPI = 12011 10 OnCreate = FormCreate 12 11 OnDestroy = FormDestroy 13 12 OnShow = FormShow 14 LCLVersion = '1.8.0. 6'13 LCLVersion = '1.8.0.4' 15 14 object ButtonOk: TButton 16 15 Left = 376 … … 35 34 object Label1: TLabel 36 35 Left = 16 37 Height = 2 036 Height = 23 38 37 Top = 16 39 Width = 4 338 Width = 49 40 39 Caption = 'Name:' 41 40 ParentColor = False … … 58 57 object TabSheetUsedBy: TTabSheet 59 58 Caption = 'Used by' 60 ClientHeight = 35 961 ClientWidth = 63 259 ClientHeight = 351 60 ClientWidth = 634 62 61 object ListView1: TListView 63 62 Left = 0 … … 69 68 item 70 69 Caption = 'Name' 71 Width = 20070 Width = 612 72 71 end> 73 72 OwnerData = True … … 82 81 object EditName: TEdit 83 82 Left = 135 84 Height = 2883 Height = 33 85 84 Top = 11 86 85 Width = 433 … … 89 88 object CheckBoxCreateNode: TCheckBox 90 89 Left = 16 91 Height = 2 490 Height = 27 92 91 Top = 48 93 Width = 1 5292 Width = 173 94 93 Caption = 'Create source node' 95 94 TabOrder = 4 … … 97 96 object Label2: TLabel 98 97 Left = 312 99 Height = 2 098 Height = 23 100 99 Top = 52 101 Width = 37102 Caption = 'L avel:'100 Width = 42 101 Caption = 'Level:' 103 102 ParentColor = False 104 103 end 105 104 object ComboBoxLevel: TComboBox 106 105 Left = 376 107 Height = 28106 Height = 37 108 107 Top = 48 109 108 Width = 125 110 ItemHeight = 20109 ItemHeight = 0 111 110 Style = csDropDownList 112 111 TabOrder = 5 -
branches/generator/Forms/UFormRuleItem.lfm
r129 r131 7 7 ClientHeight = 400 8 8 ClientWidth = 656 9 DesignTimePPI = 12010 9 OnClose = FormClose 11 10 OnCreate = FormCreate 12 11 OnDestroy = FormDestroy 13 12 OnShow = FormShow 14 LCLVersion = '1.8.0. 6'13 LCLVersion = '1.8.0.4' 15 14 object ButtonCancel: TButton 16 15 Left = 176 … … 35 34 object ComboBoxType: TComboBox 36 35 Left = 160 37 Height = 2836 Height = 33 38 37 Top = 16 39 38 Width = 400 40 ItemHeight = 2039 ItemHeight = 0 41 40 Items.Strings = ( 42 41 'Terminal' … … 51 50 object Label2: TLabel 52 51 Left = 16 53 Height = 2 052 Height = 23 54 53 Top = 24 55 Width = 3554 Width = 40 56 55 Caption = 'Type:' 57 56 ParentColor = False … … 62 61 Top = 88 63 62 Width = 632 64 ActivePage = TabSheetTerminal 63 ActivePage = TabSheetTerminalRange 65 64 Anchors = [akTop, akLeft, akRight, akBottom] 66 65 ShowTabs = False 67 TabIndex = 066 TabIndex = 3 68 67 TabOrder = 3 69 68 object TabSheetTerminal: TTabSheet 70 69 Caption = 'Terminal' 71 ClientHeight = 2 5872 ClientWidth = 62 470 ClientHeight = 260 71 ClientWidth = 626 73 72 object EditTerminal: TEdit 74 73 Left = 152 75 Height = 2874 Height = 33 76 75 Top = 16 77 76 Width = 400 … … 81 80 object LabelTerminal: TLabel 82 81 Left = 8 83 Height = 2 082 Height = 23 84 83 Top = 16 85 Width = 6184 Width = 70 86 85 Caption = 'Terminal:' 87 86 ParentColor = False … … 90 89 object TabSheetNonTerminal: TTabSheet 91 90 Caption = 'NonTerminal' 92 ClientHeight = 2 5893 ClientWidth = 62 491 ClientHeight = 260 92 ClientWidth = 626 94 93 object LabelNonTerminal: TLabel 95 94 Left = 8 … … 107 106 Anchors = [akTop, akLeft, akRight, akBottom] 108 107 ItemHeight = 0 108 ScrollWidth = 482 109 109 TabOrder = 0 110 TopIndex = -1 110 111 end 111 112 end … … 114 115 end 115 116 object TabSheetTerminalRange: TTabSheet 116 Caption = 'T abSheetTerminalRange'117 ClientHeight = 2 58118 ClientWidth = 62 4117 Caption = 'Terminal range' 118 ClientHeight = 260 119 ClientWidth = 626 119 120 object LabelTerminal1: TLabel 120 121 Left = 8 121 Height = 2 0122 Height = 23 122 123 Top = 16 123 Width = 97124 Width = 112 124 125 Caption = 'Terminal from:' 125 126 ParentColor = False … … 127 128 object EditTerminalFrom: TEdit 128 129 Left = 152 129 Height = 28130 Height = 33 130 131 Top = 16 131 132 Width = 400 … … 135 136 object LabelTerminal2: TLabel 136 137 Left = 8 137 Height = 2 0138 Height = 23 138 139 Top = 56 139 Width = 79140 Width = 90 140 141 Caption = 'Terminal to:' 141 142 ParentColor = False … … 143 144 object EditTerminalTo: TEdit 144 145 Left = 152 145 Height = 28146 Height = 33 146 147 Top = 56 147 148 Width = 400 … … 153 154 object CheckBoxOptional: TCheckBox 154 155 Left = 16 155 Height = 2 4156 Height = 27 156 157 Top = 56 157 Width = 82158 Width = 90 158 159 Caption = 'Optional' 159 160 TabOrder = 4 … … 161 162 object CheckBoxRepetitive: TCheckBox 162 163 Left = 216 163 Height = 2 4164 Height = 27 164 165 Top = 56 165 Width = 9 1166 Width = 99 166 167 Caption = 'Repetitive' 167 168 TabOrder = 5 … … 169 170 object CheckBoxAnyExcept: TCheckBox 170 171 Left = 400 171 Height = 2 4172 Height = 27 172 173 Top = 56 173 Width = 97174 Width = 106 174 175 Caption = 'Any except' 175 176 TabOrder = 6
Note:
See TracChangeset
for help on using the changeset viewer.