Author Topic: File/script editor  (Read 3400 times)

Offline wontolla

  • Sr. Member
  • ****
  • Posts: 413
  • S3 & G9 & A720
Re: File/script editor
« Reply #15 on: 05 / October / 2008, 23:21:16 »
Quote
I can't download the gui_read.c file


Sorry for the death link, here is a new one. One of these days I will pay for hosting instead of using these free sites that erase your files from time to time.

http://wontolla.freehostia.com/CHDK/FileEditor/gui_read.c

And the video that explains the keyboard usage, similar to iPods. (so I guess, because I don't have one).

http://wontolla.freehostia.com/CHDK/FileEditor/MQwerty.flv


The code is fairly commented and most of my changes are between lines in the form: Begin Wontolla's mess...End Wontolla's mess
But you don't really need to understand or change what I did. All my functions are just to draw here and there on the screen and control the buttons. You should focus at the end, in the main switch for this feature to be completed. I marked the places where the code to actually write on a file should be added. For example:

Code: C
  1. gui_read_draw_keyboard_square(square, COLOUR_CENTER, page, key);
  2.                     //DISPLAY CHARACTER
  3.                     stage = 2;
  4.                 }
  5.                 else if (stage==2) {
  6.                     //WRITE CHARACTER
  7.                     gui_read_draw_keyboard_section(state, black, page);
  8.                     state=left;
  9.                     qui_read_draw_button_margin(left, COLOUR_SELECTED);
  10.                     gui_read_draw_keyboard_section(left, coloured, page);
  11.                     key=0;
  12.                     stage = 1;
  13.  

Where the //WRITE CHARACTER comment must be replaced by the code that writes the present character to the file, using the standard I/O C code functions like fopen, fwrite etc.

I recommend adding some code to create a new file and write on it first. Then, move to the modification of an existing file and insert/erase/modify in any place on that file. Unfortunately, nowadays I don't have time to work on this. Sadly, not even to go out and take pictures. But I hope one of you guys find the way to finish this feature as it will be useful for all those CHDK script writers out there.

I will happily answer any questions about the code etc.

Have fun!

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal