/* =========================================================================== 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. You should have received a copy of the GNU General Public License along with IceTech Source Code. If not, see . 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 =========================================================================== */ #ifndef __DIALOGDECLEDITOR_H__ #define __DIALOGDECLEDITOR_H__ #pragma once #include "afxcmn.h" // 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 CWnd { DECLARE_DYNAMIC(DialogDeclEditor) public: 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; } virtual BOOL PreTranslateMessage( MSG* pMsg ); protected: 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 OnSize( UINT nType, int cx, int cy ); 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 OnBnClickedSave(); afx_msg void OnBnClickedRevert(); DECLARE_MESSAGE_MAP() private: 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 saveButton; CButton revertButton; struct declProperty_t { idStr key; idStr value; int lineIndex; bool quotedKey; bool quotedValue; }; static toolTip_t toolTips[]; idDecl * decl; int firstLine; bool modified; bool updatingControls; bool controlsCreated; CFont modernFont; CFont monoFont; CBrush bgBrush; CBrush panelBrush; CBrush editBrush; CBrush staticBrush; idList 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 ); }; #endif /* !__DIALOGDECLEDITOR_H__ */