OSDN Git Service

Correct image overlay problem where searches could result in garbled images.
authorRandy Baumgarte <randy@fbn.cx>
Tue, 11 Jan 2011 06:38:35 +0000 (01:38 -0500)
committerRandy Baumgarte <randy@fbn.cx>
Sun, 30 Jan 2011 13:35:34 +0000 (08:35 -0500)
shortcuts_sample.txt
src/cx/fbn/nevernote/xml/NoteFormatter.java

index 8cf01db..202aa1c 100644 (file)
@@ -37,6 +37,8 @@ Edit_Image_Rotate_Left                                // Rotate an image left
 Edit_Image_Rotate_Right                                // Rotate an image to the right
 Edit_Delete_Table_Row                          // Delete a table row
 Edit_Insert_Table_Row                          // Insert a table row
+Edit_Insert_Table_Column                       // Insert a table row
+Edit_Delete_Table_Column                       // Delete a table row
 
 Edit_Insert_Hyperlink          Ctrl+K          // Insert a hyperlink (Popup menu)
 Edit_Insert_Todo                               // Insert a todo checkbox (Popup menu)
index d513322..ecd7166 100644 (file)
@@ -16,6 +16,7 @@ import com.trolltech.qt.core.QUrl;
 import com.trolltech.qt.core.Qt.BGMode;\r
 import com.trolltech.qt.gui.QColor;\r
 import com.trolltech.qt.gui.QPainter;\r
+import com.trolltech.qt.gui.QPainter.RenderHint;\r
 import com.trolltech.qt.gui.QPixmap;\r
 import com.trolltech.qt.xml.QDomAttr;\r
 import com.trolltech.qt.xml.QDomDocument;\r
@@ -146,9 +147,13 @@ public class NoteFormatter {
        // Create a transparent pixmap.  The only non-transparent\r
        // piece is the hilight that will be overlayed to hilight text no the background\r
        QPixmap overlayPix = new QPixmap(pix.size());\r
+       overlayPix.fill(QColor.transparent);\r
        QPainter p2 = new QPainter(overlayPix);\r
        p2.setBackgroundMode(BGMode.TransparentMode);\r
-       p2.setBrush(QColor.yellow);\r
+       p2.setRenderHint(RenderHint.Antialiasing, true);\r
+               QColor yellow = QColor.yellow;\r
+//             yellow.setAlphaF(0.4);\r
+       p2.setBrush(yellow);\r
        \r
                // Get the recognition data from the note\r
        QDomDocument doc = new QDomDocument();\r
@@ -179,8 +184,9 @@ public class NoteFormatter {
                                                        searchWord = searchWord.substring(1);\r
                                                if (searchWord.endsWith("*"))\r
                                                        searchWord = searchWord.substring(0,searchWord.length()-1);\r
-                                               if (text.toLowerCase().contains(searchWord))\r
-                                                       p2.drawRect(x,y,w,h);                           \r
+                                               if (text.toLowerCase().contains(searchWord)) {\r
+                                                       p2.drawRect(x,y,w,h);                   \r
+                                               }\r
                                        }\r
                                }\r
                        }\r
@@ -189,7 +195,7 @@ public class NoteFormatter {
        p2.end();\r
        \r
        // Paint the hilight onto the background.\r
-       p.setOpacity(0.40);\r
+       p.setOpacity(0.4);\r
        p.drawPixmap(0,0, overlayPix);\r
        p.end();\r
        \r