diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index e599802a50..73f69956aa 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -6,9 +6,9 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Mario Luzeiro - * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-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 @@ -56,6 +56,8 @@ #include "3d_cache/3d_cache.h" #include "3d_cache/3d_filename_resolver.h" +#include + size_t DIALOG_MODULE_BOARD_EDITOR::m_page = 0; // remember the last open page during session @@ -770,7 +772,10 @@ void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event ) m_Parent->SetCrossHairPosition( m_ReferenceCopy->GetTextPos() ); m_ReferenceCopy->SetParent( m_CurrentModule ); - m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL ); + + DIALOG_EDIT_FPTEXT dialog( this, m_Parent, m_ReferenceCopy, NULL ); + dialog.ShowModal(); + m_Parent->SetCrossHairPosition( tmp ); m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() ); } @@ -782,7 +787,10 @@ void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event ) m_Parent->SetCrossHairPosition( m_ValueCopy->GetTextPos() ); m_ValueCopy->SetParent( m_CurrentModule ); - m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL ); + + DIALOG_EDIT_FPTEXT dialog( this, m_Parent, m_ValueCopy, NULL ); + dialog.ShowModal(); + m_Parent->SetCrossHairPosition( tmp ); m_ValueCtrl->SetValue( m_ValueCopy->GetText() ); } diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index 23c298e763..7c7388c607 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -7,10 +7,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-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 @@ -58,6 +58,8 @@ #include "3d_cache/3d_cache.h" #include "3d_cache/3d_filename_resolver.h" +#include + size_t DIALOG_MODULE_MODULE_EDITOR::m_page = 0; // remember the last open page during session @@ -546,7 +548,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnEditReference( wxCommandEvent& event ) { wxPoint tmp = m_parent->GetCrossHairPosition(); m_parent->SetCrossHairPosition( m_referenceCopy->GetTextPos() ); - m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL ); + + DIALOG_EDIT_FPTEXT dialog( this, m_parent, m_referenceCopy, NULL ); + dialog.ShowModal(); + m_parent->SetCrossHairPosition( tmp ); m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() ); } @@ -556,7 +561,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnEditValue( wxCommandEvent& event ) { wxPoint tmp = m_parent->GetCrossHairPosition(); m_parent->SetCrossHairPosition( m_valueCopy->GetTextPos() ); - m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL ); + + DIALOG_EDIT_FPTEXT dialog( this, m_parent, m_valueCopy, NULL ); + dialog.ShowModal(); + m_parent->SetCrossHairPosition( tmp ); m_ValueCtrl->SetValue( m_valueCopy->GetText() ); } diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index e71a083904..75ed66d10a 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -58,19 +58,17 @@ extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod void PCB_BASE_FRAME::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC ) { m_canvas->SetIgnoreMouseEvents( true ); - DialogEditModuleText dialog( this, TextMod, DC ); + DIALOG_EDIT_FPTEXT dialog( this, this, TextMod, DC ); dialog.ShowModal(); m_canvas->SetIgnoreMouseEvents( false ); } -DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent, +DIALOG_EDIT_FPTEXT::DIALOG_EDIT_FPTEXT( wxWindow* aCaller, PCB_BASE_FRAME* aBoardEditor, TEXTE_MODULE* aTextMod, wxDC* aDC ) : - DialogEditModuleText_base( aParent ), - m_OrientValidator( 1, &m_OrientValue ) - + DIALOG_EDIT_FPTEXT_BASE( aCaller ), m_OrientValidator( 1, &m_OrientValue ) { - m_parent = aParent; + m_boardEditor = aBoardEditor; m_dc = aDC; m_module = NULL; m_currentText = aTextMod; @@ -89,7 +87,7 @@ DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent, } -bool DialogEditModuleText::TransferDataToWindow() +bool DIALOG_EDIT_FPTEXT::TransferDataToWindow() { if( !wxDialog::TransferDataToWindow() ) return false; @@ -191,14 +189,14 @@ bool DialogEditModuleText::TransferDataToWindow() m_unlock->SetValue( m_currentText->IsUnlocked() ); // Configure the layers list selector - if( !m_parent->GetBoard()->IsLayerEnabled( m_currentText->GetLayer() ) ) + if( !m_boardEditor->GetBoard()->IsLayerEnabled( m_currentText->GetLayer() ) ) // Footprints are built outside the current board, so items cann be // on a not activated layer, therefore show it if happens. m_LayerSelectionCtrl->ShowNonActivatedLayers( true ); m_LayerSelectionCtrl->SetLayersHotkeys( false ); m_LayerSelectionCtrl->SetLayerSet( forbiddenLayers ); - m_LayerSelectionCtrl->SetBoardFrame( m_parent ); + m_LayerSelectionCtrl->SetBoardFrame( m_boardEditor ); m_LayerSelectionCtrl->Resync(); if( m_LayerSelectionCtrl->SetLayerSelection( m_currentText->GetLayer() ) < 0 ) @@ -214,11 +212,11 @@ bool DialogEditModuleText::TransferDataToWindow() } -bool DialogEditModuleText::TransferDataFromWindow() +bool DIALOG_EDIT_FPTEXT::TransferDataFromWindow() { - BOARD_COMMIT commit( m_parent ); + BOARD_COMMIT commit( m_boardEditor ); - if( !Validate() || !DialogEditModuleText_base::TransferDataFromWindow() ) + if( !Validate() || !DIALOG_EDIT_FPTEXT_BASE::TransferDataFromWindow() ) return false; if( m_module ) @@ -227,7 +225,7 @@ bool DialogEditModuleText::TransferDataFromWindow() #ifndef USE_WX_OVERLAY if( m_dc ) //Erase old text on screen { - m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR, + m_currentText->Draw( m_boardEditor->GetCanvas(), m_dc, GR_XOR, (m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) ); } #endif @@ -340,11 +338,11 @@ bool DialogEditModuleText::TransferDataFromWindow() #ifndef USE_WX_OVERLAY if( m_dc ) // Display new text { - m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR, + m_currentText->Draw( m_boardEditor->GetCanvas(), m_dc, GR_XOR, (m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) ); } #else - m_parent->Refresh(); + m_boardEditor->Refresh(); #endif commit.Push( _( "Modify module text" ) ); @@ -356,7 +354,7 @@ bool DialogEditModuleText::TransferDataFromWindow() } -void DialogEditModuleText::ModuleOrientEvent( wxCommandEvent& event ) +void DIALOG_EDIT_FPTEXT::ModuleOrientEvent( wxCommandEvent& event ) { bool custom_orientation = false; diff --git a/pcbnew/dialogs/dialog_edit_module_text.h b/pcbnew/dialogs/dialog_edit_module_text.h index 6cce19aa94..2fef69c036 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.h +++ b/pcbnew/dialogs/dialog_edit_module_text.h @@ -1,10 +1,10 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2013 Jean-Pierre Charras + * Copyright (C) 2018 Jean-Pierre Charras * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2008-2013 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-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 @@ -27,16 +27,16 @@ #ifndef DIALOG_EDIT_MODULE_TEXT_H #define DIALOG_EDIT_MODULE_TEXT_H -#include +#include #include /*************** **************/ -/* class DialogEditModuleText */ +/* class DIALOG_EDIT_FPTEXT */ /*************** **************/ -class DialogEditModuleText : public DialogEditModuleText_base +class DIALOG_EDIT_FPTEXT : public DIALOG_EDIT_FPTEXT_BASE { private: - PCB_BASE_FRAME* m_parent; + PCB_BASE_FRAME* m_boardEditor; wxDC* m_dc; MODULE* m_module; TEXTE_MODULE* m_currentText; @@ -45,8 +45,9 @@ private: double m_OrientValue; public: - DialogEditModuleText( PCB_BASE_FRAME* aParent, TEXTE_MODULE* aTextMod, wxDC* aDC ); - ~DialogEditModuleText() {}; + DIALOG_EDIT_FPTEXT( wxWindow* aCaller, PCB_BASE_FRAME* aBoardEditor, + TEXTE_MODULE* aTextMod, wxDC* aDC ); + ~DIALOG_EDIT_FPTEXT() {}; protected: bool TransferDataToWindow() override; diff --git a/pcbnew/dialogs/dialog_edit_module_text_base.cpp b/pcbnew/dialogs/dialog_edit_module_text_base.cpp index cb608d15c4..cb38be14cb 100644 --- a/pcbnew/dialogs/dialog_edit_module_text_base.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text_base.cpp @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Aug 4 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO *NOT* EDIT THIS FILE! +// PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #include "class_pcb_layer_box_selector.h" @@ -12,7 +12,7 @@ /////////////////////////////////////////////////////////////////////////// -DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +DIALOG_EDIT_FPTEXT_BASE::DIALOG_EDIT_FPTEXT_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 ); @@ -161,16 +161,16 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow bMainSizer->Fit( this ); // Connect Events - this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogEditModuleText_base::OnInitDlg ) ); - m_Orient->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DialogEditModuleText_base::ModuleOrientEvent ), NULL, this ); - m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this ); + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_FPTEXT_BASE::OnInitDlg ) ); + m_Orient->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EDIT_FPTEXT_BASE::ModuleOrientEvent ), NULL, this ); + m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_FPTEXT_BASE::OnOkClick ), NULL, this ); } -DialogEditModuleText_base::~DialogEditModuleText_base() +DIALOG_EDIT_FPTEXT_BASE::~DIALOG_EDIT_FPTEXT_BASE() { // Disconnect Events - this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DialogEditModuleText_base::OnInitDlg ) ); - m_Orient->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DialogEditModuleText_base::ModuleOrientEvent ), NULL, this ); - m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogEditModuleText_base::OnOkClick ), NULL, this ); + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_FPTEXT_BASE::OnInitDlg ) ); + m_Orient->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_EDIT_FPTEXT_BASE::ModuleOrientEvent ), NULL, this ); + m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_FPTEXT_BASE::OnOkClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_edit_module_text_base.fbp b/pcbnew/dialogs/dialog_edit_module_text_base.fbp index a20ddf14fe..77bddae6b5 100644 --- a/pcbnew/dialogs/dialog_edit_module_text_base.fbp +++ b/pcbnew/dialogs/dialog_edit_module_text_base.fbp @@ -42,7 +42,7 @@ wxID_ANY - DialogEditModuleText_base + DIALOG_EDIT_FPTEXT_BASE -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER diff --git a/pcbnew/dialogs/dialog_edit_module_text_base.h b/pcbnew/dialogs/dialog_edit_module_text_base.h index c1d5a47095..546f3299c8 100644 --- a/pcbnew/dialogs/dialog_edit_module_text_base.h +++ b/pcbnew/dialogs/dialog_edit_module_text_base.h @@ -1,8 +1,8 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Aug 4 2017) // http://www.wxformbuilder.org/ // -// PLEASE DO *NOT* EDIT THIS FILE! +// PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// #ifndef __DIALOG_EDIT_MODULE_TEXT_BASE_H__ @@ -11,6 +11,7 @@ #include #include #include +class DIALOG_SHIM; class PCB_LAYER_BOX_SELECTOR; class TEXT_CTRL_EVAL; @@ -33,9 +34,9 @@ class TEXT_CTRL_EVAL; /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Class DialogEditModuleText_base +/// Class DIALOG_EDIT_FPTEXT_BASE /////////////////////////////////////////////////////////////////////////////// -class DialogEditModuleText_base : public DIALOG_SHIM +class DIALOG_EDIT_FPTEXT_BASE : public DIALOG_SHIM { private: @@ -75,8 +76,8 @@ class DialogEditModuleText_base : public DIALOG_SHIM public: - DialogEditModuleText_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DialogEditModuleText_base(); + DIALOG_EDIT_FPTEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_EDIT_FPTEXT_BASE(); }; diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 280ab77055..02beb40c36 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -389,7 +389,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) textMod->SetThickness( dsnSettings.m_ModuleTextWidth ); textMod->SetTextPos( wxPoint( cursorPos.x, cursorPos.y ) ); - DialogEditModuleText textDialog( m_frame, textMod, NULL ); + DIALOG_EDIT_FPTEXT textDialog( m_frame, m_frame, textMod, NULL ); bool placing; RunMainStack([&]() {