[Libreoffice-commits] core.git: Branch 'feature/calc-pluggable-opencl' - 5 commits - officecfg/registry sc/inc sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Sep 13 08:48:21 PDT 2013


 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |    7 ++
 sc/inc/calcconfig.hxx                                    |    1 
 sc/source/core/tool/calcconfig.cxx                       |    6 +-
 sc/source/core/tool/formulaopt.cxx                       |   21 ++++++--
 sc/source/ui/optdlg/calcoptionsdlg.cxx                   |   39 +++++++++++----
 sc/source/ui/optdlg/calcoptionsdlg.hxx                   |    2 
 6 files changed, 62 insertions(+), 14 deletions(-)

New commits:
commit d92548c8621e11a59a77fc1bb9466715fc067c40
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 13 17:39:19 2013 +0200

    fix some updating problems in the opencl auto select dialog
    
    Change-Id: I2ddddbd694a0fe4971a1ef40ee6e15e6b3f07b3f

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 43a0410..f2b91f8 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -233,6 +233,9 @@ void ScCalcOptionsDialog::FillOptionsList()
 #if HAVE_FEATURE_OPENCL
     pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
     fillOpenclList();
+
+    mpBtnAutomaticSelectionFalse->Check(!maConfig.mbOpenCLAutoSelect);
+    mpBtnAutomaticSelectionTrue->Check(maConfig.mbOpenCLAutoSelect);
 #endif
 
     mpLbSettings->SetUpdateMode(true);
@@ -367,9 +370,10 @@ void ScCalcOptionsDialog::RadioValueChanged()
         case CALC_OPTION_ENABLE_OPENCL:
             maConfig.mbOpenCLEnabled = bValue;
             if(bValue)
-                mpOpenclInfoList->GetParent()->Disable();
-            else
                 mpOpenclInfoList->GetParent()->Enable();
+            else
+                mpOpenclInfoList->GetParent()->Disable();
+            OpenclAutomaticSelectionChanged();
             break;
     }
 
commit 2914f05f7900c876e9120ac204eee7c3eff9b5ac
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 13 17:18:52 2013 +0200

    enable the opencl device selection also after enabling opencl again
    
    Change-Id: If898125c55794ea542643d0299b02b6183b79ef9

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 76871cb..43a0410 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -366,6 +366,10 @@ void ScCalcOptionsDialog::RadioValueChanged()
             break;
         case CALC_OPTION_ENABLE_OPENCL:
             maConfig.mbOpenCLEnabled = bValue;
+            if(bValue)
+                mpOpenclInfoList->GetParent()->Disable();
+            else
+                mpOpenclInfoList->GetParent()->Enable();
             break;
     }
 
commit 13936f50924c66e2b013bf0326a6d181afa9cf67
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 13 16:57:56 2013 +0200

    store opencl auto select setting in configuration
    
    Change-Id: I687b31959b2932cc1b5f7ce6daea8d7bbbe85ee5

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index ada4416..5950597 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1337,6 +1337,13 @@
           </info>
           <value>false</value>
         </prop>
+        <prop oor:name="OpenCLAutoSelect" oor:type="xs:boolean" oor:nillable="false">
+          <!-- UIHints: Tools - Options  Spreadsheet  Formula -->
+          <info>
+            <desc>Whether to automatically select the OpenCL device</desc>
+          </info>
+          <value>true</value>
+        </prop>
       </group>
       <group oor:name="Syntax">
         <info>
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index aace08d..1477874 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -29,6 +29,7 @@ struct SC_DLLPUBLIC ScCalcConfig
     formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax;
     bool mbEmptyStringAsZero:1;
     bool mbOpenCLEnabled:1;
+    bool mbOpenCLAutoSelect:1;
 
     ScCalcConfig();
 
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 896e009..1278402 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -12,7 +12,8 @@
 ScCalcConfig::ScCalcConfig() :
     meStringRefAddressSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED),
     mbEmptyStringAsZero(false),
-    mbOpenCLEnabled(false)
+    mbOpenCLEnabled(false),
+    mbOpenCLAutoSelect(true)
 {
 }
 
@@ -25,7 +26,8 @@ bool ScCalcConfig::operator== (const ScCalcConfig& r) const
 {
     return meStringRefAddressSyntax == r.meStringRefAddressSyntax &&
            mbEmptyStringAsZero == r.mbEmptyStringAsZero &&
-           mbOpenCLEnabled == r.mbOpenCLEnabled;
+           mbOpenCLEnabled == r.mbOpenCLEnabled &&
+           mbOpenCLAutoSelect == r.mbOpenCLAutoSelect;
 }
 
 bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index 0868fd2..bf6b385 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -196,7 +196,8 @@ SfxPoolItem* ScTpFormulaItem::Clone( SfxItemPool * ) const
 #define SCFORMULAOPT_OOXML_RECALC         7
 #define SCFORMULAOPT_ODF_RECALC           8
 #define SCFORMULAOPT_OPENCL_ENABLED       9
-#define SCFORMULAOPT_COUNT               10
+#define SCFORMULAOPT_OPENCL_AUTOSELECT   10
+#define SCFORMULAOPT_COUNT               11
 
 Sequence<OUString> ScFormulaCfg::GetPropertyNames()
 {
@@ -211,7 +212,8 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames()
         "Syntax/EmptyStringAsZero",      // SCFORMULAOPT_EMPTY_STRING_AS_ZERO
         "Load/OOXMLRecalcMode",          // SCFORMULAOPT_OOXML_RECALC
         "Load/ODFRecalcMode",            // SCFORMULAOPT_ODF_RECALC
-        "Calculation/OpenCL"             // SCFORMULAOPT_OPENCL_ENABLED
+        "Calculation/OpenCL",            // SCFORMULAOPT_OPENCL_ENABLED
+        "Calculation/OpenCLAutoSelect"   // SCFORMULAOPT_OPENCL_AUTOSELECT
     };
     Sequence<OUString> aNames(SCFORMULAOPT_COUNT);
     OUString* pNames = aNames.getArray();
@@ -224,7 +226,7 @@ Sequence<OUString> ScFormulaCfg::GetPropertyNames()
 ScFormulaCfg::PropsToIds ScFormulaCfg::GetPropNamesToId()
 {
     Sequence<OUString> aPropNames = GetPropertyNames();
-    static sal_uInt16 aVals[] = { SCFORMULAOPT_GRAMMAR, SCFORMULAOPT_ENGLISH_FUNCNAME, SCFORMULAOPT_SEP_ARG, SCFORMULAOPT_SEP_ARRAY_ROW, SCFORMULAOPT_SEP_ARRAY_COL, SCFORMULAOPT_STRING_REF_SYNTAX, SCFORMULAOPT_EMPTY_STRING_AS_ZERO, SCFORMULAOPT_OOXML_RECALC, SCFORMULAOPT_ODF_RECALC, SCFORMULAOPT_OPENCL_ENABLED };
+    static sal_uInt16 aVals[] = { SCFORMULAOPT_GRAMMAR, SCFORMULAOPT_ENGLISH_FUNCNAME, SCFORMULAOPT_SEP_ARG, SCFORMULAOPT_SEP_ARRAY_ROW, SCFORMULAOPT_SEP_ARRAY_COL, SCFORMULAOPT_STRING_REF_SYNTAX, SCFORMULAOPT_EMPTY_STRING_AS_ZERO, SCFORMULAOPT_OOXML_RECALC, SCFORMULAOPT_ODF_RECALC, SCFORMULAOPT_OPENCL_ENABLED, SCFORMULAOPT_OPENCL_AUTOSELECT };
     OSL_ENSURE( SAL_N_ELEMENTS(aVals) == aPropNames.getLength(), "Properties and ids are out of Sync");
     PropsToIds aPropIdMap;
     for ( sal_uInt16 i=0; i<aPropNames.getLength(); ++i )
@@ -409,6 +411,13 @@ void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
                     pValues[nProp] >>= bVal;
                     GetCalcConfig().mbOpenCLEnabled = bVal;
                 }
+                break;
+                case SCFORMULAOPT_OPENCL_AUTOSELECT:
+                {
+                    sal_Bool bVal = GetCalcConfig().mbOpenCLAutoSelect;
+                    pValues[nProp] >>= bVal;
+                    GetCalcConfig().mbOpenCLAutoSelect = bVal;
+                }
                 default:
                     ;
                 }
@@ -517,6 +526,12 @@ void ScFormulaCfg::Commit()
                 pValues[nProp] <<= bVal;
             }
             break;
+            case SCFORMULAOPT_OPENCL_AUTOSELECT:
+            {
+                sal_Bool bVal = GetCalcConfig().mbOpenCLAutoSelect;
+                pValues[nProp] <<= bVal;
+            }
+            break;
             default:
                 ;
         }
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 4ac8b91..76871cb 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -349,6 +349,8 @@ void ScCalcOptionsDialog::OpenclAutomaticSelectionChanged()
         mpOpenclInfoList->Disable();
     else
         mpOpenclInfoList->Enable();
+
+    maConfig.mbOpenCLAutoSelect = bValue;
 }
 
 void ScCalcOptionsDialog::RadioValueChanged()
commit ea8ef8b47eeb018a9dea051bd8dba7f9b9db18b4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 13 14:41:51 2013 +0200

    display platform and device together
    
    Change-Id: Iebe13dae8ede0696913597116904af8e720ffc65

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index f13c578..4ac8b91 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -199,18 +199,10 @@ void ScCalcOptionsDialog::fillOpenclList()
     for(std::vector<sc::OpenclPlatformInfo>::const_iterator it = aPlatformInfo.begin(),
             itEnd = aPlatformInfo.end(); it != itEnd; ++it)
     {
-        SvTreeListEntry* pEntry = new SvTreeListEntry;
-        pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), 0));
-        pEntry->AddItem(new SvLBoxString(pEntry, 0, it->maVendor));
-        mpOpenclInfoList->GetModel()->Insert(pEntry);
-
         for(std::vector<sc::OpenclDeviceInfo>::const_iterator
                 itr = it->maDevices.begin(), itrEnd = it->maDevices.end(); itr != itrEnd; ++itr)
         {
-            SvTreeListEntry* pDeviceEntry = new SvTreeListEntry;
-pDeviceEntry->AddItem(new SvLBoxContextBmp(pDeviceEntry, 0, Image(), Image(), 0));
-pDeviceEntry->AddItem(new SvLBoxString(pDeviceEntry, 0, itr->maName));
-mpOpenclInfoList->GetModel()->Insert(pDeviceEntry, pEntry);
+            mpOpenclInfoList->InsertEntry(it->maVendor + " " + itr->maName);
         }
     }
 
commit 20144d518600d40db91b6cf42902d56ddfcc6d2f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 13 14:29:24 2013 +0200

    disable the opencl device selection while auto selection is enabled
    
    Change-Id: Ie2f10e9e863bfcb6a34380049bd63e480aab76d2

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 8167736..f13c578 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -124,6 +124,8 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rC
     mpOpenclInfoList->SetHighlightRange();
     mpOpenclInfoList->GetParent()->Hide();
 
+    mpBtnAutomaticSelectionTrue->SetToggleHdl(LINK(this, ScCalcOptionsDialog, BtnAutomaticSelectHdl));
+
     maCaptionStringRefSyntax = get<Window>("ref_syntax_caption")->GetText();
     maDescStringRefSyntax = get<Window>("ref_syntax_desc")->GetText();
     maUseFormulaSyntax = get<Window>("use_formula_syntax")->GetText();
@@ -306,6 +308,8 @@ void ScCalcOptionsDialog::SelectionChanged()
                     mpOpenclInfoList->GetParent()->Enable();
                 else
                     mpOpenclInfoList->GetParent()->Disable();
+
+                OpenclAutomaticSelectionChanged();
             }
 
             if ( bValue )
@@ -346,6 +350,15 @@ void ScCalcOptionsDialog::ListOptionValueChanged()
     }
 }
 
+void ScCalcOptionsDialog::OpenclAutomaticSelectionChanged()
+{
+    bool bValue = mpBtnAutomaticSelectionTrue->IsChecked();
+    if(bValue)
+        mpOpenclInfoList->Disable();
+    else
+        mpOpenclInfoList->Enable();
+}
+
 void ScCalcOptionsDialog::RadioValueChanged()
 {
     sal_uInt16 nSelected = mpLbSettings->GetSelectEntryPos();
@@ -403,5 +416,11 @@ IMPL_LINK_NOARG(ScCalcOptionsDialog, BtnToggleHdl)
     return 0;
 }
 
+IMPL_LINK_NOARG(ScCalcOptionsDialog, BtnAutomaticSelectHdl)
+{
+    OpenclAutomaticSelectionChanged();
+    return 0;
+}
+
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index b52b46f..8fade8d 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -28,6 +28,7 @@ public:
 
     DECL_LINK( SettingsSelHdl, Control* );
     DECL_LINK( BtnToggleHdl, void* );
+    DECL_LINK( BtnAutomaticSelectHdl, void* );
 
     const ScCalcConfig& GetConfig() const;
 
@@ -36,6 +37,7 @@ private:
     void SelectionChanged();
     void ListOptionValueChanged();
     void RadioValueChanged();
+    void OpenclAutomaticSelectionChanged();
 #if HAVE_FEATURE_OPENCL
     void fillOpenclList();
 #endif


More information about the Libreoffice-commits mailing list