//更新処理 void RefreshCloneTree(KModelEdit* mdl, const char* szModelName, int select) { //static int old_sceneobject = GetSelectedSceneObject(); //int current_sceneobject = GetSelectedSceneObject(); //if(old_sceneobject!=current_sceneobject){ // old_sceneobject = current_sceneobject //}else{ SaveItemState(); //} //以前のデータをクリア ClearCloneTree(vClone.GetTreeWnd()); //ファイル名表示部分 if(szModelName!=NULL) { char* szTitle = (char*)GlobalAlloc(GPTR, sizeof(char) * (lstrlen(szModelName)+1)); lstrcpy(szTitle, szModelName); PathStripPath(szTitle); vClone.AddItem(szTitle, 0); GlobalFree(szTitle); }else vClone.AddItem("(null)", 0); KClone** node_ptr=(KClone**)GlobalAlloc(GPTR,256*sizeof(KClone*)); KClone* kpt=mdl->GetTree(); if(kpt == NULL) return; int* node_id=(int*)GlobalAlloc(GPTR,256*sizeof(int)); int node=0; long child_end=0; node_id[node] = 1; node_ptr[node]=NULL; //NULL->child node++; node_id[node] = vClone.AddItem(kpt->clone_data.clone_name, node_id[node-1]); node_ptr[node] = kpt; while(node!=-1) { if((child_end!=1)&&(kpt->child!=NULL)){ node++; kpt = kpt->child; node_ptr[node]=kpt; child_end=0; //--copy-------------------- node_id[node] = vClone.AddItem(kpt->clone_data.clone_name, node_id[node-1]); //-------------------------- }else if(kpt->sibling!=NULL){ kpt = kpt->sibling; node_ptr[node]=kpt; child_end=0; //--copy-------------------- node_id[node] = vClone.AddItem(kpt->clone_data.clone_name, node_id[node-1]); //-------------------------- }else{ node--; kpt = node_ptr[node]; if(kpt==NULL) kpt = mdl->GetTree()->sibling; if(kpt==NULL) break; child_end=1; } } GlobalFree(node_ptr); GlobalFree(node_id); long scene = GetSelectedScene(); if(scene<0) return; long scene_object = GetSelectedSceneObject(); if(scene_object<0) return; KModelEdit* m = demo.scene[scene].sceneobj[scene_object].model; long allocnum = 0; KClone* kcl = NULL; if(m){ allocnum = m->GetCloneAllocNum(); kcl = m->GetCloneAllocPtr(); } if(kcl==NULL) return; for(int i=0; i<allocnum; i++){ vClone.SetCheck(2+i, !(kcl[i].clone_data.visible)); } //for(int i=0; i<vClone.GetItemNum(); i++) //{ // //if(i==0) continue; // KClone* p = GetKClone(i+1); // if(!p){ // continue; // } // vClone.SetCheck(i+1, !(p->clone_data.visible)); //} // } ApplyItemState(); if(select>=0){ vClone.SelectItem(select+1); } }
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); }