Exemplo n.º 1
1
        public override void Execute(TextArea textArea)
        {
            Point position = textArea.Caret.Position;
            List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldedFoldingsWithEnd(position.Y);
            FoldMarker justBeforeCaret = null;
            foreach (FoldMarker fm in foldings) {
                if (fm.EndColumn == position.X) {
                    justBeforeCaret = fm;
                    break; // the first folding found is the folding with the smallest Startposition
                }
            }

            if (justBeforeCaret != null) {
                position.Y = justBeforeCaret.StartLine;
                position.X = justBeforeCaret.StartColumn;
            } else {
                if (position.X > 0) {
                    --position.X;
                } else if (position.Y  > 0) {
                    LineSegment lineAbove = textArea.Document.GetLineSegment(position.Y - 1);
                    position = new Point(lineAbove.Length, position.Y - 1);
                }
            }

            textArea.Caret.Position = position;
            textArea.SetDesiredColumn();
        }
Exemplo n.º 2
0
 public override void Execute(TextArea textArea)
 {
     foreach (FoldMarker fm in  textArea.Document.FoldingManager.FoldMarker) {
         fm.IsFolded = fm.FoldType == FoldType.MemberBody || fm.FoldType == FoldType.Region;
     }
     //textArea.Refresh();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Executes the action on a certain <see cref="TextArea"/>.
        /// </summary>
        /// <param name="textArea">The text area on which to execute the action.</param>
        public override void Execute(TextArea textArea)
        {
            foreach (Fold fold in textArea.Document.FoldingManager.Folds)
            fold.IsFolded = _predicate(fold);

              textArea.Document.FoldingManager.NotifyFoldingChanged(EventArgs.Empty);
        }
Exemplo n.º 4
0
        public override void Initialize()
        {
            base.Initialize();

            TextArea loveletter = new TextArea("Hello, World!", 1, 20);
            AddComponent(loveletter, 20, 200);
        }
Exemplo n.º 5
0
        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.SelectionManager.HasSomethingSelected) {
                Delete.DeleteSelection(textArea);
            } else {
                if (textArea.Caret.Offset > 0 && !textArea.IsReadOnly(textArea.Caret.Offset - 1)) {
                    textArea.BeginUpdate();
                    int curLineNr     = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset);
                    int curLineOffset = textArea.Document.GetLineSegment(curLineNr).Offset;

                    if (curLineOffset == textArea.Caret.Offset) {
                        LineSegment line = textArea.Document.GetLineSegment(curLineNr - 1);
                        int lineEndOffset = line.Offset + line.Length;
                        int lineLength = line.Length;
                        textArea.Document.Remove(lineEndOffset, curLineOffset - lineEndOffset);
                        textArea.Caret.Position = new TextLocation(lineLength, curLineNr - 1);
                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new TextLocation(0, curLineNr - 1)));
                    } else {
                        int caretOffset = textArea.Caret.Offset - 1;
                        textArea.Caret.Position = textArea.Document.OffsetToPosition(caretOffset);
                        textArea.Document.Remove(caretOffset, 1);

                        textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, new TextLocation(textArea.Caret.Offset - textArea.Document.GetLineSegment(curLineNr).Offset, curLineNr)));
                    }
                    textArea.EndUpdate();
                }
            }
        }
Exemplo n.º 6
0
		public static string GenerateRtf(TextArea textArea)
		{
			try {
				colors = new Hashtable();
				colorNum = 0;
				colorString = new StringBuilder();
				
				
				StringBuilder rtf = new StringBuilder();
				
				rtf.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1031");
				BuildFontTable(textArea.Document, rtf);
				rtf.Append('\n');
				
				string fileContent = BuildFileContent(textArea);
				BuildColorTable(textArea.Document, rtf);
				rtf.Append('\n');
				rtf.Append(@"\viewkind4\uc1\pard");
				rtf.Append(fileContent);
				rtf.Append("}");
				return rtf.ToString();
			} catch (Exception e) {
				Console.WriteLine(e.ToString());
			}
			return null;
		}
Exemplo n.º 7
0
 public override void Execute(TextArea textArea)
 {
     LineSegment curLine = textArea.Document.GetLineSegment(textArea.Caret.Line);
     Point position = textArea.Caret.Position;
     List<FoldMarker> foldings = textArea.Document.FoldingManager.GetFoldedFoldingsWithStart(position.Y);
     FoldMarker justBehindCaret = null;
     foreach (FoldMarker fm in foldings) {
         if (fm.StartColumn == position.X) {
             justBehindCaret = fm;
             break;
         }
     }
     if (justBehindCaret != null) {
         position.Y = justBehindCaret.EndLine;
         position.X = justBehindCaret.EndColumn;
     } else { // no folding is interesting
         if (position.X < curLine.Length || textArea.TextEditorProperties.AllowCaretBeyondEOL) {
             ++position.X;
         } else if (position.Y + 1 < textArea.Document.TotalNumberOfLines) {
             ++position.Y;
             position.X = 0;
         }
     }
     textArea.Caret.Position = position;
     textArea.SetDesiredColumn();
 }
Exemplo n.º 8
0
		/// <summary>
		/// Description
		/// </summary>
		private string GetIndentationSmart(TextArea textArea, int lineNumber) {
			if (lineNumber < 0 || lineNumber > textArea.Document.TotalNumberOfLines) {
				throw new ArgumentOutOfRangeException("lineNumber");
			}

			//! TODO:
			//			- search backward the last symbol
			//			- on { or ), indend by \t
			//			- think about more indentation style
			//			- remember last ) and set next indentation -1

			LineSegment lastLine = textArea.Document.GetLineSegment(lineNumber);
			if (lastLine == null || lastLine.Words.Count == 0) {
				// No text in the last line
				return "";
			}

			// Fetch leading space of last line
			string lastLeading = GetIndentation(textArea, lineNumber);
			TextWord lastWord = lastLine.Words[lastLine.Words.Count - 1];
			if (lastWord.Type != TextWordType.Word) {
				return lastLeading;
			}
			if (mIndentationChars.Contains(lastWord.Word.Trim()) == false) {
				return lastLeading;
			}

			return lastLeading + "\t";
		}
 public override void Execute(TextArea textArea)
 {
     if (textArea.Caret.Line != 0 || textArea.Caret.Column != 0) {
         textArea.Caret.Position = new Point(0, 0);
         textArea.SetDesiredColumn();
     }
 }
Exemplo n.º 10
0
		public override void Execute(TextArea textArea)
		{
			textArea.Document.BookmarkManager.ToggleMarkAt(textArea.Caret.Line);
			textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Caret.Line));
			textArea.Document.CommitUpdate();
			
		}
Exemplo n.º 11
0
        /// <summary>
        /// Executes the action on a certain <see cref="TextArea"/>.
        /// </summary>
        /// <param name="textArea">The text area on which to execute the action.</param>
        public override void Execute(TextArea textArea)
        {
            LineSegment curLine;
              TextLocation newPos = textArea.Caret.Position;
              bool jumpedIntoFolding;
              do
              {
            curLine = textArea.Document.GetLineSegment(newPos.Y);
            newPos.X = curLine.Length;

            List<Fold> foldings = textArea.Document.FoldingManager.GetFoldsFromPosition(newPos.Y, newPos.X);
            jumpedIntoFolding = false;
            foreach (Fold fold in foldings)
            {
              if (fold.IsFolded)
              {
            newPos = new TextLocation(fold.EndColumn, fold.EndLine);
            jumpedIntoFolding = true;
            break;
              }
            }
              } while (jumpedIntoFolding);

              if (newPos != textArea.Caret.Position)
              {
            textArea.Caret.Position = newPos;
            textArea.SetDesiredColumn();
              }
        }
Exemplo n.º 12
0
        /// <remarks>
        /// Executes this edit action
        /// </remarks>
        /// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.Document.ReadOnly) {
                return;
            }
            if (textArea.SelectionManager.HasSomethingSelected) {
                textArea.BeginUpdate();
                textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition;
                textArea.SelectionManager.RemoveSelectedText();
                textArea.ScrollToCaret();
                textArea.EndUpdate();
            } else {

                if (textArea.Caret.Offset < textArea.Document.TextLength) {
                    textArea.BeginUpdate();
                    int curLineNr   = textArea.Document.GetLineNumberForOffset(textArea.Caret.Offset);
                    LineSegment curLine = textArea.Document.GetLineSegment(curLineNr);

                    if (curLine.Offset + curLine.Length == textArea.Caret.Offset) {
                        if (curLineNr + 1 < textArea.Document.TotalNumberOfLines) {
                            LineSegment nextLine = textArea.Document.GetLineSegment(curLineNr + 1);

                            textArea.Document.Remove(textArea.Caret.Offset, nextLine.Offset - textArea.Caret.Offset);
                            textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToEnd, new Point(0, curLineNr)));
                        }
                    } else {
                        textArea.Document.Remove(textArea.Caret.Offset, 1);
            //						textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.PositionToLineEnd, new Point(textArea.Caret.Offset - textArea.Document.GetLineSegment(curLineNr).Offset, curLineNr)));
                    }
                    textArea.UpdateMatchingBracket();
                    textArea.EndUpdate();
                }
            }
        }
Exemplo n.º 13
0
		public override void Execute(TextArea textArea)
		{
			TextLocation oldCaretPos  = textArea.Caret.Position;
			base.Execute(textArea);
			textArea.AutoClearSelection = false;
			textArea.SelectionManager.ExtendSelection(oldCaretPos, textArea.Caret.Position);
		}
 /// <summary>
 /// Generates the completion data. This method is called by the text editor control.
 /// </summary>
 /// <param name="fileName">the name of the file.</param>
 /// <param name="textArea">The text area.</param>
 /// <param name="charTyped">The character typed.</param>
 /// <returns>The completion data.</returns>
 public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
 {
   ICompletionData[] completionData = new ICompletionData[_texts.Length];
   for (int i = 0; i < completionData.Length; i++)
     completionData[i] = new DefaultCompletionData(_texts[i], null, _imageIndex);
   return completionData;
 }
Exemplo n.º 15
0
		/// <summary>
		/// This function formats a specific line after <code>ch</code> is pressed.
		/// </summary>
		/// <returns>
		/// the caret delta position the caret will be moved this number
		/// of bytes (e.g. the number of bytes inserted before the caret, or
		/// removed, if this number is negative)
		/// </returns>
		public virtual int FormatLine(TextArea textArea, int line, int cursorOffset, char ch)
		{
			if (ch == '\n') {
				return IndentLine(textArea, line);
			}
			return 0;
		}
Exemplo n.º 16
0
		public override void Execute(TextArea textArea)
		{
			foreach (FoldMarker fm in  textArea.Document.FoldingManager.FoldMarker) {
				fm.IsFolded = fm.FoldType == FoldType.MemberBody || fm.FoldType == FoldType.Region;
			}
			textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
		}
Exemplo n.º 17
0
		public override void Execute(TextArea textArea)
		{
			if (textArea.Document.ReadOnly) {
				return;
			}
			textArea.ClipboardHandler.Cut(null, null);
		}
 public override void Execute(TextArea textArea)
 {
     int lineNumber = textArea.Document.BookmarkManager.GetPrevMark(textArea.Caret.Line);
     if (lineNumber >= 0 && lineNumber < textArea.Document.TotalNumberOfLines) {
         textArea.Caret.Line = lineNumber;
     }
 }
        /// <summary>
        /// Executes the action on a certain <see cref="TextArea"/>.
        /// </summary>
        /// <param name="textArea">The text area on which to execute the action.</param>
        public override void Execute(TextArea textArea)
        {
            if (textArea.Document.ReadOnly)
            return;

              textArea.ClipboardHandler.Paste();
        }
    /// <summary>
    /// This function sets the indentation level in a range of lines.
    /// </summary>
    /// <param name="textArea">The text area.</param>
    /// <param name="begin">The begin.</param>
    /// <param name="end">The end.</param>
    public override void IndentLines(TextArea textArea, int begin, int end)
    {
      if (textArea.Document.TextEditorProperties.IndentStyle != IndentStyle.Smart)
      {
        base.IndentLines(textArea, begin, end);
        return;
      }
      int cursorPos = textArea.Caret.Position.Y;
      int oldIndentLength = 0;

      if (cursorPos >= begin && cursorPos <= end)
        oldIndentLength = GetIndentation(textArea, cursorPos).Length;

      IndentationSettings set = new IndentationSettings();
      set.IndentString = Tab.GetIndentationString(textArea.Document);
      CSharpIndentationReformatter r = new CSharpIndentationReformatter();
      DocumentAccessor acc = new DocumentAccessor(textArea.Document, begin, end);
      r.Reformat(acc, set);

      if (cursorPos >= begin && cursorPos <= end)
      {
        int newIndentLength = GetIndentation(textArea, cursorPos).Length;
        if (oldIndentLength != newIndentLength)
        {
          // fix cursor position if indentation was changed
          int newX = textArea.Caret.Position.X - oldIndentLength + newIndentLength;
          textArea.Caret.Position = new TextLocation(Math.Max(newX, 0), cursorPos);
        }
      }
    }
Exemplo n.º 21
0
		/// <remarks>
		/// Executes this edit action
		/// </remarks>
		/// <param name="textArea">The <see cref="ItextArea"/> which is used for callback purposes</param>
		public override void Execute(TextArea textArea)
		{
			if (textArea.Document.ReadOnly) {
				return;
			}
			textArea.Document.UndoStack.StartUndoGroup();
			if (textArea.SelectionManager.HasSomethingSelected) {
				foreach (ISelection selection in textArea.SelectionManager.SelectionCollection) {
					int startLine = selection.StartPosition.Y;
					int endLine   = selection.EndPosition.Y;
					if (startLine != endLine) {
						textArea.BeginUpdate();
						InsertTabs(textArea.Document, selection, startLine, endLine);
						textArea.Document.UpdateQueue.Clear();
						textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine, endLine));
                        textArea.EndUpdate();
					} else {
						InsertTabAtCaretPosition(textArea);
						break;
					}
				}
				textArea.Document.CommitUpdate();
				textArea.AutoClearSelection = false;
			} else {
				InsertTabAtCaretPosition(textArea);
			}
			textArea.Document.UndoStack.EndUndoGroup();
		}
Exemplo n.º 22
0
		public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped) {
			List<ICompletionData> completionData = new List<ICompletionData>();

			int column = Math.Max(0, textArea.Caret.Column - 1);
			LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Line);
			TextWord word = line.GetWord(column);

			string itemText = (word != null ? word.Word : "") + char.ToLower(charTyped);

			if (mScriptContent.CommandsFlat.ContainsKey(itemText) != false) {
				foreach (string key in mScriptContent.CommandsFlat[itemText]) {
					completionData.Add(new ScriptCompletionData(mScriptContent.Commands[key].Name, mScriptContent.Commands[key].Description, 0));
				}
			}
			if (mScriptContent.ConstantsFlat.ContainsKey(itemText) != false) {
				foreach (string key in mScriptContent.ConstantsFlat[itemText]) {
					completionData.Add(new ScriptCompletionData(mScriptContent.Constants[key].Name, mScriptContent.Constants[key].Description, 0));
				}
			}
			if (mScriptContent.Maps.ContainsKey(itemText) != false) {
				foreach (string key in mScriptContent.Maps[itemText]) {
					completionData.Add(new ScriptCompletionData(key, key, 0));
				}
			}

			return completionData.ToArray();
		}
 public override void Execute(TextArea textArea)
 {
     List<FoldMarker> foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(textArea.Caret.Line);
     if (foldMarkers.Count != 0)
     {
         foreach (FoldMarker fm in foldMarkers)
             fm.IsFolded = !fm.IsFolded;
     }
     else
     {
         foldMarkers = textArea.Document.FoldingManager.GetFoldingsContainsLineNumber(textArea.Caret.Line);
         if (foldMarkers.Count != 0)
         {
             FoldMarker innerMost = foldMarkers[0];
             for (int i = 1; i < foldMarkers.Count; i++)
             {
                 if (new TextLocation(foldMarkers[i].StartColumn, foldMarkers[i].StartLine) >
                         new TextLocation(innerMost.StartColumn, innerMost.StartLine))
                 {
                     innerMost = foldMarkers[i];
                 }
             }
             innerMost.IsFolded = !innerMost.IsFolded;
         }
     }
     textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
 }
    /// <summary>
    /// Indents the specified line.
    /// </summary>
    protected override int SmartIndentLine(TextArea textArea, int lineNr)
    {
      if (lineNr <= 0)
        return AutoIndentLine(textArea, lineNr);

      string oldText = textArea.Document.GetText(textArea.Document.GetLineSegment(lineNr));

      DocumentAccessor acc = new DocumentAccessor(textArea.Document, lineNr, lineNr);

      IndentationSettings set = new IndentationSettings();
      set.IndentString = Tab.GetIndentationString(textArea.Document);
      set.LeaveEmptyLines = false;
      CSharpIndentationReformatter r = new CSharpIndentationReformatter();

      r.Reformat(acc, set);

      string t = acc.Text;
      if (t.Length == 0)
      {
        // use AutoIndentation for new lines in comments / verbatim strings.
        return AutoIndentLine(textArea, lineNr);
      }
      else
      {
        int newIndentLength = t.Length - t.TrimStart().Length;
        int oldIndentLength = oldText.Length - oldText.TrimStart().Length;
        if (oldIndentLength != newIndentLength && lineNr == textArea.Caret.Position.Y)
        {
          // fix cursor position if indentation was changed
          int newX = textArea.Caret.Position.X - oldIndentLength + newIndentLength;
          textArea.Caret.Position = new TextLocation(Math.Max(newX, 0), lineNr);
        }
        return newIndentLength;
      }
    }
Exemplo n.º 25
0
 /// <summary>
 /// This function sets the indentlevel in a range of lines.
 /// </summary>
 public virtual void IndentLines(TextArea textArea, int begin, int end)
 {
     textArea.Document.UndoStack.StartUndoGroup();
     for (int i = begin; i <= end; ++i) {
         IndentLine(textArea, i);
     }
     textArea.Document.UndoStack.EndUndoGroup();
 }
Exemplo n.º 26
0
 public override void Execute(TextArea textArea)
 {
     ArrayList foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(textArea.Caret.Line);
     foreach (FoldMarker fm in foldMarkers) {
         fm.IsFolded = !fm.IsFolded;
     }
     //textArea.Refresh();
 }
Exemplo n.º 27
0
		public override void Execute(TextArea textArea)
		{
			List<FoldMarker> foldMarkers = textArea.Document.FoldingManager.GetFoldingsWithStart(textArea.Caret.Line);
			foreach (FoldMarker fm in foldMarkers) {
				fm.IsFolded = !fm.IsFolded;
			}
			textArea.Document.FoldingManager.NotifyFoldingsChanged(EventArgs.Empty);
		}
Exemplo n.º 28
0
		public override void Execute(TextArea textArea)
		{
			Bookmark mark = textArea.Document.BookmarkManager.GetNextMark(textArea.Caret.Line, predicate);
			if (mark != null) {
				textArea.Caret.Line = mark.LineNumber;
				textArea.SelectionManager.ClearSelection();
			}
		}
Exemplo n.º 29
0
		public override void Execute(TextArea textArea)
		{
			int lineNumber = textArea.Document.BookmarkManager.GetNextMark(textArea.Caret.Line);
			if (lineNumber >= 0 && lineNumber < textArea.Document.TotalNumberOfLines) {
				textArea.Caret.Line = lineNumber;
			}
			textArea.SelectionManager.ClearSelection();
		}
Exemplo n.º 30
0
        public void textarea_renders_with_correct_tag_id_and_name()
        {
            var element = new TextArea("foo.Bar").ToString()
                .ShouldHaveHtmlNode("foo_Bar")
                .ShouldBeNamed(HtmlTag.TextArea);

            element.ShouldHaveAttribute(HtmlAttribute.Name).WithValue("foo.Bar");
        }
Exemplo n.º 31
0
 public virtual void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea)
 {
 }
Exemplo n.º 32
0
 FormattedTextArea GetFormattedTextArea(TextArea area)
 {
     return(GetFormattedTextArea(area, double.NaN));
 }
        /// <summary>
        /// 载入考核表
        /// </summary>
        private void loadEvaluateTable(string id)
        {
            string evaluatedID = "";

            if (id == "" || id == "0")
            {
                evaluatedID = Request.QueryString["id"];
            }
            else
            {
                evaluatedID = id;
            }
            Panel1.Title = Request.QueryString["name"] + "的考核表";
            EvaluateTable evaluateTable = new EvaluateTable();
            string        exception     = "";

            if (EvaluateTableManagementCtrl.GetEvaluateTable(evaluatedID, ref evaluateTable, ref exception))
            {
                Label_Comment.Text = evaluateTable.Comment;

                Label_EvaluatedName.Text = evaluateTable.EvaluatedName;
                Label_PostName.Text      = evaluateTable.PostName;
                Label_LaborDep.Text      = evaluateTable.LaborDep;
                Label_LaborUnit.Text     = evaluateTable.LaborUnit;
                Label_Period.Text        = evaluateTable.StartTime + " ~ " + evaluateTable.StopTime;

                for (int i = 0; i < evaluateTable.KeyResponse.Count; i++)
                {
                    SimpleForm sf = Panel3.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox         tb = sf.Items[0] as TriggerBox;
                    TextArea           ta = sf.Items[1] as TextArea;
                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    tb.Text = evaluateTable.KeyResponse[i].Title;
                    ta.Text = evaluateTable.KeyResponse[i].Content[0];
                    hf.Text = evaluateTable.KeyResponse[i].Title + "&" + evaluateTable.KeyResponse[i].Content[0];
                }

                for (int i = 0; i < evaluateTable.KeyQualify.Count; i++)
                {
                    SimpleForm sf = Panel4.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.KeyQualify[i].Title;
                    ta.Text = "优:" + evaluateTable.KeyQualify[i].Content[0]
                              + " 良:" + evaluateTable.KeyQualify[i].Content[1]
                              + " 中:" + evaluateTable.KeyQualify[i].Content[2]
                              + " 差:" + evaluateTable.KeyQualify[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.KeyQualify[i].Title
                              + "&" + evaluateTable.KeyQualify[i].Content[0]
                              + "^" + evaluateTable.KeyQualify[i].Content[1]
                              + "^" + evaluateTable.KeyQualify[i].Content[2]
                              + "^" + evaluateTable.KeyQualify[i].Content[3];
                }

                for (int i = 0; i < evaluateTable.KeyAttitude.Count; i++)
                {
                    SimpleForm sf = Panel5.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.KeyAttitude[i].Title;
                    ta.Text = "优:" + evaluateTable.KeyAttitude[i].Content[0]
                              + " 良:" + evaluateTable.KeyAttitude[i].Content[1]
                              + " 中:" + evaluateTable.KeyAttitude[i].Content[2]
                              + " 差:" + evaluateTable.KeyAttitude[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.KeyAttitude[i].Title
                              + "&" + evaluateTable.KeyAttitude[i].Content[0]
                              + "^" + evaluateTable.KeyAttitude[i].Content[1]
                              + "^" + evaluateTable.KeyAttitude[i].Content[2]
                              + "^" + evaluateTable.KeyAttitude[i].Content[3];
                }

                for (int i = 0; i < evaluateTable.Response.Count; i++)
                {
                    SimpleForm sf = Panel6.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox         tb = sf.Items[0] as TriggerBox;
                    TextArea           ta = sf.Items[1] as TextArea;
                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    tb.Text = evaluateTable.Response[i].Title;
                    ta.Text = evaluateTable.Response[i].Content[0];
                    hf.Text = evaluateTable.Response[i].Title + "&" + evaluateTable.Response[i].Content[0];
                }

                for (int i = 0; i < evaluateTable.Qualify.Count; i++)
                {
                    SimpleForm sf = Panel7.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.Qualify[i].Title;
                    ta.Text = "优:" + evaluateTable.Qualify[i].Content[0]
                              + " 良:" + evaluateTable.Qualify[i].Content[1]
                              + " 中:" + evaluateTable.Qualify[i].Content[2]
                              + " 差:" + evaluateTable.Qualify[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.Qualify[i].Title
                              + "&" + evaluateTable.Qualify[i].Content[0]
                              + "^" + evaluateTable.Qualify[i].Content[1]
                              + "^" + evaluateTable.Qualify[i].Content[2]
                              + "^" + evaluateTable.Qualify[i].Content[3];
                }

                for (int i = 0; i < evaluateTable.Attitude.Count; i++)
                {
                    SimpleForm sf = Panel8.Items[i] as SimpleForm;
                    sf.Collapsed = false;
                    TriggerBox tb = sf.Items[0] as TriggerBox;
                    TextArea   ta = sf.Items[1] as TextArea;
                    tb.Text = evaluateTable.Attitude[i].Title;
                    ta.Text = "优:" + evaluateTable.Attitude[i].Content[0]
                              + " 良:" + evaluateTable.Attitude[i].Content[1]
                              + " 中:" + evaluateTable.Attitude[i].Content[2]
                              + " 差:" + evaluateTable.Attitude[i].Content[3];

                    FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                    hf.Text = evaluateTable.Attitude[i].Title
                              + "&" + evaluateTable.Attitude[i].Content[0]
                              + "^" + evaluateTable.Attitude[i].Content[1]
                              + "^" + evaluateTable.Attitude[i].Content[2]
                              + "^" + evaluateTable.Attitude[i].Content[3];
                }

                TextArea_Reject1.Text = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
                TextArea_Reject2.Text = evaluateTable.Reject[0].Content[0];
            }
            else    //如果该被考评人的岗位责任书尚未制定,则被考评人姓名、岗位名称、用工部门、用工单位和考核时间段从父网页获取
            {
                Label_EvaluatedName.Text = Request.QueryString["name"];
                Label_PostName.Text      = Request.QueryString["postname"];
                Label_LaborDep.Text      = Request.QueryString["labordepart"];
                Label_LaborUnit.Text     = Request.QueryString["depart"];
                Label_Period.Text        = Request.QueryString["starttime"] + " ~ " + Request.QueryString["stoptime"];
                TextArea_Reject1.Text    = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
            }
        }
        /// <summary>
        /// 获取当前页面中的考核表
        /// </summary>
        /// <returns></returns>
        private EvaluateTable getNewEvaluateTable()
        {
            EvaluateTable evaluateTable = new EvaluateTable();

            evaluateTable.EvaluatedName = Label_EvaluatedName.Text.Trim();
            evaluateTable.PostName      = Label_PostName.Text.Trim();
            evaluateTable.LaborDep      = Label_LaborDep.Text.Trim();
            evaluateTable.LaborUnit     = Label_LaborUnit.Text.Trim();
            evaluateTable.StartTime     = Label_Period.Text.Split('~')[0].Trim();
            evaluateTable.StopTime      = Label_Period.Text.Split('~')[1].Trim();
            foreach (ControlBase item in Panel3.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = new string[] { hf.Text.Split('&')[1] };
                evaluateTable.KeyResponse.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel4.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.KeyQualify.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel5.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.KeyAttitude.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel6.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text == "")
                {
                    break;
                }
                TextArea           ta      = sf.Items[1] as TextArea;
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = new string[] { hf.Text.Split('&')[1] };
                evaluateTable.Response.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel7.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.Qualify.Add(new Quota(title, content));
            }

            foreach (ControlBase item in Panel8.Items)
            {
                SimpleForm sf = item as SimpleForm;
                TriggerBox tb = sf.Items[0] as TriggerBox;
                if (tb.Text.Trim() == "")
                {
                    break;
                }
                FineUI.HiddenField hf      = sf.Items[2] as FineUI.HiddenField;
                string             title   = hf.Text.Split('&')[0].Trim();
                string[]           content = hf.Text.Split('&')[1].Split('^');
                evaluateTable.Attitude.Add(new Quota(title, content));
            }

            evaluateTable.Reject.Add(new Quota("其他", new string[] { TextArea_Reject2.Text.Trim() }));

            return(evaluateTable);
        }
Exemplo n.º 35
0
        /// <summary>
        /// Execute the Inser Closing Element action
        /// </summary>
        /// <param name="textArea">The text area in which to perform the
        /// action</param>
        public override void Execute(TextArea textArea)
        {
            IDocument doc = textArea.Document;
            int       endTag = -1, open = -1, close = -1, offset = textArea.Caret.Offset;
            char      c;

            if (offset > 0 && doc.GetCharAt(offset - 1) == '>')
            {
                offset--;
            }

            // Find end of the element
            for (int i = offset; i < doc.TextLength; i++)
            {
                c = doc.GetCharAt(i);

                if (c == '<' || c == '>')
                {
                    if (c == '>')
                    {
                        endTag = close = i;

                        // Find start of tag
                        for (int j = close - 1; j >= 0; j--)
                        {
                            c = doc.GetCharAt(j);

                            if (c == '<' || c == '>')
                            {
                                if (c == '<')
                                {
                                    open = j;
                                }

                                break;
                            }

                            // On whitespace, assume we just moved past
                            // an attribute.
                            if (Char.IsWhiteSpace(c))
                            {
                                endTag = j;
                            }
                        }
                    }

                    break;
                }
            }

            // Execute the default action if we couldn't find an element
            // or it's a comment.
            if (open < 0 || close < 0 || doc.GetText(open + 1, 3) == "!--")
            {
                if (defaultAction != null)
                {
                    defaultAction.Execute(textArea);
                }
                else
                {
                    textArea.InsertChar('\t');
                }
            }
            else
            {
                open++;
                string tag = doc.GetText(open, endTag - open);

                close++;
                doc.Insert(close, "</" + tag + ">");
                textArea.Caret.Position = doc.OffsetToPosition(close);
            }
        }
Exemplo n.º 36
0
        //--------------------------------------------------------------
        #region Methods
        //--------------------------------------------------------------

        /// <summary>
        /// Insert the element represented by the completion data into the text
        /// editor.
        /// </summary>
        /// <param name="textArea">TextArea to insert the completion data in.</param>
        /// <param name="ch">Character that should be inserted after the completion data. \0 when no
        /// character should be inserted.</param>
        /// <returns>
        /// Returns true when the insert action has processed the character
        /// <paramref name="ch"/>; false when the character was not processed.
        /// </returns>
        public bool InsertAction(TextArea textArea, char ch)
        {
            _snippet.Insert(textArea);
            return(false);
        }
Exemplo n.º 37
0
 public override void Execute(TextArea textArea)
 {
     textArea.SelectionManager.ClearSelection();
 }
 /// <summary>
 /// Generates the completion data. This method is called by the text editor control.
 /// This method may return null.
 /// </summary>
 public abstract ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped);
 protected abstract void GenerateCompletionData(TextArea textArea, char charTyped);
Exemplo n.º 40
0
        public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
        {
            var res      = new List <ICompletionData>();
            int tblindex = m_imgCache.GetImageIndex(StdIcons.table);
            int vindex   = m_imgCache.GetImageIndex(StdIcons.view);

            var context = m_anal.GetContext(textArea.Caret.Line, textArea.Caret.Column);

            switch (context)
            {
            case SqlEditorAnalyser.CodeContext.Table:
            {
                var prefixName = FindPrefix(textArea);
                if (prefixName == null)         // do not handle table prefixes
                {
                    foreach (var tbl in m_anal.TableNames)
                    {
                        res.Add(new SqlCompletionData(tbl.Name, tbl.ToString(), tblindex, GetFullName(tbl)));
                    }
                    foreach (var tbl in m_anal.ViewNames)
                    {
                        res.Add(new SqlCompletionData(tbl.Name, tbl.ToString(), vindex, GetFullName(tbl)));
                    }
                }
            }
            break;

            case SqlEditorAnalyser.CodeContext.Column:
            case SqlEditorAnalyser.CodeContext.ColumnWithoutQualifier:
            {
                var  prefixName = FindPrefix(textArea);
                int  colindex   = m_imgCache.GetImageIndex(StdIcons.column);
                int  starindex  = m_imgCache.GetImageIndex(StdIcons.star_blue);
                bool qual       = context == SqlEditorAnalyser.CodeContext.Column;

                if (prefixName != null)
                {
                    var used = m_anal.FindUsedMatch(prefixName);
                    if (used != null)
                    {
                        string alltext = String.Format("all ({0})", used.FullName);
                        string allins  = "";
                        foreach (var col in used.Structure.Columns)
                        {
                            if (allins.Length > 0)
                            {
                                allins += ", ";
                                allins += (qual ? prefixName.ToString() + "." : "") + GetShortName(col.ColumnName);
                            }
                            else
                            {
                                allins += GetShortName(col.ColumnName);
                            }
                        }
                        res.Add(new SqlCompletionData(alltext, allins, starindex, allins));

                        foreach (var col in used.Structure.Columns)
                        {
                            string text = String.Format("{0} ({1})", col.ColumnName, used.FullName);
                            string ins  = GetShortName(col.ColumnName);
                            res.Add(new SqlCompletionData(text, text, colindex, ins));
                        }
                    }
                }
                else
                {
                    foreach (var tbl in m_anal.UsedTables)
                    {
                        string alltext = String.Format("all ({0})", (tbl.Alias ?? tbl.FullName.ToString()));
                        string allins  = "";
                        foreach (var col in tbl.Structure.Columns)
                        {
                            if (allins.Length > 0)
                            {
                                allins += ", ";
                            }
                            string ins = (qual ? (tbl.Alias ?? GetFullName(tbl.FullName)) + "." : "") + GetShortName(col.ColumnName);
                            allins += ins;
                        }
                        res.Add(new SqlCompletionData(alltext, allins, starindex, allins));
                        if (qual)
                        {
                            int imgindex = m_anal.ViewNames.IndexOf(tbl.FullName) >= 0 ? vindex : tblindex;
                            res.Add(new SqlCompletionData(tbl.Alias ?? tbl.FullName.Name, tbl.Alias ?? tbl.FullName.ToString(), imgindex, tbl.Alias ?? GetFullName(tbl.FullName)));
                        }

                        foreach (var col in tbl.Structure.Columns)
                        {
                            string text = String.Format("{0} ({1}{2})", col.ColumnName, tbl.FullName, tbl.Alias != null ? ":" + tbl.Alias : "");
                            string ins  = (qual ? (tbl.Alias ?? GetFullName(tbl.FullName)) + "." : "") + GetShortName(col.ColumnName);
                            res.Add(new SqlCompletionData(text, text, colindex, ins));
                        }
                    }
                }
            }
            break;
            }
            return(res.ToArray());
        }
Exemplo n.º 41
0
    override protected void CreateChildren()
    {
        base.CreateChildren();

        #region Top label

        Label label = new TitleLabel {
            HorizontalCenter = 0, Top = 20, StyleName = "title"
        };
        AddChild(label);

        new TextRotator
        {
            Delay = 5, // 5 seconds delay
            Lines = new[]
            {
                "Form Demo 1",
                "Created with eDriven.Gui"/*,
                                           * "Author: Danko Kozar"*/
            },
            Callback = delegate(string line) { label.Text = line; }
        }
        .Start();

        #endregion

        Panel panel = new Panel
        {
            Title     = "Form Demo",
            Icon      = Resources.Load <Texture>("Icons/star"),
            SkinClass = typeof(PanelSkin2),
            //SkinClass = typeof(WindowSkin),
            Width            = 350,
            MaxHeight        = 500,
            HorizontalCenter = 0, VerticalCenter = 0,
            //Top = 100, Bottom = 100 // additional constrains for screen resize
        };
        AddChild(panel);

        Group container = new Group {
            Left = 10, Right = 10, Top = 10, Bottom = 10
        };
        panel.AddContentChild(container);

        Form form = new Form {
            PercentWidth = 100
        };
        container.AddContentChild(form);

        #region Text Fields

        TextField txtSubject = new TextField
        {
            FocusEnabled = true,
            PercentWidth = 100,
            Text         = "Input text",
            //Optimized = true
            //AlowedCharacters = "a1"
        };
        form.AddField("subject", "Subject:", txtSubject);

        TextArea txtMessage = new TextArea
        {
            FocusEnabled = true,
            PercentWidth = 100,
            Height       = 200,
            Text         = LoremIpsum,
            //Optimized = true
        };
        form.AddField("message", "Message:", txtMessage);

        #endregion

        #region Buttons

        panel.ControlBarGroup.AddChild(new Spacer {
            PercentWidth = 100
        });

        Button btnSet = new Button
        {
            Text      = "Set data",
            Icon      = ImageLoader.Instance.Load("Icons/arrow_up"),
            SkinClass = typeof(ImageButtonSkin)
        };
        btnSet.Press += delegate
        {
            form.Data = new Hashtable
            {
                { "subject", "The subject" },
                { "message", "This is the message..." }
            };
        };
        panel.ControlBarGroup.AddChild(btnSet);
        btnSet.SetFocus();

        Button btnGet = new Button
        {
            Text      = "Get data",
            SkinClass = typeof(ImageButtonSkin),
            Icon      = ImageLoader.Instance.Load("Icons/arrow_down")
        };
        btnGet.Press += delegate
        {
            StringBuilder sb = new StringBuilder();
            foreach (DictionaryEntry entry in form.Data)
            {
                sb.AppendLine(string.Format(@"""{0}"": {1}", entry.Key, entry.Value));
                sb.AppendLine();
            }

            Alert.Show("This is the form data", sb.ToString(), AlertButtonFlag.Ok,
                       new AlertOption(AlertOptionType.HeaderIcon, Resources.Load <Texture>("Icons/information")));
        };
        panel.ControlBarGroup.AddChild(btnGet);

        #endregion

        panel.Plugins.Add(new TabManager
        {
            TabChildren = new List <DisplayListMember> {
                txtSubject, txtMessage, btnSet, btnGet
            }
        });
    }
Exemplo n.º 42
0
 /// <summary>
 /// Execute the Find Text action
 /// </summary>
 /// <param name="textArea">The text area in which to perform the
 /// action</param>
 public override void Execute(TextArea textArea)
 {
     editor.OnPerformFindText(EventArgs.Empty);
 }
 /// <summary>
 /// Does nothing: indenting multiple lines is useless without a smart indentation strategy.
 /// </summary>
 public virtual void IndentLines(TextArea textArea, int beginLine, int endLine)
 {
 }
Exemplo n.º 44
0
 /// <summary>
 /// Execute the Spell Check action
 /// </summary>
 /// <param name="textArea">The text area in which to perform the action</param>
 public override void Execute(TextArea textArea)
 {
     editor.OnPerformSpellCheck(EventArgs.Empty);
 }
Exemplo n.º 45
0
 public virtual void Insert(TextArea textArea)
 {
     _snippet?.Insert(textArea);
 }
        /// <summary>
        /// 清空所有项目
        /// </summary>
        private void clearAll()
        {
            Label_Period.Text = "";

            foreach (ControlBase cb in Panel3.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel4.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel5.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel6.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel7.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            foreach (ControlBase cb in Panel8.Items)
            {
                SimpleForm         sf = cb as SimpleForm;
                TriggerBox         tb = sf.Items[0] as TriggerBox;
                TextArea           ta = sf.Items[1] as TextArea;
                FineUI.HiddenField hf = sf.Items[2] as FineUI.HiddenField;
                tb.Text = "";
                ta.Text = "";
                hf.Text = "";
            }

            TextArea_Reject1.Text = "累计旷工3天以上的;\n严重失职,营私舞弊,给本单位造成3000元以上经济损失或者其它严重后果的;\n同时与其他用人单位建立劳动关系,对完成本单位工作任务造成严重影响,或者经本单位提出,拒不改正的;\n违背职业道德,行贿、受贿价值超过3000元以上的;\n被依法追究刑事责任的;";
            TextArea_Reject2.Text = "";
        }
Exemplo n.º 47
0
 private void TextArea_RegularNewLine(object sender, ExecutedRoutedEventArgs e)
 {
     TextArea.PerformTextInput(Environment.NewLine);
 }
 public void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
 {
     textArea.Document.Replace(completionSegment, text);
 }
Exemplo n.º 49
0
 public static void CopySelected(TextArea ta)
 {
     _buffer = ta.Selection.GetText(ta.Document);
 }
Exemplo n.º 50
0
 public static void Paste(TextArea ta)
 {
     ta.Selection.ReplaceSelectionWithText(ta, _buffer);
 }
 public PasteCommand(TextArea textArea, Clipboard clipboard) : base(textArea, clipboard)
 {
 }