Пример #1
0
void EditorUI::SerializeConfig (CfgList& cfg, bool store)
{
	// Serialize editor window properties
	int x=window->x(), y=window->y(), width=window->w(), height=window->h();
	string& springTexDir = Texture::textureLoadDir;
	if (store) {
		CFG_STOREN(cfg,x);
		CFG_STOREN(cfg,y);
		CFG_STOREN(cfg,width);
		CFG_STOREN(cfg,height);
		CFG_STORE(cfg,springTexDir);
		CFG_STORE(cfg,optimizeOnLoad);
		bool showTimeline=uiTimeline->window->visible();
		CFG_STORE(cfg,showTimeline);
		bool showTrackEdit=uiAnimTrackEditor->window->visible();
		CFG_STORE(cfg,showTrackEdit);
		bool showIK=uiIK->window->visible();
		CFG_STORE(cfg,showIK);
	} else {
		CFG_LOADN(cfg,x);
		CFG_LOADN(cfg,y);
		CFG_LOADN(cfg,width);
		CFG_LOADN(cfg,height);
		CFG_LOAD(cfg,springTexDir);
		CFG_LOAD(cfg,optimizeOnLoad);

		window->resize(x,y,width,height);
	}
	// Serialize views: first match the number of views specified in the config
	int numViews = viewsGroup->children();
	if (store) {
		CFG_STOREN(cfg,numViews);
	} else {
		CFG_LOADN(cfg,numViews);
		int nv=numViews-viewsGroup->children();
		if (nv > 0) {
			viewsGroup->begin();
			for (int a=0;a<nv;a++) {
				EditorViewWindow *wnd = new EditorViewWindow (0,0,0,0,&callback);
				wnd->SetMode(a%4);
			}
			viewsGroup->end();
		} else {
			for (int a=viewsGroup->children()-1;a>=numViews;a--) {
				EditorViewWindow *wnd = (EditorViewWindow *)viewsGroup->child(a);
				viewsGroup->remove (wnd);
				delete wnd;
			}
		}
	}
	// then serialize view settings for each view in the config
	int viewIndex = 0;
	char viewName[16];
	for (int a=0;a<viewsGroup->children();++a) {
		sprintf (viewName, "View%d", viewIndex++);
		CfgList *viewcfg;
		if (store) {
			viewcfg = new CfgList;
			cfg.AddValue (viewName, viewcfg);
		}else viewcfg=dynamic_cast<CfgList*>(cfg.GetValue(viewName));
		if (viewcfg) 
			((EditorViewWindow *)viewsGroup->child(a))->Serialize (*viewcfg,store);
	}
}
Пример #2
0
void EditorViewWindow::ShowViewModifyMenu (int cx,int cy)
{
	vector <EditorViewWindow*> views=editor->GetViews ();

	const int d=ViewMergeDistance;
	EditorViewWindow *candidate = 0;

	for (uint a=0;a<views.size();a++)
	{
		EditorViewWindow *nb = views[a];
		if (nb == this) continue;

		bool hor=false,ver=false;
		if (cx < d && nb->x() + nb->w() == x()) hor = true;
		if (cx >= w()-d && nb->x () == w()+x()) hor = true;
		if (cy < d && nb->y() + nb->h() == y()) ver = true;
		if (cy >= h()-d && nb->y() == y()+h()) ver = true;

		// does it have the same vertical/horizontal dimensions?
		if ((hor && nb->h () == h() && nb->y() == y()) || 
			(ver && nb->w () == w() && nb->x() == x()))
		{
			candidate=nb;
			break;
		}
	}
	if (candidate) {
		MergeViewData mvd;
		mvd.editor = editor;
		mvd.other = candidate;
		mvd.own = this;

		fltk::Menu *p = new fltk::Menu (0,0,PopupBoxW,PopupBoxH);
		p->add ("Merge", 0, MergeViewCallback, &mvd);
		p->popup(fltk::Rectangle(cx + x(), cy + y(), PopupBoxW,PopupBoxH), 0);//"View config");
		delete p;
	}
}
Пример #3
0
template<int MapType> static void MapTypeCB(fltk::Widget* w, void *data)
{
	EditorViewWindow *wnd = (EditorViewWindow *)data;
	wnd->SetMode(MapType);
}
Пример #4
0
template<bool EditorViewWindow::*prop> static void BooleanPropCB(fltk::Widget *w,void *data) {
	EditorViewWindow *wnd = (EditorViewWindow *)data;
	wnd->*prop = !(wnd->*prop);
	wnd->redraw();
}
Пример #5
0
template<int rmode> static void RenderTypeCB(fltk::Widget* w, void *data)
{
	EditorViewWindow *wnd = (EditorViewWindow *)data;
	wnd->rendermode=rmode;
	wnd->redraw();
}