KiCad PCB EDA Suite
DIALOG_MODULE_BOARD_EDITOR Class Reference

#include <dialog_edit_module_for_BoardEditor.h>

Inheritance diagram for DIALOG_MODULE_BOARD_EDITOR:
DIALOG_MODULE_BOARD_EDITOR_BASE DIALOG_SHIM KIWAY_HOLDER

Public Types

enum  FP_PRM_EDITOR_RETVALUE { PRM_EDITOR_ABORT, PRM_EDITOR_WANT_EXCHANGE_FP, PRM_EDITOR_EDIT_OK, PRM_EDITOR_WANT_MODEDIT }
 

Public Member Functions

 DIALOG_MODULE_BOARD_EDITOR (PCB_EDIT_FRAME *aParent, MODULE *aModule, wxDC *aDC)
 
 ~DIALOG_MODULE_BOARD_EDITOR ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void FixOSXCancelButtonIssue ()
 A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms. More...
 

Protected Attributes

wxNotebook * m_NoteBook
 
wxPanel * m_PanelProperties
 
wxStaticText * m_staticTextRef
 
wxTextCtrl * m_ReferenceCtrl
 
wxButton * m_button4
 
wxStaticText * m_staticTextVal
 
wxTextCtrl * m_ValueCtrl
 
wxButton * m_button5
 
wxRadioBox * m_LayerCtrl
 
wxRadioBox * m_OrientCtrl
 
wxStaticText * m_staticTextRotation
 
TEXT_CTRL_EVALm_OrientValueCtrl
 
wxStaticText * m_staticTextPos
 
wxStaticText * m_XPosLabel
 
TEXT_CTRL_EVALm_ModPositionX
 
wxStaticText * m_XPosUnit
 
wxStaticText * m_YPosLabel
 
TEXT_CTRL_EVALm_ModPositionY
 
wxStaticText * m_YPosUnit
 
wxStaticText * m_TextSheetPath
 
wxTextCtrl * m_textCtrlSheetPath
 
wxButton * m_buttonExchange
 
wxButton * m_buttonModuleEditor
 
wxRadioBox * m_AttributsCtrl
 
wxRadioBox * m_AutoPlaceCtrl
 
wxStaticText * m_staticText11
 
wxSlider * m_CostRot90Ctrl
 
wxStaticText * m_staticText12
 
wxSlider * m_CostRot180Ctrl
 
wxStaticText * m_staticText16
 
wxChoice * m_ZoneConnectionChoice
 
wxStaticText * m_staticTextInfo
 
wxStaticText * m_staticTextNetClearance
 
TEXT_CTRL_EVALm_NetClearanceValueCtrl
 
wxStaticText * m_NetClearanceUnits
 
wxStaticLine * m_staticline1
 
wxStaticLine * m_staticline2
 
wxStaticLine * m_staticline3
 
wxStaticText * m_MaskClearanceTitle
 
TEXT_CTRL_EVALm_SolderMaskMarginCtrl
 
wxStaticText * m_SolderMaskMarginUnits
 
wxStaticText * m_staticTextSolderPaste
 
TEXT_CTRL_EVALm_SolderPasteMarginCtrl
 
wxStaticText * m_SolderPasteMarginUnits
 
wxStaticText * m_staticTextRatio
 
TEXT_CTRL_EVALm_SolderPasteMarginRatioCtrl
 
wxStaticText * m_SolderPasteRatioMarginUnits
 
wxPanel * m_Panel3D
 
wxBoxSizer * bSizerMain3D
 
wxListBox * m_3D_ShapeNameListBox
 
wxButton * m_buttonAdd
 
wxButton * m_buttonRemove
 
wxButton * m_buttonEdit
 
wxButton * m_button8
 
wxBoxSizer * bLowerSizer3D
 
wxStdDialogButtonSizer * m_sdbSizerStdButtons
 
wxButton * m_sdbSizerStdButtonsOK
 
wxButton * m_sdbSizerStdButtonsCancel
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void BrowseAndAdd3DShapeFile ()
 
void InitBoardProperties ()
 
void InitModeditProperties ()
 
void Edit3DShapeFileName ()
 
void OnEditValue (wxCommandEvent &event) override
 
void OnEditReference (wxCommandEvent &event) override
 
void On3DShapeSelection (wxCommandEvent &event)
 
void On3DShapeNameSelected (wxCommandEvent &event) override
 
void Edit3DShapeFilename (wxCommandEvent &event) override
 
void Remove3DShape (wxCommandEvent &event) override
 
void Add3DShape (wxCommandEvent &event) override
 
void GotoModuleEditor (wxCommandEvent &event) override
 
void ExchangeModule (wxCommandEvent &event) override
 
void ModuleOrientEvent (wxCommandEvent &event) override
 
void Cfg3DPath (wxCommandEvent &event) override
 
void OnInitDlg (wxInitDialogEvent &event) override
 
bool TransferDataToWindow () override
 
bool TransferDataFromWindow () override
 

Private Attributes

PCB_EDIT_FRAMEm_Parent
 
wxDC * m_DC
 
MODULEm_CurrentModule
 
TEXTE_MODULEm_ReferenceCopy
 
TEXTE_MODULEm_ValueCopy
 
std::vector< MODULE_3D_SETTINGSm_shapes3D_list
 
int m_LastSelected3DShapeIndex
 
PANEL_PREV_3Dm_PreviewPane
 
MODULEm_currentModuleCopy
 
wxFloatingPointValidator< double > m_OrientValidator
 
double m_OrientValue
 

Static Private Attributes

static size_t m_page = 0
 Module editor: Dialog for editing module properties in the pcb editor. More...
 

Detailed Description

Definition at line 35 of file dialog_edit_module_for_BoardEditor.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR ( PCB_EDIT_FRAME aParent,
MODULE aModule,
wxDC *  aDC 
)

Definition at line 62 of file dialog_edit_module_for_BoardEditor.cpp.

References DIALOG_MODULE_BOARD_EDITOR_BASE::bLowerSizer3D, PCB_GENERAL_SETTINGS::Colors(), KiBitmap(), m_CurrentModule, m_currentModuleCopy, m_DC, m_LastSelected3DShapeIndex, DIALOG_MODULE_BOARD_EDITOR_BASE::m_NoteBook, m_OrientValidator, m_OrientValue, DIALOG_MODULE_BOARD_EDITOR_BASE::m_OrientValueCtrl, m_page, DIALOG_MODULE_BOARD_EDITOR_BASE::m_Panel3D, m_Parent, m_PreviewPane, m_ReferenceCopy, DIALOG_MODULE_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsOK, m_shapes3D_list, m_ValueCopy, Pgm(), KIWAY_HOLDER::Prj(), and PCB_BASE_FRAME::Settings().

64  :
67 {
68  wxASSERT( aParent != NULL );
69  wxASSERT( aModule != NULL );
70 
71  m_Parent = aParent;
72  m_DC = aDC;
73  m_CurrentModule = aModule;
74 
75  m_currentModuleCopy = new MODULE( *aModule );
76 
77  // Give an icon
78  wxIcon icon;
79  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
80  SetIcon( icon );
81 
82  m_OrientValidator.SetRange( -360.0, 360.0 );
83  m_OrientValueCtrl->SetValidator( m_OrientValidator );
85 
86  aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
87 
89  aParent->Prj().Get3DCacheManager(),
91  &aParent->Settings().Colors(),
92  &m_shapes3D_list );
93 
94  bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );
95 
96  m_NoteBook->SetSelection( m_page );
97  m_sdbSizerStdButtonsOK->SetDefault();
98 
99  m_ReferenceCopy = NULL;
100  m_ValueCopy = NULL;
102  m_OrientValue = 0;
103 
104  // Layout() gets called correctly in TransferDataToWindow().
105 }
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
wxFloatingPointValidator< double > m_OrientValidator
static size_t m_page
Module editor: Dialog for editing module properties in the pcb editor.
DIALOG_MODULE_BOARD_EDITOR_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Footprint Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
PCB_GENERAL_SETTINGS & Settings()
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
COLORS_DESIGN_SETTINGS & Colors()
DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR ( )

Definition at line 109 of file dialog_edit_module_for_BoardEditor.cpp.

References DIALOG_MODULE_BOARD_EDITOR_BASE::m_NoteBook, m_page, m_PreviewPane, m_ReferenceCopy, m_shapes3D_list, m_ValueCopy, and KIWAY_HOLDER::Prj().

110 {
111  m_shapes3D_list.clear();
112 
113  // free the memory used by all models, otherwise models which were
114  // browsed but not used would consume memory
115  Prj().Get3DCacheManager()->FlushCache( false );
116 
117  // the GL canvas has to be visible before it is destroyed
118  m_page = m_NoteBook->GetSelection();
119  m_NoteBook->SetSelection( 1 );
120 
121  delete m_ReferenceCopy;
122  m_ReferenceCopy = NULL;
123 
124  delete m_ValueCopy;
125  m_ValueCopy = NULL;
126 
127  delete m_PreviewPane;
128  m_PreviewPane = NULL; // just in case, to avoid double-free
129 
130  // this is already deleted by the board used on preview pane so
131  // no need to delete here
132  // delete m_currentModuleCopy;
133  // m_currentModuleCopy = NULL;
134 }
static size_t m_page
Module editor: Dialog for editing module properties in the pcb editor.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list

Member Function Documentation

void DIALOG_MODULE_BOARD_EDITOR::Add3DShape ( wxCommandEvent &  event)
inlineoverrideprivatevirtual
void DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile ( )
private

Definition at line 526 of file dialog_edit_module_for_BoardEditor.cpp.

References Format(), PROJECT::GetRString(), DIALOG_MODULE_BOARD_EDITOR_BASE::m_3D_ShapeNameListBox, MODULE_3D_SETTINGS::m_Filename, m_LastSelected3DShapeIndex, m_PreviewPane, m_shapes3D_list, KIWAY_HOLDER::Prj(), S3D::Select3DModel(), PANEL_PREV_3D::SetModelDataIdx(), PROJECT::SetRString(), S3D_FILENAME_RESOLVER::SplitAlias(), PROJECT::VIEWER_3D_FILTER_INDEX, and PROJECT::VIEWER_3D_PATH.

Referenced by Add3DShape().

527 {
528  PROJECT& prj = Prj();
529  MODULE_3D_SETTINGS model;
530 
531  wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
532  wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
533  int filter = 0;
534 
535  if( !sidx.empty() )
536  {
537  long tmp;
538  sidx.ToLong( &tmp );
539 
540  if( tmp > 0 && tmp <= INT_MAX )
541  filter = (int) tmp;
542  }
543 
544  if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(),
545  initialpath, filter, &model ) || model.m_Filename.empty() )
546  {
547  return;
548  }
549 
550  prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
551  sidx = wxString::Format( wxT( "%i" ), filter );
553  S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
554  wxString alias;
555  wxString shortPath;
556  wxString filename = model.m_Filename;
557 
558  if( res && res->SplitAlias( filename, alias, shortPath ) )
559  {
560  alias.Append( wxT( ":" ) );
561  alias.Append( shortPath );
562  m_3D_ShapeNameListBox->Append( alias );
563  }
564  else
565  {
566  m_3D_ShapeNameListBox->Append( filename );
567  }
568 
569 #ifdef __WINDOWS__
570  // In Kicad files, filenames and paths are stored using Unix notation
571  model.m_Filename.Replace( "\\", "/" );
572 #endif
573 
574  m_shapes3D_list.push_back( model );
577 
578  if( m_PreviewPane )
580 
581  return;
582 }
Class PROJECT holds project specific data.
Definition: project.h:56
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath)
Function SplitAlias returns true if the given name contains an alias and populates the string anAlias...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
wxString m_Filename
The 3D shape filename in 3D library.
Definition: class_module.h:101
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:173
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:188
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool Select3DModel(wxWindow *aParent, S3D_CACHE *aCache, wxString &prevModelSelectDir, int &prevModelWildcard, MODULE_3D_SETTINGS *aModel)
void DIALOG_MODULE_BOARD_EDITOR::Cfg3DPath ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 783 of file dialog_edit_module_for_BoardEditor.cpp.

References S3D::Configure3DPaths(), m_LastSelected3DShapeIndex, m_PreviewPane, KIWAY_HOLDER::Prj(), and PANEL_PREV_3D::SetModelDataIdx().

784 {
785  if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
786  if( m_LastSelected3DShapeIndex >= 0 )
787  if( m_PreviewPane )
789 }
bool Configure3DPaths(wxWindow *aParent, S3D_FILENAME_RESOLVER *aResolver)
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
void DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName ( )
private

Definition at line 474 of file dialog_edit_module_for_BoardEditor.cpp.

References DIALOG_MODULE_BOARD_EDITOR_BASE::m_3D_ShapeNameListBox, m_PreviewPane, m_shapes3D_list, KIWAY_HOLDER::Prj(), PANEL_PREV_3D::UpdateModelName(), and S3D_FILENAME_RESOLVER::ValidateFileName().

Referenced by Edit3DShapeFilename().

475 {
476  int idx = m_3D_ShapeNameListBox->GetSelection();
477 
478  if( idx < 0 )
479  return;
480 
481  // Edit filename
482  wxString filename = m_3D_ShapeNameListBox->GetStringSelection();
483  wxTextEntryDialog dlg( this, wxEmptyString, wxEmptyString, filename );
484 
485  bool hasAlias;
486  S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
487 
488  if( dlg.ShowModal() != wxID_OK )
489  return;
490 
491  filename = dlg.GetValue();
492 
493  if( filename.empty() )
494  return;
495 
496  if( !res->ValidateFileName( filename, hasAlias ) )
497  {
498  wxString msg = _( "Invalid filename: " );
499  msg.append( filename );
500  wxMessageBox( msg, _( "Edit 3D file name" ) );
501 
502  return;
503  }
504 
505  m_3D_ShapeNameListBox->SetString( idx, filename );
506 
507  // if the user has specified an alias in the name then prepend ':'
508  if( hasAlias )
509  filename.insert( 0, wxT( ":" ) );
510 
511  #ifdef __WINDOWS__
512  // In Kicad files, filenames and paths are stored using Unix notation
513  filename.Replace( wxT( "\\" ), wxT( "/" ) );
514  #endif
515 
516  m_shapes3D_list[idx].m_Filename = filename;
517 
518  // This assumes that the index didn't change and will just update the filename
519  if( m_PreviewPane )
520  m_PreviewPane->UpdateModelName( filename );
521 
522  return;
523 }
bool ValidateFileName(const wxString &aFileName, bool &hasAlias)
Function ValidateName returns true if the given path is a valid aliased relative path.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void UpdateModelName(wxString const &aModel)
void DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFilename ( wxCommandEvent &  event)
inlineoverrideprivatevirtual
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 184 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues().

185 {
186  // so we can do logging of this state change:
187 
188 #if defined(DEBUG)
189  const char* type_id = typeid( *this ).name();
190  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
191 #endif
192 
193  return wxDialog::Enable( enable );
194 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 542 of file dialog_shim.cpp.

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_MODULE::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

543 {
544  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
545  // handle validation in the same way as other dialogs.
546  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
547  return;
548 
549  SetReturnCode( retCode );
550 
551  if( !IsQuasiModal() )
552  {
553  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
554  return;
555  }
556 
557  m_qmodal_showing = false;
558 
559  if( m_qmodal_loop )
560  {
561  if( m_qmodal_loop->IsRunning() )
562  m_qmodal_loop->Exit( 0 );
563  else
564  m_qmodal_loop->ScheduleExit( 0 );
565 
566  m_qmodal_loop = NULL;
567  }
568 
571 
572  Show( false );
573 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool IsQuasiModal()
Definition: dialog_shim.h:93
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
void DIALOG_MODULE_BOARD_EDITOR::ExchangeModule ( wxCommandEvent &  event)
overrideprivatevirtual
void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 104 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DialogEditModuleText::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_MODULE_MODULE_EDITOR::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), and DIALOG_SIGNAL_LIST::TransferDataToWindow().

105 {
106  // must be called from the constructor of derived classes,
107  // when all widgets are initialized, and therefore their size fixed
108 
109  // SetSizeHints fixes the minimal size of sizers in the dialog
110  // (SetSizeHints calls Fit(), so no need to call it)
111  GetSizer()->SetSizeHints( this );
112 
113  // the default position, when calling the first time the dlg
114  Center();
115 }
void DIALOG_SHIM::FixOSXCancelButtonIssue ( )
protectedinherited

A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.

Definition at line 117 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::Show().

118 {
119 #ifdef __WXMAC__
120  // A ugly hack to fix an issue on OSX: ctrl+c closes the dialog instead of
121  // copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer
122  // created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority
123  // to copy text standard accelerator, and the dlg is closed when trying to copy text
124  wxButton* button = dynamic_cast< wxButton* > ( wxWindow::FindWindowById( wxID_CANCEL, this ) );
125 
126  if( button )
127  button->SetLabel( _( "Cancel" ) );
128 #endif
129 }
void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 231 of file dialog_edit_module_for_BoardEditor.cpp.

References GetNewTimeStamp(), EDA_ITEM::GetTimeStamp(), m_CurrentModule, m_Parent, PCB_EDIT_FRAME::OnModify(), PRM_EDITOR_WANT_MODEDIT, and EDA_ITEM::SetTimeStamp().

232 {
233  if( m_CurrentModule->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
234  {
236  m_Parent->OnModify();
237  }
238 
239  EndModal( PRM_EDITOR_WANT_MODEDIT );
240 }
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:994
timestamp_t GetNewTimeStamp()
Definition: common.cpp:166
timestamp_t GetTimeStamp() const
Definition: base_struct.h:231
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:230
void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties ( )
private

Definition at line 138 of file dialog_edit_module_for_BoardEditor.cpp.

References B_Cu, g_UserUnit, GetAbbreviatedUnitsLabel(), BOARD_ITEM::GetLayer(), MODULE::GetLocalClearance(), MODULE::GetLocalSolderMaskMargin(), MODULE::GetLocalSolderPasteMargin(), MODULE::GetLocalSolderPasteMarginRatio(), MODULE::GetOrientation(), MODULE::GetPosition(), MODULE::GetZoneConnection(), m_CurrentModule, DIALOG_MODULE_BOARD_EDITOR_BASE::m_LayerCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ModPositionX, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ModPositionY, DIALOG_MODULE_BOARD_EDITOR_BASE::m_NetClearanceUnits, DIALOG_MODULE_BOARD_EDITOR_BASE::m_NetClearanceValueCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_OrientCtrl, m_OrientValidator, m_OrientValue, DIALOG_MODULE_BOARD_EDITOR_BASE::m_OrientValueCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderMaskMarginCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderMaskMarginUnits, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginRatioCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginUnits, DIALOG_MODULE_BOARD_EDITOR_BASE::m_XPosUnit, DIALOG_MODULE_BOARD_EDITOR_BASE::m_YPosUnit, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ZoneConnectionChoice, PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, PutValueInLocalUnits(), wxPoint::x, and wxPoint::y.

Referenced by TransferDataToWindow().

139 {
142 
145 
146  m_LayerCtrl->SetSelection(
147  (m_CurrentModule->GetLayer() == B_Cu) ? 1 : 0 );
148 
149  bool custom_orientation = false;
150  switch( int( m_CurrentModule->GetOrientation() ) )
151  {
152  case 0:
153  m_OrientCtrl->SetSelection( 0 );
154  break;
155 
156  case 900:
157  case -2700:
158  m_OrientCtrl->SetSelection( 1 );
159  break;
160 
161  case -900:
162  case 2700:
163  m_OrientCtrl->SetSelection( 2 );
164  break;
165 
166  case -1800:
167  case 1800:
168  m_OrientCtrl->SetSelection( 3 );
169  break;
170 
171  default:
172  m_OrientCtrl->SetSelection( 4 );
173  custom_orientation = true;
174  break;
175  }
176 
177  m_OrientValueCtrl->Enable( custom_orientation );
179  m_OrientValidator.TransferToWindow();
180 
181  // Initialize dialog relative to masks clearances
185 
188 
189  // These 2 parameters are usually < 0, so prepare entering a negative
190  // value, if current is 0
192 
194  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
195  m_SolderPasteMarginCtrl->GetValue() );
196 
197  // Add solder paste margin ration in per cent
198  // for the usual default value 0.0, display -0.0 (or -0,0 in some countries)
199  wxString msg;
200  msg.Printf( wxT( "%f" ),
202 
204  msg[0] == '0') // Sometimes Printf adds a sign if the value is very small (0.0)
205  m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
206  else
207  m_SolderPasteMarginRatioCtrl->SetValue( msg );
208 
210  {
211  default:
213  m_ZoneConnectionChoice->SetSelection( 0 );
214  break;
215 
216  case PAD_ZONE_CONN_FULL:
217  m_ZoneConnectionChoice->SetSelection( 1 );
218  break;
219 
221  m_ZoneConnectionChoice->SetSelection( 2 );
222  break;
223 
224  case PAD_ZONE_CONN_NONE:
225  m_ZoneConnectionChoice->SetSelection( 3 );
226  break;
227  }
228 }
int GetLocalClearance() const
Definition: class_module.h:199
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
const wxPoint & GetPosition() const override
Definition: class_module.h:175
wxFloatingPointValidator< double > m_OrientValidator
ZoneConnection GetZoneConnection() const
Definition: class_module.h:209
double GetLocalSolderPasteMarginRatio() const
Definition: class_module.h:205
Pads are not covered.
Definition: zones.h:57
double GetOrientation() const
Definition: class_module.h:180
wxString GetAbbreviatedUnitsLabel(EDA_UNITS_T aUnit)
Definition: base_units.cpp:484
int GetLocalSolderMaskMargin() const
Definition: class_module.h:196
int GetLocalSolderPasteMargin() const
Definition: class_module.h:202
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:266
Use thermal relief for pads.
Definition: zones.h:58
pads are covered by copper
Definition: zones.h:59
void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties ( )
private

Definition at line 281 of file dialog_edit_module_for_BoardEditor.cpp.

References MODULE::GetAttributes(), MODULE::GetPath(), MODULE::GetPlacementCost180(), MODULE::GetPlacementCost90(), EDA_TEXT::GetText(), MODULE::IsLocked(), KISYS3DMOD, DIALOG_MODULE_BOARD_EDITOR_BASE::m_3D_ShapeNameListBox, DIALOG_MODULE_BOARD_EDITOR_BASE::m_AttributsCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_AutoPlaceCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_CostRot180Ctrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_CostRot90Ctrl, m_CurrentModule, m_LastSelected3DShapeIndex, DIALOG_MODULE_BOARD_EDITOR_BASE::m_Panel3D, m_PreviewPane, m_ReferenceCopy, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ReferenceCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsOK, m_shapes3D_list, DIALOG_MODULE_BOARD_EDITOR_BASE::m_textCtrlSheetPath, m_ValueCopy, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ValueCtrl, MOD_CMS, MOD_VIRTUAL, MODULE::Models(), MODULE::PadsLocked(), KIWAY_HOLDER::Prj(), MODULE::Reference(), PANEL_PREV_3D::ResetModelData(), PANEL_PREV_3D::SetModelDataIdx(), EDA_ITEM::SetParent(), S3D_FILENAME_RESOLVER::SplitAlias(), and MODULE::Value().

Referenced by TransferDataToWindow().

282 {
283  wxString default_path;
284  wxGetEnv( KISYS3DMOD, &default_path );
285 #ifdef __WINDOWS__
286  default_path.Replace( wxT( "/" ), wxT( "\\" ) );
287 #endif
288 
290 
291  // Init 3D shape list
292  m_3D_ShapeNameListBox->Clear();
293  auto sM = m_CurrentModule->Models().begin();
294  auto eM = m_CurrentModule->Models().end();
295  m_shapes3D_list.clear();
296 
297  wxString origPath;
298  wxString alias;
299  wxString shortPath;
300  S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
301 
302  while( sM != eM )
303  {
304  m_shapes3D_list.push_back( *sM );
305  origPath = sM->m_Filename;
306 
307  if( res && res->SplitAlias( origPath, alias, shortPath ) )
308  {
309  origPath = alias;
310  origPath.append( ":" );
311  origPath.append( shortPath );
312  }
313 
314  m_3D_ShapeNameListBox->Append( origPath );
315  ++sM;
316 
317  }
318 
323  m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
324  m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
325 
326  // Shows the footprint's schematic path.
328 
329  m_AttributsCtrl->SetItemToolTip( 0,
330  _( "Use this attribute for most non SMD components\n"
331  "Components with this option are not put in the footprint position list file" ) );
332  m_AttributsCtrl->SetItemToolTip( 1,
333  _( "Use this attribute for SMD components.\n"
334  "Only components with this option are put in the footprint position list file" ) );
335  m_AttributsCtrl->SetItemToolTip( 2,
336  _( "Use this attribute for \"virtual\" components drawn on board\n"
337  "like an edge connector (old ISA PC bus for instance)" ) );
338 
339  // Controls on right side of the dialog
340  switch( m_CurrentModule->GetAttributes() & 255 )
341  {
342  case 0:
343  m_AttributsCtrl->SetSelection( 0 );
344  break;
345 
346  case MOD_CMS:
347  m_AttributsCtrl->SetSelection( 1 );
348  break;
349 
350  case MOD_VIRTUAL:
351  m_AttributsCtrl->SetSelection( 2 );
352  break;
353 
354  default:
355  m_AttributsCtrl->SetSelection( 0 );
356  break;
357  }
358 
359  if( m_CurrentModule->IsLocked() )
360  m_AutoPlaceCtrl->SetSelection( 2 );
361  else if( m_CurrentModule->PadsLocked() )
362  m_AutoPlaceCtrl->SetSelection( 1 );
363  else
364  m_AutoPlaceCtrl->SetSelection( 0 );
365 
366  m_AutoPlaceCtrl->SetItemToolTip( 0,
367  _( "Component can be freely moved and auto placed. User "
368  "can arbitrarily select and edit component's pads." ) );
369  m_AutoPlaceCtrl->SetItemToolTip( 1,
370  _( "Component can be freely moved and auto placed, but its "
371  "pads cannot be selected or edited." ) );
372  m_AutoPlaceCtrl->SetItemToolTip( 2,
373  _( "Component is locked: it cannot be freely moved or auto "
374  "placed." ) );
375 
377 
379 
380  // if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
381  if( m_3D_ShapeNameListBox->GetCount() > 0 )
382  {
385 
386  if( m_PreviewPane )
388  }
389  else
390  {
391  if( m_PreviewPane )
392  m_PreviewPane->ResetModelData( true );
393  }
394 
395  // We have modified the UI, so call Fit() for m_Panel3D
396  // to be sure the m_Panel3D sizers are initiliazed before opening the dialog
397  m_Panel3D->GetSizer()->Fit( m_Panel3D );
398 
399  // For some reason, on Linux, after the call to
400  // m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true )
401  // the dialog has no longer the focus. Force it:
402  m_sdbSizerStdButtonsOK->SetFocus();
403 }
void ResetModelData(bool aReloadPreviewModule=false)
ResetModelData - Clear the values and reload the preview board.
TEXTE_MODULE & Reference()
Definition: class_module.h:483
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:76
int GetPlacementCost90() const
Definition: class_module.h:553
bool SplitAlias(const wxString &aFileName, wxString &anAlias, wxString &aRelPath)
Function SplitAlias returns true if the given name contains an alias and populates the string anAlias...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool PadsLocked() const
Definition: class_module.h:292
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:240
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:482
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
#define KISYS3DMOD
A variable name whose value holds the path of 3D shape files.
Definition: 3d_viewer.h:38
int GetAttributes() const
Definition: class_module.h:217
bool IsLocked() const override
Function IsLocked.
Definition: class_module.h:256
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:170
Virtual component: when created by copper shapes on board (Like edge card connectors, mounting hole...)
Definition: class_module.h:78
const wxString & GetPath() const
Definition: class_module.h:193
int GetPlacementCost180() const
Definition: class_module.h:550
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway.

Referenced by SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void DIALOG_MODULE_BOARD_EDITOR::ModuleOrientEvent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 249 of file dialog_edit_module_for_BoardEditor.cpp.

References DIALOG_MODULE_BOARD_EDITOR_BASE::m_OrientCtrl, m_OrientValidator, m_OrientValue, and DIALOG_MODULE_BOARD_EDITOR_BASE::m_OrientValueCtrl.

250 {
251  bool custom_orientation = false;
252 
253  switch( m_OrientCtrl->GetSelection() )
254  {
255  case 0:
256  m_OrientValue = 0.0;
257  break;
258 
259  case 1:
260  m_OrientValue = 90.0;
261  break;
262 
263  case 2:
264  m_OrientValue = 270.0;
265  break;
266 
267  case 3:
268  m_OrientValue = 180.0;
269  break;
270 
271  default:
272  custom_orientation = true;
273  break;
274  }
275 
276  m_OrientValidator.TransferToWindow();
277  m_OrientValueCtrl->Enable( custom_orientation );
278 }
wxFloatingPointValidator< double > m_OrientValidator
void DIALOG_MODULE_BOARD_EDITOR::On3DShapeNameSelected ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 406 of file dialog_edit_module_for_BoardEditor.cpp.

References DIALOG_MODULE_BOARD_EDITOR_BASE::m_3D_ShapeNameListBox, m_LastSelected3DShapeIndex, m_PreviewPane, m_shapes3D_list, PANEL_PREV_3D::ResetModelData(), and PANEL_PREV_3D::SetModelDataIdx().

407 {
409 
410  if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when
411  // deleting an item in
412  // m_3D_ShapeNameListBox wxListBox
413  {
414  if( m_PreviewPane )
416 
417  return;
418  }
419 
420  if( m_LastSelected3DShapeIndex >= (int) m_shapes3D_list.size() )
421  {
422  wxMessageBox( wxT( "On3DShapeNameSelected() error" ) );
424 
425  if( m_PreviewPane )
427 
428  return;
429  }
430 
431  if( m_PreviewPane )
433 }
void ResetModelData(bool aReloadPreviewModule=false)
ResetModelData - Clear the values and reload the preview board.
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void DIALOG_MODULE_BOARD_EDITOR::On3DShapeSelection ( wxCommandEvent &  event)
private
void DIALOG_MODULE_BOARD_EDITOR::OnEditReference ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 759 of file dialog_edit_module_for_BoardEditor.cpp.

References EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextPos(), PCB_BASE_FRAME::InstallTextModOptionsFrame(), m_CurrentModule, m_Parent, m_ReferenceCopy, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ReferenceCtrl, EDA_DRAW_FRAME::SetCrossHairPosition(), and EDA_ITEM::SetParent().

760 {
762 
767  m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
768 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
void InstallTextModOptionsFrame(TEXTE_MODULE *TextMod, wxDC *DC)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:240
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void DIALOG_MODULE_BOARD_EDITOR::OnEditValue ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 771 of file dialog_edit_module_for_BoardEditor.cpp.

References EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_TEXT::GetText(), EDA_TEXT::GetTextPos(), PCB_BASE_FRAME::InstallTextModOptionsFrame(), m_CurrentModule, m_Parent, m_ValueCopy, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ValueCtrl, EDA_DRAW_FRAME::SetCrossHairPosition(), and EDA_ITEM::SetParent().

772 {
774 
779  m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
780 }
const wxPoint & GetTextPos() const
Definition: eda_text.h:224
void InstallTextModOptionsFrame(TEXTE_MODULE *TextMod, wxDC *DC)
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:240
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void DIALOG_MODULE_BOARD_EDITOR::OnInitDlg ( wxInitDialogEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 93 of file dialog_edit_module_for_BoardEditor.h.

References DIALOG_SHIM::FinishDialogSettings(), and TransferDataToWindow().

94  {
95  // Call the default wxDialog handler of a wxInitDialogEvent
97 
98  // Now all widgets have the size fixed, call FinishDialogSettings
100  }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile(), BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint(), DIALOG_SYMBOL_LIB_TABLE::browseLibrariesHandler(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_MODULE_MODULE_EDITOR::Cfg3DPath(), Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE(), DIALOG_MODULE_BOARD_EDITOR(), DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), LIB_VIEW_FRAME::DisplayLibInfos(), LIB_EDIT_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName(), Edit3DShapeFileName(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), FOOTPRINT_EDIT_FRAME::getLibPath(), LIB_EDIT_FRAME::getLibraryFileName(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), SCH_EDIT_FRAME::ImportFile(), PCB_EDIT_FRAME::ImportFile(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), InitModeditProperties(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), DIALOG_NETLIST::OnSaveMessagesToFile(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_CHOOSE_COMPONENT::OnSchViewPaint(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_3D_VIEWER::takeScreenshot(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), ~DIALOG_MODULE_BOARD_EDITOR(), and DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:144
void DIALOG_MODULE_BOARD_EDITOR::Remove3DShape ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_MODULE_BOARD_EDITOR_BASE.

Definition at line 437 of file dialog_edit_module_for_BoardEditor.cpp.

References DIALOG_MODULE_BOARD_EDITOR_BASE::m_3D_ShapeNameListBox, m_LastSelected3DShapeIndex, m_PreviewPane, m_shapes3D_list, PANEL_PREV_3D::ResetModelData(), and PANEL_PREV_3D::SetModelDataIdx().

438 {
439  int ii = m_3D_ShapeNameListBox->GetSelection();
440 
441  if( ii < 0 )
442  {
443  if( m_PreviewPane )
444  m_PreviewPane->ResetModelData( true );
445 
446  return;
447  }
448 
449  m_shapes3D_list.erase( m_shapes3D_list.begin() + ii );
450  m_3D_ShapeNameListBox->Delete( ii );
451 
452  if( m_3D_ShapeNameListBox->GetCount() > 0 )
453  {
454  if( ii > 0 )
456  else
458 
460 
461  if( m_PreviewPane )
463  }
464  else
465  {
466  if( m_PreviewPane )
467  m_PreviewPane->ResetModelData( true );
468  }
469 
470  return;
471 }
void ResetModelData(bool aReloadPreviewModule=false)
ResetModelData - Clear the values and reload the preview board.
void SetModelDataIdx(int idx, bool aReloadPreviewModule=false)
SetModelDataIdx - This will set the index of the INFO list that was set on the parent.
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 139 of file dialog_shim.cpp.

References class_map, DIALOG_SHIM::FixOSXCancelButtonIssue(), EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, wxPoint::x, and wxPoint::y.

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_SCH_FIND::OnCancel(), DIALOG_ANNOTATE::OnCancelClick(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_MODULE::OnQuit(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

140 {
141  bool ret;
142  const char* hash_key;
143 
144  if( m_hash_key.size() )
145  {
146  // a special case like EDA_LIST_DIALOG, which has multiple uses.
147  hash_key = m_hash_key.c_str();
148  }
149  else
150  {
151  hash_key = typeid(*this).name();
152  }
153 
154  // Show or hide the window. If hiding, save current position and size.
155  // If showing, use previous position and size.
156  if( show )
157  {
158 #ifndef __WINDOWS__
159  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
160 #endif
161  ret = wxDialog::Show( show );
162 
163  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
164  EDA_RECT r = class_map[ hash_key ];
165 
166  if( r.GetSize().x != 0 && r.GetSize().y != 0 )
167  SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
168  }
169  else
170  {
171  // Save the dialog's position & size before hiding, using classname as key
172  EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
173  class_map[ hash_key ] = r;
174 
175  ret = wxDialog::Show( show );
176  }
177 
179 
180  return ret;
181 }
const wxSize GetSize() const
std::string m_hash_key
Definition: dialog_shim.h:128
void FixOSXCancelButtonIssue()
A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.
static RECT_MAP class_map
const wxPoint GetPosition() const
Class EDA_RECT handles the component boundary box.
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 497 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), SCH_EDIT_FRAME::InstallHierarchyFrame(), InvokeDialogCreateBOMEditor(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

498 {
499  // This is an exception safe way to zero a pointer before returning.
500  // Yes, even though DismissModal() clears this first normally, this is
501  // here in case there's an exception before the dialog is dismissed.
502  struct NULLER
503  {
504  void*& m_what;
505  NULLER( void*& aPtr ) : m_what( aPtr ) {}
506  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
507  } clear_this( (void*&) m_qmodal_loop );
508 
509  // release the mouse if it's currently captured as the window having it
510  // will be disabled when this dialog is shown -- but will still keep the
511  // capture making it impossible to do anything in the modal dialog itself
512  wxWindow* win = wxWindow::GetCapture();
513  if( win )
514  win->ReleaseMouse();
515 
516  // Get the optimal parent
517  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
518 
519  // Show the optimal parent
520  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
521 
522  wxASSERT_MSG( !m_qmodal_parent_disabler,
523  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
524 
525  // quasi-modal: disable only my "optimal" parent
527 
528  Show( true );
529 
530  m_qmodal_showing = true;
531 
532  EVENT_LOOP event_loop;
533 
534  m_qmodal_loop = &event_loop;
535 
536  event_loop.Run();
537 
538  return GetReturnCode();
539 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
bool DIALOG_MODULE_BOARD_EDITOR::TransferDataFromWindow ( )
overrideprivate

Definition at line 608 of file dialog_edit_module_for_BoardEditor.cpp.

References B_Cu, MODULE::CalculateBoundingBox(), EDA_DRAW_PANEL::CrossHairOff(), EDA_DRAW_PANEL::CrossHairOn(), DisplayError(), MODULE::Draw(), F_Cu, MODULE::Flip(), EDA_DRAW_FRAME::GetCanvas(), EDA_ITEM::GetFlags(), BOARD_ITEM::GetLayer(), MODULE::GetOrientation(), MODULE::GetPosition(), GR_OR, GR_XOR, KiROUND(), DIALOG_MODULE_BOARD_EDITOR_BASE::m_AttributsCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_AutoPlaceCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_CostRot180Ctrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_CostRot90Ctrl, m_CurrentModule, m_DC, DIALOG_MODULE_BOARD_EDITOR_BASE::m_LayerCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ModPositionX, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ModPositionY, DIALOG_MODULE_BOARD_EDITOR_BASE::m_NetClearanceValueCtrl, m_OrientValue, DIALOG_MODULE_BOARD_EDITOR_BASE::m_Panel3D, DIALOG_MODULE_BOARD_EDITOR_BASE::m_PanelProperties, m_Parent, m_PreviewPane, m_ReferenceCopy, m_shapes3D_list, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderMaskMarginCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginCtrl, DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginRatioCtrl, m_ValueCopy, DIALOG_MODULE_BOARD_EDITOR_BASE::m_ZoneConnectionChoice, MOD_CMS, MOD_VIRTUAL, MODULE::Models(), COMMIT::Modify(), PAD_ZONE_CONN_FULL, PAD_ZONE_CONN_INHERITED, PAD_ZONE_CONN_NONE, PAD_ZONE_CONN_THERMAL, PRM_EDITOR_EDIT_OK, BOARD_COMMIT::Push(), MODULE::Reference(), MODULE::Rotate(), MODULE::SetAttributes(), MODULE::SetLocalClearance(), MODULE::SetLocalSolderMaskMargin(), MODULE::SetLocalSolderPasteMargin(), MODULE::SetLocalSolderPasteMarginRatio(), MODULE::SetLocked(), MODULE::SetPadsLocked(), MODULE::SetPlacementCost180(), MODULE::SetPlacementCost90(), MODULE::SetPosition(), MODULE::SetZoneConnection(), PANEL_PREV_3D::ValidateWithMessage(), MODULE::Value(), ValueFromTextCtrl(), wxPoint::x, and wxPoint::y.

609 {
610  wxPoint modpos;
611  wxString msg;
612 
613  if( !Validate() || !DIALOG_MODULE_BOARD_EDITOR_BASE::TransferDataFromWindow() ||
614  !m_PanelProperties->TransferDataFromWindow() )
615  {
616  wxMessageBox( _( "Error: invalid or missing footprint parameter" ) );
617  return false;
618  }
619 
620  if( !m_Panel3D->TransferDataFromWindow() )
621  {
622  wxMessageBox( _( "Error: invalid or missing 3D parameter" ) );
623  return false;
624  }
625 
626  if( m_DC )
627  {
630  }
631 
632  BOARD_COMMIT commit( m_Parent );
633  commit.Modify( m_CurrentModule );
634 
635  // Init Fields (should be first, because they can be moved or/and flipped later):
636  TEXTE_MODULE& reference = m_CurrentModule->Reference();
637  reference = *m_ReferenceCopy;
638  TEXTE_MODULE& value = m_CurrentModule->Value();
639  value = *m_ValueCopy;
640 
641  // Initialize masks clearances
645 
646  double dtmp = 0.0;
647  msg = m_SolderPasteMarginRatioCtrl->GetValue();
648  msg.ToDouble( &dtmp );
649 
650  // A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
651  if( dtmp < -50.0 )
652  dtmp = -50.0;
653  // A margin ratio is always <= 0
654  // 0 means use full pad copper area
655  if( dtmp > 0.0 )
656  dtmp = 0.0;
657 
659 
660  switch( m_ZoneConnectionChoice->GetSelection() )
661  {
662  default:
663  case 0:
665  break;
666 
667  case 1:
669  break;
670 
671  case 2:
673  break;
674 
675  case 3:
677  break;
678  }
679 
680  // Set Module Position
681  modpos.x = ValueFromTextCtrl( *m_ModPositionX );
682  modpos.y = ValueFromTextCtrl( *m_ModPositionY );
683  m_CurrentModule->SetPosition( modpos );
684  m_CurrentModule->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 );
685  m_CurrentModule->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
686 
687  switch( m_AttributsCtrl->GetSelection() )
688  {
689  case 0:
691  break;
692 
693  case 1:
695  break;
696 
697  case 2:
699  break;
700  }
701 
704 
705  /* Now, set orientation. must be made after others changes,
706  * because rotation changes fields positions on board according to the new orientation
707  * (relative positions are not modified)
708  */
709  int orient = KiROUND( m_OrientValue * 10.0 );
710 
711  if( m_CurrentModule->GetOrientation() != orient )
713  orient - m_CurrentModule->GetOrientation() );
714 
715  // Set component side, that also have effect on the fields positions on board
716  bool change_layer = false;
717  if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT
718  {
719  if( m_CurrentModule->GetLayer() == B_Cu )
720  change_layer = true;
721  }
722  else if( m_CurrentModule->GetLayer() == F_Cu )
723  change_layer = true;
724 
725  if( change_layer )
727 
728  // This will update the S3D_INFO list into the current module
729  msg.Clear();
730 
731  if( !m_PreviewPane->ValidateWithMessage( msg ) )
732  {
733  DisplayError( this, msg );
734  return false;
735  }
736 
737  std::list<MODULE_3D_SETTINGS>* draw3D = &m_CurrentModule->Models();
738  draw3D->clear();
739  draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );
740 
742 
743  // This is a simple edition, we must create an undo entry
744  if( m_CurrentModule->GetFlags() == 0 )
745  commit.Push( _( "Modify module properties" ) );
746 
747  SetReturnCode( PRM_EDITOR_EDIT_OK );
748 
749  if( m_DC )
750  {
753  }
754 
755  return true;
756 }
void SetPlacementCost90(int aCost)
Definition: class_module.h:554
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
TEXTE_MODULE & Reference()
Definition: class_module.h:483
void Rotate(const wxPoint &aRotCentre, double aAngle) override
Function Rotate Rotate this object.
void SetLocalClearance(int aClearance)
Definition: class_module.h:200
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
void SetPlacementCost180(int aCost)
Definition: class_module.h:551
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:331
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
void CalculateBoundingBox()
Function CalculateBoundingBox calculates the bounding box in board coordinates.
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw draws the footprint to the aDC.
void Flip(const wxPoint &aCentre) override
Function Flip Flip this object, i.e.
const wxPoint & GetPosition() const override
Definition: class_module.h:175
bool ValidateWithMessage(wxString &aErrorMessage)
verify X,Y and Z scale factors are acceptable (> 0.001 and < 1000.0)
Set for modules listed in the automatic insertion list (usually SMD footprints)
Definition: class_module.h:76
void SetZoneConnection(ZoneConnection aType)
Definition: class_module.h:208
void SetLocalSolderPasteMarginRatio(double aRatio)
Definition: class_module.h:206
Pads are not covered.
Definition: zones.h:57
double GetOrientation() const
Definition: class_module.h:180
TEXTE_MODULE & Value()
read/write accessors:
Definition: class_module.h:482
std::vector< MODULE_3D_SETTINGS > m_shapes3D_list
void SetPadsLocked(bool aPadsLocked)
Definition: class_module.h:294
void SetPosition(const wxPoint &aPos) override
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:385
void CrossHairOff(wxDC *DC)
Definition: draw_panel.cpp:259
void SetLocalSolderMaskMargin(int aMargin)
Definition: class_module.h:197
Definition: gr_basic.h:42
void SetLocalSolderPasteMargin(int aMargin)
Definition: class_module.h:203
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:170
void CrossHairOn(wxDC *DC)
Definition: draw_panel.cpp:266
void SetLocked(bool isLocked) override
Function SetLocked sets the MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: class_module.h:266
Virtual component: when created by copper shapes on board (Like edge card connectors, mounting hole...)
Definition: class_module.h:78
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:73
Use thermal relief for pads.
Definition: zones.h:58
void SetAttributes(int aAttributes)
Definition: class_module.h:218
pads are covered by copper
Definition: zones.h:59
bool DIALOG_MODULE_BOARD_EDITOR::TransferDataToWindow ( )
overrideprivate

Definition at line 585 of file dialog_edit_module_for_BoardEditor.cpp.

References InitBoardProperties(), InitModeditProperties(), DIALOG_MODULE_BOARD_EDITOR_BASE::m_Panel3D, and DIALOG_MODULE_BOARD_EDITOR_BASE::m_PanelProperties.

Referenced by OnInitDlg().

586 {
587  if( !wxDialog::TransferDataToWindow() ||
588  !m_PanelProperties->TransferDataToWindow() )
589  {
590  wxMessageBox( _( "Error: invalid footprint parameter" ) );
591  return false;
592  }
593 
594  if( !m_Panel3D->TransferDataToWindow() )
595  {
596  wxMessageBox( _( "Error: invalid 3D parameter" ) );
597  return false;
598  }
599 
602  Layout();
603 
604  return true;
605 }

Member Data Documentation

wxBoxSizer* DIALOG_MODULE_BOARD_EDITOR_BASE::bLowerSizer3D
protectedinherited
wxBoxSizer* DIALOG_MODULE_BOARD_EDITOR_BASE::bSizerMain3D
protectedinherited
wxRadioBox* DIALOG_MODULE_BOARD_EDITOR_BASE::m_AttributsCtrl
protectedinherited
wxRadioBox* DIALOG_MODULE_BOARD_EDITOR_BASE::m_AutoPlaceCtrl
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_button4
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_button5
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_button8
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_buttonAdd
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_buttonEdit
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_buttonExchange
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_buttonModuleEditor
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_buttonRemove
protectedinherited
wxSlider* DIALOG_MODULE_BOARD_EDITOR_BASE::m_CostRot180Ctrl
protectedinherited
wxSlider* DIALOG_MODULE_BOARD_EDITOR_BASE::m_CostRot90Ctrl
protectedinherited
MODULE* DIALOG_MODULE_BOARD_EDITOR::m_currentModuleCopy
private

Definition at line 47 of file dialog_edit_module_for_BoardEditor.h.

Referenced by DIALOG_MODULE_BOARD_EDITOR().

wxDC* DIALOG_MODULE_BOARD_EDITOR::m_DC
private
std::string DIALOG_SHIM::m_hash_key
protectedinherited
int DIALOG_MODULE_BOARD_EDITOR::m_LastSelected3DShapeIndex
private
wxRadioBox* DIALOG_MODULE_BOARD_EDITOR_BASE::m_LayerCtrl
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_MaskClearanceTitle
protectedinherited
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_ModPositionX
protectedinherited
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_ModPositionY
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_NetClearanceUnits
protectedinherited
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_NetClearanceValueCtrl
protectedinherited
wxNotebook* DIALOG_MODULE_BOARD_EDITOR_BASE::m_NoteBook
protectedinherited
wxFloatingPointValidator<double> DIALOG_MODULE_BOARD_EDITOR::m_OrientValidator
private
double DIALOG_MODULE_BOARD_EDITOR::m_OrientValue
private
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_OrientValueCtrl
protectedinherited
size_t DIALOG_MODULE_BOARD_EDITOR::m_page = 0
staticprivate

Module editor: Dialog for editing module properties in the pcb editor.

Definition at line 45 of file dialog_edit_module_for_BoardEditor.h.

Referenced by DIALOG_MODULE_BOARD_EDITOR(), and ~DIALOG_MODULE_BOARD_EDITOR().

wxPanel* DIALOG_MODULE_BOARD_EDITOR_BASE::m_PanelProperties
protectedinherited
PCB_EDIT_FRAME* DIALOG_MODULE_BOARD_EDITOR::m_Parent
private
EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 131 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited
wxTextCtrl* DIALOG_MODULE_BOARD_EDITOR_BASE::m_ReferenceCtrl
protectedinherited
wxStdDialogButtonSizer* DIALOG_MODULE_BOARD_EDITOR_BASE::m_sdbSizerStdButtons
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsCancel
protectedinherited
wxButton* DIALOG_MODULE_BOARD_EDITOR_BASE::m_sdbSizerStdButtonsOK
protectedinherited
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderMaskMarginCtrl
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderMaskMarginUnits
protectedinherited
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginCtrl
protectedinherited
TEXT_CTRL_EVAL* DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginRatioCtrl
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteMarginUnits
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_SolderPasteRatioMarginUnits
protectedinherited
wxStaticLine* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticline1
protectedinherited
wxStaticLine* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticline2
protectedinherited
wxStaticLine* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticline3
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticText11
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticText12
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticText16
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextInfo
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextNetClearance
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextPos
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextRatio
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextRef
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextRotation
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextSolderPaste
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_staticTextVal
protectedinherited
wxTextCtrl* DIALOG_MODULE_BOARD_EDITOR_BASE::m_textCtrlSheetPath
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_TextSheetPath
protectedinherited
wxTextCtrl* DIALOG_MODULE_BOARD_EDITOR_BASE::m_ValueCtrl
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_XPosLabel
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_XPosUnit
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_YPosLabel
protectedinherited
wxStaticText* DIALOG_MODULE_BOARD_EDITOR_BASE::m_YPosUnit
protectedinherited
wxChoice* DIALOG_MODULE_BOARD_EDITOR_BASE::m_ZoneConnectionChoice
protectedinherited

The documentation for this class was generated from the following files: