← Back to team overview

kicad-developers team mailing list archive

Re: Reproducible on Windows or Linux?

 

Le 14/01/2018 à 12:41, Jeff Young a écrit :
> Correcting the dialog parent didn’t help, so I’m going to let that sleeping dog lie for 5.0.
> 
> The bug is in Cocoa.  wxWidgets calls:
> 
>     SetWindowStyle( parentFlags & ~(wxTAB_TRAVERSAL) )
> 
> 
> to send tabs to the layer popup.  The window style also contains some flags which affect the window
> layer, so wxWidgets does the equivalent of:
> 
>     window.setLayer( window.layer )
> 


Hi Jeff,
Could you tray this patch.
Like Wayne, I am thinking the issue is in Kicad code, not in wxWidgets.


-- 
Jean-Pierre CHARRAS
 .../dialogs/dialog_edit_module_for_BoardEditor.cpp | 12 ++++++++++--
 pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp  | 12 ++++++++++--
 pcbnew/dialogs/dialog_edit_module_text.cpp         | 22 ++++++++++------------
 pcbnew/dialogs/dialog_edit_module_text.h           |  4 ++--
 pcbnew/tools/drawing_tool.cpp                      |  2 +-
 5 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
index e599802..b192d2e 100644
--- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
+++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp
@@ -56,6 +56,8 @@
 #include "3d_cache/3d_cache.h"
 #include "3d_cache/3d_filename_resolver.h"
 
+#include <dialog_edit_module_text.h>
+
 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 );
+
+    DialogEditModuleText 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 );
+
+    DialogEditModuleText 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 23c298e..2626abf 100644
--- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp
+++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp
@@ -58,6 +58,8 @@
 #include "3d_cache/3d_cache.h"
 #include "3d_cache/3d_filename_resolver.h"
 
+#include <dialog_edit_module_text.h>
+
 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 );
+
+    DialogEditModuleText 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 );
+
+    DialogEditModuleText 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 e71a083..3d4b18f 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 );
+    DialogEditModuleText dialog( this, this, TextMod, DC );
     dialog.ShowModal();
     m_canvas->SetIgnoreMouseEvents( false );
 }
 
 
-DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent,
+DialogEditModuleText::DialogEditModuleText( wxWindow* aCaller, PCB_BASE_FRAME* aBoardEditor,
                                             TEXTE_MODULE* aTextMod, wxDC* aDC ) :
-    DialogEditModuleText_base( aParent ),
-    m_OrientValidator( 1, &m_OrientValue )
-
+    DialogEditModuleText_base( aCaller ), m_OrientValidator( 1, &m_OrientValue )
 {
-    m_parent = aParent;
+    m_boardEditor = aBoardEditor;
     m_dc     = aDC;
     m_module = NULL;
     m_currentText = aTextMod;
@@ -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 )
@@ -216,7 +214,7 @@ bool DialogEditModuleText::TransferDataToWindow()
 
 bool DialogEditModuleText::TransferDataFromWindow()
 {
-    BOARD_COMMIT commit( m_parent );
+    BOARD_COMMIT commit( m_boardEditor );
 
     if( !Validate() || !DialogEditModuleText_base::TransferDataFromWindow() )
         return false;
@@ -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" ) );
diff --git a/pcbnew/dialogs/dialog_edit_module_text.h b/pcbnew/dialogs/dialog_edit_module_text.h
index 6cce19a..b268c34 100644
--- a/pcbnew/dialogs/dialog_edit_module_text.h
+++ b/pcbnew/dialogs/dialog_edit_module_text.h
@@ -36,7 +36,7 @@
 class DialogEditModuleText : public DialogEditModuleText_base
 {
 private:
-    PCB_BASE_FRAME* m_parent;
+    PCB_BASE_FRAME* m_boardEditor;
     wxDC* m_dc;
     MODULE* m_module;
     TEXTE_MODULE* m_currentText;
@@ -45,7 +45,7 @@ private:
     double m_OrientValue;
 
 public:
-    DialogEditModuleText( PCB_BASE_FRAME* aParent, TEXTE_MODULE* aTextMod, wxDC* aDC );
+    DialogEditModuleText( wxWindow* aCaller, PCB_BASE_FRAME* aBoardEditor, TEXTE_MODULE* aTextMod, wxDC* aDC );
     ~DialogEditModuleText() {};
 
 protected:
diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp
index 280ab77..7e2b382 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 );
+                    DialogEditModuleText textDialog( m_frame, m_frame, textMod, NULL );
                     bool placing;
 
                     RunMainStack([&]() {

Follow ups

References