コード例 #1
0
		public AssemblyBrowserWidget ()
		{
			this.Build ();

			comboboxVisibilty = ComboBox.NewText ();
			comboboxVisibilty.InsertText (0, GettextCatalog.GetString ("Only public members"));
			comboboxVisibilty.InsertText (1, GettextCatalog.GetString ("All members"));
			comboboxVisibilty.Active = Math.Min (1, Math.Max (0, PropertyService.Get ("AssemblyBrowser.MemberSelection", 0)));
			comboboxVisibilty.Changed += delegate {
				TreeView.PublicApiOnly = comboboxVisibilty.Active == 0;
				PropertyService.Set ("AssemblyBrowser.MemberSelection", comboboxVisibilty.Active);
				FillInspectLabel (); 
			};

			searchentry1 = new MonoDevelop.Components.SearchEntry ();
			searchentry1.Ready = true;
			searchentry1.HasFrame = true;
			searchentry1.WidthRequest = 200;
			searchentry1.Visible = true;
			UpdateSearchEntryMessage ();
			searchentry1.InnerEntry.Changed += SearchEntryhandleChanged;

			CheckMenuItem checkMenuItem = this.searchentry1.AddFilterOption (0, GettextCatalog.GetString ("Types and Members"));
			checkMenuItem.Active = PropertyService.Get ("AssemblyBrowser.SearchMemberState", SearchMemberState.TypesAndMembers) == SearchMemberState.TypesAndMembers;
			checkMenuItem.Toggled += delegate {
				if (checkMenuItem.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.TypeAndMembers;
					CreateColumns ();
					StartSearch ();
				}
				if (checkMenuItem.Active)
					PropertyService.Set ("AssemblyBrowser.SearchMemberState", SearchMemberState.TypesAndMembers);
				UpdateSearchEntryMessage ();
			};

			CheckMenuItem checkMenuItem2 = this.searchentry1.AddFilterOption (0, GettextCatalog.GetString ("Types"));
			checkMenuItem2.Active = PropertyService.Get ("AssemblyBrowser.SearchMemberState", SearchMemberState.TypesAndMembers) == SearchMemberState.Types;
			checkMenuItem2.Toggled += delegate {
				if (checkMenuItem2.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Type;
					CreateColumns ();
					StartSearch ();
				}
				if (checkMenuItem.Active)
					PropertyService.Set ("AssemblyBrowser.SearchMemberState", SearchMemberState.Types);
				UpdateSearchEntryMessage ();
			};
			
			CheckMenuItem checkMenuItem1 = this.searchentry1.AddFilterOption (1, GettextCatalog.GetString ("Members"));
			checkMenuItem.Active = PropertyService.Get ("AssemblyBrowser.SearchMemberState", SearchMemberState.TypesAndMembers) == SearchMemberState.Members;
			checkMenuItem1.Toggled += delegate {
				if (checkMenuItem1.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Member;
					CreateColumns ();
					StartSearch ();
				}
				if (checkMenuItem.Active)
					PropertyService.Set ("AssemblyBrowser.SearchMemberState", SearchMemberState.Members);
				UpdateSearchEntryMessage ();

			};

			languageCombobox = Gtk.ComboBox.NewText ();
			languageCombobox.AppendText (GettextCatalog.GetString ("Summary"));
			languageCombobox.AppendText (GettextCatalog.GetString ("IL"));
			languageCombobox.AppendText (GettextCatalog.GetString ("C#"));
			languageCombobox.Active = Math.Min (2, Math.Max (0, PropertyService.Get ("AssemblyBrowser.Language", 0)));
			languageCombobox.Changed += LanguageComboboxhandleChanged;
#pragma warning disable 618
			TreeView = new AssemblyBrowserTreeView (new NodeBuilder[] { 
				new ErrorNodeBuilder (),
				new ProjectNodeBuilder (this),
				new AssemblyNodeBuilder (this),
				new ModuleReferenceNodeBuilder (),
				new AssemblyReferenceNodeBuilder (this),
				//new AssemblyReferenceFolderNodeBuilder (this),
				new AssemblyResourceFolderNodeBuilder (),
				new ResourceNodeBuilder (),
				new NamespaceBuilder (this),
				new DomTypeNodeBuilder (this),
				new DomMethodNodeBuilder (this),
				new DomFieldNodeBuilder (this),
				new DomEventNodeBuilder (this),
				new DomPropertyNodeBuilder (this),
				new BaseTypeFolderNodeBuilder (this),
				new BaseTypeNodeBuilder (this)
				}, new TreePadOption [0]);
			TreeView.PublicApiOnly = comboboxVisibilty.Active == 0;
			TreeView.AllowsMultipleSelection = false;
			TreeView.SelectionChanged += HandleCursorChanged;

			treeViewPlaceholder.Add (TreeView);

//			this.descriptionLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 9"));
//			this.documentationLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 12"));
//			this.documentationLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 225));
//			this.documentationLabel.Wrap = true;
			

			inspectEditor = TextEditorFactory.CreateNewEditor ();
			inspectEditor.ContextMenuPath = "/MonoDevelop/AssemblyBrowser/EditorContextMenu";
			inspectEditor.Options = DefaultSourceEditorOptions.PlainEditor;

			//inspectEditor.ButtonPressEvent += HandleInspectEditorButtonPressEvent;
			
			this.inspectEditor.IsReadOnly = true;
//			this.inspectEditor.Document.SyntaxMode = new Mono.TextEditor.Highlighting.MarkupSyntaxMode ();
//			this.inspectEditor.LinkRequest += InspectEditorhandleLinkRequest;

			documentationScrolledWindow.PackStart (inspectEditor, true, true, 0);

			this.hpaned1.ExposeEvent += HPaneExpose;
			hpaned1 = hpaned1.ReplaceWithWidget (new HPanedThin (), true);
			hpaned1.Position = 271;

			this.notebook1.SetTabLabel (this.documentationScrolledWindow, new Label (GettextCatalog.GetString ("Documentation")));
			this.notebook1.SetTabLabel (this.searchWidget, new Label (GettextCatalog.GetString ("Search")));
			notebook1.Page = 0;
			//this.searchWidget.Visible = false;
				
			typeListStore = new Gtk.ListStore (typeof(Xwt.Drawing.Image), // type image
			                                   typeof(string), // name
			                                   typeof(string), // namespace
			                                   typeof(string), // assembly
				                               typeof(IMember)
			                                  );
			
			memberListStore = new Gtk.ListStore (typeof(Xwt.Drawing.Image), // member image
			                                   typeof(string), // name
			                                   typeof(string), // Declaring type full name
			                                   typeof(string), // assembly
				                               typeof(IMember)
			                                  );
			CreateColumns ();
//			this.searchEntry.Changed += SearchEntryhandleChanged;
			this.searchTreeview.RowActivated += SearchTreeviewhandleRowActivated;
			this.notebook1.ShowTabs = false;
			this.ShowAll ();
		}
コード例 #2
0
		public AssemblyBrowserWidget ()
		{
			this.Build ();

			buttonBack = new Gtk.Button (ImageService.GetImage ("md-breadcrumb-prev", Gtk.IconSize.Menu));
			buttonBack.Clicked += OnNavigateBackwardActionActivated;

			buttonForeward = new Gtk.Button (ImageService.GetImage ("md-breadcrumb-next", Gtk.IconSize.Menu));
			buttonForeward.Clicked += OnNavigateForwardActionActivated;

			comboboxVisibilty = ComboBox.NewText ();
			comboboxVisibilty.InsertText (0, GettextCatalog.GetString ("Only public members"));
			comboboxVisibilty.InsertText (1, GettextCatalog.GetString ("All members"));
			comboboxVisibilty.Active = 0;
			comboboxVisibilty.Changed += delegate {
				TreeView.PublicApiOnly = comboboxVisibilty.Active == 0;
				FillInspectLabel ();
			};

			searchentry1 = new MonoDevelop.Components.SearchEntry ();
			searchentry1.Ready = true;
			searchentry1.HasFrame = true;
			searchentry1.WidthRequest = 200;
			searchentry1.Visible = true;
			searchentry1.EmptyMessage = GettextCatalog.GetString ("Search for types or members");
			searchentry1.InnerEntry.Changed += SearchEntryhandleChanged;

			CheckMenuItem checkMenuItem = this.searchentry1.AddFilterOption (0, GettextCatalog.GetString ("Types"));
			checkMenuItem.Active = true;
			checkMenuItem.Toggled += delegate {
				if (checkMenuItem.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Type;
					CreateColumns ();
					StartSearch ();
				}
			};
			
			CheckMenuItem checkMenuItem1 = this.searchentry1.AddFilterOption (1, GettextCatalog.GetString ("Members"));
			checkMenuItem1.Toggled += delegate {
				if (checkMenuItem1.Active) {
					searchMode = AssemblyBrowserWidget.SearchMode.Member;
					CreateColumns ();
					StartSearch ();
				}
			};

			languageCombobox = Gtk.ComboBox.NewText ();
			//languageCombobox.AppendText (GettextCatalog.GetString ("Summary"));
			languageCombobox.AppendText (GettextCatalog.GetString ("IL"));
			languageCombobox.AppendText (GettextCatalog.GetString ("C#"));
			languageCombobox.Active = Math.Min (1, PropertyService.Get ("AssemblyBrowser.InspectLanguage", 1));
			languageCombobox.Changed += LanguageComboboxhandleChanged;

			loader = new CecilLoader (true);
			loader.IncludeInternalMembers = true;
			TreeView = new AssemblyBrowserTreeView (new NodeBuilder[] { 
				new ErrorNodeBuilder (),
				new ProjectNodeBuilder (this),
				new AssemblyNodeBuilder (this),
				new ModuleReferenceNodeBuilder (),
				new AssemblyReferenceNodeBuilder (this),
				//new AssemblyReferenceFolderNodeBuilder (this),
				new AssemblyResourceFolderNodeBuilder (),
				new ResourceNodeBuilder (),
				new NamespaceBuilder (this),
				new DomTypeNodeBuilder (this),
				new DomMethodNodeBuilder (this),
				new DomFieldNodeBuilder (this),
				new DomEventNodeBuilder (this),
				new DomPropertyNodeBuilder (this),
				new BaseTypeFolderNodeBuilder (this),
				new BaseTypeNodeBuilder (this)
				}, new TreePadOption [0]);
			TreeView.Tree.Selection.Mode = Gtk.SelectionMode.Single;
			TreeView.Tree.CursorChanged += HandleCursorChanged;
			TreeView.ShadowType = ShadowType.None;
			TreeView.BorderWidth = 1;
			TreeView.ShowBorderLine = false;
			TreeView.Zoom = 1.0;
			treeViewPlaceholder.Add (TreeView);

//			this.descriptionLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 9"));
//			this.documentationLabel.ModifyFont (Pango.FontDescription.FromString ("Sans 12"));
//			this.documentationLabel.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (255, 255, 225));
//			this.documentationLabel.Wrap = true;
			
			var options = new MonoDevelop.Ide.Gui.CommonTextEditorOptions () {
				ShowFoldMargin = false,
				ShowIconMargin = false,
				ShowLineNumberMargin = false,
				HighlightCaretLine = true,
			};
			inspectEditor = new TextEditor (new TextDocument (), options);
			inspectEditor.ButtonPressEvent += HandleInspectEditorButtonPressEvent;
			
			this.inspectEditor.Document.ReadOnly = true;
//			this.inspectEditor.Document.SyntaxMode = new Mono.TextEditor.Highlighting.MarkupSyntaxMode ();
			this.inspectEditor.TextViewMargin.GetLink = delegate(Mono.TextEditor.MarginMouseEventArgs arg) {
				var loc = inspectEditor.PointToLocation (arg.X, arg.Y);
				int offset = inspectEditor.LocationToOffset (loc);
				var referencedSegment = ReferencedSegments != null ? ReferencedSegments.FirstOrDefault (seg => seg.Segment.Contains (offset)) : null;
				if (referencedSegment == null)
					return null;
				if (referencedSegment.Reference is TypeDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((TypeDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is MethodDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((MethodDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is PropertyDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((PropertyDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is FieldDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((FieldDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is EventDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((EventDefinition)referencedSegment.Reference);
				
				if (referencedSegment.Reference is FieldDefinition)
					return new XmlDocIdGenerator ().GetXmlDocPath ((FieldDefinition)referencedSegment.Reference);

				if (referencedSegment.Reference is TypeReference) {
					return new XmlDocIdGenerator ().GetXmlDocPath ((TypeReference)referencedSegment.Reference);
				}
				return referencedSegment.Reference.ToString ();
			};
			this.inspectEditor.LinkRequest += InspectEditorhandleLinkRequest;
			documentationScrolledWindow.Add (inspectEditor);

			this.hpaned1.ExposeEvent += HPaneExpose;
			hpaned1 = hpaned1.ReplaceWithWidget (new HPanedThin (), true);
			hpaned1.Position = 271;

			this.notebook1.SetTabLabel (this.documentationScrolledWindow, new Label (GettextCatalog.GetString ("Documentation")));
			this.notebook1.SetTabLabel (this.searchWidget, new Label (GettextCatalog.GetString ("Search")));
			notebook1.Page = 0;
			//this.searchWidget.Visible = false;
				
			typeListStore = new Gtk.ListStore (typeof(Xwt.Drawing.Image), // type image
			                                   typeof(string), // name
			                                   typeof(string), // namespace
			                                   typeof(string), // assembly
				                               typeof(IMember)
			                                  );
			
			memberListStore = new Gtk.ListStore (typeof(Xwt.Drawing.Image), // member image
			                                   typeof(string), // name
			                                   typeof(string), // Declaring type full name
			                                   typeof(string), // assembly
				                               typeof(IMember)
			                                  );
			CreateColumns ();
//			this.searchEntry.Changed += SearchEntryhandleChanged;
			this.searchTreeview.RowActivated += SearchTreeviewhandleRowActivated;
			this.notebook1.ShowTabs = false;
			this.ShowAll ();
		}
コード例 #3
0
ファイル: gfaxphonebook.cs プロジェクト: horga83/gfax
        private void on_DeletePhonebookButton_clicked(object o, EventArgs args)
        {
            if (myPhoneBooks.Length > 0)
            {
                string[] list = new string[myPhoneBooks.Length];

                if (myPhoneBooks != null)
                {
                    // populate the list
                    int i = 0;
                    foreach (Phonebook pb in myPhoneBooks)
                    {
                        list[i++] = pb.Name;
                    }
                }
                string book = list[PhonebookComboBox.Active];

                MessageDialog md = new MessageDialog(
                    null,
                    DialogFlags.DestroyWithParent,
                    MessageType.Question,
                    ButtonsType.YesNo,
                    Catalog.GetString("Are you sure you want to delete the phone book?")
                    );

                ResponseType result = (ResponseType)md.Run();

                if (result == ResponseType.Yes)
                {
                    md.Destroy();

                    if (book == null)
                    {
                        return;
                    }
                    Phonetools.delete_book(book);

                    PhonebookComboBox.RemoveText(PhonebookComboBox.Active);
                    ItemStore.Clear();

                    myPhoneBooks = Phonetools.get_phonebooks();

                    if (myPhoneBooks.Length > 0)
                    {
                        // now reload
                        PhonebookComboBox.Active = 0;
                        on_PhonebookComboBox_changed(null, null);
                    }
                    else
                    {
                        DeletePhonebookButton.Sensitive = false;
                        PhonebookComboBox.InsertText(0, " ");
                    }
                    PhonebookComboBox.Active = 0;
                }
                else
                {
                    md.Destroy();
                }
            }
        }