SLNKDWF 2.00
svn path=/Slnkdwf/trunk/; revision=12481
This commit is contained in:
48
Viewer/AboutDlg.cpp
Normal file
48
Viewer/AboutDlg.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
// aboutdlg.cpp : implementation of the CAboutDlg class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "aboutdlg.h"
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
LRESULT CAboutDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CenterWindow(GetParent());
|
||||
#if 0
|
||||
if (FAILED (m_iAbout.CoCreateInstance (L"SLNKDWF.About")))
|
||||
{
|
||||
::MessageBox(NULL, "Unable to create object SLNKDWF.About", "SLNKDWF Viewer error", MB_ICONEXCLAMATION | MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CComBSTR bDLLPath, bBuildTime, bUserContext, bVersionString;
|
||||
m_iAbout->get_DLLPath(&bDLLPath);
|
||||
m_iAbout->get_Buildtime(&bBuildTime);
|
||||
m_iAbout->get_UserContext(&bUserContext);
|
||||
m_iAbout->get_VersionString(&bVersionString);
|
||||
SetDlgItemText(IDC_DLLPATH, CString(bDLLPath));
|
||||
SetDlgItemText(IDC_DLLBUILDTIME, CString(bBuildTime));
|
||||
SetDlgItemText(IDC_DLLVERSION, CString(bVersionString));
|
||||
|
||||
#endif
|
||||
char module[_MAX_PATH]; // HMODULE
|
||||
GetModuleFileName(g_hInstance, module, sizeof(module));
|
||||
|
||||
SetDlgItemText(IDC_DLLPATH, module);
|
||||
|
||||
SetDlgItemText(IDC_DWFVERSION, _DWFTK_VERSION_STRING);
|
||||
SetDlgItemText(IDC_WHIPVERSION, _WHIPTK_VERSION_STRING);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CAboutDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
EndDialog(wID);
|
||||
return 0;
|
||||
}
|
||||
25
Viewer/AboutDlg.h
Normal file
25
Viewer/AboutDlg.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// aboutdlg.h : interface of the CAboutDlg class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class CAboutDlg : public CDialogImpl<CAboutDlg>
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
|
||||
BEGIN_MSG_MAP(CAboutDlg)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
END_MSG_MAP()
|
||||
|
||||
// Handler prototypes (uncomment arguments if needed):
|
||||
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
};
|
||||
49
Viewer/FindDlg.cpp
Normal file
49
Viewer/FindDlg.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
// aboutdlg.cpp : implementation of the CFindDlg class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "FindDlg.h"
|
||||
|
||||
LRESULT CFindDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CenterWindow(GetParent());
|
||||
DlgResize_Init();
|
||||
m_ListBox.Attach(GetDlgItem(IDC_LAYERLIST));
|
||||
LONG lCount;
|
||||
|
||||
CWhip2DCImpl m_iWhip2DC;
|
||||
CDWFFileImpl m_iDWFFile;
|
||||
CEPlotSectionsImpl *piEPlotSections;
|
||||
m_iDWFFile.Open(m_dwfPath);
|
||||
|
||||
piEPlotSections = m_iDWFFile.get_EPlotSections();
|
||||
lCount = piEPlotSections->get_Count();
|
||||
if (lCount > 0)
|
||||
{
|
||||
m_iWhip2DC.Load(NULL, piEPlotSections->get_Item(m_nPage), L"", L".*",
|
||||
0, 0, VARIANT_TRUE /*center*/, VARIANT_FALSE /* Maximize */);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iWhip2DC.Load(NULL, NULL, m_dwfPath, L".*", 0, 0, VARIANT_TRUE /*center*/, VARIANT_FALSE /* Maximize */);
|
||||
}
|
||||
m_iWhip2DC.FindTexts("");
|
||||
m_iWhip2DC.get_TextCount(&lCount);
|
||||
for (int i=0;i < lCount;i++)
|
||||
{
|
||||
CFoundText tFound;
|
||||
m_iWhip2DC.get_TextItem(i, tFound);
|
||||
if (tFound.m_FoundText.string().is_ascii())
|
||||
m_ListBox.AddString(CString(tFound.m_FoundText.string().ascii()));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CFindDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
EndDialog(wID);
|
||||
return 0;
|
||||
}
|
||||
44
Viewer/FindDlg.h
Normal file
44
Viewer/FindDlg.h
Normal file
@@ -0,0 +1,44 @@
|
||||
// aboutdlg.h : interface of the CFindDlg class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class CFindDlg : public CDialogImpl<CFindDlg>,
|
||||
public CDialogResize<CFindDlg>
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_LAYERS };
|
||||
|
||||
CFindDlg::CFindDlg(const CString &dwfPath, int nPage)
|
||||
{
|
||||
m_dwfPath = dwfPath;
|
||||
m_nPage = nPage;
|
||||
};
|
||||
|
||||
BEGIN_MSG_MAP(CFindDlg)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
CHAIN_MSG_MAP(CDialogResize<CFindDlg>)
|
||||
END_MSG_MAP()
|
||||
|
||||
BEGIN_DLGRESIZE_MAP(CFindDlg)
|
||||
DLGRESIZE_CONTROL(IDOK, DLSZ_MOVE_X)
|
||||
DLGRESIZE_CONTROL(IDCANCEL, DLSZ_MOVE_X)
|
||||
DLGRESIZE_CONTROL(IDC_LAYERLIST, DLSZ_SIZE_X|DLSZ_SIZE_Y)
|
||||
END_DLGRESIZE_MAP()
|
||||
|
||||
// Handler prototypes (uncomment arguments if needed):
|
||||
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
|
||||
private:
|
||||
CListBox m_ListBox;
|
||||
CString m_dwfPath;
|
||||
int m_nPage;
|
||||
};
|
||||
30
Viewer/LayerDlg.cpp
Normal file
30
Viewer/LayerDlg.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// aboutdlg.cpp : implementation of the CLayerDlg class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "layerdlg.h"
|
||||
|
||||
LRESULT CLayerDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CenterWindow(GetParent());
|
||||
DlgResize_Init();
|
||||
m_ListBox.Attach(GetDlgItem(IDC_LAYERLIST));
|
||||
LONG lCount;
|
||||
m_iWhip2DC->get_LayerCount(&lCount);
|
||||
for (int i=0;i < lCount;i++)
|
||||
{
|
||||
CComBSTR lName;
|
||||
m_iWhip2DC->get_LayerItem(i, &lName);
|
||||
m_ListBox.AddString(CString(lName));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LRESULT CLayerDlg::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
EndDialog(wID);
|
||||
return 0;
|
||||
}
|
||||
205
Viewer/MainFrm.cpp
Normal file
205
Viewer/MainFrm.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
// MainFrm.cpp : implmentation of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "aboutdlg.h"
|
||||
#include "FindDlg.h"
|
||||
#include "SLNKDwfViewerView.h"
|
||||
#include "MainFrm.h"
|
||||
|
||||
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if(CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg))
|
||||
return TRUE;
|
||||
|
||||
return m_view.PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
BOOL CMainFrame::OnIdle()
|
||||
{
|
||||
UIUpdateToolBar();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CreateSimpleToolBar();
|
||||
|
||||
// CreateSimpleStatusBar();
|
||||
ATLTRACE("\nEarly with m_Combo %x", m_Combo.m_hWnd);
|
||||
|
||||
m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
|
||||
|
||||
UIAddToolBar(m_hWndToolBar);
|
||||
// UISetCheck(ID_VIEW_TOOLBAR, 1);
|
||||
|
||||
// register object for message filtering and idle updates
|
||||
// TODO: Het volgende crashed en lijkt niet echt nodig?
|
||||
// CMessageLoop* pLoop = _Module.GetMessageLoop();
|
||||
// ATLASSERT(pLoop != NULL);
|
||||
/// pLoop->AddMessageFilter(this);
|
||||
/// pLoop->AddIdleHandler(this);
|
||||
|
||||
// Create ComboBox in ToolBar
|
||||
RECT rcCombo = { 190, 1, 440, 200 }; // Hardcode position for now...
|
||||
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_SIMPLE | CBS_DROPDOWNLIST;
|
||||
ATLTRACE("\nAbout to Create with m_Combo %x", m_Combo.m_hWnd);
|
||||
m_Combo.Create(m_hWnd, rcCombo, NULL, dwStyle, 0, IDC_COMBO);
|
||||
m_Combo.SetFont(AtlGetDefaultGuiFont());
|
||||
m_Combo.SetParent(m_hWndToolBar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CMainFrame::SetDWF(const CString &dwfPath)
|
||||
{
|
||||
SetWindowText(dwfPath);
|
||||
|
||||
m_view.SetDWF(dwfPath);
|
||||
// Maak de pagina's aan
|
||||
m_Combo.ResetContent();
|
||||
try
|
||||
{
|
||||
CDWFFileImpl m_iDWFFile;
|
||||
CEPlotSectionsImpl *piEPlotSections;
|
||||
|
||||
m_iDWFFile.Open(dwfPath);
|
||||
|
||||
piEPlotSections = m_iDWFFile.get_EPlotSections();
|
||||
LONG lCount;
|
||||
lCount = piEPlotSections->get_Count();
|
||||
|
||||
for (LONG i=0; i<lCount; i++)
|
||||
{
|
||||
CEPlotSectionImpl *piEPlotSection;
|
||||
piEPlotSection = piEPlotSections->get_Item(i);
|
||||
m_Combo.AddString(piEPlotSection->get_Title());
|
||||
}
|
||||
ATLTRACE("\nDone filling ComboBox");
|
||||
}
|
||||
catch (CString &ee)
|
||||
{
|
||||
ATLTRACE(ee);
|
||||
//DoMessage(dc, ee); // komt later vanzelf wel
|
||||
}
|
||||
|
||||
m_Combo.SetCurSel(0);
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CFileDialog dlg(TRUE, _T("dwf"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("DWF Files (*.dwf)\0*.dwf\0All Files (*.*)\0*.*\0"), m_hWnd);
|
||||
if(dlg.DoModal() == IDOK)
|
||||
{
|
||||
m_view.SetDWF(CString(dlg.m_szFileName));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnFileExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
PostMessage(WM_CLOSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::onSelChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
int nTab = m_Combo.GetCurSel();
|
||||
m_view.SetPage(nTab);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnZoomExtents(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_view.Zoom(1.0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnZoomIn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_view.Zoom(m_view.GetZoomScale() * (1 + m_view.GetZoomDelta()));
|
||||
m_view.NotifyParentZoomChanged();
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnZoomOut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
m_view.Zoom(m_view.GetZoomScale() / (1 + m_view.GetZoomDelta()));
|
||||
m_view.NotifyParentZoomChanged();
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnFilePrint(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CPrintDialog dlg(FALSE);
|
||||
dlg.m_pd.hDevMode = m_devmode.CopyToHDEVMODE();
|
||||
dlg.m_pd.hDevNames = m_printer.CopyToHDEVNAMES();
|
||||
dlg.m_pd.nMinPage = 1;
|
||||
dlg.m_pd.nMaxPage = m_Combo.GetCount();
|
||||
|
||||
if(dlg.DoModal() == IDOK)
|
||||
{
|
||||
m_devmode.CopyFromHDEVMODE(dlg.m_pd.hDevMode);
|
||||
m_printer.ClosePrinter();
|
||||
m_printer.OpenPrinter(dlg.m_pd.hDevNames, m_devmode.m_pDevMode);
|
||||
|
||||
CPrintJob job;
|
||||
job.StartPrintJob(false, m_printer, m_devmode.m_pDevMode, this, m_view.m_dwfPath, 0, 0, (dlg.PrintToFile() != FALSE));
|
||||
}
|
||||
|
||||
::GlobalFree(dlg.m_pd.hDevMode);
|
||||
::GlobalFree(dlg.m_pd.hDevNames);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
CAboutDlg dlg;
|
||||
dlg.DoModal();
|
||||
|
||||
int nTab = m_Combo.GetCurSel();
|
||||
CFindDlg dlg2(m_view.m_dwfPath, nTab);
|
||||
dlg2.DoModal();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CMainFrame::OnViewLayers(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
// CLayerDlg dlg(m_view.GetWhip2DC());
|
||||
// dlg.DoModal();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//print job info callbacks
|
||||
bool CMainFrame::IsValidPage(UINT nPage)
|
||||
{
|
||||
return (nPage == 0); // we have only one page
|
||||
}
|
||||
|
||||
bool CMainFrame::PrintPage(UINT nPage, HDC hDC)
|
||||
{
|
||||
if (nPage >= 1) // we have only one page
|
||||
return false;
|
||||
|
||||
CRect rcPage
|
||||
( 0, 0,
|
||||
::GetDeviceCaps(hDC, PHYSICALWIDTH) - 2 * ::GetDeviceCaps(hDC, PHYSICALOFFSETX),
|
||||
::GetDeviceCaps(hDC, PHYSICALHEIGHT) - 2 * ::GetDeviceCaps(hDC, PHYSICALOFFSETY) );
|
||||
|
||||
CDCHandle dc = hDC;
|
||||
CClientDC dcScreen(m_hWnd);
|
||||
CDC dcMem;
|
||||
dcMem.CreateCompatibleDC(dcScreen);
|
||||
|
||||
CWhip2DCImpl iWhip2DC;
|
||||
PaintToDC(hDC, m_view.m_dwfPath, 0, iWhip2DC, rcPage.Size(), TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
BIN
Viewer/SLNKDWFViewer.aps
Normal file
BIN
Viewer/SLNKDWFViewer.aps
Normal file
Binary file not shown.
390
Viewer/SLNKDWFViewer.rc
Normal file
390
Viewer/SLNKDWFViewer.rc
Normal file
@@ -0,0 +1,390 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "atlres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""atlres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Toolbar
|
||||
//
|
||||
|
||||
IDR_MAINFRAME TOOLBAR 16, 15
|
||||
BEGIN
|
||||
BUTTON ID_ZOOM_IN
|
||||
BUTTON ID_ZOOM_OUT
|
||||
SEPARATOR
|
||||
BUTTON ID_ZOOM_EXTENTS
|
||||
BUTTON ID_FILE_PRINT
|
||||
SEPARATOR
|
||||
BUTTON ID_APP_ABOUT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINFRAME MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&New\tCtrl+N", ID_FILE_NEW
|
||||
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
|
||||
MENUITEM "Save &As...", ID_FILE_SAVE_AS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print...\tCtrl+P", ID_FILE_PRINT
|
||||
MENUITEM "Print Pre&view", ID_FILE_PRINT_PREVIEW
|
||||
MENUITEM "P&rint Setup...", ID_FILE_PRINT_SETUP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_APP_EXIT
|
||||
END
|
||||
POPUP "&Edit"
|
||||
BEGIN
|
||||
MENUITEM "&Undo\tCtrl+Z", ID_EDIT_UNDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT
|
||||
MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY
|
||||
MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE
|
||||
END
|
||||
POPUP "&View"
|
||||
BEGIN
|
||||
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
|
||||
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
|
||||
MENUITEM "Layers", ID_VIEW_LAYERS
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About SLNKDWFViewer...", ID_APP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON "res\\SLNKDWFViewer.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 247, 161
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,190,140,50,14
|
||||
CTEXT "SLNKDWFViewer Application v1.0\n\n(c) Copyright 2006",IDC_STATIC,7,55,136,27
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,55,26,20,20
|
||||
LTEXT "Static",IDC_DLLPATH,55,84,185,8
|
||||
LTEXT "Dll",IDC_STATIC,8,98,9,8
|
||||
LTEXT "Static",IDC_DLLVERSION,56,98,119,8
|
||||
LTEXT "Version",IDC_STATIC,23,97,24,8
|
||||
LTEXT "Built",IDC_STATIC,23,111,20,8
|
||||
LTEXT "Static",IDC_DLLBUILDTIME,56,112,131,8
|
||||
LTEXT "Path",IDC_STATIC,23,84,16,8
|
||||
LTEXT "Static",IDC_WHIPVERSION,56,139,131,8
|
||||
LTEXT "Static",IDC_DWFVERSION,55,126,131,8
|
||||
LTEXT "DWF",IDC_STATIC,24,126,20,8
|
||||
LTEXT "Whip",IDC_STATIC,24,139,20,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 240
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 154
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAINFRAME ACCELERATORS
|
||||
BEGIN
|
||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL
|
||||
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
|
||||
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
|
||||
"P", ID_FILE_PRINT, VIRTKEY, CONTROL
|
||||
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
|
||||
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
|
||||
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
|
||||
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
|
||||
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
|
||||
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
|
||||
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
|
||||
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
|
||||
VK_F6, ID_NEXT_PANE, VIRTKEY
|
||||
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "SLNKDWFViewer Module"
|
||||
VALUE "FileVersion", "1, 0, 0, 1"
|
||||
VALUE "InternalName", "SLNKDWFViewer"
|
||||
VALUE "LegalCopyright", "Copyright 2006"
|
||||
VALUE "OriginalFilename", "SLNKDWFViewer.exe"
|
||||
VALUE "ProductName", "SLNKDWFViewer Module"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "SLNKDWFViewer"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_NEW "Create a new document\nNew"
|
||||
ID_FILE_OPEN "Open an existing document\nOpen"
|
||||
ID_FILE_CLOSE "Close the active document\nClose"
|
||||
ID_FILE_SAVE "Save the active document\nSave"
|
||||
ID_FILE_SAVE_AS "Save the active document with a new name\nSave As"
|
||||
ID_FILE_PAGE_SETUP "Change the printing options\nPage Setup"
|
||||
ID_FILE_PRINT_SETUP "Change the printer and printing options\nPrint Setup"
|
||||
ID_FILE_PRINT "Print the active document\nPrint"
|
||||
ID_FILE_PRINT_PREVIEW "Display full pages\nPrint Preview"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
|
||||
ID_APP_EXIT "Quit the application; prompts to save documents\nExit"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_NEXT_PANE "Switch to the next window pane\nNext Pane"
|
||||
ID_PREV_PANE "Switch back to the previous window pane\nPrevious Pane"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_WINDOW_NEW "Open another window for the active document\nNew Window"
|
||||
ID_WINDOW_ARRANGE "Arrange icons at the bottom of the window\nArrange Icons"
|
||||
ID_WINDOW_CASCADE "Arrange windows so they overlap\nCascade Windows"
|
||||
ID_WINDOW_TILE_HORZ "Arrange windows as non-overlapping tiles\nTile Windows"
|
||||
ID_WINDOW_TILE_VERT "Arrange windows as non-overlapping tiles\nTile Windows"
|
||||
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDIT_CLEAR "Erase the selection\nErase"
|
||||
ID_EDIT_CLEAR_ALL "Erase everything\nErase All"
|
||||
ID_EDIT_COPY "Copy the selection and put it on the Clipboard\nCopy"
|
||||
ID_EDIT_CUT "Cut the selection and put it on the Clipboard\nCut"
|
||||
ID_EDIT_FIND "Find the specified text\nFind"
|
||||
ID_EDIT_PASTE "Insert Clipboard contents\nPaste"
|
||||
ID_EDIT_REPEAT "Repeat the last action\nRepeat"
|
||||
ID_EDIT_REPLACE "Replace specific text with different text\nReplace"
|
||||
ID_EDIT_SELECT_ALL "Select the entire document\nSelect All"
|
||||
ID_EDIT_UNDO "Undo the last action\nUndo"
|
||||
ID_EDIT_REDO "Redo the previously undone action\nRedo"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
|
||||
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ATL_IDS_SCSIZE "Change the window size"
|
||||
ATL_IDS_SCMOVE "Change the window position"
|
||||
ATL_IDS_SCMINIMIZE "Reduce the window to an icon"
|
||||
ATL_IDS_SCMAXIMIZE "Enlarge the window to full size"
|
||||
ATL_IDS_SCNEXTWINDOW "Switch to the next document window"
|
||||
ATL_IDS_SCPREVWINDOW "Switch to the previous document window"
|
||||
ATL_IDS_SCCLOSE "Close the active window and prompts to save the documents"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ATL_IDS_SCRESTORE "Restore the window to normal size"
|
||||
ATL_IDS_SCTASKLIST "Activate Task List"
|
||||
ATL_IDS_MDICHILD "Activate this window"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ATL_IDS_IDLEMESSAGE "Ready"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ATL_IDS_MRU_FILE "Open this document"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_ZOOM_EXTENTS "Zoom Extents\nZoom Extents"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Neutral (Sys. Default) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_LAYERS DIALOGEX 0, 0, 230, 302
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
|
||||
CAPTION "Layers"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,173,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,173,24,50,14
|
||||
LISTBOX IDC_LAYERLIST,7,7,161,288,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_LAYERS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 223
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 295
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Neutral (Sys. Default) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
362
Viewer/SLNKDWFViewerView.cpp
Normal file
362
Viewer/SLNKDWFViewerView.cpp
Normal file
@@ -0,0 +1,362 @@
|
||||
// SLNKDwfViewerView.cpp : implementation of the CSLNKDwfViewerView class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "atlgdix.h"
|
||||
|
||||
#include "SLNKDwfViewerView.h"
|
||||
|
||||
#define SCL 1
|
||||
|
||||
CSLNKDwfViewerView::CSLNKDwfViewerView()
|
||||
{
|
||||
m_nPage = 0;
|
||||
m_busyPanning = FALSE;
|
||||
m_Bitmap = NULL;
|
||||
}
|
||||
|
||||
CSLNKDwfViewerView::~CSLNKDwfViewerView()
|
||||
{
|
||||
if (m_Bitmap != NULL) delete m_Bitmap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL CSLNKDwfViewerView::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
pMsg;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CSLNKDwfViewerView::SetDWF(const CString &dwfPath)
|
||||
{
|
||||
m_dwfPath = dwfPath;
|
||||
if (m_Bitmap != NULL)
|
||||
{
|
||||
delete m_Bitmap; // It is dirty
|
||||
m_Bitmap = NULL;
|
||||
}
|
||||
|
||||
SetZoomMode(ZOOMMODE_IN);
|
||||
|
||||
SetPage(0);
|
||||
}
|
||||
|
||||
void DoMessage(CDCHandle dc, const CString msg)
|
||||
{
|
||||
CRect clrc;
|
||||
dc.GetClipBox(clrc);
|
||||
|
||||
FillRect(dc,clrc,GetSysColorBrush( COLOR_WINDOW ));
|
||||
SetTextColor(dc, GetSysColor( COLOR_WINDOWTEXT ));
|
||||
|
||||
CString tok(msg);
|
||||
tok.Replace("~", "\n"); // We ondersteunen ook ~ als newline
|
||||
RECT rc = { 0, 0, clrc.Width(), 0};
|
||||
GetClientRect(dc.WindowFromDC(), clrc);
|
||||
int height = DrawText(dc, tok, tok.GetLength(), &rc, DT_CALCRECT); // Grootte bepalen
|
||||
rc.top = clrc.Height()/2 - rc.bottom/2; // Vertikaal centreren
|
||||
rc.bottom = clrc.Height()/2 + rc.bottom/2;
|
||||
height = DrawText(dc, tok, tok.GetLength(), &rc, DT_TOP);
|
||||
ATLASSERT(height);
|
||||
}
|
||||
|
||||
void PaintToDC(HDC dc, CString dwfPath, int nPage,
|
||||
CWhip2DCImpl &iWhip2DC, CSize wSize,
|
||||
BOOL forPrint /*=FALSE*/)
|
||||
{
|
||||
try {
|
||||
CDWFFileImpl m_iDWFFile;
|
||||
CEPlotSectionsImpl *piEPlotSections;
|
||||
m_iDWFFile.Open(dwfPath);
|
||||
|
||||
piEPlotSections = m_iDWFFile.get_EPlotSections();
|
||||
LONG lCount = piEPlotSections->get_Count();
|
||||
if (lCount > 0)
|
||||
{
|
||||
iWhip2DC.Load(dc, piEPlotSections->get_Item(nPage), L"", L".*",
|
||||
wSize.cx, wSize.cy, VARIANT_TRUE /*center*/, VARIANT_FALSE /* Maximize */);
|
||||
}
|
||||
else
|
||||
{
|
||||
iWhip2DC.Load(dc, NULL, dwfPath, L".*",
|
||||
wSize.cx, wSize.cy, VARIANT_TRUE /*center*/, VARIANT_FALSE /* Maximize */);
|
||||
}
|
||||
|
||||
int mm = GetMapMode(dc);
|
||||
SetMapMode(dc, MM_TEXT);
|
||||
|
||||
if (forPrint)
|
||||
iWhip2DC.put_paperColor(0xFFFFFF); // Altijd wit papier
|
||||
|
||||
iWhip2DC.Paint(VARIANT_FALSE);
|
||||
SetMapMode(dc, mm);
|
||||
}
|
||||
catch (CString &ee)
|
||||
{
|
||||
DoMessage(dc, ee);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
DoMessage(dc, "Unhandled Exception");
|
||||
}
|
||||
}
|
||||
|
||||
BOOL DoEvents()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if(msg.message==WM_QUIT)
|
||||
return FALSE;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CSLNKDwfViewerView::my_progress_action(void *param, double progress)
|
||||
{
|
||||
CSLNKDwfViewerView *vw = (CSLNKDwfViewerView *)param;
|
||||
// Erg instabiel (door recursieve WM_PAINT?)
|
||||
// if (!DoEvents())
|
||||
// return FALSE;
|
||||
if (GetSystemMetrics(SM_REMOTESESSION))
|
||||
{ // App is running on a remote session.
|
||||
return TRUE; // Geen preview bij terminal services
|
||||
}
|
||||
|
||||
if (GetTickCount() - vw->m_Timer > 100)
|
||||
{ // Preview time
|
||||
// Tijdens het blitten willen we geen vertalingen
|
||||
CRect rc;
|
||||
vw->GetClientRect(rc);
|
||||
SIZE orgSize;
|
||||
|
||||
::SetViewportExtEx(vw->m_hDCOriginal, rc.Size().cx, rc.Size().cy, &orgSize);
|
||||
CPoint pt;
|
||||
::GetViewportOrgEx(vw->m_hDCOriginal, &pt);
|
||||
CPoint pt2;
|
||||
vw->m_MemDC.SetViewportOrg(0,0, &pt2);
|
||||
|
||||
::BitBlt(vw->m_hDCOriginal,
|
||||
-pt.x, -pt.y, rc.Width(), rc.Height(),
|
||||
vw->m_MemDC, 0, 0, SRCCOPY);
|
||||
vw->m_MemDC.SetViewportOrg(pt2);
|
||||
|
||||
if (0)
|
||||
{ // Progress lijntje
|
||||
// We kunnen rustig rechtstreeks op m_hDCOriginal tekenen want
|
||||
// er komt toch nog een definitieve bitmap overheen
|
||||
CPen p;
|
||||
p.CreatePen(PS_SOLID ,0, RGB(128,128,128));
|
||||
HPEN pOld = (HPEN)SelectObject(vw->m_hDCOriginal, p);
|
||||
CPoint org;
|
||||
MoveToEx(vw->m_hDCOriginal, 1, 0, &org);
|
||||
LineTo(vw->m_hDCOriginal, 1, (int)(progress*rc.Height()));
|
||||
MoveToEx(vw->m_hDCOriginal, org.x, org.y, NULL);
|
||||
SelectObject(vw->m_hDCOriginal, pOld);
|
||||
}
|
||||
::SetViewportExtEx(vw->m_hDCOriginal, orgSize.cx, orgSize.cy, NULL);
|
||||
vw->m_Timer = GetTickCount();
|
||||
}
|
||||
return TRUE; // Continue
|
||||
};
|
||||
|
||||
void CSLNKDwfViewerView::DoPaint(CDCHandle dc)
|
||||
{
|
||||
if (m_dwfPath == "")
|
||||
{
|
||||
DoMessage(dc, "Open DWF first");
|
||||
return;
|
||||
}
|
||||
|
||||
// Altijd 10% van ons beeld zoomen met scrollbars
|
||||
CRect rc;
|
||||
GetClientRect(rc);
|
||||
SetScrollLine(max(rc.Size().cx / GetZoomScale() / 10 + 0.5, 1),
|
||||
max(rc.Size().cy / GetZoomScale() / 10 + 0.5, 1));
|
||||
|
||||
// Default 0.5% inzoomen
|
||||
CSize wSize;
|
||||
dc.GetViewportExt(&wSize);
|
||||
#if 0
|
||||
CPoint pOrg;
|
||||
dc.GetViewportOrg(&pOrg);
|
||||
|
||||
pOrg.x += MulDiv(wSize.cx, 1, 200); // Half verschuiven
|
||||
pOrg.y += MulDiv(wSize.cy, 1, 200);
|
||||
dc.SetViewportOrg(pOrg);
|
||||
|
||||
wSize.cx = MulDiv(wSize.cx, 198, 200);
|
||||
wSize.cy = MulDiv(wSize.cy, 198, 200);
|
||||
#endif
|
||||
|
||||
CWaitCursor Wait;
|
||||
|
||||
if (0&&GetZoomScale() != 1.0)
|
||||
::PaintToDC(dc, m_dwfPath, m_nPage, m_iWhip2DC, wSize);
|
||||
else
|
||||
{
|
||||
CPoint pt;
|
||||
dc.GetViewportOrg(&pt);
|
||||
|
||||
if (m_Bitmap == NULL ||
|
||||
m_BitmapViewportOrigin != pt ||
|
||||
m_BitmapViewportExt != wSize ||
|
||||
m_BitmapClientRect != rc)
|
||||
{ // Bitmap opnieuw maken
|
||||
if (m_Bitmap != NULL) delete m_Bitmap;
|
||||
CBitmapHandle pOldBitmap;
|
||||
|
||||
m_MemDC.CreateCompatibleDC(dc);
|
||||
// Create a bitmap big enough to hold the window's image
|
||||
|
||||
m_Bitmap = new CBitmap;
|
||||
m_Bitmap->CreateCompatibleBitmap(dc, rc.Width(), rc.Height());
|
||||
|
||||
m_MemDC.SetViewportOrg(pt.x, pt.y);
|
||||
pOldBitmap = m_MemDC.SelectBitmap(*m_Bitmap);
|
||||
|
||||
m_Timer = GetTickCount();
|
||||
m_hDCOriginal = dc; // Hier gaan we wel progress op tekenen
|
||||
m_iWhip2DC.set_progress_action(my_progress_action, (void *) this);
|
||||
|
||||
::PaintToDC(m_MemDC, m_dwfPath, m_nPage, m_iWhip2DC, wSize);
|
||||
|
||||
// Select the original bitmap back in
|
||||
m_MemDC.SelectBitmap(pOldBitmap);
|
||||
m_MemDC.DeleteDC();
|
||||
|
||||
m_BitmapViewportOrigin = pt;
|
||||
m_BitmapViewportExt = wSize;
|
||||
m_BitmapClientRect = rc;
|
||||
|
||||
}
|
||||
// Nu het echt tonen
|
||||
{
|
||||
CBitmapHandle pOldBitmap;
|
||||
CDC MemDC;
|
||||
|
||||
// And a memory DC, set Map Mode
|
||||
MemDC.CreateCompatibleDC(dc);
|
||||
pOldBitmap = MemDC.SelectBitmap(*m_Bitmap);
|
||||
|
||||
dc.SetViewportExt(rc.Size());
|
||||
dc.BitBlt( -pt.x, -pt.y, rc.Width(), rc.Height(), MemDC, 0, 0, SRCCOPY );
|
||||
MemDC.SelectBitmap(pOldBitmap);
|
||||
MemDC.DeleteDC();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void CSLNKDwfViewerView::SetPage(int nPage)
|
||||
{
|
||||
m_nPage = nPage;
|
||||
if (m_Bitmap != NULL)
|
||||
{
|
||||
delete m_Bitmap; // It is dirty
|
||||
m_Bitmap = NULL;
|
||||
}
|
||||
CRect rc;
|
||||
GetClientRect(&rc);
|
||||
SetScrollSize(rc.Width()*SCL, rc.Height()*SCL);
|
||||
SetScrollLine(0, 0);
|
||||
SetZoomScaleMin(.5 / SCL);
|
||||
Zoom(1 / SCL);
|
||||
SetScrollLine(rc.Width() / SCL, rc.Height() / SCL);
|
||||
};
|
||||
|
||||
LRESULT CSLNKDwfViewerView::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
CZoomScrollWindowImpl::OnSize(uMsg, wParam, lParam, bHandled);
|
||||
int cx = GET_X_LPARAM(lParam);
|
||||
int cy = GET_Y_LPARAM(lParam);
|
||||
CRect rc;
|
||||
GetClientRect(&rc);
|
||||
if (rc.Width()>0 && rc.Height()>0)
|
||||
SetScrollSize(rc.Width()*SCL, rc.Height()*SCL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT CSLNKDwfViewerView::OnMouseWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/)
|
||||
{
|
||||
int zDelta = (int)(short)HIWORD(wParam);
|
||||
int fwKeys = (int)(short)LOWORD(wParam);
|
||||
|
||||
CPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
|
||||
ScreenToClient(&pt);
|
||||
|
||||
double delta = (fwKeys&MK_SHIFT)?0.1:(fwKeys&MK_CONTROL)?0.01:1.0;
|
||||
double zoom = zDelta / WHEEL_DELTA;
|
||||
if(zDelta > 0)
|
||||
zoom = zoom * (1+ GetZoomDelta()*delta);
|
||||
else
|
||||
zoom = abs(zoom) / (1+ GetZoomDelta()*delta);
|
||||
|
||||
CRect rc;
|
||||
GetClientRect(&rc);
|
||||
|
||||
CPoint newcenter(pt.x + (rc.right / 2.0 - pt.x) / zoom,
|
||||
pt.y + (rc.bottom / 2.0 - pt.y) / zoom);
|
||||
|
||||
Zoom(newcenter, GetZoomScale() * zoom);
|
||||
|
||||
NotifyParentZoomChanged();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CSLNKDwfViewerView::OnRButtonDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
m_PanTotal = CPoint(0, 0);
|
||||
|
||||
m_PanStartPoint = point;
|
||||
GetScrollOffset(m_PanStartScroll);
|
||||
SetCapture(); // Zo kunnen we ook "buiten" het venster doorpannen
|
||||
m_busyPanning = TRUE;
|
||||
// tPanStart = GetTickCount();
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CSLNKDwfViewerView::OnRButtonUp(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_busyPanning)
|
||||
{
|
||||
ReleaseCapture();
|
||||
|
||||
m_busyPanning = FALSE;
|
||||
|
||||
// Invalidate(); // Als meer dan 1/10 seconde is nog niet alles getekend
|
||||
}
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
LRESULT CSLNKDwfViewerView::OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if (m_busyPanning && (wParam & MK_RBUTTON)) // Pannen
|
||||
{
|
||||
POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
CPoint traveled = m_PanStartPoint - point;
|
||||
|
||||
m_PanTotal += traveled;
|
||||
|
||||
// SetCursor(::LoadCursor(AfxGetResourceHandle(), MAKEINTRESOURCE(IDC_HANDJE)));
|
||||
|
||||
SetScrollOffset(m_PanStartScroll + traveled);
|
||||
m_PanStartPoint = point;
|
||||
GetScrollOffset(m_PanStartScroll);
|
||||
}
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
93
Viewer/SLNKDwfViewerView.h
Normal file
93
Viewer/SLNKDwfViewerView.h
Normal file
@@ -0,0 +1,93 @@
|
||||
// SLNKDwfViewerView.h : interface of the CSLNKDwfViewerView class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#include "atlgdix.h"
|
||||
|
||||
void PaintToDC(HDC dc, CString dwfPath, int nPage,
|
||||
CWhip2DCImpl &iWhip2DC, CSize wSize,
|
||||
BOOL forPrint = FALSE);
|
||||
|
||||
class CSLNKDwfViewerView : public CZoomScrollWindowImpl<CSLNKDwfViewerView>
|
||||
// , public CDoubleBufferImpl<CSLNKDwfViewerView>
|
||||
// , public COffscreenDraw<CSLNKDwfViewerView>
|
||||
// , public CPrintPreviewWindowImpl<CSLNKDwfViewerView>
|
||||
{
|
||||
public:
|
||||
DECLARE_WND_CLASS(NULL)
|
||||
|
||||
CSLNKDwfViewerView();
|
||||
~CSLNKDwfViewerView();
|
||||
|
||||
BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
BEGIN_MSG_MAP(CSLNKDwfViewerView)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||
|
||||
// CHAIN_MSG_MAP(CPrintPreviewWindowImpl<CSLNKDwfViewerView>)
|
||||
// CHAIN_MSG_MAP(CDoubleBufferImpl<CSLNKDwfViewerView>)
|
||||
// CHAIN_MSG_MAP(COffscreenDraw<CSLNKDwfViewerView>)
|
||||
CHAIN_MSG_MAP(CZoomScrollWindowImpl<CSLNKDwfViewerView>)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnMouseWheel(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
return 1; // no background painting needed. Scheelt geflikker
|
||||
}
|
||||
|
||||
int OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
CZoomScrollWindowImpl::OnCreate(uMsg, wParam, lParam, bHandled);
|
||||
// HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnRButtonDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnRButtonUp(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled);
|
||||
|
||||
LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
SetFocus();
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
|
||||
void DoPaint(CDCHandle dc);
|
||||
|
||||
void SetDWF(const CString &dwfPath);
|
||||
void SetPage(int nPage);
|
||||
CWhip2DCImpl *GetWhip2DC()
|
||||
{
|
||||
return &m_iWhip2DC;
|
||||
}
|
||||
|
||||
CString m_dwfPath;
|
||||
private:
|
||||
CDC m_MemDC;
|
||||
CBitmap *m_Bitmap;
|
||||
CPoint m_BitmapViewportOrigin; // zodat je weet wanneer opnieuw genereren
|
||||
CSize m_BitmapViewportExt;
|
||||
CRect m_BitmapClientRect;
|
||||
|
||||
int m_nPage;
|
||||
CWhip2DCImpl m_iWhip2DC;
|
||||
BOOL m_busyPanning;
|
||||
CPoint m_PanStartPoint, m_PanTotal, m_PanStartScroll;
|
||||
CDCHandle m_hDCOriginal;
|
||||
static BOOL my_progress_action(void *param, double progress);
|
||||
time_t m_Timer;
|
||||
};
|
||||
245
Viewer/Viewer.vcproj
Normal file
245
Viewer/Viewer.vcproj
Normal file
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="Viewer"
|
||||
ProjectGUID="{6DFC9788-904C-4724-A734-06634061EF00}"
|
||||
RootNamespace="WINCDMDWF"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm118"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="d:\Library\Wtl80\include;d:\Library\Dwf702\develop\global\src\dwf;d:\Library\Dwf702\develop\global\src\;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="3"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="2"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
AdditionalIncludeDirectories="d:\Library\Wtl80\include"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
UseOfATL="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/Zm118"
|
||||
AdditionalIncludeDirectories="d:\Library\Wtl80\include;d:\Library\Dwf702\develop\global\src\dwf;d:\Library\Dwf702\develop\global\src\;.\CxImage\Zlib"
|
||||
PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="2"
|
||||
BrowseInformation="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
AdditionalIncludeDirectories="d:\Library\Wtl80\include"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\AboutDlg.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FindDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MainFrm.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SLNKDWFViewerView.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="2"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\ListDWF.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\resource.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\res\SLNKDWFViewer.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SLNKDWFViewer.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\toolbar.bmp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
22
Viewer/ViewerLib.h
Normal file
22
Viewer/ViewerLib.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <atlwin.h>
|
||||
|
||||
#include <atlframe.h>
|
||||
#include <atlctrls.h>
|
||||
#include <atldlgs.h>
|
||||
#include <atlctrlw.h>
|
||||
|
||||
//JGL added
|
||||
#include <atltypes.h>
|
||||
#include <atlscrl.h>
|
||||
#include <atlstr.h>
|
||||
#include <atlctrlx.h>
|
||||
#include <atlprint.h>
|
||||
|
||||
#include "atlrx.h"
|
||||
|
||||
#include "../SLNKDWFImpl/SLNKDWFStaticRO.h"
|
||||
|
||||
#include "../SlnkdwfImpl/Whip2DCImpl.h"
|
||||
|
||||
#include "SlnkDWFViewerView.h"
|
||||
#include "Mainfrm.h"
|
||||
42
Viewer/_layerdlg.h
Normal file
42
Viewer/_layerdlg.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// aboutdlg.h : interface of the CLayerDlg class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class CLayerDlg : public CDialogImpl<CLayerDlg>,
|
||||
public CDialogResize<CLayerDlg>
|
||||
{
|
||||
public:
|
||||
enum { IDD = IDD_LAYERS };
|
||||
|
||||
CLayerDlg::CLayerDlg(CComPtr<SLNKDWFLib::IWhip2DC> p_iWhip2DC)
|
||||
{
|
||||
m_iWhip2DC = p_iWhip2DC;
|
||||
};
|
||||
|
||||
BEGIN_MSG_MAP(CLayerDlg)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
CHAIN_MSG_MAP(CDialogResize<CLayerDlg>)
|
||||
END_MSG_MAP()
|
||||
|
||||
BEGIN_DLGRESIZE_MAP(CLayerDlg)
|
||||
DLGRESIZE_CONTROL(IDOK, DLSZ_MOVE_X)
|
||||
DLGRESIZE_CONTROL(IDCANCEL, DLSZ_MOVE_X)
|
||||
DLGRESIZE_CONTROL(IDC_LAYERLIST, DLSZ_SIZE_X|DLSZ_SIZE_Y)
|
||||
END_DLGRESIZE_MAP()
|
||||
|
||||
// Handler prototypes (uncomment arguments if needed):
|
||||
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
|
||||
|
||||
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
|
||||
private:
|
||||
CListBox m_ListBox;
|
||||
CComQIPtr<SLNKDWFLib::IWhip2DC> m_iWhip2DC;
|
||||
};
|
||||
911
Viewer/atlgdix.h
Normal file
911
Viewer/atlgdix.h
Normal file
@@ -0,0 +1,911 @@
|
||||
#ifndef __ATLGDIX_H__
|
||||
#define __ATLGDIX_H__
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Additional GDI/USER wrappers
|
||||
//
|
||||
// Written by Bjarke Viksoe (bjarke@viksoe.dk)
|
||||
// Copyright (c) 2001-2002 Bjarke Viksoe.
|
||||
// Thanks to Daniel Bowen for COffscreenDrawRect.
|
||||
//
|
||||
// This code may be used in compiled form in any way you desire. This
|
||||
// file may be redistributed by any means PROVIDING it is
|
||||
// not sold for profit without the authors written consent, and
|
||||
// providing that this notice and the authors name is included.
|
||||
//
|
||||
// This file is provided "as is" with no expressed or implied warranty.
|
||||
// The author accepts no liability if it causes any damage to you or your
|
||||
// computer whatsoever. It's free, so don't hassle me about it.
|
||||
//
|
||||
// Beware of bugs.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error ATL requires C++ compilation (use a .cpp suffix)
|
||||
#endif
|
||||
|
||||
#ifndef __ATLGDI_H__
|
||||
#error atlgdix.h requires atlgdi.h to be included first
|
||||
#endif
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Macros
|
||||
|
||||
// The GetXValue macros below are badly designed and emit
|
||||
// compiler warnings e.g. when using RGB(255,255,255)...
|
||||
#pragma warning(disable : 4310)
|
||||
|
||||
#ifndef BlendRGB
|
||||
#define BlendRGB(c1, c2, factor) \
|
||||
RGB( GetRValue(c1) + ((GetRValue(c2) - GetRValue(c1)) * factor / 100L), \
|
||||
GetGValue(c1) + ((GetGValue(c2) - GetGValue(c1)) * factor / 100L), \
|
||||
GetBValue(c1) + ((GetBValue(c2) - GetBValue(c1)) * factor / 100L) )
|
||||
#endif
|
||||
|
||||
#ifndef COLOR_INVALID
|
||||
#define COLOR_INVALID (COLORREF) CLR_INVALID
|
||||
#endif
|
||||
|
||||
|
||||
#if _WTL_VER < 0x0750
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CIcon
|
||||
|
||||
template< bool t_bManaged >
|
||||
class CIconT
|
||||
{
|
||||
public:
|
||||
HICON m_hIcon;
|
||||
|
||||
// Constructor/destructor/operators
|
||||
|
||||
CIconT(HICON hIcon = NULL) : m_hIcon(hIcon)
|
||||
{
|
||||
}
|
||||
|
||||
~CIconT()
|
||||
{
|
||||
if( t_bManaged && m_hIcon != NULL ) ::DestroyIcon(m_hIcon);
|
||||
}
|
||||
|
||||
CIconT<t_bManaged>& operator=(HICON hIcon)
|
||||
{
|
||||
m_hIcon = hIcon;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Attach(HICON hIcon)
|
||||
{
|
||||
if( t_bManaged && m_hIcon != NULL ) ::DestroyIcon(m_hIcon);
|
||||
m_hIcon = hIcon;
|
||||
}
|
||||
HICON Detach()
|
||||
{
|
||||
HICON hIcon = m_hIcon;
|
||||
m_hIcon = NULL;
|
||||
return hIcon;
|
||||
}
|
||||
|
||||
operator HICON() const { return m_hIcon; }
|
||||
|
||||
bool IsNull() const { return m_hIcon == NULL; }
|
||||
|
||||
// Create methods
|
||||
|
||||
HICON LoadIcon(_U_STRINGorID icon)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hIcon = ::LoadIcon(ATL::_AtlBaseModule.GetResourceInstance(), icon.m_lpstr);
|
||||
#else
|
||||
m_hIcon = ::LoadIcon(_Module.GetResourceInstance(), icon.m_lpstr);
|
||||
#endif
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON LoadIcon(_U_STRINGorID icon, int cxDesired, int cyDesired, UINT fuLoad = 0)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hIcon = (HICON) ::LoadImage(ATL::_AtlBaseModule.GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad);
|
||||
#else
|
||||
m_hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad);
|
||||
#endif
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON LoadOEMIcon(UINT nIDIcon) // for IDI_ types
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
m_hIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(nIDIcon));
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON CreateIcon(int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, CONST BYTE* lpbANDButs, CONST BYTE *lpbXORbits)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(lpbANDbits);
|
||||
ATLASSERT(lpbXORbits);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hIcon = ::CreateIcon(ATL::_AtlBaseModule.GetResourceInstance(), nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits);
|
||||
#else
|
||||
m_hIcon = ::CreateIcon(_Module.GetResourceInstance(), nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits);
|
||||
#endif
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON CreateIconFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(pBits);
|
||||
m_hIcon = ::CreateIconFromResource(pBits, dwResSize, TRUE, dwVersion);
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON CreateIconFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(pbBits);
|
||||
ATLASSERT(cbBits>0);
|
||||
m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags);
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON CreateIconIndirect(PICONINFO pIconInfo)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(pIconInfo);
|
||||
m_hIcon = ::CreateIconIndirect(pIconInfo);
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(!::IsBadStringPtr(lpszExeFileName,-1));
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hIcon = ::ExtractIcon(ATL::_AtlBaseModule.GetModuleInstance(), lpszExeFileName, nIconIndex);
|
||||
#else
|
||||
m_hIcon = ::ExtractIcon(_Module.GetModuleInstance(), lpszExeFileName, nIconIndex);
|
||||
#endif
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON ExtractAssociatedIcon(HINSTANCE hInst, LPCTSTR lpIconPath, LPWORD lpiIcon)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(!::IsBadStringPtr(lpIconPath,-1));
|
||||
ATLASSERT(lpiIcon);
|
||||
m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon);
|
||||
return m_hIcon;
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
BOOL DestroyIcon()
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
BOOL bRet = ::DestroyIcon(m_hIcon);
|
||||
if( bRet ) m_hIcon = NULL;
|
||||
return bRet;
|
||||
}
|
||||
HICON CopyIcon()
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
return ::CopyIcon(m_hIcon);
|
||||
}
|
||||
HICON DuplicateIcon()
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
return ::DuplicateIcon(NULL, m_hIcon);
|
||||
}
|
||||
|
||||
BOOL DrawIcon(HDC hDC, int x, int y)
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
return ::DrawIcon(hDC, x, y, m_hIcon);
|
||||
}
|
||||
BOOL DrawIcon(HDC hDC, POINT pt)
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon);
|
||||
}
|
||||
BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL)
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
return ::DrawIconEx(hDC, x, y, m_hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
|
||||
}
|
||||
BOOL DrawIconEx(HDC hDC, POINT pt, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL)
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags);
|
||||
}
|
||||
|
||||
BOOL GetIconInfo(PICONINFO pIconInfo)
|
||||
{
|
||||
ATLASSERT(m_hIcon!=NULL);
|
||||
ATLASSERT(pIconInfo);
|
||||
return ::GetIconInfo(m_hIcon, pIconInfo);
|
||||
}
|
||||
};
|
||||
|
||||
typedef CIconT<true> CIcon;
|
||||
typedef CIconT<false> CIconHandle;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCursor
|
||||
|
||||
// Protect template against silly macro
|
||||
#ifdef CopyCursor
|
||||
#undef CopyCursor
|
||||
#endif
|
||||
|
||||
template< bool t_bManaged >
|
||||
class CCursorT
|
||||
{
|
||||
public:
|
||||
HCURSOR m_hCursor;
|
||||
|
||||
// Constructor/destructor/operators
|
||||
|
||||
CCursorT(HCURSOR hCursor = NULL) : m_hCursor(hCursor)
|
||||
{
|
||||
}
|
||||
|
||||
~CCursorT()
|
||||
{
|
||||
if( t_bManaged && m_hCursor != NULL ) ::DestroyCursor(m_hCursor);
|
||||
}
|
||||
|
||||
CCursorT<t_bManaged>& operator=(HCURSOR hCursor)
|
||||
{
|
||||
m_hCursor = hCursor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Attach(HCURSOR hCursor)
|
||||
{
|
||||
if( t_bManaged && m_hCursor != NULL ) ::DestroyCursor(m_hCursor);
|
||||
m_hCursor = hCursor;
|
||||
}
|
||||
HCURSOR Detach()
|
||||
{
|
||||
HCURSOR hCursor = m_hCursor;
|
||||
m_hCursor = NULL;
|
||||
return hCursor;
|
||||
}
|
||||
|
||||
operator HCURSOR() const { return m_hCursor; }
|
||||
|
||||
bool IsNull() const { return m_hCursor == NULL; }
|
||||
|
||||
// Create methods
|
||||
|
||||
HCURSOR LoadCursor(_U_STRINGorID cursor)
|
||||
{
|
||||
ATLASSERT(m_hCursor==NULL);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hCursor = ::LoadCursor(ATL::_AtlBaseModule.GetResourceInstance(), cursor.m_lpstr);
|
||||
#else
|
||||
m_hCursor = ::LoadCursor(_Module.GetResourceInstance(), cursor.m_lpstr);
|
||||
#endif
|
||||
return m_hCursor;
|
||||
}
|
||||
HCURSOR LoadOEMCursor(UINT nIDCursor) // for IDC_ types
|
||||
{
|
||||
ATLASSERT(m_hCursor==NULL);
|
||||
m_hCursor = ::LoadCursor(NULL, MAKEINTRESOURCE(nIDCursor));
|
||||
return m_hCursor;
|
||||
}
|
||||
HICON LoadCursor(_U_STRINGorID cursor, int cxDesired, int cyDesired, UINT fuLoad = 0)
|
||||
{
|
||||
ATLASSERT(m_hCursor==NULL);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hCursor = (HCURSOR) ::LoadImage(ATL::_AtlBaseModule.GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad);
|
||||
#else
|
||||
m_hCursor = (HCURSOR) ::LoadImage(_Module.GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad);
|
||||
#endif
|
||||
return m_hCursor;
|
||||
}
|
||||
HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename)
|
||||
{
|
||||
ATLASSERT(m_hCursor==NULL);
|
||||
ATLASSERT(!::IsBadStringPtr(pstrFilename,-1));
|
||||
m_hCursor = ::LoadCursorFromFile(pstrFilename);
|
||||
return m_hCursor;
|
||||
}
|
||||
HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane)
|
||||
{
|
||||
ATLASSERT(m_hCursor==NULL);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hCursor = ::CreateCursor(ATL::_AtlBaseModule.GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane);
|
||||
#else
|
||||
m_hCursor = ::CreateCursor(_Module.GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane);
|
||||
#endif
|
||||
return m_hCursor;
|
||||
}
|
||||
HICON CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(pBits);
|
||||
m_hIcon = ::CreateIconFromResource(pBits, dwResSize, FALSE, dwVersion);
|
||||
return m_hIcon;
|
||||
}
|
||||
HICON CreateCursorFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR)
|
||||
{
|
||||
ATLASSERT(m_hIcon==NULL);
|
||||
ATLASSERT(pbBits);
|
||||
ATLASSERT(cbBits>0);
|
||||
m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags);
|
||||
return m_hIcon;
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
BOOL DestroyCursor()
|
||||
{
|
||||
ATLASSERT(m_hCursor!=NULL);
|
||||
BOOL bRet = ::DestroyCursor(m_hCursor);
|
||||
if( bRet ) m_hCursor = NULL;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
HCURSOR CopyCursor()
|
||||
{
|
||||
ATLASSERT(m_hCursor!=NULL);
|
||||
return (HCURSOR) ::CopyIcon( (HICON) m_hCursor );
|
||||
}
|
||||
|
||||
#if(WINVER >= 0x0500)
|
||||
BOOL GetCursorInfo(LPCURSORINFO pCursorInfo)
|
||||
{
|
||||
ATLASSERT(m_hCursor!=NULL);
|
||||
ATLASSERT(pCursorInfo);
|
||||
return ::GetCursorInfo(pCursorInfo);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef CCursorT<true> CCursor;
|
||||
typedef CCursorT<false> CCursorHandle;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAccelerator
|
||||
|
||||
template< bool t_bManaged >
|
||||
class CAcceleratorT
|
||||
{
|
||||
public:
|
||||
HACCEL m_hAccel;
|
||||
|
||||
// Constructor/destructor/operators
|
||||
|
||||
CAcceleratorT(HACCEL hAccel = NULL) : m_hAccel(hAccel)
|
||||
{
|
||||
}
|
||||
|
||||
~CAcceleratorT()
|
||||
{
|
||||
if( t_bManaged && m_hAccel != NULL ) ::DestroyAcceleratorTable(m_hAccel);
|
||||
}
|
||||
|
||||
CAcceleratorT<t_bManaged>& operator=(HACCEL hAccel)
|
||||
{
|
||||
m_hAccel = hAccel;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void DestroyObject()
|
||||
{
|
||||
if( m_hAccel != NULL ) {
|
||||
::DestroyAcceleratorTable(m_hAccel);
|
||||
m_hAccel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Attach(HACCEL hAccel)
|
||||
{
|
||||
if( t_bManaged && m_hAccel != NULL ) ::DestroyAcceleratorTable(m_hAccel);
|
||||
m_hAccel = hAccel;
|
||||
}
|
||||
HCURSOR Detach()
|
||||
{
|
||||
HACCEL hAccel = m_hAccel;
|
||||
m_hAccel = NULL;
|
||||
return hAccel;
|
||||
}
|
||||
|
||||
operator HACCEL() const { return m_hAccel; }
|
||||
|
||||
bool IsNull() const { return m_hAccel == NULL; }
|
||||
|
||||
// Create methods
|
||||
|
||||
HACCEL LoadAccelerators(_U_STRINGorID accel)
|
||||
{
|
||||
ATLASSERT(m_hAccel==NULL);
|
||||
#if (_ATL_VER >= 0x0700)
|
||||
m_hAccel = ::LoadAccelerators(ATL::_AtlBaseModule.GetResourceInstance(), accel.m_lpstr);
|
||||
#else
|
||||
m_hAccel = ::LoadAccelerators(_Module.GetResourceInstance(), accel.m_lpstr);
|
||||
#endif
|
||||
return m_hAccel;
|
||||
}
|
||||
HACCEL CreateAcceleratorTable(LPACCEL pAccel, int cEntries)
|
||||
{
|
||||
ATLASSERT(m_hAccel==NULL);
|
||||
ATLASSERT(!::IsBadReadPtr(lpAccelDst, sizeof(ACCEL)*cEntries));
|
||||
m_hAccel = ::CreateAcceleratorTable(pAccel, cEntries);
|
||||
return m_hAccel;
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries)
|
||||
{
|
||||
ATLASSERT(m_hAccel!=NULL);
|
||||
ATLASSERT(!::IsBadWritePtr(lpAccelDst, sizeof(ACCEL)*cEntries));
|
||||
return ::CopyAcceleratorTable(m_hAccel, lpAccelDst, cEntries);
|
||||
}
|
||||
|
||||
BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg)
|
||||
{
|
||||
ATLASSERT(m_hAccel!=NULL);
|
||||
ATLASSERT(::IsWindow(hWnd));
|
||||
ATLASSERT(pMsg);
|
||||
return ::TranslateAccelerator(hWnd, m_hAccel, pMsg);
|
||||
}
|
||||
};
|
||||
|
||||
typedef CAcceleratorT<true> CAccelerator;
|
||||
typedef CAcceleratorT<false> CAcceleratorHandle;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CLogFont
|
||||
|
||||
class CLogFont : public LOGFONT
|
||||
{
|
||||
public:
|
||||
CLogFont()
|
||||
{
|
||||
::ZeroMemory( (LOGFONT*) this, sizeof(LOGFONT) );
|
||||
}
|
||||
CLogFont(const LOGFONT& lf)
|
||||
{
|
||||
Copy(&lf);
|
||||
}
|
||||
CLogFont(HFONT hFont)
|
||||
{
|
||||
ATLASSERT(::GetObjectType(hFont)==OBJ_FONT);
|
||||
::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*) this);
|
||||
}
|
||||
HFONT CreateFontIndirect()
|
||||
{
|
||||
return ::CreateFontIndirect(this);
|
||||
}
|
||||
void SetBold()
|
||||
{
|
||||
lfWeight = FW_BOLD;
|
||||
}
|
||||
BOOL IsBold() const
|
||||
{
|
||||
return lfWeight >= FW_BOLD;
|
||||
}
|
||||
void MakeBolder(int iScale = 1)
|
||||
{
|
||||
lfWeight += FW_BOLD * iScale;
|
||||
}
|
||||
void MakeLarger(int iScale)
|
||||
{
|
||||
if( lfHeight > 0 ) lfHeight += iScale; else lfHeight -= iScale;
|
||||
}
|
||||
void SetHeight(long PointSize, HDC hDC = NULL)
|
||||
{
|
||||
// For MM_TEXT mapping mode...
|
||||
// NOTE: MulDiv() gives correct rounding.
|
||||
lfHeight = -MulDiv(PointSize, ::GetDeviceCaps(hDC, LOGPIXELSY), 72);
|
||||
}
|
||||
long GetHeight(HDC hDC = NULL) const
|
||||
{
|
||||
// For MM_TEXT mapping mode...
|
||||
// NOTE: MulDiv() gives correct rounding.
|
||||
return MulDiv(-lfHeight, 72, ::GetDeviceCaps(hDC, LOGPIXELSY));
|
||||
}
|
||||
long GetDeciPointHeight(HDC hDC = NULL)
|
||||
{
|
||||
POINT ptOrg = { 0, 0 };
|
||||
::DPtoLP(hDC, &ptOrg, 1);
|
||||
POINT pt = { 0, 0 };
|
||||
pt.y = abs(lfHeight) + ptOrg.y;
|
||||
::LPtoDP(hDC,&pt,1);
|
||||
return MulDiv(pt.y, 720, ::GetDeviceCaps(hDC,LOGPIXELSY)); // 72 points/inch, 10 decipoints/point
|
||||
}
|
||||
void SetHeightFromDeciPoint(long DeciPtHeight, HDC hDC = NULL)
|
||||
{
|
||||
POINT pt;
|
||||
pt.y = MulDiv(::GetDeviceCaps(hDC, LOGPIXELSY), DeciPtHeight, 720); // 72 points/inch, 10 decipoints/point
|
||||
::DPtoLP(hDC, &pt, 1);
|
||||
POINT ptOrg = { 0, 0 };
|
||||
::DPtoLP(hDC, &ptOrg, 1);
|
||||
lfHeight = -abs(pt.y - ptOrg.y);
|
||||
}
|
||||
void SetCaptionFont()
|
||||
{
|
||||
NONCLIENTMETRICS ncm = { 0 };
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
|
||||
Copy(&ncm.lfCaptionFont);
|
||||
}
|
||||
void SetMenuFont()
|
||||
{
|
||||
NONCLIENTMETRICS ncm = { 0 };
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
|
||||
Copy(&ncm.lfMenuFont);
|
||||
}
|
||||
void SetStatusFont()
|
||||
{
|
||||
NONCLIENTMETRICS ncm = { 0 };
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
|
||||
Copy(&ncm.lfStatusFont);
|
||||
}
|
||||
void SetMessageBoxFont()
|
||||
{
|
||||
NONCLIENTMETRICS ncm = { 0 };
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
|
||||
Copy(&ncm.lfMessageFont);
|
||||
}
|
||||
void Copy(const LOGFONT* lf)
|
||||
{
|
||||
ATLASSERT(lf);
|
||||
::CopyMemory( (LOGFONT*) this, lf, sizeof(LOGFONT) );
|
||||
}
|
||||
CLogFont& operator=(const CLogFont& src)
|
||||
{
|
||||
Copy(&src);
|
||||
return *this;
|
||||
}
|
||||
CLogFont& operator=(const LOGFONT& src)
|
||||
{
|
||||
Copy(&src);
|
||||
return *this;
|
||||
}
|
||||
CLogFont& operator=(HFONT hFont)
|
||||
{
|
||||
ATLASSERT(::GetObjectType(hFont)==OBJ_FONT);
|
||||
::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*) this);
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const LOGFONT& logfont) const
|
||||
{
|
||||
return( logfont.lfHeight == lfHeight &&
|
||||
logfont.lfWidth == lfWidth &&
|
||||
logfont.lfEscapement == lfEscapement &&
|
||||
logfont.lfOrientation == lfOrientation &&
|
||||
logfont.lfWeight == lfWeight &&
|
||||
logfont.lfItalic == lfItalic &&
|
||||
logfont.lfUnderline == lfUnderline &&
|
||||
logfont.lfStrikeOut == lfStrikeOut &&
|
||||
logfont.lfCharSet == lfCharSet &&
|
||||
logfont.lfOutPrecision == lfOutPrecision &&
|
||||
logfont.lfClipPrecision == lfClipPrecision &&
|
||||
logfont.lfQuality == lfQuality &&
|
||||
logfont.lfPitchAndFamily == lfPitchAndFamily &&
|
||||
::lstrcmp(logfont.lfFaceName, lfFaceName) == 0 );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _WTL_VER
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMemDC
|
||||
|
||||
class CMemDC : public CDC
|
||||
{
|
||||
public:
|
||||
CDCHandle m_dc; // Owner DC
|
||||
CBitmap m_bitmap; // Offscreen bitmap
|
||||
CBitmapHandle m_hOldBitmap; // Originally selected bitmap
|
||||
RECT m_rc; // Rectangle of drawing area
|
||||
|
||||
CMemDC(HDC hDC, LPRECT pRect = NULL)
|
||||
{
|
||||
ATLASSERT(hDC!=NULL);
|
||||
m_dc = hDC;
|
||||
if( pRect != NULL ) m_rc = *pRect; else m_dc.GetClipBox(&m_rc);
|
||||
|
||||
CreateCompatibleDC(m_dc);
|
||||
::LPtoDP(m_dc, (LPPOINT) &m_rc, sizeof(RECT) / sizeof(POINT));
|
||||
m_bitmap.CreateCompatibleBitmap(m_dc, m_rc.right - m_rc.left, m_rc.bottom - m_rc.top);
|
||||
m_hOldBitmap = SelectBitmap(m_bitmap);
|
||||
::DPtoLP(m_dc, (LPPOINT) &m_rc, sizeof(RECT) / sizeof(POINT));
|
||||
SetWindowOrg(m_rc.left, m_rc.top);
|
||||
}
|
||||
~CMemDC()
|
||||
{
|
||||
// Copy the offscreen bitmap onto the screen.
|
||||
m_dc.BitBlt(m_rc.left, m_rc.top, m_rc.right - m_rc.left, m_rc.bottom - m_rc.top,
|
||||
m_hDC, m_rc.left, m_rc.top, SRCCOPY);
|
||||
// Swap back the original bitmap.
|
||||
SelectBitmap(m_hOldBitmap);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// COffscreenDraw
|
||||
|
||||
// To use it, derive from it and chain it in the message map.
|
||||
template< class T >
|
||||
class COffscreenDraw
|
||||
{
|
||||
public:
|
||||
BEGIN_MSG_MAP(COffscreenDraw)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
if( wParam != NULL )
|
||||
{
|
||||
CMemDC memdc( (HDC) wParam, NULL );
|
||||
pT->DoPaint(memdc.m_hDC);
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT rc;
|
||||
pT->GetClientRect(&rc);
|
||||
CPaintDC dc(pT->m_hWnd);
|
||||
CMemDC memdc(dc.m_hDC, &rc);
|
||||
pT->DoPaint(memdc.m_hDC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
return 1; // handled; no need to erase background; do it in DoPaint();
|
||||
}
|
||||
void DoPaint(CDCHandle dc)
|
||||
{
|
||||
ATLASSERT(false); // must override this
|
||||
}
|
||||
};
|
||||
|
||||
// To use it, derive from it and chain it in the message map.
|
||||
template< class T >
|
||||
class COffscreenDrawRect
|
||||
{
|
||||
public:
|
||||
BEGIN_MSG_MAP(COffscreenDrawRect)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
if( wParam != NULL )
|
||||
{
|
||||
CMemDC memdc( (HDC) wParam, NULL );
|
||||
pT->DoPaint(memdc.m_hDC, memdc.m_rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPaintDC dc(pT->m_hWnd);
|
||||
CMemDC memdc(dc.m_hDC, &dc.m_ps.rcPaint);
|
||||
pT->DoPaint(memdc.m_hDC, dc.m_ps.rcPaint);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
{
|
||||
return 1; // handled; no need to erase background; do it in DoPaint();
|
||||
}
|
||||
void DoPaint(CDCHandle dc, RECT& rcClip)
|
||||
{
|
||||
ATLASSERT(false); // must override this
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CSaveDC
|
||||
|
||||
class CSaveDC
|
||||
{
|
||||
public:
|
||||
HDC m_hDC;
|
||||
int m_iState;
|
||||
|
||||
CSaveDC(HDC hDC) : m_hDC(hDC)
|
||||
{
|
||||
ATLASSERT(::GetObjectType(m_hDC)==OBJ_DC || ::GetObjectType(m_hDC)==OBJ_MEMDC);
|
||||
m_iState = ::SaveDC(hDC);
|
||||
ATLASSERT(m_iState!=0);
|
||||
}
|
||||
~CSaveDC()
|
||||
{
|
||||
Restore();
|
||||
}
|
||||
void Restore()
|
||||
{
|
||||
if( m_iState == 0 ) return;
|
||||
ATLASSERT(::GetObjectType(m_hDC)==OBJ_DC || ::GetObjectType(m_hDC)==OBJ_MEMDC);
|
||||
::RestoreDC(m_hDC, m_iState);
|
||||
m_iState = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CHandle
|
||||
|
||||
#if (_ATL_VER < 0x0700)
|
||||
|
||||
class CHandle
|
||||
{
|
||||
public:
|
||||
HANDLE m_h;
|
||||
|
||||
CHandle(HANDLE hSrc = INVALID_HANDLE_VALUE) : m_h(hSrc)
|
||||
{ }
|
||||
|
||||
~CHandle()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
operator HANDLE() const { return m_h; };
|
||||
|
||||
LPHANDLE operator&()
|
||||
{
|
||||
ATLASSERT(!IsValid());
|
||||
return &m_h;
|
||||
}
|
||||
|
||||
CHandle& operator=(HANDLE h)
|
||||
{
|
||||
ATLASSERT(!IsValid());
|
||||
m_h = h;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool IsValid() const { return m_h != INVALID_HANDLE_VALUE; };
|
||||
|
||||
void Attach(HANDLE h)
|
||||
{
|
||||
if( IsValid() ) ::CloseHandle(m_h);
|
||||
m_h = h;
|
||||
}
|
||||
HANDLE Detach()
|
||||
{
|
||||
HANDLE h = m_h;
|
||||
m_h = INVALID_HANDLE_VALUE;
|
||||
return h;
|
||||
}
|
||||
|
||||
BOOL Close()
|
||||
{
|
||||
BOOL bRes = FALSE;
|
||||
if( m_h != INVALID_HANDLE_VALUE ) {
|
||||
bRes = ::CloseHandle(m_h);
|
||||
m_h = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
return bRes;
|
||||
}
|
||||
|
||||
BOOL Duplicate(HANDLE hSource, bool bInherit = false)
|
||||
{
|
||||
ATLASSERT(!IsValid());
|
||||
HANDLE hOurProcess = ::GetCurrentProcess();
|
||||
BOOL b = ::DuplicateHandle(hOurProcess,
|
||||
hSource,
|
||||
hOurProcess,
|
||||
&m_h,
|
||||
DUPLICATE_SAME_ACCESS,
|
||||
bInherit,
|
||||
DUPLICATE_SAME_ACCESS);
|
||||
ATLASSERT(b);
|
||||
return b;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _ATL_VER
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Mouse Hover helper
|
||||
|
||||
#ifndef NOTRACKMOUSEEVENT
|
||||
|
||||
#ifndef WM_MOUSEENTER
|
||||
#define WM_MOUSEENTER WM_USER + 253
|
||||
#endif // WM_MOUSEENTER
|
||||
|
||||
// To use it, derive from it and chain it in the message map.
|
||||
// Make sure to set bHandled to FALSE when handling WM_MOUSEMOVE or
|
||||
// the WM_MOUSELEAVE message!
|
||||
template< class T >
|
||||
class CMouseHover
|
||||
{
|
||||
public:
|
||||
bool m_fMouseOver; // Internal mouse-over state
|
||||
bool m_fMouseForceUpdate; // Update window immediately on event
|
||||
|
||||
CMouseHover() :
|
||||
m_fMouseOver(false),
|
||||
m_fMouseForceUpdate(true)
|
||||
{
|
||||
}
|
||||
|
||||
void SetForceMouseOverUpdate(bool bForce = false)
|
||||
{
|
||||
m_fMouseForceUpdate = bForce;
|
||||
}
|
||||
|
||||
BEGIN_MSG_MAP(CMouseHover)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
|
||||
MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
if( !m_fMouseOver ) {
|
||||
m_fMouseOver = true;
|
||||
pT->SendMessage(WM_MOUSEENTER, wParam, lParam);
|
||||
if( m_fMouseForceUpdate ) {
|
||||
pT->Invalidate();
|
||||
pT->UpdateWindow();
|
||||
}
|
||||
_StartTrackMouseLeave(pT->m_hWnd);
|
||||
}
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
if( m_fMouseOver ) {
|
||||
m_fMouseOver = false;
|
||||
if( m_fMouseForceUpdate ) {
|
||||
pT->Invalidate();
|
||||
pT->UpdateWindow();
|
||||
}
|
||||
}
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
}
|
||||
BOOL _StartTrackMouseLeave(HWND hWnd) const
|
||||
{
|
||||
ATLASSERT(::IsWindow(hWnd));
|
||||
TRACKMOUSEEVENT tme = { 0 };
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = hWnd;
|
||||
return _TrackMouseEvent(&tme);
|
||||
}
|
||||
BOOL _CancelTrackMouseLeave(HWND hWnd) const
|
||||
{
|
||||
TRACKMOUSEEVENT tme = { 0 };
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE | TME_CANCEL;
|
||||
tme.hwndTrack = hWnd;
|
||||
return _TrackMouseEvent(&tme);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // NOTRACKMOUSEEVENT
|
||||
|
||||
|
||||
}; // namespace WTL
|
||||
|
||||
#endif // __ATLGDIX_H__
|
||||
72
Viewer/mainfrm.h
Normal file
72
Viewer/mainfrm.h
Normal file
@@ -0,0 +1,72 @@
|
||||
// MainFrm.h : interface of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class CMainFrame : public CFrameWindowImpl<CMainFrame>, public CUpdateUI<CMainFrame>,
|
||||
public CMessageFilter, public CIdleHandler, public CPrintJobInfo
|
||||
{
|
||||
public:
|
||||
DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
|
||||
|
||||
CMainFrame()
|
||||
{
|
||||
m_printer.OpenDefaultPrinter();
|
||||
m_devmode.CopyFromPrinter(m_printer);
|
||||
ATLTRACE("\nIn constructor with m_Combo %x", m_Combo.m_hWnd);
|
||||
|
||||
};
|
||||
|
||||
CSLNKDwfViewerView m_view;
|
||||
|
||||
CComboBox m_Combo;
|
||||
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
virtual BOOL OnIdle();
|
||||
|
||||
BEGIN_UPDATE_UI_MAP(CMainFrame)
|
||||
UPDATE_ELEMENT(ID_VIEW_TOOLBAR, UPDUI_MENUPOPUP)
|
||||
END_UPDATE_UI_MAP()
|
||||
|
||||
BEGIN_MSG_MAP(CMainFrame)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
|
||||
COMMAND_ID_HANDLER(ID_ZOOM_EXTENTS, OnZoomExtents)
|
||||
COMMAND_ID_HANDLER(ID_ZOOM_IN, OnZoomIn)
|
||||
COMMAND_ID_HANDLER(ID_ZOOM_OUT, OnZoomOut)
|
||||
COMMAND_ID_HANDLER(ID_FILE_PRINT, OnFilePrint)
|
||||
COMMAND_ID_HANDLER(ID_FILE_OPEN, OnFileOpen)
|
||||
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
|
||||
COMMAND_ID_HANDLER(ID_VIEW_LAYERS, OnViewLayers)
|
||||
COMMAND_HANDLER(IDC_COMBO, CBN_SELCHANGE, onSelChange)
|
||||
CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
|
||||
CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
|
||||
END_MSG_MAP()
|
||||
|
||||
// Handler prototypes (uncomment arguments if needed):
|
||||
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||||
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||||
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
|
||||
|
||||
void SetDWF(const CString &dwfPath);
|
||||
LRESULT onSelChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnFileExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnFileOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnZoomExtents(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnZoomIn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnZoomOut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnFilePrint(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnViewToolBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
public:
|
||||
LRESULT OnViewLayers(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
|
||||
|
||||
CPrinter m_printer;
|
||||
CDevMode m_devmode;
|
||||
CPrintPreviewWindow m_wndPreview;
|
||||
|
||||
virtual bool IsValidPage(UINT nPage);
|
||||
virtual bool PrintPage(UINT nPage, HDC hDC);
|
||||
};
|
||||
0
Viewer/res/.gitignore
vendored
0
Viewer/res/.gitignore
vendored
BIN
Viewer/res/SLNKDWFViewer.ico
Normal file
BIN
Viewer/res/SLNKDWFViewer.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Viewer/res/Toolbar.bmp
Normal file
BIN
Viewer/res/Toolbar.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 718 B |
BIN
Viewer/res/_toolbar.bmp
Normal file
BIN
Viewer/res/_toolbar.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
33
Viewer/resource.h
Normal file
33
Viewer/resource.h
Normal file
@@ -0,0 +1,33 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by SLNKDWFViewer.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDD_LAYERS 201
|
||||
#define IDC_LAYERLIST 1000
|
||||
#define IDC_DLLVERSION 1001
|
||||
#define IDC_DLLPATH 1002
|
||||
#define IDC_DLLBUILD 1003
|
||||
#define IDC_DLLBUILDTIME 1003
|
||||
#define IDC_WHIPVERSION 1004
|
||||
#define IDC_DWFVERSION 1005
|
||||
#define IDC_DWF2VERSION 1005
|
||||
#define ID_VIEW_LAYERS 32772
|
||||
#define ID_ZOOM_IN 32774
|
||||
#define ID_ZOOM_EXTENTS 32777
|
||||
#define ID_ZOOM_OUT 32782
|
||||
#define IDP_PLACEHOLDER 32783
|
||||
#define IDC_COMBO 32784
|
||||
#define IDC_PROGRESS 32785
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 202
|
||||
#define _APS_NEXT_COMMAND_VALUE 32786
|
||||
#define _APS_NEXT_CONTROL_VALUE 1004
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
9
Viewer/stdafx.cpp
Normal file
9
Viewer/stdafx.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// SLNKDWFViewer.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#if (_ATL_VER < 0x0700)
|
||||
#include <atlimpl.cpp>
|
||||
#endif //(_ATL_VER < 0x0700)
|
||||
21
Viewer/stdafx.h
Normal file
21
Viewer/stdafx.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
// Change these values to use different versions
|
||||
//#define _WIN32_WINNT 0x0400
|
||||
#define _WIN32_IE 0x0400
|
||||
#define _RICHEDIT_VER 0x0100
|
||||
|
||||
#define _ATL_DEBUG_INTERFACES
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlapp.h>
|
||||
|
||||
//extern CAppModule _Module; gaf vage instabiliteit
|
||||
extern CAtlWinModule _Module;
|
||||
|
||||
#include "ViewerLib.h"
|
||||
Reference in New Issue
Block a user