mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-15 07:40:44 +02:00
Added new decl editor.
This commit is contained in:
@@ -31,75 +31,117 @@ If you have questions concerning this license or the applicable additional terms
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../comafx/CSyntaxRichEditCtrl.h"
|
||||
#include "afxcmn.h"
|
||||
|
||||
// DialogDeclEditor dialog
|
||||
// Despite the legacy file/class name this is no longer a dialog. It is a
|
||||
// dockable child-window editor used by the inspector declaration tab. It uses
|
||||
// only stock MFC controls and no custom syntax edit widget.
|
||||
|
||||
class DialogDeclEditor : public CDialog {
|
||||
class DialogDeclEditor : public CWnd {
|
||||
|
||||
DECLARE_DYNAMIC(DialogDeclEditor)
|
||||
|
||||
public:
|
||||
DialogDeclEditor( CWnd* pParent = NULL ); // standard constructor
|
||||
DialogDeclEditor();
|
||||
virtual ~DialogDeclEditor();
|
||||
|
||||
BOOL Create( CWnd *parent, UINT id = 0 );
|
||||
void LoadDecl( idDecl *decl );
|
||||
void ClearDecl( void );
|
||||
bool IsModified( void ) const { return modified; }
|
||||
idDecl * GetDecl( void ) const { return decl; }
|
||||
|
||||
//{{AFX_VIRTUAL(DialogDeclEditor)
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void DoDataExchange( CDataExchange* pDX ); // DDX/DDV support
|
||||
virtual BOOL PreTranslateMessage( MSG* pMsg );
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(DialogDeclEditor)
|
||||
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
|
||||
afx_msg BOOL OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
|
||||
afx_msg BOOL OnEraseBkgnd( CDC* pDC );
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnSetFocus( CWnd *pOldWnd );
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );
|
||||
afx_msg void OnMove( int x, int y );
|
||||
afx_msg void OnSize( UINT nType, int cx, int cy );
|
||||
afx_msg void OnSizing( UINT nSide, LPRECT lpRect );
|
||||
afx_msg void OnEditGoToLine();
|
||||
afx_msg void OnEditFind();
|
||||
afx_msg void OnEditFindNext();
|
||||
afx_msg void OnEditReplace();
|
||||
afx_msg LRESULT OnFindDialogMessage( WPARAM wParam, LPARAM lParam );
|
||||
afx_msg void OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg void OnEnInputEdit( NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg void OnNameChange();
|
||||
afx_msg void OnRawBodyChange();
|
||||
afx_msg void OnPropertyItemChanged( NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg void OnPropertyCustomDraw( NMHDR *pNMHDR, LRESULT *pResult );
|
||||
afx_msg void OnBnClickedAddProperty();
|
||||
afx_msg void OnBnClickedRemoveProperty();
|
||||
afx_msg void OnBnClickedParseRaw();
|
||||
afx_msg void OnBnClickedDeleteDecl();
|
||||
afx_msg void OnBnClickedTest();
|
||||
afx_msg void OnBnClickedOk();
|
||||
afx_msg void OnBnClickedCancel();
|
||||
//}}AFX_MSG
|
||||
afx_msg void OnBnClickedSave();
|
||||
afx_msg void OnBnClickedRevert();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
|
||||
//{{AFX_DATA(DialogDeclEditor)
|
||||
enum { IDD = IDD_DIALOG_DECLEDITOR };
|
||||
CStatusBarCtrl statusBar;
|
||||
CSyntaxRichEditCtrl declEdit;
|
||||
CStatic typeLabel;
|
||||
CStatic fileLabel;
|
||||
CStatic nameLabel;
|
||||
CStatic propertiesLabel;
|
||||
CStatic keyLabel;
|
||||
CStatic valueLabel;
|
||||
CStatic rawBodyLabel;
|
||||
CStatic statusText;
|
||||
CEdit nameEdit;
|
||||
CEdit keyEdit;
|
||||
CEdit valueEdit;
|
||||
CEdit rawBodyEdit;
|
||||
CListCtrl propertyList;
|
||||
CButton addPropertyButton;
|
||||
CButton removePropertyButton;
|
||||
CButton parseRawButton;
|
||||
CButton deleteDeclButton;
|
||||
CButton testButton;
|
||||
CButton okButton;
|
||||
CButton cancelButton;
|
||||
//}}AFX_DATA
|
||||
CButton saveButton;
|
||||
CButton revertButton;
|
||||
|
||||
struct declProperty_t {
|
||||
idStr key;
|
||||
idStr value;
|
||||
int lineIndex;
|
||||
bool quotedKey;
|
||||
bool quotedValue;
|
||||
};
|
||||
|
||||
static toolTip_t toolTips[];
|
||||
|
||||
HACCEL m_hAccel;
|
||||
CRect initialRect;
|
||||
CFindReplaceDialog *findDlg;
|
||||
CString findStr;
|
||||
CString replaceStr;
|
||||
bool matchCase;
|
||||
bool matchWholeWords;
|
||||
bool searchForward;
|
||||
idDecl * decl;
|
||||
int firstLine;
|
||||
bool modified;
|
||||
bool updatingControls;
|
||||
bool controlsCreated;
|
||||
|
||||
CFont modernFont;
|
||||
CFont monoFont;
|
||||
CBrush bgBrush;
|
||||
CBrush panelBrush;
|
||||
CBrush editBrush;
|
||||
CBrush staticBrush;
|
||||
|
||||
idList<declProperty_t> properties;
|
||||
|
||||
private:
|
||||
void CreateChildControls( void );
|
||||
void ApplyDarkTheme( void );
|
||||
void ApplyFontRecursive( CWnd *wnd );
|
||||
void SetControlsEnabled( bool enabled );
|
||||
void SetModified( bool isModified );
|
||||
void LoadBodyText( const char *declText );
|
||||
void GetBodyText( idStr &bodyText ) const;
|
||||
void SetBodyText( const idStr &bodyText );
|
||||
void BuildDeclText( idStr &declText ) const;
|
||||
void SyncPropertiesFromBody( void );
|
||||
void RefreshPropertyList( void );
|
||||
void SelectProperty( int listIndex );
|
||||
int FindProperty( const char *key ) const;
|
||||
bool UpsertPropertyInBody( const char *oldKey, const char *newKey, const char *value );
|
||||
bool RemovePropertyFromBody( const char *key );
|
||||
bool GetEditedDeclName( idStr &name ) const;
|
||||
bool TestDecl( const idStr &declText );
|
||||
bool SaveDeclText( void );
|
||||
void UpdateStatusBar( void );
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user