source: dev/ProjectEditor/Rad_UndoRedo.cpp@ 139

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