New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo action not working with shapes #107

Closed
thomaslima opened this Issue Mar 31, 2018 · 23 comments

Comments

Projects
None yet
2 participants
@thomaslima
Copy link
Collaborator

thomaslima commented Mar 31, 2018

Hi,

I just laid out a box, or a path, then pressed Cmd+z (or manually via edit > undo create box/path), and the action was not undone. Moreover, the redo did not re-insert the object.

Note: Undo/redo action works fine with rulers. And also with Cell Instances. Can you reproduce?

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 1, 2018

Hi Thomas,

I'm sorry, I'm not able to reproduce it. I am creating a simple example - empty layout, create one layer, add a rectangle. Undo works. Same for other shapes.

So it's either the context or the configuration. Did you do something special before or can you reproduce that with a layout from scratch.

With respect to the configuration, the "background combination mode" may be confusing - if this mode is not "Add" the effects may be strange:

image

Best regards,

Matthias

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 2, 2018

Hi Matthias,

I have tried with the -nc option. It must be only my compilation, or the Mac ones (qt > 5.10)

Another datapoint: The add layer event can be reversed.

Do you use qt5 as well? It would be helpful if we had the same qt in all platforms.

Best,

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 7, 2018

Hi Thomas,

sorry for the delayed response. I am using Qt4 still on Linux, but on Windows I'm using 5.6.2. On both platforms I don't see the issue.

But I do see the issue on my VirtualBox MacOS. I'll try to debug that.

Best regards,

Matthias

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 7, 2018

Found the issue. It should work now. It was a difference in the linking of RTTI information - clang requires classes to have uniform public visibility to allow dynamic_cast. But only on Mac and only in release build. That's why it was difficult to debug.

Thanks for reporting the problem.

Matthias

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 9, 2018

Thank you so much! I will test it and let you know.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 9, 2018

Just tested without cleaning build directory. Problem persists.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

Rebuilt and tested afresh. problem still persists on my MacOS with qt 5.10.1.

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 10, 2018

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

Unfortunately I have no hints so far, except that I am compiling with Qt 5.10.1 and doing the same steps that you are doing. I was even careful enough to start klayout with -nc -e -rx options. I saw you included a unit test on that but I still have to learn how to run it.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

Weird. The test passed!

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

Ok I kind of have a false alarm. When I execute klayout from the built binary folder, your patch works. But when I execute Kaazz's deploy script to a klayout bundle, the undo button stops working. very weird. I have to investigate more.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

I'd like to share something very curious. I activated the flag DYLD_PRINT_LIBRARIES while launching klayout from both folders, and recorded which libraries were loaded while loading the app. Results are attached.
dyld_libs.txt (bin)
dyld_libs.txt (pkg)

The packaged version loaded the same libraries, but also some extra ones:

> dyld: loaded: /System/Library/CoreServices/RawCamera.bundle/Contents/MacOS/RawCamera
> dyld: loaded: /System/Library/PrivateFrameworks/MobileAsset.framework/Versions/A/MobileAsset
> dyld: loaded: /System/Library/PrivateFrameworks/StreamingZip.framework/Versions/A/StreamingZip
> dyld: loaded: /System/Library/Frameworks/MediaToolbox.framework/Versions/A/MediaToolbox
> dyld: loaded: /System/Library/PrivateFrameworks/CoreAVCHD.framework/Versions/A/CoreAVCHD
> dyld: loaded: /System/Library/Frameworks/MediaAccessibility.framework/Versions/A/MediaAccessibility
> dyld: loaded: /System/Library/PrivateFrameworks/Mangrove.framework/Versions/A/Mangrove
> dyld: loaded: /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia
> dyld: loaded: /System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox
> dyld: loaded: /System/Library/PrivateFrameworks/CoreAUC.framework/Versions/A/CoreAUC
> dyld: loaded: /usr/lib/libspindump.dylib
> dyld: loaded: /usr/lib/libdscsym.dylib
> dyld: loaded: /System/Library/PrivateFrameworks/AppleVA.framework/Versions/A/AppleVA```
@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

Launched the klayout with debug level 100 and watched events play out. In the pkg folder's klayout, the menu item undo does not produce any output whatsoever. Just ignored.

In the bin folder's klayout, the debug shows that klayout captured the undo action and executed it.

The very same libraries are loaded for both events except the ones above. (In the bin's case, libspindump and libdscsym are loaded right when I actually draw a box.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 10, 2018

I just tested @Kazzz-S 's latest compilation and it works! It must have something to do with brew's qt 5.10.1, which is probably different than macport's one. :(

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 11, 2018

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 11, 2018

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 11, 2018

Thanks for the attention Matthias. Any idea why the built version actually works, but when I package it into a Mac bundle it stops working? I think I will use print statements to try to get a grasp of the issue.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 11, 2018

You are right. During compilation, I got a lot of warnings like these:
ld: warning: direct access in function 'db::layer_class<db::box<int, int>, db::stable_layer_tag>::clear(db::Shapes*, db::Manager*)' from file 'dbShapes2.o' to global weak symbol 'vtable for db::layer_op<db::box<int, int>, db::stable_layer_tag>' from file 'dbShapes.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

Would that be a problem?

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 11, 2018

Here's the full rebuild log after having changed the file dbshapes.cc.
qt5.build.macos-HighSierra-release-bug107.log

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 11, 2018

I can also tell you, based on my latest debug, that the method Shapes::undo (db::Op *op) in dbShapes.cc:926 is not called when I am in the bundled application. Incidentally, if I delete the shape(a box in my example) and click undo, it works. Again, in the unbundled application (bin folder) this method does get called.

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 11, 2018

PROBLEM SOLVED
Okay now it is my time to curse myself. The "bug" was in the mac deploy tool by @Kazzz-S. It was copying over the old klayout 0.25.1 library files instead of the 0.25.2 ones because I had both in my bin folder. That is why klayout in bin ran but not the bundled one. This is going to go to my personal history of lame bugs.

Incidentally, my uploaded 0.25.2 build might have some issues. Would you consider re-uploading that?

@thomaslima

This comment has been minimized.

Copy link
Collaborator

thomaslima commented Apr 11, 2018

Here it is if anybody is interested: klayout-0.25.2-macOS-HighSierra-1-Qt5101brew-bb8ecb4.dmg in https://www.dropbox.com/sh/034oi1afy682lsa/AABGTzS2_-H69ESatIOWY0m7a?dl=0

@klayoutmatthias

This comment has been minimized.

Copy link
Collaborator

klayoutmatthias commented Apr 11, 2018

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 24, 2018

Update to 0.25.3
* Use Qt 5 instead of Qt 4

Changelog:
0.25.3          (2018-05-03):

* Enhancement: Compile option to use libcurl instead of QtNetwork
       This workaround enables builds on the native CentOS6
       configuration with the package manager functional.
* Enhancement: Pass label (text) layers through DRC script
       The "labels" method now allows copying labels from a layer
       to the output.
* Enhancement: New "split" method for polygons
       This method will fragment the polygons into two or more
       smaller parts for reducing their vertex count.
* Enhancement: New "dtrans" method for RecursiveShapeIterator
       This method delivers the transformation in micron unit space
* Enhancement: New "insert" methods for Shapes
       Shapes can now insert from another Shapes container and
       from a RecursiveShapeIterator. Possible applications are
       fast flattening and fast region selection.
* Enhancement: New method to generate RDB items from shapes
       RdbItem#add_value from a shape, RdbDatabase#create_items
       from a shapes container or recursive shape iterator and
       RdbDatabase#create_item from a shape.
* Enhancement: DXF and CIF "keep layer names"
       If this option is set in the reader options, layer names
       are not translated into GDS layer/datatype pairs.
       Specifically a layer called "L5" for example is not
       translated to 5/0 and to "L5D0" on output correspondingly.
       The buddy script option is "--keep-layer-names".
* Enhancement: DXF contour joining accuracy
       On the DXF reader's options, a contour joining accuracy
       can be specified. Small gaps smaller than this accuracy
       will be closed when forming joined contours from edges.
       The buddy script option is --dxf-contour-accuracy=value.
* Bugfix: DXF display issue
       In some cases, DXF cell instances did not trigger bounding
       box update and the cells only got visible after save and
       load.
* Bugfix: XOR progress is more realistic
       The progress is updated after the layer has been computed,
       not before.
* Bugfix: KLayout/klayout#117
       DTrans#itype was broken.
* Bugfix: KLayout/klayout#116
       Fixed a polygon decomposition bug when writing GDS files
       with big polygons with many holes. As a side effect, the
       polygons with many holes computed by a NOT operation for
       example are less complex and spikes in the cutlines are
       avoided.
* Bugfix: KLayout/klayout#115
       Reader options were not persisted.
* Bugfix: KLayout/klayout#114
       Custom line styles not loaded from tech's layer properties
       file.
* Enhancement: KLayout/klayout#113
       The XOR tool has an option now to heal result shapes which
       cross tile boundaries. The result shape count of tiled
       and non-tiled mode should basically be the same then.
* Bugfix: KLayout/klayout#112
       Salt package repository relative paths have not been working.
* Bugfix: KLayout/klayout#109
       Issues with Python 3 and shape properties - property
* Bugfix: KLayout/klayout#108
       Bugfix on Box#enlarge and Box#moved for empty boxes.
       keys generated with Python 3 could not be written to GDS2.
* Bugfix: KLayout/klayout#107
       Undo not working with shapes.
* Enhancement: KLayout/klayout#106
       Search & replace help page enhancements.

0.25.2          (2018-03-20):
* Bugfix: KLayout/klayout#90
      DRC: "extended" was not working as expected with "joined = true"
* Bugfix: KLayout/klayout#89
      Display issue on MacOS fixed
* Enhancement: KLayout/klayout#85
      IDE debugger: files can be excluded from showing exceptions when
      they are thrown. To exclude a file press the new "Ignore" button
      when the debugger tells you an exception has been generated.
      To re-able exception reporting, clear the list of the files
      in the IDE settings ("Debugging" tab)
      The macro IDE settings can now be edited in the File/Setup
      dialog.
* Bugfix: KLayout/klayout#94
      Retina displays are support to some extend on MacOS.
      An open topic is the quality of the icons.
* Enhancement: build system for MacOS

0.25.1          (2018-02-23):
* Enhancements: build compatibility with MacOS and Qt 5.9.
      Qt 4.6 supported now as well with one restriction:
      the package installation feature is not working.
* Bugfixs: Package manager
       - Remove button wasn't enabled if multiple packages were selected
       - A potential crash ob removing packages was fixed
* Enhancement: 64 bit coordinate support enabled on Windows builds
* Further bugfixes: See links
       - KLayout/klayout#21 (Autorun(-early) doesn't seem to run when lym files are inside a package)
       - KLayout/klayout#24 (Text insert dialog bug - Ok button isn't working)
       - KLayout/klayout#26 (Exceptions are reported every time they propagate up in the call chain in the ruby debugger)
       - KLayout/klayout#28 (CIF format detection failed)
       - KLayout/klayout#30 (Writer options dialog non-functional on a fresh configuration)
       - KLayout/klayout#32 (Rounding issue with instance properties)
       - KLayout/klayout#33 (Plugin factory not working when using with Python)
       - KLayout/klayout#36 (Hardening against destruction of object inside event handler)
       - KLayout/klayout#39 (Action cannot be reassigned)
       - KLayout/klayout#40 (Crash in Python binding)
       - KLayout/klayout#41 (Polygon#touches? issue)
       - KLayout/klayout#42 (Headless mode support with Qt5/-zz)
       - KLayout/klayout#43 (Crash when using Qt specific command line options)
       - KLayout/klayout#44 (Transformation constructor with x,y not working)
       - KLayout/klayout#45 (Partial selection does not capture instance)
       - KLayout/klayout#48 (Cancel does not reset current tool)
       - KLayout/klayout#51 (Segmentation fault on return to main window and other opportunities)
       - KLayout/klayout#53 (Unreadable 'about' text)
       - KLayout/klayout#62 (QXmlSimpleReader#parse cannot be called)
       - KLayout/klayout#63 (Wrong output on DRC non_interacting with empty second input)
       - KLayout/klayout#64 (Crash on exit)
       - KLayout/klayout#68 (OASIS reader issue with degenerated shapes)
       - KLayout/klayout#69 (DRC: 'inside' does not merge shapes of second input)
       - KLayout/klayout#71 (Target cell argument is required)
       - KLayout/klayout#72 (Edges/Region NOT issue)
       - KLayout/klayout#73 (Allow 'change layers' on PCells which support a single layer parameter)
       - KLayout/klayout#74 (Small-corner boolean issue)
       - KLayout/klayout#75 (Python PCell issue when parameters are called 'layer')
       - KLayout/klayout#79 (Replace function enabled also for read-only macros)
* Further enhancements: see links
       - KLayout/klayout#29 (Permissive mode for OASIS writer on odd-width paths)
       - KLayout/klayout#59 (Async download of package index and details)
       - KLayout/klayout#66 (Authentication dialog indicates retry)
       - KLayout/klayout#77 (Layout#copy_tree now works in non-editable mode too)

0.25            (2017-11-04):
* Enhancement: Menu customization
      Menu items can be disabled or enabled now. The former
      "Key Bindings" configuration page has been turned into
      "Menu Customization". Check boxes allow enabling or
      disabling of menu items. Disabled menu items are not
      shown.
      A search filter allows quick selection of menu items
      by title or path.
* Enhancement: The cell tree no longer is collapsed on edits
      or when the sorting order changes.
* Enhancement: Using a special menu path, macros can be
      configured to appear in submenus now.
* Enhancement: KLAYOUT_HOME environment variable to
      control the location of the application folder.
      The application folder is the place where KLayout
      keeps the configuration, macros, packages and
      other things.
* Enhancements: Major overhaul of the build environment
      - Qt5 supported now
      - Employs qmake as build system
      - Reorganisation of the sources
      - Continuous integration enabled (unit tests
        integrated in .pro files, JUnit output etc.)
      - Compatible with the clang compiler
* Enhancements: Buddy tools: KLayout now comes with a set of
      additional executables that provide some functionality
      subset in a lean way. These binaries are named "strm..."
      and are installed along with KLayout.
      - strm2cif: converts any format to CIF
      - strm2dxf: converts any format to DXF
      - strm2gds: converts any format to GDS2
      - strm2gdstxt: converts any format to GDS2/text
      - strm2oas: converts any format to OASIS
      - strm2txt: converts any format to plain text (internally)
      - strmclip: creates a clip from a file
      - strmcmp: compares two files (logically)
      - strmxor: compares two files (geometrically)
      For more information, use the "-h" or "--help" option.
* Enhancements: HTTPS support for loading files from URL's directly
* Enhancements: Numerous enhancements and optimizations in the RBA/pya
      area and in the debugger.
* Enhancements: KLayout notifies the user when a file was changed and
      asks whether to reload.
* Enhancements: "File cell or layer": type into the cell or layer list to jump to the
      cell name typed.
* Enhancements: Advanced search features in the filter entry box
      for the cell selection form: Case sensitive/insensitive,
      glob pattern, clear button.
* Enhancements: Tree expansion icons have a better contrast now on Windows
      with dark background.
* Enhancements: Forward and backward navigation buttons in the main window.
      These buttons jump to the previous or next display state:
      zoom window, hierarchy depth, etc..
* Enhancements: A Package manager is provided. Packages are add-ons for
      KLayout and can include macros, script libraries, fonts
      for the TEXT PCell, technologies, DRC scripts etc.
      Packages can be published on GitHub or any server
      supporting WebDAV. After registering a package, users
      can install or update packages with a few clicks.
      For more information see https://github.com/klayoutmatthias/klayout/wiki
      or "About Packages" in the "Various Topics" area of the main
      documentation. The package manager is found in the "Tools"
      menu under "Manage Packages".
* Enhancements: LEF/DEF reader:
       - Compatibility fixes with version 5.8
       - Regions and Groups are supported now
       - LEF/DEF is a standare format now and
         can be used with "File/Open" for example.
* Enhancement: DXR reader supports variable path widths now
* Enhancement: XOR provides graphical progress
* Enhancements: Libraries can be associated with a technology. Only libraries
      associated with the selected technology are shown in the selection
      dialog.
* Enhancements: Overlapping instances are easier to select now (instance
      selection cycling).
* Enhancements: Many more methods in RBA/pya. For example:
       - Ability to directly insert "D" types (such as DBox
         into layouts and cells.
       - RBA::RecursiveShapeIterator now supports complex (non-rectangular)
         search regions
       - A more consistent type framework (consistent complex transformation
         types, vectors)
       - More intuitive interface in certain objects (i.e. CellView,
         LayerPropertiesNode, Annotation etc.). Changing an attribute
         usually has an immediate effect on the respective property now
         ("live objects")
       - Hash functions for certain objects - Box, Edge, Trans, Polygon,
         and other objects can be used as dictionary keys now.
       - New import methods for Region, EdgePairs and Edges
       - New features for LayerMapping and CellMapping
       - Multiple selected cells in LayoutView
       - RBA::TextGenerator to supply the Basic.TEXT PCell's
         functionality as static feature
       - Receivers can be added to signals and removed from
         signals now.
       - Individual instance iterator for CellInstArray
       - ...
* Enhancements: Enhanced layout statistics form with detailed shape
      statistics.
* Enhancements: Line styles (dashed, dotted etc.) available now.
      Works best with manhattan layouts.
* Enhancements: "Marked box mode": boxes are drawn with a cross.
* Enhancements: Arbitrary pattern size for custom fill pattern (no
      limited to multiples of 8). Max size is 32x32.
      Enhanced annotations:
       - Ellipses
       - Position markers
       - Text alignment
       - "Auto measure" rulers (place a ruler measuring the
         distances between adjacent objects with a single
         click)
* Enhancements: DRC enhancements:
       - Text support
       - "smoothed" function
       - "layers" function delivers all layers read
       - Polygon with edge interactions
       - middle and extent_refs methods for center point and other
         references
       - "corners" function
       - "collect...", "select" and "each" methods
* Enhancements: GDS2 paths can now use the MultiXY extension too.
* Enhancements: X2 Support for Gerber import.
* Enhancements: A function to reset the window state after the
      window has been misconfigured (i.e. detaching or closing
      the dockable windows). This feature is found in
      View/Restore Window.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment