1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 10:42:20 -05:00

Added support for dragging files. Not tested at UNIX-based/compatible platforms but it should work just as good as in any other platform.

It also takes care of the Windows fileswapping bug, of OpenInNewTab = false and some other kewl stuff. Besides I can now actually say I coded on Simba ;)

Markus

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@576 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Markus 2010-03-03 17:56:05 +00:00
parent a8664634a9
commit d045081643
2 changed files with 37 additions and 2 deletions

View File

@ -1,9 +1,10 @@
object Form1: TForm1
Left = 273
Left = 433
Height = 555
Top = 233
Top = 224
Width = 739
ActiveControl = ScriptPanel
AllowDropFiles = True
Caption = 'THA FUKING SIMBA'
ClientHeight = 535
ClientWidth = 739
@ -12,6 +13,7 @@ object Form1: TForm1
OnClose = FormClose
OnCreate = FormCreate
OnDestroy = FormDestroy
OnDropFiles = FormDropFiles
OnShortCut = FormShortCuts
LCLVersion = '0.9.29'
Visible = True

View File

@ -243,6 +243,7 @@ type
procedure editSearchListKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure editSearchListKeyPress(Sender: TObject; var Key: char);
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
procedure FunctionListChange(Sender: TObject; Node: TTreeNode);
procedure FunctionListEnter(Sender: TObject);
procedure FunctionListExit(Sender: TObject);
@ -1421,6 +1422,38 @@ begin
end;
end;
procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of String
);
var
response, i : integer;
OldFileSetting : string;
begin
if (length(FileNames) = 1) then
begin
LoadScriptFile(FileNames[0]); //One file saves us some work
exit;
end;
if (length(FileNames) > 5) then //> 5 seems nice to me, cant imagine you want to open that many scripts on a regular base
response := MessageDlg('Are you sure you want to open '+inttostr(length(filenames))+
' scripts?', mtConfirmation, mbYesNo, 0);
case response of
IDNO: exit;
end;
//Its plain stupid opening all of those files in just one tab -.-
OldFileSetting := SettingsForm.Settings.GetKeyValue('Settings/Tabs/OpenScriptInNewTab');
SettingsForm.Settings.SetKeyValue('Settings/Tabs/OpenScriptInNewTab', 'True');
{$IfDef WINDOWS}
//Fix for the really old Windows kernel bug which probably will never be fixed
for i := 1 to high(filenames) do
LoadScriptFile(FileNames[i]);
LoadScriptFile(FileNames[0]);
{$Else} //in this case its tolerable as Windows is the only OS with this bug
for i := 0 to high(filenames) do
LoadScriptFile(FileNames[i]);
{$EndIf};
SettingsForm.Settings.SetKeyValue('Settings/Tabs/OpenScriptInNewTab', OldFileSetting);
end;
procedure TForm1.FunctionListChange(Sender: TObject; Node: TTreeNode);
var
MethodInfo : TMethodInfo;