Modifying a board preferences don't set the 'unsaved' flag

Bug #793420 reported by Lorenzo Marcantonio
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Low
Jeff Young

Bug Description

To reproduce (as in today bzr):
- Open a board in pcbnew
- Enter, for example, Preferences/Dimensions/Texts and Drawings (other items *may* have the same issue)
- Change something then press OK
==> the 'save' command in not available, even if the changed preferences are in fact saved in the board file

WORKAROUND: touch something else and save or use 'save as'

Tags: pcbnew starter

Related branches

Revision history for this message
Krzysztof Wesołowski (kwesoly) wrote :

I'm not 100% sure, but preferences you mentioned are saved in *.pro files, via Preferences->Save Preferences.

Revision history for this message
Dimitar Kovachev (d-kovachev) wrote :

Bump.

Unlike the original bug description, now changed preferences are NOT saved in the .BOR file and are effectively lost (unless another modification is done and the board saved).

Version: 0.0.201207131909+3646~10~precise1

Revision history for this message
Dimitar Kovachev (d-kovachev) wrote :

Sorry: ".BRD file"

Martin Errenst (imp-d)
tags: added: pcbnew
Revision history for this message
Stefan (stol) wrote :

This can be confirmed.

In PcbNew there is a menu "Dimensions" with the sub menues
Grid
Texts And Drawings
Pads
Pad Mask Clearance
Diffrential Pairs
Save

Kicad uses a project file .pro and the pcbnew uses .kicad_pcb

B)
All the values in Grid/Pads/Pad Mask Clearance/Differental Paris
are saved in the .pro file and does not affect the .kicad_pcb

A)
All the values in "Texts And Drawings" is on the other hand
saved in the .kicad_pcb file.

This mean that any changes in B) must be followed by using the "Save" menu
choice, however using Save will not save any changes made in B)

But any changes made in B) will not "modify" pcbnew and therefore
these changes will be lost if the pcb is not modified in any other wy
like adding a track.

The follwing patch will "modify" the pcb if B) is modified
so the user can either save the changes in normal "pcb way"
or, at least, get a notification of unsaved data if exiting pcbnew without saving

 bzr push lp:~stol/kicad/bug793420
Using default stacking branch /+branch-id/324654 at chroot-67822224:///~stol/kicad/
Created new stacked branch referring to /+branch-id/324654.

Revision history for this message
Stefan (stol) wrote :

oups

It should be
A)
All the values in Grid/Pads/Pad Mask Clearance/Differental Paris
are saved in the .pro file and does not affect the .kicad_pcb

B)
All the values in "Texts And Drawings" is on the other hand
saved in the .kicad_pcb file.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 793420] Re: Modifying a board preferences don't set the 'unsaved' flag

A better short term solution would be to push the modified status down
to at least PCB_BASE_FRAME::SetDesignSettings() by first comparing the
new BOARD_DESIGN_SETTINGs against the existing ones in the board and
setting the modified flag accordingly to prevent false positives. Like
this:

void PCB_BASE_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS&
aSettings )
{
    wxASSERT( m_Pcb );

    if( m_Pcb->GetDesignSettings() != aSettings )
    {
        m_Pcb->SetDesignSettings( aSettings );
        OnModify();
    }
}

The ideal long term solution would be to keep track of the board
modification state within the BOARD object as it's modified but that is
a much more involved task.

On 9/22/2015 1:08 PM, Stefan wrote:
> oups
>
> It should be
> A)
> All the values in Grid/Pads/Pad Mask Clearance/Differental Paris
> are saved in the .pro file and does not affect the .kicad_pcb
>
> B)
> All the values in "Texts And Drawings" is on the other hand
> saved in the .kicad_pcb file.
>

Revision history for this message
Stefan (stol) wrote :

I agree, but the solution was a quick one, so it could go in easier due to the block of new features until the stable release.

Perhaps the "Save" menu should be removed as well.
Aas soon as you click on the OK button for category "Grid/Pads/Pad Mask Clearance/Differental Paris"
it would mean an update of the .pro file directly instead of "waiting" for the save button.

Revision history for this message
Novak Tamas (novak-7) wrote :

It seems to be solved (BZR 6658), as modifying e.g. Page settings - Revision enables Save button. When Save is clicked, KiCad_PDB is written, but .pro is not modified.

Changed in kicad:
status: New → Fix Released
Revision history for this message
Nick Østergaard (nickoe) wrote :

@Novak, did you test this in 4.0.2? If not and it works in latest product, then it should just be marked as fix comitted.

Revision history for this message
Novak Tamas (novak-7) wrote :

Sorry, it works well (save button enabled after changing something) for Page Settings - Revision, but doesn't work when editing Preferences - General - Units. The same with both BZR6709 and 4.0.2_stable). Gotta set back to "confirmed":(

Changed in kicad:
status: Fix Released → Confirmed
importance: Undecided → Low
Revision history for this message
xzcvczx (xzcvczx) wrote :

This also occurs if you change layer visibility without changing anything else you are unable to save which layers are visible

tags: added: starter
Jeff Young (jeyjey)
Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: Confirmed → In Progress
Revision history for this message
Jeff Young (jeyjey) wrote :

Layer visibility fixed in:

 https://github.com/KiCad/kicad-source-mirror/commit/8722fd9c6c327407d7fe285e944830b1a9a9c57b

I considered Wayne's recommendation of doing the Design Settings at the SCH_BASE_FRAME level, but we'd need to write a whole boatload of operator== routines to make that work, and it would be inconsistent with most of the rest of the app which sets modified at the UI level.

The patch therefore fixes all callers of SetDesignSettings (both PCB_BASE_FRAME and SCH_BASE_FRAME), as well as callers of SetZoneSettings.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I merged your patch. I know it's not the ideal solution but if resolves this bug. Thanks

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision b1b3a89f72263168efd08ea9fc30c26b5cbdf1cb
https://git.launchpad.net/kicad/patch/?id=b1b3a89f72263168efd08ea9fc30c26b5cbdf1cb

Changed in kicad:
status: In Progress → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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