- 24 Mar 2015 08:32:08 am
- Last edited by MateoConLechuga on 24 Mar 2015 04:15:47 pm; edited 1 time in total
Nice work thus far Michael!
I have a couple of suggestions; take them with a grain of salt though because they kind of mess up some things...
So one thing that I might recommend is to avoid the use of a list in this case to store the locations of each note, but that's just me. In addition, it might also be easier to use a single character delimiter, as it makes searching and replacing a tad easier. For instance, say you have a string like this:
Code:
To print the note data in note N, you can do:
Code:
To print the note title of note N, you can just change the 1 to a 0:
Code:
To display the titles of all the notes, you can simply do this:
Code:
As for deletion of notes, one interesting way to think about it is to not leave the string as-is, but rather to add padding on the start and end of the string while deleting an element. This is to prevent having to deal with the three different cases of having the note be at the start, body, or end. This way it can be done relatively easily:
(Sorry, my 1-line solution actually needed to do some bounds checking.
)
Code:
In addition, this means that if you have one note and you use this to delete it, "x" will then be stored in Str1. This is very useful, because now you can check to see if you have an empty list, plus it will still work when displaying the titles. Everything sorta takes care of itself.
As for the issue of backspacing, one way that I went about it is to delete the character, but not redraw everything afterwords, until a button was pressed by the user. It didn't really look too funny, or you could always just do it by redrawing everything after, which isn't too slow really.
OOOAs for text wrapping and character spacing, it might be easier to just let all characters be 5 (or 4?) pixels in width, that way no crazy time-consuming calculations have to take place. Just an idea. Otherwise you may be able to have a list of certain character widths, of pxl-Test(), but that would cause a lot of overhead.
Great work so far on this, and hope this helps a little!
EDIT: Oh yeah, and I was supposed to suggest how to speed up the input loop... Oh well, I'll write that in a bit.


So one thing that I might recommend is to avoid the use of a list in this case to store the locations of each note, but that's just me. In addition, it might also be easier to use a single character delimiter, as it makes searching and replacing a tad easier. For instance, say you have a string like this:
Code:
"xNOTE1xTEXT1xNOTE2xTEXT2x->Str1
To print the note data in note N, you can do:
Code:
2->N:1
For(X,2,2N
inString(Str1,"x",Ans+1
End:Ans+1
Disp sub(Str1,Ans,inString(Str1,"x",Ans)-Ans
To print the note title of note N, you can just change the 1 to a 0:
Code:
2->N:0
For(X,2,2N
inString(Str1,"x",Ans+1
End:Ans+1
Disp sub(Str1,Ans,inString(Str1,"x",Ans)-Ans
To display the titles of all the notes, you can simply do this:
Code:
1
While Ans!=length(Str1
Ans+1
Disp sub(Str1,Ans,inString(Str1,"x",Ans)-Ans
inString(Str1,"x",1+inString(Str1,"x",Ans
End
As for deletion of notes, one interesting way to think about it is to not leave the string as-is, but rather to add padding on the start and end of the string while deleting an element. This is to prevent having to deal with the three different cases of having the note be at the start, body, or end. This way it can be done relatively easily:
(Sorry, my 1-line solution actually needed to do some bounds checking.

Code:
"x"+Str1+"x"->Str1
1:For(X,2,2N
inString(Str1,"x",Ans+1
End:Ans->D
inString(Str1,"x",1+inString(Str1,"x",Ans+1
sub(Str1,1,D)+sub(Str1,Ans+1,length(Str1)-Ans
sub(Ans,2,length(Ans)-2->Str1
Disp Str1
In addition, this means that if you have one note and you use this to delete it, "x" will then be stored in Str1. This is very useful, because now you can check to see if you have an empty list, plus it will still work when displaying the titles. Everything sorta takes care of itself.

As for the issue of backspacing, one way that I went about it is to delete the character, but not redraw everything afterwords, until a button was pressed by the user. It didn't really look too funny, or you could always just do it by redrawing everything after, which isn't too slow really.
OOOAs for text wrapping and character spacing, it might be easier to just let all characters be 5 (or 4?) pixels in width, that way no crazy time-consuming calculations have to take place. Just an idea. Otherwise you may be able to have a list of certain character widths, of pxl-Test(), but that would cause a lot of overhead.
Great work so far on this, and hope this helps a little!

EDIT: Oh yeah, and I was supposed to suggest how to speed up the input loop... Oh well, I'll write that in a bit.
