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

Annotation of OpenXM_contrib2/windows/asir32gui/MainFrm.cpp, Revision 1.1

1.1     ! noro        1: // MainFrm.cpp : CMainFrame クラスの動作の定義を行います。
        !             2: //
        !             3:
        !             4: #include "stdafx.h"
        !             5: #include "asir32gui.h"
        !             6:
        !             7: #include "MainFrm.h"
        !             8:
        !             9: #ifdef _DEBUG
        !            10: #define new DEBUG_NEW
        !            11: #undef THIS_FILE
        !            12: static char THIS_FILE[] = __FILE__;
        !            13: #endif
        !            14:
        !            15: /////////////////////////////////////////////////////////////////////////////
        !            16: // CMainFrame
        !            17:
        !            18: IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
        !            19:
        !            20: BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
        !            21:        //{{AFX_MSG_MAP(CMainFrame)
        !            22:        ON_WM_CREATE()
        !            23:        //}}AFX_MSG_MAP
        !            24:        ON_UPDATE_COMMAND_UI(ID_INDICATOR_HEAP,OnUpdateHeapSize)
        !            25: END_MESSAGE_MAP()
        !            26:
        !            27: static UINT indicators[] =
        !            28: {
        !            29:        ID_SEPARATOR,           // ステータス ライン インジケータ
        !            30:        ID_INDICATOR_KANA,
        !            31:        ID_INDICATOR_CAPS,
        !            32:        ID_INDICATOR_NUM,
        !            33:        ID_INDICATOR_SCRL,
        !            34:        ID_INDICATOR_HEAP,
        !            35: };
        !            36:
        !            37: /////////////////////////////////////////////////////////////////////////////
        !            38: // CMainFrame クラスの構築/消滅
        !            39:
        !            40: CMainFrame *theFrame;
        !            41:
        !            42: CMainFrame::CMainFrame()
        !            43: {
        !            44:        // TODO: この位置にメンバの初期化処理コードを追加してください。
        !            45:        theFrame = this;
        !            46: }
        !            47:
        !            48: CMainFrame::~CMainFrame()
        !            49: {
        !            50: }
        !            51:
        !            52: extern "C" {
        !            53:        extern int asir_main_window;
        !            54: }
        !            55:
        !            56: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
        !            57: {
        !            58:        if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        !            59:                return -1;
        !            60:
        !            61:        if ( asir_main_window ) {
        !            62:                if (!m_wndToolBar.Create(this) ||
        !            63:                        !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
        !            64:                {
        !            65:                        TRACE0("Failed to create toolbar\n");
        !            66:                        return -1;      // 作成に失敗
        !            67:                }
        !            68:
        !            69:                if (!m_wndStatusBar.Create(this) ||
        !            70:                        !m_wndStatusBar.SetIndicators(indicators,
        !            71:                        sizeof(indicators)/sizeof(UINT)))
        !            72:                {
        !            73:                        TRACE0("Failed to create status bar\n");
        !            74:                        return -1;      // 作成に失敗
        !            75:                }
        !            76:
        !            77:                // TODO: もしツール チップスが必要ない場合、ここを削除してください。
        !            78:                m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
        !            79:                        CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
        !            80:
        !            81:                // TODO: ツール バーをドッキング可能にしない場合は以下の3行を削除
        !            82:                //       してください。
        !            83:                m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
        !            84:                EnableDocking(CBRS_ALIGN_ANY);
        !            85:                DockControlBar(&m_wndToolBar);
        !            86:        }
        !            87:        return 0;
        !            88: }
        !            89:
        !            90: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
        !            91: {
        !            92:        // TODO: この位置で CREATESTRUCT cs を修正して、Window クラスやスタイルを
        !            93:        //       修正してください。
        !            94:        if ( asir_main_window ) {
        !            95:                cs.cx = ::GetSystemMetrics(SM_CXSCREEN)*2 / 3;
        !            96:                cs.cy = ::GetSystemMetrics(SM_CYSCREEN)*2 / 3;
        !            97:        } else {
        !            98:                cs.cx = ::GetSystemMetrics(SM_CXSCREEN)*2 / 5;
        !            99:                cs.cy = ::GetSystemMetrics(SM_CYSCREEN)*1 / 5;
        !           100:        }
        !           101:
        !           102:        return CFrameWnd::PreCreateWindow(cs);
        !           103: }
        !           104:
        !           105: /////////////////////////////////////////////////////////////////////////////
        !           106: // CMainFrame クラスの診断
        !           107:
        !           108: #ifdef _DEBUG
        !           109: void CMainFrame::AssertValid() const
        !           110: {
        !           111:        CFrameWnd::AssertValid();
        !           112: }
        !           113:
        !           114: void CMainFrame::Dump(CDumpContext& dc) const
        !           115: {
        !           116:        CFrameWnd::Dump(dc);
        !           117: }
        !           118:
        !           119: #endif //_DEBUG
        !           120:
        !           121: /////////////////////////////////////////////////////////////////////////////
        !           122: // CMainFrame メッセージ ハンドラ
        !           123:
        !           124: extern "C" {
        !           125:        extern int AsirHeapSize;
        !           126:
        !           127: void show_window(int on)
        !           128: {
        !           129:        if ( on )
        !           130:                theFrame->ShowWindow(SW_SHOW);
        !           131:        else
        !           132:                theFrame->ShowWindow(SW_HIDE);
        !           133: }
        !           134: }
        !           135:
        !           136: void CMainFrame::OnUpdateHeapSize(CCmdUI *pCmdUI)
        !           137: {
        !           138:        pCmdUI->Enable();
        !           139:        CString strHeap;
        !           140:        strHeap.Format("HeapSize %dBytes",AsirHeapSize);
        !           141:        pCmdUI->SetText(strHeap);
        !           142: }

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