Добавил:
inrad
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Общая теория систем. Курсовой для ИИ / src / pluginDll
.cpp// pluginDll.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "pluginDll.h"
#include "MVCinDLL.h"
#include "pluginDoc.h"
#include "pluginForm.h"
#include "pluginSheet.h"
#include "pluginView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
// CpluginDllApp
BEGIN_MESSAGE_MAP(CpluginDllApp, CWinApp)
END_MESSAGE_MAP()
// CpluginDllApp construction
CpluginDllApp::CpluginDllApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CpluginDllApp object
CpluginDllApp theApp;
Properties* pOptions = 0;
CWnd* gpMainWnd = 0;
HINSTANCE hDLL = 0;
// CpluginDllApp initialization
BOOL CpluginDllApp::InitInstance()
{
hDLL = theApp.m_hInstance;
return CWinApp::InitInstance();
}
CMultiDocTemplate* CreateSheetDocTemplate();
CToolBar* CreateSheetToolbar(CMDIFrameWnd* frame);
Sheet* CreateSheetSample();
CMultiDocTemplate* CreateSheetDocTemplate ()
{
CMultiDocTemplate* pTemplate = NULL;
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
pTemplate = new CDLLMultiDocTemplate(
theApp.m_hInstance,
IDR_PLUGIN,
RUNTIME_CLASS(pluginDoc),
RUNTIME_CLASS(pluginForm),
RUNTIME_CLASS(pluginView));
pluginSheet::docTemplate = pTemplate;
return pTemplate;
}
CToolBar* CreateSheetToolbar (CMDIFrameWnd* frame)
{
ASSERT_VALID(frame);
return NULL;
}
Sheet* CreateSheetSample()
{
return new pluginSheet();
}
sc_addr GetSheetType()
{
sc_addr type = get_idtf_by_full_uri(system_session, "/seb/planimetry/testGG");
if(!type)
type = create_el_by_full_uri(system_session, "/seb/planimetry/testGG", SC_N_CONST);
return type;
}
void InitSheetControl(struct SheetControl* _c)
{
ASSERT(_c);
ASSERT(_c->pOptions);
pOptions = _c->pOptions;
_c->CreateToolBar = CreateSheetToolbar;
_c->CreateDocTemplate = CreateSheetDocTemplate;
_c->CreateSheetSample = CreateSheetSample;
_c->GetType = GetSheetType;
}
bool isHotKey = false;
void InitSheet()
{
// Инициализация. Регистрация горячих клавиш
HWND hWnd = AfxGetApp()->GetMainWnd()->GetSafeHwnd();
// Shift+N
isHotKey = RegisterHotKey(hWnd,2,MOD_ALT,0x4E);
}
void GetSheetHotKey(WPARAM w)
{
if(isHotKey)
if(w==2){
sc_addr * adr = new sc_addr();
Sheet * pSheet = Shell::getInstance()->createSheet(get_idtf_by_full_uri(system_session, "/seb/planimetry/testGG"),adr);
}
}
void UnInitNLSheetControl(void)
{
// Деинициализация
}
Соседние файлы в папке src