📄 mainfrm.cpp
字号:
/************************************************************
//
// Copyright (C) 2002, Geo Soft
// All rights reserved
// mail: khuntipm@yahoo.com
// web: www.geosoftindia.com
// Khunti Popat
//
************************************************************/
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "GeoPAD.h"
#include "MainFrm.h"
#include "GeoPADDll.h"
#include "GeoPADDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const DWORD dwAdornmentFlags = 0; // exit button
//#define lpnmTB ((LPNMTOOLBAR)lParam)
//#define lpnm ((LPNMHDR)lParam)
CStatusBar m_wndStatusBar;
extern CGeoPADCtrl geoPAD;
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_NOTIFY(TBN_DROPDOWN, AFX_IDW_TOOLBAR, OnToolbarDropDown)
ON_COMMAND(ID_EDIT_TOOL, OnEditTool)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return 1; // fail to create
}
m_wndToolBar.SetButtonStyle(0,TBBS_DROPDOWN);
m_wndToolBar.SetButtonStyle(1,TBBS_DROPDOWN);
m_wndToolBar.SetButtonStyle(3,TBBS_DROPDOWN);
m_wndToolBar.SetButtonStyle(4,TBBS_DROPDOWN);
m_wndToolBar.SetButtonStyle(5,TBBS_DROPDOWN);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
///////////////////////
if (!m_wndToolBar1.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar1.LoadToolBar(IDR_MAINFRAME1))
{
TRACE0("Failed to create toolbar\n");
return 1; // fail to create
}
m_wndToolBar1.SetButtonStyle(0,TBBS_DROPDOWN);
m_wndToolBar1.SetButtonStyle(1,TBBS_DROPDOWN);
m_wndToolBar1.SetButtonStyle(2,TBBS_DROPDOWN);
m_wndToolBar1.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar1);
/////////////////////////////////////////
/*
if (!m_wndToolEdit.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolEdit.LoadToolBar(IDR_EDIT))
{
TRACE0("Failed to create toolbar\n");
return 1; // fail to create
}
// m_wndToolEdit.SetButtonStyle(0,TBBS_DROPDOWN);
m_wndToolEdit.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolEdit);
// m_wndToolEdit.ShowWindow(SW_HIDE);
*/
//////////////////////////////////////////
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndStatusBar.SetPaneInfo(0,ID_SEPARATOR,SBPS_NORMAL,75);
m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_CAPS,SBPS_NORMAL,75);
m_wndStatusBar.SetPaneInfo(2,ID_INDICATOR_NUM,SBPS_NORMAL,75);
// m_wndStatusBar.SetPaneText(0,_T("sc"));
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnToolbarDropDown(NMTOOLBAR* pnmtb, LRESULT *plr)
{
// load and display popup menu
RefreshLayerMenu();
CMenu menu;
menu.LoadMenu(IDR_MAINFRAME);
CMenu* pPopup;
CRect rc;
switch(pnmtb->iItem)
{
case ID_ADDTHEME:
pPopup = menu.GetSubMenu(0);
m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar.ClientToScreen(&rc);
break;
case ID_ZOOM_FULLEXT:
pPopup = menu.GetSubMenu(1);
m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar.ClientToScreen(&rc);
break;
case ID_IDENTIFY:
pPopup = menu.GetSubMenu(2);
m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar.ClientToScreen(&rc);
break;
/* case ID_THEMETABLE:
pPopup = menu.GetSubMenu(4);
m_wndToolBar1.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar1.ClientToScreen(&rc);
break;
*/ case ID_RASTER_ORIGINAL:
pPopup = menu.GetSubMenu(3);
m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar.ClientToScreen(&rc);
break;
case ID_AUTO_LABEL:
pPopup = menu.GetSubMenu(4);
m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar.ClientToScreen(&rc);
break;
case ID_ABOUT_GEOPAD:
pPopup = menu.GetSubMenu(5);
m_wndToolBar.SendMessage(TB_GETRECT, pnmtb->iItem, (LPARAM)&rc);
m_wndToolBar.ClientToScreen(&rc);
break;
}
pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_VERTICAL,rc.left, rc.bottom,this,&rc);
}
void CMainFrame::RefreshLayerMenu()
{
/* CMenu pTopMenu;// = AfxGetMainWnd()->GetMenu();
pTopMenu.LoadMenu(IDR_MAINFRAME);
CMenu* pLayerMenu = pTopMenu.GetSubMenu(1);
for (int i = 0; i < 5; i++)
{
pLayerMenu->InsertMenu(ID_CENTER_XY, MF_STRING,i+1,_T("Layer"));
}
*/
}
void CMainFrame::OnEditTool()
{
// TODO: Add your command handler code here
//m_wndToolEdit.ShowWindow(SW_SHOW);
// m_wndToolEdit.ShowWindow(SW_HIDE);
// Invalidate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -