OSDN Git Service

Added LaTex image insert & edit
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / ContentView.java
index 2bba156..648570b 100644 (file)
@@ -26,9 +26,9 @@ import com.trolltech.qt.gui.QContextMenuEvent;
 import com.trolltech.qt.gui.QDropEvent;\r
 import com.trolltech.qt.gui.QKeyEvent;\r
 import com.trolltech.qt.gui.QKeySequence;\r
+import com.trolltech.qt.gui.QKeySequence.StandardKey;\r
 import com.trolltech.qt.gui.QMenu;\r
 import com.trolltech.qt.gui.QShortcut;\r
-import com.trolltech.qt.gui.QKeySequence.StandardKey;\r
 import com.trolltech.qt.network.QNetworkRequest;\r
 import com.trolltech.qt.webkit.QWebPage;\r
 import com.trolltech.qt.webkit.QWebView;\r
@@ -62,12 +62,18 @@ public class ContentView extends QWebView {
        QShortcut rotateImageLeftShortcut;      \r
        QAction insertLinkAction;\r
        QShortcut insertLinkShortcut;\r
+       QAction insertLatexAction;\r
+       QShortcut insertLatexShortcut;\r
        QAction insertTableAction;\r
        QShortcut insertTableShortcut;\r
        QAction insertTableRowAction;\r
        QShortcut insertTableRowShortcut;\r
+       QAction insertTableColumnAction;\r
+       QShortcut insertTableColumnShortcut;\r
        QAction deleteTableRowAction;\r
        QShortcut deleteTableRowShortcut;\r
+       QAction deleteTableColumnAction;\r
+       QShortcut deleteTableColumnShortcut;\r
        QAction openAction;\r
        \r
        QAction redBackgroundColor;\r
@@ -117,9 +123,9 @@ public class ContentView extends QWebView {
                pasteWithoutFormatAction.triggered.connect(parent, "pasteWithoutFormattingClicked()");\r
                contextMenu.addAction(pasteWithoutFormatAction); \r
                setupShortcut(pasteWithoutFormatAction, "Edit_Paste_Without_Formatting");\r
-               pasteWithoutFormatShortcut = new QShortcut(this);\r
-               pasteWithoutFormatShortcut.activated.connect(parent, "pasteWithoutFormattingClicked()");\r
-               setupShortcut(pasteWithoutFormatShortcut, "Edit_Paste_Without_Formatting");\r
+//             pasteWithoutFormatShortcut = new QShortcut(this);\r
+//             pasteWithoutFormatShortcut.activated.connect(parent, "pasteWithoutFormattingClicked()");\r
+//             setupShortcut(pasteWithoutFormatShortcut, "Edit_Paste_Without_Formatting");\r
                \r
                contextMenu.addSeparator();\r
                QMenu colorMenu = new QMenu(tr("Background Color"));\r
@@ -166,6 +172,14 @@ public class ContentView extends QWebView {
                insertLinkShortcut = new QShortcut(this);\r
                setupShortcut(insertLinkShortcut, "Edit_Insert_Hyperlink");\r
                insertLinkShortcut.activated.connect(parent, "insertLink()");\r
+\r
+               insertLatexAction = new QAction(tr("Insert LaTeX Formula"), this);\r
+               insertLatexAction.triggered.connect(parent, "insertLatex()");\r
+               setupShortcut(insertLatexAction, "Insert_Latex");\r
+               contextMenu.addAction(insertLatexAction);\r
+               insertLatexShortcut = new QShortcut(this);\r
+               setupShortcut(insertLatexShortcut, "Latex_Insert");\r
+               insertLatexShortcut.activated.connect(parent, "insertLatex()");\r
                \r
                contextMenu.addMenu(tableMenu);\r
                tableMenu.setTitle("Table");\r
@@ -185,6 +199,14 @@ public class ContentView extends QWebView {
                setupShortcut(insertTableRowShortcut, "Edit_Insert_Table_Row");\r
                insertTableRowShortcut.activated.connect(parent, "insertTableRow()");\r
                \r
+               insertTableColumnAction = new QAction(tr("Insert Column"), this);\r
+               insertTableColumnAction.triggered.connect(parent, "insertTableColumn()");\r
+               setupShortcut(insertTableColumnAction, "Edit_Insert_Table_Column");\r
+               tableMenu.addAction(insertTableColumnAction);\r
+               insertTableColumnShortcut = new QShortcut(this);\r
+               setupShortcut(insertTableColumnShortcut, "Edit_Insert_Table_Column");\r
+               insertTableColumnShortcut.activated.connect(parent, "insertTableColumn()");\r
+               \r
                deleteTableRowAction = new QAction(tr("Delete Row"), this);\r
                deleteTableRowAction.triggered.connect(parent, "deleteTableRow()");\r
                setupShortcut(deleteTableRowAction, "Edit_Delete_Table_Row");\r
@@ -193,12 +215,21 @@ public class ContentView extends QWebView {
                setupShortcut(deleteTableRowShortcut, "Edit_Delete_Table_Row");\r
                deleteTableRowShortcut.activated.connect(parent, "deleteTableRow()");\r
                \r
+               deleteTableColumnAction = new QAction(tr("Delete Column"), this);\r
+               deleteTableColumnAction.triggered.connect(parent, "deleteTableColumn()");\r
+               setupShortcut(deleteTableColumnAction, "Edit_Delete_Table_Column");\r
+               tableMenu.addAction(deleteTableColumnAction);\r
+               deleteTableColumnShortcut = new QShortcut(this);\r
+               setupShortcut(deleteTableColumnShortcut, "Edit_Delete_Table_Column");\r
+               deleteTableColumnShortcut.activated.connect(parent, "deleteTableColumn()");\r
+               \r
+               \r
                insertDateTimeShortcut = new QShortcut(this);\r
                insertDateTimeShortcut.activated.connect(parent, "insertDateTime()");\r
                setupShortcut(insertDateTimeShortcut, "Insert_DateTime");\r
                        \r
                QMenu imageMenu = new QMenu();\r
-               imageMenu.setTitle("Image");\r
+               imageMenu.setTitle(tr("Image"));\r
                contextMenu.addMenu(imageMenu);\r
                downloadImage = pageAction(QWebPage.WebAction.DownloadImageToDisk);\r
                downloadImage.setText(tr("Save Image"));\r
@@ -255,6 +286,7 @@ public class ContentView extends QWebView {
             QKeyEvent ke = (QKeyEvent) event;\r
             if (ke.key() == Qt.Key.Key_Tab.value()) {\r
                        parent.tabPressed();\r
+                       ke.accept();\r
                 return true;\r
             }\r
             if (ke.key() == Qt.Key.Key_Backtab.value()) {\r