diff --git a/ide/main.pp b/ide/main.pp index dedeba3c7b..9641215fe7 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -148,6 +148,7 @@ type procedure OnApplicationActivate(Sender: TObject); procedure OnApplicationKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure OnApplicationDropFiles(Sender: TObject; const FileNames: array of String); procedure OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm); procedure OnRemoteControlTimer(Sender: TObject); @@ -1170,6 +1171,7 @@ begin Application.AddOnIdleHandler(@OnApplicationIdle); Application.AddOnActivateHandler(@OnApplicationActivate); Application.AddOnKeyDownHandler(@OnApplicationKeyDown); + Application.AddOnDropFilesHandler(@OnApplicationDropFiles); Screen.AddHandlerRemoveForm(@OnScreenRemoveForm); SetupHints; @@ -12740,6 +12742,36 @@ begin end; end; +procedure TMainIDE.OnApplicationDropFiles(Sender: TObject; const FileNames: array of String); +var + OpenFlags: TOpenFlags; + I: Integer; + AFilename: String; +begin + //debugln('TMainIDE.OnApplicationDropFiles FileNames=', dbgs(Length(FileNames))); + if Length(FileNames) > 0 then + begin + OpenFlags := [ofAddToRecent]; + if Length(FileNames) > 1 then + Include(OpenFlags, ofRegularFile); + + for I := 0 to High(FileNames) do + begin + AFilename := CleanAndExpandFilename(FileNames[I]); + + if I < High(FileNames) then + Include(OpenFlags, ofMultiOpen) + else + Exclude(OpenFlags, ofMultiOpen); + + if DoOpenEditorFile(AFilename, -1, OpenFlags) = mrAbort then Break; + end; + + SetRecentFilesMenu; + SaveEnvironment; + end; +end; + procedure TMainIDE.OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm); begin HiddenWindowsOnRun.Remove(AForm); diff --git a/ide/uniteditor.lfm b/ide/uniteditor.lfm index ea2b98eeee..6c909795e3 100644 --- a/ide/uniteditor.lfm +++ b/ide/uniteditor.lfm @@ -1,14 +1,17 @@ -object SourceNotebook: TSourceNotebook +inherited SourceNotebook: TSourceNotebook Left = 533 Height = 300 Top = 374 Width = 400 HorzScrollBar.Page = 399 VertScrollBar.Page = 299 + AllowDropFiles = True Caption = 'SourceNotebook' + ClientHeight = 300 + ClientWidth = 400 object StatusBar: TStatusBar - Height = 23 - Top = 277 + Height = 20 + Top = 280 Width = 400 Panels = < item diff --git a/ide/uniteditor.lrs b/ide/uniteditor.lrs index a493401fa6..fefbcdd175 100644 --- a/ide/uniteditor.lrs +++ b/ide/uniteditor.lrs @@ -1,8 +1,11 @@ +{ This is an automatically generated lazarus resource file } + LazarusResources.Add('TSourceNotebook','FORMDATA',[ - 'TPF0'#15'TSourceNotebook'#14'SourceNotebook'#4'Left'#3#21#2#6'Height'#3','#1 - +#3'Top'#3'v'#1#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertScroll' - +'Bar.Page'#3'+'#1#7'Caption'#6#14'SourceNotebook'#0#10'TStatusBar'#9'StatusB' - +'ar'#6'Height'#2#23#3'Top'#3#21#1#5'Width'#3#144#1#6'Panels'#14#1#5'Width'#2 + 'TPF0'#241#15'TSourceNotebook'#14'SourceNotebook'#4'Left'#3#21#2#6'Height'#3 + +','#1#3'Top'#3'v'#1#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143#1#18'VertS' + +'crollBar.Page'#3'+'#1#14'AllowDropFiles'#9#7'Caption'#6#14'SourceNotebook' + +#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#0#10'TStatusBar'#9'StatusBa' + +'r'#6'Height'#2#20#3'Top'#3#24#1#5'Width'#3#144#1#6'Panels'#14#1#5'Width'#2 +'d'#0#1#5'Width'#3#150#0#0#1#5'Width'#2'2'#0#1#4'Text'#6#3'INS'#5'Width'#2'2' +#0#0#10'SimpleText'#6#14'This is a test'#11'SimplePanel'#8#0#0#0 ]);