The Scottish naming-system used to be fairly rigid. You do find departures from it - maybe a couple had become estranged from their parents, who knows, and didn't want to carry on their names - and if a child was illegitimate in the eyes of the "kirk", i.e. born less than 9 months after the marriage, it would usually be called after the father or mother rather than a grandparent.
But by and large, all else being equal, the 1st son was called after the father's father, the 2nd son after the mother's father, the 1st daughter after the mother's mother, the 2nd daughter after the father's mother ... then there was a bit of leeway. The names of the parents' own grandparents would be used, and if the father and/or mother of the baby had different first names from any of the above, subsequent children might be called after themselves, and if even more children arrived, the names of aunts and uncles could be drafted in. When all these family names had been used up, the names of in-laws and family friends could be employed.
My father's family were absolutely typical in this respect, and this is a 20th century family! My father was the youngest of 10 children, 8 boys and 2 girls. The eldest child was a boy, and was called James after his father's father. The 2nd son was called Robert after his mother's father. The eldest daughter was called Ann after her mother's mother. The 2nd daughter was called Margaret after her father's mother. My uncle Dave was called after his father's paternal grandfather and uncle Bill after his father's maternal grandfather. Uncle Alex was called after his mother's paternal grandfather and my uncle John after his mother's maternal grandfather. Uncle Adam was called after his father's uncle and/or brother, who were both Adam.
I think my dad must have been an afterthought, his parents both being well into their forties by the time he was born in 1911. I used to wonder why he was called after one of his uncles-by-marriage, a mere in-law, then I did some family-history research and discovered that my dad was born exactly a fortnight before his maternal aunt married professional golfer Henry Robert Duff from St. Andrews, so my granny probably thought her new brother-in-law's name would do for her 8th son, all the family names for boys being used up by then.
Harry