2 new revisions: Revision: 2900477a55d4 Branch: rt2042-toggleviewbutton Author: cmyers@xxxxxxxxxxxxxxxxxxxxx Date: Tue Feb 10 16:09:52 2015 UTC Log: Merged with default. https://code.google.com/p/brailleblaster/source/detail?r=2900477a55d4 Revision: 7f60faa93df2 Branch: rt2042-toggleviewbutton Author: cmyers@xxxxxxxxxxxxxxxxxxxxx Date: Tue Feb 10 20:40:47 2015 UTCLog: Switching perspectives saves Braille View layout. Closing in another p...
https://code.google.com/p/brailleblaster/source/detail?r=7f60faa93df2 ============================================================================== Revision: 2900477a55d4 Branch: rt2042-toggleviewbutton Author: cmyers@xxxxxxxxxxxxxxxxxxxxx Date: Tue Feb 10 16:09:52 2015 UTC Log: Merged with default. https://code.google.com/p/brailleblaster/source/detail?r=2900477a55d4 ============================================================================== Revision: 7f60faa93df2 Branch: rt2042-toggleviewbutton Author: cmyers@xxxxxxxxxxxxxxxxxxxxx Date: Tue Feb 10 20:40:47 2015 UTCLog: Switching perspectives saves Braille View layout. Closing in another perspective still saves layout.
https://code.google.com/p/brailleblaster/source/detail?r=7f60faa93df2 Modified: /src/main/org/brailleblaster/perspectives/braille/Manager.java /src/main/org/brailleblaster/perspectives/braille/ui/BrailleMenu.java /src/main/org/brailleblaster/wordprocessor/WPManager.java =======================================--- /src/main/org/brailleblaster/perspectives/braille/Manager.java Fri Feb 6 19:32:23 2015 UTC +++ /src/main/org/brailleblaster/perspectives/braille/Manager.java Tue Feb 10 20:40:47 2015 UTC
@@ -235,7 +235,7 @@ wp.getShell().layout(); } - private void setSash(){ + public void setSash(){ PropertyFileManager pfm = BBIni.getPropertyFileManager(); String containerWeight = pfm.getProperty("containerWeight"); String editorWeight = pfm.getProperty("textWeight"); @@ -257,7 +257,7 @@ miscSash.setWeights(new int[] {100, 0}); } - private void setEditingView(){ + public void setEditingView(){ PropertyFileManager pfm = BBIni.getPropertyFileManager(); String view = pfm.getProperty("editorView"); if(view != null){ @@ -1443,7 +1443,7 @@ } } - private void saveScreenProperties(){ + public void saveScreenProperties(){ PropertyFileManager pfm = BBIni.getPropertyFileManager(); int [] containerWeights = containerSash.getWeights(); int [] editorWeights = editorSash.getWeights(); =======================================--- /src/main/org/brailleblaster/perspectives/braille/ui/BrailleMenu.java Mon Feb 9 21:47:26 2015 UTC +++ /src/main/org/brailleblaster/perspectives/braille/ui/BrailleMenu.java Tue Feb 10 20:40:47 2015 UTC
@@ -871,6 +871,10 @@ treeViewMenu.getItem(0).setSelection(true); } } + + public MenuItem getCurViewSelection() { + return selectedViewItem; + } public void setEditorView(){ String view = currentEditor.getCurrentEditor(); =======================================--- /src/main/org/brailleblaster/wordprocessor/WPManager.java Fri Feb 6 22:29:48 2015 UTC +++ /src/main/org/brailleblaster/wordprocessor/WPManager.java Tue Feb 10 20:40:47 2015 UTC
@@ -36,6 +36,10 @@ import org.brailleblaster.perspectives.Controller; import org.brailleblaster.perspectives.Perspective; import org.brailleblaster.perspectives.braille.Manager; +import org.brailleblaster.perspectives.braille.ui.BrailleMenu; +import org.brailleblaster.perspectives.braille.ui.BrailleToolBar; +import org.brailleblaster.perspectives.braille.views.wp.BrailleView; +import org.brailleblaster.perspectives.braille.views.wp.TextView; import org.brailleblaster.settings.Welcome; import org.brailleblaster.util.PropertyFileManager; import org.brailleblaster.util.YesNoChoice; @@ -77,6 +81,10 @@ private static final int MAX_NUM_DOCS = 4;// the max limit of total number // of docs can have at the same // time+ // This is the last view the user was looking at before we switched perspectives. + // Will be able to switch back to last view they were using instead of defaulting to
+ // DUAL. + private String lastView = null;// This constructor is the entry point to the word processor. It gets things
// set up, handles multiple documents, etc. @@ -111,6 +119,10 @@ bbMenu = currentPerspective.getMenu(); bbToolbar = currentPerspective.getToolBar(); + // Hang onto last editor view selection(Dual, Print, Braille).+ if( currentPerspective.toString().toLowerCase().contains("brailleperspective") )
+ lastView = ((BrailleMenu)(bbMenu)).getCurViewSelection().toString(); + folder.addSelectionListener(folderListener = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -242,7 +254,30 @@ } } + // Checks the appropriate setting for the main menu and updates the image + // for the toggle button. + public void updateViewMenuAndButtons() { + + // Update main menu. + ((BrailleMenu)bbMenu).setEditorView(); + + // Update the toolbar image. + ((BrailleToolBar)(bbToolbar)).updateEditorViewBtnImg(); + } + public void swapPerspectiveController(Class<?> controllerClass) { ++ // Save current view if we're in the braille perspective, before switching
+ // to another one.+ if( currentPerspective.toString().toLowerCase().contains("brailleperspective") ) {
+ + // Record the current view configuration. + lastView = ((BrailleMenu)(bbMenu)).getCurViewSelection().toString(); + + // Save view configuration to file. + ((Manager)(currentPerspective.getController())).saveScreenProperties(); + } + int index = folder.getSelectionIndex(); if (index != -1) { currentPerspective.getController().getArchiver().pauseAutoSave(); @@ -271,6 +306,32 @@ } lastPerspective = controllerClass; + + // Just changed to the braille perspective. Update main menu and such.+ // Only fires if we started from braille, then to another persp, then back. + if( currentPerspective.toString().toLowerCase().contains("brailleperspective") && lastView != null ) {
+ + // Switch the view. + if( lastView.compareTo("MenuItem {dualView}") == 0 ) + ((Manager)(currentPerspective.getController())).setEditingView(null); + else if( lastView.compareTo("MenuItem {textView}") == 0 )+ ((Manager)(currentPerspective.getController())).setEditingView(TextView.class.getCanonicalName());
+ else if( lastView.compareTo("MenuItem {brailleView}") == 0 )+ ((Manager)(currentPerspective.getController())).setEditingView(BrailleView.class.getCanonicalName());
+ + // Update UI. + updateViewMenuAndButtons(); + }+ // Started application in perspective other than braille, then switched to braille. + else if( currentPerspective.toString().toLowerCase().contains("brailleperspective") && lastView == null ) {
+ + // Set views. + ((Manager)(currentPerspective.getController())).setSash(); + ((Manager)(currentPerspective.getController())).setEditingView(); + + // Update UI. + updateViewMenuAndButtons(); + } } private Class<?> getDefaultPerspective() {