Esempio n. 1
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;
}
Esempio n. 2
0
void SeqPrefWin::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case OK_MSG:
			if (mOwqTable) mOwqTable->ReplacePreferences( mPreferences );
			seq_app->SetPreferences(&mPreferences);
			if (mUndoLevelCtrl) AmGlobals().SetUndoHistory(mUndoLevelCtrl->Value() );
			if (mRefreshWindows != 0) RefreshWindows();
			PostMessage(B_QUIT_REQUESTED);
			break;
		case CANCEL_MSG:
			PostMessage(B_QUIT_REQUESTED);
			break;
		case CHANGE_SKIN_MSG:
			{
				const char*		skin;
				if (msg->FindString("seq:skin", &skin) == B_OK) { 
					SetStringPref(CURRENT_SKIN_PREF, skin);
					new_skin_warning();
				}
			}
			break;
		case CHANGE_SKIN_TO_DEFAULT_MSG:
			{
				if( mPreferences.HasString(CURRENT_SKIN_PREF) ) mPreferences.RemoveData(CURRENT_SKIN_PREF);
				new_skin_warning();
			}
			break;
		case REMEMBER_OPEN_MSG:
			{
				BCheckBox*	cb = dynamic_cast<BCheckBox*>( FindView(REMEMBER_OPEN_STR) );
				if( cb ) SetBoolPref( REMEBER_OPEN_SONGS_PREF, cb->Value() );
			}
			break;
		case OPEN_BLANK_MSG:
			SetStringPref( OPEN_NEW_SONG_PREF, "blank" );
			break;
		case OPEN_FOUR_MSG:
			SetStringPref( OPEN_NEW_SONG_PREF, "channels" );
			SetInt32Pref( OPEN_NEW_SONG_CHANNEL_PREF, 2 );
			break;
		case OPEN_FILE_MSG:
			SetStringPref( OPEN_NEW_SONG_PREF, "file" );
			/* Open a file panel to select a new file.
			 */
			if (!mFilePanel ) mFilePanel = new BFilePanel(B_OPEN_PANEL, 0, 0, 0,
																false);
			if (mFilePanel->IsShowing() ) break;
			if (mFilePanel->Window() ) {
				mFilePanel->Window()->SetTitle("Select File" B_UTF8_ELLIPSIS);
			}
					
			mFilePanel->SetTarget(BMessenger(this));
			mFilePanel->SetMessage( new BMessage('nfen') );
			mFilePanel->Show();

			break;
		case 'nfen':
			{
				entry_ref	ref;
				if( msg->FindRef( "refs", &ref ) == B_OK ) {
					SetOpenNewFromFileRef( &ref );
				}
			}
			break;
		case CHANGE_UNDO_HISTORY_MSG:
			if (mUndoLevelCtrl) SetInt32Pref(UNDO_HISTORY_PREF, mUndoLevelCtrl->Value() );
			break;
		case TRACK_WIN_FOLLOW_MSG:
			if (mTrackWinFollowCtrl) SetBoolPref(TRACK_WIN_FOLLOW_PREF, mTrackWinFollowCtrl->Value() == B_CONTROL_ON);
			break;
		case TRACK_WIN_PLAY_TO_END_MSG:
			if (mTrackWinPlayToEndCtrl) SetBoolPref(TRACK_WIN_PLAY_TO_END_PREF, mTrackWinPlayToEndCtrl->Value() == B_CONTROL_ON);
			break;
		case TRACK_HEIGHT_MSG:
			if (mTrackHeightCtrl) SetInt32Pref(TRACK_HEIGHT_PREF, mTrackHeightCtrl->Value() );
			break;
		case LABEL_HEIGHT_MSG:
			if (mLabelHeightCtrl) {
				SetInt32Pref(PHRASE_LABEL_HEIGHT_PREF, mLabelHeightCtrl->Value() );
				mRefreshWindows |= SEQ_REFRESH_PHRASES;
			}
			break;
		case VIEW_ROW_SELECTED_MSG:
			FactoryRowSelected();
			break;
		default:
			inherited::MessageReceived(msg);
			break;
	}
}
Esempio n. 3
0
void Initialize(int width, int height)
{
	RECT rect;
	rect.right = width;
	rect.bottom = height;
	
	/* for Layouter*/
	float ratio[6][2] = { {0.2f, 0.5f}, {0.6f, 0.4f}, {0.2f, 0.5f},
						  {0.2f, 0.5f}, {0.6f, 0.6f}, {0.2f, 0.5f}};
	vSceneList.CreateListView(0, 0, rect.right*ratio[0][0], rect.bottom*ratio[0][1], "SceneList", hMainWnd);
	DWORD dwStyle = LVS_EX_GRIDLINES;
	ListView_SetExtendedListViewStyle(vSceneList.GetListWnd(), dwStyle);
	vSceneList.SetCallbackFunctions(SceneListNameEdit, SceneListPopup, SceneListCommand, SceneListKey, SceneListMouse, SceneListSelectedItemNotify);
	vSceneList.SetHookProcedure(SceneListHookProc);
	vSceneList.AddColumn("Scene", LVSCW_AUTOSIZE, 0);


	wingl.CCreateWindow(rect.right*ratio[0][0], 0, rect.right*ratio[1][0], rect.bottom*ratio[1][1], "OpenGL");
	wingl.CSetCallbackFunctions(LayouterKeyEvent, LayouterMouseEvent, OnDraw);//, OnIdle);
	SetParent(wingl.CGethWnd(), hMainWnd);

	vSceneObjectList.CreateListView(rect.right*ratio[0][0] + rect.right*ratio[1][0], 0, rect.right*ratio[2][0], rect.bottom*ratio[2][1], "SceneObjectList", hMainWnd);
	dwStyle = LVS_EX_GRIDLINES;
	//dwStyle = LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES;
	ListView_SetExtendedListViewStyle(vSceneObjectList.GetListWnd(), dwStyle);
	vSceneObjectList.SetCallbackFunctions(SceneObjectListNameEdit, SceneObjectListPopup, SceneObjectListCommand, SceneObjectListKey, SceneObjectListMouse, SceneObjectListSelectedItemNotify);
	vSceneObjectList.SetHookProcedure(SceneObjectListHookProc);
	vSceneObjectList.AddColumn("camera_trans", LVSCW_AUTOSIZE, 2);
	vSceneObjectList.AddColumn("interpolate", LVSCW_AUTOSIZE, 1);
	vSceneObjectList.AddColumn("Scene Object", LVSCW_AUTOSIZE, 0);


	vObjectList.CreateListView(0, rect.bottom*ratio[3][1], rect.right*ratio[3][0], rect.bottom*ratio[3][1], "ObjectList", hMainWnd);
	dwStyle = LVS_EX_GRIDLINES;
	ListView_SetExtendedListViewStyle(vObjectList.GetListWnd(), dwStyle);
	vObjectList.SetCallbackFunctions(ObjectListNameEdit, ObjectListPopup, ObjectListCommand, ObjectListKey, ObjectListMouse, ObjectListSelectedItemNotify);
	vObjectList.SetHookProcedure(ObjectListHookProc);
	vObjectList.AddColumn("Object", LVSCW_AUTOSIZE, 0);

	vTimeline.Create(hMainWnd, rect.right*ratio[3][0], rect.bottom*ratio[4][1], rect.right*ratio[4][0], rect.bottom*ratio[4][1], "Timeline");
	vTimeline.SetWndProcCallback(TimelineProc);


	vClone.CreateTreeView(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], "Clone", hMainWnd);
	vClone.SetCallbackFunctions(CloneNameEdit, NULL, NULL, CloneKey, CloneMouse, CloneSelectedItemNotify); 
	vClone.SetHookProcedure(CloneHookProc);

	LONG oldStyle = GetWindowLong(vClone.GetTreeWnd(), GWL_STYLE);
	oldStyle |= TVS_CHECKBOXES;
	SetWindowLong(vClone.GetTreeWnd(), GWL_STYLE, oldStyle);


	SceneObjectListOldWndProc = (WNDPROC)SetWindowLong(vSceneObjectList.GetListWnd(), GWL_WNDPROC, (LONG)SceneObjectListWndHookProc);
	ObjectListOldWndProc = (WNDPROC)SetWindowLong(vObjectList.GetListWnd(), GWL_WNDPROC, (LONG)ObjectListWndHookProc);
	SceneListOldWndProc = (WNDPROC)SetWindowLong(vSceneList.GetListWnd(), GWL_WNDPROC, (LONG)SceneListWndHookProc);
	CloneOldWndProc = (WNDPROC)SetWindowLong(vClone.GetTreeWnd(), GWL_WNDPROC, (LONG)CloneWndHookProc);

	/* for Timeliner*/
	vSound.CreateSoundWindow(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], "Sound", hMainWnd);
	SetParent(vSound.GetHolderWnd(), hMainWnd);

	vSynth.CreateSynthWindow(rect.right*ratio[0][0] + rect.right*ratio[1][0], 0, rect.right*ratio[2][0], rect.bottom*ratio[2][1], "Synth", hMainWnd);
	SetParent(vSynth.GetHolderWnd(), hMainWnd);
	//ksd.SetNotifyCallback(vSynth.KSynthLoadNotify);

	RefreshWindows();

	//const float lratio [2] = { 19.0f, 50.0f };
	//const float rratio[2] = { 19.0f, 50.0f };
	//const float cratio = { 100.0f - lratio[0] - rratio[0] };
	//float w[3], h[3];


	////左
	//w[0] = width /100.0*lratio[0];
	//h[0] = height/100.0*lratio[1];
	//vSceneList.CreateListView(0, 0, w[0], h[0], "SceneList", hMainWnd);
	//DWORD dwStyle = LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES;
	//ListView_SetExtendedListViewStyle(vSceneList.GetListWnd(), dwStyle);
	//vSceneList.SetCallbackFunctions(SceneListNameEdit, NULL, SceneListCommand, SceneListKey, SceneListMouse, SceneListSelectedItemNotify);
	//vSceneList.SetHookProcedure(SceneListHookProc);
	//vSceneList.AddColumn("Scene", w[0], 0);
	//ChangeWindowStyle(vSceneList.GetHolderWnd(), WS_POPUP|WS_VISIBLE);

	//vObjectList.CreateListView(0, h[0], w[0], h[0], "ObjectList", hMainWnd);
	//dwStyle = LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES;
	//ListView_SetExtendedListViewStyle(vObjectList.GetListWnd(), dwStyle);
	//vObjectList.SetCallbackFunctions(ObjectListNameEdit, ObjectListPopup, ObjectListCommand, ObjectListKey, ObjectListMouse, ObjectListSelectedItemNotify);
	//vObjectList.SetHookProcedure(ObjectListHookProc);
	//vObjectList.AddColumn("Object", w[0], 0);
	//ChangeWindowStyle(vObjectList.GetHolderWnd(), WS_POPUP|WS_VISIBLE);

	////真ん中
	//w[1] = width /100.0 * 60.0;
	//h[1] = height/100.0 * 60.0;
	//wingl.CCreateWindow(w[0]+(width/100.0*1.0f), 0, w[1], h[1], "OpenGL");
	//wingl.CSetCallbackFunctions(LayouterKeyEvent, LayouterMouseEvent, OnDraw);
	//SetParent(wingl.CGethWnd(), hMainWnd);
	//ChangeWindowStyle(wingl.CGethWnd(), WS_POPUP|WS_VISIBLE);

	//vTimeline.Create(hMainWnd, w[0]+(width/100.0*1.0f), h[1]+(height/100.0f*5.0f), w[1], height/100.0*35.0f-50, "Timeline");
	//vTimeline.SetWndProcCallback(TimelineProc);

	////右
	//w[2] = width/100.0*rratio[0];
	//h[2] = height/100.0*rratio[1];
	//vSceneObjectList.CreateListView(w[0]+(width/100.0*cratio), 0, w[2], h[2], "SceneObjectList", hMainWnd);
	//dwStyle = LVS_EX_CHECKBOXES | LVS_EX_GRIDLINES;
	//ListView_SetExtendedListViewStyle(vSceneObjectList.GetListWnd(), dwStyle);
	//vSceneObjectList.SetCallbackFunctions(SceneObjectListNameEdit, NULL, SceneObjectListCommand, SceneObjectListKey, SceneObjectListMouse, SceneObjectListSelectedItemNotify);
	//vSceneObjectList.SetHookProcedure(SceneObjectListHookProc);
	//vSceneObjectList.AddColumn("Scene Object", w[2], 0);
	//ChangeWindowStyle(vSceneObjectList.GetHolderWnd(), WS_POPUP|WS_VISIBLE);

	//vClone.CreateTreeView(w[0]+(width/100.0*cratio), h[2], w[2], h[2], "Clone", hMainWnd);
	//vClone.SetCallbackFunctions(CloneNameEdit, NULL, NULL, CloneKey, CloneMouse, CloneSelectedItemNotify); 
	//vClone.SetHookProcedure(CloneHookProc);
	//LONG oldStyle = GetWindowLong(vClone.GetTreeWnd(), GWL_STYLE);
	//oldStyle |= TVS_CHECKBOXES;
	//SetWindowLong(vClone.GetTreeWnd(), GWL_STYLE, oldStyle);
	//ChangeWindowStyle(vClone.GetHolderWnd(), WS_POPUP|WS_VISIBLE);


	//HMENU hMenu = GetMenu(hMainWnd);
	//HMENU hSub  = GetSubMenu(hMenu, 1);
	//EnableMenuItem(hSub, 0, MF_BYPOSITION|MF_GRAYED);
	//EnableMenuItem(hSub, 1, MF_BYPOSITION|MF_GRAYED);
}