From 32cd1f674cb04630da7c47e48e4f2a0418eb9376 Mon Sep 17 00:00:00 2001 From: Phil Cowans Date: Fri, 27 Oct 2006 21:02:42 +0000 Subject: [PATCH] Make it build on Windows again (don't expect it to actually work sensibly * Make it build on Windows again (don't expect it to actually work sensibly though!) --- Src/DasherCore/ConversionHelper.h | 2 +- Src/DasherCore/ConversionManager.cpp | 6 +++++- Src/DasherCore/DasherCore_vc71.vcproj | 18 ++++++++++++++++++ Src/DasherCore/DasherViewSquare.cpp | 6 +++++- Src/DasherCore/IMEConversionHelper.h | 9 +++++++++ Src/DasherCore/PinYinConversionHelper.cpp | 3 +++ Src/Win32/Dasher.cpp | 4 ++-- Src/Win32/Dasher.h | 2 +- Src/Win32/DasherWindow.cpp | 4 ++-- Src/Win32/Widgets/Canvas.cpp | 2 +- Src/Win32/Widgets/Screen.cpp | 5 +++-- Src/Win32/Widgets/Screen.h | 5 ++--- Src/Win32/Widgets/Screen.inl | 4 ++-- 13 files changed, 54 insertions(+), 16 deletions(-) diff --git a/Src/DasherCore/ConversionHelper.h b/Src/DasherCore/ConversionHelper.h index 85ee2205..e1b06c37 100644 --- a/Src/DasherCore/ConversionHelper.h +++ b/Src/DasherCore/ConversionHelper.h @@ -3,7 +3,7 @@ #include #include -#include +#include "SCENode.h" diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp index 82191d0b..0e0d56d4 100644 --- a/Src/DasherCore/ConversionManager.cpp +++ b/Src/DasherCore/ConversionManager.cpp @@ -212,7 +212,9 @@ void CConversionManager::PopulateChildren( CDasherNode *pNode ) { // ----- - int iSize[pCurrentSCEChild->IsHeadAndCandNum]; + int *iSize; + + iSize = new int[pCurrentSCEChild->IsHeadAndCandNum]; AssignChildSizes(pCurrentSCENode, iSize, pCurrentSCEChild->IsHeadAndCandNum); @@ -255,6 +257,8 @@ void CConversionManager::PopulateChildren( CDasherNode *pNode ) { ++iIdx; }while(pCurrentSCEChild); + + delete[] iSize; } else { diff --git a/Src/DasherCore/DasherCore_vc71.vcproj b/Src/DasherCore/DasherCore_vc71.vcproj index c74ab34a..661cd69d 100644 --- a/Src/DasherCore/DasherCore_vc71.vcproj +++ b/Src/DasherCore/DasherCore_vc71.vcproj @@ -245,6 +245,12 @@ Name="Logging" Filter=""> + + + + + + + + + + + + > &vResult); + + // TODO: Implement placeholders + virtual bool Convert(const std::string &strSource, SCENode ** pRoot, int * childCount, int CMid) { + return false; + }; + + virtual void ClearData(int CMid) { + }; + private: bool IsInit; HIMC hIMC; diff --git a/Src/DasherCore/PinYinConversionHelper.cpp b/Src/DasherCore/PinYinConversionHelper.cpp index 198562e1..62a75469 100644 --- a/Src/DasherCore/PinYinConversionHelper.cpp +++ b/Src/DasherCore/PinYinConversionHelper.cpp @@ -1,4 +1,7 @@ +#ifndef _WIN32 #include "config.h" +#endif + #ifdef CHINESE #include diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp index ad3be0f9..721821ef 100644 --- a/Src/Win32/Dasher.cpp +++ b/Src/Win32/Dasher.cpp @@ -168,7 +168,7 @@ void CDasher::Main() void CDasher::Log() { - CUserLog* pUserLog = GetUserLogPtr(); + CUserLogBase* pUserLog = GetUserLogPtr(); // We'll use this timer event to periodically log the user's mouse position if ((pUserLog != NULL) && (m_pCanvas != NULL)) { @@ -208,7 +208,7 @@ void Dasher::CDasher::ExternalEventHandler(CEvent* pEvent) { } // Get the pointer to our user logging object -CUserLog* Dasher::CDasher::GetUserLogPtr() +CUserLogBase* Dasher::CDasher::GetUserLogPtr() { return m_pUserLog; } diff --git a/Src/Win32/Dasher.h b/Src/Win32/Dasher.h index 4685fb8e..1546f1c7 100644 --- a/Src/Win32/Dasher.h +++ b/Src/Win32/Dasher.h @@ -32,7 +32,7 @@ public: void ExternalEventHandler(Dasher::CEvent *pEvent); - CUserLog* GetUserLogPtr(); + CUserLogBase* GetUserLogPtr(); virtual void WriteTrainFile(const std::string &strNewText); diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp index 5a481951..456d78f9 100644 --- a/Src/Win32/DasherWindow.cpp +++ b/Src/Win32/DasherWindow.cpp @@ -213,7 +213,7 @@ void CDasherWindow::Main() { DASHER_ASSERT_VALIDPTR_RW(m_pDasher); m_pDasher->Main(); - Sleep(20); // limits framerate to 50fps + Sleep(50); // limits framerate to 50fps } int CDasherWindow::MessageLoop() @@ -501,7 +501,7 @@ LRESULT CDasherWindow::OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOO m_pEdit->New(); // Selecting file->new indicates a new trial to our user logging object if (m_pDasher != NULL) { - CUserLog* pUserLog = m_pDasher->GetUserLogPtr(); + CUserLogBase* pUserLog = m_pDasher->GetUserLogPtr(); if (pUserLog != NULL) pUserLog->NewTrial(); } diff --git a/Src/Win32/Widgets/Canvas.cpp b/Src/Win32/Widgets/Canvas.cpp index 2ce3c853..dfa83872 100644 --- a/Src/Win32/Widgets/Canvas.cpp +++ b/Src/Win32/Widgets/Canvas.cpp @@ -564,7 +564,7 @@ void CCanvas::DoFrame() } } - m_pDasherInterface->NewFrame(dwTicks);//TapOn(imousex, imousey, GetTickCount()); + m_pDasherInterface->NewFrame(dwTicks, false);//TapOn(imousex, imousey, GetTickCount()); } void CCanvas::centrecursor() { diff --git a/Src/Win32/Widgets/Screen.cpp b/Src/Win32/Widgets/Screen.cpp index 571e2380..860b0093 100644 --- a/Src/Win32/Widgets/Screen.cpp +++ b/Src/Win32/Widgets/Screen.cpp @@ -95,7 +95,7 @@ void CScreen::SetInterface(CDasherInterface *DasherInterface) { // CodePage = EncodingToCP(m_pDasherInterface->GetAlphabetType()); } -void CScreen::SetColourScheme(const Dasher::CCustomColours *pColours) { +void CScreen::SetColourScheme(const Dasher::CColourIO::ColourInfo *pColours) { m_cPens.clear(); m_cBrushes.clear(); m_pColours = pColours; @@ -158,7 +158,8 @@ void CScreen::DrawString(const std::string &OutputString, Dasher::screenint x1, COLORREF iCRefOld; COLORREF iCRefNew; - iCRefNew = RGB(m_pColours->GetRed(4), m_pColours->GetGreen(4), m_pColours->GetBlue(4)); + // TODO: Hardcoded numbers + iCRefNew = RGB(m_pColours->Reds[4], m_pColours->Greens[4], m_pColours->Blues[4]); iCRefOld = SetTextColor(m_hDCBuffer, iCRefNew); diff --git a/Src/Win32/Widgets/Screen.h b/Src/Win32/Widgets/Screen.h index b7d4b60b..fee5e29f 100644 --- a/Src/Win32/Widgets/Screen.h +++ b/Src/Win32/Widgets/Screen.h @@ -36,8 +36,7 @@ public: ~CScreen(); void SetInterface(CDasherInterface * DasherInterface); - - void SetColourScheme(const Dasher::CCustomColours * pColours); + void SetColourScheme(const Dasher::CColourIO::ColourInfo *pColours); void SetFont(const std::string &strFont); @@ -98,7 +97,7 @@ private: HGDIOBJ m_prevhbmBitDecorations; UINT CodePage; - const Dasher::CCustomColours *m_pColours; + const Dasher::CColourIO::ColourInfo *m_pColours; // USE GET() FUNCTIONS AS THEY CACHE TO AVOID RECREATION OF PENS/BRUSHES/FONT SIZES HPEN& GetPen(int iColor, int iWidth); diff --git a/Src/Win32/Widgets/Screen.inl b/Src/Win32/Widgets/Screen.inl index 0f62a495..02031672 100644 --- a/Src/Win32/Widgets/Screen.inl +++ b/Src/Win32/Widgets/Screen.inl @@ -115,7 +115,7 @@ inline HPEN& CScreen::GetPen(int iColor, int iWidth) { hm1_RcIter = m_cPens.find( key ); if( hm1_RcIter == m_cPens.end() ) { - HPEN pen = CreatePen(PS_SOLID, iWidth, RGB(m_pColours->GetRed(iColor), m_pColours->GetGreen(iColor), m_pColours->GetBlue(iColor))); + HPEN pen = CreatePen(PS_SOLID, iWidth, RGB(m_pColours->Reds[iColor], m_pColours->Greens[iColor], m_pColours->Blues[iColor])); m_cPens[key] = pen; } @@ -128,7 +128,7 @@ inline HBRUSH& CScreen::GetBrush(int iColor) { hm1_RcIter = m_cBrushes.find( key ); if( hm1_RcIter == m_cBrushes.end() ) { - HBRUSH brush = CreateSolidBrush(RGB(m_pColours->GetRed(iColor), m_pColours->GetGreen(iColor), m_pColours->GetBlue(iColor))); + HBRUSH brush = CreateSolidBrush(RGB(m_pColours->Reds[iColor], m_pColours->Greens[iColor], m_pColours->Blues[iColor])); m_cBrushes[key] = brush; } -- 2.11.4.GIT