source: dev/trunk/ab5.0/abdev/abdev/Rad_UndoRedo.cpp@ 615

Last change on this file since 615 was 615, checked in by dai_9181, 16 years ago

WindowInfosクラスを追加。

File size: 22.8 KB
Line 
1#include "stdafx.h"
2
3#include "Common.h"
4
5void Rad_UndoCommand(int WndNum){
6 extern HINSTANCE hInst;
7 extern MDIINFO MdiInfo[MAX_WNDNUM];
8 int i;
9 DWORD dw;
10 char *temporary;
11 RAD_UNDOSTATE *pUndoState;
12
13 pUndoState=&MdiInfo[WndNum].MdiRadInfo->undo;
14 i=pUndoState->NowPos-1;
15 if(i==-1) i=MAX_UNDONUM-1;
16 if(!pUndoState->Command[i]){
17 MessageBeep(0);
18 return;
19 }
20 pUndoState->NowPos=i;
21
22 WindowInfo *pWindowInfo = GetWndInfo(MdiInfo[WndNum].path);
23 int WndInfoNum = GetWndInfoNum(MdiInfo[WndNum].path);
24 switch(pUndoState->Command[pUndoState->NowPos]){
25 case RAD_UNDO_INSERTITEM:
26 DeleteDlgItem(WndNum,WndInfoNum,pUndoState->SelectItemNum[pUndoState->NowPos],0);
27 MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]=-1;
28 break;
29 case RAD_UNDO_DELETEITEM:
30 CHILDINFO *pChildInfo;
31 RECT rect;
32 pChildInfo=(CHILDINFO *)pUndoState->lpdwData[pUndoState->NowPos];
33 rect.left=pChildInfo->pos.x;
34 rect.top=pChildInfo->pos.y;
35 rect.right=pChildInfo->pos.x+pChildInfo->size.cx;
36 rect.bottom=pChildInfo->pos.y+pChildInfo->size.cy;
37 InsertDlgItem(WndNum,WndInfoNum,pUndoState->SelectItemNum[pUndoState->NowPos],
38 &pChildInfo->pos,&pChildInfo->size,
39 pChildInfo->IdName,pChildInfo->caption,pChildInfo->style,pChildInfo->ExStyle,pChildInfo->Control,pChildInfo->ImageCtrlInfo.type,pChildInfo->ImageCtrlInfo.path,0);
40 break;
41 case RAD_UNDO_NAME:
42 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
43 RAD_UNDOSTATE_NAME *names;
44 names=(RAD_UNDOSTATE_NAME *)pUndoState->lpdwData[pUndoState->NowPos];
45
46 temporary=pWindowInfo->name;
47 pWindowInfo->name=names->name;
48 names->name=temporary;
49 GlobalFree(MdiInfo[WndNum].path);
50 MdiInfo[WndNum].path=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pWindowInfo->name)+1);
51 lstrcpy(MdiInfo[WndNum].path,pWindowInfo->name);
52
53 temporary=pWindowInfo->HandleName;
54 pWindowInfo->HandleName=names->HandleName;
55 names->HandleName=temporary;
56
57 temporary=pWindowInfo->CallBackName;
58 pWindowInfo->CallBackName=names->CallBackName;
59 names->CallBackName=temporary;
60 }
61 else{
62 temporary=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].IdName;
63 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].IdName=(char *)pUndoState->lpdwData[pUndoState->NowPos];
64 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
65 }
66 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
67 ChangePropertyWindow(WndNum,WndInfoNum);
68 break;
69 case RAD_UNDO_CAPTION:
70 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
71 temporary=pWindowInfo->caption;
72 pWindowInfo->caption=(char *)pUndoState->lpdwData[pUndoState->NowPos];
73 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
74 }
75 else{
76 temporary=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].caption;
77 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].caption=(char *)pUndoState->lpdwData[pUndoState->NowPos];
78 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
79 }
80 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
81 ChangePropertyWindow(WndNum,WndInfoNum);
82 DrawRadWindow(WndNum,pWindowInfo);
83 break;
84 case RAD_UNDO_FONT:
85 LOGFONT *pLogFont,lf;
86 pLogFont=(LOGFONT *)pUndoState->lpdwData[pUndoState->NowPos];
87 lf=pWindowInfo->LogFont;
88 pWindowInfo->LogFont=*pLogFont;
89 *pLogFont=lf;
90 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
91 ChangePropertyWindow(WndNum,WndInfoNum);
92 DrawRadWindow(WndNum,pWindowInfo);
93 break;
94 case RAD_UNDO_BGCOLOR:
95 dw=pWindowInfo->bgColor;
96 pWindowInfo->bgColor=pUndoState->lpdwData[pUndoState->NowPos];
97 pUndoState->lpdwData[pUndoState->NowPos]=dw;
98 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
99 ChangePropertyWindow(WndNum,WndInfoNum);
100 DrawRadWindow(WndNum,pWindowInfo);
101 break;
102 case RAD_UNDO_WINDOWMENU:
103 temporary=pWindowInfo->MenuID;
104 pWindowInfo->MenuID=(char *)pUndoState->lpdwData[pUndoState->NowPos];
105 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
106 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
107 ChangePropertyWindow(WndNum,WndInfoNum);
108 break;
109 case RAD_UNDO_ICONRES:
110 temporary=pWindowInfo->IconResName;
111 pWindowInfo->IconResName=(char *)pUndoState->lpdwData[pUndoState->NowPos];
112 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
113 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
114 ChangePropertyWindow(WndNum,WndInfoNum);
115 break;
116 case RAD_UNDO_STYLE:
117 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
118 dw=pWindowInfo->style;
119 pWindowInfo->style=pUndoState->lpdwData[pUndoState->NowPos];
120 pUndoState->lpdwData[pUndoState->NowPos]=dw;
121 }
122 else{
123 dw=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].style;
124 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].style=pUndoState->lpdwData[pUndoState->NowPos];
125 pUndoState->lpdwData[pUndoState->NowPos]=dw;
126 }
127 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
128 ChangePropertyWindow(WndNum,WndInfoNum);
129 DrawRadWindow(WndNum,pWindowInfo);
130 break;
131 case RAD_UNDO_EXSTYLE:
132 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
133 dw=pWindowInfo->ExStyle;
134 pWindowInfo->ExStyle=pUndoState->lpdwData[pUndoState->NowPos];
135 pUndoState->lpdwData[pUndoState->NowPos]=dw;
136 }
137 else{
138 dw=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ExStyle;
139 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ExStyle=pUndoState->lpdwData[pUndoState->NowPos];
140 pUndoState->lpdwData[pUndoState->NowPos]=dw;
141 }
142 DrawRadWindow(WndNum,pWindowInfo);
143 break;
144 case RAD_UNDO_POSITION:
145 POINTANDSIZE PointAndSize,*pReadPointAndSize;
146 pReadPointAndSize=(POINTANDSIZE *)pUndoState->lpdwData[pUndoState->NowPos];
147 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
148 PointAndSize.size=pWindowInfo->size;
149 pWindowInfo->size=pReadPointAndSize->size;
150 }
151 else{
152 PointAndSize.pos=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].pos;
153 PointAndSize.size=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].size;
154 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].pos=pReadPointAndSize->pos;
155 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].size=pReadPointAndSize->size;
156 }
157 *pReadPointAndSize=PointAndSize;
158 DrawRadWindow(WndNum,pWindowInfo);
159 SetStatusText(NULL);
160
161 //サポートダイアログの内容をセット
162 SetSupportDlgData( WndNum, *pWindowInfo );
163 break;
164 case RAD_UNDO_IMAGESTATE:
165 IMAGECTRLINFO *pImageCtrlInfo;
166 pImageCtrlInfo=(IMAGECTRLINFO *)pUndoState->lpdwData[pUndoState->NowPos];
167
168 dw=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.type;
169 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.type=pImageCtrlInfo->type;
170 pImageCtrlInfo->type=dw;
171
172 dw=(DWORD)pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.path;
173 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.path=pImageCtrlInfo->path;
174 pImageCtrlInfo->path=(char *)dw;
175
176 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
177 ChangePropertyWindow(WndNum,WndInfoNum);
178 DrawRadWindow(WndNum,pWindowInfo);
179 break;
180 case RAD_UNDO_TYPE:
181 dw=pWindowInfo->type;
182 pWindowInfo->type=pUndoState->lpdwData[pUndoState->NowPos];
183 pUndoState->lpdwData[pUndoState->NowPos]=dw;
184 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
185 ChangePropertyWindow(WndNum,WndInfoNum);
186 break;
187 }
188
189 ProjectInfo.ModifyOfMaterial=1;
190
191 ResetState_UndoMenu();
192}
193void Rad_RedoCommand(int WndNum){
194 extern HINSTANCE hInst;
195 extern MDIINFO MdiInfo[MAX_WNDNUM];
196 DWORD dw;
197 char *temporary;
198 RAD_UNDOSTATE *pUndoState;
199 CHILDINFO *pChildInfo;
200 RECT rect;
201
202 pUndoState=&MdiInfo[WndNum].MdiRadInfo->undo;
203 if(!pUndoState->Command[pUndoState->NowPos]){
204 MessageBeep(0);
205 return;
206 }
207
208 WindowInfo *pWindowInfo = GetWndInfo(MdiInfo[WndNum].path);
209 int WndInfoNum = GetWndInfoNum(MdiInfo[WndNum].path);
210 switch(pUndoState->Command[pUndoState->NowPos]){
211 case RAD_UNDO_INSERTITEM:
212 pChildInfo=(CHILDINFO *)pUndoState->lpdwData[pUndoState->NowPos];
213 rect.left=pChildInfo->pos.x;
214 rect.top=pChildInfo->pos.y;
215 rect.right=pChildInfo->pos.x+pChildInfo->size.cx;
216 rect.bottom=pChildInfo->pos.y+pChildInfo->size.cy;
217 InsertDlgItem(WndNum,WndInfoNum,pUndoState->SelectItemNum[pUndoState->NowPos],
218 &pChildInfo->pos,&pChildInfo->size,
219 pChildInfo->IdName,pChildInfo->caption,pChildInfo->style,pChildInfo->ExStyle,pChildInfo->Control,pChildInfo->ImageCtrlInfo.type,pChildInfo->ImageCtrlInfo.path,0);
220 break;
221 case RAD_UNDO_DELETEITEM:
222 DeleteDlgItem(WndNum,WndInfoNum,pUndoState->SelectItemNum[pUndoState->NowPos],0);
223 MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]=-1;
224 break;
225 case RAD_UNDO_NAME:
226 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
227 RAD_UNDOSTATE_NAME *names;
228 names=(RAD_UNDOSTATE_NAME *)pUndoState->lpdwData[pUndoState->NowPos];
229
230 temporary=pWindowInfo->name;
231 pWindowInfo->name=names->name;
232 names->name=temporary;
233 GlobalFree(MdiInfo[WndNum].path);
234 MdiInfo[WndNum].path=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pWindowInfo->name)+1);
235 lstrcpy(MdiInfo[WndNum].path,pWindowInfo->name);
236
237 temporary=pWindowInfo->HandleName;
238 pWindowInfo->HandleName=names->HandleName;
239 names->HandleName=temporary;
240
241 temporary=pWindowInfo->CallBackName;
242 pWindowInfo->CallBackName=names->CallBackName;
243 names->CallBackName=temporary;
244 }
245 else{
246 temporary=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].IdName;
247 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].IdName=(char *)pUndoState->lpdwData[pUndoState->NowPos];
248 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
249 }
250 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
251 ChangePropertyWindow(WndNum,WndInfoNum);
252 break;
253 case RAD_UNDO_CAPTION:
254 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
255 temporary=pWindowInfo->caption;
256 pWindowInfo->caption=(char *)pUndoState->lpdwData[pUndoState->NowPos];
257 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
258 }
259 else{
260 temporary=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].caption;
261 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].caption=(char *)pUndoState->lpdwData[pUndoState->NowPos];
262 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
263 }
264 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
265 ChangePropertyWindow(WndNum,WndInfoNum);
266 DrawRadWindow(WndNum,pWindowInfo);
267 break;
268 case RAD_UNDO_FONT:
269 LOGFONT *pLogFont,lf;
270 pLogFont=(LOGFONT *)pUndoState->lpdwData[pUndoState->NowPos];
271 lf=pWindowInfo->LogFont;
272 pWindowInfo->LogFont=*pLogFont;
273 *pLogFont=lf;
274 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
275 ChangePropertyWindow(WndNum,WndInfoNum);
276 DrawRadWindow(WndNum,pWindowInfo);
277 break;
278 case RAD_UNDO_BGCOLOR:
279 dw=pWindowInfo->bgColor;
280 pWindowInfo->bgColor=pUndoState->lpdwData[pUndoState->NowPos];
281 pUndoState->lpdwData[pUndoState->NowPos]=dw;
282 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
283 ChangePropertyWindow(WndNum,WndInfoNum);
284 DrawRadWindow(WndNum,pWindowInfo);
285 break;
286 case RAD_UNDO_WINDOWMENU:
287 temporary=pWindowInfo->MenuID;
288 pWindowInfo->MenuID=(char *)pUndoState->lpdwData[pUndoState->NowPos];
289 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
290 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
291 ChangePropertyWindow(WndNum,WndInfoNum);
292 break;
293 case RAD_UNDO_ICONRES:
294 temporary=pWindowInfo->IconResName;
295 pWindowInfo->IconResName=(char *)pUndoState->lpdwData[pUndoState->NowPos];
296 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temporary;
297 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
298 ChangePropertyWindow(WndNum,WndInfoNum);
299 break;
300 case RAD_UNDO_STYLE:
301 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
302 dw=pWindowInfo->style;
303 pWindowInfo->style=pUndoState->lpdwData[pUndoState->NowPos];
304 pUndoState->lpdwData[pUndoState->NowPos]=dw;
305 }
306 else{
307 dw=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].style;
308 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].style=pUndoState->lpdwData[pUndoState->NowPos];
309 pUndoState->lpdwData[pUndoState->NowPos]=dw;
310 }
311 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
312 ChangePropertyWindow(WndNum,WndInfoNum);
313 DrawRadWindow(WndNum,pWindowInfo);
314 break;
315 case RAD_UNDO_EXSTYLE:
316 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
317 dw=pWindowInfo->ExStyle;
318 pWindowInfo->ExStyle=pUndoState->lpdwData[pUndoState->NowPos];
319 pUndoState->lpdwData[pUndoState->NowPos]=dw;
320 }
321 else{
322 dw=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ExStyle;
323 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ExStyle=pUndoState->lpdwData[pUndoState->NowPos];
324 pUndoState->lpdwData[pUndoState->NowPos]=dw;
325 }
326 DrawRadWindow(WndNum,pWindowInfo);
327 break;
328 case RAD_UNDO_POSITION:
329 POINTANDSIZE PointAndSize,*pReadPointAndSize;
330 pReadPointAndSize=(POINTANDSIZE *)pUndoState->lpdwData[pUndoState->NowPos];
331 if(pUndoState->SelectItemNum[pUndoState->NowPos]==SELECT_WINDOW){
332 PointAndSize.size=pWindowInfo->size;
333 pWindowInfo->size=pReadPointAndSize->size;
334 }
335 else{
336 PointAndSize.pos=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].pos;
337 PointAndSize.size=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].size;
338 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].pos=pReadPointAndSize->pos;
339 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].size=pReadPointAndSize->size;
340 }
341 *pReadPointAndSize=PointAndSize;
342 DrawRadWindow(WndNum,pWindowInfo);
343 SetStatusText(NULL);
344
345 //サポートダイアログの内容をセット
346 SetSupportDlgData( WndNum, *pWindowInfo );
347 break;
348 case RAD_UNDO_IMAGESTATE:
349 IMAGECTRLINFO *pImageCtrlInfo;
350 pImageCtrlInfo=(IMAGECTRLINFO *)pUndoState->lpdwData[pUndoState->NowPos];
351
352 dw=pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.type;
353 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.type=pImageCtrlInfo->type;
354 pImageCtrlInfo->type=dw;
355
356 dw=(DWORD)pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.path;
357 pWindowInfo->pChildInfo[pUndoState->SelectItemNum[pUndoState->NowPos]].ImageCtrlInfo.path=pImageCtrlInfo->path;
358 pImageCtrlInfo->path=(char *)dw;
359
360 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
361 ChangePropertyWindow(WndNum,WndInfoNum);
362 DrawRadWindow(WndNum,pWindowInfo);
363 break;
364 case RAD_UNDO_TYPE:
365 dw=pWindowInfo->type;
366 pWindowInfo->type=pUndoState->lpdwData[pUndoState->NowPos];
367 pUndoState->lpdwData[pUndoState->NowPos]=dw;
368 if(pUndoState->SelectItemNum[pUndoState->NowPos]==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0])
369 ChangePropertyWindow(WndNum,WndInfoNum);
370 break;
371 }
372
373 pUndoState->NowPos++;
374 if(pUndoState->NowPos==MAX_UNDONUM) pUndoState->NowPos=0;
375
376 ProjectInfo.ModifyOfMaterial=1;
377
378 ResetState_UndoMenu();
379}
380void Rad_DeleteUndoData(int WndNum,int pos){
381 extern HANDLE hHeap;
382 extern MDIINFO MdiInfo[MAX_WNDNUM];
383 RAD_UNDOSTATE *pUndoState;
384
385 pUndoState=&MdiInfo[WndNum].MdiRadInfo->undo;
386 switch(pUndoState->Command[pos]){
387 case RAD_UNDO_INSERTITEM:
388 case RAD_UNDO_DELETEITEM:
389 CHILDINFO *pChildInfo;
390 pChildInfo=(CHILDINFO *)pUndoState->lpdwData[pos];
391 HeapDefaultFree(pChildInfo->IdName);
392 HeapDefaultFree(pChildInfo->caption);
393 if(pChildInfo->Control==CT_IMAGEBOX){
394 //イメージ ボックスの場合
395 HeapDefaultFree(pChildInfo->ImageCtrlInfo.path);
396 }
397 HeapDefaultFree(pChildInfo);
398 break;
399 case RAD_UNDO_NAME:
400 if(pUndoState->SelectItemNum[pos]==SELECT_WINDOW){
401 RAD_UNDOSTATE_NAME *names;
402 names=(RAD_UNDOSTATE_NAME *)pUndoState->lpdwData[pos];
403 HeapDefaultFree(names->name);
404 HeapDefaultFree(names->HandleName);
405 HeapDefaultFree(names->CallBackName);
406 HeapDefaultFree(names);
407 }
408 else HeapDefaultFree((void *)pUndoState->lpdwData[pos]);
409 break;
410 case RAD_UNDO_CAPTION:
411 HeapDefaultFree((void *)pUndoState->lpdwData[pos]);
412 break;
413 case RAD_UNDO_FONT:
414 HeapDefaultFree((void *)pUndoState->lpdwData[pos]);
415 break;
416 case RAD_UNDO_WINDOWMENU:
417 if(pUndoState->lpdwData[pos])
418 HeapDefaultFree((void *)pUndoState->lpdwData[pos]);
419 break;
420 case RAD_UNDO_ICONRES:
421 if(pUndoState->lpdwData[pos])
422 HeapDefaultFree((void *)pUndoState->lpdwData[pos]);
423 break;
424 case RAD_UNDO_POSITION:
425 HeapDefaultFree((void *)pUndoState->lpdwData[pos]);
426 break;
427 case RAD_UNDO_IMAGESTATE:
428 IMAGECTRLINFO *pImageCtrlInfo;
429 pImageCtrlInfo=(IMAGECTRLINFO *)pUndoState->lpdwData[pos];
430 HeapDefaultFree(pImageCtrlInfo->path);
431 HeapDefaultFree(pImageCtrlInfo);
432 break;
433 }
434 pUndoState->Command[pos]=0;
435}
436void Rad_NoticeChanging(int WndNum,int Command,int SelectItemNum,DWORD dwData){
437 extern HANDLE hHeap;
438 extern MDIINFO MdiInfo[MAX_WNDNUM];
439 int i;
440 char *temporary,*temp2;
441 RAD_UNDOSTATE *pUndoState;
442
443 pUndoState=&MdiInfo[WndNum].MdiRadInfo->undo;
444
445 //Redoされた場合の不要なデータを削除する
446 for(i=pUndoState->NowPos;;i++){
447 if(i==MAX_UNDONUM) i=0;
448 if(pUndoState->Command[i]==0) break;
449 Rad_DeleteUndoData(WndNum,i);
450 }
451
452 pUndoState->Command[pUndoState->NowPos]=Command;
453 pUndoState->SelectItemNum[pUndoState->NowPos]=SelectItemNum;
454 switch(Command){
455 case RAD_UNDO_INSERTITEM:
456 case RAD_UNDO_DELETEITEM:
457 CHILDINFO *pChildInfo,*pSaveChildInfo;
458 pChildInfo=(CHILDINFO *)dwData;
459 pSaveChildInfo=(CHILDINFO *)HeapAlloc(hHeap,0,sizeof(CHILDINFO));
460 pSaveChildInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(pChildInfo->IdName)+1);
461 lstrcpy(pSaveChildInfo->IdName,pChildInfo->IdName);
462 pSaveChildInfo->pos=pChildInfo->pos;
463 pSaveChildInfo->size=pChildInfo->size;
464 pSaveChildInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(pChildInfo->caption)+1);
465 lstrcpy(pSaveChildInfo->caption,pChildInfo->caption);
466 pSaveChildInfo->style=pChildInfo->style;
467 pSaveChildInfo->ExStyle=pChildInfo->ExStyle;
468 pSaveChildInfo->Control=pChildInfo->Control;
469 if(pChildInfo->Control==CT_IMAGEBOX){
470 //イメージ ボックスの場合
471 pSaveChildInfo->ImageCtrlInfo.type=pChildInfo->ImageCtrlInfo.type;
472 pSaveChildInfo->ImageCtrlInfo.path=(char *)HeapAlloc(hHeap,0,lstrlen(pChildInfo->ImageCtrlInfo.path)+1);
473 lstrcpy(pSaveChildInfo->ImageCtrlInfo.path,pChildInfo->ImageCtrlInfo.path);
474 }
475 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)pSaveChildInfo;
476 break;
477 case RAD_UNDO_NAME:
478 if(SelectItemNum==SELECT_WINDOW){
479 RAD_UNDOSTATE_NAME *names,*SaveNames;
480 names=(RAD_UNDOSTATE_NAME *)dwData;
481 SaveNames=(RAD_UNDOSTATE_NAME *)HeapAlloc(hHeap,0,sizeof(RAD_UNDOSTATE_NAME));
482 SaveNames->name=(char *)HeapAlloc(hHeap,0,lstrlen(names->name)+1);
483 lstrcpy(SaveNames->name,names->name);
484 SaveNames->HandleName=(char *)HeapAlloc(hHeap,0,lstrlen(names->HandleName)+1);
485 lstrcpy(SaveNames->HandleName,names->HandleName);
486 SaveNames->CallBackName=(char *)HeapAlloc(hHeap,0,lstrlen(names->CallBackName)+1);
487 lstrcpy(SaveNames->CallBackName,names->CallBackName);
488 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)SaveNames;
489 }
490 else{
491 temporary=(char *)dwData;
492 temp2=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
493 lstrcpy(temp2,temporary);
494 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temp2;
495 }
496 break;
497 case RAD_UNDO_CAPTION:
498 temporary=(char *)dwData;
499 temp2=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
500 lstrcpy(temp2,temporary);
501 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temp2;
502 break;
503 case RAD_UNDO_FONT:
504 LOGFONT *pLogFont,*pSaveLogFont;
505 pLogFont=(LOGFONT *)dwData;
506 pSaveLogFont=(LOGFONT *)HeapAlloc(hHeap,0,sizeof(LOGFONT));
507 *pSaveLogFont=*pLogFont;
508 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)pSaveLogFont;
509 break;
510 case RAD_UNDO_BGCOLOR:
511 pUndoState->lpdwData[pUndoState->NowPos]=dwData;
512 break;
513 case RAD_UNDO_WINDOWMENU:
514 case RAD_UNDO_ICONRES:
515 if(!dwData) pUndoState->lpdwData[pUndoState->NowPos]=0;
516 else{
517 temporary=(char *)dwData;
518 temp2=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
519 lstrcpy(temp2,temporary);
520 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)temp2;
521 }
522 break;
523 case RAD_UNDO_STYLE:
524 case RAD_UNDO_EXSTYLE:
525 pUndoState->lpdwData[pUndoState->NowPos]=dwData;
526 break;
527 case RAD_UNDO_POSITION:
528 POINTANDSIZE *pPointAndSize,*pSavePointAndSize;
529 pPointAndSize=(POINTANDSIZE *)dwData;
530 pSavePointAndSize=(POINTANDSIZE *)HeapAlloc(hHeap,0,sizeof(POINTANDSIZE));
531 pSavePointAndSize->pos=pPointAndSize->pos;
532 pSavePointAndSize->size=pPointAndSize->size;
533 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)pSavePointAndSize;
534 break;
535 case RAD_UNDO_IMAGESTATE:
536 IMAGECTRLINFO *pImageCtrlInfo,*pSaveImageCtrlInfo;
537 pImageCtrlInfo=(IMAGECTRLINFO *)dwData;
538 pSaveImageCtrlInfo=(IMAGECTRLINFO *)HeapAlloc(hHeap,0,sizeof(IMAGECTRLINFO));
539 pSaveImageCtrlInfo->type=pImageCtrlInfo->type;
540 pSaveImageCtrlInfo->path=(char *)HeapAlloc(hHeap,0,lstrlen(pImageCtrlInfo->path)+1);
541 lstrcpy(pSaveImageCtrlInfo->path,pImageCtrlInfo->path);
542 pUndoState->lpdwData[pUndoState->NowPos]=(DWORD)pSaveImageCtrlInfo;
543 break;
544 case RAD_UNDO_TYPE:
545 pUndoState->lpdwData[pUndoState->NowPos]=dwData;
546 break;
547 }
548
549 pUndoState->NowPos++;
550 if(pUndoState->NowPos==MAX_UNDONUM) pUndoState->NowPos=0;
551 if(pUndoState->Command[pUndoState->NowPos]){
552 //一番古い情報を切り捨てる
553 Rad_DeleteUndoData(WndNum,pUndoState->NowPos);
554 }
555
556 ProjectInfo.ModifyOfMaterial=1;
557
558 ResetState_UndoMenu();
559}
Note: See TracBrowser for help on using the repository browser.