Index: trunk/src/Makefile.in =================================================================== --- trunk/src/Makefile.in (revision 318) +++ trunk/src/Makefile.in (revision 319) @@ -173,6 +173,7 @@ pcblib_DATA= \ default_font \ + default.pcb \ gpcb-menu.res \ pcb-menu.res @@ -180,6 +181,7 @@ EXTRA_DIST= \ check_icon.data \ default_font \ + default.pcb \ hid/batch/hid.conf \ hid/bom/hid.conf \ hid/gcode/hid.conf \ @@ -249,6 +251,7 @@ install_: $(MKDIR) $(BINDIR) $(DATADIR) $(CPC) `pwd`/pcb $(BINDIR)/pcb + $(CPC) `pwd`/default.pcb $(DATADIR)/default.pcb $(CPC) `pwd`/default_font $(DATADIR)/default_font $(CPC) `pwd`/gpcb-menu.res $(DATADIR)/gpcb-menu.res $(CPC) `pwd`/pcb-menu.res $(DATADIR)/pcb-menu.res @@ -261,6 +264,8 @@ uninstall: $(RM) $(BINDIR)/pcb + $(RM) $(DATADIR)/default.pcb + $(RM) $(DATADIR)/default_font $(RM) $(DATADIR)/gpcb-menu.res $(RM) $(DATADIR)/pcb-menu.res Index: trunk/src/action.c =================================================================== --- trunk/src/action.c (revision 318) +++ trunk/src/action.c (revision 319) @@ -5986,7 +5986,7 @@ if (PCB->Changed && Settings.SaveInTMP) SaveInTMP (); RemovePCB (PCB); - PCB = CreateNewPCB (true); + PCB = CreateNewPCB (); PCB->Data->LayerN = DEF_LAYER; CreateNewPCBPost (PCB, 1); Index: trunk/src/buffer.c =================================================================== --- trunk/src/buffer.c (revision 318) +++ trunk/src/buffer.c (revision 319) @@ -1094,7 +1094,7 @@ bool LoadLayoutToBuffer (BufferTypePtr Buffer, char *Filename) { - PCBTypePtr newPCB = CreateNewPCB (false); + PCBTypePtr newPCB = CreateNewPCB (); /* new data isn't added to the undo list */ if (!ParsePCB (newPCB, Filename)) Index: trunk/src/create.c =================================================================== --- trunk/src/create.c (revision 318) +++ trunk/src/create.c (revision 319) @@ -144,7 +144,7 @@ * creates a new PCB */ PCBTypePtr -CreateNewPCB (bool SetDefaultNames) +CreateNewPCB_ (bool SetDefaultNames) { PCBTypePtr ptr; int i; @@ -214,6 +214,23 @@ return (ptr); } +PCBTypePtr +CreateNewPCB () +{ + PCBTypePtr old, nw; + + old = PCB; + + if ((LoadPCB(Settings.DefaultPcbFile) == 0) || (LoadPCB(PCB_DEFAULT_PCB_FILE_SRC) == 0)) + nw = PCB; + else + nw = NULL; + + PCB = old; + return nw; +} + + /* This post-processing step adds the top and bottom silk layers to a * pre-existing PCB. */ @@ -223,14 +240,6 @@ /* copy default settings */ pcb_colors_from_settings (pcb); - if (use_defaults) - { - if (ParseGroupString (Settings.Groups, &pcb->LayerGroups, DEF_LAYER)) - return 1; - - pcb->Data->Layer[component_silk_layer].Name = strdup ("silk"); - pcb->Data->Layer[solder_silk_layer].Name = strdup ("silk"); - } return 0; } Index: trunk/src/create.h =================================================================== --- trunk/src/create.h (revision 318) +++ trunk/src/create.h (revision 319) @@ -40,7 +40,8 @@ DataTypePtr CreateNewBuffer (void); void pcb_colors_from_settings (PCBTypePtr); -PCBTypePtr CreateNewPCB (bool); +PCBTypePtr CreateNewPCB_ (bool); +PCBTypePtr CreateNewPCB (); /* Called after PCB->Data->LayerN is set. Returns zero if no errors, else nonzero. */ int CreateNewPCBPost (PCBTypePtr, int /* set defaults */); Index: trunk/src/default.pcb =================================================================== --- trunk/src/default.pcb (nonexistent) +++ trunk/src/default.pcb (revision 319) @@ -0,0 +1,47 @@ +# release: pcb 20110918 + +# To read pcb files, the pcb version (or the git source date) must be >= the file version +FileVersion[20070407] + +PCB["" 600000 500000] + +Grid[2500.0 0 0 1] +Cursor[2500 62500 0.000000] +PolyArea[3100.006200] +Thermal[0.500000] +DRC[1200 900 1000 700 1500 1000] +Flags("nameonpcb,clearnew,snappin") +Groups("1,3,4,c:2,5,6,s:7:8") +Styles["Signal,1000,7874,3150,2000:Power,2000,8661,3937,2000:Fat,8000,13780,4724,2500:Sig-tight,1000,6400,3150,1200"] + +Attribute("PCB::grid::unit" "mil") +Layer(1 "component") +( +) +Layer(2 "solder") +( +) +Layer(3 "comp-GND") +( +) +Layer(4 "comp-power") +( +) +Layer(5 "sold-GND") +( +) +Layer(6 "sold-power") +( +) +Layer(7 "signal3") +( +) +Layer(8 "outline") +( +) +Layer(9 "silk") +( +) +Layer(10 "silk") +( +) Index: trunk/src/file.c =================================================================== --- trunk/src/file.c (revision 318) +++ trunk/src/file.c (revision 319) @@ -395,7 +395,7 @@ { const char *unit_suffix; char *new_filename; - PCBTypePtr newPCB = CreateNewPCB (false); + PCBTypePtr newPCB = CreateNewPCB_ (false); PCBTypePtr oldPCB; #ifdef DEBUG double elapsed; Index: trunk/src/global.h =================================================================== --- trunk/src/global.h (revision 318) +++ trunk/src/global.h (revision 319) @@ -667,6 +667,7 @@ char *DefaultLayerName[MAX_LAYER], *FontCommand, /* commands for file loading... */ *FileCommand, *PrintFile, *LibraryShell, *LibrarySearchPaths, *SaveCommand, *LibraryFilename, *FontFile, /* name of default font file */ + *DefaultPcbFile, *Groups, /* string with layergroups */ *Routes, /* string with route styles */ *FilePath, *RatPath, *RatCommand, *FontPath, *PinoutFont, *ElementPath, *Size, /* geometry string for size */ Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 318) +++ trunk/src/main.c (revision 319) @@ -978,88 +978,6 @@ ISET (BackupInterval, 60, "backup-interval", "Time between automatic backups in seconds. Set to 0 to disable"), -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-1 -Name of the 1st Layer. Default is @code{"top"}. -@end ftable -%end-doc -*/ - LAYERNAME (1, "top"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-2 -Name of the 2nd Layer. Default is @code{"ground"}. -@end ftable -%end-doc -*/ - LAYERNAME (2, "ground"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-3 -Name of the 3nd Layer. Default is @code{"signal2"}. -@end ftable -%end-doc -*/ - LAYERNAME (3, "signal2"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-4 -Name of the 4rd Layer. Default is @code{"signal3"}. -@end ftable -%end-doc -*/ - LAYERNAME (4, "signal3"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-5 -Name of the 5rd Layer. Default is @code{"power"}. -@end ftable -%end-doc -*/ - LAYERNAME (5, "power"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-6 -Name of the 6rd Layer. Default is @code{"bottom"}. -@end ftable -%end-doc -*/ - LAYERNAME (6, "bottom"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-7 -Name of the 7rd Layer. Default is @code{"outline"}. -@end ftable -%end-doc -*/ - LAYERNAME (7, "outline"), - -/* %start-doc options "4 Layer Names" -@ftable @code -@item --layer-name-8 -Name of the 8rd Layer. Default is @code{"spare"}. -@end ftable -%end-doc -*/ - LAYERNAME (8, "spare"), - -/* %start-doc options "1 General Options" -@ftable @code -@item --groups -Layer group string. Defaults to @code{"1,c:2:3:4:5:6,s:7:8"}. -@end ftable -%end-doc -*/ - SSET (Groups, "1,c:2:3:4:5:6,s:7:8", "groups", "Layer group string"), - - /* %start-doc options "6 Commands" pcb uses external commands for input output operations. These commands can be configured at start-up to meet local requirements. The command string may include @@ -1147,18 +1065,15 @@ SSET (FontFile, "default_font", "default-font", "File name of default font"), -/* %start-doc options "1 General Options" +/* %start-doc options "5 Paths" @ftable @code -@item --route-styles -A string that defines the route styles. Defaults to @* -@code{"Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000 - :Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600"} +@item --default-pcb +The name of the default font. @end ftable %end-doc */ - SSET (Routes, "Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000" - ":Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600", "route-styles", - "A string that defines the route styles"), + SSET (DefaultPcbFile, PCB_DEFAULT_PCB_FILE, "default-pcb", + "File name of default pcb file (layer and style settings)"), /* %start-doc options "5 Paths" @ftable @code @@ -1419,7 +1334,8 @@ Settings.MaxWidth = CLAMP (Settings.MaxWidth, MIN_SIZE, MAX_COORD); Settings.MaxHeight = CLAMP (Settings.MaxHeight, MIN_SIZE, MAX_COORD); - ParseRouteString (Settings.Routes, &Settings.RouteStyle[0], "cmil"); + if (Settings.Routes != NULL) + ParseRouteString (Settings.Routes, &Settings.RouteStyle[0], "cmil"); /* * Make sure we have settings for some various programs we may wish @@ -1770,9 +1686,13 @@ } /* Create a new PCB object in memory */ - PCB = CreateNewPCB (true); - PCB->Data->LayerN = DEF_LAYER; - ParseGroupString (Settings.Groups, &PCB->LayerGroups, DEF_LAYER); + PCB = CreateNewPCB (); + + if (PCB == NULL) { + Message("Can't load the default pcb (%s) for creating an empty layout\n", Settings.DefaultPcbFile); + exit(1); + } + /* Add silk layers to newly created PCB */ CreateNewPCBPost (PCB, 1); if (argc > 1)