Text Editor - Edi2 - page 2 - Script Writing - CHDK Forum
supplierdeeply

Text Editor - Edi2

  • 38 Replies
  • 18033 Views
Re: Text Editor written in Lua! Beta stage.
« Reply #10 on: 28 / June / 2011, 11:24:04 »
Advertisements
Scrolling through file can be faster when you swich how many lines you want to jump on one UP/DOWN press. You can swich this using SHOOT_HALF button. I was thinking about implementing JogDial wheel rotation as scroll, but it needs to use specific  firmware adresses since there is no command like "is_key jogdial" or something.

Did you use Edi2 or older version?

Edi2

It's is to hard to implement the "hold" key detection? Becuase just holding while scrolling would be much pleasant. (more than the jogdial, on sx1 it's without feedback clicks and it's terrible to control anything with it)

Re: Text Editor written in Lua! Beta stage.
« Reply #11 on: 29 / June / 2011, 02:39:48 »
Well, probably it's not hard to implement as it was said a few days ago in some thread on the forum. However, I don't really know how to do this now, since my get_input() function waits for click. I have an idea how to improve it and I'll try to implement this, but don't know when.

At the moment I added new features:
  • you can set width and height of the editor (but height>14 and width>40 are probably useless since CHDK limitation
  • you can set if you like to use Windows or Unix newline encoding (on Windows there are two characters for encode newline: newline itself and carriage return, Unix uses only newline char.)
  • you can insert a character by ASCII code

About lines, which appears in some strange places - it's probably due to CHDK issues with console redrawing, I have no possibility to fix it.

The newest version - in first post.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Text Editor written in Lua! Beta stage.
« Reply #12 on: 10 / July / 2011, 15:44:26 »
There is a new - stable and final release of the editor and filebrowser. The filebrowser is now very simmilar to the oryginal CHDK filebrowser. I hope you'll find them usefull.

Zip archive (first post) also contains a README file. You can find there a lot o information about usage and possibilities of the Edi2.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #13 on: 02 / October / 2011, 06:46:38 »
Ok - new release.

Changelog:

- file browser is now merged with editor and you need only a single file. It can be placed everywhere on SD card;)
- some small changes in code

PS. does anybody know, how to change UNIX time into a human understandable date? I would add a modification date to the file browser.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #14 on: 02 / October / 2011, 10:28:20 »
PS. does anybody know, how to change UNIX time into a human understandable date? I would add a modification date to the file browser.

Does this help : http://stackoverflow.com/questions/4460902/unix-time-to-humanreadable-date-and-time
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #15 on: 02 / October / 2011, 15:38:32 »
Ok, thx, I'm changing this code to work with integers. I have an experimental version of filebrowser with dates of last modification of files, but without an hour and minute. I hope I'll finish it in one week.

At the moment it's just a not very important feature;)

Unfortunetly, things like this makes the script bigger and bigger...

Here is an experimental release, I'm not really sure if date_from_unix(time) works correctly...
« Last Edit: 09 / October / 2011, 19:01:03 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #16 on: 02 / October / 2011, 17:38:10 »
Ok, thx, I'm changing this code to work with integers. I have an experimental version of filebrowser with dates of last modification of files, but without an hour and minute. I hope I'll finish it in one week.


There's a file browser already built into CHDK.
I wonder if it would be better to provide methods to call it from within uBasic / Lua scripts rather than write another one inside your editor script?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #17 on: 03 / October / 2011, 03:21:49 »
Yes, it would be great, but I asked about it a few months ago (http://chdk.setepontos.com/index.php?topic=6452.msg68466#msg68466) but msl told me it's impossible to use CHDK browser in a script at the moment, so I had to write my own.

I believe, that it's possible to change source code to provide lua function such as file_browser(place) which would run CHDK browser in given place and then it would return path to the file which was selected by user.

I don't really know, how CHDK source is written and how to do so, but I guess it can't be difficult... And it would give the scripts new possibilities! Not only for an editor (for example user could select, where he want to save photos taken by script).

PS. Even if I'd like to compile my own version of CHDK trying to use CHDK browser, I can't do so having no fi2.inc file:/
« Last Edit: 03 / October / 2011, 04:00:12 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #18 on: 03 / October / 2011, 08:45:17 »
The existing code works pretty well.  Why put more work into this ?  Unless you want to improve the date code, I'll submit the patch and we can move on to other things ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Text Editor - Edi2 - FINAL RELEASE!
« Reply #19 on: 03 / October / 2011, 13:17:15 »
In fact I don't need to change the script - as you said it works nice;) Nevertheless as I said CHDK file browser accesible from script would be great idea.

Please, make a patch and meanwhile I'll try to provide CHDK version with lua-accesible CHDK filebrowser. If it'll be succesfull I'll try to make a patch and post it in other thread.

And thank you for all your help! ;)
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

 

Related Topics