supplierdeeply

Text Editor - Edi2

  • 31 Replies
  • 4740 Views
Text Editor - Edi2
« on: 13 / June / 2011, 13:13:55 »
Advertisements
Hello!

I decided to write a simple text editor for CHDK:D There is a lot of situations, when you need to change one line in script and then you have to turn off, take SD, put it into a computer... and so on. Wouldn't it  be nice to edit text directly on camera?

The zip contains also README.TXT where everything is described including how-to. Therefore I decided to remove the obsolete how-to in this post. Just read readme;p


CAUTION!!!

Although this is stable, final release it might cause some problems. You can't be really sure, what will happen while doing something with a file. The script can be only as safe as CHDK is. Once again - I can take no responsibility of any problems you'll have with the editor and coused by using it. USE ON YOUR OWN RISK!

Additional info:
-it was created and tested fos SX130IS, but uses no camera-specific functions, it should work on most of cameras. It is possible that some non-manual-zoom cameras will display a bug such as "no key zoom_in" or so one. If that's true try to remove 'is_key("zoom_in")' from filebrws.lua.

Have fun;)

File attached in this post is the newest version.
Since version 2.6 EDI requires file_browser() and textbox()functions

« Last Edit: 09 / September / 2012, 13:03:44 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Text Editor! Experimental stage.
« Reply #1 on: 13 / June / 2011, 15:44:42 »
I have posted an obsolete version of filebrowser, which coused some problems, here are new versions.

I also improved some little things in editor, including Backspace instead of Delete.
« Last Edit: 17 / June / 2011, 06:27:22 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Text Editor! Experimental stage.
« Reply #2 on: 14 / June / 2011, 17:53:34 »
New release:
-you can now add special characters, such as "[" ";" and so on. This is aviable being in WRITE mode, by press DISPLAY. There is a placeholder for "newline" character, but this feature doesn't work.

Next time I'll add numbers and real-newline insertion (I hope).

Zip contains filebrws.lua and edi_0_6_3.lua. Both are needed.

The newest version is always in the first post.
« Last Edit: 17 / June / 2011, 06:26:55 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Text Editor! Experimental stage.
« Reply #3 on: 16 / June / 2011, 16:22:26 »
New version released. Changes:
-now you can add a newline (in WRITE mode press DISP)
-you can also delete newline character (when coursor is at the first position in the line)
-if you have zoom buttons/lever you can use them as spacebar (zoom-in) and backspace (zoom-out) no matter if you are in abc or ABC mode.
-3rd mode - numbers - added. LEFT=1,2,3; UP=4,5,6; RIGHT=7,8,9; DOWN=0,+,-,*./,=

Newest zip is aviable in first post. I decided to keep the newest version in first post.

If anybody is interested, please, give a feedback.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick


Re: Text Editor! Experimental stage.
« Reply #4 on: 17 / June / 2011, 02:12:39 »
thank you ill give it a try must be handy for editing on the camera

Re: Text Editor! Experimental stage.
« Reply #5 on: 17 / June / 2011, 18:23:45 »
Newes version!

Changes:

- Adding and removing lines a little bit improved;
- Moving cursor improved - moving beyond line couses jump to previous/next line, you can also directly move from the begin to the end of file moving cursor UP being on the first line and DOWN being on the last line;
- Delete whole file - new option in File Menu (MENU key) - it deletes whole file content (No questions!!!). This is not done physically to the file on the SD card unless you'll save the file.

The filebrowser is also a little changed - I changed selection indicator ftom ">>" to little triangle used in editor. This is very minor change.

Since the script contains all basic functions, that text editor needs and looks quite stable I decided to change the status from "experimental" to "beta". Enjoy.

As always - the newest version is in the first file to avoid mess.
« Last Edit: 17 / June / 2011, 18:26:11 by outslider »
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Text Editor written in Lua! Beta stage.
« Reply #6 on: 24 / June / 2011, 07:15:33 »
I decided to completly rewrite the code. Now it's not as dirty, as before.

As always you can find the newest version in first post. I decided to keep the old version there. If you like new Edi2 just download the second zip.

Changelog:
  • code rewritten - simplified and shortened
  • probably all previous features of Edi1.x are implemented in Edi2
  • KEYMAP variable - you can change writting layout if you like
  • new, nice function menu() which creates menu from given table, width, height and a few other optional settings
  • set_console_autoredraw() set to 0 and console_redraw() almost not used - screen doesn't blink anymore!

I think about implementing this editor in C and add the editor to the CHDK. Who would be interested? Is this a good idea?
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

*

Offline reyalp

  • ******
  • 10057
Re: Text Editor written in Lua! Beta stage.
« Reply #7 on: 24 / June / 2011, 16:35:34 »
I think about implementing this editor in C and add the editor to the CHDK. Who would be interested? Is this a good idea?
If it works reasonably well as a script, I think just keeping it as a script would be better. It could still be included with CHDK.

The reason is that if we put it in C code, it takes memory from everyone, all the time. It can be a compile time option, but then it's much less likely to be available. As a script, it only takes SD space, which is really not a problem.

No one is going to want to do a lot of editing on the camera, but being able to do a quick fix to a script in the field could come in really handy when you need it.

If the C implementation is very small and simple I'd be fine with adding to the text editor, but if the script works, I don't see much reason. Having it in script is more flexible in many ways (e.g. easy to change keymap).
Don't forget what the H stands for.


Re: Text Editor written in Lua! Beta stage.
« Reply #8 on: 24 / June / 2011, 21:33:48 »
Hi

Very nice editor, great work, I had exactly same problem and was thinking making editor myself, but I think I wouldn't done it so nicely. I was surprised that the typing is done much quickly than expected.

I think I will swap the SHOOT_HALF with erase (to be sure to not hit shoot when in hurry)

I encountered some glitches when it writes something somewhere (like different line on wrong place) and then it's gone, but it can be lived with.

I don't know if having it as C would be much better, sacrificing memory? If I have mem for games, then don't spare on handy editor. So having it as compile option, then I would chose it. But then it would be much less flexible to changes. And perhaps I wouldn't able to use it, on my SX1 is just some older beta version available. And the last thing, if it would perform badly as script then 100% go with C, but actually it's responsive so perhaps it's not so much necessary.

On my LCD it's uses about 2/3 screen, can it be altered to use it whole?

Perhaps when it would detect keyholds (I spoke with somebody on different thread about key holds) the scrolling trough file would be much faster.

Re: Text Editor written in Lua! Beta stage.
« Reply #9 on: 27 / June / 2011, 02:32:10 »
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?
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

 

Related Topics