📄 tracetool.h.svn-base
字号:
// tracetool.h
//
// Author : Thierry Parent
// Version : 8.1.0
//
// HomePage : http://www.codeproject.com/csharp/TraceTool.asp
// Download : http://sourceforge.net/projects/tracetool/
// See License.txt for license information (GPL)
#pragma once
#include <deque>
#include <string>
using namespace std ;
class TTrace ;
class TraceNode ;
class TraceNode ;
class TraceNodeEx ;
class WinTrace ;
class TraceOptions ;
class TMemberNode ;
//-------------------------------------------------------------------------
const int WMD_TRACETOOL = 123 ; // identification code 'traceTool'
// Icones
const int CST_ICO_DEFAULT = -1 ;
const int CST_ICO_FORM = 0 ;
const int CST_ICO_COMPONENT = 1 ;
const int CST_ICO_CONTROL = 3 ;
const int CST_ICO_PROP = 5 ;
const int CST_ICO_MENU = 15 ;
const int CST_ICO_MENU_ITEM = 16 ;
const int CST_ICO_COLLECT_ITEM = 21 ;
const int CST_ICO_WARNING = 22 ;
const int CST_ICO_ERROR = 23 ;
const int CST_ICO_INFO = 24 ; // default
// plugin
const int CST_PLUG_ONACTION = 1 ;
const int CST_PLUG_ONBEFOREDELETE = 2 ;
const int CST_PLUG_ONTIMER = 4 ;
// resource kind
const int CST_RES_BUT_RIGHT = 1 ; // Button on right
const int CST_RES_BUT_LEFT = 2 ; // Button on left
const int CST_RES_LABEL_RIGHT = 3 ; // Label on right
const int CST_RES_LABELH_RIGHT = 4 ; // Label on right HyperLink
const int CST_RES_LABEL_LEFT = 5 ; // Label on left
const int CST_RES_LABELH_LEFT = 6 ; // Label on left hyperlink
const int CST_RES_MENU_ACTION = 7 ; // Item menu in the Actions Menu
const int CST_RES_MENU_WINDOW = 8 ; // Item menu in the Windows Menu. Call CreateResource on the main win trace to create this menu item
// resource id
const int CST_ACTION_CUT = 1 ; // cut same as copy then delete
const int CST_ACTION_COPY = 2 ; // copy
const int CST_ACTION_DELETE = 3 ; // delete selected
const int CST_ACTION_SELECT_ALL = 4 ; // select all
const int CST_ACTION_RESIZE_COLS = 5 ; // resize columns
const int CST_ACTION_VIEW_INFO = 6 ; // view trace info
const int CST_ACTION_VIEW_PROP = 7 ; // view properties
const int CST_ACTION_PAUSE = 8 ; // Pause on
const int CST_ACTION_SAVE = 9 ; // SaveToFile
const int CST_ACTION_CLEAR_ALL = 10 ; // clear all
const int CST_ACTION_CLOSE_WIN = 11 ; // Close win
const int CST_ACTION_RESUME = 12 ; // resume from Pause
const int CST_ACTION_LABEL_INFO = 20 ; // TracesInfo label
const int CST_ACTION_LABEL_LOGFILE = 21 ; // LabelLogFile label
const int CST_ACTION_VIEW_MAIN = 50 ; // View Main trace
const int CST_ACTION_VIEW_ODS = 51 ; // ODS
const int CST_ACTION_OPEN_XML = 52 ; // XML trace -> Tracetool XML traces
const int CST_ACTION_EVENTLOG = 53 ; // Event log
const int CST_ACTION_TAIL = 54 ; // Tail
// Command
const int CST_TREE_COLUMNWIDTH = 93 ; // Columns widths
const int CST_USE_MULTICOL_TREE = 94 ; // same as CST_USE_TREE but the tree is multicolumn
const int CST_TREE_MULTI_COLUMN = 95 ; // change the columns titles
const int CST_TREE_COLUMNTITLE = 96 ; // change the tree to display multiple column
const int CST_DISPLAY_TREE = 97 ; // display tree windows
const int CST_TREE_NAME = 98 ; // param : the new name of the tree (use CST_USE_TREE just before to specify the tree)
const int CST_USE_TREE = 99 ; // param : Id (CLSID for example) of the tree to use for other command.
const int CST_INIT = 100 ;
const int CST_TRACE_ID = 101 ; // param : CLSID
const int CST_SHOW = 102 ; // param : 1 : show. 0 : hide
const int CST_ICO_INDEX = 103 ; // param : image index
const int CST_CLEAR_ALL = 104 ; // no param
const int CST_WINWATCH_NAME = 110 ; // param : window name
const int CST_WINWATCH_ID = 111 ; // param : Window id
const int CST_WATCH_NAME = 112 ; // param : watch name
const int CST_WATCH_VALUE = 113 ; // param : watch value
const int CST_CLEAR_NODE = 300 ; // param : the node to clear + flag
const int CST_CLEAR_SUBNODES = 301 ; // param : the parent node
const int CST_THREAD_ID = 302 ; // param : thread ID
const int CST_PROCESS_NAME = 303 ; // param process name
const int CST_MESSAGE_TIME = 304 ; // param : the time of the message
const int CST_THREAD_NAME = 305 ; // param : thread name (java)
const int CST_CREATE_MEMBER = 500 ; // param : Member name
const int CST_MEMBER_FONT_DETAIL = 501 ; // param : ColId Bold Italic Color size Fontname
const int CST_MEMBER_COL2 = 502 ; // param : info col 2
const int CST_MEMBER_COL3 = 504 ; // param : info col 3
const int CST_ADD_MEMBER = 505 ; // add member to upper level. No param (for now)
const int CST_NEW_NODE = 550 ; // param : parent node ID
const int CST_LEFT_MSG = 551 ; // param : left msg
const int CST_RIGHT_MSG = 552 ; // param : right msg
const int CST_SELECT_NODE = 553 ; // set the node as 'Selected' by the user. param : Node id
const int CST_GET_NODE = 554 ; // return the node id
const int CST_USE_NODE = 555 ; // use an existing node. param : Node id
const int CST_APPEND_LEFT_MSG = 556 ; // param : left msg to append
const int CST_APPEND_RIGHT_MSG = 557 ; // param : right msg to append
const int CST_FOCUS_NODE = 558 ; // Focus to the node.
const int CST_SAVETOTEXT = 559 ; // save to text file, parameter : filename
const int CST_SAVETOXML = 560 ; // save to XML file, parameter : filename
const int CST_LOADXML = 561 ; // load an XML file to the current wintrace
const int CST_LOGFILE = 562 ; // set the log file for a wintrace
const int CST_LINKTOPLUGIN = 563 ; // link a wintrace to a plugin
const int CST_CREATE_RESOURCE = 564 ; // create a resource on a wintrace
const int CST_SET_TEXT_RESOURCE = 565 ; // set the text resource
const int CST_DISABLE_RESOURCE = 566 ; // disable a resource
const int CST_FONT_DETAIL = 567 ; // param : ColId Bold Italic Color size Fontname
const int CST_FLUSH = 800 ; // special case to be interpreted by the sender thread (not to be send)
//====================================================================================
/// <summary>
/// The list of command to send
/// </summary>
template <class _Ty, class _Ax = allocator<_Ty> >
class CommandDeque : public deque<_Ty, _Ax>
{
public :
// formatting Helper functions.
/// back : code only
void Add(const int msg)
{
char message [10] ;
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message, 10,"%5d", msg);
#else
sprintf(message, "%5d", msg);
#endif
push_back (message) ;
} ;
//-------------------------------------------------------------------------
/// front : code only
void AddFront(const int msg)
{
char message[10];
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message, 10,"%5d", msg);
#else
sprintf(message, "%5d", msg);
#endif
push_front (message) ;
}
//-------------------------------------------------------------------------
/// back : code + string
void Add(const int msg, const char *StrValue)
{
char * message ;
if (StrValue == NULL)
{
message = (char*)malloc(5+1) ;
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message, 6,"%5d", msg);
#else
sprintf(message, "%5d", msg);
#endif
} else {
int MsgLen = 5+strlen(StrValue)+1 ;
message = (char*)malloc(MsgLen) ;
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message, MsgLen,"%5d%s", msg, StrValue);
#else
sprintf(message, "%5d%s", msg, StrValue);
#endif
}
push_back (message) ;
free (message) ;
}
//-------------------------------------------------------------------------
/// front : code + string
void AddFront(const int msg, const char * StrValue)
{
char * message ;
if (StrValue == NULL)
{
message = (char*)malloc(5+1) ;
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message,6, "%5d", msg);
#else
sprintf(message, "%5d", msg);
#endif
} else {
int MsgLen = 5+strlen(StrValue)+1 ;
message = (char*)malloc(MsgLen) ;
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message, MsgLen,"%5d%s", msg, StrValue);
#else
sprintf(message, "%5d%s", msg, StrValue);
#endif
}
push_front (message) ;
free (message) ;
}
//-------------------------------------------------------------------------
/// back : code + int
void Add(const int msg, const int intValue)
{
char message[20];
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && (! UNDER_CE) // visual studio 2005 : deprecated function
sprintf_s(message, 20, "%5d%11d", msg, intValue); // 5 + 11 + 1
#else
sprintf(message, "%5d%11d", msg, intValue); // 5 + 11 + 1
#endif
push_back (message) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -