FS2_Open
Open source remastering of the Freespace 2 engine
starfieldeditor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #include "stdafx.h"
13 #include "FRED.h"
14 #include "StarfieldEditor.h"
15 #include "starfield/starfield.h"
16 #include "FREDDoc.h"
17 
18 #ifdef _DEBUG
19 #undef THIS_FILE
20 static char THIS_FILE[] = __FILE__;
21 #endif
22 
24 // starfield_editor dialog
25 
26 starfield_editor::starfield_editor(CWnd* pParent /*=NULL*/)
27  : CDialog(starfield_editor::IDD, pParent)
28 {
29  //{{AFX_DATA_INIT(starfield_editor)
30  //}}AFX_DATA_INIT
31 }
32 
33 void starfield_editor::DoDataExchange(CDataExchange* pDX)
34 {
35  CDialog::DoDataExchange(pDX);
36  //{{AFX_DATA_MAP(starfield_editor)
37  DDX_Control(pDX, IDC_SLIDER1, m_slider);
38  //}}AFX_DATA_MAP
39 }
40 
41 BEGIN_MESSAGE_MAP(starfield_editor, CDialog)
42  //{{AFX_MSG_MAP(starfield_editor)
43  ON_WM_HSCROLL()
44  //}}AFX_MSG_MAP
45 END_MESSAGE_MAP()
46 
48 // starfield_editor message handlers
49 
50 void starfield_editor::OnOK()
51 {
52  char buf[40];
53 
54  UpdateData(TRUE);
56  MODIFY(Num_stars, m_slider.GetPos());
57  sprintf(buf, "%d", Num_stars);
58  GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
60 }
61 
63 {
65  CDialog::OnCancel();
66 }
67 
69 {
70  char buf[40];
71  CDialog::OnInitDialog();
73 
74  m_slider.SetRange(0, MAX_STARS);
75  m_slider.SetPos(Num_stars);
76  sprintf(buf, "%d", Num_stars);
77  GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
78  return TRUE;
79 }
80 
81 void starfield_editor::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
82 {
83  char buf[40];
84 
85  CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
86 
87  MODIFY(Num_stars, m_slider.GetPos());
88  sprintf(buf, "%d", Num_stars);
89  GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
90 }
void record_window_data(window_data *wndd, CWnd *wnd)
Definition: fred.cpp:670
CFREDApp theApp
Definition: fred.cpp:115
int init_window(window_data *wndd, CWnd *wnd, int adjust=0, int pre=0)
Definition: fred.cpp:639
CSliderCtrl m_slider
virtual BOOL OnInitDialog()
#define TRUE
Definition: pstypes.h:399
window_data Starfield_wnd_data
Definition: fred.cpp:73
unsigned int UINT
Definition: config.h:82
#define MODIFY(a, b)
Definition: fred.h:26
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
#define IDC_TOTAL
Definition: resource.h:712
const int MAX_STARS
Definition: starfield.cpp:47
virtual void DoDataExchange(CDataExchange *pDX)
int Num_stars
Definition: starfield.cpp:58
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
starfield_editor(CWnd *pParent=NULL)
int BOOL
Definition: config.h:80
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
#define IDC_SLIDER1
Definition: resource.h:711
void update_map_window()
Definition: fred.cpp:532