[BACK]Return to MainFrm.cpp CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / windows / engine2000

Annotation of OpenXM_contrib2/windows/engine2000/MainFrm.cpp, Revision 1.5

1.1       noro        1: // MainFrm.cpp : CMainFrame クラスの動作の定義を行います。
                      2: //
                      3:
                      4: #include "stdafx.h"
                      5: #include "ox_plot.h"
                      6:
                      7: #include "MainFrm.h"
                      8:
1.4       ohara       9: #include "gmpxx.h"
1.1       noro       10: extern "C" {
                     11: #include "ca.h"
                     12: #include "ifplot.h"
                     13: }
                     14:
                     15: #ifdef _DEBUG
                     16: #define new DEBUG_NEW
                     17: #undef THIS_FILE
                     18: static char THIS_FILE[] = __FILE__;
                     19: #endif
                     20:
                     21: /////////////////////////////////////////////////////////////////////////////
                     22: // CMainFrame
                     23:
                     24: IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
                     25:
                     26: BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
                     27:        //{{AFX_MSG_MAP(CMainFrame)
                     28:        ON_WM_CREATE()
                     29:        ON_WM_SETFOCUS()
                     30:        ON_WM_CLOSE()
                     31:        ON_COMMAND(ID_APP_EXIT, OnAppExit)
                     32:        //}}AFX_MSG_MAP
                     33:        ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
                     34:        ON_COMMAND(ID_FILE_PRINT_SETUP, OnFilePrintSetup)
                     35:        ON_UPDATE_COMMAND_UI(ID_INDICATOR_PROGRESS,OnUpdateProgress)
                     36: END_MESSAGE_MAP()
                     37:
                     38: static UINT indicators[] =
                     39: {
                     40:        ID_SEPARATOR,           // ステータス ライン インジケータ
                     41:        ID_INDICATOR_PROGRESS,
                     42: //     ID_INDICATOR_KANA,
                     43: //     ID_INDICATOR_CAPS,
                     44: //     ID_INDICATOR_NUM,
                     45: //     ID_INDICATOR_SCRL,
                     46: };
                     47: /////////////////////////////////////////////////////////////////////////////
                     48: // CMainFrame クラスの構築/消滅
                     49:
                     50: CMainFrame::CMainFrame()
                     51: {
                     52:        // TODO: この位置にメンバの初期化処理コードを追加してください。
                     53:
                     54: }
                     55:
                     56: CMainFrame::~CMainFrame()
                     57: {
                     58: }
                     59:
                     60: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
                     61: {
                     62:        if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
                     63:                return -1;
                     64:        // フレームのクライアント領域全体を占めるビューを作成します。
                     65:        if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
                     66:                CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
                     67:        {
                     68:                TRACE0("Failed to create view window\n");
                     69:                return -1;
                     70:        }
                     71:        if (!m_wndStatusBar.Create(this) ||
                     72:                !m_wndStatusBar.SetIndicators(indicators,
                     73:                  sizeof(indicators)/sizeof(UINT)))
                     74:        {
                     75:                TRACE0("Failed to create status bar\n");
                     76:                return -1;      // 作成に失敗
                     77:        }
                     78:
                     79:        m_nProgress = 100;
                     80:
                     81:        UINT nID,nStyle;
                     82:        int cxWidth;
                     83:
                     84:        m_wndStatusBar.GetPaneInfo(0,nID,nStyle,cxWidth);
                     85:        cxWidth = 0;
                     86:        m_wndStatusBar.SetPaneInfo(0,nID,nStyle,cxWidth);
                     87:
                     88:        m_wndStatusBar.GetPaneInfo(1,nID,nStyle,cxWidth);
                     89:        cxWidth = 150;
                     90:        m_wndStatusBar.SetPaneInfo(1,nID,nStyle,cxWidth);
                     91:
                     92:        return 0;
                     93: }
                     94:
                     95: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
                     96: {
                     97:        if( !CFrameWnd::PreCreateWindow(cs) )
                     98:                return FALSE;
                     99:        // TODO: この位置で CREATESTRUCT cs を修正して、Window クラスやスタイルを
                    100:        //       修正してください。
                    101:
                    102:        cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
                    103:        cs.lpszClass = AfxRegisterWndClass(0);
                    104:        cs.lpszName = m_pWindowName;
                    105:        cs.cx = m_cansize.cx+20; /* XXX */
                    106:        cs.cy = m_cansize.cy+80; /* XXX */
                    107:        return TRUE;
                    108: }
                    109:
                    110: /////////////////////////////////////////////////////////////////////////////
                    111: // CMainFrame クラスの診断
                    112:
                    113: #ifdef _DEBUG
                    114: void CMainFrame::AssertValid() const
                    115: {
                    116:        CFrameWnd::AssertValid();
                    117: }
                    118:
                    119: void CMainFrame::Dump(CDumpContext& dc) const
                    120: {
                    121:        CFrameWnd::Dump(dc);
                    122: }
                    123:
                    124: #endif //_DEBUG
                    125:
                    126: /////////////////////////////////////////////////////////////////////////////
                    127: // CMainFrame メッセージ ハンドラ
                    128: void CMainFrame::OnSetFocus(CWnd* pOldWnd)
                    129: {
                    130:        // ビュー ウィンドウにフォーカスを与えます。
                    131:        m_wndView.SetFocus();
                    132: }
                    133:
                    134: BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
                    135: {
                    136:        // ビューに最初にコマンドを処理する機会を与えます。
                    137:        if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
                    138:                return TRUE;
                    139:
                    140:        // 処理されなかった場合にはデフォルトの処理を行います。
                    141:        return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
                    142: }
                    143:
                    144:
                    145: void CMainFrame::OnClose()
                    146: {
                    147:        // TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
                    148:        m_wndView.DestroyCanvas();
1.3       noro      149:        CFrameWnd::OnClose();
1.1       noro      150: }
                    151:
                    152: void CMainFrame::OnAppExit()
                    153: {
                    154:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    155:        OnClose();
                    156: }
                    157:
                    158: void CMainFrame::OnUpdateProgress(CCmdUI *pCmdUI)
                    159: {
                    160:        int mode;
                    161:        CString strProgress;
                    162:
                    163:        if ( !m_wndView.can )
                    164:                return;
1.5     ! ohara     165:
        !           166:        mode = m_wndView.can->mode;
        !           167:        if (mode == modeNO(IFPLOT) || mode == modeNO(CONPLOT)) {
1.1       noro      168:                        pCmdUI->Enable();
                    169:                        strProgress.Format("%s%d%%",m_wndView.can->prefix,m_wndView.can->percentage);
                    170:                        pCmdUI->SetText(strProgress);
                    171:        }
                    172: }
                    173:
                    174: void CMainFrame::OnFilePrintSetup()
                    175: {
                    176:        theApp.OnFilePrintSetup();
                    177: }
                    178:
                    179: void CMainFrame::OnFilePrint()
                    180: {
                    181:        CDC dc;
                    182:        CPrintDialog pd(TRUE);
                    183:        int ret;
                    184:
                    185:        ret = theApp.DoPrintDialog(&pd);
                    186:        if ( ret == IDOK ) {
                    187:                theApp.CreatePrinterDC(dc);
                    188:                m_wndView.OnPrint(dc);
                    189:        }
                    190: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>