]> icculus.org git repositories - taylor/freespace2.git/blob - src/fred2/starfieldeditor.cpp
fix issue with looping audio streams
[taylor/freespace2.git] / src / fred2 / starfieldeditor.cpp
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/FRED2/StarfieldEditor.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Starfield editor dialog handling code
16  *
17  * $Log$
18  * Revision 1.3  2002/06/09 04:41:17  relnev
19  * added copyright header
20  *
21  * Revision 1.2  2002/05/07 03:16:44  theoddone33
22  * The Great Newline Fix
23  *
24  * Revision 1.1.1.1  2002/05/03 03:28:08  root
25  * Initial import.
26  *
27  * 
28  * 2     10/07/98 6:28p Dave
29  * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
30  * Fred. Globalized mission and campaign file extensions. Removed Silent
31  * Threat specific code.
32  * 
33  * 1     10/07/98 3:01p Dave
34  * 
35  * 1     10/07/98 3:00p Dave
36  * 
37  * 11    12/08/97 4:48p Hoffoss
38  * Moved starfield editor controls to background editor.
39  * 
40  * 10    4/17/97 2:01p Hoffoss
41  * All dialog box window states are saved between sessions now.
42  * 
43  * 9     4/17/97 9:33a Hoffoss
44  * Squished a warning.
45  * 
46  * 8     4/16/97 5:18p Hoffoss
47  * Moved Asteroid field editor stuff to a seperate dialog box.
48  * 
49  * 7     3/17/97 3:00p Hoffoss
50  * slider updates on the fly now.
51  * 
52  * 6     2/21/97 5:34p Hoffoss
53  * Added extensive modification detection and fixed a bug in initial
54  * orders editor.
55  * 
56  * 5     2/17/97 5:28p Hoffoss
57  * Checked RCS headers, added them were missing, changing description to
58  * something better, etc where needed.
59  * 
60  * 4     1/31/97 3:16p Hoffoss
61  * Asteroid field management implemented.
62  *
63  * $NoKeywords: $
64  */
65
66 #include "stdafx.h"
67 #include "fred.h"
68 #include "starfieldeditor.h"
69 #include "starfield.h"
70 #include "freddoc.h"
71
72 #ifdef _DEBUG
73 #define new DEBUG_NEW
74 #undef THIS_FILE
75 static char THIS_FILE[] = __FILE__;
76 #endif
77
78 /////////////////////////////////////////////////////////////////////////////
79 // starfield_editor dialog
80
81 starfield_editor::starfield_editor(CWnd* pParent /*=NULL*/)
82         : CDialog(starfield_editor::IDD, pParent)
83 {
84         //{{AFX_DATA_INIT(starfield_editor)
85         //}}AFX_DATA_INIT
86 }
87
88 void starfield_editor::DoDataExchange(CDataExchange* pDX)
89 {
90         CDialog::DoDataExchange(pDX);
91         //{{AFX_DATA_MAP(starfield_editor)
92         DDX_Control(pDX, IDC_SLIDER1, m_slider);
93         //}}AFX_DATA_MAP
94 }
95
96 BEGIN_MESSAGE_MAP(starfield_editor, CDialog)
97         //{{AFX_MSG_MAP(starfield_editor)
98         ON_WM_HSCROLL()
99         //}}AFX_MSG_MAP
100 END_MESSAGE_MAP()
101
102 /////////////////////////////////////////////////////////////////////////////
103 // starfield_editor message handlers
104
105 void starfield_editor::OnOK()
106 {
107         char buf[40];
108
109         UpdateData(TRUE);
110         theApp.record_window_data(&Starfield_wnd_data, this);
111         MODIFY(Num_stars, m_slider.GetPos());
112         sprintf(buf, "%d", Num_stars);
113         GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
114         update_map_window();
115 }
116
117 void starfield_editor::OnCancel()
118 {
119         theApp.record_window_data(&Starfield_wnd_data, this);
120         CDialog::OnCancel();
121 }
122
123 BOOL starfield_editor::OnInitDialog() 
124 {
125         char buf[40];
126         CDialog::OnInitDialog();
127         theApp.init_window(&Starfield_wnd_data, this);
128         
129         m_slider.SetRange(100, MAX_STARS);
130         m_slider.SetPos(Num_stars);
131         sprintf(buf, "%d", Num_stars);
132         GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
133         return TRUE;
134 }
135
136 void starfield_editor::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
137 {
138         char buf[40];
139
140         CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
141
142         MODIFY(Num_stars, m_slider.GetPos());
143         sprintf(buf, "%d", Num_stars);
144         GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
145 }
146