mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-16 00:01:53 +02:00
83 lines
2.2 KiB
C++
83 lines
2.2 KiB
C++
/*
|
|
===========================================================================
|
|
|
|
IceTech GPL Source Code
|
|
Copyright (C) 2026 Justin Marshall
|
|
|
|
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
|
|
|
IceTech Source Code is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
IceTech Source Code is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
===========================================================================
|
|
*/
|
|
#pragma once
|
|
|
|
#include "afxwin.h"
|
|
#include "afxrich.h"
|
|
|
|
|
|
#define ICE_CONSOLE_DEFAULT_COLOR RGB(64, 255, 255)
|
|
|
|
|
|
// CConsoleDlg dialog
|
|
|
|
class CConsoleDlg : public CDialog
|
|
{
|
|
DECLARE_DYNCREATE(CConsoleDlg)
|
|
|
|
public:
|
|
CConsoleDlg(CWnd* pParent = NULL);
|
|
virtual ~CConsoleDlg();
|
|
|
|
enum { IDD = IDD_DIALOG_CONSOLE };
|
|
|
|
protected:
|
|
virtual void DoDataExchange(CDataExchange* pDX);
|
|
virtual BOOL OnInitDialog();
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
public:
|
|
CRichEditCtrl editConsole;
|
|
CEdit editInput;
|
|
|
|
void AddText(const char* msg);
|
|
void SetConsoleText(const idStr& text);
|
|
void ExecuteCommand(const idStr& cmd = "");
|
|
|
|
idStr consoleStr;
|
|
idStrList consoleHistory;
|
|
idStr currentCommand;
|
|
int currentHistoryPosition;
|
|
bool saveCurrentCommand;
|
|
|
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
|
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
|
afx_msg void OnSetFocus(CWnd* pOldWnd);
|
|
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
|
|
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
|
|
|
|
private:
|
|
CBrush blackBrush;
|
|
|
|
void CreateRichConsoleFromPlaceholder();
|
|
void SetupRichConsoleDefaults();
|
|
|
|
void AppendConsoleTextColored(const char* text);
|
|
void AppendConsoleRun(const CString& text, COLORREF color);
|
|
void TrimConsoleIfNeeded();
|
|
|
|
bool TryConsumeColorToken(const char* s, int& consumed, COLORREF& color) const;
|
|
COLORREF DoomColorForIndex(char c) const;
|
|
COLORREF DoomColorForName(const char* name, int& consumed) const;
|
|
|
|
CString NormalizeNewlines(const CString& in) const;
|
|
}; |