Fresco/Berlin/modules/Unidraw UnidrawKitImpl.cc,1.9,1.10

Tobias Hunger <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Berlin/modules/Unidraw
In directory purcel:/tmp/cvs-serv9995/Berlin/modules/Unidraw

Modified Files:
	UnidrawKitImpl.cc 
Log Message:
Cleanup the cleanup.

A new template create_and_set_body added to KitImpl. That gets us around the
need to define a temporary in most places, shortening the code even further.


Index: UnidrawKitImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Unidraw/UnidrawKitImpl.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- UnidrawKitImpl.cc	23 Jan 2003 22:31:06 -0000	1.9
+++ UnidrawKitImpl.cc	25 Jan 2003 22:37:04 -0000	1.10
@@ -60,27 +60,17 @@
 Unidraw::Tool_ptr UnidrawKitImpl::select_tool()
 {
   Graphic_var box = _figures->rectangle(0., 0., 1., 1.);
-  SelectTool *tool = new SelectTool(box);
-  activate(tool);
-  Unidraw::Tool_ptr res = tool->_this();
-  return res;
+  return create<Unidraw::Tool>(new SelectTool(box));
 }
 
 Unidraw::Editor_ptr UnidrawKitImpl::create_editor()
 {
-  EditorImpl *editor = new EditorImpl(this);
-  activate(editor);
-  Unidraw::Editor_ptr res = editor->_this();
-  return res;
+  return create<Unidraw::Editor>(new EditorImpl(this));
 }
 
 Unidraw::View_ptr UnidrawKitImpl::create_view(Graphic_ptr g, Unidraw::Model_ptr m)
 {
-  UViewImpl *view = new UViewImpl(m);
-  activate(view);
-  view->body(g);
-  Unidraw::View_ptr res = view->_this();
-  return res;
+  return create_and_set_body<Unidraw::View>(new UViewImpl(m), g);
 }
 
 Fresco::FigureKit_ptr UnidrawKitImpl::figures()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.