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

Last change on this file since 478 was 475, checked in by dai_9181, 17 years ago

構成管理を変更中・・・(いったんコミット)

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