* Added tageditor, a context menu for inserting monodoc tags
authorAdam Treat <adam@mono-cvs.ximian.com>
Tue, 24 Sep 2002 21:29:10 +0000 (21:29 -0000)
committerAdam Treat <adam@mono-cvs.ximian.com>
Tue, 24 Sep 2002 21:29:10 +0000 (21:29 -0000)
* Updated the GUI to handle the changes in the lib

svn path=/trunk/mcs/; revision=7794

mcs/doctools/monodoc-qt/global.cs
mcs/doctools/monodoc-qt/listitem.cs
mcs/doctools/monodoc-qt/listview.cs
mcs/doctools/monodoc-qt/remarksform.cs
mcs/doctools/monodoc-qt/tageditor.cs [new file with mode: 0644]

index af5b4c39d801d0d0ec3420f9927788a635edf175..3721662bdb1fb625a0f922a13fa76edbf86e2e5c 100644 (file)
@@ -15,14 +15,15 @@ namespace Mono.Document.Editor {
                public static QPixmap IMono = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/mono.png");
                public static QPixmap IName = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/red.gif");
                public static QPixmap IClass = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/class.gif");
-               public static QPixmap IStructure = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/structure.gif");
-               public static QPixmap IInterface = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/interface.gif");
                public static QPixmap IDelegate = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/delegate.gif");
                public static QPixmap IEnum = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/enum.gif");
+               public static QPixmap IInterface = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/interface.gif");
+               public static QPixmap IStructure = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/structure.gif");
                public static QPixmap IMethod = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/method.gif");
+               public static QPixmap IEvent = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/event.gif");
                public static QPixmap IField = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/field.gif");
+               public static QPixmap IOperator = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/operator.gif");
                public static QPixmap IProperty = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/property.gif");
-               public static QPixmap IEvent = new QPixmap (QDir.HomeDirPath ()+"/.monodoc/images/event.gif");
                public static string Summary = "<summary> Provide a brief (usually one sentence) description of a member or type.";
                public static string Remarks = "<remarks> Provide verbose information for a type or member.";
                
index 7ebb817663bd11d47ce870db18854f96aeb8f086..deea48ca243150c355767ce25dcaed24f0a88e6b 100644 (file)
@@ -26,14 +26,16 @@ namespace Mono.Document.Editor {
                public ListItem (QListViewItem parent, string text, DocMember member) : base (parent, text)
                {
                        this.member = member;
-                       if (member.IsCtor || member.IsMethod || member.IsDtor)
+                       if (member.IsConstructor || member.IsMethod)
                                SetPixmap (0, Global.IMethod);
+                       else if (member.IsEvent)
+                               SetPixmap (0, Global.IEvent);
                        else if (member.IsField)
                                SetPixmap (0, Global.IField);
+                       else if (member.IsOperator)
+                               SetPixmap (0, Global.IOperator);
                        else if (member.IsProperty)
                                SetPixmap (0, Global.IProperty);
-                       else if (member.IsEvent)
-                               SetPixmap (0, Global.IEvent);
 
                }
 
@@ -42,14 +44,14 @@ namespace Mono.Document.Editor {
                        this.type = type;
                        if (type.IsClass)
                                SetPixmap (0, Global.IClass);
-                       else if (type.IsStructure)
-                               SetPixmap (0, Global.IStructure);
-                       else if (type.IsInterface)
-                               SetPixmap (0, Global.IInterface);
                        else if (type.IsDelegate)
                                SetPixmap (0, Global.IDelegate);
                        else if (type.IsEnum)
                                SetPixmap (0, Global.IEnum);
+                       else if (type.IsInterface)
+                               SetPixmap (0, Global.IInterface);
+                       else if (type.IsStructure)
+                               SetPixmap (0, Global.IStructure);
                }
 
                public IEditForm BuildEditForm ()
@@ -62,4 +64,4 @@ namespace Mono.Document.Editor {
                        return EditForm;
                }
        }
-}
\ No newline at end of file
+}
index ff668411856d51be2b229bba49cb1572bb925d03..d3c229b0eae7a379a2e10ab3c263b5d921acd54f 100644 (file)
@@ -39,12 +39,12 @@ namespace Mono.Document.Editor {
                                        type.Language = "en";
                                        progress.SetProgress (i++);
                                        ListItem typeitem = new ListItem (GetNamespaceItem (type.Namespace), type.Name, type);
-                                       ProcessMember (type.Dtors, typeitem);
-                                       ProcessMember (type.Events, typeitem);
-                                       ProcessMember (type.Fields, typeitem);
                                        ProcessMember (type.Properties, typeitem);
+                                       ProcessMember (type.Operators, typeitem);
                                        ProcessMember (type.Methods, typeitem);
-                                       ProcessMember (type.Ctors, typeitem);
+                                       ProcessMember (type.Fields, typeitem);
+                                       ProcessMember (type.Events, typeitem);
+                                       ProcessMember (type.Constructors, typeitem);
                                }
                                SetUpdatesEnabled (true);
                                Repaint ();
@@ -72,4 +72,4 @@ namespace Mono.Document.Editor {
                        return _namespace;
                }
        }
-}
\ No newline at end of file
+}
index 16e30e9a48b43be58c274b90a193e88a0f9d8bc4..97cd0c213553425ac8320813bc1289226002dd36 100644 (file)
@@ -19,7 +19,7 @@ namespace Mono.Document.Editor {
                {
                        this.document = document;
                        new QLabel (Global.Remarks, this);
-                       edit = new QTextEdit (this);
+                       edit = new Edit (this);
                        Connect (parent, SIGNAL ("Sync ()"), this, SLOT ("OnSync ()"));
                        Connect (parent, SIGNAL ("Flush ()"), this, SLOT ("OnFlush ()"));
                }
@@ -31,5 +31,22 @@ namespace Mono.Document.Editor {
                {
                        document.Remarks = edit.Text ();
                }
+               
+               private class Edit : QTextEdit {
+
+                       TagContext context;
+
+                       public Edit (QWidget parent) : base (parent)
+                       {
+                               mousePressEvent += new MousePressEvent (pressEvent);
+                               context = new TagContext (this);
+                       }
+
+                       public void pressEvent (QMouseEvent e)
+                       {
+                               if (e.Button () == ButtonState.RightButton)
+                               context.Popup (e.GlobalPos ());
+                       }
+               }
        }
-}
\ No newline at end of file
+}
diff --git a/mcs/doctools/monodoc-qt/tageditor.cs b/mcs/doctools/monodoc-qt/tageditor.cs
new file mode 100644 (file)
index 0000000..8c231ce
--- /dev/null
@@ -0,0 +1,69 @@
+// doceditbar.cs - Qt# Mono Documentation Tool
+//
+// Author: Adam Treat <manyoso@yahoo.com>
+// (c) 2002 Adam Treat
+// Licensed under the terms of the GNU GPL
+
+namespace Mono.Document.Editor {
+
+       using Qt;
+       using System;
+
+       public class TagContext : QPopupMenu {
+
+               QTextEdit edit;
+
+               public TagContext (QTextEdit edit) : base (edit)
+               {
+                       this.edit = edit;
+                       InsertItem ("<see>", this, SLOT ("OnSee ()"));
+                       InsertItem ("<code>", this, SLOT ("OnCode ()"));
+                       InsertItem ("<data>", this, SLOT ("OnData ()"));
+                       InsertItem ("<list>", this, SLOT ("OnList ()"));
+                       InsertItem ("<example>", this, SLOT ("OnExample ()"));
+                       InsertItem ("<exception>", this, SLOT ("OnException ()"));
+               }
+
+               public void OnSee ()
+               {
+                       edit.Insert ("<see></see>");
+                       BackUp ("</see>");
+               }
+               
+               public void OnCode ()
+               {
+                       edit.Insert ("<code></code>");
+                       BackUp ("</code>");
+               }
+               
+               public void OnData ()
+               {
+                       edit.Insert ("<data></data>");
+                       BackUp ("</data>");
+               }
+               
+               public void OnList ()
+               {
+                       edit.Insert ("<list></list>");
+                       BackUp ("</list>");
+               }
+               
+               public void OnExample ()
+               {
+                       edit.Insert ("<example></example>");
+                       BackUp ("</example>");
+               }
+               
+               public void OnException ()
+               {
+                       edit.Insert ("<exception></exception>");
+                       BackUp ("</exception>");
+               }
+               
+               public void BackUp (string back)
+               {
+                       foreach (char c in back)
+                               edit.MoveCursor (QTextEdit.CursorAction.MoveBackward, false);
+               }
+       }
+}