* Converting homemade plugins to FH7

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Converting homemade plugins to FH7

Post by shoshk » 12 Dec 2020 19:46

Hi all,

Just wanted to share...

Aside from changes in the new versions of lua and iup, I've discovered that changes to the GEDCOM structure also need to be taken into account.

For example, the structure for media objects (OBJE) has changed.

The following is code to add a media object for FH6

Code: Select all

--------------------------------------------------------------------------------
-- AddMedia
--------------------------------------------------------------------------------

function AddMedia(pMediaPath, pMediaName, pMediaTitle, pFormat, pKeys, pSource)

	ptrObje = fhCreateItem("OBJE")
	if ptrObje:IsNotNull() then
		local ptrTag = fhCreateItem("TITL",ptrObje,true)
		fhSetValueAsText(ptrTag, pMediaTitle)
		ptrTag = fhCreateItem("_FILE",ptrObje,true)
		fhSetValueAsText(ptrTag, pMediaPath..pMediaName..'.'..pFormat)
		ptrTag = fhCreateItem("FORM",ptrObje,true)
		fhSetValueAsText(ptrTag, pFormat)
		ptrTag = fhCreateItem("_KEYS",ptrObje,true)
		fhSetValueAsText(ptrTag, pKeys)
	end

	local ptrLink = fhNewItemPtr()
	ptrLink = fhCreateItem("OBJE",pSource,true)
	if ptrLink:IsNotNull() then
		fhSetValueAsLink(ptrLink,ptrObje)
	end

end
This is the new code for FH7

Code: Select all

--------------------------------------------------------------------------------
-- AddMedia
-- Changed 12 Dec 2020 to reflect changes to GEDCOM structure for 5.5.1
--------------------------------------------------------------------------------

function AddMedia(pMediaPath, pMediaName, pMediaTitle, pFormat, pKeys, pSource)

	local ptrObje = fhCreateItem("OBJE")
	if ptrObje:IsNotNull() then
		local ptrFile = fhCreateItem("FILE",ptrObje,true)
		fhSetValueAsText(ptrFile, pMediaPath..pMediaName..'.'..pFormat)
		local ptrTag = fhCreateItem("TITL",ptrFile,true)
		fhSetValueAsText(ptrTag, pMediaTitle)
		ptrTag = fhCreateItem("FORM",ptrFile,true)
		fhSetValueAsText(ptrTag, pFormat)
		ptrTag = fhCreateItem("_KEYS",ptrObje,true)
		fhSetValueAsText(ptrTag, pKeys)
	end

	local ptrLink = fhNewItemPtr()
	ptrLink = fhCreateItem("OBJE",pSource,true)
	if ptrLink:IsNotNull() then
		fhSetValueAsLink(ptrLink,ptrObje)
	end

end
Also, it seems that fhSetValueAsText still works with note fields. It's not necessary to use fhSetValueAsRichText if you are not adding/updating a note which does not use RichText features.

Regards,
Shosh
Shosh Kalson

User avatar
tatewise
Megastar
Posts: 27088
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Converting homemade plugins to FH7

Post by tatewise » 12 Dec 2020 20:55

Yes, excellent, that is all part of the change from GEDCOM 5.5 to GEDCOM 5.5.1.

Those are the things that plugin authors are having to update, and maintain v6 and v7 compatibility.
I hope that in due course all these will find there way into the Knowledge Base.

Other changes involve less used items such as Email _EMAIL => EMAIL and web _WEB => WWW and rich text, and a few other smaller differences.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ColeValleyGirl
Megastar
Posts: 4854
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Converting homemade plugins to FH7

Post by ColeValleyGirl » 13 Dec 2020 07:19

I'm working on the relevant KB article now -- post anything else that should be included here?

avatar
shoshk
Famous
Posts: 242
Joined: 13 May 2015 16:28
Family Historian: V7
Location: Mitzpe Jericho, Israel

Re: Converting homemade plugins to FH7

Post by shoshk » 13 Dec 2020 07:33

Is there a document which documents changes (if any) to Calico Pie's GEDCOM extensions?

Shosh
Shosh Kalson

User avatar
ColeValleyGirl
Megastar
Posts: 4854
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Re: Converting homemade plugins to FH7

Post by ColeValleyGirl » 13 Dec 2020 08:20

Shosh, not that I know of.

Post Reply