mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
a957386291
commit
0bb0cb4a12
|
|
@ -73,6 +73,47 @@ static NO_RETURN void raise_invalid_hole_index_on_simple_polygon ()
|
|||
// -------------------------------------------------------------------------------
|
||||
// Shape implementation
|
||||
|
||||
int Shape::layer () const
|
||||
{
|
||||
const db::Shapes *sh = shapes ();
|
||||
if (! sh) {
|
||||
return -1;
|
||||
}
|
||||
const db::Cell *cell = sh->cell ();
|
||||
if (! cell) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int li = cell->index_of_shapes (sh);
|
||||
return li < cell->layers () ? int (li) : -1;
|
||||
}
|
||||
|
||||
void Shape::set_layer (unsigned int layer_index)
|
||||
{
|
||||
db::Shapes *sh = shapes ();
|
||||
if (! sh) {
|
||||
return;
|
||||
}
|
||||
db::Cell *cell = sh->cell ();
|
||||
if (! cell) {
|
||||
return;
|
||||
}
|
||||
db::Layout *layout = cell->layout ();
|
||||
if (! layout || ! layout->is_valid_layer (layer_index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
db::Shapes *target_sh = &cell->shapes (layer_index);
|
||||
if (target_sh != sh) {
|
||||
|
||||
// move the shape inside the cell
|
||||
db::Shape new_shape = target_sh->insert (*this);
|
||||
sh->erase_shape (*this);
|
||||
*this = new_shape;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
db::properties_id_type Shape::prop_id () const
|
||||
{
|
||||
if (m_with_props) {
|
||||
|
|
|
|||
|
|
@ -1098,6 +1098,26 @@ public:
|
|||
m_type = UserObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the index of layer the shape sits in
|
||||
*
|
||||
* This getter only applies to shapes that are members of a cell
|
||||
* and a layout.
|
||||
* For other shapes this method returns -1.
|
||||
*/
|
||||
int layer () const;
|
||||
|
||||
/**
|
||||
* @brief Changes the layer the shape sits in
|
||||
*
|
||||
* This setter applies to shapes are are members of a cell
|
||||
* and a layout.
|
||||
* Changing the layer effectively moves the shape to a different
|
||||
* container. For invalid layer indexes or if the shape is
|
||||
* not member of a cell and layout, this method does nothing.
|
||||
*/
|
||||
void set_layer (unsigned int layer_index);
|
||||
|
||||
/**
|
||||
* @brief Get the properties Id associated with the shape
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1047,3 +1047,32 @@ TEST(10)
|
|||
si = s.begin (db::ShapeIterator::All);
|
||||
EXPECT_EQ (si->rectangle ().empty (), true);
|
||||
}
|
||||
|
||||
// layer index setter/getter
|
||||
TEST(20)
|
||||
{
|
||||
db::Shape sh0;
|
||||
EXPECT_EQ (sh0.layer (), -1);
|
||||
|
||||
db::Layout ly (true);
|
||||
|
||||
unsigned int l1 = ly.get_layer (db::LayerProperties (1, 0));
|
||||
unsigned int l2 = ly.get_layer (db::LayerProperties (2, 0));
|
||||
|
||||
db::Cell &top = ly.cell (ly.add_cell ("TOP"));
|
||||
db::Shape sh = top.shapes (l1).insert (db::Box (0, 0, 1000, 2000));
|
||||
|
||||
EXPECT_EQ (top.shapes (l1).size (), size_t (1));
|
||||
EXPECT_EQ (top.shapes (l2).size (), size_t (0));
|
||||
|
||||
EXPECT_EQ (sh.layer (), int (l1));
|
||||
EXPECT_EQ (sh.to_string (), "box (0,0;1000,2000)");
|
||||
|
||||
sh.set_layer (l2);
|
||||
|
||||
EXPECT_EQ (sh.layer (), int (l2));
|
||||
EXPECT_EQ (sh.to_string (), "box (0,0;1000,2000)");
|
||||
|
||||
EXPECT_EQ (top.shapes (l1).size (), size_t (0));
|
||||
EXPECT_EQ (top.shapes (l2).size (), size_t (1));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<widget class="QLabel" name="cell_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
|
@ -68,6 +68,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="lay::LayerSelectionComboBox" name="layer_cbx">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -576,6 +583,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::LayerSelectionComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>layWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>mode_tab</tabstop>
|
||||
<tabstop>x1_le_1</tabstop>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@
|
|||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
|
|
@ -109,10 +108,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<widget class="QLabel" name="cell_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
|
@ -124,6 +123,9 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="lay::LayerSelectionComboBox" name="layer_cbx"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -334,6 +336,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::LayerSelectionComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>layWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>width_le</tabstop>
|
||||
<tabstop>ptlist_le</tabstop>
|
||||
|
|
|
|||
|
|
@ -264,7 +264,6 @@
|
|||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
|
|
@ -277,10 +276,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<widget class="QLabel" name="cell_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
|
@ -292,6 +291,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="lay::LayerSelectionComboBox" name="layer_cbx">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -304,6 +310,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::LayerSelectionComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>layWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>width_le</tabstop>
|
||||
<tabstop>ptlist_le</tabstop>
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<widget class="QLabel" name="cell_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
|
@ -68,6 +68,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="lay::LayerSelectionComboBox" name="layer_cbx">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -271,6 +278,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::LayerSelectionComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>layWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>x_le</tabstop>
|
||||
<tabstop>y_le</tabstop>
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@
|
|||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
|
|
@ -122,10 +121,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<widget class="QLabel" name="cell_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
|
@ -137,6 +136,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="lay::LayerSelectionComboBox" name="layer_cbx">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -225,6 +231,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::LayerSelectionComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>layWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>pointListEdit</tabstop>
|
||||
<tabstop>dbu_cb</tabstop>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>568</width>
|
||||
<height>375</height>
|
||||
<height>378</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -245,10 +245,10 @@ to show text objects scaled and rotated</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<widget class="QLabel" name="cell_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
|
|
@ -260,6 +260,13 @@ to show text objects scaled and rotated</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="lay::LayerSelectionComboBox" name="layer_cbx">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -413,6 +420,13 @@ to show text objects scaled and rotated</string>
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>lay::LayerSelectionComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>layWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>text_le</tabstop>
|
||||
<tabstop>x_le</tabstop>
|
||||
|
|
|
|||
|
|
@ -76,12 +76,12 @@ bool CombinedChangeApplicator::supports_relative_mode () const
|
|||
return false;
|
||||
}
|
||||
|
||||
db::Shape CombinedChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const
|
||||
db::Shape CombinedChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const
|
||||
{
|
||||
db::Shape s = shape;
|
||||
for (std::vector<ChangeApplicator *>::const_iterator a = m_appl.begin (); a != m_appl.end (); ++a) {
|
||||
if (*a) {
|
||||
s = (*a)->do_apply (shapes, s, dbu, relative);
|
||||
s = (*a)->do_apply (shapes, s, dbu, cv_index, layer, relative);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
|
|
@ -107,7 +107,7 @@ ChangePropertiesApplicator::ChangePropertiesApplicator (db::properties_id_type p
|
|||
// .. nothing yet ...
|
||||
}
|
||||
|
||||
db::Shape ChangePropertiesApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape ChangePropertiesApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
return shapes.replace_prop_id (shape, m_prop_id);
|
||||
}
|
||||
|
|
@ -117,6 +117,24 @@ db::Instance ChangePropertiesApplicator::do_apply_inst (db::Cell &cell, const db
|
|||
return cell.replace_prop_id (instance, m_prop_id);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ChangeLayerApplicator implementation
|
||||
|
||||
ChangeLayerApplicator::ChangeLayerApplicator (unsigned int cv_index, unsigned int new_layer)
|
||||
: m_cv_index (cv_index), m_new_layer (new_layer)
|
||||
{
|
||||
// .. nothing yet ...
|
||||
}
|
||||
|
||||
db::Shape ChangeLayerApplicator::do_apply (db::Shapes & /*shapes*/, const db::Shape &shape, double /*dbu*/, unsigned int cv_index, unsigned int layer, bool /*relative*/) const
|
||||
{
|
||||
db::Shape s = shape;
|
||||
if (m_cv_index == cv_index && layer != m_new_layer) {
|
||||
s.set_layer (m_new_layer);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// BoxDimensionsChangeApplicator implementation
|
||||
|
||||
|
|
@ -126,7 +144,7 @@ BoxDimensionsChangeApplicator::BoxDimensionsChangeApplicator (db::Coord dl, db::
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape BoxDimensionsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
db::Shape BoxDimensionsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool relative) const
|
||||
{
|
||||
db::Box org_box;
|
||||
shape.box (org_box);
|
||||
|
|
@ -207,7 +225,7 @@ PointDimensionsChangeApplicator::PointDimensionsChangeApplicator (const db::Poin
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PointDimensionsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
db::Shape PointDimensionsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool relative) const
|
||||
{
|
||||
db::Point org_point;
|
||||
shape.point (org_point);
|
||||
|
|
@ -243,8 +261,10 @@ PolygonChangeApplicator::PolygonChangeApplicator (const db::Polygon &poly, const
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PolygonChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
db::Shape PolygonChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool relative) const
|
||||
{
|
||||
db::Shape s = shape;
|
||||
|
||||
db::Polygon org_poly;
|
||||
shape.polygon (org_poly);
|
||||
|
||||
|
|
@ -254,19 +274,19 @@ db::Shape PolygonChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape
|
|||
|
||||
if (new_poly != org_poly) {
|
||||
// shape changed - replace the old by the new one
|
||||
return shapes.replace (shape, new_poly);
|
||||
s = shapes.replace (shape, new_poly);
|
||||
} else {
|
||||
// shape did not change
|
||||
return shape;
|
||||
}
|
||||
|
||||
} else if (m_poly != org_poly) {
|
||||
// shape changed - replace the old by the new one
|
||||
return shapes.replace (shape, m_poly);
|
||||
s = shapes.replace (shape, m_poly);
|
||||
} else {
|
||||
// shape did not change
|
||||
return shape;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
@ -278,7 +298,7 @@ TextOrientationChangeApplicator::TextOrientationChangeApplicator (const db::FTra
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape TextOrientationChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape TextOrientationChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Text org_text;
|
||||
shape.text (org_text);
|
||||
|
|
@ -304,7 +324,7 @@ TextPositionChangeApplicator::TextPositionChangeApplicator (const db::Vector &di
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape TextPositionChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
db::Shape TextPositionChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool relative) const
|
||||
{
|
||||
db::Text org_text;
|
||||
shape.text (org_text);
|
||||
|
|
@ -341,7 +361,7 @@ TextHAlignChangeApplicator::TextHAlignChangeApplicator (db::HAlign halign)
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape TextHAlignChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape TextHAlignChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Text org_text;
|
||||
shape.text (org_text);
|
||||
|
|
@ -367,7 +387,7 @@ TextVAlignChangeApplicator::TextVAlignChangeApplicator (db::VAlign valign)
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape TextVAlignChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape TextVAlignChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Text org_text;
|
||||
shape.text (org_text);
|
||||
|
|
@ -393,7 +413,7 @@ TextSizeChangeApplicator::TextSizeChangeApplicator (db::Coord size)
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape TextSizeChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape TextSizeChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Text org_text;
|
||||
shape.text (org_text);
|
||||
|
|
@ -419,7 +439,7 @@ TextStringChangeApplicator::TextStringChangeApplicator (const std::string &strin
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape TextStringChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape TextStringChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Text org_text;
|
||||
shape.text (org_text);
|
||||
|
|
@ -445,7 +465,7 @@ PathPointsChangeApplicator::PathPointsChangeApplicator (const std::vector<db::Po
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PathPointsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
db::Shape PathPointsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool relative) const
|
||||
{
|
||||
db::Path org_path;
|
||||
shape.path (org_path);
|
||||
|
|
@ -479,7 +499,7 @@ PathWidthChangeApplicator::PathWidthChangeApplicator (db::Coord w, db::Coord org
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PathWidthChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
db::Shape PathWidthChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool relative) const
|
||||
{
|
||||
db::Path org_path;
|
||||
shape.path (org_path);
|
||||
|
|
@ -517,7 +537,7 @@ PathStartExtensionChangeApplicator::PathStartExtensionChangeApplicator (db::Coor
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PathStartExtensionChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape PathStartExtensionChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Path org_path;
|
||||
shape.path (org_path);
|
||||
|
|
@ -547,7 +567,7 @@ PathEndExtensionChangeApplicator::PathEndExtensionChangeApplicator (db::Coord e)
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PathEndExtensionChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape PathEndExtensionChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Path org_path;
|
||||
shape.path (org_path);
|
||||
|
|
@ -577,7 +597,7 @@ PathRoundEndChangeApplicator::PathRoundEndChangeApplicator (bool r)
|
|||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PathRoundEndChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool /*relative*/) const
|
||||
db::Shape PathRoundEndChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
db::Path org_path;
|
||||
shape.path (org_path);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual db::Shape do_apply (db::Shapes & /*shapes*/, const db::Shape & /*shape*/, double /*dbu*/, bool /*relative*/) const
|
||||
virtual db::Shape do_apply (db::Shapes & /*shapes*/, const db::Shape & /*shape*/, double /*dbu*/, unsigned int /*cv_index*/, unsigned int /*layer*/, bool /*relative*/) const
|
||||
{
|
||||
return db::Shape ();
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ public:
|
|||
void add (ChangeApplicator *a);
|
||||
|
||||
bool supports_relative_mode () const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
db::Instance do_apply_inst (db::Cell &cell, const db::Instance &instance, double dbu, bool relative) const;
|
||||
|
||||
private:
|
||||
|
|
@ -107,13 +107,29 @@ public:
|
|||
ChangePropertiesApplicator (db::properties_id_type prop_id);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
db::Instance do_apply_inst (db::Cell &cell, const db::Instance &instance, double dbu, bool relative) const;
|
||||
|
||||
private:
|
||||
db::properties_id_type m_prop_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A property ID change applicator
|
||||
*/
|
||||
class ChangeLayerApplicator
|
||||
: public ChangeApplicator
|
||||
{
|
||||
public:
|
||||
ChangeLayerApplicator (unsigned int cv_index, unsigned int new_layer);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
unsigned int m_cv_index, m_new_layer;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A box change applicator
|
||||
*/
|
||||
|
|
@ -124,7 +140,7 @@ public:
|
|||
BoxDimensionsChangeApplicator (db::Coord dl, db::Coord db, db::Coord dr, db::Coord dt, db::Coord l, db::Coord b, db::Coord r, db::Coord t);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Coord m_dl, m_db, m_dr, m_dt;
|
||||
|
|
@ -141,7 +157,7 @@ public:
|
|||
PointDimensionsChangeApplicator (const db::Point &point, const db::Point &org_point);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Point m_point, m_org_point;
|
||||
|
|
@ -157,7 +173,7 @@ public:
|
|||
PolygonChangeApplicator (const db::Polygon &poly, const db::Polygon &org_poly);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Polygon m_poly, m_org_poly;
|
||||
|
|
@ -173,7 +189,7 @@ public:
|
|||
TextOrientationChangeApplicator (const db::FTrans &trans);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::FTrans m_trans;
|
||||
|
|
@ -189,7 +205,7 @@ public:
|
|||
TextPositionChangeApplicator (const db::Vector &disp, const db::Vector &org_disp);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Vector m_disp, m_org_disp;
|
||||
|
|
@ -205,7 +221,7 @@ public:
|
|||
TextHAlignChangeApplicator (db::HAlign halign);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::HAlign m_halign;
|
||||
|
|
@ -221,7 +237,7 @@ public:
|
|||
TextVAlignChangeApplicator (db::VAlign valign);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::VAlign m_valign;
|
||||
|
|
@ -237,7 +253,7 @@ public:
|
|||
TextSizeChangeApplicator (db::Coord size);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Coord m_size;
|
||||
|
|
@ -253,7 +269,7 @@ public:
|
|||
TextStringChangeApplicator (const std::string &string);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
std::string m_string;
|
||||
|
|
@ -269,7 +285,7 @@ public:
|
|||
PathPointsChangeApplicator (const std::vector<db::Point> &points, const std::vector<db::Point> &org_points);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
std::vector<db::Point> m_points, m_org_points;
|
||||
|
|
@ -285,7 +301,7 @@ public:
|
|||
PathWidthChangeApplicator (db::Coord w, db::Coord org_w);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Coord m_width, m_org_width;
|
||||
|
|
@ -301,7 +317,7 @@ public:
|
|||
PathStartExtensionChangeApplicator (db::Coord e);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Coord m_ext;
|
||||
|
|
@ -317,7 +333,7 @@ public:
|
|||
PathEndExtensionChangeApplicator (db::Coord e);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Coord m_ext;
|
||||
|
|
@ -333,7 +349,7 @@ public:
|
|||
PathRoundEndChangeApplicator (bool r);
|
||||
|
||||
bool supports_relative_mode () const { return false; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, unsigned int cv_index, unsigned int layer, bool relative) const;
|
||||
|
||||
private:
|
||||
bool m_round;
|
||||
|
|
|
|||
|
|
@ -63,12 +63,18 @@ ShapePropertiesPage::~ShapePropertiesPage ()
|
|||
void
|
||||
ShapePropertiesPage::setup ()
|
||||
{
|
||||
m_enable_cb_callback = false;
|
||||
|
||||
layer_selector ()->set_new_layer_enabled (false);
|
||||
layer_selector ()->set_no_layer_available (false);
|
||||
|
||||
connect (dbu_checkbox (), SIGNAL (toggled (bool)), this, SLOT (display_mode_changed (bool)));
|
||||
connect (abs_checkbox (), SIGNAL (toggled (bool)), this, SLOT (display_mode_changed (bool)));
|
||||
connect (layer_selector (), SIGNAL (current_layer_changed ()), this, SLOT (current_layer_changed ()));
|
||||
|
||||
m_enable_cb_callback = false;
|
||||
dbu_checkbox ()->setChecked (mp_service->view ()->dbu_coordinates ());
|
||||
abs_checkbox ()->setChecked (mp_service->view ()->absolute_coordinates ());
|
||||
|
||||
m_enable_cb_callback = true;
|
||||
}
|
||||
|
||||
|
|
@ -206,6 +212,18 @@ BEGIN_PROTECTED
|
|||
END_PROTECTED
|
||||
}
|
||||
|
||||
void
|
||||
ShapePropertiesPage::current_layer_changed ()
|
||||
{
|
||||
if (m_enable_cb_callback) {
|
||||
try {
|
||||
emit edited ();
|
||||
} catch (tl::Exception &) {
|
||||
// ignore exceptions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShapePropertiesPage::update ()
|
||||
{
|
||||
|
|
@ -260,6 +278,11 @@ ShapePropertiesPage::do_apply (bool current_only, bool relative, bool commit)
|
|||
if (m_prop_id != pos->shape ().prop_id ()) {
|
||||
applicator.reset (new CombinedChangeApplicator (applicator.release (), new ChangePropertiesApplicator (m_prop_id)));
|
||||
}
|
||||
|
||||
int new_layer = layer_selector ()->current_layer ();
|
||||
if (new_layer >= 0 && int (pos->layer ()) != new_layer) {
|
||||
applicator.reset (new CombinedChangeApplicator (applicator.release (), new ChangeLayerApplicator (cv_index, (unsigned int) new_layer)));
|
||||
}
|
||||
}
|
||||
|
||||
if (! applicator.get ()) {
|
||||
|
|
@ -320,7 +343,7 @@ ShapePropertiesPage::do_apply (bool current_only, bool relative, bool commit)
|
|||
double dbu = layout.dbu ();
|
||||
|
||||
if (!current_only || pos->shape () == current) {
|
||||
new_shape = applicator->do_apply (shapes, pos->shape (), dbu, relative_mode);
|
||||
new_shape = applicator->do_apply (shapes, pos->shape (), dbu, pos->cv_index (), pos->layer (), relative_mode);
|
||||
}
|
||||
|
||||
shapes_seen.insert (std::make_pair (pos->shape (), new_shape));
|
||||
|
|
@ -333,9 +356,10 @@ ShapePropertiesPage::do_apply (bool current_only, bool relative, bool commit)
|
|||
|
||||
// change selection to new shape
|
||||
new_sel[index].set_shape (new_shape);
|
||||
new_sel[index].set_layer (new_shape.layer ());
|
||||
|
||||
mp_service->select (*pos, lay::Editable::Reset);
|
||||
mp_service->select (new_sel [index], lay::Editable::Add);
|
||||
mp_service->select (new_sel[index], lay::Editable::Add);
|
||||
|
||||
update_required = true;
|
||||
|
||||
|
|
@ -348,7 +372,7 @@ ShapePropertiesPage::do_apply (bool current_only, bool relative, bool commit)
|
|||
new_sel[index] = gs.second;
|
||||
|
||||
mp_service->select (*pos, lay::Editable::Reset);
|
||||
mp_service->select (new_sel [index], lay::Editable::Add);
|
||||
mp_service->select (new_sel[index], lay::Editable::Add);
|
||||
|
||||
update_required = true;
|
||||
|
||||
|
|
@ -379,7 +403,7 @@ ShapePropertiesPage::apply (bool commit)
|
|||
bool
|
||||
ShapePropertiesPage::can_apply_to_all () const
|
||||
{
|
||||
return m_selection_ptrs.size () > 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -397,31 +421,28 @@ ShapePropertiesPage::update_shape ()
|
|||
|
||||
EditableSelectionIterator::pointer pos = m_selection_ptrs [m_indexes.front ()];
|
||||
|
||||
const lay::CellView &cv = mp_service->view ()->cellview (pos->cv_index ());
|
||||
double dbu = cv->layout ().dbu ();
|
||||
|
||||
tl_assert (! pos->is_cell_inst ());
|
||||
|
||||
std::string layer (tl::to_string (QObject::tr ("Layer ")));
|
||||
const lay::CellView &cv = view ()->cellview (pos->cv_index ());
|
||||
double dbu = cv->layout ().dbu ();
|
||||
|
||||
std::string ln = cv->layout ().get_properties (pos->layer ()).to_string ();
|
||||
for (lay::LayerPropertiesConstIterator lp = mp_service->view ()->begin_layers (); ! lp.at_end (); ++lp) {
|
||||
if (lp->cellview_index () == int (pos->cv_index ()) && lp->layer_index () == int (pos->layer ())) {
|
||||
ln = lp->display_string (mp_service->view (), true, true);
|
||||
break;
|
||||
}
|
||||
m_enable_cb_callback = false;
|
||||
layer_selector ()->set_view (view (), pos->cv_index (), true);
|
||||
layer_selector ()->set_current_layer (pos->layer ());
|
||||
m_enable_cb_callback = true;
|
||||
|
||||
std::string cell_str;
|
||||
if (pos->shape ().shapes () && pos->shape ().shapes ()->cell () && pos->shape ().shapes ()->cell ()->layout ()) {
|
||||
auto ci = pos->shape ().shapes ()->cell ()->cell_index ();
|
||||
cell_str = tl::to_string (tr ("Cell: ")) + pos->shape ().shapes ()->cell ()->layout ()->cell_name (ci);
|
||||
}
|
||||
layer += ln;
|
||||
cell_label ()->setText (tl::to_qstring (cell_str));
|
||||
|
||||
layer += ", ";
|
||||
layer += tl::to_string (QObject::tr ("Cell "));
|
||||
layer += cv->layout ().cell_name (pos->cell_index ());
|
||||
|
||||
mp_service->view ()->set_current_layer (pos->cv_index (), cv->layout ().get_properties (pos->layer ()));
|
||||
view ()->set_current_layer (pos->cv_index (), cv->layout ().get_properties (pos->layer ()));
|
||||
|
||||
m_prop_id = pos->shape ().prop_id ();
|
||||
|
||||
do_update (pos->shape (), dbu, layer);
|
||||
do_update (pos->shape (), dbu);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -507,10 +528,8 @@ PolygonPropertiesPage::description (size_t entry) const
|
|||
}
|
||||
|
||||
void
|
||||
PolygonPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
PolygonPropertiesPage::do_update (const db::Shape &shape, double dbu)
|
||||
{
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Polygon poly;
|
||||
shape.polygon (poly);
|
||||
|
||||
|
|
@ -627,7 +646,6 @@ PolygonPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Sha
|
|||
db::Polygon org_poly;
|
||||
shape.polygon (org_poly);
|
||||
|
||||
// shape changed - replace the old by the new one
|
||||
return new PolygonChangeApplicator (poly, org_poly);
|
||||
}
|
||||
|
||||
|
|
@ -683,14 +701,12 @@ BoxPropertiesPage::description (size_t entry) const
|
|||
}
|
||||
|
||||
void
|
||||
BoxPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
BoxPropertiesPage::do_update (const db::Shape &shape, double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
m_lr_swapped = false;
|
||||
m_tb_swapped = false;
|
||||
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Box box;
|
||||
shape.box (box);
|
||||
set_box (box);
|
||||
|
|
@ -913,12 +929,10 @@ PointPropertiesPage::description (size_t entry) const
|
|||
}
|
||||
|
||||
void
|
||||
PointPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
PointPropertiesPage::do_update (const db::Shape &shape, double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Point point;
|
||||
shape.point (point);
|
||||
set_point (point);
|
||||
|
|
@ -1042,10 +1056,8 @@ TextPropertiesPage::description (size_t entry) const
|
|||
}
|
||||
|
||||
void
|
||||
TextPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
TextPropertiesPage::do_update (const db::Shape &shape, double dbu)
|
||||
{
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Text text;
|
||||
shape.text (text);
|
||||
|
||||
|
|
@ -1194,10 +1206,8 @@ PathPropertiesPage::description (size_t entry) const
|
|||
}
|
||||
|
||||
void
|
||||
PathPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
PathPropertiesPage::do_update (const db::Shape &shape, double dbu)
|
||||
{
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Path path;
|
||||
shape.path (path);
|
||||
|
||||
|
|
@ -1298,10 +1308,8 @@ EditablePathPropertiesPage::description (size_t entry) const
|
|||
}
|
||||
|
||||
void
|
||||
EditablePathPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
EditablePathPropertiesPage::do_update (const db::Shape &shape, double dbu)
|
||||
{
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Path path;
|
||||
shape.path (path);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "layPlugin.h"
|
||||
#include "layProperties.h"
|
||||
#include "layWidgets.h"
|
||||
#include "edtService.h"
|
||||
#include "ui_PolygonPropertiesPage.h"
|
||||
#include "ui_BoxPropertiesPage.h"
|
||||
|
|
@ -78,10 +79,12 @@ protected:
|
|||
bool m_enable_cb_callback;
|
||||
db::properties_id_type m_prop_id;
|
||||
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname) = 0;
|
||||
virtual void do_update (const db::Shape &shape, double dbu) = 0;
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu) = 0;
|
||||
virtual QCheckBox *dbu_checkbox () const = 0;
|
||||
virtual QCheckBox *abs_checkbox () const = 0;
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const = 0;
|
||||
virtual QLabel *cell_label () const = 0;
|
||||
bool dbu_units () const;
|
||||
bool abs_trans () const;
|
||||
db::ICplxTrans trans () const;
|
||||
|
|
@ -95,6 +98,7 @@ public slots:
|
|||
void show_props ();
|
||||
void display_mode_changed (bool);
|
||||
void update_shape ();
|
||||
void current_layer_changed ();
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -109,12 +113,14 @@ public:
|
|||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual void do_update (const db::Shape &shape, double dbu);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const { return layer_cbx; }
|
||||
virtual QLabel *cell_label () const { return cell_lbl; }
|
||||
|
||||
public slots:
|
||||
void text_changed ();
|
||||
|
|
@ -134,7 +140,7 @@ public:
|
|||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual void do_update (const db::Shape &shape, double dbu);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
public slots:
|
||||
|
|
@ -143,6 +149,8 @@ public slots:
|
|||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const { return layer_cbx; }
|
||||
virtual QLabel *cell_label () const { return cell_lbl; }
|
||||
|
||||
private:
|
||||
bool m_recursion_sentinel;
|
||||
|
|
@ -165,7 +173,7 @@ public:
|
|||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual void do_update (const db::Shape &shape, double dbu);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
public slots:
|
||||
|
|
@ -174,6 +182,8 @@ public slots:
|
|||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const { return layer_cbx; }
|
||||
virtual QLabel *cell_label () const { return cell_lbl; }
|
||||
|
||||
private:
|
||||
double m_dbu;
|
||||
|
|
@ -193,12 +203,14 @@ public:
|
|||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual void do_update (const db::Shape &shape, double dbu);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const { return layer_cbx; }
|
||||
virtual QLabel *cell_label () const { return cell_lbl; }
|
||||
};
|
||||
|
||||
class PathPropertiesPage
|
||||
|
|
@ -212,12 +224,14 @@ public:
|
|||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual void do_update (const db::Shape &shape, double dbu);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const { return layer_cbx; }
|
||||
virtual QLabel *cell_label () const { return cell_lbl; }
|
||||
|
||||
private:
|
||||
bool m_in_text_changed;
|
||||
|
|
@ -234,12 +248,14 @@ public:
|
|||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual void do_update (const db::Shape &shape, double dbu);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
virtual lay::LayerSelectionComboBox *layer_selector () const { return layer_cbx; }
|
||||
virtual QLabel *cell_label () const { return cell_lbl; }
|
||||
|
||||
public slots:
|
||||
void type_selected (int);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,17 @@ public:
|
|||
|
||||
void emit_data_changed ()
|
||||
{
|
||||
emit dataChanged (index (0, 0, QModelIndex ()), index (rowCount (QModelIndex ()) - 1, columnCount (QModelIndex ()) - 1, QModelIndex ()));
|
||||
int cc = columnCount (QModelIndex ());
|
||||
int rc = rowCount (QModelIndex ());
|
||||
|
||||
emit dataChanged (index (0, 0, QModelIndex ()), index (rc - 1, cc - 1, QModelIndex ()));
|
||||
|
||||
// data changes for the children too
|
||||
for (int i = 0; i < rc; ++i) {
|
||||
auto p = index (i, 0, QModelIndex ());
|
||||
int ec = rowCount (p);
|
||||
emit dataChanged (index (0, 0, p), index (ec - 1, cc - 1, p));
|
||||
}
|
||||
}
|
||||
|
||||
void begin_reset_model ()
|
||||
|
|
|
|||
|
|
@ -608,8 +608,12 @@ BEGIN_PROTECTED
|
|||
// NOTE: add_new_layers has triggered update_layer_list which already added the new layer
|
||||
set_current_layer (lp);
|
||||
|
||||
emit current_layer_changed ();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
emit current_layer_changed ();
|
||||
}
|
||||
|
||||
END_PROTECTED;
|
||||
|
|
|
|||
|
|
@ -310,6 +310,13 @@ public:
|
|||
*/
|
||||
db::LayerProperties current_layer_props () const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal indicating that the user selected a new layer
|
||||
* This signal is emitted if the layer is edited. It is not emitted on programmatic changes.
|
||||
*/
|
||||
void current_layer_changed ();
|
||||
|
||||
protected slots:
|
||||
void item_selected (int index);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue