Skip to content
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

Refactor simulation components #783

Merged
merged 22 commits into from
Jun 25, 2024
Merged

Conversation

wawuwo
Copy link
Contributor

@wawuwo wawuwo commented Jun 23, 2024

Hi!

I started working on #730 and found out that in order to fix it it's better to refine components inheritance hierarchy a bit, so I've come up with this. A short description of changes:

  1. Distinction between drawing of simulation and usual components
if (Model.at(0) == '.') {   // is simulation component (dc, ac, ...)
    drawSimulator(p);
} else {    // normal components go here
    drawUsual(p);
}

is removed from Component in favour of a single method — Component::drawSymbol. By default it draws a usual component and anyone wanting their own logic has to override it.

  1. A new class SimulationComponent is added: it inherits from Component overriding its drawSymbol to provide logic specific to simulation components. This class is meant to be a common base class for all simulation components.
  2. All simulation components are changed to inherit from newly created base class .

There are a lot of commits, but most of them are tiny, and the most important ones are the first two. They lay the foundation for all subsequent ones.

This method is meant to be overrided by ancestors if they need
to provide their own drawing implementation.
@ra3xdh ra3xdh added this to the 24.3.0 milestone Jun 23, 2024
@wawuwo
Copy link
Contributor Author

wawuwo commented Jun 24, 2024

There is a problem: with some fonts simulation "box" has wrong size; working on it

wawuwo added 21 commits June 24, 2024 09:44
This class inherits from Component and is meant to be inherited
by all simulation components to share the symbol drawing logic.
@wawuwo
Copy link
Contributor Author

wawuwo commented Jun 25, 2024

Now it's OK I hope

@ra3xdh ra3xdh merged commit c3b599d into ra3xdh:current Jun 25, 2024
5 checks passed
@ra3xdh
Copy link
Owner

ra3xdh commented Jun 25, 2024

I didn't find issues with this PR. Merging. Thanks for the contribution!

@ra3xdh ra3xdh linked an issue Jun 25, 2024 that may be closed by this pull request
@wawuwo wawuwo deleted the refactor-sim-components branch June 25, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong bound box for simulation block
2 participants