Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
da757938
Commit
da757938
authored
Feb 07, 2013
by
Jacobo Aragunde Perez
Committed by
jean-pierre charras
Feb 07, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit patch for bug 1116059 (Inconsistency between confirmation dialogs)
parent
eed97c54
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
21 deletions
+81
-21
libedit.cpp
eeschema/libedit.cpp
+22
-10
libeditframe.cpp
eeschema/libeditframe.cpp
+17
-7
libeditframe.h
eeschema/libeditframe.h
+13
-2
moduleframe.cpp
pcbnew/moduleframe.cpp
+29
-2
No files found.
eeschema/libedit.cpp
View file @
da757938
...
...
@@ -285,7 +285,17 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
}
void
LIB_EDIT_FRAME
::
SaveActiveLibrary
(
wxCommandEvent
&
event
)
void
LIB_EDIT_FRAME
::
OnSaveActiveLibrary
(
wxCommandEvent
&
event
)
{
bool
newFile
=
false
;
if
(
event
.
GetId
()
==
ID_LIBEDIT_SAVE_CURRENT_LIB_AS
)
newFile
=
true
;
this
->
SaveActiveLibrary
(
newFile
);
}
bool
LIB_EDIT_FRAME
::
SaveActiveLibrary
(
bool
newFile
)
{
wxFileName
fn
;
wxString
msg
;
...
...
@@ -295,7 +305,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
if
(
m_library
==
NULL
)
{
DisplayError
(
this
,
_
(
"No library specified."
)
);
return
;
return
false
;
}
if
(
GetScreen
()
->
IsModify
()
)
...
...
@@ -304,7 +314,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
SaveOnePartInMemory
();
}
if
(
event
.
GetId
()
==
ID_LIBEDIT_SAVE_CURRENT_LIB_AS
)
if
(
newFile
)
{
// Get a new name for the library
wxString
default_path
=
wxGetApp
().
ReturnLastVisitedLibraryPath
();
wxFileDialog
dlg
(
this
,
_
(
"Component Library Name:"
),
default_path
,
...
...
@@ -312,7 +322,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
wxFD_SAVE
|
wxFD_OVERWRITE_PROMPT
);
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
return
;
return
false
;
fn
=
dlg
.
GetPath
();
...
...
@@ -330,12 +340,12 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
msg
=
_
(
"Modify library file
\"
"
)
+
fn
.
GetFullPath
()
+
_
(
"
\"
?"
);
if
(
!
IsOK
(
this
,
msg
)
)
return
;
return
false
;
}
// Verify the user has write privileges before attempting to save the library file.
if
(
!
IsWritable
(
fn
)
)
return
;
return
false
;
ClearMsgPanel
();
...
...
@@ -367,7 +377,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
msg
=
_
(
"Error occurred while saving library file
\"
"
)
+
fn
.
GetFullPath
()
+
_
(
"
\"
."
);
AppendMsgPanel
(
_
(
"*** ERROR: ***"
),
msg
,
RED
);
DisplayError
(
this
,
msg
);
return
;
return
false
;
}
}
catch
(
...
/* IO_ERROR ioe */
)
...
...
@@ -375,7 +385,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
libFileName
.
MakeAbsolute
();
msg
=
wxT
(
"Failed to create component library file "
)
+
libFileName
.
GetFullPath
();
DisplayError
(
this
,
msg
);
return
;
return
false
;
}
wxFileName
docFileName
=
libFileName
;
...
...
@@ -407,7 +417,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
docFileName
.
GetFullPath
()
+
_
(
"
\"
."
);
AppendMsgPanel
(
_
(
"*** ERROR: ***"
),
msg
,
RED
);
DisplayError
(
this
,
msg
);
return
;
return
false
;
}
}
catch
(
...
/* IO_ERROR ioe */
)
...
...
@@ -416,13 +426,15 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
msg
=
wxT
(
"Failed to create component document library file "
)
+
docFileName
.
GetFullPath
();
DisplayError
(
this
,
msg
);
return
;
return
false
;
}
msg
=
_
(
"Library file
\"
"
)
+
fn
.
GetFullName
()
+
wxT
(
"
\"
Ok"
);
fn
.
SetExt
(
DOC_EXT
);
wxString
msg1
=
_
(
"Document file
\"
"
)
+
fn
.
GetFullPath
()
+
wxT
(
"
\"
Ok"
);
AppendMsgPanel
(
msg
,
msg1
,
BLUE
);
return
true
;
}
...
...
eeschema/libeditframe.cpp
View file @
da757938
...
...
@@ -98,7 +98,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_ACTIVATE
(
LIB_EDIT_FRAME
::
OnActivate
)
/* Main horizontal toolbar. */
EVT_TOOL
(
ID_LIBEDIT_SAVE_CURRENT_LIB
,
LIB_EDIT_FRAME
::
SaveActiveLibrary
)
EVT_TOOL
(
ID_LIBEDIT_SAVE_CURRENT_LIB
,
LIB_EDIT_FRAME
::
On
SaveActiveLibrary
)
EVT_TOOL
(
ID_LIBEDIT_SELECT_CURRENT_LIB
,
LIB_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_LIBEDIT_DELETE_PART
,
LIB_EDIT_FRAME
::
DeleteOnePart
)
EVT_TOOL
(
ID_TO_LIBVIEW
,
LIB_EDIT_FRAME
::
OnOpenLibraryViewer
)
...
...
@@ -130,7 +130,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
/* menubar commands */
EVT_MENU
(
wxID_EXIT
,
LIB_EDIT_FRAME
::
CloseWindow
)
EVT_MENU
(
ID_LIBEDIT_SAVE_CURRENT_LIB_AS
,
LIB_EDIT_FRAME
::
SaveActiveLibrary
)
EVT_MENU
(
ID_LIBEDIT_SAVE_CURRENT_LIB_AS
,
LIB_EDIT_FRAME
::
On
SaveActiveLibrary
)
EVT_MENU
(
ID_LIBEDIT_GEN_PNG_FILE
,
LIB_EDIT_FRAME
::
OnPlotCurrentComponent
)
EVT_MENU
(
ID_LIBEDIT_GEN_SVG_FILE
,
LIB_EDIT_FRAME
::
OnPlotCurrentComponent
)
EVT_MENU
(
wxID_HELP
,
EDA_DRAW_FRAME
::
GetKicadHelp
)
...
...
@@ -343,15 +343,25 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if
(
GetScreen
()
->
IsModify
()
)
{
if
(
!
IsOK
(
this
,
_
(
"Component was modified!
\n
Discard changes?"
)
)
)
int
ii
=
DisplayExitDialog
(
this
,
_
(
"Save the changes in the library before closing?"
)
);
switch
(
ii
)
{
case
wxID_NO
:
break
;
case
wxID_OK
:
case
wxID_YES
:
if
(
this
->
SaveActiveLibrary
(
false
)
)
break
;
// fall through: cancel the close because of an error
case
wxID_CANCEL
:
Event
.
Veto
();
return
;
}
else
{
GetScreen
()
->
ClrModify
();
}
GetScreen
()
->
ClrModify
();
}
BOOST_FOREACH
(
const
CMP_LIBRARY
&
lib
,
CMP_LIBRARY
::
GetLibraryList
()
)
...
...
eeschema/libeditframe.h
View file @
da757938
...
...
@@ -439,13 +439,24 @@ private:
void
SelectActiveLibrary
(
CMP_LIBRARY
*
aLibrary
=
NULL
);
/**
* Function SaveActiveLibrary
* Function
On
SaveActiveLibrary
* it the command event handler to save the changes to the current library.
*
* A backup file of the current library is saved with the .bak extension before the
* changes made to the library are saved.
*/
void
SaveActiveLibrary
(
wxCommandEvent
&
event
);
void
OnSaveActiveLibrary
(
wxCommandEvent
&
event
);
/**
* Function SaveActiveLibrary
* saves the changes to the current library.
*
* A backup file of the current library is saved with the .bak extension before the
* changes made to the library are saved.
* @param newFile Ask for a new file name to save the library.
* @return True if the library was successfully saved.
*/
bool
SaveActiveLibrary
(
bool
newFile
);
/**
* Function LoadComponentFromCurrentLib
...
...
pcbnew/moduleframe.cpp
View file @
da757938
...
...
@@ -320,12 +320,39 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if
(
GetScreen
()
->
IsModify
()
)
{
if
(
!
IsOK
(
this
,
_
(
"Module Editor: Module modified! Continue?"
)
)
)
int
ii
=
DisplayExitDialog
(
this
,
_
(
"Save the changes in the module before closing?"
)
);
switch
(
ii
)
{
Event
.
Veto
();
return
;
case
wxID_NO
:
break
;
case
wxID_OK
:
case
wxID_YES
:
// code from FOOTPRINT_EDIT_FRAME::Process_Special_Functions,
// at case ID_MODEDIT_SAVE_LIBMODULE
if
(
GetBoard
()
->
m_Modules
&&
getLibPath
()
!=
wxEmptyString
)
{
if
(
Save_Module_In_Library
(
getLibPath
(),
GetBoard
()
->
m_Modules
,
true
,
true
))
{
// save was correct
GetScreen
()
->
ClrModify
();
break
;
}
}
else
{
DisplayError
(
this
,
_
(
"Library is not set, the module could not be saved."
)
);
}
// fall through: cancel the close because of an error
case
wxID_CANCEL
:
Event
.
Veto
();
return
;
}
}
//close the editor
SaveSettings
();
Destroy
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment