// SPDX-License-Identifier: GPL-2.0-or-later /* * Contain internal sizes of paper which can be used in various * functions to make and size pages. * * Authors: * Martin Owens * * Copyright (C) 2022 Authors * * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ #include "template-paper.h" #include "clear-n_.h" namespace Inkscape { namespace Extension { namespace Internal { /** * Return the width and height of the new page with the orientation. */ Geom::Point TemplatePaper::get_template_size(Inkscape::Extension::Template *tmod) const { std::string orient = tmod->get_param_optiongroup("orientation", "port"); double min = tmod->get_param_float("min"); double max = tmod->get_param_float("max"); if (orient == "port") { return Geom::Point(min, max); } else if (orient == "land") { return Geom::Point(max, min); } g_warning("Unknown orientation for paper! '%s'", orient.c_str()); return Geom::Point(100, 100); } void TemplatePaper::init() { // clang-format off Inkscape::Extension::build_from_mem( "" "org.inkscape.template.paper" "" N_("Paper Sizes") "" "" N_("Standard paper document formats") "" "" NC_("TemplateCategory", "Print") "" "mm" "210.0" "297.0" "" "" "" "" "" "", new TemplatePaper()); // clang-format on } } // namespace Internal } // namespace Extension } // namespace Inkscape /* Local Variables: mode:c++ c-file-style:"stroustrup" c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) indent-tabs-mode:nil fill-column:99 End: */ // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :