We have moved to https://dokuwiki.librecad.org/
Lots of content was already moved to the new wiki, but there is still work to do. If you want to contribute, please register a new account at https://dokuwiki.librecad.org/
This wiki will be kept for a while to keep search engine results valid. Moved sites may be deleted here in future.
API & Development
- Responsible for starting CAD actions
- Responsible for routing UI events
- Generate GUI actions and connection to CAD actions
- Access to GUI interface: Qt widgets
- Responsible for the actual drawing of objects (onto a QPaintDevice)
- Base class for all CAD entity types
There are some segfaults by action( rs_action* methods) destructors caused by actions when closing the main window. These segfault can be fixed by detecting RS_GraphicView cleanup in action destructors.
A method to detect cleanup is added:
bool RS_GraphicView::isCleanUp() const;
whenever isCleanUp() returns true, action destructors should not try to cleanup, as entities may be deleted already.
TODO: We need a better solution probably by smart pointers.
The --debug switch
The LibreCAD binary supports the command line switch --debug. To use this feature, start LC from a terminal appending the --debug parameter.
LibreCAD will start as usual, but in the terminal window a whole lot of debugging messages will appear.
To save these messages into a file use librecad --debug 2>debugging.txt.
The enhanced --debug switch
With commit de0f48f (somewhere after version 2.0.0rc2; Sep 11, 2013), this switch was enhanced.
When debugging a special issue, you can control the debugging level, thus the quantity of messages printed to the terminal will be reduced.
Using only --debug is working as always.
Appending a digit from 0 to 6 to the switch, e.g. --debug3, will set the corresponding debugging level.
For a list of all debugging levels use the switch --debug?, then a list of all debugging levels is printed and LibreCAD will not start.
The higher the level number, the more messages will be printed.
The supported debug levels are:
|level||name||use in print()||printing|
|2||Error||RS_Debug:D_ERROR||critical and errors|
|3||Warning||RS_Debug:D_WARNING||critical, errors and warnings|
|4||Notice||RS_Debug:D_NOTICE||critical, errors, warnings and notices|
|5||Informational||RS_Debug:D_INFORMATIONAL||critical, errors, warnings, notices and informational|
|6||Debugging||RS_Debug:D_DEBUGGING||all, same as --debug|
Using the enhanced --debug switch
Use the RS_DEBUG->print( level, "format", ...); method to print the messages you need.
There is an overloaded method RS_DEBUG->print( "format", ...); which is the same as RS_DEBUG->print( RS_Debug:D_DEBUGGING, "format", ...);.
"format" is a standard printf-format string, followed by the variables to be set in the format string.
When you're working on a new feature or investigating an issue, add e.g. RS_DEBUG->print( RS_Debug:D_INFORMATIONAL, ...); commands to your code. Start LibreCAD from a terminal with --debug5.
Then you will have much lesser output to search for the information you need.
If the messages will be useful for further debugging sessions, you may leave some of them in the code, but consider to raise their level befor committing, to keep the lower levels clean.
If messages are useless after finishing the feature or fixing an issue, please remove them before committing.