mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 03:59:17 +02:00
IDE: open files dropped on the source editor
git-svn-id: trunk@13801 -
This commit is contained in:
parent
4af440554d
commit
37a80ea14c
32
ide/main.pp
32
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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
]);
|
||||
|
Loading…
Reference in New Issue
Block a user