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.

375 lines
12 KiB

  1. /**********************************************************/
  2. /* Routines d'affichage de parametres et caracteristiques */
  3. /**********************************************************/
  4. #include "fctsys.h"
  5. #include "gr_basic.h"
  6. #include "common.h"
  7. #include "pcbnew.h"
  8. #include "autorout.h"
  9. #include "3d_struct.h"
  10. #include "protos.h"
  11. /* Routines locales */
  12. /*****************************************************************************/
  13. void Affiche_Infos_PCB_Texte(WinEDA_BasePcbFrame * frame, TEXTE_PCB* pt_texte)
  14. /*****************************************************************************/
  15. /* Affiche en bas d'ecran les caract du texte sur PCB
  16. Entree :
  17. pointeur de la description du texte
  18. */
  19. {
  20. wxString msg;
  21. frame->MsgPanel->EraseMsgBox();
  22. if ( pt_texte == NULL ) return;
  23. if( pt_texte->m_StructType == TYPECOTATION )
  24. Affiche_1_Parametre(frame, 1,_("COTATION"),pt_texte->m_Text, DARKGREEN);
  25. else
  26. Affiche_1_Parametre(frame, 1,_("PCB Text"),pt_texte->m_Text, DARKGREEN);
  27. Affiche_1_Parametre(frame, 28,_("Layer"),
  28. ReturnPcbLayerName(pt_texte->m_Layer),
  29. g_DesignSettings.m_LayerColor[pt_texte->m_Layer] & MASKCOLOR);
  30. Affiche_1_Parametre(frame, 36,_("Mirror"),wxEmptyString,GREEN) ;
  31. if( (pt_texte->m_Miroir & 1) )
  32. Affiche_1_Parametre(frame, -1,wxEmptyString,_("No"), DARKGREEN) ;
  33. else Affiche_1_Parametre(frame, -1,wxEmptyString,_("Yes"), DARKGREEN) ;
  34. msg.Printf( wxT("%.1f"),(float)pt_texte->m_Orient/10 );
  35. Affiche_1_Parametre(frame, 43,_("Orient"),msg, DARKGREEN) ;
  36. valeur_param(pt_texte->m_Width, msg) ;
  37. Affiche_1_Parametre(frame, 50,_("Width"),msg,MAGENTA) ;
  38. valeur_param(pt_texte->m_Size.x, msg) ;
  39. Affiche_1_Parametre(frame, 60, _("H Size"),msg,RED) ;
  40. valeur_param(pt_texte->m_Size.y, msg);
  41. Affiche_1_Parametre(frame, 70,_("V Size"),msg,RED) ;
  42. }
  43. /************************************************************************/
  44. void Affiche_Infos_E_Texte(WinEDA_BasePcbFrame * frame, MODULE* Module,
  45. TEXTE_MODULE* pt_texte)
  46. /************************************************************************/
  47. /* Affiche en bas d'ecran les caract du texte sur empreinte
  48. Entree :
  49. pointeur de description sur le module
  50. pointeur de la description du texte
  51. */
  52. {
  53. wxString text_type_msg[3] = {_("Ref."),_("Value"),_("Text")};
  54. wxString msg, Line;
  55. int ii;
  56. frame->MsgPanel->EraseMsgBox();
  57. Line = Module->m_Reference->m_Text;
  58. Affiche_1_Parametre(frame, 1, _("Module"), Line, DARKCYAN) ;
  59. Line = pt_texte->m_Text;
  60. Affiche_1_Parametre(frame, 10,_("Text"),Line,YELLOW) ;
  61. ii = pt_texte->m_Type; if (ii > 2) ii = 2;
  62. Affiche_1_Parametre(frame, 20,_("Type"),text_type_msg[ii], DARKGREEN) ;
  63. Affiche_1_Parametre(frame, 25,_("Display"),wxEmptyString, DARKGREEN);
  64. if(pt_texte->m_NoShow)
  65. Affiche_1_Parametre(frame, -1,wxEmptyString, _("No"), DARKGREEN);
  66. else Affiche_1_Parametre(frame, -1,wxEmptyString, _("Yes"), DARKGREEN);
  67. ii = pt_texte->m_Layer;
  68. if ( ii <= 28)
  69. Affiche_1_Parametre(frame, 28,_("Layer"),ReturnPcbLayerName(ii), DARKGREEN);
  70. else
  71. {
  72. msg.Printf( wxT("%d"), ii);
  73. Affiche_1_Parametre(frame, 28,_("Layer"), msg, DARKGREEN) ;
  74. }
  75. msg = wxT(" Yes");
  76. if( (pt_texte->m_Miroir & 1) ) msg = wxT(" No");
  77. Affiche_1_Parametre(frame, 36,_("Mirror"),msg, DARKGREEN) ;
  78. msg.Printf( wxT("%.1f"),(float)pt_texte->m_Orient / 10 );
  79. Affiche_1_Parametre(frame, 42,_("Orient"),msg, DARKGREEN) ;
  80. valeur_param(pt_texte->m_Width, msg) ;
  81. Affiche_1_Parametre(frame, 48,_("Width"),msg, DARKGREEN) ;
  82. valeur_param(pt_texte->m_Size.x,msg) ;
  83. Affiche_1_Parametre(frame, 56,_("H Size"),msg,RED) ;
  84. valeur_param(pt_texte->m_Size.y,msg);
  85. Affiche_1_Parametre(frame, 64,_("V Size"),msg,RED) ;
  86. }
  87. /*********************************************************************/
  88. void Affiche_Infos_Piste(WinEDA_BasePcbFrame * frame, TRACK * pt_piste)
  89. /********************************************************************/
  90. /* Affiche les caract principales d'un segment de piste en bas d'ecran
  91. */
  92. {
  93. wxString msg;
  94. int text_pos;
  95. frame->MsgPanel->EraseMsgBox();
  96. switch(pt_piste->m_StructType)
  97. {
  98. case TYPEVIA:
  99. msg = g_ViaType_Name[pt_piste->m_Shape & 255];
  100. break;
  101. case TYPETRACK:
  102. msg = _("Track") ;
  103. break;
  104. case TYPEZONE:
  105. msg = _("Zone"); break;
  106. default:
  107. msg = wxT("????"); break;
  108. }
  109. text_pos = 1;
  110. Affiche_1_Parametre(frame, text_pos,_("Type"),msg, DARKCYAN);
  111. /* Affiche NetName pour les segments de piste type cuivre */
  112. text_pos += 15;
  113. if( ( pt_piste->m_StructType == TYPETRACK ) ||
  114. ( pt_piste->m_StructType == TYPEZONE ) ||
  115. ( pt_piste->m_StructType == TYPEVIA ) )
  116. {
  117. EQUIPOT * equipot = GetEquipot( frame->m_Pcb, pt_piste->m_NetCode);
  118. if ( equipot )
  119. {
  120. msg = equipot->m_Netname;
  121. }
  122. else msg = wxT("<noname>");
  123. Affiche_1_Parametre(frame, text_pos,_("NetName"),msg,RED) ;
  124. /* Affiche net code :*/
  125. msg.Printf( wxT("%d .%d"),pt_piste->m_NetCode, pt_piste->m_Sous_Netcode);
  126. text_pos += 18;
  127. Affiche_1_Parametre(frame, text_pos,_("NetCode"),msg,RED) ;
  128. }
  129. else
  130. {
  131. Affiche_1_Parametre(frame, text_pos, _("Segment"),wxEmptyString,RED) ;
  132. if(pt_piste->m_Shape == S_CIRCLE)
  133. Affiche_1_Parametre(frame, -1,wxEmptyString,_("Circle"),RED) ;
  134. else Affiche_1_Parametre(frame, -1,wxEmptyString,_("Standard"),RED) ;
  135. }
  136. /* Affiche les flags Status piste */
  137. msg = wxT(". . ");
  138. if(pt_piste->GetState(SEGM_FIXE) ) msg[0] = 'F';
  139. if(pt_piste->GetState(SEGM_AR) ) msg[2] = 'A';
  140. text_pos = 42;
  141. Affiche_1_Parametre(frame, text_pos,_("Stat"), msg,MAGENTA);
  142. /* Affiche Layer(s) */
  143. if ( pt_piste->m_StructType == TYPEVIA)
  144. {
  145. SEGVIA * Via = (SEGVIA *) pt_piste;
  146. int top_layer, bottom_layer;
  147. Via->ReturnLayerPair(&top_layer, &bottom_layer);
  148. msg = ReturnPcbLayerName(top_layer, TRUE) + wxT("/") + ReturnPcbLayerName(bottom_layer, TRUE);
  149. }
  150. else msg = ReturnPcbLayerName(pt_piste->m_Layer);
  151. text_pos += 5;
  152. Affiche_1_Parametre(frame, text_pos, _("Layer"), msg, BROWN) ;
  153. /* Affiche Epaisseur */
  154. valeur_param((unsigned)(pt_piste->m_Width), msg) ;
  155. text_pos += 11;
  156. if (pt_piste->m_StructType == TYPEVIA ) // Display Diam and Drill values
  157. {
  158. Affiche_1_Parametre(frame, text_pos,_("Diam"), msg, DARKCYAN);
  159. int drill_value = (pt_piste->m_Drill >= 0 ) ?
  160. pt_piste->m_Drill : g_DesignSettings.m_ViaDrill;
  161. valeur_param((unsigned)drill_value, msg);
  162. text_pos += 8;
  163. wxString title = _("Drill");
  164. if ( g_DesignSettings.m_ViaDrill >= 0 ) title += wxT("*");
  165. Affiche_1_Parametre(frame, text_pos,_("Drill"),msg, RED);
  166. }
  167. else Affiche_1_Parametre(frame, text_pos,_("Width"),msg, DARKCYAN) ;
  168. }
  169. /************************************************************/
  170. void Affiche_Infos_DrawSegment(WinEDA_BasePcbFrame * frame,
  171. DRAWSEGMENT * DrawSegment)
  172. /************************************************************/
  173. /* Affiche les caract principales d'un segment type drawind PCB en bas d'ecran */
  174. {
  175. int itype;
  176. wxString msg;
  177. frame->MsgPanel->EraseMsgBox();
  178. itype = DrawSegment->m_Type & 0x0F;
  179. msg = wxT("DRAWING");
  180. if( DrawSegment->m_StructType == TYPECOTATION ) msg = wxT("COTATION");
  181. Affiche_1_Parametre(frame, 1,_("Type"),msg, DARKCYAN) ;
  182. Affiche_1_Parametre(frame, 16,_("Shape"),wxEmptyString,RED) ;
  183. if(DrawSegment->m_Shape == S_CIRCLE)
  184. Affiche_1_Parametre(frame, -1,wxEmptyString,_("Circle"),RED) ;
  185. else if (DrawSegment->m_Shape == S_ARC)
  186. {
  187. Affiche_1_Parametre(frame, -1,wxEmptyString, _(" Arc "),RED) ;
  188. msg.Printf( wxT("%d"),DrawSegment->m_Angle);
  189. Affiche_1_Parametre(frame, 32, wxT(" l.arc "), msg,RED) ;
  190. }
  191. else Affiche_1_Parametre(frame, -1, wxEmptyString, _("Segment"),RED) ;
  192. Affiche_1_Parametre(frame, 48, _("Layer"),ReturnPcbLayerName(DrawSegment->m_Layer),BROWN) ;
  193. /* Affiche Epaisseur */
  194. valeur_param((unsigned)(DrawSegment->m_Width), msg) ;
  195. Affiche_1_Parametre(frame, 60,_("Width"), msg, DARKCYAN) ;
  196. }
  197. /*****************************************************************************/
  198. void Affiche_Infos_Segment_Module(WinEDA_BasePcbFrame * frame,
  199. MODULE* Module,EDGE_MODULE* pt_edge)
  200. /*****************************************************************************/
  201. /* Affiche en bas d'ecran les caract du Segment contour d'un module
  202. Les parametres du module doivent etre a jour*/
  203. {
  204. wxString bufcar;
  205. if(Module == NULL) return;
  206. frame->MsgPanel->EraseMsgBox();
  207. Affiche_1_Parametre(frame, 1,_("Seg"),wxEmptyString, DARKCYAN) ;
  208. Affiche_1_Parametre(frame, 5 ,_("Module"),Module->m_Reference->m_Text, DARKCYAN) ;
  209. Affiche_1_Parametre(frame, 14,_("Value"),Module->m_Value->m_Text, BLUE) ;
  210. bufcar.Printf( wxT("%8.8lX"), Module->m_TimeStamp) ;
  211. Affiche_1_Parametre(frame, 24,_("TimeStamp"),bufcar,BROWN) ;
  212. Affiche_1_Parametre(frame, 34,_("Mod Layer"),ReturnPcbLayerName(Module->m_Layer),RED);
  213. Affiche_1_Parametre(frame, 44,_("Seg Layer"),
  214. ReturnPcbLayerName(Module->m_Layer),RED) ;
  215. valeur_param(pt_edge->m_Width,bufcar);
  216. Affiche_1_Parametre(frame, 54,_("Width"), bufcar,BLUE);
  217. }
  218. /*********************************************************/
  219. void Affiche_Infos_Status_Pcb(WinEDA_BasePcbFrame * frame)
  220. /*********************************************************/
  221. /* Affiche l'etat du PCB : nb de pads, nets , connexions.. */
  222. #define POS_AFF_NBPADS 1
  223. #define POS_AFF_NBVIAS 8
  224. #define POS_AFF_NBNODES 16
  225. #define POS_AFF_NBLINKS 24
  226. #define POS_AFF_NBNETS 32
  227. #define POS_AFF_NBCONNECT 40
  228. #define POS_AFF_NBNOCONNECT 48
  229. {
  230. int nb_vias = 0, ii;
  231. EDA_BaseStruct * Struct;
  232. wxString txt;
  233. frame->MsgPanel->EraseMsgBox();
  234. txt.Printf( wxT("%d"),frame->m_Pcb->m_NbPads);
  235. Affiche_1_Parametre(frame, POS_AFF_NBPADS,_("Pads"),txt, DARKGREEN) ;
  236. for( ii= 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Pnext)
  237. {
  238. ii++;
  239. if(Struct->m_StructType == TYPEVIA) nb_vias++ ;
  240. }
  241. txt.Printf( wxT("%d"),nb_vias);
  242. Affiche_1_Parametre(frame, POS_AFF_NBVIAS,_("Vias"),txt, DARKGREEN) ;
  243. txt.Printf( wxT("%d"),frame->m_Pcb->GetNumNodes() );
  244. Affiche_1_Parametre(frame, POS_AFF_NBNODES,_("Nodes"),txt, DARKCYAN) ;
  245. txt.Printf( wxT("%d"),frame->m_Pcb->m_NbLinks);
  246. Affiche_1_Parametre(frame, POS_AFF_NBLINKS,_("Links"),txt, DARKGREEN) ;
  247. txt.Printf( wxT("%d"),frame->m_Pcb->m_NbNets);
  248. Affiche_1_Parametre(frame, POS_AFF_NBNETS,_("Nets"),txt,RED) ;
  249. txt.Printf( wxT("%d"),frame->m_Pcb->m_NbLinks - frame->m_Pcb->GetNumNoconnect());
  250. Affiche_1_Parametre(frame, POS_AFF_NBCONNECT,_("Connect"),txt, DARKGREEN) ;
  251. txt.Printf( wxT("%d"),frame->m_Pcb->GetNumNoconnect());
  252. Affiche_1_Parametre(frame, POS_AFF_NBNOCONNECT,_("NoConn"),txt,BLUE) ;
  253. }
  254. /*******************************************************************/
  255. void Affiche_Infos_Equipot(int netcode, WinEDA_BasePcbFrame * frame)
  256. /*******************************************************************/
  257. /* Affiche les infos relatives a une equipot: nb de pads, nets , connexions.. */
  258. {
  259. int nb_vias = 0, ii;
  260. EDA_BaseStruct * Struct;
  261. wxString txt;
  262. MODULE * module;
  263. D_PAD * pad;
  264. EQUIPOT * equipot;
  265. frame->MsgPanel->EraseMsgBox();
  266. equipot = GetEquipot(frame->m_Pcb, netcode);
  267. if ( equipot )
  268. Affiche_1_Parametre(frame, 1,_("Net Name"),equipot->m_Netname,RED) ;
  269. else
  270. Affiche_1_Parametre(frame, 1,_("No Net (not connected)"), wxEmptyString, RED) ;
  271. txt.Printf( wxT("%d"), netcode);
  272. Affiche_1_Parametre(frame, 30,_("Net Code"),txt,RED) ;
  273. for ( ii = 0, module = frame->m_Pcb->m_Modules; module != 0;
  274. module = (MODULE*)module->Pnext)
  275. {
  276. for ( pad = module->m_Pads;pad != 0; pad = (D_PAD*) pad->Pnext)
  277. {
  278. if ( pad->m_NetCode == netcode ) ii++;
  279. }
  280. }
  281. txt.Printf( wxT("%d"),ii);
  282. Affiche_1_Parametre(frame, 40,_("Pads"),txt, DARKGREEN) ;
  283. for( ii= 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Pnext)
  284. {
  285. ii++;
  286. if( Struct->m_StructType == TYPEVIA )
  287. if ( ((SEGVIA*)Struct)->m_NetCode == netcode ) nb_vias++ ;
  288. }
  289. txt.Printf( wxT("%d"),nb_vias);
  290. Affiche_1_Parametre(frame, 50,_("Vias"),txt, BLUE) ;
  291. }