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

Last change on this file since 626 was 626, checked in by dai_9181, 16 years ago

MdiInfoをリファクタリング

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