コード例 #1
0
 public ResourceFilter(Func<string> GetFilterText, TreeModel childModel, TreePath root)
     : base(childModel, root)
 {
     VisibleFunc = new TreeModelFilterVisibleFunc ((model, iter) => {
         var key = model.GetValue(iter, 0) as string;
         var value = model.GetValue(iter, 1);
         var comment = model.GetValue(iter, 2);
         if (
             string.IsNullOrEmpty(GetFilterText ()) ||
             string.IsNullOrEmpty(key) ||
             key.Contains(GetFilterText ()) ||
             value != null && value.ToString().Contains(GetFilterText ()) ||
             comment != null && comment.ToString().Contains(GetFilterText ())
         ) {
             return true;
         }
         return false;
     });
 }
コード例 #2
0
 public ResourceFilter(Func <string> GetFilterText, TreeModel childModel, TreePath root) : base(childModel, root)
 {
     VisibleFunc = new TreeModelFilterVisibleFunc((model, iter) => {
         var key     = model.GetValue(iter, 0) as string;
         var value   = model.GetValue(iter, 1);
         var comment = model.GetValue(iter, 2);
         if (
             string.IsNullOrEmpty(GetFilterText()) ||
             string.IsNullOrEmpty(key) ||
             key.Contains(GetFilterText()) ||
             value != null && value.ToString().Contains(GetFilterText()) ||
             comment != null && comment.ToString().Contains(GetFilterText())
             )
         {
             return(true);
         }
         return(false);
     });
 }
コード例 #3
0
ファイル: ErrorListPad.cs プロジェクト: segaman/monodevelop
		void CreateControl ()
		{
			control = new HPaned ();

			store = new Gtk.ListStore (typeof (Gdk.Pixbuf), // image - type
			                           typeof (bool),       // read?
			                           typeof (Task));       // read? -- use Pango weight

			TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc (FilterTaskTypes);
			filter = new TreeModelFilter (store, null);
			filter.VisibleFunc = filterFunct;
			
			sort = new TreeModelSort (filter);
			sort.SetSortFunc (VisibleColumns.Type, SeverityIterSort);
			sort.SetSortFunc (VisibleColumns.Project, ProjectIterSort);
			sort.SetSortFunc (VisibleColumns.File, FileIterSort);
			
			view = new PadTreeView (sort);
			view.RulesHint = true;
			view.DoPopupMenu = (evnt) => IdeApp.CommandService.ShowContextMenu (view, evnt, CreateMenu ());
			AddColumns ();
			LoadColumnsVisibility ();
			view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type;
			view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
			view.Columns[VisibleColumns.File].SortColumnId = VisibleColumns.File;
			
			sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (view);
			TaskService.Errors.TasksRemoved      += DispatchService.GuiDispatch<TaskEventHandler> (ShowResults);
			TaskService.Errors.TasksAdded        += DispatchService.GuiDispatch<TaskEventHandler> (TaskAdded);
			TaskService.Errors.TasksChanged      += DispatchService.GuiDispatch<TaskEventHandler> (TaskChanged);
			TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;
			
			IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
			IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed;
			
			view.RowActivated += new RowActivatedHandler (OnRowActivated);
			
			iconWarning = sw.RenderIcon (Stock.Warning, Gtk.IconSize.Menu, "");
			iconError = sw.RenderIcon (Stock.Error, Gtk.IconSize.Menu, "");
			iconInfo = sw.RenderIcon (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");
			
			control.Add1 (sw);
			
			outputView = new LogView ();
			control.Add2 (outputView);
			
			Control.ShowAll ();
			
			control.SizeAllocated += HandleControlSizeAllocated;
			
			bool outputVisible = PropertyService.Get<bool> (outputViewVisiblePropertyName, false);
			if (outputVisible) {
				outputView.Visible = true;
				logBtn.Active = true;
			} else {
				outputView.Hide ();
			}
			
			sw.SizeAllocated += HandleSwSizeAllocated;
			
			// Load existing tasks
			foreach (Task t in TaskService.Errors) {
				AddTask (t);
			}

			control.FocusChain = new Gtk.Widget [] { sw };
		}
コード例 #4
0
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.TreeStore(typeof(Xwt.Drawing.Image),               // image - type
                                      typeof(bool),                            // read?
                                      typeof(Task),                            // read? -- use Pango weight
                                      typeof(string));

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTasks);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);

            view = new PadTreeView(sort);
            view.ShowExpanders = true;
            view.RulesHint     = true;
            view.DoPopupMenu   = (evnt) => IdeApp.CommandService.ShowContextMenu(view, evnt, CreateMenu());
            AddColumns();
            LoadColumnsVisibility();
            view.Columns[VisibleColumns.Type].SortColumnId    = VisibleColumns.Type;
            view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
            view.Columns[VisibleColumns.File].SortColumnId    = VisibleColumns.File;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += DispatchService.GuiDispatch <TaskEventHandler> (ShowResults);
            TaskService.Errors.TasksAdded   += DispatchService.GuiDispatch <TaskEventHandler> (TaskAdded);
            TaskService.Errors.TasksChanged += DispatchService.GuiDispatch <TaskEventHandler> (TaskChanged);
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += new RowActivatedHandler(OnRowActivated);

            iconWarning = ImageService.GetIcon(Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            iconError   = ImageService.GetIcon(Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
            iconInfo    = ImageService.GetIcon(Ide.Gui.Stock.Information, Gtk.IconSize.Menu);
            iconEmpty   = ImageService.GetIcon(Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);

            control.Add1(sw);

            outputView = new LogView();
            control.Add2(outputView);

            Control.ShowAll();

            control.SizeAllocated += HandleControlSizeAllocated;

            bool outputVisible = PropertyService.Get <bool> (outputViewVisiblePropertyName, false);

            if (outputVisible)
            {
                outputView.Visible = true;
                logBtn.Active      = true;
            }
            else
            {
                outputView.Hide();
            }

            sw.SizeAllocated += HandleSwSizeAllocated;

            // Load existing tasks
            foreach (Task t in TaskService.Errors)
            {
                AddTask(t);
            }

            control.FocusChain = new Gtk.Widget [] { sw };
        }
コード例 #5
0
		void CreateControl ()
		{
			control = new HPaned ();

			store = new Gtk.TreeStore (typeof (Xwt.Drawing.Image), // image - type
									   typeof (bool),       // read?
									   typeof (TaskListEntry),       // read? -- use Pango weight
									   typeof (string));
			SemanticModelAttribute modelAttr = new SemanticModelAttribute ("store__Type", "store__Read", "store__Task", "store__Description");
			TypeDescriptor.AddAttributes (store, modelAttr);

			TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc (FilterTasks);
			filter = new TreeModelFilter (store, null);
			filter.VisibleFunc = filterFunct;
			
			sort = new TreeModelSort (filter);
			sort.SetSortFunc (VisibleColumns.Type, SeverityIterSort);
			sort.SetSortFunc (VisibleColumns.Project, ProjectIterSort);
			sort.SetSortFunc (VisibleColumns.File, FileIterSort);
			
			view = new PadTreeView (sort);
			view.ShowExpanders = true;
			view.RulesHint = true;
			view.DoPopupMenu = (evnt) => IdeApp.CommandService.ShowContextMenu (view, evnt, CreateMenu ());
			AddColumns ();
			LoadColumnsVisibility ();
			view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type;
			view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
			view.Columns[VisibleColumns.File].SortColumnId = VisibleColumns.File;
			
			sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (view);
			TaskService.Errors.TasksRemoved      += ShowResults;
			TaskService.Errors.TasksAdded        += TaskAdded;
			TaskService.Errors.TasksChanged      += TaskChanged;
			TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;
			
			IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
			IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed;
			
			view.RowActivated += new RowActivatedHandler (OnRowActivated);
			
			iconWarning = ImageService.GetIcon (Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
			iconError = ImageService.GetIcon (Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
			iconInfo = ImageService.GetIcon (Ide.Gui.Stock.Information, Gtk.IconSize.Menu);
			iconEmpty = ImageService.GetIcon (Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);
			
			control.Add1 (sw);
			
			outputView = new LogView { Name = "buildOutput" };
			control.Add2 (outputView);
			
			control.ShowAll ();
			
			control.SizeAllocated += HandleControlSizeAllocated;
			
			bool outputVisible = OutputViewVisible;
			if (outputVisible) {
				outputView.Visible = true;
				logBtn.Active = true;
			} else {
				outputView.Hide ();
			}
			
			sw.SizeAllocated += HandleSwSizeAllocated;
			
			// Load existing tasks
			foreach (TaskListEntry t in TaskService.Errors) {
				AddTask (t);
			}

			control.FocusChain = new Gtk.Widget [] { sw };
		}
コード例 #6
0
ファイル: ErrorListPad.cs プロジェクト: sim756/monodevelop
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.TreeStore(typeof(Xwt.Drawing.Image),               // image - type
                                      typeof(bool),                            // read?
                                      typeof(TaskListEntry),                   // read? -- use Pango weight
                                      typeof(string));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Type", "store__Read", "store__Task", "store__Description");

            TypeDescriptor.AddAttributes(store, modelAttr);

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTasks);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);
            sort.SetSortFunc(VisibleColumns.Category, CategoryIterSort);

            view = new PadTreeView(sort);
            view.Selection.Mode = SelectionMode.Multiple;
            view.ShowExpanders  = true;
            view.RulesHint      = true;

            view.DoPopupMenu += ShowPopup;

            AddColumns();
            LoadColumnsVisibility();
            view.Columns [VisibleColumns.Type].SortColumnId     = VisibleColumns.Type;
            view.Columns [VisibleColumns.Project].SortColumnId  = VisibleColumns.Project;
            view.Columns [VisibleColumns.File].SortColumnId     = VisibleColumns.File;
            view.Columns [VisibleColumns.Category].SortColumnId = VisibleColumns.Category;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += ShowResults;
            TaskService.Errors.TasksAdded   += TaskAdded;
            TaskService.Errors.TasksChanged += TaskChanged;
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += new RowActivatedHandler(OnRowActivated);

            iconWarning = ImageService.GetIcon(Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            iconError   = ImageService.GetIcon(Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
            iconInfo    = ImageService.GetIcon(Ide.Gui.Stock.Information, Gtk.IconSize.Menu);
            iconEmpty   = ImageService.GetIcon(Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);

            control.Add1(sw);

            control.ShowAll();

            // Load existing tasks
            foreach (TaskListEntry t in TaskService.Errors)
            {
                AddTask(t);
            }
        }
コード例 #7
0
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.ListStore(typeof(Gdk.Pixbuf),               // image - type
                                      typeof(bool),                     // read?
                                      typeof(Task));                    // read? -- use Pango weight

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTaskTypes);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);

            view                   = new MonoDevelop.Ide.Gui.Components.PadTreeView(sort);
            view.RulesHint         = true;
            view.PopupMenu        += new PopupMenuHandler(OnPopupMenu);
            view.ButtonPressEvent += new ButtonPressEventHandler(OnButtonPressed);
            AddColumns();
            LoadColumnsVisibility();
            view.Columns[VisibleColumns.Type].SortColumnId    = VisibleColumns.Type;
            view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
            view.Columns[VisibleColumns.File].SortColumnId    = VisibleColumns.File;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += (TaskEventHandler)DispatchService.GuiDispatch(new TaskEventHandler(ShowResults));
            TaskService.Errors.TasksAdded   += (TaskEventHandler)DispatchService.GuiDispatch(new TaskEventHandler(TaskAdded));
            TaskService.Errors.TasksChanged += (TaskEventHandler)DispatchService.GuiDispatch(new TaskEventHandler(TaskChanged));
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += new RowActivatedHandler(OnRowActivated);

            iconWarning = sw.RenderIcon(Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, "");
            iconError   = sw.RenderIcon(Gtk.Stock.DialogError, Gtk.IconSize.Menu, "");
            iconInfo    = sw.RenderIcon(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");

            control.Add1(sw);

            outputView = new LogView();
            control.Add2(outputView);

            Control.ShowAll();

            sw.SizeAllocated += delegate {
                if (outputView.Visible)
                {
                    PropertyService.Set(logSeparatorPositionPropertyName, (double)((double)control.Position / (double)control.Allocation.Width));
                }
            };

            outputView.Hide();

            CreateMenu();

            // Load existing tasks
            foreach (Task t in TaskService.Errors)
            {
                AddTask(t);
            }

            control.FocusChain = new Gtk.Widget [] { sw };
        }
コード例 #8
0
		public void Initialize (IPadWindow window)
		{
			this.window = window;
			window.PadShown += delegate {
				if (needsReload)
					Refresh ();
			};
			
			DockItemToolbar toolbar = window.GetToolbar (PositionType.Top);
			
			errorBtn = new ToggleButton ();
			errorBtn.Active = (bool)PropertyService.Get (showErrorsPropertyName, true);
			string errorTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Error) != EnabledLoggingLevel.Error
				&& (InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Fatal) != EnabledLoggingLevel.Fatal) {
				errorBtn.Sensitive = false;
				errorTipText = GettextCatalog.GetString ("Logging of errors is not enabled");
			} else {
				errorTipText = GettextCatalog.GetString ("Show errors");
			}
			errorBtn.Image = new Gtk.Image (Gtk.Stock.DialogError, Gtk.IconSize.Menu);
			errorBtn.Image.Show ();
			errorBtn.Toggled += new EventHandler (FilterChanged);
			errorBtn.TooltipText = errorTipText;
			UpdateErrorsNum();
			toolbar.Add (errorBtn);
			
			warnBtn = new ToggleButton ();
			warnBtn.Active = (bool)PropertyService.Get (showWarningsPropertyName, true);
			string warnTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Warn) != EnabledLoggingLevel.Warn) {
				warnBtn.Sensitive = false;
				warnTipText = GettextCatalog.GetString ("Logging of warnings is not enabled");
			} else {
				warnTipText = GettextCatalog.GetString ("Show warnings");
			}
			warnBtn.Image = new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
			warnBtn.Image.Show ();
			warnBtn.Toggled += new EventHandler (FilterChanged);
			warnBtn.TooltipText = warnTipText;
			UpdateWarningsNum();
			toolbar.Add (warnBtn);
			
			msgBtn = new ToggleButton ();
			msgBtn.Active = (bool)PropertyService.Get (showMessagesPropertyName, true);
			string msgTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Info) != EnabledLoggingLevel.Info) {
				msgBtn.Sensitive = false;
				msgTipText = GettextCatalog.GetString ("Logging of informational messages is not enabled");
			} else {
				msgTipText = GettextCatalog.GetString ("Show messages");
			}
			msgBtn.Image = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu);
			msgBtn.Image.Show ();
			msgBtn.Toggled += new EventHandler (FilterChanged);
			msgBtn.TooltipText = msgTipText;
			UpdateMessagesNum();
			toolbar.Add (msgBtn);
			
			debugBtn = new ToggleButton ();
			debugBtn.Active = (bool)PropertyService.Get (showDebugPropertyName, true);
			string debugTipText;
			if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Debug) != EnabledLoggingLevel.Debug) {
				debugBtn.Sensitive = false;
				debugTipText = GettextCatalog.GetString ("Logging of debug messages is not enabled");
			} else {
				debugTipText = GettextCatalog.GetString ("Show debug");
			}
			debugBtn.Image = new Gtk.Image (Gtk.Stock.DialogQuestion, Gtk.IconSize.Menu);
			debugBtn.Image.Show ();
			debugBtn.Toggled += new EventHandler (FilterChanged);
			debugBtn.TooltipText = debugTipText;
			UpdateDebugNum();
			toolbar.Add (debugBtn);
			
			toolbar.Add (new SeparatorToolItem ());
			
			Gtk.Button clearBtn = new Gtk.Button (new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu));
			clearBtn.Clicked += new EventHandler (OnClearList);
			toolbar.Add (clearBtn);
			toolbar.ShowAll ();

			// Content
			
			store = new Gtk.ListStore (typeof (Gdk.Pixbuf),      // image - type
			                           typeof (string),          // desc
			                           typeof (string),          // time
			                           typeof (string),          // type string
			                           typeof (LogMessage));     // message

			TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc (FilterTaskTypes);
			filter = new TreeModelFilter (store, null);
            filter.VisibleFunc = filterFunct;
			
			view = new MonoDevelop.Ide.Gui.Components.PadTreeView (new Gtk.TreeModelSort (filter));
			view.RulesHint = true;
			view.PopupMenu += new PopupMenuHandler (OnPopupMenu);
			view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed);
			view.HeadersClickable = true;
			view.Selection.Mode = SelectionMode.Multiple;
			
			AddColumns ();
			
			sw = new Gtk.ScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (view);
			
			LoggingService.AddLogger (this);
						
			iconWarning = sw.RenderIcon (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, "");
			iconError = sw.RenderIcon (Gtk.Stock.DialogError, Gtk.IconSize.Menu, "");
			iconInfo = sw.RenderIcon (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");
			iconDebug = sw.RenderIcon (Gtk.Stock.DialogQuestion, Gtk.IconSize.Menu, "");
			
			control = sw;
			sw.ShowAll ();
			
			Refresh ();

			store.SetSortFunc ((int)Columns.Time, TimeSortFunc);
			((TreeModelSort)view.Model).SetSortColumnId ((int)Columns.Time, SortType.Descending);
		}
コード例 #9
0
		void CreateControl ()
		{
			control = new HPaned ();

			store = new Gtk.ListStore (typeof (Gdk.Pixbuf), // image - type
			                           typeof (bool),       // read?
			                           typeof (Task));       // read? -- use Pango weight

			TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc (FilterTaskTypes);
			filter = new TreeModelFilter (store, null);
			filter.VisibleFunc = filterFunct;
			
			sort = new TreeModelSort (filter);
			sort.SetSortFunc (VisibleColumns.Type, SeverityIterSort);
			sort.SetSortFunc (VisibleColumns.Project, ProjectIterSort);
			sort.SetSortFunc (VisibleColumns.File, FileIterSort);
			
			view = new MonoDevelop.Ide.Gui.Components.PadTreeView (sort);
			view.RulesHint = true;
			view.PopupMenu += new PopupMenuHandler (OnPopupMenu);
			view.ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressed);
			AddColumns ();
			LoadColumnsVisibility ();
			view.Columns[VisibleColumns.Type].SortColumnId = VisibleColumns.Type;
			view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
			view.Columns[VisibleColumns.File].SortColumnId = VisibleColumns.File;
			
			sw = new MonoDevelop.Components.CompactScrolledWindow ();
			sw.ShadowType = ShadowType.None;
			sw.Add (view);
			TaskService.Errors.TasksRemoved      += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (ShowResults));
			TaskService.Errors.TasksAdded        += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (TaskAdded));
			TaskService.Errors.TasksChanged      += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (TaskChanged));
			TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;
			
			IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
			IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed;
			
			view.RowActivated += new RowActivatedHandler (OnRowActivated);
			
			iconWarning = sw.RenderIcon (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, "");
			iconError = sw.RenderIcon (Gtk.Stock.DialogError, Gtk.IconSize.Menu, "");
			iconInfo = sw.RenderIcon (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");
			
			control.Add1 (sw);
			
			outputView = new LogView ();
			control.Add2 (outputView);
			
			Control.ShowAll ();
			
			sw.SizeAllocated += delegate {
				if (outputView.Visible)
					PropertyService.Set (logSeparatorPositionPropertyName, (double) ((double) control.Position / (double) control.Allocation.Width));
			};
			
			outputView.Hide ();
			
			CreateMenu ();

			// Load existing tasks
			foreach (Task t in TaskService.Errors) {
				AddTask (t);
			}

			control.FocusChain = new Gtk.Widget [] { sw };
		}
コード例 #10
0
        public void Initialize(IPadWindow window)
        {
            this.window      = window;
            window.PadShown += delegate {
                if (needsReload)
                {
                    Refresh();
                }
            };

            DockItemToolbar toolbar = window.GetToolbar(PositionType.Top);

            errorBtn        = new ToggleButton();
            errorBtn.Active = (bool)PropertyService.Get(showErrorsPropertyName, true);
            string errorTipText;

            if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Error) != EnabledLoggingLevel.Error &&
                (InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Fatal) != EnabledLoggingLevel.Fatal)
            {
                errorBtn.Sensitive = false;
                errorTipText       = GettextCatalog.GetString("Logging of errors is not enabled");
            }
            else
            {
                errorTipText = GettextCatalog.GetString("Show errors");
            }
            errorBtn.Image = new Gtk.Image(Gtk.Stock.DialogError, Gtk.IconSize.Menu);
            errorBtn.Image.Show();
            errorBtn.Toggled    += new EventHandler(FilterChanged);
            errorBtn.TooltipText = errorTipText;
            UpdateErrorsNum();
            toolbar.Add(errorBtn);

            warnBtn        = new ToggleButton();
            warnBtn.Active = (bool)PropertyService.Get(showWarningsPropertyName, true);
            string warnTipText;

            if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Warn) != EnabledLoggingLevel.Warn)
            {
                warnBtn.Sensitive = false;
                warnTipText       = GettextCatalog.GetString("Logging of warnings is not enabled");
            }
            else
            {
                warnTipText = GettextCatalog.GetString("Show warnings");
            }
            warnBtn.Image = new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
            warnBtn.Image.Show();
            warnBtn.Toggled    += new EventHandler(FilterChanged);
            warnBtn.TooltipText = warnTipText;
            UpdateWarningsNum();
            toolbar.Add(warnBtn);

            msgBtn        = new ToggleButton();
            msgBtn.Active = (bool)PropertyService.Get(showMessagesPropertyName, true);
            string msgTipText;

            if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Info) != EnabledLoggingLevel.Info)
            {
                msgBtn.Sensitive = false;
                msgTipText       = GettextCatalog.GetString("Logging of informational messages is not enabled");
            }
            else
            {
                msgTipText = GettextCatalog.GetString("Show messages");
            }
            msgBtn.Image = new Gtk.Image(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu);
            msgBtn.Image.Show();
            msgBtn.Toggled    += new EventHandler(FilterChanged);
            msgBtn.TooltipText = msgTipText;
            UpdateMessagesNum();
            toolbar.Add(msgBtn);

            debugBtn        = new ToggleButton();
            debugBtn.Active = (bool)PropertyService.Get(showDebugPropertyName, true);
            string debugTipText;

            if ((InternalLog.EnabledLoggingLevel & EnabledLoggingLevel.Debug) != EnabledLoggingLevel.Debug)
            {
                debugBtn.Sensitive = false;
                debugTipText       = GettextCatalog.GetString("Logging of debug messages is not enabled");
            }
            else
            {
                debugTipText = GettextCatalog.GetString("Show debug");
            }
            debugBtn.Image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Menu);
            debugBtn.Image.Show();
            debugBtn.Toggled    += new EventHandler(FilterChanged);
            debugBtn.TooltipText = debugTipText;
            UpdateDebugNum();
            toolbar.Add(debugBtn);

            toolbar.Add(new SeparatorToolItem());

            Gtk.Button clearBtn = new Gtk.Button(new Gtk.Image(Gtk.Stock.Clear, Gtk.IconSize.Menu));
            clearBtn.Clicked += new EventHandler(OnClearList);
            toolbar.Add(clearBtn);
            toolbar.ShowAll();

            // Content

            store = new Gtk.ListStore(typeof(Gdk.Pixbuf),                    // image - type
                                      typeof(string),                        // desc
                                      typeof(string),                        // time
                                      typeof(string),                        // type string
                                      typeof(LogMessage));                   // message

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTaskTypes);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            view                  = new MonoDevelop.Ide.Gui.Components.PadTreeView(new Gtk.TreeModelSort(filter));
            view.RulesHint        = true;
            view.HeadersClickable = true;
            view.Selection.Mode   = SelectionMode.Multiple;

            view.DoPopupMenu = (evt) =>
                               IdeApp.CommandService.ShowContextMenu(view, evt, new CommandEntrySet()
            {
                new CommandEntry(EditCommands.Copy),
                new CommandEntry(EditCommands.SelectAll),
            });

            AddColumns();

            sw            = new Gtk.ScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);

            LoggingService.AddLogger(this);

            iconWarning = sw.RenderIcon(Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, "");
            iconError   = sw.RenderIcon(Gtk.Stock.DialogError, Gtk.IconSize.Menu, "");
            iconInfo    = sw.RenderIcon(Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");
            iconDebug   = sw.RenderIcon(Gtk.Stock.DialogQuestion, Gtk.IconSize.Menu, "");

            control = sw;
            sw.ShowAll();

            Refresh();

            store.SetSortFunc((int)Columns.Time, TimeSortFunc);
            ((TreeModelSort)view.Model).SetSortColumnId((int)Columns.Time, SortType.Descending);
        }