* how to

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
justone
Diamond
Posts: 82
Joined: 05 Mar 2006 14:42
Family Historian: None

how to

Post by justone » 07 Feb 2013 17:50

Is there a way to use any of the common LUA IDEs instead of the internal editor?

Sort of 'define editor internal/external'
or perhaps in a way that external ones could load the FHapi things ?

Working without syntax highlighting and other common features IDEs do offer isn't that advanced.

ID:6745

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

how to

Post by Jane » 07 Feb 2013 23:12

Personally I tend to work in the FH editor, as I prefer the live debug options, but if you need the help you can open the fh_lua files in any of the other editors, most allow additional definitions for Lua functions, so it's just a case of creating a function module in Lua defining the fh functions and objects, although I have not found it necessary for the work I have done so far.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
justone
Diamond
Posts: 82
Joined: 05 Mar 2006 14:42
Family Historian: None

how to

Post by justone » 08 Feb 2013 07:52

Hi Jane,

yes sort of a fh functions module. I know how to do that.

What I do miss is a way to involke FH.exe from the commandline with the parameters:
- load given project
- raise LUA editor with given .lua loaded
sort of FH.exe -project -luafile

or

The ability to work like most programs nowadays, which do check file modifications done outside themselves. Ultraedit for example always asks you if you want to reload a currently opened document if that was modified external.
This would be ideal for the internal editor, since one could load the same lua source into let's say ZeroBraneStudio and each time one modifies it in there, the FH editor would ask if one wants to reload it, before doing a debugger run. And vice versa the IDE would moan if one modified it within the internal editor.

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

how to

Post by Jane » 08 Feb 2013 08:14

I have suggested the following to Calico

Detect changes to the source, as it does for the gedcom file, when focus returns. Which would allow you to edit outside.


Loading FH to run a plugin would be more complex I suspect as it already expects a gedcom file as it's parameter, personally I think the spot changes option it probably simpler.

Don't forget you can add any plugin to the menu, so if you added the one you were working on to the menu you can just save the plugin and switch to fh and run the plugin from the menu.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
justone
Diamond
Posts: 82
Joined: 05 Mar 2006 14:42
Family Historian: None

how to

Post by justone » 09 Feb 2013 12:29

Hi Jane stumbled across some more issues, so I think I better wait until some more skilled ones like you or tatewise release more plugins to see how things could be done.

What I wanted to do is as following.
I played within ZeroBraneStudio with wx and turtle grphics and thought, mate what a good idea to build some sort of a timeliner which does show all INDIs matching a given surname by having a window dimension going from earliest date to last date found in these INDI records, plotting lines matching their lifespan + plotting a name underneath each line.

Within ZeroBraneStudio this works quite well, while not having access to the FH parts so I had to cheat with data to check if it works in general.

If I code from within the FH editor using require 'wx' plus placing the wx.dll into d:programdata...Plugins it also works untill
a) FH freezes or
b) until I close the turtle graphics windows the plugin opened, since that closes the whole FH after it gets closed.

I haven't looked at all plugin sources, but do you know of one dealing with 'wx' so I could learn by looking at the code?
I must also admit I haven' digged to much into iuplua if that would allow a graphics window like wx.

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

how to

Post by Jane » 09 Feb 2013 15:55

WX is not part of the Lua shipped with FH, so you will need to bundle all the dlls and module codes into your plugin folder.

Crashes normally mean you are not correctly enabling the dlls etc for the module or not closing them down correctly when complete.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

avatar
justone
Diamond
Posts: 82
Joined: 05 Mar 2006 14:42
Family Historian: None

how to

Post by justone » 09 Feb 2013 21:11

Yep, found out by now that I might be able to archive what I want using iuplua_pplot instead of wx.

but now I'm stuck at the most common unexplained part of FH, which is DATES.

I spent now more but an hour to get the sense of datepoints, dates an so on, but I'm lost. Perhaps Simon should rethink his examples and spent more time into explaining this section.

I wanted to read in the bithyear from an INDI record and stick this to a table as an integer value. STOP. Don't deliver the answer,that's too easy (Jane / tatewise).

I explain what I got, where I looked and perhaps you could point out what I missed to look at, or what I should think about. Since otherwise theres no learning for me.

I started similar to sample plugin scripts, list all individuals using.....

Since I only needed surname, given + bithyear + deatyear I of course used something similar to
tblINDI[count].surname = fhGetItemText(ptrName,'~:SURNAME')
but with dates I'm lost since
fhGetItemPtr(ptrName,'~.BIRT.DATE') returns a pointer
GetYear() returns an integer from a DatePoint
now I scrolled the API up and down to find something on how to get a DatePoint from a Pointer of a Date, with no luck.

I even tried wierd things such as
ptrDate:MoveTo(ptrName,'~:BIRT.DATE')
dtDate = fhGetValueAsDate(ptrDate)
tblINDI[count].birtyear = dtDate:GetYear()
also without any luck

now I'm somewhat lost since dp, dt, ptr ... sigh.
If you got to GetYear() and read the explanation in the API is says 'Returns the year from a datepoint'
if you then go to the functions index to see which functions have a dp being an argument or a return value, you find none at all.

This is where I need a hint.

avatar
justone
Diamond
Posts: 82
Joined: 05 Mar 2006 14:42
Family Historian: None

how to

Post by justone » 09 Feb 2013 21:34

Oh dear ;-)
Solved it.
'~:BIRT.DATE' can't work since it must say
'~.BIRT.DATE'

and I knew why I dislike coding in editors without syntax highlighting and keyword auto-correcting and and and and ....

while I still think that
ptrDate:MoveTo(ptrIndi,'.~BIRT.DATE')
dtDate = fhGetValueAsDate(ptrDate)
dpDate = dtDate:GetDatePt1()
tblINDI[count].birtyear = dpDate:GetYear()
is dead ugly for getting a year from an individual and stick it into a table

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

how to

Post by Jane » 10 Feb 2013 12:18

You can shorten that a bit, but remember gedcom dates are very very complicated, it that each one can have two dates and a raft of other things in it, so getting a year is not as simple as just grabbing the first one.

Why not just use a function to return the year that way you can keep it clean and add the required checking for null pointers and values.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
Jane
Site Admin
Posts: 8440
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

how to

Post by Jane » 10 Feb 2013 12:43

Another quick and dirty way is to use

Code: Select all

date = tonumber(fhGetItemText(ptrIndi,'~.BIRT.DATE:YEAR'))
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

Post Reply