Fresco/Berlin/modules/Desktop DesktopKitImpl.cc,1.53,1.54 DesktopKitImpl.hh,1.24,1.25 Manipulator.cc,1.13,1.14 Manipulator.hh,1.6,1.7 Pulldown.cc,1.9,1.10 Pulldown.hh,1.7,1.8 WindowImpl.cc,1.39,1.40 WindowImpl.hh,1.24,1.25
Tobias Hunger <[email protected]> Mon, 29 Dec 2003 09:12:15 +0100
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Desktop
In directory purcel:/tmp/cvs-serv30213/modules/Desktop
Modified Files:
DesktopKitImpl.cc DesktopKitImpl.hh Manipulator.cc
Manipulator.hh Pulldown.cc Pulldown.hh WindowImpl.cc
WindowImpl.hh
Log Message:
* Styleguidify Berlin
* Add namespace Berlin
Both patches are mixed into one since I did not want to commit two such
large and disruptive patches.
Index: DesktopKitImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/DesktopKitImpl.cc,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- DesktopKitImpl.cc 18 Feb 2003 21:18:12 -0000 1.53
+++ DesktopKitImpl.cc 29 Dec 2003 08:03:21 -0000 1.54
@@ -44,273 +44,299 @@
DesktopKitImpl::DesktopKitImpl(const std::string &id,
const Fresco::Kit::PropertySeq &p,
- ServerContextImpl *c)
- : KitImpl(id, p, c) { }
+ ServerContextImpl *c) :
+ KitImpl(id, p, c)
+{ }
DesktopKitImpl::~DesktopKitImpl() { }
void DesktopKitImpl::bind(ServerContext_ptr context)
{
- Trace trace("DesktopKitImpl::bind");
- KitImpl::bind(context);
- CORBA::Object_var object =
- context->get_singleton("IDL:fresco.org/Fresco/Desktop:1.0");
- my_desktop = Desktop::_narrow(object);
- my_desktop->increment();
- Fresco::Kit::PropertySeq props;
- props.length(0);
- my_layout = resolve_kit<LayoutKit>(context,
- "IDL:fresco.org/Fresco/LayoutKit:1.0",
- props);
- my_tools = resolve_kit<ToolKit>(context,
- "IDL:fresco.org/Fresco/ToolKit:1.0",
- props);
- my_widgets = resolve_kit<WidgetKit>(context,
- "IDL:fresco.org/Fresco/WidgetKit:1.0",
- props);
- my_text = resolve_kit<TextKit>(context,
- "IDL:fresco.org/Fresco/TextKit:1.0",
- props);
- my_rasters = resolve_kit<RasterKit>(context,
- "IDL:fresco.org/Fresco/RasterKit:1.0",
- props);
- my_figures = resolve_kit<FigureKit>(context,
- "IDL:fresco.org/Fresco/FigureKit:1.0",
- props);
+ Trace trace("DesktopKitImpl::bind");
+ KitImpl::bind(context);
+ CORBA::Object_var object =
+ context->get_singleton("IDL:fresco.org/Fresco/Desktop:1.0");
+ my_desktop = Desktop::_narrow(object);
+ my_desktop->increment();
+ Fresco::Kit::PropertySeq props;
+ props.length(0);
+ my_layout =
+ resolve_kit<LayoutKit>(context,
+ "IDL:fresco.org/Fresco/LayoutKit:1.0",
+ props);
+ my_tools
+ = resolve_kit<ToolKit>(context,
+ "IDL:fresco.org/Fresco/ToolKit:1.0",
+ props);
+ my_widgets
+ = resolve_kit<WidgetKit>(context,
+ "IDL:fresco.org/Fresco/WidgetKit:1.0",
+ props);
+ my_text
+ = resolve_kit<TextKit>(context,
+ "IDL:fresco.org/Fresco/TextKit:1.0",
+ props);
+ my_rasters
+ = resolve_kit<RasterKit>(context,
+ "IDL:fresco.org/Fresco/RasterKit:1.0",
+ props);
+ my_figures
+ = resolve_kit<FigureKit>(context,
+ "IDL:fresco.org/Fresco/FigureKit:1.0",
+ props);
- ClientContext_var client = context->client();
- my_exit = client->exit();
+ ClientContext_var client = context->client();
+ my_exit = client->exit();
}
Desktop_ptr DesktopKitImpl::desk()
-{
- return RefCount_var<Fresco::Desktop>::increment(my_desktop);
-}
+{ return RefCount_var<Fresco::Desktop>::increment(my_desktop); }
-Window_ptr DesktopKitImpl::shell(Controller_ptr g, Fresco::ClientContext_ptr n)
+Window_ptr DesktopKitImpl::shell(Controller_ptr g,
+ Fresco::ClientContext_ptr n)
{
- WindowImpl *window = new WindowImpl;
- activate(window);
- Window_var wptr = window->_this();
-
- Graphic_var vbox = my_layout->vbox();
- RefCount_var<Graphic> hbox = my_layout->hbox();
- Graphic_var down = my_layout->vbox();
-
- Graphic::Requisition req;
- // GraphicImpl::init_requisiton(req) not needed as we init
- // everything manualy!
- req.preserve_aspect = false;
-
- req.x.defined = true;
- req.x.minimum = 200.;
- req.x.natural = 200.;
- req.x.maximum = 200.;
- req.x.align = 0.;
-
- req.y.defined = true;
- req.y.minimum = 0.;
- req.y.natural = 0.;
- req.y.maximum = my_layout->fill();
- req.y.align = 0.;
-
- req.z.defined = false;
+ WindowImpl *window = new WindowImpl;
+ activate(window);
+ Window_var wptr = window->_this();
+
+ Graphic_var vbox = my_layout->vbox();
+ RefCount_var<Graphic> hbox = my_layout->hbox();
+ Graphic_var down = my_layout->vbox();
- Raster_var raster = my_rasters->create_raster("exit.png");
- Image_var exitgraphic = my_figures->pixmap(raster);
- Trigger_var exitbutton = my_widgets->button(exitgraphic, my_exit);
+ Graphic::Requisition req;
+ // GraphicImpl::init_requisiton(req) not needed as we init
+ // everything manualy!
+ req.preserve_aspect = false;
+
+ req.x.defined = true;
+ req.x.minimum = 200.;
+ req.x.natural = 200.;
+ req.x.maximum = 200.;
+ req.x.align = 0.;
- raster = my_rasters->create_raster("shade.png");
- Image_var shadergraphic = my_figures->pixmap(raster);
-
- RefCount_var<Fresco::Controller> shaderbutton = my_widgets->toggle(shadergraphic);
- Graphic_var visible = my_tools->create_switch(Graphic::_nil(), down,
- Controller::toggled, shaderbutton);
+ req.y.defined = true;
+ req.y.minimum = 0.;
+ req.y.natural = 0.;
+ req.y.maximum = my_layout->fill();
+ req.y.align = 0.;
- RefCount_var<Graphic> tbbuttons = my_layout->hbox();
- tbbuttons->append_graphic(shaderbutton);
- tbbuttons->append_graphic(RefCount_var<Graphic>(my_layout->hspace(20.)));
- tbbuttons->append_graphic(exitbutton);
+ req.z.defined = false;
- Command_var mover = move(wptr);
- ToolKit::FrameSpec spec;
- spec.brightness(0.5); spec._d(ToolKit::outset);
+ Raster_var raster = my_rasters->create_raster("exit.png");
+ Image_var exitgraphic = my_figures->pixmap(raster);
+ Trigger_var exitbutton = my_widgets->button(exitgraphic, my_exit);
+
+ raster = my_rasters->create_raster("shade.png");
+ Image_var shadergraphic = my_figures->pixmap(raster);
+
+ RefCount_var<Fresco::Controller> shaderbutton =
+ my_widgets->toggle(shadergraphic);
+ Graphic_var visible = my_tools->create_switch(Graphic::_nil(), down,
+ Controller::toggled,
+ shaderbutton);
- Unistring const * const title = n->application_title();
- RefCount_var<Graphic> titletext = my_text->chunk(*title);
- delete title;
+ RefCount_var<Graphic> tbbuttons = my_layout->hbox();
+ tbbuttons->append_graphic(shaderbutton);
+ tbbuttons->
+ append_graphic(RefCount_var<Graphic>(my_layout->hspace(20.)));
+ tbbuttons->append_graphic(exitbutton);
+
+ Command_var mover = move(wptr);
+ ToolKit::FrameSpec spec;
+ spec.brightness(0.5); spec._d(ToolKit::outset);
- RefCount_var<Graphic> titlebox = my_layout->hbox_align_elements(0.);
- titlebox->append_graphic(RefCount_var<Graphic>(my_layout->hfill()));
- titlebox->append_graphic(RefCount_var<Graphic>(my_tools->rgb(titletext, 0., 0., 0.)));
- titlebox->append_graphic(RefCount_var<Graphic>(my_layout->hfill()));
- titlebox->append_graphic(RefCount_var<Graphic>(my_layout->margin(tbbuttons, 20.)));
- RefCount_var<Graphic> tbframe = my_tools->frame(titlebox, 20., spec, true);
+ Unistring const * const title = n->application_title();
+ RefCount_var<Graphic> titletext = my_text->chunk(*title);
+ delete title;
- RefCount_var<Graphic> tbdragger = my_tools->dragger(tbframe, mover);
+ RefCount_var<Graphic> titlebox = my_layout->hbox_align_elements(0.);
+ titlebox->append_graphic(RefCount_var<Graphic>(my_layout->hfill()));
+ titlebox->append_graphic(RefCount_var<Graphic>(my_tools->rgb(titletext,
+ 0., 0.,
+ 0.)));
+ titlebox->append_graphic(RefCount_var<Graphic>(my_layout->hfill()));
+ titlebox->append_graphic(RefCount_var<Graphic>(my_layout->margin(tbbuttons, 20.)));
+ RefCount_var<Graphic> tbframe = my_tools->frame(titlebox, 20.,
+ spec, true);
- req.y.minimum = 40.;
- req.y.natural = 40.;
- req.y.maximum = 40.;
- Command_var lresize = move_resize(wptr, 1.0, 0.0, Window::left|Window::bottom);
- RefCount_var<Graphic> lframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> ldragger = my_tools->dragger(lframe, lresize);
+ RefCount_var<Graphic> tbdragger = my_tools->dragger(tbframe, mover);
- req.x.minimum = 0.;
- req.x.natural = 0.;
- req.x.maximum = my_layout->fill();
- req.y.minimum = 40.;
- req.y.natural = 40.;
- req.y.maximum = 40.;
- Command_var bresize = move_resize(wptr, 0.0, 0.0, Window::bottom);
- RefCount_var<Graphic> bframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> bdragger = my_tools->dragger(bframe, bresize);
+ req.y.minimum = 40.;
+ req.y.natural = 40.;
+ req.y.maximum = 40.;
+ Command_var lresize = move_resize(wptr, 1.0, 0.0,
+ Window::left|Window::bottom);
+ RefCount_var<Graphic> lframe =
+ my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> ldragger = my_tools->dragger(lframe, lresize);
- req.x.minimum = 200.;
- req.x.natural = 200.;
- req.x.maximum = 200.;
- req.y.minimum = 40.;
- req.y.natural = 40.;
- req.y.maximum = 40.;
- Command_var rresize = move_resize(wptr, 0.0, 0.0, Window::right|Window::bottom);
- RefCount_var<Graphic> rframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> rdragger = my_tools->dragger(rframe, rresize);
+ req.x.minimum = 0.;
+ req.x.natural = 0.;
+ req.x.maximum = my_layout->fill();
+ req.y.minimum = 40.;
+ req.y.natural = 40.;
+ req.y.maximum = 40.;
+ Command_var bresize = move_resize(wptr, 0.0, 0.0, Window::bottom);
+ RefCount_var<Graphic> bframe =
+ my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> bdragger = my_tools->dragger(bframe, bresize);
- hbox->append_graphic(ldragger);
- hbox->append_graphic(bdragger);
- hbox->append_graphic(rdragger);
- vbox->append_graphic(tbdragger);
+ req.x.minimum = 200.;
+ req.x.natural = 200.;
+ req.x.maximum = 200.;
+ req.y.minimum = 40.;
+ req.y.natural = 40.;
+ req.y.maximum = 40.;
+ Command_var rresize =
+ move_resize(wptr, 0.0, 0.0, Window::right|Window::bottom);
+ RefCount_var<Graphic> rframe =
+ my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> rdragger = my_tools->dragger(rframe, rresize);
- down->append_graphic(RefCount_var<Graphic>(my_layout->align(g, 0., 0.)));
- down->append_graphic(hbox);
- vbox->append_graphic(visible);
- //RefCount_var<Graphic> background = _tool->rgb(vbox, 0.827, 0.827, 0.866);
- RefCount_var<Graphic> background = my_tools->rgb(vbox, 0.8, 0.8, 0.8);
- wptr->body(background);
- /*
- * FIXME: we need to take care to include the window control elements
- * into the control graph too...
- * - stefan
- */
- wptr->append_controller(g);
- window->insert(my_desktop);
- my_desktop->append_controller(wptr);
- wptr->mapped(true);
- return wptr._retn();
+ hbox->append_graphic(ldragger);
+ hbox->append_graphic(bdragger);
+ hbox->append_graphic(rdragger);
+ vbox->append_graphic(tbdragger);
+
+ down->append_graphic(RefCount_var<Graphic>(my_layout->align(g, 0.,
+ 0.)));
+ down->append_graphic(hbox);
+ vbox->append_graphic(visible);
+ // RefCount_var<Graphic> background =
+ // my_tool->rgb(vbox, 0.827, 0.827, 0.866);
+ RefCount_var<Graphic> background = my_tools->rgb(vbox, 0.8, 0.8, 0.8);
+ wptr->body(background);
+ /*
+ * FIXME: we need to take care to include the window control elements
+ * into the control graph too...
+ * - stefan
+ */
+ wptr->append_controller(g);
+ window->insert(my_desktop);
+ my_desktop->append_controller(wptr);
+ wptr->mapped(true);
+ return wptr._retn();
}
Window_ptr DesktopKitImpl::transient(Controller_ptr g)
{
- WindowImpl *window = new WindowImpl();
- activate(window);
- Window_var wptr = window->_this();
- ToolKit::FrameSpec spec;
- spec.brightness(0.5); spec._d(ToolKit::outset);
-
- Graphic::Requisition req;
- // GraphicImpl::init_requisiton(req) not needed as we init
- // everything manualy!
- req.preserve_aspect = false;
+ WindowImpl *window = new WindowImpl();
+ activate(window);
+ Window_var wptr = window->_this();
+ ToolKit::FrameSpec spec;
+ spec.brightness(0.5); spec._d(ToolKit::outset);
- req.x.defined = true;
- req.x.minimum = 0.;
- req.x.natural = 0.;
- req.x.maximum = my_layout->fill();
- req.x.align = 0.;
+ Graphic::Requisition req;
+ // GraphicImpl::init_requisiton(req) not needed as we init
+ // everything manualy!
+ req.preserve_aspect = false;
- req.y.defined = true;
- req.y.minimum = 200.;
- req.y.natural = 200.;
- req.y.maximum = 200.;
- req.y.align = 0;
+ req.x.defined = true;
+ req.x.minimum = 0.;
+ req.x.natural = 0.;
+ req.x.maximum = my_layout->fill();
+ req.x.align = 0.;
- req.z.defined = false;
+ req.y.defined = true;
+ req.y.minimum = 200.;
+ req.y.natural = 200.;
+ req.y.maximum = 200.;
+ req.y.align = 0;
- Command_var mover = move(wptr);
- RefCount_var<Graphic> tbframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> tbdragger = my_tools->dragger(tbframe, mover);
+ req.z.defined = false;
- req.x.minimum = 200.;
- req.x.natural = 200.;
- req.x.maximum = 200.;
- req.y.minimum = 40.;
- req.y.natural = 40.;
- req.y.maximum = 40.;
- Command_var lresize = move_resize(wptr, 1.0, 0.0, Window::left|Window::bottom);
- RefCount_var<Graphic> lframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> ldragger = my_tools->dragger(lframe, lresize);
+ Command_var mover = move(wptr);
+ RefCount_var<Graphic> tbframe =
+ my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> tbdragger = my_tools->dragger(tbframe, mover);
- req.x.minimum = 0.;
- req.x.natural = 0.;
- req.x.maximum = my_layout->fill();
- req.y.minimum = 40.;
- req.y.natural = 40.;
- req.y.maximum = 40.;
- Command_var bresize = move_resize(wptr, 0.0, 0.0, Window::bottom);
- RefCount_var<Graphic> bframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> bdragger = my_tools->dragger(bframe, bresize);
+ req.x.minimum = 200.;
+ req.x.natural = 200.;
+ req.x.maximum = 200.;
+ req.y.minimum = 40.;
+ req.y.natural = 40.;
+ req.y.maximum = 40.;
+ Command_var lresize =
+ move_resize(wptr, 1.0, 0.0, Window::left|Window::bottom);
+ RefCount_var<Graphic> lframe =
+ my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> ldragger = my_tools->dragger(lframe, lresize);
- req.x.minimum = 200.;
- req.x.natural = 200.;
- req.x.maximum = 200.;
- req.y.minimum = 40.;
- req.y.natural = 40.;
- req.y.maximum = 40.;
- Command_var rresize = move_resize(wptr, 0.0, 0.0, Window::right|Window::bottom);
- RefCount_var<Graphic> rframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
- RefCount_var<Graphic> rdragger = my_tools->dragger(rframe, rresize);
+ req.x.minimum = 0.;
+ req.x.natural = 0.;
+ req.x.maximum = my_layout->fill();
+ req.y.minimum = 40.;
+ req.y.natural = 40.;
+ req.y.maximum = 40.;
+ Command_var bresize = move_resize(wptr, 0.0, 0.0, Window::bottom);
+ RefCount_var<Graphic> bframe =
+ my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> bdragger = my_tools->dragger(bframe, bresize);
- RefCount_var<Graphic> vbox = my_layout->vbox();
- RefCount_var<Graphic> background = my_tools->rgb(vbox, 0.8, 0.8, 0.8);
- RefCount_var<Graphic> hbox = my_layout->hbox();
- hbox->append_graphic(ldragger);
- hbox->append_graphic(bdragger);
- hbox->append_graphic(rdragger);
- vbox->append_graphic(tbdragger);
- vbox->append_graphic(RefCount_var<Graphic>(my_layout->align(g, 0., 0.)));
- vbox->append_graphic(hbox);
- wptr->body(background);
- /*
- * FIXME: we need to take care to include the window control elements
- * into the control graph too...
- * - stefan
- */
- wptr->append_controller(g);
- window->insert(my_desktop);
- my_desktop->append_controller(wptr);
- return wptr._retn();
+ req.x.minimum = 200.;
+ req.x.natural = 200.;
+ req.x.maximum = 200.;
+ req.y.minimum = 40.;
+ req.y.natural = 40.;
+ req.y.maximum = 40.;
+ Command_var rresize = move_resize(wptr, 0.0, 0.0,
+ Window::right|Window::bottom);
+ RefCount_var<Graphic> rframe = my_tools->frame(RefCount_var<Graphic>(my_layout->glue_requisition(req)), 20., spec, true);
+ RefCount_var<Graphic> rdragger = my_tools->dragger(rframe, rresize);
+
+ RefCount_var<Graphic> vbox = my_layout->vbox();
+ RefCount_var<Graphic> background = my_tools->rgb(vbox, 0.8, 0.8, 0.8);
+ RefCount_var<Graphic> hbox = my_layout->hbox();
+ hbox->append_graphic(ldragger);
+ hbox->append_graphic(bdragger);
+ hbox->append_graphic(rdragger);
+ vbox->append_graphic(tbdragger);
+ vbox->append_graphic(RefCount_var<Graphic>(my_layout->align(g, 0.,
+ 0.)));
+ vbox->append_graphic(hbox);
+ wptr->body(background);
+ /*
+ * FIXME: we need to take care to include the window control elements
+ * into the control graph too...
+ * - stefan
+ */
+ wptr->append_controller(g);
+ window->insert(my_desktop);
+ my_desktop->append_controller(wptr);
+ return wptr._retn();
}
Window_ptr DesktopKitImpl::pulldown(Controller_ptr g)
{
- Pulldown *menu = new Pulldown();
- activate(menu);
- Window_var wptr = menu->_this();
- ToolKit::FrameSpec spec;
- spec.brightness(0.5); spec._d(ToolKit::outset);
+ Pulldown *menu = new Pulldown();
+ activate(menu);
+ Window_var wptr = menu->_this();
+ ToolKit::FrameSpec spec;
+ spec.brightness(0.5); spec._d(ToolKit::outset);
- RefCount_var<Graphic> outset = my_tools->frame(g, 20., spec, true);
- RefCount_var<Graphic> background = my_tools->rgb(outset, 0.8, 0.8, 0.8);
- wptr->body(background);
- wptr->append_controller(g);
- menu->insert(my_desktop);
- my_desktop->append_controller(wptr);
- return wptr._retn();
+ RefCount_var<Graphic> outset = my_tools->frame(g, 20., spec, true);
+ RefCount_var<Graphic> background =
+ my_tools->rgb(outset, 0.8, 0.8, 0.8);
+ wptr->body(background);
+ wptr->append_controller(g);
+ menu->insert(my_desktop);
+ my_desktop->append_controller(wptr);
+ return wptr._retn();
}
Command_ptr DesktopKitImpl::move(Fresco::Window_ptr window)
{
- Manipulator *manipulator = new Mover(window);
- activate(manipulator);
- return manipulator->_this();
+ Manipulator *manipulator = new Mover(window);
+ activate(manipulator);
+ return manipulator->_this();
}
Command_ptr DesktopKitImpl::resize(Fresco::Window_ptr window)
{
- Manipulator *manipulator = new Resizer(window);
- activate(manipulator);
- return manipulator->_this();
+ Manipulator *manipulator = new Resizer(window);
+ activate(manipulator);
+ return manipulator->_this();
}
Command_ptr DesktopKitImpl::move_resize(Fresco::Window_ptr window,
@@ -318,30 +344,31 @@
Fresco::Alignment y,
CORBA::Short border)
{
- Manipulator *manipulator = new MoveResizer(window, my_desktop, x, y, border);
- activate(manipulator);
- return manipulator->_this();
+ Manipulator *manipulator =
+ new MoveResizer(window, my_desktop, x, y, border);
+ activate(manipulator);
+ return manipulator->_this();
}
Command_ptr DesktopKitImpl::relayer(Fresco::Window_ptr window)
{
- Manipulator *manipulator = new Relayerer(window);
- activate(manipulator);
- return manipulator->_this();
+ Manipulator *manipulator = new Relayerer(window);
+ activate(manipulator);
+ return manipulator->_this();
}
Command_ptr DesktopKitImpl::map(Fresco::Window_ptr window,
CORBA::Boolean flag)
{
- Manipulator *manipulator;
- if (flag) manipulator = new Mapper(window);
- else manipulator = new Unmapper(window);
- activate(manipulator);
- return manipulator->_this();
+ Manipulator *manipulator;
+ if (flag) manipulator = new Mapper(window);
+ else manipulator = new Unmapper(window);
+ activate(manipulator);
+ return manipulator->_this();
}
-extern "C" KitImpl *load()
+extern "C" Berlin::KitImpl *load()
{
- static std::string properties[] = {"implementation", "DesktopKitImpl"};
- return create_prototype<DesktopKitImpl> ("IDL:fresco.org/Fresco/DesktopKit:1.0", properties, 2);
+ static std::string properties[] = {"implementation", "DesktopKitImpl"};
+ return Berlin::create_prototype<DesktopKitImpl> ("IDL:fresco.org/Fresco/DesktopKit:1.0", properties, 2);
}
Index: DesktopKitImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/DesktopKitImpl.hh,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- DesktopKitImpl.hh 18 Feb 2003 21:18:12 -0000 1.24
+++ DesktopKitImpl.hh 29 Dec 2003 08:03:21 -0000 1.25
@@ -19,8 +19,8 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _DesktopKitImpl_hh
-#define _DesktopKitImpl_hh
+#ifndef _DesktopKit_DesktopKitImpl_hh
+#define _DesktopKit_DesktopKitImpl_hh
#include <Fresco/config.hh>
#include <Fresco/DesktopKit.hh>
@@ -37,45 +37,51 @@
namespace Berlin
{
-namespace DesktopKit
-{
+ namespace DesktopKit
+ {
-class WindowImpl;
-class DesktopImpl;
+ class WindowImpl;
+ class DesktopImpl;
-class DesktopKitImpl : public virtual POA_Fresco::DesktopKit,
- public KitImpl
-{
-public:
- DesktopKitImpl(const std::string &,
- const Fresco::Kit::PropertySeq &,
- ServerContextImpl *);
- virtual ~DesktopKitImpl();
- virtual KitImpl *clone(const Fresco::Kit::PropertySeq &p, ServerContextImpl *c)
- { return new DesktopKitImpl(repo_id(), p, c);}
- virtual void bind(Fresco::ServerContext_ptr);
- virtual Fresco::Desktop_ptr desk();
- virtual Fresco::Window_ptr shell(Fresco::Controller_ptr, Fresco::ClientContext_ptr);
- virtual Fresco::Window_ptr transient(Fresco::Controller_ptr);
- virtual Fresco::Window_ptr pulldown(Fresco::Controller_ptr);
+ class DesktopKitImpl : public virtual POA_Fresco::DesktopKit,
+ public KitImpl
+ {
+ public:
+ DesktopKitImpl(const std::string &,
+ const Fresco::Kit::PropertySeq &,
+ ServerContextImpl *);
+ virtual ~DesktopKitImpl();
+ virtual Berlin::KitImpl *clone(const Fresco::Kit::PropertySeq &p,
+ ServerContextImpl *c)
+ { return new DesktopKitImpl(repo_id(), p, c); }
+ virtual void bind(Fresco::ServerContext_ptr);
+ virtual Fresco::Desktop_ptr desk();
+ virtual Fresco::Window_ptr shell(Fresco::Controller_ptr,
+ Fresco::ClientContext_ptr);
+ virtual Fresco::Window_ptr transient(Fresco::Controller_ptr);
+ virtual Fresco::Window_ptr pulldown(Fresco::Controller_ptr);
- virtual Fresco::Command_ptr move(Fresco::Window_ptr);
- virtual Fresco::Command_ptr resize(Fresco::Window_ptr);
- virtual Fresco::Command_ptr move_resize(Fresco::Window_ptr, Fresco::Alignment, Fresco::Alignment, CORBA::Short);
- virtual Fresco::Command_ptr relayer(Fresco::Window_ptr);
- virtual Fresco::Command_ptr map(Fresco::Window_ptr, CORBA::Boolean);
- private:
- RefCount_var<Fresco::Desktop> my_desktop;
- RefCount_var<Fresco::LayoutKit> my_layout;
- RefCount_var<Fresco::ToolKit> my_tools;
- RefCount_var<Fresco::WidgetKit> my_widgets;
- RefCount_var<Fresco::TextKit> my_text;
- RefCount_var<Fresco::RasterKit> my_rasters;
- RefCount_var<Fresco::FigureKit> my_figures;
- Fresco::Command_var my_exit;
-};
+ virtual Fresco::Command_ptr move(Fresco::Window_ptr);
+ virtual Fresco::Command_ptr resize(Fresco::Window_ptr);
+ virtual Fresco::Command_ptr move_resize(Fresco::Window_ptr,
+ Fresco::Alignment,
+ Fresco::Alignment,
+ CORBA::Short);
+ virtual Fresco::Command_ptr relayer(Fresco::Window_ptr);
+ virtual Fresco::Command_ptr map(Fresco::Window_ptr,
+ CORBA::Boolean);
+ private:
+ RefCount_var<Fresco::Desktop> my_desktop;
+ RefCount_var<Fresco::LayoutKit> my_layout;
+ RefCount_var<Fresco::ToolKit> my_tools;
+ RefCount_var<Fresco::WidgetKit> my_widgets;
+ RefCount_var<Fresco::TextKit> my_text;
+ RefCount_var<Fresco::RasterKit> my_rasters;
+ RefCount_var<Fresco::FigureKit> my_figures;
+ Fresco::Command_var my_exit;
+ };
-} // namespace
+ } // namespace
} // namespace
#endif
Index: Manipulator.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/Manipulator.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Manipulator.cc 5 Jan 2003 16:21:29 -0000 1.13
+++ Manipulator.cc 29 Dec 2003 08:03:21 -0000 1.14
@@ -33,135 +33,157 @@
void Mover::execute(const CORBA::Any &any)
{
- OriginatedDelta *od;
- if (any >>= od)
+ OriginatedDelta *od;
+ if (any >>= od)
{
- Vertex p = window->position();
- window->position(p + od->delta);
+ Vertex p = my_window->position();
+ my_window->position(p + od->delta);
}
- else std::cerr << "Mover::execute : wrong message type !" << std::endl;
+ else
+ std::cerr << "Mover::execute : wrong message type !" << std::endl;
}
void Resizer::execute(const CORBA::Any &any)
{
- OriginatedDelta *od;
- if (any >>= od)
+ OriginatedDelta *od;
+ if (any >>= od)
{
- Vertex s = window->size();
- Graphic::Requisition r;
- // We need to initialise manually:-(
- r.x.defined = false;
- r.y.defined = false;
- r.z.defined = false;
- r.preserve_aspect = false;
-
- window->request(r);
- if (r.x.defined)
+ Vertex s = my_window->size();
+ Graphic::Requisition r;
+ // We need to initialise manually:-(
+ r.x.defined = false;
+ r.y.defined = false;
+ r.z.defined = false;
+ r.preserve_aspect = false;
+
+ my_window->request(r);
+ if (r.x.defined)
{
- if (od->delta.x > 0.) s.x = std::min(s.x + od->delta.x, r.x.maximum);
- else s.x = std::max(s.x + od->delta.x, r.x.minimum);
+ if (od->delta.x > 0.)
+ s.x = std::min(s.x + od->delta.x, r.x.maximum);
+ else
+ s.x = std::max(s.x + od->delta.x, r.x.minimum);
}
- else s.x += od->delta.x;
- if (r.y.defined)
+ else s.x += od->delta.x;
+ if (r.y.defined)
{
- if (od->delta.y > 0.) s.y = std::min(s.y + od->delta.y, r.y.maximum);
- else s.y = std::max(s.y + od->delta.y, r.y.minimum);
+ if (od->delta.y > 0.)
+ s.y = std::min(s.y + od->delta.y, r.y.maximum);
+ else
+ s.y = std::max(s.y + od->delta.y, r.y.minimum);
}
- else s.y += od->delta.y;
- window->size(s);
+ else s.y += od->delta.y;
+ my_window->size(s);
}
- else std::cerr << "Resizer::execute : wrong message type !" << std::endl;
+ else std::cerr << "Resizer::execute: wrong message type !"
+ << std::endl;
}
-MoveResizer::MoveResizer(Window_ptr window, Desktop_ptr d, Alignment x, Alignment y, CORBA::Short b)
- : Manipulator(window), desktop(Desktop::_duplicate(d)), xalign(x), yalign(y), border(b) {}
+MoveResizer::MoveResizer(Window_ptr window, Desktop_ptr d,
+ Alignment x, Alignment y, CORBA::Short b) :
+ Manipulator(window),
+ my_desktop(Desktop::_duplicate(d)),
+ my_xalign(x),
+ my_yalign(y),
+ my_border(b)
+{ }
void MoveResizer::execute(const CORBA::Any &any)
{
-
- // We need to check now whether the origin + delta are > the left
- // side when resizing the right side.
- // Vice versa for the other side. And then top + bottom.
- Trace trace("MoveResizer::execute");
- OriginatedDelta *od;
- if (any >>= od)
+
+ // We need to check now whether the origin + delta are > the left
+ // side when resizing the right side.
+ // Vice versa for the other side. And then top + bottom.
+ Trace trace("MoveResizer::execute");
+ OriginatedDelta *od;
+ if (any >>= od)
{
- Fresco::Graphic::Requisition r;
- // We need to initialise manually:-(
- r.x.defined = false;
- r.y.defined = false;
- r.z.defined = false;
- r.preserve_aspect = false;
+ Fresco::Graphic::Requisition r;
+ // We need to initialise manually:-(
+ r.x.defined = false;
+ r.y.defined = false;
+ r.z.defined = false;
+ r.preserve_aspect = false;
- window->request(r);
- Vertex pos = window->position();
- Vertex size = window->size();
- Vertex p = pos, s = size;
- Logger::log(Logger::desktop) << "od: " << (od->delta.x +
- od->origin.x) <<
- ", p: " << (p.x + r.x.minimum) << std::endl;
- if (border & Fresco::Window::left && xalign != 0.)
+ my_window->request(r);
+ Vertex pos = my_window->position();
+ Vertex size = my_window->size();
+ Vertex p = pos, s = size;
+ Logger::log(Logger::desktop)
+ << "od: " << (od->delta.x + od->origin.x)
+ << ", p: " << (p.x + r.x.minimum) << std::endl;
+ if (my_border & Fresco::Window::left && my_xalign != 0.)
{
- if ((od->delta.x > 0 &&
- od->delta.x + od->origin.x >= p.x)
- ||
- (od->delta.x < 0 &&
- od->delta.x + od->origin.x <= p.x)
- ) {
- s.x = std::min(r.x.maximum, std::max(r.x.minimum, size.x - od->delta.x/xalign));
- p.x = pos.x - xalign * (s.x - size.x);
- }
+ if ((od->delta.x > 0 &&
+ od->delta.x + od->origin.x >= p.x) ||
+ (od->delta.x < 0 &&
+ od->delta.x + od->origin.x <= p.x))
+ {
+ s.x = std::min(r.x.maximum,
+ std::max(r.x.minimum,
+ size.x - od->delta.x/my_xalign));
+ p.x = pos.x - my_xalign * (s.x - size.x);
+ }
}
- else if (border & Fresco::Window::right && xalign != 1.)
+ else if (my_border & Fresco::Window::right && my_xalign != 1.)
{
- if ((od->delta.x > 0 &&
- od->delta.x + od->origin.x >= p.x + size.x)
- ||
- (od->delta.x < 0 &&
- od->delta.x + od->origin.x <= p.x + size.x)
- ) {
- s.x = std::min(r.x.maximum, std::max(r.x.minimum, size.x + od->delta.x/(1.-xalign)));
- p.x = pos.x - xalign * (s.x - size.x);
- }
+ if ((od->delta.x > 0 &&
+ od->delta.x + od->origin.x >= p.x + size.x) ||
+ (od->delta.x < 0 &&
+ od->delta.x + od->origin.x <= p.x + size.x)
+ )
+ {
+ s.x = std::min(r.x.maximum,
+ std::max(r.x.minimum, size.x + od->delta.x/
+ (1.-my_xalign)));
+ p.x = pos.x - my_xalign * (s.x - size.x);
+ }
}
- if (border & Fresco::Window::top && yalign != 0.)
+ if (my_border & Fresco::Window::top && my_yalign != 0.)
{
- if ((od->delta.y > 0 &&
- od->delta.y + od->origin.y >= p.y)
- ||
- (od->delta.y < 0 &&
- od->delta.y + od->origin.y <= p.y)
- ) {
- s.y = std::min(r.y.maximum, std::max(r.y.minimum, size.y - od->delta.y/yalign));
- p.y = pos.y - yalign * (s.y - size.y);
- }
+ if ((od->delta.y > 0 &&
+ od->delta.y + od->origin.y >= p.y) ||
+ (od->delta.y < 0 && od->delta.y + od->origin.y <= p.y))
+ {
+ s.y = std::min(r.y.maximum,
+ std::max(r.y.minimum,
+ size.y - od->delta.y/my_yalign));
+ p.y = pos.y - my_yalign * (s.y - size.y);
+ }
}
- else if (border & Fresco::Window::bottom && yalign != 1.)
+ else if (my_border & Fresco::Window::bottom && my_yalign != 1.)
{
- if ((od->delta.y > 0 &&
- od->delta.y + od->origin.y >= p.y + size.y)
- ||
- (od->delta.y < 0 &&
- od->delta.y + od->origin.y <= p.y + size.y)
- ) {
- s.y = std::min(r.y.maximum, std::max(r.y.minimum, size.y + od->delta.y/(1.-yalign)));
- p.y = pos.y - yalign * (s.y - size.y);
- }
+ if ((od->delta.y > 0 &&
+ od->delta.y + od->origin.y >= p.y + size.y) ||
+ (od->delta.y < 0 &&
+ od->delta.y + od->origin.y <= p.y + size.y))
+ {
+ s.y = std::min(r.y.maximum,
+ std::max(r.y.minimum, size.y + od->delta.y/
+ (1.-my_yalign)));
+ p.y = pos.y - my_yalign * (s.y - size.y);
+ }
}
- desktop->lock();
- window->position(p);
- window->size(s);
- desktop->unlock();
+ my_desktop->lock();
+ my_window->position(p);
+ my_window->size(s);
+ my_desktop->unlock();
}
- else std::cerr << "MoveResizer::execute : wrong message type !" << std::endl;
+ else
+ std::cerr << "MoveResizer::execute : wrong message type !"
+ << std::endl;
}
void Relayerer::execute(const CORBA::Any &any)
{
- Layout::Stage::Index i;
- if (any >>= i) window->layer(i);
- else std::cerr << "Relayerer::execute : wrong message type !" << std::endl;
+ Layout::Stage::Index i;
+ if (any >>= i)
+ my_window->layer(i);
+ else
+ std::cerr << "Relayerer::execute : wrong message type !"
+ << std::endl;
}
-void Mapper::execute(const CORBA::Any &) { window->mapped(true);}
-void Unmapper::execute(const CORBA::Any &) { window->mapped(false);}
+void Mapper::execute(const CORBA::Any &)
+{ my_window->mapped(true); }
+void Unmapper::execute(const CORBA::Any &) { my_window->mapped(false); }
Index: Manipulator.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/Manipulator.hh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Manipulator.hh 5 Jan 2003 16:21:29 -0000 1.6
+++ Manipulator.hh 29 Dec 2003 08:03:21 -0000 1.7
@@ -19,8 +19,8 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _Manipulator_hh
-#define _Manipulator_hh
+#ifndef _DesktopKit_Manipulator_hh
+#define _DesktopKit_Manipulator_hh
#include <Prague/Sys/Tracer.hh>
#include <Fresco/config.hh>
@@ -29,66 +29,72 @@
#include <Berlin/CommandImpl.hh>
#include <Berlin/RefCountVar.hh>
-namespace Berlin {
-namespace DesktopKit {
-
-class Manipulator : public CommandImpl
+namespace Berlin
{
-public:
- Manipulator(Fresco::Window_ptr w) : window(Fresco::Window::_duplicate(w)) {}
- virtual ~Manipulator() { Prague::Trace trace("Manipulator::~Manipulator");}
- virtual void execute(const CORBA::Any &) = 0;
-protected:
- Fresco::Window_var window;
-};
+ namespace DesktopKit
+ {
-class Mover : public Manipulator
-{
-public:
- Mover(Fresco::Window_ptr window) : Manipulator(window) {}
- virtual void execute(const CORBA::Any &);
-};
+ class Manipulator : public CommandImpl
+ {
+ public:
+ Manipulator(Fresco::Window_ptr w) :
+ my_window(Fresco::Window::_duplicate(w))
+ { }
+ virtual ~Manipulator()
+ { Prague::Trace trace("Manipulator::~Manipulator"); }
+ virtual void execute(const CORBA::Any &) = 0;
+ protected:
+ Fresco::Window_var my_window;
+ };
-class Resizer : public Manipulator
-{
-public:
- Resizer(Fresco::Window_ptr window) : Manipulator(window) {}
- virtual void execute(const CORBA::Any &);
-};
+ class Mover : public Manipulator
+ {
+ public:
+ Mover(Fresco::Window_ptr window) : Manipulator(window) { }
+ virtual void execute(const CORBA::Any &);
+ };
-class MoveResizer : public Manipulator
-{
-public:
- MoveResizer(Fresco::Window_ptr, Fresco::Desktop_ptr, Fresco::Alignment, Fresco::Alignment, CORBA::Short);
- virtual void execute(const CORBA::Any &);
-private:
- Fresco::Desktop_var desktop;
- Fresco::Alignment xalign, yalign;
- CORBA::Short border;
-};
+ class Resizer : public Manipulator
+ {
+ public:
+ Resizer(Fresco::Window_ptr window) : Manipulator(window) {}
+ virtual void execute(const CORBA::Any &);
+ };
-class Relayerer: public Manipulator
-{
-public:
- Relayerer(Fresco::Window_ptr window) : Manipulator(window) {}
- virtual void execute(const CORBA::Any &);
-};
+ class MoveResizer : public Manipulator
+ {
+ public:
+ MoveResizer(Fresco::Window_ptr, Fresco::Desktop_ptr,
+ Fresco::Alignment, Fresco::Alignment, CORBA::Short);
+ virtual void execute(const CORBA::Any &);
+ private:
+ Fresco::Desktop_var my_desktop;
+ Fresco::Alignment my_xalign, my_yalign;
+ CORBA::Short my_border;
+ };
-class Mapper : public Manipulator
-{
-public:
- Mapper(Fresco::Window_ptr window) : Manipulator(window) {}
- virtual void execute(const CORBA::Any &);
-};
+ class Relayerer: public Manipulator
+ {
+ public:
+ Relayerer(Fresco::Window_ptr window) : Manipulator(window) {}
+ virtual void execute(const CORBA::Any &);
+ };
-class Unmapper : public Manipulator
-{
-public:
- Unmapper(Fresco::Window_ptr window) : Manipulator(window) {}
- virtual void execute(const CORBA::Any &);
-};
+ class Mapper : public Manipulator
+ {
+ public:
+ Mapper(Fresco::Window_ptr window) : Manipulator(window) {}
+ virtual void execute(const CORBA::Any &);
+ };
-} // namespace
+ class Unmapper : public Manipulator
+ {
+ public:
+ Unmapper(Fresco::Window_ptr window) : Manipulator(window) {}
+ virtual void execute(const CORBA::Any &);
+ };
+
+ } // namespace
} // namespace
#endif
Index: Pulldown.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/Pulldown.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Pulldown.cc 5 Jan 2003 16:21:29 -0000 1.9
+++ Pulldown.cc 29 Dec 2003 08:03:21 -0000 1.10
@@ -31,29 +31,27 @@
CORBA::Boolean Pulldown::receive_focus(Fresco::Focus_ptr focus)
{
- Trace trace("Pulldown::receive_focus");
- // Make sure we're mapped for keyboard focus
- if (focus->device() == 0)
- mapped(true);
+ Trace trace("Pulldown::receive_focus");
+ // Make sure we're mapped for keyboard focus
+ if (focus->device() == 0)
+ mapped(true);
- return WindowImpl::receive_focus(focus);
+ return WindowImpl::receive_focus(focus);
}
void Pulldown::lose_focus(Input::Device device)
{
- Trace trace("Pulldown::lose_focus");
- if (device == 0)
- mapped(false);
-
- WindowImpl::lose_focus(device);
+ Trace trace("Pulldown::lose_focus");
+ if (device == 0)
+ mapped(false);
+
+ WindowImpl::lose_focus(device);
}
void Pulldown::mapped(CORBA::Boolean flag)
{
- Trace trace("Pulldown::mapped");
- /*
- * make sure we get focus before we are mapped
- */
+ Trace trace("Pulldown::mapped");
+ // make sure we get focus before we are mapped
// if (!flag || request_focus(Controller_var(_this()), 1))
WindowImpl::mapped(flag);
}
Index: Pulldown.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/Pulldown.hh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Pulldown.hh 5 Jan 2003 16:21:29 -0000 1.7
+++ Pulldown.hh 29 Dec 2003 08:03:21 -0000 1.8
@@ -19,23 +19,25 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _Pulldown_hh
-#define _Pulldown_hh
+#ifndef _DesktopKit_Pulldown_hh
+#define _DesktopKit_Pulldown_hh
#include "WindowImpl.hh"
-namespace Berlin {
-namespace DesktopKit {
-
-class Pulldown : public WindowImpl
+namespace Berlin
{
-public:
- virtual CORBA::Boolean receive_focus(Fresco::Focus_ptr);
- virtual void lose_focus(Fresco::Input::Device);
- virtual void mapped(CORBA::Boolean);
-};
+ namespace DesktopKit
+ {
-} // namespace
+ class Pulldown : public WindowImpl
+ {
+ public:
+ virtual CORBA::Boolean receive_focus(Fresco::Focus_ptr);
+ virtual void lose_focus(Fresco::Input::Device);
+ virtual void mapped(CORBA::Boolean);
+ };
+
+ } // namespace
} // namespace
#endif
Index: WindowImpl.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/WindowImpl.cc,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- WindowImpl.cc 23 Jan 2003 22:31:03 -0000 1.39
+++ WindowImpl.cc 29 Dec 2003 08:03:21 -0000 1.40
@@ -31,33 +31,30 @@
using namespace Berlin::DesktopKit;
-class WindowImpl::UnmappedStageHandle : public virtual POA_Layout::StageHandle,
- public virtual ServantBase
+class WindowImpl::UnmappedStageHandle :
+ public virtual POA_Layout::StageHandle, public virtual ServantBase
{
-public:
- UnmappedStageHandle(Stage_ptr,
- Graphic_ptr,
- const Vertex &,
- const Vertex &,
- Stage::Index);
- UnmappedStageHandle(StageHandle_ptr);
- virtual ~UnmappedStageHandle();
- virtual Stage_ptr parent() { return Stage::_duplicate(_parent);}
- virtual Graphic_ptr child() { return Fresco::Graphic::_duplicate(_child);}
- virtual void remove() {}
- virtual Vertex position() { return _position;}
- virtual void position(const Vertex &pp) { _position = pp;}
- virtual Vertex size() { return _size;}
- virtual void size(const Vertex &ss) { _size = ss;}
- virtual Stage::Index layer() { return _layer;}
- virtual void layer(Stage::Index ll) { _layer = ll;}
-
+ public:
+ UnmappedStageHandle(Stage_ptr, Graphic_ptr, const Vertex &,
+ const Vertex &, Stage::Index);
+ UnmappedStageHandle(StageHandle_ptr);
+ virtual ~UnmappedStageHandle();
+ virtual Stage_ptr parent() { return Stage::_duplicate(my_parent); }
+ virtual Graphic_ptr child()
+ { return Fresco::Graphic::_duplicate(my_child); }
+ virtual void remove() { }
+ virtual Vertex position() { return my_position; }
+ virtual void position(const Vertex &pp) { my_position = pp; }
+ virtual Vertex size() { return my_size; }
+ virtual void size(const Vertex &ss) { my_size = ss; }
+ virtual Stage::Index layer() { return my_layer; }
+ virtual void layer(Stage::Index ll) { my_layer = ll; }
private:
- Stage_var _parent;
- Graphic_var _child;
- Vertex _position;
- Vertex _size;
- Stage::Index _layer;
+ Stage_var my_parent;
+ Graphic_var my_child;
+ Vertex my_position;
+ Vertex my_size;
+ Stage::Index my_layer;
};
WindowImpl::UnmappedStageHandle::UnmappedStageHandle(Stage_ptr par,
@@ -65,161 +62,157 @@
const Vertex &pp,
const Vertex &ss,
Stage::Index ll) :
- _parent(Stage::_duplicate(par)),
- _child(Fresco::Graphic::_duplicate(cc)),
- _position(pp),
- _size(ss),
- _layer(ll) { }
+ my_parent(Stage::_duplicate(par)),
+ my_child(Fresco::Graphic::_duplicate(cc)),
+ my_position(pp),
+ my_size(ss),
+ my_layer(ll)
+{ }
WindowImpl::UnmappedStageHandle::UnmappedStageHandle(StageHandle_ptr handle) :
- _parent(handle->parent()),
- _child(handle->child()),
- _position(handle->position()),
- _size(handle->size()),
- _layer(handle->layer()) { }
+ my_parent(handle->parent()),
+ my_child(handle->child()),
+ my_position(handle->position()),
+ my_size(handle->size()),
+ my_layer(handle->layer())
+{ }
WindowImpl::UnmappedStageHandle::~UnmappedStageHandle()
-{
- Trace trace("UnmappedStageHandle::~UnmappedStageHandle");
-}
+{ Trace trace("UnmappedStageHandle::~UnmappedStageHandle"); }
-WindowImpl::WindowImpl()
- : ControllerImpl(false)
-{
- Trace trace("WindowImpl::WindowImpl");
-}
+WindowImpl::WindowImpl() : ControllerImpl(false)
+{ Trace trace("WindowImpl::WindowImpl"); }
WindowImpl::~WindowImpl()
{
- Trace trace("WindowImpl::~WindowImpl");
- mapped(false);
+ Trace trace("WindowImpl::~WindowImpl");
+ mapped(false);
}
void WindowImpl::need_resize()
{
- Trace trace("WindowImpl::need_resize");
- Vertex size = _handle->size();
- Fresco::Graphic::Requisition r;
- GraphicImpl::init_requisition(r);
- request(r);
- if (r.x.minimum <= size.x && r.x.maximum >= size.x &&
- r.y.minimum <= size.y && r.y.maximum >= size.y &&
- r.z.minimum <= size.z && r.z.maximum >= size.z)
- need_redraw();
- else
+ Trace trace("WindowImpl::need_resize");
+ Vertex size = my_handle->size();
+ Fresco::Graphic::Requisition r;
+ GraphicImpl::init_requisition(r);
+ request(r);
+ if (r.x.minimum <= size.x && r.x.maximum >= size.x &&
+ r.y.minimum <= size.y && r.y.maximum >= size.y &&
+ r.z.minimum <= size.z && r.z.maximum >= size.z)
+ need_redraw();
+ else
{
- size.x = std::min(r.x.maximum, std::max(r.x.minimum, size.x));
- size.y = std::min(r.y.maximum, std::max(r.y.minimum, size.y));
- size.z = std::min(r.z.maximum, std::max(r.z.minimum, size.z));
- _handle->size(size);
+ size.x = std::min(r.x.maximum, std::max(r.x.minimum, size.x));
+ size.y = std::min(r.y.maximum, std::max(r.y.minimum, size.y));
+ size.z = std::min(r.z.maximum, std::max(r.z.minimum, size.z));
+ my_handle->size(size);
}
}
-/*
- * cache the focus holding controllers so we can restore them when the window
- * receives focus again...
- */
-CORBA::Boolean WindowImpl::request_focus(Controller_ptr c, Fresco::Input::Device d)
+// cache the focus holding controllers so we can restore them when the
+// window receives focus again...
+CORBA::Boolean WindowImpl::request_focus(Controller_ptr c,
+ Fresco::Input::Device d)
{
- if (_unmapped) return false;
- Controller_var parent = parent_controller();
- if (CORBA::is_nil(parent)) return false;
- if (parent->request_focus(c, d))
+ if (my_unmapped) return false;
+ Controller_var parent = parent_controller();
+ if (CORBA::is_nil(parent)) return false;
+ if (parent->request_focus(c, d))
{
- if (_focus.size() <= d) _focus.resize(d + 1);
- _focus[d] = Fresco::Controller::_duplicate(c);
- return true;
+ if (my_focus.size() <= d) my_focus.resize(d + 1);
+ my_focus[d] = Fresco::Controller::_duplicate(c);
+ return true;
}
- else return false;
+ else return false;
}
void WindowImpl::insert(Desktop_ptr desktop)
{
- Trace trace("WindowImpl::insert");
- Vertex position, size;
- position.x = position.y = 100., position.z = 0.;
- Fresco::Graphic::Requisition r;
- GraphicImpl::init_requisition(r);
- request(r);
- size.x = r.x.natural, size.y = r.y.natural, size.z = 0;
- _unmapped = new UnmappedStageHandle(desktop,
- Graphic_var(_this()),
- position,
- size,
- 0);
- _handle = _unmapped->_this();
+ Trace trace("WindowImpl::insert");
+ Vertex position, size;
+ position.x = position.y = 100., position.z = 0.;
+ Fresco::Graphic::Requisition r;
+ GraphicImpl::init_requisition(r);
+ request(r);
+ size.x = r.x.natural, size.y = r.y.natural, size.z = 0;
+ my_unmapped = new UnmappedStageHandle(desktop,
+ Graphic_var(_this()),
+ position,
+ size,
+ 0);
+ my_handle = my_unmapped->_this();
}
Vertex WindowImpl::position()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _handle->position();
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_handle->position();
}
void WindowImpl::position(const Vertex &p)
{
- Trace trace("WindowImpl::position");
- Prague::Guard<Mutex> guard(_mutex);
- _handle->position(p);
+ Trace trace("WindowImpl::position");
+ Prague::Guard<Mutex> guard(my_mutex);
+ my_handle->position(p);
}
Vertex WindowImpl::size()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _handle->size();
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_handle->size();
}
void WindowImpl::size(const Vertex &s)
{
- Trace trace("WindowImpl::size");
- Prague::Guard<Mutex> guard(_mutex);
- _handle->size(s);
+ Trace trace("WindowImpl::size");
+ Prague::Guard<Mutex> guard(my_mutex);
+ my_handle->size(s);
}
Stage::Index WindowImpl::layer()
{
- Prague::Guard<Mutex> guard(_mutex);
- return _handle->layer();
+ Prague::Guard<Mutex> guard(my_mutex);
+ return my_handle->layer();
}
void WindowImpl::layer(Stage::Index l)
{
- Trace trace("WindowImpl::layer");
- Prague::Guard<Mutex> guard(_mutex);
- _handle->layer(l);
+ Trace trace("WindowImpl::layer");
+ Prague::Guard<Mutex> guard(my_mutex);
+ my_handle->layer(l);
}
CORBA::Boolean WindowImpl::mapped()
{
- Prague::Guard<Mutex> guard(_mutex);
- return !_unmapped;
+ Prague::Guard<Mutex> guard(my_mutex);
+ return !my_unmapped;
}
void WindowImpl::mapped(CORBA::Boolean flag)
{
- Trace trace("WindowImpl::mapped");
- if (flag)
+ Trace trace("WindowImpl::mapped");
+ if (flag)
// map
{
- Prague::Guard<Mutex> guard(_mutex);
- if (!_unmapped) return;
- Stage_var stage = _handle->parent();
- stage->lock();
- StageHandle_var tmp = stage->insert(Graphic_var(_this()),
- _handle->position(),
- _handle->size(),
- _handle->layer());
- stage->unlock();
- _handle = tmp;
- _unmapped = 0;
+ Prague::Guard<Mutex> guard(my_mutex);
+ if (!my_unmapped) return;
+ Stage_var stage = my_handle->parent();
+ stage->lock();
+ StageHandle_var tmp = stage->insert(Graphic_var(_this()),
+ my_handle->position(),
+ my_handle->size(),
+ my_handle->layer());
+ stage->unlock();
+ my_handle = tmp;
+ my_unmapped = 0;
}
- else
+ else
// unmap
{
- Prague::Guard<Mutex> guard(_mutex);
- if (_unmapped) return;
- _unmapped = new UnmappedStageHandle(_handle);
- _handle->remove();
- _handle = _unmapped->_this();
+ Prague::Guard<Mutex> guard(my_mutex);
+ if (my_unmapped) return;
+ my_unmapped = new UnmappedStageHandle(my_handle);
+ my_handle->remove();
+ my_handle = my_unmapped->_this();
}
}
Index: WindowImpl.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Berlin/modules/Desktop/WindowImpl.hh,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- WindowImpl.hh 5 Jan 2003 16:21:29 -0000 1.24
+++ WindowImpl.hh 29 Dec 2003 08:03:21 -0000 1.25
@@ -19,8 +19,8 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*/
-#ifndef _WindowImpl_hh
-#define _WindowImpl_hh
+#ifndef _DesktopKit_WindowImpl_hh
+#define _DesktopKit_WindowImpl_hh
#include <Prague/Sys/Tracer.hh>
#include <Fresco/config.hh>
@@ -31,35 +31,38 @@
#include <Prague/Sys/Thread.hh>
#include <vector>
-namespace Berlin {
-namespace DesktopKit {
-
-class WindowImpl : public virtual POA_Fresco::Window,
- public ControllerImpl
+namespace Berlin
{
- class UnmappedStageHandle;
-public:
- WindowImpl();
- virtual ~WindowImpl();
- virtual void need_resize();
- virtual CORBA::Boolean request_focus(Fresco::Controller_ptr, Fresco::Input::Device);
- void insert(Fresco::Desktop_ptr);
- virtual Fresco::Vertex position();
- virtual void position(const Fresco::Vertex &);
- virtual Fresco::Vertex size();
- virtual void size(const Fresco::Vertex &);
- virtual Layout::Stage::Index layer();
- virtual void layer(Layout::Stage::Index);
- virtual CORBA::Boolean mapped();
- virtual void mapped(CORBA::Boolean);
-private:
- Layout::StageHandle_var _handle;
- Impl_var<UnmappedStageHandle> _unmapped;
- Prague::Mutex _mutex;
- std::vector<Fresco::Controller_var> _focus;
-};
+ namespace DesktopKit
+ {
-} // namespace
+ class WindowImpl : public virtual POA_Fresco::Window,
+ public ControllerImpl
+ {
+ class UnmappedStageHandle;
+ public:
+ WindowImpl();
+ virtual ~WindowImpl();
+ virtual void need_resize();
+ virtual CORBA::Boolean request_focus(Fresco::Controller_ptr,
+ Fresco::Input::Device);
+ void insert(Fresco::Desktop_ptr);
+ virtual Fresco::Vertex position();
+ virtual void position(const Fresco::Vertex &);
+ virtual Fresco::Vertex size();
+ virtual void size(const Fresco::Vertex &);
+ virtual Layout::Stage::Index layer();
+ virtual void layer(Layout::Stage::Index);
+ virtual CORBA::Boolean mapped();
+ virtual void mapped(CORBA::Boolean);
+ private:
+ Layout::StageHandle_var my_handle;
+ Impl_var<UnmappedStageHandle> my_unmapped;
+ Prague::Mutex my_mutex;
+ std::vector<Fresco::Controller_var> my_focus;
+ };
+
+ } // namespace
} // namespace
#endif