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.

191 lines
5.7 KiB

  1. /***************************************************/
  2. /* tool_cvpcb.cpp: construction du menu principal */
  3. /***************************************************/
  4. #include "fctsys.h"
  5. #include "gr_basic.h"
  6. #include "common.h"
  7. #include "cvpcb.h"
  8. #include "trigo.h"
  9. #include "protos.h"
  10. #define BITMAP wxBitmap
  11. #include "bitmaps.h"
  12. #include "delete_association.xpm"
  13. #include "module_filtered_list.xpm"
  14. #include "module_full_list.xpm"
  15. #include "id.h"
  16. /*********************************************/
  17. void WinEDA_CvpcbFrame::ReCreateHToolbar()
  18. /*********************************************/
  19. {
  20. if ( m_HToolBar != NULL ) return;
  21. m_HToolBar = new WinEDA_Toolbar(TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE);
  22. SetToolBar(m_HToolBar);
  23. m_HToolBar->AddTool(ID_CVPCB_READ_INPUT_NETLIST, BITMAP(open_xpm),
  24. _("Open a NetList file"));
  25. m_HToolBar->AddTool(ID_CVPCB_SAVEQUITCVPCB, BITMAP(save_xpm),
  26. _("Save NetList and Components List files"));
  27. m_HToolBar->AddSeparator();
  28. m_HToolBar->AddTool(ID_CVPCB_CREATE_CONFIGWINDOW, BITMAP(config_xpm),
  29. _("Configuration"));
  30. m_HToolBar->AddSeparator();
  31. m_HToolBar->AddTool(ID_CVPCB_CREATE_SCREENCMP, BITMAP(module_xpm),
  32. _("View selected part"));
  33. m_HToolBar->AddTool(ID_CVPCB_AUTO_ASSOCIE, BITMAP(auto_associe_xpm),
  34. _("Automatic Association"));
  35. m_HToolBar->AddSeparator();
  36. m_HToolBar->AddTool(ID_CVPCB_GOTO_PREVIOUSNA, BITMAP(left_xpm),
  37. _("Select previous free component"));
  38. m_HToolBar->AddTool(ID_CVPCB_GOTO_FIRSTNA, BITMAP(right_xpm),
  39. _("Select next free component"));
  40. m_HToolBar->AddSeparator();
  41. m_HToolBar->AddTool(ID_CVPCB_DEL_ASSOCIATIONS, BITMAP(delete_association_xpm),
  42. _("Delete all associations"));
  43. m_HToolBar->AddSeparator();
  44. m_HToolBar->AddTool(ID_CVPCB_CREATE_STUFF_FILE, BITMAP(save_cmpstuff_xpm),
  45. _("Create stuff file (component/module list)"));
  46. m_HToolBar->AddSeparator();
  47. m_HToolBar->AddTool(ID_PCB_DISPLAY_FOOTPRINT_DOC, BITMAP(file_footprint_xpm),
  48. _("Display/print component documentation (footprint.pdf)"));
  49. m_HToolBar->AddSeparator();
  50. m_HToolBar->AddSeparator();
  51. m_HToolBar->AddRadioTool(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
  52. wxEmptyString, BITMAP(module_filtered_list_xpm),
  53. wxNullBitmap,
  54. _("Display the filtered footprint list for the current component"));
  55. m_HToolBar->AddRadioTool(ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
  56. wxEmptyString, BITMAP(module_full_list_xpm),
  57. wxNullBitmap,
  58. _("Display the full footprint list (without filtering)"));
  59. if( m_Parent->m_EDA_Config )
  60. {
  61. wxString key = wxT(FILTERFOOTPRINTKEY);
  62. int opt = m_Parent->m_EDA_Config->Read(key, (long)1);
  63. m_HToolBar->ToggleTool(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt);
  64. m_HToolBar->ToggleTool(ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, ! opt);
  65. }
  66. // after adding the buttons to the toolbar, must call Realize() to reflect
  67. // the changes
  68. m_HToolBar->Realize();
  69. }
  70. /*******************************************/
  71. void WinEDA_CvpcbFrame::ReCreateMenuBar()
  72. /*******************************************/
  73. /* Creation des menus de la fenetre principale
  74. */
  75. {
  76. int ii;
  77. wxMenuBar * menuBar = GetMenuBar();
  78. if( menuBar == NULL )
  79. {
  80. menuBar = new wxMenuBar();
  81. // Associate the menu bar with the frame
  82. SetMenuBar(menuBar);
  83. m_FilesMenu = new wxMenu;
  84. wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT,
  85. _("&Open"),
  86. _("Open a NetList file") );
  87. item->SetBitmap(open_xpm);
  88. m_FilesMenu->Append(item);
  89. m_FilesMenu->AppendSeparator();
  90. item = new wxMenuItem(m_FilesMenu, ID_SAVE_PROJECT,
  91. _("&Save As..."),
  92. _("Save New NetList and Components List files") );
  93. item->SetBitmap(save_xpm);
  94. m_FilesMenu->Append(item);
  95. m_FilesMenu->AppendSeparator();
  96. item = new wxMenuItem(m_FilesMenu, ID_CVPCB_QUIT, _("E&xit"), _("Quit Cvpcb" ));
  97. item->SetBitmap(exit_xpm);
  98. m_FilesMenu->Append(item);
  99. // Creation des selections des anciens fichiers
  100. m_FilesMenu->AppendSeparator();
  101. for ( ii = 0; ii < 10; ii++ )
  102. {
  103. if ( GetLastProject(ii).IsEmpty() ) break;
  104. m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
  105. }
  106. // Menu Configuration:
  107. wxMenu * configmenu = new wxMenu;
  108. item = new wxMenuItem(configmenu, ID_CONFIG_REQ, _("&Configuration"),
  109. _("Setting Libraries, Directories and others..."));
  110. item->SetBitmap(config_xpm);
  111. configmenu->Append(item);
  112. // Font selection and setup
  113. AddFontSelectionMenu(configmenu);
  114. m_Parent->SetLanguageList(configmenu);
  115. configmenu->AppendSeparator();
  116. item = new wxMenuItem(configmenu, ID_CONFIG_SAVE,
  117. _("&Save config"),
  118. _("Save configuration in current dir"));
  119. item->SetBitmap(save_setup_xpm);
  120. configmenu->Append(item);
  121. // Menu Help:
  122. wxMenu *helpMenu = new wxMenu;
  123. item = new wxMenuItem(helpMenu , ID_CVPCB_DISPLAY_HELP, _("&Contents"),
  124. _("Open the cvpcb manual"));
  125. item->SetBitmap(help_xpm);
  126. helpMenu->Append(item);
  127. item = new wxMenuItem(helpMenu , ID_CVPCB_DISPLAY_LICENCE, _("&About"),
  128. _("About this application"));
  129. item->SetBitmap(info_xpm);
  130. helpMenu->Append(item);
  131. menuBar->Append(m_FilesMenu, _("&File"));
  132. menuBar->Append(configmenu, _("&Preferences"));
  133. menuBar->Append(helpMenu, _("&Help"));
  134. }
  135. else // simple mise a jour de la liste des fichiers anciens
  136. {
  137. wxMenuItem * item;
  138. int max_file = m_Parent->m_LastProjectMaxCount;
  139. for ( ii = max_file-1; ii >=0 ; ii-- )
  140. {
  141. if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
  142. {
  143. item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
  144. if ( item ) delete item;
  145. }
  146. }
  147. for ( ii = 0; ii < max_file; ii++ )
  148. {
  149. if ( GetLastProject(ii).IsEmpty() ) break;
  150. m_FilesMenu->Append(ID_LOAD_FILE_1 + ii, GetLastProject(ii) );
  151. }
  152. }
  153. }