[dasher: 140/217] Win32 Status bar speed and alphabet display were not updated when parameters changed.



commit 9edabd95b79dddf397837cdca16dee651f63a145
Author: ipomoena <amajorek google com>
Date:   Wed Dec 9 17:20:36 2015 -0800

    Win32 Status bar speed and alphabet display  were not updated when parameters changed.

 Src/DasherCore/DashIntfSettings.h   |    1 +
 Src/Win32/DasherWindow.cpp          |    2 +-
 Src/Win32/Widgets/StatusControl.cpp |   25 +++++++++++++------------
 Src/Win32/Widgets/StatusControl.h   |    6 ++++--
 4 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/Src/DasherCore/DashIntfSettings.h b/Src/DasherCore/DashIntfSettings.h
index a9e43b2..7164981 100644
--- a/Src/DasherCore/DashIntfSettings.h
+++ b/Src/DasherCore/DashIntfSettings.h
@@ -39,6 +39,7 @@ public:
 
   CDashIntfSettings(CSettingsStore *pSettingsStore);
 
+  CSettingsUser* GetSettingsUser() { return this; }
   bool GetBoolParameter(int iParameter) const;
   long GetLongParameter(int iParameter) const;
   const std::string &GetStringParameter(int iParameter) const;
diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp
index 4d84f83..0f2c66a 100644
--- a/Src/Win32/DasherWindow.cpp
+++ b/Src/Win32/DasherWindow.cpp
@@ -126,7 +126,7 @@ HWND CDasherWindow::Create() {
 
   m_pEdit->SetInterface(m_pDasher);
 
-  m_pSpeedAlphabetBar = new CStatusControl(m_pAppSettings);
+  m_pSpeedAlphabetBar = new CStatusControl(m_pDasher->GetSettingsUser(), m_pAppSettings);
   m_pSpeedAlphabetBar->Create(hWnd);
 
   m_pSplitter = new CSplitter(this, 100);
diff --git a/Src/Win32/Widgets/StatusControl.cpp b/Src/Win32/Widgets/StatusControl.cpp
index 30263a2..c1f1d5e 100644
--- a/Src/Win32/Widgets/StatusControl.cpp
+++ b/Src/Win32/Widgets/StatusControl.cpp
@@ -4,7 +4,19 @@
 
 #include <string>
 
-CStatusControl::CStatusControl(CAppSettings *pAppSettings) : m_pAppSettings(pAppSettings) {
+CStatusControl::CStatusControl(Dasher::CSettingsUser *pCreateFrom, CAppSettings *pAppSettings) 
+       : CSettingsObserver(pCreateFrom), m_pAppSettings(pAppSettings) {
+}
+
+void CStatusControl::HandleEvent(int iParameter) {
+       switch (iParameter) {
+       case  SP_ALPHABET_ID:
+               PopulateCombo();
+               break;
+       case LP_MAX_BITRATE:
+               PopulateSpeed();
+               break;
+       }
 }
 
 // TODO: ATL has more sophisticated handlers for conrol and notify messages - consider using them instead
@@ -72,22 +84,11 @@ void CStatusControl::CreateChildren() {
   std::wstring strAlphabetLabel(L"Alphabet:");
 
   // TODO: Wrap windows here in CWindow classes.
-#ifndef _WIN32_WCE
-  // TODO: Is this really needed?
   m_hSpeedLabel = CreateWindowEx(WS_EX_CONTROLPARENT, TEXT("STATIC"), strSpeedLabel.c_str(), 
       SS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, m_hWnd, NULL, WinHelper::hInstApp, NULL);
-#else
-  m_hSpeedLabel = CreateWindowEx(0, TEXT("STATIC"), strSpeedLabel.c_str(), 
-      SS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, m_hWnd, NULL, WinHelper::hInstApp, NULL);
-#endif
 
-#ifndef _WIN32_WCE
   m_hAlphabetLabel = CreateWindowEx(WS_EX_CONTROLPARENT, TEXT("STATIC"), strAlphabetLabel.c_str(), 
       SS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, m_hWnd, NULL, WinHelper::hInstApp, NULL);
-#else
-  m_hAlphabetLabel = CreateWindowEx(0, TEXT("STATIC"), strAlphabetLabel.c_str(), 
-      SS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, m_hWnd, NULL, WinHelper::hInstApp, NULL);
-#endif
 
   SendMessage(m_hSpeedLabel, WM_SETFONT, (WPARAM) hGuiFont, true);
   SendMessage(m_hAlphabetLabel, WM_SETFONT, (WPARAM) hGuiFont, true);
diff --git a/Src/Win32/Widgets/StatusControl.h b/Src/Win32/Widgets/StatusControl.h
index 2a02b7f..35e16ed 100644
--- a/Src/Win32/Widgets/StatusControl.h
+++ b/Src/Win32/Widgets/StatusControl.h
@@ -2,14 +2,15 @@
 #define __StatusControl_h__
 
 #include "../Common/WinCommon.h"
+#include "../../DasherCore/SettingsStore.h"
 #include "../AppSettings.h"
 
 #include <atlbase.h>
 #include <atlwin.h>
 
-class CStatusControl : public ATL::CWindowImpl<CStatusControl> {
+class CStatusControl : public ATL::CWindowImpl<CStatusControl>, public Dasher::CSettingsObserver {
 public:
-       CStatusControl(CAppSettings *pAppSettings);
+       CStatusControl(Dasher::CSettingsUser *pCreateFrom, CAppSettings *pAppSettings);
 
   // ATL boilerplate code
   DECLARE_WND_SUPERCLASS(L"STATUSCONTROL", L"STATIC");
@@ -31,6 +32,7 @@ public:
   int GetHeight() {
     return m_iEditHeight + 2;
   }
+  void HandleEvent(int iParameter);
 
 private:
   // Create the child windows of the control


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]