Browse Source
The functions involved in the problem were PGM_BASE::GetEditorName and EDA_BASE_FRAME::OnSelectPreferredEditor: 1) OnSelectPreferredEditor showed a dialog to allow the user selecting the editor, but before that called GetEditorName to get the name of the current editor (to show as a default in the choose file dialog). 2) The problem was when there was no editor, GetEditorName showed its own dialog. 3) So the user was seeing first the dialog from (2) and then the dialog from (1). 4) As GetEditorName is used in many other places the solution I did was to add to it an optional parameter that tells it what to do if no editor is set. To avoid modifying other code that relies on the current behaviour, this parameter has a default value that causes to show the dialog. But now when OnSelectPreferredEditor calls it, it passes the parameter that causes it to return an empty string if no editor was set. 5) Also, I found a second bug while doing it which allowed in the first dialog to select an unexistent file (the dialog was missing the wxFD_FILE_MUST_EXIST flag). 6) Lastly, to avoid having duplicated code (the one that showed the same dialog and that configured the wildcard was in two methods) I created a single function that now both functions call: PGM_BASE::AskUserForPreferredEditor. This way we also will have consistency in the behaviour of both dialogs and there is a single place where it needs to be modified.pull/12/head
committed by
Chris Pavlina
3 changed files with 61 additions and 38 deletions
Loading…
Reference in new issue