263 Commits

Author SHA1 Message Date
Andrey Kalmykov
a138bcbda4 Fix removing of a not selected label instead of selected
Fixes ra3xdh#1254
2025-02-23 19:46:23 +01:00
Andrey Kalmykov
20caefadf8 Make future wire more thicker when laying a new wire 2025-02-23 11:30:24 +01:00
Vadim Kuznetsov
eff2da648a
Merge pull request #1237 from wawuwo/refactor-out-some-q3ptrlist-usages
Replace some Q3PtrList usages with QList
2025-02-15 19:08:14 +03:00
Andrey Kalmykov
3ac7d9e435 Replace some Q3PtrList usages with QList 2025-02-09 22:13:09 +01:00
Andrey Kalmykov
1ac773f4f2 Rename Schematic::sizeOfSelection() 2025-02-09 10:35:19 +01:00
Andrey Kalmykov
cbfb060786 Refactor Schematic::sizeOfSelection 2025-02-09 10:35:19 +01:00
Vadim Kuznetsov
7fde61997c Remove conditional Qt5 code 2025-01-04 12:15:41 +03:00
Vadim Kuznetsov
07970d566a Remove qucs::SkipEmptyParts 2025-01-03 21:06:41 +03:00
dsm
8a9c64004f fix #1121 2024-12-11 18:53:56 +03:00
Iwbnwif Yiw
6a1ad91454 Add getter / setter for schematic grid color 2024-11-15 21:05:09 +00:00
Iwbnwif Yiw
bcd45d7c67 Merge branch 'current' into update-settings-dialog 2024-11-15 20:53:58 +00:00
ThomasZecha
62cf2d4bdc New Feature: CDL netlist export
Introduced very basic c++ coding style for the class Schematic and it's
parent-class QucsDoc based on https://google.github.io/styleguide/cppguide.html:
-Prefix class attributes with a_ (much more better readability!)
-Class member initialization via constructor member initialization list
-No public class attributes (where possible with small effort)

Signed-off-by: ThomasZecha <zecha@ihp-microelectronics.com>
2024-11-15 12:39:39 +01:00
Iwbnwif Yiw
ae7765b85f Create 'Appearance' tab in settings dialog and allow grid color to be set. 2024-11-14 21:15:18 +00:00
ivandi
f3a46cb77b Fix missing text in schematic after upgrading to Qt-6.8.0 2024-10-15 21:18:07 -04:00
Vadim Kuznetsov
bd210e9820
Merge pull request #844 from wawuwo/get-rid-of-mouseactions-drawn
Get rid of MouseActions::drawn
2024-08-02 19:19:49 +02:00
dsm
95786c2647 fixed MSVC build crash. 2024-07-31 12:02:41 +03:00
Muhammet Şükrü Demir
b7a0e1be81 rename getFirst and getLast to front,back.
QList, std::vector etc. has front and back so this changes will reduce refactoring effort.
2024-07-31 12:02:39 +03:00
Andrey Kalmykov
5c936ef0cf Remove Schematic::textCorr
The function is called only in one place, and the variable which
receives its return value is later reassigned new value without
being used, i.e. function return value is discarded. All this
renders Schematic::textCorr useless.
2024-07-31 09:08:50 +02:00
Andrey Kalmykov
2cad2d6a13 Refactor Node class
- Remove dependency on Q3PtrList (most important)
- Hide implementation details (in particular make private
  container used to actually store connected elements)
- New class API
- Formatting and code structuring
2024-07-16 19:32:38 +02:00
Andrey Kalmykov
623bd080fe Get rid of MouseActions::drawn
'drawn' is some obscure flag which is scattered all around
the codebase, it's mostly set to 'false' and only occasionally
to 'true'. It controls blocks of code which are described as
"erase old symbol".

Honestly, I tried to grasp it's meaning and purpose, and I failed.
I believe this flag is just a legacy no one can remember of, and
it's OK to remove it.

Removing 'MouseActions::drawn' completely doesn't seem to change
something, at least at first sight everything looks the same as
usual.

I cram everything in a single large commit for the sake of easier
reverting if it will be needed later.
2024-07-14 17:27:42 +02:00
gslg-1
5a9f35754f Fix of ra3xdh/qucs_s#821 2024-07-13 14:37:04 +02:00
Muhammet Şükrü Demir
db75f6f253
fix Qt5 build. 2024-07-09 00:38:53 +03:00
Muhammet Şükrü Demir
b0be784626 add qNativeGestureZoomEvent. 2024-07-09 00:20:14 +03:00
Vadim Kuznetsov
d30e32888c Assign port numbers for symbol-only mode; preserve ports order on save 2024-06-16 18:57:30 +03:00
Vadim Kuznetsov
670825aa95 Add Schematic::isSymbolOnly and its processing 2024-06-15 18:02:11 +03:00
Andrey Kalmykov
f3fc9eade6 Make border lines of selection rectangle be thin 2024-06-08 10:19:43 +02:00
Andrey Kalmykov
fd9e2fcf76 fixup! Make Schematic::drawContents use QPainter-based drawing 2024-05-23 11:05:23 +03:00
Andrey Kalmykov
1a05e1310e Remove ViewPainter and related stuff
After switching everything to drawing using bare QPainter, a lot
of ViewPainter-based stuff became unused and basically obsolete,
including the ViewPainter itself.
2024-05-19 00:42:48 +03:00
Andrey Kalmykov
8fd201ebdf Rewrite printing and export to image using QPainter "paint" methods 2024-05-19 00:42:48 +03:00
Andrey Kalmykov
b97cf20e38 Make Schematic::drawContents use QPainter-based drawing
Schematic::drawContents is the root of the "drawing" call stack:
starting from this function the QPainter is passed down to diagrams,
components, paintings, etc., using the QPainter-base "paint" methods
prepared in previous commits. So, in this commit we're basically
connect everyhing together to make the new drawing subsystem.
2024-05-19 00:42:48 +03:00
Andrey Kalmykov
99e11f6de8 Add "QPainter" version of Schematic::drawGrid 2024-05-19 00:42:48 +03:00
Andrey Kalmykov
c41612609e Add "QPainter" version of Schematic::paintFrame 2024-05-19 00:42:48 +03:00
Andrey Kalmykov
be88d06541 Add "QPainter" drawing functions to Schematic 2024-05-19 00:42:48 +03:00
Andrey Kalmykov
44d9b55e23 Fix detached ports disappearing after undo in symbol edit mode
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.
2024-04-22 19:16:48 +03:00
Andrey Kalmykov
44eda495d0 Allow inserting ports when editing a symbol
"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.
2024-04-20 11:05:32 +03:00
Andrey Kalmykov
f00c6ef8c3 Add feature: saving symbol to file
"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.
2024-04-13 19:16:17 +03:00
Vadim Kuznetsov
e3ff3f5bee
Merge pull request #675 from wawuwo/private-size-of-all
Refactor: make private UsedX1, UsedY1, UsedX2, UsedY2 members of Schematic
2024-04-08 08:22:17 +02:00
Vadim Kuznetsov
632627224a
Merge pull request #640 from ivandi69/relative-file-path
Add support for relative file paths
2024-04-07 12:55:52 +02:00
Andrey Kalmykov
770ef95514 Replace usages of sizeOfAll with updateAllBoundingRect
Passing Used.* members to 'sizeOfAll' function is clumsy, it
requires the reader to know the purpose of Used.* variables and
that 'sizeOfAll' function updates its arguments in-place. Then
both of facts must be summed up to understand that the line

 Doc->sizeOfAll(Doc->UsedX1, Doc->UsedY1, Doc->UsedX2, Doc->UsedY2)

means 'update the bounds of the area occupied by elements'

On the other hand, the newly added 'updateAllBoundingRect' clearly
states what it does, it hides access to Used.* members and it's
easier to read and understand.
2024-04-07 13:05:42 +03:00
Andrey Kalmykov
2be5fd216b Add allBoundingRect and updateAllBounding member functions to Schematic
These functions don't do anything new, but only wrap already existing
functionality (Schematic::sizeOfAll) to provide a more elegant API.
2024-04-07 12:25:16 +03:00
Andrey Kalmykov
ae4dd58438 Flatten nested conditions 2024-03-24 12:35:41 +03:00
Andrey Kalmykov
8d9b48f1bc Replace manual int comparisons with stdlib functions 2024-03-24 12:35:34 +03:00
Andrey Kalmykov
9accdcbb96 Replace raw for-loops with for-range loops 2024-03-24 12:16:09 +03:00
ivandi
13b7d305ed Add support for relative file paths 2024-03-12 21:04:10 -04:00
Andrey Kalmykov
779da7a634 Format code 2024-03-08 14:14:44 +03:00
Andrey Kalmykov
1180af6cca Flatten nested if-conditions 2024-03-08 14:14:44 +03:00
Andrey Kalmykov
44ef1f7569 Replace manual comparisons with standard library tools 2024-03-08 14:14:44 +03:00
Andrey Kalmykov
36f0bd9ed3 Change signature and usage
Schematic::sizeOfSelection returns values back to the client
via four reference variables passed to it as arguments. This
is not very elegant and most important it doesn't convey return
values semantics.

This commit makes 'sizeOfSelection' return QRect as usual return
value of function.
2024-03-08 14:14:44 +03:00
Andrey Kalmykov
77aa94f35a Replace explicit for loops with for-range constructs 2024-03-08 14:14:44 +03:00
Andrey Kalmykov
5c7aa4dcd6 Replace pre-declared loop vars with in-place 'auto'
Schematic::sizeOfSelection have a set of variables declared in
the beginning of function body. These variables are used as loop
variables further down in function body, which is bad because:
 - variable declarations are far from their actual usage
 - variables have unnecessary large scope

This commit replaces them with `auto` variables declared directly
in loops.
2024-03-08 14:14:39 +03:00