From ad86e50a69c508e3c92a2c19f089ae83c86ee2cd Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Tue, 29 May 2012 23:43:17 +0300 Subject: [PATCH] Derive pcbnew find dialog from DIALOG_SHIM. --- pcbnew/dialogs/dialog_find.cpp | 16 +++------------- pcbnew/dialogs/dialog_find_base.cpp | 5 +++-- pcbnew/dialogs/dialog_find_base.fbp | 6 +++--- pcbnew/dialogs/dialog_find_base.h | 7 +++++-- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp index bfa29d3b42..db30c764c0 100644 --- a/pcbnew/dialogs/dialog_find.cpp +++ b/pcbnew/dialogs/dialog_find.cpp @@ -1,7 +1,8 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 1992-2012 Marco Mattila + * Copyright (C) 2012 Marco Mattila + * Copyright (C) 2006 Jean-Pierre Charras * Copyright (C) 1992-2012 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -51,9 +52,6 @@ private: static wxString prevSearchString; static bool warpMouse; - static wxPoint prevPosition; - static wxSize prevSize; - void onButtonFindItemClick( wxCommandEvent& event ); void onButtonFindMarkerClick( wxCommandEvent& event ); void onButtonCloseClick( wxCommandEvent& event ); @@ -62,8 +60,6 @@ private: // Initialize static member variables -wxPoint DIALOG_FIND::prevPosition( -1, -1 ); -wxSize DIALOG_FIND::prevSize; wxString DIALOG_FIND::prevSearchString; bool DIALOG_FIND::warpMouse = true; @@ -79,11 +75,7 @@ DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent itemCount = markerCount = 0; - if( prevPosition.x != -1 ) - SetSize( prevPosition.x, prevPosition.y, - prevSize.x, prevSize.y ); - else - Center(); + Center(); } @@ -196,8 +188,6 @@ void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent ) void DIALOG_FIND::onClose( wxCloseEvent& aEvent ) { - prevPosition = GetPosition(); - prevSize = GetSize(); warpMouse = !m_NoMouseWarpCheckBox->IsChecked(); EndModal( 1 ); diff --git a/pcbnew/dialogs/dialog_find_base.cpp b/pcbnew/dialogs/dialog_find_base.cpp index 279770c043..ce3209a7ea 100644 --- a/pcbnew/dialogs/dialog_find_base.cpp +++ b/pcbnew/dialogs/dialog_find_base.cpp @@ -9,7 +9,7 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DIALOG_FIND_BASE::DIALOG_FIND_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 ); @@ -41,13 +41,14 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer4->Add( m_button2, 0, wxALL, 5 ); - m_button3 = new wxButton( this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer4->Add( m_button3, 0, wxALL, 5 ); bSizerMain->Add( bSizer4, 0, 0, 5 ); this->SetSizer( bSizerMain ); this->Layout(); + bSizerMain->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_find_base.fbp b/pcbnew/dialogs/dialog_find_base.fbp index 7482db3338..76ebf5b651 100644 --- a/pcbnew/dialogs/dialog_find_base.fbp +++ b/pcbnew/dialogs/dialog_find_base.fbp @@ -69,9 +69,9 @@ Resizable 1 - 350,150 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + DIALOG_SHIM; dialog_shim.h Find 0 @@ -614,7 +614,7 @@ 0 0 - wxID_ANY + wxID_CANCEL Close diff --git a/pcbnew/dialogs/dialog_find_base.h b/pcbnew/dialogs/dialog_find_base.h index 3373ad0945..63ba7a9e6b 100644 --- a/pcbnew/dialogs/dialog_find_base.h +++ b/pcbnew/dialogs/dialog_find_base.h @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; + +#include "dialog_shim.h" #include #include #include @@ -29,7 +32,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_FIND_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_FIND_BASE : public wxDialog +class DIALOG_FIND_BASE : public DIALOG_SHIM { private: @@ -50,7 +53,7 @@ class DIALOG_FIND_BASE : public wxDialog public: - DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,150 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_FIND_BASE(); };