mirror of https://github.com/KLayout/klayout.git
Fixed issue #1522 (Changing ruler/annotation from script weirdly interferes with pya.Application.commit_config)
This commit is contained in:
parent
8b805d8815
commit
9565a55a3b
|
|
@ -45,24 +45,6 @@ namespace ant
|
||||||
|
|
||||||
static PluginDeclaration *sp_instance = 0;
|
static PluginDeclaration *sp_instance = 0;
|
||||||
|
|
||||||
PluginDeclaration::PluginDeclaration ()
|
|
||||||
: m_current_template (0),
|
|
||||||
m_current_template_updated (true), m_templates_updated (true)
|
|
||||||
{
|
|
||||||
sp_instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginDeclaration::~PluginDeclaration ()
|
|
||||||
{
|
|
||||||
sp_instance = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginDeclaration *
|
|
||||||
PluginDeclaration::instance ()
|
|
||||||
{
|
|
||||||
return sp_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::vector<ant::Template> make_standard_templates ()
|
static std::vector<ant::Template> make_standard_templates ()
|
||||||
{
|
{
|
||||||
std::vector<ant::Template> templates;
|
std::vector<ant::Template> templates;
|
||||||
|
|
@ -92,6 +74,24 @@ static std::vector<ant::Template> make_standard_templates ()
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PluginDeclaration::PluginDeclaration ()
|
||||||
|
: m_current_template (0),
|
||||||
|
m_current_template_updated (true), m_templates_updated (true)
|
||||||
|
{
|
||||||
|
sp_instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
PluginDeclaration::~PluginDeclaration ()
|
||||||
|
{
|
||||||
|
sp_instance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PluginDeclaration *
|
||||||
|
PluginDeclaration::instance ()
|
||||||
|
{
|
||||||
|
return sp_instance;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PluginDeclaration::get_options (std::vector < std::pair<std::string, std::string> > &options) const
|
PluginDeclaration::get_options (std::vector < std::pair<std::string, std::string> > &options) const
|
||||||
{
|
{
|
||||||
|
|
@ -281,25 +281,24 @@ PluginDeclaration::update_current_template ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_current_template >= 0 && m_current_template < int (m_templates.size ())) {
|
std::vector<std::string> menu_entries = mp->menu ()->group ("ruler_mode_group");
|
||||||
|
for (std::vector<std::string>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
||||||
std::vector<std::string> menu_entries = mp->menu ()->group ("ruler_mode_group");
|
lay::Action *action = mp->menu ()->action (*m);
|
||||||
for (std::vector<std::string>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
if (m_current_template >= 0 && m_current_template < int (m_templates.size ())) {
|
||||||
lay::Action *action = mp->menu ()->action (*m);
|
|
||||||
action->set_title (m_templates [m_current_template].title ());
|
action->set_title (m_templates [m_current_template].title ());
|
||||||
|
} else {
|
||||||
|
action->set_title (std::string ());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (m_templates.size () > 1) {
|
|
||||||
|
|
||||||
tl::weak_collection<lay::ConfigureAction>::iterator it = m_actions.begin ();
|
if (m_templates.size () > 1) {
|
||||||
int index = 0;
|
tl::weak_collection<lay::ConfigureAction>::iterator it = m_actions.begin ();
|
||||||
for (std::vector<Template>::const_iterator tt = m_templates.begin (); tt != m_templates.end () && it != m_actions.end (); ++tt, ++it, ++index) {
|
int index = 0;
|
||||||
if (it.operator -> ()) {
|
for (std::vector<Template>::const_iterator tt = m_templates.begin (); tt != m_templates.end () && it != m_actions.end (); ++tt, ++it, ++index) {
|
||||||
it->set_checked (index == m_current_template);
|
if (it.operator -> ()) {
|
||||||
}
|
it->set_checked (index == m_current_template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_current_template_updated = false;
|
m_current_template_updated = false;
|
||||||
|
|
@ -313,15 +312,13 @@ PluginDeclaration::update_menu ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_current_template < 0 || m_current_template >= int (m_templates.size ())) {
|
std::vector<std::string> menu_entries = mp->menu ()->group ("ruler_mode_group");
|
||||||
m_current_template = 0;
|
for (std::vector<std::string>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
||||||
}
|
lay::Action *action = mp->menu ()->action (*m);
|
||||||
|
if (m_current_template >= 0 && m_current_template < int (m_templates.size ())) {
|
||||||
if (m_current_template >= 0 && m_current_template < int (m_templates.size ())) {
|
|
||||||
std::vector<std::string> menu_entries = mp->menu ()->group ("ruler_mode_group");
|
|
||||||
for (std::vector<std::string>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
|
||||||
lay::Action *action = mp->menu ()->action (*m);
|
|
||||||
action->set_title (m_templates [m_current_template].title ());
|
action->set_title (m_templates [m_current_template].title ());
|
||||||
|
} else {
|
||||||
|
action->set_title (std::string ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue