00001
00025 #include "register_functions.c"
00026 #include "indp.h"
00027
00028
00035 int
00036 indp_create_element ()
00037 {
00038 gdouble xmax;
00039 gdouble xmin;
00040 gdouble ymax;
00041 gdouble ymin;
00042 gdouble x_text;
00043 gdouble y_text;
00044 gdouble dx;
00045 gint pin_number;
00046 gchar *pin_pad_name = g_strdup ("");
00047 FlagType pad_flag;
00048 ElementTypePtr element;
00049
00050 if (!element)
00051 {
00052 if (verbose)
00053 {
00054 g_log ("", G_LOG_LEVEL_WARNING,
00055 _("could not create a valid element pointer for a %s package."),
00056 footprint_type);
00057 }
00058 return (EXIT_FAILURE);
00059 }
00060
00061
00062 element->MarkX = 0;
00063 element->MarkY = 0;
00064
00065
00066 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00067 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00068 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00069 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00070
00071
00072 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00073 {
00074 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00075 }
00076 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00077 {
00078 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00079 }
00080 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00081 {
00082 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00083 }
00084 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00085 {
00086 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00087 }
00088
00089 if (multiplier * (-courtyard_length / 2.0) < xmin)
00090 {
00091 xmin = multiplier * (-courtyard_length / 2.0);
00092 }
00093 if (multiplier * (courtyard_length / 2.0) > xmax)
00094 {
00095 xmax = multiplier * (courtyard_length / 2.0);
00096 }
00097 if (multiplier * (-courtyard_width / 2.0) < ymin)
00098 {
00099 ymin = multiplier * (-courtyard_width / 2.0);
00100 }
00101 if (multiplier * (courtyard_width / 2.0) > ymax)
00102 {
00103 ymax = multiplier * (courtyard_width / 2.0);
00104 }
00105
00106 element->Name[1].Scale = 100;
00107 element->Name[1].X = 0.0 ;
00108 element->Name[1].Y = (ymin - 10000.0);
00109 element->Name[1].TextString = footprint_name;
00110 element->Name[1].Element = element;
00111 element->Name[1].Direction = EAST;
00112 element->Name[1].ID = ID++;
00113
00114 element->Name[2].Scale = 100;
00115 element->Name[2].X = 0.0 ;
00116 element->Name[2].Y = (ymin - 10000.0);
00117 element->Name[2].TextString = footprint_refdes;
00118 element->Name[2].Element = element;
00119 element->Name[2].Direction = EAST;
00120 element->Name[2].ID = ID++;
00121
00122 element->Name[3].Scale = 100;
00123 element->Name[3].X = 0.0 ;
00124 element->Name[3].Y = (ymin - 10000.0);
00125 element->Name[3].TextString = footprint_value;
00126 element->Name[3].Element = element;
00127 element->Name[3].Direction = EAST;
00128 element->Name[3].ID = ID++;
00129
00130 if (pad_shapes_type == SQUARE)
00131 {
00132 pad_flag.f = SQUARE;
00133 }
00134 else
00135 {
00136 pad_flag.f = CLEAR;
00137 }
00138 if (pad_length > pad_width)
00139 {
00140
00141 create_new_pad
00142 (
00143 element,
00144 (int) (multiplier * ((pitch_x - pad_length + pad_width) / 2.0)),
00145 0,
00146 (int) (multiplier * ((pitch_x + pad_length - pad_width) / 2.0)),
00147 0,
00148 (int) (multiplier * pad_width),
00149 (int) (multiplier * pad_clearance),
00150 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00151 "",
00152 "2",
00153 pad_flag
00154 );
00155
00156 if (pin1_square)
00157 {
00158 pad_flag.f = SQUARE;
00159 }
00160
00161 create_new_pad
00162 (
00163 element,
00164 (int) (multiplier * ((-pitch_x - pad_length + pad_width) / 2.0)),
00165 0,
00166 (int) (multiplier * ((-pitch_x + pad_length - pad_width) / 2.0)),
00167 0,
00168 (int) (multiplier * pad_width),
00169 (int) (multiplier * pad_clearance),
00170 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00171 "",
00172 "1",
00173 pad_flag
00174 );
00175 }
00176 else
00177 {
00178
00179 create_new_pad
00180 (
00181 element,
00182 (int) (multiplier * (pitch_x / 2.0)),
00183 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00184 (int) (multiplier * (pitch_x / 2.0)),
00185 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00186 (int) (multiplier * pad_length),
00187 (int) (multiplier * pad_clearance),
00188 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00189 "",
00190 "2",
00191 pad_flag
00192 );
00193
00194 if (pin1_square)
00195 {
00196 pad_flag.f = SQUARE;
00197 }
00198
00199 create_new_pad
00200 (
00201 element,
00202 (int) (multiplier * (-pitch_x / 2.0)),
00203 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00204 (int) (multiplier * (-pitch_x / 2)),
00205 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00206 (int) (multiplier * pad_length),
00207 (int) (multiplier * pad_clearance),
00208 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00209 "",
00210 "1",
00211 pad_flag
00212 );
00213 }
00214
00215 if (silkscreen_package_outline && package_body_width)
00216 {
00217 if (pad_width >= package_body_width)
00218 {
00219 create_new_line
00220 (
00221 element,
00222 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00223 (int) (multiplier * (package_body_width / 2.0)),
00224 (int) (multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width)),
00225 (int) (multiplier * (package_body_width / 2.0)),
00226 (int) (multiplier * silkscreen_line_width)
00227 );
00228 create_new_line
00229 (
00230 element,
00231 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00232 (int) (multiplier * (-package_body_width / 2.0)),
00233 (int) (multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width)),
00234 (int) (multiplier * (-package_body_width / 2.0)),
00235 (int) (multiplier * silkscreen_line_width)
00236 );
00237 }
00238 else
00239 {
00240
00241 create_new_line
00242 (
00243 element,
00244 (int) (multiplier * (-package_body_length / 2.0)),
00245 (int) (multiplier * (package_body_width / 2.0)),
00246 (int) (multiplier * (package_body_length / 2.0)),
00247 (int) (multiplier * (package_body_width / 2.0)),
00248 (int) (multiplier * silkscreen_line_width)
00249 );
00250 create_new_line
00251 (
00252 element,
00253 (int) (multiplier * (-package_body_length / 2.0)),
00254 (int) (multiplier * (-package_body_width / 2.0)),
00255 (int) (multiplier * (package_body_length / 2.0)),
00256 (int) (multiplier * (-package_body_width / 2.0)),
00257 (int) (multiplier * silkscreen_line_width)
00258 );
00259
00260 create_new_line
00261 (
00262 element,
00263 (int) (multiplier * (-package_body_length / 2.0)),
00264 (int) (multiplier * (-package_body_width / 2.0)),
00265 (int) (multiplier * (-package_body_length / 2.0)),
00266 (int) (multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance)),
00267 (int) (multiplier * silkscreen_line_width)
00268 );
00269 create_new_line
00270 (
00271 element,
00272 (int) (multiplier * (-package_body_length / 2.0)),
00273 (int) (multiplier * (package_body_width / 2.0)),
00274 (int) (multiplier * (-package_body_length / 2.0)),
00275 (int) (multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance)),
00276 (int) (multiplier * silkscreen_line_width)
00277 );
00278 create_new_line
00279 (
00280 element,
00281 (int) (multiplier * (package_body_length / 2.0)),
00282 (int) (multiplier * (-package_body_width / 2.0)),
00283 (int) (multiplier * (package_body_length / 2.0)),
00284 (int) (multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance)),
00285 (int) (multiplier * silkscreen_line_width)
00286 );
00287 create_new_line
00288 (
00289 element,
00290 (int) (multiplier * (package_body_length / 2.0)),
00291 (int) (multiplier * (package_body_width / 2.0)),
00292 (int) (multiplier * (package_body_length / 2.0)),
00293 (int) (multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance)),
00294 (int) (multiplier * silkscreen_line_width)
00295 );
00296 }
00297 }
00298
00299 if (silkscreen_indicate_1)
00300 {
00301 if (pad_width >= package_body_width)
00302 {
00303 create_new_line
00304 (
00305 element,
00306 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00307 (int) (multiplier * (-package_body_width / 2.0)),
00308 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00309 (int) (multiplier * (package_body_width / 2.0)),
00310 (int) (multiplier * silkscreen_line_width)
00311 );
00312 }
00313 else
00314 {
00315 create_new_arc
00316 (
00317 element,
00318 (int) (multiplier * (((-package_body_length) / 2.0) - 2 * silkscreen_line_width)),
00319 (int) (multiplier * (-package_body_width / 2.0)),
00320 (int) (multiplier * 0.5 * silkscreen_line_width),
00321 (int) (multiplier * 0.5 * silkscreen_line_width),
00322 0,
00323 360,
00324 (int) (multiplier * silkscreen_line_width)
00325 );
00326 }
00327 }
00328
00329 if (courtyard)
00330 {
00331 create_new_line
00332 (
00333 element,
00334 (int) (xmin),
00335 (int) (ymin),
00336 (int) (xmin),
00337 (int) (ymax),
00338 (int) (multiplier * courtyard_line_width)
00339 );
00340 create_new_line
00341 (
00342 element,
00343 (int) (xmax),
00344 (int) (ymin),
00345 (int) (xmax),
00346 (int) (ymax),
00347 (int) (multiplier * courtyard_line_width)
00348 );
00349 create_new_line
00350 (
00351 element,
00352 (int) (xmin),
00353 (int) (ymin),
00354 (int) (xmax),
00355 (int) (ymin),
00356 (int) (multiplier * courtyard_line_width)
00357 );
00358 create_new_line
00359 (
00360 element,
00361 (int) (xmax),
00362 (int) (ymax),
00363 (int) (xmin),
00364 (int) (ymax),
00365 (int) (multiplier * courtyard_line_width)
00366 );
00367 }
00368
00369 if (attributes_in_footprint)
00370 {
00371 element = create_attributes_in_element (element);
00372 }
00373
00374 if (verbose)
00375 {
00376 g_log ("", G_LOG_LEVEL_INFO,
00377 _("created an element for a %s package: %s."),
00378 footprint_type,
00379 footprint_filename);
00380 }
00381 current_element = (ElementTypePtr) &element;
00382 return (EXIT_SUCCESS);
00383 }
00384
00385
00395 int
00396 indp_create_packages_list ()
00397 {
00398 g_list_free (packages_list);
00399 packages_list = g_list_append (packages_list, "INDP");
00400 return (EXIT_SUCCESS);
00401 }
00402
00403
00427 int
00428 indp_drc ()
00429 {
00430 int result = EXIT_SUCCESS;
00431 if (verbose)
00432 {
00433 g_log ("", G_LOG_LEVEL_INFO,
00434 (_("[%s] DRC Check: checking package %s.")),
00435 footprint_type, footprint_name);
00436 }
00437
00438 if (number_of_pins != 2)
00439 {
00440 if (verbose)
00441 {
00442 g_log ("", G_LOG_LEVEL_WARNING,
00443 (_("[%s] DRC Error: check for number of pins/pads <> 2.")),
00444 footprint_type);
00445 }
00446 result = EXIT_FAILURE;
00447 }
00448
00449 switch (pad_shapes_type)
00450 {
00451 case NO_SHAPE:
00452 {
00453 if (verbose)
00454 {
00455 g_log ("", G_LOG_LEVEL_WARNING,
00456 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00457 footprint_type);
00458 }
00459 result = EXIT_FAILURE;
00460 break;
00461 }
00462 case ROUND:
00463 {
00464 if (verbose)
00465 {
00466 g_log ("", G_LOG_LEVEL_WARNING,
00467 (_("[%s] DRC Error: circular pad shape specified for check for allowed pad shapes.")),
00468 footprint_type);
00469 }
00470 result = EXIT_FAILURE;
00471 break;
00472 }
00473 case SQUARE:
00474 {
00475 break;
00476 }
00477 case OCTAGONAL:
00478 {
00479 if (verbose)
00480 {
00481 g_log ("", G_LOG_LEVEL_WARNING,
00482 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00483 footprint_type);
00484 }
00485 result = EXIT_FAILURE;
00486 break;
00487 }
00488 case ROUND_ELONGATED:
00489 {
00490 break;
00491 }
00492 default:
00493 {
00494 if (verbose)
00495 {
00496 g_log ("", G_LOG_LEVEL_WARNING,
00497 (_("[%s] DRC Error: no valid pad shape type specified.")),
00498 footprint_type);
00499 }
00500 result = EXIT_FAILURE;
00501 break;
00502 }
00503 }
00504
00505 if (package_body_length <= 0.0)
00506 {
00507 if (verbose)
00508 {
00509 g_log ("", G_LOG_LEVEL_WARNING,
00510 (_("[%s] DRC Error: specified package body length is too small.")),
00511 footprint_type);
00512 }
00513 result = EXIT_FAILURE;
00514 }
00515 if (package_body_width <= 0.0)
00516 {
00517 if (verbose)
00518 {
00519 g_log ("", G_LOG_LEVEL_WARNING,
00520 (_("[%s] DRC Error: specified package body width is too small.")),
00521 footprint_type);
00522 }
00523 result = EXIT_FAILURE;
00524 }
00525 if (package_body_height <= 0.0)
00526 {
00527 if (verbose)
00528 {
00529 g_log ("", G_LOG_LEVEL_WARNING,
00530 (_("[%s] DRC Error: specified package body height is too small.")),
00531 footprint_type);
00532 }
00533 result = EXIT_FAILURE;
00534 }
00535
00536 if (courtyard_length <= 0.0)
00537 {
00538 if (verbose)
00539 {
00540 g_log ("", G_LOG_LEVEL_WARNING,
00541 (_("[%s] DRC Error: specified courtyard length is too small.")),
00542 footprint_type);
00543 }
00544 result = EXIT_FAILURE;
00545 }
00546 if (courtyard_width <= 0.0)
00547 {
00548 if (verbose)
00549 {
00550 g_log ("", G_LOG_LEVEL_WARNING,
00551 (_("[%s] DRC Error: specified courtyard width is too small.")),
00552 footprint_type);
00553 }
00554 return (EXIT_FAILURE);
00555 }
00556
00557 if (pitch_x - pad_length < pad_clearance)
00558 {
00559 if (verbose)
00560 {
00561 g_log ("", G_LOG_LEVEL_WARNING,
00562 (_("[%s] DRC Error: minimum clearance between copper (X-direction) is too small.")),
00563 footprint_type);
00564 }
00565 result = EXIT_FAILURE;
00566 }
00567
00568 if (pitch_y - pad_width < pad_clearance)
00569 {
00570 if (verbose)
00571 {
00572 g_log ("", G_LOG_LEVEL_WARNING,
00573 (_("[%s] DRC Error: minimum clearance between copper (Y-direction) is too small.")),
00574 footprint_type);
00575 }
00576 result = EXIT_FAILURE;
00577 }
00578
00579 if (fiducial)
00580 {
00581 if (verbose)
00582 {
00583 g_log ("", G_LOG_LEVEL_WARNING,
00584 (_("[%s] DRC Error: package should not have any fiducials.")),
00585 footprint_type);
00586 }
00587 result = EXIT_FAILURE;
00588 }
00589
00590
00591 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00592 {
00593 if (verbose)
00594 {
00595 g_log ("", G_LOG_LEVEL_WARNING,
00596 (_("[%s] DRC Error: clearance of the package length with regard to the courtyard dimensions is too small.")),
00597 footprint_type);
00598 }
00599 result = EXIT_FAILURE;
00600 }
00601
00602
00603 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00604 {
00605 if (verbose)
00606 {
00607 g_log ("", G_LOG_LEVEL_WARNING,
00608 (_("[%s] DRC Error: clearance of the package width with regard to the courtyard dimensions is too small.")),
00609 footprint_type);
00610 }
00611 result = EXIT_FAILURE;
00612 }
00618
00619 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00620 {
00621 if (verbose)
00622 {
00623 g_log ("", G_LOG_LEVEL_WARNING,
00624 (_("[%s] DRC Error: silkscreen line width is too small.")),
00625 footprint_type);
00626 }
00627 result = EXIT_FAILURE;
00628 }
00629 switch (units_type)
00630 {
00631 case NO_UNITS:
00632 {
00633 if (verbose)
00634 {
00635 g_log ("", G_LOG_LEVEL_WARNING,
00636 (_("[%s] DRC Error: no units specified.")),
00637 footprint_type);
00638 }
00639 result = EXIT_FAILURE;
00640 break;
00641 }
00642 case MIL:
00643 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00644 {
00645 if (verbose)
00646 {
00647 g_log ("", G_LOG_LEVEL_WARNING,
00648 (_("[%s] DRC Error: silkscreen line width too wide.")),
00649 footprint_type);
00650 }
00651 result = EXIT_FAILURE;
00652 break;
00653 }
00654 case MIL_100:
00655 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00656 {
00657 if (verbose)
00658 {
00659 g_log ("", G_LOG_LEVEL_WARNING,
00660 (_("[%s] DRC Error: silkscreen line width too wide.")),
00661 footprint_type);
00662 }
00663 result = EXIT_FAILURE;
00664 break;
00665 }
00666 case MM:
00667 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00668 {
00669 if (verbose)
00670 {
00671 g_log ("", G_LOG_LEVEL_WARNING,
00672 (_("[%s] DRC Error: silkscreen line width too wide.")),
00673 footprint_type);
00674 }
00675 result = EXIT_FAILURE;
00676 break;
00677 }
00678 default:
00679 {
00680 if (verbose)
00681 {
00682 g_log ("", G_LOG_LEVEL_WARNING,
00683 (_("[%s] DRC Error: no valid units type specified.")),
00684 footprint_type);
00685 }
00686 result = EXIT_FAILURE;
00687 break;
00688 }
00689 }
00690
00691 if (verbose && (result == EXIT_SUCCESS))
00692 {
00693 g_log ("", G_LOG_LEVEL_INFO,
00694 (_("[%s] DRC Check: no errors while checking package %s.")),
00695 footprint_type, footprint_name);
00696 }
00697 return result;
00698 }
00699
00700
00714 int
00715 indp_get_default_footprint_values ()
00716 {
00717 if (!strcmp (footprint_name, "?INDP"))
00718 {
00719 footprint_units = g_strdup ("mm");
00720 package_body_length = 0.0;
00721 package_body_width = 0.0;
00722 package_body_height = 0.0;
00723 package_is_radial = FALSE;
00724 number_of_pins = 2;
00725 number_of_columns = 0;
00726 number_of_rows = 0;
00727 count_x = 0;
00728 count_y = 0;
00729 pitch_x = 0.0;
00730 pitch_y = 0.0;
00731 pad_length = 0.0;
00732 pad_width = 0.0;
00733 pad_shape = g_strdup ("rectangular pad");
00734 pad_shapes_type = SQUARE;
00735 thermal = FALSE;
00736 thermal_length = 0.0;
00737 thermal_width = 0.0;
00738 silkscreen_package_outline = FALSE;
00739 silkscreen_length = 0.0;
00740 silkscreen_width = 0.0;
00741 silkscreen_line_width = 0.20;
00742 courtyard_length = 0.0;
00743 courtyard_width = 0.0;
00744 courtyard_line_width = 0.05;
00745 g_free (footprint_name);
00746 footprint_name = g_strdup ("INDP");
00747 return (EXIT_SUCCESS);
00748 }
00749 else
00750 {
00751 if (verbose)
00752 {
00753 g_log ("", G_LOG_LEVEL_WARNING,
00754 _("default values for footprint %s not found.\n"),
00755 footprint_name);
00756 }
00757 return (EXIT_FAILURE);
00758 }
00759 }
00760
00761
00769 #if GUI
00770 int
00771 indp_set_gui_constraints ()
00772 {
00773
00774 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00775 "package_is_radial_checkbutton");
00776 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00777 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00778
00779
00780 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00781 "number_of_columns_entry");
00782 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "2");
00783 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00784 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00785 "number_of_rows_entry");
00786 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "1");
00787 gtk_widget_set_sensitive (number_of_rows_entry, FALSE);
00788 GtkWidget *pitch_y_entry = lookup_widget (GTK_WIDGET (widget),
00789 "pitch_y_entry");
00790 gtk_entry_set_text (GTK_ENTRY (pitch_y_entry), "");
00791 gtk_widget_set_sensitive (pitch_y_entry, FALSE);
00792 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00793 "count_x_entry");
00794 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00795 gtk_widget_set_sensitive (count_x_entry, FALSE);
00796 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00797 "count_y_entry");
00798 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00799 gtk_widget_set_sensitive (count_y_entry, FALSE);
00800 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00801 "number_1_position_entry");
00802 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
00803 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00804
00805
00806 gui_constraints_disable_thermal_tab_widgets (widget);
00807
00808
00809 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00810 return (EXIT_SUCCESS);
00811 }
00812 #endif
00813
00814
00821 int
00822 indp_write_footprint ()
00823 {
00824 gdouble xmax;
00825 gdouble xmin;
00826 gdouble ymax;
00827 gdouble ymin;
00828 gdouble x_text;
00829 gdouble y_text;
00830 gchar *pin_pad_flags = g_strdup ("");
00831
00832
00833 fp = fopen (footprint_filename, "w");
00834 if (!fp)
00835 {
00836 if (verbose)
00837 {
00838 g_log ("", G_LOG_LEVEL_WARNING,
00839 _("could not open file for %s footprint: %s."),
00840 footprint_type, footprint_filename);
00841 }
00842 fclose (fp);
00843 return (EXIT_FAILURE);
00844 }
00845
00846 if (license_in_footprint)
00847 {
00848 write_license ();
00849 }
00850
00851
00852 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00853 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00854 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00855 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00856
00857
00858 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00859 {
00860 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00861 }
00862 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00863 {
00864 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00865 }
00866 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00867 {
00868 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00869 }
00870 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00871 {
00872 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00873 }
00874
00875 if (multiplier * (-courtyard_length / 2.0) < xmin)
00876 {
00877 xmin = multiplier * (-courtyard_length / 2.0);
00878 }
00879 if (multiplier * (courtyard_length / 2.0) > xmax)
00880 {
00881 xmax = multiplier * (courtyard_length / 2.0);
00882 }
00883 if (multiplier * (-courtyard_width / 2.0) < ymin)
00884 {
00885 ymin = multiplier * (-courtyard_width / 2.0);
00886 }
00887 if (multiplier * (courtyard_width / 2.0) > ymax)
00888 {
00889 ymax = multiplier * (courtyard_width / 2.0);
00890 }
00891
00892
00893 x_text = 0.0 ;
00894 y_text = (ymin - 10000.0);
00895 write_element_header (x_text, y_text);
00896
00897 if (!strcmp (pad_shape, "rectangular pad"))
00898 {
00899 pin_pad_flags = g_strdup ("square");
00900 }
00901 if (pad_length > pad_width)
00902 {
00903
00904 write_pad
00905 (
00906 1,
00907 "P",
00908 multiplier * ((-pitch_x - pad_length + pad_width) / 2.0),
00909 0,
00910 multiplier * ((-pitch_x + pad_length - pad_width) / 2.0),
00911 0,
00912 multiplier * pad_width,
00913 multiplier * pad_clearance,
00914 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00915
00916 (pin1_square) ? "square" : pin_pad_flags
00917 );
00918
00919 write_pad
00920 (
00921 2,
00922 "N",
00923 multiplier * ((pitch_x - pad_length + pad_width) / 2.0),
00924 0,
00925 multiplier * ((pitch_x + pad_length - pad_width) / 2.0),
00926 0,
00927 multiplier * pad_width,
00928 multiplier * pad_clearance,
00929 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00930 pin_pad_flags
00931 );
00932 }
00933 else
00934 {
00935
00936 write_pad
00937 (
00938 1,
00939 "P",
00940 multiplier * (-pitch_x / 2.0),
00941 multiplier * ((pad_width - pad_length) / 2.0),
00942 multiplier * (-pitch_x / 2),
00943 multiplier * ((-pad_width + pad_length) / 2.0),
00944 multiplier * pad_length,
00945 multiplier * pad_clearance,
00946 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00947
00948 (pin1_square) ? "square" : pin_pad_flags
00949 );
00950
00951 write_pad
00952 (
00953 2,
00954 "N",
00955 multiplier * (pitch_x / 2.0),
00956 multiplier * ((pad_width - pad_length) / 2.0),
00957 multiplier * (pitch_x / 2.0),
00958 multiplier * ((-pad_width + pad_length) / 2.0),
00959 multiplier * pad_length,
00960 multiplier * pad_clearance,
00961 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00962 pin_pad_flags
00963 );
00964 }
00965
00966 if (silkscreen_package_outline && package_body_width)
00967 {
00968 fprintf (fp, "# Write a package body on the silkscreen\n");
00969 if (pad_width >= package_body_width)
00970 {
00971 write_element_line
00972 (
00973 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00974 multiplier * (package_body_width / 2.0),
00975 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00976 multiplier * (package_body_width / 2.0),
00977 multiplier * silkscreen_line_width
00978 );
00979 write_element_line
00980 (
00981 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00982 multiplier * (-package_body_width / 2.0),
00983 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00984 multiplier * (-package_body_width / 2.0),
00985 multiplier * silkscreen_line_width
00986 );
00987 }
00988 else
00989 {
00990
00991 write_element_line
00992 (
00993 multiplier * (-package_body_length / 2.0),
00994 multiplier * (package_body_width / 2.0),
00995 multiplier * (package_body_length / 2.0),
00996 multiplier * (package_body_width / 2.0),
00997 multiplier * silkscreen_line_width
00998 );
00999 write_element_line
01000 (
01001 multiplier * (-package_body_length / 2.0),
01002 multiplier * (-package_body_width / 2.0),
01003 multiplier * (package_body_length / 2.0),
01004 multiplier * (-package_body_width / 2.0),
01005 multiplier * silkscreen_line_width
01006 );
01007
01008 write_element_line
01009 (
01010 multiplier * (-package_body_length / 2.0),
01011 multiplier * (-package_body_width / 2.0),
01012 multiplier * (-package_body_length / 2.0),
01013 multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance),
01014 multiplier * silkscreen_line_width
01015 );
01016 write_element_line
01017 (
01018 multiplier * (-package_body_length / 2.0),
01019 multiplier * (package_body_width / 2.0),
01020 multiplier * (-package_body_length / 2.0),
01021 multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance),
01022 multiplier * silkscreen_line_width
01023 );
01024 write_element_line
01025 (
01026 multiplier * (package_body_length / 2.0),
01027 multiplier * (-package_body_width / 2.0),
01028 multiplier * (package_body_length / 2.0),
01029 multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance),
01030 multiplier * silkscreen_line_width
01031 );
01032 write_element_line
01033 (
01034 multiplier * (package_body_length / 2.0),
01035 multiplier * (package_body_width / 2.0),
01036 multiplier * (package_body_length / 2.0),
01037 multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance),
01038 multiplier * silkscreen_line_width
01039 );
01040 }
01041 }
01042
01043 if (silkscreen_indicate_1)
01044 {
01045 fprintf (fp, "# Write a pin 1 marker on the silkscreen\n");
01046 if (pad_width >= package_body_width)
01047 {
01048 write_element_line
01049 (
01050 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01051 multiplier * (-package_body_width / 2.0),
01052 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01053 multiplier * (package_body_width / 2.0),
01054 multiplier * silkscreen_line_width
01055 );
01056 }
01057 else
01058 {
01059 write_element_arc
01060 (
01061 multiplier * (((-package_body_length) / 2.0) - 2 * silkscreen_line_width),
01062 multiplier * (-package_body_width / 2.0),
01063 multiplier * 0.5 * silkscreen_line_width,
01064 multiplier * 0.5 * silkscreen_line_width,
01065 0,
01066 360,
01067 multiplier * silkscreen_line_width
01068 );
01069 }
01070 }
01071
01072 if (courtyard)
01073 {
01074 fprintf (fp, "# Write a courtyard on the silkscreen\n");
01075 write_rectangle
01076 (
01077 xmin,
01078 ymin,
01079 xmax,
01080 ymax,
01081 multiplier * courtyard_line_width
01082 );
01083 }
01084
01085 if (attributes_in_footprint)
01086 {
01087 write_attributes ();
01088 }
01089
01090 fprintf (fp, "\n");
01091 fprintf (fp, ")\n");
01092 fclose (fp);
01093
01094 if (verbose)
01095 {
01096 g_log ("", G_LOG_LEVEL_INFO,
01097 _("wrote a footprint for a %s package: %s."),
01098 footprint_type,
01099 footprint_filename);
01100 }
01101 return (EXIT_SUCCESS);
01102 }
01103
01104
01108 static fpw_function_t
01109 indp_function_list[] =
01110 {
01111 #if GUI
01112 {
01113 "Set GUI constraints",
01114 indp_set_gui_constraints,
01115 "Set GUI constraints for an INDP package",
01116 NULL
01117 },
01118 #endif
01119 {
01120 "Create Element",
01121 indp_create_element,
01122 "Create a pcb element for an INDP package",
01123 NULL
01124 },
01125 {
01126 "Create Packages List",
01127 indp_create_packages_list,
01128 "Create a list of known INDP packages",
01129 NULL
01130 },
01131 {
01132 "DRC INDP Element",
01133 indp_drc,
01134 "Design Rule Check for an INDP package",
01135 NULL
01136 },
01137 {
01138 "Default Element Values",
01139 indp_get_default_footprint_values,
01140 "Get default values for an INDP package",
01141 NULL
01142 },
01143 {
01144 "Write footprint",
01145 indp_write_footprint,
01146 "Write a footprint for an INDP package",
01147 NULL
01148 }
01149 };
01150
01151
01155 REGISTER_FUNCTIONS (indp_function_list)
01156
01157
01158
01161 void
01162 indp_init ()
01163 {
01164 register_indp_function_list ();
01165 }
01166
01167
01168