OSDN Git Service

Change the editor button bar from a QHBoxLayout to a QToolBar. This will allow the...
authorRandy Baumgarte <randy@fbn.cx>
Wed, 1 Sep 2010 19:23:28 +0000 (15:23 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Tue, 14 Sep 2010 10:23:15 +0000 (06:23 -0400)
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/dialog/ConfigDialog.java
src/cx/fbn/nevernote/dialog/ConfigShowEditorButtonsPage.java [deleted file]
src/cx/fbn/nevernote/gui/BrowserWindow.java
src/cx/fbn/nevernote/gui/EditorButtonBar.java [new file with mode: 0644]

index 230cd27..2399e93 100644 (file)
@@ -85,7 +85,6 @@ import com.trolltech.qt.gui.QCloseEvent;
 import com.trolltech.qt.gui.QColor;
 import com.trolltech.qt.gui.QComboBox;
 import com.trolltech.qt.gui.QComboBox.InsertPolicy;
-import com.trolltech.qt.gui.QCursor;
 import com.trolltech.qt.gui.QDesktopServices;
 import com.trolltech.qt.gui.QDialog;
 import com.trolltech.qt.gui.QFileDialog;
@@ -3383,49 +3382,32 @@ public class NeverNote extends QMainWindow{
     }
     // Show editor buttons
     private void showEditorButtons() {
+               browserWindow.buttonLayout.setVisible(true);
+               browserWindow.undoAction.setVisible(false);
+               
                browserWindow.undoButton.setVisible(false);
-               browserWindow.redoButton.setVisible(false);
-               browserWindow.cutButton.setVisible(false);
-               browserWindow.copyButton.setVisible(false);
-               browserWindow.pasteButton.setVisible(false);
-               browserWindow.strikethroughButton.setVisible(false);
-               browserWindow.underlineButton.setVisible(false);
-               browserWindow.boldButton.setVisible(false);
-               browserWindow.italicButton.setVisible(false);
-               browserWindow.hlineButton.setVisible(false);
-               browserWindow.indentButton.setVisible(false);
-               browserWindow.outdentButton.setVisible(false);
-               browserWindow.fontList.setVisible(false);
-               browserWindow.fontSize.setVisible(false);
-               browserWindow.fontColor.setVisible(false);
-               browserWindow.fontHilight.setVisible(false);
-               browserWindow.leftAlignButton.setVisible(false);
-               browserWindow.centerAlignButton.setVisible(false);
-               browserWindow.rightAlignButton.setVisible(false);
-               browserWindow.indentButton.setVisible(false);
-               browserWindow.outdentButton.setVisible(false);
 
-               browserWindow.undoButton.setVisible(Global.isEditorButtonVisible("undo"));
-               browserWindow.redoButton.setVisible(Global.isEditorButtonVisible("redo"));
-               browserWindow.cutButton.setVisible(Global.isEditorButtonVisible("cut"));
-               browserWindow.copyButton.setVisible(Global.isEditorButtonVisible("copy"));
-               browserWindow.pasteButton.setVisible(Global.isEditorButtonVisible("paste"));
-               browserWindow.strikethroughButton.setVisible(Global.isEditorButtonVisible("strikethrough"));
-               browserWindow.underlineButton.setVisible(Global.isEditorButtonVisible("underline"));
-               browserWindow.boldButton.setVisible(Global.isEditorButtonVisible("bold"));
-               browserWindow.italicButton.setVisible(Global.isEditorButtonVisible("italic"));
-               browserWindow.hlineButton.setVisible(Global.isEditorButtonVisible("hline"));
-               browserWindow.indentButton.setVisible(Global.isEditorButtonVisible("indent"));
-               browserWindow.outdentButton.setVisible(Global.isEditorButtonVisible("outdent"));
-               browserWindow.bulletListButton.setVisible(Global.isEditorButtonVisible("bulletList"));
-               browserWindow.numberListButton.setVisible(Global.isEditorButtonVisible("numberList"));
-               browserWindow.fontList.setVisible(Global.isEditorButtonVisible("font"));
-               browserWindow.fontSize.setVisible(Global.isEditorButtonVisible("fontSize"));
-               browserWindow.fontColor.setVisible(Global.isEditorButtonVisible("fontColor"));
-               browserWindow.fontHilight.setVisible(Global.isEditorButtonVisible("fontHilight"));
-               browserWindow.leftAlignButton.setVisible(Global.isEditorButtonVisible("alignLeft"));
-               browserWindow.centerAlignButton.setVisible(Global.isEditorButtonVisible("alignCenter"));
-               browserWindow.rightAlignButton.setVisible(Global.isEditorButtonVisible("alignRight"));
+               browserWindow.undoAction.setVisible(Global.isEditorButtonVisible("undo"));
+               browserWindow.redoAction.setVisible(Global.isEditorButtonVisible("redo"));
+               browserWindow.cutAction.setVisible(Global.isEditorButtonVisible("cut"));
+               browserWindow.copyAction.setVisible(Global.isEditorButtonVisible("copy"));
+               browserWindow.pasteAction.setVisible(Global.isEditorButtonVisible("paste"));
+               browserWindow.strikethroughAction.setVisible(Global.isEditorButtonVisible("strikethrough"));
+               browserWindow.underlineAction.setVisible(Global.isEditorButtonVisible("underline"));
+               browserWindow.boldAction.setVisible(Global.isEditorButtonVisible("bold"));
+               browserWindow.italicAction.setVisible(Global.isEditorButtonVisible("italic"));
+               browserWindow.hlineAction.setVisible(Global.isEditorButtonVisible("hline"));
+               browserWindow.indentAction.setVisible(Global.isEditorButtonVisible("indent"));
+               browserWindow.outdentAction.setVisible(Global.isEditorButtonVisible("outdent"));
+               browserWindow.bulletListAction.setVisible(Global.isEditorButtonVisible("bulletList"));
+               browserWindow.numberListAction.setVisible(Global.isEditorButtonVisible("numberList"));
+               browserWindow.fontListAction.setVisible(Global.isEditorButtonVisible("font"));
+               browserWindow.fontSizeAction.setVisible(Global.isEditorButtonVisible("fontSize"));
+               browserWindow.fontColorAction.setVisible(Global.isEditorButtonVisible("fontColor"));
+               browserWindow.fontHilightAction.setVisible(Global.isEditorButtonVisible("fontHilight"));
+               browserWindow.leftAlignAction.setVisible(Global.isEditorButtonVisible("alignLeft"));
+               browserWindow.centerAlignAction.setVisible(Global.isEditorButtonVisible("alignCenter"));
+               browserWindow.rightAlignAction.setVisible(Global.isEditorButtonVisible("alignRight"));
     }
     private void duplicateNote(String guid) {
                
index 587faba..45237a8 100644 (file)
@@ -47,7 +47,6 @@ public class ConfigDialog extends QDialog {
        private final ConfigDebugPage                   debugPage;\r
        private final ConfigAppearancePage              appearancePage;\r
        private final ConfigIndexPage                   indexPage;\r
-       private final ConfigShowEditorButtonsPage               editorButtonsPage;\r
        \r
        public ConfigDialog(QWidget parent) {\r
                \r
@@ -63,11 +62,9 @@ public class ConfigDialog extends QDialog {
                appearancePage = new ConfigAppearancePage(this);\r
                indexPage = new ConfigIndexPage(this);\r
                debugPage = new ConfigDebugPage(this);\r
-               editorButtonsPage = new ConfigShowEditorButtonsPage(this);\r
                pagesWidget.addWidget(appearancePage);\r
                pagesWidget.addWidget(indexPage);\r
                pagesWidget.addWidget(connectionPage);\r
-               pagesWidget.addWidget(editorButtonsPage);\r
                pagesWidget.addWidget(debugPage);\r
                \r
                QPushButton cancelButton = new QPushButton(tr("Cancel"));\r
@@ -175,28 +172,7 @@ public class ConfigDialog extends QDialog {
                Global.setTimeFormat(timeFmt);\r
                \r
                Global.setSyncInterval(connectionPage.getSyncInterval());\r
-               \r
-               \r
-               Global.saveEditorButtonsVisible("undo", editorButtonsPage.showUndo());\r
-               Global.saveEditorButtonsVisible("redo", editorButtonsPage.showRedo());\r
-               Global.saveEditorButtonsVisible("cut", editorButtonsPage.showCut());\r
-               Global.saveEditorButtonsVisible("copy", editorButtonsPage.showCopy());\r
-               Global.saveEditorButtonsVisible("paste", editorButtonsPage.showPaste());\r
-               Global.saveEditorButtonsVisible("underline", editorButtonsPage.showUnderline());\r
-               Global.saveEditorButtonsVisible("strikethrough", editorButtonsPage.showStrikethrough());\r
-               Global.saveEditorButtonsVisible("italic", editorButtonsPage.showItalic());\r
-               Global.saveEditorButtonsVisible("bold", editorButtonsPage.showBold());\r
-               Global.saveEditorButtonsVisible("font", editorButtonsPage.showFont());\r
-               Global.saveEditorButtonsVisible("fontSize", editorButtonsPage.showFontSize());\r
-               Global.saveEditorButtonsVisible("fontColor", editorButtonsPage.showFontColor());\r
-               Global.saveEditorButtonsVisible("fontHilight", editorButtonsPage.showFontHilight());\r
-               Global.saveEditorButtonsVisible("indent", editorButtonsPage.showIndent());\r
-               Global.saveEditorButtonsVisible("outdent", editorButtonsPage.showOutdent());\r
-               Global.saveEditorButtonsVisible("numberList", editorButtonsPage.showNumberList());\r
-               Global.saveEditorButtonsVisible("bulletList", editorButtonsPage.showBulletList());\r
-               Global.saveEditorButtonsVisible("alignCenter", editorButtonsPage.showAlignCenter());\r
-               Global.saveEditorButtonsVisible("alignLeft", editorButtonsPage.showAlignLeft());\r
-               Global.saveEditorButtonsVisible("alignRight", editorButtonsPage.showAlignRight());\r
+                               \r
                close();\r
        }\r
        @Override\r
@@ -236,12 +212,6 @@ public class ConfigDialog extends QDialog {
                configButton.setFlags(ItemFlag.ItemIsSelectable, ItemFlag.ItemIsEnabled);\r
                configButton.setIcon(new QIcon(iconPath+"synchronize.png"));\r
 \r
-               QListWidgetItem editorButton = new QListWidgetItem(contentsWidget);\r
-               editorButton.setText(tr("Hide Edit Buttons"));\r
-               editorButton.setTextAlignment(AlignmentFlag.AlignHCenter.value());\r
-               editorButton.setFlags(ItemFlag.ItemIsSelectable, ItemFlag.ItemIsEnabled);\r
-               editorButton.setIcon(new QIcon(iconPath+"scissors.jpg"));\r
-\r
                QListWidgetItem debugButton = new QListWidgetItem(contentsWidget);\r
                debugButton.setText(tr("Debugging"));\r
                debugButton.setTextAlignment(AlignmentFlag.AlignHCenter.value());\r
@@ -301,29 +271,7 @@ public class ConfigDialog extends QDialog {
                appearancePage.setTimeFormat(Global.getTimeFormat());\r
                appearancePage.setStyle(Global.getStyle());\r
                appearancePage.setStandardPalette(Global.useStandardPalette());\r
-                               \r
-               editorButtonsPage.setUndo(Global.isEditorButtonVisible("undo"));\r
-               editorButtonsPage.setRedo(Global.isEditorButtonVisible("redo"));\r
-               editorButtonsPage.setCut(Global.isEditorButtonVisible("cut"));\r
-               editorButtonsPage.setCopy(Global.isEditorButtonVisible("copy"));\r
-               editorButtonsPage.setPaste(Global.isEditorButtonVisible("paste"));\r
-               editorButtonsPage.setBold(Global.isEditorButtonVisible("bold"));\r
-               editorButtonsPage.setItalic(Global.isEditorButtonVisible("italic"));\r
-               editorButtonsPage.setUnderline(Global.isEditorButtonVisible("underline"));\r
-               editorButtonsPage.setStrikethrough(Global.isEditorButtonVisible("strikethrough"));\r
-               editorButtonsPage.setIndent(Global.isEditorButtonVisible("indent"));\r
-               editorButtonsPage.setHline(Global.isEditorButtonVisible("hline"));\r
-               editorButtonsPage.setOutdent(Global.isEditorButtonVisible("outdent"));\r
-               editorButtonsPage.setBulletList(Global.isEditorButtonVisible("bulletList"));\r
-               editorButtonsPage.setNumberList(Global.isEditorButtonVisible("numberList"));\r
-               editorButtonsPage.setFont(Global.isEditorButtonVisible("font"));\r
-               editorButtonsPage.setFontSize(Global.isEditorButtonVisible("fontSize"));\r
-               editorButtonsPage.setFontColor(Global.isEditorButtonVisible("fontColor"));\r
-               editorButtonsPage.setFontHighlight(Global.isEditorButtonVisible("fontHilight"));\r
-               editorButtonsPage.setAlignLeft(Global.isEditorButtonVisible("alignLeft"));\r
-               editorButtonsPage.setAlignCenter(Global.isEditorButtonVisible("alignCenter"));\r
-               editorButtonsPage.setAlignRight(Global.isEditorButtonVisible("alignRight"));\r
-               \r
+                                               \r
                debugPage.setDebugLevel(Global.getMessageLevel());\r
                debugPage.setCarriageReturnFix(Global.enableCarriageReturnFix());\r
                \r
diff --git a/src/cx/fbn/nevernote/dialog/ConfigShowEditorButtonsPage.java b/src/cx/fbn/nevernote/dialog/ConfigShowEditorButtonsPage.java
deleted file mode 100644 (file)
index e234f96..0000000
+++ /dev/null
@@ -1,521 +0,0 @@
-/*\r
- * This file is part of NeverNote \r
- * Copyright 2009 Randy Baumgarte\r
- * \r
- * This file may be licensed under the terms of of the\r
- * GNU General Public License Version 2 (the ``GPL'').\r
- *\r
- * Software distributed under the License is distributed\r
- * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
- * express or implied. See the GPL for the specific language\r
- * governing rights and limitations.\r
- *\r
- * You should have received a copy of the GPL along with this\r
- * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
- * or write to the Free Software Foundation, Inc.,\r
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
- *\r
-*/\r
-\r
-package cx.fbn.nevernote.dialog;\r
-\r
-import com.trolltech.qt.gui.QComboBox;\r
-import com.trolltech.qt.gui.QGridLayout;\r
-import com.trolltech.qt.gui.QGroupBox;\r
-import com.trolltech.qt.gui.QHBoxLayout;\r
-import com.trolltech.qt.gui.QRadioButton;\r
-import com.trolltech.qt.gui.QWidget;\r
-\r
-public class ConfigShowEditorButtonsPage extends QWidget {\r
-       private final QRadioButton showUndo;\r
-       private final QRadioButton hideUndo;\r
-       private final QRadioButton showRedo;\r
-       private final QRadioButton hideRedo;\r
-       private final QRadioButton showCut;\r
-       private final QRadioButton hideCut;\r
-       private final QRadioButton showCopy;\r
-       private final QRadioButton hideCopy;\r
-       private final QRadioButton showPaste;\r
-       private final QRadioButton hidePaste;\r
-       private final QRadioButton showBold;\r
-       private final QRadioButton hideBold;\r
-       private final QRadioButton showItalic;\r
-       private final QRadioButton hideItalic;\r
-       private final QRadioButton showUnderline;\r
-       private final QRadioButton hideUnderline;\r
-       private final QRadioButton showStrikethrough;\r
-       private final QRadioButton hideStrikethrough;\r
-       private final QRadioButton showHline;\r
-       private final QRadioButton hideHline;\r
-       private final QRadioButton showOutdent;\r
-       private final QRadioButton hideOutdent;\r
-       private final QRadioButton showIndent;\r
-       private final QRadioButton hideIndent;\r
-       private final QRadioButton showBulletList;\r
-       private final QRadioButton hideBulletList;\r
-       private final QRadioButton showNumberList;\r
-       private final QRadioButton hideNumberList;\r
-       private final QRadioButton showFont;\r
-       private final QRadioButton hideFont;\r
-       private final QRadioButton showFontSize;\r
-       private final QRadioButton hideFontSize;\r
-       private final QRadioButton showFontColor;\r
-       private final QRadioButton hideFontColor;\r
-       private final QRadioButton showFontHighlight;\r
-       private final QRadioButton hideFontHighlight;\r
-       private final QRadioButton showAlignLeft;\r
-       private final QRadioButton hideAlignLeft;\r
-       private final QRadioButton showAlignCenter;\r
-       private final QRadioButton hideAlignCenter;\r
-       private final QRadioButton showAlignRight;\r
-       private final QRadioButton hideAlignRight;\r
-       \r
-       QComboBox messageCombo;\r
-       public ConfigShowEditorButtonsPage(QWidget parent) {\r
-               super(parent);\r
-\r
-               // Undo Button\r
-               QGroupBox undoGroup =  new QGroupBox(tr("Undo"));\r
-               QHBoxLayout undoLayout = new QHBoxLayout();\r
-               showUndo = new QRadioButton(tr("Show"));\r
-               hideUndo = new QRadioButton(tr("Hide"));\r
-               undoLayout.addWidget(showUndo);\r
-               undoLayout.addWidget(hideUndo);\r
-               undoLayout.setStretch(1, 100);\r
-               undoGroup.setLayout(undoLayout);\r
-\r
-\r
-               // Redo Button\r
-               QGroupBox redoGroup =  new QGroupBox(tr("Redo"));\r
-               QHBoxLayout redoLayout = new QHBoxLayout();\r
-               showRedo = new QRadioButton(tr("Show"));\r
-               hideRedo = new QRadioButton(tr("Hide"));\r
-               redoLayout.addWidget(showRedo);\r
-               redoLayout.addWidget(hideRedo);\r
-               redoLayout.setStretch(1, 100);\r
-               redoGroup.setLayout(redoLayout);\r
-\r
-\r
-               // Paste button\r
-               QGroupBox pasteGroup =  new QGroupBox(tr("Paste"));\r
-               QHBoxLayout pasteLayout = new QHBoxLayout();\r
-               showPaste = new QRadioButton(tr("Show"));\r
-               hidePaste = new QRadioButton(tr("Hide"));\r
-               pasteLayout.addWidget(showPaste);\r
-               pasteLayout.addWidget(hidePaste);\r
-               pasteLayout.setStretch(1, 100);\r
-               pasteGroup.setLayout(pasteLayout);\r
-\r
-               // Copy button\r
-               QGroupBox copyGroup =  new QGroupBox(tr("Copy"));\r
-               QHBoxLayout copyLayout = new QHBoxLayout();\r
-               showCopy = new QRadioButton(tr("Show"));\r
-               hideCopy = new QRadioButton(tr("Hide"));\r
-               copyLayout.addWidget(showCopy);\r
-               copyLayout.addWidget(hideCopy);\r
-               copyLayout.setStretch(1, 100);\r
-               copyGroup.setLayout(copyLayout);\r
-\r
-               \r
-               // Cut Button\r
-               QGroupBox cutGroup =  new QGroupBox(tr("Cut"));\r
-               QHBoxLayout cutLayout = new QHBoxLayout();\r
-               showCut = new QRadioButton(tr("Show"));\r
-               hideCut = new QRadioButton(tr("Hide"));\r
-               cutLayout.addWidget(showCut);\r
-               cutLayout.addWidget(hideCut);\r
-               cutLayout.setStretch(1, 100);\r
-               cutGroup.setLayout(cutLayout);\r
-\r
-               // Notebook Column\r
-               QGroupBox underlineGroup =  new QGroupBox(tr("Underline"));\r
-               QHBoxLayout underlineLayout = new QHBoxLayout();\r
-               showUnderline = new QRadioButton(tr("Show"));\r
-               hideUnderline = new QRadioButton(tr("Hide"));\r
-               underlineLayout.addWidget(showUnderline);\r
-               underlineLayout.addWidget(hideUnderline);\r
-               underlineLayout.setStretch(1, 100);\r
-               underlineGroup.setLayout(underlineLayout);\r
-\r
-               // Bold Button\r
-               QGroupBox boldGroup =  new QGroupBox(tr("Bold"));\r
-               QHBoxLayout boldLayout = new QHBoxLayout();\r
-               showBold = new QRadioButton(tr("Show"));\r
-               hideBold = new QRadioButton(tr("Hide"));\r
-               boldLayout.addWidget(showBold);\r
-               boldLayout.addWidget(hideBold);\r
-               boldLayout.setStretch(1, 100);\r
-               boldGroup.setLayout(boldLayout);\r
-\r
-\r
-               // Italic Button\r
-               QGroupBox italicGroup =  new QGroupBox(tr("Italic"));\r
-               QHBoxLayout italicLayout = new QHBoxLayout();\r
-               showItalic = new QRadioButton(tr("Show"));\r
-               hideItalic = new QRadioButton(tr("Hide"));\r
-               italicLayout.addWidget(showItalic);\r
-               italicLayout.addWidget(hideItalic);\r
-               italicLayout.setStretch(1, 100);\r
-               italicGroup.setLayout(italicLayout);\r
-\r
-               // Strikethrough Button\r
-               QGroupBox strikethroughGroup =  new QGroupBox(tr("Strikethrough"));\r
-               QHBoxLayout strikethroughLayout = new QHBoxLayout();\r
-               showStrikethrough = new QRadioButton(tr("Show"));\r
-               hideStrikethrough = new QRadioButton(tr("Hide"));\r
-               strikethroughLayout.addWidget(showStrikethrough);\r
-               strikethroughLayout.addWidget(hideStrikethrough);\r
-               strikethroughLayout.setStretch(1, 100);\r
-               strikethroughGroup.setLayout(strikethroughLayout);\r
-\r
-\r
-               // Hline Button\r
-               QGroupBox hlineGroup =  new QGroupBox(tr("Horizontal Line"));\r
-               QHBoxLayout hlineLayout = new QHBoxLayout();\r
-               showHline = new QRadioButton(tr("Show"));\r
-               hideHline = new QRadioButton(tr("Hide"));\r
-               hlineLayout.addWidget(showHline);\r
-               hlineLayout.addWidget(hideHline);\r
-               hlineLayout.setStretch(1, 100);\r
-               hlineGroup.setLayout(hlineLayout);\r
-\r
-               // Outdent Button\r
-               QGroupBox outdentGroup =  new QGroupBox(tr("Outdent"));\r
-               QHBoxLayout outdentLayout = new QHBoxLayout();\r
-               showOutdent = new QRadioButton(tr("Show"));\r
-               hideOutdent = new QRadioButton(tr("Hide"));\r
-               outdentLayout.addWidget(showOutdent);\r
-               outdentLayout.addWidget(hideOutdent);\r
-               outdentLayout.setStretch(1, 100);\r
-               outdentGroup.setLayout(outdentLayout);\r
-\r
-               // Indent Button\r
-               QGroupBox indentGroup =  new QGroupBox(tr("Indent"));\r
-               QHBoxLayout indentLayout = new QHBoxLayout();\r
-               showIndent = new QRadioButton(tr("Show"));\r
-               hideIndent = new QRadioButton(tr("Hide"));\r
-               indentLayout.addWidget(showIndent);\r
-               indentLayout.addWidget(hideIndent);\r
-               indentLayout.setStretch(1, 100);\r
-               indentGroup.setLayout(indentLayout);\r
-\r
-               // Bullet List Button\r
-               QGroupBox bulletListGroup =  new QGroupBox(tr("Bullet List"));\r
-               QHBoxLayout bulletListLayout = new QHBoxLayout();\r
-               showBulletList = new QRadioButton(tr("Show"));\r
-               hideBulletList = new QRadioButton(tr("Hide"));\r
-               bulletListLayout.addWidget(showBulletList);\r
-               bulletListLayout.addWidget(hideBulletList);\r
-               bulletListLayout.setStretch(1, 100);\r
-               bulletListGroup.setLayout(bulletListLayout);\r
-\r
-               // Number List Button\r
-               QGroupBox numberListGroup =  new QGroupBox(tr("Numbered List"));\r
-               QHBoxLayout numberListLayout = new QHBoxLayout();\r
-               showNumberList = new QRadioButton(tr("Show"));\r
-               hideNumberList = new QRadioButton(tr("Hide"));\r
-               numberListLayout.addWidget(showNumberList);\r
-               numberListLayout.addWidget(hideNumberList);\r
-               numberListLayout.setStretch(1, 100);\r
-               numberListGroup.setLayout(numberListLayout);\r
-\r
-               // Font drop down list\r
-               QGroupBox fontGroup =  new QGroupBox(tr("Fonts"));\r
-               QHBoxLayout fontLayout = new QHBoxLayout();\r
-               showFont = new QRadioButton(tr("Show"));\r
-               hideFont = new QRadioButton(tr("Hide"));\r
-               fontLayout.addWidget(showFont);\r
-               fontLayout.addWidget(hideFont);\r
-               fontLayout.setStretch(1, 100);\r
-               fontGroup.setLayout(fontLayout);\r
-\r
-               // Font sizes drop down list\r
-               QGroupBox fontSizeGroup =  new QGroupBox(tr("Font Size"));\r
-               QHBoxLayout fontSizeLayout = new QHBoxLayout();\r
-               showFontSize = new QRadioButton(tr("Show"));\r
-               hideFontSize = new QRadioButton(tr("Hide"));\r
-               fontSizeLayout.addWidget(showFontSize);\r
-               fontSizeLayout.addWidget(hideFontSize);\r
-               fontSizeLayout.setStretch(1, 100);\r
-               fontSizeGroup.setLayout(fontSizeLayout);\r
-               \r
-               // Font color button\r
-               QGroupBox fontColorGroup =  new QGroupBox(tr("Font Color"));\r
-               QHBoxLayout fontColorLayout = new QHBoxLayout();\r
-               showFontColor = new QRadioButton(tr("Show"));\r
-               hideFontColor = new QRadioButton(tr("Hide"));\r
-               fontColorLayout.addWidget(showFontColor);\r
-               fontColorLayout.addWidget(hideFontColor);\r
-               fontColorLayout.setStretch(1, 100);\r
-               fontColorGroup.setLayout(fontColorLayout);\r
-               \r
-               // highlight button\r
-               QGroupBox fontHighlightGroup =  new QGroupBox(tr("Text Highlight"));\r
-               QHBoxLayout fontHighlightLayout = new QHBoxLayout();\r
-               showFontHighlight = new QRadioButton(tr("Show"));\r
-               hideFontHighlight = new QRadioButton(tr("Hide"));\r
-               fontHighlightLayout.addWidget(showFontHighlight);\r
-               fontHighlightLayout.addWidget(hideFontHighlight);\r
-               fontHighlightLayout.setStretch(1, 100);\r
-               fontHighlightGroup.setLayout(fontHighlightLayout);\r
-                               \r
-               // Align Left\r
-               QGroupBox alignLeftGroup =  new QGroupBox(tr("Align Left"));\r
-               QHBoxLayout alignLeftLayout = new QHBoxLayout();\r
-               showAlignLeft = new QRadioButton(tr("Show"));\r
-               hideAlignLeft = new QRadioButton(tr("Hide"));\r
-               alignLeftLayout.addWidget(showAlignLeft);\r
-               alignLeftLayout.addWidget(hideAlignLeft);\r
-               alignLeftLayout.setStretch(1, 100);\r
-               alignLeftGroup.setLayout(alignLeftLayout);\r
-               \r
-               // Align Center\r
-               QGroupBox alignCenterGroup =  new QGroupBox(tr("Align Center"));\r
-               QHBoxLayout alignCenterLayout = new QHBoxLayout();\r
-               showAlignCenter = new QRadioButton(tr("Show"));\r
-               hideAlignCenter = new QRadioButton(tr("Hide"));\r
-               alignCenterLayout.addWidget(showAlignCenter);\r
-               alignCenterLayout.addWidget(hideAlignCenter);\r
-               alignCenterLayout.setStretch(1, 100);\r
-               alignCenterGroup.setLayout(alignCenterLayout);\r
-               \r
-               // Align Right\r
-               QGroupBox alignRightGroup =  new QGroupBox(tr("Align Right"));\r
-               QHBoxLayout alignRightLayout = new QHBoxLayout();\r
-               showAlignRight = new QRadioButton(tr("Show"));\r
-               hideAlignRight = new QRadioButton(tr("Hide"));\r
-               alignRightLayout.addWidget(showAlignRight);\r
-               alignRightLayout.addWidget(hideAlignRight);\r
-               alignRightLayout.setStretch(1, 100);\r
-               alignRightGroup.setLayout(alignRightLayout);\r
-               \r
-               QGridLayout mainLayout = new QGridLayout();\r
-               mainLayout.addWidget(undoGroup, 0,0);\r
-               mainLayout.addWidget(redoGroup, 0,1);\r
-               mainLayout.addWidget(cutGroup, 0,2);\r
-               mainLayout.addWidget(copyGroup, 1,0);\r
-               mainLayout.addWidget(pasteGroup, 1,1);\r
-               mainLayout.addWidget(boldGroup, 1,2);\r
-               mainLayout.addWidget(italicGroup, 2,0);\r
-               mainLayout.addWidget(underlineGroup, 2,1);\r
-               mainLayout.addWidget(strikethroughGroup, 2,2);\r
-               mainLayout.addWidget(hlineGroup, 3,0);\r
-               mainLayout.addWidget(indentGroup, 3,1);\r
-               mainLayout.addWidget(outdentGroup, 3,2);\r
-               mainLayout.addWidget(bulletListGroup, 4,0);\r
-               mainLayout.addWidget(numberListGroup, 4,1);\r
-               mainLayout.addWidget(fontGroup, 5,0);\r
-               mainLayout.addWidget(fontSizeGroup, 5,1);\r
-               mainLayout.addWidget(fontColorGroup, 5,2);\r
-               mainLayout.addWidget(fontHighlightGroup, 4,2);\r
-               mainLayout.addWidget(alignLeftGroup, 6,0);\r
-               mainLayout.addWidget(alignCenterGroup, 6,1);\r
-               mainLayout.addWidget(alignRightGroup, 6,2);\r
-\r
-               mainLayout.setColumnStretch(3, 100);\r
-               mainLayout.setRowStretch(7, 100);\r
-               setLayout(mainLayout);\r
-       }\r
-       \r
-       public void setUndo(boolean value) {\r
-               if (value)\r
-                       showUndo.click();\r
-               else\r
-                       hideUndo.click();\r
-       }\r
-       \r
-       public void setRedo(boolean value) {\r
-               if (value)\r
-                       showRedo.click();\r
-               else\r
-                       hideRedo.click();\r
-       }\r
-\r
-       public void setCut(boolean value) {\r
-               if (value)\r
-                       showCut.click();\r
-               else\r
-                       hideCut.click();\r
-       }\r
-\r
-       public void setCopy(boolean value) {\r
-               if (value)\r
-                       showCopy.click();\r
-               else\r
-                       hideCopy.click();\r
-       }\r
-\r
-       public void setPaste(boolean value) {\r
-               if (value)\r
-                       showPaste.click();\r
-               else\r
-                       hidePaste.click();\r
-       }\r
-       public void setUnderline(boolean value) {\r
-               if (value)\r
-                       showUnderline.click();\r
-               else\r
-                       hideUnderline.click();\r
-       }\r
-       public void setBold(boolean value) {\r
-               if (value)\r
-                       showBold.click();\r
-               else\r
-                       hideBold.click();\r
-       }\r
-       public void setItalic(boolean value) {\r
-               if (value)\r
-                       showItalic.click();\r
-               else\r
-                       hideItalic.click();\r
-       }\r
-       public void setStrikethrough(boolean value) {\r
-               if (value)\r
-                       showStrikethrough.click();\r
-               else\r
-                       hideStrikethrough.click();\r
-       }\r
-       public void setHline(boolean value) {\r
-               if (value)\r
-                       showHline.click();\r
-               else\r
-                       hideHline.click();\r
-       }\r
-       public void setIndent(boolean value) {\r
-               if (value)\r
-                       showIndent.click();\r
-               else\r
-                       hideIndent.click();\r
-       }\r
-       public void setOutdent(boolean value) {\r
-               if (value)\r
-                       showOutdent.click();\r
-               else\r
-                       hideOutdent.click();\r
-       }\r
-       public void setBulletList(boolean value) {\r
-               if (value)\r
-                       showBulletList.click();\r
-               else\r
-                       hideBulletList.click();\r
-       }\r
-       public void setNumberList(boolean value) {\r
-               if (value)\r
-                       showNumberList.click();\r
-               else\r
-                       hideNumberList.click();\r
-       }\r
-       public void setFont(boolean value) {\r
-               if (value)\r
-                       showFont.click();\r
-               else\r
-                       hideFont.click();\r
-       }\r
-       public void setFontSize(boolean value) {\r
-               if (value)\r
-                       showFontSize.click();\r
-               else\r
-                       hideFontSize.click();\r
-       }\r
-       public void setFontColor(boolean value) {\r
-               if (value)\r
-                       showFontColor.click();\r
-               else\r
-                       hideFontColor.click();\r
-       }\r
-       public void setFontHighlight(boolean value) {\r
-               if (value)\r
-                       showFontHighlight.click();\r
-               else\r
-                       hideFontHighlight.click();\r
-       }\r
-       public void setAlignLeft(boolean value) {\r
-               if (value)\r
-                       showAlignLeft.click();\r
-               else\r
-                       hideAlignLeft.click();\r
-       }\r
-       public void setAlignCenter(boolean value) {\r
-               if (value)\r
-                       showAlignCenter.click();\r
-               else\r
-                       hideAlignCenter.click();\r
-       }\r
-       public void setAlignRight(boolean value) {\r
-               if (value)\r
-                       showAlignRight.click();\r
-               else\r
-                       hideAlignRight.click();\r
-       }\r
-\r
-\r
-       \r
-       public boolean showUndo() {\r
-               return showUndo.isChecked();\r
-       }\r
-       public boolean showCut() {\r
-               return showCut.isChecked();\r
-       }\r
-       public boolean showRedo() {\r
-               return showRedo.isChecked();\r
-       }\r
-       public boolean showCopy() {\r
-               return showCopy.isChecked();\r
-       }\r
-       public boolean showPaste() {\r
-               return showPaste.isChecked();\r
-       }\r
-       public boolean showBold() {\r
-               return showBold.isChecked();\r
-       }\r
-       public boolean showUnderline() {\r
-               return showUnderline.isChecked();\r
-       }\r
-       public boolean showItalic() {\r
-               return showItalic.isChecked();\r
-       }\r
-       public boolean showStrikethrough() {\r
-               return showStrikethrough.isChecked();\r
-       }       \r
-       public boolean showHline() {\r
-               return showHline.isChecked();\r
-       }\r
-       public boolean showIndent() {\r
-               return showIndent.isChecked();\r
-       }\r
-       public boolean showOutdent() {\r
-               return showOutdent.isChecked();\r
-       }\r
-       public boolean showNumberList() {\r
-               return showNumberList.isChecked();\r
-       }\r
-       public boolean showBulletList() {\r
-               return showBulletList.isChecked();\r
-       }\r
-       public boolean showFont() {\r
-               return showFont.isChecked();\r
-       }       \r
-       public boolean showFontSize() {\r
-               return showFontSize.isChecked();\r
-       }       \r
-       public boolean showFontColor() {\r
-               return showFontColor.isChecked();\r
-       }       \r
-       public boolean showFontHilight() {\r
-               return showFontHighlight.isChecked();\r
-       }       \r
-       public boolean showAlignCenter() {\r
-               return showAlignCenter.isChecked();\r
-       }       public \r
-       boolean showAlignLeft() {\r
-               return showAlignLeft.isChecked();\r
-       }\r
-       public boolean showAlignRight() {\r
-               return showAlignRight.isChecked();\r
-       }\r
-\r
-\r
-\r
-\r
-\r
-}
\ No newline at end of file
index ef50a6f..77542c4 100644 (file)
@@ -50,6 +50,7 @@ import com.trolltech.qt.core.QFileSystemWatcher;
 import com.trolltech.qt.core.QIODevice;\r
 import com.trolltech.qt.core.QMimeData;\r
 import com.trolltech.qt.core.QUrl;\r
+import com.trolltech.qt.gui.QAction;\r
 import com.trolltech.qt.gui.QApplication;\r
 import com.trolltech.qt.gui.QCalendarWidget;\r
 import com.trolltech.qt.gui.QClipboard;\r
@@ -119,6 +120,7 @@ public class BrowserWindow extends QWidget {
        private final QLabel notebookLabel;\r
        private final QLabel createdLabel;\r
        public final QComboBox fontSize;\r
+       public final QAction    fontSizeAction;\r
        private boolean extendedOn;\r
        public boolean buttonsVisible;\r
        private final String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
@@ -138,26 +140,43 @@ public class BrowserWindow extends QWidget {
        private final QCalendarWidget subjectCalendarWidget;\r
 \r
        public final QPushButton undoButton;\r
+       public final QAction    undoAction;\r
        public final QPushButton redoButton;\r
+       public final QAction    redoAction;\r
        public final QPushButton cutButton;\r
+       public final QAction    cutAction;\r
        public final QPushButton copyButton;\r
+       public final QAction    copyAction;\r
        public final QPushButton pasteButton;\r
+       public final QAction    pasteAction;\r
        public final QPushButton boldButton;\r
+       public final QAction    boldAction;\r
        public final QPushButton underlineButton;\r
+       public final QAction    underlineAction;\r
        public final QPushButton italicButton;\r
+       public final QAction    italicAction;\r
        public final Signal0 focusLost;\r
        public final NoteResourceSignal resourceSignal;\r
 \r
        public QPushButton rightAlignButton;\r
+       public final QAction    rightAlignAction;\r
        public QPushButton leftAlignButton;\r
+       public final QAction    leftAlignAction;\r
        public QPushButton centerAlignButton;\r
+       public final QAction    centerAlignAction;\r
 \r
        public final QPushButton strikethroughButton;\r
+       public final QAction    strikethroughAction;\r
        public final QPushButton hlineButton;\r
+       public final QAction    hlineAction;\r
        public final QPushButton indentButton;\r
+       public final QAction    indentAction;\r
        public final QPushButton outdentButton;\r
+       public final QAction    outdentAction;\r
        public final QPushButton bulletListButton;\r
+       public final QAction    bulletListAction;\r
        public final QPushButton numberListButton;\r
+       public final QAction    numberListAction;\r
 \r
        public final QShortcut focusTitleShortcut;\r
        public final QShortcut focusTagShortcut;\r
@@ -165,10 +184,14 @@ public class BrowserWindow extends QWidget {
        public final QShortcut focusUrlShortcut;\r
        public final QShortcut focusAuthorShortcut;\r
        \r
+       public EditorButtonBar buttonLayout;\r
        public final QComboBox fontList;\r
+       public final QAction    fontListAction;\r
        public final QPushButton fontColor;\r
+       public final QAction    fontColorAction;\r
        private final ColorMenu fontColorMenu;\r
        public final QPushButton fontHilight;\r
+       public final QAction    fontHilightAction;\r
 //     public final ColorComboBox fontHilight;\r
        private final ColorMenu fontHilightColorMenu;\r
        public final QFileSystemWatcher fileWatcher;\r
@@ -339,49 +362,68 @@ public class BrowserWindow extends QWidget {
                bulletListButton = newEditorButton("bulletList", tr("Bullet List"));\r
                numberListButton = newEditorButton("numberList", tr("Number List"));\r
 \r
-\r
-               QHBoxLayout buttonLayout;\r
-               buttonLayout = new QHBoxLayout();\r
-               buttonLayout.setSpacing(0);\r
-               v.addLayout(buttonLayout);\r
                \r
-               buttonLayout.addWidget(undoButton);\r
-               buttonLayout.addWidget(redoButton);\r
-\r
-               buttonLayout.addWidget(newSeparator(), 0);\r
-               buttonLayout.addWidget(cutButton);\r
-               buttonLayout.addWidget(copyButton);\r
-               buttonLayout.addWidget(pasteButton);\r
-\r
-               buttonLayout.addWidget(newSeparator(), 0);\r
-               buttonLayout.addWidget(boldButton);\r
-               buttonLayout.addWidget(italicButton);\r
-               buttonLayout.addWidget(underlineButton);\r
-               buttonLayout.addWidget(strikethroughButton);\r
+               buttonLayout = new EditorButtonBar();\r
+//             buttonLayout.setSpacing(0);\r
+               v.addWidget(buttonLayout);\r
                \r
-               buttonLayout.addWidget(newSeparator(), 0);\r
-               buttonLayout.addWidget(leftAlignButton);\r
-               buttonLayout.addWidget(centerAlignButton);\r
-               buttonLayout.addWidget(rightAlignButton);\r
-\r
-               buttonLayout.addWidget(newSeparator(), 0);\r
-               buttonLayout.addWidget(hlineButton);\r
+               undoAction = buttonLayout.addWidget(undoButton);\r
+               buttonLayout.toggleUndoVisible.triggered.connect(this, "toggleUndoVisible(Boolean)");\r
+               redoAction = buttonLayout.addWidget(redoButton);\r
+               buttonLayout.toggleRedoVisible.triggered.connect(this, "toggleRedoVisible(Boolean)");\r
+               \r
+               buttonLayout.addWidget(newSeparator());\r
+               cutAction = buttonLayout.addWidget(cutButton);\r
+               buttonLayout.toggleCutVisible.triggered.connect(this, "toggleCutVisible(Boolean)");\r
+               copyAction = buttonLayout.addWidget(copyButton);\r
+               buttonLayout.toggleCopyVisible.triggered.connect(this, "toggleCopyVisible(Boolean)");\r
+               pasteAction = buttonLayout.addWidget(pasteButton);\r
+               buttonLayout.togglePasteVisible.triggered.connect(this, "togglePasteVisible(Boolean)");\r
+\r
+               buttonLayout.addWidget(newSeparator());\r
+               boldAction = buttonLayout.addWidget(boldButton);\r
+               buttonLayout.toggleBoldVisible.triggered.connect(this, "toggleBoldVisible(Boolean)");\r
+               italicAction = buttonLayout.addWidget(italicButton);\r
+               buttonLayout.toggleItalicVisible.triggered.connect(this, "toggleItalicVisible(Boolean)");\r
+               underlineAction = buttonLayout.addWidget(underlineButton);\r
+               buttonLayout.toggleUnderlineVisible.triggered.connect(this, "toggleUnderlineVisible(Boolean)");\r
+               strikethroughAction = buttonLayout.addWidget(strikethroughButton);\r
+               buttonLayout.toggleStrikethroughVisible.triggered.connect(this, "toggleStrikethroughVisible(Boolean)");\r
 \r
-               buttonLayout.addWidget(indentButton);\r
-               buttonLayout.addWidget(outdentButton);\r
-               buttonLayout.addWidget(bulletListButton);\r
-               buttonLayout.addWidget(numberListButton);\r
+               \r
+               buttonLayout.addWidget(newSeparator());\r
+               leftAlignAction = buttonLayout.addWidget(leftAlignButton);\r
+               buttonLayout.toggleLeftAlignVisible.triggered.connect(this, "toggleLeftAlignVisible(Boolean)");\r
+               centerAlignAction = buttonLayout.addWidget(centerAlignButton);\r
+               buttonLayout.toggleCenterAlignVisible.triggered.connect(this, "toggleCenterAlignVisible(Boolean)");\r
+               rightAlignAction = buttonLayout.addWidget(rightAlignButton);\r
+               buttonLayout.toggleRightAlignVisible.triggered.connect(this, "toggleRightAlignVisible(Boolean)");\r
+\r
+               buttonLayout.addWidget(newSeparator());\r
+               hlineAction = buttonLayout.addWidget(hlineButton);\r
+               buttonLayout.toggleHLineVisible.triggered.connect(this, "toggleHLineVisible(Boolean)");\r
+\r
+               indentAction = buttonLayout.addWidget(indentButton);\r
+               buttonLayout.toggleIndentVisible.triggered.connect(this, "toggleIndentVisible(Boolean)");\r
+               outdentAction = buttonLayout.addWidget(outdentButton);\r
+               buttonLayout.toggleOutdentVisible.triggered.connect(this, "toggleOutdentVisible(Boolean)");\r
+               bulletListAction = buttonLayout.addWidget(bulletListButton);\r
+               buttonLayout.toggleBulletListVisible.triggered.connect(this, "toggleBulletListVisible(Boolean)");\r
+               numberListAction = buttonLayout.addWidget(numberListButton);\r
+               buttonLayout.toggleNumberListVisible.triggered.connect(this, "toggleNumberListVisible(Boolean)");\r
 \r
                // Setup the font & font size combo boxes\r
-               buttonLayout.addWidget(newSeparator(), 0);\r
+               buttonLayout.addWidget(newSeparator());\r
                fontList = new QComboBox();\r
                fontSize = new QComboBox();\r
                fontList.setToolTip("Font");\r
                fontSize.setToolTip("Font Size");\r
                fontList.activated.connect(this, "fontChanged(String)");\r
                fontSize.activated.connect(this, "fontSizeChanged(String)");\r
-               buttonLayout.addWidget(fontList, 0);\r
-               buttonLayout.addWidget(fontSize, 0);\r
+               fontListAction = buttonLayout.addWidget(fontList);\r
+               buttonLayout.toggleFontVisible.triggered.connect(this, "toggleFontListVisible(Boolean)");\r
+               fontSizeAction = buttonLayout.addWidget(fontSize);\r
+               buttonLayout.toggleFontSizeVisible.triggered.connect(this, "toggleFontSizeVisible(Boolean)");\r
                QFontDatabase fonts = new QFontDatabase();\r
                List<String> fontFamilies = fonts.families();\r
                for (int i = 0; i < fontFamilies.size(); i++) {\r
@@ -391,21 +433,22 @@ public class BrowserWindow extends QWidget {
                        }\r
                }\r
 \r
-               buttonLayout.addWidget(newSeparator(), 0);\r
+//             buttonLayout.addWidget(newSeparator(), 0);\r
                fontColor = newEditorButton("fontColor", tr("Font Color"));\r
                fontColorMenu = new ColorMenu(this);\r
                fontColor.setMenu(fontColorMenu.getMenu());\r
                fontColorMenu.getMenu().triggered.connect(this, "fontColorClicked()");\r
-               buttonLayout.addWidget(fontColor);\r
+               fontColorAction = buttonLayout.addWidget(fontColor);\r
+               buttonLayout.toggleFontColorVisible.triggered.connect(this, "toggleFontColorVisible(Boolean)");\r
                fontHilight = newEditorButton("fontHilight", tr("Font Hilight Color"));\r
                fontHilightColorMenu = new ColorMenu(this);\r
                fontHilight.setMenu(fontHilightColorMenu.getMenu());\r
                fontHilightColorMenu.getMenu().triggered.connect(this, "fontHilightClicked()");\r
-               buttonLayout.addWidget(fontHilight);\r
+               fontHilightAction = buttonLayout.addWidget(fontHilight);\r
+               buttonLayout.toggleFontHilight.triggered.connect(this, "toggleFontHilightVisible(Boolean)");\r
 \r
-               buttonLayout.addWidget(new QLabel(), 1);\r
+//             buttonLayout.addWidget(new QLabel(), 1);\r
                v.addWidget(browser, 1);\r
-//             v.addLayout(buttonLayout,0);\r
                setLayout(v);\r
 \r
                browser.downloadAttachmentRequested.connect(this,\r
@@ -648,33 +691,8 @@ public class BrowserWindow extends QWidget {
 \r
        public void hideButtons() {\r
 \r
+               undoButton.parentWidget().setVisible(false);\r
                buttonsVisible = false;\r
-               \r
-               undoButton.setVisible(false);\r
-               redoButton.setVisible(false);\r
-               cutButton.setVisible(false);\r
-               copyButton.setVisible(false);\r
-               pasteButton.setVisible(false);\r
-               boldButton.setVisible(false);\r
-               underlineButton.setVisible(false);\r
-               italicButton.setVisible(false);\r
-\r
-               rightAlignButton.setVisible(false);\r
-               leftAlignButton.setVisible(false);\r
-               centerAlignButton.setVisible(false);\r
-\r
-               strikethroughButton.setVisible(false);\r
-               hlineButton.setVisible(false);\r
-               indentButton.setVisible(false);\r
-               outdentButton.setVisible(false);\r
-               bulletListButton.setVisible(false);\r
-               numberListButton.setVisible(false);\r
-\r
-               fontList.setVisible(false);\r
-               fontSize.setVisible(false);\r
-               fontColor.setVisible(false);\r
-               fontHilight.setVisible(false);\r
-\r
        }\r
 \r
 \r
@@ -2453,4 +2471,93 @@ public class BrowserWindow extends QWidget {
 //             browser.previousPageAction.setVisible(false);\r
        }\r
 */\r
+       \r
+       private void toggleUndoVisible(Boolean toggle) {\r
+               undoAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("undo", toggle);\r
+       }\r
+       private void toggleRedoVisible(Boolean toggle) {\r
+               redoAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("redo", toggle);\r
+       }\r
+       private void toggleCutVisible(Boolean toggle) {\r
+               cutAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("cut", toggle);\r
+       }\r
+       private void toggleCopyVisible(Boolean toggle) {\r
+               copyAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("copy", toggle);\r
+       }\r
+       private void togglePasteVisible(Boolean toggle) {\r
+               pasteAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("paste", toggle);\r
+       }\r
+       private void toggleBoldVisible(Boolean toggle) {\r
+               boldAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("bold", toggle);\r
+       }\r
+       private void toggleItalicVisible(Boolean toggle) {\r
+               italicAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("italic", toggle);\r
+       }\r
+       private void toggleUnderlineVisible(Boolean toggle) {\r
+               underlineAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("underline", toggle);\r
+       }\r
+       private void toggleStrikethroughVisible(Boolean toggle) {\r
+               strikethroughAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("strikethrough", toggle);\r
+       }\r
+       private void toggleLeftAlignVisible(Boolean toggle) {\r
+               leftAlignAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("alignLeft", toggle);\r
+       }\r
+       private void toggleRightAlignVisible(Boolean toggle) {\r
+               rightAlignAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("alignRight", toggle);\r
+       }       \r
+       private void toggleCenterAlignVisible(Boolean toggle) {\r
+               centerAlignAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("alignCenter", toggle);\r
+       }\r
+       private void toggleHLineVisible(Boolean toggle) {\r
+               hlineAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("hline", toggle);\r
+       }\r
+       private void toggleIndentVisible(Boolean toggle) {\r
+               indentAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("indent", toggle);\r
+       }\r
+       private void toggleOutdentVisible(Boolean toggle) {\r
+               outdentAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("outdent", toggle);\r
+       }\r
+       private void toggleBulletListVisible(Boolean toggle) {\r
+               bulletListAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("bulletList", toggle);\r
+       }\r
+       private void toggleNumberListVisible(Boolean toggle) {\r
+               numberListAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("numberList", toggle);\r
+       }\r
+       private void toggleFontListVisible(Boolean toggle) {\r
+               fontListAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("font", toggle);\r
+       }\r
+       private void toggleFontColorVisible(Boolean toggle) {\r
+               fontColorAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("fontColor", toggle);\r
+       }\r
+       private void toggleFontSizeVisible(Boolean toggle) {\r
+               fontSizeAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("fontSize", toggle);\r
+       }\r
+       private void toggleFontHilightVisible(Boolean toggle) {\r
+               fontHilightAction.setVisible(toggle);\r
+               Global.saveEditorButtonsVisible("fontHilight", toggle);\r
+       }\r
+\r
+\r
+\r
+\r
 }\r
diff --git a/src/cx/fbn/nevernote/gui/EditorButtonBar.java b/src/cx/fbn/nevernote/gui/EditorButtonBar.java
new file mode 100644 (file)
index 0000000..1d701af
--- /dev/null
@@ -0,0 +1,82 @@
+package cx.fbn.nevernote.gui;\r
+\r
+import com.trolltech.qt.gui.QAction;\r
+import com.trolltech.qt.gui.QContextMenuEvent;\r
+import com.trolltech.qt.gui.QMenu;\r
+import com.trolltech.qt.gui.QToolBar;\r
+\r
+import cx.fbn.nevernote.Global;\r
+\r
+public class EditorButtonBar extends QToolBar {\r
+       QMenu contextMenu;\r
+       QAction toggleUndoVisible;\r
+       QAction toggleRedoVisible;\r
+       QAction toggleCutVisible;\r
+       QAction toggleCopyVisible;\r
+       QAction toggleCopyBoldVisible;\r
+       QAction togglePasteVisible;\r
+       QAction toggleBoldVisible;\r
+       QAction toggleUnderlineVisible;\r
+       QAction toggleItalicVisible;\r
+       QAction toggleRightAlignVisible;\r
+       QAction toggleLeftAlignVisible;\r
+       QAction toggleCenterAlignVisible;\r
+\r
+       QAction toggleStrikethroughVisible;\r
+       QAction toggleHLineVisible;\r
+       QAction toggleIndentVisible;\r
+       QAction toggleOutdentVisible;\r
+       QAction toggleBulletListVisible;\r
+       QAction toggleNumberListVisible;\r
+       \r
+       QAction toggleFontVisible;\r
+       QAction toggleFontSizeVisible;\r
+       QAction toggleFontColorVisible;\r
+       QAction toggleFontHilight;\r
+       \r
+\r
+\r
+       public EditorButtonBar() {\r
+               contextMenu = new QMenu();\r
+               \r
+               toggleUndoVisible = addAction("undo" ,tr("Undo"));\r
+               toggleRedoVisible = addAction("redo", tr("Redo Change"));\r
+               toggleCutVisible = addAction("cut", tr("Cut"));\r
+               toggleCopyVisible = addAction("copy", tr("Copy"));\r
+               togglePasteVisible = addAction("paste", tr("Paste"));\r
+               toggleBoldVisible = addAction("bold", tr("Bold"));\r
+               toggleItalicVisible = addAction("italic", tr("Italic"));\r
+               toggleUnderlineVisible = addAction("underline", tr("Underline"));\r
+               toggleStrikethroughVisible = addAction("strikethrough", tr("Strikethrough"));\r
+\r
+               toggleLeftAlignVisible = addAction("alignLeft", tr("Left Align"));\r
+               toggleCenterAlignVisible = addAction("alignCenter", tr("Center Align"));\r
+               toggleRightAlignVisible = addAction("alignRight", tr("Right Align"));\r
+\r
+               toggleHLineVisible = addAction("hline", tr("Insert Horizontal Line"));\r
+               toggleIndentVisible = addAction("indent", tr("Shift Right"));\r
+               toggleOutdentVisible = addAction("outdent", tr("Shift Left"));\r
+               toggleBulletListVisible = addAction("bulletList", tr("Bullet List"));\r
+               toggleNumberListVisible = addAction("numberList", tr("Number List"));\r
+\r
+               toggleFontVisible = addAction("font", "Font");\r
+               toggleFontSizeVisible = addAction("fontSize", "Font Size");\r
+               toggleFontColorVisible = addAction("fontColor", "Font Color");\r
+               toggleFontHilight = addAction("fontHilight", "Font Hilight");\r
+       }\r
+       \r
+       \r
+       private QAction addAction(String config, String name) {\r
+               QAction newAction = new QAction(this);\r
+               newAction.setText(name);\r
+               newAction.setCheckable(true);\r
+               newAction.setChecked(Global.isEditorButtonVisible(config));\r
+               contextMenu.addAction(newAction);\r
+               return newAction;\r
+       }\r
+       \r
+       @Override\r
+       public void contextMenuEvent(QContextMenuEvent event) {\r
+               contextMenu.exec(event.globalPos());\r
+       }\r
+}\r