Fixes in DIALOG_IMAGE_EDITOR (minor bug fix, and code update).

Fixes: lp:1783796
https://bugs.launchpad.net/kicad/+bug/1783796
This commit is contained in:
jean-pierre charras 2018-07-27 13:41:54 +02:00
parent 421204ae80
commit 46f5d81d6e
5 changed files with 31 additions and 50 deletions

View File

@ -5,7 +5,7 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 2018 jean-pierre.charras
* Copyright (C) 2011-2018 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -44,13 +44,8 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem
msg.Printf( wxT( "%f" ), m_workingImage->GetScale() );
m_textCtrlScale->SetValue( msg );
GetSizer()->SetSizeHints( this );
Layout();
Fit();
SetMinSize( GetBestSize() );
Centre();
SetFocus();
FinishDialogSettings();
m_sdbSizerOK->SetDefault();
}
@ -159,18 +154,9 @@ bool DIALOG_IMAGE_EDITOR::CheckValues()
}
void DIALOG_IMAGE_EDITOR::OnOK_Button( wxCommandEvent& aEvent )
bool DIALOG_IMAGE_EDITOR::TransferDataFromWindow()
{
if( CheckValues() )
EndModal( wxID_OK );
return;
}
void DIALOG_IMAGE_EDITOR::OnCancel_Button( wxCommandEvent& aEvent )
{
EndModal( wxID_CANCEL );
return CheckValues();
}

View File

@ -5,8 +5,8 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2018 jean-pierre.charras
* Copyright (C) 2018 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -59,9 +59,9 @@ private:
void OnMirrorX_click( wxCommandEvent& event ) override;
void OnMirrorY_click( wxCommandEvent& event ) override;
void OnRotateClick( wxCommandEvent& event ) override;
void OnOK_Button( wxCommandEvent& aEvent ) override;
void OnCancel_Button( wxCommandEvent& aEvent ) override;
void OnRedrawPanel( wxPaintEvent& event ) override;
bool TransferDataFromWindow() override;
bool CheckValues();
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
@ -43,7 +43,6 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizerRight->Add( m_buttonGrey, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonHalfSize = new wxButton( this, wxID_ANY, _("Half Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonHalfSize->SetDefault();
bSizerRight->Add( m_buttonHalfSize, 0, wxALL|wxEXPAND, 5 );
m_buttonUndoLast = new wxButton( this, wxID_ANY, _("Undo Last"), wxDefaultPosition, wxDefaultSize, 0 );
@ -65,14 +64,14 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT, 5 );
bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( bSizerMain );
@ -89,8 +88,6 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
m_buttonGrey->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnGreyScaleConvert ), NULL, this );
m_buttonHalfSize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnHalfSize ), NULL, this );
m_buttonUndoLast->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnUndoLastChange ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnCancel_Button ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnOK_Button ), NULL, this );
}
DIALOG_IMAGE_EDITOR_BASE::~DIALOG_IMAGE_EDITOR_BASE()
@ -103,7 +100,5 @@ DIALOG_IMAGE_EDITOR_BASE::~DIALOG_IMAGE_EDITOR_BASE()
m_buttonGrey->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnGreyScaleConvert ), NULL, this );
m_buttonHalfSize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnHalfSize ), NULL, this );
m_buttonUndoLast->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnUndoLastChange ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnCancel_Button ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnOK_Button ), NULL, this );
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Jun 5 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/panel.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
@ -29,7 +30,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_IMAGE_EDITOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_IMAGE_EDITOR_BASE : public wxDialog
class DIALOG_IMAGE_EDITOR_BASE : public DIALOG_SHIM
{
private:
@ -43,9 +44,9 @@ class DIALOG_IMAGE_EDITOR_BASE : public wxDialog
wxButton* m_buttonUndoLast;
wxStaticText* m_staticTextScale;
wxTextCtrl* m_textCtrlScale;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnRedrawPanel( wxPaintEvent& event ) { event.Skip(); }
@ -55,8 +56,6 @@ class DIALOG_IMAGE_EDITOR_BASE : public wxDialog
virtual void OnGreyScaleConvert( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHalfSize( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUndoLastChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel_Button( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOK_Button( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -14,6 +14,7 @@
<property name="file">dialog_image_editor_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_image_editor</property>
<property name="namespace"></property>
@ -46,7 +47,7 @@
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title">Image Editor</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -573,7 +574,7 @@
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
@ -910,7 +911,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="flag">wxALIGN_RIGHT|wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
@ -922,14 +923,14 @@
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancel_Button</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOK_Button</event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>