Try to fix Bug #1502012 (Can not close print preview window with the "X" icon) Linux spécific.

This commit is contained in:
Stefan (stol) 2015-10-08 13:59:00 +02:00 committed by jean-pierre charras
parent b4fd9f3ed5
commit 9537884f7e
3 changed files with 37 additions and 5 deletions

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.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
@ -265,7 +265,17 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
frame->SetSize( (parent->GetSize() * 2) / 3 );
frame->Center();
frame->Initialize();
// On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
// close the frame using the X box in caption, when the preview frame is run
// from a dialog
frame->SetExtraStyle(frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
// We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
// modal for its caller only.
// An other reason is the fact when closing the frame without this option,
// all top level frames are reenabled.
// With this option, only the parent is reenabled.
// Reenabling all top level frames should be made by the parent dialog.
frame->InitializeWithModality( wxPreviewFrame_WindowModal );
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );

View File

@ -190,7 +190,18 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize();
// On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
// close the frame using the X box in caption, when the preview frame is run
// from a dialog
frame->SetExtraStyle(frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
// We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
// modal for its caller only.
// An other reason is the fact when closing the frame without this option,
// all top level frames are reenabled.
// With this option, only the parent is reenabled.
// Reenabling all top level frames should be made by the parent dialog.
frame->InitializeWithModality( wxPreviewFrame_WindowModal );
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );

View File

@ -465,7 +465,18 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Center();
frame->Initialize();
// On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
// close the frame using the X box in caption, when the preview frame is run
// from a dialog
frame->SetExtraStyle(frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
// We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
// modal for its caller only.
// An other reason is the fact when closing the frame without this option,
// all top level frames are reenabled.
// With this option, only the parent is reenabled.
// Reenabling all top level frames should be made by the parent dialog.
frame->InitializeWithModality( wxPreviewFrame_WindowModal );
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );