mirror of https://github.com/KLayout/klayout.git
WIP: bugfixing.
This commit is contained in:
parent
78695f9c23
commit
fcf4fd74f6
|
|
@ -481,7 +481,7 @@ Layout::set_technology_name (const std::string &tech)
|
|||
|
||||
}
|
||||
|
||||
if (mapping.empty ()) {
|
||||
if (! mapping.empty ()) {
|
||||
|
||||
bool needs_cleanup = false;
|
||||
|
||||
|
|
@ -495,7 +495,8 @@ Layout::set_technology_name (const std::string &tech)
|
|||
db::LibraryProxy *lib_proxy = dynamic_cast<db::LibraryProxy *> (&*c);
|
||||
if (lib_proxy && (m = mapping.find (lib_proxy->lib_id ())) != mapping.end ()) {
|
||||
|
||||
db::Cell *lib_cell = &cell (lib_proxy->library_cell_index ());
|
||||
db::Library *lib = db::LibraryManager::instance ().lib (lib_proxy->lib_id ());
|
||||
db::Cell *lib_cell = &lib->layout ().cell (lib_proxy->library_cell_index ());
|
||||
db::PCellVariant *lib_pcell = dynamic_cast <db::PCellVariant *> (lib_cell);
|
||||
if (lib_pcell) {
|
||||
pcells_to_map.push_back (std::make_pair (lib_proxy, lib_pcell));
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ LibraryManager::lib_by_name (const std::string &name, const std::set<std::string
|
|||
{
|
||||
iterator l = m_lib_by_name.find (name);
|
||||
while (l != m_lib_by_name.end () && l->first == name) {
|
||||
bool found = true;
|
||||
for (std::set<std::string>::const_iterator t = for_technologies.begin (); t != for_technologies.end (); ++t) {
|
||||
if (! lib (l->second)->is_for_technology (*t)) {
|
||||
const db::Library *lptr = lib (l->second);
|
||||
bool found = lptr->for_technologies ();
|
||||
for (std::set<std::string>::const_iterator t = for_technologies.begin (); t != for_technologies.end () && found; ++t) {
|
||||
if (! lptr->is_for_technology (*t)) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
|
|
@ -83,6 +83,15 @@ LibraryManager::lib_by_name (const std::string &name, const std::set<std::string
|
|||
++l;
|
||||
}
|
||||
|
||||
// fallback: technology-unspecific libs
|
||||
l = m_lib_by_name.find (name);
|
||||
while (l != m_lib_by_name.end () && l->first == name) {
|
||||
if (! lib (l->second)->for_technologies ()) {
|
||||
return std::make_pair (true, l->second);
|
||||
}
|
||||
++l;
|
||||
}
|
||||
|
||||
return std::make_pair (false, lib_id_type (0));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -626,7 +626,8 @@ TEST(4)
|
|||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").second, lib_a1->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Z").first, false);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, false);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").second, lib_a1->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").second, lib_a1->get_id ());
|
||||
|
||||
|
|
@ -637,7 +638,8 @@ TEST(4)
|
|||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").second, lib_a2->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Z").first, false);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, false);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").second, lib_a2->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").second, lib_a1->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Y").first, true);
|
||||
|
|
@ -650,7 +652,23 @@ TEST(4)
|
|||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").second, lib_a3->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Z").first, false);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, false);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").second, lib_a3->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").second, lib_a3->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Y").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Y").second, lib_a2->get_id ());
|
||||
|
||||
|
||||
LIBT_A *lib_a4 = new LIBT_A ();
|
||||
db::LibraryManager::instance ().register_lib (lib_a4);
|
||||
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A").second, lib_a3->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Z").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Z").second, lib_a4->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "").second, lib_a3->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").first, true);
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "X").second, lib_a3->get_id ());
|
||||
EXPECT_EQ (db::LibraryManager::instance ().lib_by_name ("A", "Y").first, true);
|
||||
|
|
|
|||
|
|
@ -440,14 +440,13 @@ EditorOptionsInst::update_cell_edits ()
|
|||
}
|
||||
|
||||
db::Layout *layout = 0;
|
||||
lay::LayoutView *view = lay::LayoutView::current ();
|
||||
|
||||
// find the layout the cell has to be looked up: that is either the layout of the current instance or
|
||||
// the library selected
|
||||
if (mp_ui->lib_cbx->current_library ()) {
|
||||
layout = &mp_ui->lib_cbx->current_library ()->layout ();
|
||||
} else if (view && view->cellview (m_cv_index).is_valid ()) {
|
||||
layout = &view->cellview (m_cv_index)->layout ();
|
||||
} else if (view ()->cellview (m_cv_index).is_valid ()) {
|
||||
layout = &view ()->cellview (m_cv_index)->layout ();
|
||||
}
|
||||
|
||||
if (! layout) {
|
||||
|
|
@ -485,7 +484,7 @@ EditorOptionsInst::browse_cell ()
|
|||
{
|
||||
BEGIN_PROTECTED
|
||||
|
||||
if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
|
||||
if (m_cv_index >= 0 && view ()->cellview (m_cv_index).is_valid ()) {
|
||||
|
||||
// find the layout the cell has to be looked up: that is either the layout of the current instance or
|
||||
// the library selected
|
||||
|
|
@ -495,7 +494,7 @@ BEGIN_PROTECTED
|
|||
lib = mp_ui->lib_cbx->current_library ();
|
||||
layout = &lib->layout ();
|
||||
} else {
|
||||
layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
|
||||
layout = &view ()->cellview (m_cv_index)->layout ();
|
||||
}
|
||||
|
||||
bool all_cells = (mp_ui->lib_cbx->current_library () != 0 ? false : true);
|
||||
|
|
@ -605,12 +604,10 @@ EditorOptionsInst::setup (lay::Dispatcher *root)
|
|||
std::string techname;
|
||||
|
||||
mp_ui->lib_cbx->update_list ();
|
||||
if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
|
||||
techname = lay::LayoutView::current ()->cellview (m_cv_index)->tech_name ();
|
||||
mp_ui->lib_cbx->set_technology_filter (techname, true);
|
||||
} else {
|
||||
mp_ui->lib_cbx->set_technology_filter (std::string (), false);
|
||||
if (m_cv_index >= 0 && view ()->cellview (m_cv_index).is_valid ()) {
|
||||
techname = view ()->cellview (m_cv_index)->tech_name ();
|
||||
}
|
||||
mp_ui->lib_cbx->set_technology_filter (techname, ! techname.empty ());
|
||||
|
||||
// cell name
|
||||
std::string s;
|
||||
|
|
@ -707,11 +704,11 @@ EditorOptionsInstPCellParam::apply (lay::Dispatcher *root)
|
|||
std::string param;
|
||||
db::Layout *layout = 0;
|
||||
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, view ()->active_cellview_ref ()->tech_name ());
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, view ()->active_cellview ().is_valid () ? view ()->active_cellview ()->tech_name () : std::string ());
|
||||
if (lib) {
|
||||
layout = &lib->layout ();
|
||||
} else if (m_cv_index >= 0 && lay::LayoutView::current () && lay::LayoutView::current ()->cellview (m_cv_index).is_valid ()) {
|
||||
layout = &lay::LayoutView::current ()->cellview (m_cv_index)->layout ();
|
||||
} else if (m_cv_index >= 0 && view ()->cellview (m_cv_index).is_valid ()) {
|
||||
layout = &view ()->cellview (m_cv_index)->layout ();
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
|
|
@ -760,7 +757,7 @@ EditorOptionsInstPCellParam::setup (lay::Dispatcher *root)
|
|||
needs_update = true;
|
||||
}
|
||||
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, view ()->active_cellview_ref ()->tech_name ());
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, view ()->active_cellview ().is_valid () ? view ()->active_cellview ()->tech_name () : std::string ());
|
||||
|
||||
// pcell parameters
|
||||
std::string param;
|
||||
|
|
@ -840,7 +837,7 @@ EditorOptionsInstPCellParam::update_pcell_parameters (const std::vector <tl::Var
|
|||
|
||||
// find the layout the cell has to be looked up: that is either the layout of the current instance or
|
||||
// the library selected
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, view ()->active_cellview_ref ()->tech_name ());
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, view ()->active_cellview ().is_valid () ? view ()->active_cellview ()->tech_name () : std::string ());
|
||||
if (lib) {
|
||||
layout = &lib->layout ();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,11 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std
|
|||
const db::Library *lib = 0;
|
||||
for (std::list<ConfigurationDescriptor>::const_iterator c = m_cfg.begin (); c != m_cfg.end (); ++c, ++libname_column) {
|
||||
if (c->rendering == RecentConfigurationPage::CellLibraryName) {
|
||||
lib = db::LibraryManager::instance ().lib_ptr_by_name (values [libname_column], view ()->active_cellview_ref ()->tech_name ());
|
||||
if (view ()->active_cellview ().is_valid ()) {
|
||||
lib = db::LibraryManager::instance ().lib_ptr_by_name (values [libname_column], view ()->active_cellview ()->tech_name ());
|
||||
} else {
|
||||
lib = db::LibraryManager::instance ().lib_ptr_by_name (values [libname_column]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1854,7 +1854,12 @@ InstService::switch_cell_or_pcell (bool switch_parameters)
|
|||
}
|
||||
|
||||
const lay::CellView &cv = view ()->cellview (m_cv_index);
|
||||
db::Library *lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, cv->tech_name ());
|
||||
db::Library *lib = 0;
|
||||
if (cv.is_valid ()) {
|
||||
lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name, cv->tech_name ());
|
||||
} else {
|
||||
lib = db::LibraryManager::instance ().lib_ptr_by_name (m_lib_name);
|
||||
}
|
||||
|
||||
// find the layout the cell has to be looked up: that is either the layout of the current instance or
|
||||
// the library selected
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@ struct LayerSelectionComboBoxPrivateData
|
|||
const db::Layout *layout;
|
||||
lay::LayoutView *view;
|
||||
int cv_index;
|
||||
db::LayerProperties last_props;
|
||||
};
|
||||
|
||||
LayerSelectionComboBox::LayerSelectionComboBox (QWidget *parent)
|
||||
|
|
@ -424,6 +425,14 @@ LayerSelectionComboBox::set_view (lay::LayoutView *view, int cv_index, bool all_
|
|||
mp_private->cv_index = cv_index;
|
||||
mp_private->all_layers = all_layers;
|
||||
|
||||
view->layer_list_changed_event.add (this, &LayerSelectionComboBox::on_layer_list_changed);
|
||||
|
||||
update_layer_list ();
|
||||
}
|
||||
|
||||
void
|
||||
LayerSelectionComboBox::on_layer_list_changed (int)
|
||||
{
|
||||
update_layer_list ();
|
||||
}
|
||||
|
||||
|
|
@ -442,7 +451,7 @@ void
|
|||
LayerSelectionComboBox::update_layer_list ()
|
||||
{
|
||||
int i = currentIndex ();
|
||||
db::LayerProperties props;
|
||||
db::LayerProperties props = mp_private->last_props;
|
||||
if (i >= 0 && i < int (mp_private->layers.size ())) {
|
||||
props = mp_private->layers [i].first;
|
||||
}
|
||||
|
|
@ -522,6 +531,8 @@ LayerSelectionComboBox::update_layer_list ()
|
|||
void
|
||||
LayerSelectionComboBox::set_current_layer (const db::LayerProperties &props)
|
||||
{
|
||||
mp_private->last_props = props;
|
||||
|
||||
for (std::vector <std::pair <db::LayerProperties, int> >::iterator ll = mp_private->layers.begin (); ll != mp_private->layers.end (); ++ll) {
|
||||
if (ll->first.log_equal (props)) {
|
||||
setCurrentIndex (std::distance (mp_private->layers.begin (), ll));
|
||||
|
|
@ -562,7 +573,7 @@ LayerSelectionComboBox::current_layer_props () const
|
|||
{
|
||||
int i = currentIndex ();
|
||||
if (i < 0 || i > int (mp_private->layers.size ())) {
|
||||
return db::LayerProperties ();
|
||||
return mp_private->last_props;
|
||||
} else {
|
||||
return mp_private->layers [i].first;
|
||||
}
|
||||
|
|
@ -600,7 +611,7 @@ LibrarySelectionComboBox::update_list ()
|
|||
for (db::LibraryManager::iterator l = db::LibraryManager::instance ().begin (); l != db::LibraryManager::instance ().end (); ++l) {
|
||||
|
||||
db::Library *lib = db::LibraryManager::instance ().lib (l->second);
|
||||
if (! m_tech_set || !lib->for_technologies ()|| lib->is_for_technology (m_tech)) {
|
||||
if (! m_tech_set || !lib->for_technologies () || lib->is_for_technology (m_tech)) {
|
||||
|
||||
std::string item_text = lib->get_name ();
|
||||
if (! lib->get_description ().empty ()) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "laybasicCommon.h"
|
||||
|
||||
#include "tlObject.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
|
@ -170,7 +172,7 @@ private:
|
|||
* This combo box allows selecting a (physical) layer from a layout
|
||||
*/
|
||||
class LAYBASIC_PUBLIC LayerSelectionComboBox
|
||||
: public QComboBox
|
||||
: public QComboBox, public tl::Object
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -249,6 +251,7 @@ protected slots:
|
|||
private:
|
||||
LayerSelectionComboBoxPrivateData *mp_private;
|
||||
|
||||
void on_layer_list_changed (int);
|
||||
void update_layer_list ();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue