2007-06-05 12:10:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_display_options.cpp
|
2008-12-20 13:12:57 +00:00
|
|
|
// Purpose:
|
2007-06-05 12:10:51 +00:00
|
|
|
// Author: jean-pierre Charras
|
2008-12-20 13:12:57 +00:00
|
|
|
// Modified by:
|
2007-06-05 12:10:51 +00:00
|
|
|
// Created: 17/02/2006 17:47:55
|
2008-12-20 13:12:57 +00:00
|
|
|
// RCS-ID:
|
2007-06-05 12:10:51 +00:00
|
|
|
// Copyright: License GNU
|
2008-12-20 13:12:57 +00:00
|
|
|
// Licence:
|
2007-06-05 12:10:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Generated by DialogBlocks (unregistered), 17/02/2006 17:47:55
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
|
|
|
#pragma implementation "dialog_display_options.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
////@begin includes
|
|
|
|
////@end includes
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include "wxstruct.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "cvpcb.h"
|
|
|
|
#include "protos.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "cvstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "dialog_display_options.h"
|
|
|
|
|
|
|
|
////@begin XPM images
|
|
|
|
////@end XPM images
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
void WinEDA_DisplayFrame::InstallOptionsDisplay(wxCommandEvent& event)
|
|
|
|
/*********************************************************************/
|
|
|
|
/* Creation de la fenetre d'options de la fenetre de visu */
|
|
|
|
{
|
2007-10-25 02:01:28 +00:00
|
|
|
WinEDA_FootprintDisplayOptionsFrame * OptionWindow = new WinEDA_FootprintDisplayOptionsFrame(this);
|
2007-10-07 03:08:24 +00:00
|
|
|
OptionWindow->ShowModal();
|
|
|
|
OptionWindow->Destroy();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2007-10-25 02:01:28 +00:00
|
|
|
* WinEDA_FootprintDisplayOptionsFrame type definition
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS( WinEDA_FootprintDisplayOptionsFrame, wxDialog )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/*!
|
2007-10-25 02:01:28 +00:00
|
|
|
* WinEDA_FootprintDisplayOptionsFrame event table definition
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_FootprintDisplayOptionsFrame, wxDialog )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame event table entries
|
|
|
|
EVT_BUTTON( wxID_OK, WinEDA_FootprintDisplayOptionsFrame::OnOkClick )
|
2007-10-24 19:19:47 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_FootprintDisplayOptionsFrame::OnCancelClick )
|
2007-10-24 19:19:47 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
EVT_BUTTON( wxID_APPLY, WinEDA_FootprintDisplayOptionsFrame::OnApplyClick )
|
2007-10-24 19:19:47 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame event table entries
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
/*!
|
2007-10-25 02:01:28 +00:00
|
|
|
* WinEDA_FootprintDisplayOptionsFrame constructors
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame( )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
WinEDA_FootprintDisplayOptionsFrame::WinEDA_FootprintDisplayOptionsFrame( WinEDA_BasePcbFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
m_Parent = parent;
|
|
|
|
|
|
|
|
Create(parent, id, caption, pos, size, style);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-10-25 02:01:28 +00:00
|
|
|
* WinEDA_FootprintDisplayOptionsFrame creator
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
bool WinEDA_FootprintDisplayOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame member initialisation
|
|
|
|
OuterBoxSizer = NULL;
|
|
|
|
MainBoxSizer = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
m_EdgesDisplayOption = NULL;
|
|
|
|
m_TextDisplayOption = NULL;
|
2007-10-25 02:01:28 +00:00
|
|
|
ColumnBoxSizer = NULL;
|
2007-10-07 03:08:24 +00:00
|
|
|
m_IsShowPadFill = NULL;
|
2007-10-24 19:19:47 +00:00
|
|
|
m_IsShowPadNum = NULL;
|
2008-07-21 13:44:01 +00:00
|
|
|
m_CancelButton = NULL;
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame member initialisation
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame creation
|
2007-10-24 19:19:47 +00:00
|
|
|
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
2007-06-05 12:10:51 +00:00
|
|
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
|
|
|
|
|
|
|
CreateControls();
|
2007-10-24 19:19:47 +00:00
|
|
|
if (GetSizer())
|
|
|
|
{
|
|
|
|
GetSizer()->SetSizeHints(this);
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
Centre();
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame creation
|
2007-06-05 12:10:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-10-25 02:01:28 +00:00
|
|
|
* Control creation for WinEDA_FootprintDisplayOptionsFrame
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
void WinEDA_FootprintDisplayOptionsFrame::CreateControls()
|
2008-12-20 13:12:57 +00:00
|
|
|
{
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame content construction
|
2009-04-23 15:02:18 +00:00
|
|
|
// Generated by DialogBlocks, 16/04/2009 14:23:49 (unregistered)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
WinEDA_FootprintDisplayOptionsFrame* itemDialog1 = this;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
OuterBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemDialog1->SetSizer(OuterBoxSizer);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxALL, 5);
|
2007-10-24 19:19:47 +00:00
|
|
|
|
|
|
|
wxArrayString m_EdgesDisplayOptionStrings;
|
|
|
|
m_EdgesDisplayOptionStrings.Add(_("&Line"));
|
|
|
|
m_EdgesDisplayOptionStrings.Add(_("&Filled"));
|
|
|
|
m_EdgesDisplayOptionStrings.Add(_("&Sketch"));
|
|
|
|
m_EdgesDisplayOption = new wxRadioBox( itemDialog1, EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionStrings, 1, wxRA_SPECIFY_COLS );
|
|
|
|
m_EdgesDisplayOption->SetSelection(0);
|
2007-10-27 12:24:09 +00:00
|
|
|
MainBoxSizer->Add(m_EdgesDisplayOption, 0, wxALIGN_TOP|wxALL, 5);
|
2007-10-24 19:19:47 +00:00
|
|
|
|
|
|
|
wxArrayString m_TextDisplayOptionStrings;
|
|
|
|
m_TextDisplayOptionStrings.Add(_("&Line"));
|
|
|
|
m_TextDisplayOptionStrings.Add(_("&Filled"));
|
|
|
|
m_TextDisplayOptionStrings.Add(_("&Sketch"));
|
|
|
|
m_TextDisplayOption = new wxRadioBox( itemDialog1, TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionStrings, 1, wxRA_SPECIFY_COLS );
|
|
|
|
m_TextDisplayOption->SetSelection(0);
|
2007-10-27 12:24:09 +00:00
|
|
|
MainBoxSizer->Add(m_TextDisplayOption, 0, wxALIGN_TOP|wxALL, 5);
|
2007-10-24 19:19:47 +00:00
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
ColumnBoxSizer = new wxBoxSizer(wxVERTICAL);
|
2009-04-23 15:02:18 +00:00
|
|
|
MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2007-10-24 19:19:47 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_IsShowPadFill = new wxCheckBox( itemDialog1, PADFILL_OPT, _("Fill &pad"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
2007-10-24 19:19:47 +00:00
|
|
|
m_IsShowPadFill->SetValue(false);
|
2007-10-25 02:01:28 +00:00
|
|
|
ColumnBoxSizer->Add(m_IsShowPadFill, 1, wxGROW|wxALL, 5);
|
2007-10-24 19:19:47 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Show pad &number"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
2007-10-07 03:08:24 +00:00
|
|
|
m_IsShowPadNum->SetValue(false);
|
2008-07-21 13:44:01 +00:00
|
|
|
if (WinEDA_FootprintDisplayOptionsFrame::ShowToolTips())
|
2007-10-24 19:19:47 +00:00
|
|
|
m_IsShowPadNum->SetToolTip(_("Display pad number"));
|
2007-10-25 02:01:28 +00:00
|
|
|
ColumnBoxSizer->Add(m_IsShowPadNum, 1, wxGROW|wxALL, 5);
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
wxStaticLine* itemStaticLine9 = new wxStaticLine( itemDialog1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
|
|
|
OuterBoxSizer->Add(itemStaticLine9, 0, wxGROW|wxALL, 5);
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
wxStdDialogButtonSizer* itemStdDialogButtonSizer10 = new wxStdDialogButtonSizer;
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
OuterBoxSizer->Add(itemStdDialogButtonSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
|
|
wxButton* itemButton11 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemStdDialogButtonSizer10->AddButton(itemButton11);
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2008-07-21 13:44:01 +00:00
|
|
|
m_CancelButton = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
2009-04-23 15:02:18 +00:00
|
|
|
itemStdDialogButtonSizer10->AddButton(m_CancelButton);
|
2007-10-07 03:08:24 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
wxButton* itemButton13 = new wxButton( itemDialog1, wxID_APPLY, _("&Apply"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemStdDialogButtonSizer10->AddButton(itemButton13);
|
|
|
|
|
|
|
|
itemStdDialogButtonSizer10->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
// Set validators
|
|
|
|
m_EdgesDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModEdge) );
|
|
|
|
m_TextDisplayOption->SetValidator( wxGenericValidator(& DisplayOpt.DisplayModText) );
|
2007-10-07 03:08:24 +00:00
|
|
|
m_IsShowPadFill->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadFill) );
|
2007-10-24 19:19:47 +00:00
|
|
|
m_IsShowPadNum->SetValidator( wxGenericValidator(& DisplayOpt.DisplayPadNum) );
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame content construction
|
2008-07-21 13:44:01 +00:00
|
|
|
|
|
|
|
m_CancelButton->SetFocus(); /* Necessary to use escape key as cancel under wxGRk */
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Should we show tooltips?
|
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
bool WinEDA_FootprintDisplayOptionsFrame::ShowToolTips()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get bitmap resources
|
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
wxBitmap WinEDA_FootprintDisplayOptionsFrame::GetBitmapResource( const wxString& name )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
// Bitmap retrieval
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame bitmap retrieval
|
2007-06-05 12:10:51 +00:00
|
|
|
wxUnusedVar(name);
|
|
|
|
return wxNullBitmap;
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame bitmap retrieval
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get icon resources
|
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
wxIcon WinEDA_FootprintDisplayOptionsFrame::GetIconResource( const wxString& name )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
// Icon retrieval
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame icon retrieval
|
2007-06-05 12:10:51 +00:00
|
|
|
wxUnusedVar(name);
|
|
|
|
return wxNullIcon;
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame icon retrieval
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* Update settings related to edges, text strings, and pads
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings(void)
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
// Update settings
|
2007-10-25 02:01:28 +00:00
|
|
|
////@begin WinEDA_FootprintDisplayOptionsFrame update settings
|
2009-04-23 15:02:18 +00:00
|
|
|
m_Parent->m_DisplayModEdge = m_EdgesDisplayOption->GetSelection();
|
|
|
|
m_Parent->m_DisplayModText = m_TextDisplayOption->GetSelection();
|
|
|
|
m_Parent->m_DisplayPadNum = m_IsShowPadNum->GetValue();
|
|
|
|
m_Parent->m_DisplayPadFill = m_IsShowPadFill->GetValue();
|
2008-12-20 13:12:57 +00:00
|
|
|
m_Parent->DrawPanel->Refresh();
|
2007-10-25 02:01:28 +00:00
|
|
|
////@end WinEDA_FootprintDisplayOptionsFrame update settings
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
void WinEDA_FootprintDisplayOptionsFrame::OnOkClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
UpdateObjectSettings();
|
|
|
|
EndModal( 1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
void WinEDA_FootprintDisplayOptionsFrame::OnCancelClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
EndModal( -1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-10-07 03:08:24 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_APPLY
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
|
|
|
|
2007-10-25 02:01:28 +00:00
|
|
|
void WinEDA_FootprintDisplayOptionsFrame::OnApplyClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-07 03:08:24 +00:00
|
|
|
UpdateObjectSettings();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|