Code

While dragging or rotating a guide, <shift>-key now disables snapping. (Just before...
[inkscape.git] / src / desktop-events.cpp
1 /** @file
2  * @brief Event handlers for SPDesktop
3  */
4 /* Author:
5  *   Lauris Kaplinski <lauris@kaplinski.com>
6  *
7  * Copyright (C) 1999-2002 Lauris Kaplinski
8  * Copyright (C) 1999-2010 Others
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #ifdef HAVE_CONFIG_H
14 # include <config.h>
15 #endif
16 #include <map>
17 #include <string>
18 #include <2geom/line.h>
19 #include <glibmm/i18n.h>
21 #include "desktop.h"
22 #include "desktop-handles.h"
23 #include "dialogs/dialog-events.h"
24 #include "display/canvas-axonomgrid.h"
25 #include "display/canvas-grid.h"
26 #include "display/guideline.h"
27 #include "display/snap-indicator.h"
28 #include "document.h"
29 #include "event-context.h"
30 #include "helper/action.h"
31 #include "helper/unit-menu.h"
32 #include "helper/units.h"
33 #include "message-context.h"
34 #include "preferences.h"
35 #include "snap.h"
36 #include "sp-guide.h"
37 #include "sp-metrics.h"
38 #include "sp-namedview.h"
39 #include "tools-switch.h"
40 #include "ui/dialog/guides.h"
41 #include "widgets/desktop-widget.h"
42 #include "xml/repr.h"
44 static void snoop_extended(GdkEvent* event, SPDesktop *desktop);
45 static void init_extended();
47 /* Root item handler */
49 int sp_desktop_root_handler(SPCanvasItem */*item*/, GdkEvent *event, SPDesktop *desktop)
50 {
51     static bool watch = false;
52     static bool first = true;
54     if ( first ) {
55         Inkscape::Preferences *prefs = Inkscape::Preferences::get();
56         if ( prefs->getBool("/options/useextinput/value", true)
57             && prefs->getBool("/options/switchonextinput/value") ) {
58             watch = true;
59             init_extended();
60         }
61         first = false;
62     }
63     if ( watch ) {
64         snoop_extended(event, desktop);
65     }
67     return sp_event_context_root_handler(desktop->event_context, event);
68 }
70 static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw, bool horiz)
71 {
72     static bool dragging = false;
73     static SPCanvasItem *guide = NULL;
74     static Geom::Point normal;
75     int wx, wy;
77     SPDesktop *desktop = dtw->desktop;
78     Inkscape::XML::Node *repr = SP_OBJECT_REPR(desktop->namedview);
80     gdk_window_get_pointer(GTK_WIDGET(dtw->canvas)->window, &wx, &wy, NULL);
81     Geom::Point const event_win(wx, wy);
83     gint width, height;
84     gdk_window_get_geometry(GTK_WIDGET(dtw->canvas)->window, NULL /*x*/, NULL /*y*/, &width, &height, NULL/*depth*/);
86     switch (event->type) {
87     case GDK_BUTTON_PRESS:
88             if (event->button.button == 1) {
89                 dragging = true;
91                 Geom::Point const event_w(sp_canvas_window_to_world(dtw->canvas, event_win));
92                 Geom::Point const event_dt(desktop->w2d(event_w));
94                 // explicitly show guidelines; if I draw a guide, I want them on
95                 sp_repr_set_boolean(repr, "showguides", TRUE);
96                 sp_repr_set_boolean(repr, "inkscape:guide-bbox", TRUE);
98                 // calculate the normal of the guidelines when dragged from the edges of rulers.
99                 Geom::Point normal_bl_to_tr(-1.,1.); //bottomleft to topright
100                 Geom::Point normal_tr_to_bl(1.,1.); //topright to bottomleft
101                 normal_bl_to_tr.normalize();
102                 normal_tr_to_bl.normalize();
103                 Inkscape::CanvasGrid * grid = sp_namedview_get_first_enabled_grid(desktop->namedview);
104                 if ( grid && grid->getGridType() == Inkscape::GRID_AXONOMETRIC ) {
105                     Inkscape::CanvasAxonomGrid *axonomgrid = dynamic_cast<Inkscape::CanvasAxonomGrid *>(grid);
106                     if (event->button.state & GDK_CONTROL_MASK) {
107                         // guidelines normal to gridlines
108                         normal_bl_to_tr = Geom::Point::polar(-axonomgrid->angle_rad[0], 1.0);
109                         normal_tr_to_bl = Geom::Point::polar(axonomgrid->angle_rad[2], 1.0);
110                     } else {
111                         normal_bl_to_tr = rot90(Geom::Point::polar(axonomgrid->angle_rad[2], 1.0));
112                         normal_tr_to_bl = rot90(Geom::Point::polar(-axonomgrid->angle_rad[0], 1.0));
113                     }
114                 }
115                 if (horiz) {
116                     if (wx < 50) {
117                         normal = normal_bl_to_tr;
118                     } else if (wx > width - 50) {
119                         normal = normal_tr_to_bl;
120                     } else {
121                         normal = Geom::Point(0.,1.);
122                     }
123                 } else {
124                     if (wy < 50) {
125                         normal = normal_bl_to_tr;
126                     } else if (wy > height - 50) {
127                         normal = normal_tr_to_bl;
128                     } else {
129                         normal = Geom::Point(1.,0.);
130                     }
131                 }
133                 guide = sp_guideline_new(desktop->guides, event_dt, normal);
134                 sp_guideline_set_color(SP_GUIDELINE(guide), desktop->namedview->guidehicolor);
135                 gdk_pointer_grab(widget->window, FALSE,
136                                  (GdkEventMask)(GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ),
137                                  NULL, NULL,
138                                  event->button.time);
139             }
140             break;
141     case GDK_MOTION_NOTIFY:
142             if (dragging) {
143                 Geom::Point const event_w(sp_canvas_window_to_world(dtw->canvas, event_win));
144                 Geom::Point event_dt(desktop->w2d(event_w));
146                 if (!(event->motion.state & GDK_SHIFT_MASK)) {
147                     SnapManager &m = desktop->namedview->snap_manager;
148                     m.setup(desktop);
149                     // We only have a temporary guide which is not stored in our document yet.
150                     // Because the guide snapper only looks in the document for guides to snap to,
151                     // we don't have to worry about a guide snapping to itself here
152                     m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN);
153                 }
155                 sp_guideline_set_position(SP_GUIDELINE(guide), from_2geom(event_dt));
156                 desktop->set_coordinate_status(to_2geom(event_dt));
157                 desktop->setPosition(to_2geom(event_dt));
158             }
159             break;
160     case GDK_BUTTON_RELEASE:
161             if (dragging && event->button.button == 1) {
162                 sp_event_context_discard_delayed_snap_event(desktop->event_context);
164                 gdk_pointer_ungrab(event->button.time);
165                 Geom::Point const event_w(sp_canvas_window_to_world(dtw->canvas, event_win));
166                 Geom::Point event_dt(desktop->w2d(event_w));
168                 if (!(event->button.state & GDK_SHIFT_MASK)) {
169                     SnapManager &m = desktop->namedview->snap_manager;
170                     m.setup(desktop);
171                     // We only have a temporary guide which is not stored in our document yet.
172                     // Because the guide snapper only looks in the document for guides to snap to,
173                     // we don't have to worry about a guide snapping to itself here
174                     m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN);
175                 }
177                 dragging = false;
179                 gtk_object_destroy(GTK_OBJECT(guide));
180                 guide = NULL;
181                 if ((horiz ? wy : wx) >= 0) {
182                     Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
183                     Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide");
184                     sp_repr_set_point(repr, "orientation", normal);
185                     sp_repr_set_point(repr, "position", from_2geom(event_dt));
186                     SP_OBJECT_REPR(desktop->namedview)->appendChild(repr);
187                     Inkscape::GC::release(repr);
188                     sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
189                                      _("Create guide"));
190                 }
191                 desktop->set_coordinate_status(from_2geom(event_dt));
192             }
193     default:
194             break;
195     }
197     return FALSE;
200 int sp_dt_hruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw)
202     if (event->type == GDK_MOTION_NOTIFY) {
203         sp_event_context_snap_delay_handler(dtw->desktop->event_context, (gpointer) widget, (gpointer) dtw, (GdkEventMotion *)event, DelayedSnapEvent::GUIDE_HRULER);
204     }
205     return sp_dt_ruler_event(widget, event, dtw, true);
208 int sp_dt_vruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw)
210     if (event->type == GDK_MOTION_NOTIFY) {
211         sp_event_context_snap_delay_handler(dtw->desktop->event_context, (gpointer) widget, (gpointer) dtw, (GdkEventMotion *)event, DelayedSnapEvent::GUIDE_VRULER);
212     }
213     return sp_dt_ruler_event(widget, event, dtw, false);
216 static Geom::Point drag_origin;
217 static SPGuideDragType drag_type = SP_DRAG_NONE;
218 //static bool reset_drag_origin = false; // when Ctrl is pressed while dragging, this is used to trigger resetting of the
219 //                                       // drag origin to that location so that constrained movement is more intuitive
221 // Min distance from anchor to initiate rotation, measured in screenpixels
222 #define tol 40.0
224 gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
226     static bool moved = false;
227     gint ret = FALSE;
229     SPGuide *guide = SP_GUIDE(data);
230     SPDesktop *desktop = static_cast<SPDesktop*>(gtk_object_get_data(GTK_OBJECT(item->canvas), "SPDesktop"));
232     switch (event->type) {
233     case GDK_2BUTTON_PRESS:
234             if (event->button.button == 1) {
235                 drag_type = SP_DRAG_NONE;
236                 sp_event_context_discard_delayed_snap_event(desktop->event_context);
237                 sp_canvas_item_ungrab(item, event->button.time);
238                 Inkscape::UI::Dialogs::GuidelinePropertiesDialog::showDialog(guide, desktop);
239                 ret = TRUE;
240             }
241             break;
242     case GDK_BUTTON_PRESS:
243             if (event->button.button == 1) {
244                 Geom::Point const event_w(event->button.x, event->button.y);
245                 Geom::Point const event_dt(desktop->w2d(event_w));
247                 // Due to the tolerance allowed when grabbing a guide, event_dt will generally
248                 // be close to the guide but not just exactly on it. The drag origin calculated
249                 // here must be exactly on the guide line though, otherwise
250                 // small errors will occur once we snap, see
251                 // https://bugs.launchpad.net/inkscape/+bug/333762
252                 drag_origin = Geom::projection(event_dt, Geom::Line(guide->point_on_line, guide->angle()));
254                 if (event->button.state & GDK_SHIFT_MASK) {
255                     // with shift we rotate the guide
256                     drag_type = SP_DRAG_ROTATE;
257                 } else {
258                     if (event->button.state & GDK_CONTROL_MASK) {
259                         drag_type = SP_DRAG_MOVE_ORIGIN;
260                     } else {
261                         drag_type = SP_DRAG_TRANSLATE;
262                     }
263                 }
265                 if (drag_type == SP_DRAG_ROTATE || drag_type == SP_DRAG_TRANSLATE) {
266                     sp_canvas_item_grab(item,
267                                         ( GDK_BUTTON_RELEASE_MASK  |
268                                           GDK_BUTTON_PRESS_MASK    |
269                                           GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK ),
270                                         NULL,
271                                         event->button.time);
272                 }
273                 ret = TRUE;
274             }
275             break;
276         case GDK_MOTION_NOTIFY:
277             if (drag_type != SP_DRAG_NONE) {
278                 Geom::Point const motion_w(event->motion.x,
279                                            event->motion.y);
280                 Geom::Point motion_dt(desktop->w2d(motion_w));
282                 sp_event_context_snap_delay_handler(desktop->event_context, (gpointer) item, data, (GdkEventMotion *)event, DelayedSnapEvent::GUIDE_HANDLER);
284                 // This is for snapping while dragging existing guidelines. New guidelines,
285                 // which are dragged off the ruler, are being snapped in sp_dt_ruler_event
286                 SnapManager &m = desktop->namedview->snap_manager;
287                 m.setup(desktop, true, NULL, NULL, guide);
288                 if (drag_type == SP_DRAG_MOVE_ORIGIN) {
289                     // If we snap in guideConstrainedSnap() below, then motion_dt will
290                     // be forced to be on the guide. If we don't snap however, then
291                     // the origin should still be constrained to the guide. So let's do
292                     // that explicitly first:
293                     Geom::Line line(guide->point_on_line, guide->angle());
294                     Geom::Coord t = line.nearestPoint(motion_dt);
295                     motion_dt = line.pointAt(t);
296                     if (!(event->motion.state & GDK_SHIFT_MASK)) {
297                         m.guideConstrainedSnap(motion_dt, *guide);
298                     }
299                 } else if (!(event->motion.state & GDK_SHIFT_MASK)) {
300                     m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type);
301                 }
303                 switch (drag_type) {
304                     case SP_DRAG_TRANSLATE:
305                     {
306                         sp_guide_moveto(*guide, motion_dt, false);
307                         break;
308                     }
309                     case SP_DRAG_ROTATE:
310                     {
311                         Geom::Point pt = motion_dt - guide->point_on_line;
312                         double angle = std::atan2(pt[Geom::Y], pt[Geom::X]);
313                         if  (event->motion.state & GDK_CONTROL_MASK) {
314                             Inkscape::Preferences *prefs = Inkscape::Preferences::get();
315                             unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12));
316                             if (snaps) {
317                                 double sections = floor(angle * snaps / M_PI + .5);
318                                 angle = (M_PI / snaps) * sections;
319                             }
320                         }
321                         sp_guide_set_normal(*guide, Geom::Point(1,0) * Geom::Rotate(angle + M_PI_2), false);
322                         break;
323                     }
324                     case SP_DRAG_MOVE_ORIGIN:
325                     {
326                         sp_guide_moveto(*guide, motion_dt, false);
327                         break;
328                     }
329                     case SP_DRAG_NONE:
330                         g_assert_not_reached();
331                         break;
332                 }
333                 moved = true;
334                 desktop->set_coordinate_status(from_2geom(motion_dt));
335                 desktop->setPosition(from_2geom(motion_dt));
337                 ret = TRUE;
338             }
339             break;
340     case GDK_BUTTON_RELEASE:
341             if (drag_type != SP_DRAG_NONE && event->button.button == 1) {
342                 sp_event_context_discard_delayed_snap_event(desktop->event_context);
344                 if (moved) {
345                     Geom::Point const event_w(event->button.x,
346                                               event->button.y);
347                     Geom::Point event_dt(desktop->w2d(event_w));
349                     SnapManager &m = desktop->namedview->snap_manager;
350                     m.setup(desktop, true, NULL, NULL, guide);
351                     if (drag_type == SP_DRAG_MOVE_ORIGIN) {
352                         // If we snap in guideConstrainedSnap() below, then motion_dt will
353                         // be forced to be on the guide. If we don't snap however, then
354                         // the origin should still be constrained to the guide. So let's
355                         // do that explicitly first:
356                         Geom::Line line(guide->point_on_line, guide->angle());
357                         Geom::Coord t = line.nearestPoint(event_dt);
358                         event_dt = line.pointAt(t);
359                         if (!(event->button.state & GDK_SHIFT_MASK)) {
360                             m.guideConstrainedSnap(event_dt, *guide);
361                         }
362                     } else if (!(event->button.state & GDK_SHIFT_MASK)) {
363                         m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type);
364                     }
366                     if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) {
367                         switch (drag_type) {
368                             case SP_DRAG_TRANSLATE:
369                             {
370                                 sp_guide_moveto(*guide, event_dt, true);
371                                 break;
372                             }
373                             case SP_DRAG_ROTATE:
374                             {
375                                 Geom::Point pt = event_dt - guide->point_on_line;
376                                 double angle = std::atan2(pt[Geom::Y], pt[Geom::X]);
377                                 if  (event->motion.state & GDK_CONTROL_MASK) {
378                                     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
379                                     unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12));
380                                     if (snaps) {
381                                         double sections = floor(angle * snaps / M_PI + .5);
382                                         angle = (M_PI / snaps) * sections;
383                                     }
384                                 }
385                                 sp_guide_set_normal(*guide, Geom::Point(1,0) * Geom::Rotate(angle + M_PI_2), true);
386                                 break;
387                             }
388                             case SP_DRAG_MOVE_ORIGIN:
389                             {
390                                 sp_guide_moveto(*guide, event_dt, true);
391                                 break;
392                             }
393                             case SP_DRAG_NONE:
394                                 g_assert_not_reached();
395                                 break;
396                         }
397                         sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
398                                          _("Move guide"));
399                     } else {
400                         /* Undo movement of any attached shapes. */
401                         sp_guide_moveto(*guide, guide->point_on_line, false);
402                         sp_guide_set_normal(*guide, guide->normal_to_line, false);
403                         sp_guide_remove(guide);
404                         sp_document_done(sp_desktop_document(desktop), SP_VERB_NONE,
405                                      _("Delete guide"));
406                     }
407                     moved = false;
408                     desktop->set_coordinate_status(from_2geom(event_dt));
409                     desktop->setPosition (from_2geom(event_dt));
410                 }
411                 drag_type = SP_DRAG_NONE;
412                 sp_canvas_item_ungrab(item, event->button.time);
413                 ret=TRUE;
414             }
415     case GDK_ENTER_NOTIFY:
416     {
417             sp_guideline_set_color(SP_GUIDELINE(item), guide->hicolor);
419             // set move or rotate cursor
420             Geom::Point const event_w(event->crossing.x, event->crossing.y);
421             Geom::Point const event_dt(desktop->w2d(event_w));
423             if (event->crossing.state & GDK_SHIFT_MASK) {
424                 GdkCursor *guide_cursor;
425                 guide_cursor = gdk_cursor_new (GDK_EXCHANGE);
426                 gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor);
427                 gdk_cursor_unref(guide_cursor);
428             }
430             char *guide_description = sp_guide_description(guide);
431             desktop->guidesMessageContext()->setF(Inkscape::NORMAL_MESSAGE, _("<b>Guideline</b>: %s"), guide_description);
432             g_free(guide_description);
433             break;
434     }
435     case GDK_LEAVE_NOTIFY:
436             sp_guideline_set_color(SP_GUIDELINE(item), guide->color);
438             // restore event context's cursor
439             gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, desktop->event_context->cursor);
441             desktop->guidesMessageContext()->clear();
442             break;
443         case GDK_KEY_PRESS:
444             switch (get_group0_keyval (&event->key)) {
445                 case GDK_Delete:
446                 case GDK_KP_Delete:
447                 case GDK_BackSpace:
448                 {
449                     SPDocument *doc = SP_OBJECT_DOCUMENT(guide);
450                     sp_guide_remove(guide);
451                     sp_document_done(doc, SP_VERB_NONE, _("Delete guide"));
452                     ret = TRUE;
453                     sp_event_context_discard_delayed_snap_event(desktop->event_context);
454                     break;
455                 }
456                 case GDK_Shift_L:
457                 case GDK_Shift_R:
458                     GdkCursor *guide_cursor;
459                     guide_cursor = gdk_cursor_new (GDK_EXCHANGE);
460                     gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor);
461                     gdk_cursor_unref(guide_cursor);
462                     ret = TRUE;
463                 default:
464                     // do nothing;
465                     break;
466             }
467             break;
468         case GDK_KEY_RELEASE:
469             switch (get_group0_keyval (&event->key)) {
470                 case GDK_Shift_L:
471                 case GDK_Shift_R:
472                     GdkCursor *guide_cursor;
473                     guide_cursor = gdk_cursor_new (GDK_EXCHANGE);
474                     gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor);
475                     gdk_cursor_unref(guide_cursor);
476                     break;
477                 default:
478                     // do nothing;
479                     break;
480             }
481     default:
482         break;
483     }
485     return ret;
488 //static std::map<GdkInputSource, std::string> switchMap;
489 static std::map<std::string, int> toolToUse;
490 static std::string lastName;
491 static GdkInputSource lastType = GDK_SOURCE_MOUSE;
493 static void init_extended()
495     std::string avoidName = "pad";
496     GList* devices = gdk_devices_list();
497     if ( devices ) {
498         for ( GList* curr = devices; curr; curr = g_list_next(curr) ) {
499             GdkDevice* dev = reinterpret_cast<GdkDevice*>(curr->data);
500             if ( dev->name
501                  && (avoidName != dev->name)
502                  && (dev->source != GDK_SOURCE_MOUSE) ) {
503 //                 g_message("Adding '%s' as [%d]", dev->name, dev->source);
505                 // Set the initial tool for the device
506                 switch ( dev->source ) {
507                     case GDK_SOURCE_PEN:
508                         toolToUse[dev->name] = TOOLS_CALLIGRAPHIC;
509                         break;
510                     case GDK_SOURCE_ERASER:
511                         toolToUse[dev->name] = TOOLS_ERASER;
512                         break;
513                     case GDK_SOURCE_CURSOR:
514                         toolToUse[dev->name] = TOOLS_SELECT;
515                         break;
516                     default:
517                         ; // do not add
518                 }
519 //            } else if (dev->name) {
520 //                 g_message("Skippn '%s' as [%s]", dev->name, dev->source);
521             }
522         }
523     }
527 void snoop_extended(GdkEvent* event, SPDesktop *desktop)
529     GdkInputSource source = GDK_SOURCE_MOUSE;
530     std::string name;
532     switch ( event->type ) {
533         case GDK_MOTION_NOTIFY:
534         {
535             GdkEventMotion* event2 = reinterpret_cast<GdkEventMotion*>(event);
536             if ( event2->device ) {
537                 source = event2->device->source;
538                 name = event2->device->name;
539             }
540         }
541         break;
543         case GDK_BUTTON_PRESS:
544         case GDK_2BUTTON_PRESS:
545         case GDK_3BUTTON_PRESS:
546         case GDK_BUTTON_RELEASE:
547         {
548             GdkEventButton* event2 = reinterpret_cast<GdkEventButton*>(event);
549             if ( event2->device ) {
550                 source = event2->device->source;
551                 name = event2->device->name;
552             }
553         }
554         break;
556         case GDK_SCROLL:
557         {
558             GdkEventScroll* event2 = reinterpret_cast<GdkEventScroll*>(event);
559             if ( event2->device ) {
560                 source = event2->device->source;
561                 name = event2->device->name;
562             }
563         }
564         break;
566         case GDK_PROXIMITY_IN:
567         case GDK_PROXIMITY_OUT:
568         {
569             GdkEventProximity* event2 = reinterpret_cast<GdkEventProximity*>(event);
570             if ( event2->device ) {
571                 source = event2->device->source;
572                 name = event2->device->name;
573             }
574         }
575         break;
577         default:
578             ;
579     }
581     if (!name.empty()) {
582         if ( lastType != source || lastName != name ) {
583             // The device switched. See if it is one we 'count'
584             //g_message("Changed device %s -> %s", lastName.c_str(), name.c_str());
585             std::map<std::string, int>::iterator it = toolToUse.find(lastName);
586             if (it != toolToUse.end()) {
587                 // Save the tool currently selected for next time the input
588                 // device shows up.
589                 it->second = tools_active(desktop);
590             }
592             it = toolToUse.find(name);
593             if (it != toolToUse.end() ) {
594                 tools_switch(desktop, it->second);
595             }
597             lastName = name;
598             lastType = source;
599         }
600     }
605 /*
606   Local Variables:
607   mode:c++
608   c-file-style:"stroustrup"
609   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
610   indent-tabs-mode:nil
611   fill-column:99
612   End:
613 */
614 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :