void CShareNotLoadedDialog::OnOK() { // The user wants PrintMaster to modify AUTOEXEC.BAT (ugh!) // Find AUTOEXEC.BAT and modify it. CAutoexecBatFile AutoexecBat; CString csLine; TRY { if (AutoexecBat.Locate()) { // We'll be adding the SHARE line to the start of AUTOEXEC.BAT. // Use the Windows OpenFile() function to search for SHARE.EXE. OFSTRUCT of; #ifdef WIN32 if (OpenFile("SHARE.EXE", &of, OF_EXIST|OF_READ|OF_SHARE_DENY_NONE) != HFILE_ERROR) #else if (OpenFile("SHARE.EXE", &of, OF_EXIST|OF_SEARCH|OF_READ|OF_SHARE_DENY_NONE) != HFILE_ERROR) #endif { TRACE("Found SHARE.EXE at '%s'\n", of.szPathName); // Create a new AUTOEXEC.BAT TRY { // JRO csLine = "REM *** The following SHARE line was added by PrintMaster Gold ***\n"; csLine = GET_PMWAPP()->GetResourceStringPointer (IDS_REM_AUTOEXEC); AutoexecBat.WriteLine(csLine); csLine = of.szPathName; csLine += '\n'; AutoexecBat.WriteLine(csLine); csLine = "\n"; AutoexecBat.WriteLine(csLine); AutoexecBat.CopyRestOfLines(); AutoexecBat.Done(TRUE, &m_csBackupName); m_fAutoexecBatModified = TRUE; } CATCH_ALL(e) { // JRO m_csReason = "Your hard disk or root directory may be full or the AUTOEXEC.BAT file may be write protected."; m_csReason = GET_PMWAPP()->GetResourceStringPointer (IDS_ROOT_FULL); THROW_LAST(); } END_CATCH_ALL } else {
ERRORCODE CDCache::cache_font(LPCSTR name) { ERRORCODE error; /* If we don't have a database, we don't have anything. */ if (m_database == NULL) { return ERRORCODE_NotInitialized; } TRY { m_database->set_maximum_size(m_cache_size = GET_PMWAPP()->get_workspace_size()); } CATCH_ALL(e) { } END_CATCH_ALL CompositeFileName cfn(name); /* Store the file in the database (if not already there). */ AfxGetApp()->BeginWaitCursor(); error = m_database->add_file(cfn.get_dynamic_name(TRUE), CACHE_FILE_TYPE_Font); AfxGetApp()->EndWaitCursor(); return error; }
void CPmwMDIChild::ActivateFrame(int nCmdShow) { BOOL fCascade = FALSE; if (nCmdShow == -1) { if (GET_PMWAPP()->GetOpenDocumentCount() > 1) { // We now have more than one document. // Show it non-maximized, and cascade the windows. fCascade = TRUE; nCmdShow = SW_NORMAL; } else { nCmdShow = SW_SHOWMAXIMIZED; } } CMDIChildWnd::ActivateFrame(nCmdShow); if (fCascade) { Util::SendWmCommand(AfxGetMainWnd(), ID_WINDOW_CASCADE, NULL, 0); } }
void CFormatBar::BuildTypefaceList(void) { m_TypefaceBox.SetRedraw(FALSE); m_TypefaceBox.ResetContent(); BOOL is_registered = GET_PMWAPP()->user_is_registered(); /* Add all the chooseable faces to the list. */ FaceEntry* entry; int i; for (entry = typeface_server.face_list.first_face(), i = 0; entry != NULL; entry = entry->next_face(), i++) { if (entry->is_chooseable(is_registered)) { int nIndex = m_TypefaceBox.InsertString(-1, entry->get_name()); if (nIndex != -1) { m_TypefaceBox.SetItemData(nIndex, (DWORD)i); } } } m_TypefaceBox.SetRedraw(TRUE); if (m_TypefaceBox.IsWindowVisible()) { m_TypefaceBox.InvalidateRect(NULL); } }
CCartoonOMatic::CCartoonOMatic() { // Nid the filename (in case it has not been yet). GET_PMWAPP()->nid_filename(cbNFXTemplate); // No result yet. m_nUserResult = -1; }
///////////////////////////////////////////////////////////////////////////// // CTextWrapDialog message handlers BOOL CTextWrapDialog::OnInitDialog() { CPmwDialog::OnInitDialog(); GET_PMWAPP()->ShowHelpfulHint("Text Wrap Dialog", this); return TRUE; }
BOOL CStickerPrintDialog::OnInitDialog() { CPmwPrint::OnInitDialog(); // Windows 95 changes this string. We set it back. SetDlgItemText(IDC_PRINT_ALL, GET_PMWAPP()->GetResourceStringPointer(IDS_PrintAll)); return TRUE; }
void CDoubleSidedPrintPrePrint1::OnClickedPrint() { CPmwApp* pApp = GET_PMWAPP(); // Create a newsletter project. pApp->last_new_info.type = PROJECT_TYPE_Newsletter; pApp->last_new_info.subtype = 0; pApp->last_new_info.orientation = PORTRAIT; // Paper info is printer info. *(pApp->last_new_info.m_pPaperInfo) = *(pApp->GetPaperInfo(pApp->last_new_info.orientation)); WORD wFlags = CPmwDoc::m_wGlobalDocumentFlags; CPmwDoc::m_wGlobalDocumentFlags |= CPmwDoc::FLAG_TestPrintDocument; CPmwDoc* pDoc = (CPmwDoc*)(pApp->m_pScratchTemplate->OpenDocumentFile(NULL, FALSE)); CPmwDoc::m_wGlobalDocumentFlags = wFlags; if (pDoc != NULL) { #ifndef WIN32 pDoc->DoNewDocument(-1, FALSE); #endif CPmwView* pView = pDoc->GetCurrentView(); // We have one page so far. Add the key text to it. // Create the key frame with text saying "FACE UP". WORD wDoubleSidedType = DBLPRN_Valid; pView->CreateKeyFrame(wDoubleSidedType); pView->CreateKeyArrow(wDoubleSidedType); CreateLeftFrame(pView, "A"); ASSERT(pDoc->NumberOfPages() == 1); // Create the second page. pDoc->AddPage(1); pDoc->GotoPage(1); pView->CreateKeyFrame(wDoubleSidedType); pView->CreateKeyArrow(wDoubleSidedType); CreateLeftFrame(pView, "B"); // Set the title for the print-out. CString csTitle; TRY csTitle.LoadString(IDS_PrintTest1); END_TRY pDoc->SetTitle(csTitle); // Do the print-out. pView->PrintNoDialog(); pDoc->OnCloseDocument(); } }
PRINTSIZECHECKRESULT CPrintSize::CheckDouble(UINT id, double &value, double min, double max, SHORT precision) { PRINTSIZECHECKRESULT Result; Result = PRINT_SIZE_CHECK_UNCHANGED; TRY { if (m_last_active_item_changed) { /* get the current value */ CDataExchange cDX(this, TRUE); DDX_Text(&cDX, id, value); /* if the user entered something, reformat the number for specified precision */ CString s; cDX.m_bSaveAndValidate = FALSE; FormatDouble(value, precision, s); DDX_Text(&cDX, id, s); Result = PRINT_SIZE_CHECK_CHANGED; /* validate value */ if ((value < min) || (value > max)) { CString csMin; CString csMax; FormatDouble(min, precision, csMin); FormatDouble(max, precision, csMax); char szMessage[256]; wsprintf( szMessage, // JRO "Please enter a value between %s and %s.", GET_PMWAPP()->GetResourceStringPointer (IDS_ENTER_VAL_S), (const char far *)csMin, (const char far *)csMax); m_ignore_change_focus = TRUE; AfxMessageBox(szMessage); m_ignore_change_focus = FALSE; Result = PRINT_SIZE_CHECK_ERROR; } } } CATCH_ALL(e) { Result = PRINT_SIZE_CHECK_ERROR; } END_CATCH_ALL return Result; }
LPCSTR CPostCardView::GadgetMenuName(UINT uID, UINT uPart) { LPCSTR pszMenuName = NULL; if (uID == ID_PAGE_GADGET) { // JRO pszMenuName = "Brochure Page"; pszMenuName = GET_PMWAPP()->GetResourceStringPointer (IDS_POSTCARD_PAGE); } else { pszMenuName = CPmwView::GadgetMenuName(uID, uPart); } return pszMenuName; }
CHAR *Calendar::get_weekday_name(WEEKDAY weekday) { if (weekday < SUNDAY || weekday > SATURDAY) { return NULL; } #ifdef LOCALIZE static TCHAR szWeekDayName[MAX_WEEKDAYNAME]; CurrentLocale.WeekDayName((WEEKDAY)weekday, szWeekDayName, sizeof(szWeekDayName)); return szWeekDayName; #else // JRO return ::weekday_name[weekday]; return (CHAR *)GET_PMWAPP()->GetResourceStringPointer (::weekday_name_id[weekday]); #endif }
CHAR *Calendar::get_month_name(MONTH month) { if (month < JANUARY || month > DECEMBER) { return NULL; } #ifdef LOCALIZE static TCHAR szMonthName[MAX_MONTHNAME]; CurrentLocale.MonthName(month, szMonthName, sizeof(szMonthName)); return szMonthName; #else // JRO return ::month_name[month]; return (CHAR *)GET_PMWAPP()->GetResourceStringPointer (::month_name_id[month]); #endif }
BOOL CAccountAccessDlg::OnInitDialog() { CDialog::OnInitDialog(); CButton* pButton = (CButton*)GetDlgItem(IDC_CREATEACCOUNTRADIO); if(m_fNew) pButton->SetCheck(1); else pButton->SetCheck(0); GET_PMWAPP()->WakeWindow(); //Bring us to top return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
CFontPreviewWnd::CFontPreviewWnd(CWnd* pParent /*=NULL*/) { //{{AFX_DATA_INIT(CFontPreviewWnd) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT CSize szWnd(240, 80); if(GET_PMWAPP()->LargeFontMode()) szWnd.cy = 100; CWnd::CreateEx(WS_EX_DLGMODALFRAME, ::AfxRegisterWndClass(CS_SAVEBITS, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), NULL, WS_BORDER | WS_POPUP, 0, 0, szWnd.cx, szWnd.cy, pParent->GetSafeHwnd(), (HMENU)0); }
BOOL CPicturePreview::CreateDocument(void) { if (m_pDoc == NULL) { m_pDoc = GET_PMWAPP()->NewHiddenDocument(); if (m_pDoc != NULL) { m_fCloseDoc = TRUE; m_pDoc->size_to_paper(); } } else { m_pDoc->deselect_all(); m_pDoc->object_list()->destroy_objects(); } return (m_pDoc != NULL); }
BOOL CLabelTypeDialog::OnInitDialog() { CPmwDialogColor::OnInitDialog(); m_pPreview = (CLabelPreview*)GetDlgItem(IDC_PREVIEW); /* // Read the list. */ m_List.ReadList("LABELS.DAT"); /* // Set the type to view. // This depends on either the old paper passed or the printer type. */ BOOL fTractor; if (m_pOldInfo == NULL) { /* Get the type from the printer. */ fTractor = GET_PMWAPP()->GetPrinterInfo(PORTRAIT)->Tractor() == 1; } else { /* Get the type from the old info. */ fTractor = (m_pOldInfo->Type() == CPaperInfo::PAPER_Continuous); } CheckDlgButton(IDC_LABEL_TYPE_LASER, !fTractor); CheckDlgButton(IDC_LABEL_TYPE_DOT_MATRIX, fTractor); /* // Build the list box. */ BuildList(); CreateWizzardButtons (); EnableWizardButtons (m_WizFlags); return TRUE; // return TRUE unless you set the focus to a control }
void CPictureCatalogDialog::do_print() { // Set our title so that the user will know what is being printed. m_pDoc->SetTitle(GET_PMWAPP()->GetResourceStringPointer (IDS_PICTURES)); CPrintInfo pInfo; CPrintDialog *dlg_save = pInfo.m_pPD; CCatalogPrint pdlg(m_pDoc); pInfo.m_pPD = &pdlg; // Bring over the list. if (AfxGetApp()->DoPrintDialog(&pdlg) == IDOK) { // get all the filenames they selected POSITION pos = GetStartPosition(); CStringArray files; while (pos != NULL) { CString file = GetNextPathName(pos); files.Add(file); } CString strDir = GetPathName(); CCatalogView view(files, strDir); m_pDoc->m_bAutoDelete = FALSE; // don't destroy document while closing views m_pDoc->size_to_paper(); // Hook the view into the document. ((CCatalogDoc *)m_pDoc)->add_hidden_view(&view); // Print the project. view.PrintProject(&pInfo); // Remove the view before its destructor happens. m_pDoc->RemoveView(&view); } pInfo.m_pPD = dlg_save; }
void CTypefaceCombo::BuildList() { BOOL is_registered = GET_PMWAPP()->user_is_registered(); // Add all the chooseable faces to the list. FaceEntry* entry; int i; // First the best int nFaceIndex; for (i = 0; i < m_nMRUItems; i++) { if ((nFaceIndex = typeface_server.face_list.find_face(m_RecentItemList[i])) != -1) { entry = typeface_server.face_list.get_face(nFaceIndex); if (entry->is_chooseable(is_registered)) { int nIndex = InsertString(-1, entry->get_name()); if (nIndex != -1) { SetItemData(nIndex, (DWORD)nFaceIndex); } } } } // Now the rest for (entry = typeface_server.face_list.first_face(), i = 0; entry != NULL; entry = entry->next_face(), i++) { if (entry->is_chooseable(is_registered)) { int nIndex = InsertString(-1, entry->get_name()); if (nIndex != -1) { SetItemData(nIndex, (DWORD)i); } } } }
BOOL CDemoDescriptionDialog::OnInitDialog() { CPmwDialog::OnInitDialog(); // Set remaining trial count in dialog. CString csFormat; CString csText; TRY { CWnd* pWnd = GetDlgItem(IDC_COUNT_REMAINING); pWnd->GetWindowText(csFormat); csText.Format(csFormat, GET_PMWAPP()->m_installation_info.nTrialCount+1); pWnd->SetWindowText(csText); } END_TRY return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
PRINTSIZECHECKRESULT CPrintSize::CheckInt(UINT id, int &value, int min, int max) { PRINTSIZECHECKRESULT Result; Result = PRINT_SIZE_CHECK_UNCHANGED; TRY { if (m_last_active_item_changed) { /* get the current value */ CDataExchange cDX(this, TRUE); DDX_Text(&cDX, id, value); Result = PRINT_SIZE_CHECK_CHANGED; /* validate value */ if ((value < min) || (value > max)) { char szMessage[256]; wsprintf( szMessage, // JRO "Please enter a value between %d and %d.", GET_PMWAPP()->GetResourceStringPointer (IDS_ENTER_VAL_D), min, max); m_ignore_change_focus = TRUE; AfxMessageBox(szMessage); m_ignore_change_focus = FALSE; Result = PRINT_SIZE_CHECK_ERROR; } } } CATCH_ALL(e) { Result = PRINT_SIZE_CHECK_ERROR; } END_CATCH_ALL return Result; }
void CDocumentPreview::NewDocPreview(LPCSTR pszFileName, LPCSTR pszFriendlyName /*=NULL*/) { // Get rid of any existing preview. ErasePreview(); // Close any existing document. if (m_pDoc != NULL) { CloseDocument(); } // Open the new document. CString strName = GetGlobalPathManager()->LocatePath(pszFileName); m_pDoc = GET_PMWAPP()->OpenHiddenDocument(strName); m_fCloseDoc = TRUE; m_fForceToFront = TRUE; m_fEncloseObjects = FALSE; SetDescription(pszFileName, pszFriendlyName); SizeDocPreview(); }
BOOL CArtOleDropTarget::SaveClipObjectsToUserArt(COleDataObject* pDataObject, LPCTSTR pFilename) { CPmwDoc* pTempDoc = GET_PMWAPP()->NewHiddenDocument(); if (pTempDoc == NULL) { ASSERT(pTempDoc); return FALSE; } pTempDoc->size_to_paper(); BOOL retval = TRUE; if ((clipboard.PasteObjectsFromDatabase(pTempDoc) != ERRORCODE_None) || (pTempDoc->SaveToFile(pFilename, TRUE) != TRUE)) { retval = FALSE; } pTempDoc->OnCloseDocument(); return retval; }
CFileSaveAsGraphicDlg::CFileSaveAsGraphicDlg(BOOL fSelection, LPCSTR Filter, LPCSTR defExt, LPCSTR initialDir, CWnd* pParentWnd) : CFileDialog(FALSE, defExt, NULL, NULL, Filter, pParentWnd) { //{{AFX_DATA_INIT(CFileSaveAsGraphicDlg) m_Width = MIN_WIDTH; m_Height = MIN_HEIGHT; m_SaveAll = (fSelection == TRUE) ? 1 : 0; m_fAddToGallery = TRUE; m_Aspect = TRUE; m_strCategory = _T(""); //}}AFX_DATA_INIT m_ofn.Flags |= (OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_HIDEREADONLY | OFN_NOREADONLYRETURN | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST); m_ofn.lpTemplateName = MAKEINTRESOURCE (IDD); m_ofn.hInstance = AfxGetResourceHandle (); m_ofn.lpstrInitialDir = initialDir; m_ofn.lpstrTitle = GET_PMWAPP()->GetResourceStringPointer(IDS_EXPORT_AS); m_nGraphicIndex = -1; }
UINT CUpdateAccountRequest::ProcessResponse(CHttpFile& pHttpFile) { #ifdef ARTSTORE return 1; #else //Take the HttpFile and parse it. UINT uRet = 1; UINT nFileLength = pHttpFile.GetLength(); CString strBuffer; CString strSearch; CString strList; LPSTR b = strBuffer.GetBuffer(nFileLength); pHttpFile.Read(b, nFileLength); strBuffer.ReleaseBuffer(); uRet = CBasicRequestInfo::ProcessResponse(strBuffer); #if 0 if(uRet == 0) { if(GetNewPassword() != "") { if(GetNewPassword() != GetPassword()) { LPSTR s = GetNewPassword().GetBuffer(255); //WritePrivateProfileString("Server Account", "Password", s, "Pmw.ini"); GET_PMWAPP()->WritePrivateProfileString(SECTION_ServerAccount, ENTRY_ServerPassword, s, GET_PMWAPP()->main_ini); GetNewPassword().ReleaseBuffer(); } } } #endif return uRet; #endif }
BOOL CDoubleSidedPrintWizard::Run(CWnd* pParent) { BOOL fResult = FALSE; CDoubleSidedPrintWizard Wizard("", pParent, 0); #ifdef WIN32 Wizard.m_psh.dwFlags &= ~PSH_HASHELP; Wizard.m_Introduction.m_psp.dwFlags &= ~PSP_HASHELP; Wizard.m_PrePrint1.m_psp.dwFlags &= ~PSP_HASHELP; Wizard.m_PostPrint1.m_psp.dwFlags &= ~PSP_HASHELP; Wizard.m_PrePrint2.m_psp.dwFlags &= ~PSP_HASHELP; Wizard.m_PostPrint2.m_psp.dwFlags &= ~PSP_HASHELP; Wizard.m_Finish.m_psp.dwFlags &= ~PSP_HASHELP; #endif Wizard.AddPage(&Wizard.m_Introduction); Wizard.AddPage(&Wizard.m_PrePrint1); Wizard.AddPage(&Wizard.m_PostPrint1); Wizard.AddPage(&Wizard.m_PrePrint2); Wizard.AddPage(&Wizard.m_PostPrint2); Wizard.AddPage(&Wizard.m_Finish); Wizard.SetWizardMode(); if (Wizard.DoModal() == ID_WIZFINISH) { if (Wizard.m_PostPrint1.m_nChosen != -1 && Wizard.m_PostPrint2.m_nChosen != -1) { int nIndex = Wizard.m_PostPrint1.m_nChosen*4 + Wizard.m_PostPrint2.m_nChosen; ASSERT(nIndex < 8); static WORD wDoubleSidedTypes[] = { // A on top first. DBLPRN_UpDown, // Then AC / blank visible DBLPRN_DownDown, // Then B / C visible DBLPRN_UpDownReversed, // Then AC / blankk visible, C reversed DBLPRN_DownDownReversed,// Then B / C visible, C reversed // B on top first. DBLPRN_UpUp, // Then AD / blank visible DBLPRN_DownUp, // Then B / D visible DBLPRN_UpUpReversed, // Then AD / blank visible, D reversed DBLPRN_DownUpReversed, // Then B / D visible, D reversed }; WORD wDoubleSidedType = wDoubleSidedTypes[nIndex] + DBLPRN_Valid + DBLPRN_PrintOnBlank; // Set the value in the printer info. CPrinterInfo* pPrinterInfo = GET_PMWAPP()->GetPrinterInfo(PORTRAIT); pPrinterInfo->SetDoubleSidedType(wDoubleSidedType); GET_PMWAPP()->GetPrinterInfo(LANDSCAPE)->SetDoubleSidedType(wDoubleSidedType); // Portrait and landscape share in INI file. pPrinterInfo->WriteSettings(); } else { // Some Chosen value is not set! ASSERT(FALSE); } fResult = TRUE; } return fResult; }
// Create the help window. BOOL CPmHelpWindow::Create(LPCSTR pszHelpFile, CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT uID, int nNavigationTabWidth) { // Save a pointer to the window we want to notify. m_hwndNotify = pParentWnd->GetSafeHwnd(); // Create the dialog bar. BOOL fResult = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, uID); // Save our ID. m_uID = uID; // Save the width for the navigation tab. m_nNavigationTabWidth = nNavigationTabWidth; if (fResult) { // Hide the window by default. It will be shown later if needed. ShowWindow(SW_HIDE); // Clip children. ModifyStyle(0, WS_CLIPCHILDREN); // Set titlebar text (floating only) CString strTitle = "@@N Help"; GetConfiguration()->ReplaceText(strTitle); SetWindowText(strTitle); // Replace the dummy control in the template with the Html Help control. CWnd* pOldControl = GetDlgItem(IDC_HELP_CONTROL); if (pOldControl != NULL) { fResult = TRUE; // Get the size and position of the dummy control. CRect crBounds; pOldControl->GetWindowRect(crBounds); ScreenToClient(crBounds); // Compute the sizes of the border area around the // help control within the dialog bar. As the dialog // bar is resizes, these borders sizes are retained. m_crBorder.left = crBounds.left; m_crBorder.top = crBounds.top; m_crBorder.right = m_sizeDefault.cx-crBounds.right; m_crBorder.bottom = m_sizeDefault.cy-crBounds.bottom; CRect crCloseButton; crCloseButton.SetRect(0, 0, 12, 12); // size of bitmap m_btnClose.Create(crCloseButton, this, ID_VIEW_HELPWINDOW); m_btnClose.SetBitmaps("HELP_CLOSE_U", "HELP_CLOSE_D", pOurPal); m_btnClose.SetTransparentColor(RGB(255,0,255)); // Restore the previous size of the help window. CRect crHelpWindow; CIniFile IniFile(GET_PMWAPP()->m_pszProfileName); // Restore the previous Expand/Contract state. m_fExpanded = IniFile.GetInteger("HelpWindow", "Expanded", FALSE); if (IniFile.GetWindowPosition("HelpWindow", NULL, NULL, crHelpWindow)) { if (!crHelpWindow.IsRectEmpty()) { m_sizeDefault.cx = crHelpWindow.Width(); m_sizeDefault.cy = crHelpWindow.Height(); } } m_czFloating = m_czDocked = m_sizeDefault; TRY { // Remember the name of the help. m_csHelpFile = pszHelpFile; } END_TRY if ((m_csHelpFile.IsEmpty()) || (!Util::FileExists(m_csHelpFile))) { // Can't use the help file. m_csHelpFile.Empty(); } else { // Load the Html Help control. if (m_HtmlHelpControl.Load()) { // Initialize all structure members to zero. HH_WINTYPE HHWinType; ZeroMemory(&HHWinType, sizeof(HHWinType)); // Structure size in bytes. HHWinType.cbStruct = sizeof(HHWinType); // Properties of the HTML window. HHWinType.fsWinProperties = HHWIN_PROP_TRI_PANE | // use a tri-pane window HHWIN_PROP_TAB_SEARCH | // show a "Search" tab in navigation pane HHWIN_PROP_AUTO_SYNC | // automatically sync contents and index HHWIN_PROP_TRACKING | // send tracking notification messages HHWIN_PROP_NOTB_TEXT | // no text on toolbar buttons HHWIN_PROP_NOTITLEBAR | HHWIN_PROP_NODEF_STYLES | // no default window styles (only HH_WINTYPE.dwStyles) HHWIN_PROP_NODEF_EXSTYLES; // no default extended window styles (only HH_WINTYPE.dwExStyles) // Window styles. HHWinType.dwStyles = WS_VISIBLE | WS_CLIPSIBLINGS | WS_CHILD; // Extended window styles. HHWinType.dwExStyles = WS_EX_WINDOWEDGE; // Buttons on toolbar pane. HHWinType.fsToolBarFlags = HHWIN_BUTTON_EXPAND | // expand/contract button HHWIN_BUTTON_BACK | // back button HHWIN_BUTTON_HOME | // home button // HHWIN_BUTTON_ZOOM | // font button -- too flakey at the moment! HHWIN_BUTTON_PRINT; // print button // Full Paths or CHM locations of various files. CString csInitialTopic; CString csHomePage; CString csTableOfContents; CString csIndex; TRY { csInitialTopic = "contents.htm"; csHomePage = m_csHelpFile; csHomePage += "::/contents.htm"; csTableOfContents = m_csHelpFile; csTableOfContents += "::/toc.hhc"; csIndex = m_csHelpFile; csIndex += "::/index.hhk"; } END_TRY HHWinType.pszFile = csInitialTopic; HHWinType.pszHome = csHomePage; HHWinType.pszToc = csTableOfContents; HHWinType.pszIndex = csIndex; // Expansion width of navigation pane (left pane). HHWinType.iNavWidth = m_nNavigationTabWidth; // Initial display state: HHWinType.nShowState = SW_RESTORE; // TOC should be activated. HHWinType.curNavType = HHWIN_NAVTYPE_TOC; // Position of navigation tabs. HHWinType.tabpos = HHWIN_NAVTAB_TOP; // ID to use in WPARAM in WM_NOTIFY. HHWinType.idNotify = m_uID; // Title of Help Window HHWinType.pszCaption= "PrintMaster 7.0 Help Window"; // Initial state is not expanded. HHWinType.fNotExpanded = !m_fExpanded; // Indicate which fields in structure are valid. HHWinType.fsValidMembers = HHWIN_PARAM_STYLES | // valid dwStyles HHWIN_PARAM_PROPERTIES | // valid fsWinProperties HHWIN_PARAM_RECT | // valid rcWindowPos HHWIN_PARAM_TB_FLAGS | // valid fsToolBarFlags HHWIN_PARAM_NAV_WIDTH | // valid iNavWidth HHWIN_PARAM_SHOWSTATE | // valid nShowState HHWIN_PARAM_TABPOS | // valid tabpos HHWIN_PARAM_EXPANSION | // valid fNotExpanded HHWIN_PARAM_CUR_TAB; // valid curNavType // Specify the name of the new window type. HHWinType.pszType = PM_HELP_TYPE; // Allow any derived classes to modify the window type information. PreSetWinType(&HHWinType); // This call creates the new window type from the values in // the HH_WINTYPE structure. m_HtmlHelpControl.SetWinType(&HHWinType); // Display the default topic. HWND hWnd = NULL; CString csHelpFile; TRY { csHelpFile = m_csHelpFile; csHelpFile += ">" PM_HELP_TYPE; hWnd = m_HtmlHelpControl.DisplayContents(GetSafeHwnd(), csHelpFile); } END_TRY // If we have successfully created a new help window, // then get rid of the old window. if (hWnd != NULL) { // Get rid of the old control. if (pOldControl->DestroyWindow()) { #if 0 // remove the "Flat" style in the toolbar CWnd HelpWindow; HelpWindow.Attach(hWnd); CToolBarCtrl* pToolBar = (CToolBarCtrl*)(HelpWindow.GetWindow(GW_CHILD)); pToolBar->ModifyStyle(TBSTYLE_FLAT, 0); HelpWindow.Detach(); #endif // Signal that all the cached size information is accurate. m_fSizesValid = TRUE; fResult = TRUE; } } } } ASSERT(fResult); if (!fResult) { // We failed, clean up. } }
void CLabelView::OnDraw(CDC* pDC) { // Print preview comes in as printing. Printing case does not come here. // So, IsPrinting() flag determines preview. if (!pDC->IsPrinting() || m_pPreviewExtent == NULL) { INHERITED::OnDraw(pDC); return; } /* // Save the scaled_source x0 and y0 in the printer rc since we will be // changing them. */ // Save the in extent since it gets change during interrupt. PBOX InExtent = m_pPreviewExtent->extent; PBOX SourcePbox = printer_rc.source_pbox; PPNT SourceOrigin; SourceOrigin.x = printer_rc.scaled_source_x0; SourceOrigin.y = printer_rc.scaled_source_y0; /* Get the document to work with. */ CPmwDoc* pDoc = GetDocument(); int nPrintOrientation = pDoc->get_orientation(); BOOL fLandscape = (nPrintOrientation == LANDSCAPE); /* Get the App and its info. */ CPmwApp* pApp = GET_PMWAPP(); CPaperInfo* pPaperInfo = pApp->GetPaperInfo(nPrintOrientation); CPrinterInfo* pPrinterInfo = pApp->GetPrinterInfo(nPrintOrientation); CFixedRect PaperPhysicalMargins = pPaperInfo->PhysicalMargins(); /* Get the paper info. */ CPaperInfo* pLabelInfo = pDoc->GetPaperInfo(); CFixedRect Margins = pLabelInfo->Margins(); // If this is landscape, rotate the margins correctly. pPrinterInfo->OrientRect(&Margins); /* Compute the number of slots we need to print. */ int nSlot = m_pPreviewExtent->update_object == NULL ? 0 : m_pPreviewExtent->m_nPreviewSlot; int nSlots = pLabelInfo->Slots(); /* Run through all the slots. */ while (nSlot < nSlots) { /* // Setup the parameters for this slot so that we will draw in the correct // spot on the page. */ ASSERT(pDoc->CurrentPageIndex() == 0 || pDoc->CurrentPageIndex() == 1); CFixedRect SlotBounds = pLabelInfo->SlotBounds(nSlot); BOOL fBack = (pDoc->CurrentPageIndex() == 1); CFixedPoint Dims = pLabelInfo->PaperDims(); CFixed lLeft = SlotBounds.Left; CFixed lTop = SlotBounds.Top; CFixed lWidth = SlotBounds.Width(); CFixed lHeight = SlotBounds.Height(); if (fLandscape) { switch (pPrinterInfo->Orientation()) { case 90: { // 90 degree rotation (like lasers) SlotBounds.Left = Dims.y - (lTop + lHeight); SlotBounds.Top = lLeft; break; } // case -1: // case 270: default: { // 270 degree rotation (like dot-matrix) SlotBounds.Left = lTop; SlotBounds.Top = Dims.x - (lLeft + lWidth); break; } } if (fBack) { // We are printing the back side. Reverse the slot. SlotBounds.Left = Dims.y - (SlotBounds.Left + lHeight); } SlotBounds.Right = SlotBounds.Left + lHeight; SlotBounds.Bottom = SlotBounds.Top + lWidth; } else { // Portrait. if (fBack) { // We are printing the back side. Reverse the slot. SlotBounds.Left = Dims.x - SlotBounds.Right; SlotBounds.Right = SlotBounds.Left + lWidth; } } CFixedPoint Org; Org.x = Margins.Left-PaperPhysicalMargins.Left; Org.y = Margins.Top-PaperPhysicalMargins.Top; if (fLandscape) { /* Printout is landscape. Reverse the origins. */ CFixed t = Org.x; Org.x = Org.y; Org.y = t; } PPNT Delta; Delta.x = MulFixed(SlotBounds.Left + Org.x, PAGE_RESOLUTION); Delta.y = MulFixed(SlotBounds.Top + Org.y, PAGE_RESOLUTION); printer_rc.source_pbox.x0 = SourcePbox.x0 - Delta.x; printer_rc.source_pbox.y0 = SourcePbox.y0 - Delta.y; printer_rc.source_pbox.x1 = SourcePbox.x1 - Delta.x; printer_rc.source_pbox.y1 = SourcePbox.y1 - Delta.y; printer_rc.scaled_source_x0 = /*SourceOrigin.x*/ - Delta.x*printer_rc.x_resolution; printer_rc.scaled_source_y0 = /*SourceOrigin.y*/ - Delta.y*printer_rc.y_resolution; if (IsBoxOnBox(&printer_rc.source_pbox, &InExtent)) { // Do the draw. INHERITED::OnDraw(pDC); if (m_pPreviewExtent->update_object != NULL) { m_pPreviewExtent->m_nPreviewSlot = nSlot; m_pPreviewExtent->extent = InExtent; break; } } /* // Update the parameters for the next label to draw. */ nSlot++; } /* // Restore the scaled source x0 from the saved values. */ printer_rc.source_pbox = SourcePbox; printer_rc.scaled_source_x0 = SourceOrigin.x; printer_rc.scaled_source_y0 = SourceOrigin.y; }
void CLabelView::OnDraw(PrintContext* pc) { CPmwDoc* pDoc = GetDocument(); DWORD dwPage = pDoc->CurrentPageIndex(); // Verify we are doing a normal page. if (dwPage != 0 && dwPage != 1) { // Non-standard page (like the "key" page). Defer to the base class. CPmwView::OnDraw(pc); return; } /* // Save the scaled_source x0 and y0 in the printer rc since we will be // changing them. */ PBOX SourcePbox = printer_rc.source_pbox; PPNT SourceOrigin; SourceOrigin.x = printer_rc.scaled_source_x0; SourceOrigin.y = printer_rc.scaled_source_y0; /* Get the document to work with. */ int nPrintOrientation = pDoc->get_orientation(); BOOL fLandscape = (nPrintOrientation == LANDSCAPE); /* Get the App and its info. */ CPmwApp* pApp = GET_PMWAPP(); CPaperInfo* pPaperInfo = pApp->GetPaperInfo(nPrintOrientation); CPrinterInfo* pPrinterInfo = pApp->GetPrinterInfo(nPrintOrientation); CFixedRect PaperPhysicalMargins = pPaperInfo->PhysicalMargins(); /* Get the paper info. */ CPaperInfo* pLabelInfo = pDoc->GetPaperInfo(); CFixedRect Margins = pLabelInfo->Margins(); // If this is landscape, rotate the margins correctly. pPrinterInfo->OrientRect(&Margins); /* Get the label print dialog. */ CLabelPrintDialog* pDialog = (CLabelPrintDialog*)pc->m_pPD; /* Get the name list. */ CStdMacroServer* pMacroServer = pDoc->GetMacroServer(); NameListRecord* pNameList = pMacroServer->GetNameList(); /* Compute the number of slots we need to print. */ int nSlot = pc->m_nStartingLabel; int nSlots = pLabelInfo->Slots(); /* Run through all the slots. */ while (nSlot < nSlots && !UserAbort) { /* // See if the name we want is the one that's bound. */ if (pc->m_nBoundName != pc->m_nCurrentName) { pc->m_nBoundName = pc->m_nCurrentName; ASSERT(pc->m_pCursor != NULL); if (pc->m_pCursor != NULL) { pMacroServer->BindToRecord(pc->m_pCursor, pNameList->Name(pc->m_nBoundName)); pDoc->ReflowMacros(); } } /* // Setup the parameters for this slot so that we will draw in the correct // spot on the page. */ ASSERT(dwPage == 0 || dwPage == 1); CFixedRect SlotBounds = pLabelInfo->SlotBounds(nSlot); BOOL fBack = (dwPage == 1); CFixedPoint Dims = pLabelInfo->PaperDims(); CFixed lLeft = SlotBounds.Left; CFixed lTop = SlotBounds.Top; CFixed lWidth = SlotBounds.Width(); CFixed lHeight = SlotBounds.Height(); if (fLandscape) { switch (pPrinterInfo->Orientation()) { case 90: { // 90 degree rotation (like lasers) SlotBounds.Left = Dims.y - (lTop + lHeight); SlotBounds.Top = lLeft; break; } // case -1: // case 270: default: { // 270 degree rotation (like dot-matrix) SlotBounds.Left = lTop; SlotBounds.Top = Dims.x - (lLeft + lWidth); break; } } if (fBack) { // We are printing the back side. Reverse the slot. SlotBounds.Left = Dims.y - (SlotBounds.Left + lHeight); } SlotBounds.Right = SlotBounds.Left + lHeight; SlotBounds.Bottom = SlotBounds.Top + lWidth; } else { // Portrait. if (fBack) { // We are printing the back side. Reverse the slot. SlotBounds.Left = Dims.x - SlotBounds.Right; SlotBounds.Right = SlotBounds.Left + lWidth; } } CFixedPoint Org; Org.x = Margins.Left-PaperPhysicalMargins.Left; Org.y = Margins.Top-PaperPhysicalMargins.Top; if (fLandscape) { /* Printout is landscape. Reverse the origins. */ CFixed t = Org.x; Org.x = Org.y; Org.y = t; } PPNT Delta; Delta.x = MulFixed(SlotBounds.Left + Org.x, PAGE_RESOLUTION); Delta.y = MulFixed(SlotBounds.Top + Org.y, PAGE_RESOLUTION); printer_rc.source_pbox.x0 = SourcePbox.x0 - Delta.x; printer_rc.source_pbox.y0 = SourcePbox.y0 - Delta.y; printer_rc.source_pbox.x1 = SourcePbox.x1 - Delta.x; printer_rc.source_pbox.y1 = SourcePbox.y1 - Delta.y; printer_rc.scaled_source_x0 = /*SourceOrigin.x*/ - Delta.x*printer_rc.x_resolution; printer_rc.scaled_source_y0 = /*SourceOrigin.y*/ - Delta.y*printer_rc.y_resolution; /* // Do the draw. */ CPmwView::OnDraw(&pc->m_dcPrint); /* // Update the parameters for the next label to draw. */ if (pDialog->m_fCollate) { if (++pc->m_nCurrentName == pNameList->Names()) { /* Reset the name index. */ pc->m_nCurrentName = (pNameList->Names() == 0) ? -1 : 0; /* Advance to the next copy. */ pc->m_nCurrentCopy++; if (pc->m_nCurrentCopy == pDialog->m_nLabelCopies) { /* All done! */ break; } /* // Finished another set. // If we need to stop here, do so now. */ if (pDialog->m_fPageBreak) { /* Move to the next page. */ break; } } } else { /* We want to do the next copy. */ if (++pc->m_nCurrentCopy == pDialog->m_nLabelCopies) { /* Reset the copy count. */ pc->m_nCurrentCopy = 0; /* Advance to the next name. */ pc->m_nCurrentName++; if (pc->m_nCurrentName == pNameList->Names()) { /* All done! */ break; } /* // Finished another set. // If we need to stop here, do so now. */ if (pDialog->m_fPageBreak) { /* Move to the next page. */ break; } } } nSlot++; } /* // Restore the scaled source x0 from the saved values. */ printer_rc.source_pbox = SourcePbox; printer_rc.scaled_source_x0 = SourceOrigin.x; printer_rc.scaled_source_y0 = SourceOrigin.y; }
void CTableFormatControl::Init(void) { // First, get the client rect. CRect crClient; GetClientRect(crClient); ASSERT(crClient.left == 0); ASSERT(crClient.top == 0); // Do whatever we want to the client rect. crClient.InflateRect(-4, -4); // Leave some room around the outside. // Set it for later use. m_crClient = crClient; // Set up a redisplay context to use for generating widths, etc. // Most of what we need is set default by the rc constructor. m_rc.scaled_source_x0 = 0; m_rc.scaled_source_y0 = 0; m_rc.destination_x0 = m_crClient.left; m_rc.destination_y0 = m_crClient.top; m_rc.destination_rect = m_crClient; m_rc.clip_rect = m_rc.destination_rect; m_rc.outline_gamma_curve = m_rc.bitmap_gamma_curve = screen_gamma_curve; CDC* pDC = GetDC(); if (pDC != NULL) { m_rc.x_resolution = pDC->GetDeviceCaps(LOGPIXELSX); m_rc.y_resolution = pDC->GetDeviceCaps(LOGPIXELSY); ReleaseDC(pDC); } else { ASSERT(FALSE); m_rc.x_resolution = m_rc.y_resolution = 96; } // Compute the source that maps into this. PBOX Bound; m_rc.screen_to_pbox(&m_rc.destination_rect, &Bound); ASSERT(Bound.x0 == 0); ASSERT(Bound.y0 == 0); m_rc.source_pbox = Bound; // Create the document we need to show the object. m_pDoc = GET_PMWAPP()->NewHiddenDocument(); if (m_pDoc == NULL) { ASSERT(FALSE); return; } // Create a table object to use for previewing. PMGDatabase* pDatabase = m_pDoc->get_database(); TABLE_CREATE_STRUCT tcs; tcs.info.m_nRows = 5; tcs.info.m_nColumns = 5; tcs.bound = m_rc.source_pbox; m_pTable = (CTableObject*)pDatabase->new_object(OBJECT_TYPE_Table, &tcs); if (m_pTable == NULL) { return; } m_pDoc->append_object(m_pTable); }
AutoexecBat.CopyRestOfLines(); AutoexecBat.Done(TRUE, &m_csBackupName); m_fAutoexecBatModified = TRUE; } CATCH_ALL(e) { // JRO m_csReason = "Your hard disk or root directory may be full or the AUTOEXEC.BAT file may be write protected."; m_csReason = GET_PMWAPP()->GetResourceStringPointer (IDS_ROOT_FULL); THROW_LAST(); } END_CATCH_ALL } else { // JRO m_csReason = "The SHARE.EXE program could not be found."; m_csReason = GET_PMWAPP()->GetResourceStringPointer (IDS_NOT_FOUND_SHARE); } } else { // JRO m_csReason = "The AUTOEXEC.BAT file could not be found."; m_csReason = GET_PMWAPP()->GetResourceStringPointer (IDS_NOT_FOUND_AUTOEXEC); } } CATCH_ALL(e) { m_fAutoexecBatModified = FALSE; } END_CATCH_ALL CDialog::OnOK();