| 47 | |
| 48 | |
| 49 | LayoutHandle::LayoutHandle (db::Layout *layout, const std::string &filename) |
| 50 | : mp_layout (layout), |
| 51 | m_ref_count (0), |
| 52 | m_filename (filename), |
| 53 | m_dirty (false), |
| 54 | m_save_options_valid (false) |
| 55 | { |
| 56 | // the layout gets held by the LayoutHandle object |
| 57 | layout->keep (); |
| 58 | |
| 59 | layout->technology_changed_event.add (this, &LayoutHandle::on_technology_changed); |
| 60 | |
| 61 | // layouts in the managed layouts space participate in spare proxy cleanup |
| 62 | layout->do_cleanup (true); |
| 63 | |
| 64 | add_file_to_watcher (m_filename); |
| 65 | |
| 66 | if (! m_filename.empty ()) { |
| 67 | rename (filename_for_caption (m_filename)); |
| 68 | } else { |
| 69 | |
| 70 | // create a unique new name |
| 71 | static int nn = 0; |
| 72 | |
| 73 | std::string n; |
| 74 | do { |
| 75 | n = tl::sprintf ("L%d", ++nn); |
| 76 | } while (find (n) != 0); |
| 77 | |
| 78 | m_name = n; |
| 79 | ms_dict.insert (std::make_pair (n, this)); |
| 80 | |
| 81 | } |
| 82 | |
| 83 | mp_layout->hier_changed_event.add (this, &LayoutHandle::layout_changed); |
| 84 | mp_layout->bboxes_changed_any_event.add (this, &LayoutHandle::layout_changed); |
| 85 | mp_layout->cell_name_changed_event.add (this, &LayoutHandle::layout_changed); |
| 86 | mp_layout->prop_ids_changed_event.add (this, &LayoutHandle::layout_changed); |
| 87 | mp_layout->layer_properties_changed_event.add (this, &LayoutHandle::layout_changed); |
| 88 | |
| 89 | if (tl::verbosity () >= 30) { |
| 90 | tl::info << "Created layout " << name (); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | LayoutHandle::~LayoutHandle () |
| 95 | { |
nothing calls this directly
no test coverage detected