Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wip2 #1537

Merged
merged 4 commits into from
Nov 20, 2023
Merged

Wip2 #1537

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 37 additions & 40 deletions src/ant/ant/antPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,6 @@ namespace ant

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 ()
{
std::vector<ant::Template> templates;
Expand Down Expand Up @@ -92,6 +74,24 @@ static std::vector<ant::Template> make_standard_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
PluginDeclaration::get_options (std::vector < std::pair<std::string, std::string> > &options) const
{
Expand Down Expand Up @@ -281,25 +281,24 @@ PluginDeclaration::update_current_template ()
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) {
lay::Action *action = mp->menu ()->action (*m);
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);
if (m_current_template >= 0 && m_current_template < int (m_templates.size ())) {
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 ();
int index = 0;
for (std::vector<Template>::const_iterator tt = m_templates.begin (); tt != m_templates.end () && it != m_actions.end (); ++tt, ++it, ++index) {
if (it.operator -> ()) {
it->set_checked (index == m_current_template);
}
if (m_templates.size () > 1) {
tl::weak_collection<lay::ConfigureAction>::iterator it = m_actions.begin ();
int index = 0;
for (std::vector<Template>::const_iterator tt = m_templates.begin (); tt != m_templates.end () && it != m_actions.end (); ++tt, ++it, ++index) {
if (it.operator -> ()) {
it->set_checked (index == m_current_template);
}
}

}

m_current_template_updated = false;
Expand All @@ -313,15 +312,13 @@ PluginDeclaration::update_menu ()
return;
}

if (m_current_template < 0 || m_current_template >= int (m_templates.size ())) {
m_current_template = 0;
}

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);
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);
if (m_current_template >= 0 && m_current_template < int (m_templates.size ())) {
action->set_title (m_templates [m_current_template].title ());
} else {
action->set_title (std::string ());
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/db/db/dbLayout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ Layout::operator= (const Layout &d)

m_tech_name = d.m_tech_name;

m_prop_id = d.m_prop_id;

}
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/doc/about/packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
this can be a web server or a folder on
a file server. KLayout talks WebDAV, so the web server needs to offer WebDAV
access. A subversion (SVN) server provides WebDAV by default, so this is a good
choice. For the packages themselves Git or WebDAV/Subversion can be used. You
choice. For the packages themselves, Git or WebDAV/Subversion can be used. You
need to specify the protocol in the package URL (see below).
</p>

Expand Down
15 changes: 12 additions & 3 deletions src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,21 @@ static unsigned int show_layout1 (lay::LayoutViewBase *view, db::Layout *layout,
{
// the layout gets held by the LayoutHandle object
layout->keep ();
lay::LayoutHandle *handle = new lay::LayoutHandle (layout, std::string ());
lay::LayoutHandle *handle = lay::LayoutHandle::find_layout (layout);
if (! handle) {
handle = new lay::LayoutHandle (layout, std::string ());
}
return view->add_layout (handle, add_cellview);
}

static unsigned int show_layout2 (lay::LayoutViewBase *view, db::Layout *layout, std::string &tech, bool add_cellview)
{
// the layout gets held by the LayoutHandle object
layout->keep ();
lay::LayoutHandle *handle = new lay::LayoutHandle (layout, std::string ());
lay::LayoutHandle *handle = lay::LayoutHandle::find_layout (layout);
if (! handle) {
handle = new lay::LayoutHandle (layout, std::string ());
}
handle->set_tech_name (tech);
return view->add_layout (handle, add_cellview);
}
Expand All @@ -294,7 +300,10 @@ static unsigned int show_layout3 (lay::LayoutViewBase *view, db::Layout *layout,
{
// the layout gets held by the LayoutHandle object
layout->keep ();
lay::LayoutHandle *handle = new lay::LayoutHandle (layout, std::string ());
lay::LayoutHandle *handle = lay::LayoutHandle::find_layout (layout);
if (! handle) {
handle = new lay::LayoutHandle (layout, std::string ());
}
handle->set_tech_name (tech);
return view->add_layout (handle, add_cellview, initialize_layers);
}
Expand Down
15 changes: 15 additions & 0 deletions src/laybasic/laybasic/layCellView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,17 @@ LayoutHandle::find (const std::string &name)
}
}

LayoutHandle *
LayoutHandle::find_layout (const db::Layout *layout)
{
for (auto h = ms_dict.begin (); h != ms_dict.end (); ++h) {
if (h->second->mp_layout == layout) {
return h->second;
}
}
return 0;
}

void
LayoutHandle::get_names (std::vector <std::string> &names)
{
Expand Down Expand Up @@ -484,6 +495,10 @@ LayoutHandleRef::operator= (const LayoutHandleRef &r)
void
LayoutHandleRef::set (LayoutHandle *h)
{
if (mp_handle == h) {
return;
}

if (mp_handle) {
mp_handle->remove_ref ();
mp_handle = 0;
Expand Down
8 changes: 8 additions & 0 deletions src/laybasic/laybasic/layCellView.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ class LAYBASIC_PUBLIC LayoutHandle
*/
static LayoutHandle *find (const std::string &name);

/**
* @brief Finds a handle by layout object
*
* @param layout The Layout object bound to the handle
* @return 0, if there is no layout object with this name. Otherwise a pointer to its handle
*/
static LayoutHandle *find_layout (const db::Layout *layout);

/**
* @brief Gets the names of all registered layout objects
*/
Expand Down
12 changes: 12 additions & 0 deletions src/layui/layui/rdbMarkerBrowserPage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,18 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/)
markers_list->header ()->setSortIndicatorShown (true);
markers_list->header ()->setMinimumSectionSize (24);

QAction *select_all_info_action = new QAction (this);
select_all_info_action->setText (tr ("Select All"));
connect (select_all_info_action, SIGNAL (triggered ()), info_text, SLOT (selectAll ()));

QAction *copy_info_action = new QAction (this);
copy_info_action->setText (tr ("Copy"));
connect (copy_info_action, SIGNAL (triggered ()), info_text, SLOT (copy ()));

info_text->addAction (select_all_info_action);
info_text->addAction (copy_info_action);
info_text->setContextMenuPolicy (Qt::ActionsContextMenu);

list_shapes_cb->setChecked (m_list_shapes);

connect (markers_list, SIGNAL (doubleClicked (const QModelIndex &)), this, SLOT (marker_double_clicked (const QModelIndex &)));
Expand Down
18 changes: 18 additions & 0 deletions testdata/ruby/dbLayoutTests1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,24 @@ def test_23

end

def test_24

ly = RBA::Layout::new
ly.set_property("k1", 17)
ly.set_property(17, "42")

assert_equal(17, ly.property("k1"))
assert_equal("42", ly.property(17))
assert_equal(nil, ly.property(42))

ly_dup = ly.dup

assert_equal(17, ly_dup.property("k1"))
assert_equal("42", ly_dup.property(17))
assert_equal(nil, ly_dup.property(42))

end

# Iterating while flatten
def test_issue200

Expand Down
20 changes: 20 additions & 0 deletions testdata/ruby/layLayoutView.rb
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,26 @@ def test_7

end

# issue-1533
def test_8

if !RBA.constants.member?(:Application)
return
end

app = RBA::Application.instance
mw = app.main_window
mw.close_all
mw.create_view

ly = RBA::Layout::new
mw.current_view.show_layout(ly, false)

# was crashing
mw.current_view.show_layout(ly, false)

end

end

load("test_epilogue.rb")
Expand Down
Loading