Skip to content

Commit

Permalink
Disable logging in weasel frontend.
Browse files Browse the repository at this point in the history
git-svn-id: https://rimeime.googlecode.com/svn/trunk/weasel@362 b90aed45-4297-9963-ff9d-98b604ac09a9
  • Loading branch information
lotem committed Nov 24, 2011
1 parent 79706d8 commit 6c95f01
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 36 deletions.
10 changes: 5 additions & 5 deletions RimingWeasel/ReadMe.txt → RimeWithWeasel/ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
========================================================================
STATIC LIBRARY : RimingWeasel Project Overview
STATIC LIBRARY : RimeWithWeasel Project Overview
========================================================================

AppWizard has created this RimingWeasel library project for you.
AppWizard has created this RimeWithWeasel library project for you.

This file contains a summary of what you will find in each of the files that
make up your RimingWeasel application.
make up your RimeWithWeasel application.


RimingWeasel.vcproj
RimeWithWeasel.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Expand All @@ -19,7 +19,7 @@ RimingWeasel.vcproj

StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named RimingWeasel.pch and a precompiled types file named StdAfx.obj.
named RimeWithWeasel.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////
Other notes:
Expand Down
34 changes: 20 additions & 14 deletions RimingWeasel/RimingWeasel.cpp → RimeWithWeasel/RimeWithWeasel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "stdafx.h"
#include <RimingWeasel.h>
#include <RimeWithWeasel.h>
#include <windows.h>
#include <list>
#include <set>
Expand All @@ -21,12 +21,18 @@ static const std::string WeaselLogFilePath()

#define EZLOGGER_OUTPUT_FILENAME WeaselLogFilePath()
#define EZLOGGER_REPLACE_EXISTING_LOGFILE_

// logging enabled
//#define EZDBGONLYLOGGERPRINT(...)
//#define EZDBGONLYLOGGERFUNCTRACKER

#pragma warning(disable: 4995)
#pragma warning(disable: 4996)
#include <ezlogger/ezlogger_headers.hpp>
#pragma warning(default: 4996)
#pragma warning(default: 4995)


const WCHAR* utf8towcs(const char* utf8_str)
{
const int buffer_len = 4096;
Expand Down Expand Up @@ -61,16 +67,16 @@ static const char* weasel_user_data_dir() {
return path;
}

RimingWeaselHandler::RimingWeaselHandler()
RimeWithWeaselHandler::RimeWithWeaselHandler()
: active_session(0)
{
}

RimingWeaselHandler::~RimingWeaselHandler()
RimeWithWeaselHandler::~RimeWithWeaselHandler()
{
}

void RimingWeaselHandler::Initialize()
void RimeWithWeaselHandler::Initialize()
{
EZDBGONLYLOGGERPRINT("Initializing la rime.");
RimeTraits weasel_traits;
Expand All @@ -80,21 +86,21 @@ void RimingWeaselHandler::Initialize()
m_ui.Create(NULL);
}

void RimingWeaselHandler::Finalize()
void RimeWithWeaselHandler::Finalize()
{
EZDBGONLYLOGGERPRINT("Finalizing la rime.");
m_ui.Destroy();
RimeFinalize();
}

UINT RimingWeaselHandler::FindSession(UINT session_id)
UINT RimeWithWeaselHandler::FindSession(UINT session_id)
{
bool found = RimeFindSession(session_id);
EZDBGONLYLOGGERPRINT("Find session: session_id = 0x%x, found = %d", session_id, found);
return found ? session_id : 0;
}

UINT RimingWeaselHandler::AddSession(LPWSTR buffer)
UINT RimeWithWeaselHandler::AddSession(LPWSTR buffer)
{
UINT session_id = RimeCreateSession();
EZDBGONLYLOGGERPRINT("Add session: created session_id = 0x%x", session_id);
Expand All @@ -104,7 +110,7 @@ UINT RimingWeaselHandler::AddSession(LPWSTR buffer)
return session_id;
}

UINT RimingWeaselHandler::RemoveSession(UINT session_id)
UINT RimeWithWeaselHandler::RemoveSession(UINT session_id)
{
EZDBGONLYLOGGERPRINT("Remove session: session_id = 0x%x", session_id);
// TODO: force committing? otherwise current composition would be lost
Expand All @@ -114,7 +120,7 @@ UINT RimingWeaselHandler::RemoveSession(UINT session_id)
return 0;
}

BOOL RimingWeaselHandler::ProcessKeyEvent(weasel::KeyEvent keyEvent, UINT session_id, LPWSTR buffer)
BOOL RimeWithWeaselHandler::ProcessKeyEvent(weasel::KeyEvent keyEvent, UINT session_id, LPWSTR buffer)
{
EZDBGONLYLOGGERPRINT("Process key event: keycode = 0x%x, mask = 0x%x, session_id = 0x%x",
keyEvent.keycode, keyEvent.mask, session_id);
Expand All @@ -125,21 +131,21 @@ BOOL RimingWeaselHandler::ProcessKeyEvent(weasel::KeyEvent keyEvent, UINT sessio
return (BOOL)taken;
}

void RimingWeaselHandler::FocusIn(UINT session_id)
void RimeWithWeaselHandler::FocusIn(UINT session_id)
{
EZDBGONLYLOGGERPRINT("Focus in: session_id = 0x%x", session_id);
_UpdateUI(session_id);
active_session = session_id;
}

void RimingWeaselHandler::FocusOut(UINT session_id)
void RimeWithWeaselHandler::FocusOut(UINT session_id)
{
EZDBGONLYLOGGERPRINT("Focus out: session_id = 0x%x", session_id);
m_ui.Hide();
active_session = 0;
}

void RimingWeaselHandler::UpdateInputPosition(RECT const& rc, UINT session_id)
void RimeWithWeaselHandler::UpdateInputPosition(RECT const& rc, UINT session_id)
{
EZDBGONLYLOGGERPRINT("Update input position: (%d, %d), session_id = 0x%x, active_session = 0x%x",
rc.left, rc.top, session_id, active_session);
Expand All @@ -151,7 +157,7 @@ void RimingWeaselHandler::UpdateInputPosition(RECT const& rc, UINT session_id)
}
}

void RimingWeaselHandler::_UpdateUI(UINT session_id)
void RimeWithWeaselHandler::_UpdateUI(UINT session_id)
{
weasel::Context weasel_context;
RimeContext ctx;
Expand Down Expand Up @@ -201,7 +207,7 @@ void RimingWeaselHandler::_UpdateUI(UINT session_id)
}
}

bool RimingWeaselHandler::_Respond(UINT session_id, LPWSTR buffer)
bool RimeWithWeaselHandler::_Respond(UINT session_id, LPWSTR buffer)
{
std::set<std::string> actions;
std::list<std::string> messages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="RimingWeasel"
Name="RimeWithWeasel"
ProjectGUID="{1C497821-BD63-4F02-9094-32B185B62F23}"
RootNamespace="RimingWeasel"
RootNamespace="RimeWithWeasel"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
Expand Down Expand Up @@ -414,7 +414,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\RimingWeasel.cpp"
RelativePath=".\RimeWithWeasel.cpp"
>
</File>
<File
Expand Down Expand Up @@ -476,7 +476,7 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\include\RimingWeasel.h"
RelativePath="..\include\RimeWithWeasel.h"
>
</File>
<File
Expand Down
2 changes: 1 addition & 1 deletion RimingWeasel/stdafx.cpp → RimeWithWeasel/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// RimingWeasel.pch will be the pre-compiled header
// RimeWithWeasel.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 10 additions & 5 deletions WeaselIME/WeaselIME.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ static const std::string WeaselLogFilePath()

#define EZLOGGER_OUTPUT_FILENAME WeaselLogFilePath()
#define EZLOGGER_REPLACE_EXISTING_LOGFILE_
#pragma warning(disable: 4995)
#pragma warning(disable: 4996)
#include <ezlogger/ezlogger_headers.hpp>
#pragma warning(default: 4996)
#pragma warning(default: 4995)

// logging disabled
#define EZDBGONLYLOGGERPRINT(...)
#define EZDBGONLYLOGGERFUNCTRACKER

//#pragma warning(disable: 4995)
//#pragma warning(disable: 4996)
//#include <ezlogger/ezlogger_headers.hpp>
//#pragma warning(default: 4996)
//#pragma warning(default: 4995)


HINSTANCE WeaselIME::s_hModule = 0;
Expand Down
4 changes: 2 additions & 2 deletions WeaselServer/WeaselServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "stdafx.h"
#include <WeaselIPC.h>
#include <RimingWeasel.h>
#include <RimeWithWeasel.h>
#include <winsparkle.h>

CAppModule _Module;
Expand Down Expand Up @@ -47,7 +47,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lp
int nRet = 0;
try
{
weasel::Server server(new RimingWeaselHandler);
weasel::Server server(new RimeWithWeaselHandler);
if (!server.Start())
return -1;
nRet = server.Run();
Expand Down
6 changes: 3 additions & 3 deletions include/RimingWeasel.h → include/RimeWithWeasel.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#include <WeaselIPC.h>
#include <WeaselUI.h>

class RimingWeaselHandler :
class RimeWithWeaselHandler :
public weasel::RequestHandler
{
public:
RimingWeaselHandler();
virtual ~RimingWeaselHandler();
RimeWithWeaselHandler();
virtual ~RimeWithWeaselHandler();
virtual void Initialize();
virtual void Finalize();
virtual UINT FindSession(UINT session_id);
Expand Down
4 changes: 2 additions & 2 deletions weasel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
include\PyWeasel.h = include\PyWeasel.h
include\ResponseParser.h = include\ResponseParser.h
include\RimingWeasel.h = include\RimingWeasel.h
include\RimeWithWeasel.h = include\RimeWithWeasel.h
include\WeaselCommon.h = include\WeaselCommon.h
include\WeaselIPC.h = include\WeaselIPC.h
include\WeaselUI.h = include\WeaselUI.h
Expand Down Expand Up @@ -58,7 +58,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestResponseParser", "test\
{CE11A2DF-8D20-4B07-A935-4B0D03F0303D} = {CE11A2DF-8D20-4B07-A935-4B0D03F0303D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RimingWeasel", "RimingWeasel\RimingWeasel.vcproj", "{1C497821-BD63-4F02-9094-32B185B62F23}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RimeWithWeasel", "RimeWithWeasel\RimeWithWeasel.vcproj", "{1C497821-BD63-4F02-9094-32B185B62F23}"
ProjectSection(ProjectDependencies) = postProject
{10B3B8BF-7294-4661-9A8A-2FFC920FA2F4} = {10B3B8BF-7294-4661-9A8A-2FFC920FA2F4}
EndProjectSection
Expand Down

0 comments on commit 6c95f01

Please sign in to comment.