Thread: [Jreepad-CVS] jreepad/src/jreepad JreepadPrefs.java, 1.21, 1.22 JreepadView.java, 1.35, 1.36
Brought to you by:
danstowell
From: PeWu <pe...@us...> - 2007-02-05 10:56:47
|
Update of /cvsroot/jreepad/jreepad/src/jreepad In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5603/src/jreepad Modified Files: JreepadPrefs.java JreepadView.java Log Message: refactoring: refactored PlainTextEditor from JreepadView Index: JreepadView.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadView.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** JreepadView.java 26 Jan 2007 21:47:55 -0000 1.35 --- JreepadView.java 5 Feb 2007 10:56:43 -0000 1.36 *************** *** 42,47 **** import javax.swing.JTable; import javax.swing.JTree; - import javax.swing.event.CaretEvent; - import javax.swing.event.CaretListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; --- 42,45 ---- *************** *** 54,74 **** import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; - import javax.swing.event.UndoableEditEvent; - import javax.swing.event.UndoableEditListener; import javax.swing.table.DefaultTableModel; - import javax.swing.text.AbstractDocument; import javax.swing.text.BadLocationException; - import javax.swing.text.BoxView; - import javax.swing.text.ComponentView; import javax.swing.text.Document; - import javax.swing.text.Element; - import javax.swing.text.IconView; - import javax.swing.text.LabelView; - import javax.swing.text.StyleConstants; - import javax.swing.text.StyledEditorKit; - import javax.swing.text.View; - import javax.swing.text.ViewFactory; import javax.swing.tree.TreePath; import org.philwilson.JTextile; --- 52,63 ---- import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.table.DefaultTableModel; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.tree.TreePath; + import jreepad.editor.ContentChangeListener; + import jreepad.editor.PlainTextEditor; + import org.philwilson.JTextile; *************** *** 81,128 **** { - // Code to ensure that the article word-wraps follows - // - contributed by Michael Labhard based on code found on the web... - static class JPEditorKit extends StyledEditorKit - { - public ViewFactory getViewFactory() - { - return new JPRTFViewFactory(); - } - } - - static class JPRTFViewFactory implements ViewFactory - { - public View create(Element elem) - { - String kind = elem.getName(); - if(kind != null) - if (kind.equals(AbstractDocument.ContentElementName)) { - return new LabelView(elem); - } else if (kind.equals(AbstractDocument.ParagraphElementName)) { - return new JPParagraphView(elem); - } else if (kind.equals(AbstractDocument.SectionElementName)) { - return new BoxView(elem, View.Y_AXIS); - } else if (kind.equals(StyleConstants.ComponentElementName)) { - return new ComponentView(elem); - } else if (kind.equals(StyleConstants.IconElementName)) { - return new IconView(elem); - } - // default to text display - return new LabelView(elem); - } - } - - private static short paraRightMargin = 0; - static class JPParagraphView extends javax.swing.text.ParagraphView - { - public JPParagraphView(Element e) - { - super(e); - this.setInsets((short)0, (short)0, (short)0, paraRightMargin); - } - } - // Code to ensure that the article word-wraps ends here - // - contributed by Michael Labhard - private static JreepadPrefs prefs; private JreepadNode root; --- 70,73 ---- *************** *** 137,141 **** // It will be equal to one of the content-type-specific panes. Need to set the content of BOTH of these... // private JEditorPane editorPane; ! private JEditorPane editorPanePlainText; private JEditorPane editorPaneHtml; private JTable editorPaneCsv; --- 82,86 ---- // It will be equal to one of the content-type-specific panes. Need to set the content of BOTH of these... // private JEditorPane editorPane; ! private PlainTextEditor editorPanePlainText; private JEditorPane editorPaneHtml; private JTable editorPaneCsv; *************** *** 149,155 **** private JreepadSearcher searcher; - // The following boolean should be FALSE while we're changing from node to node, and true otherwise - private boolean copyEditorPaneContentToNodeContent = true; - private boolean warnAboutUnsaved = false; --- 94,97 ---- *************** *** 232,237 **** ! editorPanePlainText = new JEditorPanePlus("text/plain", root.getContent()); ! editorPanePlainText.setEditable(true); editorPaneHtml = new JEditorPanePlus("text/html", root.getContent()); editorPaneHtml.setEditable(false); --- 174,178 ---- ! editorPanePlainText = new PlainTextEditor(root.getArticle()); editorPaneHtml = new JEditorPanePlus("text/html", root.getContent()); editorPaneHtml.setEditable(false); *************** *** 239,264 **** editorPaneCsv.getModel().addTableModelListener(this); - setEditorPaneKit(); - - // Add a listener to make sure the editorpane's content is always stored when it changes - editorPanePlainText.addCaretListener(new CaretListener() { - public void caretUpdate(CaretEvent e) - { - if(!copyEditorPaneContentToNodeContent) - return; // i.e. we are deactivated while changing from node to node - if(currentNode.getArticle().getArticleMode() != JreepadArticle.ARTICLEMODE_ORDINARY) - return; // i.e. we are only relevant when in plain-text mode - - if(!editorPanePlainText.getText().equals(currentNode.getContent())) - { - // System.out.println("UPDATE - I'd now overwrite node content with editorpane content"); - currentNode.getArticle().setContent(editorPanePlainText.getText()); - setWarnAboutUnsaved(true); - } - else - { - // System.out.println(" No need to update content."); - } - }}); articleView = new JScrollPane(getEditorPaneComponent(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); articleView.addComponentListener(new ComponentListener() --- 180,183 ---- *************** *** 290,308 **** ); setCurrentNode(root); setViewBoth(); tree.setSelectionRow(0); - - editorPanePlainText.getDocument().addUndoableEditListener(new JreepadUndoableEditListener()); - - } - - public void setEditorPaneKit() - { - if(getPrefs().wrapToWindow) - editorPanePlainText.setEditorKit(new JPEditorKit()); - // else - // editorPane.setEditorKit(new javax.swing.text.StyledEditorKit()); } --- 209,223 ---- ); + editorPanePlainText.setContentChangeListener(new ContentChangeListener() { + public void contentChanged() + { + setWarnAboutUnsaved(true); + } + }); + setCurrentNode(root); setViewBoth(); tree.setSelectionRow(0); } *************** *** 388,392 **** } ! copyEditorPaneContentToNodeContent = false; // Deactivate the caret-listener, effectively - ALSO DEACTIVATES UNDO-STORAGE if(currentNode != null) { --- 303,308 ---- } ! editorPanePlainText.lockEdits(); // Deactivate the caret-listener, effectively - ALSO DEACTIVATES UNDO-STORAGE ! if(currentNode != null) { *************** *** 400,404 **** // editorPaneHtml.setText(n.getContent()); ensureCorrectArticleRenderMode(); ! copyEditorPaneContentToNodeContent = true; // Reactivate the caret listener - ALSO REACTIVATES UNDO-STORAGE } --- 316,320 ---- // editorPaneHtml.setText(n.getContent()); ensureCorrectArticleRenderMode(); ! editorPanePlainText.unlockEdits(); // Reactivate the caret listener - ALSO REACTIVATES UNDO-STORAGE } *************** *** 549,557 **** try { - editorPanePlainText.setText(doc.getText(0, here) + theDate + - doc.getText(here, doc.getLength() - here)); editorPaneHtml.setText(doc.getText(0, here) + theDate + doc.getText(here, doc.getLength() - here)); - editorPanePlainText.setCaretPosition(here + theDate.length()); } catch(BadLocationException e) --- 465,470 ---- *************** *** 559,562 **** --- 472,476 ---- // Simply ignore this } + editorPanePlainText.insertText(theDate); } *************** *** 1155,1159 **** //DEL storeForUndo(); currentNode.getArticle().wrapContentToCharWidth(charWidth); ! editorPanePlainText.setText(currentNode.getContent()); editorPaneHtml.setText(currentNode.getContent()); setWarnAboutUnsaved(true); --- 1069,1073 ---- //DEL storeForUndo(); currentNode.getArticle().wrapContentToCharWidth(charWidth); ! editorPanePlainText.reloadArticle(); editorPaneHtml.setText(currentNode.getContent()); setWarnAboutUnsaved(true); *************** *** 1163,1167 **** //DEL storeForUndo(); currentNode.getArticle().stripAllTags(); ! editorPanePlainText.setText(currentNode.getContent()); editorPaneHtml.setText(currentNode.getContent()); setWarnAboutUnsaved(true); --- 1077,1081 ---- //DEL storeForUndo(); currentNode.getArticle().stripAllTags(); ! editorPanePlainText.reloadArticle(); editorPaneHtml.setText(currentNode.getContent()); setWarnAboutUnsaved(true); *************** *** 1174,1178 **** // + "\neditorPanePlainText contains: " + editorPanePlainText.getText()); ! copyEditorPaneContentToNodeContent = false; // Disables store-for-undo currentNode.getArticle().setContent(editorPanePlainText.getText()); --- 1088,1092 ---- // + "\neditorPanePlainText contains: " + editorPanePlainText.getText()); ! editorPanePlainText.lockEdits(); // Disables store-for-undo currentNode.getArticle().setContent(editorPanePlainText.getText()); *************** *** 1218,1222 **** ensureCorrectArticleRenderMode(); getEditorPaneComponent().repaint(); ! copyEditorPaneContentToNodeContent = true; // Re-enables store-for-undo } --- 1132,1136 ---- ensureCorrectArticleRenderMode(); getEditorPaneComponent().repaint(); ! editorPanePlainText.unlockEdits(); // Re-enables store-for-undo } *************** *** 1301,1305 **** String s = a.getContent(); try{ ! editorPanePlainText.setText(s); }catch(Exception ex){ // This shouldn't cause a problem. So this try-catch is only for debugging really. --- 1215,1219 ---- String s = a.getContent(); try{ ! editorPanePlainText.setArticle(a); }catch(Exception ex){ // This shouldn't cause a problem. So this try-catch is only for debugging really. *************** *** 1447,1514 **** } // End of class JEditorPanePlus - - //This one listens for edits that can be undone. - protected class JreepadUndoableEditListener - implements UndoableEditListener { - public void undoableEditHappened(UndoableEditEvent e) { - - //System.out.println("Undoable event is " + (e.getEdit().isSignificant()?"":"NOT ") + "significant"); - //System.out.println("Undoable event source: " + e.getEdit()); - - //Remember the edit and update the menus. - - if(copyEditorPaneContentToNodeContent){ - //System.out.println("Storing undoable event for node " + getCurrentNode().getTitle()); - //System.out.println(" Event is " + e.getEdit().getPresentationName() ); - //if(getCurrentNode().lastEditStyle != e.getEdit().getPresentationName()){ - // System.out.println(" This is a SIGNIFICANT change."); - //} - //System.out.println(" Content: " + getCurrentNode().getContent()); - //System.out.println(" Node undoMgr: " + getCurrentNode().undoMgr); - //Thread.currentThread().dumpStack(); - getCurrentNode().getArticle().getUndoMgr().addEdit(e.getEdit()); - } - - - - //undoAction.updateUndoState(); - //redoAction.updateRedoState(); - } - } - - - - - - - - - - /* - class ArticleTableColumnModel extends DefaultTableColumnModel { - public ArticleTableColumnModel(){ - super(); - initColListener(); - } - - private void initColListener(){ - addColumnModelListener(new TableColumnModelListener() - { - public void columnAdded(TableColumnModelEvent e){ storeColumnModel(); } - public void columnMarginChanged(ChangeEvent e){ storeColumnModel(); } - public void columnMoved(TableColumnModelEvent e){ storeColumnModel(); } - public void columnRemoved(TableColumnModelEvent e){ storeColumnModel(); } - public void columnSelectionChanged(ListSelectionEvent e){ storeColumnModel();} - }); - } - - private void storeColumnModel() - { - // Simply store the TableColumnModel in the node, for future reference - getCurrentNode().tblColModel = this; - } - - } // End of: class ArticleTableColumnModel - */ - } \ No newline at end of file --- 1361,1363 ---- Index: JreepadPrefs.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadPrefs.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** JreepadPrefs.java 25 Aug 2006 11:11:30 -0000 1.21 --- JreepadPrefs.java 5 Feb 2007 10:56:43 -0000 1.22 *************** *** 33,37 **** /* ! A class to hold Jreepad's preferences - and hopefully to store them on disk in a nice permanent way which can be carried across from different versions --- 33,37 ---- /* ! A class to hold Jreepad's preferences - and hopefully to store them on disk in a nice permanent way which can be carried across from different versions *************** *** 42,58 **** Preferences prefs; File openLocation, saveLocation, importLocation, exportLocation, backupLocation; ! boolean seenLicense; ! int autoSavePeriod; boolean autoSave; ! public static final int VIEW_BOTH = 0; public static final int VIEW_TREE = 1; public static final int VIEW_ARTICLE = 2; int viewWhich; ! boolean viewToolbar; ! int searchMaxNum; --- 42,58 ---- Preferences prefs; File openLocation, saveLocation, importLocation, exportLocation, backupLocation; ! boolean seenLicense; ! int autoSavePeriod; boolean autoSave; ! public static final int VIEW_BOTH = 0; public static final int VIEW_TREE = 1; public static final int VIEW_ARTICLE = 2; int viewWhich; ! boolean viewToolbar; ! int searchMaxNum; *************** *** 60,78 **** boolean loadLastFileOnOpen; ! String webSearchName; String webSearchPrefix; String webSearchPostfix; ! int defaultSearchMode; ! boolean wikiBehaviourActive; ! ! static final String[] characterEncodings = new String[]{"ISO-8859-1", "ISO-8859-15", "UTF-8", "UTF-16", "US-ASCII", "8859_15"}; int fileEncoding; String getEncoding() { return characterEncodings[fileEncoding]; } ! Vector openRecentList; int openRecentListLength; --- 60,78 ---- boolean loadLastFileOnOpen; ! String webSearchName; String webSearchPrefix; String webSearchPostfix; ! int defaultSearchMode; ! boolean wikiBehaviourActive; ! ! static final String[] characterEncodings = new String[]{"ISO-8859-1", "ISO-8859-15", "UTF-8", "UTF-16", "US-ASCII", "8859_15"}; int fileEncoding; String getEncoding() { return characterEncodings[fileEncoding]; } ! Vector openRecentList; int openRecentListLength; *************** *** 83,97 **** else return (File)openRecentList.get(0); ! } ! Font treeFont; Font articleFont; ! int characterWrapWidth; ! ! boolean wrapToWindow; ! int windowLeft, windowTop, windowWidth, windowHeight; ! public static final int LINEBREAK_WIN=0; public static final int LINEBREAK_MAC=1; --- 83,97 ---- else return (File)openRecentList.get(0); ! } ! Font treeFont; Font articleFont; ! int characterWrapWidth; ! ! public boolean wrapToWindow; ! int windowLeft, windowTop, windowWidth, windowHeight; ! public static final int LINEBREAK_WIN=0; public static final int LINEBREAK_MAC=1; *************** *** 108,136 **** return "\r\n"; } ! TreePathCollection treePathCollection; ! int htmlExportArticleType; boolean htmlExportUrlsToLinks; int htmlExportAnchorLinkType; ! int dividerLocation; ! boolean autoDetectHtmlArticles; ! boolean addQuotesToCsvOutput; ! static final int FILETYPE_XML = 0; static final int FILETYPE_HJT = 1; int mainFileType; public static final String[] mainFileTypes = {"Jreepad XML","Treepad HJT"}; ! static final int TOOLBAR_TEXT = 0; static final int TOOLBAR_ICON = 1; static final int TOOLBAR_OFF = 2; int toolbarMode; ! boolean showGreenStrip; ! JreepadPrefs(Dimension wndSize) { // Grab the prefs object from wherever Java's API has put it... --- 108,136 ---- return "\r\n"; } ! TreePathCollection treePathCollection; ! int htmlExportArticleType; boolean htmlExportUrlsToLinks; int htmlExportAnchorLinkType; ! int dividerLocation; ! boolean autoDetectHtmlArticles; ! boolean addQuotesToCsvOutput; ! static final int FILETYPE_XML = 0; static final int FILETYPE_HJT = 1; int mainFileType; public static final String[] mainFileTypes = {"Jreepad XML","Treepad HJT"}; ! static final int TOOLBAR_TEXT = 0; static final int TOOLBAR_ICON = 1; static final int TOOLBAR_OFF = 2; int toolbarMode; ! boolean showGreenStrip; ! JreepadPrefs(Dimension wndSize) { // Grab the prefs object from wherever Java's API has put it... *************** *** 144,172 **** seenLicense = prefs.getBoolean("SEENLICENSE", false); ! autoSavePeriod = prefs.getInt("AUTOSAVEPERIOD", 10); autoSave = prefs.getBoolean("AUTOSAVE", false); ! viewWhich = prefs.getInt("VIEWWHICH", 0); ! viewToolbar = prefs.getBoolean("VIEWTOOLBAR", true); ! searchMaxNum = prefs.getInt("SEARCHMAXNUM", 200); ! autoDateInArticles = prefs.getBoolean("AUTODATEINARTICLES", true); ! loadLastFileOnOpen = prefs.getBoolean("LOADLASTFILEONOPEN", true); ! webSearchName = prefs.get("WEBSEARCHNAME", JreepadViewer.lang.getString("PREFS_DEFAULT_SEARCH_TEXT")); //"Google search for highlighted text"; webSearchPrefix = prefs.get("WEBSEARCHPREFIX", "www.google.co.uk/search?q="); webSearchPostfix = prefs.get("WEBSEARCHPOSTFIX", "&hl=en"); ! defaultSearchMode = prefs.getInt("DEFAULTSEARCHMODE", 0); ! wikiBehaviourActive = prefs.getBoolean("WIKIBEHAVIOURACTIVE", true); ! fileEncoding = prefs.getInt("FILEENCODING", 2); // Default to UTF-8 ! openRecentList = new Vector(); openRecentListLength = prefs.getInt("OPENRECENTLISTLENGTH", 10); --- 144,172 ---- seenLicense = prefs.getBoolean("SEENLICENSE", false); ! autoSavePeriod = prefs.getInt("AUTOSAVEPERIOD", 10); autoSave = prefs.getBoolean("AUTOSAVE", false); ! viewWhich = prefs.getInt("VIEWWHICH", 0); ! viewToolbar = prefs.getBoolean("VIEWTOOLBAR", true); ! searchMaxNum = prefs.getInt("SEARCHMAXNUM", 200); ! autoDateInArticles = prefs.getBoolean("AUTODATEINARTICLES", true); ! loadLastFileOnOpen = prefs.getBoolean("LOADLASTFILEONOPEN", true); ! webSearchName = prefs.get("WEBSEARCHNAME", JreepadViewer.lang.getString("PREFS_DEFAULT_SEARCH_TEXT")); //"Google search for highlighted text"; webSearchPrefix = prefs.get("WEBSEARCHPREFIX", "www.google.co.uk/search?q="); webSearchPostfix = prefs.get("WEBSEARCHPOSTFIX", "&hl=en"); ! defaultSearchMode = prefs.getInt("DEFAULTSEARCHMODE", 0); ! wikiBehaviourActive = prefs.getBoolean("WIKIBEHAVIOURACTIVE", true); ! fileEncoding = prefs.getInt("FILEENCODING", 2); // Default to UTF-8 ! openRecentList = new Vector(); openRecentListLength = prefs.getInt("OPENRECENTLISTLENGTH", 10); *************** *** 185,194 **** int treeFontSize = prefs.getInt("TREEFONTSIZE", (new JTree()).getFont().getSize()); int articleFontSize = prefs.getInt("ARTICLEFONTSIZE", (new JEditorPane()).getFont().getSize()); ! treeFont = new Font(treeFontName, Font.PLAIN, treeFontSize); articleFont = new Font(articleFontName, Font.PLAIN, articleFontSize); ! characterWrapWidth = prefs.getInt("CHARACTERWRAPWIDTH", 80); ! wrapToWindow = prefs.getBoolean("WRAPTOWINDOW", true); --- 185,194 ---- int treeFontSize = prefs.getInt("TREEFONTSIZE", (new JTree()).getFont().getSize()); int articleFontSize = prefs.getInt("ARTICLEFONTSIZE", (new JEditorPane()).getFont().getSize()); ! treeFont = new Font(treeFontName, Font.PLAIN, treeFontSize); articleFont = new Font(articleFontName, Font.PLAIN, articleFontSize); ! characterWrapWidth = prefs.getInt("CHARACTERWRAPWIDTH", 80); ! wrapToWindow = prefs.getBoolean("WRAPTOWINDOW", true); *************** *** 200,208 **** windowLeft = prefs.getInt("WINDOWLEFT", 0); if(windowWidth==0 || windowWidth==0){ ! windowWidth = (int)(wndSize.getWidth() * 0.6f); windowHeight = (int)(wndSize.getHeight() * 0.6f); ! ! // This bit attempts to ensure that the Jreepad view doesn't get too wide // (e.g. for people with dual-screen systems) // - it limits the width/height proportion to the golden ratio! --- 200,208 ---- windowLeft = prefs.getInt("WINDOWLEFT", 0); if(windowWidth==0 || windowWidth==0){ ! windowWidth = (int)(wndSize.getWidth() * 0.6f); windowHeight = (int)(wndSize.getHeight() * 0.6f); ! ! // This bit attempts to ensure that the Jreepad view doesn't get too wide // (e.g. for people with dual-screen systems) // - it limits the width/height proportion to the golden ratio! *************** *** 212,219 **** else if(windowHeight > (int)(((float)windowWidth)*1.618034f) ) windowHeight = (int)(((float)windowWidth)*1.618034f); ! windowTop = windowHeight/3; ! windowLeft = windowWidth/3; ! } --- 212,219 ---- else if(windowHeight > (int)(((float)windowWidth)*1.618034f) ) windowHeight = (int)(((float)windowWidth)*1.618034f); ! windowTop = windowHeight/3; ! windowLeft = windowWidth/3; ! } *************** *** 224,242 **** // NEED SOME WAY OF STORING THE TREE STATE WHICH ACTUALLY WORKS. treePathCollection = new TreePathCollection(new javax.swing.tree.TreePath[0]); ! htmlExportArticleType = prefs.getInt("HTMLEXPORTARTICLETYPE", 0); htmlExportUrlsToLinks = prefs.getBoolean("HTMLEXPORTURLSTOLINKS", true); htmlExportAnchorLinkType = prefs.getInt("HTMLEXPORTANCHORLINKTYPE", 1); ! dividerLocation = prefs.getInt("DIVIDERLOCATION", -1); ! autoDetectHtmlArticles = prefs.getBoolean("AUTODETECTHTMLINARTICLES", true); ! addQuotesToCsvOutput = prefs.getBoolean("ADDQUOTESTOCSVOUTPUT", false); ! mainFileType = prefs.getInt("MAINFILETYPE", FILETYPE_HJT); ! toolbarMode = prefs.getInt("TOOLBARMODE", TOOLBAR_ICON); ! showGreenStrip = prefs.getBoolean("SHOWGREENSTRIP", true); --- 224,242 ---- // NEED SOME WAY OF STORING THE TREE STATE WHICH ACTUALLY WORKS. treePathCollection = new TreePathCollection(new javax.swing.tree.TreePath[0]); ! htmlExportArticleType = prefs.getInt("HTMLEXPORTARTICLETYPE", 0); htmlExportUrlsToLinks = prefs.getBoolean("HTMLEXPORTURLSTOLINKS", true); htmlExportAnchorLinkType = prefs.getInt("HTMLEXPORTANCHORLINKTYPE", 1); ! dividerLocation = prefs.getInt("DIVIDERLOCATION", -1); ! autoDetectHtmlArticles = prefs.getBoolean("AUTODETECTHTMLINARTICLES", true); ! addQuotesToCsvOutput = prefs.getBoolean("ADDQUOTESTOCSVOUTPUT", false); ! mainFileType = prefs.getInt("MAINFILETYPE", FILETYPE_HJT); ! toolbarMode = prefs.getInt("TOOLBARMODE", TOOLBAR_ICON); ! showGreenStrip = prefs.getBoolean("SHOWGREENSTRIP", true); *************** *** 252,269 **** prefs.put("EXPORTLOCATION", ""+exportLocation); prefs.put("BACKUPLOCATION", ""+backupLocation); ! prefs.putBoolean("SEENLICENSE", seenLicense); prefs.putInt("AUTOSAVEPERIOD", autoSavePeriod); prefs.putBoolean("AUTOSAVE", autoSave); ! prefs.putInt("VIEWWHICH", viewWhich); ! prefs.putBoolean("VIEWTOOLBAR", viewToolbar); ! prefs.putInt("SEARCHMAXNUM", searchMaxNum); ! prefs.putBoolean("AUTODATEINARTICLES", autoDateInArticles); ! prefs.putBoolean("LOADLASTFILEONOPEN", loadLastFileOnOpen); --- 252,269 ---- prefs.put("EXPORTLOCATION", ""+exportLocation); prefs.put("BACKUPLOCATION", ""+backupLocation); ! prefs.putBoolean("SEENLICENSE", seenLicense); prefs.putInt("AUTOSAVEPERIOD", autoSavePeriod); prefs.putBoolean("AUTOSAVE", autoSave); ! prefs.putInt("VIEWWHICH", viewWhich); ! prefs.putBoolean("VIEWTOOLBAR", viewToolbar); ! prefs.putInt("SEARCHMAXNUM", searchMaxNum); ! prefs.putBoolean("AUTODATEINARTICLES", autoDateInArticles); ! prefs.putBoolean("LOADLASTFILEONOPEN", loadLastFileOnOpen); *************** *** 273,277 **** prefs.putInt("DEFAULTSEARCHMODE", defaultSearchMode); ! prefs.putBoolean("WIKIBEHAVIOURACTIVE", wikiBehaviourActive); --- 273,277 ---- prefs.putInt("DEFAULTSEARCHMODE", defaultSearchMode); ! prefs.putBoolean("WIKIBEHAVIOURACTIVE", wikiBehaviourActive); *************** *** 287,293 **** prefs.put("ARTICLEFONTNAME", articleFont.getName()); prefs.putInt("ARTICLEFONTSIZE", articleFont.getSize()); ! prefs.putInt("CHARACTERWRAPWIDTH", characterWrapWidth); ! prefs.putBoolean("WRAPTOWINDOW", wrapToWindow); --- 287,293 ---- prefs.put("ARTICLEFONTNAME", articleFont.getName()); prefs.putInt("ARTICLEFONTSIZE", articleFont.getSize()); ! prefs.putInt("CHARACTERWRAPWIDTH", characterWrapWidth); ! prefs.putBoolean("WRAPTOWINDOW", wrapToWindow); *************** *** 298,321 **** prefs.putInt("LINEBREAKTYPE", linebreakType); ! // HOW TO SERIALISE? prefs.put(""+treePathCollection); ! prefs.putInt("HTMLEXPORTARTICLETYPE", htmlExportArticleType); prefs.putBoolean("HTMLEXPORTURLSTOLINKS", htmlExportUrlsToLinks); prefs.putInt("HTMLEXPORTANCHORLINKTYPE", htmlExportAnchorLinkType); ! prefs.putInt("DIVIDERLOCATION", dividerLocation); ! prefs.putBoolean("AUTODETECTHTMLINARTICLES", autoDetectHtmlArticles); ! prefs.putBoolean("ADDQUOTESTOCSVOUTPUT", addQuotesToCsvOutput); ! prefs.putInt("MAINFILETYPE", mainFileType); ! prefs.putInt("TOOLBARMODE", toolbarMode); ! prefs.putBoolean("SHOWGREENSTRIP", showGreenStrip); ! ! try{ prefs.flush(); // Encourage the store to be saved --- 298,321 ---- prefs.putInt("LINEBREAKTYPE", linebreakType); ! // HOW TO SERIALISE? prefs.put(""+treePathCollection); ! prefs.putInt("HTMLEXPORTARTICLETYPE", htmlExportArticleType); prefs.putBoolean("HTMLEXPORTURLSTOLINKS", htmlExportUrlsToLinks); prefs.putInt("HTMLEXPORTANCHORLINKTYPE", htmlExportAnchorLinkType); ! prefs.putInt("DIVIDERLOCATION", dividerLocation); ! prefs.putBoolean("AUTODETECTHTMLINARTICLES", autoDetectHtmlArticles); ! prefs.putBoolean("ADDQUOTESTOCSVOUTPUT", addQuotesToCsvOutput); ! prefs.putInt("MAINFILETYPE", mainFileType); ! prefs.putInt("TOOLBARMODE", toolbarMode); ! prefs.putBoolean("SHOWGREENSTRIP", showGreenStrip); ! ! try{ prefs.flush(); // Encourage the store to be saved *************** *** 324,329 **** } ! /* ! // We override the serialization routines so that different versions of our class can read // each other's serialized states. private void writeObject(java.io.ObjectOutputStream out) --- 324,329 ---- } ! /* ! // We override the serialization routines so that different versions of our class can read // each other's serialized states. private void writeObject(java.io.ObjectOutputStream out) *************** *** 335,350 **** out.writeObject(exportLocation); out.writeObject(backupLocation); ! out.writeInt(autoSavePeriod); out.writeBoolean(autoSave); ! out.writeInt(viewWhich); ! out.writeBoolean(viewToolbar); ! out.writeInt(searchMaxNum); ! out.writeBoolean(autoDateInArticles); ! out.writeBoolean(loadLastFileOnOpen); --- 335,350 ---- out.writeObject(exportLocation); out.writeObject(backupLocation); ! out.writeInt(autoSavePeriod); out.writeBoolean(autoSave); ! out.writeInt(viewWhich); ! out.writeBoolean(viewToolbar); ! out.writeInt(searchMaxNum); ! out.writeBoolean(autoDateInArticles); ! out.writeBoolean(loadLastFileOnOpen); *************** *** 354,358 **** out.writeInt(defaultSearchMode); ! out.writeBoolean(wikiBehaviourActive); --- 354,358 ---- out.writeInt(defaultSearchMode); ! out.writeBoolean(wikiBehaviourActive); *************** *** 364,370 **** out.writeObject(treeFont); out.writeObject(articleFont); ! out.writeInt(characterWrapWidth); ! out.writeBoolean(wrapToWindow); --- 364,370 ---- out.writeObject(treeFont); out.writeObject(articleFont); ! out.writeInt(characterWrapWidth); ! out.writeBoolean(wrapToWindow); *************** *** 375,395 **** out.writeInt(linebreakType); ! out.writeObject(treePathCollection); ! out.writeInt(htmlExportArticleType); out.writeBoolean(htmlExportUrlsToLinks); out.writeInt(htmlExportAnchorLinkType); ! out.writeInt(dividerLocation); ! out.writeBoolean(autoDetectHtmlArticles); ! out.writeBoolean(addQuotesToCsvOutput); ! out.writeInt(mainFileType); ! out.writeInt(toolbarMode); ! out.writeBoolean(showGreenStrip); } --- 375,395 ---- out.writeInt(linebreakType); ! out.writeObject(treePathCollection); ! out.writeInt(htmlExportArticleType); out.writeBoolean(htmlExportUrlsToLinks); out.writeInt(htmlExportAnchorLinkType); ! out.writeInt(dividerLocation); ! out.writeBoolean(autoDetectHtmlArticles); ! out.writeBoolean(addQuotesToCsvOutput); ! out.writeInt(mainFileType); ! out.writeInt(toolbarMode); ! out.writeBoolean(showGreenStrip); } *************** *** 404,419 **** exportLocation = (File)in.readObject(); backupLocation = (File)in.readObject(); ! autoSavePeriod = in.readInt(); autoSave = in.readBoolean(); ! viewWhich = in.readInt(); ! viewToolbar = in.readBoolean(); ! searchMaxNum = in.readInt(); ! autoDateInArticles = in.readBoolean(); ! loadLastFileOnOpen = in.readBoolean(); --- 404,419 ---- exportLocation = (File)in.readObject(); backupLocation = (File)in.readObject(); ! autoSavePeriod = in.readInt(); autoSave = in.readBoolean(); ! viewWhich = in.readInt(); ! viewToolbar = in.readBoolean(); ! searchMaxNum = in.readInt(); ! autoDateInArticles = in.readBoolean(); ! loadLastFileOnOpen = in.readBoolean(); *************** *** 423,431 **** defaultSearchMode = in.readInt(); ! wikiBehaviourActive = in.readBoolean(); ! fileEncoding = in.readInt(); ! openRecentList = (Vector)in.readObject(); openRecentListLength = in.readInt(); --- 423,431 ---- defaultSearchMode = in.readInt(); ! wikiBehaviourActive = in.readBoolean(); ! fileEncoding = in.readInt(); ! openRecentList = (Vector)in.readObject(); openRecentListLength = in.readInt(); *************** *** 433,441 **** treeFont = (Font)in.readObject(); articleFont = (Font)in.readObject(); ! characterWrapWidth = in.readInt(); ! wrapToWindow = in.readBoolean(); ! windowLeft = in.readInt(); windowTop = in.readInt(); --- 433,441 ---- treeFont = (Font)in.readObject(); articleFont = (Font)in.readObject(); ! characterWrapWidth = in.readInt(); ! wrapToWindow = in.readBoolean(); ! windowLeft = in.readInt(); windowTop = in.readInt(); *************** *** 444,464 **** linebreakType = in.readInt(); ! treePathCollection = (TreePathCollection)in.readObject(); ! htmlExportArticleType = in.readInt(); htmlExportUrlsToLinks = in.readBoolean(); htmlExportAnchorLinkType = in.readInt(); ! dividerLocation = in.readInt(); ! autoDetectHtmlArticles = in.readBoolean(); ! addQuotesToCsvOutput = in.readBoolean(); ! mainFileType = in.readInt(); ! toolbarMode = in.readInt(); ! showGreenStrip = in.readBoolean(); } --- 444,464 ---- linebreakType = in.readInt(); ! treePathCollection = (TreePathCollection)in.readObject(); ! htmlExportArticleType = in.readInt(); htmlExportUrlsToLinks = in.readBoolean(); htmlExportAnchorLinkType = in.readInt(); ! dividerLocation = in.readInt(); ! autoDetectHtmlArticles = in.readBoolean(); ! addQuotesToCsvOutput = in.readBoolean(); ! mainFileType = in.readInt(); ! toolbarMode = in.readInt(); ! showGreenStrip = in.readBoolean(); } |