Le 20/06/2020 à 22:40, Jeff Young a écrit : > Some answers below: > >> On 20 Jun 2020, at 06:39, <[email protected] <mailto:[email protected]>> >> <[email protected] <mailto:[email protected]>> wrote: >> >> I wanted to add a feature to GerbView that relates to exporting a KiCad PCB >> file from loaded Gerbers. I often use "Export to PCBNew..." to recreate >> boards from Gerbers, and many of them involve Gerbers generated by Protel, >> the progenitor to Altium. Since Altium (and Protel) use specific file >> extensions for specfic layers, it's tedious to manually have to set each >> Gerber layer to the equivalent KiCad PCB layer. Every time I use "Export to >> PCBNew..." I keep thinking how handy it would be if GerbView could recognize >> the file extensions and offer to map them to the appropriate KiCad PCB >> layers. >> >> So, I've created a proof of concept that compiles into my local copy of >> GerbView, and I have a couple of questions: >> >> 1 - I made my changes directly in the file select_layers_to_pcb.cpp by >> adding a new member function to it. The new function is called from and >> used within "initDialog()". Is it preferable to create a whole new source >> file/object for containing the new function (or functions if more are >> needed), or is it okay to add it directly into this existing file? Or is >> this the sort of question best answered when someone is reviewing a >> submission? > > Add it directly. > >> >> 2 - In the KiCad source code, I see a lot of text using the macro "_" to >> provide string translations, but there are also cases where the "wxT" macro >> (which I don't believe handles translations) is used instead. Is there a >> rule of thumb for when to use "_", or is best to just always use it? > > The translation framework can only handle 7-bit ASCII. So any characters > above that must be broken out and used with the “wxT” macro (as well as > anything you don’t want translated, such as file tokens or the like). >
wxT creates wide char string. It is used to create/initialize wxStrings. It is now not mandatory for ASCII7 strings, but was needed for wxWidgets older than 3.0 >> >> 3 - The source files I've looked at seem to use "ii" as the default integer >> index in loops, versus the more traditional "i". Is this a KiCad thing, or >> something specific to whatever developer(s) worked in the code I've looked >> at? > > It’s pretty random over a larger sample of code. Use either. > I am the guy who use ii, jj ... in loops. This is a trick I learned a long time ago from a coworker: using ii, jj in loops allows you to easily find/replace all occurrences of these variables in a text editor, when needed. Good luck to find/replace occurrences of a variable named i or j ... >> >> 4 - The source files I've looked at only use the generic "int" as opposed to >> using more specific types such as "int32_t" or "int8_t". Is the use of >> "stdint.h" not allowed/not encouraged? > > I’ll let someone else field this. > > Cheers, > Jeff. -- Jean-Pierre CHARRAS _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

