Advertisement
RascalJack

TI-84+CSE Text Centering Tool

May 2nd, 2015
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. SetUpEditor |LTXT
  2. 6->dim(|LTXT
  3. //Checks if run from Program or User
  4. If |LTXT(2)=0:Then
  5. ClrHome
  6. Disp "Text Centering Tool"
  7. If |LTXT(5)=0:Then
  8. Input "X Pixel to Center On: ",A
  9. Else
  10. Disp "X Pixel to Center On: 132"
  11. 132->A
  12. End
  13. //Setup of Variables
  14. A->|LTXT(1)
  15. //Text Input w/ Lowercase and Uppercase Letters
  16. //Setup for Variables
  17. 0->B
  18. " "->Str1
  19. 0->C
  20. 0->D
  21. 2->F
  22. 5->H
  23. 0->I
  24. //Converting the Inputting X Value to a String
  25. {0,1}->L1
  26. {0,|LTXT(1)}->L2
  27. LinReg(ax+b) {Y1}
  28. Equ>String({Y1},Str2
  29. sub(Str2,1,length(Str2)-3->Str2
  30. DelVar {Y1}
  31. //Outputting Text
  32. Output(3,1,"Text String: "
  33. If |LTXT(6)=0:Then
  34. Output(7,1,"Quit: Period Key"
  35. Output(8,1,"Settings: (-) Key
  36. Output(9,1,"Key Help: Right Arrow"
  37. End
  38. Output(10,1,"Style: Uppercase"
  39. //Main getKey Loop
  40. Repeat A=105
  41. getKey->A
  42. //Quit
  43. If A=103:Then
  44. {0,0,|LTXT(3),|LTXT(4),|LTXT(5),|LTXT(6)}->|LTXT
  45. ClrHome
  46. Stop
  47. End
  48. //Settings
  49. If A=104:Then
  50. For(A,0,1)
  51. If |LTXT(4)=A:sub("No Yes",(1+(3*(A=1))),3)->Str8
  52. If |LTXT(5)=A:sub("No Yes",(1+(3*(A=1))),3)->Str7
  53. If |LTXT(6)=A:sub("Yes No",(1+(3*(A=1))),3)->Str6
  54. End
  55. ClrHome
  56. Disp "SETTINGS","*Show Centered Text: "+Str8," Default X to 132: "+Str7," Tool-Tips: "+Str6," Return to Program"
  57. //Custom Settings Menu
  58. Repeat F=12
  59. getKey->E
  60. If E=34:Then
  61. If F<H:Then
  62. F+1->F
  63. 1->I
  64. End
  65. If F=H and I=0:2->F
  66. 0->I
  67. End
  68. If E=25:Then
  69. If F>2:Then
  70. F-1->F
  71. 1->I
  72. End
  73. If F=2 and I=0:H->F
  74. 0->I
  75. End
  76. If E!=G and F!=H and E=26 or E!=G and F!=H and E=24 or E!=G and F!=H and E=105:Then
  77. If F=2:(1-(|LTXT(4)=1)->|LTXT(4
  78. If F=3:(1-(|LTXT(5)=1)->|LTXT(5
  79. If F=4:(1-(|LTXT(6)=1)->|LTXT(6
  80. For(A,0,1)
  81. If |LTXT(4)=A:sub("No Yes",(1+(3*(A=1))),3)->Str8
  82. If |LTXT(5)=A:sub("No Yes",(1+(3*(A=1))),3)->Str7
  83. If |LTXT(6)=A:sub("Yes No",(1+(3*(A=1))),3)->Str6
  84. End
  85. Output(2,22,Str8
  86. Output(3,20,Str7
  87. Output(4,13,Str6
  88. End
  89. If E!=G and E=34 or E!=G and E=25:Then
  90. For(A,2,10
  91. Output(A,1," "
  92. End
  93. Output(F,1,"*"
  94. End
  95. If E!=G and F=H and E=105:12->F
  96. E->G
  97. End
  98. 2->F
  99. ClrHome
  100. Disp "Text Centering Tool"
  101. Disp "X Pixel to Center On: "+Str2
  102. End
  103. //Key Help
  104. If A=26:Then
  105. ClrHome
  106. Disp "KEY HELP","Alphabet is Normal","Symbols are 2nd to STAT","Symbols: .,:;!?","Up-Down switch Style","Left Arrow is Backspace","Right Arrow is Help","","Back = Enter Key"
  107. Pause
  108. ClrHome
  109. Disp "Text Centering Tool"
  110. Disp "X Pixel to Center On: "+Str2
  111. End
  112. //Up Style Changer
  113. If A=25:Then
  114. If B>0:Then
  115. B-1->B
  116. 1->I
  117. End
  118. If B=0 and I=0:2->B
  119. 0->I
  120. End
  121. //Down Style Changer
  122. If A=34:Then
  123. If B<2:Then
  124. B+1->B
  125. 1->I
  126. End
  127. If B=2 and I=0:0->B
  128. 0->I
  129. End
  130. //Backspace
  131. If A=24:2->C
  132. //Backspace Brain
  133. If length(Str1)>0 and C=2:Then
  134. If length(Str1)=1:Then
  135. " "->Str1
  136. 0->C
  137. Else
  138. sub(Str1,1,length(Str1)-1)->Str1
  139. Output(3,1,"Text String: "+Str1+" "
  140. 1->C
  141. End:End
  142. //Main Output Update
  143. Output(3,1,"Text String: "+Str1
  144. If |LTXT(6)=0:Then
  145. Output(7,1,"Quit: Period Key"
  146. Output(8,1,"Settings: (-) Key
  147. Output(9,1,"Key Help: Right Arrow"
  148. End
  149. If B=1:Output(10,1,"Style: Lowercase"
  150. If B=0:Output(10,1,"Style: Uppercase"
  151. If B=2:Output(10,1,"Style: Number "
  152. If A>20 and A<24 or A>30 and A<34 or A>40 and A<44 or A>50 and A<56 or A>60 and A<66 or A>70 and A<76 or A>80 and A<86 or A>90 and A<95 or A=102:Then
  153. If A>20 and A<24:A+7->D
  154. If A>30 and A<34:A->D
  155. If A>40 and A<44:A-40->D
  156. If A>50 and A<56:A-47->D
  157. If A>60 and A<66:A-52->D
  158. If A>70 and A<76:A-57->D
  159. If A>80 and A<86:A-62->D
  160. If A>90 and A<95:A-67->D
  161. If A=102:A-75->D
  162. If B=0:Str1+sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,:;!?",D,1)->Str1
  163. If B=1:Str1+sub("abcdefghijklmnopqrstuvwxyz .,:;!?",D,1)->Str1
  164. If B=2:Str1+sub("ABCDEFGHIJKLMN789RS456WX1230.,:;!?",D,1)->Str1
  165. If length(Str1)=2 and C=0:Then
  166. sub(Str1,2,length(Str1)-1)->Str1
  167. 1->C
  168. End:End:End
  169. ClrHome
  170. //Final Display
  171. Disp "Text Centering Tool"
  172. Disp "X Pixel to Center On: "+Str2
  173. Disp "Text: "+Str1
  174. End
  175. //Variable Assignment
  176. " "->Str2
  177. "i.!"->Str3
  178. "l,:"->Str4
  179. "s"->Str5
  180. "ABCDEFGHIJKLOPQRSTZbcdefghjnprtvyz;?1234567890"->Str6
  181. "NUXkoqx"->Str7
  182. "MVWYau"->Str8
  183. "mw"->Str9
  184. 0->dim(L1
  185. 0->dim(L2
  186. DelVar Str0
  187. If |LTXT(1)=0:1->|LTXT(1)
  188. DelVar PDelVar ODelVar QDelVar RDelVar SDelVar TDelVar UDelVar UDelVar VDelVar W
  189. 1->E
  190. ~2->P
  191.  
  192. //Actual Math
  193. For(B,1,8
  194. expr(sub("Str2Str3Str4Str5Str6Str7Str8Str9",B,1))->Str0
  195. length(Str0)->dim(L1
  196. If B=7:E+1->E
  197. If B=8:B+1->B
  198. Fill(expr(sub("2467891012",B,E)),L1
  199. If dim(L2)>0:augment(L2,L1)->L2
  200. If dim(L2)=0:L1->L2
  201. ClrList L1
  202. End
  203. Str2+Str3+Str4+Str5+Str6+Str7+Str8+Str9->Str0
  204. For(X,1,length(Str1
  205. L2(inString(Str0,sub(Str1,X,1)
  206. Ans+P->P
  207. End
  208.  
  209. round((|LTXT(1)-(P/2)),0)->|LTXT(3)
  210.  
  211. //Final Output
  212. If |LTXT(2)=0:Then
  213. {0,1}->L1
  214. {0,|LTXT(3)}->L2
  215. LinReg(ax+b) {Y1}
  216. Equ>String({Y1},Str0
  217. sub(Str0,1,length(Str0)-3->Str0
  218. DelVar {Y1}
  219. {0,1}->L1
  220. {0,P}->L2
  221. LinReg(ax+b) {Y1}
  222. Equ>String({Y1},Str2
  223. sub(Str2,1,length(Str2)-3->Str2
  224. DelVar {Y1}
  225. Disp "X Value: "+Str0,"Pixel Value: "+Str2
  226. If |LTXT(4)=1:Then
  227. Disp "Graphing Text"
  228. rand(50
  229. Vertical 132,Black,1
  230. Text(82,|LTXT(3),Str1
  231. Text(120,58,"Press Enter to Return"
  232. Pause
  233. ClrDraw
  234. Disp
  235. End:End
  236. {0,0,|LTXT(3),|LTXT(4),|LTXT(5),|LTXT(5)}->|LTXT
  237. Return
  238.  
  239. //Documentation:
  240. //O=2,0;B=1
  241. //Q=2,2;B=2
  242. //R=4,2;B=3
  243. //S=5,2;B=4
  244. //T=6,2;B=5
  245. //U=7,2;B=6
  246. //V=8,2;B=7
  247. //W=10,2;B=8
  248.  
  249. //If inString(Str2,sub(Str1,1,1)):Then
  250. //For(A,1,length(Str2))
  251. //inString(Str1,sub(Str2,A,1))
  252. //If Ans>0:Then
  253. //Disp Ans
  254. //Ans+S->S
  255. //Disp S
  256. //End:End:End
  257.  
  258. //ALL NUMBERS ARE 6,2
  259. //CAPITAL LETTERS
  260. //A = 6,2
  261. //B = 6,2
  262. //C = 6,2
  263. //D = 6,2
  264. //E = 6,2
  265. //F = 6,2
  266. //G = 6,2
  267. //H = 6,2
  268. //I = 6,2
  269. //J = 6,2
  270. //K = 6,2
  271. //L = 6,2
  272. //M = 8,2
  273. //N = 7,2
  274. //O = 6,2
  275. //P = 6,2
  276. //Q = 6,2
  277. //R = 6,2
  278. //S = 6,2
  279. //T = 6,2
  280. //U = 7,2
  281. //V = 8,2
  282. //W = 8,2
  283. //X = 7,2
  284. //Y = 8,2
  285. //Z = 6,2
  286. //LOWERCASE:
  287. //a = 8,2
  288. //b = 6,2
  289. //c = 6,2
  290. //d = 6,2
  291. //e = 6,2
  292. //f = 6,2
  293. //g = 6,2
  294. //h = 6,2
  295. //i = 2,2
  296. //j = 6,2
  297. //k = 7,2
  298. //l = 4,2
  299. //m = 10,2
  300. //n = 6,2
  301. //o = 7,2
  302. //p = 6,2
  303. //q = 7,2
  304. //r = 6,2
  305. //s = 5,2
  306. //t = 6,2
  307. //u = 8,2
  308. //v = 6,2
  309. //w = 10,2
  310. //x = 7,2
  311. //y = 6,2
  312. //z = 6,2
  313. //SYMBOLS:
  314. //[Space] = 2,0
  315. //. = 2,2
  316. //, = 4,2
  317. //; = 6,2
  318. //: = 4,2
  319. //! = 2,2
  320. //? = 6,2
  321.  
  322. //Text Input Documentation:
  323. //A:41
  324. //B:42
  325. //C:43
  326. //D:51
  327. //E:52
  328. //F:53
  329. //G:54
  330. //H:55
  331. //I:61
  332. //J:62
  333. //K:63
  334. //L:64
  335. //M:65
  336. //N:71
  337. //O:72
  338. //P:73
  339. //Q:74
  340. //R:75
  341. //S:81
  342. //T:82
  343. //U:83
  344. //V:84
  345. //W:85
  346. //X:91
  347. //Y:92
  348. //Z:93
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement