Java tutorial
//browse boxes, word doc load to end error, [tiny character counter for musings/outlines/brainstorming, prewriting, and garbage collection] //change it so that it does NOT save on appending (DONE!) OR Appending/appending the contents of a file to the end/loading a file will automatically save this session. Do you want to continue?/Are you sure you want to load a file? //make a diagram of how everything actually works in this program (the behind-the-scenes) //jump to chapter in page viewing mode, about auto saving in page viewing mode, less messy swing version, jump to page in normal mode, editable in viewing mode?/disable editing, zoom/increase font size and recalculate pages and stats in both modes and adjust page turning accordingly, word doc support, thesaurus, other file menu goodies, autoformat-->garbagecollection and check any attached functions of the insert button before removing it //novelist's/writer's/author's personal organizer, two higher font sizes and one lower? //xtra edits: add "voice" to the menu bar, second column/box to filetracker, click and drag to rearrange chapters, 1, make "automatically save your session" bold, add an "are you sure you want to turn page viewing mode on?" yesnookcancel dialog box, export printable version-->ready for publishing!/export version to be published //Beyond Horizons/Obvious Solutions/GP's Freeware //list of software: file too long (free trial/full version/free with ads?/FREE?); Authors Assistant (free trial/full verion/FREE?/Free with ads?), custom medical forms (full service/download a sample/download an example of a completed patient management software (the sample can be usedtested for 30 days/valid for 30 days)) //be sure to index the website on google //create a secure payment portal (ASP.NET?) //Apps: p2t, ff, miL, sign on with monster mmorpg //Exit--> do you want to save before quitting? yes/no //ZOOM/FONT capability (+ -) (Either ONLY make it possible to zoom (increase font size) in regular mode, OR take into account the increased font when flipping/counting pages, and thus include it in viewing mode) //default font size button //the page counter should readjust itself based on the user's selected font size //"would you like to save before increasing the font size?" yes/no //disable page forward/backward when not in viewing mode OR until you fix it. //Insert button--> "Append to End" OR Insert inserts normally, and two append to end buttons are added underneath musings and prewriting //add "speech" to menu bar--> read [my novel] to me/launch windows built-in dictation //add filetracker to doc block, create a dialog for "Enter your book title: " publish (create publishable doc) as (____ by ____), recode program entirely[load each page seperately based on the master doc string OR do the scrolling thing the way it is now- either way should be editable by the user]/code page turning potion in swing to allow editing while in viewing mode //instead of putting M, m, & pre directly at the location specified by the user, a user folder should be created, and M, m, pre, & the versions folder should be put inside it. //word doc support //Aesthetics (like the login) //Export/PUBLISH/(Obtain Publisher-Ready Version)/save master user copy, print (default printer)-->are you sure you want to print? (will automatically save a version/the latest version to the default location), printwithsettings (default location- ie. will automatically save a new version and then open it) //change / / to purple, lower primary by a few millimeters, shift ALH over to the left and reduce the font size //put viewing mode caption at the bottom right //optional: move "viewing mode off" button //Help--> tips before you publish //Publishing Help //all manually inputted paths --> browse boxes //Delete this account-->enter your password-->are you sure you want to delete-->are you ABSOLUTELY sure you want to delete ////remaining tasks (12): //fill in menu options<--Menu: File- exit, Edit- ..., Help- how to use ALH, contact us (for any questions), version no. //LOL...I believe that this is covered under "aesthetics"<--menu color- white? //I already did this, right?<--save a version button's functionality //done? or does word doc support still need to be added?<--files list //is this unnecessary and redundant?<--insert-->insert paragraph, further TESTING: same spacing, all format changes saved, various boundary cases //I already said this needs to be done<--WORD DOCUMENT SUPPORT/it is absolutely essential to SUPPORT WORD DOCUMENTS //check to see if this is already done<--an example of versioning: versions--> v1 (Date: ), v2 (Date: ), v3 (Date: )-->each of these folders contain their associated subfolders //I think this is already done.<--login box to front, ALH to invisible until login //Meh...not really worth the effort<--click-and-drag to rearrange chapters (rearranging them in the menu bar will rearrange them in the text (ie. Primary window) automatically //Already been stated in a far less inane and utterly confusing way<--save PRINTABLE DOCUMENT/VERSION BUTTON to- will read the formatting in the master doc, and format a new word document accordingly //MLA-ification //the way it is right now, no changes to the novel are saved when viewing mode is on...HOWEVER...prewriting IS saved (ie. is still there when you exit viewing mode) //this is funny as hell, and I love it, but I guess I should prevent going back beyond page 1:( <--Has been fixed, right? <-- fix clicking page forward more than tot pages, negative page numbers on going back past page 1 :P //what exception again?<--troubleshoot thrown exception //Enable editing in viewing mode OR tell the user that changes to the novel will not be saved, but notes ie.prewriting WILL be<--editing should be disabled //DONE<--scroll bar on the first page should be disabled //when viewing mode is turned off, the page displayed should be the same page the person left off on...or at the very least, it should start off on the same sentence (in the case of zooming) //browse versions folder/open a version, save this version as the default version //do not save to MOG, do not save to a user-specified path, DO SAVE TO a default path, much like in patient manager (except this folder will be called "aadata" or something //add jump to chapter functionality in viewing mode //either tell (via message box) the user to remove the symbols of the chapter header to undesignate as a chapter, OR tell them to highlight it from @ to -, and then click the "un/de-designate as chapter" button //basic functionality: it should help you organize your novel/writing into chapters //ask the user if he/she wants to save changes on exit...don't automatically do it<--...perhaps I *will* include a save changes button...but everything is automatically saved on exit as an assumption. //a changes tracker might be useful //list of other useful features: //publishing tip of the day //-------------------------------------------------------------------------------------------------------------------- //presenta, pick up cert, change m's login pw //recover firefox, article (and figure out why it was deleted), and chrome (in that order) //long path tool, pin ups //tell V you're sick //Insert button--> "Append to End" OR Insert inserts normally, and two append to end buttons are added underneath musings and prewriting //the method whose name you never remember: displayFilesWindow() //add filetracker to doc block, fix back button, create a dialog for "Enter your book title: " publish (create publishable doc) as (____ by ____), recode program entirely[load each page seperately based on the master doc string OR do the scrolling thing the way it is now- either way should be editable by the user]/code page turning potion in swing to allow editing while in viewing mode //instead of putting M, m, & pre directly at the location specified by the user, a user folder should be created, and M, m, pre, & the versions folder should be put inside it. //word doc support //how to fix the login aesthetic problem: let the main form load. set the main form's visibility to zero. recreate the login form as a custom dialog box, and have it display right after the main form's visibility is set to false. //Name Change: Author's Assistant //UI changes- //add "obtain printable version" button (asks the user where he/she wants it to be saved (is the same as "export" in patient manager) //change / / to purple, lower primary by a few millimeters, shift ALH over to the left and reduce the font size //put viewing mode caption at the bottom right //optional: move "viewing mode off" button //Help--> tips before you publish //longpathtool- feedback on the copy feature //yt- shiftedper, Practice!!! //bleach //pups,r panorama; remaining h ph's (about 3 or so) //keywords: writer's assistant, book viewer, author software, publishing software, writing assistant, novelist's assistant //vote to k t //this is unnecessary (and here's why:), because ALH creates a blank master doc for every user. files are loaded naturally using the "load file" button [unnecessary stuff to the right]-->Caution: when using ALH, all formatting in the provided document (IF a document is provided), will be lost. We reccomend you use a copy of said document. //copywrite c ALH //Version 14.0, / / //pricing (or lack thereof): ... //fdm follower google keywords: //mIL google keywords: //pointAndT google keywords: //fix refining spaces onHover goin green //set refining spaces keywords on google: refiningspaces, refining spaces, interior design, ... //google keywords: author's helper, author's lil helper, author's little helper, authors helper, writer's helper, chapter organizer, publishing software, author help, novelist help, writer help software free //Blog:The Curried Coconut- the best of southeast asian cookery //The Starving Carnivore //remaining tasks (10): //Menu: File- exit, Edit- ..., Help- how to use ALH, contact us (for any questions), version no. //menu color- white? //save a version button's functionality //files list //insert-->insert paragraph, further TESTING: same spacing, all format changes saved, various boundary cases //something important goes here: WORD DOCUMENT SUPPORT/it is absolutely essential to SUPPORT WORD DOCUMENTS //an example of versioning: versions--> v1 (Date: ), v2 (Date: ), v3 (Date: )-->each of these folders contain their associated subfolders //login box to front, ALH to invisible until login //click-and-drag to rearrange chapters (rearranging them in the menu bar will rearrange them in the text (ie. Primary window) automatically //save PRINTABLE DOCUMENT/VERSION BUTTON to- will read the formatting in the master doc, and format a new word document accordingly //Optional features: MLA-ify, change manual inputting of path to browse boxes //java and c programs from command line, download necessary compilers, that little pink intro book which is perfect for teaching programming, ggbridge book, sexy times :3- call uhs //fix clicking page forward more than tot pages, negative page numbers on going back past page 1 :P //troubleshoot thrown exception //in viewing mode, editing should be disabled, scroll bar on the first page should be disabled // //'radioactive' analogy // //toggle button, paragraph formatting, what to do with the stats label when you're in viewing mode //why don't filetracker, save&quit, saveversion, loadfile, and insert get disabled in viewing mode? //java and c programs from command line, download necessary compilers, that little pink intro book which is perfect for teaching programming, ggbridge book, sexy times :3- call uhs //demo #1: loadFile, stats, flip pages, designate as chapter, jump to chapter //include writing quote of the day //click and drag to rearrange the chapters in the text //why does "next" need to be clicked twice if "back" has been pressed? //autoload(load musings)&save (save & quit button) //the insert box //break it off at a space (you'll probably need to count the chars remaining and split it accordingly) //insert text using the [insert box & button] OR press enter before it wraps //the insert button's method should calculate where the newline chars should go, before inserting the minibox's text at the correct index in primary //find collar and chain comic //select from LEFT to RIGHT, the cursor should automatically go to the end of the selected text by default //you care about the one (the number of characters) WITHOUT the whitespace, as well as the tot number of words //constantly refresh the statistics, onLine, onPage, onChar, Pages //words, total characters, paragraphs, pages, lines, onPage //who's working on a more efficient battery for ren en? //zersys freelance (web developer), CEH certification & [completion], info sec job, boarding school teaching, back to ph grad school //why DOESN'T he have CEH certification? ie. why did he never bother? //a couple of freelance projects for him just to get zersys on my res & a letter of rec //Core Functionality Tasks Remaining: designate as chapter button, rearrangeChaptersOnDrag (both in the list and in the text), 1, the Quit button (ie. save- overwrite existing master file and musings file) //Optional Tasks Remaining: opened files list, stats, initialize all four/five labels, insert button //Necessary Fixes: page turning, login form should be in front of the primary form //Sadistic Sit: "Further/c d"- fucking with ppls heads in a crude way, unlike D //mosthdon'tknowthefirstthingaboutwhattruehis...that'sthepd&shgtbpun //spicy panang curry and sushi rice, pizza, pho //for all h ew/bb, TF isi...and lacks the complex eiofh, acting on cd alone //maintenence, mobile app development, hacking, watertight UI/web development //Sitara found herself impulsively/awkwardly flattened/plastered against the back wall of the cave, with the smell of smoke/ash/burning flesh still lingering in/rapidly filling her nostrils. //pick up at line 1466, afterwards, focus on making the login form popup in front of the main form //mon-IL/Commiserate/Comissery- rambles, advice, commisserate, share your pain with others in the same situation //mIL comics //---------------------- //harnessing E's storms/lightning for power generation/tmtwereqs- need larger battery/more efficient method of storage //use OCI + G T //7 Lines: //dis //Apps: AR page translator; fandom follower //facebook- anonymous comments "entertainment?" app, Oculus Rift //Samsung- oculus partnership, hmd with similar design but a different target audience ie. "casuals" //Sony- project morpheus //Google- Quantum Computers- Qbit & ____ say that they're really close to having a viable prototype //3D printing //---------------------------------------------- //Why should you be held responsible for their ignorance? //ias //rewards and incentives: stuff you love after T.O.D. (ff?) (beer and board games?) (some other funny indie shit?) //4Q //you left off at creating/loading the master file, respectively //write the "load file" button functionality after that //fix page turning after everything else is finished //insert to the end of the master file directly on load/or merely insert it to the end of the window and then save the whole thing at the end? //set AnchorPane title (ie. the blue bar) to Ch Organizer/Author's [Lil] Helper/Author's Assistant/Author's Helper //cleanup,practice,code,apply;printer ink; //Avast; //bkup; pick up cert //on the right side: 4 labels + the insert box + the make bold aka designate as chapter title/header button + quit //label 1: smallTitle- a l h //label 2: title- Hello/Hello Again //label 3: displayscharacterindexonclick //label 4: stats- displays onPage, total Pages, total characters/words/lines/paragraphs/chapters //insert box- has an insert button underneath it, which will insert text to the index indicated by the cursor //designate as chapter button (maybe I'll put this on the bottom left instead...) //quit button: is located in the top right corner, SAVES and quits (closes form) onClick, terminates program //on the left side: "Musings" box, Jump to Chapter box (lists all the chapters)- it should have click-and-drag functionality //, a small box which lists all files ever loaded in chronological order, optional: a tabbed organizer box //comic cover, whatparey //login- loads master doc //create- creates master doc //both- on "load file" click, inserts text TO THE END of all the preloaded text in the window (ie. the master doc text up to this point)...it will designate the beginning of this new text file as a default chapter, until the user goes in and manually changes this. The viewing window will shift to the beginning of the new file's text/the end of all the text //leave it alone!!! (w/o a disturbances) //let it regen itself //even if it's not orig (like in so cal, which is mostly not orig), at least it will be A LOT better than what it is now! //fs, higu, enb //should auto generate a sidebar with a list of files added (in chronological order) //display page number on cursor click AND button press //yourthing.ToString, Integer.parseInt(yourthing), (direct) //charAt() //create a class called text //text objects- associated methods- getPages, getLines, getParagraphs, getWords, getCharacters //paan, peppermint filled chocolate, panang curry paste //on cursor click, it takes two clicks of the forward button...why is that? // //"designate/set as chapter header" button //T O D //another approach to page turning: //1) count the characters in the window- use multiples of 40 // ie. the number of chars in the first 40 lines, the second 40 lines, the third 40 lines, etc... //2) move the caret to the topmost character //3) move the cursor down by numberOfCharactersInWindow/viewingarea + 1 // -count characters normally ie. starting from 1, but don't forget to account for indeces when moving the cursor (ie. start from zero) //problems: does not take into account the starting position...you can get around this by disabling the scroll feature //approach 2: //1) first determine which "page" the cursor is on //2)... //part I: Sit going stir crazy and spoiling for a fight. D obliges by sending her on various "errands" //she finally gets used to life w/ him //that cave/cavern inspired by thatijs //was, for once and the first time, enjoying p //w/ highly ch m [] cr, in an adjacent //plunder ppp //the wanderer //urgh //instead of saving everything to the master document, you could have an array hold each chapter/loaded document //"previously opened docs" tracker //THE MEAT AND POTATOES //the two things iwmost //comple tum; pubnov,pjb,str,phsfortheloveofp*Litself /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package authorslilhelper; import com.gtranslate.Audio; import com.gtranslate.Language; import java.awt.Desktop; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Label; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URI; import java.util.ArrayList; import java.util.StringTokenizer; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ListView; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.input.Clipboard; import javafx.scene.input.ClipboardContent; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.stage.Modality; import javafx.stage.Stage; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.BreakType; import org.apache.poi.xwpf.usermodel.ParagraphAlignment; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; import com.sun.speech.freetts.FreeTTS; import com.sun.speech.freetts.Voice; import com.sun.speech.freetts.VoiceManager; import java.io.StringReader; import java.lang.reflect.Method; /** * * @author Quiggy */ public class FXMLDocumentController implements Initializable { @FXML public Button autoDesignate, remove, refreshButton, delete, emptyTrash, saveQuit; public Label onChapter; public Pane filesWindow; public AnchorPane anchorPane; public Boolean viewingMode; public int currentPage; public int totalPages; public ListView chaptersList; //use ctrl+shift+i to auto-import public Label onCharacter; public Label stats; public Label welcome; public Label musingsLabel, insertLabel; // public Label title; public AuthorsLilHelper instance; private Label label; public Label title; public Button fontup, fontdown; public Button loadFile; public Button save; public Button modeOn; public Button modeOff; public Button goTo; public Button tracker; public Button saveVersion; //public Button insert; public Button reset; public Button forward, backward; public Button createPrintable, plus, minus; public String installationPath = System.getProperty("user.home") + "/alhusers"; // public Button button; // public ListView list; // public JTextArea Primary; public Button designate; public TextArea Primary; public TextArea filesWindowText; public TextArea Insert; public TextField pageBox; // public ScrollBar scroll; String fileLocation = ""; String masterPath; public String currentUser; public String path; public TextArea Musings, Prewriting; public MenuBar menu; Stage stage; boolean magnified; boolean newUser; MenuItem on, off; MenuItem up; MenuItem down; public int fontsize; public double rowCapacity; public double characterCapacity; public int eIndex; //Clipboard systemClipboard; //ClipboardContent content; public Label musingsCounter, prewritingCounter, garbageCounter; public boolean reading; public String lastFocus = "primary"; boolean newText = false; /*@FXML private void loadFile(ActionEvent event) { try { FileReader reader = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while((s = br.readLine()) != null) { index = 0; while(index < s.length()) //change this { if((index == characterCapacity) && (index < s.length() - 1)) { while(s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if(endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch(Exception e) { } }*/ public void loadWordDocument() { try { JFileChooser chooser = new JFileChooser(); int value = chooser.showOpenDialog(null); if (value == JFileChooser.APPROVE_OPTION) { XWPFDocument docToAppend = new XWPFDocument(new FileInputStream(chooser.getSelectedFile())); XWPFWordExtractor extract = new XWPFWordExtractor(docToAppend); String fullText = extract.getText(); /* for(int q = 0; q < fullText.length(); q++) { if(q < fullText.length() - 3) { if(fullText.charAt(q) == '\n' && fullText.charAt(q+1) == '\t') { fullText = fullText.substring(0, q) + "\n\n" + fullText.substring(q + 1, fullText.length() - 1); } } }*/ //newly bracketed out //Primary.appendText(extract.getText()); String[] buttons = { "Append to end", "Insert at cursor location" }; int result = JOptionPane.showOptionDialog(null, "How would you like to insert the text? ", "Insert Text", JOptionPane.WARNING_MESSAGE, 0, null, buttons, buttons[1]); if (result == 0) { try { //FileReader reader = new FileReader(fileLocation); //InputStream in = IOUtils.toInputStream(fullText, "UTF-8"); StringReader reader = new StringReader(fullText); BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if (endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch (Exception e) { } //Primary.appendText(fullText); //resetOnPaste(); onClickOrKeyPress(); /*save(); Primary.selectAll(); Primary.clear(); reinitializePrimary();*/ String pathToSave = chooser.getSelectedFile().getAbsolutePath(); //adds the loaded file's name/path to the filetracker File filesLoadedLog = new File(installationPath + "/FileTracker" + currentUser); FileWriter writ = new FileWriter(filesLoadedLog, true); BufferedWriter bw = new BufferedWriter(writ); //writ.append("Hello World"); // if(filesLoadedLog.exists() == true) // { writ.append(pathToSave + "\n"); // title.setText(fileLocation); // } // else // { // writ.write(fileLocation); // title.setText(fileLocation); // } bw.close(); writ.close(); } if (result == 1) { Primary.insertText(Primary.getCaretPosition(), "\n"); //Primary.nextWord(); //Primary.forward(); int desiredCaretPosition = Primary.getCaretPosition(); Primary.end(); int start = Primary.getCaretPosition(); try { StringReader reader = new StringReader(fullText); BufferedReader br = new BufferedReader(reader); //FileReader reader = new FileReader(fileLocation); //BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if (endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch (Exception e) { } Primary.end(); int end = Primary.getCaretPosition(); Primary.selectRange(start, end); String appendedText = Primary.getSelectedText(); Primary.deleteText(start, end); Primary.insertText(desiredCaretPosition, appendedText); // int caretPosition = Primary.getCaretPosition(); //NEWLY BRACKETED OUT // Primary.insertText(caretPosition, fullText); //NEWLY BRACKETED OUT //resetOnPaste(); onClickOrKeyPress(); /*save(); Primary.selectAll(); Primary.clear(); reinitializePrimary();*/ String pathToSave = chooser.getSelectedFile().getAbsolutePath(); //adds the loaded file's name/path to the filetracker File filesLoadedLog = new File(installationPath + "/FileTracker" + currentUser); FileWriter writ = new FileWriter(filesLoadedLog, true); BufferedWriter bw = new BufferedWriter(writ); //writ.append("Hello World"); // if(filesLoadedLog.exists() == true) // { writ.append(pathToSave + "\n"); // title.setText(fileLocation); // } // else // { // writ.write(fileLocation); // title.setText(fileLocation); // } bw.close(); writ.close(); } } else { } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Images are not supported. If your document contains images, it will not be loaded. Please remove the images or paste the text into another document and try again."); } } public void loadTextDocument() { JFileChooser chooser = new JFileChooser(); int value = chooser.showOpenDialog(null); if (value == JFileChooser.APPROVE_OPTION) { fileLocation = chooser.getSelectedFile().getPath(); //adds files to file tracker try { File filesLoadedLog = new File( installationPath + "/userdata/" + currentUser + "/userprefs/filetracker.txt"); FileWriter writ = new FileWriter(filesLoadedLog, true); BufferedWriter bw = new BufferedWriter(writ); //writ.append("Hello World"); // if(filesLoadedLog.exists() == true) // { writ.append(fileLocation + "\n"); // title.setText(fileLocation); // } // else // { // writ.write(fileLocation); // title.setText(fileLocation); // } bw.close(); writ.close(); } catch (Exception e) { } try { String[] buttons = { "Append to end", "Insert at cursor location" }; int result = JOptionPane.showOptionDialog(null, "How would you like to insert the text? ", "Insert Text", JOptionPane.WARNING_MESSAGE, 0, null, buttons, buttons[1]); if (result == 0) { try { FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if (endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch (Exception e) { } /* FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String aLine; Primary.appendText("\n"); while((aLine = br.readLine()) != null) { Primary.appendText(aLine + "\n"); }*/ // dialog.close(); } if (result == 1) { Primary.insertText(Primary.getCaretPosition(), "\n"); //Primary.nextWord(); //Primary.forward(); int desiredCaretPosition = Primary.getCaretPosition(); Primary.end(); int start = Primary.getCaretPosition(); try { FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if (endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch (Exception e) { } Primary.end(); int end = Primary.getCaretPosition(); Primary.selectRange(start, end); String appendedText = Primary.getSelectedText(); Primary.deleteText(start, end); Primary.insertText(desiredCaretPosition, appendedText); /*FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String aLine; int desiredCaretPosition = Primary.getCaretPosition(); Primary.appendText("\n"); int start = Primary.getCaretPosition(); while((aLine = br.readLine()) != null) { Primary.appendText(aLine + "\n"); } //Primary.positionCaret(start); //Primary.selectEnd(); //String text = Primary.getSelectedText(); //Primary. Primary.positionCaret(Primary.getSelectedText().length() - 1); int end = Primary.getCaretPosition(); Primary.selectRange(start, end); String appendedText = Primary.getSelectedText(); Primary.deleteText(start, end); Primary.insertText(desiredCaretPosition, appendedText);*/ //8 lines: /*Clipboard systemClipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); Primary.end(); Primary.selectRange(endPos, Primary.getCaretPosition()); content.putString(Primary.getSelectedText()); Primary.cut(); Primary.positionCaret(caretPosition); Primary.paste();*/ /* try { String masterString = new Scanner(new File(fileLocation)).useDelimiter("\\Z").next(); Primary.insertText(Primary.getCaretPosition(), masterString); } catch(IOException e) {}*/ /*FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String aLine; int desiredCaretPosition = Primary.getCaretPosition(); Primary.appendText("\n"); int start = Primary.getCaretPosition(); while((aLine = br.readLine()) != null) { Primary.appendText(aLine + "\n"); } //Primary.positionCaret(start); //Primary.selectEnd(); //String text = Primary.getSelectedText(); //Primary. Primary.positionCaret(Primary.getSelectedText().length() - 1); int end = Primary.getCaretPosition(); Primary.selectRange(start, end); String appendedText = Primary.getSelectedText(); Primary.deleteText(start, end); Primary.insertText(desiredCaretPosition, appendedText);*/ } /* FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String aLine; Primary.appendText("\n"); while((aLine = br.readLine()) != null) { Primary.appendText(aLine + "\n"); } // dialog.close(); //save(); //Primary.selectAll(); //Primary.clear(); //reinitializePrimary(); */ } catch (Exception e) { System.out.println("Exception: " + e); //JOptionPane.showMessageDialog(null, "File not found. Please check the path and try again."); // dialogVbox.getChildren().add(new Text("File not found. Please check the path and try again.")); } } /*System.out.println("You clicked me!"); final Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); final TextField textField = new TextField(); Button submit = new Button(); Button cancel = new Button(); cancel.setText("Cancel"); cancel.setAlignment(Pos.CENTER); submit.setText("Submit"); submit.setAlignment(Pos.BOTTOM_RIGHT); // submit. final VBox dialogVbox = new VBox(20); dialogVbox.getChildren().add(new Text("Enter file location: ")); dialogVbox.getChildren().add(textField); dialogVbox.getChildren().add(submit); dialogVbox.getChildren().add(cancel); Scene dialogScene = new Scene(dialogVbox, 300, 200); dialog.setScene(dialogScene); dialog.setTitle("Path Required"); dialog.show(); submit.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { fileLocation = textField.getText(); //adds files to file tracker try { File filesLoadedLog = new File(installationPath + "/userdata/" + currentUser + "/userprefs/filetracker.txt"); FileWriter writ = new FileWriter(filesLoadedLog, true); BufferedWriter bw = new BufferedWriter(writ); //writ.append("Hello World"); // if(filesLoadedLog.exists() == true) // { writ.append(fileLocation + "\n"); // title.setText(fileLocation); // } // else // { // writ.write(fileLocation); // title.setText(fileLocation); // } bw.close(); writ.close(); } catch(Exception e) { } try { FileReader reader = new FileReader(fileLocation); BufferedReader br = new BufferedReader(reader); String aLine; Primary.appendText("\n"); while((aLine = br.readLine()) != null) { Primary.appendText(aLine + "\n"); } dialog.close(); //save(); //Primary.selectAll(); //Primary.clear(); //reinitializePrimary(); } catch(Exception e) { dialogVbox.getChildren().add(new Text("File not found. Please check the path and try again.")); } } }); cancel.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { dialog.close(); //close the window here } }); //htt //a state of extreme r // primary. */ } public void addPathToFileTracker() { } @FXML private void loadFile(ActionEvent event) { //JOptionPane pane = new JOptionPane(); //pane Object[] possibilities = { "text file (.txt)", "word document (.docx)" }; String s = (String) JOptionPane.showInputDialog(null, "Select the type of file you would like to append:\n", "File Type", JOptionPane.PLAIN_MESSAGE, null, possibilities, "text file (.txt)"); if (s == "text file (.txt)") { loadTextDocument(); } /* if(s == "word document (.docx)") { try { JFileChooser chooser = new JFileChooser(); int value = chooser.showOpenDialog(null); if(value == JFileChooser.APPROVE_OPTION) { XWPFDocument docToAppend = new XWPFDocument(new FileInputStream(chooser.getSelectedFile())); XWPFWordExtractor extract = new XWPFWordExtractor(docToAppend); Primary.appendText(extract.getText()); } save(); Primary.selectAll(); Primary.clear(); reinitializePrimary(); String pathToSave = chooser.getSelectedFile().getAbsolutePath(); //adds the loaded file's name/path to the filetracker File filesLoadedLog = new File(installationPath + "/FileTracker" + currentUser); FileWriter writ = new FileWriter(filesLoadedLog, true); BufferedWriter bw = new BufferedWriter(writ); //writ.append("Hello World"); // if(filesLoadedLog.exists() == true) // { writ.append(pathToSave + "\n"); // title.setText(fileLocation); // } // else // { // writ.write(fileLocation); // title.setText(fileLocation); // } bw.close(); writ.close(); } catch(Exception e) { } } */ if (s == "word document (.docx)") { loadWordDocument(); } } /* public String getPath() { path = }*/ @FXML //rikHany<3:D //public void getPage() public void currentRowTest() { title.setText(Integer.toString(getCurrentRow())); } public void onClickOrKeyPress() { if (viewingMode == false) { //stats section onCharacter.setText(Integer.toString(Primary.getCaretPosition())); //displays total characters if (magnified == false) { stats.setText("Total characters including blank lines, indentations, & whitespace: " + Primary.getText().length() + "\n" + "Total characters without blank lines, indentations, & whitespace: " + getTotalCharacters() + "\n" + "Total Words: " + getTotalWords() + "\n\n" + "Total Rows: " + getTotalRows() + "\n\n" + "Total Pages: " + (int) getTotalPages() + "\n" + "On page " + getCurrentPageNumber()); } else { stats.setText("Total characters including blank lines, indentations, & whitespace: " + Primary.getText().length() + "\n" + "Total characters without blank lines, indentations, & whitespace: " + getTotalCharacters() + "\n" + "\n\n" + "Total Rows: " + getTotalRows() + "\n\n" + "Total Pages: " + (int) getTotalPages() + "\n" + "On page " + getCurrentPageNumber()); } //list refresh section repopulateListBasedOnText(); //auxillary counters int c1; String musingsText = Musings.getText(); musingsText = musingsText.trim(); musingsText = musingsText.replaceAll("\\s+", ""); c1 = musingsText.length(); musingsCounter.setText(Integer.toString(c1)); int c2; String prewritingText = Prewriting.getText(); prewritingText = prewritingText.trim(); prewritingText = prewritingText.replaceAll("\\s+", ""); c2 = prewritingText.length(); prewritingCounter.setText(Integer.toString(c2)); int c3; String garbageText = Insert.getText(); garbageText = garbageText.trim(); garbageText = garbageText.replaceAll("\\s+", ""); c3 = garbageText.length(); garbageCounter.setText(Integer.toString(c3)); // onChapter(); //NEW! } else { stats.setText(""); } } public int getTotalCharacters() { int numberOfCharacters; String primaryText = Primary.getText(); primaryText = primaryText.trim(); primaryText = primaryText.replaceAll("\\s+", ""); numberOfCharacters = primaryText.length(); return numberOfCharacters; } public int getCurrentRow() { //get a substring that is from Primary.home() to the current caret position...ie. select from home to the current position int savedCursorPosition = Primary.getCaretPosition(); //Primary.home(); //Primary.selectRange(Primary.getCaretPosition(), savedCursorPosition); //String substring = Primary.getSelectedText(); String substring = Primary.getText(0, savedCursorPosition); //sets the cursor back to its original position /*Primary.deselect(); Primary.positionCaret(savedCursorPosition);*/ //Primary.positionCaret(savedCursorPosition); int newLineCharacters = 1; for (int cI = 0; cI < substring.length(); cI++) { char currentCharacter = substring.charAt(cI); if (currentCharacter == '\n' || currentCharacter == '\r') { newLineCharacters++; } } /*String[] lines = substring.split("\n"); newLineCharacters = lines.length;*/ return newLineCharacters; } public int getTotalRows() { int totalRows; String primaryText = Primary.getText(); String[] lines = primaryText.split("\r\n|\r|\n"); totalRows = lines.length; return totalRows; } public double getTotalPages() { double pages = getTotalRows() / rowCapacity; String p = Double.toString(pages); Boolean onTheRight = false; String left = ""; String right = ""; for (int i = 0; i < p.length(); i++) { char currentCharacter = p.charAt(i); if (currentCharacter == '.') { onTheRight = true; } if (onTheRight == false) { left = left + currentCharacter; } if ((onTheRight == true) && (currentCharacter != '.')) { right = right + currentCharacter; } } if (Double.parseDouble(left) < 0) { pages = 1; } else { if (Double.parseDouble(right) > 0) { pages = Double.parseDouble(left) + 1; } else { pages = Double.parseDouble(left); } } //_.__ --> if right = 0, pgs = left; if right > 0, pgs = right + 1 return pages; } public int getCurrentPageNumber() { int currentPage; double pages = getCurrentRow() / rowCapacity; String p = Double.toString(pages); Boolean onTheRight = false; String left = ""; String right = ""; for (int i = 0; i < p.length(); i++) { char currentCharacter = p.charAt(i); if (currentCharacter == '.') { onTheRight = true; } if (onTheRight == false) { left = left + currentCharacter; } if ((onTheRight == true) && (currentCharacter != '.')) { right = right + currentCharacter; } } if (Double.parseDouble(left) < 0) { currentPage = 1; } else { if (Double.parseDouble(right) > 0) { currentPage = Integer.parseInt(left) + 1; } else { currentPage = Integer.parseInt(left); } } return currentPage; //currentline/40.0 //if left < 0 --> currentPage = 1 //if left > 0 -->if(right > 0){currentPage = left + 1} else{currentPage = left} } public int getTotalWords() { int totalWords = 0; String primaryText = Primary.getText(); String state = ""; char currentCharacter = ' '; for (int i = 0; i < primaryText.length(); i++) { currentCharacter = primaryText.charAt(i); // If next character is a separator, set the state as OUT if (currentCharacter == ' ' || currentCharacter == '\n' || currentCharacter == '\t') { if (state == "in") { state = "out"; totalWords++; } else { } } else { state = "in"; } } return totalWords; } public void countWordsInSelection() { } public void designateAsChapter() { //add the selection to the list, at the correct index //make the selection bold/a different font //Text t = new Text(); //what did I put this here for? //Primary.insertText(a, t); // Primary.selectRange(1, 5); String selectedText = Primary.getSelectedText(); int length = selectedText.length(); //int caretPosition = Primary.getCaretPosition(); //int caretPosition; int start = Primary.getSelection().getStart(); int end = Primary.getSelection().getEnd(); int caretPosition = end; Primary.positionCaret(start); Primary.deselect(); Primary.insertText(end, "-\n\n"); //Formerly: "---\n\n" Primary.positionCaret(end); for (int i = 0; i < (length - 1) + 1; i++) { Primary.backward(); } caretPosition = Primary.getCaretPosition(); Primary.insertText(caretPosition, "\n\n\n~"); //Formerly: "\n\n\n@---" //inserts the new chapter into the chapters list (sidebar) at the appropriate position repopulateListBasedOnText(); //yt- shifted perspectives, f blog- the curried coconut- animal-free indo-malay fusion cusine - curry crt //repopulate list from text //rearrange chapters in text based on sidebar //Vote (5) to Kick Troll //Who's talking about their ... right now, get advice, stories & articles, humor/jokes/columns, 1 //fdm //perceived time/perception of time (passage/flow) // String alphaBeta = new String(); // alphaBeta = "sdfsfa"; //Primary.selectForward, Primary.selectBackward //Primary.clear Primary.deselect // Primary.replaceSelection(alphaBeta); //Primary.replaceText(a, a, masterPath) //Primary.setStyle(); //Primary.getSelectedText(); //Primary.getStyle(); //Primary.selectedTextProperty().is //should be unnecessary in this method: //reorderChapters(); } public void reorderListBasedOnSidebar() { } public void repopulateListBasedOnText() { ArrayList chapters = new ArrayList(); String primaryText = Primary.getText(); int i = 0, ats = 0; while (i < primaryText.length()) { char currentChar = primaryText.charAt(i); if (currentChar == '~') { ats++; int i2 = i + 1; char c; c = ' '; String chapterName = ""; while (c != '-') { c = primaryText.charAt(i2); chapterName = chapterName + c; i2++; } chapters.add(chapterName); } i++; } ObservableList<String> items = FXCollections.observableArrayList("Single", "Double"); items.clear(); for (int counter = 0; counter < chapters.size(); counter++) { items.add(chapters.get(counter).toString()); } chaptersList.setItems(items); } public void jumpToChapter() { if (viewingMode == false) { System.out.println("hello jumpToChapter method"); int listIndex, charIndex, numberOfAts, ats; listIndex = chaptersList.getSelectionModel().getSelectedIndex(); //Primary.appendText(Integer.toString(listIndex)); //System.out.println(listIndex); String primaryText = Primary.getText(); charIndex = 0; ats = 0; while (ats <= listIndex) { char currentChar = primaryText.charAt(charIndex); if (currentChar == '~') { ats++; } charIndex++; } Primary.positionCaret(charIndex); Primary.selectForward(); //BufferedReader br = new BufferedReader(primaryText); --> use charAt(yada) instead //the alternative way to do this: //Primary.home(); //Primary. //while (numberOfAts != index) //{c++/Primary.forward(); if(char = '@'){ats++;}} } else { String pageText = Primary.getText(); int listIndex, charIndex, numberOfAts, ats; int chapterIndex = chaptersList.getSelectionModel().getSelectedIndex(); String chapterTitle = chaptersList.getItems().get(chapterIndex).toString(); System.out.println("Chapter Title: " + chapterTitle); //Primary.appendText(Integer.toString(listIndex)); //System.out.println(listIndex); goToPage(1); int cPage = 1; double lastPage = totalPages; System.out.println(lastPage); System.out.println("Chapter Title: "); System.out.println(chapterTitle); while (cPage < lastPage) { int isNull = Primary.getText().indexOf(chapterTitle); System.out.println("Hello isNull: " + isNull); if (isNull != -1) { //break; cPage = (int) lastPage; break; } pageViewingModeForward(); cPage++; } } } public String getCurrentRowAndCharacterIndex() { rowIndex = 0; caretIndex = 0; int totalLines = 0; linesToTop = 0; linesToBottom = 0; //feslsh:D title.setText(Integer.toString(Primary.getCaretPosition())); caretIndex = Primary.getCaretPosition(); char character = ' '; int characterIndex = 0; String stringToBeParsed = Primary.getText(); String substring = ""; //int characterCounter = 0; while (characterIndex <= caretIndex) { character = stringToBeParsed.charAt(characterIndex); // System.out.println(character); substring = substring + character; if (character == '\n') { rowIndex++; //check substring width here- COUNTS CHARACTERS IN SUBSTRING and then divides it by the max allowed characters to determine how many additional lines there are double charactersInSubstring = 0; while (charactersInSubstring < substring.length()) { charactersInSubstring++; } double quotient = charactersInSubstring / 78.00; double linesToAdd = 0; //round down if the quotient is less than one if (quotient < 1) { linesToAdd = Math.floor(quotient); } //round up if the quotient is greater than one if (quotient > 1) { linesToAdd = Math.ceil(quotient); } rowIndex = rowIndex + (int) linesToAdd; substring = ""; } // Primary.isWrapText() //keep going // count the lines to this point ie. "rowIndex" characterIndex++; //characterCounter++; } // System.out.println(rowIndex); // System.out.println(characterIndex); String sepByComma = Integer.toString(rowIndex) + "," + Integer.toString(characterIndex); return sepByComma; } public double getCurrentPage() { //gets the data encoded in the string returned by getCurrentRowAndCharacterIndex() String containsIndexes = getCurrentRowAndCharacterIndex(); String rI = ""; StringTokenizer tokenizer = new StringTokenizer(containsIndexes); int counter = 0; while (tokenizer.hasMoreElements()) { counter++; String token = tokenizer.nextElement().toString(); if (counter == 1) { rI = token; } } int rowIndex = Integer.parseInt(rI); title.setText("Line Index: " + rI); int lineNumber = rowIndex - 1; double page; if (rowIndex < rowCapacity) { page = 1; } else { page = lineNumber / rowCapacity; String pageNumber = Double.toString(page); Boolean leftOfDecimalPoint = true; char aChar = ' '; String left = ""; String right = ""; for (int c = 0; c < pageNumber.length(); c++) { aChar = pageNumber.charAt(c); if (aChar == '.') { leftOfDecimalPoint = false; } if (leftOfDecimalPoint == true && aChar != '.') { left = left + aChar; } if (leftOfDecimalPoint == false && aChar != '.') { right = right + aChar; } } page = Integer.parseInt(left); if (Integer.parseInt(right) > 0) { page = page + 1; } } System.out.println("On page " + page); return page; } public void previousPage() { if (viewingMode == false) { regModeBackward(); /*double page = getCurrentRow()/40.0; char ch = ' '; String left = ""; if(page < 1) { page = 1; } else { int i = 0; while(ch != '.') { left = left + ch; ch = Double.toString(page).charAt(i); i++; } page = Double.parseDouble(left.trim()); } int desiredRow; //determine the current page //set the cursor to the end of the current page if(page == 1 || page == 2) { Primary.home(); } if(page == getTotalPages()) { desiredRow = (((int)getTotalPages() - 1)*40) + 80; Primary.end(); while(getCurrentRow() != desiredRow) { Primary.backward(); } } if(page != 1 || page != 2 || page != getTotalPages()) { int bottom = Integer.parseInt(left.trim())* 40; desiredRow = bottom - 79; while(getCurrentRow() != desiredRow) { Primary.backward(); } } //go up 80 lines //if the current page is the last page... /*Primary.end(); int extraLines = getTotalRows() % 40; desiredRow = getTotalRows() - extraLines - 40; while(getCurrentRow() != desiredRow) { Primary.backward(); }*/ /*if() { } if() { }*/ } else { pageViewingModeBackward(); } } public void nextPage() { if (viewingMode == false) { regModeForward(); /*int currentPage, desiredRow; double a = getCurrentRow()/40.0; char aCharacter = ' '; String left = ""; int i = 0; while(aCharacter != '.') { left = left + aCharacter; aCharacter = Double.toString(a).charAt(i); i++; } if(a < 1) { currentPage = 1; Primary.home(); desiredRow = 80; while(getCurrentRow() != desiredRow) { Primary.forward(); } } if(a > 1 && a < getTotalPages() - 1) { //multiply left by 40, and then move the cursor to that positoin int top = Integer.parseInt(left.trim())* 40; desiredRow = top + 40; Primary.home(); while(getCurrentRow() != desiredRow) { Primary.forward(); } } if(a == getTotalPages() - 1) { /*int remainingRows = getCurrentRow() % 40; int top = Integer.parseInt(left.trim())* 40; desiredRow = top + (40-remainingRows); Primary.home(); while(getCurrentRow() != desiredRow) { Primary.forward(); } // Primary.end(); //insert the remaining rows as blank space ONE TIME }*/ } else { pageViewingModeForward(); } } //Primary.positionCaret(Primary.getCaretPosition()); // BufferedReader br = new BufferedReader(Primary.getText()); //while the caret position has not been reached, do this stuff--> //determines the rowIndex //rowIndex = 0; public int readNumberOfLinesInFile() { int numberOfRows = 0; return numberOfRows; } public int rowIndex, caretIndex, linesToTop, linesToBottom; @FXML public void displayCaretPositionOnClick() { rowIndex = 0; caretIndex = 0; linesToTop = 0; linesToBottom = 0; //yame //glad to hear it //recog dawned...it was always y o t...it was y. //I n l t...a //gdy, K y p, s!, cowed //ah, tables~ (hist repeating itself for Sit in non-obvious ways) //find *dat* comic :3 System.out.println("Hello World"); //title.setText("Inside getRowNumberOnClick Method"); //To do this, save the line as a string, and then have the buffered reader search for a string (the line) while incrementing a counter //Primary.selectPositionCaret(0); //Primary.selectNextWord/Select forward title.setText(Integer.toString(Primary.getCaretPosition())); caretIndex = Primary.getCaretPosition(); //Primary.positionCaret(Primary.getCaretPosition()); // BufferedReader br = new BufferedReader(Primary.getText()); //while the caret position has not been reached, do this stuff--> //determines the rowIndex rowIndex = 0; char character = ' '; int characterIndex = 0; String stringToBeParsed = Primary.getText(); String substring = ""; //int characterCounter = 0; while (characterIndex <= caretIndex) { character = stringToBeParsed.charAt(characterIndex); // System.out.println(character); substring = substring + character; if (character == '\n') { rowIndex++; //check substring width here- COUNTS CHARACTERS IN SUBSTRING and then divides it by the max allowed characters to determine how many additional lines there are double charactersInSubstring = 0; while (charactersInSubstring < substring.length()) { charactersInSubstring++; } double quotient = charactersInSubstring / 78.00; double linesToAdd = 0; //round down if the quotient is less than one if (quotient < 1) { linesToAdd = Math.floor(quotient); } //round up if the quotient is greater than one if (quotient > 1) { linesToAdd = Math.ceil(quotient); } rowIndex = rowIndex + (int) linesToAdd; substring = ""; } // Primary.isWrapText() //keep going // count the lines to this point ie. "rowIndex" characterIndex++; //characterCounter++; } // System.out.println(rowIndex); // System.out.println(characterIndex); if (rowIndex < (rowCapacity - 1)) { linesToTop = rowIndex; linesToBottom = (int) (rowCapacity - 1) - rowIndex; } //had earned her the title : T Wa // /Exp //She *always* had been a bit of a w //title: TBA/AOD/HOD/DA/TWA-funerary garments //quickly, he tugged at his sleeves //as prop dictated //more sh than exc (or perhaps he didn't sw that way) //promised to be a good/exc/fun sh, with him as the rl/g its dire else { int remainder = (rowIndex + 1) % (int) rowCapacity; //lines to top of window linesToTop = remainder; //lines to bottom of window linesToBottom = (int) (rowCapacity - 1) - linesToTop; } // System.out.println(linesToTop); // System.out.println(linesToBottom); // System.out.println(rowIndex); //Msc Note: getParagraphs is also a built in method // Primary.getText().contains(null) // Primary.positionCaret(7000); // Primary.setId(null); // Primary.getText().indexOf(""); //Use this to get the caret position[row number] // title.setText(Integer.toString(Primary.getText().length())); // title.setText(Primary.getText());// it treats this as a SINGLE string seperated by newline characters...you could feed this into a buffered reader and use it to calculate the number of rows // while(the new line char has not been reached) // title.setText(Primary.getText()); //gets ALL of the text //rowIndex = whatever pops out of the while loop //linesToTop //linesToBottom } public void onDragReleased() { System.out.println("you dragged a row"); } public int charactersToTop() { int numberOfCharacters = 0; return numberOfCharacters; } public int charactersToBottom() { //Get a substring starting from the caret index, and ending at the end of the last row in the window //subtracts rowIndex from the appropriate multiple of 39 //a loop reads every line through the last line, and counts the characters int numberOfNewLineCharacters = 0; int characterIndex = caretIndex; char character = ' '; String string = Primary.getText(); String substring = ""; /*while(row <= linesToBottom) { Primary.getText().charAt(caretIndex); row++; }*/ while (numberOfNewLineCharacters < linesToBottom) { character = string.charAt(characterIndex); characterIndex++; substring = substring + character; if (character == '\n') { numberOfNewLineCharacters++; //check substring width here- COUNTS CHARACTERS IN SUBSTRING and then divides it by the max allowed characters to determine how many additional lines there are double charactersInSubstring = 0; while (charactersInSubstring < substring.length()) { charactersInSubstring++; } double quotient = charactersInSubstring / 78.00; double linesToAdd = 0; //round down if the quotient is less than one if (quotient < 1) { linesToAdd = Math.floor(quotient); } //round up if the quotient is greater than one if (quotient > 1) { linesToAdd = Math.ceil(quotient); } numberOfNewLineCharacters = numberOfNewLineCharacters + (int) linesToAdd; substring = ""; } } //System.out.println(character); //substring = substring + character; //int numberOfCharacters = 0; //2) uses a line-counting loop similar to the ones used in the onClick method /*for(int lineIndex = rowIndex; lineIndex <= rowIndex + 40; lineIndex++) { //counts the characters to the bottom ...in other words, the last /n }*/ // System.out.println(caretIndex + substring.length()); return characterIndex; } public int pages() { String theEntireText = Primary.getText(); int numberOfPages = 0; //pages = linesinfile/40.0 return numberOfPages; } //illusory cave //illusory built passage/tunnel (with those awesomely hot/cute trio of e g's:D) //Rak's //stuck em w/ a big ol spear //the remnants of a society that has forgotten. int a; /* public void displayNextPage() { int numberOfNewLineCharacters = 0; a = 0; //MOVES THE CARET FORWARD until #ofNewLines = #ofLinesToBottom while(numberOfNewLineCharacters <= linesToBottom) { if(Primary.getText().charAt(Primary.getCaretPosition()) == '\n') { numberOfNewLineCharacters++; } Primary.forward(); a++; } //System.out.println("End of Page position: " + charactersToBottom()); //Primary.positionCaret(caretIndex + (charactersToBottom() + 2)); //moves the cursor to Primary.positionCaret(caretIndex + (charactersToBottom() + 1)) //Ignore: 1) moves the cursor to the top using the charactersToTop method...ie. Primary.positionCaret(caretIndex-charactersToTop()) // int onePage = (int)Primary.getHeight(); //Primary.positionCaret(Primary.); // Primary.setCaretPosition(Primary.getDocument().getLength()); //Primary.positionCaret((int)Primary.getCaretPosition() - 150); // Primary.positionCaret((int)Primary.getCaretPosition() + 300); //this function will also clear the selection- NO IT DOESN'T THANK GOD AND ALL THAT IS HOLY!!!! //System.out.println(Primary.getCaretPosition()); //selectPositionCaret // Primary.selectNextWord(); // Primary.selectHome(); //Get the current cursor position (ie. row number) //rownumber mod 40 OR anchorposition mod 478 //move the cursor up by the remainder (ie. subtract the remainder from the row number) //move the cursor down by 41/479 (because 40/479 is the number of rows that is displayed at any one time) //OR //count the current lines, and in doing so, determine the cursor's line // System.out.println(Primary.getBaselineOffset()); // System.out.println(Primary.getCaretPosition()); //ScrollPane scrollPane = new ScrollPane(); //TextLineNumber tln = new TextLineNumber(Primary); //System.out.println(Primary.getAnchor()); } */ public void initializeMag() { Primary.clear(); try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window while ((aLine = br2.readLine()) != null) { Primary.appendText(aLine); } } catch (Exception e) { } /*String s = Primary.getText(); String z = Primary.getText(); ArrayList indeces = new ArrayList(); for(int i = 0; i < s.length() - 2; i++) { if(s.charAt(i) == '\n' || s.charAt(i) == '\r') { if(i < s.length() - 5) {z = s.substring(0, i) + s.substring(i + 1, s.length() - 1);} } } Primary.clear(); Primary.setText(z);*/ /*String s = Primary.getText(); //s = s.replaceAll("\t", "&"); s = s.replaceAll("\t", "^"); s = s.replaceAll("\n", ""); Primary.clear(); Primary.setText(s);*/ /*String s = "tiger"; String z = s.substring(0, 2) + s.substring(3, s.length()); System.out.println(z);*/ //&& s.charAt(i+1) != '\n' /*try{ String primaryText = Primary.getText(); File fs = new File(installationPath + "/userdata/" + currentUser + "/userprefs/temp.txt"); FileWriter writ = new FileWriter(fs, false); //it is set to false so that the font size will be overwritten every time BufferedWriter bw = new BufferedWriter(writ); writ.append(primaryText); bw.close(); writ.close(); Primary.clear(); FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/userprefs/temp.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window while((aLine = br2.readLine()) != null) { if(aLine.length() > characterCapacity) { ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double)aLine.length()/characterCapacity); double remainingCharas = (double)aLine.length() % characterCapacity; int onSegment = 1; int currentCharIndex = 0; int toIndex = (int)(characterCapacity - 1); do { aLine = aLine.replaceAll("\n", ""); //Primary.selectBackward(); //Primary.clear(); Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); currentCharIndex = toIndex; toIndex = toIndex + (int)characterCapacity; onSegment++; } while(onSegment <= numberOfWholeSegments); toIndex = toIndex - (int)characterCapacity + (int)remainingCharas + 1; String z = aLine.substring(currentCharIndex, toIndex); // z = z.replaceAll("\n", ""); Primary.appendText(z + "\n"); //Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); /*while() while(currentCharIndex < aLine.length()) { for(int c = currentCharIndex; c < 90; c++) { } }*/ /*for(int c = 0; c < aLine.length(); c++) { if(c % 90 == 0) { Primary.appendText(aLine.substring(n, c) + "\n"); n = c; } }*/ /* } else { Primary.appendText(aLine + "\n"); //appendText, insertText, setText } //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; //ct++; } Primary.positionCaret(0); }catch(Exception e){}*/ } public void fontUp() { Primary.setStyle("-fx-font-size: 20"); //30 rows, ___ chars per row //fontsize = 2; //rowCapacity = 30; //characterCapacity = 74; //rowCapacity = 24.0; //characterCapacity= 55.0; magnified = true; Primary.setWrapText(false); plus.setDisable(true); up.setDisable(true); minus.setDisable(false); down.setDisable(false); //initializeMag(); //Primary.setStyle("-fx-font-size: 20"); /*System.out.println("fu"); try { //System.out.println("Here's the master path: " + masterPath); FileReader r1 = new FileReader(installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); BufferedReader br = new BufferedReader(r1); //String line; int currentFontSize = Integer.parseInt(br.readLine().trim()); int desiredFontSize = currentFontSize + 1; if((Integer.toString(desiredFontSize)).equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 24.0; characterCapacity= 55.0; //System.out.println("hioverhere"); Primary.setStyle("-fx-font-size: 20"); } br.close(); r1.close(); } catch(Exception e) { System.out.println(e); } System.out.println("fu"); //plus.setDisable(true); //minus.setDisable(false); /*if(desiredFontSize == 2) { Primary.setStyle("-fx-font-size: 20"); plus.setDisable(true); }*/ //set the default font size to "1" during installation/file creation //in every run, the program should check and set the currentfontsize variable, as well as display *that* font size //the buttons should also be checked for enable/disable behavior (ie. if the font size is already at the minimum, then the "-" button should be inactive, and vice-versa for the "+" button //set the new current font size here // currentFontSize = desiredFontSize; //write it to the user prefs file (overwrite the fontsize file with the new font size) /* try { File fs = new File(installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); FileWriter writ = new FileWriter(fs, false); //it is set to false so that the font size will be overwritten every time BufferedWriter bw = new BufferedWriter(writ); writ.append(Integer.toString(fontsize).trim()); bw.close(); writ.close(); } catch (IOException e) {} //recalculateRows(); //recalculatePages(); //getTotalRows(); //getTotalPages(); //save(); Primary.clear(); reinitializePrimary(); getTotalRows(); onClickOrKeyPress();*/ } public void fontDown() { //fontsize = 1; //rowCapacity = 40.0; //characterCapacity = 90.0; magnified = false; Primary.setWrapText(true); if (fontsize == 1) { Primary.setStyle("-fx-font-size: 12"); } if (fontsize == 2) { Primary.setStyle("-fx-font-size: 14"); } if (fontsize == 3) { Primary.setStyle("-fx-font-size: 16"); } minus.setDisable(true); down.setDisable(true); plus.setDisable(false); up.setDisable(false); /*try { FileReader r1 = new FileReader(installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); BufferedReader br = new BufferedReader(r1); //String line; int currentFontSize = Integer.parseInt(br.readLine().trim()); int desiredFontSize = currentFontSize - 1; if((Integer.toString(desiredFontSize)).equalsIgnoreCase("1")) { fontsize = 1; rowCapacity = 40.0; characterCapacity= 90.0; Primary.setStyle("-fx-font-size: 12"); } br.close(); r1.close(); } catch(Exception e) { System.out.println(e); } //plus.setDisable(false); //minus.setDisable(true); System.out.println("fd"); /*if(desiredFontSize == 2) { Primary.setStyle("-fx-font-size: 20"); plus.setDisable(true); }*/ //set the default font size to "1" during installation/file creation //in every run, the program should check and set the currentfontsize variable, as well as display *that* font size //the buttons should also be checked for enable/disable behavior (ie. if the font size is already at the minimum, then the "-" button should be inactive, and vice-versa for the "+" button //set the new current font size here // currentFontSize = desiredFontSize; //write it to the user prefs file (overwrite the fontsize file with the new font size) /* System.out.println("fd"); try { File fs = new File(installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); System.out.println("fd"); FileWriter writ = new FileWriter(fs, false); //it is set to false so that the font size will be overwritten every time BufferedWriter bw = new BufferedWriter(writ); writ.append(Integer.toString(fontsize).trim()); bw.close(); writ.close(); } catch (IOException e) { System.out.println(e); } System.out.println("fd"); //recalculateRows(); //recalculatePages(); //getTotalRows(); //getTotalPages(); save(); Primary.clear(); reinitializePrimary(); getTotalRows(); onClickOrKeyPress();*/ } /*public int recalculateRows() { return getTotalRows(); } public int recalculatePages() { return 5; }*/ public void displayPreviousPage() { //title.setText("back button pressed"); for (int c = 0; c < a; c++) { Primary.backward(); } /* int numberOfNewLineCharacters = 0; //MOVES THE CARET backward until #ofNewLines = #ofLinesToTop while(numberOfNewLineCharacters <= linesToTop + 39) { if(Primary.getText().charAt(Primary.getCaretPosition()) == '\n') { numberOfNewLineCharacters++; } Primary.backward(); }*/ // Primary. // Primary.positionCaret((int)Primary.getCaretPosition() - 300); // int onePage = (int)Primary.getHeight(); // Primary.positionCaret((int)Primary.getCaretPosition() - (onePage+150)); //this function will also clear the selection- NO IT DOESN'T THANK GOD AND ALL THAT IS HOLY!!!! } public void rearrangeList() { } public void reorderChapters() { } @Override public void initialize(URL url, ResourceBundle rb) { Musings.setWrapText(true); Prewriting.setWrapText(true); Insert.setWrapText(true); reset.setDisable(true); //checks font size--> sets it to the default (ie. unmagnified) //fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; //Primary.setStyle("-fx-font-size: 12"); //magnified = false; /*Primary.setWrapText(true); fontsize = 2; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); magnified = false;*/ magnified = false; minus.setDisable(true); //down.setDisable(true); //MenuBar menu = new MenuBar(); Menu file = new Menu("File"); Menu edit = new Menu("Edit"); Menu view = new Menu("View"); Menu tools = new Menu("Resources"); Menu speech = new Menu("Speech Options"); Menu help = new Menu("Help"); Menu thesaurus = new Menu("Thesaurus"); Menu mla = new Menu("MLA"); Menu copyright = new Menu("Copyright Information"); Menu citations = new Menu("MLA Citation Generators"); Menu pageViewingMode = new Menu("Book Viewing Mode"); Menu read = new Menu("Read to me"); Menu dictation = new Menu("Dictation"); Menu settings = new Menu("Settings"); Menu zoom = new Menu("Zoom"); up = new MenuItem("Up"); down = new MenuItem("Down"); MenuItem filetracker = new MenuItem("Open File Tracker (Files Appended Log)"); //for the manual version: "where would you like to save your manual versions?" "Enter a name for this version folder" MenuItem open = new MenuItem("Open/Load a version (version will appear in a separate window)"); //would you like to load an automatically indexed backup (opens folder where backups are saved in a browse box, so that the user can select the word doc to open)/version or a manual backup/version (loads in a second separate window)? -->open a version (opens the automatically generated version (with or without an identifier - it doesn't matter) in a separate window), open a manual backup (opens the word docs), load a manual backup into the editor in a separate screen //version not recognized, please select a viable/appropriate version MenuItem manualBackup = new MenuItem("Save a manual backup version"); MenuItem peerAdvice = new MenuItem("Peer Review"); MenuItem computedAdvice = new MenuItem("Computed Advice"); //"you might want to yadayadayada //MenuItem computedAdvice = new MenuItem("Advice based on context"); MenuItem dictionary = new MenuItem("Dictionary"); MenuItem backup = new MenuItem( "Save an automatic backup version (the version file will be generated automatically)"); MenuItem autoDesig = new MenuItem("Automatically Assign Chapters"); MenuItem undesig = new MenuItem("Remove Selected Chapter Designation"); MenuItem selectAll = new MenuItem("Select All"); MenuItem documentSettings = new MenuItem("Final Document Settings"); MenuItem generalSettings = new MenuItem("General Settings"); MenuItem delete = new MenuItem("Delete this account"); MenuItem versionInfo = new MenuItem("About Author's Assistant..."); MenuItem howToUse = new MenuItem("How To Use Author's Assistant"); MenuItem writershandbook = new MenuItem("Writer's Handbook"); MenuItem startReading = new MenuItem("Start reading book"); MenuItem stopReading = new MenuItem("Stop reading book"); MenuItem launchWindowsDictation = new MenuItem("Launch Windows' Built-In Dictation"); //MenuItem launchBrainacDictation = new MenuItem("Download Brainac Dictation"); //MenuItem citations = new MenuItem("Launch MLA Citation Generator"); on = new MenuItem("turn on Viewing Mode"); off = new MenuItem("turn off Viewing Mode"); MenuItem easyBib = new MenuItem("Launch Easy Bib"); MenuItem sonOfTheCitationMachine = new MenuItem("Launch Son of the Citation Machine"); MenuItem lookupWord = new MenuItem("Thesaurus"); MenuItem desig = new MenuItem("Designate selection as chapter header"); MenuItem sve = new MenuItem("Save"); MenuItem publish = new MenuItem("Generate document for publishing!"); MenuItem toLogin = new MenuItem("login as a different user"); //Return to login/ MenuItem exit = new MenuItem("Exit"); MenuItem cut = new MenuItem("Cut"); MenuItem copy = new MenuItem("Copy"); MenuItem paste = new MenuItem("Paste"); MenuItem find = new MenuItem("Search "); toLogin.setDisable(true); lookupWord.setDisable(true); stopReading.setDisable(true); writershandbook.setDisable(true); delete.setDisable(true); dictionary.setDisable(true); computedAdvice.setDisable(true); peerAdvice.setDisable(true); open.setDisable(true); manualBackup.setDisable(true); //Easy Bib, Son of the Citation Machine citations.getItems().add(easyBib); citations.getItems().add(sonOfTheCitationMachine); pageViewingMode.getItems().add(on); pageViewingMode.getItems().add(off); read.getItems().add(startReading); read.getItems().add(stopReading); dictation.getItems().add(launchWindowsDictation); settings.getItems().add(generalSettings); settings.getItems().add(documentSettings); zoom.getItems().add(up); zoom.getItems().add(down); undesig.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { remove.fire(); //removeChapterDesignation(); } }); autoDesig.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { autoDesignate.fire(); } }); filetracker.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { displayFilesWindow(); //removeChapterDesignation(); } }); up.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { plus.fire(); //removeChapterDesignation(); } }); down.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { minus.fire(); //removeChapterDesignation(); } }); selectAll.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (Primary.isFocused()) { Primary.selectAll(); } if (Musings.isFocused()) { Musings.selectAll(); } if (Insert.isFocused()) { Insert.selectAll(); } if (Prewriting.isFocused()) { Prewriting.selectAll(); } } }); versionInfo.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { JOptionPane.showMessageDialog(null, "Author's Assistant 47: Version 1.0 \n Compatible with: Windows 7"); } }); howToUse.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { JOptionPane.showMessageDialog(null, "A description of how to use Author's Assistant will be coming shortly"); } }); launchWindowsDictation.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { launchSpeechRecognition(); } }); startReading.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { readToMe(); } }); on.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { pageViewingModeOn(); } }); off.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { pageViewingModeOff(); } }); easyBib.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { try { Desktop.getDesktop().browse(new URI("http://www.easybib.com/")); } catch (Exception anException) { } } }); sonOfTheCitationMachine.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { try { Desktop.getDesktop().browse(new URI("http://www.citationmachine.net/mla/cite-a-book")); } catch (Exception anException) { } } }); lookupWord.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { } }); desig.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { designateAsChapter(); } }); sve.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { save(); } }); publish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { createPrintable(); } }); toLogin.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { int result = JOptionPane.showConfirmDialog(null, "Do you want to save? ", "Save changes?", JOptionPane.YES_NO_CANCEL_OPTION); //[before returning to the login screen?] if (result == 0) { save(); try { //System.exit(0); Parent blah = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(blah); Stage appStage = (Stage) ((Node) e.getSource()).getScene().getWindow(); appStage.setScene(scene); appStage.show(); } catch (IOException i) { } } if (result == 1) { try { Parent blah = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(blah); Stage appStage = (Stage) ((Node) e.getSource()).getScene().getWindow(); appStage.setScene(scene); appStage.show(); } catch (IOException i) { } } if (result == 2) { } } }); exit.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { int result = JOptionPane.showConfirmDialog(null, "Do you want to save before exiting?", "Save changes?", JOptionPane.YES_NO_CANCEL_OPTION); if (result == 0) { save(); System.exit(0); } if (result == 1) { System.exit(0); } if (result == 2) { } } }); cut.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { cut(); } }); copy.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { copy(); } }); paste.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { paste(); } }); find.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { //Primary.deselect(); //on box open eIndex = 0; final VBox searchBox = new VBox(20); final TextField searchForThis = new TextField(); Label note = new Label("Search is CASE-SENSITIVE"); Button next = new Button("Next"); Button close = new Button("Close"); // loginBox.getChildren().add(new Text("Enter file location: ")); searchBox.getChildren().add(new Text("Find in text/Search for...")); searchBox.getChildren().add(searchForThis); searchBox.getChildren().add(note); searchBox.getChildren().add(next); searchBox.getChildren().add(close); /*loginBox.getChildren().add(new Text("Enter your password: ")); loginBox.getChildren().add(passwordField); loginBox.getChildren().add(login); loginBox.getChildren().add(create); loginBox.getChildren().add(quit); loginBox.getChildren().add(flag);*/ final Stage dialog = new Stage(); Scene dialogScene = new Scene(searchBox, 500, 250); dialog.setScene(dialogScene); dialog.setTitle("Find..."); dialog.show(); //instance.getStage(d).show(); next.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { if (lastFocus.equalsIgnoreCase("primary")) { //on next click String searchForThisText = searchForThis.getText(); //Primary.positionCaret(endIndex); String primaryText = Primary.getText(); int startIndex = primaryText.indexOf(searchForThisText, eIndex); //int startIndex = primaryText.indexOf(searchForThisText); eIndex = startIndex + (searchForThisText.length()); Primary.selectRange(startIndex, eIndex); } if (lastFocus.equalsIgnoreCase("trash")) { //on next click String searchForThisText = searchForThis.getText(); //Primary.positionCaret(endIndex); String trashText = Insert.getText(); int startIndex = trashText.indexOf(searchForThisText, eIndex); //int startIndex = primaryText.indexOf(searchForThisText); eIndex = startIndex + (searchForThisText.length()); Insert.selectRange(startIndex, eIndex); } if (lastFocus.equalsIgnoreCase("musings")) { //on next click String searchForThisText = searchForThis.getText(); //Primary.positionCaret(endIndex); String musingsText = Musings.getText(); int startIndex = musingsText.indexOf(searchForThisText, eIndex); //int startIndex = primaryText.indexOf(searchForThisText); eIndex = startIndex + (searchForThisText.length()); Musings.selectRange(startIndex, eIndex); } if (lastFocus.equalsIgnoreCase("prewriting")) { //on next click String searchForThisText = searchForThis.getText(); //Primary.positionCaret(endIndex); String prewritingText = Prewriting.getText(); int startIndex = prewritingText.indexOf(searchForThisText, eIndex); //int startIndex = primaryText.indexOf(searchForThisText); eIndex = startIndex + (searchForThisText.length()); Prewriting.selectRange(startIndex, eIndex); } // stage.close(); //close the window here } }); close.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { dialog.close(); // stage.close(); //close the window here } }); //on next click /*String searchForThisText = "the"; //Primary.positionCaret(endIndex); String primaryText = Primary.getText(); int startIndex = primaryText.indexOf(searchForThisText, eIndex); //int startIndex = primaryText.indexOf(searchForThisText); eIndex = startIndex + (searchForThisText.length()); Primary.selectRange(startIndex, eIndex); */ //Primary.deselect(); //should have a "next" button //next button action event //next.fire(firstClick, endIndex); } }); file.getItems().add(sve); file.getItems().add(open); file.getItems().add(backup); file.getItems().add(manualBackup); file.getItems().add(publish); file.getItems().add(toLogin); file.getItems().add(delete); file.getItems().add(exit); edit.getItems().add(selectAll); edit.getItems().add(cut); edit.getItems().add(copy); edit.getItems().add(paste); edit.getItems().add(find); edit.getItems().add(desig); edit.getItems().add(undesig); edit.getItems().add(autoDesig); edit.getItems().add(settings); tools.getItems().add(dictionary); //new tools.getItems().add(lookupWord); tools.getItems().add(citations); tools.getItems().add(writershandbook); tools.getItems().add(computedAdvice); //new tools.getItems().add(peerAdvice); //new view.getItems().add(filetracker); view.getItems().add(pageViewingMode); //view.getItems().add(settings); view.getItems().add(zoom); speech.getItems().add(read); speech.getItems().add(dictation); help.getItems().add(howToUse); help.getItems().add(versionInfo); //tools.getItems().mlacitationgenerator //thesaurus, dictionary //writer's handbook //tips/advice before you publish/about publishing menu.getMenus().add(file); menu.getMenus().add(edit); menu.getMenus().add(view); menu.getMenus().add(tools); menu.getMenus().add(speech); menu.getMenus().add(help); //menu.getMenus().add(help); //menu.getMenus().add(thesaurus); //menu.getMenus().add(mla); //menu.getMenus().add(copyright); menu.prefWidthProperty().bind(anchorPane.widthProperty()); viewingMode = false; filesWindow.setVisible(false); loadFile.setDisable(true); save.setDisable(true); saveVersion.setDisable(true); tracker.setDisable(true); designate.setDisable(true); modeOn.setDisable(true); on.setDisable(true); modeOff.setDisable(true); off.setDisable(true); //insert.setDisable(true); /*goTo.setDisable(true); createPrintable.setDisable(true); forward.setDisable(true); backward.setDisable(true);*/ //stage.hide(); //makes the above four lines irrelevant LOL //.setBlendMode(BlendMode.ADD); //.setDisable(true); //setTranslateY(5000); //setOpacity(0); //setVisible(false); // Scene dS = new Scene(loginBox, 400, 300); // final Stage d = new Stage(); // d.setScene(dS); // d.show(); //the "new" version of the login box final Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); final TextField usernameField = new TextField(); final TextField passwordField = new TextField(); Button login = new Button(); Button create = new Button(); Button quit = new Button(); Label flag = new Label(); login.setText("Login"); login.setAlignment(Pos.BASELINE_LEFT); create.setText("Create"); create.setAlignment(Pos.CENTER); quit.setText("Quit"); quit.setAlignment(Pos.BOTTOM_RIGHT); flag.setText("Username and/or Password is incorrect. Please Try Again."); flag.setVisible(false); final VBox loginBox = new VBox(20); // loginBox.getChildren().add(new Text("Enter file location: ")); loginBox.getChildren().add(new Text("Enter your username: ")); loginBox.getChildren().add(usernameField); loginBox.getChildren().add(new Text("Enter your password: ")); loginBox.getChildren().add(passwordField); loginBox.getChildren().add(login); loginBox.getChildren().add(create); loginBox.getChildren().add(quit); loginBox.getChildren().add(flag); Scene dialogScene = new Scene(loginBox, 750, 500); dialog.setScene(dialogScene); dialog.setTitle("Login"); try { dialog.toFront(); } catch (Exception e) { } dialog.show(); //instance.getStage(d).show(); login.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { newUser = false; String username = usernameField.getText(); String password = passwordField.getText(); initializeExistingUser(dialog, stage, username, password, loginBox); // stage.close(); //close the window here } }); create.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { newUser = true; initializeNewUser(dialog, stage); // d.close(); // stage.close(); //close the window here } }); quit.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { dialog.close(); System.exit(0); // stage.close(); //close the window here } }); //loginBox.toFront(); /*boolean existingUser; String username, password, masterPath; existingUser = instance.getBoolean(); username = instance.getUsername(); password = instance.getPassword(); masterPath = instance.getMasterPath(); if(existingUser == true) { title.setText("Hello Again"); //How are you today...?... } if(existingUser == false) { title.setText("Hello/Welcome!"); }*/ //if it is an existing user, the data is CHECKED, and then sent. if it is a new user, the data is sent. //if existing user = true, get the username from ALH.java, parse the userdata file here, load everything up, and don't forget to say hi (Hello Again) //if existing user = false (ie. if "create" is pressed), then get the username,password,and masterPath fields from ALH.java,write them to userdata, load everything up, and say hi (Hello/Welcome...something generated by an rng:D) /*chaptersList.setOnMouseDragEntered(new EventHandler<MouseDragEvent>() { public void handle(MouseDragEvent e) { chaptersList.setStyle("-fx-border-color:red;-fx-border-width:2;-fx-border-style:solid;"); e.consume(); } });*/ } public void explicitInitialize() { } /*public void saveVersion() { }*/ public void pageViewingModeOn() { int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to turn on page viewing mode? Turning on viewing mode will automatically save your session/work up to this point.", "Viewing Mode", JOptionPane.OK_CANCEL_OPTION); if (result == 0) { viewingMode = true; save(); currentPage = (int) getCurrentPageNumber(); totalPages = (int) getTotalPages(); designate.setDisable(true); modeOn.setDisable(true); on.setDisable(true); modeOff.setDisable(false); off.setDisable(false); goTo.setDisable(false); tracker.setDisable(true); save.setDisable(true); saveVersion.setDisable(true); loadFile.setDisable(true); //insert.setDisable(true); //remove the scroll bar //sets the title label to the first page title.setText("Page 1 of " + totalPages); //makes almost everything invisible (14 items) designate.setVisible(false); modeOn.setVisible(false); tracker.setVisible(false); save.setVisible(false); saveVersion.setVisible(false); loadFile.setVisible(false); //insert.setVisible(false); createPrintable.setVisible(false); welcome.setVisible(false); onCharacter.setVisible(false); Musings.setVisible(false); //Insert.setVisible(false); musingsLabel.setVisible(false); insertLabel.setVisible(false); Insert.setVisible(false); delete.setVisible(false); emptyTrash.setVisible(false); refreshButton.setVisible(false); remove.setVisible(false); autoDesignate.setVisible(false); saveQuit.setVisible(false); musingsCounter.setVisible(false); garbageCounter.setVisible(false); prewritingCounter.setVisible(false); onChapter.setVisible(false); reset.setVisible(false); pageViewingModeForward(); pageViewingModeBackward(); Primary.setEditable(false); } if (result == 1) { } } public void regModeForward() { try { /*Method m = Primary.getClass().getDeclaredMethod("textUpdated"); m.setAccessible(true); boolean updateText = Primary.textUpdated();*/ if (newText == true) { reloadPrimary(); } } catch (Exception e) { } //int onPage = getCurrentPageNumber(); int pageIterator = 0; int desiredPage = getCurrentPageNumber() + 1; if (desiredPage == (int) getTotalPages() || desiredPage > (int) getTotalPages()) { Primary.end(); } else { Primary.positionCaret(0); while (pageIterator != (desiredPage + 1)) { pageIterator = getCurrentPageNumber(); //Primary.forward(); Primary.nextWord(); } for (int i = 0; i < 2; i++) { //Primary.backward(); Primary.previousWord(); } } } public void regModeBackward() { try { /*Method m = Primary.getClass().getDeclaredMethod("textUpdated"); m.setAccessible(true); boolean updateText = Primary.textUpdated();*/ if (newText == true) { reloadPrimary(); } } catch (Exception e) { } int pageIterator; int desiredPage = getCurrentPageNumber() - 1; //System.out.println("backwards method is being called!"); if ((desiredPage == 1) || (desiredPage < 1) || (desiredPage == (int) getTotalPages())) { Primary.positionCaret(0); } else { Primary.end(); int onPage = (int) getTotalPages(); while (onPage != desiredPage - 1) { onPage = getCurrentPageNumber(); //Primary.backward(); Primary.previousWord(); } for (int i = 0; i < 2; i++) { //Primary.forward(); Primary.nextWord(); } } } public void pageViewingModeOff() { viewingMode = false; String searchForThisText = Primary.getText(); Primary.clear(); //RELOAD the user's data here load(); // reinitializePrimary(); String primaryText = Primary.getText(); int startIndex = primaryText.indexOf(searchForThisText); int endIndex = startIndex + (searchForThisText.length() - 1); //Primary.selectRange(startIndex, endIndex); Primary.selectRange(startIndex, endIndex); Primary.deselect(); //Jump to the correct page here /* System.out.println("hello jumpToChapter method"); int listIndex, charIndex, numberOfAts, ats; listIndex = chaptersList.getSelectionModel().getSelectedIndex(); //Primary.appendText(Integer.toString(listIndex)); //System.out.println(listIndex); String primaryText = Primary.getText(); charIndex = 0; ats = 0; while(ats <= listIndex) { char currentChar = primaryText.charAt(charIndex); if(currentChar=='@') { ats++; } charIndex++; } Primary.positionCaret(charIndex); Primary.selectForward(); */ designate.setDisable(false); modeOn.setDisable(false); on.setDisable(false); modeOff.setDisable(true); off.setDisable(true); goTo.setDisable(false); tracker.setDisable(false); save.setDisable(false); saveVersion.setDisable(false); loadFile.setDisable(false); //insert.setDisable(false); //makes everything visible again designate.setVisible(true); modeOn.setVisible(true); tracker.setVisible(true); save.setVisible(true); saveVersion.setVisible(true); loadFile.setVisible(true); //insert.setVisible(true); createPrintable.setVisible(true); welcome.setVisible(true); onCharacter.setVisible(true); Musings.setVisible(true); //Insert.setVisible(true); musingsLabel.setVisible(true); insertLabel.setVisible(true); Insert.setVisible(true); Insert.setVisible(true); delete.setVisible(true); emptyTrash.setVisible(true); // refreshButton.setVisible(true); remove.setVisible(true); autoDesignate.setVisible(true); saveQuit.setVisible(true); musingsCounter.setVisible(true); garbageCounter.setVisible(true); prewritingCounter.setVisible(true); //onChapter.setVisible(true); // reset.setVisible(true); title.setText("Viewing Mode: Off"); Primary.setEditable(true); } public void goToPage() { try { /*Method m = Primary.getClass().getDeclaredMethod("textUpdated"); m.setAccessible(true); boolean updateText = Primary.textUpdated();*/ if (newText == true) { reloadPrimary(); } } catch (Exception e) { } if (viewingMode == true) { //flip to page by going to the first page, and then flipping the appropriate number of pages int desiredPage = Integer.parseInt(pageBox.getText().trim()); //arraylist of strings ArrayList linesInPrimary = new ArrayList(); //store all lines in an array System.out.println(installationPath + "/userdata/" + currentUser + "/Master.txt"); try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; String lineToAdd; int currentCharIndex = 0; int toIndex; while ((aLine = br2.readLine()) != null) { //title.setText("Hello Worlddd"); //System.out.println("Helllows"); if (aLine.length() > characterCapacity) { System.out.println("blah"); //ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double) aLine.length() / characterCapacity); double remainingCharas = (double) aLine.length() % characterCapacity; int onSegment = 1; currentCharIndex = 0; toIndex = (int) (characterCapacity - 1); do { //lineToAdd = aLine.substring(currentCharIndex, toIndex) + "\n"; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); currentCharIndex = toIndex; toIndex = toIndex + (int) characterCapacity; onSegment++; } while (onSegment <= numberOfWholeSegments); toIndex = toIndex - (int) characterCapacity + (int) remainingCharas + 1; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); } else { System.out.println("nnnn"); //toIndex = aLine.length() - 1; //lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(aLine); } } reader2.close(); br2.close(); } catch (Exception e) { title.setText(installationPath + "/userdata/" + currentUser + "/Master.txt"); } /*for(int i = 0; i < linesInPrimary.size();i++) { Primary.appendText(linesInPrimary.get(i).toString()); }*/ //print the lines based on page index (sets of 90, ie. 0-89,89-179, etc..) //desiredpage = getcurrentpage() + 1 if (desiredPage > totalPages) { //do nothing } else { currentPage = desiredPage; Primary.clear(); //locate the array index range required (0-39,39-79,etc.) title.setText("Page " + Integer.toString(currentPage) + " of " + totalPages); int firstLineIndex = ((desiredPage - 1) * (int) rowCapacity); int lastLineIndex = firstLineIndex + (int) (rowCapacity - 1); int i = firstLineIndex; //it now prints the relevant lines to primary using a loop //iterates to lastLineIndex OR null //while((linesInPrimary.get(i) != null) && i <= lastLineIndex) while (i <= lastLineIndex) { if (i == lastLineIndex) { Primary.appendText(linesInPrimary.get(i) + ""); } else { Primary.appendText(linesInPrimary.get(i) + "\n"); } i++; } } Primary.home(); if (currentPage == totalPages) { forward.setDisable(true); } else { forward.setDisable(false); } currentPage = desiredPage; } else { try { int cPage = getCurrentPageNumber(); int onPage = 0; int desiredPage = Integer.parseInt(pageBox.getText().trim()); if (desiredPage == 1) { Primary.positionCaret(0); } else if (desiredPage == (int) getTotalPages()) { Primary.end(); } else { if (cPage < desiredPage) { Primary.positionCaret(0); while (onPage != (desiredPage + 1)) { onPage = getCurrentPageNumber(); //Primary.forward(); Primary.nextWord(); } for (int i = 0; i < 2; i++) { //Primary.backward(); Primary.previousWord(); } } else { Primary.end(); onPage = (int) getTotalPages(); while (onPage != desiredPage - 1) { onPage = getCurrentPageNumber(); //Primary.backward(); Primary.previousWord(); } for (int i = 0; i < 2; i++) { //Primary.forward(); Primary.nextWord(); } } onClickOrKeyPress(); } } catch (Exception e) { //message: please enter an appropriate value into the box! ok. } } } public void goToPage(int pageNumberProvided) { if (viewingMode == true) { //flip to page by going to the first page, and then flipping the appropriate number of pages int desiredPage = pageNumberProvided; //arraylist of strings ArrayList linesInPrimary = new ArrayList(); //store all lines in an array System.out.println(installationPath + "/userdata/" + currentUser + "/Master.txt"); try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; String lineToAdd; int currentCharIndex = 0; int toIndex; while ((aLine = br2.readLine()) != null) { //title.setText("Hello Worlddd"); //System.out.println("Helllows"); if (aLine.length() > characterCapacity) { System.out.println("blah"); //ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double) aLine.length() / characterCapacity); double remainingCharas = (double) aLine.length() % characterCapacity; int onSegment = 1; currentCharIndex = 0; toIndex = (int) (characterCapacity - 1); do { //lineToAdd = aLine.substring(currentCharIndex, toIndex) + "\n"; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); currentCharIndex = toIndex; toIndex = toIndex + (int) characterCapacity; onSegment++; } while (onSegment <= numberOfWholeSegments); toIndex = toIndex - (int) characterCapacity + (int) remainingCharas + 1; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); } else { System.out.println("nnnn"); //toIndex = aLine.length() - 1; //lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(aLine); } } reader2.close(); br2.close(); } catch (Exception e) { title.setText(installationPath + "/userdata/" + currentUser + "/Master.txt"); } /*for(int i = 0; i < linesInPrimary.size();i++) { Primary.appendText(linesInPrimary.get(i).toString()); }*/ //print the lines based on page index (sets of 90, ie. 0-89,89-179, etc..) //desiredpage = getcurrentpage() + 1 if (desiredPage > totalPages) { //do nothing } else { currentPage = desiredPage; Primary.clear(); //locate the array index range required (0-39,39-79,etc.) title.setText("Page " + Integer.toString(currentPage) + " of " + totalPages); int firstLineIndex = ((desiredPage - 1) * (int) rowCapacity); int lastLineIndex = firstLineIndex + (int) (rowCapacity - 1); int i = firstLineIndex; //it now prints the relevant lines to primary using a loop //iterates to lastLineIndex OR null //while((linesInPrimary.get(i) != null) && i <= lastLineIndex) while (i <= lastLineIndex) { if (i == lastLineIndex) { Primary.appendText(linesInPrimary.get(i) + ""); } else { Primary.appendText(linesInPrimary.get(i) + "\n"); } i++; } } Primary.home(); if (currentPage == totalPages) { forward.setDisable(true); } else { forward.setDisable(false); } currentPage = desiredPage; } else { try { int cPage = getCurrentPageNumber(); int onPage = 0; int desiredPage = pageNumberProvided; if (desiredPage == 1) { Primary.positionCaret(0); } else if (desiredPage == (int) getTotalPages()) { Primary.end(); } else { if (cPage < desiredPage) { Primary.positionCaret(0); while (onPage != (desiredPage + 1)) { onPage = getCurrentPageNumber(); Primary.forward(); } for (int i = 0; i < 2; i++) { Primary.backward(); } } else { Primary.end(); onPage = (int) getTotalPages(); while (onPage != desiredPage - 1) { onPage = getCurrentPageNumber(); Primary.backward(); } for (int i = 0; i < 2; i++) { Primary.forward(); } } } } catch (Exception e) { //message: please enter an appropriate value into the box! ok. } } } public void pageViewingModeBackward() { forward.setDisable(false); int desiredPage = currentPage - 1; //arraylist of strings ArrayList linesInPrimary = new ArrayList(); //store all lines in an array System.out.println(installationPath + "/userdata/" + currentUser + "/Master.txt"); try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; String lineToAdd; int currentCharIndex = 0; int toIndex; while ((aLine = br2.readLine()) != null) { //title.setText("Hello Worlddd"); //System.out.println("Helllows"); if (aLine.length() > (characterCapacity + 10)) //the + 10 is NEW { System.out.println("blah"); //ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double) aLine.length() / characterCapacity); double remainingCharas = (double) aLine.length() % characterCapacity; int onSegment = 1; currentCharIndex = 0; toIndex = (int) (characterCapacity - 1); do { //lineToAdd = aLine.substring(currentCharIndex, toIndex) + "\n"; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); currentCharIndex = toIndex; toIndex = toIndex + (int) characterCapacity; onSegment++; } while (onSegment <= numberOfWholeSegments); toIndex = toIndex - (int) characterCapacity + (int) remainingCharas + 1; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); } else { System.out.println("nnnn"); //toIndex = aLine.length() - 1; //lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(aLine); } } reader2.close(); br2.close(); } catch (Exception e) { title.setText(installationPath + "/userdata/" + currentUser + "/Master.txt"); } /*for(int i = 0; i < linesInPrimary.size();i++) { Primary.appendText(linesInPrimary.get(i).toString()); }*/ //print the lines based on page index (sets of 90, ie. 0-89,89-179, etc..) //desiredpage = getcurrentpage() + 1 if (desiredPage > totalPages) { //do nothing } else { currentPage = desiredPage; Primary.clear(); //locate the array index range required (0-39,39-79,etc.) title.setText("Page " + Integer.toString(currentPage) + " of " + totalPages); int firstLineIndex = ((desiredPage - 1) * (int) rowCapacity); int lastLineIndex = firstLineIndex + (int) (rowCapacity - 1); int i = firstLineIndex; //it now prints the relevant lines to primary using a loop //iterates to lastLineIndex OR null //while((linesInPrimary.get(i) != null) && i <= lastLineIndex) while (i <= lastLineIndex) { if (i == lastLineIndex) { Primary.appendText(linesInPrimary.get(i) + ""); } else { Primary.appendText(linesInPrimary.get(i) + "\n"); } i++; } } Primary.home(); currentPage = desiredPage; } public void pageViewingModeForward() { //save(); //put this in the viewing mode On() method instead //a long-term to-do: /*if(editing == enabled) get master string here directly from the text doc try { String masterString = new Scanner(new File(path + "/Master.txt")).useDelimiter("\\Z").next(); } catch(IOException e) {} File fullText = new File(path + "/Master.txt"); FileWriter writ = new FileWriter(fullText, true); BufferedWriter bw22 = new BufferedWriter(writ22); writ22.append(""); bw22.close(); writ22.close(); Primary.replaceText(a, a, path); removes Primary.insertText(int i, String string); write it back to the text doc*/ int desiredPage = currentPage + 1; //arraylist of strings ArrayList linesInPrimary = new ArrayList(); //store all lines in an array System.out.println(installationPath + "/userdata/" + currentUser + "/Master.txt"); try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; String lineToAdd; int currentCharIndex = 0; int toIndex; while ((aLine = br2.readLine()) != null) { //title.setText("Hello Worlddd"); //System.out.println("Helllows"); if (aLine.length() > (characterCapacity + 10)) //the + 10 is NEW { System.out.println("blah"); //ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double) aLine.length() / characterCapacity); double remainingCharas = (double) aLine.length() % characterCapacity; int onSegment = 1; currentCharIndex = 0; toIndex = (int) (characterCapacity - 1); do { //lineToAdd = aLine.substring(currentCharIndex, toIndex) + "\n"; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); currentCharIndex = toIndex; toIndex = toIndex + (int) characterCapacity; onSegment++; } while (onSegment <= numberOfWholeSegments); toIndex = toIndex - (int) characterCapacity + (int) remainingCharas + 1; lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(lineToAdd); } else { System.out.println("nnnn"); //toIndex = aLine.length() - 1; //lineToAdd = aLine.substring(currentCharIndex, toIndex); linesInPrimary.add(aLine); } } reader2.close(); br2.close(); } catch (Exception e) { title.setText(installationPath + "/userdata/" + currentUser + "/Master.txt"); } /*for(int i = 0; i < linesInPrimary.size();i++) { Primary.appendText(linesInPrimary.get(i).toString()); }*/ //print the lines based on page index (sets of 90, ie. 0-89,89-179, etc..) //desiredpage = getcurrentpage() + 1 if (desiredPage > totalPages) { //do nothing } else { currentPage = desiredPage; Primary.clear(); //locate the array index range required (0-39,39-79,etc.) title.setText("Page " + Integer.toString(currentPage) + " of " + totalPages); int firstLineIndex = ((desiredPage - 1) * (int) rowCapacity); int lastLineIndex = firstLineIndex + (int) (rowCapacity - 1); int i = firstLineIndex; //it now prints the relevant lines to primary using a loop //iterates to lastLineIndex OR null //while((linesInPrimary.get(i) != null) && i <= lastLineIndex) while (i <= lastLineIndex) { if (i == lastLineIndex) { Primary.appendText(linesInPrimary.get(i) + ""); } else { Primary.appendText(linesInPrimary.get(i) + "\n"); } i++; } } Primary.home(); if (currentPage == totalPages) { forward.setDisable(true); } else { forward.setDisable(false); } currentPage = desiredPage; //title.setText(Integer.toString(currentPage)); //while((aLine = br2.readLine()) != null) || (aLine = br2.readLine)) } public void save() { //newText = false; int primaryPos, insertPos, prewritingPos, musingsPos; try { //File statText1 = new File(path + "/Master.txt"); insertPos = Insert.getCaretPosition(); FileOutputStream is4 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/trash.txt"); OutputStreamWriter osw4 = new OutputStreamWriter(is4); Writer w4 = new BufferedWriter(osw4); //Insert.selectAll(); //w4.write(Insert.getSelectedText()); w4.write(Insert.getText()); w4.close(); Insert.deselect(); Insert.home(); Insert.positionCaret(insertPos); musingsPos = Musings.getCaretPosition(); FileOutputStream is2 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/musings.txt"); OutputStreamWriter osw2 = new OutputStreamWriter(is2); Writer w2 = new BufferedWriter(osw2); //Musings.selectAll(); //w2.write(Musings.getSelectedText()); w2.write(Musings.getText()); w2.close(); Musings.deselect(); Musings.home(); Musings.positionCaret(musingsPos); prewritingPos = Prewriting.getCaretPosition(); FileOutputStream is3 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/prewriting.txt"); OutputStreamWriter osw3 = new OutputStreamWriter(is3); Writer w3 = new BufferedWriter(osw3); //Prewriting.selectAll(); //w3.write(Prewriting.getSelectedText()); w3.write(Prewriting.getText()); w3.close(); Prewriting.deselect(); Prewriting.home(); Prewriting.positionCaret(prewritingPos); primaryPos = Primary.getCaretPosition(); FileOutputStream is = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/Master.txt"); OutputStreamWriter osw = new OutputStreamWriter(is); Writer w = new BufferedWriter(osw); //Primary.selectAll(); //w.write(Primary.getSelectedText()); w.write(Primary.getText()); w.close(); Primary.deselect(); Primary.home(); Primary.positionCaret(primaryPos); } catch (IOException e) { } } public void saveAndQuit() { //saves (overwrites) musings, prewriting, and Master try { //File statText1 = new File(path + "/Master.txt"); FileOutputStream is4 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/trash.txt"); OutputStreamWriter osw4 = new OutputStreamWriter(is4); Writer w4 = new BufferedWriter(osw4); Insert.selectAll(); w4.write(Insert.getSelectedText()); w4.close(); Insert.deselect(); Insert.home(); FileOutputStream is = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/Master.txt"); OutputStreamWriter osw = new OutputStreamWriter(is); Writer w = new BufferedWriter(osw); Primary.selectAll(); w.write(Primary.getSelectedText()); w.close(); FileOutputStream is2 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/musings.txt"); OutputStreamWriter osw2 = new OutputStreamWriter(is2); Writer w2 = new BufferedWriter(osw2); Musings.selectAll(); w2.write(Musings.getSelectedText()); w2.close(); FileOutputStream is3 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/prewriting.txt"); OutputStreamWriter osw3 = new OutputStreamWriter(is3); Writer w3 = new BufferedWriter(osw3); Prewriting.selectAll(); w3.write(Prewriting.getSelectedText()); w3.close(); System.exit(0); /* Writer output = new BufferedWriter(new FileWriter(path + "/Master.txt", true)); output.append("blahhhhhhhhhrgh"); output.write(Primary.getText()); output.close();*/ } catch (IOException e) { title.setText(installationPath + "/userdata/" + currentUser + "/Master.txt"); } //Exits } public void load() { try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br = new BufferedReader(reader2); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; // int index = 0; // boolean endOfPara = false; //loads the text and formats it if necessary while ((s = br.readLine()) != null) { index = 0; //loading block if (s.length() <= characterCapacity) { //String s = "abcdefg"; int result = s.indexOf('\n'); if (result == -1) { Primary.appendText(s + "\n"); } else { Primary.appendText(s); } } //formatting block else { while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') //{ // Primary.appendText(n); //} //else //{ Primary.appendText(n + "\n"); //} index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; //Primary.forward(); //Primary.deletePreviousChar(); } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } /*if(endOfPara == true) { if(s.charAt(index - 2) != '\n') { Primary.appendText("\n"); } } endOfPara = false;*/ } } } catch (Exception e) { } } public void initializeExistingUser(Stage d, Stage stage, String username, String password, VBox loginBox) { down.setDisable(true); //it was a y. //populate list based on the [master] text repopulateListBasedOnText(); /*ObservableList<String> items =FXCollections.observableArrayList ( "Single", "Double", "Suite", "Family App"); items.add("hello"); chaptersList.setItems(items);*/ //On B-->roL-->"m ev" //always, sit never required babysitting //MJ,A,TG,GWHGF,AG //Don't feel to bad about [the soc ang/part of it]... those years weren't supposed to //Rv to vegas boolean existingUser = false; System.out.println("reaches here"); String masterPath = ""; //determines whether the username and password are correct try { System.out.println("why is it not finding this: " + installationPath + "/users.txt"); FileReader aReader = new FileReader(installationPath + "/users.txt"); BufferedReader aBr = new BufferedReader(aReader); System.out.println("reaches the next part of the try block"); String s = aBr.readLine(); System.out.println(s); while ((s = aBr.readLine()) != null) { System.out.println("here's the full line: " + s); String[] splits = s.split(","); System.out.println("username field: " + username); System.out.println("username in file " + splits[0]); System.out.println("password field: " + password); System.out.println("password in file: " + splits[1]); if (username.equalsIgnoreCase(splits[0]) && password.equalsIgnoreCase(splits[1])) { System.out.println("hello existing account"); existingUser = true; currentUser = splits[0]; masterPath = splits[3]; path = splits[3]; break; } } } catch (Exception e) { } //the meat and potatoes /*try { title.setText("Hello Again"); Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene mainScene = new Scene(root); title.setText("Hello Again"); Stage stage = new Stage(); title.setText("Hello Again"); stage.setScene(mainScene); title.setText("Hello Again"); stage.show(); title.setText("Hello Again"); } catch (IOException e) { }*/ if (existingUser == true) { //sets the fontsize, row capacity, and column capacity variables /*fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); magnified = false;*/ /*Primary.setWrapText(true); fontsize = 2; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); magnified = false;*/ try { FileReader r1 = new FileReader( installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); BufferedReader br = new BufferedReader(r1); String line; line = br.readLine().trim(); /*if(line.equalsIgnoreCase("1")) { fontsize = 1; rowCapacity = 40.0; characterCapacity= 90.0; System.out.println("hello font size 1"); Primary.setStyle("-fx-font-size: 12"); plus.setDisable(false); minus.setDisable(true); } /*if(line.equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 34.0; characterCapacity = 60.0; Primary.setStyle("-fx-font-size: 14"); }*/ /*if(line.equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 24.0; characterCapacity = 55.0; Primary.setStyle("-fx-font-size: 20"); plus.setDisable(true); minus.setDisable(false); }*/ if (line.equals("1")) { Primary.setWrapText(true); fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); magnified = false; } if (line.equals("2")) { Primary.setWrapText(true); fontsize = 2; rowCapacity = 34.3; characterCapacity = 70.0; Primary.setStyle("-fx-font-size: 14"); magnified = false; } if (line.equals("3")) { System.out.println("hello existing user font size 3"); Primary.setWrapText(true); fontsize = 3; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); magnified = false; } br.close(); r1.close(); } catch (Exception e) { } //as a rule, you cannot apply your to something that is intrinsically not yours. In other words, 's existence. That is not to say that you can not apply it to the info that is readily available. //there is one type of thing of this nature: //the philosopher who hates philosophy //in essence. //philosophy's harrowing agonies //it led you away from me, after all. P is the d's p. //loads the master document title.setText("Hello Again"); welcome.setText("Welcome Back!"); Primary.setWrapText(true); loadFile.setDisable(false); save.setDisable(false); saveVersion.setDisable(false); tracker.setDisable(false); designate.setDisable(false); modeOn.setDisable(false); on.setDisable(false); modeOff.setDisable(true); off.setDisable(true); //insert.setDisable(false); /*goTo.setDisable(false); createPrintable.setDisable(false); forward.setDisable(false); backward.setDisable(false);*/ //stage.show(); try { FileReader r1 = new FileReader(installationPath + "/userdata/" + currentUser + "/musings.txt"); BufferedReader b1 = new BufferedReader(r1); String line; while ((line = b1.readLine()) != null) { Musings.appendText(line + "\n"); } b1.close(); r1.close(); Musings.home(); FileReader r2 = new FileReader(installationPath + "/userdata/" + currentUser + "/prewriting.txt"); BufferedReader b2 = new BufferedReader(r2); String line2; while ((line2 = b2.readLine()) != null) { Prewriting.appendText(line2 + "\n"); } b2.close(); r2.close(); Prewriting.home(); FileReader r3 = new FileReader(installationPath + "/userdata/" + currentUser + "/trash.txt"); BufferedReader b3 = new BufferedReader(r3); String line3; while ((line3 = b3.readLine()) != null) { Insert.appendText(line3 + "\n"); } b3.close(); r3.close(); Insert.home(); //masterPath = masterPath + "/Master.txt"; // File f = new File(masterPath); //System.out.println(masterPath); //It's just a little pg that I designed w y i m...h~ // Primary.appendText("blah"); //LOADING THE MASTER DOC STARTS HERE FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br = new BufferedReader(reader2); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; // int index = 0; // boolean endOfPara = false; try { //loads the text and formats it if necessary while ((s = br.readLine()) != null) { index = 0; //loading block if (s.length() <= characterCapacity) { //String s = "abcdefg"; int result = s.indexOf('\n'); if (result == -1) { Primary.appendText(s + "\n"); } else { Primary.appendText(s); } } //formatting block else { while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') //{ // Primary.appendText(n); //} //else //{ Primary.appendText(n + "\n"); //} index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; //Primary.forward(); //Primary.deletePreviousChar(); } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } /*if(endOfPara == true) { if(s.charAt(index - 2) != '\n') { Primary.appendText("\n"); } } endOfPara = false;*/ } } } catch (Exception e) { } } catch (Exception e) { } /* while((aLine = br2.readLine()) != null) { if(aLine.length() > characterCapacity) { index = 0; while(index < aLine.length()) //change this { if((index == characterCapacity) && (index < aLine.length() - 1)) { while(aLine.charAt(index) != ' ') { index--; } String n = aLine.substring(0, index); aLine = aLine.substring(index); Primary.appendText(n + "\n"); index = 0; } else if((index == aLine.length() - 1) && (index <= characterCapacity) && (aLine.length() > 0)) { Primary.appendText(aLine + "\n"); index = aLine.length(); //OR use break; endOfPara = true; } else { index++; } } } else { if(aLine.charAt(aLine.length() - 1) == '\n') { Primary.appendText(aLine); } else { Primary.appendText(aLine + "\n"); } } /* if(aLine.length() > characterCapacity) { ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double)aLine.length()/characterCapacity); double remainingCharas = (double)aLine.length() % characterCapacity; int onSegment = 1; int currentCharIndex = 0; int toIndex = (int)(characterCapacity - 1); do { Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); currentCharIndex = toIndex; toIndex = toIndex + (int)characterCapacity; onSegment++; } while(onSegment <= numberOfWholeSegments); toIndex = toIndex - (int)characterCapacity + (int)remainingCharas + 1; Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); /*while() while(currentCharIndex < aLine.length()) { for(int c = currentCharIndex; c < 90; c++) { } }*/ /*for(int c = 0; c < aLine.length(); c++) { if(c % 90 == 0) { Primary.appendText(aLine.substring(n, c) + "\n"); n = c; } }*/ /* } else { Primary.appendText(aLine + "\n"); //appendText, insertText, setText } //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; //ct++; */ // } // Primary.positionCaret(0); //System.out.println(Primary.styleProperty().toString()); // } // catch(Exception e) // { // }*/ Primary.positionCaret(0); d.close(); } else { loginBox.getChildren().get(7).setVisible(true); //String astring = ""; //Text alpha = new Text(astring); //loginBox.getChildren().get(7).getUserData(). //loginBox.getChildren().add(7, new Text("Username and/or Password is incorrect. Please Try Again.")); //astring = "Username and/or Password is incorrect. Please Try Again."; //loginBox.getChildren().add(new Text("Username and/or Password is incorrect. Please Try Again.")); } //stage.toFront(); } public void oldInitializeExistingUser(Stage d, Stage stage, String username, String password, VBox loginBox) { //it was a y. //populate list based on the [master] text repopulateListBasedOnText(); /*ObservableList<String> items =FXCollections.observableArrayList ( "Single", "Double", "Suite", "Family App"); items.add("hello"); chaptersList.setItems(items);*/ //On B-->roL-->"m ev" //always, sit never required babysitting //MJ,A,TG,GWHGF,AG //Don't feel to bad about [the soc ang/part of it]... those years weren't supposed to //Rv to vegas boolean existingUser = false; System.out.println("reaches here"); String masterPath = ""; //determines whether the username and password are correct try { System.out.println("why is it not finding this: " + installationPath + "/users.txt"); FileReader aReader = new FileReader(installationPath + "/users.txt"); BufferedReader aBr = new BufferedReader(aReader); System.out.println("reaches the next part of the try block"); String s = aBr.readLine(); System.out.println(s); while ((s = aBr.readLine()) != null) { System.out.println("here's the full line: " + s); String[] splits = s.split(","); System.out.println("username field: " + username); System.out.println("username in file " + splits[0]); System.out.println("password field: " + password); System.out.println("password in file: " + splits[1]); if (username.equalsIgnoreCase(splits[0]) && password.equalsIgnoreCase(splits[1])) { System.out.println("hello existing account"); existingUser = true; currentUser = splits[0]; masterPath = splits[3]; path = splits[3]; break; } } } catch (Exception e) { } //the meat and potatoes /*try { title.setText("Hello Again"); Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene mainScene = new Scene(root); title.setText("Hello Again"); Stage stage = new Stage(); title.setText("Hello Again"); stage.setScene(mainScene); title.setText("Hello Again"); stage.show(); title.setText("Hello Again"); } catch (IOException e) { }*/ if (existingUser == true) { //sets the fontsize, row capacity, and column capacity variables /*fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); magnified = false;*/ /*Primary.setWrapText(true); fontsize = 2; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); magnified = false;*/ try { FileReader r1 = new FileReader( installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); BufferedReader br = new BufferedReader(r1); String line; line = br.readLine().trim(); /*if(line.equalsIgnoreCase("1")) { fontsize = 1; rowCapacity = 40.0; characterCapacity= 90.0; System.out.println("hello font size 1"); Primary.setStyle("-fx-font-size: 12"); plus.setDisable(false); minus.setDisable(true); } /*if(line.equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 34.0; characterCapacity = 60.0; Primary.setStyle("-fx-font-size: 14"); }*/ /*if(line.equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 24.0; characterCapacity = 55.0; Primary.setStyle("-fx-font-size: 20"); plus.setDisable(true); minus.setDisable(false); }*/ if (line.equals("1")) { Primary.setWrapText(true); fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); magnified = false; } if (line.equals("2")) { Primary.setWrapText(true); fontsize = 2; rowCapacity = 34.3; characterCapacity = 70.0; Primary.setStyle("-fx-font-size: 14"); magnified = false; } if (line.equals("3")) { System.out.println("hello existing user font size 3"); Primary.setWrapText(true); fontsize = 3; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); magnified = false; } br.close(); r1.close(); } catch (Exception e) { } //as a rule, you cannot apply your to something that is intrinsically not yours. In other words, 's existence. That is not to say that you can not apply it to the info that is readily available. //there is one type of thing of this nature: //the philosopher who hates philosophy //in essence. //philosophy's harrowing agonies //it led you away from me, after all. P is the d's p. //loads the master document title.setText("Hello Again"); welcome.setText("Welcome Back!"); Primary.setWrapText(true); loadFile.setDisable(false); save.setDisable(false); saveVersion.setDisable(false); tracker.setDisable(false); designate.setDisable(false); modeOn.setDisable(false); on.setDisable(false); modeOff.setDisable(true); off.setDisable(true); //insert.setDisable(false); /*goTo.setDisable(false); createPrintable.setDisable(false); forward.setDisable(false); backward.setDisable(false);*/ //stage.show(); try { FileReader r1 = new FileReader(installationPath + "/userdata/" + currentUser + "/musings.txt"); BufferedReader b1 = new BufferedReader(r1); String line; while ((line = b1.readLine()) != null) { Musings.appendText(line + "\n"); } b1.close(); r1.close(); Musings.home(); FileReader r2 = new FileReader(installationPath + "/userdata/" + currentUser + "/prewriting.txt"); BufferedReader b2 = new BufferedReader(r2); String line2; while ((line2 = b2.readLine()) != null) { Prewriting.appendText(line2 + "\n"); } b2.close(); r2.close(); Prewriting.home(); FileReader r3 = new FileReader(installationPath + "/userdata/" + currentUser + "/trash.txt"); BufferedReader b3 = new BufferedReader(r3); String line3; while ((line3 = b3.readLine()) != null) { Insert.appendText(line3 + "\n"); } b3.close(); r3.close(); Insert.home(); //masterPath = masterPath + "/Master.txt"; // File f = new File(masterPath); //System.out.println(masterPath); //It's just a little pg that I designed w y i m...h~ // Primary.appendText("blah"); //LOADING THE MASTER DOC STARTS HERE FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br = new BufferedReader(reader2); String s, prevL = ""; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. //ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window int index = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); if (n.charAt(n.length() - 1) == '\n') { Primary.appendText(n); } else { Primary.appendText(n + "\n"); } index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } if (endOfPara == true) { if (s.charAt(index - 2) != '\n') { Primary.appendText("\n"); } } endOfPara = false; } } catch (Exception e) { } /* while((aLine = br2.readLine()) != null) { if(aLine.length() > characterCapacity) { index = 0; while(index < aLine.length()) //change this { if((index == characterCapacity) && (index < aLine.length() - 1)) { while(aLine.charAt(index) != ' ') { index--; } String n = aLine.substring(0, index); aLine = aLine.substring(index); Primary.appendText(n + "\n"); index = 0; } else if((index == aLine.length() - 1) && (index <= characterCapacity) && (aLine.length() > 0)) { Primary.appendText(aLine + "\n"); index = aLine.length(); //OR use break; endOfPara = true; } else { index++; } } } else { if(aLine.charAt(aLine.length() - 1) == '\n') { Primary.appendText(aLine); } else { Primary.appendText(aLine + "\n"); } } /* if(aLine.length() > characterCapacity) { ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double)aLine.length()/characterCapacity); double remainingCharas = (double)aLine.length() % characterCapacity; int onSegment = 1; int currentCharIndex = 0; int toIndex = (int)(characterCapacity - 1); do { Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); currentCharIndex = toIndex; toIndex = toIndex + (int)characterCapacity; onSegment++; } while(onSegment <= numberOfWholeSegments); toIndex = toIndex - (int)characterCapacity + (int)remainingCharas + 1; Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); /*while() while(currentCharIndex < aLine.length()) { for(int c = currentCharIndex; c < 90; c++) { } }*/ /*for(int c = 0; c < aLine.length(); c++) { if(c % 90 == 0) { Primary.appendText(aLine.substring(n, c) + "\n"); n = c; } }*/ /* } else { Primary.appendText(aLine + "\n"); //appendText, insertText, setText } //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; //ct++; */ // } // Primary.positionCaret(0); //System.out.println(Primary.styleProperty().toString()); // } // catch(Exception e) // { // }*/ Primary.positionCaret(0); d.close(); } else { loginBox.getChildren().get(7).setVisible(true); //String astring = ""; //Text alpha = new Text(astring); //loginBox.getChildren().get(7).getUserData(). //loginBox.getChildren().add(7, new Text("Username and/or Password is incorrect. Please Try Again.")); //astring = "Username and/or Password is incorrect. Please Try Again."; //loginBox.getChildren().add(new Text("Username and/or Password is incorrect. Please Try Again.")); } } /*public void reinitializePrimary() { try{ FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window while((aLine = br2.readLine()) != null) { if(aLine.length() > characterCapacity) { ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double)aLine.length()/characterCapacity); double remainingCharas = (double)aLine.length() % characterCapacity; int onSegment = 1; int currentCharIndex = 0; int toIndex = (int)(characterCapacity - 1); do { Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); currentCharIndex = toIndex; toIndex = toIndex + (int)characterCapacity; onSegment++; } while(onSegment <= numberOfWholeSegments); toIndex = toIndex - (int)characterCapacity + (int)remainingCharas + 1; Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); /*while() while(currentCharIndex < aLine.length()) { for(int c = currentCharIndex; c < 90; c++) { } }*/ /*for(int c = 0; c < aLine.length(); c++) { if(c % 90 == 0) { Primary.appendText(aLine.substring(n, c) + "\n"); n = c; } }*/ /* } else { Primary.appendText(aLine + "\n"); //appendText, insertText, setText } //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; //ct++; } Primary.positionCaret(0); } catch(Exception e) { } }*/ public void reinitializePrimary() { try { FileReader reader = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } if (endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch (Exception e) { } } public void initializeNewUser(final Stage d, final Stage stage) { down.setDisable(true); title.setText("Welcome!"); d.close(); final VBox accountBox = new VBox(20); final TextField username = new TextField(); final TextField password = new TextField(); final TextField masterP = new TextField(); Button ok = new Button(); final Label label = new Label("This username is already taken"); label.setVisible(false); ok.setText("Ok"); // loginBox.getChildren().add(new Text("Enter file location: ")); accountBox.getChildren().add(new Text("Create an Account")); accountBox.getChildren().add(new Text("Username: ")); accountBox.getChildren().add(username); accountBox.getChildren().add(new Text("Password: ")); accountBox.getChildren().add(password); //accountBox.getChildren().add(new Text("Where would you like Author's Lil Helper to create your master file?")); //accountBox.getChildren().add(masterP); accountBox.getChildren().add(ok); accountBox.getChildren().add(label); Scene aScene = new Scene(accountBox, 300, 400); d.setScene(aScene); d.setTitle("Create An Account"); d.show(); //Primary.appendText(s + "\n"); //appendText, insertText, setText //on ok click, include a try/catch statement to determine whether the path specified exists //writes all user login info to the UserData file, creates the master document at the specified location ok.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { String u, p;//, mP; System.out.println("inside Ok click event"); u = username.getText(); p = password.getText(); //mP = masterP.getText(); try { //checks whether the username is at least four characters, is already taken, and whether the password is at least four characters. If all of this pans out, it executes the code below if (u.length() >= 4 && p.length() >= 4) { //check whether the username is taken System.out.println("Inside length checking, " + installationPath); FileReader aReader = new FileReader(installationPath + "/users.txt"); BufferedReader aBr = new BufferedReader(aReader); String s; boolean taken = false; while ((s = aBr.readLine()) != null) { String[] splits = s.split(","); System.out.println(username.getText().trim()); System.out.println(splits[0]); if (username.getText().trim().equals(splits[0])) { taken = true; } /*System.out.println("username field: " + username); System.out.println("username in file " + splits[0]); System.out.println("password field: " + password); System.out.println("password in file: " + splits[1]);*/ } if (taken == true) { label.setVisible(true); } else { currentUser = u; //masterPath = installationPath + "/userdata/" + currentUser; //mp + "/Users/" + currentUser //or default location (like in p m) instead of mp //File userFolder = new File(masterPath); File userFolder = new File(installationPath + "/userdata/" + currentUser); // if the directory does not exist, create it if (!userFolder.exists()) { //System.out.println("creating directory: " + directoryName); boolean result = false; try { userFolder.mkdir(); //result = true; File thisUsersPrefs = new File( installationPath + "/userdata/" + currentUser + "/userprefs"); thisUsersPrefs.mkdir(); result = true; File versions = new File( installationPath + "/userdata/" + currentUser + "/Versions"); thisUsersPrefs.mkdir(); versions.mkdir(); result = true; } catch (SecurityException se) { //handle it } if (result) { System.out.println("DIR created"); } } //check the path here //File f = new File(installationPath + "/userdata/" + currentUser); //if (f.exists() && f.isDirectory()) //{ Object[] possibilities = { "12", "14", "16" }; String font = (String) JOptionPane.showInputDialog(null, "Select a default font size:\n", "File Type", JOptionPane.PLAIN_MESSAGE, null, possibilities, "12"); if (font == "12") { Primary.setWrapText(true); fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); //magnified = false; File fs = new File( installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); FileWriter writ = new FileWriter(fs, false); //it is set to false so that the font size will be overwritten every time BufferedWriter bw = new BufferedWriter(writ); writ.append("1"); bw.close(); writ.close(); } if (font == "14") { Primary.setWrapText(true); fontsize = 2; rowCapacity = 34.3; characterCapacity = 70.0; Primary.setStyle("-fx-font-size: 14"); //magnified = false; File fs = new File( installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); FileWriter writ = new FileWriter(fs, false); //it is set to false so that the font size will be overwritten every time BufferedWriter bw = new BufferedWriter(writ); writ.append("2"); bw.close(); writ.close(); } if (font == "16") { Primary.setWrapText(true); fontsize = 3; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); //magnified = false; File fs = new File( installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); FileWriter writ = new FileWriter(fs, false); //it is set to false so that the font size will be overwritten every time BufferedWriter bw = new BufferedWriter(writ); writ.append("3"); bw.close(); writ.close(); } //create master doc & musings doc here try { //System.out.println(masterP.getText()); String fullPath1 = installationPath + "/userdata/" + currentUser + "/Master.txt"; System.out.println("fullpath1"); String fullPath2 = installationPath + "/userdata/" + currentUser + "/musings.txt"; System.out.println("fullpath2"); String fullPath4 = installationPath + "/userdata/" + currentUser + "/prewriting.txt"; System.out.println("fullpath3"); String fullPath5 = installationPath + "/userdata/" + currentUser + "/trash.txt"; System.out.println("fullpath4"); String fullPath3 = installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"; System.out.println("fullpath5"); String fullPath6 = installationPath + "/userdata/" + currentUser + "/userprefs/filetracker.txt"; System.out.println("fullpath6"); File statText1 = new File(fullPath1); System.out.println("fullpath1"); File statText2 = new File(fullPath2); System.out.println("fullpath2"); File statText3 = new File(fullPath3); System.out.println("fullpath3"); File statText4 = new File(fullPath4); System.out.println("fullpath4"); File statText5 = new File(fullPath5); System.out.println("fullpath5"); File statText6 = new File(fullPath6); System.out.println("fullpath6"); /*FileOutputStream is3 = new FileOutputStream(statText3); OutputStreamWriter osw3 = new OutputStreamWriter(is3); Writer w3 = new BufferedWriter(osw3); w3.write("1"); w3.close();*/ FileOutputStream is = new FileOutputStream(statText1); OutputStreamWriter osw = new OutputStreamWriter(is); Writer w = new BufferedWriter(osw); w.write(" "); w.close(); FileOutputStream is2 = new FileOutputStream(statText2); OutputStreamWriter osw2 = new OutputStreamWriter(is2); Writer w2 = new BufferedWriter(osw2); w2.write(" "); w2.close(); FileOutputStream is4 = new FileOutputStream(statText4); OutputStreamWriter osw4 = new OutputStreamWriter(is4); Writer w4 = new BufferedWriter(osw4); w4.write(""); w4.close(); FileOutputStream is5 = new FileOutputStream(statText5); OutputStreamWriter osw5 = new OutputStreamWriter(is5); Writer w5 = new BufferedWriter(osw5); w5.write(""); w5.close(); FileOutputStream is6 = new FileOutputStream(statText6); OutputStreamWriter osw6 = new OutputStreamWriter(is6); Writer w6 = new BufferedWriter(osw6); w6.write(""); w6.close(); String fullPath7 = installationPath + "/userdata/" + currentUser + "/userprefs/versionscreated.txt"; File aFile = new File(fullPath7); FileOutputStream is7 = new FileOutputStream(aFile); OutputStreamWriter osw7 = new OutputStreamWriter(is7); Writer w7 = new BufferedWriter(osw7); w7.write(""); w7.close(); //optional (cuz it'll be blank anyway): display masterdoc in the primary window //write user data here Writer output = new BufferedWriter( new FileWriter(installationPath + "/users.txt", true)); output.append("\n" + u + "," + p + "," + "1" + "," + installationPath + "/userdata/" + currentUser); output.close(); //masterPath = mP; //close the window here d.close(); loadFile.setDisable(false); save.setDisable(false); saveVersion.setDisable(false); tracker.setDisable(false); designate.setDisable(false); modeOn.setDisable(false); on.setDisable(false); modeOff.setDisable(true); off.setDisable(true); //insert.setDisable(false); /*goTo.setDisable(false); createPrintable.setDisable(false); forward.setDisable(false); backward.setDisable(false);*/ //stage.show(); } catch (IOException e) { System.out.println("Error- prolly not finding the path/file"); } } //} //else //{ //accountBox.getChildren().add(new Text("Location/Path specified does not exist. Please fix the path and try again.")); //} } //if it doesn't pan out, it prints the following message else { accountBox.getChildren().add( new Text("Username and Password must be a minimum of four characters in length")); } } catch (IOException io) { } } }); /*Primary.setWrapText(true); fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); magnified = false;*/ /*Primary.setWrapText(true); fontsize = 2; rowCapacity = 30.0; characterCapacity = 67.0; Primary.setStyle("-fx-font-size: 16"); magnified = false;*/ resetOnPaste(); } public void paste() { //paste code goes here //systemClipboard = Clipboard.getSystemClipboard(); if (Primary.isFocused()) { try { Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("primary has the focus"); Primary.insertText(Primary.getCaretPosition(), pasteThis); } catch (Exception e) { } reloadPrimary(); // refreshStatistics(); } else if (Prewriting.isFocused()) { try { Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("prewriting has the focus"); Prewriting.insertText(Prewriting.getCaretPosition(), pasteThis); } catch (Exception e) { } //System.out.println("prewriting has the focus"); //Prewriting.insertText(Prewriting.getCaretPosition(), systemClipboard.getString()); } else if (Musings.isFocused()) { try { Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("musings has the focus"); Musings.insertText(Musings.getCaretPosition(), pasteThis); } catch (Exception e) { } //System.out.println("musings has the focus"); //Musings.insertText(Musings.getCaretPosition(), systemClipboard.getString()); } else if (Insert.isFocused()) { try { Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("trash has the focus"); Insert.insertText(Insert.getCaretPosition(), pasteThis); } catch (Exception e) { } /*try{ Toolkit toolkit = Toolkit.getDefaultToolkit(); Clipboard cp = Clipboard.getSystemClipboard(); boolean pasteThis = cp.hasString(); //String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("hello"); System.out.println("In Clipboard: " + pasteThis); System.out.println("trash has the focus"); //Insert.insertText(Insert.getCaretPosition(), pasteThis); } catch(Exception e) {}*/ //System.out.println("trash has the focus"); //Insert.insertText(Insert.getCaretPosition(), systemClipboard.getString()); } //System.out.println(systemClipboard.getString()); if (newUser == true) { resetOnPaste(); newUser = false; onClickOrKeyPress(); } //KeyEvent.VK_C; } /*public void paste() { //paste code goes here //systemClipboard = Clipboard.getSystemClipboard(); if(Primary.isFocused()) { customizedPaste(); // System.out.println("primary has the focus"); // Primary.insertText(Primary.getCaretPosition(), pasteThis);} // catch(Exception e) // {} } else if(Prewriting.isFocused()) { try{ Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("prewriting has the focus"); Prewriting.insertText(Prewriting.getCaretPosition(), pasteThis);} catch(Exception e) {} //System.out.println("prewriting has the focus"); //Prewriting.insertText(Prewriting.getCaretPosition(), systemClipboard.getString()); } else if(Musings.isFocused()) { try{ Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("musings has the focus"); Musings.insertText(Musings.getCaretPosition(), pasteThis);} catch(Exception e) {} //System.out.println("musings has the focus"); //Musings.insertText(Musings.getCaretPosition(), systemClipboard.getString()); } else if(Insert.isFocused()) { try{ Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("trash has the focus"); Insert.insertText(Insert.getCaretPosition(), pasteThis);} catch(Exception e) {} /*try{ Toolkit toolkit = Toolkit.getDefaultToolkit(); Clipboard cp = Clipboard.getSystemClipboard(); boolean pasteThis = cp.hasString(); //String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); System.out.println("hello"); System.out.println("In Clipboard: " + pasteThis); System.out.println("trash has the focus"); //Insert.insertText(Insert.getCaretPosition(), pasteThis); } catch(Exception e) {}*/ //System.out.println("trash has the focus"); //Insert.insertText(Insert.getCaretPosition(), systemClipboard.getString()); /* } //System.out.println(systemClipboard.getString()); if(newUser == true) { resetOnPaste(); newUser = false; onClickOrKeyPress(); } //KeyEvent.VK_C; }*/ public void cut() { Clipboard systemClipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); if (Primary.isFocused()) { System.out.println("primary has the focus"); content.putString(Primary.getSelectedText()); Primary.cut(); } else if (Prewriting.isFocused()) { System.out.println("prewriting has the focus"); content.putString(Prewriting.getSelectedText()); Prewriting.cut(); } else if (Musings.isFocused()) { System.out.println("musings has the focus"); content.putString(Musings.getSelectedText()); Musings.cut(); } else if (Insert.isFocused()) { System.out.println("trash has the focus"); content.putString(Insert.getSelectedText()); Insert.cut(); } //systemClipboard.setContent(content); //System.out.println(systemClipboard.getString()); //System.out.println(systmClipboard.getContent(DataFormat.RTF).toString()); } public void copy() { Clipboard systemClipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); if (Primary.isFocused()) { System.out.println("primary has the focus"); content.putString(Primary.getSelectedText()); } else if (Prewriting.isFocused()) { System.out.println("prewriting has the focus"); content.putString(Prewriting.getSelectedText()); } else if (Musings.isFocused()) { System.out.println("musings has the focus"); content.putString(Musings.getSelectedText()); } else if (Insert.isFocused()) { System.out.println("trash has the focus"); content.putString(Insert.getSelectedText()); } systemClipboard.setContent(content); System.out.println(systemClipboard.getString()); //System.out.println(systmClipboard.getContent(DataFormat.RTF).toString()); } public void selectAll() { } public void undo() { } public void redo() { } @FXML public void keyTyped(KeyEvent event) { //if(event.equals(KeyEvent.VK_C)) System.out.println("key event detected"); if (event.getCode().equals(KeyCode.V) && event.isControlDown()) { System.out.println("Hello copy shortcut intercepted!"); if (newUser == true) { //reset.fire(); //trueReload(); //resetOnPaste(); resetOnPaste(); //newUser = false; onClickOrKeyPress(); } else { reloadPrimary(); // paste(); onClickOrKeyPress(); /*if(Primary.isFocused() == true) { customizedPaste(); } else { paste(); }*/ } } /*else if(event.getCode().equals(KeyCode.ENTER)) { loadPrimaryFromPrimary(); onClickOrKeyPress(); }*/ else if ((event.getCode().equals(KeyCode.ALPHANUMERIC) || event.getCode().equals(KeyCode.BACK_SPACE) || event.getCode().equals(KeyCode.ENTER)) && (Primary.isFocused() == true)) { newText = true; onClickOrKeyPress(); } else { onClickOrKeyPress(); } } public void loadPrimaryFromPrimary() { //do what you did in loadText/Word doc for insert at caret position } public void oldLoadPrimaryFromPrimary() { int currentCaretPosition = Primary.getCaretPosition(); try { StringReader reader = new StringReader(Primary.getText()); BufferedReader br = new BufferedReader(reader); Primary.clear(); String s; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. //ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window int index = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { System.out.println("Hello load primary from primary"); while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') System.out.println("before newline check"); if (n.indexOf("\n") != 0) { Primary.appendText(n); System.out.println("newline detected!"); } else { Primary.appendText(n + "\n"); } index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { //if(s.charAt(index) == '\n') //{ Primary.appendText(s); //} //else //{ // Primary.appendText(s + "\n"); //} index = s.length(); //OR use break; endOfPara = true; } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } if (endOfPara == true) { //if(s.charAt(index - 2) != '\n') //{ Primary.appendText("\n\n"); //} } endOfPara = false; } Primary.positionCaret(currentCaretPosition); } catch (Exception e) { } } /*public void handleEvent() { System.out.println("key event detected"); if (event.getCode().equals(KeyCode.ENTER) && event.isControlDown()) { // CTRL + ENTER messageArea.setText(messageArea.getText() + "\n"); System.out.println("Hello copy shortcut intercepted!"); if(newUser == true) { //reset.fire(); //trueReload(); //resetOnPaste(); resetOnPaste(); newUser = false; onClickOrKeyPress(); } } }*/ /*public void fixEverything() { if(newUser == true) { //-Primary.clear(); //-reset.fire(); //trueReload(); //resetOnPaste(); newUser = false; onClickOrKeyPress(); } } public void trueReload() { fontsize = 1; rowCapacity = 40.0; characterCapacity = 90.0; Primary.setStyle("-fx-font-size: 12"); magnified = false; /*try { FileReader r1 = new FileReader(installationPath + "/userdata/" + currentUser + "/userprefs/fontsize.txt"); BufferedReader br = new BufferedReader(r1); String line; line = br.readLine().trim(); if(line.equalsIgnoreCase("1")) { fontsize = 1; rowCapacity = 40.0; characterCapacity= 90.0; System.out.println("hello font size 1"); Primary.setStyle("-fx-font-size: 12"); plus.setDisable(false); minus.setDisable(true); } /*if(line.equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 34.0; characterCapacity = 60.0; Primary.setStyle("-fx-font-size: 14"); }*/ /* if(line.equalsIgnoreCase("2")) { fontsize = 2; rowCapacity = 24.0; characterCapacity = 55.0; Primary.setStyle("-fx-font-size: 20"); plus.setDisable(true); minus.setDisable(false); } br.close(); r1.close(); } catch(Exception e) { }*/ //loads the master document /* title.setText("Hello Again"); welcome.setText("Welcome Back!"); Primary.setWrapText(true); loadFile.setDisable(false); save.setDisable(false); saveVersion.setDisable(false); tracker.setDisable(false); designate.setDisable(false); modeOn.setDisable(false); modeOff.setDisable(true); //insert.setDisable(false); /*goTo.setDisable(false); createPrintable.setDisable(false); forward.setDisable(false); backward.setDisable(false);*/ //stage.show(); /* try { FileReader r1 = new FileReader(installationPath + "/userdata/" + currentUser + "/musings.txt"); BufferedReader b1 = new BufferedReader(r1); String line; while((line = b1.readLine()) != null) { Musings.appendText(line + "\n"); } b1.close(); r1.close(); Musings.home(); FileReader r2 = new FileReader(installationPath + "/userdata/" + currentUser + "/prewriting.txt"); BufferedReader b2 = new BufferedReader(r2); String line2; while((line2 = b2.readLine()) != null) { Prewriting.appendText(line2 + "\n"); } b2.close(); r2.close(); Prewriting.home(); FileReader r3 = new FileReader(installationPath + "/userdata/" + currentUser + "/trash.txt"); BufferedReader b3 = new BufferedReader(r3); String line3; while((line3 = b3.readLine()) != null) { Insert.appendText(line3 + "\n"); } b3.close(); r3.close(); Insert.home(); //masterPath = masterPath + "/Master.txt"; // File f = new File(masterPath); //System.out.println(masterPath); //It's just a little pg that I designed w y i m...h~ // Primary.appendText("blah"); FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window while((aLine = br2.readLine()) != null) { if(aLine.length() > characterCapacity) { ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double)aLine.length()/characterCapacity); double remainingCharas = (double)aLine.length() % characterCapacity; int onSegment = 1; int currentCharIndex = 0; int toIndex = (int)(characterCapacity - 1); do { Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); currentCharIndex = toIndex; toIndex = toIndex + (int)characterCapacity; onSegment++; } while(onSegment <= numberOfWholeSegments); toIndex = toIndex - (int)characterCapacity + (int)remainingCharas + 1; Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); /*while() while(currentCharIndex < aLine.length()) { for(int c = currentCharIndex; c < 90; c++) { } }*/ /*for(int c = 0; c < aLine.length(); c++) { if(c % 90 == 0) { Primary.appendText(aLine.substring(n, c) + "\n"); n = c; } }*/ /* } else { Primary.appendText(aLine + "\n"); //appendText, insertText, setText } //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; //ct++; } Primary.positionCaret(0); //System.out.println(Primary.styleProperty().toString()); } catch(Exception e) { } }*/ public void resetOnPaste() { save(); Primary.clear(); reinitializePrimary(); } //d.initModality(Modality.APPLICATION_MODAL); // mainForm.initModality(Modality.APPLICATION_MODAL); //Reordered/Reorganized Chaos // submit. //"wow. really?!:" //x.x aka what you SHOULD've said- now all y s is a l./d b a //of[a] people that had forgotten //}//End of Initialize //include a label with masterdoc stats such as total words, total pages, and onPage // EXECUTION STARTS HERE for all practical purposes- this is, ESSENTIALLY, your main //Reord/reorg /*title.setText("Hello Again"); File f = new File("C:/Users/Quiggy/Desktop/MOG- and various other pet programming projects/adjectives.txt"); if(f.exists()) { System.out.println("File exists"); try { Primary.setWrapText(true); //Primary.setWrapStyleWord(true); //It's just a little pg that I designed w y i m...h~ FileReader reader = new FileReader("C:/Users/Quiggy/Desktop/MOG- and various other pet programming projects/adjectives.txt"); BufferedReader br = new BufferedReader(reader); String s, previousLine = ""; int count = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); while((s = br.readLine()) != null) { Primary.appendText(s + "\n"); //appendText, insertText, setText //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; count++; } Primary.positionCaret(0); } catch(Exception e) { } } else { System.out.println("File does not exist"); }*/ public void closeFilesWindow() { filesWindow.setVisible(false); } public void displayFilesWindow() { filesWindowText.clear(); ArrayList existingDirectories = new ArrayList(); ArrayList Indexedfiles = new ArrayList(); try { FileReader reader = new FileReader( installationPath + "/userdata/" + currentUser + "/userprefs/filetracker.txt"); BufferedReader br = new BufferedReader(reader); String line; while ((line = br.readLine()) != null) { filesWindowText.appendText(line + "\n"); } br.close(); reader.close(); //filesWindowText.write() } catch (IOException e) { } //filesWindowText.appendText("BLHAHAIF"); //filesWindowText.appendText(installationPath + "/FilesTracker" + currentUser); filesWindow.setVisible(true); } public void saveVersion() { File versionsFolder = new File(installationPath + "/userdata/" + currentUser + "/Versions"); // if the directory does not exist, create it if (!versionsFolder.exists()) { // System.out.println("creating directory: " + directoryName); boolean result = false; try { versionsFolder.mkdir(); result = true; } catch (SecurityException se) { //handle it } if (result) { System.out.println("DIR created"); } } /*File userFolder = new File(path + "/Versions" + "/" + currentUser); // if the directory does not exist, create it if (!userFolder.exists()) { // System.out.println("creating directory: " + directoryName); boolean result = false; try { userFolder.mkdir(); result = true; } catch(SecurityException se) { //handle it } if(result) { System.out.println("DIR created"); } }*/ //The "fun" starts here try { //version directory creation block FileReader reader = new FileReader( installationPath + "/userdata/" + currentUser + "/userprefs/" + "versionscreated.txt"); BufferedReader br = new BufferedReader(reader); String fullString = ""; boolean reached = false; int lastSavedVersion = 0; int versionToMake = 2; while (reached != true && (fullString = br.readLine()) != null) { String[] splits = fullString.split(","); if (splits[0].equals(currentUser)) { reached = true; lastSavedVersion = Integer.parseInt(splits[1]); } } //title.setText("Hello World"); title.setText(Boolean.toString(reached)); if (reached == false) { //user has not created any versions- I. create the first version and II. record the user and version number in the file //I. versionToMake = 1; File v1 = new File(installationPath + "/userdata/" + currentUser + "/Versions/v1"); v1.mkdir(); //II. FileWriter writer = new FileWriter( installationPath + "/userdata/" + currentUser + "/userprefs/versionscreated.txt"); //ie. change this to the "installation path" when this goes the executable route BufferedWriter bw = new BufferedWriter(writer); writer.append(currentUser + ",1"); bw.close(); writer.close(); } else { //previous versions exist- create the appropriate version and change the user's version number in the file //I. versionToMake = lastSavedVersion + 1; //title.setText(path + "/Versions/" + currentUser + "/v" + versionToMake); File aVersion = new File( installationPath + "/userdata/" + currentUser + "/Versions/v" + versionToMake); if (!aVersion.exists()) { // System.out.println("creating directory: " + directoryName); boolean result = false; try { aVersion.mkdir(); result = true; } catch (SecurityException se) { //handle it } if (result) { System.out.println("DIR created"); } } //II. ArrayList fileContents = new ArrayList(); FileReader reader2 = new FileReader( installationPath + "/userdata/" + currentUser + "/userprefs/versionscreated.txt"); //ie. change this to the "installation path" when this goes the executable route BufferedReader br2 = new BufferedReader(reader2); String aLine = ""; while ((aLine = br2.readLine()) != null) { String[] splits = fullString.split(","); if (splits[0].equals(currentUser)) { } else { fileContents.add(aLine); } } //create the new file //write the lines stored in the array to the new file //append the current users name and version number, seperated by a comma FileOutputStream is2 = new FileOutputStream( installationPath + "/userdata/" + currentUser + "/userprefs/versionscreated.txt"); OutputStreamWriter osw2 = new OutputStreamWriter(is2); Writer w2 = new BufferedWriter(osw2); for (int i = 0; i < fileContents.size(); i++) { if (i == 0) { //reorg_ch, Caution: going into viewing mode will automatically save your session; sw/ja ff, ygo ff, tcw ff w2.write(fileContents.get(i).toString()); } else { w2.append(fileContents.get(i).toString()); } } w2.append(currentUser + "," + versionToMake); w2.close(); } //end of the second set of I. & II. //file saving block String pathToStoreFiles = installationPath + "/userdata/" + currentUser + "/Versions/v" + versionToMake; File f1 = new File(pathToStoreFiles + "/Master.txt"); File f2 = new File(pathToStoreFiles + "/musings.txt"); File f3 = new File(pathToStoreFiles + "/prewriting.txt"); File f4 = new File(pathToStoreFiles + "/trash.txt"); FileOutputStream fOS1 = new FileOutputStream(f1); OutputStreamWriter streamWriter1 = new OutputStreamWriter(fOS1); Writer writer1 = new BufferedWriter(streamWriter1); Primary.selectAll(); writer1.write(Primary.getSelectedText()); Primary.deselect(); Primary.home(); writer1.close(); streamWriter1.close(); fOS1.close(); FileOutputStream fOS2 = new FileOutputStream(f2); OutputStreamWriter streamWriter2 = new OutputStreamWriter(fOS2); Writer writer2 = new BufferedWriter(streamWriter2); Musings.selectAll(); writer2.write(Musings.getSelectedText()); Musings.deselect(); Musings.home(); writer2.close(); streamWriter2.close(); fOS2.close(); FileOutputStream fOS3 = new FileOutputStream(f3); OutputStreamWriter streamWriter3 = new OutputStreamWriter(fOS3); Writer writer3 = new BufferedWriter(streamWriter3); Prewriting.selectAll(); writer3.write(Prewriting.getSelectedText()); Prewriting.deselect(); Prewriting.home(); writer3.close(); streamWriter3.close(); fOS3.close(); FileOutputStream fOS4 = new FileOutputStream(f4); OutputStreamWriter streamWriter4 = new OutputStreamWriter(fOS4); Writer writer4 = new BufferedWriter(streamWriter4); Insert.selectAll(); writer4.write(Insert.getSelectedText()); Insert.deselect(); Insert.home(); writer4.close(); streamWriter4.close(); fOS4.close(); } catch (Exception e) { System.out.println("saving a version threw this exception: " + e); } //displays the "version saved" message box JOptionPane.showMessageDialog(null, "Version Created/Saved!"); /*final Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); final TextField textField = new TextField(); Button ok = new Button(); ok.setText("Ok"); ok.setAlignment(Pos.BOTTOM_RIGHT); final VBox dialogVbox = new VBox(20); dialogVbox.getChildren().add(new Text("\n\n\n Version Successfully Created!")); //dialogVbox.getChildren().add(textField); dialogVbox.getChildren().add(ok); Scene dialogScene = new Scene(dialogVbox, 300, 130); dialog.setScene(dialogScene); dialog.setTitle("Version Creation Successful"); dialog.show(); ok.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { dialog.close(); //close the window here } });*/ } public void createPrintable() { try { //add the LAST paragraph to paragraphs here /*int endOfPara = s.length() - 1; char cur = 'a'; char next = 'b'; char nextNext = 'c'; int variableIndex = endOfPara; while(!((cur == ' ' || cur == '\n') && (next == '\n'))) { cur = s.charAt(variableIndex); next = s.charAt(variableIndex - 1); //nextNext = s.charAt(variableIndex - 2); variableIndex--; } String blah = s.substring(variableIndex, endOfPara); paragraphs.add(blah);*/ /* if(current == '@') //read in the new document and make all the chapter headers bold {}*/ final Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); final TextField textField = new TextField(); Button submit = new Button(); Button cancel = new Button(); cancel.setText("Cancel"); cancel.setAlignment(Pos.CENTER); submit.setText("Continue"); submit.setAlignment(Pos.BOTTOM_RIGHT); // submit. final VBox dialogVbox = new VBox(20); dialogVbox.getChildren().add(new Text("What is the name/title of your book? ")); dialogVbox.getChildren().add(textField); dialogVbox.getChildren().add(submit); dialogVbox.getChildren().add(cancel); Scene dialogScene = new Scene(dialogVbox, 300, 200); dialog.setScene(dialogScene); dialog.setTitle("Give your book a title "); dialog.show(); submit.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { System.out.println("Hi create Printable: " + characterCapacity); save(); Primary.appendText("\n\n" + "----End of Document----" + "\n"); ArrayList paragraphs = new ArrayList(); String s = Primary.getText(); char current = ' '; char previous = ' '; String aParagraph = ""; int beginningIndex = 0; for (int i = 0; i < s.length(); i++) { current = s.charAt(i); /*if(i > 0) { previous = s.charAt(i - 1); }*/ if (current == '\n' && previous == '\n') { aParagraph = s.substring(beginningIndex, i); //todo: remove every 90th character (eg when % 90 == 0) from aParagraph before adding it //THIS IS THE "IMPORTANT" BLOCK YOU BRACKETED OUT ON A WHIM /* for(int a = 0; a < aParagraph.length(); a++) { //lecturer //use your "fame" to your advantage //yt channel- if(a >= characterCapacity)//surprising her, as the connection grew closer/stronger and stronger, chapter titles, last paragraph getting cut off {//a state of deep & profound relaxation. Sitara cared about nothing/little. It was the l itself that made the [first] entreaty, wherein she could, in idle 'conversation' beckon it/request it to mve; or to perform any operation allowed/conceivable by its physical makeup. if(a % characterCapacity == 0) //author's note: there are things in there that are pure fantasy/while the vast majority is pure fantasy, as well as things in there that are based on my real life, loosely and even closely/nearly identically, in some cases {//"a polite request works better than an assertion of dominance--something you're unfamiliar with, I'm sure." StringBuilder builder = new StringBuilder(aParagraph); System.out.println(aParagraph.charAt(a)); builder.deleteCharAt(a); aParagraph = builder.toString(); } } }*/ /* int b = 0; for(int a = 0; a < aParagraph.length(); a++) { //lecturer //use your "fame" to your advantage //yt channel- //if(b == characterCapacity)//surprising her, as the connection grew closer/stronger and stronger, chapter titles, last paragraph getting cut off //{//a state of deep & profound relaxation. Sitara cared about nothing/little. It was the l itself that made the [first] entreaty, wherein she could, in idle 'conversation' beckon it/request it to mve; or to perform any operation allowed/conceivable by its physical makeup. //if(a % (characterCapacity) == 0) //author's note: there are things in there that are pure fantasy/while the vast majority is pure fantasy, as well as things in there that are based on my real life, loosely and even closely/nearly identically, in some cases //{//"a polite request works better than an assertion of dominance--something you're unfamiliar with, I'm sure." if(b == characterCapacity) { StringBuilder builder = new StringBuilder(aParagraph); //builder.deleteCharAt(a); //builder.deleteCharAt(a-1); System.out.println(aParagraph.charAt(a)); aParagraph = builder.toString(); b = 0; //} } b++; }*/ paragraphs.add(aParagraph); /*if(s.substring(i, s.length()-1).length() <= 90) { String finalParagraph = s.substring(i, s.length()-1); //light-blue tiles paragraphs.add(finalParagraph); }*/ while (s.charAt(i) == ' ') { i++; } beginningIndex = i; } previous = current; } String title = textField.getText(); dialog.close(); int result = JOptionPane.showConfirmDialog(null, "In the next screen, enter a title/a unique label for your manuscript.\n If needed, this can include a version number or type.\n It does not need to have the same title as your book. \n You do NOT need to include any extensions, such as .docx--this will\n be taken care of automatically.", "No extension required", JOptionPane.OK_CANCEL_OPTION); //[before returning to the login screen?] if (result == 0) { JFileChooser chooser = new JFileChooser(); int value = chooser.showOpenDialog(null); String saveFile = ""; // JOptionPane.showMessageDialog(null, "In the next screen, enter a title/a unique label for your manuscript. If needed, this can include a version number or type. It does not need to have the same title as your book. You do NOT need to include any extensions, such as .docx--this will be taken care of automatically."); if (value == JFileChooser.APPROVE_OPTION) { saveFile = chooser.getSelectedFile().getPath() + ".docx"; } try { FileOutputStream outstream = new FileOutputStream(saveFile); //FileOutputStream outstream = new FileOutputStream("C:/Users/Quiggy/Desktop/Test.docx"); XWPFDocument doc = new XWPFDocument(); XWPFParagraph titlePara = doc.createParagraph(); titlePara.setAlignment(ParagraphAlignment.CENTER); XWPFRun titleRun = titlePara.createRun(); titleRun.setBold(true); titleRun.setFontSize(18); //titleRun.setText("\n\n\n\n\n\n" + title + "\n\n\n\n\n\n\n\n"); titleRun.addBreak(); titleRun.addBreak(); titleRun.addBreak(); titleRun.addBreak(); titleRun.addBreak(); titleRun.addBreak(); titleRun.addBreak(); titleRun.setText(title); titleRun.addBreak(BreakType.PAGE); XWPFParagraph contents = doc.createParagraph(); titlePara.setAlignment(ParagraphAlignment.CENTER); XWPFRun contentsRun = contents.createRun(); contentsRun.setBold(true); contentsRun.setFontSize(16); contentsRun.setText("Contents: "); contentsRun.addBreak(); contentsRun.addBreak(); XWPFParagraph chaptersNames = doc.createParagraph(); titlePara.setAlignment(ParagraphAlignment.CENTER); int chapterCount = 0; for (int c = 0; c < paragraphs.size(); c++) { /*XWPFParagraph p = doc.createParagraph(); //Paragraph XWPFRun run = p.createRun(); //Where the text will be written from run.setText("\t");*/ XWPFRun chaptersRun = chaptersNames.createRun(); chaptersRun.setBold(false); chaptersRun.setFontSize(12); //chaptersRun.setText("A chapter \t\t\t\t\t\t\t\t ... "); String currentParagraph = paragraphs.get(c).toString(); for (int d = 0; d < currentParagraph.length(); d++) { if (currentParagraph.charAt(d) == '~') { chapterCount++; currentParagraph = currentParagraph.substring(d + 1, currentParagraph.length() - 2); if ((currentParagraph.indexOf("chapter") == -1) && (currentParagraph.indexOf("Chapter") == -1) && (currentParagraph.indexOf("CHAPTER") == -1)) { chaptersRun.setText("Chapter " + chapterCount + ": " + currentParagraph + "\t\t\t\t\t\t\t ... "); } else { chaptersRun.setText(currentParagraph + "\t\t\t\t\t\t\t ... "); } chaptersRun.addBreak(); } else { //run.setBold(false); } } //doc.createParagraph().createRun().setText(" " + paragraphs.get(c).toString()); //doc.createParagraph().createRun().addBreak(); } XWPFParagraph breakPara = doc.createParagraph(); titlePara.setAlignment(ParagraphAlignment.CENTER); XWPFRun breakRun = breakPara.createRun(); breakRun.setBold(false); breakRun.setFontSize(12); breakRun.addBreak(BreakType.PAGE); XWPFParagraph para = doc.createParagraph(); para.setAlignment(ParagraphAlignment.CENTER); XWPFRun paraRun = para.createRun(); paraRun.setBold(true); paraRun.setFontSize(12);//paraRun.setFontSize(16); //paraRun.setText("Hello World"); //paraRun.setText(Primary.getText()); //doc.createParagraph().createRun().addBreak(); //inserts a line break //doc.createParagraph().createRun().setText("blah"); //creates another paragraph for (int c = 0; c < paragraphs.size(); c++) { /*XWPFParagraph p = doc.createParagraph(); //Paragraph XWPFRun run = p.createRun(); //Where the text will be written from run.setText("\t");*/ XWPFParagraph p = doc.createParagraph(); //Paragraph XWPFRun run = p.createRun(); //Where the text will be written from String currentParagraph = paragraphs.get(c).toString(); for (int d = 0; d < currentParagraph.length(); d++) { if (currentParagraph.charAt(d) == '~') { currentParagraph = currentParagraph.substring(d + 1, currentParagraph.length() - 2); run.setBold(true); } else { //run.setBold(false); } } run.setText(" " + currentParagraph); run.addBreak(); //NEW! //doc.createParagraph().createRun().setText(" " + paragraphs.get(c).toString()); //doc.createParagraph().createRun().addBreak(); } doc.write(outstream); outstream.close(); } catch (Exception io) { } //JOptionPane.showConfirmDialog(null, "Are you sure you want to create the word document?"); //Makes the chapter titles bold and removes the "@" & "-" JOptionPane.showMessageDialog(null, "Document Successfully Created. The program/AA will now exit"); try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(new File(saveFile)); } } catch (IOException ioe) { ioe.printStackTrace(); } System.exit(0); } if (result == 1) { } /*if(result == 2) { }*/ } }); cancel.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { dialog.close(); //close the window here } }); } catch (Exception e) { } } //scrollbar AND perfect page flipping, perfect page flipping //disable editing in viewing mode public void indexFile(String filePath) { /*String fP = filePath; //adds files to file tracker try { File filesLoadedLog = new File(installationPath + "/FileTracker" + currentUser); FileWriter writ = new FileWriter(filesLoadedLog, true); BufferedWriter bw = new BufferedWriter(writ); //writ.append("Hello World"); // if(filesLoadedLog.exists() == true) // { writ.append(" ("+ fileLocation + ") \n"); // title.setText(fileLocation); // } // else // { // writ.write(fileLocation); // title.setText(fileLocation); // } bw.close(); writ.close(); } catch(Exception e) { }*/ //right now: pr,yahoo,petprograms //summer: physics gre,teaching certification/harv } public void readToMe() { reading = true; String primaryText = Primary.getText(); FreeTTS freetts; String voiceName = "kevin16"; System.out.println(); System.out.println("Using voice: " + voiceName); /* The VoiceManager manages all the voices for FreeTTS. */ VoiceManager voiceManager = VoiceManager.getInstance(); Voice helloVoice = voiceManager.getVoice(voiceName); if (helloVoice == null) { System.err.println("Cannot find a voice named " + voiceName + ". Please specify a different voice."); System.exit(1); } /* Allocates the resources for the voice. */ helloVoice.allocate(); /* Synthesize speech. */ //helloVoice.speak("Thank you for giving me a voice. " + "I'm so glad to say hello to this world."); while (reading == true) { helloVoice.speak(primaryText); } /* Clean up and leave. */ helloVoice.deallocate(); /*try { Audio audio = Audio.getInstance(); System.out.println("hi audio"); InputStream sound = audio.getAudio("hello", Language.ENGLISH); System.out.println("hi again audio"); audio.play(sound); } catch(Exception excep) { System.out.println("audio exception: " + excep); //System.out.println(excep); }*/ } public void stopReadingToMe() { /*try { Audio a = Audio.getInstance(); InputStream sound = a.getAudio("", Language.ENGLISH); a.play(sound); } catch(Exception excep) { }*/ reading = false; /*FreeTTS freetts; String voiceName = "kevin16"; VoiceManager voiceManager = VoiceManager.getInstance(); Voice helloVoice = voiceManager.getVoice(voiceName); helloVoice.deallocate();*/ } public void launchSpeechRecognition() { Runtime rt = Runtime.getRuntime(); try { //Process process = rt.exec("control panel"); //Process process2 = rt.exec("cmd.exe"); Process process = rt.exec("Control Panel"); try { process.wait(2500); } catch (Exception e) { } Process process3 = rt.exec("notepad"); //Process process4 = rt.exec("Speech Recognition"); } catch (Exception e) { System.out.println(e); } try { Audio audio = Audio.getInstance(); InputStream sound = audio.getAudio("Type 'speech' into the control panel search bar.", Language.ENGLISH); audio.play(sound); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Type 'Speech' into the control panel search bar. It will guide you through how to use Windows 7 Native Dictation"); } } public void setLastFocusToPrimary() { lastFocus = "primary"; } public void setLastFocusToTrash() { lastFocus = "trash"; } public void setLastFocusToMusings() { lastFocus = "musings"; } public void setLastFocusToPrewriting() { lastFocus = "prewriting"; } //next door pizza (grk/mdd), souplantation, thai restuarant with the amazing coconut water //boar's head swiss slices public void refreshStatistics() { int currentPos = Primary.getCaretPosition(); Primary.selectAll(); Primary.cut(); customizedPaste(); Primary.positionCaret(currentPos); } public void customizedPaste() { try { Toolkit toolkit = Toolkit.getDefaultToolkit(); String pasteThis = toolkit.getSystemClipboard().getData(DataFlavor.stringFlavor).toString(); // Primary.insertText(Primary.getCaretPosition(), "\n"); //Primary.nextWord(); //Primary.forward(); int desiredCaretPosition = Primary.getCaretPosition(); Primary.end(); int start = Primary.getCaretPosition(); StringReader reader = new StringReader(pasteThis); BufferedReader br = new BufferedReader(reader); //FileReader reader = new FileReader(fileLocation); //BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; // int index = 0; // boolean endOfPara = false; //loads the text and formats it if necessary while ((s = br.readLine()) != null) { index = 0; //loading block if (s.length() <= characterCapacity) { //String s = "abcdefg"; int result = s.indexOf('\n'); if (result == -1) { Primary.appendText(s + "\n"); } else { Primary.appendText(s); } } //formatting block else { while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') //{ // Primary.appendText(n); //} //else //{ Primary.appendText(n + "\n"); //} index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } if (endOfPara == true) { if (s.charAt(index - 2) != '\n') { Primary.appendText("\n"); } } endOfPara = false; } } /*while((s = br.readLine()) != null) { index = 0; while(index < s.length()) //change this { if((index == characterCapacity) && (index < s.length() - 1)) { while(s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') //{ // Primary.appendText(n); //} //else //{ Primary.appendText(n + "\n"); //} index = 0; } else if((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s); //Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if(endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; }*/ Primary.end(); int end = Primary.getCaretPosition(); Primary.selectRange(start, end); String appendedText = Primary.getSelectedText(); Primary.deleteText(start, end); Primary.insertText(desiredCaretPosition, appendedText); /*Clipboard systemClipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); Primary.end(); Primary.selectRange(endPos, Primary.getCaretPosition()); content.putString(Primary.getSelectedText()); Primary.cut(); Primary.positionCaret(caretPosition); Primary.paste();*/ } catch (Exception e) { } } public void firstReloadPrimary() { String pText = Primary.getText(); Primary.clear(); StringReader reader = new StringReader(pText); BufferedReader br = new BufferedReader(reader); //FileReader reader = new FileReader(fileLocation); //BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; // int index = 0; // boolean endOfPara = false; try { //loads the text and formats it if necessary while ((s = br.readLine()) != null) { index = 0; //loading block if (s.length() <= characterCapacity) { //String s = "abcdefg"; int result = s.indexOf('\n'); if (result == -1) { Primary.appendText(s + "\n"); } else { Primary.appendText(s); } } //formatting block else { while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') //{ // Primary.appendText(n); //} //else //{ Primary.appendText(n + "\n"); //} index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; //Primary.forward(); //Primary.deletePreviousChar(); } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } /*if(endOfPara == true) { if(s.charAt(index - 2) != '\n') { Primary.appendText("\n"); } } endOfPara = false;*/ } } } catch (Exception e) { } } public void secondReloadPrimary() { save(); Primary.clear(); try { FileReader reader2 = new FileReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br2 = new BufferedReader(reader2); String aLine, prevL = ""; //int ct = 0; //System.out.println("The contents of the file are: "); //s = br.readLine(); //System.out.println(s); //Removes All Newline characters //EXCEPT those around chapter headers (call a seperate method) and paragraphs //Inserts newline characters and prints the text to the window //the fix below IS TEMPORARY ONLY. The actual algorithm you should use is as follows: if the string is less than 90 chars, add it. If it is greater than 90 chars, use something less than 90 chars (depending on where the spaces are) as a delimiter, and split it into an appropriate number of substrings. store each of these substrings in an array/arraylist. iterate through the array, and add these to primary. ArrayList manuallyAddedNewlinesToRemoveOnSave = new ArrayList(); //SHOULD NOT be necessary, because the newline characters are specific to the viewing window while ((aLine = br2.readLine()) != null) { if (aLine.length() > characterCapacity) { ArrayList segments = new ArrayList(); double numberOfWholeSegments = Math.floor((double) aLine.length() / characterCapacity); double remainingCharas = (double) aLine.length() % characterCapacity; int onSegment = 1; int currentCharIndex = 0; int toIndex = (int) (characterCapacity - 1); do { while (aLine.charAt(toIndex) != ' ') { toIndex--; } Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); currentCharIndex = toIndex; toIndex = toIndex + (int) characterCapacity; onSegment++; } while (onSegment <= numberOfWholeSegments); toIndex = toIndex - (int) characterCapacity + (int) remainingCharas + 1; Primary.appendText(aLine.substring(currentCharIndex, toIndex) + "\n"); /*while() while(currentCharIndex < aLine.length()) { for(int c = currentCharIndex; c < 90; c++) { } }*/ /*for(int c = 0; c < aLine.length(); c++) { if(c % 90 == 0) { Primary.appendText(aLine.substring(n, c) + "\n"); n = c; } }*/ } else { Primary.appendText(aLine + "\n"); //appendText, insertText, setText } //Primary. //Primary.setText(previousLine + s); //System.out.println(s); //previousLine=s; //ct++; } Primary.positionCaret(0); //System.out.println(Primary.styleProperty().toString()); } catch (Exception e) { } try { //FileReader reader = new FileReader(fileLocation); //InputStream in = IOUtils.toInputStream(fullText, "UTF-8"); StringReader reader = new StringReader(installationPath + "/userdata/" + currentUser + "/Master.txt"); BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); Primary.appendText(n + "\n"); index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } if (endOfPara == true) { Primary.appendText("\n"); } endOfPara = false; } } catch (Exception e) { } //Primary.appendText(fullText); //resetOnPaste(); onClickOrKeyPress(); } public void reloadPrimary3() { try { Primary.getSkin().getClass().getDeclaredMethod("getCaretBoundsOnScreen"); } catch (Exception e) { } try { //FileReader reader = new FileReader(fileLocation); //InputStream in = IOUtils.toInputStream(fullText, "UTF-8"); StringReader reader = new StringReader(Primary.getText()); Primary.clear(); BufferedReader br = new BufferedReader(reader); String prev = ""; String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; while ((s = br.readLine()) != null) { index = 0; while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); prev = n; if (((n.charAt(0) == '\t') || (n.charAt(0) == ' ')) && (prev.length() < characterCapacity)) { Primary.appendText(n.charAt(0) + n.trim() + "\n"); } else { Primary.appendText(n.trim() + "\n"); } index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { prev = s; Primary.appendText(s.trim() + "\n"); index = s.length(); //OR use break; endOfPara = true; } else { index++; } } /*if(endOfPara == true) { Primary.appendText("\n"); }*/ endOfPara = false; } } catch (Exception e) { } //Primary.appendText(fullText); //resetOnPaste(); onClickOrKeyPress(); } public void reloadPrimary() { newText = false; int caretPosition = Primary.getCaretPosition(); String pText = Primary.getText(); Primary.clear(); StringReader reader = new StringReader(pText); BufferedReader br = new BufferedReader(reader); //FileReader reader = new FileReader(fileLocation); //BufferedReader br = new BufferedReader(reader); String s; int index = 0; //int charCounter = 0; boolean endOfPara = false; // int index = 0; // boolean endOfPara = false; try { //loads the text and formats it if necessary while ((s = br.readLine()) != null) { index = 0; //loading block if (s.length() <= characterCapacity) { //String s = "abcdefg"; int result = s.indexOf('\n'); if (result == -1) { Primary.appendText(s + "\n"); } else { Primary.appendText(s); } } //formatting block else { while (index < s.length()) //change this { if ((index == characterCapacity) && (index < s.length() - 1)) { while (s.charAt(index) != ' ') { index--; } String n = s.substring(0, index); s = s.substring(index); //if(n.charAt(n.length() - 1) == '\n') //{ // Primary.appendText(n); //} //else //{ Primary.appendText(n + "\n"); //} index = 0; } else if ((index == s.length() - 1) && (index <= characterCapacity) && (s.length() > 0)) { Primary.appendText(s + "\n"); index = s.length(); //OR use break; endOfPara = true; //Primary.forward(); //Primary.deletePreviousChar(); } else { index++; } /*if(charCounter > 90) { if((charCounter >= 90) && (s.charAt(index) != ) { } if(index == (s.length() - 1)) { } else { charCounter++; } }*/ } /*if(endOfPara == true) { if(s.charAt(index - 2) != '\n') { Primary.appendText("\n"); } } endOfPara = false;*/ } } } catch (Exception e) { } Primary.positionCaret(caretPosition); } public void textFormattingPutASpaceBetweenParagraphs() { } public void emptyTrash() { int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to empty the trash can?", "Viewing Mode", JOptionPane.OK_CANCEL_OPTION); if (result == 0) { //Insert.selectAll(); //unnecessary Insert.clear(); } if (result == 1) { } } public void clearSelectionFromTrash() { int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to clear this selection (the highlighted text)?", "Viewing Mode", JOptionPane.OK_CANCEL_OPTION); if (result == 0) { //int a, b; //a = Insert.getSelection().getStart(); //b = Insert.getSelection().getEnd(); //Insert.deleteText(a, b); Insert.deleteText(Insert.getSelection()); } if (result == 1) { } } public void autoDesignate() { int eeIndex = 0; int prevIndex = 0; /*if(eIndex <= prevIndex) { break; }*/ while (eeIndex >= prevIndex) { String primaryText = Primary.getText(); int startIndex = primaryText.indexOf("Chapter", eeIndex); Primary.positionCaret(startIndex); int i = startIndex; while (primaryText.charAt(i) != '\n') { Primary.selectForward(); i++; } designateAsChapter(); Primary.forward(); Primary.deselect(); prevIndex = eeIndex; eeIndex = i; } /*eeIndex = 0; prevIndex = 0; Primary.home(); while(eeIndex >= prevIndex) { String primaryText = Primary.getText(); int startIndex = primaryText.indexOf("chapter", eeIndex); Primary.positionCaret(startIndex); int i = startIndex; while(primaryText.charAt(i) != '\n') { Primary.selectForward(); i++; } designateAsChapter(); Primary.forward(); Primary.deselect(); prevIndex = eeIndex; eeIndex = i; } eeIndex = 0; prevIndex = 0; Primary.home(); while(eeIndex >= prevIndex) { String primaryText = Primary.getText(); int startIndex = primaryText.indexOf("CHAPTER", eeIndex); Primary.positionCaret(startIndex); int i = startIndex; while(primaryText.charAt(i) != '\n') { Primary.selectForward(); i++; } designateAsChapter(); Primary.forward(); Primary.deselect(); prevIndex = eeIndex; eeIndex = i; }*/ //eIndex = startIndex + (searchForThisText.length()); //Primary.positionCaret(endIndex); //int startIndex = primaryText.indexOf(searchForThisText); //Primary.selectRange(startIndex, eIndex); } public void removeChapterDesignation() { //listIndex = chaptersList.getSelectionModel().getSelectedIndex(); if (chaptersList.getSelectionModel().getSelectedIndex() == -1) { JOptionPane.showMessageDialog(null, "Please select a chapter from the list and try again"); } else { String searchForThisText = chaptersList.getSelectionModel().getSelectedItem().toString(); String primaryText = Primary.getText(); int start = primaryText.indexOf(searchForThisText); int end = start + (searchForThisText.length() - 1); //start = Primary.getSelection().getStart(); //int end = Primary.getSelection().getEnd(); Primary.positionCaret(start); Primary.deletePreviousChar(); Primary.positionCaret(end); Primary.deletePreviousChar(); onClickOrKeyPress(); //Primary.selectRange(startIndex, endIndex); // Primary.selectRange(startIndex, endIndex); /*int start = Primary.getSelection().getStart(); int end = Primary.getSelection().getEnd(); Primary.positionCaret(start + 1); Primary.deletePreviousChar(); Primary.positionCaret(end - 1); Primary.deletePreviousChar();*/ /*while(primaryText.charAt(i) != '\n') { Primary.selectForward(); i++; }*/ } } public void onChapter() { if ((chaptersList.getItems().isEmpty() == false) && (Primary.isFocused() == true)) { String primaryText = Primary.getText(); int cursorPosition = Primary.getCaretPosition(); int chapterNumber; String chapterName = ""; Object[] chapters = chaptersList.getItems().toArray(); int i = 0; int chapterIndex = 0; while (chapterIndex < cursorPosition) { String currentChapter = chaptersList.getItems().get(i).toString().trim(); chapterIndex = primaryText.indexOf(currentChapter); i++; } chapterNumber = i - 1; if (chapterName.contains("chapter") || chapterName.contains("Chapter") || chapterName.contains("CHAPTER")) { onChapter.setText("On " + chapterName); } else { onChapter.setText("On Chapter " + chapterNumber + ": " + chapterName); } onChapter.setVisible(true); } else { onChapter.setVisible(false); } } } class Indexedfile { String directoryName, fPath; Indexedfile() { } public void setPath(String p) { fPath = p; } public String getPath() { return fPath; } public void setDirectory(String directory) { directoryName = directory; } public String getDirectory() { return directoryName; } } class Person { int hasMaster; String masterPath; String username; String password; public String getMasterPath() { return masterPath; } public int getHasMaster() { return hasMaster; } public String getUsername() { return username; } public String getPassword() { return password; } public void setUsername(String u) { username = u; } public void setPassword(String p) { password = p; } public void setHasMaster(int hM) { hasMaster = hM; } public void setMasterPath(String mP) { masterPath = mP; } } //In his dream: the remnants of a soc that had forgotten //------------- //1: //D still grimaced when he came upon the scene, even though he had been expecting/prepared for it. "Sitara, end it." //"but--" //"*Now*" his tone brokered no argument; //through, the redirection of //1: [nsr] //although, when she really reflected on it/bothered to think about it, she realized that she had indulged few/only a handful of them in this [particular] l //sm's ____/The Curve //increasingly/ more and more, she found herself wanting to be hf*H*sake, and not just for the riff, but for/to... //"It would have been better if..." //k o d- *had* to make sure that //burden //should I call you the et --- then? //Unsurprisingly/He did not take/rise to the bait. "You will address me in a manner beffiting your status, or deemed acceptable by me" //Jan: Sit,/... look at this! //who was una...ad...h b a //if she was busy //h, this isn't even the tip of the iceberg i t of the k o s I i //this is merely a little playground that I created/designed for you, 3 more words //should we begin? //yes, gwrtb/v, and surely the most fun to play with //-Organized/Reordered Chaos //-------------------------------------------------------- //3: //D is making me look like a hypocrite!! //that's actually not a bad foundation t have //o w has not/ne known p cannot hope to progress //1-3 more //That being said [I sincerely hope], I hope you enjoy the ride. ///the journey //-Organized Chaos //there's no need to define it. relax. //the first thing I ever noticed //3g&J //fun times in the: hlhl...this promised to be... //Primary.setCaretPosition(Primary.getHeight()); /* double cursorIndex; cursorIndex = Primary.getLength(); System.out.println(cursorIndex); //Primary.setScrollTop(20000); */ //ScrollPane scroll = new ScrollPane(); // gets the current position of the caret: Primary.caretPositionProperty() //insig in the sand //include a "set as chapter" button /* String text = txtInform.getText(); String second = "**Second**"; int i = text.indexOf(second); int pos = txtInform.getCaretPosition(); */ /* txtInform.setColumns(20); txtInform.setLineWrap(true); txtInform.setRows(5); txtInform.setWrapStyleWord(true); jScrollPane1.setViewportView(txtInform);*/ //Primary.setText (String.valueOf(count)); // JFrame frame = new JFrame(); // JPanel panel = new JPanel(); //frame.add(panel); //frame.getHeight() // panel.getHeight() // panel.add(Primary); //coh & vital //this r l...and what it does to the e //revisiting an old bunny: Rak discovers one of his solidier's desecrated corpses (they were on a routine patrol), an (supposedly) post-mortem message etched in her blood, and &[with] a taunting message carved into the log //still, she persisted. //you would be heralded as a -- //he was suddenly overcome with the--in his estimation--completely rational urge to pummel her smirking face into the ground //1 related //The Nexus //beyond recognition //chapter title: Primordial //M hunt //Handover //Of so and the field (it's almost analogous, really) //Panorama //make MENAK, the amazing cook (Sit is decent, of course, and Genj is ludicrously bad at it) //wherein everyone goes domestic:3 //a celebrated/decor w/gBw, reduced to... //loyalties. //code,appl,prac,med //ARTR, a better ff app //----------------------------------------------------------- //samsung galaxy gear wristwatch //samsung smartglass