-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSheetMiniDB.cpp
136 lines (111 loc) · 4.14 KB
/
SheetMiniDB.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//-----------------------------------------------------------------------------
// File: SheetMiniDB.cpp
//
// Desc:
//
// Copyright (c) 2002 Dan
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Includes
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "PolygonManager.h"
#include "CustomMsg.h"
#include "main.h"
#include "resource.h"
#include "MessageProcs.h"
#include "SheetMiniDB.h"
#include "Settings.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Name: OnSheetMini_WMInitDialog()
// Desc:
//-----------------------------------------------------------------------------
void OnSheetMini_WMInitDialog( HWND hWnd )
{
char str[256];
ShowWindow( hWnd, true );
UpdateWindow( hWnd );
PolygonManager->NewBrush( SHEETBRUSH );
sprintf( str, "%f", Settings->m_fBrush_Sheet_USize );
SetDlgItemTextA( hWnd, IDC_EDIT_USIZE, str );
sprintf( str, "%f", Settings->m_fBrush_Sheet_VSize );
SetDlgItemTextA( hWnd, IDC_EDIT_VSIZE, str );
switch( Settings->m_iBrush_Sheet_Axis )
{
case 1: SendDlgItemMessage( hWnd, IDC_RADIO_SHEET_X_AXIS, BM_SETCHECK, TRUE, 0 ); break;
case 2: SendDlgItemMessage( hWnd, IDC_RADIO_SHEET_Y_AXIS, BM_SETCHECK, TRUE, 0 ); break;
case 3: SendDlgItemMessage( hWnd, IDC_RADIO_SHEET_Z_AXIS, BM_SETCHECK, TRUE, 0 ); break;
default: Settings->m_iBrush_Sheet_Axis = 1; break;
}
}
//-----------------------------------------------------------------------------
// Name: OnSheetMini_WMCommand()
// Desc:
//-----------------------------------------------------------------------------
void OnSheetMini_WMCommand( HWND hWnd, WPARAM wParam )
{
switch( LOWORD( wParam ) )
{
case IDC_RADIO_SHEET_X_AXIS:
Settings->m_iBrush_Sheet_Axis = 1;
PolygonManager->NewBrush( SHEETBRUSH );
break;
case IDC_RADIO_SHEET_Y_AXIS:
Settings->m_iBrush_Sheet_Axis = 2;
PolygonManager->NewBrush( SHEETBRUSH );
break;
case IDC_RADIO_SHEET_Z_AXIS:
Settings->m_iBrush_Sheet_Axis = 3;
PolygonManager->NewBrush( SHEETBRUSH );
break;
}
}
//-----------------------------------------------------------------------------
// Name: OnSheetMini_WMDestroy()
// Desc:
//-----------------------------------------------------------------------------
void OnSheetMini_WMDestroy( HWND hWnd )
{
UpdateSheetData( hWnd );
EndDialog( hWnd, 0 );
}
//-----------------------------------------------------------------------------
// Name: UpdateSheetData()
// Desc:
//-----------------------------------------------------------------------------
void UpdateSheetData( HWND hWnd )
{
char str[256];
GetDlgItemTextA( hWnd, IDC_EDIT_USIZE, str, 256 );
Settings->m_fBrush_Sheet_USize = (float)atof( str );
GetDlgItemTextA( hWnd, IDC_EDIT_VSIZE, str, 256 );
Settings->m_fBrush_Sheet_VSize = (float)atof( str );
if( BST_CHECKED == SendDlgItemMessage( hWnd, IDC_RADIO_SHEET_X_AXIS, BM_GETCHECK, 0, 0 ) )
Settings->m_iBrush_Sheet_Axis = 1;
else if( BST_CHECKED == SendDlgItemMessage( hWnd, IDC_RADIO_SHEET_Y_AXIS, BM_GETCHECK, 0, 0 ) )
Settings->m_iBrush_Sheet_Axis = 2;
else if( BST_CHECKED == SendDlgItemMessage( hWnd, IDC_RADIO_SHEET_Z_AXIS, BM_GETCHECK, 0, 0 ) )
Settings->m_iBrush_Sheet_Axis = 3;
}
//-----------------------------------------------------------------------------
// Name: OnSheetMini_WMKeydown()
// Desc:
//-----------------------------------------------------------------------------
void OnSheetMini_WMKeydown( WPARAM wParam, HWND hWnd )
{
switch( wParam )
{
case VK_RETURN: PolygonManager->NewBrush( SHEETBRUSH ); break;
}
}
//-----------------------------------------------------------------------------
// Name: OnSheetMini_UpdateBrush()
// Desc:
//-----------------------------------------------------------------------------
void OnSheetMini_UpdateBrush( HWND hWnd )
{
UpdateSheetData( hWnd );
PolygonManager->NewBrush( SHEETBRUSH );
}