#include "stdafx.h" #include "common.h" void NewRadWindow(int WndInfoNum){ extern HINSTANCE hInst,hResInst; extern HWND hDocCombo; extern PROJECTINFO ProjectInfo; extern MDIINFO MdiInfo[MAX_WNDNUM]; int i,i2; HWND hChild; RECT rect; MDICREATESTRUCT mdic; WINDOW_INFO *pWindowInfo; pWindowInfo=&ProjectInfo.pWindowInfo[WndInfoNum]; //すでに指定されたファイルが開かれている場合 hChild=GetWindow(hClient,GW_CHILD); while(hChild){ i=GetWndNum(hChild); if(MdiInfo[i].DocType==WNDTYPE_RAD){ if(lstrcmpi(MdiInfo[i].path,pWindowInfo->name)==0) break; } hChild=GetNextWindow(hChild,GW_HWNDNEXT); } if(hChild){ BringWindowToTop(hChild); return; } mdic.szTitle=pWindowInfo->name; mdic.szClass="MDIClientWindow_Rad"; mdic.hOwner=hInst; mdic.x=CW_USEDEFAULT; mdic.y=CW_USEDEFAULT; mdic.cx=CW_USEDEFAULT; mdic.cy=CW_USEDEFAULT; hChild=GetWindow(hClient,GW_CHILD); if(IsWindow(hChild)){ if(IsZoomed(hChild)) mdic.style=WS_MAXIMIZE|WS_CLIPCHILDREN; else mdic.style=0; } else{ if(pobj_nv->bMDIZoomed) mdic.style=WS_MAXIMIZE|WS_CLIPCHILDREN; else mdic.style=0; } mdic.lParam=0; hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(long)&mdic); //ウィンドウ作成 ////////////////////// // 子ウィンドウを作成 ////////////////////// //ツールウィンドウを作成 HWND hTools; hTools=CreateWindow("RadToolsWindow",NULL, WS_CHILD|WS_VSCROLL|WS_VISIBLE|WS_CLIPCHILDREN, 0,0,0,0, hChild,NULL,hInst,NULL); //プロパティウィンドウを作成 HWND hProperty; hProperty=CreateWindowEx(WS_EX_CLIENTEDGE,"RadPropertyWindow",NULL, WS_CHILD|WS_VSCROLL|WS_VISIBLE|WS_CLIPCHILDREN, 0,0,0,0, hChild,NULL,hInst,NULL); //内部RADウィンドウを作成 HWND hRad; hRad=CreateWindowEx(WS_EX_CLIENTEDGE,"RadWindow",NULL, WS_CHILD|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE|WS_CLIPCHILDREN, 0,0,0,0, hChild,NULL,hInst,NULL); //サポートウィンドウを作成 HWND hSupport; hSupport=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_SUPPORT),hChild,(DLGPROC)DlgRadSupport); //ウィンドウのID登録 HDC hdc; for(i=0;iname)+1); lstrcpy(MdiInfo[i].title,pWindowInfo->name); MdiInfo[i].path=(char *)GlobalAlloc(GMEM_FIXED,lstrlen(pWindowInfo->name)+1); lstrcpy(MdiInfo[i].path,pWindowInfo->name); //////////////////////////// // MDIRADINFO構造体をセット //////////////////////////// MdiInfo[i].MdiRadInfo=(MDIRADINFO *)GlobalAlloc(GPTR,sizeof(MDIRADINFO)); MdiInfo[i].MdiRadInfo->hTools=hTools; MdiInfo[i].MdiRadInfo->hProperty=hProperty; MdiInfo[i].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),hProperty,(DLGPROC)RadProperty_WindowProc); SCROLLINFO ScrollInfo; ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_POS; ScrollInfo.nPos=0; SetScrollInfo(MdiInfo[i].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1); MdiInfo[i].MdiRadInfo->hRad=hRad; MdiInfo[i].MdiRadInfo->hSupport=hSupport; hdc=GetDC(hRad); MdiInfo[i].MdiRadInfo->hBitmap=CreateCompatibleBitmap(hdc,ScreenX*2,ScreenY*2); MdiInfo[i].MdiRadInfo->hMemDC=CreateCompatibleDC(hdc); MdiInfo[i].MdiRadInfo->hOldBitmap= (HBITMAP)SelectObject(MdiInfo[i].MdiRadInfo->hMemDC,MdiInfo[i].MdiRadInfo->hBitmap); ReleaseDC(hRad,hdc); for(i2=0;i2SelectingItem[i2]=-1; MdiInfo[i].MdiRadInfo->ButtonSelect=IDC_TOOL_MOUSE; //変更情報を初期化 MdiInfo[i].MdiRadInfo->undo.NowPos=0; memset(MdiInfo[i].MdiRadInfo->undo.Command,0,sizeof(int)*MAX_UNDONUM); DrawRadWindow(i,pWindowInfo); //サポートダイアログの内容をセット SetSupportDlgData(i,WndInfoNum); break; } } ShowWindow(hSupport,SW_SHOW); //ウィンドウ位置を初期化 GetClientRect(hChild,&rect); ResizeToRadToolWindows(i,rect.right,rect.bottom); i=SendMessage(hDocCombo,CB_ADDSTRING,0,(long)pWindowInfo->name); //Docコンボボックスに追加 SendMessage(hDocCombo,CB_SETCURSEL,i,0); //タブに追加 pobj_MainTab->InsertItem( pWindowInfo->name, true ); //メニュー状態を設定 ResetState_DocMenu(); SetFocus(hRad); } int 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){ //dwInsertType //0 … 元に戻す、やり直し //1 … 通常の挿入 //2 … 貼り付け extern HANDLE hHeap; extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; int i,i2,NewItemNum; char temporary[MAX_PATH]; CHILDINFO *pChildInfo; ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,0,ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo,(ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows+1)*sizeof(WINDOW_INFO)); if(ItemNum==-1) NewItemNum=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows; else{ for(i=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows;i>ItemNum;i--) ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i]=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i-1]; NewItemNum=ItemNum; } pChildInfo=&ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[NewItemNum]; //ID if(ItemNum==-1){ for(i=lstrlen(IdName)-1;i>=0;i--){ if(!('0'<=IdName[i]&&IdName[i]<='9')) break; } i++; if(IdName[i]!='\0'){ i2=atoi(IdName+i)+1; if(dwInsertType==2) i2--; IdName[i]=0; } else{ if(dwInsertType==2) i2=0; else i2=1; } if(i2==0) lstrcpy(temporary,IdName); else sprintf(temporary,"%s%d",IdName,i2); SearchStart: for(i=0;iIdName=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); lstrcpy(pChildInfo->IdName,temporary); //位置 pChildInfo->pos=*pPos; pChildInfo->size=*pSize; //小さすぎる場合は、最小の大きさに調整 if(pChildInfo->size.cxsize.cx=MIN_ITEM_X; if(pChildInfo->size.cysize.cy=MIN_ITEM_Y; //テキスト if(ItemNum==-1){ if(dwInsertType==1){ if(caption[0]) sprintf(temporary,"%s%d",caption,i2); else temporary[0]=0; } else lstrcpy(temporary,caption); } else lstrcpy(temporary,caption); pChildInfo->caption=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); lstrcpy(pChildInfo->caption,temporary); //スタイル pChildInfo->style=style_or_WndNum; //拡張スタイル pChildInfo->ExStyle=ExStyle; //クラス名 pChildInfo->Control=Control; if(Control==CT_IMAGEBOX){ //イメージ ボックスの場合 pChildInfo->ImageCtrlInfo.type=ImageType; if(!ImagePath) pChildInfo->ImageCtrlInfo.path=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1); else{ pChildInfo->ImageCtrlInfo.path=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,lstrlen(ImagePath)+1); lstrcpy(pChildInfo->ImageCtrlInfo.path,ImagePath); } } //変更情報 if(dwInsertType!=0) Rad_NoticeChanging(WndNum,RAD_UNDO_INSERTITEM,NewItemNum,(DWORD)pChildInfo); ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows++; DrawRadWindow(WndNum,&ProjectInfo.pWindowInfo[WndInfoNum]); return NewItemNum; } void DeleteDlgItem(int WndNum,int WndInfoNum,int ItemNum,BOOL bNoticeChanging){ extern HANDLE hHeap; extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; int i; //変更情報 if(bNoticeChanging) Rad_NoticeChanging(WndNum,RAD_UNDO_DELETEITEM,ItemNum,(DWORD)&ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum]); //子ウィンドウのメモリを解放 HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].IdName); HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].caption); if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].Control==CT_IMAGEBOX){ //イメージ ボックスの場合 HeapDefaultFree(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[ItemNum].ImageCtrlInfo.path); } ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows--; for(i=ItemNum;ihProp_Dlg); MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_WindowProc); SCROLLINFO ScrollInfo; ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_POS; ScrollInfo.nPos=0; SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1); RECT rect; GetClientRect(MdiInfo[WndNum].MdiRadInfo->hProperty,&rect); SendMessage(MdiInfo[WndNum].MdiRadInfo->hProperty,WM_SIZE,0,MAKELONG(rect.right,rect.bottom)); } void CursorPos_GlobalToLocal(HWND hwnd,long *x,long *y){ SCROLLINFO VertScrollInfo,HorzScrollInfo; VertScrollInfo.cbSize=sizeof(SCROLLINFO); VertScrollInfo.fMask=SIF_RANGE|SIF_POS; GetScrollInfo(hwnd,SB_VERT,&VertScrollInfo); HorzScrollInfo.cbSize=sizeof(SCROLLINFO); HorzScrollInfo.fMask=SIF_RANGE|SIF_POS; GetScrollInfo(hwnd,SB_HORZ,&HorzScrollInfo); *x-=HorzScrollInfo.nPos; *y-=VertScrollInfo.nPos; } void CursorPos_LocalToGlobal(HWND hwnd,long *x,long *y){ SCROLLINFO VertScrollInfo,HorzScrollInfo; VertScrollInfo.cbSize=sizeof(SCROLLINFO); VertScrollInfo.fMask=SIF_RANGE|SIF_POS; GetScrollInfo(hwnd,SB_VERT,&VertScrollInfo); HorzScrollInfo.cbSize=sizeof(SCROLLINFO); HorzScrollInfo.fMask=SIF_RANGE|SIF_POS; GetScrollInfo(hwnd,SB_HORZ,&HorzScrollInfo); *x+=HorzScrollInfo.nPos; *y+=VertScrollInfo.nPos; } void DrawFrame(HWND hwnd,int WndNum,int WndInfoNum,RECT *NewRect,RECT *OldRect,BOOL bLA){ extern PROJECTINFO ProjectInfo; extern MDIINFO MdiInfo[MAX_WNDNUM]; static int swLineStop; int i,sw; int x,y; HDC hdc; HPEN hPen,hOldPen; HBRUSH hOldBrush; RECT rect; hdc=GetDC(hwnd); sw=0; if(pobj_nv->bLineAdjust&&bLA){ for(i=0;iSelectingItem[0]) continue; if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].Control != ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control) continue; if(NewRect->leftleft){ if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x > NewRect->left - MdiInfo[WndNum].MdiRadInfo->ClientPos.x && ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x-10 < NewRect->left - MdiInfo[WndNum].MdiRadInfo->ClientPos.x){ //左側をストップする x=NewRect->right-NewRect->left; NewRect->left=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x + MdiInfo[WndNum].MdiRadInfo->ClientPos.x; NewRect->right=NewRect->left+x; hPen=CreatePen(PS_SOLID,0,RGB(100,100,100)); hOldPen=(HPEN)SelectObject(hdc,hPen); MoveToEx(hdc,NewRect->left,0,NULL); LineTo(hdc,NewRect->left,ScreenX); SelectObject(hdc,hOldPen); DeleteObject(hPen); swLineStop=1; sw=1; } } if(NewRect->toptop){ if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y > NewRect->top - MdiInfo[WndNum].MdiRadInfo->ClientPos.y && ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y-10 < NewRect->top - MdiInfo[WndNum].MdiRadInfo->ClientPos.y){ //左側をストップする y=NewRect->bottom-NewRect->top; NewRect->top=ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y + MdiInfo[WndNum].MdiRadInfo->ClientPos.y; NewRect->bottom=NewRect->top+y; hPen=CreatePen(PS_SOLID,0,RGB(100,100,100)); hOldPen=(HPEN)SelectObject(hdc,hPen); MoveToEx(hdc,0,NewRect->top,NULL); LineTo(hdc,ScreenY,NewRect->top); SelectObject(hdc,hOldPen); DeleteObject(hPen); swLineStop=1; sw=1; } } } } //以前の選択フレームを消去 RectNaturalFormat(OldRect,&rect); x=rect.left; y=rect.top; CursorPos_GlobalToLocal(hwnd,&rect.left,&rect.top); CursorPos_GlobalToLocal(hwnd,&rect.right,&rect.bottom); if(swLineStop&&sw==0){ BitBlt(hdc,0,0,ScreenX*2,ScreenY*2, MdiInfo[WndNum].MdiRadInfo->hMemDC,0,0,SRCCOPY); swLineStop=0; } else{ BitBlt(hdc,rect.left-LEVER_THICK, rect.top-LEVER_THICK, rect.right-rect.left+LEVER_THICK*2, rect.bottom-rect.top+LEVER_THICK*2, MdiInfo[WndNum].MdiRadInfo->hMemDC,x-LEVER_THICK,y-LEVER_THICK,SRCCOPY); } //新しい選択フレームを描画 RectNaturalFormat(NewRect,&rect); CursorPos_GlobalToLocal(hwnd,&rect.left,&rect.top); CursorPos_GlobalToLocal(hwnd,&rect.right,&rect.bottom); hPen=CreatePen(PS_DOT,0,RGB(0,0,0)); SetBkMode(hdc,TRANSPARENT); hOldPen=(HPEN)SelectObject(hdc,hPen); hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH)); Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom); SelectObject(hdc,hOldBrush); SelectObject(hdc,hOldPen); DeleteObject(hPen); ReleaseDC(hwnd,hdc); *OldRect=*NewRect; } void GetSelectingRect(int WndNum,int WndInfoNum,int num,RECT *rect){ extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]==SELECT_WINDOW){ //ウィンドウ軸を選択 rect->left=0; rect->top=0; rect->right=ProjectInfo.pWindowInfo[WndInfoNum].size.cx+(LEVER_THICK*2); rect->bottom=ProjectInfo.pWindowInfo[WndInfoNum].size.cy+(LEVER_THICK*2); } else{ //子ウィンドウを選択 rect->left=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].pos.x-LEVER_THICK; rect->top=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[num]].pos.y-LEVER_THICK; 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; 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; } } void DrawSelectingRect(HWND hwnd,int WndNum,int WndInfoNum,int ButtonSelect){ extern MDIINFO MdiInfo[MAX_WNDNUM]; extern RADINFO RadInfo; extern PROJECTINFO ProjectInfo; int i,i2,i3; HDC hdc; HPEN hPen,hOldPen; HBRUSH hOldBrush; COLORREF rgb; RECT rect,tempRect; hdc=GetDC(hwnd); if(ButtonSelect==IDC_TOOL_MOUSE) rgb=RGB(255,60,30); else if(ButtonSelect==NON_TOOL) rgb=RGB(100,100,100); hPen=CreatePen(PS_SOLID,0,rgb); SetBkMode(hdc,TRANSPARENT); hOldPen=(HPEN)SelectObject(hdc,hPen); i=0; while(MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]!=-1||i==0){ GetSelectingRect(WndNum,WndInfoNum,i,&tempRect); RectNaturalFormat(&tempRect,&rect); CursorPos_GlobalToLocal(hwnd,&rect.left,&rect.top); CursorPos_GlobalToLocal(hwnd,&rect.right,&rect.bottom); //主線 hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(NULL_BRUSH)); Rectangle(hdc, rect.left+2, rect.top+2, rect.right-2, rect.bottom-2); SelectObject(hdc,hOldBrush); hOldBrush=(HBRUSH)SelectObject(hdc,GetStockObject(WHITE_BRUSH)); Rectangle(hdc, rect.left,rect.top, rect.left+5,rect.top+5); Rectangle(hdc, rect.left,rect.bottom-5, rect.left+5,rect.bottom); Rectangle(hdc, rect.right-5,rect.top, rect.right,rect.top+5); Rectangle(hdc, rect.right-5,rect.bottom-5, rect.right,rect.bottom); i2=(rect.right-rect.left)/2; i3=(rect.bottom-rect.top)/2; Rectangle(hdc, rect.left+i2-2,rect.top, rect.left+i2+3,rect.top+5); Rectangle(hdc, rect.left+i2-2,rect.bottom-5, rect.left+i2+3,rect.bottom); Rectangle(hdc, rect.left,rect.top+i3-2, rect.left+5,rect.top+i3+3); Rectangle(hdc, rect.right-5,rect.top+i3-2, rect.right,rect.top+i3+3); SelectObject(hdc,hOldBrush); //移動時の選択フレームの消去用範囲 RadInfo.OldDraggingRect[i]=rect; i++; } SelectObject(hdc,hOldPen); DeleteObject(hPen); ReleaseDC(hwnd,hdc); } void ChangePropertyWindow(int WndNum,int WndInfoNum){ extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; RECT rect; SCROLLINFO ScrollInfo; DestroyWindow(MdiInfo[WndNum].MdiRadInfo->hProp_Dlg); if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){ MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_WindowProc); ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_POS; ScrollInfo.nPos=0; SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1); GetClientRect(MdiInfo[WndNum].MdiRadInfo->hProperty,&rect); SendMessage(MdiInfo[WndNum].MdiRadInfo->hProperty,WM_SIZE,0,MAKELONG(rect.right,rect.bottom)); } else{ if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_BUTTON) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_BUTTON),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ButtonProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_CHECKBOX) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_CHECKBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_CheckBoxProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_COMBOBOX) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_COMBOBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ComboBoxProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_EDIT) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_EDIT),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_EditProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_GROUPBOX) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_GROUPBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_GroupBoxProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_HSCROLLBAR) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_SCROLLBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ScrollBarProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_IMAGEBOX) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_IMAGEBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ImageBoxProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_LISTBOX) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_LISTBOX),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ListBoxProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_LISTVIEW) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_LISTVIEW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ListViewProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_PROGRESSBAR) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_PROGRESSBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ProgressBarProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_RADIOBUTTON) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_RADIOBUTTON),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_RadioButtonProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_STATIC) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_STATIC),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_StaticProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_TRACKBAR) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_TRACKBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_TrackBarProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_TREEVIEW) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_TREEVIEW),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_TreeViewProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_UPDOWN) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_UPDOWN),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_UpDownProc); else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_VSCROLLBAR) MdiInfo[WndNum].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_SCROLLBAR),MdiInfo[WndNum].MdiRadInfo->hProperty,(DLGPROC)RadProperty_ScrollBarProc); ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_POS; ScrollInfo.nPos=0; SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1); GetClientRect(MdiInfo[WndNum].MdiRadInfo->hProperty,&rect); SendMessage(MdiInfo[WndNum].MdiRadInfo->hProperty,WM_SIZE,0,MAKELONG(rect.right,rect.bottom)); } } int GetItemNumOnMouse(int WndNum,int WndInfoNum,int x,int y){ extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; int i; for(i=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows-1;i>=0;i--){ if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].Control==CT_COMBOBOX&& (ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].style&0x000F)!=CBS_SIMPLE){ //コンボ ボックスの場合は表示部分をターゲットに選択する(高さ20pixel) if(x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x&& x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx&& y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y&& y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+20){ break; } } else if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].Control==CT_GROUPBOX){ //グループ ボックスの場合は中央をあける if(( x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x&& x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx&& y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y&& y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy )&& (!( x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+LEVER_THICK*2&& x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx-LEVER_THICK*2&& y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+LEVER_THICK*3&& y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy-LEVER_THICK*2 )) ){ break; } } else if(x>=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x&& x<=MdiInfo[WndNum].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx&& y>=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y&& y<=MdiInfo[WndNum].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy){ break; } } return i; } void SelectItemNumOnMouse(int WndNum,int WndInfoNum,int x,int y){ //マウス座標をもとにコントロールアイテムを選択 extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; int i; for(i=1;iSelectingItem[i]=-1; i=GetItemNumOnMouse(WndNum,WndInfoNum,x,y); if(i==-1){ if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){ MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]=SELECT_WINDOW; ChangePropertyWindow(WndNum,WndInfoNum); } } else{ MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]=i; ChangePropertyWindow(WndNum,WndInfoNum); } SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(WndNum,WndInfoNum); } void SetItemNumOnFrame(int WndNum,int WndInfoNum,RECT *pRect){ extern PROJECTINFO ProjectInfo; extern MDIINFO MdiInfo[MAX_WNDNUM]; int i,i2,sw; RECT rect; for(i=1;iSelectingItem[i]=-1; RectNaturalFormat(pRect,&rect); if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW) sw=0; else sw=1; for(i=ProjectInfo.pWindowInfo[WndInfoNum].NumberOfChildWindows-1,i2=0;i>=0;i--){ if(rect.left <= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+MdiInfo[WndNum].MdiRadInfo->ClientPos.x&& rect.top <= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+MdiInfo[WndNum].MdiRadInfo->ClientPos.y&& rect.right >= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.x+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cx+MdiInfo[WndNum].MdiRadInfo->ClientPos.x&& rect.bottom >= ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].pos.y+ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[i].size.cy+MdiInfo[WndNum].MdiRadInfo->ClientPos.y){ MdiInfo[WndNum].MdiRadInfo->SelectingItem[i2]=i; i2++; } } if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW|| (MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW&&sw)){ ChangePropertyWindow(WndNum,WndInfoNum); } } int GetStateOfDraggingFrame(int WndNum,int WndInfoNum,int x,int y){ extern PROJECTINFO ProjectInfo; extern MDIINFO MdiInfo[MAX_WNDNUM]; int i; RECT rect; if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[1]!=-1){ i=0; while(MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]!=-1||i==0){ GetSelectingRect(WndNum,WndInfoNum,i,&rect); if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&& y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK){ if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i]].Control==CT_GROUPBOX){ //グループボックスの場合は中央をあける if(!(x>=rect.left+LEVER_THICK*2&&x<=rect.right-LEVER_THICK*2&& y>=rect.top+LEVER_THICK*3&&y<=rect.bottom-LEVER_THICK*2)){ return FRAME_INSIDE; } } else return FRAME_INSIDE; } i++; } } else{ GetSelectingRect(WndNum,WndInfoNum,0,&rect); if(MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){ if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&& y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK){ if(ProjectInfo.pWindowInfo[WndInfoNum].pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[0]].Control==CT_GROUPBOX){ //グループ ボックスの場合は中央をあける if(!(x>=rect.left+LEVER_THICK*3&&x<=rect.right-LEVER_THICK*3&& y>=rect.top+LEVER_THICK*4&&y<=rect.bottom-LEVER_THICK*3)){ return FRAME_INSIDE; } } else return FRAME_INSIDE; } else if(x>=rect.left&&x<=rect.left+LEVER_THICK&& y>=rect.top&&y<=rect.top+LEVER_THICK) return FRAME_UPPER_LEFT; else if(x>=rect.right-LEVER_THICK&&x<=rect.right&& y>=rect.top&&y<=rect.top+LEVER_THICK) return FRAME_UPPER_RIGHT; else if(x>=rect.left&&x<=rect.left+LEVER_THICK&& y>=rect.bottom-LEVER_THICK&&y<=rect.bottom) return FRAME_LOWER_LEFT; else if(x>=rect.left&&x<=rect.left+LEVER_THICK&& y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK)return FRAME_LEFT; else if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&& y>=rect.top&&y<=rect.top+LEVER_THICK) return FRAME_UPPER; } if(x>=rect.right-LEVER_THICK&&x<=rect.right&& y>=rect.bottom-LEVER_THICK&&y<=rect.bottom) return FRAME_LOWER_RIGHT; else if(x>=rect.right-LEVER_THICK&&x<=rect.right&& y>=rect.top+LEVER_THICK&&y<=rect.bottom-LEVER_THICK) return FRAME_RIGHT; else if(x>=rect.left+LEVER_THICK&&x<=rect.right-LEVER_THICK&& y>=rect.bottom-LEVER_THICK&&y<=rect.bottom) return FRAME_LOWER; } return 0; } void ResetScrollbarOfRadEditor(int WndNum,int weight,int height){ extern PROJECTINFO ProjectInfo; extern MDIINFO MdiInfo[MAX_WNDNUM]; int WndInfoNum; SCROLLINFO ScrollInfo; SIZE NeedSize; WndInfoNum=GetWndInfoNum(MdiInfo[WndNum].path); //必要な幅、高さを共に100ピクセル余裕を持たせる NeedSize.cx=ProjectInfo.pWindowInfo[WndInfoNum].size.cx+(LEVER_THICK*2)+100; NeedSize.cy=ProjectInfo.pWindowInfo[WndInfoNum].size.cy+(LEVER_THICK*2)+100; ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_PAGE|SIF_RANGE|SIF_POS|SIF_DISABLENOSCROLL; //垂直スクロールバーの設定 GetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_VERT,&ScrollInfo); ScrollInfo.nMin=0; if(height>NeedSize.cy) ScrollInfo.nMax=0; else{ ScrollInfo.nMax=NeedSize.cy; ScrollInfo.nPage=height; } SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_VERT,&ScrollInfo,1); //水平スクロールバーの設定 GetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_VERT,&ScrollInfo); ScrollInfo.nMin=0; if(weight>NeedSize.cx) ScrollInfo.nMax=0; else{ ScrollInfo.nMax=NeedSize.cx; ScrollInfo.nPage=weight; } SetScrollInfo(MdiInfo[WndNum].MdiRadInfo->hRad,SB_HORZ,&ScrollInfo,1); } LRESULT CALLBACK RadWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; extern RADINFO RadInfo; int i,i2,i3,i4; char temporary[MAX_PATH],temp2[MAX_PATH]; HWND hParent; HDC hdc; RECT rect; POINT mouse,pos; SIZE size; SCROLLINFO ScrollInfo,si2; PAINTSTRUCT ps; POINTANDSIZE PointAndSize; switch(message){ case WM_LBUTTONDOWN: SetCapture(hwnd); SetFocus(hwnd); mouse.x=LOWORD(lParam); mouse.y=HIWORD(lParam); CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); i=GetWndNum(GetParent(hwnd)); i2=GetWndInfoNum(MdiInfo[i].path); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ if(((wParam&MK_CONTROL)||(wParam&MK_SHIFT))&& MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){ //Shiftキー、Ctrlキーによる複数選択 for(i3=0;;i3++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1){ MdiInfo[i].MdiRadInfo->SelectingItem[i3]=GetItemNumOnMouse(i,i2,mouse.x,mouse.y); InvalidateRect(hwnd,NULL,0); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); break; } } } else{ RadInfo.NowDragging=GetStateOfDraggingFrame(i,i2,mouse.x,mouse.y); if(!RadInfo.NowDragging){ SelectItemNumOnMouse(i,i2,mouse.x,mouse.y); InvalidateRect(hwnd,NULL,0); RadInfo.NowDragging=GetStateOfDraggingFrame(i,i2,mouse.x,mouse.y); } if(RadInfo.NowDragging){ //アイテム選択中。サイズ、位置変更開始 if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){ RadInfo.DraggingRect[0].left=LEVER_THICK; RadInfo.DraggingRect[0].top=LEVER_THICK; RadInfo.DraggingRect[0].right=ProjectInfo.pWindowInfo[i2].size.cx+LEVER_THICK; RadInfo.DraggingRect[0].bottom=ProjectInfo.pWindowInfo[i2].size.cy+LEVER_THICK; RadInfo.DragStartRect[0]=RadInfo.DraggingRect[0]; } else{ i3=0; while(MdiInfo[i].MdiRadInfo->SelectingItem[i3]!=-1){ RadInfo.DraggingRect[i3].left=MdiInfo[i].MdiRadInfo->ClientPos.x+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x; RadInfo.DraggingRect[i3].top=MdiInfo[i].MdiRadInfo->ClientPos.y+ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y; 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; 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; RadInfo.DragStartRect[i3]=RadInfo.DraggingRect[i3]; i3++; } } } else{ //範囲選択 RadInfo.NowDragging=SELECTING_FRAME; RadInfo.OldDraggingRect[0].left=LEVER_THICK; RadInfo.OldDraggingRect[0].top=LEVER_THICK; RadInfo.OldDraggingRect[0].right=ProjectInfo.pWindowInfo[i2].size.cx+LEVER_THICK; RadInfo.OldDraggingRect[0].bottom=ProjectInfo.pWindowInfo[i2].size.cy+LEVER_THICK; } RadInfo.DragStartPos.x=mouse.x; RadInfo.DragStartPos.y=mouse.y; } SetCursorByState(RadInfo.NowDragging); } else{ RadInfo.DraggingRect[0].left=mouse.x; RadInfo.DraggingRect[0].top=mouse.y; RadInfo.NowDragging=ITEM_MAKING; } return 0; case WM_LBUTTONUP: ReleaseCapture(); SetFocus(hwnd); mouse.x=(int)(short)LOWORD(lParam); mouse.y=(int)(short)HIWORD(lParam); CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); hParent=GetParent(hwnd); i=GetWndNum(hParent); i2=GetWndInfoNum(MdiInfo[i].path); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ if(RadInfo.NowDragging){ if(RadInfo.DragStartPos.x==mouse.x&&RadInfo.DragStartPos.y==mouse.y){ RadInfo.NowDragging=0; InvalidateRect(hwnd,NULL,0); ResetState_EditMenu(); return 0; } if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){ if(RadInfo.NowDragging==SELECTING_FRAME){ SetItemNumOnFrame(i,i2,&RadInfo.DraggingRect[0]); InvalidateRect(hwnd,NULL,1); } else{ //ウィンドウ枠の調整完了 PointAndSize.size=ProjectInfo.pWindowInfo[i2].size; Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].size.cx=RadInfo.DraggingRect[0].right-LEVER_THICK; ProjectInfo.pWindowInfo[i2].size.cy=RadInfo.DraggingRect[0].bottom-LEVER_THICK; DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); InvalidateRect(hwnd,NULL,1); GetClientRect(hwnd,&rect); ResetScrollbarOfRadEditor(i,rect.right,rect.bottom); } } else{ i3=0; while(MdiInfo[i].MdiRadInfo->SelectingItem[i3]!=-1){ //アイテム枠の調整完了 PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size; Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x=RadInfo.DraggingRect[i3].left-MdiInfo[i].MdiRadInfo->ClientPos.x; ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y=RadInfo.DraggingRect[i3].top-MdiInfo[i].MdiRadInfo->ClientPos.y; ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size.cx=RadInfo.DraggingRect[i3].right-RadInfo.DraggingRect[i3].left; ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size.cy=RadInfo.DraggingRect[i3].bottom-RadInfo.DraggingRect[i3].top; DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); i3++; } } SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } } else if(RadInfo.NowDragging==ITEM_MAKING){ if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_BUTTON){ //ボタン コントロール作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=44; RadInfo.DraggingRect[0].right=mouse.x+44; RadInfo.DraggingRect[0].top-=10; RadInfo.DraggingRect[0].bottom=mouse.y+11; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"CommandButton","Button",WS_CHILD|WS_VISIBLE,0,CT_BUTTON,0,0,1); } if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_CHECKBOX){ //チェック ボックス作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=33; RadInfo.DraggingRect[0].right=mouse.x+34; RadInfo.DraggingRect[0].top-=7; RadInfo.DraggingRect[0].bottom=mouse.y+8; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_COMBOBOX){ //コンボ ボックス作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=42; RadInfo.DraggingRect[0].right=mouse.x+42; RadInfo.DraggingRect[0].top-=42; RadInfo.DraggingRect[0].bottom=mouse.y+42; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_EDIT){ //エディット コントロール作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=35; RadInfo.DraggingRect[0].right=mouse.x+35; RadInfo.DraggingRect[0].top-=10; RadInfo.DraggingRect[0].bottom=mouse.y+11; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"EditBox","",WS_CHILD|WS_VISIBLE,WS_EX_CLIENTEDGE,CT_EDIT,0,0,1); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_GROUPBOX){ //グループ ボックス作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=42; RadInfo.DraggingRect[0].right=mouse.x+42; RadInfo.DraggingRect[0].top-=30; RadInfo.DraggingRect[0].bottom=mouse.y+30; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_HSCROLLBAR){ //水平スクロールバー作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=35; RadInfo.DraggingRect[0].right=mouse.x+35; RadInfo.DraggingRect[0].top-=8; RadInfo.DraggingRect[0].bottom=mouse.y+9; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"HScrollBar","",WS_CHILD|WS_VISIBLE|SBS_HORZ,0,CT_HSCROLLBAR,0,0,1); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_IMAGEBOX){ //イメージ ボックス作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=16; RadInfo.DraggingRect[0].right=mouse.x+16; RadInfo.DraggingRect[0].top-=16; RadInfo.DraggingRect[0].bottom=mouse.y+16; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_LISTBOX){ //リスト ボックス作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=42; RadInfo.DraggingRect[0].right=mouse.x+42; RadInfo.DraggingRect[0].top-=30; RadInfo.DraggingRect[0].bottom=mouse.y+30; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_LISTVIEW){ //リスト ビュー作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=52; RadInfo.DraggingRect[0].right=mouse.x+53; RadInfo.DraggingRect[0].top-=37; RadInfo.DraggingRect[0].bottom=mouse.y+38; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ListView","",WS_CHILD|WS_VISIBLE,WS_EX_CLIENTEDGE,CT_LISTVIEW,0,0,1); } if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_PROGRESSBAR){ //プロバレス バー作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=70; RadInfo.DraggingRect[0].right=mouse.x+70; RadInfo.DraggingRect[0].top-=10; RadInfo.DraggingRect[0].bottom=mouse.y+11; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"ProgressBar","",WS_CHILD|WS_VISIBLE,WS_EX_STATICEDGE,CT_PROGRESSBAR,0,0,1); } if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_RADIOBUTTON){ //ラジオ ボタン作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=31; RadInfo.DraggingRect[0].right=mouse.x+32; RadInfo.DraggingRect[0].top-=7; RadInfo.DraggingRect[0].bottom=mouse.y+8; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_STATIC){ //スタティック コントロール作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=25; RadInfo.DraggingRect[0].right=mouse.x+25; RadInfo.DraggingRect[0].top-=6; RadInfo.DraggingRect[0].bottom=mouse.y+6; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"Static","Text",WS_CHILD|WS_VISIBLE,0,CT_STATIC,0,0,1); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_TRACKBAR){ //トラック バー作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=87; RadInfo.DraggingRect[0].right=mouse.x+88; RadInfo.DraggingRect[0].top-=11; RadInfo.DraggingRect[0].bottom=mouse.y+12; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; 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); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_TREEVIEW){ //ツリー ビュー作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=52; RadInfo.DraggingRect[0].right=mouse.x+53; RadInfo.DraggingRect[0].top-=37; RadInfo.DraggingRect[0].bottom=mouse.y+38; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"TreeView","",WS_CHILD|WS_VISIBLE,WS_EX_CLIENTEDGE,CT_TREEVIEW,0,0,1); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_UPDOWN){ //アップ ダウン コントロール作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=8; RadInfo.DraggingRect[0].right=mouse.x+8; RadInfo.DraggingRect[0].top-=10; RadInfo.DraggingRect[0].bottom=mouse.y+11; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"UpDown","",WS_CHILD|WS_VISIBLE,0,CT_UPDOWN,0,0,1); } else if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_VSCROLLBAR){ //垂直スクロールバー作成 if(RadInfo.DraggingRect[0].left==mouse.x&&RadInfo.DraggingRect[0].top==mouse.y){ RadInfo.DraggingRect[0].left-=9; RadInfo.DraggingRect[0].right=mouse.x+9; RadInfo.DraggingRect[0].top-=30; RadInfo.DraggingRect[0].bottom=mouse.y+30; } else{ RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; } RectNaturalFormat(&RadInfo.DraggingRect[0],&rect); pos.x=rect.left-MdiInfo[i].MdiRadInfo->ClientPos.x; pos.y=rect.top-MdiInfo[i].MdiRadInfo->ClientPos.y; size.cx=rect.right-rect.left; size.cy=rect.bottom-rect.top; MdiInfo[i].MdiRadInfo->SelectingItem[0]=InsertDlgItem(i,i2,-1,&pos,&size,"VScrollBar","",WS_CHILD|WS_VISIBLE|SBS_VERT,0,CT_VSCROLLBAR,0,0,1); } SendMessage(GetWindow(MdiInfo[i].MdiRadInfo->hTools,GW_CHILD),WM_COMMAND,IDC_TOOL_MOUSE,0); SendMessage(GetWindow(GetWindow(MdiInfo[i].MdiRadInfo->hTools,GW_CHILD),GW_CHILD),TB_CHECKBUTTON,IDC_TOOL_MOUSE,TRUE); ChangePropertyWindow(i,i2); //複数選択を解除 MdiInfo[i].MdiRadInfo->SelectingItem[1]=-1; } RadInfo.NowDragging=0; ResetState_EditMenu(); return 0; case WM_MOUSEMOVE: mouse.x=(int)(short)LOWORD(lParam); mouse.y=(int)(short)HIWORD(lParam); CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); hParent=GetParent(hwnd); i=GetWndNum(hParent); i2=GetWndInfoNum(MdiInfo[i].path); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ if(wParam&MK_LBUTTON&&RadInfo.NowDragging){ //////////////////////////////////////////////// // ドラッグ中の場合(コントロールのサイズ変更) if(RadInfo.NowDragging==FRAME_UPPER_LEFT){ if(RadInfo.DraggingRect[0].right-MIN_ITEM_X<=(mouse.x+LEVER_THICK)) RadInfo.DraggingRect[0].left=RadInfo.DraggingRect[0].right-MIN_ITEM_X; else if(mouse.x+LEVER_THICKClientPos.x) RadInfo.DraggingRect[0].left=MdiInfo[i].MdiRadInfo->ClientPos.x; else RadInfo.DraggingRect[0].left=mouse.x+LEVER_THICK; if(RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y<=(mouse.y+LEVER_THICK)) RadInfo.DraggingRect[0].top=RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y; else if(mouse.y+LEVER_THICKClientPos.y) RadInfo.DraggingRect[0].top=MdiInfo[i].MdiRadInfo->ClientPos.y; else RadInfo.DraggingRect[0].top=mouse.y+LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_UPPER_RIGHT){ if(mouse.x-LEVER_THICK-MIN_ITEM_X<=RadInfo.DraggingRect[0].left) RadInfo.DraggingRect[0].right=RadInfo.DraggingRect[0].left+MIN_ITEM_X; else if(mouse.x>MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx) RadInfo.DraggingRect[0].right=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx; else RadInfo.DraggingRect[0].right=mouse.x-LEVER_THICK; if(RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y<=(mouse.y+LEVER_THICK)) RadInfo.DraggingRect[0].top=RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y; else if(mouse.y+LEVER_THICKClientPos.y) RadInfo.DraggingRect[0].top=MdiInfo[i].MdiRadInfo->ClientPos.y; else RadInfo.DraggingRect[0].top=mouse.y+LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_LOWER_LEFT){ if(RadInfo.DraggingRect[0].right-MIN_ITEM_X<=(mouse.x+LEVER_THICK)) RadInfo.DraggingRect[0].left=RadInfo.DraggingRect[0].right-MIN_ITEM_X; else if(mouse.x+LEVER_THICKClientPos.x) RadInfo.DraggingRect[0].left=MdiInfo[i].MdiRadInfo->ClientPos.x; else RadInfo.DraggingRect[0].left=mouse.x+LEVER_THICK; if(mouse.y-LEVER_THICK-MIN_ITEM_Y<=RadInfo.DraggingRect[0].top) RadInfo.DraggingRect[0].bottom=RadInfo.DraggingRect[0].top+MIN_ITEM_Y; else if(mouse.y>MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy) RadInfo.DraggingRect[0].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy; else RadInfo.DraggingRect[0].bottom=mouse.y-LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_LOWER_RIGHT){ if(mouse.x-LEVER_THICK-MIN_ITEM_X<=RadInfo.DraggingRect[0].left) RadInfo.DraggingRect[0].right=RadInfo.DraggingRect[0].left+MIN_ITEM_X; else if((mouse.x>MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW) RadInfo.DraggingRect[0].right=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx; else RadInfo.DraggingRect[0].right=mouse.x-LEVER_THICK; if(mouse.y-LEVER_THICK-MIN_ITEM_Y<=RadInfo.DraggingRect[0].top) RadInfo.DraggingRect[0].bottom=RadInfo.DraggingRect[0].top+MIN_ITEM_Y; else if((mouse.y>MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW) RadInfo.DraggingRect[0].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy; else RadInfo.DraggingRect[0].bottom=mouse.y-LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_LEFT){ if(RadInfo.DraggingRect[0].right-MIN_ITEM_X<=(mouse.x+LEVER_THICK)) RadInfo.DraggingRect[0].left=RadInfo.DraggingRect[0].right-MIN_ITEM_X; else if(mouse.x+LEVER_THICKClientPos.x) RadInfo.DraggingRect[0].left=MdiInfo[i].MdiRadInfo->ClientPos.x; else RadInfo.DraggingRect[0].left=mouse.x+LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_RIGHT){ if(mouse.x-LEVER_THICK-MIN_ITEM_X<=RadInfo.DraggingRect[0].left) RadInfo.DraggingRect[0].right=RadInfo.DraggingRect[0].left+MIN_ITEM_X; else if((mouse.x>MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW) RadInfo.DraggingRect[0].right=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx; else RadInfo.DraggingRect[0].right=mouse.x-LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_UPPER){ if(RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y<=(mouse.y+LEVER_THICK)) RadInfo.DraggingRect[0].top=RadInfo.DraggingRect[0].bottom-MIN_ITEM_Y; else if(mouse.y+LEVER_THICKClientPos.y) RadInfo.DraggingRect[0].top=MdiInfo[i].MdiRadInfo->ClientPos.y; else RadInfo.DraggingRect[0].top=mouse.y+LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_LOWER){ if(mouse.y-LEVER_THICK-MIN_ITEM_Y<=RadInfo.DraggingRect[0].top) RadInfo.DraggingRect[0].bottom=RadInfo.DraggingRect[0].top+MIN_ITEM_Y; else if((mouse.y>MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy)&&MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW) RadInfo.DraggingRect[0].bottom=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy; else RadInfo.DraggingRect[0].bottom=mouse.y-LEVER_THICK; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } else if(RadInfo.NowDragging==FRAME_INSIDE){ i3=0; while(MdiInfo[i].MdiRadInfo->SelectingItem[i3]!=-1){ i4=RadInfo.DragStartRect[i3].left+mouse.x-RadInfo.DragStartPos.x; if(i4>MdiInfo[i].MdiRadInfo->ClientPos.x){ i4=RadInfo.DragStartRect[i3].right+mouse.x-RadInfo.DragStartPos.x; if(i4ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx) i4=0; else i4-=MdiInfo[i].MdiRadInfo->ClientPos.x+MdiInfo[i].MdiRadInfo->ClientSize.cx; } else i4-=MdiInfo[i].MdiRadInfo->ClientPos.x; //i4は枠外に出たときのポインタと壁にあたったコントロールとの差 RadInfo.DraggingRect[i3].left=RadInfo.DragStartRect[i3].left+mouse.x-RadInfo.DragStartPos.x-i4; RadInfo.DraggingRect[i3].right=RadInfo.DragStartRect[i3].right+mouse.x-RadInfo.DragStartPos.x-i4; i4=RadInfo.DragStartRect[i3].top+mouse.y-RadInfo.DragStartPos.y; if(i4>MdiInfo[i].MdiRadInfo->ClientPos.y){ i4=RadInfo.DragStartRect[i3].bottom+mouse.y-RadInfo.DragStartPos.y; if(i4ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy) i4=0; else i4-=MdiInfo[i].MdiRadInfo->ClientPos.y+MdiInfo[i].MdiRadInfo->ClientSize.cy; } else i4-=MdiInfo[i].MdiRadInfo->ClientPos.y; RadInfo.DraggingRect[i3].top=RadInfo.DragStartRect[i3].top+mouse.y-RadInfo.DragStartPos.y-i4; RadInfo.DraggingRect[i3].bottom=RadInfo.DragStartRect[i3].bottom+mouse.y-RadInfo.DragStartPos.y-i4; if(MdiInfo[i].MdiRadInfo->SelectingItem[1]==-1) i4=1; else i4=0; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[i3],&RadInfo.OldDraggingRect[i3],i4); i3++; } } else if(RadInfo.NowDragging==SELECTING_FRAME){ RadInfo.DraggingRect[0].left=RadInfo.DragStartPos.x; RadInfo.DraggingRect[0].top=RadInfo.DragStartPos.y; RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } SetCursorByState(RadInfo.NowDragging); SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } else{ //ドラッグ中でないとき SetCursorByState(GetStateOfDraggingFrame(i,i2,mouse.x,mouse.y)); } } else{ //アイテム(子ウィンドウ作成中) if(wParam&MK_LBUTTON&&RadInfo.NowDragging==ITEM_MAKING){ //ドラッグ中の場合 RadInfo.DraggingRect[0].right=mouse.x; RadInfo.DraggingRect[0].bottom=mouse.y; DrawFrame(hwnd,i,i2,&RadInfo.DraggingRect[0],&RadInfo.OldDraggingRect[0],0); } } return 0; case WM_LBUTTONDBLCLK: mouse.x=LOWORD(lParam); mouse.y=HIWORD(lParam); CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); hParent=GetParent(hwnd); i=GetWndNum(hParent); i2=GetWndInfoNum(MdiInfo[i].path); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ if(MdiInfo[i].MdiRadInfo->SelectingItem[0]!=SELECT_WINDOW){ temp2[0]=0; if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_BUTTON|| ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_CHECKBOX|| ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_IMAGEBOX|| ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_RADIOBUTTON|| ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_STATIC){ sprintf(temporary,"%s_%s_Click",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName); } else if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_COMBOBOX) sprintf(temporary,"%s_%s_EditChange",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName); else if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_EDIT) sprintf(temporary,"%s_%s_Change",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName); else if(ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].Control==CT_LISTBOX) sprintf(temporary,"%s_%s_SelChange",ProjectInfo.pWindowInfo[i2].name,ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].IdName); else temporary[0]=0; if(temporary[0]) SelectProcedureOfMessageCall(i2,temporary,temp2); } } return 0; case WM_KEYDOWN: hParent=GetParent(hwnd); i=GetWndNum(hParent); i2=GetWndInfoNum(MdiInfo[i].path); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW){ PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].size; if(GetKeyState(VK_SHIFT)&0x8000){ if(wParam==VK_RIGHT||wParam==VK_LEFT||wParam==VK_DOWN||wParam==VK_UP) Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize); if(wParam==VK_RIGHT) ProjectInfo.pWindowInfo[i2].size.cx++; else if(wParam==VK_LEFT) ProjectInfo.pWindowInfo[i2].size.cx--; else if(wParam==VK_DOWN) ProjectInfo.pWindowInfo[i2].size.cy++; else if(wParam==VK_UP) ProjectInfo.pWindowInfo[i2].size.cy--; if(wParam==VK_RIGHT||wParam==VK_LEFT||wParam==VK_DOWN||wParam==VK_UP){ DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } } } else{ PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size; if(wParam==VK_RIGHT){ if(GetKeyState(VK_SHIFT)&0x8000){ Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cx++; } else{ for(i3=0;;i3++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break; PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size; Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x++; } } DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } else if(wParam==VK_LEFT){ if(GetKeyState(VK_SHIFT)&0x8000){ Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cx--; } else{ for(i3=0;;i3++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break; PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size; Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.x--; } } DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } else if(wParam==VK_UP){ if(GetKeyState(VK_SHIFT)&0x8000){ Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cy--; } else{ for(i3=0;;i3++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break; PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size; Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y--; } } DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } else if(wParam==VK_DOWN){ if(GetKeyState(VK_SHIFT)&0x8000){ Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[0],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[0]].size.cy++; } else{ for(i3=0;;i3++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break; PointAndSize.pos=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos; PointAndSize.size=ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].size; Rad_NoticeChanging(i,RAD_UNDO_POSITION,MdiInfo[i].MdiRadInfo->SelectingItem[i3],(DWORD)&PointAndSize); ProjectInfo.pWindowInfo[i2].pChildInfo[MdiInfo[i].MdiRadInfo->SelectingItem[i3]].pos.y++; } } DrawRadWindow(i,&ProjectInfo.pWindowInfo[i2]); SetStatusText(NULL); //サポートダイアログの内容をセット SetSupportDlgData(i,i2); } else if(wParam==VK_DELETE) SendMessage(hwnd,WM_COMMAND,IDM_RAD_ITEM_DELETE,0); } } return 0; case WM_SETFOCUS: i=GetWndNum(GetParent(hwnd)); if(MdiInfo[i].MdiRadInfo->ButtonSelect==NON_TOOL) MdiInfo[i].MdiRadInfo->ButtonSelect=IDC_TOOL_MOUSE; InvalidateRect(hwnd,NULL,0); return 0; case WM_KILLFOCUS: i=GetWndNum(GetParent(hwnd)); if(i==-1) return 0; //ウィンドウが破棄された場合 if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE) MdiInfo[i].MdiRadInfo->ButtonSelect=NON_TOOL; InvalidateRect(hwnd,NULL,0); return 0; case WM_PAINT: i=GetWndNum(GetParent(hwnd)); if(i==-1) return 0; //ウィンドウが初期状態の場合 i2=GetWndInfoNum(MdiInfo[i].path); ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_RANGE|SIF_POS; GetScrollInfo(hwnd,SB_VERT,&ScrollInfo); si2.cbSize=sizeof(SCROLLINFO); si2.fMask=SIF_RANGE|SIF_POS; GetScrollInfo(hwnd,SB_HORZ,&si2); hdc=BeginPaint(hwnd,&ps); BitBlt(hdc,0,0,ScreenX*2,ScreenY*2, MdiInfo[i].MdiRadInfo->hMemDC,si2.nPos,ScrollInfo.nPos,SRCCOPY); EndPaint(hwnd,&ps); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE||MdiInfo[i].MdiRadInfo->ButtonSelect==NON_TOOL) DrawSelectingRect(hwnd,i,i2,MdiInfo[i].MdiRadInfo->ButtonSelect); return 0; case WM_CONTEXTMENU: if(RadInfo.NowDragging) return 0; hParent=GetParent(hwnd); BringWindowToTop(hParent); SetFocus(hwnd); i=GetWndNum(hParent); i2=GetWndInfoNum(MdiInfo[i].path); if(MdiInfo[i].MdiRadInfo->ButtonSelect==IDC_TOOL_MOUSE){ mouse.x=LOWORD(lParam); mouse.y=HIWORD(lParam); ScreenToClient(hwnd,&mouse); CursorPos_LocalToGlobal(hwnd,&mouse.x,&mouse.y); SelectItemNumOnMouse(i,i2,mouse.x,mouse.y); InvalidateRect(hwnd,NULL,0); extern HMENU hRadMenuBase; if(MdiInfo[i].MdiRadInfo->SelectingItem[0]==SELECT_WINDOW) TrackPopupMenu(GetSubMenu(hRadMenuBase,0),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0); else TrackPopupMenu(GetSubMenu(hRadMenuBase,1),TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0); } return 0; case WM_COMMAND: switch(LOWORD(wParam)){ case IDM_RAD_WINDOW_EVENTCODE: i=GetWndNum(GetParent(hwnd)); DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_RAD_EVENTCODE),hwnd,(DLGPROC)DlgEventCode,0); break; case IDM_RAD_WINDOW_MENUEVENTCODE: i=GetWndNum(GetParent(hwnd)); DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_RAD_EVENTCODE),hwnd,(DLGPROC)DlgEventCode,1); break; case IDM_RAD_ITEM_DELETE: hParent=GetParent(hwnd); i=GetWndNum(hParent); i2=GetWndInfoNum(MdiInfo[i].path); //削除順序を考慮しなければならないので、バブルソートを行う int i5,i6; for(i5=0;;i5++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i5]==-1) break; } for(i3=0;i3i3;i4--){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i4] > MdiInfo[i].MdiRadInfo->SelectingItem[i4-1]){ i6=MdiInfo[i].MdiRadInfo->SelectingItem[i4]; MdiInfo[i].MdiRadInfo->SelectingItem[i4]= MdiInfo[i].MdiRadInfo->SelectingItem[i4-1]; MdiInfo[i].MdiRadInfo->SelectingItem[i4-1]=i6; } } } for(i3=0;;i3++){ if(MdiInfo[i].MdiRadInfo->SelectingItem[i3]==-1) break; DeleteDlgItem(i,i2,MdiInfo[i].MdiRadInfo->SelectingItem[i3],1); } for(i3=0;i3SelectingItem[i3]=-1; ResetState_EditMenu(); break; } return 0; case WM_VSCROLL: ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_POS|SIF_PAGE|SIF_RANGE; GetScrollInfo(hwnd,SB_VERT,&ScrollInfo); if(LOWORD(wParam)==SB_LINEUP) i=-20; else if(LOWORD(wParam)==SB_LINEDOWN) i=20; else if(LOWORD(wParam)==SB_PAGEUP) i=-(signed int)ScrollInfo.nPage; else if(LOWORD(wParam)==SB_PAGEDOWN) i=ScrollInfo.nPage; else if(LOWORD(wParam)==SB_THUMBTRACK) i=HIWORD(wParam)-ScrollInfo.nPos; else i=0; GetClientRect(hwnd,&rect); i=max(-ScrollInfo.nPos,min(i,ScrollInfo.nMax-rect.bottom-ScrollInfo.nPos)); if(i!=0){ ScrollInfo.nPos+=i; SetScrollInfo(hwnd,SB_VERT,&ScrollInfo,1); ScrollWindow(hwnd,0,-i,NULL,NULL); UpdateWindow(hwnd); } return 0; case WM_HSCROLL: ScrollInfo.cbSize=sizeof(SCROLLINFO); ScrollInfo.fMask=SIF_POS|SIF_PAGE|SIF_RANGE; GetScrollInfo(hwnd,SB_HORZ,&ScrollInfo); if(LOWORD(wParam)==SB_LINEUP) i=-20; else if(LOWORD(wParam)==SB_LINEDOWN) i=20; else if(LOWORD(wParam)==SB_PAGEUP) i=-(signed int)ScrollInfo.nPage; else if(LOWORD(wParam)==SB_PAGEDOWN) i=ScrollInfo.nPage; else if(LOWORD(wParam)==SB_THUMBTRACK) i=HIWORD(wParam)-ScrollInfo.nPos; else i=0; GetClientRect(hwnd,&rect); i=max(-ScrollInfo.nPos,min(i,ScrollInfo.nMax-rect.right-ScrollInfo.nPos)); if(i!=0){ ScrollInfo.nPos+=i; SetScrollInfo(hwnd,SB_HORZ,&ScrollInfo,1); ScrollWindow(hwnd,-i,0,NULL,NULL); UpdateWindow(hwnd); } return 0; case WM_SIZE: i=GetWndNum(GetParent(hwnd)); if(i==-1) break; //ウィンドウが初期状態の場合 ResetScrollbarOfRadEditor(i,LOWORD(lParam),HIWORD(lParam)); return 0; } return DefWindowProc(hwnd,message,wParam,lParam); } void ResizeToRadToolWindows(int WndNum,int weight,int height){ extern MDIINFO MdiInfo[MAX_WNDNUM]; int i,i2; RECT rect; if(height<200){ i=100; i2=100; } else{ //ツールボタンウィンドウ(長さ、i) GetClientRect(GetWindow(MdiInfo[WndNum].MdiRadInfo->hTools,GW_CHILD),&rect); if(height>rect.bottom+1) i=rect.bottom+1; else i=height; //プロパティウィンドウ(長さ、i2) GetClientRect(GetWindow(MdiInfo[WndNum].MdiRadInfo->hProperty,GW_CHILD),&rect); i2=height-i; if(i2<100){ i=height-100; i2=100; } } MoveWindow(MdiInfo[WndNum].MdiRadInfo->hTools,weight-172,0,172,i,1); MoveWindow(MdiInfo[WndNum].MdiRadInfo->hProperty,weight-172,i,172,i2,1); GetWindowRect(MdiInfo[WndNum].MdiRadInfo->hSupport,&rect); rect.right-=rect.left; rect.bottom-=rect.top; //RADウィンドウ MoveWindow(MdiInfo[WndNum].MdiRadInfo->hRad,0,0,weight-172,height-rect.bottom,1); //サポートウィンドウ MoveWindow(MdiInfo[WndNum].MdiRadInfo->hSupport,0,height-rect.bottom,weight-172,rect.bottom,1); } LRESULT CALLBACK MDIClientWindow_Rad(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ extern HWND hDocCombo; extern MDIINFO MdiInfo[MAX_WNDNUM]; extern PROJECTINFO ProjectInfo; int i,WndNum; switch(message){ case WM_CREATE: extern HICON hWindowDocumentIcon; SendMessage(hwnd,WM_SETICON,ICON_SMALL,(long)hWindowDocumentIcon); break; case WM_MDIACTIVATE: if(!lParam) return 0; i=GetWndNum((HWND)lParam); if(i==-1) return 0; //ウィンドウが初期状態の場合 i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[i].title); SendMessage(hDocCombo,CB_SETCURSEL,i,0); SetStatusText(NULL); ResetState_EditMenu(); return 0; case WM_SIZE: WndNum=GetWndNum(hwnd); if(WndNum==-1) break; ResizeToRadToolWindows(WndNum,LOWORD(lParam),HIWORD(lParam)); break; case WM_CLOSE: CloseDocWindow(GetWndNum(hwnd)); pobj_nv->bMDIZoomed=IsZoomed(hwnd); i=DefMDIChildProc(hwnd,message,wParam,lParam); //メニュー状態を設定 ResetState_DocMenu(); return i; } return DefMDIChildProc(hwnd,message,wParam,lParam); }