Merge branch 'master' into wip

This commit is contained in:
Matthias Koefferlein 2024-01-07 17:25:11 +01:00
commit 9a52095dd0
17 changed files with 431 additions and 99 deletions

View File

@ -1,6 +1,6 @@
Relevant KLayout version: 0.28.14<br>
Relevant KLayout version: 0.28.15<br>
Author: Kazzz-S<br>
Last modified: 2023-12-10<br>
Last modified: 2024-01-05<br>
# 1. Introduction
This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.13 or later for different 64-bit macOS, including:
@ -81,7 +81,7 @@ $ [python] ./build4mac.py
: Sys: use [Sonoma|Ventura|Monterey]-bundled Ruby 2.6 |
: MP32: use Ruby 3.2 from MacPorts |
: HB32: use Ruby 3.2 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 |
: Ana3: use Ruby 3.2 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'MP311', 'HB311', 'Ana3', | hb311
: 'MP39', 'hb311', 'HBAuto'] |
: nil: don't bind Python |
@ -215,10 +215,10 @@ $ ./build4mac.py -q qt5macports -r mp32 -p mp311 -Y
* "Rmp32Pmp311" means that Ruby is 3.2 from MacPorts; Python is 3.11 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.11
0. Install Anaconda3 (Anaconda3-2023.09-0-MacOSX-x86_64.pkg), then install Ruby 3.1 and libgit2 by
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.2 and Anaconda3 Python 3.11
0. Install Anaconda3 (Anaconda3-2023.09-0-MacOSX-x86_64.pkg), then install Ruby 3.2 and libgit2 by
```
$ conda install ruby=3.1.4
$ conda install ruby=3.2.2
$ conda install -c conda-forge libgit2
```
@ -239,7 +239,7 @@ $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y
**`LW-qt5Ana3.pkg.macos-Monterey-release-Rana3Pana3`** directory, where
* "LW-" means this is a lightweight package.
* "qt5Ana3" means that Qt5 from Anaconda3 is used.
* "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.11) is from Anaconda3.
* "Rana3Pana3" means that Ruby (3.2) is from Anaconda3; Python (3.11) is from Anaconda3.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
5. You may have to set the `PYTHONHOME` environment variable like:
```

View File

@ -63,7 +63,7 @@ def GenerateUsage(platform):
usage += " : Sys: use [Sonoma|Ventura|Monterey]-bundled Ruby 2.6 |\n"
usage += " : MP32: use Ruby 3.2 from MacPorts |\n"
usage += " : HB32: use Ruby 3.2 from Homebrew |\n"
usage += " : Ana3: use Ruby 3.1 from Anaconda3 |\n"
usage += " : Ana3: use Ruby 3.2 from Anaconda3 |\n"
usage += " [-p|--python <type>] : case-insensitive type=['nil', 'MP311', 'HB311', 'Ana3', | %s\n" % myPython
usage += " : 'MP39', 'HB39', 'HBAuto'] |\n"
usage += " : nil: don't bind Python |\n"

View File

@ -167,13 +167,13 @@ Ruby32Brew = { 'exe': '%s/bin/ruby' % HBRuby32Path,
'lib': '%s/lib/libruby.3.2.dylib' % HBRuby32Path
}
# Ruby 3.1 bundled with anaconda3 installed under /Applications/anaconda3/
# Ruby 3.2 bundled with anaconda3 installed under /Applications/anaconda3/
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
# [Key Type Name] = 'Ana3'
RubyAnaconda3 = { 'exe': '/Applications/anaconda3/bin/ruby',
'inc': '/Applications/anaconda3/include/ruby-3.1.0',
'lib': '/Applications/anaconda3/lib/libruby.3.1.dylib'
'inc': '/Applications/anaconda3/include/ruby-3.2.0',
'lib': '/Applications/anaconda3/lib/libruby.3.2.dylib'
}
# Consolidated dictionary kit for Ruby

View File

@ -965,72 +965,114 @@ struct cplx_trans_defs
}
};
template <class F, class I>
static F *cplxtrans_from_cplxtrans (const I &t)
namespace {
template<class F, class I> struct dbu_trans;
template<>
struct dbu_trans<db::Coord, db::Coord>
{
return new F (t);
db::ICplxTrans operator() (double /*dbu*/) const { return db::ICplxTrans (); }
};
template<>
struct dbu_trans<db::Coord, db::DCoord>
{
db::VCplxTrans operator() (double dbu) const { return db::VCplxTrans (1.0 / dbu); }
};
template<>
struct dbu_trans<db::DCoord, db::Coord>
{
db::CplxTrans operator() (double dbu) const { return db::CplxTrans (dbu); }
};
template<>
struct dbu_trans<db::DCoord, db::DCoord>
{
db::DCplxTrans operator() (double /*dbu*/) const { return db::DCplxTrans (); }
};
}
template <class F, class I>
static F cplxtrans_to_cplxtrans (const I *t)
static F *cplxtrans_from_cplxtrans (const I &t, double dbu)
{
return F (*t);
return new F (dbu_trans<typename F::target_coord_type, typename I::target_coord_type> () (dbu) * t * dbu_trans<typename I::coord_type, typename F::coord_type> () (dbu));
}
template <class F, class I>
static F cplxtrans_to_icplxtrans (const I *t, double dbu)
static F cplxtrans_to_cplxtrans (const I *t, double dbu)
{
F f = F (*t);
f.disp (typename F::displacement_type (f.disp () * (1.0 / dbu)));
return f;
}
template <class F, class I>
static F cplxtrans_to_dcplxtrans (const I *t, double dbu)
{
F f = F (*t);
f.disp (f.disp () * dbu);
return f;
return F (dbu_trans<typename F::target_coord_type, typename I::target_coord_type> () (dbu) * *t * dbu_trans<typename I::coord_type, typename F::coord_type> () (dbu));
}
Class<db::DCplxTrans> decl_DCplxTrans ("db", "DCplxTrans",
constructor ("new|#from_itrans", &cplxtrans_from_cplxtrans<db::DCplxTrans, db::CplxTrans>, gsi::arg ("trans"),
constructor ("new|#from_itrans", &cplxtrans_from_cplxtrans<db::DCplxTrans, db::CplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the input space from integer units to floating-point units. "
"Formally, the DCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation "
"into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25 and replaces the previous static method 'from_itrans'."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::DCplxTrans, db::ICplxTrans>, gsi::arg ("trans"),
constructor ("new", &cplxtrans_from_cplxtrans<db::DCplxTrans, db::ICplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. "
"Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * to_dbu' where 'to_dbu' is the transformation "
"into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'. 'from_dbu' is the transformation into micrometer space, "
"or more precisely 'CplxTrans(mag=dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::DCplxTrans, db::VCplxTrans>, gsi::arg ("trans"),
constructor ("new", &cplxtrans_from_cplxtrans<db::DCplxTrans, db::VCplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the output space from integer units to floating-point units. "
"Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation "
"into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
method_ext ("to_itrans", &cplxtrans_to_icplxtrans<db::ICplxTrans, db::DCplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_itrans", &cplxtrans_to_cplxtrans<db::ICplxTrans, db::DCplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with integer input and output coordinates\n"
"\n"
"The database unit can be specified to translate the floating-point coordinate "
"displacement in micron units to an integer-coordinate displacement in database units. The displacement's' "
"coordinates will be divided by the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors. Instead of 'to_itrans' use the conversion constructor:\n"
"\n"
"@code\n"
"itrans = RBA::ICplxTrans::new(dtrans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method_ext ("to_vtrans", &cplxtrans_to_icplxtrans<db::VCplxTrans, db::DCplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans<db::VCplxTrans, db::DCplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with integer output coordinates\n"
"\n"
"The database unit can be specified to translate the floating-point coordinate "
"displacement in micron units to an integer-coordinate displacement in database units. The displacement's' "
"coordinates will be divided by the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors. Instead of 'to_vtrans' use the conversion constructor:\n"
"\n"
"@code\n"
"vtrans = RBA::VCplxTrans::new(dtrans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method_ext ("to_trans", &cplxtrans_to_cplxtrans<db::CplxTrans, db::DCplxTrans>,
method_ext ("#to_trans", &cplxtrans_to_cplxtrans<db::CplxTrans, db::DCplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with integer input coordinates\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors. Instead of 'to_trans' use the conversion constructor:\n"
"\n"
"@code\n"
"trans = RBA::CplxTrans::new(dtrans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method ("*!", (db::CplxTrans (db::DCplxTrans::*) (const db::CplxTrans &) const) &db::DCplxTrans::concat, gsi::arg ("t"),
"@brief Multiplication (concatenation) of transformations\n"
@ -1073,43 +1115,62 @@ Class<db::DCplxTrans> decl_DCplxTrans ("db", "DCplxTrans",
);
Class<db::CplxTrans> decl_CplxTrans ("db", "CplxTrans",
constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans<db::CplxTrans, db::DCplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans<db::CplxTrans, db::DCplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the input space from floating-point units to integer units. "
"Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation "
"into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::CplxTrans, db::ICplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new", &cplxtrans_from_cplxtrans<db::CplxTrans, db::ICplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the output space from integer units to floating-point units. "
"Formally, the CplxTrans transformation is initialized with 'from_dbu * trans' where 'from_dbu' is the transformation "
"into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::CplxTrans, db::VCplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new", &cplxtrans_from_cplxtrans<db::CplxTrans, db::VCplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates an integer-to-floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the input and output space from integer units to floating-point units and vice versa. "
"Formally, the DCplxTrans transformation is initialized with 'from_dbu * trans * from_dbu' where 'from_dbu' is the transformation "
"into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
method_ext ("to_itrans", &cplxtrans_to_icplxtrans<db::ICplxTrans, db::CplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_itrans", &cplxtrans_to_cplxtrans<db::ICplxTrans, db::CplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with integer input and output coordinates\n"
"\n"
"The database unit can be specified to translate the floating-point coordinate "
"displacement in micron units to an integer-coordinate displacement in database units. The displacement's' "
"coordinates will be divided by the database unit.\n"
"This method is redundant with the conversion constructors. Instead of 'to_itrans' use the conversion constructor:\n"
"\n"
"This method has been introduced in version 0.25."
"@code\n"
"itrans = RBA::ICplxTrans::new(trans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method_ext ("to_vtrans", &cplxtrans_to_icplxtrans<db::VCplxTrans, db::CplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans<db::VCplxTrans, db::CplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with integer output and floating-point input coordinates\n"
"\n"
"The database unit can be specified to translate the floating-point coordinate "
"displacement in micron units to an integer-coordinate displacement in database units. The displacement's' "
"coordinates will be divided by the database unit.\n"
"This method is redundant with the conversion constructors. Instead of 'to_vtrans' use the conversion constructor:\n"
"\n"
"This method has been introduced in version 0.25."
"@code\n"
"vtrans = RBA::VCplxTrans::new(trans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method_ext ("to_trans", &cplxtrans_to_cplxtrans<db::DCplxTrans, db::CplxTrans>,
method_ext ("#to_trans", &cplxtrans_to_cplxtrans<db::DCplxTrans, db::CplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with floating-point input coordinates\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors. Instead of 'to_trans' use the conversion constructor:\n"
"\n"
"@code\n"
"dtrans = RBA::DCplxTrans::new(trans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method ("*!", (db::DCplxTrans (db::CplxTrans::*) (const db::VCplxTrans &) const) &db::CplxTrans::concat, gsi::arg ("t"),
"@brief Multiplication (concatenation) of transformations\n"
@ -1163,43 +1224,77 @@ Class<db::CplxTrans> decl_CplxTrans ("db", "CplxTrans",
);
Class<db::ICplxTrans> decl_ICplxTrans ("db", "ICplxTrans",
constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans<db::ICplxTrans, db::DCplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans<db::ICplxTrans, db::DCplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates an integer coordinate transformation from another coordinate flavour\n"
"\n"
"This constructor has been introduced in version 0.25 and replaces the previous static method 'from_dtrans'."
) +
constructor ("new|#from_trans", &cplxtrans_from_cplxtrans<db::ICplxTrans, db::CplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
"The 'dbu' argument is used to transform the input space and output space from floating-point units to integer units and vice versa. "
"Formally, the ICplxTrans transformation is initialized with 'to_dbu * trans * from_dbu' where 'from_dbu' is the transformation "
"into micrometer space, or more precisely 'CplxTrans(mag=dbu)' and 'to_dbu' is the transformation into DBU space, or more "
"precisely 'VCplxTrans(mag=1/dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25 and replaces the previous static method 'from_trans'."
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::ICplxTrans, db::VCplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new|#from_trans", &cplxtrans_from_cplxtrans<db::ICplxTrans, db::CplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates an integer coordinate transformation from another coordinate flavour\n"
"\n"
"This constructor has been introduced in version 0.25."
"The 'dbu' argument is used to transform the output space from floating-point units to integer units. "
"Formally, the CplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation into DBU space, or more "
"precisely 'VCplxTrans(mag=1/dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
method_ext ("to_itrans", &cplxtrans_to_dcplxtrans<db::DCplxTrans, db::ICplxTrans>, gsi::arg ("dbu", 1.0),
constructor ("new", &cplxtrans_from_cplxtrans<db::ICplxTrans, db::VCplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates an integer coordinate transformation from another coordinate flavour\n"
"\n"
"The 'dbu' argument is used to transform the input space from floating-point units to integer units. "
"Formally, the CplxTrans transformation is initialized with 'trans * from_dbu' where 'from_dbu' is the transformation "
"into micrometer space, or more precisely 'CplxTrans(mag=dbu)'.\n"
"\n"
"This constructor has been introduced in version 0.25. The 'dbu' argument has been added in version 0.29."
) +
method_ext ("#to_itrans", &cplxtrans_to_cplxtrans<db::DCplxTrans, db::ICplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with floating-point input and output coordinates\n"
"\n"
"The database unit can be specified to translate the integer coordinate "
"displacement in database units to a floating-point displacement in micron units. The displacement's' "
"coordinates will be multiplied with the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors and is ill-named. "
"Instead of 'to_itrans' use the conversion constructor:\n"
"\n"
"@code\n"
"dtrans = RBA::DCplxTrans::new(itrans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method_ext ("to_vtrans", &cplxtrans_to_dcplxtrans<db::CplxTrans, db::ICplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans<db::CplxTrans, db::ICplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with floating-point output coordinates\n"
"\n"
"The database unit can be specified to translate the integer coordinate "
"displacement in database units to a floating-point displacement in micron units. The displacement's' "
"coordinates will be multiplied with the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors and is ill-named. "
"Instead of 'to_vtrans' use the conversion constructor:\n"
"\n"
"@code\n"
"trans = RBA::CplxTrans::new(itrans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method_ext ("to_trans", &cplxtrans_to_cplxtrans<db::VCplxTrans, db::ICplxTrans>,
method_ext ("#to_trans", &cplxtrans_to_cplxtrans<db::VCplxTrans, db::ICplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with floating-point input coordinates\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors and is ill-named. "
"Instead of 'to_trans' use the conversion constructor:\n"
"\n"
"@code\n"
"vtrans = RBA::VCplxTrans::new(itrans, dbu)\n"
"@/code\n"
"\n"
"This method has been introduced in version 0.25 and was deprecated in version 0.29."
) +
method ("*!", (db::VCplxTrans (db::ICplxTrans::*) (const db::VCplxTrans &) const) &db::ICplxTrans::concat, gsi::arg ("t"),
"@brief Multiplication (concatenation) of transformations\n"
@ -1241,37 +1336,76 @@ Class<db::ICplxTrans> decl_ICplxTrans ("db", "ICplxTrans",
);
Class<db::VCplxTrans> decl_VCplxTrans ("db", "VCplxTrans",
constructor ("new", &cplxtrans_from_cplxtrans<db::VCplxTrans, db::DCplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new", &cplxtrans_from_cplxtrans<db::VCplxTrans, db::DCplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates a floating-point to integer coordinate transformation from another coordinate flavour\n"
"\n"
"The 'dbu' argument is used to transform the output space from floating-point units to integer units. "
"Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans' where 'to_dbu' is the transformation "
"into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n"
"\n"
"The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::VCplxTrans, db::CplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new", &cplxtrans_from_cplxtrans<db::VCplxTrans, db::CplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates a floating-point to integer coordinate transformation from another coordinate flavour\n"
"\n"
"The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. "
"Formally, the VCplxTrans transformation is initialized with 'to_dbu * trans * to_dbu' where 'to_dbu' is the transformation "
"into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n"
"\n"
"The 'dbu' argument has been added in version 0.29."
) +
constructor ("new", &cplxtrans_from_cplxtrans<db::VCplxTrans, db::ICplxTrans>, gsi::arg ("trans"),
"@brief Creates a floating-point coordinate transformation from another coordinate flavour\n"
constructor ("new", &cplxtrans_from_cplxtrans<db::VCplxTrans, db::ICplxTrans>, gsi::arg ("trans"), gsi::arg ("dbu", 1.0),
"@brief Creates a floating-point to integer coordinate transformation from another coordinate flavour\n"
"\n"
"The 'dbu' argument is used to transform the input and output space from floating-point units to integer units and vice versa. "
"Formally, the VCplxTrans transformation is initialized with 'trans * to_dbu' where 'to_dbu' is the transformation "
"into DBU space, or more precisely 'VCplxTrans(mag=1/dbu)'.\n"
"\n"
"The 'dbu' argument has been added in version 0.29."
) +
method_ext ("to_itrans", &cplxtrans_to_dcplxtrans<db::DCplxTrans, db::VCplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_itrans", &cplxtrans_to_cplxtrans<db::DCplxTrans, db::VCplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with floating-point output coordinates\n"
"\n"
"The database unit can be specified to translate the integer coordinate "
"displacement in database units to a floating-point displacement in micron units. The displacement's' "
"coordinates will be multiplied with the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors and is ill-named. "
"Instead of 'to_itrans' use the conversion constructor:\n"
"\n"
"@code\n"
"dtrans = RBA::DCplxTrans::new(vtrans, dbu)\n"
"@/code\n"
"\n"
"This method has been deprecated in version 0.29."
) +
method_ext ("to_vtrans", &cplxtrans_to_dcplxtrans<db::CplxTrans, db::VCplxTrans>, gsi::arg ("dbu", 1.0),
method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans<db::CplxTrans, db::VCplxTrans>, gsi::arg ("dbu", 1.0),
"@brief Converts the transformation to another transformation with integer input and floating-point output coordinates\n"
"\n"
"The database unit can be specified to translate the integer coordinate "
"displacement in database units to an floating-point displacement in micron units. The displacement's' "
"coordinates will be multiplied with the database unit.\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors and is ill-named. "
"Instead of 'to_vtrans' use the conversion constructor:\n"
"\n"
"@code\n"
"trans = RBA::CplxTrans::new(vtrans, dbu)\n"
"@/code\n"
"\n"
"This method has been deprecated in version 0.29."
) +
method_ext ("to_trans", &cplxtrans_to_cplxtrans<db::ICplxTrans, db::VCplxTrans>,
method_ext ("#to_trans", &cplxtrans_to_cplxtrans<db::ICplxTrans, db::VCplxTrans>,
"@brief Converts the transformation to another transformation with integer input coordinates\n"
"\n"
"This method has been introduced in version 0.25."
"This method is redundant with the conversion constructors and is ill-named. "
"Instead of 'to_trans' use the conversion constructor:\n"
"\n"
"@code\n"
"itrans = RBA::ICplxTrans::new(vtrans, dbu)\n"
"@/code\n"
"\n"
"This method has been deprecated in version 0.29."
) +
method ("*!", (db::VCplxTrans (db::VCplxTrans::*) (const db::DCplxTrans &) const) &db::VCplxTrans::concat, gsi::arg ("t"),
"@brief Multiplication (concatenation) of transformations\n"

View File

@ -656,6 +656,30 @@ Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "lay", "M
"it can be beneficial for test or automation purposes, i.e. if a screenshot needs to be "
"produced once the application has finished drawing."
) +
gsi::method ("synchronous", &lay::MainWindow::synchronous,
"@brief Gets a value indicating whether synchronous mode is activated\n"
"See \\synchronous= for details about this attribute\n"
"\n"
"This property getter was introduced in version 0.29."
) +
gsi::method ("title=", &lay::MainWindow::set_title, gsi::arg ("title"),
"@brief Sets the window title\n"
"If the window title is not empty, it will be used for the application window's title. Otherwise "
"the default title is used. The title string is subject to expression interpolation. So it is "
"possible to implement the default scheme of adding the current view using the following code:\n"
"\n"
"@code\n"
"add_view_info = \"$(var view=LayoutView.current; view ? ' - ' + (view.is_dirty ? '[+] ' : '') + view.title : '')\"\n"
"RBA::MainWindow.instance.title = \"Custom Title\" + add_view_info\n"
"@/code\n"
"\n"
"This property was introduced in version 0.29."
) +
gsi::method ("title", &lay::MainWindow::title,
"@brief Gets the window title\n"
"See \\title= for a description of this property.\n"
"This property was introduced in version 0.29."
) +
gsi::method ("close_all", &lay::MainWindow::close_all,
"@brief Closes all views\n"
"\n"

View File

@ -3597,18 +3597,35 @@ MainWindow::view_title_changed (lay::LayoutView *view)
}
}
void
MainWindow::set_title (const std::string &title)
{
if (title != m_title) {
m_title = title;
update_window_title ();
}
}
void
MainWindow::update_window_title ()
{
if (current_view ()) {
std::string sep = " - ";
if (current_view ()->is_dirty ()) {
sep += "[+] ";
}
setWindowTitle (tl::to_qstring (lay::ApplicationBase::version () + sep + current_view ()->title ()));
std::string title = m_title;
if (! title.empty ()) {
tl::Eval eval;
title = eval.interpolate (title);
} else {
setWindowTitle (tl::to_qstring (lay::ApplicationBase::version ()));
title = lay::ApplicationBase::version ();
if (current_view ()) {
std::string sep = " - ";
if (current_view ()->is_dirty ()) {
sep += "[+] ";
}
title += sep + current_view ()->title ();
}
}
setWindowTitle (tl::to_qstring (title));
}
void
@ -3616,7 +3633,6 @@ MainWindow::current_view_changed ()
{
update_window_title ();
current_view_changed_event ();
// TODO: required? current_view_changed_event (int (view_index_org));
}
double

View File

@ -426,6 +426,22 @@ public:
return m_synchronous;
}
/**
* @brief Sets the title string
*
* If empty, the default title will be created. Otherwise this string will
* be used. It is subject to expression interpolation.
*/
void set_title (const std::string &title);
/**
* @brief Gets the title string
*/
const std::string &title () const
{
return m_title;
}
/**
* @brief Returns true, if the edit functions of the current view are enabled
*/
@ -760,6 +776,7 @@ private:
std::string m_message;
std::unique_ptr<QPrinter> mp_printer;
std::vector<QString> m_changed_files;
std::string m_title;
// the object manager (undo/redo mechanism and others)
db::Manager m_manager;

View File

@ -474,6 +474,12 @@ static lay::AbstractMenu *menu (lay::LayoutViewBase *view)
return view->menu ();
}
static bool view_is_dirty (lay::LayoutViewBase *view)
{
view->refresh ();
return view->is_dirty ();
}
LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase ("lay", "LayoutViewBase",
gsi::constant ("LV_NoLayers", (unsigned int) lay::LayoutViewBase::LV_NoLayers,
"@brief With this option, no layers view will be provided (see \\layer_control_frame)\n"
@ -1136,6 +1142,13 @@ LAYBASIC_PUBLIC Class<lay::LayoutViewBase> decl_LayoutViewBase ("lay", "LayoutVi
"Show the layout in full depth down to the deepest level of hierarchy. "
"This method may cause a redraw."
) +
gsi::method_ext ("is_dirty?", &view_is_dirty,
"@brief Gets a flag indicating whether one of the layouts displayed needs saving\n"
"A layout is 'dirty' if it is modified and needs saving. This method returns "
"true if this is the case for at least one of the layouts shown in the view.\n"
"\n"
"This method has been introduced in version 0.29.\n"
) +
gsi::method ("resize", static_cast<void (lay::LayoutViewBase::*) (unsigned int, unsigned int)> (&lay::LayoutViewBase::resize), gsi::arg ("w"), gsi::arg ("h"),
"@brief Resizes the layout view to the given dimension\n"
"\n"

View File

@ -2749,6 +2749,11 @@ public:
return m_options;
}
/**
* @brief Calls deferred methods and updates view ops, provided for GSI bindings mainly
*/
void refresh ();
private:
// event handlers used to connect to the layout object's events
void signal_hier_changed ();
@ -2917,8 +2922,6 @@ private:
void init_layer_properties (LayerProperties &props, const LayerPropertiesList &lp_list) const;
void merge_dither_pattern (lay::LayerPropertiesList &props);
void refresh ();
protected:
/**
* @brief Constructor for calling from a LayoutView

View File

@ -144,6 +144,7 @@ RUBYTEST (extNetTracer, "extNetTracer.rb")
RUBYTEST (imgObject, "imgObject.rb")
RUBYTEST (layLayers, "layLayers.rb")
RUBYTEST (layLayoutView, "layLayoutView.rb")
RUBYTEST (layMainWindow, "layMainWindow.rb")
RUBYTEST (layMarkers, "layMarkers.rb")
RUBYTEST (layMacro, "layMacro.rb")
RUBYTEST (layMenuTest, "layMenuTest.rb")

View File

@ -626,6 +626,37 @@ class DBTrans_TestClass < TestBase
end
# Complex trans conversions, issue #1586
def test_6_CplxTransConversions
itrans = RBA::ICplxTrans::new(1.0, 0.0, false, RBA::Vector::new(1, 2))
vtrans = RBA::VCplxTrans::new(1000.0, 0.0, false, RBA::Vector::new(1, 2))
dtrans = RBA::DCplxTrans::new(1.0, 0.0, false, RBA::DVector::new(1, 2))
ctrans = RBA::CplxTrans::new(0.001, 0.0, false, RBA::DVector::new(1, 2))
assert_equal(RBA::ICplxTrans::new(vtrans, 0.001).to_s, "r0 *1 1,2")
assert_equal(RBA::ICplxTrans::new(dtrans, 0.001).to_s, "r0 *1 1000,2000")
assert_equal(RBA::ICplxTrans::new(ctrans, 0.001).to_s, "r0 *1 1000,2000")
assert_equal(RBA::VCplxTrans::new(itrans, 0.001).to_s, "r0 *1000 1,2")
assert_equal(RBA::VCplxTrans::new(dtrans, 0.001).to_s, "r0 *1000 1000,2000")
assert_equal(RBA::VCplxTrans::new(ctrans, 0.001).to_s, "r0 *1000 1000,2000")
assert_equal(RBA::DCplxTrans::new(itrans, 0.001).to_s, "r0 *1 0.001,0.002")
assert_equal(RBA::DCplxTrans::new(vtrans, 0.001).to_s, "r0 *1 0.001,0.002")
assert_equal(RBA::DCplxTrans::new(ctrans, 0.001).to_s, "r0 *1 1,2")
assert_equal(RBA::CplxTrans::new(itrans, 0.001).to_s, "r0 *0.001 0.001,0.002")
assert_equal(RBA::CplxTrans::new(vtrans, 0.001).to_s, "r0 *0.001 0.001,0.002")
assert_equal(RBA::CplxTrans::new(dtrans, 0.001).to_s, "r0 *0.001 1,2")
# issue #1586 (NOTE: to_itrans is deprecated)
t = RBA::DCplxTrans::new(1.0, 45.0, false, 12.345678, 20.000000)
assert_equal(t.to_itrans(0.001).to_s, "r45 *1 12345.678,20000")
assert_equal(RBA::ICplxTrans::new(t, 0.001).to_s, "r45 *1 12345.678,20000")
end
end
load("test_epilogue.rb")

View File

@ -571,6 +571,30 @@ class LAYLayoutView_TestClass < TestBase
end
def test_9
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
mw.create_layout(1)
assert_equal(false, mw.current_view.is_dirty?)
cv = mw.current_view.cellview(0)
cv.cell = cv.layout.create_cell("TOP")
assert_equal(true, mw.current_view.cellview(0).is_dirty?)
if cv.layout.is_editable?
assert_equal(true, mw.current_view.is_dirty?)
end
end
end
load("test_epilogue.rb")

69
testdata/ruby/layMainWindow.rb vendored Normal file
View File

@ -0,0 +1,69 @@
# encoding: UTF-8
# KLayout Layout Viewer
# Copyright (C) 2006-2024 Matthias Koefferlein
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
if !$:.member?(File::dirname($0))
$:.push(File::dirname($0))
end
load("test_prologue.rb")
class LAYMainWindow_TestClass < TestBase
# Basic view creation and MainWindow events
def test_1
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.title = "ABC$(1+2)"
assert_equal("ABC$(1+2)", mw.title)
if RBA.constants.member?(:QWidget)
# string is interpolated
assert_equal("ABC3", mw.windowTitle)
end
end
def test_2
# smoke test
app = RBA::Application.instance
mw = app.main_window
s = mw.synchronous
mw.synchronous = true
assert_equal(true, mw.synchronous)
mw.synchronous = false
assert_equal(false, mw.synchronous)
mw.synchronous = true
end
end
load("test_epilogue.rb")