diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md index db8cd7691..4d2fbea10 100644 --- a/macbuild/ReadMe.md +++ b/macbuild/ReadMe.md @@ -1,6 +1,6 @@ -Relevant KLayout version: 0.28.14
+Relevant KLayout version: 0.28.15
Author: Kazzz-S
-Last modified: 2023-12-10
+Last modified: 2024-01-05
# 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 ] : 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: ``` diff --git a/macbuild/Resources/script-bundle-A.zip b/macbuild/Resources/script-bundle-A.zip index ba3f6cd88..5f21746d8 100644 Binary files a/macbuild/Resources/script-bundle-A.zip and b/macbuild/Resources/script-bundle-A.zip differ diff --git a/macbuild/Resources/script-bundle-B.zip b/macbuild/Resources/script-bundle-B.zip index 99620dbfc..3f66e0a95 100644 Binary files a/macbuild/Resources/script-bundle-B.zip and b/macbuild/Resources/script-bundle-B.zip differ diff --git a/macbuild/Resources/script-bundle-H.zip b/macbuild/Resources/script-bundle-H.zip index bf5a808e0..821e0e51c 100644 Binary files a/macbuild/Resources/script-bundle-H.zip and b/macbuild/Resources/script-bundle-H.zip differ diff --git a/macbuild/Resources/script-bundle-P.zip b/macbuild/Resources/script-bundle-P.zip index c018c3a72..def41bdc4 100644 Binary files a/macbuild/Resources/script-bundle-P.zip and b/macbuild/Resources/script-bundle-P.zip differ diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index b365b10d8..687763d1c 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -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 ] : case-insensitive type=['nil', 'MP311', 'HB311', 'Ana3', | %s\n" % myPython usage += " : 'MP39', 'HB39', 'HBAuto'] |\n" usage += " : nil: don't bind Python |\n" diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index 2074d5c14..d87149133 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -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 diff --git a/src/db/db/gsiDeclDbTrans.cc b/src/db/db/gsiDeclDbTrans.cc index 31fd48eb2..794e787b5 100644 --- a/src/db/db/gsiDeclDbTrans.cc +++ b/src/db/db/gsiDeclDbTrans.cc @@ -965,72 +965,114 @@ struct cplx_trans_defs } }; -template -static F *cplxtrans_from_cplxtrans (const I &t) +namespace { + +template struct dbu_trans; + +template<> +struct dbu_trans { - return new F (t); + db::ICplxTrans operator() (double /*dbu*/) const { return db::ICplxTrans (); } +}; + +template<> +struct dbu_trans +{ + db::VCplxTrans operator() (double dbu) const { return db::VCplxTrans (1.0 / dbu); } +}; + +template<> +struct dbu_trans +{ + db::CplxTrans operator() (double dbu) const { return db::CplxTrans (dbu); } +}; + +template<> +struct dbu_trans +{ + db::DCplxTrans operator() (double /*dbu*/) const { return db::DCplxTrans (); } +}; + } template -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 () (dbu) * t * dbu_trans () (dbu)); } template -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 -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 () (dbu) * *t * dbu_trans () (dbu)); } Class decl_DCplxTrans ("db", "DCplxTrans", - constructor ("new|#from_itrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), + constructor ("new|#from_itrans", &cplxtrans_from_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, gsi::arg ("trans"), + constructor ("new", &cplxtrans_from_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 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, gsi::arg ("trans"), + constructor ("new", &cplxtrans_from_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 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, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_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" "\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, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, 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, + method_ext ("#to_trans", &cplxtrans_to_cplxtrans, 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 decl_DCplxTrans ("db", "DCplxTrans", ); Class decl_CplxTrans ("db", "CplxTrans", - constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, 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, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, 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, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_cplxtrans, 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, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_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, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_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, + method_ext ("#to_trans", &cplxtrans_to_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 decl_CplxTrans ("db", "CplxTrans", ); Class decl_ICplxTrans ("db", "ICplxTrans", - constructor ("new|#from_dtrans", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new|#from_dtrans", &cplxtrans_from_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 and replaces the previous static method 'from_dtrans'." - ) + - constructor ("new|#from_trans", &cplxtrans_from_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, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new|#from_trans", &cplxtrans_from_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, gsi::arg ("dbu", 1.0), + constructor ("new", &cplxtrans_from_cplxtrans, 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, 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, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, 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, + method_ext ("#to_trans", &cplxtrans_to_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 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 decl_ICplxTrans ("db", "ICplxTrans", ); Class decl_VCplxTrans ("db", "VCplxTrans", - constructor ("new", &cplxtrans_from_cplxtrans, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_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 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, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_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, gsi::arg ("trans"), - "@brief Creates a floating-point coordinate transformation from another coordinate flavour\n" + constructor ("new", &cplxtrans_from_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 '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, gsi::arg ("dbu", 1.0), + method_ext ("#to_itrans", &cplxtrans_to_cplxtrans, 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, gsi::arg ("dbu", 1.0), + method_ext ("#to_vtrans", &cplxtrans_to_cplxtrans, 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, + method_ext ("#to_trans", &cplxtrans_to_cplxtrans, "@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" diff --git a/src/lay/lay/gsiDeclLayMainWindow.cc b/src/lay/lay/gsiDeclLayMainWindow.cc index f7c57326d..39cecc9e3 100644 --- a/src/lay/lay/gsiDeclLayMainWindow.cc +++ b/src/lay/lay/gsiDeclLayMainWindow.cc @@ -656,6 +656,30 @@ Class 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" diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 7df5070dd..1adfb3bb7 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -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 diff --git a/src/lay/lay/layMainWindow.h b/src/lay/lay/layMainWindow.h index 30d51af61..a0e9e6d62 100644 --- a/src/lay/lay/layMainWindow.h +++ b/src/lay/lay/layMainWindow.h @@ -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 mp_printer; std::vector m_changed_files; + std::string m_title; // the object manager (undo/redo mechanism and others) db::Manager m_manager; diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc b/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc index 8a495711a..6674eb17c 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutViewBase.cc @@ -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 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 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 (&lay::LayoutViewBase::resize), gsi::arg ("w"), gsi::arg ("h"), "@brief Resizes the layout view to the given dimension\n" "\n" diff --git a/src/laybasic/laybasic/layLayoutViewBase.h b/src/laybasic/laybasic/layLayoutViewBase.h index 903e2f153..c6181b6b9 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.h +++ b/src/laybasic/laybasic/layLayoutViewBase.h @@ -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 diff --git a/src/rba/unit_tests/rbaTests.cc b/src/rba/unit_tests/rbaTests.cc index a64b2c417..3aa050836 100644 --- a/src/rba/unit_tests/rbaTests.cc +++ b/src/rba/unit_tests/rbaTests.cc @@ -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") diff --git a/testdata/ruby/dbTransTest.rb b/testdata/ruby/dbTransTest.rb index a778b07cb..b5d6f3444 100644 --- a/testdata/ruby/dbTransTest.rb +++ b/testdata/ruby/dbTransTest.rb @@ -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") diff --git a/testdata/ruby/layLayoutView.rb b/testdata/ruby/layLayoutView.rb index b6aa899dd..7a03c05b4 100644 --- a/testdata/ruby/layLayoutView.rb +++ b/testdata/ruby/layLayoutView.rb @@ -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") diff --git a/testdata/ruby/layMainWindow.rb b/testdata/ruby/layMainWindow.rb new file mode 100644 index 000000000..ba4d0f35a --- /dev/null +++ b/testdata/ruby/layMainWindow.rb @@ -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") +