android 打开window log,LogWindow.h - Android社区 - https://www.androidos.net.cn/

//

// Copyright 2005 The Android Open Source Project

//

// Window with log output.

//

#ifndef _SIM_LOG_WINDOW_H

#define _SIM_LOG_WINDOW_H

#include "PhoneData.h"

#include "UserEvent.h"

#include "LogMessage.h"

#include "LogPool.h"

#include "LogPrefsDialog.h"

/*

* Display log output from runtime process.

*

* We receive the messages broken into components (date, log level, tag,

* function name, etc.) and do the formatting ourselves. We receive all

* messages regardless of log level, and provide filter controls in the

* window.

*

* Messages are stored in a "log pool", which has a fixed memory footprint.

* The messages that are currently visible in the log output window are

* also pointed at from a fixed-size display array. Changes to output

* format cause us to clear the display and re-show everything in the

* display array, while changes to the output filter cause us to

* re-evaluate the contents of the display pool.

*/

class LogWindow : public wxDialog {

public:

LogWindow(wxWindow* parent);

virtual ~LogWindow(void);

/* we override this, to cope with annoying GTK behavior */

virtual bool Show(bool show = true);

/* return preferred size and position */

static wxRect GetPrefWindowRect(void);

/* handle a log message "user event" */

void AddLogMessage(LogMessage* pLogMessage);

/* resize the display messages array */

void SetMaxDisplayMsgs(int max);

/* post a message to the log; may be called from non-main thread */

static void PostLogMsg(const android_LogBundle* pBundle);

static void PostLogMsg(const wxString& msg);

static void PostLogMsg(const char* msg);

private:

void OnMove(wxMoveEvent& event);

void OnClose(wxCloseEvent& event);

void OnLogLevel(wxCommandEvent& event);

void OnLogClear(wxCommandEvent& event);

void OnLogPause(wxCommandEvent& event);

void OnLogPrefs(wxCommandEvent& event);

/* handle incoming log message */

void OnUserEvent(UserEvent& event);

void SaveWindowPrefs(void);

void ConstructControls(void);

void AddToDisplay(LogMessage* pLogMessage);

void ClearDisplay(void);

void Redisplay(void);

void SetTextStyle(void);

bool FilterMatches(const LogMessage* pLogMessage);

void FormatMessage(const LogMessage* pLogMessage,

wxTextCtrl* pTextCtrl);

void LogToFile(const LogMessage* pLogMessage);

void PrepareLogFile(void);

static void SendToWindow(LogMessage* pMessage);

/*

* Message pool.

*/

LogPool mPool;

/*

* Display array. This is a fixed-size circular array that holds

* pointers to the log messages currently displayed on screen.

*/

LogMessage** mDisplayArray; // ptrs to messages currently displayed

int mMaxDisplayMsgs; // max #of messages

int mTopPtr; // index of top message

int mNextPtr; // index of next empty slot

bool mPaused; // is output paused for review?

/*

* Current filter.

*/

android_LogPriority mMinPriority; // messages at or above are shown

/* format options */

LogPrefsDialog::HeaderFormat mHeaderFormat;

bool mSingleLine; // put whole message on one line?

int mExtraSpacing; // double/triple-space messages?

int mPointSize; // text point size;

bool mUseColor; // colorful messages?

bool mFontMonospace; // use monospace font?

/* log file options */

bool mWriteFile;

wxString mFileName;

bool mTruncateOld;

FILE* mLogFp;

/*

* Window position stuff.

*/

bool mNewlyShown;

wxPoint mLastPosition;

bool mVisible;

DECLARE_EVENT_TABLE()

};

#endif // _SIM_LOG_WINDOW_H

C++程序

|

128行

|

3.79 KB

//

// Copyright 2005 The Android Open Source Project

//

// Window with log output.

//

#ifndef _SIM_LOG_WINDOW_H

#define _SIM_LOG_WINDOW_H

#include "PhoneData.h"

#include "UserEvent.h"

#include "LogMessage.h"

#include "LogPool.h"

#include "LogPrefsDialog.h"

/*

* Display log output from runtime process.

*

* We receive the messages broken into components (date, log level, tag,

* function name, etc.) and do the formatting ourselves. We receive all

* messages regardless of log level, and provide filter controls in the

* window.

*

* Messages are stored in a "log pool", which has a fixed memory footprint.

* The messages that are currently visible in the log output window are

* also pointed at from a fixed-size display array. Changes to output

* format cause us to clear the display and re-show everything in the

* display array, while changes to the output filter cause us to

* re-evaluate the contents of the display pool.

*/

class LogWindow : public wxDialog {

public:

LogWindow(wxWindow* parent);

virtual ~LogWindow(void);

/* we override this, to cope with annoying GTK behavior */

virtual bool Show(bool show = true);

/* return preferred size and position */

static wxRect GetPrefWindowRect(void);

/* handle a log message "user event" */

void AddLogMessage(LogMessage* pLogMessage);

/* resize the display messages array */

void SetMaxDisplayMsgs(int max);

/* post a message to the log; may be called from non-main thread */

static void PostLogMsg(const android_LogBundle* pBundle);

static void PostLogMsg(const wxString& msg);

static void PostLogMsg(const char* msg);

private:

void OnMove(wxMoveEvent& event);

void OnClose(wxCloseEvent& event);

void OnLogLevel(wxCommandEvent& event);

void OnLogClear(wxCommandEvent& event);

void OnLogPause(wxCommandEvent& event);

void OnLogPrefs(wxCommandEvent& event);

/* handle incoming log message */

void OnUserEvent(UserEvent& event);

void SaveWindowPrefs(void);

void ConstructControls(void);

void AddToDisplay(LogMessage* pLogMessage);

void ClearDisplay(void);

void Redisplay(void);

void SetTextStyle(void);

bool FilterMatches(const LogMessage* pLogMessage);

void FormatMessage(const LogMessage* pLogMessage,

wxTextCtrl* pTextCtrl);

void LogToFile(const LogMessage* pLogMessage);

void PrepareLogFile(void);

static void SendToWindow(LogMessage* pMessage);

/*

* Message pool.

*/

LogPool mPool;

/*

* Display array. This is a fixed-size circular array that holds

* pointers to the log messages currently displayed on screen.

*/

LogMessage** mDisplayArray; // ptrs to messages currently displayed

int mMaxDisplayMsgs; // max #of messages

int mTopPtr; // index of top message

int mNextPtr; // index of next empty slot

bool mPaused; // is output paused for review?

/*

* Current filter.

*/

android_LogPriority mMinPriority; // messages at or above are shown

/* format options */

LogPrefsDialog::HeaderFormat mHeaderFormat;

bool mSingleLine; // put whole message on one line?

int mExtraSpacing; // double/triple-space messages?

int mPointSize; // text point size;

bool mUseColor; // colorful messages?

bool mFontMonospace; // use monospace font?

/* log file options */

bool mWriteFile;

wxString mFileName;

bool mTruncateOld;

FILE* mLogFp;

/*

* Window position stuff.

*/

bool mNewlyShown;

wxPoint mLastPosition;

bool mVisible;

DECLARE_EVENT_TABLE()

};

#endif // _SIM_LOG_WINDOW_H

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值