source: dev/trunk/ab5.0/abdev/ProjectEditor/RadProc.cpp@ 441

Last change on this file since 441 was 302, checked in by dai_9181, 17 years ago
File size: 75.5 KB
Line 
1
2#include "common.h"
3
4void NewRadWindow(int WndInfoNum){
5 extern HINSTANCE hInst,hResInst;
6 extern HWND hDocCombo;
7 extern PROJECTINFO ProjectInfo;
8 extern MDIINFO MdiInfo[MAX_WNDNUM];
9 int i,i2;
10 HWND hChild;
11 RECT rect;
12 MDICREATESTRUCT mdic;
13 WINDOW_INFO *pWindowInfo;
14
15 pWindowInfo=&ProjectInfo.pWindowInfo[WndInfoNum];
16
17 //すでに指定されたファイルが開かれている場合
18 hChild=GetWindow(hClient,GW_CHILD);
19 while(hChild){
20 i=GetWndNum(hChild);
21 if(MdiInfo[i].DocType==WNDTYPE_RAD){
22 if(lstrcmpi(MdiInfo[i].path,pWindowInfo->name)==0) break;
23 }
24 hChild=GetNextWindow(hChild,GW_HWNDNEXT);
25 }
26 if(hChild){
27 BringWindowToTop(hChild);
28 return;
29 }
30
31 mdic.szTitle=pWindowInfo->name;
32 mdic.szClass="MDIClientWindow_Rad";
33 mdic.hOwner=hInst;
34 mdic.x=CW_USEDEFAULT;
35 mdic.y=CW_USEDEFAULT;
36 mdic.cx=CW_USEDEFAULT;
37 mdic.cy=CW_USEDEFAULT;
38
39 hChild=GetWindow(hClient,GW_CHILD);
40 if(IsWindow(hChild)){
41 if(IsZoomed(hChild)) mdic.style=WS_MAXIMIZE|WS_CLIPCHILDREN;
42 else mdic.style=0;
43 }
44 else{
45 if(pobj_nv->bMDIZoomed) mdic.style=WS_MAXIMIZE|WS_CLIPCHILDREN;
46 else mdic.style=0;
47 }
48
49 mdic.lParam=0;
50 hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(long)&mdic); //ウィンドウ作成
51
52
53 //////////////////////
54 // 子ウィンドウを作成
55 //////////////////////
56
57 //ツールウィンドウを作成
58 HWND hTools;
59 hTools=CreateWindow("RadToolsWindow",NULL,
60 WS_CHILD|WS_VSCROLL|WS_VISIBLE|WS_CLIPCHILDREN,
61 0,0,0,0,
62 hChild,NULL,hInst,NULL);
63
64 //プロパティウィンドウを作成
65 HWND hProperty;
66 hProperty=CreateWindowEx(WS_EX_CLIENTEDGE,"RadPropertyWindow",NULL,
67 WS_CHILD|WS_VSCROLL|WS_VISIBLE|WS_CLIPCHILDREN,
68 0,0,0,0,
69 hChild,NULL,hInst,NULL);
70
71 //内部RADウィンドウを作成
72 HWND hRad;
73 hRad=CreateWindowEx(WS_EX_CLIENTEDGE,"RadWindow",NULL,
74 WS_CHILD|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE|WS_CLIPCHILDREN,
75 0,0,0,0,
76 hChild,NULL,hInst,NULL);
77
78 //サポートウィンドウを作成
79 HWND hSupport;
80 hSupport=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_SUPPORT),hChild,(DLGPROC)DlgRadSupport);
81
82 //ウィンドウのID登録
83 HDC hdc;
84 for(i=0;i<MAX_WNDNUM;i++){
85 if(MdiInfo[i].hwnd==0){
86 MdiInfo[i].hwnd=hChild;
87 MdiInfo[i].DocType=WNDTYPE_RAD;
88 MdiInfo[i].title=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pWindowInfo->name)+1);
89 lstrcpy(MdiInfo[i].title,pWindowInfo->name);
90 MdiInfo[i].path=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pWindowInfo->name)+1);
91 lstrcpy(MdiInfo[i].path,pWindowInfo->name);
92
93
94 ////////////////////////////
95 // MDIRADINFO構造体をセット
96 ////////////////////////////
97
98 MdiInfo[i].MdiRadInfo=(MDIRADINFO *)GlobalAlloc(GPTR,sizeof(MDIRADINFO));
99
100 MdiInfo[i].MdiRadInfo->hTools=hTools;
101 MdiInfo[i].MdiRadInfo->hProperty=hProperty;
102 MdiInfo[i].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),hProperty,(DLGPROC)RadProperty_WindowProc);
103
104 SCROLLINFO ScrollInfo;
105 ScrollInfo.cbSize=sizeof(SCROLLINFO);
106 ScrollInfo.fMask=SIF_POS;
107 ScrollInfo.nPos=0;
108 SetScrollInfo(MdiInfo[i].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1);
109
110 MdiInfo[i].MdiRadInfo->hRad=hRad;
111
112 MdiInfo[i].MdiRadInfo->hSupport=hSupport;
113
114 hdc=GetDC(hRad);
115 MdiInfo[i].MdiRadInfo->hBitmap=CreateCompatibleBitmap(hdc,ScreenX*2,ScreenY*2);
116 MdiInfo[i].MdiRadInfo->hMemDC=CreateCompatibleDC(hdc);
117 MdiInfo[i].MdiRadInfo->hOldBitmap=
118 (HBITMAP)SelectObject(MdiInfo[i].MdiRadInfo->hMemDC,MdiInfo[i].MdiRadInfo->hBitmap);
119 ReleaseDC(hRad,hdc);
120
121 for(i2=0;i2<MAX_RAD_SELITEM;i2++) MdiInfo[i].MdiRadInfo->SelectingItem[i2]=-1;
122 MdiInfo[i].MdiRadInfo->ButtonSelect=IDC_TOOL_MOUSE;
123
124 //変更情報を初期化
125 MdiInfo[i].MdiRadInfo->undo.NowPos=0;
126 memset(MdiInfo[i].MdiRadInfo->undo.Command,0,sizeof(int)*MAX_UNDONUM);
127
128
129 DrawRadWindow(i,pWindowInfo);
130
131 //サポートダイアログの内容をセット
132 SetSupportDlgData(i,WndInfoNum);
133
134 break;
135 }
136 }
137
138 ShowWindow(hSupport,SW_SHOW);
139
140 //ウィンドウ位置を初期化
141 GetClientRect(hChild,&rect);
142 ResizeToRadToolWindows(i,rect.right,rect.bottom);
143
144 i=SendMessage(hDocCombo,CB_ADDSTRING,0,(long)pWindowInfo->name); //Docコンボボックスに追加
145 SendMessage(hDocCombo,CB_SETCURSEL,i,0);
146
147 //タブに追加
148 pobj_MainTab->InsertItem( pWindowInfo->name, true );
149
150 //メニュー状態を設定
151 ResetState_DocMenu();
152
153 SetFocus(hRad);
154}
155
156int InsertDlgItem(int WndNum,int WndInfoNum,int ItemNum,POINT *pPos,SIZE *pSize,char *IdName,char *caption,DWORD style_or_WndNum,DWORD ExStyle,int Control,int ImageType,char *ImagePath,DWORD dwInsertType){
157 //dwInsertType
158 //0 … 元に戻す、やり直し
159 //1 … 通常の挿入
160 //2 … 貼り付け
161
162 extern HANDLE hHeap;
163 extern MDIINFO MdiInfo[MAX_WNDNUM];
164 extern PROJECTINFO ProjectInfo;
165 int i,i2,NewItemNum;
166 char temporary[MAX_PATH];
167 CHILDINFO *pChildInfo;
168
169 ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo,(ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows+1)*sizeof(WINDOW_INFO));
170 if(ItemNum==-1)
171 NewItemNum=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;
172 else{
173 for(i=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;i>ItemNum;i--)
174 ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i]=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i-1];
175 NewItemNum=ItemNum;
176 }
177 pChildInfo=&ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[NewItemNum];
178
179 //ID
180 if(ItemNum==-1){
181 for(i=lstrlen(IdName)-1;i>=0;i--){
182 if(!('0'<=IdName[i]&&IdName[i]<='9')) break;
183 }
184 i++;
185
186 if(IdName[i]!='\0'){
187 i2=atoi(IdName+i)+1;
188 if(dwInsertType==2) i2--;
189 IdName[i]=0;
190 }
191 else{
192 if(dwInsertType==2) i2=0;
193 else i2=1;
194 }
195
196 if(i2==0) lstrcpy(temporary,IdName);
197 else sprintf(temporary,"%s%d",IdName,i2);
198SearchStart:
199 for(i=0;i<ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;i++){
200 if(i!=NewItemNum){
201 if(lstrcmp(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].IdName,temporary)==0){
202 i2++;
203 sprintf(temporary,"%s%d",IdName,i2);
204 goto SearchStart;
205 }
206 }
207 }
208 }
209 else lstrcpy(temporary,IdName);
210 pChildInfo->IdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
211 lstrcpy(pChildInfo->IdName,temporary);
212
213 //位置
214 pChildInfo->pos=*pPos;
215 pChildInfo->size=*pSize;
216 //小さすぎる場合は、最小の大きさに調整
217 if(pChildInfo->size.cx<MIN_ITEM_X) pChildInfo->size.cx=MIN_ITEM_X;
218 if(pChildInfo->size.cy<MIN_ITEM_Y) pChildInfo->size.cy=MIN_ITEM_Y;
219
220 //テキスト
221 if(ItemNum==-1){
222 if(dwInsertType==1){
223 if(caption[0]) sprintf(temporary,"%s%d",caption,i2);
224 else temporary[0]=0;
225 }
226 else lstrcpy(temporary,caption);
227 }
228 else lstrcpy(temporary,caption);
229 pChildInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
230 lstrcpy(pChildInfo->caption,temporary);
231
232 //スタイル
233 pChildInfo->style=style_or_WndNum;
234
235 //拡張スタイル
236 pChildInfo->ExStyle=ExStyle;
237
238 //クラス名
239 pChildInfo->Control=Control;
240
241 if(Control==CT_IMAGEBOX){
242 //イメージ ボックスの場合
243 pChildInfo->ImageCtrlInfo.type=ImageType;
244 if(!ImagePath)
245 pChildInfo->ImageCtrlInfo.path=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
246 else{
247 pChildInfo->ImageCtrlInfo.path=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,lstrlen(ImagePath)+1);
248 lstrcpy(pChildInfo->ImageCtrlInfo.path,ImagePath);
249 }
250 }
251
252 //変更情報
253 if(dwInsertType!=0)
254 Rad_NoticeChanging(WndNum,RAD_UNDO_INSERTITEM,NewItemNum,(DWORD)pChildInfo);
255
256 ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows++;
257
258 DrawRadWindow(WndNum,&ProjectInfo.pWindowInfo[WndInfoNum]);
259 return NewItemNum;
260}
261void DeleteDlgItem(int WndNum,int WndInfoNum,int ItemNum,BOOL bNoticeChanging){
262 extern HANDLE hHeap;
263 extern MDIINFO MdiInfo[MAX_WNDNUM];
264 extern PROJECTINFO ProjectInfo;
265 int i;
266
267 //変更情報
268 if(bNoticeChanging)
269 Rad_NoticeChanging(WndNum,RAD_UNDO_DELETEITEM,ItemNum,(DWORD)&ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum]);
270
271 //子ウィンドウのメモリを解放
272 HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].IdName);
273 HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].caption);
274 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].Control==CT_IMAGEBOX){
275 //イメージ ボックスの場合
276 HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].ImageCtrlInfo.path);
277 }
278
279 ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows--;
280 for(i=ItemNum;i<ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;i++)
281 ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i]=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i+1];
282 if(ProjectInfo.NumberOfWindows==0) ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo,1);
283 else ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo,ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows*sizeof(CHILDINFO));
284
285 DrawRadWindow(WndNum,&ProjectInfo.pWindowInfo[WndInfoNum]);
286
287
288 //////////////////////////////
289 //プロパティウィンドウを設定
290 DestroyWindow(MdiInfo[WndNum].MdiRadInfo->hProp_Dlg);
291 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_WindowProc);
292
293 SCROLLINFO ScrollInfo;
294 ScrollInfo.cbSize=sizeof(SCROLLINFO);
295 ScrollInfo.fMask=SIF_POS;
296 ScrollInfo.nPos=0;
297 SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1);
298
299 RECT rect;
300 GetClientRect(MdiInfo[WndNum].MdiRadInfo->hProperty,&rect);
301 SendMessage(MdiInfo[WndNum].MdiRadInfo->hProperty,WM_SIZE,0,MAKELONG(rect.right,rect.bottom));
302}
303
304void CursorPos_GlobalToLocal(HWND hwnd,long *x,long *y){
305 SCROLLINFO VertScrollInfo,HorzScrollInfo;
306
307 VertScrollInfo.cbSize=sizeof(SCROLLINFO);
308 VertScrollInfo.fMask=SIF_RANGE|SIF_POS;
309 GetScrollInfo(hwnd,SB_VERT,&VertScrollInfo);
310 HorzScrollInfo.cbSize=sizeof(SCROLLINFO);
311 HorzScrollInfo.fMask=SIF_RANGE|SIF_POS;
312 GetScrollInfo(hwnd,SB_HORZ,&HorzScrollInfo);
313
314 *x-=HorzScrollInfo.nPos;
315 *y-=VertScrollInfo.nPos;
316}
317void CursorPos_LocalToGlobal(HWND hwnd,long *x,long *y){
318 SCROLLINFO VertScrollInfo,HorzScrollInfo;
319
320 VertScrollInfo.cbSize=sizeof(SCROLLINFO);
321 VertScrollInfo.fMask=SIF_RANGE|SIF_POS;
322 GetScrollInfo(hwnd,SB_VERT,&VertScrollInfo);
323 HorzScrollInfo.cbSize=sizeof(SCROLLINFO);
324 HorzScrollInfo.fMask=SIF_RANGE|SIF_POS;
325 GetScrollInfo(hwnd,SB_HORZ,&HorzScrollInfo);
326
327 *x+=HorzScrollInfo.nPos;
328 *y+=VertScrollInfo.nPos;
329}
330void DrawFrame(HWND hwnd,int WndNum,int WndInfoNum,RECT *NewRect,RECT *OldRect,BOOL bLA){
331 extern PROJECTINFO ProjectInfo;
332 extern MDIINFO MdiInfo[MAX_WNDNUM];
333 static int swLineStop;
334 int i,sw;
335 int x,y;
336 HDC hdc;
337 HPEN hPen,hOldPen;
338 HBRUSH hOldBrush;
339 RECT rect;
340
341 hdc=GetDC(hwnd);
342
343 sw=0;
344 if(pobj_nv->bLineAdjust&&bLA){
345 for(i=0;i<ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;i++){
346 if(i==MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]) continue;
347 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].Control !=
348 ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control) continue;
349
350 if(NewRect->left<OldRect->left){
351 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x
352 >
353 NewRect->left - MdiInfo[WndNum].MdiRadInfo->ClientPos.x
354 &&
355 ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x-10
356 <
357 NewRect->left - MdiInfo[WndNum].MdiRadInfo->ClientPos.x){
358
359 //左側をストップする
360 x=NewRect->right-NewRect->left;
361 NewRect->left=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x + MdiInfo[WndNum].MdiRadInfo->ClientPos.x;
362 NewRect->right=NewRect->left+x;
363
364 hPen=CreatePen(PS_SOLID,0,RGB(100,100,100));
365 hOldPen=(HPEN)SelectObject(hdc,hPen);
366 MoveToEx(hdc,NewRect->left,0,NULL);
367 LineTo(hdc,NewRect->left,ScreenX);
368 SelectObject(hdc,hOldPen);
369 DeleteObject(hPen);
370
371 swLineStop=1;
372 sw=1;
373 }
374 }
375 if(NewRect->top<OldRect->top){
376 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y
377 >
378 NewRect->top - MdiInfo[WndNum].MdiRadInfo->ClientPos.y
379 &&
380 ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y-10
381 <
382 NewRect->top - MdiInfo[WndNum].MdiRadInfo->ClientPos.y){
383
384 //左側をストップする
385 y=NewRect->bottom-NewRect->top;
386 NewRect->top=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y + MdiInfo[WndNum].MdiRadInfo->ClientPos.y;
387 NewRect->bottom=NewRect->top+y;
388
389 hPen=CreatePen(PS_SOLID,0,RGB(100,100,100));
390 hOldPen=(HPEN)SelectObject(hdc,hPen);
391 MoveToEx(hdc,0,NewRect->top,NULL);
392 LineTo(hdc,ScreenY,NewRect->top);
393 SelectObject(hdc,hOldPen);
394 DeleteObject(hPen);
395
396 swLineStop=1;
397 sw=1;
398 }
399 }
400 }
401 }
402
403 //以前の選択フレームを消去
404 RectNaturalFormat(OldRect,&rect);
405 x=rect.left;
406 y=rect.top;
407 CursorPos_GlobalToLocal(hwnd,&rect.left,&rect.top);
408 CursorPos_GlobalToLocal(hwnd,&rect.right,&rect.bottom);
409 if(swLineStop&&sw==0){
410 BitBlt(hdc,0,0,ScreenX*2,ScreenY*2,
411 MdiInfo[WndNum].MdiRadInfo->hMemDC,0,0,SRCCOPY);
412 swLineStop=0;
413 }
414 else{
415 BitBlt(hdc,rect.left-LEVER_THICK, rect.top-LEVER_THICK,
416 rect.right-rect.left+LEVER_THICK*2, rect.bottom-rect.top+LEVER_THICK*2,
417 MdiInfo[WndNum].MdiRadInfo->hMemDC,x-LEVER_THICK,y-LEVER_THICK,SRCCOPY);
418 }
419
420 //新しい選択フレームを描画
421 RectNaturalFormat(NewRect,&rect);
422 CursorPos_GlobalToLocal(hwnd,&rect.left,&rect.top);
423 CursorPos_GlobalToLocal(hwnd,&rect.right,&rect.bottom);
424
425 hPen=CreatePen(PS_DOT,0,RGB(0,0,0));
426 SetBkMode(hdc,TRANSPARENT);
427 hOldPen=(HPEN)SelectObject(hdc,hPen);
428 hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH));
429 Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom);
430 SelectObject(hdc,hOldBrush);
431 SelectObject(hdc,hOldPen);
432 DeleteObject(hPen);
433
434 ReleaseDC(hwnd,hdc);
435
436 *OldRect=*NewRect;
437}
438void GetSelectingRect(int WndNum,int WndInfoNum,int num,RECT *rect){
439 extern MDIINFO MdiInfo[MAX_WNDNUM];
440 extern PROJECTINFO ProjectInfo;
441 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]==SELECT_WINDOW){
442 //ウィンドウ軸を選択
443 rect->left=0;
444 rect->top=0;
445 rect->right=ProjectInfo.pWindowInfo[WndInfoNum].size.cx+(LEVER_THICK*2);
446 rect->bottom=ProjectInfo.pWindowInfo[WndInfoNum].size.cy+(LEVER_THICK*2);
447 }
448 else{
449 //子ウィンドウを選択
450 rect->left=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].pos.x-LEVER_THICK;
451 rect->top=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].pos.y-LEVER_THICK;
452 rect->right=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].size.cx+LEVER_THICK;
453 rect->bottom=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].size.cy+LEVER_THICK;
454 }
455}
456void DrawSelectingRect(HWND hwnd,int WndNum,int WndInfoNum,int ButtonSelect){
457 extern MDIINFO MdiInfo[MAX_WNDNUM];
458 extern RADINFO RadInfo;
459 extern PROJECTINFO ProjectInfo;
460 int i,i2,i3;
461 HDC hdc;
462 HPEN hPen,hOldPen;
463 HBRUSH hOldBrush;
464 COLORREF rgb;
465 RECT rect,tempRect;
466
467 hdc=GetDC(hwnd);
468 if(ButtonSelect==IDC_TOOL_MOUSE) rgb=RGB(255,60,30);
469 else if(ButtonSelect==NON_TOOL) rgb=RGB(100,100,100);
470 hPen=CreatePen(PS_SOLID,0,rgb);
471 SetBkMode(hdc,TRANSPARENT);
472 hOldPen=(HPEN)SelectObject(hdc,hPen);
473
474 i=0;
475 while(MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]!=-1||i==0){
476 GetSelectingRect(WndNum,WndInfoNum,i,&tempRect);
477 RectNaturalFormat(&tempRect,&rect);
478 CursorPos_GlobalToLocal(hwnd,&rect.left,&rect.top);
479 CursorPos_GlobalToLocal(hwnd,&rect.right,&rect.bottom);
480
481 //主線
482 hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH));
483 Rectangle(hdc,
484 rect.left+2, rect.top+2,
485 rect.right-2, rect.bottom-2);
486 SelectObject(hdc,hOldBrush);
487
488
489 hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(WHITE_BRUSH));
490
491 Rectangle(hdc,
492 rect.left,rect.top,
493 rect.left+5,rect.top+5);
494 Rectangle(hdc,
495 rect.left,rect.bottom-5,
496 rect.left+5,rect.bottom);
497 Rectangle(hdc,
498 rect.right-5,rect.top,
499 rect.right,rect.top+5);
500 Rectangle(hdc,
501 rect.right-5,rect.bottom-5,
502 rect.right,rect.bottom);
503
504 i2=(rect.right-rect.left)/2;
505 i3=(rect.bottom-rect.top)/2;
506 Rectangle(hdc,
507 rect.left+i2-2,rect.top,
508 rect.left+i2+3,rect.top+5);
509 Rectangle(hdc,
510 rect.left+i2-2,rect.bottom-5,
511 rect.left+i2+3,rect.bottom);
512 Rectangle(hdc,
513 rect.left,rect.top+i3-2,
514 rect.left+5,rect.top+i3+3);
515 Rectangle(hdc,
516 rect.right-5,rect.top+i3-2,
517 rect.right,rect.top+i3+3);
518
519 SelectObject(hdc,hOldBrush);
520
521 //移動時の選択フレームの消去用範囲
522 RadInfo.OldDraggingRect[i]=rect;
523
524 i++;
525 }
526
527 SelectObject(hdc,hOldPen);
528 DeleteObject(hPen);
529
530 ReleaseDC(hwnd,hdc);
531}
532void ChangePropertyWindow(int WndNum,int WndInfoNum){
533 extern MDIINFO MdiInfo[MAX_WNDNUM];
534 extern PROJECTINFO ProjectInfo;
535 RECT rect;
536 SCROLLINFO ScrollInfo;
537
538 DestroyWindow(MdiInfo[WndNum].MdiRadInfo->hProp_Dlg);
539 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){
540 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_WindowProc);
541
542 ScrollInfo.cbSize=sizeof(SCROLLINFO);
543 ScrollInfo.fMask=SIF_POS;
544 ScrollInfo.nPos=0;
545 SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1);
546
547 GetClientRect(MdiInfo[WndNum].MdiRadInfo->hProperty,&rect);
548 SendMessage(MdiInfo[WndNum].MdiRadInfo->hProperty,WM_SIZE,0,MAKELONG(rect.right,rect.bottom));
549 }
550 else{
551 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_BUTTON)
552 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_BUTTON),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ButtonProc);
553 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_CHECKBOX)
554 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_CHECKBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_CheckBoxProc);
555 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_COMBOBOX)
556 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_COMBOBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ComboBoxProc);
557 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_EDIT)
558 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_EDIT),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_EditProc);
559 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_GROUPBOX)
560 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_GROUPBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_GroupBoxProc);
561 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_HSCROLLBAR)
562 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_SCROLLBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ScrollBarProc);
563 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_IMAGEBOX)
564 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_IMAGEBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ImageBoxProc);
565 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_LISTBOX)
566 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_LISTBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ListBoxProc);
567 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_LISTVIEW)
568 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_LISTVIEW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ListViewProc);
569 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_PROGRESSBAR)
570 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_PROGRESSBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ProgressBarProc);
571 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_RADIOBUTTON)
572 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_RADIOBUTTON),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_RadioButtonProc);
573 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_STATIC)
574 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_STATIC),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_StaticProc);
575 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_TRACKBAR)
576 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_TRACKBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_TrackBarProc);
577 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_TREEVIEW)
578 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_TREEVIEW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_TreeViewProc);
579 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_UPDOWN)
580 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_UPDOWN),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_UpDownProc);
581 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_VSCROLLBAR)
582 MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_SCROLLBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ScrollBarProc);
583
584 ScrollInfo.cbSize=sizeof(SCROLLINFO);
585 ScrollInfo.fMask=SIF_POS;
586 ScrollInfo.nPos=0;
587 SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1);
588
589 GetClientRect(MdiInfo[WndNum].MdiRadInfo->hProperty,&rect);
590 SendMessage(MdiInfo[WndNum].MdiRadInfo->hProperty,WM_SIZE,0,MAKELONG(rect.right,rect.bottom));
591 }
592}
593int GetItemNumOnMouse(int WndNum,int WndInfoNum,int x,int y){
594 extern MDIINFO MdiInfo[MAX_WNDNUM];
595 extern PROJECTINFO ProjectInfo;
596 int i;
597
598 for(i=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows-1;i>=0;i--){
599 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].Control==CT_COMBOBOX&&
600 (ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].style&0x000F)!=CBS_SIMPLE){
601 //コンボ ボックスの場合は表示部分をターゲットに選択する(高さ20pixel)
602 if(x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x&&
603 x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx&&
604 y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y&&
605 y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+20){
606 break;
607 }
608 }
609 else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].Control==CT_GROUPBOX){
610 //グループ ボックスの場合は中央をあける
611 if((
612 x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x&&
613 x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx&&
614 y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y&&
615 y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy
616 )&&
617 (!(
618 x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+LEVER_THICK*2&&
619 x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx-LEVER_THICK*2&&
620 y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+LEVER_THICK*3&&
621 y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy-LEVER_THICK*2
622 ))
623 ){
624 break;
625 }
626 }
627 else if(x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x&&
628 x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx&&
629 y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y&&
630 y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy){
631 break;
632 }
633 }
634 return i;
635}
636void SelectItemNumOnMouse(int WndNum,int WndInfoNum,int x,int y){
637 //マウス座標をもとにコントロールアイテムを選択
638 extern MDIINFO MdiInfo[MAX_WNDNUM];
639 extern PROJECTINFO ProjectInfo;
640 int i;
641
642 for(i=1;i<MAX_RAD_SELITEM;i++) MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]=-1;
643 i=GetItemNumOnMouse(WndNum,WndInfoNum,x,y);
644
645 if(i==-1){
646 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){
647 MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]=SELECT_WINDOW;
648 ChangePropertyWindow(WndNum,WndInfoNum);
649 }
650 }
651 else{
652 MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]=i;
653 ChangePropertyWindow(WndNum,WndInfoNum);
654 }
655
656 SetStatusText(NULL);
657
658 //サポートダイアログの内容をセット
659 SetSupportDlgData(WndNum,WndInfoNum);
660}
661void SetItemNumOnFrame(int WndNum,int WndInfoNum,RECT *pRect){
662 extern PROJECTINFO ProjectInfo;
663 extern MDIINFO MdiInfo[MAX_WNDNUM];
664 int i,i2,sw;
665 RECT rect;
666
667 for(i=1;i<MAX_RAD_SELITEM;i++) MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]=-1;
668 RectNaturalFormat(pRect,&rect);
669 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW) sw=0;
670 else sw=1;
671 for(i=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows-1,i2=0;i>=0;i--){
672 if(rect.left <= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x&&
673 rect.top <= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y&&
674 rect.right >= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x&&
675 rect.bottom >= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y){
676 MdiInfo[WndNum].MdiRadInfo->SelectingItem[i2]=i;
677 i2++;
678 }
679 }
680 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW||
681 (MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW&&sw)){
682 ChangePropertyWindow(WndNum,WndInfoNum);
683 }
684}
685int GetStateOfDraggingFrame(int WndNum,int WndInfoNum,int x,int y){
686 extern PROJECTINFO ProjectInfo;
687 extern MDIINFO MdiInfo[MAX_WNDNUM];
688 int i;
689 RECT rect;
690
691 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[1]!=-1){
692 i=0;
693 while(MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]!=-1||i==0){
694 GetSelectingRect(WndNum,WndInfoNum,i,&rect);
695
696 if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&&
697 y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK){
698 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]].Control==CT_GROUPBOX){
699 //グループボックスの場合は中央をあける
700 if(!(x>=rect.left+LEVER_THICK*2&&x<=rect.right-LEVER_THICK*2&&
701 y>=rect.top+LEVER_THICK*3&&y<=rect.bottom-LEVER_THICK*2)){
702 return FRAME_INSIDE;
703 }
704 }
705 else return FRAME_INSIDE;
706 }
707 i++;
708 }
709 }
710 else{
711 GetSelectingRect(WndNum,WndInfoNum,0,&rect);
712
713 if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){
714 if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&&
715 y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK){
716 if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_GROUPBOX){
717 //グループ ボックスの場合は中央をあける
718 if(!(x>=rect.left+LEVER_THICK*3&&x<=rect.right-LEVER_THICK*3&&
719 y>=rect.top+LEVER_THICK*4&&y<=rect.bottom-LEVER_THICK*3)){
720 return FRAME_INSIDE;
721 }
722 }
723 else return FRAME_INSIDE;
724 }
725 else if(x>=rect.left&&x<=rect.left+LEVER_THICK&&
726 y>=rect.top&&y<=rect.top+LEVER_THICK) return FRAME_UPPER_LEFT;
727 else if(x>=rect.right-LEVER_THICK&&x<=rect.right&&
728 y>=rect.top&&y<=rect.top+LEVER_THICK) return FRAME_UPPER_RIGHT;
729 else if(x>=rect.left&&x<=rect.left+LEVER_THICK&&
730 y>=rect.bottom-LEVER_THICK&&y<=rect.bottom) return FRAME_LOWER_LEFT;
731 else if(x>=rect.left&&x<=rect.left+LEVER_THICK&&
732 y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK)return FRAME_LEFT;
733 else if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&&
734 y>=rect.top&&y<=rect.top+LEVER_THICK) return FRAME_UPPER;
735 }
736 if(x>=rect.right-LEVER_THICK&&x<=rect.right&&
737 y>=rect.bottom-LEVER_THICK&&y<=rect.bottom) return FRAME_LOWER_RIGHT;
738 else if(x>=rect.right-LEVER_THICK&&x<=rect.right&&
739 y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK) return FRAME_RIGHT;
740 else if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&&
741 y>=rect.bottom-LEVER_THICK&&y<=rect.bottom) return FRAME_LOWER;
742 }
743 return 0;
744}
745void ResetScrollbarOfRadEditor(int WndNum,int weight,int height){
746 extern PROJECTINFO ProjectInfo;
747 extern MDIINFO MdiInfo[MAX_WNDNUM];
748 int WndInfoNum;
749 SCROLLINFO ScrollInfo;
750 SIZE NeedSize;
751
752 WndInfoNum=GetWndInfoNum(MdiInfo[WndNum].path);
753
754 //必要な幅、高さを共に100ピクセル余裕を持たせる
755 NeedSize.cx=ProjectInfo.pWindowInfo[WndInfoNum].size.cx+(LEVER_THICK*2)+100;
756 NeedSize.cy=ProjectInfo.pWindowInfo[WndInfoNum].size.cy+(LEVER_THICK*2)+100;
757
758 ScrollInfo.cbSize=sizeof(SCROLLINFO);
759 ScrollInfo.fMask=SIF_PAGE|SIF_RANGE|SIF_POS|SIF_DISABLENOSCROLL;
760
761 //垂直スクロールバーの設定
762 GetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_VERT,&ScrollInfo);
763 ScrollInfo.nMin=0;
764 if(height>NeedSize.cy) ScrollInfo.nMax=0;
765 else{
766 ScrollInfo.nMax=NeedSize.cy;
767 ScrollInfo.nPage=height;
768 }
769 SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_VERT,&ScrollInfo,1);
770
771 //水平スクロールバーの設定
772 GetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_VERT,&ScrollInfo);
773 ScrollInfo.nMin=0;
774 if(weight>NeedSize.cx) ScrollInfo.nMax=0;
775 else{
776 ScrollInfo.nMax=NeedSize.cx;
777 ScrollInfo.nPage=weight;
778 }
779 SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_HORZ,&ScrollInfo,1);
780}
781LRESULT CALLBACK RadWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
782 extern MDIINFO MdiInfo[MAX_WNDNUM];
783 extern PROJECTINFO ProjectInfo;
784 extern RADINFO RadInfo;
785 int i,i2,i3,i4;
786 char temporary[MAX_PATH],temp2[MAX_PATH];
787 HWND hParent;
788 HDC hdc;
789 RECT rect;
790 POINT mouse,pos;
791 SIZE size;
792 SCROLLINFO ScrollInfo,si2;
793 PAINTSTRUCT ps;
794 POINTANDSIZE PointAndSize;
795
796 switch(message){
797 case WM_LBUTTONDOWN:
798 SetCapture(hwnd);
799
800 SetFocus(hwnd);
801 mouse.x=LOWORD(lParam);
802 mouse.y=HIWORD(lParam);
803 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y);
804
805 i=GetWndNum(GetParent(hwnd));
806 i2=GetWndInfoNum(MdiInfo[i].path);
807
808 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){
809 if(((wParam&MK_CONTROL)||(wParam&MK_SHIFT))&&
810 MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){
811
812 //Shiftキー、Ctrlキーによる複数選択
813 for(i3=0;;i3++){
814 if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1){
815 MdiInfo[i].MdiRadInfo->SelectingItem[i3]=GetItemNumOnMouse(i,i2,mouse.x,mouse.y);
816 InvalidateRect(hwnd,NULL,0);
817
818 //サポートダイアログの内容をセット
819 SetSupportDlgData(i,i2);
820 break;
821 }
822 }
823 }
824 else{
825 RadInfo.NowDragging=GetStateOfDraggingFrame(i,i2,mouse.x,mouse.y);
826 if(!RadInfo.NowDragging){
827 SelectItemNumOnMouse(i,i2,mouse.x,mouse.y);
828 InvalidateRect(hwnd,NULL,0);
829 RadInfo.NowDragging=GetStateOfDraggingFrame(i,i2,mouse.x,mouse.y);
830 }
831 if(RadInfo.NowDragging){
832 //アイテム選択中。サイズ、位置変更開始
833
834 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){
835 RadInfo.DraggingRect[0].left=LEVER_THICK;
836 RadInfo.DraggingRect[0].top=LEVER_THICK;
837 RadInfo.DraggingRect[0].right=ProjectInfo.pWindowInfo[i2].size.cx+LEVER_THICK;
838 RadInfo.DraggingRect[0].bottom=ProjectInfo.pWindowInfo[i2].size.cy+LEVER_THICK;
839 RadInfo.DragStartRect[0]=RadInfo.DraggingRect[0];
840 }
841 else{
842 i3=0;
843 while(MdiInfo[i].MdiRadInfo->SelectingItem[i3]!=-1){
844 RadInfo.DraggingRect[i3].left=MdiInfo[i].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x;
845 RadInfo.DraggingRect[i3].top=MdiInfo[i].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y;
846 RadInfo.DraggingRect[i3].right=MdiInfo[i].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size.cx;
847 RadInfo.DraggingRect[i3].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size.cy;
848 RadInfo.DragStartRect[i3]=RadInfo.DraggingRect[i3];
849 i3++;
850 }
851 }
852 }
853 else{
854 //範囲選択
855
856 RadInfo.NowDragging=SELECTING_FRAME;
857 RadInfo.OldDraggingRect[0].left=LEVER_THICK;
858 RadInfo.OldDraggingRect[0].top=LEVER_THICK;
859 RadInfo.OldDraggingRect[0].right=ProjectInfo.pWindowInfo[i2].size.cx+LEVER_THICK;
860 RadInfo.OldDraggingRect[0].bottom=ProjectInfo.pWindowInfo[i2].size.cy+LEVER_THICK;
861 }
862 RadInfo.DragStartPos.x=mouse.x;
863 RadInfo.DragStartPos.y=mouse.y;
864 }
865 SetCursorByState(RadInfo.NowDragging);
866 }
867 else{
868 RadInfo.DraggingRect[0].left=mouse.x;
869 RadInfo.DraggingRect[0].top=mouse.y;
870 RadInfo.NowDragging=ITEM_MAKING;
871 }
872 return 0;
873 case WM_LBUTTONUP:
874 ReleaseCapture();
875
876 SetFocus(hwnd);
877 mouse.x=(int)(short)LOWORD(lParam);
878 mouse.y=(int)(short)HIWORD(lParam);
879 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y);
880
881 hParent=GetParent(hwnd);
882 i=GetWndNum(hParent);
883 i2=GetWndInfoNum(MdiInfo[i].path);
884
885 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){
886 if(RadInfo.NowDragging){
887 if(RadInfo.DragStartPos.x==mouse.x&&RadInfo.DragStartPos.y==mouse.y){
888 RadInfo.NowDragging=0;
889 InvalidateRect(hwnd,NULL,0);
890 ResetState_EditMenu();
891 return 0;
892 }
893
894 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){
895 if(RadInfo.NowDragging==SELECTING_FRAME){
896 SetItemNumOnFrame(i,i2,&RadInfo.DraggingRect[0]);
897 InvalidateRect(hwnd,NULL,1);
898 }
899 else{
900 //ウィンドウ枠の調整完了
901 PointAndSize.size=ProjectInfo.pWindowInfo[i2].size;
902 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize);
903 ProjectInfo.pWindowInfo[i2].size.cx=RadInfo.DraggingRect[0].right-LEVER_THICK;
904 ProjectInfo.pWindowInfo[i2].size.cy=RadInfo.DraggingRect[0].bottom-LEVER_THICK;
905 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
906 InvalidateRect(hwnd,NULL,1);
907
908 GetClientRect(hwnd,&rect);
909 ResetScrollbarOfRadEditor(i,rect.right,rect.bottom);
910 }
911 }
912 else{
913 i3=0;
914 while(MdiInfo[i].MdiRadInfo->SelectingItem[i3]!=-1){
915 //アイテム枠の調整完了
916 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos;
917 PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size;
918 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize);
919 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x=RadInfo.DraggingRect[i3].left-MdiInfo[i].MdiRadInfo->ClientPos.x;
920 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y=RadInfo.DraggingRect[i3].top-MdiInfo[i].MdiRadInfo->ClientPos.y;
921 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size.cx=RadInfo.DraggingRect[i3].right-RadInfo.DraggingRect[i3].left;
922 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size.cy=RadInfo.DraggingRect[i3].bottom-RadInfo.DraggingRect[i3].top;
923 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
924 i3++;
925 }
926 }
927
928 SetStatusText(NULL);
929
930 //サポートダイアログの内容をセット
931 SetSupportDlgData(i,i2);
932 }
933 }
934 else if(RadInfo.NowDragging==ITEM_MAKING){
935 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_BUTTON){
936 //ボタン コントロール作成
937 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
938 RadInfo.DraggingRect[0].left-=44;
939 RadInfo.DraggingRect[0].right=mouse.x+44;
940 RadInfo.DraggingRect[0].top-=10;
941 RadInfo.DraggingRect[0].bottom=mouse.y+11;
942 }
943 else{
944 RadInfo.DraggingRect[0].right=mouse.x;
945 RadInfo.DraggingRect[0].bottom=mouse.y;
946 }
947 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
948 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
949 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
950 size.cx=rect.right-rect.left;
951 size.cy=rect.bottom-rect.top;
952 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"CommandButton","Button",WS_CHILD|WS_VISIBLE,0,CT_BUTTON,0,0,1);
953 }
954 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_CHECKBOX){
955 //チェック ボックス作成
956 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
957 RadInfo.DraggingRect[0].left-=33;
958 RadInfo.DraggingRect[0].right=mouse.x+34;
959 RadInfo.DraggingRect[0].top-=7;
960 RadInfo.DraggingRect[0].bottom=mouse.y+8;
961 }
962 else{
963 RadInfo.DraggingRect[0].right=mouse.x;
964 RadInfo.DraggingRect[0].bottom=mouse.y;
965 }
966 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
967 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
968 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
969 size.cx=rect.right-rect.left;
970 size.cy=rect.bottom-rect.top;
971 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"CheckBox","Check",WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX,0,CT_CHECKBOX,0,0,1);
972 }
973 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_COMBOBOX){
974 //コンボ ボックス作成
975 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
976 RadInfo.DraggingRect[0].left-=42;
977 RadInfo.DraggingRect[0].right=mouse.x+42;
978 RadInfo.DraggingRect[0].top-=42;
979 RadInfo.DraggingRect[0].bottom=mouse.y+42;
980 }
981 else{
982 RadInfo.DraggingRect[0].right=mouse.x;
983 RadInfo.DraggingRect[0].bottom=mouse.y;
984 }
985 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
986 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
987 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
988 size.cx=rect.right-rect.left;
989 size.cy=rect.bottom-rect.top;
990 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ComboBox","",WS_CHILD|WS_VISIBLE|CBS_DROPDOWN|CBS_SORT|WS_VSCROLL,0,CT_COMBOBOX,0,0,1);
991 }
992 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_EDIT){
993 //エディット コントロール作成
994 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
995 RadInfo.DraggingRect[0].left-=35;
996 RadInfo.DraggingRect[0].right=mouse.x+35;
997 RadInfo.DraggingRect[0].top-=10;
998 RadInfo.DraggingRect[0].bottom=mouse.y+11;
999 }
1000 else{
1001 RadInfo.DraggingRect[0].right=mouse.x;
1002 RadInfo.DraggingRect[0].bottom=mouse.y;
1003 }
1004 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1005 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1006 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1007 size.cx=rect.right-rect.left;
1008 size.cy=rect.bottom-rect.top;
1009 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"EditBox","",WS_CHILD|WS_VISIBLE,WS_EX_CLIENTEDGE,CT_EDIT,0,0,1);
1010 }
1011 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_GROUPBOX){
1012 //グループ ボックス作成
1013 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1014 RadInfo.DraggingRect[0].left-=42;
1015 RadInfo.DraggingRect[0].right=mouse.x+42;
1016 RadInfo.DraggingRect[0].top-=30;
1017 RadInfo.DraggingRect[0].bottom=mouse.y+30;
1018 }
1019 else{
1020 RadInfo.DraggingRect[0].right=mouse.x;
1021 RadInfo.DraggingRect[0].bottom=mouse.y;
1022 }
1023 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1024 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1025 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1026 size.cx=rect.right-rect.left;
1027 size.cy=rect.bottom-rect.top;
1028 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"GroupBox","Group",WS_CHILD|WS_VISIBLE|BS_GROUPBOX,0,CT_GROUPBOX,0,0,1);
1029 }
1030 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_HSCROLLBAR){
1031 //水平スクロールバー作成
1032 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1033 RadInfo.DraggingRect[0].left-=35;
1034 RadInfo.DraggingRect[0].right=mouse.x+35;
1035 RadInfo.DraggingRect[0].top-=8;
1036 RadInfo.DraggingRect[0].bottom=mouse.y+9;
1037 }
1038 else{
1039 RadInfo.DraggingRect[0].right=mouse.x;
1040 RadInfo.DraggingRect[0].bottom=mouse.y;
1041 }
1042 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1043 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1044 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1045 size.cx=rect.right-rect.left;
1046 size.cy=rect.bottom-rect.top;
1047 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"HScrollBar","",WS_CHILD|WS_VISIBLE|SBS_HORZ,0,CT_HSCROLLBAR,0,0,1);
1048 }
1049 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_IMAGEBOX){
1050 //イメージ ボックス作成
1051 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1052 RadInfo.DraggingRect[0].left-=16;
1053 RadInfo.DraggingRect[0].right=mouse.x+16;
1054 RadInfo.DraggingRect[0].top-=16;
1055 RadInfo.DraggingRect[0].bottom=mouse.y+16;
1056 }
1057 else{
1058 RadInfo.DraggingRect[0].right=mouse.x;
1059 RadInfo.DraggingRect[0].bottom=mouse.y;
1060 }
1061 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1062 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1063 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1064 size.cx=rect.right-rect.left;
1065 size.cy=rect.bottom-rect.top;
1066 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ImageBox","",WS_CHILD|WS_VISIBLE|SS_BLACKFRAME,0,CT_IMAGEBOX,IMGTYPE_FILE,0,1);
1067 }
1068 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_LISTBOX){
1069 //リスト ボックス作成
1070 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1071 RadInfo.DraggingRect[0].left-=42;
1072 RadInfo.DraggingRect[0].right=mouse.x+42;
1073 RadInfo.DraggingRect[0].top-=30;
1074 RadInfo.DraggingRect[0].bottom=mouse.y+30;
1075 }
1076 else{
1077 RadInfo.DraggingRect[0].right=mouse.x;
1078 RadInfo.DraggingRect[0].bottom=mouse.y;
1079 }
1080 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1081 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1082 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1083 size.cx=rect.right-rect.left;
1084 size.cy=rect.bottom-rect.top;
1085 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ListBox","",WS_CHILD|WS_VISIBLE|WS_VSCROLL|LBS_SORT|LBS_NOTIFY,WS_EX_CLIENTEDGE,CT_LISTBOX,0,0,1);
1086 }
1087 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_LISTVIEW){
1088 //リスト ビュー作成
1089 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1090 RadInfo.DraggingRect[0].left-=52;
1091 RadInfo.DraggingRect[0].right=mouse.x+53;
1092 RadInfo.DraggingRect[0].top-=37;
1093 RadInfo.DraggingRect[0].bottom=mouse.y+38;
1094 }
1095 else{
1096 RadInfo.DraggingRect[0].right=mouse.x;
1097 RadInfo.DraggingRect[0].bottom=mouse.y;
1098 }
1099 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1100 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1101 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1102 size.cx=rect.right-rect.left;
1103 size.cy=rect.bottom-rect.top;
1104 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ListView","",WS_CHILD|WS_VISIBLE,WS_EX_CLIENTEDGE,CT_LISTVIEW,0,0,1);
1105 }
1106 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_PROGRESSBAR){
1107 //プロバレス バー作成
1108 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1109 RadInfo.DraggingRect[0].left-=70;
1110 RadInfo.DraggingRect[0].right=mouse.x+70;
1111 RadInfo.DraggingRect[0].top-=10;
1112 RadInfo.DraggingRect[0].bottom=mouse.y+11;
1113 }
1114 else{
1115 RadInfo.DraggingRect[0].right=mouse.x;
1116 RadInfo.DraggingRect[0].bottom=mouse.y;
1117 }
1118 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1119 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1120 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1121 size.cx=rect.right-rect.left;
1122 size.cy=rect.bottom-rect.top;
1123 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ProgressBar","",WS_CHILD|WS_VISIBLE,WS_EX_STATICEDGE,CT_PROGRESSBAR,0,0,1);
1124 }
1125 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_RADIOBUTTON){
1126 //ラジオ ボタン作成
1127 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1128 RadInfo.DraggingRect[0].left-=31;
1129 RadInfo.DraggingRect[0].right=mouse.x+32;
1130 RadInfo.DraggingRect[0].top-=7;
1131 RadInfo.DraggingRect[0].bottom=mouse.y+8;
1132 }
1133 else{
1134 RadInfo.DraggingRect[0].right=mouse.x;
1135 RadInfo.DraggingRect[0].bottom=mouse.y;
1136 }
1137 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1138 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1139 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1140 size.cx=rect.right-rect.left;
1141 size.cy=rect.bottom-rect.top;
1142 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"RadioButton","radio",WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON,0,CT_RADIOBUTTON,0,0,1);
1143 }
1144 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_STATIC){
1145 //スタティック コントロール作成
1146 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1147 RadInfo.DraggingRect[0].left-=25;
1148 RadInfo.DraggingRect[0].right=mouse.x+25;
1149 RadInfo.DraggingRect[0].top-=6;
1150 RadInfo.DraggingRect[0].bottom=mouse.y+6;
1151 }
1152 else{
1153 RadInfo.DraggingRect[0].right=mouse.x;
1154 RadInfo.DraggingRect[0].bottom=mouse.y;
1155 }
1156 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1157 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1158 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1159 size.cx=rect.right-rect.left;
1160 size.cy=rect.bottom-rect.top;
1161 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"Static","Text",WS_CHILD|WS_VISIBLE,0,CT_STATIC,0,0,1);
1162 }
1163 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_TRACKBAR){
1164 //トラック バー作成
1165 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1166 RadInfo.DraggingRect[0].left-=87;
1167 RadInfo.DraggingRect[0].right=mouse.x+88;
1168 RadInfo.DraggingRect[0].top-=11;
1169 RadInfo.DraggingRect[0].bottom=mouse.y+12;
1170 }
1171 else{
1172 RadInfo.DraggingRect[0].right=mouse.x;
1173 RadInfo.DraggingRect[0].bottom=mouse.y;
1174 }
1175 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1176 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1177 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1178 size.cx=rect.right-rect.left;
1179 size.cy=rect.bottom-rect.top;
1180 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"TrackBar","",WS_CHILD|WS_VISIBLE|TBS_BOTH|TBS_NOTICKS,0,CT_TRACKBAR,0,0,1);
1181 }
1182 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_TREEVIEW){
1183 //ツリー ビュー作成
1184 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1185 RadInfo.DraggingRect[0].left-=52;
1186 RadInfo.DraggingRect[0].right=mouse.x+53;
1187 RadInfo.DraggingRect[0].top-=37;
1188 RadInfo.DraggingRect[0].bottom=mouse.y+38;
1189 }
1190 else{
1191 RadInfo.DraggingRect[0].right=mouse.x;
1192 RadInfo.DraggingRect[0].bottom=mouse.y;
1193 }
1194 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1195 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1196 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1197 size.cx=rect.right-rect.left;
1198 size.cy=rect.bottom-rect.top;
1199 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"TreeView","",WS_CHILD|WS_VISIBLE,WS_EX_CLIENTEDGE,CT_TREEVIEW,0,0,1);
1200 }
1201 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_UPDOWN){
1202 //アップ ダウン コントロール作成
1203 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1204 RadInfo.DraggingRect[0].left-=8;
1205 RadInfo.DraggingRect[0].right=mouse.x+8;
1206 RadInfo.DraggingRect[0].top-=10;
1207 RadInfo.DraggingRect[0].bottom=mouse.y+11;
1208 }
1209 else{
1210 RadInfo.DraggingRect[0].right=mouse.x;
1211 RadInfo.DraggingRect[0].bottom=mouse.y;
1212 }
1213 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1214 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1215 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1216 size.cx=rect.right-rect.left;
1217 size.cy=rect.bottom-rect.top;
1218 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"UpDown","",WS_CHILD|WS_VISIBLE,0,CT_UPDOWN,0,0,1);
1219 }
1220 else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_VSCROLLBAR){
1221 //垂直スクロールバー作成
1222 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){
1223 RadInfo.DraggingRect[0].left-=9;
1224 RadInfo.DraggingRect[0].right=mouse.x+9;
1225 RadInfo.DraggingRect[0].top-=30;
1226 RadInfo.DraggingRect[0].bottom=mouse.y+30;
1227 }
1228 else{
1229 RadInfo.DraggingRect[0].right=mouse.x;
1230 RadInfo.DraggingRect[0].bottom=mouse.y;
1231 }
1232 RectNaturalFormat(&RadInfo.DraggingRect[0],&rect);
1233 pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x;
1234 pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y;
1235 size.cx=rect.right-rect.left;
1236 size.cy=rect.bottom-rect.top;
1237 MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"VScrollBar","",WS_CHILD|WS_VISIBLE|SBS_VERT,0,CT_VSCROLLBAR,0,0,1);
1238 }
1239 SendMessage(GetWindow(MdiInfo[i].MdiRadInfo->hTools,GW_CHILD),WM_COMMAND,IDC_TOOL_MOUSE,0);
1240 SendMessage(GetWindow(GetWindow(MdiInfo[i].MdiRadInfo->hTools,GW_CHILD),GW_CHILD),TB_CHECKBUTTON,IDC_TOOL_MOUSE,TRUE);
1241 ChangePropertyWindow(i,i2);
1242
1243 //複数選択を解除
1244 MdiInfo[i].MdiRadInfo->SelectingItem[1]=-1;
1245 }
1246
1247 RadInfo.NowDragging=0;
1248
1249 ResetState_EditMenu();
1250 return 0;
1251 case WM_MOUSEMOVE:
1252 mouse.x=(int)(short)LOWORD(lParam);
1253 mouse.y=(int)(short)HIWORD(lParam);
1254 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y);
1255
1256 hParent=GetParent(hwnd);
1257 i=GetWndNum(hParent);
1258 i2=GetWndInfoNum(MdiInfo[i].path);
1259
1260 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){
1261 if(wParam&MK_LBUTTON&&RadInfo.NowDragging){
1262 ////////////////////////////////////////////////
1263 // ドラッグ中の場合(コントロールのサイズ変更)
1264
1265 if(RadInfo.NowDragging==FRAME_UPPER_LEFT){
1266 if(RadInfo.DraggingRect[0].right-MIN_ITEM_X<=(mouse.x+LEVER_THICK))
1267 RadInfo.DraggingRect[0].left=RadInfo.DraggingRect[0].right-MIN_ITEM_X;
1268 else if(mouse.x+LEVER_THICK<MdiInfo[i].MdiRadInfo->ClientPos.x)
1269 RadInfo.DraggingRect[0].left=MdiInfo[i].MdiRadInfo->ClientPos.x;
1270 else RadInfo.DraggingRect[0].left=mouse.x+LEVER_THICK;
1271
1272 if(RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y<=(mouse.y+LEVER_THICK))
1273 RadInfo.DraggingRect[0].top=RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y;
1274 else if(mouse.y+LEVER_THICK<MdiInfo[i].MdiRadInfo->ClientPos.y)
1275 RadInfo.DraggingRect[0].top=MdiInfo[i].MdiRadInfo->ClientPos.y;
1276 else RadInfo.DraggingRect[0].top=mouse.y+LEVER_THICK;
1277 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1278 }
1279 else if(RadInfo.NowDragging==FRAME_UPPER_RIGHT){
1280 if(mouse.x-LEVER_THICK-MIN_ITEM_X<=RadInfo.DraggingRect[0].left)
1281 RadInfo.DraggingRect[0].right=RadInfo.DraggingRect[0].left+MIN_ITEM_X;
1282 else if(mouse.x>MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx)
1283 RadInfo.DraggingRect[0].right=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx;
1284 else RadInfo.DraggingRect[0].right=mouse.x-LEVER_THICK;
1285
1286 if(RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y<=(mouse.y+LEVER_THICK)) RadInfo.DraggingRect[0].top=RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y;
1287 else if(mouse.y+LEVER_THICK<MdiInfo[i].MdiRadInfo->ClientPos.y)
1288 RadInfo.DraggingRect[0].top=MdiInfo[i].MdiRadInfo->ClientPos.y;
1289 else RadInfo.DraggingRect[0].top=mouse.y+LEVER_THICK;
1290 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1291 }
1292 else if(RadInfo.NowDragging==FRAME_LOWER_LEFT){
1293 if(RadInfo.DraggingRect[0].right-MIN_ITEM_X<=(mouse.x+LEVER_THICK))
1294 RadInfo.DraggingRect[0].left=RadInfo.DraggingRect[0].right-MIN_ITEM_X;
1295 else if(mouse.x+LEVER_THICK<MdiInfo[i].MdiRadInfo->ClientPos.x)
1296 RadInfo.DraggingRect[0].left=MdiInfo[i].MdiRadInfo->ClientPos.x;
1297 else RadInfo.DraggingRect[0].left=mouse.x+LEVER_THICK;
1298
1299 if(mouse.y-LEVER_THICK-MIN_ITEM_Y<=RadInfo.DraggingRect[0].top)
1300 RadInfo.DraggingRect[0].bottom=RadInfo.DraggingRect[0].top+MIN_ITEM_Y;
1301 else if(mouse.y>MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy)
1302 RadInfo.DraggingRect[0].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy;
1303 else RadInfo.DraggingRect[0].bottom=mouse.y-LEVER_THICK;
1304 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1305 }
1306 else if(RadInfo.NowDragging==FRAME_LOWER_RIGHT){
1307 if(mouse.x-LEVER_THICK-MIN_ITEM_X<=RadInfo.DraggingRect[0].left)
1308 RadInfo.DraggingRect[0].right=RadInfo.DraggingRect[0].left+MIN_ITEM_X;
1309 else if((mouse.x>MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW)
1310 RadInfo.DraggingRect[0].right=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx;
1311 else RadInfo.DraggingRect[0].right=mouse.x-LEVER_THICK;
1312
1313 if(mouse.y-LEVER_THICK-MIN_ITEM_Y<=RadInfo.DraggingRect[0].top)
1314 RadInfo.DraggingRect[0].bottom=RadInfo.DraggingRect[0].top+MIN_ITEM_Y;
1315 else if((mouse.y>MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW)
1316 RadInfo.DraggingRect[0].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy;
1317 else RadInfo.DraggingRect[0].bottom=mouse.y-LEVER_THICK;
1318 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1319 }
1320 else if(RadInfo.NowDragging==FRAME_LEFT){
1321 if(RadInfo.DraggingRect[0].right-MIN_ITEM_X<=(mouse.x+LEVER_THICK))
1322 RadInfo.DraggingRect[0].left=RadInfo.DraggingRect[0].right-MIN_ITEM_X;
1323 else if(mouse.x+LEVER_THICK<MdiInfo[i].MdiRadInfo->ClientPos.x)
1324 RadInfo.DraggingRect[0].left=MdiInfo[i].MdiRadInfo->ClientPos.x;
1325 else RadInfo.DraggingRect[0].left=mouse.x+LEVER_THICK;
1326 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1327 }
1328 else if(RadInfo.NowDragging==FRAME_RIGHT){
1329 if(mouse.x-LEVER_THICK-MIN_ITEM_X<=RadInfo.DraggingRect[0].left)
1330 RadInfo.DraggingRect[0].right=RadInfo.DraggingRect[0].left+MIN_ITEM_X;
1331 else if((mouse.x>MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW)
1332 RadInfo.DraggingRect[0].right=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx;
1333 else RadInfo.DraggingRect[0].right=mouse.x-LEVER_THICK;
1334 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1335 }
1336 else if(RadInfo.NowDragging==FRAME_UPPER){
1337 if(RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y<=(mouse.y+LEVER_THICK))
1338 RadInfo.DraggingRect[0].top=RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y;
1339 else if(mouse.y+LEVER_THICK<MdiInfo[i].MdiRadInfo->ClientPos.y)
1340 RadInfo.DraggingRect[0].top=MdiInfo[i].MdiRadInfo->ClientPos.y;
1341 else RadInfo.DraggingRect[0].top=mouse.y+LEVER_THICK;
1342 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1343 }
1344 else if(RadInfo.NowDragging==FRAME_LOWER){
1345 if(mouse.y-LEVER_THICK-MIN_ITEM_Y<=RadInfo.DraggingRect[0].top)
1346 RadInfo.DraggingRect[0].bottom=RadInfo.DraggingRect[0].top+MIN_ITEM_Y;
1347 else if((mouse.y>MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW)
1348 RadInfo.DraggingRect[0].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy;
1349 else RadInfo.DraggingRect[0].bottom=mouse.y-LEVER_THICK;
1350 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1351 }
1352 else if(RadInfo.NowDragging==FRAME_INSIDE){
1353 i3=0;
1354 while(MdiInfo[i].MdiRadInfo->SelectingItem[i3]!=-1){
1355 i4=RadInfo.DragStartRect[i3].left+mouse.x-RadInfo.DragStartPos.x;
1356
1357 if(i4>MdiInfo[i].MdiRadInfo->ClientPos.x){
1358 i4=RadInfo.DragStartRect[i3].right+mouse.x-RadInfo.DragStartPos.x;
1359 if(i4<MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx) i4=0;
1360 else i4-=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx;
1361 }
1362 else i4-=MdiInfo[i].MdiRadInfo->ClientPos.x;
1363 //i4は枠外に出たときのポインタと壁にあたったコントロールとの差
1364 RadInfo.DraggingRect[i3].left=RadInfo.DragStartRect[i3].left+mouse.x-RadInfo.DragStartPos.x-i4;
1365 RadInfo.DraggingRect[i3].right=RadInfo.DragStartRect[i3].right+mouse.x-RadInfo.DragStartPos.x-i4;
1366
1367 i4=RadInfo.DragStartRect[i3].top+mouse.y-RadInfo.DragStartPos.y;
1368 if(i4>MdiInfo[i].MdiRadInfo->ClientPos.y){
1369 i4=RadInfo.DragStartRect[i3].bottom+mouse.y-RadInfo.DragStartPos.y;
1370 if(i4<MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy) i4=0;
1371 else i4-=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy;
1372 }
1373 else i4-=MdiInfo[i].MdiRadInfo->ClientPos.y;
1374 RadInfo.DraggingRect[i3].top=RadInfo.DragStartRect[i3].top+mouse.y-RadInfo.DragStartPos.y-i4;
1375 RadInfo.DraggingRect[i3].bottom=RadInfo.DragStartRect[i3].bottom+mouse.y-RadInfo.DragStartPos.y-i4;
1376
1377 if(MdiInfo[i].MdiRadInfo->SelectingItem[1]==-1) i4=1;
1378 else i4=0;
1379 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[i3],&RadInfo.OldDraggingRect[i3],i4);
1380 i3++;
1381 }
1382 }
1383 else if(RadInfo.NowDragging==SELECTING_FRAME){
1384 RadInfo.DraggingRect[0].left=RadInfo.DragStartPos.x;
1385 RadInfo.DraggingRect[0].top=RadInfo.DragStartPos.y;
1386 RadInfo.DraggingRect[0].right=mouse.x;
1387 RadInfo.DraggingRect[0].bottom=mouse.y;
1388 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1389 }
1390 SetCursorByState(RadInfo.NowDragging);
1391
1392 SetStatusText(NULL);
1393
1394 //サポートダイアログの内容をセット
1395 SetSupportDlgData(i,i2);
1396 }
1397 else{
1398 //ドラッグ中でないとき
1399 SetCursorByState(GetStateOfDraggingFrame(i,i2,mouse.x,mouse.y));
1400 }
1401 }
1402 else{
1403 //アイテム(子ウィンドウ作成中)
1404 if(wParam&MK_LBUTTON&&RadInfo.NowDragging==ITEM_MAKING){
1405 //ドラッグ中の場合
1406
1407 RadInfo.DraggingRect[0].right=mouse.x;
1408 RadInfo.DraggingRect[0].bottom=mouse.y;
1409 DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0);
1410 }
1411 }
1412 return 0;
1413 case WM_LBUTTONDBLCLK:
1414 mouse.x=LOWORD(lParam);
1415 mouse.y=HIWORD(lParam);
1416 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y);
1417
1418 hParent=GetParent(hwnd);
1419 i=GetWndNum(hParent);
1420 i2=GetWndInfoNum(MdiInfo[i].path);
1421 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){
1422 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){
1423 temp2[0]=0;
1424 if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_BUTTON||
1425 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_CHECKBOX||
1426 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_IMAGEBOX||
1427 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_RADIOBUTTON||
1428 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_STATIC){
1429 sprintf(temporary,"%s_%s_Click",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName);
1430 }
1431 else if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_COMBOBOX)
1432 sprintf(temporary,"%s_%s_EditChange",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName);
1433 else if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_EDIT)
1434 sprintf(temporary,"%s_%s_Change",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName);
1435 else if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_LISTBOX)
1436 sprintf(temporary,"%s_%s_SelChange",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName);
1437 else temporary[0]=0;
1438 if(temporary[0]) SelectProcedureOfMessageCall(i2,temporary,temp2);
1439 }
1440 }
1441 return 0;
1442 case WM_KEYDOWN:
1443 hParent=GetParent(hwnd);
1444 i=GetWndNum(hParent);
1445 i2=GetWndInfoNum(MdiInfo[i].path);
1446 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){
1447 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){
1448 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pos;
1449 PointAndSize.size=ProjectInfo.pWindowInfo[i2].size;
1450 if(GetKeyState(VK_SHIFT)&0x8000){
1451 if(wParam==VK_RIGHT||wParam==VK_LEFT||wParam==VK_DOWN||wParam==VK_UP)
1452 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize);
1453
1454 if(wParam==VK_RIGHT)
1455 ProjectInfo.pWindowInfo[i2].size.cx++;
1456 else if(wParam==VK_LEFT)
1457 ProjectInfo.pWindowInfo[i2].size.cx--;
1458 else if(wParam==VK_DOWN)
1459 ProjectInfo.pWindowInfo[i2].size.cy++;
1460 else if(wParam==VK_UP)
1461 ProjectInfo.pWindowInfo[i2].size.cy--;
1462
1463 if(wParam==VK_RIGHT||wParam==VK_LEFT||wParam==VK_DOWN||wParam==VK_UP){
1464 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
1465
1466 SetStatusText(NULL);
1467
1468 //サポートダイアログの内容をセット
1469 SetSupportDlgData(i,i2);
1470 }
1471 }
1472 }
1473 else{
1474 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].pos;
1475 PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size;
1476 if(wParam==VK_RIGHT){
1477 if(GetKeyState(VK_SHIFT)&0x8000){
1478 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize);
1479 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cx++;
1480 }
1481 else{
1482 for(i3=0;;i3++){
1483 if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break;
1484 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos;
1485 PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size;
1486 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize);
1487
1488 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x++;
1489 }
1490 }
1491 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
1492 SetStatusText(NULL);
1493
1494 //サポートダイアログの内容をセット
1495 SetSupportDlgData(i,i2);
1496 }
1497 else if(wParam==VK_LEFT){
1498 if(GetKeyState(VK_SHIFT)&0x8000){
1499 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize);
1500 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cx--;
1501 }
1502 else{
1503 for(i3=0;;i3++){
1504 if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break;
1505 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos;
1506 PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size;
1507 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize);
1508
1509 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x--;
1510 }
1511 }
1512 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
1513 SetStatusText(NULL);
1514
1515 //サポートダイアログの内容をセット
1516 SetSupportDlgData(i,i2);
1517 }
1518 else if(wParam==VK_UP){
1519 if(GetKeyState(VK_SHIFT)&0x8000){
1520 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize);
1521 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cy--;
1522 }
1523 else{
1524 for(i3=0;;i3++){
1525 if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break;
1526 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos;
1527 PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size;
1528 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize);
1529
1530 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y--;
1531 }
1532 }
1533 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
1534 SetStatusText(NULL);
1535
1536 //サポートダイアログの内容をセット
1537 SetSupportDlgData(i,i2);
1538 }
1539 else if(wParam==VK_DOWN){
1540 if(GetKeyState(VK_SHIFT)&0x8000){
1541 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize);
1542 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cy++;
1543 }
1544 else{
1545 for(i3=0;;i3++){
1546 if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break;
1547 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos;
1548 PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size;
1549 Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize);
1550
1551 ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y++;
1552 }
1553 }
1554 DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]);
1555 SetStatusText(NULL);
1556
1557 //サポートダイアログの内容をセット
1558 SetSupportDlgData(i,i2);
1559 }
1560 else if(wParam==VK_DELETE)
1561 SendMessage(hwnd,WM_COMMAND,IDM_RAD_ITEM_DELETE,0);
1562 }
1563 }
1564 return 0;
1565 case WM_SETFOCUS:
1566 i=GetWndNum(GetParent(hwnd));
1567 if(MdiInfo[i].MdiRadInfo->ButtonSelect==NON_TOOL)
1568 MdiInfo[i].MdiRadInfo->ButtonSelect=IDC_TOOL_MOUSE;
1569 InvalidateRect(hwnd,NULL,0);
1570 return 0;
1571 case WM_KILLFOCUS:
1572 i=GetWndNum(GetParent(hwnd));
1573 if(i==-1) return 0; //ウィンドウが破棄された場合
1574 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE)
1575 MdiInfo[i].MdiRadInfo->ButtonSelect=NON_TOOL;
1576 InvalidateRect(hwnd,NULL,0);
1577 return 0;
1578 case WM_PAINT:
1579 i=GetWndNum(GetParent(hwnd));
1580 if(i==-1) return 0; //ウィンドウが初期状態の場合
1581 i2=GetWndInfoNum(MdiInfo[i].path);
1582
1583 ScrollInfo.cbSize=sizeof(SCROLLINFO);
1584 ScrollInfo.fMask=SIF_RANGE|SIF_POS;
1585 GetScrollInfo(hwnd,SB_VERT,&ScrollInfo);
1586 si2.cbSize=sizeof(SCROLLINFO);
1587 si2.fMask=SIF_RANGE|SIF_POS;
1588 GetScrollInfo(hwnd,SB_HORZ,&si2);
1589
1590 hdc=BeginPaint(hwnd,&ps);
1591 BitBlt(hdc,0,0,ScreenX*2,ScreenY*2,
1592 MdiInfo[i].MdiRadInfo->hMemDC,si2.nPos,ScrollInfo.nPos,SRCCOPY);
1593 EndPaint(hwnd,&ps);
1594
1595 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE||MdiInfo[i].MdiRadInfo->ButtonSelect==NON_TOOL)
1596 DrawSelectingRect(hwnd,i,i2,MdiInfo[i].MdiRadInfo->ButtonSelect);
1597 return 0;
1598 case WM_CONTEXTMENU:
1599 if(RadInfo.NowDragging) return 0;
1600
1601 hParent=GetParent(hwnd);
1602 BringWindowToTop(hParent);
1603 SetFocus(hwnd);
1604 i=GetWndNum(hParent);
1605 i2=GetWndInfoNum(MdiInfo[i].path);
1606
1607 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){
1608 mouse.x=LOWORD(lParam);
1609 mouse.y=HIWORD(lParam);
1610 ScreenToClient(hwnd,&mouse);
1611 CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y);
1612 SelectItemNumOnMouse(i,i2,mouse.x,mouse.y);
1613 InvalidateRect(hwnd,NULL,0);
1614 extern HMENU hRadMenuBase;
1615 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW)
1616 TrackPopupMenu(GetSubMenu(hRadMenuBase,0),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
1617 else TrackPopupMenu(GetSubMenu(hRadMenuBase,1),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
1618 }
1619 return 0;
1620 case WM_COMMAND:
1621 switch(LOWORD(wParam)){
1622 case IDM_RAD_WINDOW_EVENTCODE:
1623 i=GetWndNum(GetParent(hwnd));
1624 DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_RAD_EVENTCODE),hwnd,(DLGPROC)DlgEventCode,0);
1625 break;
1626 case IDM_RAD_WINDOW_MENUEVENTCODE:
1627 i=GetWndNum(GetParent(hwnd));
1628 DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_RAD_EVENTCODE),hwnd,(DLGPROC)DlgEventCode,1);
1629 break;
1630 case IDM_RAD_ITEM_DELETE:
1631 hParent=GetParent(hwnd);
1632 i=GetWndNum(hParent);
1633 i2=GetWndInfoNum(MdiInfo[i].path);
1634
1635 //削除順序を考慮しなければならないので、バブルソートを行う
1636 int i5,i6;
1637 for(i5=0;;i5++){
1638 if(MdiInfo[i].MdiRadInfo->SelectingItem[i5]==-1) break;
1639 }
1640 for(i3=0;i3<i5-1;i3++){
1641 for(i4=i5-1;i4>i3;i4--){
1642 if(MdiInfo[i].MdiRadInfo->SelectingItem[i4] >
1643 MdiInfo[i].MdiRadInfo->SelectingItem[i4-1]){
1644 i6=MdiInfo[i].MdiRadInfo->SelectingItem[i4];
1645 MdiInfo[i].MdiRadInfo->SelectingItem[i4]=
1646 MdiInfo[i].MdiRadInfo->SelectingItem[i4-1];
1647 MdiInfo[i].MdiRadInfo->SelectingItem[i4-1]=i6;
1648 }
1649 }
1650 }
1651
1652
1653 for(i3=0;;i3++){
1654 if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break;
1655 DeleteDlgItem(i,i2,MdiInfo[i].MdiRadInfo->SelectingItem[i3],1);
1656 }
1657 for(i3=0;i3<MAX_RAD_SELITEM;i3++) MdiInfo[i].MdiRadInfo->SelectingItem[i3]=-1;
1658
1659 ResetState_EditMenu();
1660 break;
1661 }
1662 return 0;
1663 case WM_VSCROLL:
1664 ScrollInfo.cbSize=sizeof(SCROLLINFO);
1665 ScrollInfo.fMask=SIF_POS|SIF_PAGE|SIF_RANGE;
1666 GetScrollInfo(hwnd,SB_VERT,&ScrollInfo);
1667 if(LOWORD(wParam)==SB_LINEUP) i=-20;
1668 else if(LOWORD(wParam)==SB_LINEDOWN) i=20;
1669 else if(LOWORD(wParam)==SB_PAGEUP) i=-(signed int)ScrollInfo.nPage;
1670 else if(LOWORD(wParam)==SB_PAGEDOWN) i=ScrollInfo.nPage;
1671 else if(LOWORD(wParam)==SB_THUMBTRACK) i=HIWORD(wParam)-ScrollInfo.nPos;
1672 else i=0;
1673 GetClientRect(hwnd,&rect);
1674 i=max(-ScrollInfo.nPos,min(i,ScrollInfo.nMax-rect.bottom-ScrollInfo.nPos));
1675 if(i!=0){
1676 ScrollInfo.nPos+=i;
1677 SetScrollInfo(hwnd,SB_VERT,&ScrollInfo,1);
1678 ScrollWindow(hwnd,0,-i,NULL,NULL);
1679 UpdateWindow(hwnd);
1680 }
1681 return 0;
1682 case WM_HSCROLL:
1683 ScrollInfo.cbSize=sizeof(SCROLLINFO);
1684 ScrollInfo.fMask=SIF_POS|SIF_PAGE|SIF_RANGE;
1685 GetScrollInfo(hwnd,SB_HORZ,&ScrollInfo);
1686 if(LOWORD(wParam)==SB_LINEUP) i=-20;
1687 else if(LOWORD(wParam)==SB_LINEDOWN) i=20;
1688 else if(LOWORD(wParam)==SB_PAGEUP) i=-(signed int)ScrollInfo.nPage;
1689 else if(LOWORD(wParam)==SB_PAGEDOWN) i=ScrollInfo.nPage;
1690 else if(LOWORD(wParam)==SB_THUMBTRACK) i=HIWORD(wParam)-ScrollInfo.nPos;
1691 else i=0;
1692 GetClientRect(hwnd,&rect);
1693 i=max(-ScrollInfo.nPos,min(i,ScrollInfo.nMax-rect.right-ScrollInfo.nPos));
1694 if(i!=0){
1695 ScrollInfo.nPos+=i;
1696 SetScrollInfo(hwnd,SB_HORZ,&ScrollInfo,1);
1697 ScrollWindow(hwnd,-i,0,NULL,NULL);
1698 UpdateWindow(hwnd);
1699 }
1700 return 0;
1701 case WM_SIZE:
1702 i=GetWndNum(GetParent(hwnd));
1703 if(i==-1) break; //ウィンドウが初期状態の場合
1704 ResetScrollbarOfRadEditor(i,LOWORD(lParam),HIWORD(lParam));
1705 return 0;
1706 }
1707 return DefWindowProc(hwnd,message,wParam,lParam);
1708}
1709void ResizeToRadToolWindows(int WndNum,int weight,int height){
1710 extern MDIINFO MdiInfo[MAX_WNDNUM];
1711 int i,i2;
1712 RECT rect;
1713
1714 if(height<200){
1715 i=100;
1716 i2=100;
1717 }
1718 else{
1719 //ツールボタンウィンドウ(長さ、i)
1720 GetClientRect(GetWindow(MdiInfo[WndNum].MdiRadInfo->hTools,GW_CHILD),&rect);
1721 if(height>rect.bottom+1) i=rect.bottom+1;
1722 else i=height;
1723
1724 //プロパティウィンドウ(長さ、i2)
1725 GetClientRect(GetWindow(MdiInfo[WndNum].MdiRadInfo->hProperty,GW_CHILD),&rect);
1726 i2=height-i;
1727
1728 if(i2<100){
1729 i=height-100;
1730 i2=100;
1731 }
1732 }
1733 MoveWindow(MdiInfo[WndNum].MdiRadInfo->hTools,weight-172,0,172,i,1);
1734 MoveWindow(MdiInfo[WndNum].MdiRadInfo->hProperty,weight-172,i,172,i2,1);
1735
1736 GetWindowRect(MdiInfo[WndNum].MdiRadInfo->hSupport,&rect);
1737 rect.right-=rect.left;
1738 rect.bottom-=rect.top;
1739
1740 //RADウィンドウ
1741 MoveWindow(MdiInfo[WndNum].MdiRadInfo->hRad,0,0,weight-172,height-rect.bottom,1);
1742
1743 //サポートウィンドウ
1744 MoveWindow(MdiInfo[WndNum].MdiRadInfo->hSupport,0,height-rect.bottom,weight-172,rect.bottom,1);
1745}
1746LRESULT CALLBACK MDIClientWindow_Rad(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
1747 extern HWND hDocCombo;
1748 extern MDIINFO MdiInfo[MAX_WNDNUM];
1749 extern PROJECTINFO ProjectInfo;
1750 int i,WndNum;
1751
1752 switch(message){
1753 case WM_CREATE:
1754 extern HICON hWindowDocumentIcon;
1755 SendMessage(hwnd,WM_SETICON,ICON_SMALL,(long)hWindowDocumentIcon);
1756 break;
1757 case WM_MDIACTIVATE:
1758 if(!lParam) return 0;
1759 i=GetWndNum((HWND)lParam);
1760 if(i==-1) return 0; //ウィンドウが初期状態の場合
1761
1762 i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[i].title);
1763 SendMessage(hDocCombo,CB_SETCURSEL,i,0);
1764 SetStatusText(NULL);
1765 ResetState_EditMenu();
1766 return 0;
1767 case WM_SIZE:
1768 WndNum=GetWndNum(hwnd);
1769 if(WndNum==-1) break;
1770 ResizeToRadToolWindows(WndNum,LOWORD(lParam),HIWORD(lParam));
1771 break;
1772 case WM_CLOSE:
1773 CloseDocWindow(GetWndNum(hwnd));
1774 pobj_nv->bMDIZoomed=IsZoomed(hwnd);
1775 i=DefMDIChildProc(hwnd,message,wParam,lParam);
1776
1777 //メニュー状態を設定
1778 ResetState_DocMenu();
1779
1780 return i;
1781 }
1782 return DefMDIChildProc(hwnd,message,wParam,lParam);
1783}
Note: See TracBrowser for help on using the repository browser.