示例#1
0
		private void InternalResetVisibleRows()
		{
//			if (System.DateTime.Now > new DateTime (2002,12,31))
//			{
//				
//				this.mDocument = new RowCollection ();
//				this.Add ("BETA VERSION EXPIRED");
//				VisibleRows = this.mDocument;
//				return;
//			}

			if (!this.mFolding)
			{
				VisibleRows = mDocument;
				this.NeedResetRows = false;
			}
			else
			{
				this.NeedResetRows = false;
				VisibleRows = new RowCollection(); //.Clear ();			
				int RealRow = 0;
				Row r = null;
				for (int i = 0; i < this.Count; i++)
				{
					r = this[RealRow];
					VisibleRows.Add(r);
					bool collapsed = false;
					if (r.CanFold)
						if (r.Expansion_StartSegment.Expanded == false)
						{
							if (r.Expansion_StartSegment.EndWord == null)
							{
							}
							else
							{
								r = r.Expansion_EndRow; // .Expansion_StartSegment.EndRow;
								collapsed = true;
							}
						}

					if (!collapsed)
						RealRow++;
					else
						RealRow = this.IndexOf(r) + 1;

					if (RealRow >= this.Count)
						break;
				}
			}
		}
示例#2
0
			// Construction

			public Enumerator(RowCollection tc)
			{
				m_collection = tc;
				m_index = -1;
				m_version = tc.m_version;
			}
示例#3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="collection"></param>
		public RowCollection(RowCollection collection)
		{
			AddRange(collection);
		}
示例#4
0
		/// <summary>
/// 
/// </summary>
/// <param name="collection"></param>
		public void AddRange(RowCollection collection)
		{
			// for (int i=0; i < collection.Count; ++i) Add(collection[i]);

			++m_version;

			Capacity += collection.Count;
			Array.Copy(collection.m_array, 0, this.m_array, m_count, collection.m_count);
			m_count += collection.Count;
		}
示例#5
0
		// Operations (type-safe ICloneable)
		/// <summary>
/// 
/// </summary>
/// <returns></returns>
		public RowCollection Clone()
		{
			RowCollection tc = new RowCollection();
			tc.AddRange(this);
			tc.Capacity = this.m_array.Length;
			tc.m_version = this.m_version;
			return tc;
		}
示例#6
0
		//Override the OnPrintPage to provide the printing logic for the document
		protected override void OnPrintPage(PrintPageEventArgs ev)
		{
			float lpp = 0;
			float yPos = 0;
			int count = 0;
			float leftMargin = ev.MarginBounds.Left;
			float rightMargin = ev.MarginBounds.Right;
			float topMargin = ev.MarginBounds.Top;
			//ev.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

			if (rc == null)
			{
				Document.ParseAll();
				Document.ParseAll(true);


				rc = new RowCollection();
				foreach (Row r in Document)
				{
					bool hasbreak = false;
					float x = leftMargin;
					Row newRow = new Row();
					rc.Add(newRow);
					foreach (Word w in r)
					{
						Font f = fontNormal;
						if (w.Style != null)
						{
							FontStyle fs = 0;

							if (w.Style.Bold)
								fs |= FontStyle.Bold;

							if (w.Style.Italic)
								fs |= FontStyle.Italic;

							if (w.Style.Underline)
								fs |= FontStyle.Underline;

							f = new Font("Courier new", 8, fs);
						}
						SizeF sf = ev.Graphics.MeasureString(w.Text, f);
						if (x + sf.Width > rightMargin)
						{
							char chr = (char) 0xbf;
							Word br = new Word();
							br.Text = chr + "";
							br.InfoTip = "break char";
							newRow.Add(br);
							hasbreak = true;


							newRow = new Row();
							rc.Add(newRow);
							x = leftMargin;
						}
						x += sf.Width;
						newRow.Add(w);


					}
					if (hasbreak)
					{
						rc.Add(new Row());
					}
				}
			}
			//------------------------------------------------------

			base.OnPrintPage(ev);


			lpp = ev.MarginBounds.Height/fontNormal.GetHeight(ev.Graphics);


			while (count < lpp && (RowIndex < rc.Count))
			{
				float x = leftMargin;
				yPos = topMargin + (count*fontNormal.GetHeight(ev.Graphics));

				Row r = rc[RowIndex];

				foreach (Word w in r)
				{
					if (w.InfoTip != null && w.InfoTip == "break char")
					{
						ev.Graphics.DrawString(w.Text, fontBreak, Brushes.Black, x, yPos, new StringFormat());
					}
					else
					{
						SizeF sf = ev.Graphics.MeasureString(w.Text, fontNormal);

						if (w.Text != null && (".,:;".IndexOf(w.Text) >= 0))
						{
							sf.Width = 6;
							x -= 4;
						}
						if (w.Text == "\t")
						{
							sf.Width = ev.Graphics.MeasureString("...", fontNormal).Width;
						}


						Color c = Color.Black;
						Font f = fontNormal;
						if (w.Style != null)
						{
							c = w.Style.ForeColor;
							FontStyle fs = 0;

							if (w.Style.Bold)
								fs |= FontStyle.Bold;

							if (w.Style.Italic)
								fs |= FontStyle.Italic;

							if (w.Style.Underline)
								fs |= FontStyle.Underline;

							f = new Font("Courier new", 8, fs);

							if (!w.Style.Transparent)
							{
								Color bg = w.Style.BackColor;
								ev.Graphics.FillRectangle(new SolidBrush(bg), x, yPos, sf.Width, fontNormal.GetHeight(ev.Graphics));


							}

						}

						c = Color.FromArgb(c.R, c.G, c.B);


						ev.Graphics.DrawString(w.Text, f, new SolidBrush(c), x, yPos, new StringFormat());
						x += sf.Width;
					}
				}

				count++;
				RowIndex++;
			}

			//If we have more lines then print another page
			if (RowIndex < rc.Count)
				ev.HasMorePages = true;
			else
				ev.HasMorePages = false;
		}