예제 #1
0
VOID CCardView::set_card_panel_view(SHORT new_panel)
{
/*
// If this is a demo card back, then we don't allow editing.
*/
   if ((new_panel == CARD_PANEL_Back) && !GetConfiguration()->SupportsCardBack())
   {
      return;
   }

#if 1
   BeforePageChange();
   SetPanel(new_panel);
#else
/*
// Get the document and build the undo/redo command for this.
*/

   CPmwDoc* pDoc = GetDocument();

   CCmdCardPanel* pCommand = new CCmdCardPanel(IDCmd_Panel[new_panel+1]);

   if (pCommand->Snapshot(this, pDoc->get_current_panel(), new_panel))
   {
      pDoc->AddCommand(pCommand);
   }
   else
   {
      delete pCommand;

   /* Fall through. */
//    SetPanel(new_panel);
   }
#endif
}
예제 #2
0
void CPmwView::DoFileSaveAsGraphic() 
{
	BOOL     fRet = FALSE;
   CPmwDoc  *pDoc = GetDocument ();

   CString  Filter;
   Filter.LoadString (IDS_SAVE_AS_GRAPHIC_FILT);
	// this array must match the order in the above string!
	SaveGraphicType graphicTypes[] =
		{ None, Pmo, Bmp8, Bmp24, Jpeg, Png, Gif, Pcx, Tiff, WMeta };

   CString InitialDir = pDoc->GetPathManager()->ExpandPath("[[P]]");
   CString defExt = "*.pmo"; // This must match the first selection in the filter string

   CFileSaveAsGraphicDlg fileDlg(pDoc->something_selected(), Filter, defExt, InitialDir, this);

   PBOX WorldAll, WorldSel;
	pDoc->get_panel_world (&WorldAll, pDoc->get_current_panel());
   if (pDoc->GetSelectBound (&WorldSel) != TRUE)
      WorldSel = WorldAll;

   CDC *pDC = GetDC();
   if (!pDC)
	{
		return;	// just bail...
	}

	int LogPixX = pDC->GetDeviceCaps (LOGPIXELSX);
	int LogPixY = pDC->GetDeviceCaps (LOGPIXELSY);
   fileDlg.SetDimensions(&WorldAll, &WorldSel, LogPixX, LogPixY);
   ReleaseDC (pDC);

   if (fileDlg.DoModal () == IDOK)
   {
      CString  Filename = fileDlg.GetPathName ();

		CPoint cpDims;
		cpDims.x = fileDlg.m_Width;
		cpDims.y = fileDlg.m_Height;

      enum SaveGraphicType gt;
		gt = graphicTypes[fileDlg.GetGraphicTypeIndex ()];
      ASSERT ((gt > None) && (gt < Invalid));         

		BOOL fSelected = fileDlg.IsSaveSelected();

      ERRORCODE error = ERRORCODE_Memory;
		if (gt == Pmo)
		{
			// save as "PrintMaster Objects" file
			error = SavePMObjectsToFile(Filename, pDoc, fSelected);
		}
		else
		{
			CDibToGraphicFile pDibToGraphicFile(Filename);
			pDibToGraphicFile.CreateGraphicFile (pDoc, gt, cpDims, fSelected, NULL, LogPixX);
			error = pDibToGraphicFile.GetErrorCode();
		}

      if (error != ERRORCODE_None)
         AfxMessageBox (IDS_ERROR_SAVING);
      else
      {
         if (fileDlg.AddToGallery() == TRUE)
         {
            CPMWCollection* pCollection = GetGlobalCollectionManager()->GetUserCollection(CPMWCollection::typeArt);
            if (pCollection != NULL)
            {
               int nResult = pCollection->ImportItem(Filename, NULL, NULL, fileDlg.m_strCategory, FALSE);
               if (nResult != ERRORCODE_None)
                  AfxMessageBox (IDS_ERROR_SAVING);
            }
         }
      }
   }
}