Code

Mnemonics in "Fill and stroke", "Align and distribute", and "Transform" dialogs ...
[inkscape.git] / src / selcue.cpp
index 714daaa7ea980da371a87faa0c8d07d09fd5c8ae..171178c4132f2bd7b46e87b98eb6d2da30273c49 100644 (file)
@@ -1,11 +1,10 @@
-#define __SELCUE_C__
-
 /*
  * Helper object for showing selected items
  *
  * Authors:
  *   bulia byak <bulia@users.sf.net>
  *   Carl Hetherington <inkscape@carlh.net>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2004 Authors
  *
@@ -84,7 +83,7 @@ void Inkscape::SelCue::_updateItemBboxes()
         SPCanvasItem* box = _item_bboxes[bcount ++];
 
         if (box) {
-            Geom::OptRect const b = sp_item_bbox_desktop(item, bbox_type);
+            Geom::OptRect const b = item->getBboxDesktop(bbox_type);
 
             if (b) {
                 sp_canvas_item_show(box);
@@ -125,7 +124,7 @@ void Inkscape::SelCue::_newItemBboxes()
     for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) {
         SPItem *item = (SPItem *) l->data;
 
-        Geom::OptRect const b = sp_item_bbox_desktop(item, bbox_type);
+        Geom::OptRect const b = item->getBboxDesktop(bbox_type);
 
         SPCanvasItem* box = NULL;
 
@@ -181,18 +180,20 @@ void Inkscape::SelCue::_newTextBaselines()
         if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // visualize baseline
             Inkscape::Text::Layout const *layout = te_get_layout(item);
             if (layout != NULL && layout->outputExists()) {
-                Geom::Point a = layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item);
-                baseline_point = sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRL,
-                                                    "mode", SP_CTRL_MODE_XOR,
-                                                    "size", 4.0,
-                                                    "filled", 0,
-                                                    "stroked", 1,
-                                                    "stroke_color", 0x000000ff,
-                                                    NULL);
-
-                sp_canvas_item_show(baseline_point);
-                SP_CTRL(baseline_point)->moveto(a);
-                sp_canvas_item_move_to_z(baseline_point, 0);
+                boost::optional<Geom::Point> pt = layout->baselineAnchorPoint();
+                if (pt) {
+                    baseline_point = sp_canvas_item_new(sp_desktop_controls(_desktop), SP_TYPE_CTRL,
+                        "mode", SP_CTRL_MODE_XOR,
+                        "size", 4.0,
+                        "filled", 0,
+                        "stroked", 1,
+                        "stroke_color", 0x000000ff,
+                        NULL);
+
+                    sp_canvas_item_show(baseline_point);
+                    SP_CTRL(baseline_point)->moveto((*pt) * item->i2d_affine());
+                    sp_canvas_item_move_to_z(baseline_point, 0);
+                }
             }
         }