29 #include "../../idlib/precompiled.h"
32 #include "../../game/game.h"
33 #include "../../sys/win32/win_local.h"
34 #include "../../sys/win32/rc/common_resource.h"
35 #include "../../sys/win32/rc/PDAEditor_resource.h"
36 #include "../comafx/DialogName.h"
40 #ifdef ID_DEBUG_MEMORY
61 CDialog::DoDataExchange(pDX);
105 common->
Printf(
"Cannot run the PDA editor in fullscreen mode.\n"
106 "Set r_fullscreen to 0 and vid_restart.\n" );
110 if ( g_PDAEditorDialog ==
NULL ) {
115 if ( g_PDAEditorDialog->GetSafeHwnd() ==
NULL ) {
126 g_PDAEditorDialog->ShowWindow( SW_SHOW );
127 g_PDAEditorDialog->SetFocus();
131 const char *
name = spawnArgs->GetString(
"pda" );
139 MSG *msg = AfxGetCurrentMessage();
141 MSG *msg = &m_msgCur;
144 while( ::PeekMessage(msg,
NULL,
NULL,
NULL, PM_NOREMOVE) ) {
146 if ( !AfxGetApp()->PumpMessage() ) {
153 g_PDAEditorDialog =
NULL;
157 CDialog::OnActivate( nState, pWndOther, bMinimized );
158 if ( nState != WA_INACTIVE ) {
163 if ( GetSafeHwnd() ) {
165 GetWindowRect( rct );
168 CDialog::OnMove( x, y );
175 return CDialog::OnDestroy();
180 CDialog::OnInitDialog();
193 return CDialog::PreTranslateMessage(pMsg);
202 for ( i=0; i <
num; i++ ) {
223 windowTitle.Format(
"PDA Editor - %s", pda->
GetName());
230 windowTitle +=
" [Read Only]";
234 SetWindowText( windowTitle );
238 for ( i=0; i <
num; i++ ) {
244 for ( i=0; i <
num; i++ ) {
250 for ( i=0; i <
num; i++ ) {
277 CString declText =
"\n";
282 declText +=
"\tname \t\t\"" +
shortName +
"\"\n";
283 declText +=
"\tfullname\t\t\"" +
fullName +
"\"\n";
284 declText +=
"\ticon \t\t\"\"\n";
285 declText +=
"\tid \t\t\"" +
idnum +
"\"\n";
286 declText +=
"\tpost \t\t\"" +
post +
"\"\n";
287 declText +=
"\ttitle \t\t\"" +
title +
"\"\n";
288 declText +=
"\tsecurity\t\t\"" +
security +
"\"\n";
291 declText +=
"\tpda_email\t\t\"";
297 declText +=
"\tpda_audio\t\t\"";
303 declText +=
"\tpda_video\t\t\"";
318 idnum.Format(
"%d-%02X", 1000+(rand()%8999), (rand()%255));
333 if ( dlg.DoModal() == IDOK ) {
334 dlg.
name.MakeLower();
362 name.Format(
"%s_email_%d", pda->
GetName(), newIndex++);
367 if ( addDlg.DoModal() == IDOK ) {
402 if ( editDlg.DoModal() == IDOK ) {
458 CDialog::DoDataExchange(pDX);
479 CDialog::OnInitDialog();
481 SetWindowText(
"Editing Email: " +
name );
499 body.Replace(
"\n",
"\r\n");
503 if ( IsWindow( m_hWnd ) ) {
510 CString mungedBody =
body;
511 mungedBody.Replace(
"\r\n\r\n",
"\\n\\n\"\n\n\"");
512 mungedBody.Replace(
"\r\n",
"\\n\"\n\"");
516 declText +=
"email " +
name +
" {\n";
517 declText +=
"\tto \t\t\"" +
to +
"\"\n";
518 declText +=
"\tfrom \t\t\"" +
from +
"\"\n";
519 declText +=
"\tdate \t\t\"" +
date +
"\"\n";
520 declText +=
"\tsubject\t\t\"" +
subject +
"\"\n";
521 declText +=
"\ttext {\n";
522 declText +=
"\"" + mungedBody +
"\"\n";
#define IDC_BUTTON_VIDEO_DELETE
const char * GetPost() const
afx_msg void OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
bool ReplaceSourceFileText(void)
const char * GetFrom() const
afx_msg void OnBtnClickedEmailAdd()
const char * GetPdaName() const
CDialogPDAEditor(CWnd *pParent=NULL)
virtual const int GetNumVideos() const
#define IDC_EDIT_SECURITY
const char * GetFileName(void) const
#define IDC_BUTTON_AUDIO_EDIT
#define IDC_BUTTON_PDA_ADD
CONST PIXELFORMATDESCRIPTOR UINT
void PDAEditorShutdown(void)
afx_msg void OnBtnClickedEmailEdit()
idRenderSystem * renderSystem
afx_msg void OnBtnClickedEmailDel()
idFileSystem * fileSystem
const char * GetName(void) const
virtual idDecl * CreateNewDecl(declType_t type, const char *name, const char *fileName)=0
virtual idFile * OpenFileAppend(const char *filename, bool sync=false, const char *basePath="fs_basepath")=0
const char * GetFullName() const
afx_msg void OnBtnClickedAudioAdd()
CDialogPDAEditEmail(CWnd *pParent=NULL)
const char * GetTo() const
#define IDC_BUTTON_EMAIL_ADD
afx_msg void OnBtnClickedSave()
virtual const idDeclAudio * GetAudioByIndex(int index) const
virtual BOOL OnInitDialog()
afx_msg void OnBtnClickedPDADel()
afx_msg void OnBtnClickedAudioEdit()
#define IDC_BUTTON_VIDEO_ADD
CDialogPDAEditor * g_PDAEditorDialog
const char * GetID() const
virtual bool IsFullScreen(void) const =0
virtual const idDeclVideo * GetVideoByIndex(int index) const
virtual void AddEmail(const char *name, bool unique=true) const
const char * GetBody() const
virtual const int GetNumAudios() const
virtual const idDecl * FindType(declType_t type, const char *name, bool makeDefault=true)=0
#define IDC_BUTTON_EMAIL_EDIT
void SetEmail(const idDeclEmail *email)
const char * GetDate() const
void PDAEditorInit(const idDict *spawnArgs)
virtual void Printf(const char *fmt,...) id_attribute((format(printf
#define IDC_EDIT_FULLNAME
virtual const int GetNumEmails() const
#define IDD_DIALOG_PDA_EDITOR
afx_msg void OnBtnClickedAudioDel()
void SetText(const char *text)
idDeclManager * declManager
const char * GetSecurity() const
#define IDC_BUTTON_EMAIL_DELETE
#define IDC_BUTTON_RANDOMID
afx_msg void OnBtnClickedVideoAdd()
afx_msg void OnSelChangePDA()
virtual const idDeclEmail * GetEmailByIndex(int index) const
virtual int GetNumDecls(declType_t type)=0
#define IDC_EDIT_SHORTNAME
afx_msg void OnBtnClickedPDAAdd()
virtual const idDecl * DeclByIndex(declType_t type, int index, bool forceParse=true)=0
const char * GetTitle() const
const char * GetSubject() const
virtual void DoDataExchange(CDataExchange *pDX)
afx_msg void OnBtnClickedVideoDel()
void SetName(CString &name)
afx_msg void OnBtnClickedVideoEdit()
const char * GetVideoName() const
afx_msg void OnBtnClickedRandom()
const char * GetAudioName() const
afx_msg void OnMove(int x, int y)
virtual void CloseFile(idFile *f)=0
#define IDC_BUTTON_PDA_DEL
#define IDD_DIALOG_PDA_ADD
#define IDC_BUTTON_VIDEO_EDIT
#define IDC_BUTTON_AUDIO_DELETE
virtual BOOL PreTranslateMessage(MSG *pMsg)
virtual void DoDataExchange(CDataExchange *pDX)
#define IDC_BUTTON_AUDIO_ADD