-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add symbol editor #700
Merged
Merged
Add symbol editor #700
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Schematic" object already can edit symbols, this commit makes it able to save and load them. Implementation is actually quite ugly in terms of code beauty and industry standards, it's very "hacky". It consists of two parts: 1. Teach "Save" and "Open" dialogs to deal with "*.sym" files 2. Modify "Schematic" object and some other parts of codebase so that when a schematic is saved and the filename ends with "*.sym", then only symbol parts are saved. And vice versa: when a file with a name ending in "*.sym" is opened, then skip the path for usual schematic, and load only symbol parts. The "symbol file" is actually a stripped "schematic file" — no properties, no components, etc.
- PortSymbol has two members: nameStr and numberStr. - nameStr is usually empty and is set from Schematic::adjustPortNumber after performing some obscure checks. - numberStr is usually contains a number - PortSymbol::paint outputs 'nameStr' as ports "label" - When editing a *.sym file, 'adjustPortNumber' is not called, nameStr remains empty This patch makes PortSymbol use 'numberStr' as fallback value for cases when 'nameStr' is empty. When editing a *.sym file one won't see a port without label anymore.
"Insert port" tool is reused it. When in symbol editing mode, left mouse button click with this tool activated spawns a dialog asking for port name, then insert a port. I hope there is no breaking changes and everything is backwards compatible as I strived to add workarounds everywhere it's needed. The sad part is that code is not elegant, it increases overall codebase entropy, doesn't follow any general strategy. It's just a set of patches.
Detached ports are ports which were inserted manually, i.e. they don't have a corresponding port in schematic. Inside Schematic::undo the Schematic::adjustPortNumbers is called. The latter removes detached ports and because of that you lose all of your ports if use "undo" once. But Schematic::adjustPortNumbers is also called every time the editing mode is switched and when the file is saved. So I think it wouldn't be harm to not adjust port numbers every time you undoing.
This was referenced Apr 23, 2024
Thanks! I will merge this after #533 |
Thanks for the contribution! Merged. |
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Opening a PR following the discussion in #679
Recap:
May close #147