Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/Tools/3dsmaxExport/OgreExport/src/OgreMaxExportTabGeneral.cpp @ 24

Last change on this file since 24 was 6, checked in by anonymous, 17 years ago

=…

File size: 2.2 KB
Line 
1#include "OgreExport.h"
2#include "resource.h"
3
4static OgreMaxExport_General* sInst;
5
6void OgreMaxExport_General::onInitDialog(HWND hDlg) {
7        OgreMaxExport_TabPaneHandler::onInitDialog(hDlg);
8
9        // set the initial dialog state
10        std::stringstream ss;
11        SetWindowText(GetDlgItem(m_hDlg, IDC_TXT_EXPORT_DIR), m_config.getExportPath().c_str());
12        SendMessage(GetDlgItem(m_hDlg, IDC_CHK_FLIP_YZ), BM_SETCHECK, (m_config.getInvertYZ() ? BST_CHECKED : BST_UNCHECKED), 0);
13
14        ss << m_config.getScale();
15        SetWindowText(GetDlgItem(m_hDlg, IDC_TXT_SCALE), ss.str().c_str());
16}
17
18void OgreMaxExport_General::onInvertYZ(bool checked) {
19        m_config.setInvertYZ(checked);
20}
21
22void OgreMaxExport_General::onSetScale(float newScale) {
23}
24
25void OgreMaxExport_General::onExportDirectoryChanged(const std::string& newDirectory) {
26        m_config.setExportPath(newDirectory);
27}
28
29void OgreMaxExport_General::onDestroy() {
30        update();
31}
32
33// read the contents from the dialog controls
34void OgreMaxExport_General::update() {
35
36        char buf[64];
37
38        // export path is not settable in the dialog at this time, skip it
39
40        // get the scale and invert-YZ settings
41        m_config.setInvertYZ(BST_CHECKED==IsDlgButtonChecked(m_hDlg, IDC_CHK_FLIP_YZ));
42
43        // we really can only do this here unless we want to process every keystroke in the scale edit box
44        GetWindowText(GetDlgItem(m_hDlg, IDC_TXT_SCALE), buf, 64);
45        float scale = atof(buf);
46
47        if (scale == 0.0f) //sets to 0.0 if the text cannot be converted; change to 1.0 in that case
48                scale = 1.0f; 
49
50        m_config.setScale(scale); 
51}
52
53// for the sake of sanity, keep the dlgproc and the handler class implementation here in the same source file
54INT_PTR CALLBACK GeneralTabDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
55
56        switch(message) {
57        case WM_INITDIALOG:
58                sInst = (OgreMaxExport_General*) lParam;
59
60                sInst->onInitDialog(hDlg);
61                SetWindowPos(hDlg, HWND_TOP, 10, 40, 0, 0, SWP_NOSIZE);
62                ShowWindow(hDlg, SW_SHOW);
63                break;
64
65        case WM_COMMAND:
66                switch(LOWORD(wParam)) {
67                case IDC_SELECT_EXPORT_DIR:
68                        switch(HIWORD(wParam)) {
69                        case BN_CLICKED:
70                                break;
71
72                        }
73                        break;
74                case IDC_CHK_FLIP_YZ:
75                        sInst->onInvertYZ(BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_CHK_FLIP_YZ));     
76                        break;
77                }
78                break;
79
80        case WM_DESTROY:
81                sInst->onDestroy();
82                break;
83        }
84        return FALSE;
85}
86
Note: See TracBrowser for help on using the repository browser.