initial commit

This commit is contained in:
Lance Edgar 2011-12-27 17:36:42 -06:00
commit 5d7b3af547
21 changed files with 1966 additions and 0 deletions

149
src/MainFrm.cpp Normal file
View file

@ -0,0 +1,149 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "Rattail CE.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
const DWORD dwAdornmentFlags = 0; // exit button
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_FILE_SAVE_X, OnFileSave)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if(!m_wndCommandBar.Create(this) ||
!m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
!m_wndCommandBar.AddAdornments(dwAdornmentFlags))
{
TRACE0("Failed to create CommandBar\n");
return -1; // fail to create
}
m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnFileSave()
{
CDocument* pDocument;
CString* pPath;
CFile destFile;
CArchive* ar;
BOOL bResult;
pDocument = GetActiveDocument();
if (! pDocument)
return;
pPath = GetNewPath();
if (! pPath)
return;
bResult = destFile.Open(*pPath, CFile::modeCreate | CFile::modeWrite | CFile::shareExclusive);
delete pPath;
if (! bResult)
return;
ar = new CArchive(&destFile, CArchive::store);
pDocument->Serialize(*ar);
ar->Flush();
ar->Close();
destFile.Close();
delete ar;
}
CString* CMainFrame::GetNewPath()
{
WIN32_FIND_DATA FindData;
HANDLE hFindFile;
BOOL bResult;
UINT i;
CString folder = DOCUMENTS_FOLDER;
CString* pPath;
hFindFile = FindFirstFile(folder, &FindData);
FindClose(hFindFile);
if (hFindFile == INVALID_HANDLE_VALUE) {
bResult = CreateDirectory(folder, NULL);
if (! bResult)
return NULL;
}
pPath = new CString;
for (i = 1; i <= 1024; i++) {
pPath->Format(L"%s\\Batch %04u", folder, i);
hFindFile = FindFirstFile(*pPath, &FindData);
FindClose(hFindFile);
if (hFindFile == INVALID_HANDLE_VALUE) {
return pPath;
}
}
return NULL;
}

58
src/MainFrm.h Normal file
View file

@ -0,0 +1,58 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__C8833BE4_6339_420D_8475_01C269AA00D4__INCLUDED_)
#define AFX_MAINFRM_H__C8833BE4_6339_420D_8475_01C269AA00D4__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define DOCUMENTS_FOLDER "\\My Documents\\Rattail"
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
CString* GetNewPath();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CCeCommandBar m_wndCommandBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnFileSave();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__C8833BE4_6339_420D_8475_01C269AA00D4__INCLUDED_)

154
src/Rattail CE.cpp Normal file
View file

@ -0,0 +1,154 @@
// Rattail CE.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Rattail CE.h"
#include "MainFrm.h"
#include "Rattail CEDoc.h"
#include "Rattail CEView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRattailCEApp
BEGIN_MESSAGE_MAP(CRattailCEApp, CWinApp)
//{{AFX_MSG_MAP(CRattailCEApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// 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
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRattailCEApp construction
CRattailCEApp::CRattailCEApp()
: CWinApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CRattailCEApp object
CRattailCEApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CRattailCEApp initialization
BOOL CRattailCEApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
SetRegistryKey(_T("Rattail"));
LoadStdProfileSettings(0); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CRattailCEDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CRattailCEView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog(); // Added for WCE apps
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CRattailCEApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CRattailCEApp commands
// Added for WCE apps
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CenterWindow();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

50
src/Rattail CE.h Normal file
View file

@ -0,0 +1,50 @@
// Rattail CE.h : main header file for the RATTAIL CE application
//
#if !defined(AFX_RATTAILCE_H__6BB1429E_C1CA_4593_B98C_4AB7DC7ACF6C__INCLUDED_)
#define AFX_RATTAILCE_H__6BB1429E_C1CA_4593_B98C_4AB7DC7ACF6C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CRattailCEApp:
// See Rattail CE.cpp for the implementation of this class
//
class CRattailCEApp : public CWinApp
{
public:
CRattailCEApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRattailCEApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CRattailCEApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RATTAILCE_H__6BB1429E_C1CA_4593_B98C_4AB7DC7ACF6C__INCLUDED_)

349
src/Rattail CE.rc Normal file
View file

@ -0,0 +1,349 @@
//Microsoft eMbedded Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "newres.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 DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""newres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\Rattail CE.rc2"" // non-Microsoft eMbedded Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#include ""wceres.rc"" // WCE-specific components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\Rattail CE.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
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_X
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About Rattail CE...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
"S", ID_FILE_SAVE, 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
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 151, 62
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE 0x80000000L
CAPTION "About Rattail CE"
FONT 8, "System"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,13,19,21,20
LTEXT "Rattail CE v0.1",IDC_STATIC,40,10,56,8,SS_NOPREFIX
LTEXT "Copyright © 2011 Lance Edgar",IDC_STATIC,40,25,101,8
LTEXT "http://rattail.edbob.org/",IDC_STATIC,40,41,80,8
END
IDD_RATTAILCE_FORM DIALOG DISCARDABLE 0, 0, 183, 153
STYLE WS_CHILD
FONT 8, "System"
BEGIN
CONTROL "List1",IDC_SCANS,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,
7,7,169,118
EDITTEXT IDC_SCANCODE,7,134,91,12
EDITTEXT IDC_CASE_QUANTITY,117,134,21,12,ES_RIGHT | ES_MULTILINE |
ES_NUMBER
CONTROL "",IDC_STOP_CASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
104,135,8,11
EDITTEXT IDC_UNIT_QUANTITY,156,134,20,12,ES_RIGHT | ES_MULTILINE |
ES_NUMBER
CONTROL "",IDC_STOP_UNIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
143,135,8,11
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// 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 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", " \0"
VALUE "FileDescription", "Rattail CE WCE MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "Rattail CE\0"
VALUE "LegalCopyright", "Copyright © 2011\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Rattail CE.exe\0"
VALUE "ProductName", "Rattail CE Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 144
TOPMARGIN, 7
BOTTOMMARGIN, 55
END
IDD_RATTAILCE_FORM, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 176
TOPMARGIN, 7
BOTTOMMARGIN, 146
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "Rattail CE\n\nRattailCE\n\n\nRattailCE.Document\nRattailCE Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
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"
END
STRINGTABLE DISCARDABLE
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 DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
ID_FILE_MRU_FILE3 "Open this document"
ID_FILE_MRU_FILE4 "Open this document"
ID_FILE_MRU_FILE5 "Open this document"
ID_FILE_MRU_FILE6 "Open this document"
ID_FILE_MRU_FILE7 "Open this document"
ID_FILE_MRU_FILE8 "Open this document"
ID_FILE_MRU_FILE9 "Open this document"
ID_FILE_MRU_FILE10 "Open this document"
ID_FILE_MRU_FILE11 "Open this document"
ID_FILE_MRU_FILE12 "Open this document"
ID_FILE_MRU_FILE13 "Open this document"
ID_FILE_MRU_FILE14 "Open this document"
ID_FILE_MRU_FILE15 "Open this document"
ID_FILE_MRU_FILE16 "Open this document"
END
STRINGTABLE DISCARDABLE
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 DISCARDABLE
BEGIN
ID_WINDOW_SPLIT "Split the active window into panes\nSplit"
END
STRINGTABLE DISCARDABLE
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 DISCARDABLE
BEGIN
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_CAPS "CAP"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_SAVE_AS_X "Save the active document with a new name\nSave As"
ID_FILE_SAVE_X "Save the active document\nSave"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\Rattail CE.rc2" // non-Microsoft eMbedded Visual C++ edited resources
#include "afxres.rc" // Standard components
#include "wceres.rc" // WCE-specific components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

BIN
src/Rattail CE.vcb Normal file

Binary file not shown.

114
src/Rattail CE.vcc Normal file
View file

@ -0,0 +1,114 @@
; VCC file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CRattailCEView
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "Rattail CE.h"
LastPage=0
ClassCount=5
Class1=CRattailCEApp
Class2=CRattailCEDoc
Class3=CRattailCEView
Class4=CMainFrame
Class5=CAboutDlg
ResourceCount=3
Resource1=IDR_MAINFRAME
Resource2=IDD_ABOUTBOX
Resource3=IDD_RATTAILCE_FORM
[CLS:CRattailCEApp]
Type=0
HeaderFile=Rattail CE.h
ImplementationFile=Rattail CE.cpp
Filter=N
LastObject=CRattailCEApp
[CLS:CRattailCEDoc]
Type=0
HeaderFile=Rattail CEDoc.h
ImplementationFile=Rattail CEDoc.cpp
Filter=N
LastObject=CRattailCEDoc
BaseClass=CDocument
VirtualFilter=DC
[CLS:CRattailCEView]
Type=0
HeaderFile=Rattail CEView.h
ImplementationFile=Rattail CEView.cpp
Filter=W
LastObject=CRattailCEView
BaseClass=CFormView
VirtualFilter=VWC
[CLS:CMainFrame]
Type=0
HeaderFile=MainFrm.h
ImplementationFile=MainFrm.cpp
Filter=T
LastObject=ID_FILE_SAVE_X
BaseClass=CFrameWnd
VirtualFilter=fWC
[CLS:CAboutDlg]
Type=0
HeaderFile=Rattail CE.cpp
ImplementationFile=Rattail CE.cpp
Filter=D
LastObject=CAboutDlg
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=4
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342308480
Control3=IDC_STATIC,static,1342308352
Control4=IDC_STATIC,static,1342308352
[MNU:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE_X
Command4=ID_APP_EXIT
Command5=ID_APP_ABOUT
CommandCount=5
[ACL:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_EDIT_UNDO
Command5=ID_EDIT_CUT
Command6=ID_EDIT_COPY
Command7=ID_EDIT_PASTE
Command8=ID_EDIT_UNDO
Command9=ID_EDIT_CUT
Command10=ID_EDIT_COPY
Command11=ID_EDIT_PASTE
Command12=ID_NEXT_PANE
Command13=ID_PREV_PANE
CommandCount=13
[DLG:IDD_RATTAILCE_FORM]
Type=1
Class=CRattailCEView
ControlCount=6
Control1=IDC_SCANS,SysListView32,1350631685
Control2=IDC_SCANCODE,edit,1350631424
Control3=IDC_CASE_QUANTITY,edit,1350639622
Control4=IDC_STOP_CASE,button,1342242819
Control5=IDC_UNIT_QUANTITY,edit,1350639622
Control6=IDC_STOP_UNIT,button,1342242819

BIN
src/Rattail CE.vco Normal file

Binary file not shown.

217
src/Rattail CE.vcp Normal file
View file

@ -0,0 +1,217 @@
# Microsoft eMbedded Visual Tools Project File - Name="Rattail CE" - Package Owner=<4>
# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02
# ** DO NOT EDIT **
# TARGTYPE "Win32 (WCE ARMV4I) Application" 0xa501
CFG=Rattail CE - Win32 (WCE ARMV4I) Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Rattail CE.vcn".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Rattail CE.vcn" CFG="Rattail CE - Win32 (WCE ARMV4I) Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Rattail CE - Win32 (WCE ARMV4I) Release" (based on "Win32 (WCE ARMV4I) Application")
!MESSAGE "Rattail CE - Win32 (WCE ARMV4I) Debug" (based on "Win32 (WCE ARMV4I) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP ATL_Project 2
CPP=clarm.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Rattail CE - Win32 (WCE ARMV4I) Release"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ARMV4IRel"
# PROP BASE Intermediate_Dir "ARMV4IRel"
# PROP BASE CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ARMV4IRel"
# PROP Intermediate_Dir "ARMV4IRel"
# PROP CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Target_Dir ""
# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "THUMB" /d "_THUMB_" /d "ARM" /d "_ARM_" /d "ARMV4I" /d "_AFXDLL" /r
# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "NDEBUG" /d "$(CePlatform)" /d "THUMB" /d "_THUMB_" /d "ARM" /d "_ARM_" /d "ARMV4I" /d "_AFXDLL" /r
# ADD BASE CPP /nologo /W3 /D "ARM" /D "_ARM_" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_AFXDLL" /Yu"stdafx.h" /QRarch4T /QRinterwork-return /O2 /M$(CECrtMT) /c
# ADD CPP /nologo /W3 /D "ARM" /D "_ARM_" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "NDEBUG" /D "_AFXDLL" /Yu"stdafx.h" /QRarch4T /QRinterwork-return /O2 /M$(CECrtMT) /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"wWinMainCRTStartup" /subsystem:$(CESubsystem) /MACHINE:THUMB
# ADD LINK32 /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"wWinMainCRTStartup" /subsystem:$(CESubsystem) /MACHINE:THUMB
!ELSEIF "$(CFG)" == "Rattail CE - Win32 (WCE ARMV4I) Debug"
# PROP BASE Use_MFC 2
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "ARMV4IDbg"
# PROP BASE Intermediate_Dir "ARMV4IDbg"
# PROP BASE CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "ARMV4IDbg"
# PROP Intermediate_Dir "ARMV4IDbg"
# PROP CPU_ID "{DC70F430-E78B-494F-A9D5-62ADC56443B8}"
# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "THUMB" /d "_THUMB_" /d "ARM" /d "_ARM_" /d "ARMV4I" /d "_AFXDLL" /r
# ADD RSC /l 0x409 /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "DEBUG" /d "$(CePlatform)" /d "THUMB" /d "_THUMB_" /d "ARM" /d "_ARM_" /d "ARMV4I" /d "_AFXDLL" /r
# ADD BASE CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_AFXDLL" /Yu"stdafx.h" /QRarch4T /QRinterwork-return /M$(CECrtMTDebug) /c
# ADD CPP /nologo /W3 /Zi /Od /D "DEBUG" /D "ARM" /D "_ARM_" /D "ARMV4I" /D UNDER_CE=$(CEVersion) /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "UNICODE" /D "_UNICODE" /D "_AFXDLL" /FR /Yu"stdafx.h" /QRarch4T /QRinterwork-return /M$(CECrtMTDebug) /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"wWinMainCRTStartup" /debug /subsystem:$(CESubsystem) /MACHINE:THUMB
# ADD LINK32 SCNAPI32.lib /nologo /base:"0x00010000" /stack:0x10000,0x1000 /entry:"wWinMainCRTStartup" /debug /subsystem:$(CESubsystem) /MACHINE:THUMB
!ENDIF
# Begin Target
# Name "Rattail CE - Win32 (WCE ARMV4I) Release"
# Name "Rattail CE - Win32 (WCE ARMV4I) Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\MainFrm.cpp
DEP_CPP_MAINF=\
".\MainFrm.h"\
".\Rattail CE.h"\
".\StdAfx.h"\
# End Source File
# Begin Source File
SOURCE=".\Rattail CE.cpp"
DEP_CPP_RATTA=\
".\MainFrm.h"\
".\Rattail CE.h"\
".\Rattail CEDoc.h"\
".\Rattail CEView.h"\
".\StdAfx.h"\
{$(INCLUDE)}"RSMDefs.h"\
{$(INCLUDE)}"ScanCApi.h"\
{$(INCLUDE)}"ScanDef.h"\
{$(INCLUDE)}"ScanErr.h"\
{$(INCLUDE)}"ScanMacr.h"\
{$(INCLUDE)}"StrucInf.h"\
# End Source File
# Begin Source File
SOURCE=".\Rattail CE.rc"
# End Source File
# Begin Source File
SOURCE=".\Rattail CEDoc.cpp"
DEP_CPP_RATTAI=\
".\Rattail CE.h"\
".\Rattail CEDoc.h"\
".\StdAfx.h"\
# End Source File
# Begin Source File
SOURCE=".\Rattail CEView.cpp"
DEP_CPP_RATTAIL=\
".\Rattail CE.h"\
".\Rattail CEDoc.h"\
".\Rattail CEView.h"\
".\StdAfx.h"\
{$(INCLUDE)}"RSMDefs.h"\
{$(INCLUDE)}"ScanCApi.h"\
{$(INCLUDE)}"ScanDef.h"\
{$(INCLUDE)}"ScanErr.h"\
{$(INCLUDE)}"ScanMacr.h"\
{$(INCLUDE)}"StrucInf.h"\
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
DEP_CPP_STDAF=\
".\StdAfx.h"\
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\MainFrm.h
# End Source File
# Begin Source File
SOURCE=.\newres.h
# End Source File
# Begin Source File
SOURCE=".\Rattail CE.h"
# End Source File
# Begin Source File
SOURCE=".\Rattail CEDoc.h"
# End Source File
# Begin Source File
SOURCE=".\Rattail CEView.h"
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=".\res\Rattail CE.ico"
# End Source File
# Begin Source File
SOURCE=".\res\Rattail CE.rc2"
# PROP Exclude_From_Scan -1
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

29
src/Rattail CE.vcw Normal file
View file

@ -0,0 +1,29 @@
Microsoft eMbedded Visual Tools Workspace File, Format Version 4.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Rattail CE"=".\Rattail CE.vcp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

127
src/Rattail CEDoc.cpp Normal file
View file

@ -0,0 +1,127 @@
// Rattail CEDoc.cpp : implementation of the CRattailCEDoc class
//
#include "stdafx.h"
#include "Rattail CE.h"
#include "Rattail CEDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRattailCEDoc
IMPLEMENT_DYNCREATE(CRattailCEDoc, CDocument)
BEGIN_MESSAGE_MAP(CRattailCEDoc, CDocument)
//{{AFX_MSG_MAP(CRattailCEDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CRattailCEDoc construction/destruction
CRattailCEDoc::CRattailCEDoc()
{
// TODO: add one-time construction code here
}
CRattailCEDoc::~CRattailCEDoc()
{
}
BOOL CRattailCEDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
/*
CString* pPath = GetNewPath();
if (! pPath)
return FALSE;
SetPathName(*pPath, FALSE);
delete pPath;
*/
return TRUE;
}
int CRattailCEDoc::AddScanDatum(CString& sScancode, CString& sCaseQuantity, CString& sUnitQuantity)
{
CRattailScanDatum* datum = new CRattailScanDatum();
datum->sScancode = sScancode;
datum->sCaseQuantity = sCaseQuantity;
datum->sUnitQuantity = sUnitQuantity;
return scandata.Add(datum);
}
/////////////////////////////////////////////////////////////////////////////
// CRattailCEDoc serialization
void CRattailCEDoc::Serialize(CArchive& ar)
{
int nSize, i;
CRattailScanDatum* datum;
CString buffer;
if (ar.IsStoring()) {
nSize = scandata.GetSize();
for (i = 0; i < nSize; i++) {
datum = (CRattailScanDatum*) scandata.GetAt(i);
ar.WriteString(datum->sScancode);
ar.WriteString(L"\n");
ar.WriteString(datum->sCaseQuantity);
ar.WriteString(L"\n");
ar.WriteString(datum->sUnitQuantity);
ar.WriteString(L"\n");
}
} else if (ar.IsLoading()) {
while (true) {
datum = new CRattailScanDatum();
if (ar.ReadString(buffer)) {
datum->sScancode = buffer;
if (ar.ReadString(buffer)) {
datum->sCaseQuantity = buffer;
if (ar.ReadString(buffer)) {
datum->sUnitQuantity = buffer;
scandata.Add(datum);
continue;
}
}
}
break;
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CRattailCEDoc diagnostics
#ifdef _DEBUG
void CRattailCEDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CRattailCEDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRattailCEDoc commands
void CRattailCEDoc::DeleteContents()
{
scandata.RemoveAll();
CDocument::DeleteContents();
}

69
src/Rattail CEDoc.h Normal file
View file

@ -0,0 +1,69 @@
// Rattail CEDoc.h : interface of the CRattailCEDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_RATTAILCEDOC_H__6D4250CD_B61A_45A9_8D20_5ACA2A57058C__INCLUDED_)
#define AFX_RATTAILCEDOC_H__6D4250CD_B61A_45A9_8D20_5ACA2A57058C__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CRattailCEDoc : public CDocument
{
protected: // create from serialization only
CRattailCEDoc();
DECLARE_DYNCREATE(CRattailCEDoc)
// Attributes
public:
CObArray scandata;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRattailCEDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
virtual void DeleteContents();
//}}AFX_VIRTUAL
int AddScanDatum(CString& sScancode, CString& sCaseQuantity, CString& sUnitQuantity);
// Implementation
public:
virtual ~CRattailCEDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CRattailCEDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CRattailScanDatum : public CObject
{
public:
CString sScancode;
CString sCaseQuantity;
CString sUnitQuantity;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RATTAILCEDOC_H__6D4250CD_B61A_45A9_8D20_5ACA2A57058C__INCLUDED_)

353
src/Rattail CEView.cpp Normal file
View file

@ -0,0 +1,353 @@
// Rattail CEView.cpp : implementation of the CRattailCEView class
//
#include "stdafx.h"
#include "Rattail CE.h"
#include "Rattail CEDoc.h"
#include "Rattail CEView.h"
#include "ScanCApi.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
enum tagUSERMSGS
{
UM_SCAN = WM_USER + 0x200,
UM_STARTSCANNING,
UM_STOPSCANNING
};
/////////////////////////////////////////////////////////////////////////////
// CRattailCEView
IMPLEMENT_DYNCREATE(CRattailCEView, CFormView)
BEGIN_MESSAGE_MAP(CRattailCEView, CFormView)
//{{AFX_MSG_MAP(CRattailCEView)
ON_NOTIFY(NM_CLICK, IDC_SCANS, OnClickScans)
ON_EN_SETFOCUS(IDC_SCANCODE, OnScancodeSetfocus)
ON_EN_KILLFOCUS(IDC_SCANCODE, OnScancodeKillfocus)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRattailCEView construction/destruction
CRattailCEView::CRattailCEView()
: CFormView(CRattailCEView::IDD)
{
//{{AFX_DATA_INIT(CRattailCEView)
//}}AFX_DATA_INIT
m_bInited = false;
m_lpScanBuffer = NULL;
OpenScanner();
}
CRattailCEView::~CRattailCEView()
{
CloseScanner();
}
void CRattailCEView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRattailCEView)
DDX_Control(pDX, IDC_STOP_UNIT, m_StopUnit);
DDX_Control(pDX, IDC_UNIT_QUANTITY, m_UnitQuantity);
DDX_Control(pDX, IDC_STOP_CASE, m_StopCase);
DDX_Control(pDX, IDC_CASE_QUANTITY, m_CaseQuantity);
DDX_Control(pDX, IDC_SCANS, m_Scans);
DDX_Control(pDX, IDC_SCANCODE, m_Scancode);
//}}AFX_DATA_MAP
}
BOOL CRattailCEView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CRattailCEView diagnostics
#ifdef _DEBUG
void CRattailCEView::AssertValid() const
{
CFormView::AssertValid();
}
void CRattailCEView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CRattailCEDoc* CRattailCEView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRattailCEDoc)));
return (CRattailCEDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRattailCEView message handlers
void CRattailCEView::OnClickScans(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
}
void CRattailCEView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
if (! m_bInited) {
m_Scans.InsertColumn(0, L"Scan Code");
m_Scans.SetColumnWidth(0, 160);
m_Scans.InsertColumn(1, L"Case", LVCFMT_RIGHT);
m_Scans.SetColumnWidth(1, 50);
m_Scans.InsertColumn(2, L"Unit", LVCFMT_RIGHT);
m_Scans.SetColumnWidth(2, 50);
m_CaseQuantity.SetWindowText(L"0");
m_StopUnit.SetCheck(BST_CHECKED);
m_UnitQuantity.SetWindowText(L"1");
m_bInited = true;
}
m_Scancode.SetFocus();
}
bool CRattailCEView::ProcessScan()
{
if (m_StopCase.GetCheck() == BST_CHECKED) {
m_CaseQuantity.SetSel(0, -1);
m_CaseQuantity.SetFocus();
return false;
}
if (m_StopUnit.GetCheck() == BST_CHECKED) {
m_UnitQuantity.SetSel(0, -1);
m_UnitQuantity.SetFocus();
return false;
}
return StoreScanData();
}
BOOL CRattailCEView::PreTranslateMessage(MSG* pMsg)
{
LPSCAN_BUFFER lpScanBuffer;
CString scandata;
if (pMsg->message == UM_SCAN) {
m_dwRequestID = NULL; // clear this so logic elsewhere isn't confused
lpScanBuffer = (LPSCAN_BUFFER) pMsg->lParam;
if (SCNBUF_GETSTAT(lpScanBuffer) == E_SCN_SUCCESS) {
scandata = (LPCTSTR) SCNBUF_GETDATA(lpScanBuffer);
m_Scancode.SetWindowText(scandata.Left(scandata.GetLength() - 1));
if (ProcessScan()) {
EnableScanner();
}
}
} else if (pMsg->message == WM_KEYUP) {
if (pMsg->wParam == VK_RETURN) {
if (pMsg->hwnd == m_Scancode.m_hWnd) {
ProcessScan();
} else if (pMsg->hwnd == m_CaseQuantity.m_hWnd) {
if (m_StopUnit.GetCheck() == BST_CHECKED) {
m_UnitQuantity.SetSel(0, -1);
m_UnitQuantity.SetFocus();
} else {
StoreScanData();
}
} else if (pMsg->hwnd == m_UnitQuantity.m_hWnd) {
StoreScanData();
}
}
}
return CFormView::PreTranslateMessage(pMsg);
}
bool CRattailCEView::StoreScanData()
{
CString scancode, cases, units;
int row;
CRattailCEDoc* doc;
m_Scancode.GetWindowText(scancode);
scancode.TrimLeft();
scancode.TrimRight();
if (scancode.IsEmpty()) {
m_Scancode.SetSel(0, -1);
m_Scancode.SetFocus();
return false;
}
m_CaseQuantity.GetWindowText(cases);
cases.TrimLeft();
cases.TrimRight();
if (cases == "0") {
cases.Empty();
}
m_UnitQuantity.GetWindowText(units);
units.TrimLeft();
units.TrimRight();
if (units == "0") {
units.Empty();
}
if (cases.IsEmpty() && units.IsEmpty()) {
if (m_StopCase.GetCheck() == BST_CHECKED) {
m_CaseQuantity.SetSel(0, -1);
m_CaseQuantity.SetFocus();
} else if (m_StopUnit.GetCheck() == BST_CHECKED) {
m_UnitQuantity.SetSel(0, -1);
m_UnitQuantity.SetFocus();
} else {
m_CaseQuantity.SetSel(0, -1);
m_CaseQuantity.SetFocus();
}
return false;
}
doc = GetDocument();
doc->AddScanDatum(scancode, cases, units);
row = m_Scans.GetItemCount();
m_Scans.InsertItem(row, scancode);
if (! cases.IsEmpty()) {
m_Scans.SetItemText(row, 1, cases);
}
if (! units.IsEmpty()) {
m_Scans.SetItemText(row, 2, units);
}
m_Scans.EnsureVisible(row, false);
m_Scancode.SetSel(0, -1);
m_Scancode.SetFocus();
return true;
}
void CRattailCEView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CRattailCEDoc* doc;
int i;
CRattailScanDatum* datum;
doc = GetDocument();
m_Scans.DeleteAllItems();
for (i = 0; i < doc->scandata.GetSize(); i++) {
datum = (CRattailScanDatum*) doc->scandata.GetAt(i);
m_Scans.InsertItem(i, datum->sScancode);
m_Scans.SetItemText(i, 1, datum->sCaseQuantity);
m_Scans.SetItemText(i, 2, datum->sUnitQuantity);
}
CFormView::OnUpdate(pSender, lHint, pHint);
}
BOOL CRattailCEView::OpenScanner()
{
DWORD dwResult;
HANDLE FindHandle;
SCAN_FINDINFO ScanFindInfo;
DECODER_PARAMS DecoderParams;
SI_INIT(&ScanFindInfo);
dwResult = SCAN_FindFirst(&ScanFindInfo, &FindHandle);
if (dwResult != E_SCN_SUCCESS)
return FALSE;
dwResult = SCAN_FindClose(FindHandle);
if (dwResult != E_SCN_SUCCESS)
return FALSE;
dwResult = SCAN_Open(ScanFindInfo.szDeviceName, &m_hScanner);
if (dwResult != E_SCN_SUCCESS)
return FALSE;
dwResult = SCAN_Enable(m_hScanner);
if (dwResult != E_SCN_SUCCESS) {
SCAN_Close(m_hScanner);
m_hScanner = NULL;
return FALSE;
}
SI_INIT(&DecoderParams);
dwResult = SCAN_GetDecoderParams(m_hScanner, DECODER_UPCE0, &DecoderParams);
if (dwResult != E_SCN_SUCCESS) {
SCAN_Disable(m_hScanner);
SCAN_Close(m_hScanner);
m_hScanner = NULL;
return FALSE;
}
SI_SET_FIELD(&DecoderParams, dec_specific.upce0_params.bConvertToUPCA, TRUE);
dwResult = SCAN_SetDecoderParams(m_hScanner, DECODER_UPCE0, &DecoderParams);
if (dwResult != E_SCN_SUCCESS) {
SCAN_Disable(m_hScanner);
SCAN_Close(m_hScanner);
m_hScanner = NULL;
return FALSE;
}
// TODO: I already don't remember where I got this 7095 figure...
m_lpScanBuffer = SCAN_AllocateBuffer(TRUE, 7095);
return TRUE;
}
void CRattailCEView::CloseScanner()
{
if (m_lpScanBuffer) {
SCAN_DeallocateBuffer(m_lpScanBuffer);
m_lpScanBuffer = NULL;
}
if (m_hScanner != NULL) {
SCAN_Close(m_hScanner);
m_hScanner = NULL;
}
}
BOOL CRattailCEView::EnableScanner()
{
DWORD dwResult;
if (! m_hScanner)
return FALSE;
dwResult = SCAN_ReadLabelMsg(m_hScanner, m_lpScanBuffer, m_hWnd, UM_SCAN, 0, &m_dwRequestID);
if (dwResult != E_SCN_SUCCESS)
return FALSE;
return TRUE;
}
void CRattailCEView::DisableScanner()
{
if (m_dwRequestID) {
SCAN_CancelRead(m_hScanner, m_dwRequestID);
m_dwRequestID = NULL;
}
}
void CRattailCEView::OnScancodeSetfocus()
{
EnableScanner();
}
void CRattailCEView::OnScancodeKillfocus()
{
DisableScanner();
}

91
src/Rattail CEView.h Normal file
View file

@ -0,0 +1,91 @@
// Rattail CEView.h : interface of the CRattailCEView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_RATTAILCEVIEW_H__9EA36B28_60E4_4345_9342_8125EE0D5B61__INCLUDED_)
#define AFX_RATTAILCEVIEW_H__9EA36B28_60E4_4345_9342_8125EE0D5B61__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "ScanCApi.h"
class CRattailCEView : public CFormView
{
protected: // create from serialization only
CRattailCEView();
DECLARE_DYNCREATE(CRattailCEView)
public:
//{{AFX_DATA(CRattailCEView)
enum { IDD = IDD_RATTAILCE_FORM };
CButton m_StopUnit;
CEdit m_UnitQuantity;
CButton m_StopCase;
CEdit m_CaseQuantity;
CListCtrl m_Scans;
CEdit m_Scancode;
//}}AFX_DATA
// Attributes
public:
CRattailCEDoc* GetDocument();
// Operations
public:
void CloseScanner();
void DisableScanner();
BOOL EnableScanner();
BOOL OpenScanner();
bool ProcessScan();
bool StoreScanData();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRattailCEView)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CRattailCEView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
bool m_bInited;
HANDLE m_hScanner;
LPSCAN_BUFFER m_lpScanBuffer;
DWORD m_dwRequestID;
// Generated message map functions
protected:
//{{AFX_MSG(CRattailCEView)
afx_msg void OnClickScans(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnScancodeSetfocus();
afx_msg void OnScancodeKillfocus();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in Rattail CEView.cpp
inline CRattailCEDoc* CRattailCEView::GetDocument()
{ return (CRattailCEDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RATTAILCEVIEW_H__9EA36B28_60E4_4345_9342_8125EE0D5B61__INCLUDED_)

93
src/ReadMe.txt Normal file
View file

@ -0,0 +1,93 @@
========================================================================
Microsoft Foundation Class Library for Windows CE: Rattail CE
========================================================================
AppWizard has created this Rattail CE application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your Rattail CE application.
Rattail CE.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CRattailCEApp application class.
Rattail CE.cpp
This is the main application source file that contains the application
class CRattailCEApp.
Rattail CE.rc
This is a listing of all of the Microsoft Windows CE resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
eMbedded Visual C++.
res\Rattail CE.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file Rattail CE.rc.
res\Rattail CE.rc2
This file contains resources that are not edited by Microsoft
eMbedded Visual C++. You should place all resources not
editable by the resource editor in this file.
Rattail CE.vcc
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CFrameWnd and controls all SDI frame features.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
Rattail CEDoc.h, Rattail CEDoc.cpp - the document
These files contain your CRattailCEDoc class. Edit these files to
add your special document data and to implement file saving and loading
(via CRattailCEDoc::Serialize).
Rattail CEView.h, Rattail CEView.cpp - the view of the document
These files contain your CRattailCEView class.
CRattailCEView objects are used to view CRattailCEDoc objects.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named Rattail CE.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft eMbedded Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFCWCXXX.DLL from
the Microsoft eMbedded Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFCWCDEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////

6
src/StdAfx.cpp Normal file
View file

@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// Rattail CE.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

34
src/StdAfx.h Normal file
View file

@ -0,0 +1,34 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__4B857498_205E_4475_AFC8_76EBFCC11CE6__INCLUDED_)
#define AFX_STDAFX_H__4B857498_205E_4475_AFC8_76EBFCC11CE6__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#if (_WIN32_WCE <= 200)
#error : This project does not support MFCCE 2.00 or earlier, because it requires CControlBar, available only in MFCCE 2.01 or later
#endif
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#if defined(_WIN32_WCE) && (_WIN32_WCE >= 211) && (_AFXDLL)
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__4B857498_205E_4475_AFC8_76EBFCC11CE6__INCLUDED_)

28
src/newres.h Normal file
View file

@ -0,0 +1,28 @@
#ifndef __NEWRES_H__
#define __NEWRES_H__
#define SHMENUBAR RCDATA
#if !(defined(_WIN32_WCE_PSPC) && (_WIN32_WCE >= 300))
#undef HDS_HORZ
#undef HDS_BUTTONS
#undef HDS_HIDDEN
#include <commctrl.h>
// for MenuBar
#define I_IMAGENONE (-2)
#define NOMENU 0xFFFF
#define IDS_SHNEW 1
#define IDM_SHAREDNEW 10
#define IDM_SHAREDNEWDEFAULT 11
// for Tab Control
#define TCS_SCROLLOPPOSITE 0x0001 // assumes multiline tab
#define TCS_BOTTOM 0x0002
#define TCS_RIGHT 0x0002
#define TCS_VERTICAL 0x0080
#define TCS_MULTISELECT 0x0004 // allow multi-select in button mode
#define TCS_FLATBUTTONS 0x0008
#endif //_WIN32_WCE_PSPC
#endif //__NEWRES_H__

BIN
src/res/Rattail CE.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

13
src/res/Rattail CE.rc2 Normal file
View file

@ -0,0 +1,13 @@
//
// RATTAIL CE.RC2 - resources Microsoft eMbedded Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft eMbedded Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

32
src/resource.h Normal file
View file

@ -0,0 +1,32 @@
//{{NO_DEPENDENCIES}}
// Microsoft eMbedded Visual C++ generated include file.
// Used by Rattail CE.rc
//
#define IDD_ABOUTBOX 100
#define IDD_RATTAILCE_FORM 101
#define IDR_MAINFRAME 128
#define IDC_CODES 1000
#define IDC_SCANS 1000
#define IDC_EDIT1 1001
#define IDC_SCANCODE 1001
#define IDC_EDIT2 1002
#define IDC_QUANTITY 1002
#define IDC_CASE_QUANTITY 1002
#define IDC_CHECK1 1003
#define IDC_STOP_QUANTITY 1003
#define IDC_STOP_CASE 1003
#define IDC_UNIT_QUANTITY 1004
#define IDC_STOP_UNIT 1005
#define ID_FILE_SAVE_AS_X 32771
#define ID_FILE_SAVE_X 32772
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32773
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif