source: dev/ProjectEditor/MenuProc.cpp@ 59

Last change on this file since 59 was 24, checked in by dai_9181, 18 years ago

保存されていないドキュメントのタブに(*)をつける機能に対応。
MDITEXTEDITINFOをCMdiTextEditに変更。今後、オブジェクト指向化を進める。

File size: 32.0 KB
RevLine 
[3]1#include "Common.h"
2
3#if defined(JPN)
4//日本語
5#include "rad_msg_jpn.h"
6#else
7//英語
8#include "rad_msg_eng.h"
9#endif
10
11int GetMenuInfoNum(char *name){
12 extern PROJECTINFO ProjectInfo;
13 int i;
14 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
15 if(lstrcmpi(name,ProjectInfo.pMenuInfo[i].IdName)==0) return i;
16 }
17 return -1;
18}
19void HeapMenuDataFree(MENU_INFO *pMenuInfo,int ItemNum,int *NumberOfFreedItem){
20 extern HANDLE hHeap;
21 int i;
22 for(i=0;i<ItemNum;i++){
23 if(NumberOfFreedItem) (*NumberOfFreedItem)++;
24 if(pMenuInfo[i].caption) HeapDefaultFree(pMenuInfo[i].caption);
25 if(pMenuInfo[i].IdName) HeapDefaultFree(pMenuInfo[i].IdName);
26 if(pMenuInfo[i].pMenuInfo){
27 HeapMenuDataFree(pMenuInfo[i].pMenuInfo,pMenuInfo[i].NumberOfMenu,NumberOfFreedItem);
28 HeapDefaultFree(pMenuInfo[i].pMenuInfo);
29 }
30 }
31}
32
33BOOL CALLBACK DlgProject_MenuID_Input(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
34 extern char NewIdName[MAX_PATH];
35 switch(message){
36 case WM_INITDIALOG:
37 if(lParam==0){
38 //"新規メニュー"
39 SetWindowText(hwnd,STRING_MENUEDIT_MAKE_NEWMENU);
40 }
41 else{
42 //"メニューIDの変更"
43 SetWindowText(hwnd,STRING_MENUEDIT_RENAME_MENUID);
44 SetDlgItemText(hwnd,IDC_IDNAME,(char *)lParam);
45 }
46 SetPosCenter(hwnd);
47 break;
48 case WM_COMMAND:
49 switch(LOWORD(wParam)){
50 case IDOK:
51 GetDlgItemText(hwnd,IDC_IDNAME,NewIdName,MAX_PATH);
52 if(!NewIdName[0]){
53 //"ID名を入力して下さい。"
54 MessageBox(hwnd,STRING_ERROR_MUST_IDNAME,STRING_ERROR,MB_OK);
55 return 1;
56 }
57 EndDialog(hwnd,1);
58 return 1;
59 case IDCANCEL:
60 EndDialog(hwnd,0);
61 return 1;
62 }
63 break;
64 }
65 return 0;
66}
67void Project_Menu_Insert(void){
68 extern HANDLE hHeap;
69 extern PROJECTINFO ProjectInfo;
70 extern MDIINFO MdiInfo[MAX_WNDNUM];
71 extern char NewIdName[MAX_PATH];
72 int i;
73 char temporary[MAX_PATH];
74 MENU_INFO *MenuInfo;
75
76 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_INPUTID),hOwner,(DLGPROC)DlgProject_MenuID_Input,0)) return;
77
78 //重複チェック
79 for(i=0;i<ProjectInfo.NumberOfMenu;i++){
80 if(lstrcmpi(NewIdName,ProjectInfo.pMenuInfo[i].IdName)==0){
81 //"\"%s\" メニューは既にプロジェクト内に存在します。"
82 sprintf(temporary,STRING_MENUEDIT_DUPLICATIONERROR,ProjectInfo.pMenuInfo[i].IdName);
83 MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
84 return;
85 }
86 }
87
88 ProjectInfo.pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,0,ProjectInfo.pMenuInfo,(ProjectInfo.NumberOfMenu+1)*sizeof(MENU_INFO));
89 MenuInfo=&ProjectInfo.pMenuInfo[ProjectInfo.NumberOfMenu];
90
91 MenuInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(NewIdName)+1);
92 lstrcpy(MenuInfo->IdName,NewIdName);
93
94 MenuInfo->caption=0;
95
96 MenuInfo->NumberOfMenu=0;
97 MenuInfo->pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
98
99
100 //////////////////////
101 //ツリービューに追加
102
103 extern HWND hMaterialTreeView;
104 TV_INSERTSTRUCT tv;
105 tv.hInsertAfter=TVI_SORT;
106 tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
107 tv.item.iImage=3;
108 tv.item.iSelectedImage=3;
109 tv.hParent=ProjectInfo.hMenuTreeItem;
110 tv.item.pszText=MenuInfo->IdName;
111
112 MenuInfo->hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
113
114 TreeView_SelectItem(hMaterialTreeView,MenuInfo->hTreeItem);
115
116
117 ProjectInfo.NumberOfMenu++;
118 ProjectInfo.ModifyOfMaterial=1;
119
120
121 ////////////////////////////////
122 // ウィンドウ プロパティを更新
123 for(i=0;i<MAX_WNDNUM;i++){
124 if(MdiInfo[i].hwnd&&MdiInfo[i].DocType==WNDTYPE_RAD){
125 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
126 ChangePropertyWindow(i,GetWndInfoNum(MdiInfo[i].path));
127 }
128 }
129
130 NewMenuWindow(&ProjectInfo.pMenuInfo[ProjectInfo.NumberOfMenu-1]);
131}
132void Project_Menu_Delete(int MenuInfoNum){
133 extern HANDLE hHeap;
134 extern MDIINFO MdiInfo[MAX_WNDNUM];
135 extern PROJECTINFO ProjectInfo;
136 int i;
137
138 //ウィンドウが開かれている場合は閉じる
139 for(i=0;i<MAX_WNDNUM;i++){
140 if(MdiInfo[i].hwnd&&lstrcmpi(ProjectInfo.pMenuInfo[MenuInfoNum].IdName,MdiInfo[i].path)==0){
141 SendMessage(MdiInfo[i].hwnd,WM_CLOSE,0,0);
142 break;
143 }
144 }
145
146 //メニュー情報のメモリを解放
147 HeapMenuDataFree(ProjectInfo.pMenuInfo[MenuInfoNum].pMenuInfo,ProjectInfo.pMenuInfo[MenuInfoNum].NumberOfMenu,0);
148 HeapDefaultFree(ProjectInfo.pMenuInfo[MenuInfoNum].pMenuInfo);
149 HeapDefaultFree(ProjectInfo.pMenuInfo[MenuInfoNum].IdName);
150
151 //ツリービューから削除
152 extern HWND hMaterialTreeView;
153 TreeView_DeleteItem(hMaterialTreeView,ProjectInfo.pMenuInfo[MenuInfoNum].hTreeItem);
154
155 //ProjectInfo.pMenuInfo構造体から削除
156 ProjectInfo.NumberOfMenu--;
157 for(i=MenuInfoNum;i<ProjectInfo.NumberOfMenu;i++) ProjectInfo.pMenuInfo[i]=ProjectInfo.pMenuInfo[i+1];
158 if(ProjectInfo.NumberOfMenu==0){
159 HeapDefaultFree(ProjectInfo.pMenuInfo);
160 ProjectInfo.pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
161 }
162 else ProjectInfo.pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,0,ProjectInfo.pMenuInfo,ProjectInfo.NumberOfMenu*sizeof(MENU_INFO));
163
164 ProjectInfo.ModifyOfMaterial=1;
165
166
167 ////////////////////////////////
168 // ウィンドウ プロパティを更新
169 for(i=0;i<MAX_WNDNUM;i++){
170 if(MdiInfo[i].hwnd&&MdiInfo[i].DocType==WNDTYPE_RAD){
171 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
172 ChangePropertyWindow(i,GetWndInfoNum(MdiInfo[i].path));
173 }
174 }
175}
176
177void SetMenuDataList(HWND hList,MENU_INFO *pMenuInfo,int GradeNum){
178 int i;
179 char temporary[MAX_PATH];
180 for(i=0;i<pMenuInfo->NumberOfMenu;i++){
181 memset(temporary,' ',GradeNum*4);
182 temporary[GradeNum*4]=0;
183 if(pMenuInfo->pMenuInfo[i].type==MFT_SEPARATOR)
184 lstrcpy(temporary+GradeNum*4,"-");
185 else
186 lstrcpy(temporary+GradeNum*4,pMenuInfo->pMenuInfo[i].caption);
187 SendMessage(hList,LB_ADDSTRING,0,(long)temporary);
188 if(pMenuInfo->pMenuInfo[i].pMenuInfo)
189 SetMenuDataList(hList,&pMenuInfo->pMenuInfo[i],GradeNum+1);
190 }
191}
192void NewMenuWindow(MENU_INFO *pMenuInfo){
193 extern HINSTANCE hInst;
194 extern HWND hDocCombo;
195 extern MDIINFO MdiInfo[MAX_WNDNUM];
196 int i;
197 HWND hChild,hListWnd,hMenuEdit;
198 RECT rect;
199 MDICREATESTRUCT mdic;
200
201 //すでに指定されたファイルが開かれている場合
202 hChild=GetWindow(hClient,GW_CHILD);
203 while(hChild){
204 i=GetWndNum(hChild);
205 if(MdiInfo[i].DocType==WNDTYPE_MENU){
206 if(lstrcmpi(MdiInfo[i].path,pMenuInfo->IdName)==0) break;
207 }
208 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
209 }
210 if(hChild){
211 BringWindowToTop(hChild);
212 return;
213 }
214
215 mdic.szTitle=pMenuInfo->IdName;
216 mdic.szClass="MDIClientWindow_Menu";
217 mdic.hOwner=hInst;
218 mdic.x=CW_USEDEFAULT;
219 mdic.y=CW_USEDEFAULT;
220 mdic.cx=CW_USEDEFAULT;
221 mdic.cy=CW_USEDEFAULT;
222
223 hChild=GetWindow(hClient,GW_CHILD);
224 if(IsWindow(hChild)){
225 if(IsZoomed(hChild)) mdic.style=WS_MAXIMIZE;
226 else mdic.style=0;
227 }
228 else{
229 if(pobj_nv->bMDIZoomed) mdic.style=WS_MAXIMIZE;
230 else mdic.style=0;
231 }
232
233 mdic.lParam=0;
234 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(long)&mdic); //ウィンドウ作成
235
236
237 ////////////////////
238 //子ウィンドウ作成
239
240 //ダイアログの下地を作成
241 hMenuEdit=CreateWindowEx(WS_EX_CLIENTEDGE,"MenuEditWindow",NULL,
242 WS_CHILD|WS_VSCROLL|WS_VISIBLE,
243 0,0,0,0,
244 hChild,NULL,hInst,NULL);
245
246 //メニュー リスト ウィンドウを作成
247 hListWnd=CreateWindowEx(WS_EX_CLIENTEDGE,"LISTBOX",NULL,
248 WS_CHILD|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE|LBS_NOTIFY|LBS_NOINTEGRALHEIGHT,
249 0,0,0,0,
250 hChild,NULL,hInst,NULL);
251
252 //ウィンドウのID登録
253 for(i=0;i<MAX_WNDNUM;i++){
254 if(MdiInfo[i].hwnd==0){
255 MdiInfo[i].hwnd=hChild;
256 MdiInfo[i].DocType=WNDTYPE_MENU;
257 MdiInfo[i].title=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pMenuInfo->IdName)+1);
258 lstrcpy(MdiInfo[i].title,pMenuInfo->IdName);
259 MdiInfo[i].path=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pMenuInfo->IdName)+1);
260 lstrcpy(MdiInfo[i].path,pMenuInfo->IdName);
261
262
263 /////////////////////
264 //MENU ウィンドウ情報
265
266 MdiInfo[i].MdiMenuInfo=(MDIMENUINFO *)GlobalAlloc(GPTR,sizeof(MDIMENUINFO));
267
268 MdiInfo[i].MdiMenuInfo->hList=hListWnd;
269
270 MdiInfo[i].MdiMenuInfo->hMenuEdit=hMenuEdit;
271 MdiInfo[i].MdiMenuInfo->hEdit_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_PROJECT_MENUEDIT),hMenuEdit,(DLGPROC)MenuEditDlg);
272
273 SCROLLINFO ScrollInfo;
274 ScrollInfo.cbSize=sizeof(SCROLLINFO);
275 ScrollInfo.fMask=SIF_POS;
276 ScrollInfo.nPos=0;
277 SetScrollInfo(MdiInfo[i].MdiMenuInfo->hMenuEdit,SB_VERT,&ScrollInfo,1);
278
279 SendMessage(hListWnd,LB_RESETCONTENT,0,0);
280 SetMenuDataList(hListWnd,pMenuInfo,0);
281 if(pMenuInfo->NumberOfMenu){
282 SendMessage(hListWnd,LB_SETCURSEL,0,0);
283 SendMessage(hChild,WM_COMMAND,MAKELONG(0,LBN_SELCHANGE),(long)hListWnd);
284 }
285 break;
286 }
287 }
288
289 //ウィンドウ位置を初期化
290 GetClientRect(hChild,&rect);
291 MoveWindow(MdiInfo[i].MdiMenuInfo->hMenuEdit,0,0,172,rect.bottom,1);
292 MoveWindow(MdiInfo[i].MdiMenuInfo->hList,172,0,rect.right-172,rect.bottom,1);
293
294 //Docコンボボックスに追加
295 i=SendMessage(hDocCombo,CB_ADDSTRING,0,(long)pMenuInfo->IdName);
296 SendMessage(hDocCombo,CB_SETCURSEL,i,0);
297
298 //タブに追加
[24]299 pobj_MainTab->InsertItem( pMenuInfo->IdName, true );
[3]300
301 SetFocus(hListWnd);
302
303 //メニュー状態を設定
304 ResetState_DocMenu();
305}
306
307int GetNumberOfMenu(MENU_INFO *pMenuInfo){
308 int i,i2;
309 for(i=0,i2=0;i<pMenuInfo->NumberOfMenu;i++,i2++){
310 if(pMenuInfo->pMenuInfo[i].pMenuInfo) i2+=GetNumberOfMenu(&pMenuInfo->pMenuInfo[i]);
311 }
312 return i2;
313}
314MENU_INFO *GetMenuInfoFromList(MENU_INFO *pMenuInfo,int *pPos,int index,int *GradeNum){
315 int i;
316 MENU_INFO *pRetMenuInfo;
317 for(i=0;i<pMenuInfo->NumberOfMenu;i++){
318 if((*pPos)==index){
319 *pPos=i;
320 return pMenuInfo;
321 }
322 (*pPos)++;
323 if(pMenuInfo->pMenuInfo[i].pMenuInfo){
324 (*GradeNum)++;
325 pRetMenuInfo=GetMenuInfoFromList(&pMenuInfo->pMenuInfo[i],pPos,index,GradeNum);
326 if(pRetMenuInfo) return pRetMenuInfo;
327 (*GradeNum)--;
328 }
329 }
330 return 0;
331}
332BOOL CALLBACK DlgMenuProperty_Rename(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
333 extern HANDLE hHeap;
334 extern HWND hClient,hOwner;
335 extern MDIINFO MdiInfo[MAX_WNDNUM];
336 int i;
337 char temporary[MAX_PATH];
338 static MENU_INFO *pMenuInfo;
339
340 switch(message){
341 case WM_INITDIALOG:
342 SetPosCenter(hwnd);
343 i=GetWndNum(GetWindow(hClient,GW_CHILD));
344 GetDlgItemText(MdiInfo[i].MdiMenuInfo->hEdit_Dlg,IDC_IDNAME,temporary,MAX_PATH);
345 SetDlgItemText(hwnd,IDC_IDNAME,temporary);
346 GetDlgItemText(MdiInfo[i].MdiMenuInfo->hEdit_Dlg,IDC_CAPTION,temporary,MAX_PATH);
347 SetDlgItemText(hwnd,IDC_CAPTION,temporary);
348
349 pMenuInfo=(MENU_INFO *)lParam;
350 if(pMenuInfo->pMenuInfo){
351 EnableWindow(GetDlgItem(hwnd,IDC_IDSTATIC),0);
352 EnableWindow(GetDlgItem(hwnd,IDC_IDNAME),0);
353 }
354 break;
355 case WM_COMMAND:
356 switch(LOWORD(wParam)){
357 case IDOK:
358 i=GetWndNum(GetWindow(hClient,GW_CHILD));
359
360 if(!pMenuInfo->pMenuInfo){
361 //ID
362 GetDlgItemText(hwnd,IDC_IDNAME,temporary,MAX_PATH);
363 if(!temporary[0]){
364 //"ID名を入力して下さい。"
365 MessageBox(hOwner,STRING_ERROR_MUST_IDNAME,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
366 break;
367 }
368 HeapDefaultFree(pMenuInfo->IdName);
369 pMenuInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
370 lstrcpy(pMenuInfo->IdName,temporary);
371 }
372
373 //キャプション
374 GetDlgItemText(hwnd,IDC_CAPTION,temporary,MAX_PATH);
375 if(!temporary[0]){
376 //"キャプションを入力して下さい。"
377 MessageBox(hOwner,STRING_ERROR_MUST_CAPTION,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
378 break;
379 }
380 HeapDefaultFree(pMenuInfo->caption);
381 pMenuInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
382 lstrcpy(pMenuInfo->caption,temporary);
383
384 EndDialog(hwnd,1);
385 return 1;
386 case IDCANCEL:
387 EndDialog(hwnd,0);
388 return 1;
389 }
390 break;
391 }
392 return 0;
393}
394BOOL CALLBACK MenuEditDlg(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
395 extern HANDLE hHeap;
396 extern PROJECTINFO ProjectInfo;
397 int i,i2,i3,i4,WndNum,MenuInfoNum;
398 char temporary[MAX_PATH];
399 MENU_INFO *pMenuInfo,tempMenuInfo;
400
401 switch(message){
402 case WM_COMMAND:
403 switch(LOWORD(wParam)){
404 case IDC_RENAME:
405 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
406 if(WndNum==-1) return 1;
407 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
408
409 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
410 if(i4==LB_ERR) return 1;
411 i2=0;
412 i3=0;
413 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
414 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
415
416 if(!DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_PROJECT_MENURENAME),hOwner,(DLGPROC)DlgMenuProperty_Rename,(long)pMenuInfo)) return 1;
417 GetDlgItemText(hwnd,IDC_IDNAME,temporary,MAX_PATH);
418
419 if(!pMenuInfo->pMenuInfo){
420 //ID
421 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDNAME,pMenuInfo->IdName);
422 }
423
424 //キャプション
425 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CAPTION,pMenuInfo->caption);
426
427 //リストへキャプションを反映
428 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_DELETESTRING,i4,0);
429 memset(temporary,' ',i3*4);
430 lstrcpy(temporary+i3*4,pMenuInfo->caption);
431 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_INSERTSTRING,i4,(long)temporary);
432
433 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,i4,0);
434 ProjectInfo.ModifyOfMaterial=1;
435 return 1;
436 case IDC_POPUP:
437 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
438 if(WndNum==-1) return 1;
439 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
440
441 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
442 if(i4==LB_ERR) return 1;
443 i2=0;
444 i3=0;
445 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
446 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
447
448 if(pMenuInfo->pMenuInfo){
449 if(pMenuInfo->NumberOfMenu){
450 //"この操作を行うとポップアップされるメニュー アイテムも削除されます。"
451 if(MessageBox(hOwner,STRING_MENUEDIT_DELETECHECK,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)==IDCANCEL) return 1;
452 }
453 i=0;
454 HeapMenuDataFree(pMenuInfo->pMenuInfo,pMenuInfo->NumberOfMenu,&i);
455
456 for(i2=0;i2<i;i2++)
457 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_DELETESTRING,i4+1,0);
458
459 HeapDefaultFree(pMenuInfo->pMenuInfo);
460 pMenuInfo->pMenuInfo=0;
461 lstrcpy(temporary,"IDM_name");
462 pMenuInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
463 lstrcpy(pMenuInfo->IdName,temporary);
464 }
465 else{
466 if(pMenuInfo->type==MFT_STRING){
467 HeapDefaultFree(pMenuInfo->IdName);
468 pMenuInfo->IdName=0;
469 }
470 else if(pMenuInfo->type==MFT_SEPARATOR){
471 lstrcpy(temporary,"caption text");
472 pMenuInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
473 lstrcpy(pMenuInfo->caption,temporary);
474 }
475 pMenuInfo->NumberOfMenu=0;
476 pMenuInfo->pMenuInfo=(MENU_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
477 pMenuInfo->type=MFT_STRING;
478 }
479 SendMessage(MdiInfo[WndNum].hwnd,WM_COMMAND,MAKELONG(0,LBN_SELCHANGE),(long)MdiInfo[WndNum].MdiMenuInfo->hList);
480 ProjectInfo.ModifyOfMaterial=1;
481 return 1;
482 case IDC_SEPARATOR:
483 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
484 if(WndNum==-1) return 1;
485 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
486
487 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
488 if(i4==LB_ERR) return 1;
489 i2=0;
490 i3=0;
491 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
492 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
493
494 if(SendDlgItemMessage(hwnd,IDC_SEPARATOR,BM_GETCHECK,0,0)){
495 HeapDefaultFree(pMenuInfo->caption);
496 pMenuInfo->caption=0;
497 HeapDefaultFree(pMenuInfo->IdName);
498 pMenuInfo->IdName=0;
499 pMenuInfo->type=MFT_SEPARATOR;
500
501 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_DELETESTRING,i4,0);
502 memset(temporary,' ',i3*4);
503 lstrcpy(temporary+i3*4,"-");
504 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_INSERTSTRING,i4,(long)temporary);
505 }
506 else{
507 lstrcpy(temporary,"caption text");
508 pMenuInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
509 lstrcpy(pMenuInfo->caption,temporary);
510 lstrcpy(temporary,"IDM_name");
511 pMenuInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
512 lstrcpy(pMenuInfo->IdName,temporary);
513 pMenuInfo->type=MFT_STRING;
514
515 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_DELETESTRING,i4,0);
516 memset(temporary,' ',i3*4);
517 lstrcpy(temporary+i3*4,pMenuInfo->caption);
518 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_INSERTSTRING,i4,(long)temporary);
519 }
520 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,i4,0);
521 SendMessage(MdiInfo[WndNum].hwnd,WM_COMMAND,MAKELONG(0,LBN_SELCHANGE),(long)MdiInfo[WndNum].MdiMenuInfo->hList);
522 return 1;
523 case IDC_CHECKED:
524 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
525 if(WndNum==-1) return 1;
526 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
527
528 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
529 if(i4==LB_ERR) return 1;
530 i2=0;
531 i3=0;
532 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
533 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
534
535 if(SendDlgItemMessage(hwnd,IDC_CHECKED,BM_GETCHECK,0,0))
536 pMenuInfo->state|=MFS_CHECKED;
537 else
538 pMenuInfo->state&=~MFS_CHECKED;
539
540 ProjectInfo.ModifyOfMaterial=1;
541 return 1;
542 case IDC_DISABLED:
543 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
544 if(WndNum==-1) return 1;
545 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
546
547 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
548 if(i4==LB_ERR) return 1;
549 i2=0;
550 i3=0;
551 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
552 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
553
554 if(SendDlgItemMessage(hwnd,IDC_DISABLED,BM_GETCHECK,0,0))
555 pMenuInfo->state|=MFS_DISABLED;
556 else
557 pMenuInfo->state&=~MFS_DISABLED;
558
559 ProjectInfo.ModifyOfMaterial=1;
560 return 1;
561 case IDC_INSERTMENUITEM:
562 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
563 if(WndNum==-1) return 1;
564 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
565
566 if(ProjectInfo.pMenuInfo[MenuInfoNum].NumberOfMenu==0){
567 ProjectInfo.pMenuInfo[MenuInfoNum].pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,ProjectInfo.pMenuInfo[MenuInfoNum].pMenuInfo,(ProjectInfo.pMenuInfo[MenuInfoNum].NumberOfMenu+1)*sizeof(MENU_INFO));
568 pMenuInfo=&ProjectInfo.pMenuInfo[MenuInfoNum].pMenuInfo[ProjectInfo.pMenuInfo[MenuInfoNum].NumberOfMenu];
569
570 sprintf(temporary,"caption text");
571 pMenuInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
572 lstrcpy(pMenuInfo->caption,temporary);
573
574 sprintf(temporary,"IDM_name");
575 pMenuInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
576 lstrcpy(pMenuInfo->IdName,temporary);
577
578 pMenuInfo->state=0;
579 pMenuInfo->type=MFT_STRING;
580 pMenuInfo->pMenuInfo=0;
581
582 ProjectInfo.pMenuInfo[MenuInfoNum].NumberOfMenu++;
583
584 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_INSERTSTRING,0,(long)pMenuInfo->caption);
585 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,0,0);
586 SendMessage(GetParent(MdiInfo[WndNum].MdiMenuInfo->hMenuEdit),WM_COMMAND,MAKELONG(0,LBN_SELCHANGE),(long)MdiInfo[WndNum].MdiMenuInfo->hList);
587 }
588 else{
589 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
590 if(i4==LB_ERR){
591 //"新しいメニュー アイテムの挿入位置を選択して下さい"
592 MessageBox(hOwner,STRING_MENUEDIT_MUSTSELECT_NEW_ITEM,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
593 return 1;
594 }
595 i2=0;
596 i3=0;
597 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
598 if(pMenuInfo->pMenuInfo[i2].pMenuInfo){
599 //"ポップアップ アイテムを作成する場合は \"はい\" を、ポップアップと同じ階層にメニュー アイテムを作成する場合は \"いいえ\" を押して下さい。"
600 i=MessageBox(hOwner,STRING_MENUEDIT_INSERTTYPE_YESNO,APPLICATION_NAME,MB_YESNOCANCEL);
601 if(i==IDYES){
602 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
603 i2=0;
604 i3++;
605 }
606 else if(i==IDNO){
607 i4+=GetNumberOfMenu(&pMenuInfo->pMenuInfo[i2]);
608 i2++;
609 }
610 else return 1;
611 }
612 else i2++;
613 i4++;
614 pMenuInfo->pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,0,pMenuInfo->pMenuInfo,(pMenuInfo->NumberOfMenu+1)*sizeof(MENU_INFO));
615 for(i=pMenuInfo->NumberOfMenu;i>i2;i--){
616 pMenuInfo->pMenuInfo[i]=pMenuInfo->pMenuInfo[i-1];
617 }
618 memset(&pMenuInfo->pMenuInfo[i2],0,sizeof(MENU_INFO));
619
620 sprintf(temporary,"caption text");
621 pMenuInfo->pMenuInfo[i2].caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
622 lstrcpy(pMenuInfo->pMenuInfo[i2].caption,temporary);
623
624 sprintf(temporary,"IDM_name");
625 pMenuInfo->pMenuInfo[i2].IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
626 lstrcpy(pMenuInfo->pMenuInfo[i2].IdName,temporary);
627
628 memset(temporary,' ',i3*4);
629 lstrcpy(temporary+i3*4,pMenuInfo->pMenuInfo[i2].caption);
630
631 pMenuInfo->NumberOfMenu++;
632
633 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_INSERTSTRING,i4,(long)temporary);
634 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,i4,0);
635 SendMessage(GetParent(MdiInfo[WndNum].MdiMenuInfo->hMenuEdit),WM_COMMAND,MAKELONG(0,LBN_SELCHANGE),(long)MdiInfo[WndNum].MdiMenuInfo->hList);
636 }
637 ProjectInfo.ModifyOfMaterial=1;
638 return 1;
639 case IDC_DELETEMENUITEM:
640 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
641 if(WndNum==-1) return 1;
642 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
643
644 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
645 if(i4==LB_ERR){
646 //"削除するメニュー アイテムを選択して下さい"
647 MessageBox(hOwner,STRING_MENUEDIT_MUSTSELECT_DELETE_MENUITEM,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
648 return 1;
649 }
650 i2=0;
651 i3=0;
652 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
653
654 i3=1;
655 if(pMenuInfo->pMenuInfo[i2].pMenuInfo){
656 if(pMenuInfo->pMenuInfo[i2].NumberOfMenu){
657 //"この操作を行うとポップアップされるメニュー アイテムも削除されます。"
658 if(MessageBox(hOwner,STRING_MENUEDIT_DELETECHECK,APPLICATION_NAME,MB_OKCANCEL)==IDCANCEL) return 1;
659 }
660 HeapMenuDataFree(pMenuInfo->pMenuInfo[i2].pMenuInfo,pMenuInfo->pMenuInfo[i2].NumberOfMenu,&i3);
661 HeapDefaultFree(pMenuInfo->pMenuInfo[i2].pMenuInfo);
662 }
663 else HeapDefaultFree(pMenuInfo->pMenuInfo[i2].IdName);
664
665 if(pMenuInfo->pMenuInfo[i2].type!=MFT_SEPARATOR)
666 HeapDefaultFree(pMenuInfo->pMenuInfo[i2].caption);
667
668 for(i=i2;i<pMenuInfo->NumberOfMenu-1;i++)
669 pMenuInfo->pMenuInfo[i]=pMenuInfo->pMenuInfo[i+1];
670
671 pMenuInfo->NumberOfMenu--;
672 pMenuInfo->pMenuInfo=(MENU_INFO *)HeapReAlloc(hHeap,0,pMenuInfo->pMenuInfo,pMenuInfo->NumberOfMenu*sizeof(MENU_INFO));
673
674 for(i=0;i<i3;i++)
675 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_DELETESTRING,i4,0);
676
677 i=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCOUNT,0,0)-1;
678 if(i){
679 if(i<i4) i4=i;
680 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,i4,0);
681 }
682
683 ProjectInfo.ModifyOfMaterial=1;
684 return 1;
685 case IDC_UP:
686 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
687 if(WndNum==-1) return 1;
688 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
689
690 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
691 if(i4==LB_ERR){
692 //"移動するメニュー アイテムを選択して下さい"
693 MessageBox(hOwner,STRING_MENUEDIT_MUSTSELECT_MOVE_MENUITEM,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
694 return 1;
695 }
696 i2=0;
697 i3=0;
698 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
699 if(i2==0) return 1;
700 i2--;
701
702 memcpy(&tempMenuInfo,&pMenuInfo->pMenuInfo[i2],sizeof(MENU_INFO));
703 memcpy(&pMenuInfo->pMenuInfo[i2],&pMenuInfo->pMenuInfo[i2+1],sizeof(MENU_INFO));
704 memcpy(&pMenuInfo->pMenuInfo[i2+1],&tempMenuInfo,sizeof(MENU_INFO));
705
706 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_RESETCONTENT,0,0);
707 SetMenuDataList(MdiInfo[WndNum].MdiMenuInfo->hList,&ProjectInfo.pMenuInfo[MenuInfoNum],0);
708 if(!pMenuInfo->pMenuInfo[i2].pMenuInfo)
709 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,i4-1,0);
710
711 ProjectInfo.ModifyOfMaterial=1;
712 return 1;
713 case IDC_DOWN:
714 WndNum=GetWndNum(GetParent(GetParent(hwnd)));
715 if(WndNum==-1) return 1;
716 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
717
718 i4=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
719 if(i4==LB_ERR){
720 //"移動するメニュー アイテムを選択して下さい"
721 MessageBox(hOwner,STRING_MENUEDIT_MUSTSELECT_MOVE_MENUITEM,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
722 return 1;
723 }
724 i2=0;
725 i3=0;
726 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i4,&i3);
727 if(pMenuInfo->NumberOfMenu<=i2+1) return 1;
728
729 memcpy(&tempMenuInfo,&pMenuInfo->pMenuInfo[i2],sizeof(MENU_INFO));
730 memcpy(&pMenuInfo->pMenuInfo[i2],&pMenuInfo->pMenuInfo[i2+1],sizeof(MENU_INFO));
731 memcpy(&pMenuInfo->pMenuInfo[i2+1],&tempMenuInfo,sizeof(MENU_INFO));
732
733 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_RESETCONTENT,0,0);
734 SetMenuDataList(MdiInfo[WndNum].MdiMenuInfo->hList,&ProjectInfo.pMenuInfo[MenuInfoNum],0);
735 if(!pMenuInfo->pMenuInfo[i2].pMenuInfo)
736 SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_SETCURSEL,i4+1,0);
737
738 ProjectInfo.ModifyOfMaterial=1;
739 return 1;
740 }
741 break;
742 }
743 return 0;
744}
745
746LRESULT CALLBACK MenuEditWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
747 extern HINSTANCE hInst;
748 extern MDIINFO MdiInfo[MAX_WNDNUM];
749 extern PROJECTINFO ProjectInfo;
750 int i;
751 RECT rect;
752 SCROLLINFO ScrollInfo;
753
754 switch(message){
755 case WM_MOUSEACTIVATE:
756 BringWindowToTop(GetParent(hwnd));
757 return 0;
758 case WM_VSCROLL:
759 ScrollInfo.cbSize=sizeof(SCROLLINFO);
760 ScrollInfo.fMask=SIF_POS|SIF_PAGE|SIF_RANGE;
761 GetScrollInfo(hwnd,SB_VERT,&ScrollInfo);
762 if(LOWORD(wParam)==SB_LINEUP) i=-20;
763 else if(LOWORD(wParam)==SB_LINEDOWN) i=20;
764 else if(LOWORD(wParam)==SB_PAGEUP) i=-(signed int)ScrollInfo.nPage;
765 else if(LOWORD(wParam)==SB_PAGEDOWN) i=ScrollInfo.nPage;
766 else if(LOWORD(wParam)==SB_THUMBTRACK) i=HIWORD(wParam)-ScrollInfo.nPos;
767 else i=0;
768 GetClientRect(hwnd,&rect);
769 i=max(-ScrollInfo.nPos,min(i,ScrollInfo.nMax-rect.bottom-ScrollInfo.nPos));
770 if(i!=0){
771 ScrollInfo.nPos+=i;
772 SetScrollInfo(hwnd,SB_VERT,&ScrollInfo,1);
773 ScrollWindow(hwnd,0,-i,NULL,NULL);
774 UpdateWindow(hwnd);
775 }
776 return 0;
777 case WM_SIZE:
778 i=GetWndNum(GetParent(hwnd));
779 if(i==-1) return 0; //ウィンドウが初期状態の場合
780 ScrollInfo.cbSize=sizeof(SCROLLINFO);
781 ScrollInfo.fMask=SIF_PAGE|SIF_RANGE|SIF_POS;
782 GetScrollInfo(hwnd,SB_VERT,&ScrollInfo);
783 GetClientRect(MdiInfo[i].MdiMenuInfo->hEdit_Dlg,&rect);
784 ScrollInfo.nMin=0;
785 ScrollInfo.nMax=rect.bottom;
786 ScrollInfo.nPage=HIWORD(lParam);
787 SetScrollInfo(hwnd,SB_VERT,&ScrollInfo,1);
788
789 i=ScrollInfo.nPos;
790 ScrollInfo.fMask=SIF_POS;
791 GetScrollInfo(hwnd,SB_VERT,&ScrollInfo);
792 if(i>ScrollInfo.nPos){
793 ScrollWindow(hwnd,0,i-ScrollInfo.nPos,NULL,NULL);
794 UpdateWindow(hwnd);
795 }
796 return 0;
797 }
798 return DefWindowProc(hwnd,message,wParam,lParam);
799}
800LRESULT CALLBACK MDIClientWindow_Menu(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
801 extern HWND hDocCombo;
802 extern MDIINFO MdiInfo[MAX_WNDNUM];
803 extern PROJECTINFO ProjectInfo;
804 int i,i2,i3,WndNum,MenuInfoNum;
805 MENU_INFO *pMenuInfo;
806
807 switch(message){
808 case WM_COMMAND:
809 WndNum=GetWndNum(hwnd);
810 if(WndNum==-1) return 0;
811 MenuInfoNum=GetMenuInfoNum(MdiInfo[WndNum].path);
812 if((HWND)lParam==MdiInfo[WndNum].MdiMenuInfo->hList&&HIWORD(wParam)==LBN_SELCHANGE){
813 i=SendMessage(MdiInfo[WndNum].MdiMenuInfo->hList,LB_GETCURSEL,0,0);
814 i2=0;
815 i3=0;
816 pMenuInfo=GetMenuInfoFromList(&ProjectInfo.pMenuInfo[MenuInfoNum],&i2,i,&i3);
817 pMenuInfo=&pMenuInfo->pMenuInfo[i2];
818
819 if(pMenuInfo->pMenuInfo){
820 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CAPTION,pMenuInfo->caption);
821 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDNAME,"");
822 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDSTATIC),0);
823 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_RENAME),1);
824 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_POPUP),1);
825 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_SEPARATOR),0);
826 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CHECKED),1);
827 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_DISABLED),1);
828 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_POPUP,BM_SETCHECK,BST_CHECKED,0);
829 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_SEPARATOR,BM_SETCHECK,BST_UNCHECKED,0);
830 }
831 else if(pMenuInfo->type==MFT_STRING){
832 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CAPTION,pMenuInfo->caption);
833 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDNAME,pMenuInfo->IdName);
834 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDSTATIC),1);
835 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CAPTIONSTATIC),1);
836 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_RENAME),1);
837 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_POPUP),1);
838 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_SEPARATOR),1);
839 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CHECKED),1);
840 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_DISABLED),1);
841 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_POPUP,BM_SETCHECK,BST_UNCHECKED,0);
842 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_SEPARATOR,BM_SETCHECK,BST_UNCHECKED,0);
843 }
844 else if(pMenuInfo->type==MFT_SEPARATOR){
845 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CAPTION,"");
846 SetDlgItemText(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDNAME,"");
847 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_IDSTATIC),0);
848 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CAPTIONSTATIC),0);
849 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_RENAME),0);
850 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_POPUP),0);
851 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_SEPARATOR),1);
852 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CHECKED),0);
853 EnableWindow(GetDlgItem(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_DISABLED),0);
854 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_POPUP,BM_SETCHECK,BST_UNCHECKED,0);
855 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_SEPARATOR,BM_SETCHECK,BST_CHECKED,0);
856 }
857
858 if(pMenuInfo->state&MFS_CHECKED) i2=BST_CHECKED;
859 else i2=BST_UNCHECKED;
860 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_CHECKED,BM_SETCHECK,i2,0);
861 if(pMenuInfo->state&MFS_DISABLED) i2=BST_CHECKED;
862 else i2=BST_UNCHECKED;
863 SendDlgItemMessage(MdiInfo[WndNum].MdiMenuInfo->hEdit_Dlg,IDC_DISABLED,BM_SETCHECK,i2,0);
864 }
865 return 0;
866 case WM_MDIACTIVATE:
867 if(!lParam) return 0;
868 i=GetWndNum((HWND)lParam);
869 if(i==-1) return 0; //ウィンドウが初期状態の場合
870
871 i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[i].title);
872 SendMessage(hDocCombo,CB_SETCURSEL,i,0);
873 SetStatusText(NULL);
874 ResetState_EditMenu();
875 return 0;
876 case WM_SIZE:
877 WndNum=GetWndNum(hwnd);
878 if(WndNum==-1) break;
879 MoveWindow(MdiInfo[WndNum].MdiMenuInfo->hMenuEdit,0,0,172,HIWORD(lParam),1);
880 MoveWindow(MdiInfo[WndNum].MdiMenuInfo->hList,172,0,LOWORD(lParam)-172,HIWORD(lParam),1);
881 break;
882 case WM_CLOSE:
883 CloseDocWindow(GetWndNum(hwnd));
884 pobj_nv->bMDIZoomed=IsZoomed(hwnd);
885 i=DefMDIChildProc(hwnd,message,wParam,lParam);
886
887 //メニュー状態を設定
888 ResetState_DocMenu();
889
890 return i;
891 }
892 return DefMDIChildProc(hwnd,message,wParam,lParam);
893}
Note: See TracBrowser for help on using the repository browser.