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