Click here to Skip to main content
13,897,577 members
Click here to Skip to main content

Stats

296.8K views
78.8K downloads
226 bookmarked
Posted 30 Dec 2005
Licenced CPOL

Form Designer

, 1 Aug 2009
Component for adding scriptable forms capabilities to an application.
MFCDemo.exe
CSDemo
App.ico
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
CSDemo.suo
DaeDoe.bmp
MFCDemo
MFCDemo.dsp
MFCDemo.odl
MFCDemo.reg
res
DaeDoe.bmp
MFCDemo.ico
MFCDemoDoc.ico
Toolbar1.bmp
Toolbar2.bmp
Toolbar3.bmp
Wand.bmp
VBDemo
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
DaeDoe.bmp
VBDemo.vbp
DDForms.chm
DDForms
Archive
FormEditorItems.rgs
vssver.scc
Constants.scr
DaeDoe.bmp
DDForms.def
DDForms.vcproj
DDForms.vcproj.vspscc
EventSinkPassThrough.rgs
FormEditor.bmp
FormEditor.rgs
FormEditorItemCollection.rgs
FormEditorItemDetails.rgs
FormViewer.bmp
FormViewer.rgs
FormViewerItemCollection.rgs
FormViewerItemDetails.rgs
mssccprj.scc
PropPageExtended.rgs
PropPageFormEditor.rgs
PropPageFormViewer.rgs
PropPageSimpleScriptEditor.rgs
SimpleScriptEditor.bmp
SimpleScriptEditor.rgs
vssver.scc
DDFormsTools
CodeMaxDriver
CodeMaxDriver.rgs
CodeMaxDriver.vcproj
CodeMaxDriver.vcproj.vspscc
CodeMaxDriverps.def
CodeMaxDriverPS.vcproj
CodeMaxDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
CodeSenseDriver
CodeSenseDriver.rgs
CodeSenseDriver.vcproj
CodeSenseDriver.vcproj.vspscc
CodeSenseDriverps.def
CodeSenseDriverPS.vcproj
CodeSenseDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
DDPropPageAll
DDPropPageAll.def
DDPropPageAll.vcproj
DDPropPageAll.vcproj.vspscc
mssccprj.scc
PropPageAll.rgs
vssver.scc
DDUnlock
DDUnlock.vcproj
DDUnlock.vcproj.vspscc
mssccprj.scc
vssver.scc
DDControlPack
DDButton.bmp
DDCheckBox.bmp
DDComboBox.bmp
DDControlPack.rgs
DDControlPack.vcproj
DDControlPack.vcproj.vspscc
DDHorzScrollBar.bmp
DDLabel.bmp
DDListBox.bmp
DDPicture.bmp
DDRadioButton.bmp
DDTextBox.bmp
DDVertScrollBar.bmp
mssccprj.scc
vssver.scc
Redistributables
Ansi
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
Unicode
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
// MFCDemoDoc.cpp : implementation of the CMFCDemoDoc class
//
// Author : David Shepherd
//			Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MFCDemo.h"

#include "MFCDemoDoc.h"
#include "MFCDemoView.h"

#include "LoadErrorDlg.h"

#include "Script.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDoc

IMPLEMENT_DYNCREATE(CMFCDemoDoc, CDocument)

BEGIN_MESSAGE_MAP(CMFCDemoDoc, CDocument)
	//{{AFX_MSG_MAP(CMFCDemoDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CMFCDemoDoc, CDocument)
	//{{AFX_DISPATCH_MAP(CMFCDemoDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//      DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IMFCDemo to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {D458776D-EBFA-471A-B7FC-DA89B574C38C}
static const IID IID_IMFCDemo =
{ 0xd458776d, 0xebfa, 0x471a, { 0xb7, 0xfc, 0xda, 0x89, 0xb5, 0x74, 0xc3, 0x8c } };

BEGIN_INTERFACE_MAP(CMFCDemoDoc, CDocument)
	INTERFACE_PART(CMFCDemoDoc, IID_IMFCDemo, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDoc construction/destruction

CMFCDemoDoc::CMFCDemoDoc()
{
	// TODO: add one-time construction code here

	EnableAutomation();

	AfxOleLockApp();
}

CMFCDemoDoc::~CMFCDemoDoc()
{
	AfxOleUnlockApp();
}

BOOL CMFCDemoDoc::OnNewDocument()
{
BLOCK_BEGIN
	if (!CDocument::OnNewDocument())
		return FALSE;

	// create a new form
	POSITION Pos=GetFirstViewPosition();
	ASSERT(Pos!=NULL);
	CMFCDemoView *pView=(CMFCDemoView *)GetNextView(Pos);
	ASSERT(pView!=NULL);
	if(IsWindow(pView->m_FormEditor))
	{
		pView->m_FormEditor.New();
	}
	// set the script text
	if(IsWindow(pView->m_FormEditor))
	{
		CScript Script=pView->m_FormEditor.GetScript();
		Script.SetText(
			_T("\' ----------------------------------------------------------------\r\n")
			_T("\' This is the script editor provided by the standard DaeDoe Forms \r\n")
			_T("\' package. If required, it can easily be replaced by a number of  \r\n")
			_T("\' powerful third party syntax highlighting editors such as CodeMax\r\n")
			_T("\' and CodeSense. For additional information, please refer to the  \r\n")
			_T("\' DaeDoe Forms help manual.                                       \r\n")
			_T("\' ----------------------------------------------------------------\r\n"));
	}
	// reset the script editor modified flag
	if(IsWindow(pView->m_SimpleScriptEditor))
	{
		pView->m_SimpleScriptEditor.SetModified(FALSE);
	}
	// reset the modified flag
	SetModifiedFlag(FALSE);
BLOCK_END
	return Caught ? FALSE : TRUE;
}

BOOL CMFCDemoDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
BLOCK_BEGIN
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;

	// open a form
	POSITION Pos=GetFirstViewPosition();
	ASSERT(Pos!=NULL);
	CMFCDemoView *pView=(CMFCDemoView *)GetNextView(Pos);
	ASSERT(pView!=NULL);
	if(IsWindow(pView->m_FormEditor))
	{
		pView->m_FormEditor.LoadFromFile(lpszPathName);
	}
	// reset the script editor modified flag
	if(IsWindow(pView->m_SimpleScriptEditor))
	{
		pView->m_SimpleScriptEditor.SetModified(FALSE);
	}
	// reset the modified flag
	SetModifiedFlag(FALSE);
BLOCK_END
	// show the load error dialog
	if(Caught)
	{
		CLoadErrorDlg Dlg;
		(void)Dlg.DoModal();
	}
	return Caught ? FALSE : TRUE;
}

BOOL CMFCDemoDoc::OnSaveDocument(LPCTSTR lpszPathName) 
{
BLOCK_BEGIN
	if(!CDocument::OnSaveDocument(lpszPathName))
		return FALSE;

	// save a form
	POSITION Pos=GetFirstViewPosition();
	ASSERT(Pos!=NULL);
	CMFCDemoView *pView=(CMFCDemoView *)GetNextView(Pos);
	ASSERT(pView!=NULL);
	if(IsWindow(pView->m_FormEditor))
	{
		pView->m_FormEditor.SaveToFile(lpszPathName);
	}
	// reset the script editor modified flag
	if(IsWindow(pView->m_SimpleScriptEditor))
	{
		pView->m_SimpleScriptEditor.SetModified(FALSE);
	}
	// reset the modified flag
	SetModifiedFlag(FALSE);
BLOCK_END
	return Caught ? FALSE : TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDoc serialization

void CMFCDemoDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDoc diagnostics

#ifdef _DEBUG
void CMFCDemoDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CMFCDemoDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDoc commands

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

DaveShep
Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.190306.1 | Last Updated 1 Aug 2009
Article Copyright 2005 by DaveShep
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid