diff --git a/common/dialogs/dialog_image_editor.cpp b/common/dialogs/dialog_image_editor.cpp
index 8323104d19..eae18db586 100644
--- a/common/dialogs/dialog_image_editor.cpp
+++ b/common/dialogs/dialog_image_editor.cpp
@@ -1,12 +1,8 @@
-/**
- * @file dialog_image_editor.cpp
- */
-
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2018 jean-pierre.charras
- * Copyright (C) 2011-2018 Kicad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2011-2019 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
@@ -38,9 +34,7 @@
DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem )
: DIALOG_IMAGE_EDITOR_BASE( aParent )
{
- m_workingImage = new BITMAP_BASE( * aItem );
- m_lastImage = NULL;
- m_buttonUndoLast->Enable( false );
+ m_workingImage = new BITMAP_BASE( *aItem );
wxString msg;
msg.Printf( wxT( "%f" ), m_workingImage->GetScale() );
m_textCtrlScale->SetValue( msg );
@@ -50,53 +44,8 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem
}
-void DIALOG_IMAGE_EDITOR::OnUndoLastChange( wxCommandEvent& event )
-{
- BITMAP_BASE * tmp = m_workingImage;
- m_workingImage = m_lastImage;
- delete tmp;
- m_buttonUndoLast->Enable( false );
- m_lastImage = NULL;
- m_panelDraw->Refresh();
-}
-
-
-void DIALOG_IMAGE_EDITOR::OnMirrorX_click( wxCommandEvent& event )
-{
- delete m_lastImage;
- m_lastImage = new BITMAP_BASE( * m_workingImage );
- m_buttonUndoLast->Enable( true );
- m_buttonUndoLast->Enable( true );
- m_workingImage->Mirror( true );
- m_panelDraw->Refresh();
-}
-
-
-void DIALOG_IMAGE_EDITOR::OnMirrorY_click( wxCommandEvent& event )
-{
- delete m_lastImage;
- m_lastImage = new BITMAP_BASE( * m_workingImage );
- m_buttonUndoLast->Enable( true );
- m_workingImage->Mirror( false );
- m_panelDraw->Refresh();
-}
-
-
-void DIALOG_IMAGE_EDITOR::OnRotateClick( wxCommandEvent& event )
-{
- delete m_lastImage;
- m_lastImage = new BITMAP_BASE( * m_workingImage );
- m_buttonUndoLast->Enable( true );
- m_workingImage->Rotate( false );
- m_panelDraw->Refresh();
-}
-
-
void DIALOG_IMAGE_EDITOR::OnGreyScaleConvert( wxCommandEvent& event )
{
- delete m_lastImage;
- m_lastImage = new BITMAP_BASE( * m_workingImage );
- m_buttonUndoLast->Enable( true );
wxImage& image = *m_workingImage->GetImageData();
image = image.ConvertToGreyscale();
m_workingImage->RebuildBitmap();
@@ -104,37 +53,23 @@ void DIALOG_IMAGE_EDITOR::OnGreyScaleConvert( wxCommandEvent& event )
}
-void DIALOG_IMAGE_EDITOR::OnHalfSize( wxCommandEvent& event )
-{
- delete m_lastImage;
- m_lastImage = new BITMAP_BASE( * m_workingImage );
- m_buttonUndoLast->Enable( true );
- wxSize psize = m_workingImage->GetSizePixels();
- wxImage& image = *m_workingImage->GetImageData();
-
- image = image.Scale( psize.x/2, psize.y/2, wxIMAGE_QUALITY_HIGH );
- m_workingImage->RebuildBitmap();
- m_panelDraw->Refresh();
-}
-
-
-/* Test params values correctness
- * Currently scale value must give an actual image
- * > MIN_SIZE pixels (mandatory to be able to see the image)
- * and < MAX_SIZE pixels (if bigger, a confirmation will be asked)
+/*
+ * Test params values correctness
+ * Currently scale value must give an actual image > MIN_SIZE pixels (mandatory to be able to
+ * see the image) and < MAX_SIZE pixels (if bigger, a confirmation will be asked)
* Note: The image definition is 300ppi in drawing routines.
*/
bool DIALOG_IMAGE_EDITOR::CheckValues()
{
- #define MIN_SIZE 32 // Min size in pixels after scaling
- #define MAX_SIZE 6000 // Max size in pixels after scaling
+ #define MIN_SIZE 15 // Min size in pixels after scaling (50 mils)
+ #define MAX_SIZE 6000 // Max size in pixels after scaling (20 inches)
double tmp;
wxString msg = m_textCtrlScale->GetValue();
// Test number correctness
if( !msg.ToDouble( &tmp ) || tmp < 0.0 )
{
- wxMessageBox( _("Incorrect scale number" ) );
+ wxMessageBox( _( "Incorrect scale number" ) );
return false;
}
@@ -144,9 +79,9 @@ bool DIALOG_IMAGE_EDITOR::CheckValues()
if( size_min < MIN_SIZE ) // if the size is too small, the image will be hard to locate
{
- wxMessageBox( wxString::Format(
- _("This scale gives a too small image size (%.2f mm or %.1f mil)" ),
- 25.4 / 300 * size_min, 1000.0/300.0 * size_min ) );
+ wxMessageBox( wxString::Format( _( "This scale results in an image which is too small "
+ "(%.2f mm or %.1f mil)." ),
+ 25.4 / 300 * size_min, 1000.0/300.0 * size_min ) );
return false;
}
@@ -155,9 +90,9 @@ bool DIALOG_IMAGE_EDITOR::CheckValues()
if( size_max > MAX_SIZE )
{
// the actual size is 25.4/300 * size_max in mm
- if( !IsOK( this, wxString::Format(
- _("This scale gives a very large image size (%.1f mm or %.2f in). Are you sure?" ),
- 25.4 / 300 * size_max, size_max /300.0 ) ) )
+ if( !IsOK( this, wxString::Format( _( "This scale results in an image which is very large "
+ "(%.1f mm or %.2f in). Are you sure?" ),
+ 25.4 / 300 * size_max, size_max /300.0 ) ) )
return false;
}
@@ -183,7 +118,7 @@ void DIALOG_IMAGE_EDITOR::OnRedrawPanel( wxPaintEvent& event )
}
-void DIALOG_IMAGE_EDITOR::TransfertToImage( BITMAP_BASE* aItem )
+void DIALOG_IMAGE_EDITOR::TransferToImage( BITMAP_BASE* aItem )
{
wxString msg = m_textCtrlScale->GetValue();
double scale = 1.0;
diff --git a/common/dialogs/dialog_image_editor.h b/common/dialogs/dialog_image_editor.h
index efb5e7449a..0e9c1bd854 100644
--- a/common/dialogs/dialog_image_editor.h
+++ b/common/dialogs/dialog_image_editor.h
@@ -36,8 +36,6 @@ class DIALOG_IMAGE_EDITOR : public DIALOG_IMAGE_EDITOR_BASE
{
private:
BITMAP_BASE* m_workingImage; // The copy of BITMAP_BASE to be edited
- BITMAP_BASE* m_lastImage; // the saved BITMAP_BASE before a new change.
- // Used to undo the last change
public:
DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem );
@@ -46,19 +44,13 @@ public:
public:
/**
- * Function TransfertToImage
+ * Function TransferToImage
* copy edited image to aItem
- * @param aItem = the target
*/
- void TransfertToImage( BITMAP_BASE* aItem );
+ void TransferToImage( BITMAP_BASE* aItem );
private:
- void OnUndoLastChange( wxCommandEvent& event ) override;
void OnGreyScaleConvert( wxCommandEvent& event ) override;
- void OnHalfSize( wxCommandEvent& event ) override;
- void OnMirrorX_click( wxCommandEvent& event ) override;
- void OnMirrorY_click( wxCommandEvent& event ) override;
- void OnRotateClick( wxCommandEvent& event ) override;
void OnRedrawPanel( wxPaintEvent& event ) override;
bool TransferDataFromWindow() override;
diff --git a/common/dialogs/dialog_image_editor_base.cpp b/common/dialogs/dialog_image_editor_base.cpp
index b8fe700b2a..12fda5dd3d 100644
--- a/common/dialogs/dialog_image_editor_base.cpp
+++ b/common/dialogs/dialog_image_editor_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 5 2018)
+// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -30,23 +30,11 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
- m_buttonMirrorX = new wxButton( this, wxID_ANY, _("Mirror X"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizerRight->Add( m_buttonMirrorX, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
-
- m_buttonMirrorY = new wxButton( this, wxID_ANY, _("Mirror Y"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizerRight->Add( m_buttonMirrorY, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
-
- m_buttonRotate = new wxButton( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizerRight->Add( m_buttonRotate, 0, wxEXPAND|wxALL, 5 );
-
m_buttonGrey = new wxButton( this, wxID_ANY, _("Grey"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonGrey, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
- m_buttonHalfSize = new wxButton( this, wxID_ANY, _("Half Size"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizerRight->Add( m_buttonHalfSize, 0, wxALL|wxEXPAND, 5 );
- m_buttonUndoLast = new wxButton( this, wxID_ANY, _("Undo Last"), wxDefaultPosition, wxDefaultSize, 0 );
- bSizerRight->Add( m_buttonUndoLast, 0, wxALL|wxEXPAND, 5 );
+ bSizerRight->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
m_staticTextScale = new wxStaticText( this, wxID_ANY, _("Image Scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextScale->Wrap( -1 );
@@ -56,7 +44,7 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizerRight->Add( m_textCtrlScale, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
- bSizerLeft->Add( bSizerRight, 0, wxEXPAND, 5 );
+ bSizerLeft->Add( bSizerRight, 0, wxEXPAND|wxALL, 5 );
bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
@@ -82,23 +70,13 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
// Connect Events
m_panelDraw->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRedrawPanel ), NULL, this );
- m_buttonMirrorX->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorX_click ), NULL, this );
- m_buttonMirrorY->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorY_click ), NULL, this );
- m_buttonRotate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRotateClick ), NULL, this );
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 );
}
DIALOG_IMAGE_EDITOR_BASE::~DIALOG_IMAGE_EDITOR_BASE()
{
// Disconnect Events
m_panelDraw->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRedrawPanel ), NULL, this );
- m_buttonMirrorX->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorX_click ), NULL, this );
- m_buttonMirrorY->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorY_click ), NULL, this );
- m_buttonRotate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRotateClick ), NULL, this );
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 );
}
diff --git a/common/dialogs/dialog_image_editor_base.h b/common/dialogs/dialog_image_editor_base.h
index abbdc9051d..087e99ff31 100644
--- a/common/dialogs/dialog_image_editor_base.h
+++ b/common/dialogs/dialog_image_editor_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 5 2018)
+// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -36,12 +36,7 @@ class DIALOG_IMAGE_EDITOR_BASE : public DIALOG_SHIM
protected:
wxPanel* m_panelDraw;
- wxButton* m_buttonMirrorX;
- wxButton* m_buttonMirrorY;
- wxButton* m_buttonRotate;
wxButton* m_buttonGrey;
- wxButton* m_buttonHalfSize;
- wxButton* m_buttonUndoLast;
wxStaticText* m_staticTextScale;
wxTextCtrl* m_textCtrlScale;
wxStdDialogButtonSizer* m_sdbSizer;
@@ -50,12 +45,7 @@ class DIALOG_IMAGE_EDITOR_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnRedrawPanel( wxPaintEvent& event ) { event.Skip(); }
- virtual void OnMirrorX_click( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnMirrorY_click( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnRotateClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGreyScaleConvert( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnHalfSize( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnUndoLastChange( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/common/dialogs/dialog_image_editor_fbp.fbp b/common/dialogs/dialog_image_editor_fbp.fbp
index c18e7d766e..6a2eda3005 100644
--- a/common/dialogs/dialog_image_editor_fbp.fbp
+++ b/common/dialogs/dialog_image_editor_fbp.fbp
@@ -14,7 +14,6 @@
dialog_image_editor_base
1000
none
-
1
dialog_image_editor
@@ -194,277 +193,13 @@