23using namespace std::filesystem;
32class TTraceWindow::TGroupList
37 TGroupList(
TWindow* parent,
int id)
48 auto GetData(
int index) -> TDiagBase*
68 SetGroupState(index,
i->IsChecked());
76 if (
i &&
i->IsEnabled() && key ==
_T(
' '))
77 SetGroupState(index,
i->IsChecked());
80 void SetGroupState(
int index,
bool enabled)
82 const auto group = GetData(index);
89 s << (
group->IsEnabled() ? 1 : 0) <<
_T(
' ') <<
group->GetLevel();
126TTraceWindow* TTraceWindow::Instance =
nullptr;
164 TraceText +=
group->GetDiagModule()->GetName();
165 TraceText +=
_T(
": ");
243TTraceWindow::TTraceWindow()
263 RestoreWindowState();
266TTraceWindow::~TTraceWindow()
272void TTraceWindow::CmSave()
274 auto data = TFileSaveDialog::TData{};
275 data.SetFilter(
_T(
"Text Files (*.txt)|*.txt|All Files (*.*)|*.*|"));
277 data.InitialDir =
const_cast<tchar*
>(TracePath.c_str());
280 const auto n = f.size();
287 const auto makeDigit = [](
size_t i) {
return static_cast<tchar>(
'0' + (
i % 10)); };
294 TFileSaveDialog dlg{
this,
data};
295 if (dlg.Execute() ==
IDOK)
297 const auto& s = TraceMessages.
GetText();
303void TTraceWindow::CmTop()
312void TTraceWindow::CeTop(TCommandEnabler&
tce)
317void TTraceWindow::CmEditClear()
322void TTraceWindow::CmEditSelectAll()
328void TTraceWindow::CmSetLevel()
332 const auto group =
reinterpret_cast<TDiagBase*
>(TraceGroups.GetData(
i));
334 s <<
group->GetLevel();
349 TraceGroups.SetItemText(
i, FormatGroup(
group).
c_str());
360void TTraceWindow::CeSetLevel(TCommandEnabler&
tce)
365void TTraceWindow::CmNextPane()
376void TTraceWindow::CmPreviousPane()
393void TTraceWindow::LbnSelChangeModule()
397 const auto module = reinterpret_cast<TModule*>(TraceModules.GetItemData(i));
401 if (
group->GetDiagModule() == module)
407void TTraceWindow::SaveWindowState()
411 const auto ws =
_T(
' ');
412 s << Attr.X <<
ws << Attr.Y <<
ws << (Attr.X + Attr.W) <<
ws << (Attr.Y + Attr.H);
413 ini.WriteString(
_T(
"Position"), s.str());
414 ini.WriteString(
_T(
"Path"), TracePath.c_str());
417void TTraceWindow::RestoreWindowState()
422 is >>
r.left >>
r.top >>
r.right >>
r.bottom;
433 TracePath =
ini.GetString(
_T(
"Path"), TracePath);
436void TTraceWindow::AddModules(TModule* module)
440 const auto i = TraceModules.
AddString(FormatLink(
m));
444 if (
g->GetDiagModule() == module)
445 TraceGroups.AddItem(FormatGroup(
g),
g->IsEnabled(),
g);
448void TTraceWindow::UpdateTraceText()
451 const auto tmp = TraceText;
459auto TTraceWindow::FormatGroup(TDiagBase*
group) ->
tstring
463 const auto d =
ini.GetString(
n,
n);
465 s <<
d <<
_T(
" (") <<
group->GetLevel() <<
_T(
')');
469auto TTraceWindow::FormatLink(TModule* module) ->
tstring
471 return module->GetName();
Definition of class TCheckList, an ownerdrawn listbox to select multiple items.
#define PRECONDITION(condition)
TFrameWindow * GetMainWindow()
Return the current main window.
void EvLButtonDown(uint modKeys, const TPoint &point)
Toggles the checked state when the mouse is clicked in the checkbox.
int AddItem(TCheckListItem *item)
Adds the item into the checklist.
TCheckListItem * GetItem(int idx)
Returns the item at the specified index.
void EvChar(uint key, uint repeatCount, uint flags)
Toggles the checked state when the space key is pressed.
TCheckList(TWindow *parent, int id, int x, int y, int w, int h, TCheckListItem *=0, int numItems=0, TModule *=0)
Creates a checklist.
void ClearList() override
UINT_PTR GetData()
Returns the user-defined data for this item.
void SetText(const tstring &text)
Copies the text string.
Encapsulates the system font used for a specific GUI element, e.g. icon, caption, menu,...
@ sfiMessage
Represents NONCLIENTMETRICS::lfMessageFont.
static TDiagBase * GetDiagGroup(TDiagBase *curr=nullptr)
static TDiagBaseHook * SetGlobalHook(TDiagBaseHook *hook=nullptr)
A TEdit is an interface object that represents an edit control interface element.
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
auto IdleAction(long idleCount) -> bool override
Overrides TWindow's virtual function.
virtual bool SetMenu(HMENU newMenu)
Overrides TWindow's non-virtual SetMenu function, thus allowing derived classes the opportunity to im...
void CleanupWindow() override
Cleans up any associated icons.
virtual TWindow * SetClientWindow(TWindow *clientWnd)
Sets the client window to the specified window.
void SetupWindow() override
Calls TWindow::SetUpWindow to create windows in a child list.
An interface object that represents a corresponding list box element.
virtual int SetItemData(int index, LPARAM itemData)
Sets the custom value associated with the list box item at the specified index position.
virtual int AddString(LPCTSTR str)
Adds str to the list box, returning its position in the list (0 is the first position).
int GetCaretIndex() const
Returns the index of the currently focused list-box item.
virtual int GetSelIndex() const
For single-selection list boxes.
TPaneSplitter is a class that acts as a container for child windows (called panes) and splitters (pan...
virtual bool SplitPane(TWindow *target, TWindow *newPane, TSplitDirection splitDir, float percent=0.50f)
Splits given pane, 'target', with 'newPane', in either the vertical or horizontal direction.
int GetText(TCHAR *str, int maxChars) const
Retrieves the static control's text, stores it in the str argument of maxChars size,...
static void DestroyInstance()
void Output(TDiagBase *group, LPCTSTR str) override
auto IdleAction(long) -> bool override
void CleanupWindow() override
void SetupWindow() override
HWND SetFocus()
Sets the keyboard focus to current window and activates the window that receives the focus by sending...
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
TWindow()
Protected constructor for use by immediate virtually derived classes.
void DrawMenuBar()
DrawMenuBar redraws the menu bar.
bool SetWindowPos(HWND hWndInsertAfter, const TRect &rect, uint flags)
Changes the size of the window pointed to by rect.
virtual void Destroy(int retVal=0)
Destroys an MS-Windows element associated with the TWindow.
void SetWindowFont(HFONT font, bool redraw=true)
Sets the font that a control uses to draw text.
void SetRedraw(bool redraw)
Sends a WM_SETREDRAW message to a window so that changes can be redrawn (redraw = true) or to prevent...
bool IsWindow() const
Returns true if an HWND is being used.
void EvActivate(uint active, bool minimized, HWND hWndOther)
Default message handler for WM_ACTIVATE.
bool ModifyStyle(uint32 offBits, uint32 onBits, uint swpFlags=0)
Modifies the style bits of the window.
LPCTSTR GetCaption() const
Returns the Title member of TWindow.
void SetWindowText(LPCTSTR str)
Sets the window's text to the given string (by copying).
bool ModifyExStyle(uint32 offBits, uint32 onBits, uint swpFlags=0)
Modifies the style bits of the window.
static HWND GetFocus()
Gets a handle to the window that has the focus.
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
HWND GetHandle() const
Returns the handle of the window.
int GetWindowTextLength() const
Returns the length, in characters, of the specified window's title.
Definition of class TEdit.
#define DECLARE_RESPONSE_TABLE(cls)
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
virtual void LimitText(int)
Limit the amount of new text that can be entered in the edit control.
void Insert(LPCTSTR str)
Inserts the text supplied in str into the edit control at the current text insertion point (cursor po...
virtual bool SetSelection(int startPos, int endPos)
Select the characters in the range "startPos .. endPos".
static TModule * FindResModule(TResId id, TResId type)
Global search for resources.
static TModule * NextModule(TModule *module=nullptr)
Definition of class TListBox and TlistBoxData.
Object Windows Library (OWLNext Core)
std::ostringstream tostringstream
@ psNone
Unspecified split.
@ psHorizontal
Horizontal split.
@ psVertical
Vertical split.
tstring GetDiagIniFullFileName_(LPCSTR filename_)
@ BF_UNCHECKED
Item is unchecked.
@ BF_CHECKED
Item is checked.
std::istringstream tistringstream
const int CheckList_BoxWidth
auto to_tstring(const T &v) -> tstring
Definition of TOpenSave abstract, TFileOpen, TFileSave common Dialog classes.
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
Definition of TProfile class.
Definition of private class TTraceWindow.
#define EV_COMMAND_ENABLE(id, method)
Response table entry for enabling a command.
#define EV_LBN_SELCHANGE(id, method)
#define EV_LBN_DBLCLK(id, method)
#define EV_COMMAND(id, method)
Response table entry for a menu/accelerator/push button message.