void dRfromQ1 (dMatrix3 R, const dQuaternion q) { // q = (s,vx,vy,vz) btScalar qq1 = 2.f*q[1]*q[1]; btScalar qq2 = 2.f*q[2]*q[2]; btScalar qq3 = 2.f*q[3]*q[3]; _R(0,0) = 1.f - qq2 - qq3; _R(0,1) = 2*(q[1]*q[2] - q[0]*q[3]); _R(0,2) = 2*(q[1]*q[3] + q[0]*q[2]); _R(0,3) = 0.f; _R(1,0) = 2*(q[1]*q[2] + q[0]*q[3]); _R(1,1) = 1.f - qq1 - qq3; _R(1,2) = 2*(q[2]*q[3] - q[0]*q[1]); _R(1,3) = 0.f; _R(2,0) = 2*(q[1]*q[3] - q[0]*q[2]); _R(2,1) = 2*(q[2]*q[3] + q[0]*q[1]); _R(2,2) = 1.f - qq1 - qq2; _R(2,3) = 0.f; }
BOOL CamelotWebFilter::Init() { // Get the OILFilter object pOILFilter = new WebOILFilter(this); if (pOILFilter == NULL) return FALSE; // Load the description strings FilterName.Load(FilterNameID); FilterInfo.Load(FilterInfoID); BOOL ok = TRUE; #ifdef DO_EXPORT // Init the export web file options dialog ok = WebPrefsDlg::Init(); #endif if (ok) ok = CreateRecordHandlers(); BaseCamelotFilter::DontConvertTheseFontsToOutlines = String_256(_R(IDS_WEB_GUARANTEED_FONTS)); if (Camelot.DeclareSection("Filters", 15)) { // Preferences form the web export options dialog box // Preference for bitmap compression requested by the user // 101 -201 means use PNG but remember old JPEG setting // 0-100 use JPEG with this quality setting Camelot.DeclarePref( NULL, "BitmapCompression", &BaseCamelotFilter::BitmapCompression, 0, 201 ); // Preference for whether we export a preview bitmap in web files Camelot.DeclarePref( NULL, "ExportPreviewBitmap", &BaseCamelotFilter::PreviewBitmapExport, 0, 1 ); // Preference for whether we convert all text to outlines in web files (baring some assumed fonts) Camelot.DeclarePref( NULL, "ConvertTextToOutlines", &BaseCamelotFilter::ConvertTextToOutlines, 0, 1 ); // Preference for whether we export invisible layers in web files or not (only applicable in non-minimal mode) Camelot.DeclarePref( NULL, "RemoveInvisibleLayers", &BaseCamelotFilter::RemoveInvisibleLayers, 0, 1 ); // Preference for whether we export unused colours in web files or not (only applicable in non-minimal mode) Camelot.DeclarePref( NULL, "RemoveUnusedColours", &BaseCamelotFilter::RemoveUnusedColours, 0, 1 ); // Preference for whether we export an HTML tag to the clipboard Camelot.DeclarePref( NULL, "HTMLToClipboard", &BaseCamelotFilter::HTMLToClipboard, 0, 1 ); // Preference for whether we export a minimal web file or a stripped down native file Camelot.DeclarePref( NULL, "MinimalWebFormat", &BaseCamelotFilter::MinimalWebFormat, 0, 1 ); // WEBSTER - markn 28/1/97 // Preference for whether we convert all blends to outlines in web files Camelot.DeclarePref( NULL, "ConvertBlendsToOutlines", &BaseCamelotFilter::ConvertBlendsToOutlines, 0, 1 ); // Other preferences // Preference for whether we write relative paths or not Camelot.DeclarePref( NULL, "WriteRelativePaths", &BaseCamelotFilter::WriteRelativePaths, 0, 1 ); // Preference which lists the fonts not to be converted into outlines Camelot.DeclarePref( NULL, "DontConvertTheseFontsToOutlines", &BaseCamelotFilter::DontConvertTheseFontsToOutlines); // Preference for the tolerence we use to test for similar paths Camelot.DeclarePref( NULL, "WebSimilarPathTolerence", &BaseCamelotFilter::WebSimilarPathTolerence, 0, 500 ); // Webster - Neville 29/7/97 // Whether non-frame layers in an imported file are combined onto the active layer or the // first non-frame layer in the import Camelot.DeclarePref( NULL, "ImportNonFramesOntoActivelayer", &BaseCamelotFilter::ImportNonFramesOntoActivelayer, 0, 1 ); } // All ok? return ok; }
MsgResult URLImportDlg::Message(Msg* Message) { //If the message came from within our dialog if (IS_OUR_DIALOG_MSG(Message)) { //Then cast it into a dialog message and handle it DialogMsg* Msg = (DialogMsg*)Message; //If this flag gets set, we should close the dialog BOOL EndDialog = FALSE; //Now pass the message to a message handling function switch (Msg->DlgMsg) { case DIM_CREATE: OnCreate(); break; case DIM_COMMIT: OnCommit(); EndDialog=TRUE; break; case DIM_CANCEL: DialogWasCancelled=TRUE; EndDialog = TRUE; break; case DIM_LFT_BN_CLICKED: // A control on the dialog box has been clicked... if(Msg->GadgetID==_R(IDC_URLIMPORT_IMPORT)) { OnCommit(); EndDialog=TRUE; } break; case DIM_TEXT_CHANGED: // The user has typed in an edit field switch (Msg->GadgetID) { case _R(IDC_URLIMPORT_URL): if (URLImportDlg::DontHandleNextMessage) URLImportDlg::DontHandleNextMessage=FALSE; else OnURLChanged(); break; } break; } //And end the dialog if necessary if (EndDialog) { Close(); End(); } } //Now pass the message down to the base class return DialogOp::Message(Message); }
void rfl_import_module(State& st) { st.set_label(_R("file:r"), FileStream::READ); st.set_label(_R("file:w"), FileStream::WRITE); st.set_label(_R("file:a"), FileStream::APPEND); st.new_global(_R("file:rem"), io_file_remove); st.new_global(_R("file:rename"), io_file_rename); st.new_global(_R("file:copy"), io_file_copy); st.new_global(_R("file:open"), io_file_open); st.new_global(_R("dir:make"), io_dir_make); st.new_global(_R("dir:rem"), io_dir_remove); st.new_global(_R("dir:change"), io_dir_change); st.new_global(_R("dir:curr"), io_dir_curr); }
//#include "barsdlgs.h" #include "bubbleid.h" #include <afxpriv.h> #include "infobar.h" DECLARE_SOURCE("$Revision: 1282 $"); CC_IMPLEMENT_DYNCREATE(InfoBarOp, DialogOp) const CDlgMode InfoBarOp::Mode = MODELESS; // Mode of the dialog BOOL InfoBarOp::Visible = TRUE; UINT32 InfoBarOp::IDD = _R(IDD_INFOBAR); InfoBarOp::InfoBarOp(CDlgResID SubDialogID) : DialogOp(InfoBarOp::IDD, InfoBarOp::Mode, SubDialogID) { // Not dragging the info bar intially DraggingBar = FALSE; } MsgResult InfoBarOp::Message( Msg* Message) { /* if (Document::GetCurrent() == NULL) // No document - can't do anything
BOOL ScaleTab::ShowScaleDetails() { TRACEUSER( "Neville", _T("ScaleTab::ShowScaleDetails\n")); ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::ShowScaleDetails called with no dialog pointer"); ERROR2IF(pDimScale == NULL,FALSE,"ScaleTab::ShowScaleDetails pDimScale is NULL"); String_32 Str; // Get current state of dimension scaling to see whether it is active or // noton this view. BOOL Active = pDimScale->IsActive(); pPrefsDlg->SetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR), (INT32)Active); // remember entry states in our class variables OldActiveState = Active; Str = pDimScale->GetDrawingScaleStr(); pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), Str); pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWINGSCALE), Active); // remember entry states in our class variables OldDrawingStr = Str; Str = pDimScale->GetRealScaleStr(); pPrefsDlg->SetStringGadgetValue(_R(IDC_OPTS_REALSCALE), Str); pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALSCALE), Active); // remember entry states in our class variables OldRealStr = Str; // Grey/ungrey the static text fields accordingly pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEEG), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALWORLD), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWING), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO2), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEGROUP), Active); return TRUE; }
BOOL OpMenuSave::Init() { BOOL InitOK = TRUE; // Register the save / save as... version // InitOK = RegisterOpDescriptor( // 0, // Tool ID // _R(IDT_IMPORT), // String resource ID // CC_RUNTIME_CLASS(OpMenuSave), // Runtime class // OPTOKEN_NATIVESAVE, // Token string // GetState, // GetState function // 0, // help ID // _R(IDBBL_FILESAVEOP), // bubble help // _R(IDD_BARCONTROLSTORE), // resource ID // _R(IDC_BTN_FILESAVE), // control ID // SYSTEMBAR_FILE, // Bar ID // TRUE, // Recieve system messages // FALSE, // Smart duplicate operation // TRUE, // Clean operation // 0, // No vertical counterpart // 0, // String for one copy only error // (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags // ); // if (!InitOK) return FALSE; if (!RegisterOpDescriptor(0, _R(IDT_IMPORT), CC_RUNTIME_CLASS(OpMenuSave), OPTOKEN_NATIVESAVE, GetState, 0, _R(IDBBL_IMPORTFILEOP), 0)) return FALSE; // Register the Save As Default version // if (!RegisterOpDescriptor(0, _R(IDT_SAVEASDEFAULT), CC_RUNTIME_CLASS(OpMenuSave), // OPTOKEN_SAVEASDEFAULT, GetState, // 0, _R(IDBBL_IMPORTFILEOP), 0)) // return FALSE; InitOK = RegisterOpDescriptor( 0, // Tool ID _R(IDT_SAVEASDEFAULT), // String resource ID CC_RUNTIME_CLASS(OpMenuSave), // Runtime class OPTOKEN_SAVEASDEFAULT, // Token string GetState, // GetState function 0, // help ID _R(IDBBL_FILESAVETEMPLATE), // bubble help _R(IDD_BARCONTROLSTORE), // resource ID _R(IDC_FILESAVETEMPLATE), // control ID SYSTEMBAR_FILE, // Bar ID TRUE, // Recieve system messages FALSE, // Smart duplicate operation TRUE, // Clean operation 0, // No vertical counterpart 0, // String for one copy only error (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags ); if (!InitOK) return FALSE; #ifdef NEW_NATIVE_FILTER // Only used by batching at present if (!OpSaveAsWeb::Init()) return FALSE; #endif // Used by the new saving code if (!OpSaveAsNativeV2::Init()) return FALSE; if (!OpSaveAsNativeV1::Init()) return FALSE; // All worked return TRUE; }
CDlgResID LayerPropertiesTab::GetPageID() { return _R(IDD_TAB_LAYER_PROPERTIES); }
BOOL UnitListComponent::ImportUserUnitDefinition(CXaraFileRecord* pCXaraFileRecord, Document * pDoc, INT32 Tag) { ERROR2IF(pCXaraFileRecord == NULL,FALSE,"UnitListComponent::ImportUserUnitDefinition called with no pCXaraFileRecord pointer"); ERROR2IF(pDoc == NULL,FALSE,"UnitListComponent::ImportUserUnitDefinition called with no doc pointer"); ERROR2IF(pDocUnitList == NULL,FALSE,"UnitListComponent::ImportUserUnitDefinition called with no doc unit list pointer"); Unit* pUnit = NULL; BOOL ok = TRUE; ok = pDocUnitList->MakeNewUnit(&pUnit); if (ok && pUnit) { BOOL Prefix = TRUE; switch (Tag) { case TAG_DEFINE_PREFIXUSERUNIT: Prefix = TRUE; break; case TAG_DEFINE_SUFFIXUSERUNIT: Prefix = FALSE; break; default: ERROR3("Bad tag in ImportUserUnitDefinition"); } pUnit->SetPrefixState(Prefix); // Read in the main full name of the unit String_32 Name; if (ok) ok = pCXaraFileRecord->ReadUnicode(&Name);//Name, Name.MaxLength()); if (ok) ok = pUnit->SetToken(Name); // And the abbreviation String_32 Abbrev; if (ok) ok = pCXaraFileRecord->ReadUnicode(&Abbrev);//Abbrev, Abbrev.MaxLength()); if (ok) ok = pUnit->SetSpecifier(Abbrev); // Read in the size of this unit, 0 means based on double UnitSize = 0.0; if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&UnitSize); if (ok) ok = pUnit->SetMillipoints(UnitSize); // Read in the exported base unit type INT32 ExportBaseUnit = 0L; if (ok) ok = pCXaraFileRecord->ReadINT32(&ExportBaseUnit); UnitType BasedOn = NOTYPE; // Convert this based on unit into the required forms Unit* pBasedOnUnit = GetReadUnitReference(ExportBaseUnit); if (pBasedOnUnit != NULL) { //BasedOn = GetUnitType(ExportBaseUnit); BasedOn = pBasedOnUnit->GetUnitType(); if (ok) ok = pUnit->SetBaseUnitType(BasedOn); } else { ERROR3("UserUnit has a bad unit on which it is based"); } // Read in the multipliers for this unit double BaseNumerator = 0.0; double BaseDenominator = 0.0; if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&BaseNumerator); if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&BaseDenominator); if (ok) ok = pUnit->SetBaseNumerator(BaseNumerator); if (ok) ok = pUnit->SetBaseDenominator(BaseDenominator); // Add the unit to the user units map so we can remember the references of the // imported units // Reference for this unit is the record number INT32 RecordNumber = pCXaraFileRecord->GetRecordNumber(); TRACEUSER( "Neville", _T("Imported user unit reference %d\n"), RecordNumber); (*pImpUserUnitMap)[ RecordNumber ] = pUnit; } // We will ignore any errors as we shouldn't not load a document because there is an // error in the units definition. We will just warn the user about a problem // If we have a pFilter then ask the default warning handle to append our message if (!ok && pCamFilter) { if (!WarnedBefore) { pCamFilter->AppendWarning(_R(IDS_NATIVE_UNITSWARNING)); WarnedBefore = TRUE; } } return TRUE; }
BOOL ColourDragInformation::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget) { ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()"); String_256 DragString(_R(IDS_DRAGCOL_DRAGGING_COLOUR)); // "Dragging colour '"); if (TheColour.IsTransparent()) DragString = _R(IDS_DRAGCOL_DRAGGING_NO_COLOUR); // "Dragging 'no colour' : "; else { IndexedColour *TheIxCol = GetInitiallyDraggedColour(); if (TheIxCol != NULL) DragString += *(TheIxCol->GetName()); // Document IndexedColour else DragString += ColourName; // Library colour DragString += String_16(_R(IDS_DRAGCOL_DRAGGING_COLOUR_RIGHT_BIT)); // "' : "; } if (pDragTarget->IS_KIND_OF(ViewDragTarget)) { PageDropInfo PageDropInfo; ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; ObjectDragTarget TargetHit = PageDropInfo.TargetHit; String_256 ObjectDesc = _R(IDS_DRAGCOL_THIS_OBJECT); //" this object"; if (pObjectHit) { ObjectDesc = pObjectHit->Describe(FALSE); } ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); BOOL IsInside = ClickMods.Constrain; if (!IsInside && pObjectHit && pObjectHit->IsCompound()) { TargetHit = MANY_TARGET; } switch (TargetHit) { case FILL_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_FILL)); // "Drop to set the fill colour of this "; DragString += ObjectDesc; if (IsInside) DragString += String_64(_R(IDS_DRAGCOL_ALONE)); // " alone"; break; case LINE_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_LINE)); //"Drop to set the line colour of this "; DragString += ObjectDesc; if (IsInside) DragString += String_64(_R(IDS_DRAGCOL_ALONE)); // " alone"; break; case STARTCOL_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_FILL_START)); //"Drop to set the fill start colour of this "; DragString += ObjectDesc; break; case ENDCOL_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_FILL_END)); //"Drop to set the fill end colour of this "; DragString += ObjectDesc; break; case ENDCOL2_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_FILL_END2)); //"Drop to set the fill end colour of this "; DragString += ObjectDesc; break; case ENDCOL3_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_FILL_END3)); //"Drop to set the fill end colour of this "; DragString += ObjectDesc; break; case MANY_TARGET: DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_FILL)); //"Drop to set the fill colour of this "; DragString += ObjectDesc; DragString += String_64(_R(IDS_DRAGCOL_PRESS_CONTROL)); // "; Press 'Control' to drop 'Inside'"; break; case NO_TARGET: if (IsInside) { DragString += String_256(_R(IDS_DRAGCOL_DROP_SETPAGEBACKGROUND)); // "Drop to set the fill colour of the page background"; } else { DragString += String_64(_R(IDS_DRAGCOL_DROP_SET_CURRENT_FILL_COLOUR)); // "Drop to set the 'current fill colour' attribute"; } break; }; *TheText = DragString; return TRUE; } return FALSE; }
UINT32 ColourDragInformation::GetCursorID() { return(_R(IDC_DRAGGING_COLOUR)); }
UINT32 ColourDragInformation::GetCursorID(DragTarget* pDragTarget) { if (pDragTarget->IS_KIND_OF(ViewDragTarget)) { PageDropInfo PageDropInfo; ((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo); // NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit; ObjectDragTarget TargetHit = PageDropInfo.TargetHit; ClickModifiers ClickMods = ClickModifiers::GetClickModifiers(); BOOL IsInside = ClickMods.Constrain; // Removed by Will 23/1/96 // This code was needed originally, but is no longer needed as the // colour drop testing code is much smarter and copes with the case // that this code is testing for. // if (!IsInside && pObjectHit && pObjectHit->IsCompound()) // { // TargetHit = MANY_TARGET; // } switch (TargetHit) { case FILL_TARGET: return IsInside ? _R(IDC_DROPINSIDEONFILL) : _R(IDC_CANDROPONFILL); case LINE_TARGET: return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE); case STARTCOL_TARGET: return IsInside ? _R(IDC_DROPINSIDEONFILLSTART) : _R(IDC_CANDROPONFILLSTART); case ENDCOL_TARGET: return IsInside ? _R(IDC_DROPINSIDEONFILLEND) : _R(IDC_CANDROPONFILLEND); case ENDCOL2_TARGET: return IsInside ? _R(IDC_DROPINSIDEONFILLEND2) : _R(IDC_CANDROPONFILLEND2); case ENDCOL3_TARGET: return IsInside ? _R(IDC_DROPINSIDEONFILLEND3) : _R(IDC_CANDROPONFILLEND3); case MANY_TARGET: return IsInside ? _R(IDC_DROPINSIDEONFILL) : _R(IDC_CANDROPONFILL); case NO_TARGET: // colour drag - drop = page fill, CTRL + drop = set current fill return IsInside ? _R(IDC_CANFILLPAGE) : _R(IDC_CANDROPONPAGE); //return _R(IDC_CANDROPONPAGE); }; return _R(IDC_CANDROPONPAGE); } return 0; }
BOOL HelpUsingGalleries() { return ShowHelp(HELP_CONTEXT, _R(IDH_Overview_Galleries)); }
BOOL HelpUsingTools() { return ShowHelp(HELP_CONTEXT, _R(IDH_Misc_Tools)); }
BOOL ScaleTab::CommitSection() { TRACEUSER( "Neville", _T("commit Scale section\n")); ERROR3IF(pPrefsDlg == NULL, "ScaleTab::CommitSection called with no dialog pointer"); BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The Scale tab identifier if (!ok) return TRUE; // Talk to View failed to return now // Ok has been pressed so take the values from this section of the dialog box // Takes the values in the dialog and sets the DimScale object accordingly. BOOL Valid=TRUE; // Flag for validity of value // BOOL State=FALSE; // Flag for state of button/switch BOOL SetOk=TRUE; // Preference value set ok // Section = Scale settings // Now check that we have the selected view still, just in case it has switched // without us being told about it or even we have no current document/view. // This may be a valid state now, so do not complain about it. DocView* pCurrentView = DocView::GetSelected(); if (pCurrentView != NULL) { // Only if there is a current view do we read the values. String_256 DrawingStr; String_256 RealStr; //TCHAR* pDrawingStr = DrawingStr; //TCHAR* pRealStr = RealStr; BOOL Active; // Get the values from the dialog box Active = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0, &Valid); DrawingStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_DRAWINGSCALE), &Valid); RealStr = pPrefsDlg->GetStringGadgetValue(_R(IDC_OPTS_REALSCALE), &Valid); Spread* pSpread = pCurrentView->GetFirstSelectedSpread(); // If no selected spread then use the visible spread if (pSpread == NULL) pSpread = pCurrentView->GetVisibleSpread(); // Only do the chnage if we have a valid spread pointer and we have changed something. if ( (pSpread != NULL) && ( (OldActiveState != Active) || (OldDrawingStr != DrawingStr) || (OldRealStr != RealStr) ) ) { pDimScale = pSpread->GetPtrDimScale(); if (pDimScale != NULL) { // Only if active is set do we need to try and set new strings // and hence a new drawing scale if (Active) { // Dim Scales can only be 32 characters long String_32 DrawingStr32 = _T(""); String_32 RealStr32 = _T(""); // Check if read in strings are longer than this if (DrawingStr.Length() > DrawingStr32.MaxLength()) { InformError(_R(IDE_OPTS_INVALIDDRAWSCALE)); return FALSE; } if (RealStr.Length() > RealStr32.MaxLength()) { InformError(_R(IDE_OPTS_INVALIDREALSCALE)); return FALSE; } RealStr32 = RealStr; DrawingStr32 = DrawingStr; // Try and set these strings as new drawing and real scales strings SetOk = pDimScale->SetDrawingScaleStr(DrawingStr32); if (!SetOk) { InformError(_R(IDE_OPTS_INVALIDDRAWSCALE)); return FALSE; } SetOk = SetOk && pDimScale->SetRealScaleStr(RealStr32); if (!SetOk) { InformError(_R(IDE_OPTS_INVALIDREALSCALE)); return FALSE; } // Now try to convert these into a new scaling factor if (SetOk) SetOk = SetOk && pDimScale->SetScaleFactor(); // If we failed in any of the conversions then warn the user and fail if (!SetOk) { InformError(_R(IDE_OPTS_INVALIDSCALING)); return FALSE; } } // Set up a possibly new active state pDimScale->SetActiveState(Active); } // Now tell other users of units/scaling factors that there they are likely // to need to update any currently displayed units. Document *pCurrentDoc = (Document *)pSpread->FindOwnerDoc(); BROADCAST_TO_ALL(OptionsChangingMsg(pCurrentDoc, OptionsChangingMsg::NEWUNITS)); // unfortunately pScopeDoc is NULL!, and since pCurrentDoc is calulated I thought it ought to use! - Ed 17/10/95 // BROADCAST_TO_ALL(OptionsChangingMsg(pScopeDocument, OptionsChangingMsg::OptionsState::NEWUNITS)); // Make sure the document is marked as modified. pCurrentDoc->SetModified(TRUE); // And note the new states OldActiveState = Active; OldDrawingStr = DrawingStr; OldRealStr = RealStr; } } // else // ERROR2(FALSE,_R(IDE_OPTS_READPREF_SCALE)); return TRUE; }
INT32 UnitListComponent::ExportUnitDefinition(BaseCamelotFilter *pFilter, Unit* pUnit) { #ifdef DO_EXPORT ERROR2IF(pFilter == NULL,0L,"UnitListComponent::ExportUnitDefinition null pFilter"); ERROR2IF(pUnit == NULL,0L,"UnitListComponent::ExportUnitDefinition null pUnit"); ERROR2IF(pDocUnitList == NULL,0L,"UnitListComponent::ExportUnitDefinition called with no doc unit list pointer"); ERROR2IF(pUnit->IsDefault(),0L,"UnitListComponent::ExportUnitDefinition trying to save default unit definition"); INT32 RecordNumber = 0L; // See if we have saved the unit definition out by checking our table // If so then do nothing CMapPtrToLong::iterator it = pExpUserUnitMap->find(pUnit); if (it!=pExpUserUnitMap->end()) return it->second; // Export the definition for this unit // First get all the details // UnitType type = pUnit->GetUnitType(); // Set up the prefix/suffix state for this user's unit. BOOL Prefix = pUnit->IsPrefix(); INT32 Tag = 0L; INT32 Size = 0L; if (Prefix) { Tag = TAG_DEFINE_PREFIXUSERUNIT; Size = TAG_DEFINE_PREFIXUSERUNIT_SIZE; } else { Tag = TAG_DEFINE_SUFFIXUSERUNIT; Size = TAG_DEFINE_SUFFIXUSERUNIT_SIZE; } // The main full name of the unit String_32 Name = pUnit->GetToken(); // And the abbreviation String_32 Abbrev = pUnit->GetSpecifier(); // If there are string names, then add it to this size // REMEMBER: We save out unicode strings and so we need to double the length of the returned string length Size += (Name.Length() + 1) * SIZEOF_XAR_UTF16; Size += (Abbrev.Length() + 1) * SIZEOF_XAR_UTF16; BOOL ok = TRUE; CXaraFileRecord Rec(Tag, Size); ok = Rec.Init(); // Write out the name and abbreviation for this unit if (ok) ok = Rec.WriteUnicode(Name); if (ok) ok = Rec.WriteUnicode(Abbrev); // The size of this unit, 0 if based on double UnitSize = pUnit->GetMillipoints(); if (ok) ok = Rec.WriteDOUBLE(UnitSize); // What unit this is based on UnitType BaseUnit = pUnit->GetBaseUnitType(); //INT32 ExportBaseUnit = GetExportUnitType(BaseUnit); INT32 ExportBaseUnit = GetWriteUnitReference(BaseUnit, pFilter); ERROR2IF(ExportBaseUnit == 0,FALSE,"bad base units reference!"); if (ok) ok = Rec.WriteINT32(ExportBaseUnit); // Write out the multipliers for this unit double BaseNumerator = 0.0; double BaseDenominator = 0.0; BaseNumerator = pUnit->GetBaseNumerator(); BaseDenominator = pUnit->GetBaseDenominator(); if (ok) ok = Rec.WriteDOUBLE(BaseNumerator); if (ok) ok = Rec.WriteDOUBLE(BaseDenominator); // Finally, write the record out to file // In the process get the record number that this was written out as if (ok) RecordNumber = pFilter->Write(&Rec); // Get the document comment // Add the unit to the user units map so we can remember the references of the // exported units and hence whether we have exported this before // Reference for this unit is the record number TRACEUSER( "Neville", _T("Exported user unit reference %d\n"), RecordNumber); try { (*pExpUserUnitMap)[pUnit] = RecordNumber; } catch (std::bad_alloc&) { ERROR1(FALSE, _R(IDS_OUT_OF_MEMORY)); } catch (...) { ERROR1(FALSE, _R(IDS_UNKNOWN_ERROR)); } return RecordNumber; #else return 0L; #endif }
BOOL ScaleTab::HandleMsg(DialogMsg* Msg) { TRACEUSER( "Neville", _T("HandleScaleMsg\n")); ERROR2IF(Msg == NULL,FALSE,"ScaleTab::Message null message received"); ERROR2IF(pPrefsDlg == NULL,FALSE,"ScaleTab::HandleMsg called with no dialog pointer"); BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_SCALE)); // The Scale tab identifier if (!ok) return TRUE; // page not present switch(Msg->DlgMsg) { case DIM_CREATE: // Initialise controls GreyStatus = FALSE; // we are ungreyed by default ok = InitSection(); if (!ok) InformError(); break; case DIM_LFT_BN_CLICKED: OptionsTabs::SetApplyNowState(TRUE); if (Msg->GadgetID == _R(IDC_OPTS_USESCALEFACTOR)) { BOOL Valid; BOOL Active = pPrefsDlg->GetLongGadgetValue(_R(IDC_OPTS_USESCALEFACTOR),0,1,0,&Valid); // Grey/ungrey the editable fields accordingly pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWINGSCALE), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALSCALE), Active); // Grey/ungrey the static text fields accordingly pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEEG), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_REALWORLD), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_DRAWING), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALETO2), Active); pPrefsDlg->EnableGadget(_R(IDC_OPTS_SCALEGROUP), Active); } break; case DIM_SELECTION_CHANGED: case DIM_TEXT_CHANGED: OptionsTabs::SetApplyNowState(TRUE); break; default: break; } return TRUE; }
BOOL OpBevel::ImportURL(WebAddress urlToGet) { //First, set up some variables. We must do this now because I'm //going to use a goto in a moment GenericDownloadParam* Param; OpDescriptor* pOpDesc; PathName pthTemp; //We want to import urlToGet using the best available filter //To get the best available filter, we simply download to the "All" filter //So get a pointer to the All filter Filter* pAllFilter=GetAllFilter(); //Check we found it if (pAllFilter==NULL) goto ReturnError; //Now, get ready to download the file. This is rather complex. //First create a new set of download parameters //This object will be deleted when the download finishes Param = new GenericDownloadParam; //Now find the generic download OpDescriptor pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_OPGENERICDOWNLOAD); //And check we found it if (pOpDesc==NULL) goto ReturnError; //Now, create a temporary file to download to pthTemp=FileUtil::GetTemporaryPathName(); //And now fill in our parameters Param->type = TYPE_HTML; Param->priority = AsynchDownload::PRIORITY_NORMAL; Param->strDescription = String_256(_R(IDS_HTMLIMPORT_FILEDOWNLOAD)); Param->file = pthTemp.GetPath(); Param->strURL = urlToGet.GetWebAddress(); Param->Output = NULL; Param->m_pFilter = pAllFilter; Param->m_Op = this; Param->pDoc = Document::GetCurrent(); //And, finally, start the download going, if we've got a URL to download if (!Param->strURL.IsEmpty()) pOpDesc->Invoke((OpParam*) Param); //And return TRUE return TRUE; ReturnError: if (Param) delete Param; return FALSE; }
BOOL OpMenuLoad::LoadFile(CCLexFile* pFileToLoad, UINT32 nPrefFilter) { // Make sure we have a valid file to load. /* TRACEUSER( "JustinF", _T("In OpMenuLoad::LoadFile(%p, %u)\n"), (LPVOID) pFileToLoad, nPrefFilter); */ ERROR3IF(!pFileToLoad, "Null CCLexFile* in OpMenuLoad::LoadFile"); // Find out the position of the filter selected by the user in the open dialog INT32 SelectedPos = 0; #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX) SelectedPos = BaseFileDialog::SelectedFilter; #endif // Go get the first filter in the list Filter* pFilter = Filter::GetFirst(); // Do we know which filter was used? (we know nothing about things in the recent file // list). If we don't, then use the preferred one, by default the generic filter. if (nPrefFilter != FILTERID_USERCHOICE || SelectedPos == 0) { // We know nothing. We will have to go and have a look at all the possibles // We will find the Filter Family and ask it to try and load the file. UINT32 nID = (nPrefFilter != FILTERID_USERCHOICE) ? nPrefFilter : FILTERID_GENERIC; while (pFilter != NULL && pFilter->FilterID != nID) { // Try the next filter pFilter = Filter::GetNext(pFilter); } } else { // We know which type of filter the user had selected in the file dialog // Find the filter that the user chose. while (pFilter != NULL) { // This is the filter? if (pFilter->GetFlags().CanImport && pFilter->pOILFilter->Position == SelectedPos) break; // Try the next filter pFilter = Filter::GetNext(pFilter); } } // Check that the Filter existed if (pFilter == NULL) { // It did not... InformError(_R(IDT_CANT_FIND_FILTER)); return FALSE; } // Get pointer to current doc 'cos we'll need it several times... Document* pCurDoc = Document::GetCurrent(); // If this is not a filter family, check for compatibility before asking // filter to load the file. // This means the user has chosen an explicit filter to handle the import PathName Path = pFileToLoad->GetPathName(); String_256 FilePath = Path.GetPath(); // FilePath will be null if a pathname is not valid if (!pFilter->IS_KIND_OF(FilterFamily) && !FilePath.IsEmpty()) { UINT32 Size = 1024; size_t FileSize; ADDR FilterBuf = pFilter->LoadInitialSegment(Path, &Size, &FileSize); // If there has been a problem in the load initial segment then fail now. if (FilterBuf == NULL) { // Tell the user about the problem and get out now while the goings good InformError(); return FALSE; } // Inform any filters that we are about to do a HowCompatible call. // This would allow a set of filters which have common functionality hidden in a // filter that cannot import and cannot export handle this call and hence set // itself up. This would allow it to maybe cache a result which should only be // checked by the first filter in the group. pFilter->PreHowCompatible(); // Change this to be less than 8 as the filters like the Accusoft forms return // 8 and 9 to make sure that they are last in the chain. if (pFilter->HowCompatible(Path, FilterBuf, Size, UINT32(FileSize)) < 8) { // Not 100% happy with this file - ask for confirmation. ErrorInfo Question; Question.ErrorMsg = _R(IDW_OPENQUERY_NOTSURE); Question.Button[0] = _R(IDB_OPENQUERY_OPEN); Question.Button[1] = _R(IDB_OPENQUERY_DONTOPEN); if ((ResourceID)AskQuestion(&Question) != _R(IDB_OPENQUERY_OPEN)) { // User asked for this to be cancelled. TRACEUSER( "Tim", _T("Filter compatibility was less than 10\n")); // Close the file, report the abort and finish. CCFree(FilterBuf); //InformMessage(_R(IDT_IMP_USERABORT)); return FALSE; } } // Get rid of initial file header CCFree(FilterBuf); } // we have to try and open the file try { // Found the Filter, so ask it to import the file please if (!pFilter->DoImport(this, pFileToLoad, pCurDoc)) { // Something went a bit wrong - tell the user what it was. // Only tell them if not special user cancelled error message if (Error::GetErrorNumber() != _R(IDN_USER_CANCELLED)) { // Only supress the error if not the special user abort error // ***** For now use the native EPS filter if (pFilter->FilterID == FILTERID_NATIVE_EPS && Error::GetErrorNumber() != _R(IDT_IMPORT_USERABORT)) { Error::ClearError(); InformError(_R(IDS_ERRORINARTFILE)); } else { // Tell the user what the problem was InformError(); wxMessageDialog dlg( NULL, _T( "Xara LX failed to load the design.\n\n") _T( "This is an early demonstration version of the program which does ") _T( "not yet support all of the data types that can appear in XAR designs."), _T("Load failed"), wxOK ); dlg.ShowModal() ; } } else { // otherwise remove the error so it won't get reported Error::ClearError(); } // and fail return FALSE; } } // See if there was a file io errir catch( CFileException ) { // Report the error if no one else did, otherwise clear it. if (Error::GetErrorNumber() != _R(IDN_USER_CANCELLED)) InformError(); else Error::ClearError(); // and fail return FALSE; } // Success. return TRUE; }
INT32 LibraryFile::Init(SuperGallery *ParentGal, PathName *APath, SGLibType Type, BOOL Updated, BOOL DoScroll) { #ifndef EXCLUDE_GALS if(ParentGal == NULL || APath == NULL || !Libraries.IsEmpty()) { ERROR3("LibraryFile::Init - NULL parameters are illegal OR Init called > 1 times"); if(!Libraries.IsEmpty()) return(Libraries.GetCount()); else return 0; } BOOL ok = TRUE; // Tidy up Path a bit String_256 OurPath(APath->GetPath()); LibraryFile::TidyUpSubPath(&OurPath); // Now point Path to the new pathname PathName ModifiedPath(OurPath); PathName *Path = &ModifiedPath; if(!ModifiedPath.IsValid()) { ERROR3("LibraryFile::Init -> Modified library path is invalid"); return 0; } // Remember the pathname and type MyPath = *Path; MyType = Type; ParentGallery = ParentGal; if(ParentGallery->IsKindOf(CC_RUNTIME_CLASS(LibraryGallery))) ParentLibraryGallery = (LibraryGallery *)ParentGal; else { ERROR3("LibraryFile::Init passed a non-library gallery - yikes..."); return 0; } // Need to reset the Quiet status before a stream of Library::Init calls ParentLibraryGallery->SetQuietStatus(FALSE); BOOL Retry = TRUE; while(Retry) { Retry = FALSE; // Would be nice to have a way of adding a file to a path in PathName... Is there one ? if(!SGLibOil::FileExists(Path)) { // We're opening the font gallery, but can't find the font library path - don't warn if(Type == SGLib_Font) return 0; // tell the user that the directory doesn't exist String_256 WarnMsg; String_256 DefaultIndex; String_256 IndexDesc; BOOL CanGenerate; ok = LibraryFile::GetSubIndexDetails(ParentLibraryGallery, &DefaultIndex, &IndexDesc, &CanGenerate); String_256 TmpPath(Path->GetLocation(FALSE)); LibraryFile::TidyUpSubPath(&TmpPath); // Taken out by Graham 30/10/97: If the gallery had no directory specified, //we used to throw a warning which said "do you want to specify another folder?" //We don't do this any more, because the default is to open all galleries empty and //then download stuff from the Xara web site #if 0 WarnMsg.MakeMsg(_R(IDS_BROWSE_OR_SCAN), (TCHAR *)IndexDesc, (TCHAR *)TmpPath); Error::SetError(0, WarnMsg, 0); INT32 ButtonPressed = InformWarning(0, _R(IDS_BROWSE), _R(IDS_RETRY), _R(IDS_CANCEL)/*, _R(IDS_HELP)*/); #else // WEBSTER INT32 ButtonPressed = 3; #endif // WEBSTER TRACEUSER( "Richard", _T("ButtonPressed: %d\n"), ButtonPressed); Error::ClearError(); switch(ButtonPressed) { case 1: { // Open the Browse dialog (or the Add.. dialog as it seems to be called now) PathName ThePath(*Path); // This returns FALSE if Cancel was hit, or an error occurred. if(!SGLibOil::GetLibPath(ParentLibraryGallery, &ThePath, CanGenerate, Type)) { ERROR3("GetLibPath returned FALSE in LF::Init"); return 0; } else { ModifiedPath = ThePath; if(!ModifiedPath.IsValid()) { ERROR3("LibraryFile::Init -> scanned library path is invalid"); return 0; } // Remember the pathname MyPath = ThePath; switch(Type) { case SGLib_ClipArt: case SGLib_Bitmap: LibClipartSGallery::DefaultLibraryPath = MyPath.GetPath(); LibClipartSGallery::ClipartPath = LibClipartSGallery::DefaultLibraryPath; break; case SGLib_ClipArt_WebThemes: LibClipartSGallery::DefaultLibraryPath = MyPath.GetPath(); LibClipartSGallery::WebThemePath = LibClipartSGallery::DefaultLibraryPath; break; #ifndef STANDALONE case SGLib_Texture: case SGLib_Fractal: LibFillsSGallery::DefaultLibraryPath = MyPath.GetPath(); break; case SGLib_Font: // WEBSTER-Martin-09/01/97 - Put back by Ranbir. //#ifndef WEBSTER FontsSGallery::DefaultLibraryPath = MyPath.GetPath(); break; // Not in webster so we get the error below //#endif // WEBSTER #endif default: ERROR2(FALSE,"Library::ScanForLocation Type not present!"); break; } } break; } case 2: Retry = TRUE; #if 0 { // Scan String_256 Result; if(!Library::ScanForLocation(Type, &Result)) { ERROR3("No libraries found..."); return 0; } if(!ModifiedPath.SetPathName(Result)) { ERROR3("LibraryFile::Init -> scanned library path is invalid"); return 0; } // Remember the pathname and type MyPath = *Path; } #endif break; case 3: // Cancel return 0; } } } // Wipe libraries added to gallery for scroll / redraw purposes... InitScrollRedrawSystem(); // Check the actual path exists if(SGLibOil::FileExists(Path)) { // Would be nice to have a way of adding a file to a path in PathName... Is there one ? String_256 IndexFile((const TCHAR *)Path->GetPath(TRUE)); // "%s\\XaraInfo\\index.txt" IndexFile += String_16(_R(IDS_LIBRARIES_XARAINFO_DIRNAME)); IndexFile += TEXT("\\") + String_16(_R(IDS_LIBRARIES_INDEX_FILENAME)); PathName IndexFilePath(IndexFile); if(!IndexFilePath.IsValid()) { ERROR3("LibraryFile::Init indexfilepath is invalid"); return 0; } CCDiskFile MainIndex; if (!MainIndex.InitLexer(FALSE)) { // SetError! ERROR3("LibraryFile::LibraryFile InitLexer failed"); return(0); } if(SGLibOil::FileExists(&IndexFilePath)) { // Count lines in index file INT32 Count = CountLines(&IndexFilePath); TRACEUSER( "Richard", _T("%d lines in index file\n"), Count); // Used for the percentage display INT32 CurrentGroupNumber = 0; // Just in case there's a slow job already going on... SmashSlowJob(); String_64 SlowJob(_R(IDS_LIBRARY_SCANNING)); BeginSlowJob(Count, FALSE, &SlowJob); // Now use the index file to create each group in turn if (MainIndex.open(IndexFilePath, ios::in)) { MainIndex.SetWhitespace(""); // Setting this to blank lets us read non-"'d strings MainIndex.SetDelimiters(","); // ,s delimit our fields MainIndex.SetCommentMarker('#'); // #'d lines are commented out MainIndex.SetStringDelimiters(""); // No string delimiters String_64 Directory; String_64 Description; String_64 SubIndex; String_64 Kind; LexTokenType TT; BOOL EscapePressed = FALSE; while(ok && !EscapePressed) { if(!MainIndex.GetToken()) break; // Get SubLib directory name // Keep reading tokens until we hit a normal one... (skips line ends and // comments for us TT = MainIndex.GetTokenType(); while (TT != TOKEN_NORMAL && ok) { ok = MainIndex.GetToken(); if(!ok) break; TT = MainIndex.GetTokenType(); ok = (TT != TOKEN_EOF); if(!ok) break; } if(!ok) break; Directory = MainIndex.GetTokenBuf(); KillLeadingSpaces(&Directory); if(!MainIndex.GetToken()) break; // Get ',' if(!MainIndex.GetToken()) break; // Get Description String_256 Description256; Description256 = MainIndex.GetTokenBuf(); KillLeadingSpaces(&Description256); Description256.Left(&Description, 60); if(!MainIndex.GetToken()) break; // Get ',' if(!MainIndex.GetToken()) break; // Get Sub Library Index name SubIndex = MainIndex.GetTokenBuf(); KillLeadingSpaces(&SubIndex); if(!MainIndex.GetToken()) break; // Get ',' if(!MainIndex.GetToken()) break; // Get type of files in sublib Kind = MainIndex.GetTokenBuf(); KillLeadingSpaces(&Kind); BOOL Match = FALSE; Match = ParentLibraryGallery->CheckForIndexMatch(&Kind); if(Match) { // Show status of additions EscapePressed = !ContinueSlowJob(CurrentGroupNumber++); // Sort pathname of sublib directory out String_256 SubP(Path->GetPath(TRUE)); SubP += Directory; PathName SubPath(SubP); if(!SubPath.IsValid()) { ERROR3("LibraryFile::Init - invalid subpath"); if(MainIndex.isOpen()) MainIndex.close(); EndSlowJob(); return 0; } // Go ahead and add the new group if(ok) { // Create the sub lib Library *NewSubLib = new Library; if (NewSubLib != NULL) { // Create the new group in the gallery (note the TRUE for create a virtualised one if // we can to save time / memory) if(NewSubLib->Init(ParentGal, &SubPath, &Description, &SubIndex, Type, Updated, TRUE)) { Libraries.AddTail(NewSubLib); // Keep track of libraries added for redraw purposes... AddNewFolderToScrollRedrawSystem(NewSubLib); } else { // This check is new, should be ok... delete NewSubLib; NewSubLib = NULL; ERROR3("Library::Init failed in LibraryFile::Init"); ok = FALSE; } } } } } } else { // Failed to open the index file... // SetError?! ERROR3("LibraryFile::LibraryFile couldn't open index file"); ok = FALSE; } EndSlowJob(); } else { // The directory given had no XaraInfo\index.txt file, maybe it's a sublib, check // For defaults... ok = CheckForSubIndexes(ParentGal, Path, Type, Updated); } // reclaim lexer-buffer memory MainIndex.DeinitLexer(); // And close the file if(MainIndex.isOpen()) MainIndex.close(); // Scroll / redraw the newly added groups... if(DoScroll) DoScrollRedraw(); } else { TRACEUSER( "Richard", _T("Path doesn't exist\n")); } // And return the number of items created return(Libraries.GetCount()); #endif return 0; }
//#include "oilcoord.h" - in camtypes.h [AUTOMATICALLY REMOVED] //#include "justin3.h" //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED] #include "mkshapes.h" #include "groupops.h" DECLARE_SOURCE("$Revision$"); CC_IMPLEMENT_DYNCREATE(DaveDlg, DialogOp) #define new CAM_DEBUG_NEW // Set up the dialog box details stored as statics in the class CDlgResID DaveDlg::IDD = _R(IDD_DAVES_DLG); const CDlgMode DaveDlg::Mode = MODELESS; BOOL DaveDlg::DontHandleNextMessage = FALSE; BOOL DaveDlg::DialogWasCancelled = FALSE; WebAddress DaveDlg::ms_url = WebAddress(); /****************************************************************************************** > BOOL DaveDlg::OpenAndGetURL(WebAddress* purlToReturn) Author: Graham_Walmsley (Xara Group Ltd) <*****@*****.**> Created: 6/6/97 Inputs: -
BOOL LibraryFile::CheckForSubIndexes(SuperGallery *ParentGal, PathName *Path, SGLibType Type, BOOL Updated) { // The directory given had no XaraInfo\index.txt file, maybe it's a sublib, check // For defaults... String_256 DefaultIndex; String_256 IndexDesc; BOOL CanGenerate; BOOL ok = TRUE; // Need to reset the Quiet status before a stream of Library::Init calls ParentLibraryGallery->SetQuietStatus(FALSE); if(GetSubIndexDetails(ParentLibraryGallery, &DefaultIndex, &IndexDesc, &CanGenerate)) { String_256 SubP(Path->GetPath(TRUE)); // "%s\\XaraInfo\\%s" SubP += String_16(_R(IDS_LIBRARIES_XARAINFO_DIRNAME)); SubP += TEXT("\\") + DefaultIndex; PathName SubPath(SubP); if(!SubPath.IsValid()) { ERROR3("LibraryFile::CheckForSubIndexes invalid subpath"); return FALSE; } BOOL Generate = FALSE; BOOL Found = FALSE; // Is there a default sub index ? Found = SGLibOil::FileExists(&SubPath); if(!Found && CanGenerate) { if(Library::RemoteIndexes && GenerateIndexFile::IsDirectoryReadOnly(Path)) { // Check whether there's a 'temporary' index for this directory, and // possibly use that instead of the read only directory... String_256 RemoteLocationOfIndex; BOOL Existing = GenerateIndexFile::CheckForRemote(Path, &RemoteLocationOfIndex); if(Existing) { String_256 SubP(RemoteLocationOfIndex); // %s\\XaraInfo\\%s SGLibOil::AppendSlashIfNotPresent(&SubP); SubP += String_16(_R(IDS_LIBRARIES_XARAINFO_DIRNAME)); SubP += TEXT("\\") + DefaultIndex; PathName TmpSubPath(SubP); Found = SGLibOil::FileExists(&TmpSubPath); // OK, so there's a remote index sitting pretty in the user's temporary // location... Use that and don't bother generating a new one... if(Found) { SubPath.SetPathName(SubP); Path->SetPathName(RemoteLocationOfIndex); } } } if(!Found) { // tell the user that there is no index file, and ask if they want one generating String_256 WarnMsg; String_256 TmpPath(SubPath.GetLocation(FALSE)); LibraryFile::TidyUpSubPath(&TmpPath); WarnMsg.MakeMsg(_R(IDS_LIBRARY_NO_INDEX_FILE_GEN), (TCHAR *)IndexDesc, (TCHAR *)TmpPath); Error::SetError(0, WarnMsg, 0); //INT32 ButtonPressed = InformMessage(0, _R(IDS_NOTHUMBNAILS), _R(IDS_THUMBNAILS), _R(IDS_CANCEL)/*, _R(IDS_HELP)*/); INT32 ButtonPressed = InformMessage(0, _R(IDS_CREATE), _R(IDS_CANCEL)); Error::ClearError(); if(ButtonPressed < 2) { // Generate an index... String_64 Author(PRODUCT_NAME); Generate = GenerateDefaultIndex(&SubPath, Path, &Author, Type, TRUE); ok = TRUE; } else { // Cancel or help clicked ok = FALSE; } } } if(!Found && !CanGenerate) { // tell the user that there is no index file, and give them a cancel... String_256 WarnMsg; String_256 TmpPath(SubPath.GetLocation(FALSE)); LibraryFile::TidyUpSubPath(&TmpPath); WarnMsg.MakeMsg(_R(IDS_LIBRARY_NO_INDEX_FILE), (TCHAR *)IndexDesc, (TCHAR *)TmpPath); Error::SetError(0, WarnMsg, 0); INT32 ButtonPressed = InformWarning(0, _R(IDS_CANCEL), NULL); Error::ClearError(); ok = FALSE; } // Check again... Found = SGLibOil::FileExists(&SubPath); if((Found && ok) || (!Found && Generate && ok)) { String_256 Description256 = Path->GetPath(); AbbreviateName(Description256, 60, TRUE); String_64 Description(Description256); BOOL DoAgain = TRUE; while (DoAgain) { DoAgain = FALSE; // Create the sub lib Library *NewSubLib = new Library; if (NewSubLib != NULL) { String_64 DefIndex64(DefaultIndex); String_256 PathToAdd256 = SubPath.GetLocation(FALSE); TidyUpSubPath(&PathToAdd256); PathName PathToAdd(PathToAdd256); Error::ClearError(); // Create the actual group itself if(NewSubLib->Init(ParentGal, &PathToAdd, &Description, &DefIndex64, Type, Updated)) { Libraries.AddTail(NewSubLib); ok = TRUE; // Keep track of libraries added for redraw purposes... AddNewFolderToScrollRedrawSystem(NewSubLib); } else { delete NewSubLib; NewSubLib = NULL; String_256 WarnMsg; String_256 SmallPath; PathToAdd256.Left(&SmallPath, 150); // "The index for '%s' seems to be invalid and requires updating." WarnMsg.MakeMsg(_R(IDS_LIBRARY_DODGY_INDEX), (TCHAR *)SmallPath); Error::SetError(0, WarnMsg, 0); INT32 Button = InformWarning(0, _R(IDS_GENERATE), _R(IDS_CANCEL)); Error::ClearError(); String_256 IPathToAdd256(PathToAdd256); SGLibOil::AppendSlashIfNotPresent(&IPathToAdd256); IPathToAdd256 += TEXT("indexfle.txt"); // This is just to check we can write ok... PathName IPathToAdd(IPathToAdd256); if(Button == 1) DoAgain = SGLibOil::GenerateClicked(ParentLibraryGallery, &IPathToAdd); if(!DoAgain) ok = FALSE; Error::ClearError(); } } } } } return ok; }
BOOL AttrWebAddress::WritePreChildrenWeb(BaseCamelotFilter* pFilter) { #ifdef DO_EXPORT //Check our incoming parameter ERROR2IF(pFilter == NULL,FALSE,"AttrWebAddress::WritePreChildrenWeb - NULL parameter"); //Set up some variables. //This pointer points to the record we are currently writing CamelotFileRecord* pRecord=NULL; // Add a description of the TAG_MOULD_BOUNDS record, for older importers that don't understand this record pFilter->AddTagDescription(TAG_WEBADDRESS,_R(IDS_TAG_WEBADDRESS)); //And this lets us know whether there's been an error BOOL ok=TRUE; //Now, is the clickable area of this attribute the bounding box? if (Value.m_fBounding) { //Yes it is. //So create a "bounding box" record pRecord=new CamelotFileRecord(pFilter,TAG_WEBADDRESS_BOUNDINGBOX,TAG_WEBADDRESS_SIZE); //Check it's been created OK ok=(pRecord!=NULL); //Initialise it if (ok) pRecord->Init(); //We also want to write out the start of the record, which is the clickable //rectangle of this record //So get the clickable rectangle DocRect rectBounding=GetClickableRectangle(); //And write it out pRecord->WriteCoordInterleaved(rectBounding.lo); pRecord->WriteCoordInterleaved(rectBounding.hi); } else { //No, the clickable area of this attribute is the object shape //So create a normal Web Address record pRecord=new CamelotFileRecord(pFilter,TAG_WEBADDRESS,TAG_WEBADDRESS_SIZE); //And check it's been created OK ok=(pRecord!=NULL); //Initialise it if (ok) pRecord->Init(); } //The rest of the data we need to write out is common to both types of record. //We need to write out the URL and Frame strings, in that order. //So write out the URL string String_256 strToWrite=Value.m_url.GetWebAddress(); if (ok) ok=WriteString(pRecord, strToWrite); //And the Frame string //We do this using our toolkit function WriteString. This function //will write out a NULL character if the character pointer we pass it //is NULL if (ok) ok=WriteString(pRecord, Value.m_pcFrame); //And write out our record if (ok) ok = pFilter->Write(pRecord); //And delete it delete pRecord; return ok; #else return FALSE; #endif }
void RT_CALL CbWriteSeparator() { RtWriteStringToConsole(_R("============\n")); }
void InfoBarOp::EnableLayerControl() { EnableGadget(_R(IDC_LAYER_COMBO), TRUE ); EnableGadget(_R(IDC_INVOKE_LYR_DLG), TRUE ); }
void RT_CALL CbWriteMenuTitle(RT_CHAR* lpLabel) { RtWriteStringsToConsole(3, _R("\n"), lpLabel, _R(" menu\n\n")); }
//#include "urlres.h" //URL dialog resources //#include "resimmap.h" //URL import string resources //#include "msg.h" - in camtypes.h [AUTOMATICALLY REMOVED] #include "xshelpid.h" //For the help ID DECLARE_SOURCE("$Revision$"); CC_IMPLEMENT_DYNCREATE(URLImportDlg, DialogOp) #define new CAM_DEBUG_NEW // Set up the dialog box details stored as statics in the class CDlgResID URLImportDlg::IDD = _R(IDD_URLIMPORT); const CDlgMode URLImportDlg::Mode = MODAL; BOOL URLImportDlg::DontHandleNextMessage = FALSE; BOOL URLImportDlg::DialogWasCancelled = FALSE; WebAddress URLImportDlg::ms_url = WebAddress(); /****************************************************************************************** > BOOL URLImportDlg::OpenAndGetURL(WebAddress* purlToReturn) Author: Graham_Walmsley (Xara Group Ltd) <*****@*****.**>
CDlgResID ScaleTab::GetPageID() { return _R(IDD_OPTSTAB_SCALE); }
void URLImportDlg::OnCreate() { //Put the keyboard focus in the edit field SetKeyboardFocus(_R(IDC_URLIMPORT_URL)); }
void SGDisplayDATATYPE::GetNameText(String_256 *Result) { ERROR3IF(Result == NULL, "Illegal NULL param"); *Result = _R(IDS_SGBASE_EXAMPLE_TEXT); // TEXT("Example Item"); }