BOOL NodeAnimatingBitmap::AllocBitmapRefs(INT32 nCount) { ERROR3IF(m_pBmpRefs != 0, "Bitmaps already allocated in NodeAnimatingBitmap::AllocBitmapRefs"); ERROR3IF(nCount <= 0, "Invalid count in NodeAnimatingBitmap::AllocBitmapRefs"); m_pBmpRefs = new KernelBitmapRef[nCount]; return m_pBmpRefs != 0; }
ActionCode LayerColourAction::Init( UndoableOperation* pOp, ActionList* pActionList, OpChangeLayerColourParam EntryParam) { UINT32 ActSize = sizeof(LayerColourAction); LayerColourAction* pNewAction; ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(LayerColourAction),(Action**)&pNewAction); if (Ac != AC_FAIL && pNewAction != NULL) { OpChangeLayerColourParam& Param = ((LayerColourAction*)pNewAction)->Param; Document* pDoc = EntryParam.pDoc; Layer* pLayer = EntryParam.pLayer; Param.pDoc = pDoc; Param.pLayer = pLayer; if (pDoc != NULL && pLayer != NULL) { DocColour* pDocColour = pLayer->GetGuideColour(); Param.pColour = pDocColour->FindParentIndexedColour(); pLayer->SetGuideColour(EntryParam.pColour); LayerSGallery::ForceRedrawLayer(pDoc,pLayer); BROADCAST_TO_ALL(LayerMsg(pLayer,LayerMsg::GUIDELINES_CHANGED)); } ERROR3IF(pDoc == NULL, "pDoc is NULL"); ERROR3IF(pLayer == NULL,"pLayer is NULL"); } return Ac; }
void ColourPlate::GetDescription(StringBase *Description) { ERROR3IF(Description == NULL, "Illegal NULL param"); *Description = TEXT(""); switch(GetType()) { case COLOURPLATE_CYAN: Description->MakeMsg(_R(IDS_COLOURPLATE_CYAN)); break; case COLOURPLATE_MAGENTA: Description->MakeMsg(_R(IDS_COLOURPLATE_MAGENTA)); break; case COLOURPLATE_YELLOW: Description->MakeMsg(_R(IDS_COLOURPLATE_YELLOW)); break; case COLOURPLATE_KEY: Description->MakeMsg(_R(IDS_COLOURPLATE_BLACK)); break; case COLOURPLATE_SPOT: { IndexedColour *Col = GetSpotColour(); ERROR3IF(Col == NULL, "NULL Spot colour in spot plate"); Description->MakeMsg(_R(IDS_COLOURPLATE_SPOT), (TCHAR *) *(Col->GetName()) ); } break; default: break; } }
void ColourPlate::GetDisplayColour(DocColour *Colour) { ERROR3IF(Colour == NULL, "Illegal NULL param"); PColourCMYK CMYKDef; CMYKDef.Cyan = CMYKDef.Magenta = CMYKDef.Yellow = CMYKDef.Key = 0; switch(GetType()) { case COLOURPLATE_CYAN: CMYKDef.Cyan = 255; break; case COLOURPLATE_MAGENTA: CMYKDef.Magenta = 255; break; case COLOURPLATE_YELLOW: CMYKDef.Yellow = 255; break; case COLOURPLATE_KEY: CMYKDef.Key = 255; break; case COLOURPLATE_SPOT: { IndexedColour *Col = GetSpotColour(); ERROR3IF(Col == NULL, "NULL Spot colour in spot plate"); Colour->MakeRefToIndexedColour(Col); return; // Return immediately } break; default: // Just leave it alone, which will return the default value - white break; } // If we've dropped through this far, then set the CMYK value we've // filled in, and return Colour->SetCMYKValue(&CMYKDef); }
void PrintPrefsDlg::SetCurrentDlg(PrintPrefsDlg* pDlg) { ERROR3IF(pDlg != NULL && pCurrentDlg != NULL,"Setting current Dlg, but there's already one there"); ERROR3IF(pDlg == NULL && pCurrentDlg == NULL,"Setting current Dlg to NULL, but there's no current dlg"); pCurrentDlg = pDlg; }
void OpNudge::PerformMergeProcessing() { // Obtain a pointer to the operation history for the current document OperationHistory* pOpHist = &pOurDoc->GetOpHistory(); // Ensure that we are the last operation added to the operation history // Note cannot be an ERROR2 cos this function cannot fail. ERROR3IF(pOpHist->FindLastOp() != this, "Last Op should be this op"); // OK lets see if the operation performed before this was an OpNudge operation Operation* pPrevOp = pOpHist->FindPrevToLastOp(); if (pPrevOp != NULL) // Check if there was a previous op { if (IS_A(pPrevOp, OpNudge)) { // Yes it was // We can merge this op with pPrevOp if they both apply to the same set of objects // This will be TRUE is their SelectionStates are the same. RestoreSelectionsAction* pRestoreSelAct = (RestoreSelectionsAction*) GetUndoActionList()->FindActionOfClass(CC_RUNTIME_CLASS(RestoreSelectionsAction)); ERROR3IF(pRestoreSelAct == NULL, "This op should have a RestoreSelectionsAction"); SelectionState* ThisOpsSelection = pRestoreSelAct->GetSelState(); pRestoreSelAct = (RestoreSelectionsAction*) pPrevOp->GetUndoActionList()->FindActionOfClass(CC_RUNTIME_CLASS(RestoreSelectionsAction)); ERROR3IF(pRestoreSelAct == NULL, "OpNudge op should have a RestoreSelectionsAction"); SelectionState* LastOpsSelection = pRestoreSelAct->GetSelState(); if ((*ThisOpsSelection) == (*LastOpsSelection)) { // scan to see if either of these ops hides a node // if either do then we cannot merge them together // this can happen if perhaps the extending definitions // were changed by the nudge (sjk 27-7-00) if (DoesActionListHideNodes(pPrevOp) || DoesActionListHideNodes(this) ) return; // this op can be merged into the previous op, we simply need to combine the // TransformNodeActions TransformNodeAction* pTransNdAct = (TransformNodeAction*) GetUndoActionList()->FindActionOfClass(CC_RUNTIME_CLASS(TransformNodeAction)); ERROR3IF(pTransNdAct == NULL, "This op should have a TransformNodeAction"); TransformNodeAction* pLastOpsTransNdAct = (TransformNodeAction*) pPrevOp->GetUndoActionList()->FindActionOfClass(CC_RUNTIME_CLASS(TransformNodeAction)); ERROR3IF(pLastOpsTransNdAct == NULL,"OpNudgeOp should have a TransformNodeAction"); pLastOpsTransNdAct->CombineWith(pTransNdAct); // This op is no longer required, so let's vape it pOpHist->DeleteLastOp(); } } } return; }
void ColourPlate::SetScreenInfo(double Angle, double Frequency) { ERROR3IF(Angle < 0.0 || Angle >= 360.0, "Illegal screen angle"); ScreenAngle = Angle; ERROR3IF(Frequency < 1.0 || Frequency > 1000.0, "Silly screen frequency"); ScreenFrequency = Frequency; }
void String_32::CopyConstruct( const StringBase &other ) { *(text = fixedbuf) = 0; length = FIX_LEN_BUFSIZE; ERROR3IF((const TCHAR*) other == 0, "StringBase to be copied has not been ALLOCated"); ERROR3IF(camStrlen((const TCHAR*) other) >= length, "Constructed String_32 not large enough to hold StringBase copy"); camStrcpy(text, (const TCHAR*) other); }
BOOL BfxPixelOp::SetAuxilliaryBitmaps(KernelBitmap * pProposed /*A*/, KernelBitmap * pCurrent /*B*/, KernelBitmap * pOriginal /*T*/, INT32 Threshold, DWORD theColour) { if (pProposed) { ERROR2IF( (pProposed->ActualBitmap==NULL) ,FALSE,"BfxPixelOp can't find OIL bitmap"); ERROR3IF( (!(pProposed->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxPixelOp Oil layer inconsistency"); BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pProposed->ActualBitmap))->BMInfo->bmiHeader); ERROR2IF( ((pBMI->biHeight != Height) || (pBMI->biWidth != Width) || (BPP && pBMI->biBitCount !=BPP)), FALSE, "Incompatible bitmaps for BfxPixelOp::SetAuxilliaryBitmap"); pA = (DWORD *)(void *)(((CWxBitmap *)(pProposed->ActualBitmap))->BMBytes); } else { pA = NULL; } if (pOriginal) { ERROR2IF( (pOriginal->ActualBitmap==NULL) ,FALSE,"BfxPixelOp can't find OIL bitmap"); ERROR3IF( (!(pOriginal->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxPixelOp Oil layer inconsistency"); BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pOriginal->ActualBitmap))->BMInfo->bmiHeader); ERROR2IF( ((pBMI->biHeight != Height) || (pBMI->biWidth != Width) || (BPP && pBMI->biBitCount !=BPP)), FALSE, "Incompatible bitmaps for BfxPixelOp::SetAuxilliaryBitmap"); pT = (DWORD *)(void *)(((CWxBitmap *)(pOriginal->ActualBitmap))->BMBytes); } else { pT = NULL; } if (pCurrent) { ERROR2IF( (pCurrent->ActualBitmap==NULL) ,FALSE,"BfxPixelOp can't find OIL bitmap"); ERROR3IF( (!(pCurrent->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxPixelOp Oil layer inconsistency"); BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pCurrent->ActualBitmap))->BMInfo->bmiHeader); ERROR2IF( ((pBMI->biHeight != Height) || (pBMI->biWidth != Width) || (BPP && pBMI->biBitCount !=BPP)), FALSE, "Incompatible bitmaps for BfxPixelOp::SetAuxilliaryBitmap"); pB = (DWORD *)(void *)(((CWxBitmap *)(pCurrent->ActualBitmap))->BMBytes); } else { pB = NULL; } Value = Threshold; Colour = theColour; return TRUE; }
void BitmapExportPaletteInterface::SetFlags(INT32 index, INT32 flags) { if (!m_SortedPaletteValid) ValidateSortedPalette(); ERROR3IF(index == -1, "Function called with an invalid palette index"); ExtendedPalette *palette = BmapPrevDlg::m_pExportOptions->GetExtendedPalette(); ERROR3IF(!palette, "There is no palette - This should never happen"); palette->Data[m_PaletteSortedToReal[index]].Flags = flags; }
BYTE BitmapExportPaletteInterface::GetRed(INT32 index) { if (!m_SortedPaletteValid) ValidateSortedPalette(); ERROR3IF(index == -1, "Function called with an invalid palette index"); ExtendedPalette *palette = BmapPrevDlg::m_pExportOptions->GetExtendedPalette(); ERROR3IF(!palette, "There is no palette - This should never happen"); return palette->Data[m_PaletteSortedToReal[index]].Red; }
/****************************************************************************************** > INT32 BitmapExportPaletteInterface::HueComparisonFn(const INT32 *arg1, const INT32 *arg2) Author: Jonathan_Payne (Xara Group Ltd) <*****@*****.**> (based on code by Alex Price) Created: 30/11/2000 Inputs: arg1 Pointer to a value in the m_PaletteSortedToReal array ie an index in the real palette arg2 Pointer to a value in the m_PaletteSortedToReal array ie an index in the real palette Purpose: For use with qsort'ing the palette by hue ******************************************************************************************/ INT32 BitmapExportPaletteInterface::HueComparisonFn(const INT32 *arg1, const INT32 *arg2) { INT32 paletteIndex1 = *arg1; INT32 paletteIndex2 = *arg2; ExtendedPalette *palette = BmapPrevDlg::m_pExportOptions->GetExtendedPalette(); ERROR3IF(!palette, "There is no palette - This should never happen"); // Extract the red, green, and blue values for the first index INT32 red1 = palette->Data[paletteIndex1].Red; INT32 green1 = palette->Data[paletteIndex1].Green; INT32 blue1 = palette->Data[paletteIndex1].Blue; // Extract the red, green, and blue values for the first index INT32 red2 = palette->Data[paletteIndex2].Red; INT32 green2 = palette->Data[paletteIndex2].Green; INT32 blue2 = palette->Data[paletteIndex2].Blue; // Get the Hue value corresponding to the first RGB triplet. DocColour colour1(red1, green1, blue1); INT32 hue1, saturation1, value1; colour1.GetHSVValue(&hue1, &saturation1, &value1); // Get the Hue value corresponding to the first RGB triplet. DocColour colour2(red2, green2, blue2); INT32 hue2, saturation2, value2; colour2.GetHSVValue(&hue2, &saturation2, &value2); if (hue1 > hue2) return 1; else if (hue1 < hue2) return -1; ERROR3IF(hue1 != hue2, "This is not possible!"); // If the Hue values are the same, then put in order of Saturation if (saturation1 < saturation2) return 1; else if (saturation1 > saturation2) return -1; ERROR3IF(saturation1 != saturation2, "This is not possible!"); // If the saturation values are the same, then the final step is // to put them in order of Value if (value1 < value2) return 1; else if (value1 > value2) return -1; ERROR3IF(value1 != value2, "This is not possible!"); return 0; // Everything is eqaul }
/****************************************************************************************** > INT32 BitmapExportPaletteInterface::LuminanceComparisonFn(const INT32 *arg1, const INT32 *arg2) Author: Jonathan_Payne (Xara Group Ltd) <*****@*****.**> (based on code by Alex Price) Created: 30/11/2000 Inputs: arg1 Pointer to a value in the m_PaletteSortedToReal array ie an index in the real palette arg2 Pointer to a value in the m_PaletteSortedToReal array ie an index in the real palette Purpose: For use with qsort'ing the palette by Luminance ******************************************************************************************/ INT32 BitmapExportPaletteInterface::LuminanceComparisonFn(const INT32 *arg1, const INT32 *arg2) { INT32 paletteIndex1 = *arg1; INT32 paletteIndex2 = *arg2; ExtendedPalette *palette = BmapPrevDlg::m_pExportOptions->GetExtendedPalette(); ERROR3IF(!palette, "There is no palette - This should never happen"); // Extract the red, green, and blue values for the first index INT32 red1 = palette->Data[paletteIndex1].Red; INT32 green1 = palette->Data[paletteIndex1].Green; INT32 blue1 = palette->Data[paletteIndex1].Blue; // Extract the red, green, and blue values for the first index INT32 red2 = palette->Data[paletteIndex2].Red; INT32 green2 = palette->Data[paletteIndex2].Green; INT32 blue2 = palette->Data[paletteIndex2].Blue; // Get the Luminance value corresponding to the first RGB triplet. double luminance1 = ( 0.299 * red1 ) + ( 0.587 * green1 ) + ( 0.114 * blue1 ); // Get the Luminance value corresponding to the second RGB triplet. double luminance2 = ( 0.299 * red2 ) + ( 0.587 * green2 ) + ( 0.114 * blue1 ); // This will sort in descending Hue values. if (luminance1 < luminance2) return 1; else if (luminance1 > luminance2) return -1; ERROR3IF(luminance1 != luminance2, "This is not possible!"); if (red1 < red2 ) return 1; else if (red1 > red2) return -1; ERROR3IF(red1 != red2, "This is not possible!"); if (green1 < green2 ) return 1; else if (green1 > green2) return -1; ERROR3IF(green1 != green2, "This is not possible!"); if (blue1 < blue2 ) return 1; else if (blue1 > blue2) return -1; ERROR3IF(blue1 != blue2, "This is not possible!"); return 0; // The red, green and blue are equal }
void GBrush::GetLogBrushInternal( const COLORREF rgb, wxBrush* pBrush ) { ERROR3IF( !Valid, "GBrush called when not available"); ERROR3IF( Current != this, "GBrush not current"); pBrush->SetStyle(wxSOLID); // we let the Widgets handle primary colours cos they should be able to manage it (!) if ( ((rgb & 0x0000FF)==0x000000 || (rgb & 0x0000FF)==0x0000FF) && ((rgb & 0x00FF00)==0x000000 || (rgb & 0x00FF00)==0x00FF00) && ((rgb & 0xFF0000)==0x000000 || (rgb & 0xFF0000)==0xFF0000) ) { pBrush->SetColour(GetRValue(rgb),GetGValue(rgb),GetBValue(rgb)); return; } // We assume the GBrush is defined in the GContext belonging to GRenderRegions // ARRRGGHHH Who wrote MakeCurrent() without making it Virtual. What a naughty // boy I am (Andy, that is! - Jason ;-) GDrawContext *GContext = GRenderRegion::GetStaticDrawContext(); const BYTE *pGBrush = NULL; // This was checked in init/start, but we might as well be safe if (GContext != NULL) { // If the current mode is for solid colours (no dithering) then we ask for solid colour. // This is used for things like pasteboards which shouldn't dither for aesthetic (eor!) reasons if (UseSolidColours) GContext->SetSolidColour(rgb); else GContext->SetColour(rgb); pGBrush = GContext->ReturnBrushRGB(); } else ERROR3("GBrush got a NULL GContext!\n"); if (pGBrush == NULL) pBrush->SetColour(GetRValue(rgb),GetGValue(rgb),GetBValue(rgb)); else if ( UseSolidColours ) pBrush->SetColour(pGBrush[0],pGBrush[1],pGBrush[2]); else { #ifdef __WXGTK__ // The following line shouldn't be necessary, but wxGTK appears to // fail if it doesn't have a valid colour when setting the brush // into a device context. pBrush->SetColour(0,0,0); #endif wxImage image(4,4,(BYTE*)pGBrush,true); wxBitmap bitmap(image); pBrush->SetStipple(bitmap); // Also sets style to wxSTIPPLE } }
void TEMPLATESGallery::CreateNewSubtree(Document *ParentDoc, SGDisplayGroup *ExistingGroup) { ERROR3IF(ParentDoc == NULL, "TEMPLATESGallery::CreateNewSubtree - NULL parameter passed in"); if (ParentDoc == NULL) return; SGDisplayGroup *DisplayDocument; SGDisplayDATATYPE *DisplayDATATYPE; if (ExistingGroup != NULL) { ERROR3IF(ExistingGroup->GetParentDocument() != ParentDoc, "This group is not for that document! What's going down, dude?"); DisplayDocument = ExistingGroup; // Use existing group DisplayDocument->DestroySubtree(FALSE); // Wipe any existing DATATYPE display items } else { DisplayDocument = new SGDisplayGroup(this, ParentDoc,NULL); // Create new Group if (DisplayDocument == NULL) // Total failure - abort return; DisplayTree->AddItem(DisplayDocument); // Add new group to tree } // **** TO DO **** // Fill in some code here to generate SGDisplayDATATYPEs to be displayed. // e.g: (in PSEUDO code!! ;-) // // DATATYPE *Ptr = ParentDoc->GetDATATYPEList()->GetHead(); // while (Ptr != NULL) // { // DisplayDATATYPE = new SGDisplayDATATYPE(Ptr); // if (DisplayDATATYPE != NULL) // DisplayDocument->AddItem(DisplayDATATYPE); // // Ptr = ParentDoc->GetDATATYPEList()->GetNext(); // } // // // Default : create a few items to display // NOTE: The pointer faked up to pass in to the constructor will cause the thing // to blow up if you start actually trying to USE the data item! Replace this at // earliest convenience with proper tree construction code. for (INT32 Bob = 0; Bob < 7; Bob++) { DisplayDATATYPE = new SGDisplayDATATYPE( (DATATYPE *) 0xcdcdcdcd ); if (DisplayDATATYPE != NULL) DisplayDocument->AddItem(DisplayDATATYPE); } }
BOOL LoadBrushDirect::OnLoadDocument(Document* pDoc) { ERROR3IF(pDoc==NULL,"No doc pointer during PrintMarksMan::ConvertAllDocColours!"); Node *CurNode = Node::DocFindFirstDepthFirst(pDoc); Node *NextNode; while (CurNode !=NULL) { // We may be about to chop this node out of the tree, so get the next node now NextNode = CurNode->DocFindNextDepthFirst(); // Use to scan the colour fields of the attribute. UINT32 Context = 0; DocColour *pColour; if (CurNode->IsAnAttribute()) { NodeAttribute *pNodeAttr = (NodeAttribute *) CurNode; // Get the next colour field from the attribute pColour = pNodeAttr->EnumerateColourFields(Context++); while (pColour != NULL) { // For each colour field, make sure the colour is a local DocColour so that // the sub-tree is entirely stand-alone if (pColour->FindParentIndexedColour() != NULL) { ColourGeneric ColDef; ColourContext *cc = ColourManager::GetColourContext(pColour->GetColourModel()); ERROR3IF(cc == NULL, "Can't find colour context?!"); // Get the IndexedColour definition as a standalone colour definition cc->ConvertColour(pColour->FindParentIndexedColour(), &ColDef); // Make the DocColour into a simple standalone "lookalike" of the parent colour *pColour = DocColour(pColour->GetColourModel(), &ColDef); } pColour = pNodeAttr->EnumerateColourFields(Context++); } } CurNode = NextNode; } // All is well we hope. return TRUE; }
BOOL UnitListComponent::StartExport(BaseCamelotFilter *pFilter) { #ifdef DO_EXPORT ERROR3IF(pExpUserUnitMap != NULL,"UnitListComponent::StartExport pExpUserUnitMap is non-NULL!"); if (pFilter) { // Get the document we are interested in pDocument = pFilter->GetDocument(); // Get the unit list attached to the current document if (pDocument) pDocUnitList = pDocument->GetDocUnitList(); ERROR3IF(pDocUnitList == NULL,"UnitListComponent::StartExport No doc unit list attached to this doc yet"); // Get a hash table for the user units... /* TRY { pExpUserUnitMap = new CMapPtrToPtr; } CATCH (CMemoryException, e) { ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY)); } END_CATCH */ try { pExpUserUnitMap = new CMapPtrToLong; } catch (std::bad_alloc&) { ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY)); } catch (...) { ERROR1(FALSE, _R(IDS_UNKNOWN_ERROR)); } } else { pDocUnitList = NULL; pDocument = NULL; } #endif return TRUE; }
BOOL LiveEffectsTool::UpdatePPStack(BOOL bUCE) { if (m_pPPStack!=NULL) return FALSE; m_pPPStack = EffectsStack::GetEffectsStackFromSelection(); BOOL bOK; // If we know what type of effect we were last editing, try to find that type again if (!m_strCurrentEffectID.IsEmpty()) { bOK = m_pPPStack->FindBestProcessor(&m_strCurrentEffectID, &m_iCurrentStackPos); if (!bOK) { m_strCurrentEffectID.Empty(); m_iCurrentStackPos = STACKPOS_TOP; } } // If we don't have a current effect set for the current stack then try to // find the topmost effect if (m_strCurrentEffectID.IsEmpty()) { m_iCurrentStackPos = STACKPOS_TOP; bOK = m_pPPStack->GetLevelInfo(&m_strCurrentEffectID, &m_iCurrentStackPos); if (!bOK) { m_strCurrentEffectID.Empty(); m_iCurrentStackPos = STACKPOS_TOP; } } // Tell any running XPE editor that things have changed if (bUCE) OpLiveEffect::UpdateCurrentEditor(); // Safety net: UpdateCurrentEditor should not leave m_pPPStack NULL! ERROR3IF(m_pPPStack==NULL, "Effect tool's effect stack is NULL in UpdatePPStack!"); if (m_pPPStack==NULL) m_pPPStack = EffectsStack::GetEffectsStackFromSelection(); // Safety net: UpdateCurrentEditor should not leave m_pPPStack NULL! ERROR3IF(m_pPPStack==NULL, "Effect tool's effect stack is NULL in UpdatePPStack!"); if (m_pPPStack==NULL) m_pPPStack = EffectsStack::GetEffectsStackFromSelection(); return TRUE; }
void SelectionState::DeselectAll(BOOL RenderBlobs) { // Find the selected objects in the tree; SelRange* Selected = GetApplication()->FindSelection(); ERROR3IF( Selected==NULL, "Selection object is null in DeselectAll()"); // Get the selected spread Spread* pSpread = Document::GetSelectedSpread(); ERROR3IF(pSpread == NULL,"NULL selected spread"); // Make sure that we have a spread and a selection if (pSpread == NULL || Selected == NULL) return; // Find first selected node #if !defined(EXCLUDE_FROM_RALPH) Node* pFirstSelectedNode = Selected->FindFirst(); // If there is a selection, EOR blobs off, deselect nodes, and inform everybody if (pFirstSelectedNode != NULL && RenderBlobs) { // Go though and render all the EOR blobs off the screen // Find the Blob Manager BlobManager* BlobMgr = GetApplication()->GetBlobManager(); ENSURE( BlobMgr!=NULL, "Blob Manager unexpectedly not there."); // Render all the blobs BlobMgr->RenderOff(NULL, pFirstSelectedNode->FindParentSpread()); Tool* pTool = Tool::GetCurrent(); // Get the tool to remove all its blobs before we deselect the nodes. // Only do this if the current tool dosent update itself on sel changed messages if (pSpread!=NULL && pTool!=NULL && !pTool->AreToolBlobsRenderedOnSelection()) pTool->RenderToolBlobs(pSpread,NULL); } #endif DeselectAll(pSpread->FindFirstChild()); // Selection cache is no longer valid, so update and tell everyone that it has changed // *Note*, This used to be 'Selected->Update(TRUE)', but I (Will) removed the TRUE, so // that a message is NOT broadcast. This should only be called from an operation, // and the op will send a message when it ends. Selected->Update(); }
BOOL BitmapPreviewData::ExportBrowserTypeBitmap(KernelBitmap *pBmp,PathName *pOutFile) { ERROR3IF(pBmp == NULL, "NULL param passed in ExportPreviewBitmap"); ERROR3IF(pOutFile == NULL, "NULL param passed in ExportPreviewBitmap"); if ((pBmp == NULL) || (pOutFile == NULL)) return FALSE; // create a disk file CCDiskFile TempDiskFile(1024, FALSE, TRUE); // Find the gif preview filter for export (so we don't get an options dialog box) Filter *pFilter = Filter::GetFirst(); while (pFilter != NULL) { if (IS_A(pFilter,PreviewFilterGIF)) // This is the filter! break; // Try the next filter pFilter = Filter::GetNext(pFilter); } if (pFilter == NULL) return FALSE; // filter not found // get the preview bitmap filter, so no dialog box is displayed PreviewFilterGIF *pGIFFilter = (PreviewFilterGIF *)pFilter; BOOL ok = TRUE; // create an operation for the export SelOperation *pOp = new SelOperation; if (pOp != NULL) { ok = pGIFFilter->DoExportBitmap(pOp, &TempDiskFile, pOutFile, pBmp); // delete the created operation delete pOp; } else return FALSE; // close the file if (TempDiskFile.isOpen()) TempDiskFile.close(); return ok; }
void OpPalettePopupCommand::Do( OpDescriptor* pOpDesc ) { ERROR3IF(!m_pPaletteControl, "Help, I am the palette right click menu and I can't talk to the palette"); ERROR3IF(!m_pBmapPrevDlg, "Help, I am the palette right click menu and I can't talk to the preview dialog"); // Get the token of the item selected by the user. String_256 s(pOpDesc->Token); if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_LOCKED)) m_pPaletteControl->SetSelectedColourToggleLocked(); else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_WEB_SAFE)) m_pPaletteControl->SetSelectedColourWebSafe(); else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_TRANSPARENT_BACKGROUND)) { BmapPrevDlg::m_pExportOptions->SetBackgroundTransparency(!BmapPrevDlg::m_pExportOptions->IsBackgroundTransparent()); m_pBmapPrevDlg->DoPreview(); } else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_TRANSPARENT)) m_pPaletteControl->SetSelectedColourToggleTransparent(); else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_DELETE)) m_pPaletteControl->SetSelectedColourToggleDeleted(); else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_RESTORE)) m_pPaletteControl->SetSelectedColourToggleDeleted(); else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SYSTEM_COLOURS)) BmapPrevDlg::m_pExportOptions->SetToUseSystemPalette(!BmapPrevDlg::m_pExportOptions->IsUsingSystemPalette()); else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SORT_BY_USE)) { m_pPaletteControl->SetCurrentSortType(BitmapExportPaletteInterface::SORT_USE); m_pPaletteControl->RenderSoon(); } else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SORT_BY_LUMINANCE)) { m_pPaletteControl->SetCurrentSortType(BitmapExportPaletteInterface::SORT_LUMINANCE); m_pPaletteControl->RenderSoon(); } else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SORT_BY_HUE)) { m_pPaletteControl->SetCurrentSortType(BitmapExportPaletteInterface::SORT_HUE); m_pPaletteControl->RenderSoon(); } BmapPrevDlg::m_pExportOptions->InvalidatePalette(); m_pBmapPrevDlg->UpdateCurrentTab(); m_pBmapPrevDlg->DoPreview(); End(); }
SGLibType LibraryFile::GetLibraryType(void) { // Did the client forget to call Init() before calling this method? ERROR3IF(MyType == SGLib_Blank, "This LibraryFile has not been properly initialised!"); return(MyType); }
BOOL LibraryFile::KillLeadingSpaces(StringBase *Str) { ERROR3IF(Str == NULL, "LibraryFile::KillLeadingSpaces - NULL params are illegal"); if( ((TCHAR *)(*Str))[0] != ' ' && ((TCHAR *)(*Str))[Str->Length()-1] != ' ') return TRUE; INT32 Length = Str->Length(); INT32 FirstNonSpaceChar = 0; while (((TCHAR *)(*Str))[FirstNonSpaceChar] == ' ' && FirstNonSpaceChar < Length) FirstNonSpaceChar++; if(FirstNonSpaceChar >= Length) *Str = ""; else { // Strip off trailing spaces... INT32 LastNonSpaceChar = Length; while (((TCHAR *)(*Str))[LastNonSpaceChar-1] == ' ' && LastNonSpaceChar > 0) LastNonSpaceChar--; String_256 Str256; Str->Mid(&Str256, FirstNonSpaceChar, LastNonSpaceChar - FirstNonSpaceChar); *Str = Str256; } return TRUE; }
BOOL BfxPixelOpPseudo::SetBitmap(KernelBitmap * pKB, DWORD theCacheStateMask, DWORD theCacheValueMask, BOOL theDefaultValue) { Base = NULL; ERROR2IF( ((!pKB) || (pKB->ActualBitmap==NULL)) ,FALSE,"BfxALU can't find OIL bitmap"); ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency"); BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader); BPP=pBMI->biBitCount; ERROR2IF(BPP>8, FALSE,"Pseudo colour BMP not pseudo colour"); switch (BPP) { case 1 : Log2BPP=0; break; case 2 : Log2BPP=1; break; case 4 : Log2BPP=2; break; case 8 : Log2BPP=3; break; default: ERROR2(FALSE, "Invalid BPP field"); } if (!BfxPixelOp::SetBitmap(pKB, theCacheStateMask,theCacheValueMask, theDefaultValue)) return FALSE; BPPMask = (BPP==32)?0xFFFFFFFF:(1<<BPP)-1; XShift = 3-Log2BPP; XMask = (1<<XShift)-1; Size = (pBMI->biSizeImage<<3)>>Log2BPP; return TRUE; }
BOOL GuidesPropertiesTab::DeleteClicked() { INT32* pIndexList = pPropertiesDlg->GetSelectedItems(_R(IDC_GUIDETAB_GUIDELINELIST)); INT32 Count = GuidelineList.GetCount(); INT32 i; BOOL ok = (pIndexList != NULL && Count > 0); NodeGuideline** pGuidelineList = NULL; if (ok) { pGuidelineList = (NodeGuideline**)CCMalloc(sizeof(NodeGuideline*)*(Count+1)); ok = (pGuidelineList != NULL); if (ok) { for (i=0; (pIndexList[i] >= 0) && (i < Count);i++) { GuidelineListItem* pItem = (GuidelineListItem*)GuidelineList.FindItem(pIndexList[i]); if (pItem != NULL) pGuidelineList[i] = pItem->pGuideline; else { pGuidelineList[i] = NULL; ERROR3_PF(("List item at index [%d] is NULL",i)); } } pGuidelineList[i] = NULL; } } else ok = FALSE; if (ok) { OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_GUIDELINE); ERROR3IF(pOpDesc == NULL,"FindOpDescriptor(OPTOKEN_GUIDELINE) failed"); if (pOpDesc != NULL) { OpGuidelineParam GuidelineParam; GuidelineParam.Method = GUIDELINEOPMETHOD_DELETE; GuidelineParam.pGuidelineList = pGuidelineList; pOpDesc->Invoke(&GuidelineParam); } } if (pGuidelineList != NULL) CCFree(pGuidelineList); if (pIndexList != NULL) delete [] pIndexList; return ok; }
void PlugInOp::Do(OpDescriptor* pOpDesc) { if (pOpDesc == NULL) { ERROR3IF(pOpDesc == NULL,"PlugInOp::Do null OpDescriptor"); return; } //ERROR3("PlugInOp - do"); // Search the plug-ins list for the specified plug-in and invoke it PlugInManager* pManager = GetApplication()->GetPlugInManager(); if (pManager == NULL) return; PlugInItem * pPlugIn = pManager->GetFirstPlugIn(); String_32 OpToken; while (pPlugIn) { OpToken = pPlugIn->GetUniqueID(); OpToken += pPlugIn->GetPlugInName(); if (pOpDesc->Token == OpToken) pPlugIn->About(); pPlugIn = pManager->GetNextPlugIn(pPlugIn); } // and finish End(); }
BOOL BfxPixelOp::SetBitmap(KernelBitmap * pKB, DWORD theCacheStateMask, DWORD theCacheValueMask, BOOL theDefaultValue) { Base = NULL; ERROR2IF( ((!pKB) || (pKB->ActualBitmap==NULL)) ,FALSE,"BfxALU can't find OIL bitmap"); ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency"); BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader); ERROR2IF( (BPP && pBMI->biBitCount != BPP), FALSE, "BfxPixelOp called with incorrect BPP"); Base = (DWORD *)(void *)(((CWxBitmap *)(pKB->ActualBitmap))->BMBytes); Width = pBMI->biWidth; INT32 Bits = pBMI->biBitCount; switch (Bits) { case 1 : WidthRounded = (Width+31) &~31; break; case 2 : WidthRounded = (Width+15) &~15; break; case 4 : WidthRounded = (Width+7) &~7; break; case 8 : WidthRounded = (Width+3) &~3; break; case 16: WidthRounded = (Width+1) &~1; break; case 32: default: WidthRounded = Width; break; } Height = pBMI->biHeight; Size = (pBMI->biSizeImage)>>2; return TRUE; }
BOOL ObjectCache::MakeRoomFor(CachedObject* pObj) { ERROR3IF(pObj==NULL, "Error: the object to cache can't be NULL"); if (pObj == NULL) return FALSE; // is there room in the cache or do we have to free some memory ? if (pObj->GetSize() + m_CurrentSize <= m_Ceiling) return TRUE; // enough room // is the cache big enough ? if (pObj->GetSize() > m_Ceiling) return FALSE; // the object is bigger than the cache size // Scan the cache deleting objects until there is room BOOL EnoughRoom = (pObj->GetSize() + m_CurrentSize <= m_Ceiling); do { BOOL ObjectDeleted = DeleteObject(); EnoughRoom = (pObj->GetSize() + m_CurrentSize <= m_Ceiling); if(!ObjectDeleted && !EnoughRoom) return FALSE; // no room and no deleted objects } while (!EnoughRoom); return TRUE; }
void MouldTransform::Transform(DocCoord* Coords, INT32 NumCoords) { ERROR3IF(Coords==NULL, "MouldTransform::Transform() called with illegal coord pointer"); for (INT32 i=0; i<NumCoords; i++) pMouldGeom->MouldPoint(Coords[i],Coords[i]); }
void BfxPixelOpPseudo::TranslateToRGB(DWORD Colour, KernelBitmap * pKB, INT32 * R, INT32 * G, INT32 * B) { RGBQUAD Col; if ((!pKB) || (pKB->ActualBitmap==NULL)) { ERROR3( "BfxALU can't find OIL bitmap"); return; } ERROR3IF( (!(pKB->ActualBitmap->IsKindOf(CC_RUNTIME_CLASS(CWxBitmap)) )),"BfxALU Oil layer inconsistency"); BITMAPINFOHEADER * pBMI=&(((CWxBitmap *)(pKB->ActualBitmap))->BMInfo->bmiHeader); if ( Colour >= pBMI->biClrUsed ) { ERROR3("Too large palette entry"); *R=*G=*B=0; return; } Col = ((RGBQUAD *)(pBMI+1/*pointer arith*/))[Colour]; *R = Col.rgbRed; *G = Col.rgbGreen; *B = Col.rgbBlue; return; };