You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
3.4 KiB

  1. /*
  2. * file gerbview_dialog_display_options_frame.cpp
  3. * Set the display options for Gerbview
  4. */
  5. #include "fctsys.h"
  6. #include "common.h"
  7. #include "class_drawpanel.h"
  8. #include "pcbplot.h"
  9. #include "gerbview.h"
  10. #include "gerbview_dialog_display_options_frame_base.h"
  11. /*******************************************/
  12. /* Dialog frame to select display options */
  13. /*******************************************/
  14. class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
  15. {
  16. private:
  17. WinEDA_GerberFrame* m_Parent;
  18. public:
  19. DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame* parent );
  20. ~DIALOG_DISPLAY_OPTIONS() {};
  21. private:
  22. void OnOKBUttonClick( wxCommandEvent& event );
  23. void OnCancelButtonClick( wxCommandEvent& event );
  24. };
  25. void WinEDA_GerberFrame::InstallGerberDisplayOptionsDialog( wxCommandEvent& event )
  26. {
  27. DIALOG_DISPLAY_OPTIONS dlg( this );
  28. int opt = dlg.ShowModal();
  29. if (opt > 0 )
  30. DrawPanel->Refresh();
  31. }
  32. DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( WinEDA_GerberFrame *parent) :
  33. DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY )
  34. {
  35. m_Parent = parent;
  36. SetFocus();
  37. // Show Option Draw Lines
  38. if( DisplayOpt.DisplayPcbTrackFill ) // We use DisplayPcbTrackFill as Lines draw option
  39. m_OptDisplayLines->SetSelection( 1 );
  40. else
  41. m_OptDisplayLines->SetSelection( 0 );
  42. if( DisplayOpt.DisplayPadFill )
  43. m_OptDisplayFlashedItems->SetSelection( 1 );
  44. else
  45. m_OptDisplayFlashedItems->SetSelection( 0 );
  46. // Show Option Draw polygons
  47. if( g_DisplayPolygonsModeSketch == 0 )
  48. m_OptDisplayPolygons->SetSelection( 1 );
  49. else
  50. m_OptDisplayPolygons->SetSelection( 0 );
  51. m_ShowPageLimits->SetSelection(0);
  52. if( m_Parent->m_Draw_Sheet_Ref )
  53. {
  54. for( int ii = 1; g_GerberPageSizeList[ii] != NULL; ii++ )
  55. {
  56. if( m_Parent->GetScreen()->m_CurrentSheetDesc == g_GerberPageSizeList[ii] )
  57. {
  58. m_ShowPageLimits->SetSelection(ii);
  59. break;
  60. }
  61. }
  62. }
  63. m_OptDisplayDCodes->SetValue( m_Parent->IsElementVisible( DCODES_VISIBLE ) );
  64. GetSizer()->Fit( this );
  65. GetSizer()->SetSizeHints( this );
  66. }
  67. void DIALOG_DISPLAY_OPTIONS::OnCancelButtonClick( wxCommandEvent& WXUNUSED(event) )
  68. {
  69. EndModal( 0 );
  70. }
  71. void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
  72. {
  73. if( m_OptDisplayLines->GetSelection() == 1 )
  74. DisplayOpt.DisplayPcbTrackFill = TRUE;
  75. else
  76. DisplayOpt.DisplayPcbTrackFill = FALSE;
  77. if( m_OptDisplayFlashedItems->GetSelection() == 1 )
  78. {
  79. DisplayOpt.DisplayPadFill = true;
  80. DisplayOpt.DisplayViaFill = true;
  81. }
  82. else
  83. {
  84. DisplayOpt.DisplayViaFill = false;
  85. DisplayOpt.DisplayPadFill = false;
  86. }
  87. if( m_OptDisplayPolygons->GetSelection() == 0 )
  88. g_DisplayPolygonsModeSketch = 1;
  89. else
  90. g_DisplayPolygonsModeSketch = 0;
  91. m_Parent->SetElementVisibility( DCODES_VISIBLE, m_OptDisplayDCodes->GetValue() );
  92. m_Parent->m_DisplayPadFill = m_Parent->m_DisplayViaFill =
  93. DisplayOpt.DisplayViaFill;
  94. m_Parent->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
  95. int idx = m_ShowPageLimits->GetSelection();
  96. if( idx > 0 )
  97. m_Parent->m_Draw_Sheet_Ref = true;
  98. else
  99. m_Parent->m_Draw_Sheet_Ref = false;
  100. m_Parent->GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[idx];
  101. EndModal( 1 );
  102. }