[Libreoffice-commits] core.git: cui/source cui/uiconfig

Muhammet Kara muhammet.kara at pardus.org.tr
Wed Sep 7 15:21:22 UTC 2016


 cui/source/customize/cfg.cxx      |   72 ++++++++++++++++++++++++--------------
 cui/source/customize/cfg.hrc      |    1 
 cui/source/customize/cfg.src      |    5 --
 cui/source/inc/cfg.hxx            |    3 +
 cui/uiconfig/ui/menuassignpage.ui |   24 +++++++-----
 5 files changed, 64 insertions(+), 41 deletions(-)

New commits:
commit 3b3feeff98385bccce14b83bf32f079f624550c6
Author: Muhammet Kara <muhammet.kara at pardus.org.tr>
Date:   Mon Sep 5 16:36:59 2016 +0300

    tdf#82840 Add 'Add Separator' button to toolbar customization
    
    Add 'Add Separator' button to the 'Customize' dialog's
    'Menus', 'Context Menus', and 'Toolbars' tabs. And remove the
    'Add Separator' item from the 'Modify' menu.
    
    In the following commits, more widgets will be added
    and moved around to achieve the suggested appearance
    and functionality in the related bug report.
    
    Change-Id: I1961e2ebeb326eca69d8f967b2b636793200aba0
    Reviewed-on: https://gerrit.libreoffice.org/28681
    Tested-by: Jenkins <ci at libreoffice.org>
    Tested-by: Yousuf Philips <philipz85 at hotmail.com>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index ff6a74c..1490215 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1749,6 +1749,7 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet)
     get(m_pContents, "contents");
     get(m_pContentsLabel, "contentslabel");
     get(m_pAddCommandsButton, "add");
+    get(m_pAddSeparatorButton, "addseparatorbtn");
     get(m_pModifyCommandButton, "modify");
     get(m_pDeleteCommandButton, "deletebtn");
     get(m_pResetTopLevelButton, "resetbtn");
@@ -1786,6 +1787,7 @@ void SvxConfigPage::dispose()
     m_pContentsLabel.clear();
     m_pEntries.clear();
     m_pAddCommandsButton.clear();
+    m_pAddSeparatorButton.clear();
     m_pModifyCommandButton.clear();
     m_pDeleteCommandButton.clear();
     m_pResetTopLevelButton.clear();
@@ -2440,6 +2442,9 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe
     m_pAddCommandsButton->SetClickHdl  (
         LINK( this, SvxMenuConfigPage, AddCommandsHdl ) );
 
+    m_pAddSeparatorButton->SetClickHdl  (
+        LINK( this, SvxMenuConfigPage, AddSeparatorHdl ) );
+
     m_pDeleteCommandButton->SetClickHdl  (
         LINK( this, SvxMenuConfigPage, DeleteCommandHdl ) );
 
@@ -2512,8 +2517,8 @@ void SvxMenuConfigPage::UpdateButtonStates()
         m_pMoveUpButton->Enable( false );
         m_pMoveDownButton->Enable( false );
         m_pDeleteCommandButton->Enable(false);
+        m_pAddSeparatorButton->Enable();
 
-        pPopup->EnableItem( "addseparator" );
         pPopup->EnableItem( "modrename", false );
 
         m_pDescriptionField->SetText("");
@@ -2532,19 +2537,19 @@ void SvxMenuConfigPage::UpdateButtonStates()
 
     if ( pEntryData->IsSeparator() )
     {
-        pPopup->EnableItem( "addseparator", false );
         pPopup->EnableItem( "modrename", false );
 
         m_pDescriptionField->SetText("");
 
+        m_pAddSeparatorButton->Enable( false );
         m_pDeleteCommandButton->Enable();
     }
     else
     {
-        pPopup->EnableItem( "addseparator" );
         pPopup->EnableItem( "modrename" );
 
         m_pDeleteCommandButton->Enable();
+        m_pAddSeparatorButton->Enable();
 
         m_pDescriptionField->SetText(pEntryData->GetHelpText());
     }
@@ -2620,6 +2625,7 @@ IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, SelectMenu, ListBox&, void )
     m_pModifyTopLevelButton->Enable( pMenuData != nullptr );
     m_pModifyCommandButton->Enable( pMenuData != nullptr );
     m_pAddCommandsButton->Enable( pMenuData != nullptr );
+    m_pAddSeparatorButton->Enable( pMenuData != nullptr );
 
     PopupMenu* pPopup = m_pModifyTopLevelButton->GetPopupMenu();
     if ( pMenuData )
@@ -2714,12 +2720,6 @@ IMPL_LINK_TYPED( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void
             GetSaveInData()->SetModified();
         }
     }
-    else if (sIdent == "addseparator")
-    {
-        SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
-        pNewEntryData->SetUserDefined();
-        InsertEntry( pNewEntryData );
-    }
     else if (sIdent == "modrename")
     {
         SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry();
@@ -2793,6 +2793,18 @@ IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, AddCommandsHdl, Button *, void )
     m_pSelectorDlg->Execute();
 }
 
+IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, AddSeparatorHdl, Button *, void )
+{
+    SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
+    pNewEntryData->SetUserDefined();
+    InsertEntry( pNewEntryData );
+
+    if ( GetSaveInData()->IsModified() )
+    {
+        UpdateButtonStates();
+    }
+}
+
 IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, DeleteCommandHdl, Button *, void )
 {
     DeleteSelectedContent();
@@ -3121,6 +3133,9 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
     m_pAddCommandsButton->SetClickHdl  (
         LINK( this, SvxToolbarConfigPage, AddCommandsHdl ) );
 
+    m_pAddSeparatorButton->SetClickHdl  (
+        LINK( this, SvxToolbarConfigPage, AddSeparatorHdl ) );
+
     m_pDeleteCommandButton->SetClickHdl  (
         LINK( this, SvxToolbarConfigPage, DeleteCommandHdl ) );
 
@@ -3452,20 +3467,6 @@ IMPL_LINK_TYPED( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, vo
             }
             break;
         }
-        case ID_BEGIN_GROUP:
-        {
-            SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
-            pNewEntryData->SetUserDefined();
-
-            SvTreeListEntry* pNewLBEntry = InsertEntry( pNewEntryData );
-
-            m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
-            m_pContentsListBox->SetCheckButtonState(
-                pNewLBEntry, SvButtonState::Tristate );
-
-            bNeedsApply = true;
-            break;
-        }
         case ID_ICON_ONLY:
         {
             break;
@@ -4469,7 +4470,6 @@ void SvxToolbarConfigPage::UpdateButtonStates()
 {
     PopupMenu* pPopup = m_pModifyCommandButton->GetPopupMenu();
     pPopup->EnableItem( ID_RENAME, false );
-    pPopup->EnableItem( ID_BEGIN_GROUP, false );
     pPopup->EnableItem( ID_DEFAULT_COMMAND, false );
     pPopup->EnableItem( ID_ICON_ONLY, false );
     pPopup->EnableItem( ID_ICON_AND_TEXT, false );
@@ -4477,7 +4477,8 @@ void SvxToolbarConfigPage::UpdateButtonStates()
     pPopup->EnableItem( ID_CHANGE_SYMBOL, false );
     pPopup->EnableItem( ID_RESET_SYMBOL, false );
 
-    m_pDeleteCommandButton->Enable(false);
+    m_pDeleteCommandButton->Enable( false );
+    m_pAddSeparatorButton->Enable( false );
 
     m_pDescriptionField->SetText("");
 
@@ -4494,7 +4495,6 @@ void SvxToolbarConfigPage::UpdateButtonStates()
     }
     else
     {
-        pPopup->EnableItem( ID_BEGIN_GROUP );
         pPopup->EnableItem( ID_RENAME );
         pPopup->EnableItem( ID_ICON_ONLY );
         pPopup->EnableItem( ID_ICON_AND_TEXT );
@@ -4502,6 +4502,7 @@ void SvxToolbarConfigPage::UpdateButtonStates()
         pPopup->EnableItem( ID_CHANGE_SYMBOL );
 
         m_pDeleteCommandButton->Enable();
+        m_pAddSeparatorButton->Enable();
 
         if ( !pEntryData->IsUserDefined() )
             pPopup->EnableItem( ID_DEFAULT_COMMAND );
@@ -4537,6 +4538,7 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void )
         m_pModifyTopLevelButton->Enable( false );
         m_pModifyCommandButton->Enable( false );
         m_pAddCommandsButton->Enable( false );
+        m_pAddSeparatorButton->Enable( false );
         m_pDeleteCommandButton->Enable( false );
         m_pResetTopLevelButton->Enable( false );
 
@@ -4677,6 +4679,24 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, AddCommandsHdl, Button *, void )
     m_pSelectorDlg->Execute();
 }
 
+IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, AddSeparatorHdl, Button *, void )
+{
+    // get currently selected toolbar
+    SvxConfigEntry* pToolbar = GetTopLevelSelection();
+
+    SvxConfigEntry* pNewEntryData = new SvxConfigEntry;
+    pNewEntryData->SetUserDefined();
+
+    SvTreeListEntry* pNewLBEntry = InsertEntry( pNewEntryData );
+
+    m_pContentsListBox->SetCheckButtonInvisible( pNewLBEntry );
+    m_pContentsListBox->SetCheckButtonState(
+        pNewLBEntry, SvButtonState::Tristate );
+
+    static_cast<ToolbarSaveInData*>( GetSaveInData())->ApplyToolbar( pToolbar );
+    UpdateButtonStates();
+}
+
 IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, DeleteCommandHdl, Button *, void )
 {
     DeleteSelectedContent();
diff --git a/cui/source/customize/cfg.hrc b/cui/source/customize/cfg.hrc
index 496b8cf..486206f 100644
--- a/cui/source/customize/cfg.hrc
+++ b/cui/source/customize/cfg.hrc
@@ -23,7 +23,6 @@
 #define ID_MOVE (43 + CFG_OFFSET)
 #define ID_DELETE (44 + CFG_OFFSET)
 
-#define ID_BEGIN_GROUP (46 + CFG_OFFSET)
 // There is a gap here
 #define ID_ICONS_ONLY (48 + CFG_OFFSET)
 #define ID_ICONS_AND_TEXT (49 + CFG_OFFSET)
diff --git a/cui/source/customize/cfg.src b/cui/source/customize/cfg.src
index fd0b565..d09241d 100644
--- a/cui/source/customize/cfg.src
+++ b/cui/source/customize/cfg.src
@@ -88,11 +88,6 @@ Menu MODIFY_TOOLBAR_CONTENT
         };
         MenuItem
         {
-            Identifier = ID_BEGIN_GROUP ;
-            Text [ en-US ] = "Add Separator" ;
-        };
-        MenuItem
-        {
             Separator = TRUE ;
         };
         MenuItem
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index f17175e..eb7a2d7 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -375,6 +375,7 @@ protected:
     VclPtr<SvTreeListBox>                      m_pContentsListBox;
 
     VclPtr<PushButton>                         m_pAddCommandsButton;
+    VclPtr<PushButton>                         m_pAddSeparatorButton;
     VclPtr<MenuButton>                         m_pModifyCommandButton;
     VclPtr<PushButton>                         m_pDeleteCommandButton;
     // Resets the top level toolbar to default settings
@@ -477,6 +478,7 @@ private:
     DECL_LINK_TYPED( MenuSelectHdl, MenuButton *, void );
     DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void );
     DECL_LINK_TYPED( AddCommandsHdl, Button *, void );
+    DECL_LINK_TYPED( AddSeparatorHdl, Button *, void );
     DECL_LINK_TYPED( DeleteCommandHdl, Button *, void );
     DECL_LINK_TYPED( AddFunctionHdl, SvxScriptSelectorDialog&, void );
 
@@ -570,6 +572,7 @@ private:
     DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void );
     DECL_LINK_TYPED( NewToolbarHdl, Button *, void );
     DECL_LINK_TYPED( AddCommandsHdl, Button *, void );
+    DECL_LINK_TYPED( AddSeparatorHdl, Button *, void );
     DECL_LINK_TYPED( DeleteCommandHdl, Button *, void );
     DECL_LINK_TYPED( ResetTopLevelHdl, Button *, void );
     DECL_LINK_TYPED( AddFunctionHdl, SvxScriptSelectorDialog&, void );
diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui
index f131925..03f46d5 100644
--- a/cui/uiconfig/ui/menuassignpage.ui
+++ b/cui/uiconfig/ui/menuassignpage.ui
@@ -369,7 +369,7 @@
                         <property name="layout_style">start</property>
                         <child>
                           <object class="GtkButton" id="add">
-                            <property name="label" translatable="yes">Add...</property>
+                            <property name="label" translatable="yes">Add Command</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
@@ -381,6 +381,20 @@
                             <property name="position">0</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkButton" id="addseparatorbtn">
+                            <property name="label" translatable="yes">Add Separator</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -526,14 +540,6 @@
       </object>
     </child>
     <child>
-      <object class="GtkMenuItem" id="addseparator">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">Add Separator</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
       <object class="GtkSeparatorMenuItem" id="menuitem4">
         <property name="visible">True</property>
         <property name="can_focus">False</property>


More information about the Libreoffice-commits mailing list