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.

441 lines
12 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 = 34;
  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 _("GerbView 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 = 20;
  38. const int BUTT_SIZE_Y = 16;
  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. wxString m_Name;
  47. int * m_Color; // Pointeur sur la variable couleur
  48. bool m_NoDisplayIsColor; // TRUE si bit ITEM_NON_VISIBLE de la variable Color
  49. bool * m_NoDisplay; // Pointeur sur la variable Display on/off si ce
  50. // n'est pas la var Color
  51. int m_Id;
  52. wxBitmapButton * m_Button; // Button to display/change color assigned to this layer
  53. // int m_State; // (Commented out until when it is actually used.)
  54. wxCheckBox * m_CheckBox; // Option Display ON/OFF
  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. _( "Layers 1-16" ), // Title
  64. 15 // Index to last bitmap button in group
  65. };
  66. static ColorButton Layer_1_Butt=
  67. {
  68. _("Layer 1"), // Title
  69. ADR(0), // Address of optional parameter
  70. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  71. };
  72. static ColorButton Layer_2_Butt=
  73. {
  74. _("Layer 2"), // Title
  75. ADR(1), // Address of optional parameter
  76. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  77. };
  78. static ColorButton Layer_3_Butt=
  79. {
  80. _("Layer 3"), // Title
  81. ADR(2), // Address of optional parameter
  82. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  83. };
  84. static ColorButton Layer_4_Butt=
  85. {
  86. _("Layer 4"), // Title
  87. ADR(3), // Address of optional parameter
  88. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  89. };
  90. static ColorButton Layer_5_Butt=
  91. {
  92. _("Layer 5"), // Title
  93. ADR(4), // Address of optional parameter
  94. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  95. };
  96. static ColorButton Layer_6_Butt=
  97. {
  98. _("Layer 6"), // Title
  99. ADR(5), // Address of optional parameter
  100. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  101. };
  102. static ColorButton Layer_7_Butt=
  103. {
  104. _("Layer 7"), // Title
  105. ADR(6), // Address of optional parameter
  106. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  107. };
  108. static ColorButton Layer_8_Butt=
  109. {
  110. _("Layer 8"), // Title
  111. ADR(7), // Address of optional parameter
  112. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  113. };
  114. static ColorButton Layer_9_Butt=
  115. {
  116. _("Layer 9"), // Title
  117. ADR(8), // Address of optional parameter
  118. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  119. };
  120. static ColorButton Layer_10_Butt=
  121. {
  122. _("Layer 10"), // Title
  123. ADR(9), // Address of optional parameter
  124. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  125. };
  126. static ColorButton Layer_11_Butt=
  127. {
  128. _("Layer 11"), // Title
  129. ADR(10), // Address of optional parameter
  130. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  131. };
  132. static ColorButton Layer_12_Butt=
  133. {
  134. _("Layer 12"), // Title
  135. ADR(11), // Address of optional parameter
  136. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  137. };
  138. static ColorButton Layer_13_Butt=
  139. {
  140. _("Layer 13"), // Title
  141. ADR(12), // Address of optional parameter
  142. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  143. };
  144. static ColorButton Layer_14_Butt=
  145. {
  146. _("Layer 14"), // Title
  147. ADR(13), // Address of optional parameter
  148. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  149. };
  150. static ColorButton Layer_15_Butt=
  151. {
  152. _("Layer 15"), // Title
  153. ADR(14), // Address of optional parameter
  154. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  155. };
  156. static ColorButton Layer_16_Butt=
  157. {
  158. _("Layer 16"), // Title
  159. ADR(15), // Address of optional parameter
  160. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  161. };
  162. static ButtonIndex Msg_Layers_Tech =
  163. {
  164. _( "Layers 17-32" ), // Title
  165. 31 // Index to last bitmap button in group
  166. };
  167. static ColorButton Layer_17_Butt=
  168. {
  169. _("Layer 17"), // Title
  170. ADR(16), // Address of optional parameter
  171. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  172. };
  173. static ColorButton Layer_18_Butt=
  174. {
  175. _("Layer 18"), // Title
  176. ADR(17), // Address of optional parameter
  177. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  178. };
  179. static ColorButton Layer_19_Butt=
  180. {
  181. _("Layer 19"), // Title
  182. ADR(18), // Address of optional parameter
  183. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  184. };
  185. static ColorButton Layer_20_Butt=
  186. {
  187. _("Layer 20"), // Title
  188. ADR(19), // Address of optional parameter
  189. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  190. };
  191. static ColorButton Layer_21_Butt=
  192. {
  193. _("Layer 21"), // Title
  194. ADR(20), // Address of optional parameter
  195. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  196. };
  197. static ColorButton Layer_22_Butt=
  198. {
  199. _("Layer 22"), // Title
  200. ADR(21), // Address of optional parameter
  201. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  202. };
  203. static ColorButton Layer_23_Butt=
  204. {
  205. _("Layer 23"), // Title
  206. ADR(22), // Address of optional parameter
  207. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  208. };
  209. static ColorButton Layer_24_Butt=
  210. {
  211. _("Layer 24"), // Title
  212. ADR(23), // Address of optional parameter
  213. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  214. };
  215. static ColorButton Layer_25_Butt=
  216. {
  217. _("Layer 25"), // Title
  218. ADR(24), // Address of optional parameter
  219. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  220. };
  221. static ColorButton Layer_26_Butt=
  222. {
  223. _("Layer 26"), // Title
  224. ADR(25), // Address of optional parameter
  225. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  226. };
  227. static ColorButton Layer_27_Butt=
  228. {
  229. _("Layer 27"), // Title
  230. ADR(26), // Address of optional parameter
  231. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  232. };
  233. static ColorButton Layer_28_Butt=
  234. {
  235. _("Layer 28"), // Title
  236. ADR(27), // Address of optional parameter
  237. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  238. };
  239. static ColorButton Layer_29_Butt=
  240. {
  241. _("Layer 29"), // Title
  242. ADR(28), // Address of optional parameter
  243. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  244. };
  245. static ColorButton Layer_30_Butt=
  246. {
  247. _("Layer 30"), // Title
  248. ADR(29), // Address of optional parameter
  249. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  250. };
  251. static ColorButton Layer_31_Butt=
  252. {
  253. _("Layer 31"), // Title
  254. ADR(30), // Address of optional parameter
  255. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  256. };
  257. static ColorButton Layer_32_Butt=
  258. {
  259. _("Layer 32"), // Title
  260. ADR(31), // Address of optional parameter
  261. TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
  262. };
  263. static ButtonIndex Msg_Others_Items =
  264. {
  265. _( "Others" ), // Title
  266. 33 // Index to last bitmap button in group
  267. };
  268. static ColorButton Grid_Butt=
  269. {
  270. _("Grid"), // Title
  271. &g_GridColor, // Address of optional parameter
  272. FALSE,
  273. &g_ShowGrid // Address of boolean display control parameter to toggle
  274. };
  275. static ColorButton Show_DCodes_Butt=
  276. {
  277. _("D codes id."), // Title
  278. &g_DCodesColor, // Address of optional parameter
  279. FALSE,
  280. &DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle
  281. };
  282. static ColorButton * laytool_list[] = {
  283. &Layer_1_Butt,
  284. &Layer_2_Butt,
  285. &Layer_3_Butt,
  286. &Layer_4_Butt,
  287. &Layer_5_Butt,
  288. &Layer_6_Butt,
  289. &Layer_7_Butt,
  290. &Layer_8_Butt,
  291. &Layer_9_Butt,
  292. &Layer_10_Butt,
  293. &Layer_11_Butt,
  294. &Layer_12_Butt,
  295. &Layer_13_Butt,
  296. &Layer_14_Butt,
  297. &Layer_15_Butt,
  298. &Layer_16_Butt,
  299. &Layer_17_Butt,
  300. &Layer_18_Butt,
  301. &Layer_19_Butt,
  302. &Layer_20_Butt,
  303. &Layer_21_Butt,
  304. &Layer_22_Butt,
  305. &Layer_23_Butt,
  306. &Layer_24_Butt,
  307. &Layer_25_Butt,
  308. &Layer_26_Butt,
  309. &Layer_27_Butt,
  310. &Layer_28_Butt,
  311. &Layer_29_Butt,
  312. &Layer_30_Butt,
  313. &Layer_31_Butt,
  314. &Layer_32_Butt,
  315. &Grid_Butt,
  316. &Show_DCodes_Butt,
  317. };
  318. static ButtonIndex* laytool_index[BUTTON_GROUPS] = {
  319. &Msg_Layers_Cu,
  320. &Msg_Layers_Tech,
  321. &Msg_Others_Items
  322. };
  323. /**************************************************************/
  324. /* classe derivee pour la frame de Configuration des couleurs */
  325. /**************************************************************/
  326. class WinEDA_SetColorsFrame: public wxDialog
  327. {
  328. private:
  329. DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
  330. DECLARE_EVENT_TABLE()
  331. WinEDA_DrawFrame* m_Parent;
  332. wxBoxSizer* OuterBoxSizer;
  333. wxBoxSizer* MainBoxSizer;
  334. wxFlexGridSizer* FlexColumnBoxSizer;
  335. wxStaticText* Label;
  336. wxBoxSizer* RowBoxSizer;
  337. wxBitmapButton* BitmapButton;
  338. wxCheckBox* CheckBox;
  339. wxButton* Button;
  340. wxStaticLine* Line;
  341. wxStdDialogButtonSizer* StdDialogButtonSizer;
  342. // Creation
  343. bool Create( wxWindow* parent,
  344. wxWindowID id = SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME,
  345. const wxString& caption = SYMBOL_WINEDA_SETCOLORSFRAME_TITLE,
  346. const wxPoint& pos = wxDefaultPosition,
  347. const wxSize& size = wxDefaultSize,
  348. long style = SYMBOL_WINEDA_SETCOLORSFRAME_STYLE );
  349. // Initialises member variables
  350. void Init();
  351. // Creates the controls and sizers
  352. void CreateControls();
  353. wxBitmap GetBitmapResource( const wxString& name );
  354. wxIcon GetIconResource( const wxString& name );
  355. static bool ShowToolTips();
  356. void SetColor( wxCommandEvent& event );
  357. void OnOkClick( wxCommandEvent& event );
  358. void OnCancelClick( wxCommandEvent& event );
  359. void OnApplyClick( wxCommandEvent& event );
  360. void UpdateLayerSettings();
  361. void ResetDisplayLayersCu( wxCommandEvent& event );
  362. public:
  363. // Constructors and destructor
  364. WinEDA_SetColorsFrame();
  365. WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos );
  366. ~WinEDA_SetColorsFrame();
  367. };
  368. #endif
  369. // SET_COLOR_H