mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 19:23:51 +02:00
Switched ConsoleDlg over to richtext
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
|
||||
This file is part of the IceTech GPL Source Code (?IceTech Source Code?).
|
||||
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
|
||||
@@ -16,17 +16,15 @@ 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.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with IceTech Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the IceTech Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the IceTech Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing Justin Marshall, justinmarshall20@gmail.com
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "afxwin.h"
|
||||
#include "afxrich.h"
|
||||
|
||||
|
||||
#define ICE_CONSOLE_DEFAULT_COLOR RGB(64, 255, 255)
|
||||
|
||||
|
||||
// CConsoleDlg dialog
|
||||
@@ -36,31 +34,50 @@ class CConsoleDlg : public CDialog
|
||||
DECLARE_DYNCREATE(CConsoleDlg)
|
||||
|
||||
public:
|
||||
CConsoleDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CConsoleDlg(CWnd* pParent = NULL);
|
||||
virtual ~CConsoleDlg();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_DIALOG_CONSOLE };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
CEdit editConsole;
|
||||
CRichEditCtrl editConsole;
|
||||
CEdit editInput;
|
||||
void AddText(const char *msg);
|
||||
void SetConsoleText ( const idStr& text );
|
||||
void ExecuteCommand ( const idStr& cmd = "" );
|
||||
|
||||
|
||||
void AddText(const char* msg);
|
||||
void SetConsoleText(const idStr& text);
|
||||
void ExecuteCommand(const idStr& cmd = "");
|
||||
|
||||
idStr consoleStr;
|
||||
idStrList consoleHistory;
|
||||
idStr currentCommand;
|
||||
int currentHistoryPosition;
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user