BOOL DialogView::Init() { // Get pixel size from screen DC. INT32 pixwidth, pixheight; wxScreenDC dc; wxSize ppi = OSRenderRegion::GetFixedDCPPI(dc); pixwidth=ppi.GetWidth(); pixheight=ppi.GetHeight(); // Set up our pixel size PixelWidth = FIXED16(72000.0 / pixwidth); PixelHeight = FIXED16(72000.0 / pixheight); ScaledPixelWidth = PixelWidth; ScaledPixelHeight = PixelHeight; // Get ourselves a ViewState object pVState = new ViewState; if (pVState == NULL) return FALSE; // Connect this view state to this view pVState->pView = this; // No document for dialogs pDoc = NULL; // All ok return TRUE; }
FIXED16 PrintComponent::GetTokenValFIXED16(const char* pComment) { ExtractTokenValStr(pComment); double n = 0.0; camSscanf( Buffer, _T("%le"), &n ); if (n > double(0x7fff)) n = double(0x7fff); if (n < double(-0x8000)) n = double(-0x8000); return FIXED16(n); }
BOOL GRenderWinG::StartRenderAfter(GMATRIX *GMat) { if (Inverted) { // flip up other way GMat->BY = -GMat->BY; // calculate the new offset //XLONG ydisp = (XLONG)( (WRect.bottom - WRect.top ) * 72000 ) / (XLONG)(PixelsPerInch.MakeXlong() * ScaleFactor); FIXED16 ScaledDpi = FIXED16(PixelsPerInch) * ScaleFactor; XLONG Size = (WRect.bottom - WRect.top ) * 72000; XLONG ydisp = Size / ScaledDpi.MakeXlong(); GMat->CY = -GMat->CY + Mul(-GMat->BY, ydisp); } // we cannot fail return TRUE; }
FIXED16 TransformBase::GetScalar() { // Just return the current value of the scale factor return FIXED16(1.0); }
PSDCFontInfo::PSDCFontInfo() { Rotation = FIXED16(0); }
bool ScreenCamView::OnCreate( wxDocument* doc, /* TYPENOTE: Correct */ long flags ) { // Construct the (C++) child windows. PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller / ruler usage") #ifndef EXCLUDE_FROM_XARALX RenderWindow = new CRenderWnd; HScrollBar = new CWinScroller(TRUE); VScrollBar = new CWinScroller(FALSE); Corner = new CScrollerCorner; // WEBSTER - markn 15/1/97 // No rulers in Webster #ifndef WEBSTER HRuler = new OILHorizontalRuler; VRuler = new OILVerticalRuler; OGadget = new OriginGadget; #endif //webster if (!RenderWindow || !HScrollBar || !VScrollBar || !Corner #ifndef WEBSTER ||!HRuler ||!VRuler ||!OGadget #endif //webster ) { Error::SetError(_R(IDE_CREATE_VIEW_FAILED), 0); InformError(); return -1; } #endif // Get base class to call CView functions, and get a document for this view. if( !CCamView::OnCreate( doc, flags ) ) // Something went wrong - pass error back. return false; PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller usage") // Now get Windows to do its side of the construction. The stated sizes and // positions of the windows here will be changed very soon. #ifndef EXCLUDE_FROM_XARALX const CRect rcARect(-100,-100,-90,-90); if (!RenderWindow->Create("", "", 0, rcARect, this, 1) || !HScrollBar->Create(0, rcARect, this, 2) || !VScrollBar->Create(0, rcARect, this, 3) || !Corner->Create("", "", 0, rcARect, this, 4) // WEBSTER - markn 15/1/97 // No rulers in Webster #ifndef WEBSTER || !OGadget->Create(this) || !HRuler->Create(this) || !VRuler->Create(this) #endif //webster ) { Error::SetError(_R(IDE_CREATE_VIEW_FAILED), 0); InformError(); return -1; } #endif CreateNewDocView(); // WEBSTER - markn 15/1/97 // No rulers in Webster #ifndef WEBSTER // init the kernel rulers and establish pointer links to them PORTNOTE("other","ScreenCamView::OnCreate - Removed ruler usage") #ifndef EXCLUDE_FROM_XARALX RulerPair* pRulers=pDocView->GetpRulerPair(); pRulers->Init(pDocView,HRuler,VRuler,OGadget); HRuler->LinkToKernel(pRulers->GetpHorizontalRuler()); VRuler->LinkToKernel(pRulers->GetpVerticalRuler()); #endif #endif //webster ENSURE(pDocView != 0, "ScreenView::ScreenView can't get a new DocView!"); pDocView->ConnectToOilView(this); // find the last view so we can use some of it's settings to create the new // DocView * LastView = DocView::GetSelected(); // Link this and the DocView to the ViewState object. pDocView->SetViewState(Status); //////////////////////////////////////////////////////////////////////////////// wxScreenDC dc; wxSize pixsize=OSRenderRegion::GetFixedDCPPI(dc); PORTNOTE("other","ScreenCamView::OnCreate - Removed scroller usage") #ifndef EXCLUDE_FROM_XARALX // Set the logical pixel size accordingly (measured in millipoints). Take the // opportunity to pass the values into the scrollers and the OIL -> Windows coordinate // transform system. HScrollBar->SetGranularity(72000L / pixwidth); VScrollBar->SetGranularity(72000L / pixheight); #endif // Tell DocView how big the pixel size is. FIXED16 PixelWidth = FIXED16(72000.0/pixsize.x); FIXED16 PixelHeight = FIXED16(72000.0/pixsize.y); ERROR3IF(PixelWidth != PixelHeight, "Luke says non-square pixels are not supported"); pDocView->SetPixelSize(PixelWidth, PixelHeight); // Make our DocView the current DocView pDocView->SetCurrent(); GetCanvas()->SetScrollRate(1,1); if (GetFrame()) GetFrame()->GetClientSize(&CurrentSize.width,&CurrentSize.height); // Now the scrollers have all their information, we can set their appearance. // Make sure that they are invisible until the rest of the frame is ready /* XLONG x1 = CurrentSize.GetWidth () * PixelWidth; XLONG x2 = CurrentSize.GetHeight() * PixelHeight; GetFrame()->SetScrollbar(wxHORIZONTAL,0,x1,Status->WorkAreaExtent.hi.x-Status->WorkAreaExtent.lo.x,false); GetFrame()->SetScrollbar( wxVERTICAL,0,x2,Status->WorkAreaExtent.hi.y-Status->WorkAreaExtent.lo.y,false); */ SetScrollerStyle(ScrollerStyle = PropScrollersOn); ShowScrollers(DefaultScrollersState); ShowRulers(DefaultRulersState); /////////////////////////////////////////////////////////////////////////////// // Register for WM_DROPFILES messages // DragAcceptFiles(TRUE); // WEBSTER - markn 12/2/97 #if (_OLE_VER >= 0x200) // Register with OLE as a drop target. m_DropTarget.Register(this); #endif /////////////////////////////////////////////////////////////////////////////// // now that the ScreenView (and hence DocView) is stable, broadcast a message to let everyone know BROADCAST_TO_ALL(DocViewMsg(pDocView,DocViewMsg::NEWANDSTABLE)); // ****************** BODGE ************************** // This code will tell windows to send us messages when // the joystick gets waggled about. // We should really release the joystick at some point later, // but it gets released automatically when this ScreenView is // destroyed, so it will do for now. // The messages get passed to 'OnJoystickMove' member of this // class. #ifdef WIN32 PORTNOTE("other","ScreenCamView::OnCreate - Removed joystick usage") #ifndef EXCLUDE_FROM_XARALX JOYINFO joyinfo; UINT32 wNumDevs, wDeviceID; BOOL bDev1Attached, bDev2Attached; // Are there any Joysticks available ? if((wNumDevs = joyGetNumDevs()) == 0) return 0; // Nope. // Are there One or Two of them ? bDev1Attached = joyGetPos(JOYSTICKID1,&joyinfo) != JOYERR_UNPLUGGED; bDev2Attached = wNumDevs == 2 && joyGetPos(JOYSTICKID2,&joyinfo) != JOYERR_UNPLUGGED; if(bDev1Attached || bDev2Attached) // Decide which joystick to use wDeviceID = bDev1Attached ? JOYSTICKID1 : JOYSTICKID2; else return 0; // Grab those Messages !! MMRESULT JoyResult = joySetCapture(m_hWnd, wDeviceID, NULL, TRUE); #endif #endif // ****************** BODGE ************************** // Return success! return true; }
/******************************************************************************************** > static GRenderDIB* QuickRenderer::CreateGRenderDIB( double ResFactor, DocRect AreaOfDocumentToRender, UINT32 bpp, BOOL NeedsTransp, Matrix* pSourceMat) Author: Ilan_Copelyn (Xara Group Ltd) <*****@*****.**> Created: 5/06/2000 Purpose: Create and start a GRenderDIB ready for rendering SeeAlso: Errors: Returns NULL if unable to alloc mem for bitmaps in StartRender() ********************************************************************************************/ GRenderDIB* QuickRenderer::CreateGRenderDIB( double ResFactor, DocRect AreaOfDocumentToRender, UINT32 bpp, BOOL NeedsTransp, Matrix* pSourceMat) { ///////////////////////////////////////////////////////////////////////////////////////////// // Setup a new GRenderDIB ///////////////////////////////////////////////////////////////////////////////////////////// GRenderDIB* pNewGRR=NULL; BOOL DoWantBMPSmoothing = FALSE; BOOL ok; // Setup new GRenderDIB based on current Screen resolution and ResFactor multiplier View* pView = View::GetCurrent(); // get the top spread Spread* pSpread = Document::GetSelectedSpread(); // if we've been passed a source matrix, then we'll scale it up by ResFactor and use that. // DEBUG: // Note that we currently check whether the view is for printing, solely so that this code // can live on the net without breaking printing of shadows more than it already is. Matrix Mat; if (pSourceMat != NULL) { FIXED16 Scale; DocCoord dcTrans; pSourceMat->Decompose(&Scale, NULL, NULL, NULL, &dcTrans); // Karim 04/09/2000 // BODGE, to cope with printing reflected images. // If the given matrix contains a reflection, then its determinant < 0. // If this is so, then we'll scale the matrix by -1, which corrects the output. if (pSourceMat->Det() < 0.0) Scale *= FIXED16(-1); Mat = Matrix(Scale * FIXED16(ResFactor), Scale * FIXED16(ResFactor)); Mat.SetTranslation(dcTrans); // Mat *= *pSourceMat; } // otherwise, we'll use the view's settings, scaled up by ResFactor. else { Mat = pView->ConstructScaledRenderingMatrix(pSpread, ResFactor); } // get the scale factor out of the matrix. FIXED16 Scale; Mat.Decompose(&Scale); // double dpi = Scale.MakeDouble() * PIXELS_PER_INCH; double dpi = 0.0; // use screen dpi (ie PIXELS_PER_INCH) // Create a new GRenderDIB region pNewGRR = new GRenderDIB(AreaOfDocumentToRender, Mat, Scale, bpp, dpi); ERROR2IF(pNewGRR == NULL,FALSE,"Failed to create a GRenderDIB!"); // Ensure bmp mem is not allocated from limited memory NewWrappedRRCreated((GRenderRegion*) pNewGRR); // State flags + pixel width calculations if(!pNewGRR->AttachDevice(pView, NULL, pSpread)) // view and spread from previous RR rather than Current - nb in create bitmap copy case { ERROR3("Cannot attach devices"); delete pNewGRR; pNewGRR = NULL; return NULL; } pNewGRR->m_DoCompression = NeedsTransp; ok = pNewGRR->InitDevice(); if (!ok) { delete pNewGRR; pNewGRR = NULL; return NULL; } pNewGRR->InitAttributes(); pNewGRR->RRQuality.SetQuality(QUALITY_MAX); pNewGRR->SetQualityLevel(); pNewGRR->SetLineAttributes(); pNewGRR->SetFillAttributes(); // NB following call gets GRendRegion to create the bitmap into which GDraw will render BOOL Started = pNewGRR->StartRender(); // Karim 06/07/2000 // I'm commenting these pre-processor directives out, to fix a bug with the new shadowing // code, where shadows at anything other than 100% zoom are incorrectly scaled. This is a // BODGE, and this code should be revisited at a later date. //#ifdef _DEBUG // Set DIB dpi indicators correctly - so they are correct if adding to bitmap gallery (not required) double PixPerMetre = PIXELS_PER_INCH * INCHES_PER_METRE; PixPerMetre *= Scale.MakeDouble(); LPBITMAPINFO bi; LPBYTE by; GetBitmapPointers(pNewGRR,&bi,&by); if(bi) { bi->bmiHeader.biXPelsPerMeter = (INT32) (PixPerMetre + 0.5); bi->bmiHeader.biYPelsPerMeter = (INT32) (PixPerMetre + 0.5); } //#endif if(Started) { pNewGRR->SaveContext(); if(DoWantBMPSmoothing) { (pNewGRR->GetDrawContext())->SetTileSmoothingFlag(TRUE); } return pNewGRR; } else { // ENSURE(FALSE,"StartRender failed to alloc bmp for GDraw to render into."); delete pNewGRR; return NULL; } }