Revision: 097a09234f3a Branch: BraillePageIndicator Author: cmyers@xxxxxxxxxxxxxxxxxxxxx Date: Mon Oct 6 18:37:58 2014 UTCLog: Updated BPI's so they appear when doc is loaded and refreshed. Indicators also appear when you change settings in the Braille Templates dialog.
https://code.google.com/p/brailleblaster/source/detail?r=097a09234f3a Modified: /src/main/org/brailleblaster/perspectives/braille/Manager.java/src/main/org/brailleblaster/perspectives/braille/viewInitializer/EPubInitializer.java
/src/main/org/brailleblaster/perspectives/braille/views/wp/BrailleView.java =======================================--- /src/main/org/brailleblaster/perspectives/braille/Manager.java Wed Sep 24 19:16:01 2014 UTC +++ /src/main/org/brailleblaster/perspectives/braille/Manager.java Mon Oct 6 18:37:58 2014 UTC
@@ -291,7 +291,7 @@ braille.view.setWordWrap(false); wp.getStatusBar().resetLocation(6,100,100); wp.getStatusBar().setText("Loading..."); - startProgressBar(); + // startProgressBar(); documentName = fileName; setTabTitle(fileName);vi = ViewFactory.createUpdater(arch, document, text, braille, treeView);
@@ -305,7 +305,7 @@ text.hasChanged = false; braille.hasChanged = false; wp.getStatusBar().resetLocation(0,100,100); - pb.stop(); + // pb.stop(); wp.getStatusBar().setText("Words: " + text.words); braille.setWords(text.words); text.view.setWordWrap(true); =======================================--- /src/main/org/brailleblaster/perspectives/braille/viewInitializer/EPubInitializer.java Thu Jul 3 16:07:57 2014 UTC +++ /src/main/org/brailleblaster/perspectives/braille/viewInitializer/EPubInitializer.java Mon Oct 6 18:37:58 2014 UTC
@@ -40,6 +40,7 @@ @Override public void initializeViews(Manager m) { + braille.resetIndicator(); findSections(m, document.getRootElement()); if(sectionList.size() == 0){ sectionList.add(new SectionElement(m, document.getRootElement())); =======================================--- /src/main/org/brailleblaster/perspectives/braille/views/wp/BrailleView.java Thu Sep 25 13:02:35 2014 UTC +++ /src/main/org/brailleblaster/perspectives/braille/views/wp/BrailleView.java Mon Oct 6 18:37:58 2014 UTC
@@ -914,36 +914,65 @@ total += spaceBeforeText+brailleSidebar.length(); spaceBeforeText = 0; } + + + /** + * Resets the braille page indicator. Helpful for when + * we're refreshing. + */ + public void resetIndicator() { + flag = true; + } /** * Add indicator at input line number * Indicator is a bullet and add all indicator at indication array list */ public void addIndicator(){ - int lineNumber=manager.getDocument().getIndicatorLocation(); - if (lineNumber<view.getLineCount()){ +// int lineNumber=manager.getDocument().getIndicatorLocation(); +// if (lineNumber<view.getLineCount()){ +// +// if (flag==true) +// { +// counter=lineNumber - 1; +// flag=false; +// }+// System.out.println(counter + " - out while... " + view.getLineCount() + " - out while.");
+// while(counter < view.getLineCount()){ +// if (view.getLineBullet(counter)==null){ +// StyleRange indicatorStyle = new StyleRange(); +// indicatorStyle.underline=true; +// indicatorStyle.underlineStyle=SWT.UNDERLINE_SINGLE; +// indicatorStyle.metrics = new GlyphMetrics(5, 0, 50);+// indicatorStyle.foreground = view.getDisplay().getSystemColor(SWT.COLOR_BLACK);
+// Bullet bullet = new Bullet (ST.BULLET_TEXT, indicatorStyle); +// bullet.text = " "; +// view.setLineBullet(counter, 1, null); +// view.setLineBullet(counter, 1, bullet); +// indications.add(bullet); +// } +// counter=counter+lineNumber;+// System.out.println(counter + " - in while... " + view.getLineCount() + " - in while.");
+// } +// } + int linesPerPage = manager.getDocument().getIndicatorLocation(); + counter = linesPerPage - 1; + if(indications.isEmpty() == false) + indications.clear(); + while( counter < view.getLineCount() ) { + StyleRange indicatorStyle = new StyleRange(); + indicatorStyle.underline=true; + indicatorStyle.underlineStyle=SWT.UNDERLINE_SINGLE; + indicatorStyle.metrics = new GlyphMetrics(5, 0, 50);+ indicatorStyle.foreground = view.getDisplay().getSystemColor(SWT.COLOR_BLACK);
+ Bullet bullet = new Bullet (ST.BULLET_TEXT, indicatorStyle); + bullet.text = " "; + view.setLineBullet(counter, 1, null); + view.setLineBullet(counter, 1, bullet); + indications.add(bullet); - if (flag==true) - { - counter=lineNumber - 1; - flag=false; - } - while(counter < view.getLineCount()){ - if (view.getLineBullet(counter)==null){ - StyleRange indicatorStyle = new StyleRange(); - indicatorStyle.underline=true; - indicatorStyle.underlineStyle=SWT.UNDERLINE_SINGLE; - indicatorStyle.metrics = new GlyphMetrics(5, 0, 50);- indicatorStyle.foreground = view.getDisplay().getSystemColor(SWT.COLOR_BLACK);
- Bullet bullet = new Bullet (ST.BULLET_TEXT, indicatorStyle); - bullet.text = " "; - view.setLineBullet(counter, 1, null); - view.setLineBullet(counter, 1, bullet); - indications.add(bullet); - } - counter=counter+lineNumber; - } - } + counter = counter + linesPerPage; + } // while() } /**