pcb

refdes labels in new layout can't be moved without restart

Bug #699478 reported by Jared Casper
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pcb
Fix Released
Medium
Unassigned

Bug Description

The .pcb file that gsch2pcb creates does not have a font in it. When
loading files, the bounding box for all the text is calculated as the
file is read. In the case that there is no font, this is before the
default font is installed, so the bounding box is way too small.

This is remedied by looping through all the text and resetting the
bouding box after the default font is installed (if there was no font
in the file).

Revision history for this message
Jared Casper (jaredcasper) wrote :
Revision history for this message
Jared Casper (jaredcasper) wrote : RE: Fix for pr2976245, refdes labels in new layout can't be mov

Hrm, there still appears to be a problem that after loading a file with no font, text not associated with an element is only grabable in a small box in the far left of the text. The bounding box is set correctly, but for some reason you can't grab it anywhere in that box, just on the far left.

Not sure what is going on there, but that may be another bug/patch since the bounding box is indeed being set correctly (verified by putting in a printf when it is set, and by the outline drawn when moving it around).

Revision history for this message
Patrick Bernaud (patrickb) wrote :

You have to update the rtree after modifying the bounding box: change the ALLTEXT_LOOP block to something like:
r_delete_entry (layer->text_tree, (BoxTypePtr) text);
RestoreToPolygon (PCB->Data, TEXT_TYPE, layer, text);
SetTextBoundingBox (&PCB->Font, text);
r_insert_entry (layer->text_tree, (BoxTypePtr) text, 0);

Revision history for this message
Jared Casper (jaredcasper) wrote :
Revision history for this message
Jared Casper (jaredcasper) wrote : RE: Fix for pr2976245, refdes labels in new layout can't be mov

Ah thanks! I should have seen that. A fixed patch attached; I added a ClearFromPolygon after setting the bounding box to reclear the polys if necessary.

Revision history for this message
Jared Casper (jaredcasper) wrote :
Revision history for this message
Jared Casper (jaredcasper) wrote : RE: Fix for pr2976245, refdes labels in new layout can't be mov

Uploaded a new version of the patch. Instead of resetting the bounding box after the fact, it ensures each new PCB structure includes the default font, which can then be overwritten by the one in the file.

Felix Ruoff (felixruoff)
Changed in pcb:
status: New → Confirmed
Felix Ruoff (felixruoff)
summary: - Fix for pr2976245, refdes labels in new layout can't be mov
+ refdes labels in new layout can't be moved in new layout without restart
Revision history for this message
Felix Ruoff (felixruoff) wrote : Re: refdes labels in new layout can't be moved in new layout without restart

Just rebased the patch to actual git-head and tested it. It fixes the bug for me, thank you Jared! Please apply.

Revision history for this message
Felix Ruoff (felixruoff) wrote :
Felix Ruoff (felixruoff)
summary: - refdes labels in new layout can't be moved in new layout without restart
+ refdes labels in new layout can't be moved without restart
Revision history for this message
gpleda.org commit robot (gpleda-launchpad-robot) wrote :

Bug was fixed by a commit
git master commit b0ecb342f6602c037072b99a11250ccc162bf781
http://git.gpleda.org/?p=pcb.git;a=commit;h=b0ecb342f6602c037072b99a11250ccc162bf781

commit b0ecb342f6602c037072b99a11250ccc162bf781
Author: Jared Casper <email address hidden>
Commit: DJ Delorie <email address hidden>

    refdes labels in new layout can't be moved.

    The .pcb file that gsch2pcb creates does not have a font in it. When
    loading files, the bounding box for all the text is calculated as the
    file is read. In the case that there is no font, this is before the
    default font is installed, so the bounding box is way too small.

    This patch remedies this by making all new PCB structures contain the
    default font by calling CreateDefaultFont in CreateNewPCB
    (CreateDefaultFont now takes in a PCBTypePtr instead of using the
    global PCB). Previously, each time CreateNewPCB was called,
    CreateDefaultFont was called soon thereafter.

    In the case of loading a PCB from a file. The default font in the
    newly created struct PCB is marked invalid but not removed. If the
    .pcb file contains a font, the default font will be overwritten by the
    file's font. If it does not, PCB->Font will still be invalid after
    LoadPCB, a message is displayed that the default font is being used,
    and PCB->Font.Valid is set to true.

    Also fixes a related bug where the memory for a symbols lines wasn't
    being cleared when a new file was brought into place. Previously,
    this only happened if a new Font was loaded into an existing PCB. Now
    the font will be replaced every time a file with symbol information is
    loaded.

    Rebased to actual git-head by Felix Ruoff

    Closes-bug: lp-699478

Changed in pcb:
status: Confirmed → Fix Committed
Peter Clifton (pcjc2)
Changed in pcb:
milestone: future-bug-release → next-bug-release
Peter Clifton (pcjc2)
Changed in pcb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.