Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Extension::TemplatePreset Class Reference

#include <template.h>

Inheritance diagram for Inkscape::Extension::TemplatePreset:
Inkscape::Extension::Internal::TemplatePresetFile

Public Member Functions

 TemplatePreset (Template *mod, const Inkscape::XML::Node *repr, TemplatePrefs prefs={}, int priority=0)
 Parse the inx xml node for preset information.
 
 ~TemplatePreset ()
 
std::string const & get_key () const
 
std::string const & get_icon () const
 
std::string const & get_category () const
 
std::string const & get_name () const
 
std::string const & get_label () const
 
std::string const & get_description () const
 
int get_sort_priority () const
 
int get_visibility () const
 
bool is_visible (TemplateShow mode)
 
std::unique_ptr< SPDocumentnew_from_template (TemplatePrefs const &others={})
 Generate a new document from this preset.
 
void resize_to_template (SPDocument *doc, SPPage *page, const TemplatePrefs &others={})
 Resize the given page to however the page format requires it to be.
 
bool match_size (double width, double height, const TemplatePrefs &others={})
 Reverse match for templates, allowing page duplication and labeling.
 
std::string get_icon_path () const
 

Protected Member Functions

std::string _get_icon_path (std::string const &name) const
 
bool setup_prefs (const TemplatePrefs &others={})
 Setup the preferences and ask the user to fill in the remaineder.
 
void _add_prefs (const TemplatePrefs &prefs)
 Called by setup_prefs to save the given prefs into this extension.
 

Protected Attributes

std::string _key
 
std::string _icon
 
std::string _name
 
std::string _label
 
std::string _desc
 
std::string _category
 
int _priority
 
int _visibility
 
TemplatePrefs _prefs
 

Private Attributes

Template_mod
 

Detailed Description

Definition at line 48 of file template.h.

Constructor & Destructor Documentation

◆ TemplatePreset()

Inkscape::Extension::TemplatePreset::TemplatePreset ( Template mod,
const Inkscape::XML::Node repr,
TemplatePrefs  prefs = {},
int  priority = 0 
)

Parse the inx xml node for preset information.

Definition at line 35 of file template.cpp.

References _category, _desc, _icon, _key, _label, _name, _prefs, _priority, _visibility, Inkscape::XML::Node::attributeList(), and name.

◆ ~TemplatePreset()

Inkscape::Extension::TemplatePreset::~TemplatePreset ( )
inline

Definition at line 52 of file template.h.

Member Function Documentation

◆ _add_prefs()

void Inkscape::Extension::TemplatePreset::_add_prefs ( const TemplatePrefs prefs)
protected

Called by setup_prefs to save the given prefs into this extension.

Definition at line 133 of file template.cpp.

References _mod, Inkscape::Extension::Extension::set_param_any(), and Inkscape::Extension::Extension::set_param_hidden().

Referenced by match_size(), and setup_prefs().

◆ _get_icon_path()

std::string Inkscape::Extension::TemplatePreset::_get_icon_path ( std::string const &  name) const
protected

◆ get_category()

std::string const & Inkscape::Extension::TemplatePreset::get_category ( ) const
inline

Definition at line 56 of file template.h.

References _category.

◆ get_description()

std::string const & Inkscape::Extension::TemplatePreset::get_description ( ) const
inline

Definition at line 59 of file template.h.

References _desc.

◆ get_icon()

std::string const & Inkscape::Extension::TemplatePreset::get_icon ( ) const
inline

Definition at line 55 of file template.h.

References _icon.

◆ get_icon_path()

std::string Inkscape::Extension::TemplatePreset::get_icon_path ( ) const

Definition at line 80 of file template.cpp.

References _get_icon_path(), and _icon.

◆ get_key()

std::string const & Inkscape::Extension::TemplatePreset::get_key ( ) const
inline

Definition at line 54 of file template.h.

References _key.

◆ get_label()

std::string const & Inkscape::Extension::TemplatePreset::get_label ( ) const
inline

Definition at line 58 of file template.h.

References _label.

◆ get_name()

std::string const & Inkscape::Extension::TemplatePreset::get_name ( ) const
inline

Definition at line 57 of file template.h.

References _name.

◆ get_sort_priority()

int Inkscape::Extension::TemplatePreset::get_sort_priority ( ) const
inline

Definition at line 60 of file template.h.

References _priority.

◆ get_visibility()

int Inkscape::Extension::TemplatePreset::get_visibility ( ) const
inline

Definition at line 61 of file template.h.

References _visibility.

◆ is_visible()

bool Inkscape::Extension::TemplatePreset::is_visible ( TemplateShow  mode)
inline

Definition at line 63 of file template.h.

References _visibility, mode, and Inkscape::Extension::TEMPLATE_ANY.

Referenced by match_size().

◆ match_size()

bool Inkscape::Extension::TemplatePreset::match_size ( double  width,
double  height,
const TemplatePrefs others = {} 
)

Reverse match for templates, allowing page duplication and labeling.

Definition at line 171 of file template.cpp.

References _add_prefs(), _mod, _prefs, height, Inkscape::Extension::Extension::imp, is_visible(), Inkscape::Extension::TEMPLATE_SIZE_LIST, Inkscape::Extension::TEMPLATE_SIZE_SEARCH, and width.

◆ new_from_template()

std::unique_ptr< SPDocument > Inkscape::Extension::TemplatePreset::new_from_template ( TemplatePrefs const &  others = {})

Generate a new document from this preset.

Sets the preferences and then calls back to it's parent extension.

Definition at line 150 of file template.cpp.

References _mod, Inkscape::Extension::Template::new_from_template(), and setup_prefs().

◆ resize_to_template()

void Inkscape::Extension::TemplatePreset::resize_to_template ( SPDocument doc,
SPPage page,
const TemplatePrefs others = {} 
)

Resize the given page to however the page format requires it to be.

Definition at line 161 of file template.cpp.

References _mod, Inkscape::Extension::Template::can_resize(), page, Inkscape::Extension::Template::resize_to_template(), and setup_prefs().

◆ setup_prefs()

bool Inkscape::Extension::TemplatePreset::setup_prefs ( const TemplatePrefs others = {})
protected

Setup the preferences and ask the user to fill in the remaineder.

Parameters
others- populate with these prefs on top of internal prefs.
Returns
True if preferences have been shown or not using GUI, False is canceled.

Can cause a GUI popup.

Definition at line 114 of file template.cpp.

References _add_prefs(), _mod, _prefs, Inkscape::Extension::Extension::prefs(), and Inkscape::Extension::Extension::set_param_hidden().

Referenced by new_from_template(), and resize_to_template().

Member Data Documentation

◆ _category

std::string Inkscape::Extension::TemplatePreset::_category
protected

◆ _desc

std::string Inkscape::Extension::TemplatePreset::_desc
protected

◆ _icon

std::string Inkscape::Extension::TemplatePreset::_icon
protected

◆ _key

std::string Inkscape::Extension::TemplatePreset::_key
protected

◆ _label

std::string Inkscape::Extension::TemplatePreset::_label
protected

◆ _mod

Template* Inkscape::Extension::TemplatePreset::_mod
private

◆ _name

std::string Inkscape::Extension::TemplatePreset::_name
protected

◆ _prefs

TemplatePrefs Inkscape::Extension::TemplatePreset::_prefs
protected

◆ _priority

int Inkscape::Extension::TemplatePreset::_priority
protected

◆ _visibility

int Inkscape::Extension::TemplatePreset::_visibility
protected

The documentation for this class was generated from the following files: