[Libreoffice-commits] core.git: Branch 'feature/calc-pluggable-opencl' - 2 commits - sc/source sc/uiconfig
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Sep 16 06:22:53 PDT 2013
sc/source/ui/optdlg/calcoptionsdlg.cxx | 40 ++++++++++++++++++----
sc/source/ui/optdlg/calcoptionsdlg.hxx | 2 +
sc/uiconfig/scalc/ui/formulacalculationoptions.ui | 12 ++++++
3 files changed, 48 insertions(+), 6 deletions(-)
New commits:
commit 3750977ceff4bd097a2b96ce610d2e94bf33786b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 16 15:14:28 2013 +0200
select the correct entry when opening the dialog
Change-Id: Ib1f418e9f05ce2f57029e51ab6dfcd139d6f3f6d
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index fdf190b..9607fb6 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -211,12 +211,18 @@ void ScCalcOptionsDialog::fillOpenclList()
for(std::vector<sc::OpenclDeviceInfo>::iterator
itr = it->maDevices.begin(), itrEnd = it->maDevices.end(); itr != itrEnd; ++itr)
{
- SvTreeListEntry* pEntry = mpOpenclInfoList->InsertEntry(it->maVendor + " " + itr->maName);
+ OUString aDeviceId = it->maVendor + " " + itr->maName;
+ SvTreeListEntry* pEntry = mpOpenclInfoList->InsertEntry(aDeviceId);
+ if(aDeviceId == aStoredDevice)
+ {
+ mpOpenclInfoList->GetModel()->GetView(0)->Select(pEntry);
+ }
pEntry->SetUserData(&(*itr));
}
}
mpOpenclInfoList->SetUpdateMode(true);
+ SelectedDeviceChanged();
}
#endif
@@ -371,6 +377,9 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
{
#if HAVE_FEATURE_OPENCL
SvTreeListEntry* pEntry = mpOpenclInfoList->GetModel()->GetView(0)->FirstSelected();
+ if(!pEntry)
+ return;
+
sc::OpenclDeviceInfo* pInfo = reinterpret_cast<sc::OpenclDeviceInfo*>(pEntry->GetUserData());
if(pInfo)
{
commit 46fb39105cbe48497641d834a9d4370679afedf9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Sep 16 14:53:15 2013 +0200
add the software interpreter to the list
Change-Id: I1462b6321a195a6863746ce296575b64b140e0ec
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 6dd78fe..fdf190b 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -137,6 +137,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rC
maDescEmptyStringAsZero = get<Window>("empty_str_as_zero_desc")->GetText();
maCaptionOpenCLEnabled = get<Window>("opencl_enabled")->GetText();
maDescOpenCLEnabled = get<Window>("opencl_enabled_desc")->GetText();
+ maSoftware = get<Window>("software")->GetText();
mpLbSettings->set_height_request(8 * mpLbSettings->GetTextHeight());
mpLbSettings->SetStyle(mpLbSettings->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
@@ -199,6 +200,10 @@ void ScCalcOptionsDialog::fillOpenclList()
{
mpOpenclInfoList->SetUpdateMode(false);
mpOpenclInfoList->Clear();
+ mpOpenclInfoList->InsertEntry(maSoftware);
+
+ OUString aStoredDevice = maConfig.maOpenCLDevice;
+
sc::FormulaGroupInterpreter::fillOpenCLInfo(maPlatformInfo);
for(std::vector<sc::OpenclPlatformInfo>::iterator it = maPlatformInfo.begin(),
itEnd = maPlatformInfo.end(); it != itEnd; ++it)
@@ -367,11 +372,25 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
#if HAVE_FEATURE_OPENCL
SvTreeListEntry* pEntry = mpOpenclInfoList->GetModel()->GetView(0)->FirstSelected();
sc::OpenclDeviceInfo* pInfo = reinterpret_cast<sc::OpenclDeviceInfo*>(pEntry->GetUserData());
- assert(pInfo);
- mpFtFrequency->SetText(OUString::number(pInfo->mnFrequency));
- mpFtComputeUnits->SetText(OUString::number(pInfo->mnComputeUnits));
- mpFtMemory->SetText(OUString::number(pInfo->mnMemory/1024/1024));
- maConfig.maOpenCLDevice = dynamic_cast<SvLBoxString*>(pEntry->GetItem(1))->GetText();
+ if(pInfo)
+ {
+ mpFtFrequency->SetText(OUString::number(pInfo->mnFrequency));
+ mpFtComputeUnits->SetText(OUString::number(pInfo->mnComputeUnits));
+ mpFtMemory->SetText(OUString::number(pInfo->mnMemory/1024/1024));
+ }
+ else
+ {
+ mpFtFrequency->SetText(OUString());
+ mpFtComputeUnits->SetText(OUString());
+ mpFtMemory->SetText(OUString());
+ }
+
+ OUString aDevice = dynamic_cast<SvLBoxString*>(pEntry->GetItem(1))->GetText();
+ // use english string for configuration
+ if(aDevice == maSoftware)
+ aDevice = "Software";
+
+ maConfig.maOpenCLDevice = aDevice;
#endif
}
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index 3d6b755..633c475 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -86,6 +86,8 @@ private:
OUString maCaptionOpenCLEnabled;
OUString maDescOpenCLEnabled;
+ OUString maSoftware;
+
ScCalcConfig maConfig;
#if HAVE_FEATURE_OPENCL
std::vector<sc::OpenclPlatformInfo> maPlatformInfo;
diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
index c5bd7dc..895f8ee 100644
--- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
+++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
@@ -464,6 +464,18 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="software">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Software</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">11</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
More information about the Libreoffice-commits
mailing list