1 | #include "stdafx.h" |
---|
2 | |
---|
3 | #include "Common.h" |
---|
4 | |
---|
5 | using namespace ActiveBasic::IDE; |
---|
6 | |
---|
7 | #if defined(JPN) |
---|
8 | //日本語 |
---|
9 | #include "pj_msg_jpn.h" |
---|
10 | #else |
---|
11 | //英語 |
---|
12 | #include "pj_msg_eng.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | int GetWndInfoNum(char *name){ |
---|
16 | extern PROJECTINFO ProjectInfo; |
---|
17 | int i; |
---|
18 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
19 | if(lstrcmpi(name,ProjectInfo.pWindowInfo[i].name)==0) return i; |
---|
20 | } |
---|
21 | return -1; |
---|
22 | } |
---|
23 | void ChangeDivisionToOrSign(char *CopyBuffer,const char *ReadBuffer){ |
---|
24 | int i,i2; |
---|
25 | for(i=0,i2=0;;i++,i2++){ |
---|
26 | if(ReadBuffer[i]=='|'){ |
---|
27 | CopyBuffer[i2]=0; |
---|
28 | lstrcpy(CopyBuffer+i2," or "); |
---|
29 | i2+=3; |
---|
30 | continue; |
---|
31 | } |
---|
32 | CopyBuffer[i2]=ReadBuffer[i]; |
---|
33 | if(ReadBuffer[i]=='\0') break; |
---|
34 | } |
---|
35 | } |
---|
36 | void ChangeOrSignToDivision(char *CopyBuffer,const char *ReadBuffer){ |
---|
37 | int i,i2,IsStr; |
---|
38 | for(i=0,i2=0,IsStr=0;;i++,i2++){ |
---|
39 | if(ReadBuffer[i]=='\"') IsStr^=1; |
---|
40 | if(ReadBuffer[i]=='\0'){ |
---|
41 | CopyBuffer[i2]=0; |
---|
42 | break; |
---|
43 | } |
---|
44 | if(ReadBuffer[i+3]=='\0'){ |
---|
45 | memcpy(CopyBuffer+i2,ReadBuffer+i,3); |
---|
46 | CopyBuffer[i2+3]=0; |
---|
47 | break; |
---|
48 | } |
---|
49 | if((ReadBuffer[i]==' '||ReadBuffer[i]=='\t')&& |
---|
50 | (ReadBuffer[i+1]=='O'||ReadBuffer[i+1]=='o')&&(ReadBuffer[i+2]=='R'||ReadBuffer[i+2]=='r')&& |
---|
51 | (ReadBuffer[i+3]==' '||ReadBuffer[i+3]=='\t')&&IsStr==0){ |
---|
52 | CopyBuffer[i2]='|'; |
---|
53 | i+=3; |
---|
54 | continue; |
---|
55 | } |
---|
56 | CopyBuffer[i2]=ReadBuffer[i]; |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | HGLOBAL Rad_GetChildInfoClipboardData(int WndNum,int WndInfoNum){ |
---|
61 | //CHILDINFO構造体をクリップボード用データ(pByteが示すバッファ)に変換する |
---|
62 | extern PROJECTINFO ProjectInfo; |
---|
63 | extern MDIINFO MdiInfo[MAX_WNDNUM]; |
---|
64 | HGLOBAL hGlobal; |
---|
65 | BYTE *pByte; |
---|
66 | int i2,i3,MemSize; |
---|
67 | CHILDINFO *pChildInfo; |
---|
68 | |
---|
69 | for(i3=0;;i3++){ |
---|
70 | if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]==-1) break; |
---|
71 | } |
---|
72 | |
---|
73 | |
---|
74 | hGlobal=GlobalAlloc(GMEM_MOVEABLE,sizeof(int)); |
---|
75 | pByte=(BYTE *)GlobalLock(hGlobal); |
---|
76 | *((int *)pByte)=i3; |
---|
77 | GlobalUnlock(hGlobal); |
---|
78 | i2=sizeof(int); |
---|
79 | |
---|
80 | MemSize=i2; |
---|
81 | |
---|
82 | for(i3--;i3>=0;i3--){ |
---|
83 | pChildInfo=&ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]]; |
---|
84 | |
---|
85 | MemSize+=lstrlen(pChildInfo->IdName)+1+ |
---|
86 | sizeof(POINT)+ |
---|
87 | sizeof(SIZE)+ |
---|
88 | lstrlen(pChildInfo->caption)+1+ |
---|
89 | sizeof(DWORD)+ |
---|
90 | sizeof(DWORD)+ |
---|
91 | sizeof(int)+ |
---|
92 | sizeof(int)+ |
---|
93 | lstrlen(pChildInfo->ImageCtrlInfo.path)+1; |
---|
94 | |
---|
95 | hGlobal=GlobalReAlloc(hGlobal,MemSize,0); |
---|
96 | pByte=(BYTE *)GlobalLock(hGlobal); |
---|
97 | |
---|
98 | lstrcpy((char *)pByte+i2,pChildInfo->IdName); |
---|
99 | i2+=lstrlen(pChildInfo->IdName)+1; |
---|
100 | |
---|
101 | memcpy(pByte+i2,&pChildInfo->pos,sizeof(POINT)); |
---|
102 | i2+=sizeof(POINT); |
---|
103 | |
---|
104 | memcpy(pByte+i2,&pChildInfo->size,sizeof(SIZE)); |
---|
105 | i2+=sizeof(SIZE); |
---|
106 | |
---|
107 | lstrcpy((char *)pByte+i2,pChildInfo->caption); |
---|
108 | i2+=lstrlen(pChildInfo->caption)+1; |
---|
109 | |
---|
110 | memcpy(pByte+i2,&pChildInfo->style,sizeof(DWORD)); |
---|
111 | i2+=sizeof(DWORD); |
---|
112 | |
---|
113 | memcpy(pByte+i2,&pChildInfo->ExStyle,sizeof(DWORD)); |
---|
114 | i2+=sizeof(DWORD); |
---|
115 | |
---|
116 | memcpy(pByte+i2,&pChildInfo->Control,sizeof(int)); |
---|
117 | i2+=sizeof(int); |
---|
118 | |
---|
119 | memcpy(pByte+i2,&pChildInfo->ImageCtrlInfo.type,sizeof(int)); |
---|
120 | i2+=sizeof(int); |
---|
121 | |
---|
122 | if(!pChildInfo->ImageCtrlInfo.path){ |
---|
123 | lstrcpy((char *)pByte+i2,""); |
---|
124 | i2++; |
---|
125 | } |
---|
126 | else{ |
---|
127 | lstrcpy((char *)pByte+i2,pChildInfo->ImageCtrlInfo.path); |
---|
128 | i2+=lstrlen(pChildInfo->ImageCtrlInfo.path)+1; |
---|
129 | } |
---|
130 | |
---|
131 | GlobalUnlock(hGlobal); |
---|
132 | } |
---|
133 | |
---|
134 | return hGlobal; |
---|
135 | } |
---|
136 | void Rad_PasteChildInfoClipboardData(int WndNum,HGLOBAL hGlobal){ |
---|
137 | //hGlobalに格納されているクリップボードデータをRAD画面に挿入する |
---|
138 | extern MDIINFO MdiInfo[MAX_WNDNUM]; |
---|
139 | BYTE *pByte; |
---|
140 | int i2,i3,WndInfoNum; |
---|
141 | CHILDINFO ChildInfo; |
---|
142 | char temporary[255]; |
---|
143 | |
---|
144 | for(i2=1;i2<MAX_RAD_SELITEM;i2++) MdiInfo[WndNum].MdiRadInfo->SelectingItem[i2]=-1; |
---|
145 | |
---|
146 | WndInfoNum=GetWndInfoNum(MdiInfo[WndNum].path); |
---|
147 | pByte=(BYTE *)GlobalLock(hGlobal); |
---|
148 | i3=*((int *)pByte); |
---|
149 | i2=sizeof(int); |
---|
150 | |
---|
151 | for(i3--;i3>=0;i3--){ |
---|
152 | //IdNameメンバは変更される可能性がある |
---|
153 | ChildInfo.IdName=(char *)temporary; |
---|
154 | lstrcpy(ChildInfo.IdName,(char *)pByte+i2); |
---|
155 | i2+=lstrlen(ChildInfo.IdName)+1; |
---|
156 | |
---|
157 | memcpy(&ChildInfo.pos,pByte+i2,sizeof(POINT)); |
---|
158 | i2+=sizeof(POINT); |
---|
159 | |
---|
160 | memcpy(&ChildInfo.size,pByte+i2,sizeof(SIZE)); |
---|
161 | i2+=sizeof(SIZE); |
---|
162 | |
---|
163 | ChildInfo.caption=(char *)pByte+i2; |
---|
164 | i2+=lstrlen(ChildInfo.caption)+1; |
---|
165 | |
---|
166 | memcpy(&ChildInfo.style,pByte+i2,sizeof(DWORD)); |
---|
167 | i2+=sizeof(DWORD); |
---|
168 | |
---|
169 | memcpy(&ChildInfo.ExStyle,pByte+i2,sizeof(DWORD)); |
---|
170 | i2+=sizeof(DWORD); |
---|
171 | |
---|
172 | memcpy(&ChildInfo.Control,pByte+i2,sizeof(int)); |
---|
173 | i2+=sizeof(int); |
---|
174 | |
---|
175 | memcpy(&ChildInfo.ImageCtrlInfo.type,pByte+i2,sizeof(int)); |
---|
176 | i2+=sizeof(int); |
---|
177 | |
---|
178 | ChildInfo.ImageCtrlInfo.path=(char *)pByte+i2; |
---|
179 | if(lstrlen(ChildInfo.ImageCtrlInfo.path)==0){ |
---|
180 | ChildInfo.ImageCtrlInfo.path=0; |
---|
181 | i2++; |
---|
182 | } |
---|
183 | else i2+=lstrlen(ChildInfo.ImageCtrlInfo.path)+1; |
---|
184 | |
---|
185 | ChildInfo.pos.x+=17; |
---|
186 | ChildInfo.pos.y+=10; |
---|
187 | |
---|
188 | MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]=InsertDlgItem(WndNum, |
---|
189 | WndInfoNum, |
---|
190 | -1, |
---|
191 | &ChildInfo.pos, |
---|
192 | &ChildInfo.size, |
---|
193 | ChildInfo.IdName, |
---|
194 | ChildInfo.caption, |
---|
195 | ChildInfo.style, |
---|
196 | ChildInfo.ExStyle, |
---|
197 | ChildInfo.Control, |
---|
198 | ChildInfo.ImageCtrlInfo.type, |
---|
199 | ChildInfo.ImageCtrlInfo.path, |
---|
200 | 2); |
---|
201 | } |
---|
202 | |
---|
203 | GlobalUnlock(hGlobal); |
---|
204 | |
---|
205 | ChangePropertyWindow(WndNum,WndInfoNum); |
---|
206 | } |
---|
207 | |
---|
208 | char *FormatCaption(char *caption){ |
---|
209 | extern HANDLE hHeap; |
---|
210 | int i2,i3,BufSize; |
---|
211 | char *buffer; |
---|
212 | |
---|
213 | BufSize=256*2; |
---|
214 | buffer=(char *)HeapAlloc(hHeap,0,BufSize); |
---|
215 | for(i2=0,i3=0;;i2++,i3++){ |
---|
216 | if(i2+256>=BufSize){ |
---|
217 | BufSize+=256; |
---|
218 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufSize); |
---|
219 | } |
---|
220 | if(caption[i3]=='\"'){ |
---|
221 | lstrcpy(buffer+i2,"\"+Chr$(34)+\""); |
---|
222 | i2+=lstrlen(buffer+i2); |
---|
223 | i2--; |
---|
224 | continue; |
---|
225 | } |
---|
226 | buffer[i2]=caption[i3]; |
---|
227 | if(caption[i3]=='\0') break; |
---|
228 | } |
---|
229 | |
---|
230 | return buffer; |
---|
231 | } |
---|
232 | char *SetCaptionSequence(char *caption){ |
---|
233 | extern HANDLE hHeap; |
---|
234 | int i2,i3,BufSize; |
---|
235 | char *buffer; |
---|
236 | |
---|
237 | BufSize=256*2; |
---|
238 | buffer=(char *)HeapAlloc(hHeap,0,BufSize); |
---|
239 | for(i2=0,i3=0;;i2++,i3++){ |
---|
240 | if(i2+256>=BufSize){ |
---|
241 | BufSize+=256; |
---|
242 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufSize); |
---|
243 | } |
---|
244 | buffer[i2]=caption[i3]; |
---|
245 | if(caption[i3]=='\"'){ |
---|
246 | buffer[i2++]='\\'; |
---|
247 | buffer[i2]='1'; |
---|
248 | } |
---|
249 | else if(caption[i3]=='\\'){ |
---|
250 | buffer[i2++]='\\'; |
---|
251 | buffer[i2]='\\'; |
---|
252 | } |
---|
253 | else if(caption[i3]=='\0') break; |
---|
254 | } |
---|
255 | |
---|
256 | return buffer; |
---|
257 | } |
---|
258 | void RestoreCaptionSequence(char *caption){ |
---|
259 | int i2,i3; |
---|
260 | |
---|
261 | for(i2=0,i3=0;;i2++,i3++){ |
---|
262 | caption[i2]=caption[i3]; |
---|
263 | if(caption[i3]=='\\'){ |
---|
264 | i3++; |
---|
265 | if(caption[i3]=='1') caption[i2]='\"'; |
---|
266 | else caption[i2]=caption[i3]; |
---|
267 | } |
---|
268 | else if(caption[i3]=='\0') break; |
---|
269 | } |
---|
270 | } |
---|
271 | |
---|
272 | //テンプレートソースファイルに値をセットする |
---|
273 | char *PermutationWndPgmTemplate(char *pBuf,char *pPjName, char *pWndName, char *pHandleName, char *pProcName){ |
---|
274 | extern HANDLE hHeap; |
---|
275 | int i,i2; |
---|
276 | |
---|
277 | for(i=0;;i++){ |
---|
278 | if(pBuf[i]=='\0') break; |
---|
279 | if(memicmp(pBuf+i,"#name#",6)==0){ |
---|
280 | //プロジェクト名を置換 |
---|
281 | i2=lstrlen(pPjName); |
---|
282 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-6)+1); |
---|
283 | SlideString(pBuf+i+6,i2-6); |
---|
284 | memcpy(pBuf+i,pPjName,i2); |
---|
285 | } |
---|
286 | if(memicmp(pBuf+i,"#window#",8)==0){ |
---|
287 | //ウィンドウ名を置換 |
---|
288 | i2=lstrlen(pWndName); |
---|
289 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-8)+1); |
---|
290 | SlideString(pBuf+i+8,i2-8); |
---|
291 | memcpy(pBuf+i,pWndName,i2); |
---|
292 | } |
---|
293 | if(memicmp(pBuf+i,"#handle#",8)==0){ |
---|
294 | //ハンドル名を置換 |
---|
295 | i2=lstrlen(pHandleName); |
---|
296 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-8)+1); |
---|
297 | SlideString(pBuf+i+8,i2-8); |
---|
298 | memcpy(pBuf+i,pHandleName,i2); |
---|
299 | } |
---|
300 | if(memicmp(pBuf+i,"#procedure#",11)==0){ |
---|
301 | //プロシージャ名を置換 |
---|
302 | i2=lstrlen(pProcName); |
---|
303 | if(i2>6) pBuf=(char *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pBuf,lstrlen(pBuf)+(i2-11)+1); |
---|
304 | SlideString(pBuf+i+11,i2-11); |
---|
305 | memcpy(pBuf+i,pProcName,i2); |
---|
306 | } |
---|
307 | } |
---|
308 | |
---|
309 | return pBuf; |
---|
310 | } |
---|
311 | |
---|
312 | BOOL GetItemNotifyMessageNameByEvent(char *buffer,int ClassID,const char *EventName){ |
---|
313 | if(lstrcmp(EventName,"Click")==0) lstrcpy(buffer,"NM_CLICK"); |
---|
314 | else if(lstrcmp(EventName,"CustomDraw")==0) lstrcpy(buffer,"NM_CUSTOMDRAW"); |
---|
315 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"NM_DBLCLK"); |
---|
316 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"NM_KILLFOCUS"); |
---|
317 | else if(lstrcmp(EventName,"OutOfMemory")==0) lstrcpy(buffer,"NM_OUTOFMEMORY"); |
---|
318 | else if(lstrcmp(EventName,"RClick")==0) lstrcpy(buffer,"NM_RCLICK"); |
---|
319 | else if(lstrcmp(EventName,"RDblClick")==0) lstrcpy(buffer,"NM_RDBLCLK"); |
---|
320 | else if(lstrcmp(EventName,"ReleasedCapture")==0) lstrcpy(buffer,"NM_RELEASEDCAPTURE"); |
---|
321 | else if(lstrcmp(EventName,"Return")==0) lstrcpy(buffer,"NM_RETURN"); |
---|
322 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"NM_SETFOCUS"); |
---|
323 | else{ |
---|
324 | if(ClassID==CT_LISTVIEW){ |
---|
325 | if(lstrcmp(EventName,"BeginDrag")==0) lstrcpy(buffer,"LVN_BEGINDRAG"); |
---|
326 | else if(lstrcmp(EventName,"BeginLabelEdit")==0) lstrcpy(buffer,"LVN_BEGINLABELEDIT"); |
---|
327 | else if(lstrcmp(EventName,"BeginRDrag")==0) lstrcpy(buffer,"LVN_BEGINRDRAG"); |
---|
328 | else if(lstrcmp(EventName,"ColumnClick")==0) lstrcpy(buffer,"LVN_COLUMNCLICK"); |
---|
329 | else if(lstrcmp(EventName,"DeleteAllItems")==0) lstrcpy(buffer,"LVN_DELETEALLITEMS"); |
---|
330 | else if(lstrcmp(EventName,"DeleteItem")==0) lstrcpy(buffer,"LVN_DELETEITEM"); |
---|
331 | else if(lstrcmp(EventName,"EndLabelEdit")==0) lstrcpy(buffer,"LVN_ENDLABELEDIT"); |
---|
332 | else if(lstrcmp(EventName,"GetDispInfo")==0) lstrcpy(buffer,"LVN_GETDISPINFO"); |
---|
333 | else if(lstrcmp(EventName,"InsertItem")==0) lstrcpy(buffer,"LVN_INSERTITEM"); |
---|
334 | else if(lstrcmp(EventName,"ItemChanged")==0) lstrcpy(buffer,"LVN_ITEMCHANGED"); |
---|
335 | else if(lstrcmp(EventName,"ItemChanging")==0) lstrcpy(buffer,"LVN_ITEMCHANGING"); |
---|
336 | else if(lstrcmp(EventName,"KeyDown")==0) lstrcpy(buffer,"LVN_KEYDOWN"); |
---|
337 | else if(lstrcmp(EventName,"SetDispInfo")==0) lstrcpy(buffer,"LVN_SETDISPINFO"); |
---|
338 | else return 0; |
---|
339 | } |
---|
340 | else if(ClassID==CT_UPDOWN){ |
---|
341 | if(lstrcmp(EventName,"Deltapos")==0) lstrcpy(buffer,"UDN_DELTAPOS"); |
---|
342 | else return 0; |
---|
343 | } |
---|
344 | else return 0; |
---|
345 | //未完成 |
---|
346 | } |
---|
347 | return 1; |
---|
348 | } |
---|
349 | BOOL GetNotifyCommandByItemMessage(WINDOW_INFO *pWindowInfo,ITEMEVENTINFO *pItemEventInfo,char *Command,char *spaces){ |
---|
350 | int i,i2,i3,sw; |
---|
351 | char temporary[MAX_PATH]; |
---|
352 | |
---|
353 | i2=0; |
---|
354 | sw=0; |
---|
355 | for(i=0;;i++){ |
---|
356 | if(pItemEventInfo[i].IdName==0) break; |
---|
357 | if(pItemEventInfo[i].ClassID==CT_LISTVIEW|| |
---|
358 | pItemEventInfo[i].ClassID==CT_TREEVIEW|| |
---|
359 | pItemEventInfo[i].ClassID==CT_UPDOWN|| |
---|
360 | pItemEventInfo[i].ClassID==CT_PROGRESSBAR|| |
---|
361 | pItemEventInfo[i].ClassID==CT_TRACKBAR){ |
---|
362 | //コモン コントロール(WM_NOTIFY) |
---|
363 | sw=1; |
---|
364 | sprintf(Command+i2,"%sCase %s\r\n",spaces,pItemEventInfo[i].IdName); |
---|
365 | i2+=lstrlen(Command+i2); |
---|
366 | sprintf(Command+i2,"%s\tSelect Case pnmHdr->code\r\n",spaces); |
---|
367 | i2+=lstrlen(Command+i2); |
---|
368 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++){ |
---|
369 | if(GetItemNotifyMessageNameByEvent(temporary,pItemEventInfo[i].ClassID,pItemEventInfo[i].pEventNames[i3])){ |
---|
370 | sprintf(Command+i2,"%s\t\tCase %s\r\n",spaces,temporary); |
---|
371 | i2+=lstrlen(Command+i2); |
---|
372 | sprintf(Command+i2,"%s\t\t\t%s_%s_%s(ByVal (pnmHdr As VoidPtr))\r\n",spaces,pWindowInfo->name,pItemEventInfo[i].IdName,pItemEventInfo[i].pEventNames[i3]); |
---|
373 | i2+=lstrlen(Command+i2); |
---|
374 | } |
---|
375 | } |
---|
376 | sprintf(Command+i2,"%s\tEnd Select\r\n",spaces); |
---|
377 | i2+=lstrlen(Command+i2); |
---|
378 | } |
---|
379 | } |
---|
380 | return sw; |
---|
381 | } |
---|
382 | void GetItemMessageNameByEvent(char *buffer,int ClassID,const char *EventName){ |
---|
383 | if(ClassID==CT_BUTTON|| |
---|
384 | ClassID==CT_CHECKBOX|| |
---|
385 | ClassID==CT_RADIOBUTTON){ |
---|
386 | if(lstrcmp(EventName,"Click")==0) lstrcpy(buffer,"BN_CLICKED"); |
---|
387 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"BN_DBLCLK"); |
---|
388 | } |
---|
389 | else if(ClassID==CT_COMBOBOX){ |
---|
390 | if(lstrcmp(EventName,"CloseUp")==0) lstrcpy(buffer,"CBN_CLOSEUP"); |
---|
391 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"CBN_DBLCLK"); |
---|
392 | else if(lstrcmp(EventName,"DropDown")==0) lstrcpy(buffer,"CBN_DROPDOWN"); |
---|
393 | else if(lstrcmp(EventName,"EditChange")==0) lstrcpy(buffer,"CBN_EDITCHANGE"); |
---|
394 | else if(lstrcmp(EventName,"EditUpdate")==0) lstrcpy(buffer,"CBN_EDITUPDATE"); |
---|
395 | else if(lstrcmp(EventName,"ErrSpace")==0) lstrcpy(buffer,"CBN_ERRSPACE"); |
---|
396 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"CBN_KILLFOCUS"); |
---|
397 | else if(lstrcmp(EventName,"SelChange")==0) lstrcpy(buffer,"CBN_SELCHANGE"); |
---|
398 | else if(lstrcmp(EventName,"SelEndCancel")==0) lstrcpy(buffer,"CBN_SELENDCANCEL"); |
---|
399 | else if(lstrcmp(EventName,"SelEndOk")==0) lstrcpy(buffer,"CBN_SELENDOK"); |
---|
400 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"CBN_SETFOCUS"); |
---|
401 | } |
---|
402 | else if(ClassID==CT_EDIT){ |
---|
403 | if(lstrcmp(EventName,"Change")==0) lstrcpy(buffer,"EN_CHANGE"); |
---|
404 | else if(lstrcmp(EventName,"ErrSpace")==0) lstrcpy(buffer,"EN_ERRSPACE"); |
---|
405 | else if(lstrcmp(EventName,"HScroll")==0) lstrcpy(buffer,"EN_HSCROLL"); |
---|
406 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"EN_KILLFOCUS"); |
---|
407 | else if(lstrcmp(EventName,"MaxText")==0) lstrcpy(buffer,"EN_MAXTEXT"); |
---|
408 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"EN_SETFOCUS"); |
---|
409 | else if(lstrcmp(EventName,"Update")==0) lstrcpy(buffer,"EN_UPDATE"); |
---|
410 | else if(lstrcmp(EventName,"VScroll")==0) lstrcpy(buffer,"EN_VSCROLL"); |
---|
411 | } |
---|
412 | else if(ClassID==CT_IMAGEBOX|| |
---|
413 | ClassID==CT_STATIC){ |
---|
414 | if(lstrcmp(EventName,"Click")==0) lstrcpy(buffer,"STN_CLICKED"); |
---|
415 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"STN_DBLCLK"); |
---|
416 | } |
---|
417 | else if(ClassID==CT_LISTBOX){ |
---|
418 | if(lstrcmp(EventName,"SelChange")==0) lstrcpy(buffer,"LBN_SELCHANGE"); |
---|
419 | else if(lstrcmp(EventName,"DblClick")==0) lstrcpy(buffer,"LBN_DBLCLK"); |
---|
420 | else if(lstrcmp(EventName,"ErrSpace")==0) lstrcpy(buffer,"LBN_ERRSPACE"); |
---|
421 | else if(lstrcmp(EventName,"KillFocus")==0) lstrcpy(buffer,"LBN_KILLFOCUS"); |
---|
422 | else if(lstrcmp(EventName,"SelCancel")==0) lstrcpy(buffer,"LBN_SELCANCEL"); |
---|
423 | else if(lstrcmp(EventName,"SetFocus")==0) lstrcpy(buffer,"LBN_SETFOCUS"); |
---|
424 | } |
---|
425 | } |
---|
426 | void GetCommandByItemMessage(WINDOW_INFO *pWindowInfo,ITEMEVENTINFO *pItemEventInfo,char *Command,char *spaces){ |
---|
427 | extern HANDLE hHeap; |
---|
428 | int i,i2,i3; |
---|
429 | char temporary[MAX_PATH]; |
---|
430 | |
---|
431 | i2=0; |
---|
432 | for(i=0;;i++){ |
---|
433 | if(pItemEventInfo[i].IdName==0) break; |
---|
434 | if(pItemEventInfo[i].ClassID!=CT_LISTVIEW&& |
---|
435 | pItemEventInfo[i].ClassID!=CT_PROGRESSBAR&& |
---|
436 | pItemEventInfo[i].ClassID!=CT_TREEVIEW&& |
---|
437 | pItemEventInfo[i].ClassID!=CT_TRACKBAR&& |
---|
438 | pItemEventInfo[i].ClassID!=CT_UPDOWN |
---|
439 | ){ |
---|
440 | //WM_COMMAND |
---|
441 | sprintf(Command+i2,"%sCase %s\r\n",spaces,pItemEventInfo[i].IdName); |
---|
442 | i2+=lstrlen(Command+i2); |
---|
443 | if(pItemEventInfo[i].ClassID==CT_MENU){ |
---|
444 | sprintf(Command+i2,"%s\t%s_%s_MenuClick()\r\n",spaces,pWindowInfo->name,pItemEventInfo[i].IdName); |
---|
445 | i2+=lstrlen(Command+i2); |
---|
446 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++) |
---|
447 | HeapDefaultFree(pItemEventInfo[i].pEventNames[i3]); |
---|
448 | } |
---|
449 | else{ |
---|
450 | sprintf(Command+i2,"%s\tSelect Case HIWORD(wParam)\r\n",spaces); |
---|
451 | i2+=lstrlen(Command+i2); |
---|
452 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++){ |
---|
453 | GetItemMessageNameByEvent(temporary,pItemEventInfo[i].ClassID,pItemEventInfo[i].pEventNames[i3]); |
---|
454 | sprintf(Command+i2,"%s\t\tCase %s\r\n",spaces,temporary); |
---|
455 | i2+=lstrlen(Command+i2); |
---|
456 | sprintf(Command+i2,"%s\t\t\t%s_%s_%s()\r\n",spaces,pWindowInfo->name,pItemEventInfo[i].IdName,pItemEventInfo[i].pEventNames[i3]); |
---|
457 | i2+=lstrlen(Command+i2); |
---|
458 | HeapDefaultFree(pItemEventInfo[i].pEventNames[i3]); |
---|
459 | } |
---|
460 | sprintf(Command+i2,"%s\tEnd Select\r\n",spaces); |
---|
461 | i2+=lstrlen(Command+i2); |
---|
462 | } |
---|
463 | HeapDefaultFree(pItemEventInfo[i].IdName); |
---|
464 | HeapDefaultFree(pItemEventInfo[i].pEventNames); |
---|
465 | } |
---|
466 | else{ |
---|
467 | //WM_NOTIFY情報のメモリ解放 |
---|
468 | for(i3=0;i3<pItemEventInfo[i].EventNum;i3++) |
---|
469 | HeapDefaultFree(pItemEventInfo[i].pEventNames[i3]); |
---|
470 | HeapDefaultFree(pItemEventInfo[i].IdName); |
---|
471 | HeapDefaultFree(pItemEventInfo[i].pEventNames); |
---|
472 | } |
---|
473 | } |
---|
474 | } |
---|
475 | |
---|
476 | void GetItemClassName(char *buffer,int Control){ |
---|
477 | switch(Control){ |
---|
478 | case CT_BUTTON: |
---|
479 | case CT_CHECKBOX: |
---|
480 | case CT_GROUPBOX: |
---|
481 | case CT_RADIOBUTTON: |
---|
482 | lstrcpy(buffer,"BUTTON"); |
---|
483 | break; |
---|
484 | case CT_COMBOBOX: |
---|
485 | lstrcpy(buffer,"COMBOBOX"); |
---|
486 | break; |
---|
487 | case CT_EDIT: |
---|
488 | lstrcpy(buffer,"EDIT"); |
---|
489 | break; |
---|
490 | case CT_HSCROLLBAR: |
---|
491 | case CT_VSCROLLBAR: |
---|
492 | lstrcpy(buffer,"SCROLLBAR"); |
---|
493 | break; |
---|
494 | case CT_LISTBOX: |
---|
495 | lstrcpy(buffer,"LISTBOX"); |
---|
496 | break; |
---|
497 | case CT_LISTVIEW: |
---|
498 | lstrcpy(buffer,"SysListView32"); |
---|
499 | break; |
---|
500 | case CT_IMAGEBOX: |
---|
501 | case CT_STATIC: |
---|
502 | lstrcpy(buffer,"STATIC"); |
---|
503 | break; |
---|
504 | case CT_PROGRESSBAR: |
---|
505 | lstrcpy(buffer,"msctls_progress32"); |
---|
506 | break; |
---|
507 | case CT_TRACKBAR: |
---|
508 | lstrcpy(buffer,"msctls_trackbar32"); |
---|
509 | break; |
---|
510 | case CT_TREEVIEW: |
---|
511 | lstrcpy(buffer,"SysTreeView32"); |
---|
512 | break; |
---|
513 | //CT_UPDOWNはCreateUpDownControl関数で独自に作成される |
---|
514 | } |
---|
515 | } |
---|
516 | long GetCommandByMessage(int WndInfoNum,const char *MessageName,BOOL bProcedureCall,char *Command,char *spaces){ |
---|
517 | extern PROJECTINFO ProjectInfo; |
---|
518 | int i,i2,sw; |
---|
519 | char temporary[MAX_PATH],*temp2; |
---|
520 | WINDOW_INFO *pWindowInfo; |
---|
521 | |
---|
522 | pWindowInfo=&ProjectInfo.pWindowInfo[WndInfoNum]; |
---|
523 | |
---|
524 | Command[0]=0; |
---|
525 | |
---|
526 | |
---|
527 | ///////////////////// |
---|
528 | // Default コマンド |
---|
529 | |
---|
530 | if(lstrcmp(MessageName,"Activate")==0){ |
---|
531 | sprintf(Command,"%sCase WM_ACTIVATE\r\n",spaces); |
---|
532 | i=lstrlen(Command); |
---|
533 | sprintf(Command+i,"%s\t%s_%s(LOWORD(wParam),HIWORD(wParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
534 | } |
---|
535 | else if(lstrcmp(MessageName,"Create")==0){ |
---|
536 | if(pWindowInfo->type==WNDTYPE_MODALDLG||pWindowInfo->type==WNDTYPE_MODELESSDLG) |
---|
537 | sprintf(Command,"%sCase WM_INITDIALOG\r\n",spaces); |
---|
538 | else sprintf(Command,"%sCase WM_CREATE\r\n",spaces); |
---|
539 | i=lstrlen(Command); |
---|
540 | |
---|
541 | sprintf(Command+i,"%s\t%s=hWnd\r\n",spaces,pWindowInfo->HandleName); |
---|
542 | i+=lstrlen(Command+i); |
---|
543 | |
---|
544 | if(pWindowInfo->MenuID){ |
---|
545 | //メニュー作成 |
---|
546 | for(i2=0;i2<ProjectInfo.NumberOfMenu;i2++){ |
---|
547 | if(lstrcmpi(ProjectInfo.pMenuInfo[i2].IdName,pWindowInfo->MenuID)==0) break; |
---|
548 | } |
---|
549 | if(i2!=ProjectInfo.NumberOfMenu){ |
---|
550 | sprintf(Command+i,"%s\tSetMenu(hWnd,hMenu_%s)\r\n",spaces,ProjectInfo.pMenuInfo[i2].IdName); |
---|
551 | i+=lstrlen(Command+i); |
---|
552 | } |
---|
553 | } |
---|
554 | |
---|
555 | //子ウィンドウ作成 |
---|
556 | for(i2=0,sw=0;i2<pWindowInfo->NumberOfChildWindows;i2++){ |
---|
557 | if(pWindowInfo->pChildInfo[i2].Control==CT_UPDOWN){ |
---|
558 | sprintf(Command+i,"%s\tCreateUpDownControl(%d,%d,%d,%d,%d,hWnd,%s,GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,0,0,100,0)\r\n", |
---|
559 | spaces, |
---|
560 | pWindowInfo->pChildInfo[i2].style, |
---|
561 | pWindowInfo->pChildInfo[i2].pos.x,pWindowInfo->pChildInfo[i2].pos.y, |
---|
562 | pWindowInfo->pChildInfo[i2].size.cx,pWindowInfo->pChildInfo[i2].size.cy, |
---|
563 | pWindowInfo->pChildInfo[i2].IdName); |
---|
564 | i+=lstrlen(Command+i); |
---|
565 | } |
---|
566 | else{ |
---|
567 | GetItemClassName(temporary,pWindowInfo->pChildInfo[i2].Control); |
---|
568 | temp2=FormatCaption(pWindowInfo->pChildInfo[i2].caption); |
---|
569 | sprintf(Command+i,"%s\tCreateWindowEx(&H%08x,\"%s\",\"%s\",&H%08x,%d,%d,%d,%d,hWnd,%s As HMENU,GetModuleHandle(0),0)\r\n", |
---|
570 | spaces, |
---|
571 | pWindowInfo->pChildInfo[i2].ExStyle, |
---|
572 | temporary, |
---|
573 | temp2, |
---|
574 | pWindowInfo->pChildInfo[i2].style, |
---|
575 | pWindowInfo->pChildInfo[i2].pos.x, |
---|
576 | pWindowInfo->pChildInfo[i2].pos.y, |
---|
577 | pWindowInfo->pChildInfo[i2].size.cx, |
---|
578 | pWindowInfo->pChildInfo[i2].size.cy, |
---|
579 | pWindowInfo->pChildInfo[i2].IdName); |
---|
580 | i+=lstrlen(Command+i); |
---|
581 | HeapDefaultFree(temp2); |
---|
582 | sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),WM_SETFONT,hFont_%s As WPARAM,0)\r\n", |
---|
583 | spaces, |
---|
584 | pWindowInfo->pChildInfo[i2].IdName, |
---|
585 | pWindowInfo->name); |
---|
586 | i+=lstrlen(Command+i); |
---|
587 | |
---|
588 | if(pWindowInfo->pChildInfo[i2].Control==CT_IMAGEBOX){ |
---|
589 | //イメージ ボックスの場合 |
---|
590 | if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_ICON){ |
---|
591 | if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_FILE){ |
---|
592 | if(strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,":")|| |
---|
593 | strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,"\\\\")){ |
---|
594 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n", |
---|
595 | spaces, |
---|
596 | pWindowInfo->name, |
---|
597 | pWindowInfo->pChildInfo[i2].IdName, |
---|
598 | pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path); |
---|
599 | } |
---|
600 | else{ |
---|
601 | if(sw==0){ |
---|
602 | sw=1; |
---|
603 | lstrcpy(Command+i,"\r\n"); |
---|
604 | i+=2; |
---|
605 | sprintf(Command+i,"%s\tDim ImageFilePath[MAX_PATH] As Byte\r\n",spaces); |
---|
606 | i+=lstrlen(Command+i); |
---|
607 | sprintf(Command+i,"%s\tDim ModulePath[MAX_PATH] As Byte, i As Long\r\n",spaces); |
---|
608 | i+=lstrlen(Command+i); |
---|
609 | sprintf(Command+i,"%s\tGetModuleFileName(GetModuleHandle(0),ModulePath,MAX_PATH)\r\n",spaces); |
---|
610 | i+=lstrlen(Command+i); |
---|
611 | sprintf(Command+i,"%s\tFor i=lstrlen(ModulePath)-1 To 0 Step -1\r\n",spaces); |
---|
612 | i+=lstrlen(Command+i); |
---|
613 | sprintf(Command+i,"%s\t\tIf ModulePath[i]=&H5C Then Exit For\r\n",spaces); |
---|
614 | i+=lstrlen(Command+i); |
---|
615 | sprintf(Command+i,"%s\tNext\r\n",spaces); |
---|
616 | i+=lstrlen(Command+i); |
---|
617 | sprintf(Command+i,"%s\tModulePath[i+1]=0\r\n",spaces); |
---|
618 | i+=lstrlen(Command+i); |
---|
619 | lstrcpy(Command+i,"\r\n"); |
---|
620 | i+=2; |
---|
621 | } |
---|
622 | sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path); |
---|
623 | i+=lstrlen(Command+i); |
---|
624 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n", |
---|
625 | spaces, |
---|
626 | pWindowInfo->name, |
---|
627 | pWindowInfo->pChildInfo[i2].IdName); |
---|
628 | } |
---|
629 | i+=lstrlen(Command+i); |
---|
630 | } |
---|
631 | else if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_RES){ |
---|
632 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_ICON,0,0,LR_DEFAULTSIZE)\r\n", |
---|
633 | spaces, |
---|
634 | pWindowInfo->name, |
---|
635 | pWindowInfo->pChildInfo[i2].IdName, |
---|
636 | pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path); |
---|
637 | i+=lstrlen(Command+i); |
---|
638 | } |
---|
639 | sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETICON,hImage_%s_%s As WPARAM,0)\r\n", |
---|
640 | spaces, |
---|
641 | pWindowInfo->pChildInfo[i2].IdName, |
---|
642 | pWindowInfo->name, |
---|
643 | pWindowInfo->pChildInfo[i2].IdName); |
---|
644 | i+=lstrlen(Command+i); |
---|
645 | } |
---|
646 | else if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_BITMAP){ |
---|
647 | if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_FILE){ |
---|
648 | if(strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,":")|| |
---|
649 | strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,"\\\\")){ |
---|
650 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n", |
---|
651 | spaces, |
---|
652 | pWindowInfo->name, |
---|
653 | pWindowInfo->pChildInfo[i2].IdName, |
---|
654 | pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path); |
---|
655 | } |
---|
656 | else{ |
---|
657 | if(sw==0){ |
---|
658 | sw=1; |
---|
659 | lstrcpy(Command+i,"\r\n"); |
---|
660 | i+=2; |
---|
661 | sprintf(Command+i,"%s\tDim ImageFilePath[MAX_PATH] As Byte\r\n",spaces); |
---|
662 | i+=lstrlen(Command+i); |
---|
663 | sprintf(Command+i,"%s\tDim ModulePath[MAX_PATH] As Byte, i As Long\r\n",spaces); |
---|
664 | i+=lstrlen(Command+i); |
---|
665 | sprintf(Command+i,"%s\tGetModuleFileName(GetModuleHandle(0),ModulePath,MAX_PATH)\r\n",spaces); |
---|
666 | i+=lstrlen(Command+i); |
---|
667 | sprintf(Command+i,"%s\tFor i=lstrlen(ModulePath)-1 To 0 Step -1\r\n",spaces); |
---|
668 | i+=lstrlen(Command+i); |
---|
669 | sprintf(Command+i,"%s\t\tIf ModulePath[i]=&H5C Then Exit For\r\n",spaces); |
---|
670 | i+=lstrlen(Command+i); |
---|
671 | sprintf(Command+i,"%s\tNext\r\n",spaces); |
---|
672 | i+=lstrlen(Command+i); |
---|
673 | sprintf(Command+i,"%s\tModulePath[i+1]=0\r\n",spaces); |
---|
674 | i+=lstrlen(Command+i); |
---|
675 | lstrcpy(Command+i,"\r\n"); |
---|
676 | i+=2; |
---|
677 | } |
---|
678 | sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path); |
---|
679 | i+=lstrlen(Command+i); |
---|
680 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)\r\n", |
---|
681 | spaces, |
---|
682 | pWindowInfo->name, |
---|
683 | pWindowInfo->pChildInfo[i2].IdName); |
---|
684 | } |
---|
685 | i+=lstrlen(Command+i); |
---|
686 | } |
---|
687 | else if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_RES){ |
---|
688 | sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE)\r\n", |
---|
689 | spaces, |
---|
690 | pWindowInfo->name, |
---|
691 | pWindowInfo->pChildInfo[i2].IdName, |
---|
692 | pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path); |
---|
693 | i+=lstrlen(Command+i); |
---|
694 | } |
---|
695 | sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETIMAGE,IMAGE_BITMAP,hImage_%s_%s As LPARAM)\r\n", |
---|
696 | spaces, |
---|
697 | pWindowInfo->pChildInfo[i2].IdName, |
---|
698 | pWindowInfo->name, |
---|
699 | pWindowInfo->pChildInfo[i2].IdName); |
---|
700 | i+=lstrlen(Command+i); |
---|
701 | } |
---|
702 | } |
---|
703 | } |
---|
704 | } |
---|
705 | |
---|
706 | if(bProcedureCall) |
---|
707 | sprintf(Command+i,"%s\t%s_%s(ByVal (lParam As VoidPtr))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
708 | return WM_CREATE; |
---|
709 | } |
---|
710 | else if(lstrcmp(MessageName,"Destroy")==0){ |
---|
711 | sprintf(Command,"%sCase WM_DESTROY\r\n",spaces); |
---|
712 | i=lstrlen(Command); |
---|
713 | if(bProcedureCall){ |
---|
714 | sprintf(Command+i,"%s\t%s_%s()\r\n",spaces,pWindowInfo->name,MessageName); |
---|
715 | i+=lstrlen(Command+i); |
---|
716 | } |
---|
717 | |
---|
718 | if(pWindowInfo->MenuID){ |
---|
719 | //メニューを解放 |
---|
720 | for(i2=0;i2<ProjectInfo.NumberOfMenu;i2++){ |
---|
721 | if(lstrcmpi(ProjectInfo.pMenuInfo[i2].IdName,pWindowInfo->MenuID)==0) break; |
---|
722 | } |
---|
723 | if(i2!=ProjectInfo.NumberOfMenu){ |
---|
724 | sprintf(Command+i,"%s\tSetMenu(hWnd,NULL)\r\n",spaces); |
---|
725 | i+=lstrlen(Command+i); |
---|
726 | } |
---|
727 | } |
---|
728 | |
---|
729 | //イメージ ボックス用の変数を解放 |
---|
730 | for(i2=0;i2<pWindowInfo->NumberOfChildWindows;i2++){ |
---|
731 | if(pWindowInfo->pChildInfo[i2].Control==CT_IMAGEBOX){ |
---|
732 | if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_ICON) |
---|
733 | sprintf(Command+i,"%s\tDestroyIcon(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pWindowInfo->pChildInfo[i2].IdName); |
---|
734 | else if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_BITMAP) |
---|
735 | sprintf(Command+i,"%s\tDeleteObject(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pWindowInfo->pChildInfo[i2].IdName); |
---|
736 | i+=lstrlen(Command+i); |
---|
737 | } |
---|
738 | } |
---|
739 | return WM_DESTROY; |
---|
740 | } |
---|
741 | else if(lstrcmp(MessageName,"DropFiles")==0){ |
---|
742 | sprintf(Command,"%sCase WM_DROPFILES\r\n",spaces); |
---|
743 | i=lstrlen(Command); |
---|
744 | sprintf(Command+i,"%s\t%s_%s(wParam As HDROP)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
745 | } |
---|
746 | else if(lstrcmp(MessageName,"HScroll")==0){ |
---|
747 | sprintf(Command,"%sCase WM_HSCROLL\r\n",spaces); |
---|
748 | i=lstrlen(Command); |
---|
749 | sprintf(Command+i,"%s\t%s_%s(LOWORD(wParam),HIWORD(wParam),lParam As HWND)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
750 | } |
---|
751 | else if(lstrcmp(MessageName,"KeyDown")==0){ |
---|
752 | sprintf(Command,"%sCase WM_KEYDOWN\r\n",spaces); |
---|
753 | i=lstrlen(Command); |
---|
754 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,lParam As Long)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
755 | } |
---|
756 | else if(lstrcmp(MessageName,"KeyPress")==0){ |
---|
757 | sprintf(Command,"%sCase WM_CHAR\r\n",spaces); |
---|
758 | i=lstrlen(Command); |
---|
759 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,lParam As Long)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
760 | } |
---|
761 | else if(lstrcmp(MessageName,"KeyUp")==0){ |
---|
762 | sprintf(Command,"%sCase WM_KEYUP\r\n",spaces); |
---|
763 | i=lstrlen(Command); |
---|
764 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,lParam As Long)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
765 | } |
---|
766 | else if(lstrcmp(MessageName,"LButtonDown")==0){ |
---|
767 | sprintf(Command,"%sCase WM_LBUTTONDOWN\r\n",spaces); |
---|
768 | i=lstrlen(Command); |
---|
769 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
770 | } |
---|
771 | else if(lstrcmp(MessageName,"LButtonDblClick")==0){ |
---|
772 | sprintf(Command,"%sCase WM_LBUTTONDBLCLK\r\n",spaces); |
---|
773 | i=lstrlen(Command); |
---|
774 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
775 | } |
---|
776 | else if(lstrcmp(MessageName,"LButtonUp")==0){ |
---|
777 | sprintf(Command,"%sCase WM_LBUTTONUP\r\n",spaces); |
---|
778 | i=lstrlen(Command); |
---|
779 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
780 | } |
---|
781 | else if(lstrcmp(MessageName,"MButtonDown")==0){ |
---|
782 | sprintf(Command,"%sCase WM_MBUTTONDOWN\r\n",spaces); |
---|
783 | i=lstrlen(Command); |
---|
784 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
785 | } |
---|
786 | else if(lstrcmp(MessageName,"MButtonDblClick")==0){ |
---|
787 | sprintf(Command,"%sCase WM_MBUTTONDBLCLK\r\n",spaces); |
---|
788 | i=lstrlen(Command); |
---|
789 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
790 | } |
---|
791 | else if(lstrcmp(MessageName,"MButtonUp")==0){ |
---|
792 | sprintf(Command,"%sCase WM_MBUTTONUP\r\n",spaces); |
---|
793 | i=lstrlen(Command); |
---|
794 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
795 | } |
---|
796 | else if(lstrcmp(MessageName,"MouseMove")==0){ |
---|
797 | sprintf(Command,"%sCase WM_MOUSEMOVE\r\n",spaces); |
---|
798 | i=lstrlen(Command); |
---|
799 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
800 | } |
---|
801 | else if(lstrcmp(MessageName,"Move")==0){ |
---|
802 | sprintf(Command,"%sCase WM_MOVE\r\n",spaces); |
---|
803 | i=lstrlen(Command); |
---|
804 | sprintf(Command+i,"%s\t%s_%s(LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
805 | } |
---|
806 | else if(lstrcmp(MessageName,"Notify")==0){ |
---|
807 | //コモンコントロールメッセージと共に挿入 |
---|
808 | return WM_NOTIFY; |
---|
809 | } |
---|
810 | else if(lstrcmp(MessageName,"Paint")==0){ |
---|
811 | sprintf(Command,"%sCase WM_PAINT\r\n",spaces); |
---|
812 | i=lstrlen(Command); |
---|
813 | sprintf(Command+i,"%s\tDim ps As PAINTSTRUCT\r\n",spaces); |
---|
814 | i+=lstrlen(Command+i); |
---|
815 | sprintf(Command+i,"%s\tDim hDC As HDC\r\n",spaces); |
---|
816 | i+=lstrlen(Command+i); |
---|
817 | sprintf(Command+i,"%s\thDC=BeginPaint(hWnd,ps)\r\n",spaces); |
---|
818 | i+=lstrlen(Command+i); |
---|
819 | sprintf(Command+i,"%s\t%s_%s(hDC)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
820 | i+=lstrlen(Command+i); |
---|
821 | sprintf(Command+i,"%s\tEndPaint(hWnd,ps)\r\n",spaces); |
---|
822 | return WM_PAINT; |
---|
823 | } |
---|
824 | else if(lstrcmp(MessageName,"QueryClose")==0){ |
---|
825 | sprintf(Command,"%sCase WM_CLOSE\r\n",spaces); |
---|
826 | i=lstrlen(Command); |
---|
827 | sprintf(Command+i,"%s\tDim cancel=0 As Integer\r\n",spaces); |
---|
828 | i+=lstrlen(Command+i); |
---|
829 | if(bProcedureCall){ |
---|
830 | sprintf(Command+i,"%s\t%s_%s(cancel)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
831 | i+=lstrlen(Command+i); |
---|
832 | } |
---|
833 | if(pWindowInfo->type==WNDTYPE_MODALDLG) |
---|
834 | sprintf(Command+i,"%s\tIf cancel=0 Then EndDialog(hWnd,0)\r\n",spaces); |
---|
835 | else |
---|
836 | sprintf(Command+i,"%s\tIf cancel=0 Then DestroyWindow(hWnd)\r\n",spaces); |
---|
837 | return WM_CLOSE; |
---|
838 | } |
---|
839 | else if(lstrcmp(MessageName,"RButtonDblClick")==0){ |
---|
840 | sprintf(Command,"%sCase WM_RBUTTONDBLCLK\r\n",spaces); |
---|
841 | i=lstrlen(Command); |
---|
842 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
843 | } |
---|
844 | else if(lstrcmp(MessageName,"RButtonDown")==0){ |
---|
845 | sprintf(Command,"%sCase WM_RBUTTONDOWN\r\n",spaces); |
---|
846 | i=lstrlen(Command); |
---|
847 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
848 | } |
---|
849 | else if(lstrcmp(MessageName,"RButtonUp")==0){ |
---|
850 | sprintf(Command,"%sCase WM_RBUTTONUP\r\n",spaces); |
---|
851 | i=lstrlen(Command); |
---|
852 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
853 | } |
---|
854 | else if(lstrcmp(MessageName,"Resize")==0){ |
---|
855 | sprintf(Command,"%sCase WM_SIZE\r\n",spaces); |
---|
856 | i=lstrlen(Command); |
---|
857 | sprintf(Command+i,"%s\t%s_%s(wParam As Long,LOWORD(lParam),HIWORD(lParam))\r\n",spaces,pWindowInfo->name,MessageName); |
---|
858 | } |
---|
859 | else if(lstrcmp(MessageName,"SetFocus")==0){ |
---|
860 | sprintf(Command,"%sCase WM_SETFOCUS\r\n",spaces); |
---|
861 | i=lstrlen(Command); |
---|
862 | sprintf(Command+i,"%s\t%s_%s()\r\n",spaces,pWindowInfo->name,MessageName); |
---|
863 | } |
---|
864 | else if(lstrcmp(MessageName,"Timer")==0){ |
---|
865 | sprintf(Command,"%sCase WM_TIMER\r\n",spaces); |
---|
866 | i=lstrlen(Command); |
---|
867 | sprintf(Command+i,"%s\t%s_%s(wParam As DWord)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
868 | } |
---|
869 | else if(lstrcmp(MessageName,"VScroll")==0){ |
---|
870 | sprintf(Command,"%sCase WM_VSCROLL\r\n",spaces); |
---|
871 | i=lstrlen(Command); |
---|
872 | sprintf(Command+i,"%s\t%s_%s(LOWORD(wParam),HIWORD(wParam),lParam As HWND)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
873 | } |
---|
874 | |
---|
875 | |
---|
876 | /////////////////// |
---|
877 | // MMSYS コマンド |
---|
878 | |
---|
879 | else if(lstrcmp(MessageName,"MciNotify")==0){ |
---|
880 | sprintf(Command,"%sCase MM_MCINOTIFY\r\n",spaces); |
---|
881 | i=lstrlen(Command); |
---|
882 | sprintf(Command+i,"%s\t%s_%s(wParam,lParam)\r\n",spaces,pWindowInfo->name,MessageName); |
---|
883 | } |
---|
884 | return 0; |
---|
885 | } |
---|
886 | |
---|
887 | char **GetMenuItemConstData(MENU_INFO *pMenuInfo,int NumberOfMenu,int *ConstNumber,char **ppNames,int *NamesNum,char *buffer,int *base){ |
---|
888 | extern HANDLE hHeap; |
---|
889 | int i,i2,sw1; |
---|
890 | |
---|
891 | for(i=0;i<NumberOfMenu;i++){ |
---|
892 | if(pMenuInfo[i].pMenuInfo){ |
---|
893 | //ポップアップ |
---|
894 | ppNames=GetMenuItemConstData(pMenuInfo[i].pMenuInfo,pMenuInfo[i].NumberOfMenu,ConstNumber,ppNames,NamesNum,buffer,base); |
---|
895 | } |
---|
896 | else if(pMenuInfo[i].type==MFT_STRING){ |
---|
897 | //重複チェック |
---|
898 | for(i2=0,sw1=0;i2<*NamesNum;i2++){ |
---|
899 | if(lstrcmpi(ppNames[i2],pMenuInfo[i].IdName)==0){ |
---|
900 | sw1=1; |
---|
901 | break; |
---|
902 | } |
---|
903 | } |
---|
904 | if(sw1==0){ |
---|
905 | ppNames=(char **)HeapReAlloc(hHeap,0,ppNames,sizeof(char *)*((*NamesNum)+1)); |
---|
906 | ppNames[*NamesNum]=pMenuInfo[i].IdName; |
---|
907 | (*NamesNum)++; |
---|
908 | |
---|
909 | sprintf(buffer+(*base),"Const %s=%d\r\n",pMenuInfo[i].IdName,*ConstNumber); |
---|
910 | (*base)+=lstrlen(buffer+(*base)); |
---|
911 | (*ConstNumber)++; |
---|
912 | } |
---|
913 | } |
---|
914 | } |
---|
915 | return ppNames; |
---|
916 | } |
---|
917 | int GetMakeMenuCommand(MENU_INFO *pMenuInfo,int NumberOfMenu,char *MenuHandle,char *Command,BOOL bMain){ |
---|
918 | int i,i2; |
---|
919 | char temporary[MAX_PATH]; |
---|
920 | |
---|
921 | i=0; |
---|
922 | sprintf(Command+i,"Dim %s As HMENU\r\n",MenuHandle); |
---|
923 | i+=lstrlen(Command+i); |
---|
924 | if(bMain) sprintf(Command+i,"%s=CreateMenu()\r\n",MenuHandle); |
---|
925 | else sprintf(Command+i,"%s=CreatePopupMenu()\r\n",MenuHandle); |
---|
926 | i+=lstrlen(Command+i); |
---|
927 | |
---|
928 | for(i2=NumberOfMenu-1;i2>=0;i2--){ |
---|
929 | if(pMenuInfo[i2].pMenuInfo){ |
---|
930 | sprintf(temporary,"%s_%d",MenuHandle,i2); |
---|
931 | i+=GetMakeMenuCommand(pMenuInfo[i2].pMenuInfo,pMenuInfo[i2].NumberOfMenu,temporary,Command+i,0); |
---|
932 | sprintf(Command+i,"InsMenu %s,0,MF_BYPOSITION,Ex\"%s\",0,%s,%d\r\n", |
---|
933 | MenuHandle, |
---|
934 | pMenuInfo[i2].caption, |
---|
935 | temporary, |
---|
936 | pMenuInfo[i2].state); |
---|
937 | i+=lstrlen(Command+i); |
---|
938 | } |
---|
939 | else{ |
---|
940 | if(pMenuInfo[i2].type==MFT_STRING){ |
---|
941 | sprintf(Command+i,"InsMenu %s,0,MF_BYPOSITION,Ex\"%s\",%s,0,%d\r\n", |
---|
942 | MenuHandle, |
---|
943 | pMenuInfo[i2].caption, |
---|
944 | pMenuInfo[i2].IdName, |
---|
945 | pMenuInfo[i2].state); |
---|
946 | i+=lstrlen(Command+i); |
---|
947 | } |
---|
948 | else if(pMenuInfo[i2].type==MFT_SEPARATOR){ |
---|
949 | sprintf(Command+i,"InsMenu %s,0,MF_BYPOSITION,\"\"\r\n", |
---|
950 | MenuHandle); |
---|
951 | i+=lstrlen(Command+i); |
---|
952 | } |
---|
953 | } |
---|
954 | } |
---|
955 | return i; |
---|
956 | } |
---|
957 | int GetDestroyMenuCommand(MENU_INFO *pMenuInfo,int NumberOfMenu,char *MenuHandle,char *Command){ |
---|
958 | int i,i2; |
---|
959 | char temporary[MAX_PATH]; |
---|
960 | |
---|
961 | i=0; |
---|
962 | sprintf(Command+i,"\tDestroyMenu(%s)\r\n",MenuHandle); |
---|
963 | i+=lstrlen(Command+i); |
---|
964 | |
---|
965 | for(i2=NumberOfMenu-1;i2>=0;i2--){ |
---|
966 | if(pMenuInfo[i2].pMenuInfo){ |
---|
967 | sprintf(temporary,"%s_%d",MenuHandle,i2); |
---|
968 | i+=GetDestroyMenuCommand(pMenuInfo[i2].pMenuInfo,pMenuInfo[i2].NumberOfMenu,temporary,Command+i); |
---|
969 | } |
---|
970 | } |
---|
971 | return i; |
---|
972 | } |
---|
973 | void SaveWindowProgram(){ |
---|
974 | extern HANDLE hHeap; |
---|
975 | extern PROJECTINFO ProjectInfo; |
---|
976 | int i,i2,i3,i4,i5,i6,sw1,sw2,sw3,sw4,size; |
---|
977 | char *buffer,**ppNames,temporary[MAX_PATH]; |
---|
978 | WINDOW_INFO *pWindowInfo; |
---|
979 | |
---|
980 | pWindowInfo=ProjectInfo.pWindowInfo; |
---|
981 | |
---|
982 | size=2; |
---|
983 | buffer=(char *)HeapAlloc(hHeap,0,65535*size); |
---|
984 | lstrcpy(buffer,"'このファイルはウィンドウ定義ファイル(*.wnd)をもとに生成されています\r\n\r\n"); |
---|
985 | i2=lstrlen(buffer); |
---|
986 | |
---|
987 | if(ProjectInfo.dwOption&PJ_OP_COMMCTRL){ |
---|
988 | //コマンコントロールを初期化 |
---|
989 | lstrcpy(buffer+i2,"Dim _RadSys_InitCtrls As INITCOMMONCONTROLSEX\r\n"); |
---|
990 | i2+=lstrlen(buffer+i2); |
---|
991 | lstrcpy(buffer+i2,"_RadSys_InitCtrls.dwSize=Len(_RadSys_InitCtrls)\r\n"); |
---|
992 | i2+=lstrlen(buffer+i2); |
---|
993 | lstrcpy(buffer+i2,"_RadSys_InitCtrls.dwICC=ICC_WIN95_CLASSES\r\n"); |
---|
994 | i2+=lstrlen(buffer+i2); |
---|
995 | lstrcpy(buffer+i2,"InitCommonControlsEx(_RadSys_InitCtrls)\r\n\r\n"); |
---|
996 | i2+=lstrlen(buffer+i2); |
---|
997 | } |
---|
998 | |
---|
999 | |
---|
1000 | //////////// |
---|
1001 | //IDを定義 |
---|
1002 | |
---|
1003 | ppNames=(char **)HeapAlloc(hHeap,0,1); |
---|
1004 | for(i=0,i4=1000,i5=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1005 | for(i3=0;i3<pWindowInfo[i].NumberOfChildWindows;i3++){ |
---|
1006 | |
---|
1007 | //重複チェック |
---|
1008 | for(i6=0,sw1=0;i6<i5;i6++){ |
---|
1009 | if(lstrcmpi(ppNames[i6],pWindowInfo[i].pChildInfo[i3].IdName)==0){ |
---|
1010 | sw1=1; |
---|
1011 | break; |
---|
1012 | } |
---|
1013 | } |
---|
1014 | if(sw1) continue; |
---|
1015 | |
---|
1016 | ppNames=(char **)HeapReAlloc(hHeap,0,ppNames,sizeof(char *)*(i5+1)); |
---|
1017 | ppNames[i5]=pWindowInfo[i].pChildInfo[i3].IdName; |
---|
1018 | i5++; |
---|
1019 | |
---|
1020 | sprintf(buffer+i2,"Const %s=%d\r\n",pWindowInfo[i].pChildInfo[i3].IdName,i4); |
---|
1021 | i2+=lstrlen(buffer+i2); |
---|
1022 | i4++; |
---|
1023 | |
---|
1024 | while(i2>65535*(size-1)){ |
---|
1025 | size++; |
---|
1026 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1027 | } |
---|
1028 | } |
---|
1029 | } |
---|
1030 | |
---|
1031 | //メニューのIDを定義 |
---|
1032 | ppNames=GetMenuItemConstData(ProjectInfo.pMenuInfo,ProjectInfo.NumberOfMenu,&i4,ppNames,&i5,buffer,&i2); |
---|
1033 | |
---|
1034 | HeapDefaultFree(ppNames); |
---|
1035 | lstrcpy(buffer+i2,"\r\n"); |
---|
1036 | i2+=lstrlen(buffer+i2); |
---|
1037 | |
---|
1038 | |
---|
1039 | //ハンドル変数を定義 |
---|
1040 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1041 | sprintf(buffer+i2,"Dim %s As HWND\r\n",pWindowInfo[i].HandleName); |
---|
1042 | i2+=lstrlen(buffer+i2); |
---|
1043 | sprintf(buffer+i2,"Dim hFont_%s As HFONT\r\n",pWindowInfo[i].name); |
---|
1044 | i2+=lstrlen(buffer+i2); |
---|
1045 | sprintf(buffer+i2,"hFont_%s=CreateFont(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\"%s\")\r\n", |
---|
1046 | pWindowInfo[i].name, |
---|
1047 | pWindowInfo[i].LogFont.lfHeight, |
---|
1048 | pWindowInfo[i].LogFont.lfWidth, |
---|
1049 | pWindowInfo[i].LogFont.lfEscapement, |
---|
1050 | pWindowInfo[i].LogFont.lfOrientation, |
---|
1051 | pWindowInfo[i].LogFont.lfWeight, |
---|
1052 | pWindowInfo[i].LogFont.lfItalic, |
---|
1053 | pWindowInfo[i].LogFont.lfUnderline, |
---|
1054 | pWindowInfo[i].LogFont.lfStrikeOut, |
---|
1055 | pWindowInfo[i].LogFont.lfCharSet, |
---|
1056 | pWindowInfo[i].LogFont.lfOutPrecision, |
---|
1057 | pWindowInfo[i].LogFont.lfClipPrecision, |
---|
1058 | pWindowInfo[i].LogFont.lfQuality, |
---|
1059 | pWindowInfo[i].LogFont.lfPitchAndFamily, |
---|
1060 | pWindowInfo[i].LogFont.lfFaceName); |
---|
1061 | i2+=lstrlen(buffer+i2); |
---|
1062 | |
---|
1063 | while(i2>65535*(size-1)){ |
---|
1064 | size++; |
---|
1065 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1066 | } |
---|
1067 | } |
---|
1068 | |
---|
1069 | //背景に使用するブラシを定義 |
---|
1070 | lstrcpy(buffer+i2,"Dim h3DFaceBrush As HBRUSH\r\n"); |
---|
1071 | i2+=lstrlen(buffer+i2); |
---|
1072 | lstrcpy(buffer+i2,"h3DFaceBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE))\r\n"); |
---|
1073 | i2+=lstrlen(buffer+i2); |
---|
1074 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1075 | if(pWindowInfo[i].bgColor<=0&& |
---|
1076 | pWindowInfo[i].bgColor!=-(int)RGB(255,255,255)&& |
---|
1077 | pWindowInfo[i].bgColor!=-(int)RGB(0,0,0)){ |
---|
1078 | sprintf(buffer+i2,"Dim _RadSys_hBackBrush%d As HBRUSH\r\n",i); |
---|
1079 | i2+=lstrlen(buffer+i2); |
---|
1080 | sprintf(buffer+i2,"_RadSys_hBackBrush%d=CreateSolidBrush(%d)\r\n",i,-pWindowInfo[i].bgColor); |
---|
1081 | i2+=lstrlen(buffer+i2); |
---|
1082 | } |
---|
1083 | if(pWindowInfo[i].bgColor>=0x1000){ |
---|
1084 | sprintf(buffer+i2,"Dim _RadSys_hBackBrush%d As HBRUSH\r\n",i); |
---|
1085 | i2+=lstrlen(buffer+i2); |
---|
1086 | sprintf(buffer+i2,"_RadSys_hBackBrush%d=CreatePatternBrush(LoadImage(GetModuleHandle(0),%s,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_SHARED))\r\n", |
---|
1087 | i, |
---|
1088 | ProjectInfo.res.pBitmapResInfo[pWindowInfo[i].bgColor-0x1000].IdName); |
---|
1089 | i2+=lstrlen(buffer+i2); |
---|
1090 | } |
---|
1091 | } |
---|
1092 | |
---|
1093 | lstrcpy(buffer+i2,"\r\n"); |
---|
1094 | i2+=lstrlen(buffer+i2); |
---|
1095 | |
---|
1096 | //イメージ ボックス用の変数を定義 |
---|
1097 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1098 | for(i3=0;i3<pWindowInfo[i].NumberOfChildWindows;i3++){ |
---|
1099 | if(pWindowInfo[i].pChildInfo[i3].Control==CT_IMAGEBOX){ |
---|
1100 | if((pWindowInfo[i].pChildInfo[i3].style&0x000F)==SS_ICON|| |
---|
1101 | (pWindowInfo[i].pChildInfo[i3].style&0x000F)==SS_BITMAP){ |
---|
1102 | sprintf(buffer+i2,"Dim hImage_%s_%s As HANDLE\r\n",pWindowInfo[i].name,pWindowInfo[i].pChildInfo[i3].IdName); |
---|
1103 | i2+=lstrlen(buffer+i2); |
---|
1104 | |
---|
1105 | while(i2>65535*(size-1)){ |
---|
1106 | size++; |
---|
1107 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1108 | } |
---|
1109 | } |
---|
1110 | } |
---|
1111 | } |
---|
1112 | } |
---|
1113 | |
---|
1114 | lstrcpy(buffer+i2,"\r\n"); |
---|
1115 | i2+=lstrlen(buffer+i2); |
---|
1116 | |
---|
1117 | //メニュー作成 |
---|
1118 | for(i=0;i<ProjectInfo.NumberOfMenu;i++){ |
---|
1119 | sprintf(temporary,"hMenu_%s",ProjectInfo.pMenuInfo[i].IdName); |
---|
1120 | |
---|
1121 | //InsertMenuItem郡 |
---|
1122 | i2+=GetMakeMenuCommand(ProjectInfo.pMenuInfo[i].pMenuInfo,ProjectInfo.pMenuInfo[i].NumberOfMenu,temporary,buffer+i2,1); |
---|
1123 | |
---|
1124 | lstrcpy(buffer+i2,"\r\n"); |
---|
1125 | i2+=lstrlen(buffer+i2); |
---|
1126 | |
---|
1127 | while(i2>65535*(size-1)){ |
---|
1128 | size++; |
---|
1129 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1130 | } |
---|
1131 | } |
---|
1132 | |
---|
1133 | |
---|
1134 | ////////////////////////// |
---|
1135 | //オブジェクトの解放処理 |
---|
1136 | sprintf(buffer+i2,"Sub %s_DestroyObjects()\r\n",ProjectInfo.name); |
---|
1137 | i2+=lstrlen(buffer+i2); |
---|
1138 | |
---|
1139 | //メニュー解放 |
---|
1140 | for(i=0;i<ProjectInfo.NumberOfMenu;i++){ |
---|
1141 | sprintf(temporary,"hMenu_%s",ProjectInfo.pMenuInfo[i].IdName); |
---|
1142 | i2+=GetDestroyMenuCommand(ProjectInfo.pMenuInfo[i].pMenuInfo,ProjectInfo.pMenuInfo[i].NumberOfMenu,temporary,buffer+i2); |
---|
1143 | |
---|
1144 | while(i2>65535*(size-1)){ |
---|
1145 | size++; |
---|
1146 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1147 | } |
---|
1148 | } |
---|
1149 | |
---|
1150 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1151 | //フォントハンドル解放 |
---|
1152 | sprintf(buffer+i2,"\tDeleteObject(hFont_%s)\r\n",ProjectInfo.pWindowInfo[i].name); |
---|
1153 | i2+=lstrlen(buffer+i2); |
---|
1154 | |
---|
1155 | while(i2>65535*(size-1)){ |
---|
1156 | size++; |
---|
1157 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1158 | } |
---|
1159 | } |
---|
1160 | |
---|
1161 | //背景ブラシを解放 |
---|
1162 | lstrcpy(buffer+i2,"\tDeleteObject(h3DFaceBrush)\r\n"); |
---|
1163 | i2+=lstrlen(buffer+i2); |
---|
1164 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1165 | if(pWindowInfo[i].bgColor<=0&& |
---|
1166 | pWindowInfo[i].bgColor!=-(int)RGB(255,255,255)&& |
---|
1167 | pWindowInfo[i].bgColor!=-(int)RGB(0,0,0)){ |
---|
1168 | sprintf(buffer+i2,"\tDeleteObject(_RadSys_hBackBrush%d)\r\n",i); |
---|
1169 | i2+=lstrlen(buffer+i2); |
---|
1170 | } |
---|
1171 | } |
---|
1172 | |
---|
1173 | sprintf(buffer+i2,"End Sub\r\n\r\n"); |
---|
1174 | i2+=lstrlen(buffer+i2); |
---|
1175 | |
---|
1176 | //ユーザー定義のコールバック関数が存在するかどうか |
---|
1177 | BOOL bAvailUserProc[MAX_WNDNUM]; |
---|
1178 | |
---|
1179 | |
---|
1180 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1181 | if(i!=0){ |
---|
1182 | lstrcpy(buffer+i2,"\r\n"); |
---|
1183 | i2+=lstrlen(buffer+i2); |
---|
1184 | } |
---|
1185 | |
---|
1186 | ////////////////////////// |
---|
1187 | //コールバック関数を生成 |
---|
1188 | |
---|
1189 | //処理メッセージを抽出 |
---|
1190 | ITEMEVENTINFO *pItemEventInfo; |
---|
1191 | ppNames=GetProcedureNamesOfMessageCall(i,&pItemEventInfo,&i3,&bAvailUserProc[i]); |
---|
1192 | |
---|
1193 | sprintf(buffer+i2,"Function EventCall_%s(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT\r\n",pWindowInfo[i].name); |
---|
1194 | i2+=lstrlen(buffer+i2); |
---|
1195 | |
---|
1196 | lstrcpy(buffer+i2,"\tSelect Case message\r\n"); |
---|
1197 | i2+=lstrlen(buffer+i2); |
---|
1198 | |
---|
1199 | //通常メッセージ郡 |
---|
1200 | for(i4=0,sw1=0,sw2=0,sw3=0,sw4=0;i4<i3;i4++){ |
---|
1201 | i5=GetCommandByMessage(i,ppNames[i4],1,buffer+i2,"\t\t"); |
---|
1202 | i2+=lstrlen(buffer+i2); |
---|
1203 | if(i5==WM_CREATE) sw1=1; |
---|
1204 | else if(i5==WM_DESTROY) sw2=1; |
---|
1205 | else if(i5==WM_CLOSE) sw3=1; |
---|
1206 | else if(i5==WM_NOTIFY) sw4=1; |
---|
1207 | HeapDefaultFree(ppNames[i4]); |
---|
1208 | } |
---|
1209 | HeapDefaultFree(ppNames); |
---|
1210 | |
---|
1211 | //WM_CREATE、WM_DESTROY、WM_PAINTが呼び出されていない場合 |
---|
1212 | if(!sw1){ |
---|
1213 | GetCommandByMessage(i,"Create",0,buffer+i2,"\t\t"); |
---|
1214 | i2+=lstrlen(buffer+i2); |
---|
1215 | } |
---|
1216 | if(!sw2){ |
---|
1217 | GetCommandByMessage(i,"Destroy",0,buffer+i2,"\t\t"); |
---|
1218 | i2+=lstrlen(buffer+i2); |
---|
1219 | } |
---|
1220 | if(!sw3){ |
---|
1221 | GetCommandByMessage(i,"QueryClose",0,buffer+i2,"\t\t"); |
---|
1222 | i2+=lstrlen(buffer+i2); |
---|
1223 | } |
---|
1224 | |
---|
1225 | //アイテムメッセージ郡(WM_NOTIFY) |
---|
1226 | if(pItemEventInfo[0].IdName){ |
---|
1227 | i3=i2; |
---|
1228 | lstrcpy(buffer+i2,"\t\tCase WM_NOTIFY\r\n"); |
---|
1229 | i2+=lstrlen(buffer+i2); |
---|
1230 | if(sw4){ |
---|
1231 | sprintf(buffer+i2,"\t\t\t%s_Notify(ByVal (lParam As *NMHDR))\r\n",pWindowInfo[i].name); |
---|
1232 | i2+=lstrlen(buffer+i2); |
---|
1233 | } |
---|
1234 | lstrcpy(buffer+i2,"\t\t\tDim pnmHdr As *NMHDR\r\n"); |
---|
1235 | i2+=lstrlen(buffer+i2); |
---|
1236 | lstrcpy(buffer+i2,"\t\t\tpnmHdr=lParam As *NMHDR\r\n"); |
---|
1237 | i2+=lstrlen(buffer+i2); |
---|
1238 | lstrcpy(buffer+i2,"\t\t\tSelect Case LOWORD(wParam)\r\n"); |
---|
1239 | i2+=lstrlen(buffer+i2); |
---|
1240 | |
---|
1241 | if(GetNotifyCommandByItemMessage(&pWindowInfo[i],pItemEventInfo,buffer+i2,"\t\t\t\t")){ |
---|
1242 | i2+=lstrlen(buffer+i2); |
---|
1243 | |
---|
1244 | lstrcpy(buffer+i2,"\t\t\tEnd Select\r\n"); |
---|
1245 | i2+=lstrlen(buffer+i2); |
---|
1246 | } |
---|
1247 | else{ |
---|
1248 | //WM_NOTIFYを削除 |
---|
1249 | i2=i3; |
---|
1250 | if(sw4) goto DefaultNotifyEvent; |
---|
1251 | } |
---|
1252 | } |
---|
1253 | else if(sw4){ |
---|
1254 | DefaultNotifyEvent: |
---|
1255 | lstrcpy(buffer+i2,"\t\tCase WM_NOTIFY\r\n"); |
---|
1256 | i2+=lstrlen(buffer+i2); |
---|
1257 | sprintf(buffer+i2,"\t\t\t%s_Notify(ByVal (lParam As *NMHDR))\r\n",pWindowInfo[i].name); |
---|
1258 | i2+=lstrlen(buffer+i2); |
---|
1259 | } |
---|
1260 | |
---|
1261 | //アイテムメッセージ郡(WM_COMMAND) |
---|
1262 | if(pItemEventInfo[0].IdName){ |
---|
1263 | lstrcpy(buffer+i2,"\t\tCase WM_COMMAND\r\n"); |
---|
1264 | i2+=lstrlen(buffer+i2); |
---|
1265 | lstrcpy(buffer+i2,"\t\t\tSelect Case LOWORD(wParam)\r\n"); |
---|
1266 | i2+=lstrlen(buffer+i2); |
---|
1267 | |
---|
1268 | //pItemEventInfoのIdName、EventNameメンバのメモリ解放はこの関数内で行う |
---|
1269 | GetCommandByItemMessage(&pWindowInfo[i],pItemEventInfo,buffer+i2,"\t\t\t\t"); |
---|
1270 | i2+=lstrlen(buffer+i2); |
---|
1271 | |
---|
1272 | lstrcpy(buffer+i2,"\t\t\tEnd Select\r\n"); |
---|
1273 | i2+=lstrlen(buffer+i2); |
---|
1274 | } |
---|
1275 | HeapDefaultFree(pItemEventInfo); |
---|
1276 | |
---|
1277 | // DefWindowProc関数 |
---|
1278 | lstrcpy(buffer+i2,"\t\tCase Else\r\n"); |
---|
1279 | i2+=lstrlen(buffer+i2); |
---|
1280 | sprintf(buffer+i2,"\t\t\tEventCall_%s=DefWindowProc(hWnd,message,wParam,lParam)\r\n",pWindowInfo[i].name); |
---|
1281 | i2+=lstrlen(buffer+i2); |
---|
1282 | lstrcpy(buffer+i2,"\t\t\tExit Function\r\n"); |
---|
1283 | i2+=lstrlen(buffer+i2); |
---|
1284 | |
---|
1285 | lstrcpy(buffer+i2,"\tEnd Select\r\n"); |
---|
1286 | i2+=lstrlen(buffer+i2); |
---|
1287 | |
---|
1288 | sprintf(buffer+i2,"\tEventCall_%s=0\r\n",pWindowInfo[i].name); |
---|
1289 | i2+=lstrlen(buffer+i2); |
---|
1290 | lstrcpy(buffer+i2,"End Function\r\n"); |
---|
1291 | i2+=lstrlen(buffer+i2); |
---|
1292 | |
---|
1293 | while(i2>65535*(size-1)){ |
---|
1294 | size++; |
---|
1295 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1296 | } |
---|
1297 | } |
---|
1298 | |
---|
1299 | |
---|
1300 | ////////////////////////// |
---|
1301 | //ダイアログボックス関連 |
---|
1302 | |
---|
1303 | //クラス登録 |
---|
1304 | lstrcpy(buffer+i2,"\r\nFunction DefaultCallProc(hWnd As HWND, message As DWord, wParam As WPARAM, lParam As LPARAM) As LRESULT\r\n"); |
---|
1305 | i2+=lstrlen(buffer+i2); |
---|
1306 | lstrcpy(buffer+i2,"\tDefaultCallProc=DefWindowProc(hWnd,message,wParam,lParam)\r\n"); |
---|
1307 | i2+=lstrlen(buffer+i2); |
---|
1308 | lstrcpy(buffer+i2,"End Function\r\n"); |
---|
1309 | i2+=lstrlen(buffer+i2); |
---|
1310 | lstrcpy(buffer+i2,"\r\nDim _RadSys_dlgwcl As WNDCLASSEX\r\n"); |
---|
1311 | i2+=lstrlen(buffer+i2); |
---|
1312 | lstrcpy(buffer+i2,"FillMemory(VarPtr(_RadSys_dlgwcl),Len(_RadSys_dlgwcl),0)\r\n"); |
---|
1313 | i2+=lstrlen(buffer+i2); |
---|
1314 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.cbSize=Len(_RadSys_dlgwcl)\r\n"); |
---|
1315 | i2+=lstrlen(buffer+i2); |
---|
1316 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hInstance=GetModuleHandle(0)\r\n"); |
---|
1317 | i2+=lstrlen(buffer+i2); |
---|
1318 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.style=CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS\r\n"); |
---|
1319 | i2+=lstrlen(buffer+i2); |
---|
1320 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_APPLICATION))\r\n"); |
---|
1321 | i2+=lstrlen(buffer+i2); |
---|
1322 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_WINLOGO))\r\n"); |
---|
1323 | i2+=lstrlen(buffer+i2); |
---|
1324 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW))\r\n"); |
---|
1325 | i2+=lstrlen(buffer+i2); |
---|
1326 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.lpszClassName=\"NORMALDLG\"\r\n"); |
---|
1327 | i2+=lstrlen(buffer+i2); |
---|
1328 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.hbrBackground=h3DFaceBrush\r\n"); |
---|
1329 | i2+=lstrlen(buffer+i2); |
---|
1330 | lstrcpy(buffer+i2,"_RadSys_dlgwcl.lpfnWndProc=AddressOf(DefaultCallProc)\r\n"); |
---|
1331 | i2+=lstrlen(buffer+i2); |
---|
1332 | lstrcpy(buffer+i2,"RegisterClassEx(_RadSys_dlgwcl)\r\n"); |
---|
1333 | i2+=lstrlen(buffer+i2); |
---|
1334 | |
---|
1335 | //DialogBox関数 |
---|
1336 | lstrcpy(buffer+i2,"\r\nFunction DialogBox(hOwnerWnd As HWND, TemplateName As LPSTR) As LONG_PTR\r\n"); |
---|
1337 | i2+=lstrlen(buffer+i2); |
---|
1338 | lstrcpy(buffer+i2,"\tDim hDlg As HWND\r\n"); |
---|
1339 | i2+=lstrlen(buffer+i2); |
---|
1340 | for(i=0,sw1=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1341 | if(pWindowInfo[i].type==WNDTYPE_MODALDLG){ |
---|
1342 | if(sw1==0){ |
---|
1343 | sprintf(buffer+i2,"\tIf lstrcmp(TemplateName,\"%s\")=0 Then\r\n",pWindowInfo[i].name); |
---|
1344 | i2+=lstrlen(buffer+i2); |
---|
1345 | sw1=1; |
---|
1346 | } |
---|
1347 | else{ |
---|
1348 | sprintf(buffer+i2,"\tElseIf lstrcmp(TemplateName,\"%s\")=0 Then\r\n",pWindowInfo[i].name); |
---|
1349 | i2+=lstrlen(buffer+i2); |
---|
1350 | } |
---|
1351 | sprintf(buffer+i2,"\t\t%s=CreateWindowEx(&H%08x,\"NORMALDLG\",\"%s\",&H%08x,%d,%d,%d,%d,hOwnerWnd,%d As HMENU,GetModuleHandle(0),0)\r\n", |
---|
1352 | pWindowInfo[i].HandleName, |
---|
1353 | pWindowInfo[i].ExStyle, |
---|
1354 | pWindowInfo[i].caption, |
---|
1355 | pWindowInfo[i].style, |
---|
1356 | pWindowInfo[i].pos.x, |
---|
1357 | pWindowInfo[i].pos.y, |
---|
1358 | pWindowInfo[i].size.cx, |
---|
1359 | pWindowInfo[i].size.cy, |
---|
1360 | pWindowInfo[i].id); |
---|
1361 | i2+=lstrlen(buffer+i2); |
---|
1362 | sprintf(buffer+i2,"\t\thDlg=%s\r\n", |
---|
1363 | pWindowInfo[i].HandleName); |
---|
1364 | i2+=lstrlen(buffer+i2); |
---|
1365 | if(bAvailUserProc[i]){ |
---|
1366 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(%s) As LONG_PTR)\r\n", |
---|
1367 | pWindowInfo[i].HandleName, |
---|
1368 | pWindowInfo[i].CallBackName); |
---|
1369 | } |
---|
1370 | else{ |
---|
1371 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(EventCall_%s) As LONG_PTR)\r\n", |
---|
1372 | pWindowInfo[i].HandleName, |
---|
1373 | pWindowInfo[i].name); |
---|
1374 | } |
---|
1375 | i2+=lstrlen(buffer+i2); |
---|
1376 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_INITDIALOG,0,0)\r\n",pWindowInfo[i].HandleName); |
---|
1377 | i2+=lstrlen(buffer+i2); |
---|
1378 | if(pWindowInfo[i].IconResName){ |
---|
1379 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_SETICON,ICON_SMALL,LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(%s)) As LPARAM)\r\n",pWindowInfo[i].HandleName,pWindowInfo[i].IconResName); |
---|
1380 | i2+=lstrlen(buffer+i2); |
---|
1381 | } |
---|
1382 | sprintf(buffer+i2,"\t\tShowWindow(%s,SW_SHOW)\r\n",pWindowInfo[i].HandleName); |
---|
1383 | i2+=lstrlen(buffer+i2); |
---|
1384 | } |
---|
1385 | while(i2>65535*(size-1)){ |
---|
1386 | size++; |
---|
1387 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1388 | } |
---|
1389 | } |
---|
1390 | if(sw1){ |
---|
1391 | lstrcpy(buffer+i2,"\tElse\r\n"); |
---|
1392 | i2+=lstrlen(buffer+i2); |
---|
1393 | lstrcpy(buffer+i2,"\t\tExit Function\r\n"); |
---|
1394 | i2+=lstrlen(buffer+i2); |
---|
1395 | lstrcpy(buffer+i2,"\tEnd If\r\n"); |
---|
1396 | i2+=lstrlen(buffer+i2); |
---|
1397 | lstrcpy(buffer+i2,"\tEnableWindow(hOwnerWnd,0)\r\n\r\n"); |
---|
1398 | i2+=lstrlen(buffer+i2); |
---|
1399 | lstrcpy(buffer+i2,"\tDim msg As MSG, iResult As Long\r\n"); |
---|
1400 | i2+=lstrlen(buffer+i2); |
---|
1401 | lstrcpy(buffer+i2,"\tDo\r\n"); |
---|
1402 | i2+=lstrlen(buffer+i2); |
---|
1403 | lstrcpy(buffer+i2,"\t\tiResult=GetMessage(msg,0,0,0)\r\n"); |
---|
1404 | i2+=lstrlen(buffer+i2); |
---|
1405 | lstrcpy(buffer+i2,"\t\tIf iResult=0 or iResult=-1 Then Exit Do\r\n"); |
---|
1406 | i2+=lstrlen(buffer+i2); |
---|
1407 | lstrcpy(buffer+i2,"\t\tIf IsDialogMessage(hDlg,msg) Then Continue\r\n"); |
---|
1408 | i2+=lstrlen(buffer+i2); |
---|
1409 | lstrcpy(buffer+i2,"\t\tTranslateMessage(msg)\r\n"); |
---|
1410 | i2+=lstrlen(buffer+i2); |
---|
1411 | lstrcpy(buffer+i2,"\t\tDispatchMessage(msg)\r\n"); |
---|
1412 | i2+=lstrlen(buffer+i2); |
---|
1413 | lstrcpy(buffer+i2,"\tLoop\r\n"); |
---|
1414 | i2+=lstrlen(buffer+i2); |
---|
1415 | lstrcpy(buffer+i2,"\tDialogBox=msg.wParam\r\n"); |
---|
1416 | i2+=lstrlen(buffer+i2); |
---|
1417 | } |
---|
1418 | lstrcpy(buffer+i2,"End Function\r\n"); |
---|
1419 | i2+=lstrlen(buffer+i2); |
---|
1420 | |
---|
1421 | //EndDialog関数 |
---|
1422 | lstrcpy(buffer+i2,"Sub EndDialog(hWnd As HWND, lResult As Long)\r\n"); |
---|
1423 | i2+=lstrlen(buffer+i2); |
---|
1424 | lstrcpy(buffer+i2,"\tEnableWindow(GetWindow(hWnd,GW_OWNER),1)\r\n"); |
---|
1425 | i2+=lstrlen(buffer+i2); |
---|
1426 | lstrcpy(buffer+i2,"\tDestroyWindow(hWnd)\r\n"); |
---|
1427 | i2+=lstrlen(buffer+i2); |
---|
1428 | lstrcpy(buffer+i2,"\tPostMessage(0,WM_QUIT,lResult,0)\r\n"); |
---|
1429 | i2+=lstrlen(buffer+i2); |
---|
1430 | lstrcpy(buffer+i2,"End Sub\r\n"); |
---|
1431 | i2+=lstrlen(buffer+i2); |
---|
1432 | |
---|
1433 | //CreateDialog関数 |
---|
1434 | lstrcpy(buffer+i2,"\r\nFunction CreateDialog(hOwnerWnd As HWND, TemplateName As LPSTR) As HWND\r\n"); |
---|
1435 | i2+=lstrlen(buffer+i2); |
---|
1436 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1437 | if(pWindowInfo[i].type==WNDTYPE_MODELESSDLG){ |
---|
1438 | sprintf(buffer+i2,"\tIf lstrcmp(TemplateName,\"%s\")=0 Then\r\n",pWindowInfo[i].name); |
---|
1439 | i2+=lstrlen(buffer+i2); |
---|
1440 | |
---|
1441 | sprintf(buffer+i2,"\t\t%s=CreateWindowEx(&H%08x,\"NORMALDLG\",\"%s\",&H%08x,%d,%d,%d,%d,hOwnerWnd,%d As HMENU,GetModuleHandle(0),0)\r\n", |
---|
1442 | pWindowInfo[i].HandleName, |
---|
1443 | pWindowInfo[i].ExStyle, |
---|
1444 | pWindowInfo[i].caption, |
---|
1445 | pWindowInfo[i].style, |
---|
1446 | pWindowInfo[i].pos.x, |
---|
1447 | pWindowInfo[i].pos.y, |
---|
1448 | pWindowInfo[i].size.cx, |
---|
1449 | pWindowInfo[i].size.cy, |
---|
1450 | pWindowInfo[i].id); |
---|
1451 | i2+=lstrlen(buffer+i2); |
---|
1452 | sprintf(buffer+i2,"\t\tCreateDialog=%s\r\n",pWindowInfo[i].HandleName); |
---|
1453 | i2+=lstrlen(buffer+i2); |
---|
1454 | if(bAvailUserProc[i]){ |
---|
1455 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(%s) As LONG_PTR)\r\n", |
---|
1456 | pWindowInfo[i].HandleName, |
---|
1457 | pWindowInfo[i].CallBackName); |
---|
1458 | } |
---|
1459 | else{ |
---|
1460 | sprintf(buffer+i2,"\t\tSetWindowLongPtr(%s,GWLP_WNDPROC,AddressOf(EventCall_%s) As LONG_PTR)\r\n", |
---|
1461 | pWindowInfo[i].HandleName, |
---|
1462 | pWindowInfo[i].name); |
---|
1463 | } |
---|
1464 | i2+=lstrlen(buffer+i2); |
---|
1465 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_INITDIALOG,0,0)\r\n",pWindowInfo[i].HandleName); |
---|
1466 | i2+=lstrlen(buffer+i2); |
---|
1467 | if(pWindowInfo[i].IconResName){ |
---|
1468 | sprintf(buffer+i2,"\t\tSendMessage(%s,WM_SETICON,ICON_SMALL,LoadIcon(GetModuleHandle(0),MAKEINTRESOURCE(%s)) As LPARAM)\r\n",pWindowInfo[i].HandleName,pWindowInfo[i].IconResName); |
---|
1469 | i2+=lstrlen(buffer+i2); |
---|
1470 | } |
---|
1471 | sprintf(buffer+i2,"\tEnd If\r\n",pWindowInfo[i].name); |
---|
1472 | i2+=lstrlen(buffer+i2); |
---|
1473 | } |
---|
1474 | while(i2>65535*(size-1)){ |
---|
1475 | size++; |
---|
1476 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1477 | } |
---|
1478 | } |
---|
1479 | lstrcpy(buffer+i2,"End Function\r\n"); |
---|
1480 | i2+=lstrlen(buffer+i2); |
---|
1481 | |
---|
1482 | |
---|
1483 | /////////////////////// |
---|
1484 | // 保存(Callback.wbp) |
---|
1485 | sprintf(temporary,"%sCallback.wbp",ProjectInfo.dir); |
---|
1486 | WriteBuffer(temporary,buffer,i2); |
---|
1487 | |
---|
1488 | |
---|
1489 | |
---|
1490 | lstrcpy(buffer,"'このファイルはウィンドウ定義ファイル(*.wnd)をもとに生成されています\r\n\r\n"); |
---|
1491 | i2=lstrlen(buffer); |
---|
1492 | |
---|
1493 | lstrcpy(buffer+i2,"Dim _RadSys_wcl As WNDCLASSEX\r\n"); |
---|
1494 | i2+=lstrlen(buffer+i2); |
---|
1495 | lstrcpy(buffer+i2,"FillMemory(VarPtr(_RadSys_wcl),Len(_RadSys_wcl),0)\r\n"); |
---|
1496 | i2+=lstrlen(buffer+i2); |
---|
1497 | lstrcpy(buffer+i2,"_RadSys_wcl.cbSize=Len(_RadSys_wcl)\r\n"); |
---|
1498 | i2+=lstrlen(buffer+i2); |
---|
1499 | lstrcpy(buffer+i2,"_RadSys_wcl.hInstance=GetModuleHandle(0)\r\n"); |
---|
1500 | i2+=lstrlen(buffer+i2); |
---|
1501 | lstrcpy(buffer+i2,"_RadSys_wcl.style=CS_HREDRAW or CS_VREDRAW or CS_DBLCLKS\r\n"); |
---|
1502 | i2+=lstrlen(buffer+i2); |
---|
1503 | lstrcpy(buffer+i2,"_RadSys_wcl.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW))\r\n"); |
---|
1504 | i2+=lstrlen(buffer+i2); |
---|
1505 | |
---|
1506 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
1507 | if(pWindowInfo[i].type==WNDTYPE_DEFAULT){ |
---|
1508 | ////////////////////// |
---|
1509 | //通常ウィンドウ作成 |
---|
1510 | |
---|
1511 | lstrcpy(buffer+i2,"\r\n"); |
---|
1512 | i2+=2; |
---|
1513 | |
---|
1514 | if(pWindowInfo[i].IconResName==0){ |
---|
1515 | lstrcpy(buffer+i2,"_RadSys_wcl.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_APPLICATION))\r\n"); |
---|
1516 | i2+=lstrlen(buffer+i2); |
---|
1517 | lstrcpy(buffer+i2,"_RadSys_wcl.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_WINLOGO))\r\n"); |
---|
1518 | i2+=lstrlen(buffer+i2); |
---|
1519 | } |
---|
1520 | else{ |
---|
1521 | sprintf(buffer+i2,"_RadSys_wcl.hIcon=LoadIcon(_RadSys_wcl.hInstance,MAKEINTRESOURCE(%s))\r\n",pWindowInfo[i].IconResName); |
---|
1522 | i2+=lstrlen(buffer+i2); |
---|
1523 | sprintf(buffer+i2,"_RadSys_wcl.hIconSm=LoadIcon(_RadSys_wcl.hInstance,MAKEINTRESOURCE(%s))\r\n",pWindowInfo[i].IconResName); |
---|
1524 | i2+=lstrlen(buffer+i2); |
---|
1525 | } |
---|
1526 | |
---|
1527 | sprintf(buffer+i2,"_RadSys_wcl.lpszClassName=\"NORMAL%d\"\r\n",i); |
---|
1528 | i2+=lstrlen(buffer+i2); |
---|
1529 | if(bAvailUserProc[i]) |
---|
1530 | sprintf(buffer+i2,"_RadSys_wcl.lpfnWndProc=AddressOf(%s)\r\n",pWindowInfo[i].CallBackName); |
---|
1531 | else sprintf(buffer+i2,"_RadSys_wcl.lpfnWndProc=AddressOf(EventCall_%s)\r\n",pWindowInfo[i].name); |
---|
1532 | i2+=lstrlen(buffer+i2); |
---|
1533 | if(pWindowInfo[i].bgColor==COLOR_3DFACE) |
---|
1534 | lstrcpy(buffer+i2,"_RadSys_wcl.hbrBackground=h3DFaceBrush\r\n"); |
---|
1535 | else if(pWindowInfo[i].bgColor==-(int)RGB(255,255,255)) |
---|
1536 | lstrcpy(buffer+i2,"_RadSys_wcl.hbrBackground=GetStockObject(WHITE_BRUSH)\r\n"); |
---|
1537 | else if(pWindowInfo[i].bgColor==-(int)RGB(0,0,0)) |
---|
1538 | lstrcpy(buffer+i2,"_RadSys_wcl.hbrBackground=GetStockObject(BLACK_BRUSH)\r\n"); |
---|
1539 | else if(pWindowInfo[i].bgColor<=0|| |
---|
1540 | pWindowInfo[i].bgColor>=0x1000){ |
---|
1541 | //色指定またはビットマップ |
---|
1542 | sprintf(buffer+i2,"_RadSys_wcl.hbrBackground=_RadSys_hBackBrush%d\r\n",i); |
---|
1543 | } |
---|
1544 | i2+=lstrlen(buffer+i2); |
---|
1545 | lstrcpy(buffer+i2,"RegisterClassEx(_RadSys_wcl)\r\n"); |
---|
1546 | i2+=lstrlen(buffer+i2); |
---|
1547 | sprintf(buffer+i2,"CreateWindowEx(&H%08x,\"%s%d\",\"%s\",&H%08x,%d,%d,%d,%d,0,0,GetModuleHandle(0),0)\r\n", |
---|
1548 | pWindowInfo[i].ExStyle, |
---|
1549 | pWindowInfo[i].ClassName,i, |
---|
1550 | pWindowInfo[i].caption, |
---|
1551 | pWindowInfo[i].style, |
---|
1552 | pWindowInfo[i].pos.x, |
---|
1553 | pWindowInfo[i].pos.y, |
---|
1554 | pWindowInfo[i].size.cx, |
---|
1555 | pWindowInfo[i].size.cy); |
---|
1556 | i2+=lstrlen(buffer+i2); |
---|
1557 | } |
---|
1558 | |
---|
1559 | while(i2>65535*(size-1)){ |
---|
1560 | size++; |
---|
1561 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,65535*size); |
---|
1562 | } |
---|
1563 | } |
---|
1564 | |
---|
1565 | |
---|
1566 | ///////////////////////// |
---|
1567 | // 保存(MakeWindow.wbp) |
---|
1568 | sprintf(temporary,"%sMakeWindow.wbp",ProjectInfo.dir); |
---|
1569 | WriteBuffer(temporary,buffer,i2); |
---|
1570 | HeapDefaultFree(buffer); |
---|
1571 | } |
---|
1572 | int GetSaveMenuData(char *buffer,int SpaceNum,MENU_INFO *pMenuInfo,int ItemNum){ |
---|
1573 | int i,i2; |
---|
1574 | char spaces[MAX_PATH]; |
---|
1575 | |
---|
1576 | memset(spaces,' ',SpaceNum*4); |
---|
1577 | spaces[SpaceNum*4]=0; |
---|
1578 | |
---|
1579 | for(i=0,i2=0;i<ItemNum;i++){ |
---|
1580 | if(pMenuInfo[i].pMenuInfo){ |
---|
1581 | sprintf(buffer+i2,"%sPOPUP = \"%s\",%d\r\n",spaces,pMenuInfo[i].caption,pMenuInfo[i].state); |
---|
1582 | i2+=lstrlen(buffer+i2); |
---|
1583 | i2+=GetSaveMenuData(buffer+i2,SpaceNum+1,pMenuInfo[i].pMenuInfo,pMenuInfo[i].NumberOfMenu); |
---|
1584 | sprintf(buffer+i2,"%sEND\r\n",spaces); |
---|
1585 | i2+=lstrlen(buffer+i2); |
---|
1586 | } |
---|
1587 | else if(pMenuInfo[i].type==MFT_STRING){ |
---|
1588 | sprintf(buffer+i2,"%sITEM = %s,\"%s\",%d\r\n",spaces,pMenuInfo[i].IdName,pMenuInfo[i].caption,pMenuInfo[i].state); |
---|
1589 | i2+=lstrlen(buffer+i2); |
---|
1590 | } |
---|
1591 | else if(pMenuInfo[i].type==MFT_SEPARATOR){ |
---|
1592 | sprintf(buffer+i2,"%sSEPARATOR\r\n",spaces); |
---|
1593 | i2+=lstrlen(buffer+i2); |
---|
1594 | } |
---|
1595 | } |
---|
1596 | return i2; |
---|
1597 | } |
---|
1598 | void SaveWindowFile(char *path,WINDOW_INFO *pWindowInfo,int NumberOfWindowInfo){ |
---|
1599 | extern HANDLE hHeap; |
---|
1600 | extern MDIINFO MdiInfo[MAX_WNDNUM]; |
---|
1601 | extern PROJECTINFO ProjectInfo; |
---|
1602 | int i,i2,i3,size; |
---|
1603 | char *buffer,*temporary; |
---|
1604 | |
---|
1605 | size=2; |
---|
1606 | buffer=(char *)HeapAlloc(hHeap,0,GENERAL_SIZE*size); |
---|
1607 | for(i=0,i2=0;i<NumberOfWindowInfo;i++){ |
---|
1608 | sprintf(buffer+i2,"WINDOW:%s\r\n",pWindowInfo[i].name); |
---|
1609 | i2+=lstrlen(buffer+i2); |
---|
1610 | sprintf(buffer+i2," HANDLE = %s\r\n",pWindowInfo[i].HandleName); |
---|
1611 | i2+=lstrlen(buffer+i2); |
---|
1612 | sprintf(buffer+i2," POINT = %d,%d\r\n",pWindowInfo[i].pos.x,pWindowInfo[i].pos.y); |
---|
1613 | i2+=lstrlen(buffer+i2); |
---|
1614 | sprintf(buffer+i2," SIZE = %d,%d\r\n",pWindowInfo[i].size.cx,pWindowInfo[i].size.cy); |
---|
1615 | i2+=lstrlen(buffer+i2); |
---|
1616 | sprintf(buffer+i2," CAPTION = \"%s\"\r\n",pWindowInfo[i].caption); |
---|
1617 | i2+=lstrlen(buffer+i2); |
---|
1618 | sprintf(buffer+i2," STYLE = &H%08x\r\n",pWindowInfo[i].style); |
---|
1619 | i2+=lstrlen(buffer+i2); |
---|
1620 | sprintf(buffer+i2," EXSTYLE = &H%08x\r\n",pWindowInfo[i].ExStyle); |
---|
1621 | i2+=lstrlen(buffer+i2); |
---|
1622 | if(pWindowInfo[i].MenuID){ |
---|
1623 | sprintf(buffer+i2," MENUID = %s\r\n",pWindowInfo[i].MenuID); |
---|
1624 | i2+=lstrlen(buffer+i2); |
---|
1625 | } |
---|
1626 | sprintf(buffer+i2," ID = %d\r\n",pWindowInfo[i].id); |
---|
1627 | i2+=lstrlen(buffer+i2); |
---|
1628 | sprintf(buffer+i2," BGCOLOR = %d\r\n",pWindowInfo[i].bgColor); |
---|
1629 | i2+=lstrlen(buffer+i2); |
---|
1630 | sprintf(buffer+i2," FONT = %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\"%s\"\r\n", |
---|
1631 | pWindowInfo[i].LogFont.lfHeight, |
---|
1632 | pWindowInfo[i].LogFont.lfWidth, |
---|
1633 | pWindowInfo[i].LogFont.lfEscapement, |
---|
1634 | pWindowInfo[i].LogFont.lfOrientation, |
---|
1635 | pWindowInfo[i].LogFont.lfWeight, |
---|
1636 | pWindowInfo[i].LogFont.lfItalic, |
---|
1637 | pWindowInfo[i].LogFont.lfUnderline, |
---|
1638 | pWindowInfo[i].LogFont.lfStrikeOut, |
---|
1639 | pWindowInfo[i].LogFont.lfCharSet, |
---|
1640 | pWindowInfo[i].LogFont.lfOutPrecision, |
---|
1641 | pWindowInfo[i].LogFont.lfClipPrecision, |
---|
1642 | pWindowInfo[i].LogFont.lfQuality, |
---|
1643 | pWindowInfo[i].LogFont.lfPitchAndFamily, |
---|
1644 | pWindowInfo[i].LogFont.lfFaceName); |
---|
1645 | i2+=lstrlen(buffer+i2); |
---|
1646 | if(pWindowInfo[i].IconResName){ |
---|
1647 | sprintf(buffer+i2," ICONID = %s\r\n",pWindowInfo[i].IconResName); |
---|
1648 | i2+=lstrlen(buffer+i2); |
---|
1649 | } |
---|
1650 | sprintf(buffer+i2," CLASS = \"%s\"\r\n",pWindowInfo[i].ClassName); |
---|
1651 | i2+=lstrlen(buffer+i2); |
---|
1652 | sprintf(buffer+i2," CALLBACK = %s\r\n",pWindowInfo[i].CallBackName); |
---|
1653 | i2+=lstrlen(buffer+i2); |
---|
1654 | sprintf(buffer+i2," TYPE = %d\r\n",pWindowInfo[i].type); |
---|
1655 | i2+=lstrlen(buffer+i2); |
---|
1656 | sprintf(buffer+i2," FILEPATH = %s\r\n",pWindowInfo[i].filepath); |
---|
1657 | i2+=lstrlen(buffer+i2); |
---|
1658 | for(i3=0;i3<pWindowInfo[i].NumberOfChildWindows;i3++){ |
---|
1659 | temporary=SetCaptionSequence(pWindowInfo[i].pChildInfo[i3].caption); |
---|
1660 | sprintf(buffer+i2," ITEM = %s,%d,%d,%d,%d,\"%s\",&H%08x,&H%08x,%d", |
---|
1661 | pWindowInfo[i].pChildInfo[i3].IdName, |
---|
1662 | pWindowInfo[i].pChildInfo[i3].pos.x,pWindowInfo[i].pChildInfo[i3].pos.y, |
---|
1663 | pWindowInfo[i].pChildInfo[i3].size.cx,pWindowInfo[i].pChildInfo[i3].size.cy, |
---|
1664 | temporary, |
---|
1665 | pWindowInfo[i].pChildInfo[i3].style, |
---|
1666 | pWindowInfo[i].pChildInfo[i3].ExStyle, |
---|
1667 | pWindowInfo[i].pChildInfo[i3].Control |
---|
1668 | ); |
---|
1669 | i2+=lstrlen(buffer+i2); |
---|
1670 | HeapDefaultFree(temporary); |
---|
1671 | if(pWindowInfo[i].pChildInfo[i3].Control==CT_IMAGEBOX){ |
---|
1672 | sprintf(buffer+i2,",%d,\"%s\"",pWindowInfo[i].pChildInfo[i3].ImageCtrlInfo.type,pWindowInfo[i].pChildInfo[i3].ImageCtrlInfo.path); |
---|
1673 | i2+=lstrlen(buffer+i2); |
---|
1674 | } |
---|
1675 | lstrcpy(buffer+i2,"\r\n"); |
---|
1676 | i2+=lstrlen(buffer+i2); |
---|
1677 | if(i2-GENERAL_SIZE<GENERAL_SIZE){ |
---|
1678 | size++; |
---|
1679 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,GENERAL_SIZE*size); |
---|
1680 | } |
---|
1681 | } |
---|
1682 | sprintf(buffer+i2,"END\r\n",pWindowInfo[i].name); |
---|
1683 | i2+=lstrlen(buffer+i2); |
---|
1684 | if(i2-GENERAL_SIZE<GENERAL_SIZE){ |
---|
1685 | size++; |
---|
1686 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,GENERAL_SIZE*size); |
---|
1687 | } |
---|
1688 | } |
---|
1689 | for(i=0;i<ProjectInfo.NumberOfMenu;i++){ |
---|
1690 | sprintf(buffer+i2,"MENU:%s\r\n",ProjectInfo.pMenuInfo[i].IdName); |
---|
1691 | i2+=lstrlen(buffer+i2); |
---|
1692 | i2+=GetSaveMenuData(buffer+i2,1,ProjectInfo.pMenuInfo[i].pMenuInfo,ProjectInfo.pMenuInfo[i].NumberOfMenu); |
---|
1693 | sprintf(buffer+i2,"END\r\n",pWindowInfo[i].name); |
---|
1694 | i2+=lstrlen(buffer+i2); |
---|
1695 | if(i2-GENERAL_SIZE<GENERAL_SIZE){ |
---|
1696 | size++; |
---|
1697 | buffer=(char *)HeapReAlloc(hHeap,0,buffer,GENERAL_SIZE*size); |
---|
1698 | } |
---|
1699 | } |
---|
1700 | WriteBuffer(path,buffer,i2); |
---|
1701 | HeapDefaultFree(buffer); |
---|
1702 | |
---|
1703 | extern PROJECTINFO ProjectInfo; |
---|
1704 | ProjectInfo.ModifyOfMaterial=0; |
---|
1705 | } |
---|
1706 | |
---|
1707 | MENU_INFO *GetMenuData(char *buffer,int *pPos,int *pMenuNum){ |
---|
1708 | extern HANDLE hHeap; |
---|
1709 | int i,i2,i3,i4; |
---|
1710 | char temporary[MAX_PATH],*temp2,temp3[MAX_PATH]; |
---|
1711 | MENU_INFO *pMenuInfo; |
---|
1712 | |
---|
1713 | temp2=(char *)HeapAlloc(hHeap,0,lstrlen(buffer)+1); |
---|
1714 | |
---|
1715 | *pMenuNum=0; |
---|
1716 | pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1); |
---|
1717 | |
---|
1718 | for(i=*pPos;;i++){ |
---|
1719 | if(buffer[i]=='\0') return 0; |
---|
1720 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||i==0){ |
---|
1721 | if(buffer[i]=='\r'&&buffer[i+1]=='\n') i+=2; |
---|
1722 | for(i2=0;;i++,i2++){ |
---|
1723 | if(!IsVariableChar(buffer[i])){ |
---|
1724 | temporary[i2]=0; |
---|
1725 | break; |
---|
1726 | } |
---|
1727 | temporary[i2]=buffer[i]; |
---|
1728 | } |
---|
1729 | if(i2==0){ |
---|
1730 | i--; |
---|
1731 | continue; |
---|
1732 | } |
---|
1733 | if(buffer[i]=='='){ |
---|
1734 | for(i++,i2=0;;i++,i2++){ |
---|
1735 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){ |
---|
1736 | temp2[i2]=0; |
---|
1737 | break; |
---|
1738 | } |
---|
1739 | temp2[i2]=buffer[i]; |
---|
1740 | } |
---|
1741 | } |
---|
1742 | else{ |
---|
1743 | temp2[0]=0; |
---|
1744 | i2=0; |
---|
1745 | } |
---|
1746 | |
---|
1747 | |
---|
1748 | if(lstrcmpi(temporary,"POPUP")==0){ |
---|
1749 | (*pMenuNum)++; |
---|
1750 | pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pMenuInfo,(*pMenuNum)*sizeof(MENU_INFO)); |
---|
1751 | i3=*pMenuNum-1; |
---|
1752 | |
---|
1753 | i4=GetOneParameter(temp2,0,temp3); |
---|
1754 | RemoveStringQuotes(temp3); |
---|
1755 | pMenuInfo[i3].caption=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); |
---|
1756 | lstrcpy(pMenuInfo[i3].caption,temp3); |
---|
1757 | |
---|
1758 | i4=GetOneParameter(temp2,i4,temp3); |
---|
1759 | pMenuInfo[i3].state=GetValue(temp3); |
---|
1760 | |
---|
1761 | pMenuInfo[i3].pMenuInfo=GetMenuData(buffer,&i,&pMenuInfo[i3].NumberOfMenu); |
---|
1762 | } |
---|
1763 | else if(lstrcmpi(temporary,"ITEM")==0){ |
---|
1764 | (*pMenuNum)++; |
---|
1765 | pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pMenuInfo,(*pMenuNum)*sizeof(MENU_INFO)); |
---|
1766 | i3=*pMenuNum-1; |
---|
1767 | |
---|
1768 | i4=GetOneParameter(temp2,0,temp3); |
---|
1769 | pMenuInfo[i3].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); |
---|
1770 | lstrcpy(pMenuInfo[i3].IdName,temp3); |
---|
1771 | |
---|
1772 | i4=GetOneParameter(temp2,i4,temp3); |
---|
1773 | RemoveStringQuotes(temp3); |
---|
1774 | pMenuInfo[i3].caption=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); |
---|
1775 | lstrcpy(pMenuInfo[i3].caption,temp3); |
---|
1776 | |
---|
1777 | i4=GetOneParameter(temp2,i4,temp3); |
---|
1778 | pMenuInfo[i3].state=GetValue(temp3); |
---|
1779 | |
---|
1780 | pMenuInfo[i3].type=0; |
---|
1781 | } |
---|
1782 | else if(lstrcmpi(temporary,"SEPARATOR")==0){ |
---|
1783 | (*pMenuNum)++; |
---|
1784 | pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,pMenuInfo,(*pMenuNum)*sizeof(MENU_INFO)); |
---|
1785 | i3=*pMenuNum-1; |
---|
1786 | |
---|
1787 | pMenuInfo[i3].type=MFT_SEPARATOR; |
---|
1788 | } |
---|
1789 | else if(lstrcmpi(temporary,"END")==0) break; |
---|
1790 | i--; |
---|
1791 | } |
---|
1792 | } |
---|
1793 | *pPos=i; |
---|
1794 | |
---|
1795 | HeapDefaultFree(temp2); |
---|
1796 | |
---|
1797 | return pMenuInfo; |
---|
1798 | } |
---|
1799 | _int8 OpenWindowFile(char *path){ |
---|
1800 | extern HANDLE hHeap; |
---|
1801 | extern PROJECTINFO ProjectInfo; |
---|
1802 | int i,i2,i3,i4,i5; |
---|
1803 | char *buffer,temporary[MAX_PATH],*temp2,temp3[MAX_PATH]; |
---|
1804 | CHILDINFO *pChildInfo; |
---|
1805 | |
---|
1806 | buffer=ReadBuffer(path); |
---|
1807 | if(!buffer) return 0; |
---|
1808 | temp2=(char *)HeapAlloc(hHeap,0,lstrlen(buffer)+1); |
---|
1809 | ChangeOrSignToDivision(temp2,buffer); |
---|
1810 | KillSpaces(temp2,buffer); |
---|
1811 | //temp2はこの後の処理の一時保存バッファにも利用するので解放しない |
---|
1812 | |
---|
1813 | ProjectInfo.NumberOfMenu=0; |
---|
1814 | ProjectInfo.pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1); |
---|
1815 | |
---|
1816 | ProjectInfo.NumberOfWindows=0; |
---|
1817 | ProjectInfo.pWindowInfo=(WINDOW_INFO *)HeapAlloc(hHeap,0,1); |
---|
1818 | |
---|
1819 | for(i=0,i3=0;;i++){ |
---|
1820 | if(buffer[i]=='\0') break; |
---|
1821 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||i==0){ |
---|
1822 | if(buffer[i]=='\r'&&buffer[i+1]=='\n') i+=2; |
---|
1823 | for(i2=0;;i++,i2++){ |
---|
1824 | if(!IsVariableChar(buffer[i])){ |
---|
1825 | temporary[i2]=0; |
---|
1826 | break; |
---|
1827 | } |
---|
1828 | temporary[i2]=buffer[i]; |
---|
1829 | } |
---|
1830 | if(i2==0){ |
---|
1831 | i--; |
---|
1832 | continue; |
---|
1833 | } |
---|
1834 | if(buffer[i]==':'||buffer[i]=='='){ |
---|
1835 | for(i++,i2=0;;i++,i2++){ |
---|
1836 | if((buffer[i]=='\r'&&buffer[i+1]=='\n')||buffer[i]=='\0'){ |
---|
1837 | temp2[i2]=0; |
---|
1838 | break; |
---|
1839 | } |
---|
1840 | temp2[i2]=buffer[i]; |
---|
1841 | } |
---|
1842 | } |
---|
1843 | else{ |
---|
1844 | temp2[0]=0; |
---|
1845 | i2=0; |
---|
1846 | } |
---|
1847 | |
---|
1848 | |
---|
1849 | ////////////// |
---|
1850 | //ウィンドウ |
---|
1851 | if(lstrcmpi(temporary,"WINDOW")==0&&i3==0){ |
---|
1852 | ProjectInfo.NumberOfWindows++; |
---|
1853 | ProjectInfo.pWindowInfo=(WINDOW_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,ProjectInfo.pWindowInfo,ProjectInfo.NumberOfWindows*sizeof(WINDOW_INFO)); |
---|
1854 | i4=ProjectInfo.NumberOfWindows-1; |
---|
1855 | i3=1; |
---|
1856 | |
---|
1857 | ProjectInfo.pWindowInfo[i4].name=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1858 | lstrcpy(ProjectInfo.pWindowInfo[i4].name,temp2); |
---|
1859 | |
---|
1860 | ProjectInfo.pWindowInfo[i4].NumberOfChildWindows=0; |
---|
1861 | ProjectInfo.pWindowInfo[i4].pChildInfo=(CHILDINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1); |
---|
1862 | } |
---|
1863 | else if(lstrcmpi(temporary,"HANDLE")==0&&i3==1){ |
---|
1864 | ProjectInfo.pWindowInfo[i4].HandleName=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1865 | lstrcpy(ProjectInfo.pWindowInfo[i4].HandleName,temp2); |
---|
1866 | } |
---|
1867 | else if(lstrcmpi(temporary,"POINT")==0&&i3==1){ |
---|
1868 | sscanf(temp2,"%d,%d", |
---|
1869 | &ProjectInfo.pWindowInfo[i4].pos.x, |
---|
1870 | &ProjectInfo.pWindowInfo[i4].pos.y); |
---|
1871 | if(ProjectInfo.pWindowInfo[i4].pos.x==-1) ProjectInfo.pWindowInfo[i4].pos.x=CW_USEDEFAULT; |
---|
1872 | if(ProjectInfo.pWindowInfo[i4].pos.y==-1) ProjectInfo.pWindowInfo[i4].pos.y=CW_USEDEFAULT; |
---|
1873 | } |
---|
1874 | else if(lstrcmpi(temporary,"SIZE")==0&&i3==1){ |
---|
1875 | sscanf(temp2,"%d,%d", |
---|
1876 | &ProjectInfo.pWindowInfo[i4].size.cx, |
---|
1877 | &ProjectInfo.pWindowInfo[i4].size.cy); |
---|
1878 | } |
---|
1879 | else if(lstrcmpi(temporary,"CAPTION")==0&&i3==1){ |
---|
1880 | if(temp2[0]=='\"'&&temp2[lstrlen(temp2)-1]=='\"'){ |
---|
1881 | temp2[lstrlen(temp2)-1]=0; |
---|
1882 | ProjectInfo.pWindowInfo[i4].caption=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1883 | lstrcpy(ProjectInfo.pWindowInfo[i4].caption,temp2+1); |
---|
1884 | } |
---|
1885 | } |
---|
1886 | else if(lstrcmpi(temporary,"STYLE")==0&&i3==1) ProjectInfo.pWindowInfo[i4].style=GetValue(temp2); |
---|
1887 | else if(lstrcmpi(temporary,"EXSTYLE")==0&&i3==1) ProjectInfo.pWindowInfo[i4].ExStyle=GetValue(temp2); |
---|
1888 | else if(lstrcmpi(temporary,"MENUID")==0&&i3==1){ |
---|
1889 | ProjectInfo.pWindowInfo[i4].MenuID=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1890 | lstrcpy(ProjectInfo.pWindowInfo[i4].MenuID,temp2); |
---|
1891 | } |
---|
1892 | else if(lstrcmpi(temporary,"ID")==0&&i3==1) ProjectInfo.pWindowInfo[i4].id=GetValue(temp2); |
---|
1893 | else if(lstrcmpi(temporary,"BGCOLOR")==0&&i3==1){ |
---|
1894 | ProjectInfo.pWindowInfo[i4].bgColor=GetValue(temp2); |
---|
1895 | if(ProjectInfo.dwVersion<=3){ |
---|
1896 | //プロジェクトバージョンが3以前のときは新値に変換する |
---|
1897 | if(ProjectInfo.pWindowInfo[i4].bgColor==-1) |
---|
1898 | ProjectInfo.pWindowInfo[i4].bgColor=-(int)RGB(255,255,255); |
---|
1899 | } |
---|
1900 | } |
---|
1901 | else if(lstrcmpi(temporary,"FONT")==0&&i3==1){ |
---|
1902 | i5=GetOneParameter(temp2,0,temp3); |
---|
1903 | ProjectInfo.pWindowInfo[i4].LogFont.lfHeight=GetValue(temp3); |
---|
1904 | |
---|
1905 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1906 | ProjectInfo.pWindowInfo[i4].LogFont.lfWidth=GetValue(temp3); |
---|
1907 | |
---|
1908 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1909 | ProjectInfo.pWindowInfo[i4].LogFont.lfEscapement=GetValue(temp3); |
---|
1910 | |
---|
1911 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1912 | ProjectInfo.pWindowInfo[i4].LogFont.lfOrientation=GetValue(temp3); |
---|
1913 | |
---|
1914 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1915 | ProjectInfo.pWindowInfo[i4].LogFont.lfWeight=GetValue(temp3); |
---|
1916 | |
---|
1917 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1918 | ProjectInfo.pWindowInfo[i4].LogFont.lfItalic=(BYTE)GetValue(temp3); |
---|
1919 | |
---|
1920 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1921 | ProjectInfo.pWindowInfo[i4].LogFont.lfUnderline=(BYTE)GetValue(temp3); |
---|
1922 | |
---|
1923 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1924 | ProjectInfo.pWindowInfo[i4].LogFont.lfStrikeOut=(BYTE)GetValue(temp3); |
---|
1925 | |
---|
1926 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1927 | ProjectInfo.pWindowInfo[i4].LogFont.lfCharSet=(BYTE)GetValue(temp3); |
---|
1928 | |
---|
1929 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1930 | ProjectInfo.pWindowInfo[i4].LogFont.lfOutPrecision=(BYTE)GetValue(temp3); |
---|
1931 | |
---|
1932 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1933 | ProjectInfo.pWindowInfo[i4].LogFont.lfClipPrecision=(BYTE)GetValue(temp3); |
---|
1934 | |
---|
1935 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1936 | ProjectInfo.pWindowInfo[i4].LogFont.lfQuality=(BYTE)GetValue(temp3); |
---|
1937 | |
---|
1938 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1939 | ProjectInfo.pWindowInfo[i4].LogFont.lfPitchAndFamily=(BYTE)GetValue(temp3); |
---|
1940 | |
---|
1941 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1942 | RemoveStringQuotes(temp3); |
---|
1943 | lstrcpy(ProjectInfo.pWindowInfo[i4].LogFont.lfFaceName,temp3); |
---|
1944 | } |
---|
1945 | else if(lstrcmpi(temporary,"ICONID")==0&&i3==1){ |
---|
1946 | ProjectInfo.pWindowInfo[i4].IconResName=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1947 | lstrcpy(ProjectInfo.pWindowInfo[i4].IconResName,temp2); |
---|
1948 | } |
---|
1949 | else if(lstrcmpi(temporary,"CLASS")==0&&i3==1){ |
---|
1950 | if(temp2[0]=='\"'&&temp2[lstrlen(temp2)-1]=='\"'){ |
---|
1951 | temp2[lstrlen(temp2)-1]=0; |
---|
1952 | ProjectInfo.pWindowInfo[i4].ClassName=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1953 | lstrcpy(ProjectInfo.pWindowInfo[i4].ClassName,temp2+1); |
---|
1954 | } |
---|
1955 | } |
---|
1956 | else if(lstrcmpi(temporary,"CALLBACK")==0&&i3==1){ |
---|
1957 | ProjectInfo.pWindowInfo[i4].CallBackName=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1958 | lstrcpy(ProjectInfo.pWindowInfo[i4].CallBackName,temp2); |
---|
1959 | } |
---|
1960 | |
---|
1961 | //以前のバージョンとの互換用 |
---|
1962 | else if(lstrcmpi(temporary,"DLGTMP")==0&&i3==1) ProjectInfo.pWindowInfo[i4].type=GetValue(temp2); |
---|
1963 | |
---|
1964 | else if(lstrcmpi(temporary,"TYPE")==0&&i3==1) ProjectInfo.pWindowInfo[i4].type=GetValue(temp2); |
---|
1965 | else if(lstrcmpi(temporary,"FILEPATH")==0&&i3==1){ |
---|
1966 | ProjectInfo.pWindowInfo[i4].filepath=(char *)HeapAlloc(hHeap,0,i2+1); |
---|
1967 | lstrcpy(ProjectInfo.pWindowInfo[i4].filepath,temp2); |
---|
1968 | } |
---|
1969 | else if(lstrcmpi(temporary,"ITEM")==0&&i3==1){ |
---|
1970 | ProjectInfo.pWindowInfo[i4].pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,ProjectInfo.pWindowInfo[i4].pChildInfo,(ProjectInfo.pWindowInfo[i4].NumberOfChildWindows+1)*sizeof(CHILDINFO)); |
---|
1971 | pChildInfo=&ProjectInfo.pWindowInfo[i4].pChildInfo[ProjectInfo.pWindowInfo[i4].NumberOfChildWindows]; |
---|
1972 | |
---|
1973 | //ID |
---|
1974 | i5=GetOneParameter(temp2,0,temp3); |
---|
1975 | pChildInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); |
---|
1976 | lstrcpy(pChildInfo->IdName,temp3); |
---|
1977 | |
---|
1978 | //位置 |
---|
1979 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1980 | pChildInfo->pos.x=GetValue(temp3); |
---|
1981 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1982 | pChildInfo->pos.y=GetValue(temp3); |
---|
1983 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1984 | pChildInfo->size.cx=GetValue(temp3); |
---|
1985 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1986 | pChildInfo->size.cy=GetValue(temp3); |
---|
1987 | |
---|
1988 | //テキスト |
---|
1989 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1990 | RemoveStringQuotes(temp3); |
---|
1991 | RestoreCaptionSequence(temp3); |
---|
1992 | pChildInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); |
---|
1993 | lstrcpy(pChildInfo->caption,temp3); |
---|
1994 | |
---|
1995 | //スタイル |
---|
1996 | i5=GetOneParameter(temp2,i5,temp3); |
---|
1997 | pChildInfo->style=GetValue(temp3); |
---|
1998 | |
---|
1999 | //拡張スタイル |
---|
2000 | i5=GetOneParameter(temp2,i5,temp3); |
---|
2001 | pChildInfo->ExStyle=GetValue(temp3); |
---|
2002 | |
---|
2003 | //クラス |
---|
2004 | i5=GetOneParameter(temp2,i5,temp3); |
---|
2005 | pChildInfo->Control=GetValue(temp3); |
---|
2006 | |
---|
2007 | if(pChildInfo->Control==CT_IMAGEBOX){ |
---|
2008 | //イメージ ボックスの場合 |
---|
2009 | i5=GetOneParameter(temp2,i5,temp3); |
---|
2010 | pChildInfo->ImageCtrlInfo.type=GetValue(temp3); |
---|
2011 | i5=GetOneParameter(temp2,i5,temp3); |
---|
2012 | RemoveStringQuotes(temp3); |
---|
2013 | pChildInfo->ImageCtrlInfo.path=(char *)HeapAlloc(hHeap,0,lstrlen(temp3)+1); |
---|
2014 | lstrcpy(pChildInfo->ImageCtrlInfo.path,temp3); |
---|
2015 | } |
---|
2016 | |
---|
2017 | ProjectInfo.pWindowInfo[i4].NumberOfChildWindows++; |
---|
2018 | } |
---|
2019 | |
---|
2020 | |
---|
2021 | //////////// |
---|
2022 | //メニュー |
---|
2023 | else if(lstrcmpi(temporary,"MENU")==0&&i3==0){ |
---|
2024 | ProjectInfo.NumberOfMenu++; |
---|
2025 | ProjectInfo.pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,ProjectInfo.pMenuInfo,ProjectInfo.NumberOfMenu*sizeof(MENU_INFO)); |
---|
2026 | i4=ProjectInfo.NumberOfMenu-1; |
---|
2027 | |
---|
2028 | //ID名 |
---|
2029 | ProjectInfo.pMenuInfo[i4].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temp2)+1); |
---|
2030 | lstrcpy(ProjectInfo.pMenuInfo[i4].IdName,temp2); |
---|
2031 | ProjectInfo.pMenuInfo[i4].pMenuInfo=GetMenuData(buffer,&i,&ProjectInfo.pMenuInfo[i4].NumberOfMenu); |
---|
2032 | if(!ProjectInfo.pMenuInfo[i4].pMenuInfo){ |
---|
2033 | //"ウィンドウ定義ファイルが壊れています。\n\n%s" |
---|
2034 | sprintf(temporary,STRING_ERROR_BROKEN_WNDFILE,path); |
---|
2035 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); |
---|
2036 | |
---|
2037 | HeapDefaultFree(temp2); |
---|
2038 | HeapDefaultFree(buffer); |
---|
2039 | return 0; |
---|
2040 | } |
---|
2041 | } |
---|
2042 | |
---|
2043 | |
---|
2044 | else if(lstrcmpi(temporary,"END")==0&&i3) i3=0; |
---|
2045 | else{ |
---|
2046 | //"ウィンドウ定義ファイルが壊れています。\n\n%s" |
---|
2047 | sprintf(temporary,STRING_ERROR_BROKEN_WNDFILE,path); |
---|
2048 | MessageBox(hOwner,temporary,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION); |
---|
2049 | |
---|
2050 | HeapDefaultFree(temp2); |
---|
2051 | HeapDefaultFree(buffer); |
---|
2052 | return 0; |
---|
2053 | } |
---|
2054 | i--; |
---|
2055 | } |
---|
2056 | } |
---|
2057 | |
---|
2058 | HeapDefaultFree(temp2); |
---|
2059 | HeapDefaultFree(buffer); |
---|
2060 | return 1; |
---|
2061 | } |
---|
2062 | |
---|
2063 | struct NEW_WINDOW{ |
---|
2064 | char name[MAX_PATH]; |
---|
2065 | char HandleName[MAX_PATH]; |
---|
2066 | char CallBackName[MAX_PATH]; |
---|
2067 | BOOL type; |
---|
2068 | }; |
---|
2069 | NEW_WINDOW NewWindow; |
---|
2070 | BOOL CALLBACK DlgProject_NewWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ |
---|
2071 | char temporary[MAX_PATH],temp2[MAX_PATH]; |
---|
2072 | switch(message){ |
---|
2073 | case WM_INITDIALOG: |
---|
2074 | SetPosCenter(hwnd); |
---|
2075 | SendDlgItemMessage(hwnd,IDC_AUTOSET,BM_SETCHECK,BST_CHECKED,0); |
---|
2076 | SendMessage(hwnd,WM_COMMAND,IDC_AUTOSET,0); |
---|
2077 | SendDlgItemMessage(hwnd,IDC_MODALDLG,BM_SETCHECK,BST_CHECKED,0); |
---|
2078 | break; |
---|
2079 | case WM_COMMAND: |
---|
2080 | switch(LOWORD(wParam)){ |
---|
2081 | case IDOK: |
---|
2082 | GetDlgItemText(hwnd,IDC_WINDOWNAME,NewWindow.name,MAX_PATH); |
---|
2083 | GetDlgItemText(hwnd,IDC_WINDOWHANDLE,NewWindow.HandleName,MAX_PATH); |
---|
2084 | GetDlgItemText(hwnd,IDC_WINDOWPROC,NewWindow.CallBackName,MAX_PATH); |
---|
2085 | if(SendDlgItemMessage(hwnd,IDC_DEFWINDOW,BM_GETCHECK,0,0)) |
---|
2086 | NewWindow.type=WNDTYPE_DEFAULT; |
---|
2087 | else if(SendDlgItemMessage(hwnd,IDC_MODALDLG,BM_GETCHECK,0,0)) |
---|
2088 | NewWindow.type=WNDTYPE_MODALDLG; |
---|
2089 | else if(SendDlgItemMessage(hwnd,IDC_MODELESSDLG,BM_GETCHECK,0,0)) |
---|
2090 | NewWindow.type=WNDTYPE_MODELESSDLG; |
---|
2091 | EndDialog(hwnd,1); |
---|
2092 | return 1; |
---|
2093 | case IDCANCEL: |
---|
2094 | EndDialog(hwnd,0); |
---|
2095 | return 1; |
---|
2096 | case IDC_WINDOWNAME: |
---|
2097 | if(HIWORD(wParam)==EN_CHANGE) SendMessage(hwnd,WM_COMMAND,IDC_AUTOSET,0); |
---|
2098 | return 1; |
---|
2099 | case IDC_AUTOSET: |
---|
2100 | if(SendDlgItemMessage(hwnd,IDC_AUTOSET,BM_GETCHECK,0,0)){ |
---|
2101 | SendDlgItemMessage(hwnd,IDC_WINDOWHANDLE,EM_SETREADONLY,1,0); |
---|
2102 | SendDlgItemMessage(hwnd,IDC_WINDOWPROC,EM_SETREADONLY,1,0); |
---|
2103 | GetDlgItemText(hwnd,IDC_WINDOWNAME,temporary,MAX_PATH); |
---|
2104 | if(temporary[0]){ |
---|
2105 | sprintf(temp2,"h%s",temporary); |
---|
2106 | SetDlgItemText(hwnd,IDC_WINDOWHANDLE,temp2); |
---|
2107 | sprintf(temp2,"%sProc",temporary); |
---|
2108 | SetDlgItemText(hwnd,IDC_WINDOWPROC,temp2); |
---|
2109 | } |
---|
2110 | else{ |
---|
2111 | SetDlgItemText(hwnd,IDC_WINDOWHANDLE,""); |
---|
2112 | SetDlgItemText(hwnd,IDC_WINDOWPROC,""); |
---|
2113 | } |
---|
2114 | } |
---|
2115 | else{ |
---|
2116 | SendDlgItemMessage(hwnd,IDC_WINDOWHANDLE,EM_SETREADONLY,0,0); |
---|
2117 | SendDlgItemMessage(hwnd,IDC_WINDOWPROC,EM_SETREADONLY,0,0); |
---|
2118 | } |
---|
2119 | return 1; |
---|
2120 | } |
---|
2121 | break; |
---|
2122 | } |
---|
2123 | return 0; |
---|
2124 | } |
---|
2125 | void GetDefaultWindowFont(LOGFONT *LogFont){ |
---|
2126 | LogFont->lfHeight=-12; |
---|
2127 | LogFont->lfWidth=0; |
---|
2128 | LogFont->lfEscapement=0; |
---|
2129 | LogFont->lfOrientation=0; |
---|
2130 | LogFont->lfWeight=FW_REGULAR; |
---|
2131 | LogFont->lfItalic=0; |
---|
2132 | LogFont->lfUnderline=0; |
---|
2133 | LogFont->lfStrikeOut=0; |
---|
2134 | LogFont->lfCharSet=SHIFTJIS_CHARSET; |
---|
2135 | LogFont->lfOutPrecision=OUT_STROKE_PRECIS; |
---|
2136 | LogFont->lfClipPrecision=CLIP_STROKE_PRECIS; |
---|
2137 | LogFont->lfQuality=DRAFT_QUALITY; |
---|
2138 | LogFont->lfPitchAndFamily=FF_SWISS; |
---|
2139 | lstrcpy(LogFont->lfFaceName,"MS Pゴシック"); |
---|
2140 | } |
---|
2141 | void Project_Window_Insert(void){ |
---|
2142 | extern HANDLE hHeap; |
---|
2143 | extern PROJECTINFO ProjectInfo; |
---|
2144 | int i; |
---|
2145 | char temporary[MAX_PATH],temp2[1024],*pTemp; |
---|
2146 | |
---|
2147 | if(!DialogBox(hResInst,MAKEINTRESOURCE(IDD_PROJECT_NEWWINDOW),hOwner,(DLGPROC)DlgProject_NewWindow)) return; |
---|
2148 | |
---|
2149 | //重複チェック |
---|
2150 | sprintf(temporary,"%s.sbp",NewWindow.name); |
---|
2151 | if(ProjectInfo.pobj_DBFileInfo->dupli_check(temporary)){ |
---|
2152 | sprintf(temp2,"\"%s\" ファイルは既にプロジェクト内に存在します。",temporary); |
---|
2153 | MessageBox(hOwner,temp2,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION); |
---|
2154 | return; |
---|
2155 | } |
---|
2156 | for(i=0;i<ProjectInfo.NumberOfWindows;i++){ |
---|
2157 | if(lstrcmpi(NewWindow.name,ProjectInfo.pWindowInfo[i].name)==0){ |
---|
2158 | //"\"%s\" ウィンドウは既にプロジェクト内に存在します。" |
---|
2159 | sprintf(temporary,STRING_DUPLICATIONERROR_WINDOW_IN_PROJECT,ProjectInfo.pWindowInfo[i].name); |
---|
2160 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); |
---|
2161 | return; |
---|
2162 | } |
---|
2163 | if(lstrcmpi(NewWindow.HandleName,ProjectInfo.pWindowInfo[i].HandleName)==0){ |
---|
2164 | //"\"%s\" ハンドルは既にプロジェクト内に存在します。" |
---|
2165 | sprintf(temporary,STRING_DUPLICATIONERROR_HANDLE_IN_PROJECT,ProjectInfo.pWindowInfo[i].HandleName); |
---|
2166 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); |
---|
2167 | return; |
---|
2168 | } |
---|
2169 | if(lstrcmpi(NewWindow.CallBackName,ProjectInfo.pWindowInfo[i].CallBackName)==0){ |
---|
2170 | //"\"%s\" プロシージャは既にプロジェクト内に存在します。" |
---|
2171 | sprintf(temporary,STRING_DUPLICATIONERROR_PROC_IN_PROJECT,ProjectInfo.pWindowInfo[i].CallBackName); |
---|
2172 | MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); |
---|
2173 | return; |
---|
2174 | } |
---|
2175 | } |
---|
2176 | |
---|
2177 | //ProjectInfo.pWindowInfo構造体に追加 |
---|
2178 | ProjectInfo.pWindowInfo=(WINDOW_INFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo,(ProjectInfo.NumberOfWindows+1)*sizeof(WINDOW_INFO)); |
---|
2179 | |
---|
2180 | |
---|
2181 | /////////////////////////////////////// |
---|
2182 | //ProjectInfo.pWindowInfo構造体を設定 |
---|
2183 | |
---|
2184 | //ウィンドウ名 |
---|
2185 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].name=(char *)HeapAlloc(hHeap,0,lstrlen(NewWindow.name)+1); |
---|
2186 | lstrcpy(ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].name,NewWindow.name); |
---|
2187 | |
---|
2188 | //ハンドル名 |
---|
2189 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].HandleName=(char *)HeapAlloc(hHeap,0,lstrlen(NewWindow.HandleName)+1); |
---|
2190 | lstrcpy(ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].HandleName,NewWindow.HandleName); |
---|
2191 | |
---|
2192 | //位置情報 |
---|
2193 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].pos.x=-1; |
---|
2194 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].pos.y=-1; |
---|
2195 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].size.cx=480; |
---|
2196 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].size.cy=360; |
---|
2197 | |
---|
2198 | //ウィンドウテキスト |
---|
2199 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].caption=(char *)HeapAlloc(hHeap,0,lstrlen(NewWindow.name)+1); |
---|
2200 | lstrcpy(ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].caption,NewWindow.name); |
---|
2201 | |
---|
2202 | //スタイル |
---|
2203 | switch(NewWindow.type){ |
---|
2204 | case WNDTYPE_DEFAULT: |
---|
2205 | //通常ウィンドウ |
---|
2206 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].style=WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; |
---|
2207 | break; |
---|
2208 | case WNDTYPE_MODALDLG: |
---|
2209 | case WNDTYPE_MODELESSDLG: |
---|
2210 | //ダイアログ テンプレート(最大化、最小化ボタンをなくして、細枠にする) |
---|
2211 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].style=WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU; |
---|
2212 | break; |
---|
2213 | } |
---|
2214 | |
---|
2215 | //拡張スタイル |
---|
2216 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].ExStyle=0; |
---|
2217 | |
---|
2218 | //メニュー |
---|
2219 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].MenuID=0; |
---|
2220 | |
---|
2221 | //ID |
---|
2222 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].id=0; |
---|
2223 | |
---|
2224 | //背景色 |
---|
2225 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].bgColor=COLOR_3DFACE; |
---|
2226 | |
---|
2227 | //フォント |
---|
2228 | GetDefaultWindowFont(&ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].LogFont); |
---|
2229 | |
---|
2230 | //アイコン |
---|
2231 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].IconResName=0; |
---|
2232 | |
---|
2233 | //クラス名 |
---|
2234 | lstrcpy(temporary,"NORMAL"); |
---|
2235 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].ClassName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); |
---|
2236 | lstrcpy(ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].ClassName,temporary); |
---|
2237 | |
---|
2238 | //コールバック関数名 |
---|
2239 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].CallBackName=(char *)HeapAlloc(hHeap,0,lstrlen(NewWindow.CallBackName)+1); |
---|
2240 | lstrcpy(ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].CallBackName,NewWindow.CallBackName); |
---|
2241 | |
---|
2242 | //タイプ識別 |
---|
2243 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].type=NewWindow.type; |
---|
2244 | |
---|
2245 | //子ウィンドウ情報 |
---|
2246 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].NumberOfChildWindows=0; |
---|
2247 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].pChildInfo=(CHILDINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1); |
---|
2248 | |
---|
2249 | |
---|
2250 | //メッセージ処理ファイル名 |
---|
2251 | sprintf(temporary,"%s.ab",ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].name); |
---|
2252 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].filepath=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); |
---|
2253 | lstrcpy(ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].filepath,temporary); |
---|
2254 | |
---|
2255 | |
---|
2256 | ////////////////////////// |
---|
2257 | // メッセージ処理ファイル |
---|
2258 | ////////////////////////// |
---|
2259 | |
---|
2260 | //テンプレートを読み込む |
---|
2261 | const std::string newWindowTemplateSbpPath = ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\new_window_template.sbp"; |
---|
2262 | pTemp = ReadBuffer( newWindowTemplateSbpPath ); |
---|
2263 | |
---|
2264 | //#name#をプロジェクト名に置換 |
---|
2265 | pTemp=PermutationWndPgmTemplate(pTemp, |
---|
2266 | ProjectInfo.name, |
---|
2267 | NewWindow.name, |
---|
2268 | NewWindow.HandleName, |
---|
2269 | NewWindow.CallBackName); |
---|
2270 | |
---|
2271 | sprintf(temporary,"%s%s.ab",ProjectInfo.dir,ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].name); |
---|
2272 | |
---|
2273 | //書き込み |
---|
2274 | WriteBuffer(temporary,pTemp,lstrlen(pTemp)); |
---|
2275 | Project_File_Insert(temporary); |
---|
2276 | |
---|
2277 | HeapDefaultFree(pTemp); |
---|
2278 | |
---|
2279 | |
---|
2280 | ////////////////////// |
---|
2281 | //ツリービューに追加 |
---|
2282 | |
---|
2283 | extern HWND hMaterialTreeView; |
---|
2284 | TV_INSERTSTRUCT tv; |
---|
2285 | tv.hInsertAfter=TVI_SORT; |
---|
2286 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE; |
---|
2287 | tv.item.iImage=2; |
---|
2288 | tv.item.iSelectedImage=2; |
---|
2289 | tv.hParent=ProjectInfo.hWindowTreeItem; |
---|
2290 | tv.item.pszText=ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].name; |
---|
2291 | |
---|
2292 | ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv); |
---|
2293 | |
---|
2294 | TreeView_SelectItem(hMaterialTreeView,ProjectInfo.pWindowInfo[ProjectInfo.NumberOfWindows].hTreeItem); |
---|
2295 | |
---|
2296 | |
---|
2297 | ProjectInfo.NumberOfWindows++; |
---|
2298 | ProjectInfo.ModifyOfMaterial=1; |
---|
2299 | |
---|
2300 | NewRadWindow(ProjectInfo.NumberOfWindows-1); |
---|
2301 | } |
---|
2302 | void Project_Window_Delete(int WndInfoNum){ |
---|
2303 | extern HANDLE hHeap; |
---|
2304 | extern MDIINFO MdiInfo[MAX_WNDNUM]; |
---|
2305 | extern PROJECTINFO ProjectInfo; |
---|
2306 | int i; |
---|
2307 | |
---|
2308 | //ウィンドウが開かれている場合は閉じる |
---|
2309 | for(i=0;i<MAX_WNDNUM;i++){ |
---|
2310 | if(MdiInfo[i].hwnd&&lstrcmpi(ProjectInfo.pWindowInfo[WndInfoNum].name,MdiInfo[i].path)==0){ |
---|
2311 | SendMessage(MdiInfo[i].hwnd,WM_CLOSE,0,0); |
---|
2312 | break; |
---|
2313 | } |
---|
2314 | } |
---|
2315 | |
---|
2316 | //ウィンドウ情報のメモリを解放 |
---|
2317 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].name); |
---|
2318 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].filepath); |
---|
2319 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].HandleName); |
---|
2320 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].caption); |
---|
2321 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].ClassName); |
---|
2322 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].CallBackName); |
---|
2323 | |
---|
2324 | //子ウィンドウのメモリを解放 |
---|
2325 | for(i=0;i<ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;i++){ |
---|
2326 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].IdName); |
---|
2327 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].caption); |
---|
2328 | } |
---|
2329 | HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo); |
---|
2330 | |
---|
2331 | //ツリービューから削除 |
---|
2332 | extern HWND hMaterialTreeView; |
---|
2333 | TreeView_DeleteItem(hMaterialTreeView,ProjectInfo.pWindowInfo[WndInfoNum].hTreeItem); |
---|
2334 | |
---|
2335 | //ProjectInfo.pWindowInfo構造体から削除 |
---|
2336 | ProjectInfo.NumberOfWindows--; |
---|
2337 | for(i=WndInfoNum;i<ProjectInfo.NumberOfWindows;i++) ProjectInfo.pWindowInfo[i]=ProjectInfo.pWindowInfo[i+1]; |
---|
2338 | if(ProjectInfo.NumberOfWindows==0) ProjectInfo.pWindowInfo=(WINDOW_INFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo,1); |
---|
2339 | else ProjectInfo.pWindowInfo=(WINDOW_INFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo,ProjectInfo.NumberOfWindows*sizeof(WINDOW_INFO)); |
---|
2340 | |
---|
2341 | ProjectInfo.ModifyOfMaterial=1; |
---|
2342 | } |
---|