Esempio n. 1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initialize a new CmPicture by creating a copy of the file in the given folder and
 /// hooking everything up. Put the caption in the default vernacular writing system.
 /// </summary>
 /// <param name="srcFilename">The path to the original filename (an internal copy will
 /// be made in this method)</param>
 /// <param name="captionTss">The caption (in the default vernacular Writing System)</param>
 /// <param name="description">Illustration description in English. This is not published.</param>
 /// <param name="layoutPos">Indication of where in the column/page the picture is to be
 /// laid out.</param>
 /// <param name="scaleFactor">Integral percentage by which picture is grown or shrunk.</param>
 /// <param name="locationRangeType">Indicates the type of data contained in LocationMin
 /// and LocationMax.</param>
 /// <param name="locationMin">The minimum Scripture reference at which this picture can
 /// be laid out.</param>
 /// <param name="locationMax">The maximum Scripture reference at which this picture can
 /// be laid out.</param>
 /// <param name="copyright">Publishable information about the copyright that should
 /// appear on the copyright page of the publication.</param>
 /// <param name="sFolder">The name of the CmFolder where picture should be stored</param>
 /// ------------------------------------------------------------------------------------
 private void InitializeNewPicture(string srcFilename, ITsString captionTss,
                                   string description, PictureLayoutPosition layoutPos, int scaleFactor,
                                   PictureLocationRangeType locationRangeType, int locationMin, int locationMax,
                                   string copyright, string sFolder)
 {
     InitializeNewPicture(srcFilename, captionTss, description, layoutPos, scaleFactor,
                          locationRangeType, locationMin, locationMax, copyright, sFolder,
                          m_cache.DefaultVernWs);
 }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize a new CmPicture by creating a copy of the file in the given folder and
        /// hooking everything up.
        /// </summary>
        /// <param name="srcFilename">The path to the original filename (an internal copy will
        /// be made in this method)</param>
        /// <param name="captionTss">The caption (in the given Writing System)</param>
        /// <param name="description">Illustration description in English. This is not
        /// published.</param>
        /// <param name="layoutPos">Indication of where in the column/page the picture is to be
        /// laid out.</param>
        /// <param name="scaleFactor">Integral percentage by which picture is grown or shrunk.</param>
        /// <param name="locationRangeType">Indicates the type of data contained in LocationMin
        /// and LocationMax.</param>
        /// <param name="locationMin">The minimum Scripture reference at which this picture can
        /// be laid out.</param>
        /// <param name="locationMax">The maximum Scripture reference at which this picture can
        /// be laid out.</param>
        /// <param name="copyright">Publishable information about the copyright that should
        /// appear on the copyright page of the publication.</param>
        /// <param name="sFolder">The name of the CmFolder where picture should be stored
        /// </param>
        /// <param name="ws">The WS of the caption and copyright</param>
        /// ------------------------------------------------------------------------------------
        public void InitializeNewPicture(string srcFilename, ITsString captionTss,
                                         string description, PictureLayoutPosition layoutPos, int scaleFactor,
                                         PictureLocationRangeType locationRangeType, int locationMin, int locationMax,
                                         string copyright, string sFolder, int ws)
        {
            // Set the caption first since creating the CmFile will throw if srcFilename is empty.
            if (captionTss != null)
            {
                Caption.SetAlternative(captionTss, ws);
            }
            // Locate CmFolder with given name or create it, if neccessary
            ICmFolder folder = CmFolder.FindOrCreateFolder(m_cache, (int)LangProject.LangProjectTags.kflidPictures, sFolder);

            PictureFileRA = CmFile.FindOrCreateFile(folder, srcFilename);
            int wsEn = Cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en");

            if (!String.IsNullOrEmpty(description) && wsEn > 0)
            {
                Description.SetAlternative(description, wsEn);
            }
            LayoutPos         = layoutPos;
            ScaleFactor       = scaleFactor;
            LocationRangeType = locationRangeType;
            LocationMin       = locationMin;
            LocationMax       = locationMax;
            if (!string.IsNullOrEmpty(copyright))
            {
                string sExistingCopyright = PictureFileRA.Copyright.GetAlternative(ws).Text;
                if (sExistingCopyright != null && sExistingCopyright != copyright)
                {
                    Logger.WriteEvent("Could not update copyright for picture " +
                                      PictureFileRA.AbsoluteInternalPath + " to '" + copyright + "'");
                    return;
                }
                PictureFileRA.Copyright.SetAlternative(copyright, ws);
            }
        }
Esempio n. 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize a new CmPicture by creating a copy of the file in the given folder and
		/// hooking everything up.
		/// </summary>
		/// <param name="srcFilename">The path to the original filename (an internal copy will
		/// be made in this method)</param>
		/// <param name="captionTss">The caption (in the given Writing System)</param>
		/// <param name="description">Illustration description in English. This is not
		/// published.</param>
		/// <param name="layoutPos">Indication of where in the column/page the picture is to be
		/// laid out.</param>
		/// <param name="scaleFactor">Integral percentage by which picture is grown or shrunk.</param>
		/// <param name="locationRangeType">Indicates the type of data contained in LocationMin
		/// and LocationMax.</param>
		/// <param name="locationMin">The minimum Scripture reference at which this picture can
		/// be laid out.</param>
		/// <param name="locationMax">The maximum Scripture reference at which this picture can
		/// be laid out.</param>
		/// <param name="copyright">Publishable information about the copyright that should
		/// appear on the copyright page of the publication.</param>
		/// <param name="sFolder">The name of the CmFolder where picture should be stored
		/// </param>
		/// <param name="ws">The WS of the caption and copyright</param>
		/// ------------------------------------------------------------------------------------
		public void InitializeNewPicture(string srcFilename, ITsString captionTss,
			string description, PictureLayoutPosition layoutPos, int scaleFactor,
			PictureLocationRangeType locationRangeType, int locationMin, int locationMax,
			string copyright, string sFolder, int ws)
		{
			// Set the caption first since creating the CmFile will throw if srcFilename is empty.
			if (captionTss != null)
				Caption.SetAlternative(captionTss, ws);
			// Locate CmFolder with given name or create it, if neccessary
			ICmFolder folder = CmFolder.FindOrCreateFolder(m_cache, (int)LangProject.LangProjectTags.kflidPictures, sFolder);
			PictureFileRA = CmFile.FindOrCreateFile(folder, srcFilename);
			int wsEn = Cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en");
			if (!String.IsNullOrEmpty(description) && wsEn > 0)
				Description.SetAlternative(description, wsEn);
			LayoutPos = layoutPos;
			ScaleFactor = scaleFactor;
			LocationRangeType = locationRangeType;
			LocationMin = locationMin;
			LocationMax = locationMax;
			if (!string.IsNullOrEmpty(copyright))
			{
				string sExistingCopyright = PictureFileRA.Copyright.GetAlternative(ws).Text;
				if (sExistingCopyright != null && sExistingCopyright != copyright)
				{
					Logger.WriteEvent("Could not update copyright for picture " +
						PictureFileRA.AbsoluteInternalPath + " to '" + copyright + "'");
					return;
				}
				PictureFileRA.Copyright.SetAlternative(copyright, ws);
			}
		}
Esempio n. 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize a new CmPicture by creating a copy of the file in the given folder and
		/// hooking everything up. Put the caption in the default vernacular writing system.
		/// </summary>
		/// <param name="srcFilename">The path to the original filename (an internal copy will
		/// be made in this method)</param>
		/// <param name="captionTss">The caption (in the default vernacular Writing System)</param>
		/// <param name="description">Illustration description in English. This is not published.</param>
		/// <param name="layoutPos">Indication of where in the column/page the picture is to be
		/// laid out.</param>
		/// <param name="scaleFactor">Integral percentage by which picture is grown or shrunk.</param>
		/// <param name="locationRangeType">Indicates the type of data contained in LocationMin
		/// and LocationMax.</param>
		/// <param name="locationMin">The minimum Scripture reference at which this picture can
		/// be laid out.</param>
		/// <param name="locationMax">The maximum Scripture reference at which this picture can
		/// be laid out.</param>
		/// <param name="copyright">Publishable information about the copyright that should
		/// appear on the copyright page of the publication.</param>
		/// <param name="sFolder">The name of the CmFolder where picture should be stored</param>
		/// ------------------------------------------------------------------------------------
		private void InitializeNewPicture(string srcFilename, ITsString captionTss,
			string description, PictureLayoutPosition layoutPos, int scaleFactor,
			PictureLocationRangeType locationRangeType, int locationMin, int locationMax,
			string copyright, string sFolder)
		{
			InitializeNewPicture(srcFilename, captionTss, description, layoutPos, scaleFactor,
				locationRangeType, locationMin, locationMax, copyright, sFolder,
				m_cache.DefaultVernWs);
		}
Esempio n. 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize a new CmPicture by creating a copy of the file in the given folder and
		/// hooking everything up.
		/// </summary>
		/// <param name="srcFilename">The path to the original filename (an internal copy will
		/// be made in this method)</param>
		/// <param name="captionTss">The caption (in the given Writing System)</param>
		/// <param name="description">Illustration description in English. This is not
		/// published.</param>
		/// <param name="layoutPos">Indication of where in the column/page the picture is to be
		/// laid out.</param>
		/// <param name="scaleFactor">Integral percentage by which picture is grown or shrunk.</param>
		/// <param name="locationRangeType">Indicates the type of data contained in LocationMin
		/// and LocationMax.</param>
		/// <param name="locationMin">The minimum Scripture reference at which this picture can
		/// be laid out.</param>
		/// <param name="locationMax">The maximum Scripture reference at which this picture can
		/// be laid out.</param>
		/// <param name="copyright">Publishable information about the copyright that should
		/// appear on the copyright page of the publication.</param>
		/// <param name="sFolder">The name of the CmFolder where picture should be stored
		/// </param>
		/// <param name="ws">The WS of the caption and copyright</param>
		/// ------------------------------------------------------------------------------------
		private ICmPicture Create(string srcFilename, ITsString captionTss, string description,
			PictureLayoutPosition layoutPos, int scaleFactor,
			PictureLocationRangeType locationRangeType, int locationMin, int locationMax,
			string copyright, string sFolder, int ws)
		{
			ICmPicture pic = Create();
			pic.UpdatePicture(srcFilename, captionTss, sFolder, ws);
			int wsEn = m_cache.LanguageWritingSystemFactoryAccessor.GetWsFromStr("en");
			if (!String.IsNullOrEmpty(description) && wsEn > 0)
				pic.Description.set_String(wsEn, description);
			pic.LayoutPos = layoutPos;
			pic.ScaleFactor = scaleFactor;
			pic.LocationRangeType = locationRangeType;
			pic.LocationMin = locationMin;
			pic.LocationMax = locationMax;
			if (!string.IsNullOrEmpty(copyright))
				pic.PictureFileRA.Copyright.set_String(ws, copyright);
			return pic;
		}