void VerifyOnExit() { if(MessageBox(hMainWnd, "Exit?", "Exit", MB_YESNO|MB_ICONQUESTION|MB_SYSTEMMODAL)==IDYES){ SetParent(vClone.GetHolderWnd(), NULL); SetParent(vSceneList.GetHolderWnd(), NULL); SetParent(vObjectList.GetHolderWnd(), NULL); SetParent(vSceneObjectList.GetHolderWnd(), NULL); PostQuitMessage(0); } }
LRESULT CALLBACK HWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { //case WM_ACTIVE: //break; case WM_KEYDOWN: case WM_KEYUP: CallWindowProc((WNDPROC)GetWindowLong(hGLWnd, GWL_WNDPROC), hGLWnd, msg, wParam, lParam); return TRUE;//オリジナルのメッセージ処理を行わないとLayouterWindow.cppが機能しない case WM_COMMAND: { switch(LOWORD(wParam)) { case ID_FILE_NEW_LAYOUT: { //long nUndoBuffer = GetUndoBufferNum(); //if(dwLastSaveTime){ // if(MBQ("This document has been modified. Save?")){ // CallWindowProc((WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC), hWnd, WM_COMMAND, ID_FILE_SAVE_OW, 0); // } //} FreeAll(); RefreshAllView(); break; } case ID_FILE_OPEN_LAYOUT: { char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024); if(GetOpenFileNameSingle(hGLWnd, "kdf", szFile, FALSE)) { lstrcpy(g_szFileName, szFile); FreeAll(); demo.Load(szFile); RefreshAllView(); } GlobalFree(szFile); break; } case ID_FILE_SAVE_OW: { if(g_szFileName[0] == '\0') { char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024); if(GetSaveFileNameSingle(hGLWnd, "kdf", szFile, FALSE)) { lstrcpy(g_szFileName, szFile); }else return TRUE; GlobalFree(szFile); } demo.Save(g_szFileName); RefreshAllView(); break; } case ID_FILE_SAVE_AS: { char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024); if(GetSaveFileNameSingle(hGLWnd, "kdf", szFile, FALSE)) { lstrcpy(g_szFileName, szFile); demo.Save(szFile); RefreshAllView(); } GlobalFree(szFile); break; } case ID_FILE_EXPORT: { char* szFile = (char*)GlobalAlloc(GPTR, sizeof(char) * 1024); if(GetSaveFileNameSingle(hGLWnd, "kdb", szFile, FALSE)) { //lstrcpy(g_szFileName, szFile); demo.BinarySave(szFile); MessageBox(hWnd, "Export done", "", MB_ICONINFORMATION|MB_OK|MB_TOPMOST); RefreshAllView(); } GlobalFree(szFile); break; } case ID_FILE_EXIT: { VerifyOnExit(); break; } case ID_EDIT_UNDO: { Undo(); break; } case ID_EDIT_REDO: { Redo(); break; } case ID_MODE_LAYOUTER: { StopPlaying(); nCurrentMode = LAYOUTER; HMENU hMenu = GetMenu(hWnd); HMENU hSub = GetSubMenu(hMenu, 2); CheckMenuItem(hSub, 1, MF_BYPOSITION|MF_UNCHECKED); CheckMenuItem(hSub, 0, MF_BYPOSITION|MF_CHECKED); //vSound.Hide(); //vSynth.Hide(); ShowWindow(vSound.GetHolderWnd(), FALSE); //ShowWindow(vTime.GetHolderWnd(), FALSE); ShowWindow(vSynth.GetHolderWnd(), FALSE); //ShowWindow(vScene.GetHolderWnd(), TRUE); ShowWindow(vClone.GetHolderWnd(), TRUE); ShowWindow(vObjectList.GetHolderWnd(), TRUE); ShowWindow(vSceneObjectList.GetHolderWnd(), TRUE); RefreshWindows(); break; } case ID_MODE_TIMELINER: { StopPlaying(); nCurrentMode = TIMELINER; HMENU hMenu = GetMenu(hWnd); HMENU hSub = GetSubMenu(hMenu, 2); CheckMenuItem(hSub, 0, MF_BYPOSITION|MF_UNCHECKED); CheckMenuItem(hSub, 1, MF_BYPOSITION|MF_CHECKED); //ShowWindow(vScene.GetHolderWnd(), FALSE; ShowWindow(vClone.GetHolderWnd(), FALSE); //ShowWindow(vSceneObjectList.GetHolderWnd(), FALSE); ShowWindow(vObjectList.GetHolderWnd(), FALSE); //vSound.Show(); //vSynth.Show(); ShowWindow(vSound.GetHolderWnd(), TRUE); //ShowWindow(vTime.GetHolderWnd(), TRUE); ShowWindow(vSynth.GetHolderWnd(), TRUE); RefreshWindows(); break; } case ID_FRAME_000: case ID_FRAME_025: case ID_FRAME_050: case ID_FRAME_075: case ID_FRAME_100: { float mul = (LOWORD(wParam) - ID_FRAME_000) * 0.25f; UpdateFrameTransparency(mul); break; } } return FALSE; } case WM_DESTROY: case WM_CLOSE: { VerifyOnExit(); return FALSE; } case WM_SIZE: { RefreshWindows(); return FALSE; } } return TRUE; }
void RefreshWindows() { if(nCurrentMode==LAYOUTER){ HWND hWndList[6] = { vSceneList.GetHolderWnd(), wingl.CGethWnd(), vSceneObjectList.GetHolderWnd(), vObjectList.GetHolderWnd() , vTimeline.GetHWnd(), vClone.GetHolderWnd()}; //float real_ratio[6][4] = { {0.0f, 0.0f, 0.1f, 0.5f}, {0.1f, 0.0f, 0.7f, 0.7125f}, {0.8f, 0.0f, 0.2f, 0.5f}, // {0.0f, 0.5f, 0.1f, 0.5f}, {0.2f, 0.8f, 0.5f, 0.15f}, {0.8f, 0.5f, 0.2f, 0.5f}}; float real_ratio[6][4] = { {0.0f, 0.8f, 0.15f, 1-0.8f}, {0.0f, 0.0f, 0.78125f, 0.8f}, {0.78125f, 0.2f, 1.0f-0.78125f, 0.3f}, {0.78125f,0.0f, 1.0f-0.78125f, 0.2f}, {0.15f, 0.8f, 0.78125f-0.15f, 0.2f}, {0.78125f, 0.5f, 1.0f-0.78125f, 0.5f} }; RECT rect; GetClientRect(hMainWnd, &rect); //上段 //SetWindowPos(hWndList[0], 0, 0, 0, rect.right*ratio[0][0], rect.bottom*ratio[0][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[0], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[0], 0, rect.right*real_ratio[0][0], rect.bottom*real_ratio[0][1], rect.right*real_ratio[0][2], rect.bottom*real_ratio[0][3], SWP_NOZORDER); //SetWindowPos(hWndList[1], 0, rect.right*ratio[0][0], 0, rect.right*ratio[1][0], rect.right*ratio[1][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[1], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[1], 0, rect.right*real_ratio[1][0], rect.bottom*real_ratio[1][1], rect.right*real_ratio[1][2], rect.bottom*real_ratio[1][3], SWP_NOZORDER); //SetWindowPos(hWndList[2], 0, rect.right*ratio[0][0]+rect.right*ratio[1][0], 0, rect.right*ratio[2][0], rect.right*ratio[2][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[2], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[2], 0, rect.right*real_ratio[2][0], rect.bottom*real_ratio[2][1], rect.right*real_ratio[2][2], rect.bottom*real_ratio[2][3], SWP_NOZORDER); //RECT t; //GetClientRect(hWndList[2], &t); //SetWindowPos(vObjectList.GetListWnd() , 0, 0, 0, t.right, t.bottom, SWP_NOZORDER|SWP_NOMOVE); //下段 //SetWindowPos(hWndList[3], 0, 0, rect.bottom*ratio[3][1], rect.right*ratio[3][0], rect.bottom*ratio[3][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[3], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[3], 0, rect.right*real_ratio[3][0], rect.bottom*real_ratio[3][1], rect.right*real_ratio[3][2], rect.bottom*real_ratio[3][3], SWP_NOZORDER); //SetWindowPos(hWndList[4], 0, rect.right*ratio[3][0], rect.bottom*ratio[4][1], rect.right*ratio[4][0], rect.bottom*ratio[4][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[4], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[4], 0, rect.right*real_ratio[4][0], rect.bottom*real_ratio[4][1], rect.right*real_ratio[4][2], rect.bottom*real_ratio[4][3], SWP_NOZORDER); //SetWindowPos(hWndList[5], 0, rect.right*ratio[3][0]+rect.right*ratio[4][0], rect.bottom*ratio[5][1], rect.right*ratio[5][0], rect.bottom*ratio[5][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[5], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[5], 0, rect.right*real_ratio[5][0], rect.bottom*real_ratio[5][1], rect.right*real_ratio[5][2], rect.bottom*real_ratio[5][3], SWP_NOZORDER); }else{ HWND hWndList[6] = { vSceneList.GetHolderWnd(), wingl.CGethWnd(), vSceneObjectList.GetHolderWnd(), vSynth.GetHolderWnd() , vTimeline.GetHWnd(), vSound.GetHolderWnd()}; //x,y, width, height float real_ratio[6][4] = { {0.0f, 0.8f, 0.15f, 1-0.8f}, {0.0f, 0.0f, 0.78125f, 0.8f}, {0.78125f, 0.40f, 1.0f-0.78125f, 0.30f},//SceneObjectList //{0.78125f, 0.40f, 1.0f-0.78125f, 0.40f},//Time {0.78125f, 0.0f, 1.0f-0.78125f, 0.40f},//Synth {0.15f, 0.8f, 0.78125f-0.15f, 0.2f}, {0.78125f, real_ratio[2][3] + real_ratio[3][3], 1.0f-0.78125f, 1.00f - real_ratio[5][1]}//Sound }; RECT rect; GetClientRect(hMainWnd, &rect); //上段 //SetWindowPos(hWndList[0], 0, 0, 0, rect.right*ratio[0][0], rect.bottom*ratio[0][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[0], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[0], 0, rect.right*real_ratio[0][0], rect.bottom*real_ratio[0][1], rect.right*real_ratio[0][2], rect.bottom*real_ratio[0][3], SWP_NOZORDER); //SetWindowPos(hWndList[1], 0, rect.right*ratio[0][0], 0, rect.right*ratio[1][0], rect.right*ratio[1][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[1], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[1], 0, rect.right*real_ratio[1][0], rect.bottom*real_ratio[1][1], rect.right*real_ratio[1][2], rect.bottom*real_ratio[1][3], SWP_NOZORDER); //SetWindowPos(hWndList[2], 0, rect.right*ratio[0][0]+rect.right*ratio[1][0], 0, rect.right*ratio[2][0], rect.right*ratio[2][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[2], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[2], 0, rect.right*real_ratio[2][0], rect.bottom*real_ratio[2][1], rect.right*real_ratio[2][2], rect.bottom*real_ratio[2][3], SWP_NOZORDER); //RECT t; //GetClientRect(hWndList[2], &t); //SetWindowPos(vObjectList.GetListWnd() , 0, 0, 0, t.right, t.bottom, SWP_NOZORDER|SWP_NOMOVE); //下段 //SetWindowPos(hWndList[3], 0, 0, rect.bottom*ratio[3][1], rect.right*ratio[3][0], rect.bottom*ratio[3][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[3], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[3], 0, rect.right*real_ratio[3][0], rect.bottom*real_ratio[3][1], rect.right*real_ratio[3][2], rect.bottom*real_ratio[3][3], SWP_NOZORDER); //SetWindowPos(hWndList[4], 0, rect.right*ratio[3][0], rect.bottom*ratio[4][1], rect.right*ratio[4][0], rect.bottom*ratio[4][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[4], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[4], 0, rect.right*real_ratio[4][0], rect.bottom*real_ratio[4][1], rect.right*real_ratio[4][2], rect.bottom*real_ratio[4][3], SWP_NOZORDER); //SetWindowPos(hWndList[5], 0, rect.right*ratio[3][0]+rect.right*ratio[4][0], rect.bottom*ratio[5][1], rect.right*ratio[5][0], rect.bottom*ratio[5][1], SWP_NOZORDER); ChangeWindowStyle(hWndList[5], WS_POPUP|WS_VISIBLE); SetWindowPos(hWndList[5], 0, rect.right*real_ratio[5][0], rect.bottom*real_ratio[5][1], rect.right*real_ratio[5][2], rect.bottom*real_ratio[5][3], SWP_NOZORDER); } }