cdar
diff unit_Editor.pas @ 0:ef71164288c1
begin of using hg for cdar
author | "Meillo r e t u r n s <meillo@marmaro.de>" |
---|---|
date | Sun, 03 Dec 2006 21:54:43 +0100 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/unit_Editor.pas Sun Dec 03 21:54:43 2006 +0100 1.3 @@ -0,0 +1,200 @@ 1.4 +unit unit_Editor; 1.5 + 1.6 +interface//#################################################################################### 1.7 + 1.8 +uses 1.9 + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 1.10 + Dialogs, Menus, ExtCtrls, Buttons, StdCtrls; 1.11 + 1.12 +type 1.13 + Tform_Editor = class(TForm) 1.14 + mnu_Main: TMainMenu; 1.15 + mnu_tutorial: TMenuItem; 1.16 + mnu_WelcomeScreen: TMenuItem; 1.17 + mnu_Autorun: TMenuItem; 1.18 + mnu_CreateAR: TMenuItem; 1.19 + img_Background: TImage; 1.20 + img_button: TImage; 1.21 + mnu_nzl: TMenuItem; 1.22 + mnu_Sprache: TMenuItem; 1.23 + procedure FormClose(Sender: TObject; var Action: TCloseAction); 1.24 + procedure FormCreate(Sender: TObject); 1.25 + procedure mnu_tutorialClick(Sender: TObject); 1.26 + procedure mnu_WelcomeScreenClick(Sender: TObject); 1.27 + procedure mnu_AutorunClick(Sender: TObject); 1.28 + procedure mnu_CreateARClick(Sender: TObject); 1.29 + procedure img_buttonMouseDown(Sender: TObject; Button: TMouseButton; 1.30 + Shift: TShiftState; X, Y: Integer); 1.31 + procedure img_buttonMouseMove(Sender: TObject; Shift: TShiftState; X, 1.32 + Y: Integer); 1.33 + procedure img_buttonMouseUp(Sender: TObject; Button: TMouseButton; 1.34 + Shift: TShiftState; X, Y: Integer); 1.35 + procedure mnu_SpracheClick(Sender: TObject); 1.36 + 1.37 + private 1.38 + dX : integer; 1.39 + dY : integer; 1.40 + public 1.41 + DraggingStatus : byte; 1.42 + 1.43 + PfadHG_neu : String; // 'C:\' 1.44 + PfadEnter_neu : String; // 'C:\' 1.45 + PfadIcon_neu : string; 1.46 + CDRoot_neu : string; 1.47 + xEnter_neu : integer; // '225' 1.48 + yEnter_neu : integer; // '325' 1.49 + WelcomeKind_neu : String; // 'click' 'time' 'none' 1.50 + Delay_neu : byte; // '3000' (in ms) 1.51 + StartsFD_neu : string; 1.52 + 1.53 + PfadHG_alt : String; 1.54 + PfadEnter_alt : String; 1.55 + PfadIcon_alt : string; 1.56 + CDRoot_alt : string; 1.57 + xEnter_alt : integer; 1.58 + yEnter_alt : integer; 1.59 + WelcomeKind_alt : String; 1.60 + Delay_alt : byte; 1.61 + StartsFD_alt : string; 1.62 + 1.63 + Delay : string; 1.64 + englisch : boolean; 1.65 + end; 1.66 + 1.67 +var 1.68 + form_Editor: Tform_Editor; 1.69 + 1.70 +implementation//############################################################################### 1.71 +uses unit_Start, unit_Welcome, unit_Editor_ws, unit_Editor_as, 1.72 + unit_Editor_tutorial, unit_Editor_CreateAR; 1.73 +{$R *.dfm}//################################################################################### 1.74 + 1.75 +//------------------------------------------------------------------------------ form create 1.76 +procedure Tform_Editor.FormCreate(Sender: TObject); 1.77 +begin 1.78 + // close form 'start' 1.79 + form_start.Hide; 1.80 + 1.81 + // init global vars 1.82 + PfadHG_alt := ''; 1.83 + PfadEnter_alt := ''; 1.84 + PfadIcon_alt := ''; 1.85 + CDRoot_alt := 'C:\NewCD\'; 1.86 + xEnter_alt := 0; 1.87 + yEnter_alt := 0; 1.88 + WelcomeKind_alt := 'click'; 1.89 + Delay_alt := 2; 1.90 + StartsFD_alt := ''; 1.91 + Delay := '3'; 1.92 + englisch := true; 1.93 + 1.94 + // background color 1.95 + form_editor.Color := rgb(192,192,192); 1.96 + // dragging dtatus = 0 1.97 + DraggingStatus := 0; 1.98 +end;//-------------------------------------------------------------------------- 1.99 +//------------------------------------------------------------------------------ kill 1.100 +procedure Tform_Editor.FormClose(Sender: TObject; 1.101 + var Action: TCloseAction); 1.102 +begin 1.103 + application.Terminate; 1.104 +end;//-------------------------------------------------------------------------- 1.105 + 1.106 +//############################################################################################# 1.107 + 1.108 +//------------------------------------------------------------------------------ tutorial 1.109 +procedure Tform_Editor.mnu_tutorialClick(Sender: TObject); 1.110 +begin 1.111 + application.CreateForm(tform_editor_tutorial, form_editor_tutorial); 1.112 + form_editor_tutorial.show; 1.113 +end;//-------------------------------------------------------------------------- 1.114 +//------------------------------------------------------------------------------ welcome settings 1.115 +procedure Tform_Editor.mnu_WelcomeScreenClick(Sender: TObject); 1.116 +begin 1.117 + application.CreateForm(tform_editor_ws, form_editor_ws); 1.118 + form_editor_ws.show; 1.119 +end;//-------------------------------------------------------------------------- 1.120 +//------------------------------------------------------------------------------ autorun settings 1.121 +procedure Tform_Editor.mnu_AutorunClick(Sender: TObject); 1.122 +begin 1.123 + application.CreateForm(tform_editor_as, form_editor_as); 1.124 + form_editor_as.show; 1.125 +end;//-------------------------------------------------------------------------- 1.126 +//------------------------------------------------------------------------------ create settings 1.127 +procedure Tform_Editor.mnu_CreateARClick(Sender: TObject); 1.128 +begin 1.129 + application.CreateForm(tform_editor_CreateAR, form_editor_CreateAR); 1.130 + form_editor_CreateAR.show; 1.131 +end;//-------------------------------------------------------------------------- 1.132 +//------------------------------------------------------------------------------ toggle language 1.133 +procedure Tform_Editor.mnu_SpracheClick(Sender: TObject); 1.134 +begin 1.135 + if englisch = true then 1.136 + begin 1.137 + englisch := false; 1.138 + mnu_sprache.caption := ' -> English '; // German 1.139 + mnu_Tutorial.Caption := ' Anleitung '; 1.140 + mnu_WelcomeScreen.Caption := ' Begrüßungsbild Optionen '; 1.141 + mnu_Autorun.Caption := ' Autorun Optionen '; 1.142 + mnu_CreateAR.Caption := ' Autorunner erstellen '; 1.143 + end 1.144 + else 1.145 + begin 1.146 + englisch := true; 1.147 + mnu_sprache.Caption := ' -> Deutsch '; // English 1.148 + mnu_Tutorial.Caption := ' Tutorial '; 1.149 + mnu_WelcomeScreen.Caption := ' Welcome-Screen Settings '; 1.150 + mnu_Autorun.Caption := ' Autorun Settings '; 1.151 + mnu_CreateAR.Caption := ' Create CD-Autorunner '; 1.152 + end; 1.153 +end;//-------------------------------------------------------------------------- 1.154 + 1.155 +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1.156 + 1.157 +//------------------------------------------------------------------------------ // mouse down 1.158 +procedure Tform_Editor.img_buttonMouseDown(Sender: TObject; 1.159 + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1.160 + var MouseArea : trect; 1.161 +begin 1.162 + // right drag'n'drop status needed 1.163 + if DraggingStatus <> 0 then exit; 1.164 + // remember cursor position on 'img_button' 1.165 + dX := x; 1.166 + dY := y; 1.167 + // jail mouse in mousearea 1.168 + mousearea.Left := form_editor.Left + dX + 3; 1.169 + mousearea.Right := form_editor.Left + form_editor.Width - (img_button.Width - dX + 2); 1.170 + mousearea.Top := form_editor.Top + dY + 41; 1.171 + mousearea.Bottom := form_editor.Top + form_editor.Height - (img_button.Height - dY +2); 1.172 + clipcursor(@mousearea); 1.173 + // set drag'n'drop status 1.174 + DraggingStatus := 1; 1.175 +end;//-------------------------------------------------------------------------- 1.176 +//------------------------------------------------------------------------------ // mouse move 1.177 +procedure Tform_Editor.img_buttonMouseMove(Sender: TObject; 1.178 + Shift: TShiftState; X, Y: Integer); 1.179 +begin 1.180 + // right drag'n'drop status needed 1.181 + if (DraggingStatus = 0) or (draggingstatus = 3) then exit; 1.182 + // drag 1.183 + img_button.Left := img_button.Left + (x - dX); 1.184 + img_button.Top := img_button.Top + (y - dY); 1.185 + // set drag'n'drop status 1.186 + DraggingStatus := 2; 1.187 +end;//-------------------------------------------------------------------------- 1.188 +//------------------------------------------------------------------------------ // mouse up 1.189 +procedure Tform_Editor.img_buttonMouseUp(Sender: TObject; 1.190 + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 1.191 +begin 1.192 + // right drag'n'drop status needed 1.193 + if DraggingStatus <> 2 then exit; 1.194 + // free cursor from jail 1.195 + clipcursor(nil); 1.196 + // set 'img_button' coordinated 1.197 + xEnter_alt := img_button.left; 1.198 + yEnter_alt := img_button.top; 1.199 + // set drag'n'drop status 1.200 + DraggingStatus := 0; 1.201 +end;//-------------------------------------------------------------------------- 1.202 + 1.203 +end.//#########################################################################################