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.

573 lines
17 KiB

  1. /***************/
  2. /* set_color.h */
  3. /***************/
  4. #ifndef SET_COLOR_H
  5. #define SET_COLOR_H
  6. #if defined(__GNUG__) && !defined(__APPLE__)
  7. #pragma interface "set_color.cpp"
  8. #endif
  9. #include "wx/statline.h"
  10. class wxBoxSizer;
  11. class wxFlexGridSizer;
  12. class wxStaticLine;
  13. class wxStdDialogButtonSizer;
  14. // Specify how many elements are contained within laytool_list[]
  15. const int NB_BUTT = 44;
  16. // Specify how many elements are contained within laytool_index[]
  17. const int BUTTON_GROUPS = 3;
  18. // Specify the numbers associated with assorted controls
  19. enum col_sel_id {
  20. ID_DIALOG = 1800,
  21. ID_COLOR_RESET_SHOW_LAYER_ON,
  22. ID_COLOR_RESET_SHOW_LAYER_OFF,
  23. ID_COLOR_CHECKBOX_ONOFF,
  24. ID_COLOR_SETUP
  25. };
  26. // Control identifiers
  27. // #define SYMBOL_WINEDA_SETCOLORSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
  28. #define SYMBOL_WINEDA_SETCOLORSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER
  29. #define SYMBOL_WINEDA_SETCOLORSFRAME_TITLE _("Pcbnew Layer Colors:")
  30. #define SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME ID_DIALOG
  31. // #define SYMBOL_WINEDA_SETCOLORSFRAME_SIZE wxSize(400, 300)
  32. // #define SYMBOL_WINEDA_SETCOLORSFRAME_POSITION wxDefaultPosition
  33. #ifndef wxCLOSE_BOX
  34. #define wxCLOSE_BOX 0x1000
  35. #endif
  36. // Specify the width and height of every (color-displaying / bitmap) button
  37. const int BUTT_SIZE_X = 25;
  38. const int BUTT_SIZE_Y = 20;
  39. /* Macro utile : */
  40. #define ADR( numlayer ) &g_DesignSettings.m_LayerColor[(numlayer)]
  41. /**********************************/
  42. /* Liste des menus de Menu_Layers */
  43. /**********************************/
  44. struct ColorButton
  45. {
  46. const wxString m_Title;
  47. int m_LayerNumber;
  48. int* m_Color; ///< pointer to color variable to manipulate
  49. bool m_NoDisplayIsColor; ///< TRUE if bit ITEM_NOT_SHOW of the color variable should be manipulated
  50. bool* m_NoDisplay; ///< pointer to the on/off display control variable, if it is not the color variable
  51. int m_Id;
  52. wxBitmapButton* m_Button;
  53. // int m_State; // (Commented out until when it is actually used.)
  54. wxCheckBox* m_CheckBox; ///< Display ON/OFF toggle
  55. };
  56. struct ButtonIndex
  57. {
  58. wxString m_Name; // Title
  59. int m_Index; // Index to last bitmap button in group
  60. };
  61. static ButtonIndex Msg_Layers_Cu =
  62. {
  63. _( "Copper Layers" ), // Title
  64. 15 // Index to last bitmap button in group
  65. };
  66. static ColorButton Layer_1_Butt =
  67. {
  68. wxEmptyString,
  69. COPPER_LAYER_N, // Layer
  70. ADR( COPPER_LAYER_N ), // Address of optional parameter
  71. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  72. };
  73. static ColorButton Layer_2_Butt =
  74. {
  75. wxEmptyString,
  76. 1, // Layer
  77. ADR( 1 ), // Address of optional parameter
  78. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  79. };
  80. static ColorButton Layer_3_Butt =
  81. {
  82. wxEmptyString,
  83. 2, // Layer
  84. ADR( 2 ), // Address of optional parameter
  85. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  86. };
  87. static ColorButton Layer_4_Butt =
  88. {
  89. wxEmptyString,
  90. 3, // Layer
  91. ADR( 3 ), // Address of optional parameter
  92. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  93. };
  94. static ColorButton Layer_5_Butt =
  95. {
  96. wxEmptyString,
  97. 4, // Layer
  98. ADR( 4 ), // Address of optional parameter
  99. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  100. };
  101. static ColorButton Layer_6_Butt =
  102. {
  103. wxEmptyString,
  104. 5, // Layer
  105. ADR( 5 ), // Address of optional parameter
  106. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  107. };
  108. static ColorButton Layer_7_Butt =
  109. {
  110. wxEmptyString,
  111. 6, // Layer
  112. ADR( 6 ), // Address of optional parameter
  113. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  114. };
  115. static ColorButton Layer_8_Butt =
  116. {
  117. wxEmptyString,
  118. 7, // Layer
  119. ADR( 7 ), // Address of optional parameter
  120. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  121. };
  122. static ColorButton Layer_9_Butt =
  123. {
  124. wxEmptyString,
  125. 8, // Layer
  126. ADR( 8 ), // Address of optional parameter
  127. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  128. };
  129. static ColorButton Layer_10_Butt =
  130. {
  131. wxEmptyString,
  132. 9, // Layer
  133. ADR( 9 ), // Address of optional parameter
  134. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  135. };
  136. static ColorButton Layer_11_Butt =
  137. {
  138. wxEmptyString,
  139. 10, // Layer
  140. ADR( 10 ), // Address of optional parameter
  141. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  142. };
  143. static ColorButton Layer_12_Butt =
  144. {
  145. wxEmptyString,
  146. 11, // Layer
  147. ADR( 11 ), // Address of optional parameter
  148. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  149. };
  150. static ColorButton Layer_13_Butt =
  151. {
  152. wxEmptyString,
  153. 12, // Layer
  154. ADR( 12 ), // Address of optional parameter
  155. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  156. };
  157. static ColorButton Layer_14_Butt =
  158. {
  159. wxEmptyString,
  160. 13, // Layer
  161. ADR( 13 ), // Address of optional parameter
  162. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  163. };
  164. static ColorButton Layer_15_Butt =
  165. {
  166. wxEmptyString,
  167. 14, // Layer
  168. ADR( 14 ), // Address of optional parameter
  169. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  170. };
  171. static ColorButton Layer_16_Butt =
  172. {
  173. wxEmptyString,
  174. CMP_N, // Layer
  175. ADR( CMP_N ), // Address of optional parameter
  176. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  177. };
  178. static ButtonIndex Msg_Layers_Tech =
  179. {
  180. _( "Tech Layers" ), // Title
  181. 28 // Index to last bitmap button in group
  182. };
  183. static ColorButton Layer_17_Butt =
  184. {
  185. wxEmptyString,
  186. ADHESIVE_N_CU, // Layer
  187. ADR( ADHESIVE_N_CU ), // Address of optional parameter
  188. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  189. };
  190. static ColorButton Layer_18_Butt =
  191. {
  192. wxEmptyString,
  193. ADHESIVE_N_CMP, // Layer
  194. ADR( ADHESIVE_N_CMP ), // Address of optional parameter
  195. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  196. };
  197. static ColorButton Layer_19_Butt =
  198. {
  199. wxEmptyString,
  200. SOLDERPASTE_N_CU, // Layer
  201. ADR( SOLDERPASTE_N_CU ), // Address of optional parameter
  202. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  203. };
  204. static ColorButton Layer_20_Butt =
  205. {
  206. wxEmptyString,
  207. SOLDERPASTE_N_CMP, // Layer
  208. ADR( SOLDERPASTE_N_CMP ), // Address of optional parameter
  209. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  210. };
  211. static ColorButton Layer_21_Butt =
  212. {
  213. wxEmptyString,
  214. SILKSCREEN_N_CU, // Layer
  215. ADR( SILKSCREEN_N_CU ), // Address of optional parameter
  216. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  217. };
  218. static ColorButton Layer_22_Butt =
  219. {
  220. wxEmptyString,
  221. SILKSCREEN_N_CMP, // Layer
  222. ADR( SILKSCREEN_N_CMP ), // Address of optional parameter
  223. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  224. };
  225. static ColorButton Layer_23_Butt =
  226. {
  227. wxEmptyString,
  228. SOLDERMASK_N_CU, // Layer
  229. ADR( SOLDERMASK_N_CU ), // Address of optional parameter
  230. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  231. };
  232. static ColorButton Layer_24_Butt =
  233. {
  234. wxEmptyString,
  235. SOLDERMASK_N_CMP, // Layer
  236. ADR( SOLDERMASK_N_CMP ), // Address of optional parameter
  237. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  238. };
  239. static ColorButton Layer_25_Butt =
  240. {
  241. wxEmptyString,
  242. DRAW_N, // Layer
  243. ADR( DRAW_N ), // Address of optional parameter
  244. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  245. };
  246. static ColorButton Layer_26_Butt =
  247. {
  248. wxEmptyString,
  249. COMMENT_N, // Layer
  250. ADR( COMMENT_N ), // Address of optional parameter
  251. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  252. };
  253. static ColorButton Layer_27_Butt =
  254. {
  255. wxEmptyString,
  256. ECO1_N, // Layer
  257. ADR( ECO1_N ), // Address of optional parameter
  258. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  259. };
  260. static ColorButton Layer_28_Butt =
  261. {
  262. wxEmptyString,
  263. ECO2_N, // Layer
  264. ADR( ECO2_N ), // Address of optional parameter
  265. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  266. };
  267. static ColorButton Layer_29_Butt =
  268. {
  269. wxEmptyString,
  270. EDGE_N, // Layer
  271. ADR( EDGE_N ), // Address of optional parameter
  272. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  273. };
  274. static ButtonIndex Msg_Others_Items =
  275. {
  276. wxT( "Others" ), // Title
  277. 43 // Index to last bitmap button in group
  278. };
  279. static ColorButton VIA_THROUGH_Butt =
  280. {
  281. wxT( "*" ),
  282. VIA_THROUGH, // Layer
  283. &g_DesignSettings.m_ViaColor[VIA_THROUGH], // Address of optional parameter
  284. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  285. };
  286. static ColorButton VIA_BLIND_BURIED_Butt =
  287. {
  288. wxT( "*" ),
  289. VIA_BLIND_BURIED, // Layer
  290. &g_DesignSettings.m_ViaColor[VIA_BLIND_BURIED], // Address of optional parameter
  291. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  292. };
  293. static ColorButton MICRO_VIA_Butt =
  294. {
  295. wxT( "*" ),
  296. VIA_MICROVIA, // Layer
  297. &g_DesignSettings.m_ViaColor[VIA_MICROVIA], // Address of optional parameter
  298. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  299. };
  300. static ColorButton Ratsnest_Butt =
  301. {
  302. _( "Ratsnest" ), // Title
  303. -1,
  304. &g_DesignSettings.m_RatsnestColor, // Address of optional parameter
  305. FALSE,
  306. &g_Show_Ratsnest // Address of boolean display control parameter to toggle
  307. };
  308. static ColorButton Pad_Cu_Butt =
  309. {
  310. _( "Pad Cu" ), // Title
  311. -1,
  312. &g_PadCUColor, // Address of optional parameter
  313. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  314. };
  315. static ColorButton Pad_Cmp_Butt =
  316. {
  317. _( "Pad Cmp" ), // Title
  318. -1,
  319. &g_PadCMPColor, // Address of optional parameter
  320. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  321. };
  322. static ColorButton Text_Mod_Cu_Butt =
  323. {
  324. _( "Text Module Cu" ), // Title
  325. -1,
  326. &g_ModuleTextCUColor, // Address of optional parameter
  327. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  328. };
  329. static ColorButton Text_Mod_Cmp_Butt =
  330. {
  331. _( "Text Module Cmp" ), // Title
  332. -1,
  333. &g_ModuleTextCMPColor, // Address of optional parameter
  334. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  335. };
  336. static ColorButton Text_Mod_NoVisible_Butt =
  337. {
  338. _( "Text Module invisible" ), // Title
  339. -1,
  340. &g_ModuleTextNOVColor, // Address of optional parameter
  341. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  342. };
  343. static ColorButton Anchors_Butt =
  344. {
  345. _( "Anchors" ), // Title
  346. -1,
  347. &g_AnchorColor, // Address of optional parameter
  348. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  349. };
  350. static ColorButton Grid_Butt =
  351. {
  352. _( "Grid" ), // Title
  353. -1,
  354. &g_GridColor, // Address of optional parameter
  355. FALSE,
  356. &g_ShowGrid // Address of boolean display control parameter to toggle
  357. };
  358. static ColorButton Show_Zones_Butt =
  359. {
  360. _( "Show Zones" ), // Title
  361. -1,
  362. NULL, // Address of optional parameter
  363. FALSE,
  364. &DisplayOpt.DisplayZones // Address of boolean display control parameter to toggle
  365. };
  366. static ColorButton Show_Pads_Noconnect_Butt =
  367. {
  368. _( "Show Noconnect" ), // Title
  369. -1,
  370. NULL, // Address of optional parameter
  371. FALSE,
  372. &DisplayOpt.DisplayPadNoConn // Address of boolean display control parameter to toggle
  373. };
  374. static ColorButton Show_Modules_Cmp_Butt =
  375. {
  376. _( "Show Modules Cmp" ), // Title
  377. -1,
  378. NULL, // Address of optional parameter
  379. FALSE,
  380. &DisplayOpt.Show_Modules_Cmp // Address of boolean display control parameter to toggle
  381. };
  382. static ColorButton Show_Modules_Cu_Butt =
  383. {
  384. _( "Show Modules Cu" ), // Title
  385. -1,
  386. NULL, // Address of optional parameter
  387. FALSE,
  388. &DisplayOpt.Show_Modules_Cu // Address of boolean display control parameter to toggle
  389. };
  390. static ColorButton* laytool_list[] = {
  391. &Layer_1_Butt,
  392. &Layer_2_Butt,
  393. &Layer_3_Butt,
  394. &Layer_4_Butt,
  395. &Layer_5_Butt,
  396. &Layer_6_Butt,
  397. &Layer_7_Butt,
  398. &Layer_8_Butt,
  399. &Layer_9_Butt,
  400. &Layer_10_Butt,
  401. &Layer_11_Butt,
  402. &Layer_12_Butt,
  403. &Layer_13_Butt,
  404. &Layer_14_Butt,
  405. &Layer_15_Butt,
  406. &Layer_16_Butt,
  407. &Layer_17_Butt,
  408. &Layer_18_Butt,
  409. &Layer_19_Butt,
  410. &Layer_20_Butt,
  411. &Layer_21_Butt,
  412. &Layer_22_Butt,
  413. &Layer_23_Butt,
  414. &Layer_24_Butt,
  415. &Layer_25_Butt,
  416. &Layer_26_Butt,
  417. &Layer_27_Butt,
  418. &Layer_28_Butt,
  419. &Layer_29_Butt,
  420. // &Layer_30_Butt,
  421. // &Layer_31_Butt,
  422. // &Layer_32_Butt,
  423. &VIA_THROUGH_Butt,
  424. &VIA_BLIND_BURIED_Butt,
  425. &MICRO_VIA_Butt,
  426. &Ratsnest_Butt,
  427. &Pad_Cu_Butt,
  428. &Pad_Cmp_Butt,
  429. &Text_Mod_Cu_Butt,
  430. &Text_Mod_Cmp_Butt,
  431. &Text_Mod_NoVisible_Butt,
  432. &Anchors_Butt,
  433. &Grid_Butt,
  434. &Show_Zones_Butt,
  435. &Show_Pads_Noconnect_Butt,
  436. &Show_Modules_Cmp_Butt,
  437. &Show_Modules_Cu_Butt,
  438. };
  439. static ButtonIndex* laytool_index[BUTTON_GROUPS] = {
  440. &Msg_Layers_Cu,
  441. &Msg_Layers_Tech,
  442. &Msg_Others_Items
  443. };
  444. /**************************************************************/
  445. /* classe derivee pour la frame de Configuration des couleurs */
  446. /**************************************************************/
  447. class WinEDA_SetColorsFrame: public wxDialog
  448. {
  449. private:
  450. DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
  451. DECLARE_EVENT_TABLE()
  452. WinEDA_DrawFrame* m_Parent;
  453. wxBoxSizer* OuterBoxSizer;
  454. wxBoxSizer* MainBoxSizer;
  455. wxFlexGridSizer* FlexColumnBoxSizer;
  456. wxStaticText* Label;
  457. wxBoxSizer* RowBoxSizer;
  458. wxBitmapButton* BitmapButton;
  459. wxCheckBox* CheckBox;
  460. wxButton* Button;
  461. wxStaticLine* Line;
  462. wxStdDialogButtonSizer* StdDialogButtonSizer;
  463. // Creation
  464. bool Create( wxWindow* parent,
  465. wxWindowID id = SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME,
  466. const wxString& caption = SYMBOL_WINEDA_SETCOLORSFRAME_TITLE,
  467. const wxPoint& pos = wxDefaultPosition,
  468. const wxSize& size = wxDefaultSize,
  469. long style = SYMBOL_WINEDA_SETCOLORSFRAME_STYLE );
  470. // Initialises member variables
  471. void Init();
  472. // Creates the controls and sizers
  473. void CreateControls();
  474. wxBitmap GetBitmapResource( const wxString& name );
  475. wxIcon GetIconResource( const wxString& name );
  476. static bool ShowToolTips();
  477. void SetColor( wxCommandEvent& event );
  478. void OnOkClick( wxCommandEvent& event );
  479. void OnCancelClick( wxCommandEvent& event );
  480. void OnApplyClick( wxCommandEvent& event );
  481. void UpdateLayerSettings();
  482. void ResetDisplayLayersCu( wxCommandEvent& event );
  483. public:
  484. // Constructors and destructor
  485. WinEDA_SetColorsFrame();
  486. WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos );
  487. ~WinEDA_SetColorsFrame();
  488. };
  489. #endif // SET_COLOR_H