{*************************************************************************}
{                                                                         }
{ DQE2.dpr - project's head file                                          }
{                                                                         }
{ This file is a part of the project:                                     }
{   Dizzy Quest Editor - the quest editor for Dizzy-like games            }
{                                                                         }
{ © Parfenov Alexey Andreevich, 2007                                      }
{                                                                         }
{ e-mail: AlkatrazStudio@yandex.ru                                        }
{                                                                         }
{ This program is free software; you can redistribute it and/or modify    }
{ it under the terms of the GNU General Public License as published by    }
{ the Free Software Foundation; either version 2 of the License, or       }
{ (at your option) any later version.                                     }
{                                                                         }
{ This program is distributed in the hope that it will be useful,         }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of          }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            }
{ GNU General Public License for more details.                            }
{                                                                         }
{ You may read GNU General Public License at:                             }
{   http://www.gnu.org/copyleft/gpl.html                                  }
{                                                                         }
{*************************************************************************}
program DQE2;

uses
  Forms,
  windows,
  messages,
  DQE2_Types in '..\Shared\Lib\DQE2_Types.pas',
  MainUnit in 'MainUnit.pas' {Form_Main_DQE},
  GameUnit in 'GameUnit.pas' {Form_Game},
  ZoneUnit in 'ZoneUnit.pas' {Form_Zones},
  ObjectUnit in 'ObjectUnit.pas' {Form_Objects},
  ScriptUnit in 'ScriptUnit.pas' {Form_Scripts},
  DialogUnit in 'DialogUnit.pas' {Form_Dialogs},
  MusicUnit in 'MusicUnit.pas' {Form_Music},
  ItemUnit in 'ItemUnit.pas' {Form_Items},
  EditPhraseUnit in 'EditPhraseUnit.pas' {Form_EditPhrase},
  EditIconUnit in 'EditIconUnit.pas' {Form_EditIcon},
  EditSoundFileUnit in 'EditSoundFileUnit.pas' {Form_EditSoundFile},
  ChooseUnit in 'ChooseUnit.pas' {Form_Choose},
  AboutUnit in 'AboutUnit.pas' {Form_About},
  EditDefaultsUnit in 'EditDefaultsUnit.pas' {Form_EditDefaults},
  GameSettingsUnit in 'GameSettingsUnit.pas' {Form_GameSettings},
  FontUnit in 'FontUnit.pas' {Form_Fonts},
  VarUnit in 'VarUnit.pas' {Form_Vars},
  EditAnswerUnit in 'EditAnswerUnit.pas' {Form_EditAnswer},
  OptionsUnit in 'OptionsUnit.pas' {Form_Options},
  WaitUnit in 'WaitUnit.pas' {Form_Wait},
  SplashUnit in 'SplashUnit.pas' {Form_Splash},
  EditBlendUnit in 'EditBlendUnit.pas' {Form_EditBlend},
  RollbackUnit in 'RollbackUnit.pas' {Form_Rollback},
  DebugUnit in 'DebugUnit.pas' {Form_Debug},
  EntityUnit in 'EntityUnit.pas' {Form_Entities};

{$R *.res}

var
  win:HWND;
  s:array[0..MAX_PATH]of char;
  data:COPYDATASTRUCT;
  n:integer;

begin
  win:=FindWindow(PAnsiChar(string(TForm_Main_DQE.ClassName)),nil);
  if win<>0 then
  begin
    SetForegroundWindow(win);
    if ParamCount>0 then
    begin
      ZeroMemory(@s,sizeof(s));
      n:=length(paramstr(1));
      CopyMemory(@s,PAnsiChar(ParamStr(1)),n);
      data.dwData:=0;
      data.cbData:=n+1;
      data.lpData:=@s;
      SendMessage(win,WM_COPYDATA,0,integer(@data));
    end;
    exit;
  end;
  Application.Initialize;
  Application.Title := 'Dizzy Quest Editor 2';
  Application.CreateForm(TForm_Main_DQE, Form_Main_DQE);
  Application.CreateForm(TForm_Splash, Form_Splash);
  Form_Splash.Show;Application.ProcessMessages;
  Application.CreateForm(TForm_Game, Form_Game);
  Application.CreateForm(TForm_Zones, Form_Zones);
  Application.CreateForm(TForm_Objects, Form_Objects);
  Application.CreateForm(TForm_Entities, Form_Entities);
  Application.CreateForm(TForm_Scripts, Form_Scripts);
  Application.CreateForm(TForm_Dialogs, Form_Dialogs);
  Application.CreateForm(TForm_Music, Form_Music);
  Application.CreateForm(TForm_Items, Form_Items);
  Application.CreateForm(TForm_EditPhrase, Form_EditPhrase);
  Application.CreateForm(TForm_EditIcon, Form_EditIcon);
  Application.CreateForm(TForm_EditSoundFile, Form_EditSoundFile);
  Application.CreateForm(TForm_Choose, Form_Choose);
  Application.CreateForm(TForm_About, Form_About);
  Application.CreateForm(TForm_EditDefaults, Form_EditDefaults);
  Application.CreateForm(TForm_GameSettings, Form_GameSettings);
  Application.CreateForm(TForm_Fonts, Form_Fonts);
  Application.CreateForm(TForm_Vars, Form_Vars);
  Application.CreateForm(TForm_EditAnswer, Form_EditAnswer);
  Application.CreateForm(TForm_Options, Form_Options);
  Application.CreateForm(TForm_Wait, Form_Wait);
  Application.CreateForm(TForm_EditBlend, Form_EditBlend);
  Application.CreateForm(TForm_Debug, Form_Debug);
  Application.CreateForm(TForm_Rollback, Form_Rollback);
  Form_Splash.Hide;
  Application.Run;
end.
