Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

static void spdc_pen_set_angle_distance_status_message ( SPPenContext *const   pc,
Geom::Point const   p,
int  pc_point_to_compare,
gchar const *  message 
) [static]

Show the status message for the current line/curve segment. This type of message always shows angle/distance as the last two parameters ("angle %3.2f°, distance %s").

Definition at line 1227 of file pen-context.cpp.

References Geom::atan2(), Inkscape::Preferences::get(), Inkscape::Preferences::getBool(), SPNamedView::getDefaultMetric(), and Inkscape::MessageContext::setF().

{
    g_assert(pc != NULL);
    g_assert((pc_point_to_compare == 0) || (pc_point_to_compare == 3)); // exclude control handles
    g_assert(message != NULL);

    SPDesktop *desktop = SP_EVENT_CONTEXT(pc)->desktop;
    Geom::Point rel = p - pc->p[pc_point_to_compare];
    GString *dist = SP_PX_TO_METRIC_STRING(Geom::L2(rel), desktop->namedview->getDefaultMetric());
    double angle = atan2(rel[Geom::Y], rel[Geom::X]) * 180 / M_PI;
    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
    if (prefs->getBool("/options/compassangledisplay/value", 0) != 0)
        angle = angle_to_compass (angle);

    pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, message, angle, dist->str);
    g_string_free(dist, FALSE);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index