doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DialogScriptEditor.cpp
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 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 Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 #include "../../sys/win32/rc/Common_resource.h"
33 #include "../../sys/win32/rc/ScriptEditor_resource.h"
34 
35 #include "../comafx/DialogGoToLine.h"
36 #include "DialogScriptEditor.h"
37 
38 #ifdef ID_DEBUG_MEMORY
39 #undef new
40 #undef DEBUG_NEW
41 #define DEBUG_NEW new
42 #endif
43 
44 
45 typedef struct scriptEventInfo_s {
50 
51 static idList<scriptEventInfo_t> scriptEvents;
52 
53 static DialogScriptEditor *g_ScriptDialog = NULL;
54 
55 // DialogScriptEditor dialog
56 
57 static UINT FindDialogMessage = ::RegisterWindowMessage( FINDMSGSTRING );
58 
60  { IDOK, "save" },
61  { IDCANCEL, "cancel" },
62  { 0, NULL }
63 };
64 
65 
66 IMPLEMENT_DYNAMIC(DialogScriptEditor, CDialog)
67 
68 /*
69 ================
70 DialogScriptEditor::DialogScriptEditor
71 ================
72 */
73 DialogScriptEditor::DialogScriptEditor( CWnd* pParent /*=NULL*/ )
74  : CDialog(DialogScriptEditor::IDD, pParent)
75  , findDlg(NULL)
76  , matchCase(false)
77  , matchWholeWords(false)
78  , firstLine(0)
79 {
80 }
81 
82 /*
83 ================
84 DialogScriptEditor::~DialogScriptEditor
85 ================
86 */
88 }
89 
90 /*
91 ================
92 DialogScriptEditor::DoDataExchange
93 ================
94 */
95 void DialogScriptEditor::DoDataExchange(CDataExchange* pDX) {
96  CDialog::DoDataExchange(pDX);
97  //{{AFX_DATA_MAP(DialogScriptEditor)
98  DDX_Control(pDX, IDC_SCRIPTEDITOR_EDIT_TEXT, scriptEdit);
99  DDX_Control(pDX, IDOK, okButton);
100  DDX_Control(pDX, IDCANCEL, cancelButton);
101  //}}AFX_DATA_MAP
102 }
103 
104 /*
105 ================
106 DialogScriptEditor::PreTranslateMessage
107 ================
108 */
110  if ( WM_KEYFIRST <= pMsg->message && pMsg->message <= WM_KEYLAST ) {
111  if ( m_hAccel && ::TranslateAccelerator( m_hWnd, m_hAccel, pMsg ) ) {
112  return TRUE;
113  }
114  }
115  return CWnd::PreTranslateMessage(pMsg);
116 }
117 
118 /*
119 ================
120 DialogScriptEditor::UpdateStatusBar
121 ================
122 */
124  int line, column, character;
125 
126  scriptEdit.GetCursorPos( line, column, character );
127  statusBar.SetWindowText( va( "Line: %d, Column: %d, Character: %d", line, column, character ) );
128 }
129 
130 /*
131 ================
132 DialogScriptEditor::InitScriptEvents
133 ================
134 */
136  int index;
137  idParser src;
138  idToken token;
139  idStr whiteSpace;
140  scriptEventInfo_t info;
141 
142  if ( !src.LoadFile( "script/doom_events.script" ) ) {
143  return;
144  }
145 
146  scriptEvents.Clear();
147 
148  while( src.ReadToken( &token ) ) {
149  if ( token == "scriptEvent" ) {
150 
151  src.GetLastWhiteSpace( whiteSpace );
152  index = whiteSpace.Find( "//" );
153  if ( index != -1 ) {
154  info.help = whiteSpace.Right( whiteSpace.Length() - index );
155  info.help.Replace( "\r", "" );
156  info.help.Replace( "\n", "\r\n" );
157  } else {
158  info.help = "";
159  }
160 
161  src.ExpectTokenType( TT_NAME, 0, &token );
162 
163  info.parms = token;
164 
165  src.ExpectTokenType( TT_NAME, 0, &token );
166 
167  info.name = token;
168 
169  src.ExpectTokenString( "(" );
170 
171  info.parms += " " + info.name + "(";
172  while( src.ReadToken( &token ) && token != ";" ) {
173  info.parms.Append( " " + token );
174  }
175 
176  scriptEvents.Append( info );
177  }
178  }
179 }
180 
181 /*
182 ================
183 GetScriptEvents
184 ================
185 */
186 bool GetScriptEvents( const char *objectName, CListBox &listBox ) {
187  for ( int i = 0; i < scriptEvents.Num(); i++ ) {
188  listBox.AddString( scriptEvents[i].name );
189  }
190  return true;
191 }
192 
193 /*
194 ================
195 GetFunctionParms
196 ================
197 */
198 bool GetFunctionParms( const char *funcName, CString &parmString ) {
199  for ( int i = 0; i < scriptEvents.Num(); i++ ) {
200  if ( scriptEvents[i].name.Cmp( funcName ) == 0 ) {
201  parmString = scriptEvents[i].parms;
202  return true;
203  }
204  }
205  return false;
206 }
207 
208 /*
209 ================
210 GetToolTip
211 ================
212 */
213 bool GetToolTip( const char *name, CString &string ) {
214  for ( int i = 0; i < scriptEvents.Num(); i++ ) {
215  if ( scriptEvents[i].name.Cmp( name ) == 0 ) {
216  string = scriptEvents[i].help + scriptEvents[i].parms;
217  return true;
218  }
219  }
220  return false;
221 }
222 
223 /*
224 ================
225 DialogScriptEditor::OpenFile
226 ================
227 */
228 void DialogScriptEditor::OpenFile( const char *fileName ) {
229  int numLines = 0;
230  int numCharsPerLine = 0;
231  int maxCharsPerLine = 0;
232  idStr scriptText, extension;
233  CRect rect;
234  void *buffer;
235 
236  scriptEdit.Init();
237  scriptEdit.AllowPathNames( false );
238 
239  idStr( fileName ).ExtractFileExtension( extension );
240 
241  if ( extension.Icmp( "script" ) == 0 ) {
244  scriptEdit.LoadKeyWordsFromFile( "editors/script.def" );
248  } else if ( extension.Icmp( "gui" ) == 0 ) {
249  scriptEdit.SetStringColor( SRE_COLOR_DARK_CYAN, SRE_COLOR_LIGHT_BROWN );
250  scriptEdit.LoadKeyWordsFromFile( "editors/gui.def" );
251  }
252 
253  if ( fileSystem->ReadFile( fileName, &buffer ) == -1 ) {
254  return;
255  }
256  scriptText = (char *) buffer;
257  fileSystem->FreeFile( buffer );
258 
259  this->fileName = fileName;
260 
261  // clean up new-line crapola
262  scriptText.Replace( "\r", "" );
263  scriptText.Replace( "\n", "\r" );
264  scriptText.Replace( "\v", "\r" );
265 
266  scriptEdit.SetText( scriptText );
267 
268  for( const char *ptr = scriptText.c_str(); *ptr; ptr++ ) {
269  if ( *ptr == '\r' ) {
270  if ( numCharsPerLine > maxCharsPerLine ) {
271  maxCharsPerLine = numCharsPerLine;
272  }
273  numCharsPerLine = 0;
274  numLines++;
275  } else if ( *ptr == '\t' ) {
276  numCharsPerLine += TAB_SIZE;
277  } else {
278  numCharsPerLine++;
279  }
280  }
281 
282  SetWindowText( va( "Script Editor (%s)", fileName ) );
283 
284  rect.left = initialRect.left;
285  rect.right = rect.left + maxCharsPerLine * FONT_WIDTH + 32;
286  rect.top = initialRect.top;
287  rect.bottom = rect.top + numLines * (FONT_HEIGHT+8) + 24 + 56;
288  if ( rect.right < initialRect.right ) {
289  rect.right = initialRect.right;
290  } else if ( rect.right - rect.left > 1024 ) {
291  rect.right = rect.left + 1024;
292  }
293  if ( rect.bottom < initialRect.bottom ) {
294  rect.bottom = initialRect.bottom;
295  } else if ( rect.bottom - rect.top > 768 ) {
296  rect.bottom = rect.top + 768;
297  }
298  MoveWindow( rect );
299 
300  okButton.EnableWindow( FALSE );
301 
302  UpdateStatusBar();
303 
304  scriptEdit.SetFocus();
305 }
306 
307 /*
308 ================
309 DialogScriptEditor::OnInitDialog
310 ================
311 */
313 
315 
316  CDialog::OnInitDialog();
317 
318  // load accelerator table
319  m_hAccel = ::LoadAccelerators( AfxGetResourceHandle(), MAKEINTRESOURCE( IDR_ACCELERATOR_SCRIPTEDITOR ) );
320 
321  // create status bar
322  statusBar.CreateEx( SBARS_SIZEGRIP, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, initialRect, this, AFX_IDW_STATUS_BAR );
323 
324  scriptEdit.LimitText( 1024 * 1024 );
325 
326  GetClientRect( initialRect );
327 
328  SetWindowText( "Script Editor" );
329 
330  EnableToolTips( TRUE );
331 
332  okButton.EnableWindow( FALSE );
333 
334  UpdateStatusBar();
335 
336  return FALSE; // return TRUE unless you set the focus to a control
337  // EXCEPTION: OCX Property Pages should return FALSE
338 }
339 
340 BEGIN_MESSAGE_MAP(DialogScriptEditor, CDialog)
341  ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
342  ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
343  ON_WM_DESTROY()
344  ON_WM_ACTIVATE()
345  ON_WM_MOVE()
346  ON_WM_SIZE()
347  ON_WM_SIZING()
348  ON_WM_SETFOCUS()
349  ON_COMMAND(ID_EDIT_FIND, OnEditFind)
350  ON_COMMAND(ID_EDIT_REPLACE, OnEditReplace)
351  ON_COMMAND(ID_SCRIPTEDITOR_FIND_NEXT, OnEditFindNext)
352  ON_COMMAND(ID_SCRIPTEDITOR_GOTOLINE, OnEditGoToLine)
353  ON_REGISTERED_MESSAGE(FindDialogMessage, OnFindDialogMessage)
354  ON_NOTIFY(EN_CHANGE, IDC_SCRIPTEDITOR_EDIT_TEXT, OnEnChangeEdit)
355  ON_NOTIFY(EN_MSGFILTER, IDC_SCRIPTEDITOR_EDIT_TEXT, OnEnInputEdit)
356  ON_BN_CLICKED(IDOK, OnBnClickedOk)
357  ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
358 END_MESSAGE_MAP()
359 
360 /*
361 ================
362 ScriptEditorInit
363 ================
364 */
365 void ScriptEditorInit( const idDict *spawnArgs ) {
366 
367  if ( renderSystem->IsFullScreen() ) {
368  common->Printf( "Cannot run the script editor in fullscreen mode.\n"
369  "Set r_fullscreen to 0 and vid_restart.\n" );
370  return;
371  }
372 
373  if ( g_ScriptDialog == NULL ) {
374  InitAfx();
375  g_ScriptDialog = new DialogScriptEditor();
376  }
377 
378  if ( g_ScriptDialog->GetSafeHwnd() == NULL) {
379  g_ScriptDialog->Create( IDD_DIALOG_SCRIPTEDITOR );
380 /*
381  // FIXME: restore position
382  CRect rct;
383  g_ScriptDialog->SetWindowPos( NULL, rct.left, rct.top, 0, 0, SWP_NOSIZE );
384 */
385  }
386 
388 
389  g_ScriptDialog->ShowWindow( SW_SHOW );
390  g_ScriptDialog->SetFocus();
391 
392  if ( spawnArgs ) {
393  }
394 }
395 
396 /*
397 ================
398 ScriptEditorRun
399 ================
400 */
401 void ScriptEditorRun( void ) {
402 #if _MSC_VER >= 1300
403  MSG *msg = AfxGetCurrentMessage(); // TODO Robert fix me!!
404 #else
405  MSG *msg = &m_msgCur;
406 #endif
407 
408  while( ::PeekMessage(msg, NULL, NULL, NULL, PM_NOREMOVE) ) {
409  // pump message
410  if ( !AfxGetApp()->PumpMessage() ) {
411  }
412  }
413 }
414 
415 /*
416 ================
417 ScriptEditorShutdown
418 ================
419 */
420 void ScriptEditorShutdown( void ) {
421  delete g_ScriptDialog;
422  g_ScriptDialog = NULL;
423  scriptEvents.Clear();
424 }
425 
426 
427 // DialogScriptEditor message handlers
428 
429 /*
430 ================
431 DialogScriptEditor::OnActivate
432 ================
433 */
434 void DialogScriptEditor::OnActivate( UINT nState, CWnd *pWndOther, BOOL bMinimized ) {
435  CDialog::OnActivate( nState, pWndOther, bMinimized );
436 }
437 
438 /*
439 ================
440 DialogScriptEditor::OnToolTipNotify
441 ================
442 */
443 BOOL DialogScriptEditor::OnToolTipNotify( UINT id, NMHDR *pNMHDR, LRESULT *pResult ) {
444  return DefaultOnToolTipNotify( toolTips, id, pNMHDR, pResult );
445 }
446 
447 /*
448 ================
449 DialogScriptEditor::OnSetFocus
450 ================
451 */
452 void DialogScriptEditor::OnSetFocus( CWnd *pOldWnd ) {
453  CDialog::OnSetFocus( pOldWnd );
454 }
455 
456 /*
457 ================
458 DialogScriptEditor::OnDestroy
459 ================
460 */
462  return CDialog::OnDestroy();
463 }
464 
465 /*
466 ================
467 DialogScriptEditor::OnMove
468 ================
469 */
470 void DialogScriptEditor::OnMove( int x, int y ) {
471  if ( GetSafeHwnd() ) {
472  CRect rct;
473  GetWindowRect( rct );
474  // FIXME: save position
475  }
476  CDialog::OnMove( x, y );
477 }
478 
479 /*
480 ================
481 DialogScriptEditor::OnSize
482 ================
483 */
484 #define BORDER_SIZE 0
485 #define BUTTON_SPACE 4
486 #define TOOLBAR_HEIGHT 24
487 
488 void DialogScriptEditor::OnSize( UINT nType, int cx, int cy ) {
489  CRect clientRect, rect;
490 
491  LockWindowUpdate();
492 
493  CDialog::OnSize( nType, cx, cy );
494 
495  GetClientRect( clientRect );
496 
497  if ( scriptEdit.GetSafeHwnd() ) {
498  rect.left = BORDER_SIZE;
499  rect.top = BORDER_SIZE;
500  rect.right = clientRect.Width() - BORDER_SIZE;
501  rect.bottom = clientRect.Height() - 56;
502  scriptEdit.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
503  }
504 
505  if ( okButton.GetSafeHwnd() ) {
506  okButton.GetClientRect( rect );
507  int width = rect.Width();
508  int height = rect.Height();
509  rect.left = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - 2 * width;
510  rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
511  rect.right = clientRect.Width() - BORDER_SIZE - BUTTON_SPACE - width;
512  rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
513  okButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
514  }
515 
516  if ( cancelButton.GetSafeHwnd() ) {
517  cancelButton.GetClientRect( rect );
518  int width = rect.Width();
519  int height = rect.Height();
520  rect.left = clientRect.Width() - BORDER_SIZE - width;
521  rect.top = clientRect.Height() - TOOLBAR_HEIGHT - height;
522  rect.right = clientRect.Width() - BORDER_SIZE;
523  rect.bottom = clientRect.Height() - TOOLBAR_HEIGHT;
524  cancelButton.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
525  }
526 
527  if ( statusBar.GetSafeHwnd() ) {
528  rect.left = clientRect.Width() - 2;
529  rect.top = clientRect.Height() - 2;
530  rect.right = clientRect.Width() - 2;
531  rect.bottom = clientRect.Height() - 2;
532  statusBar.MoveWindow( rect.left, rect.top, rect.Width(), rect.Height() );
533  }
534 
535  UnlockWindowUpdate();
536 }
537 
538 /*
539 ================
540 DialogScriptEditor::OnSizing
541 ================
542 */
543 void DialogScriptEditor::OnSizing( UINT nSide, LPRECT lpRect ) {
544  /*
545  1 = left
546  2 = right
547  3 = top
548  4 = left - top
549  5 = right - top
550  6 = bottom
551  7 = left - bottom
552  8 = right - bottom
553  */
554 
555  CDialog::OnSizing( nSide, lpRect );
556 
557  if ( ( nSide - 1 ) % 3 == 0 ) {
558  if ( lpRect->right - lpRect->left < initialRect.Width() ) {
559  lpRect->left = lpRect->right - initialRect.Width();
560  }
561  } else if ( ( nSide - 2 ) % 3 == 0 ) {
562  if ( lpRect->right - lpRect->left < initialRect.Width() ) {
563  lpRect->right = lpRect->left + initialRect.Width();
564  }
565  }
566  if ( nSide >= 3 && nSide <= 5 ) {
567  if ( lpRect->bottom - lpRect->top < initialRect.Height() ) {
568  lpRect->top = lpRect->bottom - initialRect.Height();
569  }
570  } else if ( nSide >= 6 && nSide <= 9 ) {
571  if ( lpRect->bottom - lpRect->top < initialRect.Height() ) {
572  lpRect->bottom = lpRect->top + initialRect.Height();
573  }
574  }
575 }
576 
577 /*
578 ================
579 DialogScriptEditor::OnEditGoToLine
580 ================
581 */
583  DialogGoToLine goToLineDlg;
584 
585  goToLineDlg.SetRange( firstLine, firstLine + scriptEdit.GetLineCount() - 1 );
586  if ( goToLineDlg.DoModal() != IDOK ) {
587  return;
588  }
589  scriptEdit.GoToLine( goToLineDlg.GetLine() - firstLine );
590 }
591 
592 /*
593 ================
594 DialogScriptEditor::OnEditFind
595 ================
596 */
598 
599  CString selText = scriptEdit.GetSelText();
600  if ( selText.GetLength() ) {
601  findStr = selText;
602  }
603 
604  // create find/replace dialog
605  if ( !findDlg ) {
606  findDlg = new CFindReplaceDialog(); // Must be created on the heap
607  findDlg->Create( TRUE, findStr, "", FR_DOWN, this );
608  }
609 }
610 
611 /*
612 ================
613 DialogScriptEditor::OnEditFindNext
614 ================
615 */
618  scriptEdit.SetFocus();
619  } else {
620  AfxMessageBox( "The specified text was not found.", MB_OK | MB_ICONINFORMATION, 0 );
621  }
622 }
623 
624 /*
625 ================
626 DialogScriptEditor::OnEditReplace
627 ================
628 */
630 
631  CString selText = scriptEdit.GetSelText();
632  if ( selText.GetLength() ) {
633  findStr = selText;
634  }
635 
636  // create find/replace dialog
637  if ( !findDlg ) {
638  findDlg = new CFindReplaceDialog(); // Must be created on the heap
639  findDlg->Create( FALSE, findStr, "", FR_DOWN, this );
640  }
641 }
642 
643 /*
644 ================
645 DialogScriptEditor::OnFindDialogMessage
646 ================
647 */
648 LRESULT DialogScriptEditor::OnFindDialogMessage( WPARAM wParam, LPARAM lParam ) {
649  if ( findDlg == NULL ) {
650  return 0;
651  }
652 
653  if ( findDlg->IsTerminating() ) {
654  findDlg = NULL;
655  return 0;
656  }
657 
658  if( findDlg->FindNext() ) {
659  findStr = findDlg->GetFindString();
660  matchCase = findDlg->MatchCase() != FALSE;
661  matchWholeWords = findDlg->MatchWholeWord() != FALSE;
662  searchForward = findDlg->SearchDown() != FALSE;
663 
664  OnEditFindNext();
665  }
666 
667  if ( findDlg->ReplaceCurrent() ) {
668  long selStart, selEnd;
669 
670  replaceStr = findDlg->GetReplaceString();
671 
672  scriptEdit.GetSel( selStart, selEnd );
673  if ( selEnd > selStart ) {
674  scriptEdit.ReplaceSel( replaceStr, TRUE );
675  }
676  }
677 
678  if ( findDlg->ReplaceAll() ) {
679  replaceStr = findDlg->GetReplaceString();
680  findStr = findDlg->GetFindString();
681  matchCase = findDlg->MatchCase() != FALSE;
682  matchWholeWords = findDlg->MatchWholeWord() != FALSE;
683 
685  if ( numReplaces == 0 ) {
686  AfxMessageBox( "The specified text was not found.", MB_OK | MB_ICONINFORMATION, 0 );
687  } else {
688  AfxMessageBox( va( "Replaced %d occurances.", numReplaces ), MB_OK | MB_ICONINFORMATION, 0 );
689  }
690  }
691 
692  return 0;
693 }
694 
695 /*
696 ================
697 DialogScriptEditor::OnEnChangeEdit
698 ================
699 */
700 void DialogScriptEditor::OnEnChangeEdit( NMHDR *pNMHDR, LRESULT *pResult ) {
701  okButton.EnableWindow( TRUE );
702 }
703 
704 /*
705 ================
706 DialogScriptEditor::OnEnInputEdit
707 ================
708 */
709 void DialogScriptEditor::OnEnInputEdit( NMHDR *pNMHDR, LRESULT *pResult ) {
710  MSGFILTER *msgFilter = (MSGFILTER *)pNMHDR;
711 
712  if ( msgFilter->msg != 512 && msgFilter->msg != 33 ) {
713  UpdateStatusBar();
714  }
715 
716  *pResult = 0;
717 }
718 
719 /*
720 ================
721 DialogScriptEditor::OnBnClickedOk
722 ================
723 */
725  idStr scriptText;
726 
727  common->Printf( "Writing \'%s\'...\n", fileName.c_str() );
728 
729  scriptEdit.GetText( scriptText );
730 
731  // clean up new-line crapola
732  scriptText.Replace( "\n", "" );
733  scriptText.Replace( "\r", "\r\n" );
734  scriptText.Replace( "\v", "\r\n" );
735 
736  if ( fileSystem->WriteFile( fileName, scriptText, scriptText.Length(), "fs_devpath" ) == -1 ) {
737  MessageBox( va( "Couldn't save: %s", fileName.c_str() ), va( "Error saving: %s", fileName.c_str() ), MB_OK | MB_ICONERROR );
738  return;
739  }
740 
741  okButton.EnableWindow( FALSE );
742 }
743 
744 /*
745 ================
746 DialogScriptEditor::OnBnClickedCancel
747 ================
748 */
750  if ( okButton.IsWindowEnabled() ) {
751  if ( MessageBox( "Cancel changes?", "Cancel", MB_YESNO | MB_ICONQUESTION ) != IDYES ) {
752  return;
753  }
754  }
755  OnCancel();
756 }
BOOL DefaultOnToolTipNotify(const toolTip_t *toolTips, UINT id, NMHDR *pNMHDR, LRESULT *pResult)
Definition: StdAfx.cpp:104
bool GetFunctionParms(const char *funcName, CString &parmString)
afx_msg LRESULT OnFindDialogMessage(WPARAM wParam, LPARAM lParam)
int GetLine(void) const
#define TOOLBAR_HEIGHT
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
void GetText(idStr &text) const
afx_msg void OnSizing(UINT nSide, LPRECT lpRect)
void SetFunctionParmCallback(toolTipCallback_t callback)
#define TT_NAME
Definition: Token.h:44
void SetStringColor(const COLORREF color, const COLORREF altColor=-1)
#define const
Definition: getdate.c:251
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
int Length(void) const
Definition: Str.h:702
static void ClearStates(void)
Definition: KeyInput.cpp:746
GLenum GLint GLint y
Definition: glext.h:2849
void SetRange(int firstLine, int lastLine)
idRenderSystem * renderSystem
virtual void DoDataExchange(CDataExchange *pDX)
idFileSystem * fileSystem
Definition: FileSystem.cpp:500
bool FindNext(const char *find, bool matchCase, bool matchWholeWords, bool searchForward)
afx_msg void OnEditGoToLine()
#define IDD_DIALOG_SCRIPTEDITOR
int ExpectTokenString(const char *string)
Definition: Parser.cpp:2402
CSyntaxRichEditCtrl scriptEdit
Definition: Token.h:71
void ScriptEditorRun(void)
GLuint src
Definition: glext.h:5390
bool GetToolTip(const char *name, CString &string)
GLenum GLint x
Definition: glext.h:2849
int i
Definition: process.py:33
virtual void FreeFile(void *buffer)=0
#define BOOL
Definition: mprintf.c:71
void SetObjectMemberCallback(objectMemberCallback_t callback)
#define IDC_SCRIPTEDITOR_EDIT_TEXT
int Icmp(const char *text) const
Definition: Str.h:667
#define ID_SCRIPTEDITOR_FIND_NEXT
virtual int WriteFile(const char *relativePath, const void *buffer, int size, const char *basePath="fs_savepath")=0
void SetToolTipCallback(toolTipCallback_t callback)
void SetText(const char *text)
void InitAfx(void)
Definition: StdAfx.cpp:53
int com_editors
Definition: Common.cpp:97
afx_msg void OnEnChangeEdit(NMHDR *pNMHDR, LRESULT *pResult)
int ReadToken(idToken *token)
Definition: Parser.cpp:2338
afx_msg void OnMove(int x, int y)
afx_msg void OnEditReplace()
void AllowPathNames(bool allow)
afx_msg void OnBnClickedOk()
virtual bool IsFullScreen(void) const =0
GLuint index
Definition: glext.h:3476
CFindReplaceDialog * findDlg
idCommon * common
Definition: Common.cpp:206
Definition: Dict.h:65
#define NULL
Definition: Lib.h:88
void GetCursorPos(int &line, int &column, int &character) const
GLuint buffer
Definition: glext.h:3108
afx_msg void OnSize(UINT nType, int cx, int cy)
afx_msg void OnBnClickedCancel()
afx_msg void OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized)
const char * Right(int len, idStr &result) const
Definition: Str.h:896
int Find(const char c, int start=0, int end=-1) const
Definition: Str.h:874
void ScriptEditorInit(const idDict *spawnArgs)
GLenum GLsizei width
Definition: glext.h:2846
virtual void Printf(const char *fmt,...) id_attribute((format(printf
afx_msg void OnEditFindNext()
GLenum GLsizei GLsizei height
Definition: glext.h:2856
static toolTip_t toolTips[]
struct scriptEventInfo_s scriptEventInfo_t
bool GetScriptEvents(const char *objectName, CListBox &listBox)
void OpenFile(const char *fileName)
int Append(const type &obj)
Definition: List.h:646
#define BORDER_SIZE
void Append(const char a)
Definition: Str.h:729
int Num(void) const
Definition: List.h:265
int LoadFile(const char *filename, bool OSPath=false)
Definition: Parser.cpp:3013
afx_msg void OnSetFocus(CWnd *pOldWnd)
const GLcharARB * name
Definition: glext.h:3629
#define ID_SCRIPTEDITOR_GOTOLINE
afx_msg void OnEnInputEdit(NMHDR *pNMHDR, LRESULT *pResult)
Definition: Str.h:116
const char * c_str(void) const
Definition: Str.h:487
#define FALSE
Definition: mprintf.c:70
#define TRUE
Definition: mprintf.c:69
virtual BOOL OnInitDialog()
void SetCaseSensitive(bool caseSensitive)
char * va(const char *fmt,...)
Definition: Str.cpp:1568
void ExtractFileExtension(idStr &dest) const
Definition: Str.cpp:965
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:2866
virtual BOOL PreTranslateMessage(MSG *pMsg)
void Replace(const char *old, const char *nw)
Definition: Str.cpp:563
Definition: List.h:84
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
CStatusBarCtrl statusBar
bool LoadKeyWordsFromFile(const char *fileName)
void ScriptEditorShutdown(void)
#define BUTTON_SPACE
#define IDR_ACCELERATOR_SCRIPTEDITOR
int ReplaceAll(const char *find, const char *replace, bool matchCase, bool matchWholeWords)
int ExpectTokenType(int type, int subtype, idToken *token)
Definition: Parser.cpp:2422
void Clear(void)
Definition: List.h:184
int GetLastWhiteSpace(idStr &whiteSpace) const
Definition: Parser.cpp:2904