Skip to content

Commit

Permalink
Open image file by drag drop, by Han
Browse files Browse the repository at this point in the history
  • Loading branch information
pchev committed Sep 17, 2019
1 parent 75f3bf1 commit b5f37db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pu_main.lfm
Expand Up @@ -4,6 +4,7 @@ object f_main: Tf_main
Top = 136
Width = 1000
ActiveControl = PageControlRight
AllowDropFiles = True
Caption = 'CCD Ciel'
ClientHeight = 580
ClientWidth = 1000
Expand All @@ -16,6 +17,7 @@ object f_main: Tf_main
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
OnDropFiles = FormDropFiles
OnKeyDown = FormKeyDown
OnResize = FormResize
OnShow = FormShow
Expand Down
13 changes: 13 additions & 0 deletions src/pu_main.pas
Expand Up @@ -317,6 +317,7 @@ Tf_main = class(TForm)
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormResize(Sender: TObject);
procedure FormShow(Sender: TObject);
Expand Down Expand Up @@ -2497,6 +2498,18 @@ procedure Tf_main.FormDestroy(Sender: TObject);
end;
end;

procedure Tf_main.FormDropFiles(Sender: TObject;
const FileNames: array of String);
var
fext:string;
begin
fext:=uppercase(extractfileext(FileNames[0]));{take the first file name in the drop list}
if ((fext='.FIT') or (fext='.FITS') or (fext='.FTS')) then
LoadFitsFile(FileNames[0]) {load fits file}
else
LoadPictureFile(FileNames[0]); {load picture file}
end;

procedure Tf_main.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case Key of
Expand Down

0 comments on commit b5f37db

Please sign in to comment.