[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra] krita/plugins/extensions/dockers/defaultdockers:
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2011-08-01 10:13:34
Message-ID: 20110801101334.1DA7EA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit a7f4f4fa91f8a039a19a21b0c6fa8c8e4fc34617 by Boudewijn Rempt.
Committed on 01/08/2011 at 12:11.
Pushed by rempt into branch 'master'.

Layerbox: go back to one add node button

But make the button a drop target anyway.

M  +11   -0    krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.h
M  +58   -30   krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.cpp
M  +50   -377  krita/plugins/extensions/dockers/defaultdockers/wdglayerbox.ui

http://commits.kde.org/calligra/a7f4f4fa91f8a039a19a21b0c6fa8c8e4fc34617

diff --git a/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.cpp \
b/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.cpp index \
                ce2d050..591d937 100644
--- a/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.cpp
+++ b/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.cpp
@@ -115,6 +115,8 @@ KisLayerBox::KisLayerBox()
     }
     actions[1]->trigger(); //TODO save/load previous state
 
+    m_wdgLayerBox->bnAdd->setIcon(BarIcon("list-add"));
+
     m_wdgLayerBox->bnViewMode->setMenu(m_viewModeMenu);
     m_wdgLayerBox->bnViewMode->setPopupMode(QToolButton::InstantPopup);
     m_wdgLayerBox->bnViewMode->setIcon(KIcon("view-choose"));
@@ -160,33 +162,54 @@ KisLayerBox::KisLayerBox()
     connect(&m_delayTimer, SIGNAL(timeout()), SLOT(slotOpacityChanged()));
 
     connect(m_wdgLayerBox->cmbComposite, SIGNAL(activated(int)), \
SLOT(slotCompositeOpChanged(int))); +    connect(m_wdgLayerBox->bnAdd, \
SIGNAL(clicked()), SLOT(slotNewPaintLayer())); +
+    m_newPainterLayerAction = new KAction(KIcon("document-new"), i18n("&Paint \
Layer"), this); +    connect(m_newPainterLayerAction, SIGNAL(triggered(bool)), this, \
SLOT(slotNewPaintLayer())); +
+    m_newGroupLayerAction = new KAction(KIcon("folder-new"), i18n("&Group Layer"), \
this); +    connect(m_newGroupLayerAction, SIGNAL(triggered(bool)), this, \
SLOT(slotNewGroupLayer())); +
+    m_newCloneLayerAction = new KAction(KIcon("edit-copy"), i18n("&Clone Layer"), \
this); +    connect(m_newCloneLayerAction, SIGNAL(triggered(bool)), this, \
SLOT(slotNewCloneLayer())); +
+    m_newShapeLayerAction = new KAction(KIcon("bookmark-new"), i18n("&Shape Layer"), \
this); +    connect(m_newShapeLayerAction, SIGNAL(triggered(bool)), this, \
SLOT(slotNewShapeLayer())); +
+    m_newAdjustmentLayerAction = new KAction(KIcon("view-filter"), i18n("&Filter \
Layer..."), this); +    connect(m_newAdjustmentLayerAction, SIGNAL(triggered(bool)), \
this, SLOT(slotNewAdjustmentLayer())); +
+    m_newGeneratorLayerAction = new KAction(KIcon("view-filter"), i18n("&Generated \
Layer..."), this); +    connect(m_newGeneratorLayerAction, SIGNAL(triggered(bool)), \
this, SLOT(slotNewGeneratorLayer())); +
+    m_newTransparencyMaskAction = new KAction(KIcon("edit-copy"), \
i18n("&Transparency Mask"), this); +    connect(m_newTransparencyMaskAction, \
SIGNAL(triggered(bool)), this, SLOT(slotNewTransparencyMask())); +
+    m_newEffectMaskAction = new KAction(KIcon("bookmarks"), i18n("&Filter Mask..."), \
this); +    connect(m_newEffectMaskAction, SIGNAL(triggered(bool)), this, \
SLOT(slotNewEffectMask())); +
+    m_newSelectionMaskAction = new KAction(KIcon("edit-paste"), i18n("&Local \
Selection"), this); +    connect(m_newSelectionMaskAction, SIGNAL(triggered(bool)), \
this, SLOT(slotNewSelectionMask())); +
+    m_newLayerMenu = new KMenu(this);
+    m_wdgLayerBox->bnAdd->setMenu(m_newLayerMenu);
+    m_wdgLayerBox->bnAdd->setPopupMode(QToolButton::MenuButtonPopup);
+
+    m_newLayerMenu->addAction(m_newPainterLayerAction);
+    m_newLayerMenu->addAction(m_newGroupLayerAction);
+    m_newLayerMenu->addAction(m_newCloneLayerAction);
+    m_newLayerMenu->addAction(m_newShapeLayerAction);
+    m_newLayerMenu->addAction(m_newAdjustmentLayerAction);
+    m_newLayerMenu->addAction(m_newGeneratorLayerAction);
+    m_newLayerMenu->addSeparator();
+    m_newLayerMenu->addAction(m_newTransparencyMaskAction);
+    m_newLayerMenu->addAction(m_newEffectMaskAction);
+#if 0 // XXX_2.0
+    m_newLayerMenu->addAction(KIcon("view-filter"), i18n("&Transformation Mask..."), \
this, SLOT(slotNewTransformationMa +    sk()));
+#endif
+    m_newLayerMenu->addAction(m_newSelectionMaskAction);
 
-    m_wdgLayerBox->bnAddPaintLayer->setIcon(BarIcon("document-new"));
-    connect(m_wdgLayerBox->bnAddPaintLayer, SIGNAL(clicked()), \
                SLOT(slotNewPaintLayer()));
-    
-    m_wdgLayerBox->bnAddGroupLayer->setIcon(BarIcon("folder-new"));
-    connect(m_wdgLayerBox->bnAddGroupLayer, SIGNAL(clicked()), \
                SLOT(slotNewGroupLayer()));
-    
-    m_wdgLayerBox->bnAddCloneLayer->setIcon(BarIcon("edit-copy"));
-    connect(m_wdgLayerBox->bnAddCloneLayer, SIGNAL(clicked()), \
                SLOT(slotNewCloneLayer()));
-    
-    m_wdgLayerBox->bnAddShapeLayer->setIcon(BarIcon("bookmaer-new"));
-    connect(m_wdgLayerBox->bnAddShapeLayer, SIGNAL(clicked()), \
                SLOT(slotNewShapeLayer()));
-    
-    m_wdgLayerBox->bnAddFilterLayer->setIcon(BarIcon("view-filter"));
-    connect(m_wdgLayerBox->bnAddFilterLayer, SIGNAL(clicked()), \
                SLOT(slotNewAdjustmentLayer()));
-    
-    m_wdgLayerBox->bnAddGeneratedLayer->setIcon(BarIcon("view-filter"));
-    connect(m_wdgLayerBox->bnAddGeneratedLayer, SIGNAL(clicked()), \
                SLOT(slotNewGeneratorLayer()));
-    
-    m_wdgLayerBox->bnAddTransparencyMask->setIcon(BarIcon("edit-copy"));
-    connect(m_wdgLayerBox->bnAddTransparencyMask, SIGNAL(clicked()), \
                SLOT(slotNewTransparencyMask()));
-    
-    m_wdgLayerBox->bnAddFilterMask->setIcon(BarIcon("bookmarks"));
-    connect(m_wdgLayerBox->bnAddFilterMask, SIGNAL(clicked()), \
                SLOT(slotNewEffectMask()));
-    
-    m_wdgLayerBox->bnAddLocalSelectionMask->setIcon(BarIcon("edit-paste"));
-    connect(m_wdgLayerBox->bnAddLocalSelectionMask, SIGNAL(clicked()), \
SLOT(slotNewSelectionMask()));  
     m_nodeModel = new KisNodeModel(this);
 
@@ -304,10 +327,11 @@ void KisLayerBox::updateUI()
             slotSetCompositeOp(l->compositeOp());
         }
     }
-    m_wdgLayerBox->bnAddTransparencyMask->setEnabled(active);
-    m_wdgLayerBox->bnAddFilterMask->setEnabled(active);
-    m_wdgLayerBox->bnAddLocalSelectionMask->setEnabled(active);
-    m_wdgLayerBox->bnAddCloneLayer->setEnabled(active && \
!active->inherits("KisGroupLayer")); +    \
m_newTransparencyMaskAction->setEnabled(active); +    \
m_newEffectMaskAction->setEnabled(active); +    \
m_newSelectionMaskAction->setEnabled(active); +    \
m_newCloneLayerAction->setEnabled(active && !active->inherits("KisGroupLayer")); +
 }
 
 void KisLayerBox::setCurrentNode(KisNodeSP node)
@@ -356,6 +380,10 @@ void KisLayerBox::slotContextMenuRequested(const QPoint &pos, \
                const QModelIndex
         if (!index.sibling(index.row() + 1, 0).isValid()) \
mergeLayerDown->setEnabled(false);  menu.addSeparator();
     }
+    menu.addSeparator();
+    menu.addAction(m_newTransparencyMaskAction);
+    menu.addAction(m_newEffectMaskAction);
+    menu.addAction(m_newSelectionMaskAction);
 
     menu.exec(pos);
 }
diff --git a/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.h \
b/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.h index \
                0564fc1..1d3a0e4 100644
--- a/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.h
+++ b/krita/plugins/extensions/dockers/defaultdockers/kis_layer_box.h
@@ -119,6 +119,17 @@ private:
     Ui_WdgLayerBox* m_wdgLayerBox;
     QTimer m_delayTimer;
     int m_newOpacity;
+
+    KAction* m_newPainterLayerAction;
+    KAction* m_newGroupLayerAction;
+    KAction* m_newCloneLayerAction;
+    KAction* m_newShapeLayerAction;
+    KAction* m_newAdjustmentLayerAction;
+    KAction* m_newGeneratorLayerAction;
+    KAction* m_newTransparencyMaskAction;
+    KAction* m_newEffectMaskAction;
+    KAction* m_newSelectionMaskAction;
+
 };
 
 class KisLayerBoxFactory : public KoDockFactoryBase
diff --git a/krita/plugins/extensions/dockers/defaultdockers/wdglayerbox.ui \
b/krita/plugins/extensions/dockers/defaultdockers/wdglayerbox.ui index \
                aeafc93..d64205a 100644
--- a/krita/plugins/extensions/dockers/defaultdockers/wdglayerbox.ui
+++ b/krita/plugins/extensions/dockers/defaultdockers/wdglayerbox.ui
@@ -54,6 +54,34 @@
        </property>
       </widget>
      </item>
+     <item>
+      <widget class="QToolButton" name="bnViewMode">
+       <property name="minimumSize">
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>16</width>
+         <height>16</height>
+        </size>
+       </property>
+       <property name="autoRaise">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
    <item row="1" column="0">
@@ -68,374 +96,6 @@
        </property>
       </widget>
      </item>
-     <item>
-      <layout class="QVBoxLayout" name="verticalLayout">
-       <item>
-        <widget class="QToolButton" name="bnViewMode">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="Line" name="line_2">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddPaintLayer">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a New Paint Layer</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a New Paint Layer. Press to create an empty paint layer. Drop \
an existing layer or mask to create a new paint layer based on the layer or \
                mask.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddGroupLayer">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a Group Layer</string>
-         </property>
-         <property name="statusTip">
-          <string/>
-         </property>
-         <property name="whatsThis">
-          <string>Add a Group Layer. Press to create an empty group layer, or drop a \
                layer to create a new group containing that layer.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddFilterLayer">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a Filter Layer</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a Filter Layer. Press to create an empty filter layer or a \
filter layer with the current selection. Drop a layer or mask to create a filter \
                layer based on that layer or mask.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddCloneLayer">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a Clone Layer</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a Clone Layer. Press to clone the current layer, or drop any \
                layer to create a clone.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddGeneratedLayer">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a Generated Layer</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a Generated Layer. Press to create an empty generated layer or \
a generated layer with the current selection. Drop a layer or mask to create a \
                generated layer based on that layer or mask.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddShapeLayer">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Create a new Shape Layer</string>
-         </property>
-         <property name="whatsThis">
-          <string>Create a new Shape Layer. Shape layers contain vector objects such \
as text or vector graphics. Drop vector objects from the shape selector on the canvas \
                after selecting a shape layer.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="Line" name="line">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddTransparencyMask">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a Transparency Mask</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a New Transparency Mask. Press to create an empty transparency \
mask or a transparency mask based on the current global selection. Drop a layer or \
mask to create a new transparency mask based on a layer, a layer's channels or the \
                mask.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddFilterMask">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a Filter Mask</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a Filter Mask. Press to create an empty filter mask or a \
filter mask with the current selection. Drop a layer or mask to create a filter mask \
                based on that layer or mask.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KisDropButton" name="bnAddLocalSelectionMask">
-         <property name="minimumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="maximumSize">
-          <size>
-           <width>22</width>
-           <height>22</height>
-          </size>
-         </property>
-         <property name="toolTip">
-          <string>Add a New Local Selection Mask</string>
-         </property>
-         <property name="whatsThis">
-          <string>Add a New Local Selection Mask. Press to create an empty local \
selection or a local selection based on the current global selection. Drop a layer or \
mask to create a new local selection based on a layer, a layer's channels or the \
                mask.</string>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-         <property name="iconSize">
-          <size>
-           <width>16</width>
-           <height>16</height>
-          </size>
-         </property>
-         <property name="autoRaise">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>40</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-      </layout>
-     </item>
     </layout>
    </item>
    <item row="2" column="0">
@@ -444,6 +104,28 @@
       <number>0</number>
      </property>
      <item>
+      <widget class="KisDropButton" name="bnAdd">
+       <property name="minimumSize">
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="autoRaise">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
       <widget class="QToolButton" name="bnDuplicate">
        <property name="minimumSize">
         <size>
@@ -669,15 +351,6 @@
  </customwidgets>
  <tabstops>
   <tabstop>cmbComposite</tabstop>
-  <tabstop>bnAddLocalSelectionMask</tabstop>
-  <tabstop>bnAddFilterMask</tabstop>
-  <tabstop>bnAddTransparencyMask</tabstop>
-  <tabstop>bnAddShapeLayer</tabstop>
-  <tabstop>bnAddGeneratedLayer</tabstop>
-  <tabstop>bnAddCloneLayer</tabstop>
-  <tabstop>bnAddFilterLayer</tabstop>
-  <tabstop>bnAddGroupLayer</tabstop>
-  <tabstop>bnAddPaintLayer</tabstop>
   <tabstop>bnDuplicate</tabstop>
   <tabstop>bnLower</tabstop>
   <tabstop>bnRaise</tabstop>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic