Confirm when cancelling a changed custom rule
This commit is contained in:
parent
1e9639e89c
commit
9a51a75403
|
@ -22,6 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
#include <confirm.h>
|
||||||
#include <widgets/paged_dialog.h>
|
#include <widgets/paged_dialog.h>
|
||||||
#include <pcb_edit_frame.h>
|
#include <pcb_edit_frame.h>
|
||||||
#include <pcb_expr_evaluator.h>
|
#include <pcb_expr_evaluator.h>
|
||||||
|
@ -60,6 +61,7 @@ PANEL_SETUP_RULES::PANEL_SETUP_RULES( PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFr
|
||||||
|
|
||||||
m_textEditor->Bind( wxEVT_STC_CHARADDED, &PANEL_SETUP_RULES::onScintillaCharAdded, this );
|
m_textEditor->Bind( wxEVT_STC_CHARADDED, &PANEL_SETUP_RULES::onScintillaCharAdded, this );
|
||||||
m_textEditor->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, &PANEL_SETUP_RULES::onScintillaCharAdded, this );
|
m_textEditor->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, &PANEL_SETUP_RULES::onScintillaCharAdded, this );
|
||||||
|
m_textEditor->Bind( wxEVT_CHAR_HOOK, &PANEL_SETUP_RULES::onCharHook, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +74,21 @@ PANEL_SETUP_RULES::~PANEL_SETUP_RULES( )
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void PANEL_SETUP_RULES::onCharHook( wxKeyEvent& aEvent )
|
||||||
|
{
|
||||||
|
if( aEvent.GetKeyCode() == WXK_ESCAPE && !m_textEditor->AutoCompActive() )
|
||||||
|
{
|
||||||
|
if( m_originalText != m_textEditor->GetText() )
|
||||||
|
{
|
||||||
|
if( !IsOK( this, _( "Cancel Changes?" ) ) )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aEvent.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
|
void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
|
||||||
{
|
{
|
||||||
m_Parent->SetModified();
|
m_Parent->SetModified();
|
||||||
|
|
|
@ -58,6 +58,7 @@ private:
|
||||||
void OnSyntaxHelp( wxHyperlinkEvent& aEvent ) override;
|
void OnSyntaxHelp( wxHyperlinkEvent& aEvent ) override;
|
||||||
void OnCompile( wxCommandEvent& event ) override;
|
void OnCompile( wxCommandEvent& event ) override;
|
||||||
void OnErrorLinkClicked( wxHtmlLinkEvent& event ) override;
|
void OnErrorLinkClicked( wxHtmlLinkEvent& event ) override;
|
||||||
|
void onCharHook( wxKeyEvent& aEvent );
|
||||||
|
|
||||||
bool TransferDataToWindow() override;
|
bool TransferDataToWindow() override;
|
||||||
bool TransferDataFromWindow() override;
|
bool TransferDataFromWindow() override;
|
||||||
|
|
Loading…
Reference in New Issue