Exemple #1
0
RegisteredUnitMenu::RegisteredUnitMenu (const Glib::ustring& label, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in)
    :  RegisteredWidget<Labelled> (label, "" /*tooltip*/, new UnitMenu())
{
    init_parent(key, wr, repr_in, doc_in);

    getUnitMenu()->setUnitType (UNIT_TYPE_LINEAR);
    _changed_connection = getUnitMenu()->signal_changed().connect (sigc::mem_fun (*this, &RegisteredUnitMenu::on_changed));
}
Exemple #2
0
void
RegisteredUnitMenu::on_changed()
{
    if (_wr->isUpdating())
        return;

    Inkscape::SVGOStringStream os;
    os << getUnitMenu()->getUnitAbbr();

    _wr->setUpdating (true);

    write_to_xml(os.str().c_str());

    _wr->setUpdating (false);
}
Exemple #3
0
void
RegisteredUnitMenu::setUnit (Glib::ustring unit)
{
    getUnitMenu()->setUnit(unit);
}
void
RegisteredUnitMenu::setUnit (const SPUnit* unit)
{
    getUnitMenu()->setUnit (sp_unit_get_abbreviation (unit));
}