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.

646 lines
22 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: setpage.cpp
  3. // Purpose:
  4. // Author: jean-pierre Charras
  5. // Modified by:
  6. // Created: 13/11/2007 09:11:27
  7. // RCS-ID:
  8. // Copyright: License GNU
  9. // Licence:
  10. /////////////////////////////////////////////////////////////////////////////
  11. /* The "Page Settings" dialog box created by this file (and setpage.h)
  12. * contains seven checkboxes which *are* provided when that dialog box is
  13. * invoked in EESchema, but which are *not* provided when that dialog box is
  14. * invoked in Pcbnew instead. As such, various lines within this file
  15. * (and setpage.h) are included on an appropriately conditional basis.
  16. * (That aspect should be noted if the contents of this file (and setpage.h)
  17. * are ever consequently modified as a consequence of setpage.pjd being
  18. * opened in DialogBlocks (as that file now incorporates those checkboxes).)
  19. */
  20. // Generated by DialogBlocks (unregistered), 13/11/2007 09:11:27
  21. #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
  22. #pragma implementation "setpage.h"
  23. #endif
  24. // For compilers that support precompilation, includes "wx/wx.h".
  25. #include "wx/wxprec.h"
  26. #ifdef __BORLANDC__
  27. #pragma hdrstop
  28. #endif
  29. #ifndef WX_PRECOMP
  30. #include "wx/wx.h"
  31. #endif
  32. ////@begin includes
  33. ////@end includes
  34. #include "fctsys.h"
  35. #include "gr_basic.h"
  36. #include "common.h"
  37. #ifdef EESCHEMA
  38. #include "program.h"
  39. #include "general.h"
  40. #endif
  41. #define NB_ITEMS 11
  42. Ki_PageDescr * SheetList[NB_ITEMS + 1] =
  43. {
  44. &g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
  45. &g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
  46. &g_Sheet_user, NULL
  47. };
  48. #include "setpage.h"
  49. ////@begin XPM images
  50. ////@end XPM images
  51. /******************************************************************/
  52. void WinEDA_DrawFrame::Process_PageSettings(wxCommandEvent& event)
  53. /******************************************************************/
  54. /* Creation de la fenetre de configuration
  55. */
  56. {
  57. WinEDA_SetPageFrame frame(this);
  58. frame.ShowModal();
  59. ReDrawPanel();
  60. }
  61. /*!
  62. * WinEDA_SetPageFrame type definition
  63. */
  64. IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetPageFrame, wxDialog )
  65. /*!
  66. * WinEDA_SetPageFrame event table definition
  67. */
  68. BEGIN_EVENT_TABLE( WinEDA_SetPageFrame, wxDialog )
  69. ////@begin WinEDA_SetPageFrame event table entries
  70. EVT_CLOSE( WinEDA_SetPageFrame::OnCloseWindow )
  71. EVT_BUTTON( wxID_OK, WinEDA_SetPageFrame::OnOkClick )
  72. EVT_BUTTON( wxID_CANCEL, WinEDA_SetPageFrame::OnCancelClick )
  73. ////@end WinEDA_SetPageFrame event table entries
  74. END_EVENT_TABLE()
  75. /*!
  76. * WinEDA_SetPageFrame constructors
  77. */
  78. WinEDA_SetPageFrame::WinEDA_SetPageFrame( )
  79. {
  80. Init();
  81. }
  82. WinEDA_SetPageFrame::WinEDA_SetPageFrame( WinEDA_DrawFrame* parent, wxWindowID id,
  83. const wxString& caption, const wxPoint& pos,
  84. const wxSize& size, long style )
  85. {
  86. Init();
  87. wxString msg;
  88. m_ParentDrawFrame = parent;
  89. m_Screen = m_ParentDrawFrame->GetBaseScreen();
  90. m_Modified = FALSE;
  91. m_SelectedSheet = NULL;
  92. m_CurrentSelection = 0;
  93. SearchPageSizeSelection();
  94. Create( parent, id, caption, pos, size, style);
  95. // Init display value for sheet User size
  96. wxString format = m_TextSheetCount->GetLabel();
  97. msg.Printf(format, m_Screen->m_NumberOfScreen);
  98. m_TextSheetCount->SetLabel(msg);
  99. format = m_TextSheetNumber->GetLabel();
  100. msg.Printf(format, m_Screen->m_ScreenNumber);
  101. m_TextSheetNumber->SetLabel(msg);
  102. if( g_UnitMetric )
  103. {
  104. UserSizeX = (double)g_Sheet_user.m_Size.x * 25.4 / 1000;
  105. UserSizeY = (double)g_Sheet_user.m_Size.y * 25.4 / 1000;
  106. msg.Printf( wxT("%.2f"), UserSizeX );
  107. m_TextUserSizeX->SetValue(msg);
  108. msg.Printf( wxT("%.2f"), UserSizeY );
  109. m_TextUserSizeY->SetValue(msg);
  110. }
  111. else
  112. {
  113. UserSizeX = (double)g_Sheet_user.m_Size.x / 1000;
  114. UserSizeY = (double)g_Sheet_user.m_Size.y / 1000;
  115. msg.Printf( wxT("%.3f"), UserSizeX );
  116. m_TextUserSizeX->SetValue(msg);
  117. msg.Printf( wxT("%.3f"), UserSizeY );
  118. m_TextUserSizeY->SetValue(msg);
  119. }
  120. }
  121. /*!
  122. * WinEDA_SetPageFrame creator
  123. */
  124. bool WinEDA_SetPageFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  125. {
  126. ////@begin WinEDA_SetPageFrame creation
  127. wxDialog::Create( parent, id, caption, pos, size, style );
  128. CreateControls();
  129. if( GetSizer() )
  130. {
  131. GetSizer()->SetSizeHints(this);
  132. }
  133. Centre();
  134. ////@end WinEDA_SetPageFrame creation
  135. return true;
  136. }
  137. /*!
  138. * WinEDA_SetPageFrame destructor
  139. */
  140. WinEDA_SetPageFrame::~WinEDA_SetPageFrame()
  141. {
  142. ////@begin WinEDA_SetPageFrame destruction
  143. ////@end WinEDA_SetPageFrame destruction
  144. }
  145. /*!
  146. * Member initialisation
  147. */
  148. void WinEDA_SetPageFrame::Init()
  149. {
  150. // NOTE: The following code has been modified by initialising the seven
  151. // checkboxes *only* within the EESchema version of this dialog box.
  152. ////@begin WinEDA_SetPageFrame member initialisation
  153. OuterSizer = NULL;
  154. MainSizer = NULL;
  155. LeftColumnSizer = NULL;
  156. m_PageSizeBox = NULL;
  157. UserSizeXSizer = NULL;
  158. UserPageSizeX = NULL;
  159. m_TextUserSizeX = NULL;
  160. UserSizeYSizer = NULL;
  161. UserPageSizeY = NULL;
  162. m_TextUserSizeY = NULL;
  163. RightColumnSizer = NULL;
  164. SheetInfoSizer = NULL;
  165. m_TextSheetCount = NULL;
  166. m_TextSheetNumber = NULL;
  167. RevisionSizer = NULL;
  168. m_TextRevision = NULL;
  169. TitleSizer = NULL;
  170. m_TextTitle = NULL;
  171. CompanySizer = NULL;
  172. m_TextCompany = NULL;
  173. Comment1Sizer = NULL;
  174. m_TextComment1 = NULL;
  175. Comment2Sizer = NULL;
  176. m_TextComment2 = NULL;
  177. Comment3Sizer = NULL;
  178. m_TextComment3 = NULL;
  179. Comment4Sizer = NULL;
  180. m_TextComment4 = NULL;
  181. Line = NULL;
  182. StdDialogButtonSizer = NULL;
  183. Button_OK = NULL;
  184. Button_Cancel = NULL;
  185. #ifdef EESCHEMA
  186. m_RevisionExport = NULL;
  187. m_TitleExport = NULL;
  188. m_CompanyExport = NULL;
  189. m_Comment1Export = NULL;
  190. m_Comment2Export = NULL;
  191. m_Comment3Export = NULL;
  192. m_Comment4Export = NULL;
  193. #endif
  194. ////@end WinEDA_SetPageFrame member initialisation
  195. }
  196. /*!
  197. * Control creation for WinEDA_SetPageFrame
  198. */
  199. void WinEDA_SetPageFrame::CreateControls()
  200. {
  201. SetFont( *g_DialogFont );
  202. // NOTE: The following code has been modified by providing the seven
  203. // checkboxes *only* within the EESchema version of this dialog box.
  204. ////@begin WinEDA_SetPageFrame content construction
  205. // Generated by DialogBlocks, 13/11/2007 09:11:27 (unregistered)
  206. WinEDA_SetPageFrame* itemDialog1 = this;
  207. this->SetForegroundColour(wxColour(0, 128, 64));
  208. OuterSizer = new wxBoxSizer(wxVERTICAL);
  209. itemDialog1->SetSizer(OuterSizer);
  210. MainSizer = new wxBoxSizer(wxHORIZONTAL);
  211. OuterSizer->Add(MainSizer, 1, wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5);
  212. LeftColumnSizer = new wxFlexGridSizer(6, 1, 0, 0);
  213. LeftColumnSizer->AddGrowableRow(1);
  214. LeftColumnSizer->AddGrowableRow(2);
  215. LeftColumnSizer->AddGrowableRow(3);
  216. LeftColumnSizer->AddGrowableRow(4);
  217. LeftColumnSizer->AddGrowableRow(5);
  218. MainSizer->Add(LeftColumnSizer, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
  219. wxArrayString m_PageSizeBoxStrings;
  220. m_PageSizeBoxStrings.Add(_("Size A4"));
  221. m_PageSizeBoxStrings.Add(_("Size A3"));
  222. m_PageSizeBoxStrings.Add(_("Size A2"));
  223. m_PageSizeBoxStrings.Add(_("Size A1"));
  224. m_PageSizeBoxStrings.Add(_("Size A0"));
  225. m_PageSizeBoxStrings.Add(_("Size A"));
  226. m_PageSizeBoxStrings.Add(_("Size B"));
  227. m_PageSizeBoxStrings.Add(_("Size C"));
  228. m_PageSizeBoxStrings.Add(_("Size D"));
  229. m_PageSizeBoxStrings.Add(_("Size E"));
  230. m_PageSizeBoxStrings.Add(_("User size"));
  231. m_PageSizeBox = new wxRadioBox( itemDialog1, ID_RADIOBOX_PAGE_SIZE, _("Page Size:"), wxDefaultPosition, wxDefaultSize, m_PageSizeBoxStrings, 1, wxRA_SPECIFY_COLS );
  232. m_PageSizeBox->SetSelection(0);
  233. LeftColumnSizer->Add(m_PageSizeBox, 1, wxGROW|wxALIGN_TOP|wxLEFT|wxRIGHT, 5);
  234. UserSizeXSizer = new wxBoxSizer(wxVERTICAL);
  235. LeftColumnSizer->Add(UserSizeXSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP, 5);
  236. UserPageSizeX = new wxStaticText( itemDialog1, wxID_STATIC, _("User Page Size X: "), wxDefaultPosition, wxDefaultSize, 0 );
  237. UserSizeXSizer->Add(UserPageSizeX, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
  238. m_TextUserSizeX = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_USER_PAGE_SIZE_X, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
  239. UserSizeXSizer->Add(m_TextUserSizeX, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 5);
  240. UserSizeYSizer = new wxBoxSizer(wxVERTICAL);
  241. LeftColumnSizer->Add(UserSizeYSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP, 5);
  242. UserPageSizeY = new wxStaticText( itemDialog1, wxID_STATIC, _("User Page Size Y: "), wxDefaultPosition, wxDefaultSize, 0 );
  243. UserSizeYSizer->Add(UserPageSizeY, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
  244. m_TextUserSizeY = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_USER_PAGE_SIZE_Y, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
  245. UserSizeYSizer->Add(m_TextUserSizeY, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 5);
  246. LeftColumnSizer->Add(5, 10, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
  247. LeftColumnSizer->Add(5, 10, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
  248. LeftColumnSizer->Add(5, 10, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
  249. RightColumnSizer = new wxFlexGridSizer(8, 1, 0, 0);
  250. RightColumnSizer->AddGrowableRow(0);
  251. RightColumnSizer->AddGrowableRow(1);
  252. RightColumnSizer->AddGrowableRow(2);
  253. RightColumnSizer->AddGrowableRow(3);
  254. RightColumnSizer->AddGrowableRow(4);
  255. RightColumnSizer->AddGrowableRow(5);
  256. RightColumnSizer->AddGrowableRow(6);
  257. RightColumnSizer->AddGrowableRow(7);
  258. RightColumnSizer->AddGrowableCol(0);
  259. MainSizer->Add(RightColumnSizer, 1, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
  260. SheetInfoSizer = new wxBoxSizer(wxHORIZONTAL);
  261. RightColumnSizer->Add(SheetInfoSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
  262. m_TextSheetCount = new wxStaticText( itemDialog1, wxID_STATIC, _("Number of sheets: %d"), wxDefaultPosition, wxDefaultSize, 0 );
  263. m_TextSheetCount->SetForegroundColour(wxColour(128, 0, 128));
  264. SheetInfoSizer->Add(m_TextSheetCount, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
  265. SheetInfoSizer->Add(5, 5, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  266. m_TextSheetNumber = new wxStaticText( itemDialog1, wxID_STATIC, _("Sheet number: %d"), wxDefaultPosition, wxDefaultSize, 0 );
  267. m_TextSheetNumber->SetForegroundColour(wxColour(128, 0, 128));
  268. SheetInfoSizer->Add(m_TextSheetNumber, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
  269. wxStaticBox* itemStaticBoxSizer20Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Revision:"));
  270. RevisionSizer = new wxStaticBoxSizer(itemStaticBoxSizer20Static, wxHORIZONTAL);
  271. itemStaticBoxSizer20Static->SetForegroundColour(wxColour(200, 0, 0));
  272. RightColumnSizer->Add(RevisionSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
  273. m_TextRevision = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_REVISION, _T(""), wxDefaultPosition, wxSize(100, -1), wxTE_RICH );
  274. RevisionSizer->Add(m_TextRevision, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  275. #ifdef EESCHEMA
  276. m_RevisionExport = new wxCheckBox( itemDialog1, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  277. m_RevisionExport->SetValue(false);
  278. RevisionSizer->Add(m_RevisionExport, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  279. #endif
  280. wxStaticBox* itemStaticBoxSizer23Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Title:"));
  281. TitleSizer = new wxStaticBoxSizer(itemStaticBoxSizer23Static, wxHORIZONTAL);
  282. itemStaticBoxSizer23Static->SetForegroundColour(wxColour(200, 0, 0));
  283. RightColumnSizer->Add(TitleSizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
  284. m_TextTitle = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_TITLE, _T(""), wxDefaultPosition, wxSize(400, -1), 0 );
  285. TitleSizer->Add(m_TextTitle, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  286. #ifdef EESCHEMA
  287. m_TitleExport = new wxCheckBox( itemDialog1, ID_CHECKBOX_TITLE, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  288. m_TitleExport->SetValue(false);
  289. TitleSizer->Add(m_TitleExport, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  290. #endif
  291. wxStaticBox* itemStaticBoxSizer26Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Company:"));
  292. CompanySizer = new wxStaticBoxSizer(itemStaticBoxSizer26Static, wxHORIZONTAL);
  293. itemStaticBoxSizer26Static->SetForegroundColour(wxColour(200, 0, 0));
  294. RightColumnSizer->Add(CompanySizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
  295. m_TextCompany = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_COMPANY, _T(""), wxDefaultPosition, wxSize(400, -1), 0 );
  296. CompanySizer->Add(m_TextCompany, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  297. #ifdef EESCHEMA
  298. m_CompanyExport = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  299. m_CompanyExport->SetValue(false);
  300. CompanySizer->Add(m_CompanyExport, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  301. #endif
  302. wxStaticBox* itemStaticBoxSizer29Static = new wxStaticBox(itemDialog1, wxID_STATIC, _("Comment1:"));
  303. Comment1Sizer = new wxStaticBoxSizer(itemStaticBoxSizer29Static, wxHORIZONTAL);
  304. itemStaticBoxSizer29Static->SetForegroundColour(wxColour(196, 0, 100));
  305. RightColumnSizer->Add(Comment1Sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
  306. m_TextComment1 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_COMMENT1, _T(""), wxDefaultPosition, wxSize(400, -1), 0 );
  307. Comment1Sizer->Add(m_TextComment1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  308. #ifdef EESCHEMA
  309. m_Comment1Export = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  310. m_Comment1Export->SetValue(false);
  311. Comment1Sizer->Add(m_Comment1Export, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  312. #endif
  313. wxStaticBox* itemStaticBoxSizer32Static = new wxStaticBox(itemDialog1, wxID_STATIC, _("Comment2:"));
  314. Comment2Sizer = new wxStaticBoxSizer(itemStaticBoxSizer32Static, wxHORIZONTAL);
  315. itemStaticBoxSizer32Static->SetForegroundColour(wxColour(196, 0, 100));
  316. RightColumnSizer->Add(Comment2Sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
  317. m_TextComment2 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_COMMENT2, _T(""), wxDefaultPosition, wxSize(400, -1), 0 );
  318. Comment2Sizer->Add(m_TextComment2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  319. #ifdef EESCHEMA
  320. m_Comment2Export = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  321. m_Comment2Export->SetValue(false);
  322. Comment2Sizer->Add(m_Comment2Export, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  323. #endif
  324. wxStaticBox* itemStaticBoxSizer35Static = new wxStaticBox(itemDialog1, wxID_STATIC, _("Comment3:"));
  325. Comment3Sizer = new wxStaticBoxSizer(itemStaticBoxSizer35Static, wxHORIZONTAL);
  326. itemStaticBoxSizer35Static->SetForegroundColour(wxColour(196, 0, 100));
  327. RightColumnSizer->Add(Comment3Sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
  328. m_TextComment3 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_COMMENT3, _T(""), wxDefaultPosition, wxSize(400, -1), 0 );
  329. Comment3Sizer->Add(m_TextComment3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  330. #ifdef EESCHEMA
  331. m_Comment3Export = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  332. m_Comment3Export->SetValue(false);
  333. Comment3Sizer->Add(m_Comment3Export, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  334. #endif
  335. wxStaticBox* itemStaticBoxSizer38Static = new wxStaticBox(itemDialog1, wxID_STATIC, _("Comment4:"));
  336. Comment4Sizer = new wxStaticBoxSizer(itemStaticBoxSizer38Static, wxHORIZONTAL);
  337. itemStaticBoxSizer38Static->SetForegroundColour(wxColour(196, 0, 100));
  338. RightColumnSizer->Add(Comment4Sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxADJUST_MINSIZE, 5);
  339. m_TextComment4 = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_COMMENT4, _T(""), wxDefaultPosition, wxSize(400, -1), 0 );
  340. Comment4Sizer->Add(m_TextComment4, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  341. #ifdef EESCHEMA
  342. m_Comment4Export = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
  343. m_Comment4Export->SetValue(false);
  344. Comment4Sizer->Add(m_Comment4Export, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  345. #endif
  346. Line = new wxStaticLine( itemDialog1, ID_STATICLINE, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
  347. OuterSizer->Add(Line, 0, wxGROW|wxLEFT|wxRIGHT, 5);
  348. StdDialogButtonSizer = new wxStdDialogButtonSizer;
  349. OuterSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
  350. Button_OK = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
  351. Button_OK->SetForegroundColour(wxColour(200, 0, 0));
  352. StdDialogButtonSizer->AddButton(Button_OK);
  353. Button_Cancel = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
  354. Button_Cancel->SetForegroundColour(wxColour(0, 0, 255));
  355. StdDialogButtonSizer->AddButton(Button_Cancel);
  356. StdDialogButtonSizer->Realize();
  357. // Set validators
  358. m_PageSizeBox->SetValidator( wxGenericValidator(& m_CurrentSelection) );
  359. m_TextRevision->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Revision) );
  360. m_TextTitle->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Title) );
  361. m_TextCompany->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Company) );
  362. m_TextComment1->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire1) );
  363. m_TextComment2->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire2) );
  364. m_TextComment3->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire3) );
  365. m_TextComment4->SetValidator( wxTextValidator(wxFILTER_NONE, & m_Screen->m_Commentaire4) );
  366. ////@end WinEDA_SetPageFrame content construction
  367. }
  368. /*!
  369. * wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
  370. */
  371. void WinEDA_SetPageFrame::OnCloseWindow( wxCloseEvent& event )
  372. {
  373. EndModal( m_Modified );
  374. }
  375. /*!
  376. * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
  377. */
  378. void WinEDA_SetPageFrame::OnOkClick( wxCommandEvent& event )
  379. {
  380. SavePageSettings( event );
  381. Close( TRUE );
  382. }
  383. /*!
  384. * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
  385. */
  386. void WinEDA_SetPageFrame::OnCancelClick( wxCommandEvent& event )
  387. {
  388. Close( TRUE );
  389. }
  390. /*!
  391. * Should we show tooltips?
  392. */
  393. bool WinEDA_SetPageFrame::ShowToolTips()
  394. {
  395. return true;
  396. }
  397. /*!
  398. * Get bitmap resources
  399. */
  400. wxBitmap WinEDA_SetPageFrame::GetBitmapResource( const wxString& name )
  401. {
  402. // Bitmap retrieval
  403. ////@begin WinEDA_SetPageFrame bitmap retrieval
  404. wxUnusedVar(name);
  405. return wxNullBitmap;
  406. ////@end WinEDA_SetPageFrame bitmap retrieval
  407. }
  408. /*!
  409. * Get icon resources
  410. */
  411. wxIcon WinEDA_SetPageFrame::GetIconResource( const wxString& name )
  412. {
  413. // Icon retrieval
  414. ////@begin WinEDA_SetPageFrame icon retrieval
  415. wxUnusedVar(name);
  416. return wxNullIcon;
  417. ////@end WinEDA_SetPageFrame icon retrieval
  418. }
  419. /*****************************************************************/
  420. void WinEDA_SetPageFrame::SavePageSettings(wxCommandEvent& event)
  421. /*****************************************************************/
  422. /* Mise a jour effective des textes et dimensions
  423. */
  424. {
  425. double dtmp;
  426. wxString msg;
  427. m_Screen->m_Revision = m_TextRevision->GetValue();
  428. m_Screen->m_Company = m_TextCompany->GetValue();
  429. m_Screen->m_Title = m_TextTitle->GetValue();
  430. m_Screen->m_Commentaire1 = m_TextComment1->GetValue();
  431. m_Screen->m_Commentaire2 = m_TextComment2->GetValue();
  432. m_Screen->m_Commentaire3 = m_TextComment3->GetValue();
  433. m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
  434. msg = m_TextUserSizeX->GetValue();
  435. msg.ToDouble(&dtmp);
  436. UserSizeX = dtmp;
  437. msg = m_TextUserSizeY->GetValue();
  438. msg.ToDouble(&dtmp);
  439. UserSizeY = dtmp;
  440. int ii = m_PageSizeBox->GetSelection();
  441. if( ii < 0 )
  442. ii = 0;
  443. m_SelectedSheet = SheetList[ii];
  444. m_Screen->m_CurrentSheetDesc = m_SelectedSheet;
  445. if( g_UnitMetric )
  446. {
  447. g_Sheet_user.m_Size.x = (int)( UserSizeX * 1000 / 25.4 );
  448. g_Sheet_user.m_Size.y = (int)( UserSizeY * 1000 / 25.4 );
  449. }
  450. else
  451. {
  452. g_Sheet_user.m_Size.x = (int)( UserSizeX * 1000 );
  453. g_Sheet_user.m_Size.y = (int)( UserSizeY * 1000 );
  454. }
  455. if( g_Sheet_user.m_Size.x < 6000 )
  456. g_Sheet_user.m_Size.x = 6000;
  457. if( g_Sheet_user.m_Size.x > 44000 )
  458. g_Sheet_user.m_Size.x = 44000;
  459. if( g_Sheet_user.m_Size.y < 4000 )
  460. g_Sheet_user.m_Size.y = 4000;
  461. if( g_Sheet_user.m_Size.y > 44000 )
  462. g_Sheet_user.m_Size.y = 44000;
  463. #ifdef EESCHEMA
  464. /* Exports settings to other sheets if requested: */
  465. SCH_SCREEN * screen;
  466. /* Build the screen list */
  467. EDA_ScreenList ScreenList;
  468. /* Update the datas */
  469. for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
  470. {
  471. if( screen == m_Screen )
  472. continue;
  473. if( m_RevisionExport->IsChecked() )
  474. screen->m_Revision = m_Screen->m_Revision;
  475. if( m_TitleExport->IsChecked() )
  476. screen->m_Title =m_Screen->m_Title;
  477. if( m_CompanyExport->IsChecked() )
  478. screen->m_Company = m_Screen->m_Company;
  479. if( m_Comment1Export->IsChecked() )
  480. screen->m_Commentaire1 = m_Screen->m_Commentaire1;
  481. if( m_Comment2Export->IsChecked() )
  482. screen->m_Commentaire2 = m_Screen->m_Commentaire2;
  483. if( m_Comment3Export->IsChecked() )
  484. screen->m_Commentaire3 = m_Screen->m_Commentaire3;
  485. if( m_Comment4Export->IsChecked() )
  486. screen->m_Commentaire4 = m_Screen->m_Commentaire4;
  487. }
  488. #endif
  489. m_Screen->SetModify();
  490. m_Screen->SetRefreshReq();
  491. }
  492. /*******************************************************/
  493. void WinEDA_SetPageFrame::SearchPageSizeSelection()
  494. /*******************************************************/
  495. /* Search the correct index to activate the radiobox list size selection
  496. * according to the current page size
  497. */
  498. {
  499. Ki_PageDescr * sheet;
  500. int ii;
  501. m_CurrentSelection = NB_ITEMS - 1;
  502. for( ii = 0; ii < NB_ITEMS; ii++ )
  503. {
  504. sheet = SheetList[ii];
  505. if( m_ParentDrawFrame->GetBaseScreen()->m_CurrentSheetDesc == sheet )
  506. m_CurrentSelection = ii;
  507. }
  508. }