[brailleblaster] [brailleblaster.newdesign] push by RandomCh...@xxxxxxxxx - Warning message for non-essential images/Non-essential button. on 2013-09-03 20:57 GMT

  • From: brailleblaster@xxxxxxxxxxxxxx
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Tue, 03 Sep 2013 20:58:02 +0000

Revision: ec1b7f06985a
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Tue Sep  3 22:05:02 2013 UTC
Log:      Warning message for non-essential images/Non-essential button.
http://code.google.com/p/brailleblaster/source/detail?r=ec1b7f06985a&repo=newdesign

Modified:
 /src/main/org/brailleblaster/imagedescriber/ImageDescriber.java
 /src/main/org/brailleblaster/imagedescriber/ImageDescriberDialog.java
 /src/main/org/brailleblaster/wordprocessor/BBToolBar.java

=======================================
--- /src/main/org/brailleblaster/imagedescriber/ImageDescriber.java Wed Aug 21 16:38:41 2013 UTC +++ /src/main/org/brailleblaster/imagedescriber/ImageDescriber.java Tue Sep 3 22:05:02 2013 UTC
@@ -125,6 +125,15 @@
 //                     }

        } // ImageDescriber(DocumentManager docManager)
+
+ ///////////////////////////////////////////////////////////////////////////
+       // Returns the root element.
+       public Element getRoot()
+       {
+               // Return root element.
+               return rootElement;
+
+       } // Element getRoot()

///////////////////////////////////////////////////////////////////////////
        // Returns the current element...
@@ -132,7 +141,181 @@
        {
                // Return the element.
                return curImgElement;
-       }
+
+       } // Element currentImageElement()
+
+ ///////////////////////////////////////////////////////////////////////////
+       // Gets the element at the given index.
+       public Element getElementAtIndex(int index)
+       {
+               // Make sure index is within bounds of list.
+               if(index >= 0 && index < imgElmList.size())
+                       return imgElmList.get(index);
+
+               // If we make it here, element doesn't exist.
+               return null;
+
+       } // Element getElementAtIndex(int index)
+
+ ///////////////////////////////////////////////////////////////////////////
+       // Returns the number of <img> elements found in the document.
+       public int getNumImgElements()
+       {
+               // Return number of image elements.
+               return numImgElms;
+
+       } // int getNumImgElements()
+
+ ///////////////////////////////////////////////////////////////////////////
+       // Traverses xml tree until it finds the next <img>.
+       public Element getNextImageElement(Element e)
+       {
+
+               curDocIndex++;
+               if( e.getClass().getName().compareTo("nu.xom.Element") == 0) {
+                       if( e.getLocalName().compareTo("img") == 0 ) {
+                               if(curDocIndex > furthestDocIndex)
+                               {
+                               // Record depth.
+                               furthestDocIndex = curDocIndex;
+
+                               // Return new element found.
+                               return e;
+
+                               } // if(curDocIndex > furthestDocIndex)
+                       }
+               }
+
+               //
+               Element newImgElement = null;
+
+               // Go through every child and find the next image.
+               for(int curC = 0; curC < e.getChildCount(); curC++)
+               {
+ if( e.getChild(curC).getClass().getName().compareTo("nu.xom.Element") == 0)
+                       {
+                               newImgElement = getNextImageElement( 
((Element)(e.getChild(curC))) );
+
+                               if(newImgElement != null)
+                                       break;
+                       }
+
+               }
+
+               return newImgElement;
+
+               // We're a little further down the tree now.
+               //curDocIndex++;
+               //
+               //// Number of children.
+               //int numChilds = e.getChildCount();
+               //
+               //// Go through every child and find the next image.
+               //for(int curC = 0; curC < numChilds; curC++)
+               //{
+               //// Get current child.
+ //if( e.getChild(curC).getClass().getName().compareTo("nu.xom.Element") == 0)
+               //{
+               //// Get current child.
+               //Element curChild = (Element)(e.getChild(curC));
+               //
+               //// Is this an <img> element?
+               //if( curChild.getLocalName().compareTo("img") == 0 ) {
+               //
+               //// If this element is further along in the tree than the
+               //// last image element, return it.
+               //if(curDocIndex > furthestDocIndex)
+               //{
+               //// Record depth.
+               //furthestDocIndex = curDocIndex;
+               //
+               //// Return new element found.
+               //return curChild;
+               //
+               //} // if(curDocIndex > furthestDocIndex)
+               //
+               //} // if( e.getLocalName()...
+               //
+               //// Traverse this child's children.
+               //getNextImageElement( curChild );
+               //
+               //} // if( e.getChild(curC) instanceof...
+               //
+               //} // for(int curC = 0...
+               //
+               //// No <img>'s found, or we've hit the end of the document, or 
both.
+               //return null;
+
+       } // getNextImageElement(Element e)
+
+ ///////////////////////////////////////////////////////////////////////////
+       // Recursively moves through xml tree and adds <img> nodes to list.
+       // Also builds image path list.
+       public void fillImgList(Element e)
+       {
+               // Is this element an <img>?
+               if( e.getLocalName().compareTo("img") == 0 ) {
+
+                       // Add element to list.
+                       imgElmList.add(e);
+
+                       // Add image file path to list.
+
+                       // Remove slash and dot, if it's there.
+                       String tempStr = e.getAttributeValue("src");
+                       if( tempStr.startsWith(".") )
+ tempStr = tempStr.substring( BBIni.getFileSep().length() + 1, tempStr.length() );
+
+                       // Build image path.
+ tempStr = dm.getWorkingPath().substring(0, dm.getWorkingPath().lastIndexOf(BBIni.getFileSep())) + BBIni.getFileSep() + tempStr;
+                       if(tempStr.contains("/") && 
BBIni.getFileSep().compareTo("/") != 0)
+                               tempStr = tempStr.replace("/", "\\");
+
+                       // Add.
+                       imgFileList.add( new Image(null, tempStr) );
+               }
+
+               // Get children.
+               Elements childElms = e.getChildElements();
+
+               // Get their children, and so on.
+               for(int curChild = 0; curChild < childElms.size(); curChild++)
+                       fillImgList( childElms.get(curChild) );
+
+       } // FillImgList(Element e)
+
+ ///////////////////////////////////////////////////////////////////////////
+       // Enumerates <img> elements using xpath, then adds them all to our 
list.
+       public void fillImgList_XPath()
+       {
+               // Get all <img> elements using xpath.
+               Nodes imgTags = null;
+               imgTags = getRoot().query("//dtb:img", context);
+
+               // For every <img>, add it to our list.
+               for(int curTag = 0; curTag < imgTags.size(); curTag++)
+               {
+                       // Add element to list.
+                       imgElmList.add( (Element)(imgTags.get(curTag)) );
+
+                       // Add image file path to list.
+
+                       // Remove slash and dot, if it's there.
+ String tempStr = imgElmList.get(imgElmList.size() - 1).getAttributeValue("src");
+                       if( tempStr.startsWith(".") )
+ tempStr = tempStr.substring( BBIni.getFileSep().length() + 1, tempStr.length() );
+
+                       // Build image path.
+ tempStr = dm.getWorkingPath().substring(0, dm.getWorkingPath().lastIndexOf(BBIni.getFileSep())) + BBIni.getFileSep() + tempStr;
+                       if(tempStr.contains("/") && 
BBIni.getFileSep().compareTo("/") != 0)
+                               tempStr = tempStr.replace("/", "\\");
+
+                       // Add.
+                       imgFileList.add( new Image(null, tempStr) );
+
+               } // for(int...
+
+       } // fillImgList_XPath()

///////////////////////////////////////////////////////////////////////////
        // Returns the next <img> element that was found in the xml doc.
@@ -245,133 +428,6 @@
        } // PrevImageElement()

///////////////////////////////////////////////////////////////////////////
-       // Returns the number of <img> elements found in the document.
-       public int getNumImgElements()
-       {
-               // Return number of image elements.
-               return numImgElms;
-
-       } // public int getNumImgElements()
-
- ///////////////////////////////////////////////////////////////////////////
-       // Traverses xml tree until it finds the next <img>.
-       public Element getNextImageElement(Element e)
-       {
-
-               curDocIndex++;
-               if( e.getClass().getName().compareTo("nu.xom.Element") == 0) {
-                       if( e.getLocalName().compareTo("img") == 0 ) {
-                               if(curDocIndex > furthestDocIndex)
-                               {
-                                       // Record depth.
-                                       furthestDocIndex = curDocIndex;
-
-                                       // Return new element found.
-                                       return e;
-
-                               } // if(curDocIndex > furthestDocIndex)
-                       }
-               }
-
-               //
-               Element newImgElement = null;
-
-               // Go through every child and find the next image.
-               for(int curC = 0; curC < e.getChildCount(); curC++)
-               {
- if( e.getChild(curC).getClass().getName().compareTo("nu.xom.Element") == 0)
-                       {
-                               newImgElement = getNextImageElement( 
((Element)(e.getChild(curC))) );
-
-                               if(newImgElement != null)
-                                       break;
-                       }
-
-               }
-
-               return newImgElement;
-
-               // We're a little further down the tree now.
-//             curDocIndex++;
-//
-//             // Number of children.
-//             int numChilds = e.getChildCount();
-//
-//             // Go through every child and find the next image.
-//             for(int curC = 0; curC < numChilds; curC++)
-//             {
-//                     // Get current child.
-// if( e.getChild(curC).getClass().getName().compareTo("nu.xom.Element") == 0)
-//                     {
-//                             // Get current child.
-//                             Element curChild = (Element)(e.getChild(curC));
-//
-//                             // Is this an <img> element?
-//                             if( curChild.getLocalName().compareTo("img") == 
0 ) {
-//
-//                                     // If this element is further along in 
the tree than the
-//                                     // last image element, return it.
-//                                     if(curDocIndex > furthestDocIndex)
-//                                     {
-//                                             // Record depth.
-//                                             furthestDocIndex = curDocIndex;
-//
-//                                             // Return new element found.
-//                                             return curChild;
-//
-//                                     } // if(curDocIndex > furthestDocIndex)
-//
-//                             } // if( e.getLocalName()...
-//
-//                             // Traverse this child's children.
-//                             getNextImageElement( curChild );
-//
-//                     } // if( e.getChild(curC) instanceof...
-//
-//             } // for(int curC = 0...
-//
-//             // No <img>'s found, or we've hit the end of the document, or 
both.
-//             return null;
-
-       } // getNextImageElement(Element e)
-
- ///////////////////////////////////////////////////////////////////////////
-       // Recursively moves through xml tree and adds <img> nodes to list.
-       // Also builds image path list.
-       public void fillImgList(Element e)
-       {
-               // Is this element an <img>?
-               if( e.getLocalName().compareTo("img") == 0 ) {
-
-                       // Add element to list.
-                       imgElmList.add(e);
-
-                       // Add image file path to list.
-
-                       // Remove slash and dot, if it's there.
-                       String tempStr = e.getAttributeValue("src");
-                       if( tempStr.startsWith(".") )
- tempStr = tempStr.substring( BBIni.getFileSep().length() + 1, tempStr.length() );
-
-                       // Build image path.
- tempStr = dm.getWorkingPath().substring(0, dm.getWorkingPath().lastIndexOf(BBIni.getFileSep())) + BBIni.getFileSep() + tempStr;
-                       if(tempStr.contains("/") && 
BBIni.getFileSep().compareTo("/") != 0)
-                               tempStr = tempStr.replace("/", "\\");
-
-                       // Add.
-                       imgFileList.add( new Image(null, tempStr) );
-               }
-
-               // Get children.
-               Elements childElms = e.getChildElements();
-
-               // Get their children, and so on.
-               for(int curChild = 0; curChild < childElms.size(); curChild++)
-                       fillImgList( childElms.get(curChild) );
-
-       } // FillImgList(Element e)
-
- ///////////////////////////////////////////////////////////////////////////
        // Returns true if the current image has an <imggroup> parent.
        // False otherwise.
        public boolean hasImgGrpParent(Element e)
@@ -476,6 +532,20 @@
        } // setCurElmImgAttributes()

///////////////////////////////////////////////////////////////////////////
+       // Checks for a <prodnote> and returns true if it exists for this node.
+       // False otherwise.
+       //
+       // Notes: Element MUST be a child of a <imggroup>
+       public boolean hasProdNote(Element e)
+       {
+
+
+               // Return false if we made it here... no prodnote.
+               return false;
+
+       } // hasProdNote()
+
+ ///////////////////////////////////////////////////////////////////////////
        // Returns the text/description in the current <imggroup>'s prodnote.
        // Returns null if it couldn't find the <prodnote> or if it didn't have
        // text.
=======================================
--- /src/main/org/brailleblaster/imagedescriber/ImageDescriberDialog.java Wed Aug 21 19:29:35 2013 UTC +++ /src/main/org/brailleblaster/imagedescriber/ImageDescriberDialog.java Tue Sep 3 22:05:02 2013 UTC
@@ -30,8 +30,14 @@

 import java.awt.Dimension;
 import java.awt.Toolkit;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;

-import javax.swing.JOptionPane;
+import nu.xom.Element;
+import nu.xom.Nodes;
+import nu.xom.XPathContext;

 import org.brailleblaster.BBIni;
 import org.brailleblaster.localization.LocaleHandler;
@@ -39,19 +45,21 @@
 import org.brailleblaster.wordprocessor.DocumentManager;
 import org.brailleblaster.wordprocessor.WPManager;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Dialog;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.browser.Browser;
+import static java.nio.file.StandardCopyOption.*;

///////////////////////////////////////////////////////////////////////////////////////////
 // Simple dialog that displays images in a document, and allows one
@@ -71,6 +79,7 @@
        Button cancelBtn;
        Button applyBtn;
        Button okayBtn;
+       Button notImpBtn;
        Label mainImage;
        Text imgDescTextBox;
        Browser browser = null;
@@ -117,6 +126,10 @@
        int cancelBtnY = 0;
        int cancelBtnW = defBtnW;
        int cancelBtnH = defBtnH;
+       int makeNotImpBtnX = 0; // not-important.
+       int makeNotImpBtnY = okayBtnY + okayBtnH + 1;
+       int makeNotImpBtnW = defBtnW;
+       int makeNotImpBtnH = defBtnH;
        // Text box.
        int txtBoxX = 0;
        int txtBoxY = 55;
@@ -128,6 +141,9 @@
        int browserW = -1;
        int browserH = -1;

+       // True if usr hit okay. False if cancel.
+       boolean msgBxBool = false;
+
///////////////////////////////////////////////////////////////////////////////////////////
        // Constructor.
public ImageDescriberDialog(Shell parent, int style, WPManager wordProcesserManager) {
@@ -163,22 +179,8 @@
// If there were no <img> elements found, there is no point in continuing.
                if(imgDesc.getNumImgElements() == 0) {

-                       // Tell user there are no image tags.
-                       Dimension screenSize = 
Toolkit.getDefaultToolkit().getScreenSize();
-                       Display dlgDisp;
-                       Shell dlgShl;
-                       dlgDisp = parent.getDisplay();
-                       dlgShl = new Shell(parent, SWT.DIALOG_TRIM);
-                       dlgShl.setText(lh.localValue("NO IMAGES!"));
-                       Label alertText = new Label(dlgShl, SWT.NONE);
-                       alertText.setBounds(0, 0, 500, 100);
-                       alertText.setText("There are no image elements in this 
document.");
- dlgShl.setSize((int)screenSize.getWidth() / 5, (int)screenSize.getWidth() / 12);
-                       dlgShl.open();
-                       while (!dlgShl.isDisposed()) {
-                               if (!dlgDisp.readAndDispatch())
-                                       dlgDisp.sleep();
-                       }
+                       // Show user No Images message.
+                       msgBx("NO IMAGES!", "There are no image elements in this 
document.");

                        // Don't bother with the rest of image describer, there 
are no images.
                        return;
@@ -193,10 +195,9 @@
                imgDescShell.setText(lh.localValue("Image Describer"));

                // Resize window.
+               setUIDimensions();
                imgDescShell.setSize(dialogWidth, dialogHeight);
-               clientWidth = imgDescShell.getClientArea().width;
-               clientHeight = imgDescShell.getClientArea().height;
-
+
                // Create all of the buttons, edit boxes, etc.
                createUIelements();

@@ -227,39 +228,6 @@
        // Creates all buttons, boxes, checks, etc.
        public void createUIelements()
        {
-               // Setup main image.
-               mainImage = new Label(imgDescShell, SWT.NONE);
-               mainImage.setBounds(imageOffsetX, imageOffsetY, imageWidth, 
imageHeight);
-
-               // Set main image to first image found. If the first <img> tag
-               Image curElmImage = imgDesc.getCurElementImage();
-               if(curElmImage != null)
- mainImage.setImage( imgHelper.createScaledImage(curElmImage, imageWidth, imageHeight) );
-               else
- mainImage.setImage( imgHelper.createScaledImage(new Image(null, BBIni.getProgramDataPath() + BBIni.getFileSep() + "images" + BBIni.getFileSep() + "imageMissing.png"),
-                                                                               
                                    imageWidth,
-                                                                               
                                    imageHeight) );
-
-               // Show current image index and name.
- imgDescShell.setText( "Image Describer - " + imgDesc.getCurrentElementIndex() + " - " + imgDesc.currentImageElement().getAttributeValue("src") );
-
-               // Create image description text box.
- imgDescTextBox = new Text(imgDescShell, SWT.BORDER | SWT.MULTI | SWT.WRAP);
-               imgDescTextBox.setBounds(txtBoxX, txtBoxY, txtBoxW, txtBoxH);
-               imgDescTextBox.addModifyListener(new ModifyListener() {
-                       public void modifyText(ModifyEvent arg0) {
-
-
-
-                       } // modifyText()
-
-               }); // addModifyListener(new ModiftyListener() {
-
-
-               // Get prodnote text/image description.
-               imgDescTextBox.setText( imgDesc.getCurProdText() );
-
-
                // Create previous button.
                prevBtn = new Button(imgDescShell, SWT.PUSH);
                prevBtn.setText("Previous");
@@ -362,14 +330,214 @@
                        } // widgetSelected()

                }); // cancelBtn.addSelectionListener...
+
+ // Make not-important button. Finds every image with this name and changes description
+               // to "Not Important."
+               notImpBtn = new Button(imgDescShell, SWT.PUSH);
+               notImpBtn.setText("Make Non-Essential");
+ notImpBtn.setBounds(makeNotImpBtnX, makeNotImpBtnY, makeNotImpBtnW, makeNotImpBtnH);
+               notImpBtn.addSelectionListener(new SelectionAdapter() {
+                       public void widgetSelected(SelectionEvent e) {
+
+                               // Warn user before doing this. It could take a 
while.
+ if( msgBx("Warning", "This will cause the Image Describer to update the entire document. This could take a while. Continue?") == true)
+                               {
+                                       // Current image path.
+                                       String curImgPath = "";
+
+                                       // Get current image path from src 
attribute.
+                                       curImgPath = 
imgDesc.currentImageElement().getAttributeValue("src");
+
+                                       // Get all img nodes.
+ String nameSpace = imgDesc.getRoot().getDocument().getRootElement().getNamespaceURI();
+                                       XPathContext context;
+                                       context = new XPathContext("dtb", 
nameSpace);
+                                       Nodes imgs = null;
+                                       imgs = 
imgDesc.getRoot().query("//dtb:img", context);
+
+                                       // Print out paths.
+                                       for(int i = 0; i < imgs.size(); i++)
+ System.out.println( ((Element)(imgs.get(i))).getAttributeValue("src") );
+
+                               } // if msgBx == true
+                               else
+                               {
+
+
+                               } // if -> else msgBox == false
+
+                       } // widgetSelected()
+
+               }); // cancelBtn.addSelectionListener...

-               // Setup browser window.
-               browser = new Browser( imgDescShell, SWT.NONE );
-               browser.setUrl( curDocMan.getWorkingPath() );
-               browserW = clientWidth;
-               browserH = clientHeight;
-               browser.setBounds(browserX, browserY, browserW, browserH);
+               // Create image description text box.
+ imgDescTextBox = new Text(imgDescShell, SWT.BORDER | SWT.MULTI | SWT.WRAP);
+               imgDescTextBox.setBounds(txtBoxX, txtBoxY, txtBoxW, txtBoxH);
+               imgDescTextBox.addModifyListener(new ModifyListener() {
+                       public void modifyText(ModifyEvent arg0) {
+
+                       } // modifyText()
+
+               }); // addModifyListener(new ModiftyListener() {

+
+
+               // Get prodnote text/image description.
+               imgDescTextBox.setText( imgDesc.getCurProdText() );
+
+               // Setup main image.
+               mainImage = new Label(imgDescShell, SWT.NONE);
+               mainImage.setBounds(imageOffsetX, imageOffsetY, imageWidth, 
imageHeight);
+
+               // Set main image to first image found. If the first <img> tag
+               Image curElmImage = imgDesc.getCurElementImage();
+               if(curElmImage != null)
+ mainImage.setImage( imgHelper.createScaledImage(curElmImage, imageWidth, imageHeight) );
+               else
+ mainImage.setImage( imgHelper.createScaledImage(new Image(null, BBIni.getProgramDataPath() + BBIni.getFileSep() + "images" + BBIni.getFileSep() + "imageMissing.png"),
+                                                                               
                                    imageWidth,
+                                                                               
                                    imageHeight) );
+
+               // Show current image index and name.
+ imgDescShell.setText( "Image Describer - " + imgDesc.getCurrentElementIndex() + " - " + imgDesc.currentImageElement().getAttributeValue("src") );
+
+               //////////////////
+               // Browser Widget.
+
+                       // Setup browser window.
+                       browser = new Browser( imgDescShell, SWT.NONE );
+
+                       // Create copy of file as html and load into browser 
widget.
+                       File f  = new File(curDocMan.getWorkingPath());
+ File f2 = new File(curDocMan.getWorkingPath().replaceAll(".xml", ".html"));
+                       Path src = f.toPath();
+                       Path dst = f2.toPath();
+                       try { Files.copy(src, dst, REPLACE_EXISTING ); }
+                       catch (IOException e1) { e1.printStackTrace(); }
+
+                       // Set url.
+ browser.setUrl( curDocMan.getWorkingPath().replaceAll(".xml", ".html") );
+                       // Set browser bounds.
+                        browser.setBounds(browserX, browserY, browserW, 
browserH);
+
+                // Browser Widget.
+                //////////////////
+
        } // public void createUIelements()

+ ///////////////////////////////////////////////////////////////////////////////////////////
+       // Resizes our widgets depending on screen resolution.
+       public void setUIDimensions()
+       {
+               // Screen resolution.
+               Dimension screenSize = 
Toolkit.getDefaultToolkit().getScreenSize();
+
+               // Overall dialog.
+               dialogWidth = (int)(screenSize.getWidth() * 0.70f);
+               dialogHeight = (int)(screenSize.getWidth() * 0.70f);
+               // Client Area.
+               clientWidth = imgDescShell.getClientArea().width;
+               clientHeight = imgDescShell.getClientArea().height;
+               // Buttons.
+               defBtnW = dialogWidth / 15;
+               defBtnH = dialogHeight / 25;
+               prevBtnX = 0;
+               prevBtnY = 0;
+               prevBtnW = defBtnW;
+               prevBtnH = defBtnH;
+               nextBtnX = prevBtnW + prevBtnX + 1;
+               nextBtnY = 0;
+               nextBtnW = defBtnW;
+               nextBtnH = defBtnH;
+               applyBtnX = nextBtnW + nextBtnX + 1;
+               applyBtnY = 0;
+               applyBtnW = defBtnW;
+               applyBtnH = defBtnH;
+               okayBtnX = applyBtnW + applyBtnX + 1;
+               okayBtnY = 0;
+               okayBtnW = defBtnW;
+               okayBtnH = defBtnH;
+               cancelBtnX = okayBtnW + okayBtnX + 1;
+               cancelBtnY = 0;
+               cancelBtnW = defBtnW;
+               cancelBtnH = defBtnH;
+               makeNotImpBtnX = 0; // not-important.
+               makeNotImpBtnY = okayBtnY + okayBtnH + 1;
+               makeNotImpBtnW = defBtnW;
+               makeNotImpBtnH = defBtnH;
+               // Text box.
+               txtBoxX = 0;
+               txtBoxY = defBtnH + 10;
+               txtBoxW = clientWidth / 3;
+               txtBoxH = clientHeight / 4;
+               // Main image.
+               imageOffsetX = 0;
+               imageOffsetY = txtBoxY + txtBoxH + 5;
+               imageWidth = clientWidth / 3;
+               imageHeight = clientWidth / 3;
+               // Browser.
+               browserX = imageWidth + 10;
+               browserY = 0;
+               browserW = clientWidth / 2;
+               browserH = clientHeight;
+
+       } // public void resizeUI()
+
+ ///////////////////////////////////////////////////////////////////////////////////////////
+       // Simple message box for alerts and messages to user.
+       public boolean msgBx(String cap, String msg)
+       {
+               // Tell user there are no image tags.
+               Dimension screenSize = 
Toolkit.getDefaultToolkit().getScreenSize();
+               msgBxBool = false;
+               Display dlgDisp;
+               final Shell dlgShl;
+               dlgDisp = imgDescShell.getDisplay();
+               dlgShl = new Shell(imgDescShell, SWT.WRAP);
+               dlgShl.setText(lh.localValue(cap));
+               Button okBtn = new Button(dlgShl, SWT.PUSH);
+               okBtn.setText("Okay");
+               okBtn.setBounds(0,  75, 100, 25);
+               okBtn.addSelectionListener(new SelectionAdapter() {
+                       public void widgetSelected(SelectionEvent e) {
+
+                               // User hit okay.
+                               msgBxBool = true;
+
+                               // Close dialog.
+                               dlgShl.close();
+
+                       } // widgetSelected()
+
+               }); // okBtn.addSelectionListener...
+               Button canBtn = new Button(dlgShl, SWT.PUSH);
+               canBtn.setText("Cancel");
+               canBtn.setBounds(101,  75, 100, 25);
+               canBtn.addSelectionListener(new SelectionAdapter() {
+                       public void widgetSelected(SelectionEvent e) {
+
+                               // User hit okay.
+                               msgBxBool = false;
+
+                               // Close dialog.
+                               dlgShl.close();
+
+                       } // widgetSelected()
+
+               }); // canBtn.addSelectionListener...
+               Label alertText = new Label(dlgShl, SWT.WRAP);
+               alertText.setBounds(0, 0, 250, 100);
+               alertText.setText(msg);
+ dlgShl.setSize((int)screenSize.getWidth() / 5, (int)screenSize.getWidth() / 12);
+               dlgShl.open();
+               while (!dlgShl.isDisposed()) {
+                       if (!dlgDisp.readAndDispatch())
+                               dlgDisp.sleep();
+               }
+
+               // Return message box boolean value. What did the user press...
+               return msgBxBool;
+
+       } // public void msgBx(String cap, string msg)
+
 } // public class ImageDescriberDialog extends Dialog
=======================================
--- /src/main/org/brailleblaster/wordprocessor/BBToolBar.java Wed Aug 28 13:58:34 2013 UTC +++ /src/main/org/brailleblaster/wordprocessor/BBToolBar.java Tue Sep 3 22:05:02 2013 UTC
@@ -233,8 +233,9 @@

                                // Run Image Describer on current document.
                                if(curDm.document.getDOM() != null) {
-//                                     ImageDescriber imgDesc = new 
ImageDescriber(curDm);
ImageDescriberDialog imgDlg = new ImageDescriberDialog(wordProc.getShell(), SWT.NONE, wordProc);
+//                                     curDm.text.view.setVisible(false);
+//                                     curDm.braille.view.setVisible(false);
                                }

                        } // widgetSelected...

Other related posts:

  • » [brailleblaster] [brailleblaster.newdesign] push by RandomCh...@xxxxxxxxx - Warning message for non-essential images/Non-essential button. on 2013-09-03 20:57 GMT - brailleblaster