コード例 #1
0
		public DemoTextView () : base ("TextView")
		{
			SetDefaultSize (450,450);
			BorderWidth = 0;

			VPaned vpaned = new VPaned ();
			vpaned.BorderWidth = 5;
			Add (vpaned);

			// For convenience, we just use the autocreated buffer from
			// the first text view; you could also create the buffer
			// by itself, then later create a view widget.
			view1 = new TextView ();
			TextBuffer buffer = view1.Buffer;
			view2 = new TextView (buffer);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vpaned.Add1 (sw);
			sw.Add (view1);

			sw = new ScrolledWindow ();
			sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
			vpaned.Add2 (sw);
			sw.Add (view2);

			CreateTags (buffer);
			InsertText (buffer);

			AttachWidgets (view1);
			AttachWidgets (view2);

			ShowAll ();
		}
コード例 #2
0
        public ContentWidget(string name)
        {
            // Building Paneds
            var outerVPaned = new VPaned();
            var innerVPaned = new VPaned();
            var middleNb    = new Notebook();
            var lowerNb     = new Notebook();

            this.tv1 = new TreeView();
            this.tv2 = new TreeView();
            this.tv3 = new TreeView();

            ScrolledWindow sw;

            sw            = new ScrolledWindow();
            sw.ShadowType = ShadowType.In;
            sw.AddWithViewport(tv1);
            outerVPaned.Add1(sw);
            outerVPaned.Add2(innerVPaned);
            innerVPaned.Add1(middleNb);
            innerVPaned.Add2(lowerNb);
            sw            = new ScrolledWindow();
            sw.ShadowType = ShadowType.In;
            sw.AddWithViewport(tv2);
            middleNb.Add(sw);
            sw            = new ScrolledWindow();
            sw.ShadowType = ShadowType.In;
            sw.AddWithViewport(tv3);
            lowerNb.Add(sw);
            AddWithViewport(outerVPaned);
            ShowAll();
        }
コード例 #3
0
        public InfoAffectableWindow(string title, bool isEdited = false) : base(WindowType.Toplevel)
        {
            Modal = true;
            Title = title;

            TransientFor = MainWindow.GetInstance();

            VPaned.Add1(infoView);
            VPaned.Add2(ActionButtonBox);

            this.Add(VPaned);

            ActionButtonBox.Add(CloseButton);
            ActionButtonBox.Add(EditButton);

            CloseButton.Clicked += (object sender, System.EventArgs e) => this.Destroy();
            EditButton.Clicked  += (object sender, System.EventArgs e) =>
            {
                if (isEdited)
                {
                    this.Destroy();
                }
                else
                {
                    Edit();
                }
            };

            this.Destroyed += (object o, System.EventArgs args) =>
            {
                //MainWindow.GetInstance().Sensitive = true;
            };

            //MainWindow.GetInstance().Sensitive = false;
        }
コード例 #4
0
        public EditAffectableWindow(string title, Affectable affectable) : base(WindowType.Toplevel)
        {
            Modal = true;

            Title = title;

            TransientFor = MainWindow.GetInstance();

            VPaned.Add(EntryBox);

            NameEntry = new Entry(affectable.Name);
            AddEntry("Name", NameEntry);
            SciNameEntry = new Entry(affectable.ScientificName);
            AddEntry("Scientific Name", SciNameEntry);
            DescriptionTextView             = new TextView();
            DescriptionTextView.Buffer.Text = affectable.Description;
            AddEntry("Description ", DescriptionTextView);

            ActionButtonBox.Add(InfoButton);
            ActionButtonBox.Add(SaveButton);
            ActionButtonBox.Add(DeleteButton);
            ActionButtonBox.Add(DiscardButton);
            VPaned.Add2(ActionButtonBox);

            this.Add(VPaned);
            InfoButton.Clicked    += (object sender, System.EventArgs e) => Info();
            DiscardButton.Clicked += (object sender, System.EventArgs e) => TryToClose();
            SaveButton.Clicked    += (object sender, System.EventArgs e) => Save();
            DeleteButton.Clicked  += (object sender, System.EventArgs e) => Delete();
        }
コード例 #5
0
        private void BuildView()
        {
            podcast_view_scroller = new ScrolledWindow();

            podcast_view_scroller.ShadowType       = ShadowType.In;
            podcast_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_feed_view_scroller = new ScrolledWindow();

            podcast_feed_view_scroller.ShadowType       = ShadowType.In;
            podcast_feed_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_feed_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_model      = new PodcastPlaylistModel();
            podcast_feed_model = new PodcastFeedModel();

            podcast_model.ClearModel();
            podcast_feed_model.ClearModel();

            podcast_model.QueueAdd(PodcastCore.Library.Podcasts);
            podcast_feed_model.QueueAdd(PodcastCore.Library.Feeds);

            podcast_view = new PodcastPlaylistView(podcast_model);
            podcast_view.ButtonPressEvent += OnPlaylistViewButtonPressEvent;

            podcast_feed_view = new PodcastFeedView(podcast_feed_model);
            podcast_feed_view.Selection.Changed += OnFeedViewSelectionChanged;
            podcast_feed_view.ButtonPressEvent  += OnPodcastFeedViewButtonPressEvent;
            podcast_feed_view.SelectAll         += OnSelectAllHandler;

            podcast_view_scroller.Add(podcast_view);
            podcast_feed_view_scroller.Add(podcast_feed_view);

            feed_info_pane = new HPaned();
            feed_info_pane.Add1(podcast_feed_view_scroller);
            // -- later-- feed_info_pane.Add2 ();

            feed_playlist_pane = new VPaned();
            feed_playlist_pane.Add1(feed_info_pane);
            feed_playlist_pane.Add2(podcast_view_scroller);

            try
            {
                feed_playlist_pane.Position =
                    GConfSchemas.PlaylistSeparatorPositionSchema.Get();
            }
            catch {
                feed_playlist_pane.Position = 300;
                GConfSchemas.PlaylistSeparatorPositionSchema.Set(
                    feed_playlist_pane.Position
                    );
            }

            update_button = new ActionButton(Globals.ActionManager ["PodcastUpdateFeedsAction"]);
            viewWidget    = feed_playlist_pane;

            viewWidget.ShowAll();
        }
コード例 #6
0
ファイル: DemoPanes.cs プロジェクト: plprevost/gtk-sharp-edit
        public DemoPanes() : base("Panes")
        {
            VBox vbox = new VBox(false, 0);

            Add(vbox);

            VPaned vpaned = new VPaned();

            vbox.PackStart(vpaned, true, true, 0);
            vpaned.BorderWidth = 5;

            HPaned hpaned = new HPaned();

            vpaned.Add1(hpaned);

            Frame frame = new Frame();

            frame.ShadowType = ShadowType.In;
            frame.SetSizeRequest(60, 60);
            hpaned.Add1(frame);

            Gtk.Button button = new Button("_Hi there");
            frame.Add(button);

            frame            = new Frame();
            frame.ShadowType = ShadowType.In;
            frame.SetSizeRequest(80, 60);
            hpaned.Add2(frame);

            frame            = new Frame();
            frame.ShadowType = ShadowType.In;
            frame.SetSizeRequest(60, 80);
            vpaned.Add2(frame);

            // Now create toggle buttons to control sizing
            vbox.PackStart(CreatePaneOptions(hpaned,
                                             "Horizontal",
                                             "Left",
                                             "Right"),
                           false, false, 0);

            vbox.PackStart(CreatePaneOptions(vpaned,
                                             "Vertical",
                                             "Top",
                                             "Bottom"),
                           false, false, 0);

            ShowAll();
        }
コード例 #7
0
        void Build()
        {
            Title         = GettextCatalog.GetString("Exception Caught");
            DefaultHeight = 500;
            DefaultWidth  = 600;
            VBox.Spacing  = 0;

            VBox.PackStart(CreateExceptionHeader(), false, true, 0);

            var paned = new VPaned();

            paned.Add1(CreateExceptionValueTreeView());
            paned.Add2(CreateStackTraceTreeView());
            paned.Show();

            var vbox = new VBox(false, 0);

            vbox.PackStart(CreateSeparator(), false, true, 0);
            vbox.PackStart(paned, true, true, 0);
            vbox.PackStart(CreateSeparator(), false, true, 0);
            vbox.Show();

            VBox.PackStart(vbox, true, true, 0);

            var actionArea = new HBox(false, 12)
            {
                BorderWidth = 6
            };

            OnlyShowMyCodeCheckbox          = new CheckButton(GettextCatalog.GetString("_Only show my code."));
            OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled;
            OnlyShowMyCodeCheckbox.Show();
            OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions().ProjectAssembliesOnly;

            var alignment = new Alignment(0.0f, 0.5f, 0.0f, 0.0f)
            {
                Child = OnlyShowMyCodeCheckbox
            };

            alignment.Show();

            actionArea.PackStart(alignment, true, true, 0);
            actionArea.PackStart(CreateButtonBox(), false, true, 0);
            actionArea.Show();

            VBox.PackStart(actionArea, false, true, 0);
            ActionArea.Hide();
        }
コード例 #8
0
ファイル: DemoPanes.cs プロジェクト: liberostelios/gtk-sharp
		public DemoPanes () : base ("Panes")
		{
			VBox vbox = new VBox (false, 0);
			Add (vbox);

			VPaned vpaned = new VPaned ();
			vbox.PackStart (vpaned, true, true, 0);
			vpaned.BorderWidth = 5;

			HPaned hpaned = new HPaned ();
			vpaned.Add1 (hpaned);

		        Frame frame = new Frame ();
		        frame.ShadowType = ShadowType.In;
			frame.SetSizeRequest (60, 60);
			hpaned.Add1 (frame);

			Gtk.Button button = new Button ("_Hi there");
			frame.Add (button);

			frame = new Frame ();
			frame.ShadowType = ShadowType.In;
			frame.SetSizeRequest (80, 60);
			hpaned.Add2 (frame);

			frame = new Frame ();
			frame.ShadowType = ShadowType.In;
			frame.SetSizeRequest (60, 80);
			vpaned.Add2 (frame);

			// Now create toggle buttons to control sizing
			vbox.PackStart (CreatePaneOptions (hpaned,
							   "Horizontal",
							   "Left",
							   "Right"),
					false, false, 0);

			vbox.PackStart (CreatePaneOptions (vpaned,
							   "Vertical",
							   "Top",
							   "Bottom"),
					false, false, 0);

			ShowAll ();
		}
コード例 #9
0
        public DemoTextView() : base("TextView")
        {
            SetDefaultSize(450, 450);
            BorderWidth = 0;

            VPaned vpaned = new VPaned();

            vpaned.BorderWidth = 5;
            Add(vpaned);

            // For convenience, we just use the autocreated buffer from
            // the first text view; you could also create the buffer
            // by itself, then later create a view widget.
            view1 = new TextView();
            TextBuffer buffer = view1.Buffer;

            view2 = new TextView(buffer);

            ScrolledWindow sw = new ScrolledWindow();

            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            vpaned.Add1(sw);
            sw.Add(view1);

            sw = new ScrolledWindow();
            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            vpaned.Add2(sw);
            sw.Add(view2);

            CreateTags(buffer);
            InsertText(buffer);

            AttachWidgets(view1);
            AttachWidgets(view2);

            ShowAll();
        }
コード例 #10
0
ファイル: UtilMainWindow.cs プロジェクト: langpavel/LPS-old
        protected virtual void Build()
        {
            // Widget LPS.Util.UtilMainWindow
            this.Name = "LPS.Util.UtilMainWindow";
            this.Title = Mono.Unix.Catalog.GetString("UtilMainWindow");
            this.WindowPosition = ((Gtk.WindowPosition) (4));
            // Container child LPS.Util.UtilMainWindow.Gtk.Container+ContainerChild
            this.vbox2 = new Gtk.VBox();
            this.vbox2.Name = "vbox2";
            this.vbox2.Spacing = 6;

            VPaned vpaned = new VPaned();
            vpaned.Position = 300;
            vbox2.PackStart(vpaned);

            tw = new TextView();
            Pango.FontDescription font = new Pango.FontDescription();
            font.Family = "Courier";
            font.Weight = Pango.Weight.Bold;
            tw.ModifyFont(font);
            ScrolledWindow sc = new ScrolledWindow();
            sc.Add(tw);
            vpaned.Add2(sc);
            tw.KeyPressEvent += HandleTwKeyPressEvent;

            // Container child vbox2.Gtk.Box+BoxChild
            this.entry1 = new Gtk.Entry();
            this.entry1.CanFocus = true;
            this.entry1.Name = "entry1";
            this.entry1.IsEditable = true;
            this.entry1.InvisibleChar = '●';
            this.vbox2.PackEnd(this.entry1);
            Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild) (this.vbox2[this.entry1]));
            w1.Position = 0;
            w1.Expand = false;
            w1.Fill = false;
            // Container child vbox2.Gtk.Box+BoxChild
            this.GtkScrolledWindow = new Gtk.ScrolledWindow();
            this.GtkScrolledWindow.Name = "GtkScrolledWindow";
            this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType) (1));
            // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
            this.outputView = new Gtk.TextView();
            this.outputView.CanFocus = true;
            this.outputView.Name = "outputView";
            this.outputView.Editable = false;
            this.GtkScrolledWindow.Add(this.outputView);
            vpaned.Add1(this.GtkScrolledWindow);
            Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild) (this.vbox2[this.GtkScrolledWindow]));
            w3.Position = 1;
            this.Add(this.vbox2);
            if((this.Child != null))
            {
                this.Child.ShowAll();
            }
            this.DefaultWidth = 400;
            this.DefaultHeight = 300;
            this.Show();
            this.entry1.Activated += new System.EventHandler(this.OnEntry1Activated);
        }
コード例 #11
0
        public QueryDebugger() : base("Hyena.Query Debugger")
        {
            SetDefaultSize(800, 600);

            VBox input_box = new VBox();

            input_box.Spacing = 8;
            ScrolledWindow sw = new ScrolledWindow();

            sw.ShadowType       = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            input                  = new TextView();
            input.AcceptsTab       = false;
            input.KeyReleaseEvent += delegate(object o, KeyReleaseEventArgs args) {
                if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter)
                {
                    input.Buffer.Text = input.Buffer.Text.Trim();
                    OnParseUserQuery(null, EventArgs.Empty);
                }
            };
            input.WrapMode = WrapMode.Word;
            sw.Add(input);
            input_box.PackStart(sw, true, true, 0);
            HBox   button_box = new HBox();
            Button parse      = new Button("Parse as User Query");

            parse.Clicked += OnParseUserQuery;
            button_box.PackStart(parse, false, false, 0);
            input_box.PackStart(button_box, false, false, 0);

            HBox output_box = new HBox();

            output_box.Spacing = 8;
            sw                  = new ScrolledWindow();
            sw.ShadowType       = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            sql                 = new TextView();
            sql.WrapMode        = WrapMode.Word;
            sw.Add(sql);
            output_box.PackStart(sw, true, true, 0);
            sw                  = new ScrolledWindow();
            sw.ShadowType       = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            xml                 = new TextView();
            xml.WrapMode        = WrapMode.Word;
            sw.Add(xml);
            output_box.PackStart(sw, true, true, 0);

            VPaned pane = new VPaned();

            pane.Add1(input_box);
            pane.Add2(output_box);
            pane.Position = 100;

            Add(pane);
            pane.ShowAll();

            input.HasFocus = true;

            LoadQueryFieldSet();
        }
コード例 #12
0
		void Build ()
		{
			Title = GettextCatalog.GetString ("Exception Caught");
			DefaultHeight = 500;
			DefaultWidth = 600;
			VBox.Spacing = 0;

			VBox.PackStart (CreateExceptionHeader (), false, true, 0);

			var paned = new VPaned ();
			paned.Add1 (CreateExceptionValueTreeView ());
			paned.Add2 (CreateStackTraceTreeView ());
			paned.Show ();

			var vbox = new VBox (false, 0);
			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.PackStart (paned, true, true, 0);
			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.Show ();

			VBox.PackStart (vbox, true, true, 0);

			var actionArea = new HBox (false, 12) { BorderWidth = 6 };

			OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code."));
			OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled;
			OnlyShowMyCodeCheckbox.Show ();
			OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions ().ProjectAssembliesOnly;

			var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox };
			alignment.Show ();

			actionArea.PackStart (alignment, true, true, 0);
			actionArea.PackStart (CreateButtonBox (), false, true, 0);
			actionArea.Show ();

			VBox.PackStart (actionArea, false, true, 0);
			ActionArea.Hide ();
		}
コード例 #13
0
ファイル: MainWindow.cs プロジェクト: jahangmar/GardenPlanner
    public MainWindow() : base(WindowType.Toplevel)
    {
        GardenData.LoadedData = GardenData.LoadedData = new GardenData("new project");
        Title = "Garden project '" + GardenData.LoadedData.Name + "'";

        //GardenData.LoadedData = GardenPlanner.MainClass.TestData();


        PlantSideVPaned.Add1(FamilyPlantVarietySelector);


        PlantAreaInfoVPaned.Add1(PlantBox);
        PlantAreaInfoVPaned.Add2(AreaInfo);

        PlantSideVPaned.Add2(PlantAreaInfoVPaned);

        TopPanedToolboxVPaned.Add1(GraphicsSidebarHPaned);
        TopPanedToolboxVPaned.Add2(ToolBox);

        Frame frame;

        PlantBox.Add(PlantAddButton);
        PlantBox.Add(PlantInfoButton);
        PlantBox.Add(PlantEditButton);

        ToolBox.Add(AreaNewButton);
        ToolBox.Add(AreaCancelButton);
        ToolBox.Add(AreaTypeComboBox);
        ToolBox.Add(AreaEditButton);
        ToolBox.Add(AreaDeleteButton);

        frame = new Frame("Zoom");
        frame.Add(ZoomButton);
        ToolBox.Add(frame);

        frame = new Frame("Date");
        VButtonBox buttonBox = new VButtonBox();

        //yearButton = new SpinButton(GardenData.GetFirstYear(), GardenData.GetLastYear(), 1);
        yearButton = new SpinButton(settings.MinYear, settings.MaxYear, 1);
        buttonBox.Add(yearButton);
        buttonBox.Add(monthButton);

        frame.Add(buttonBox);
        ToolBox.Add(frame);

        foreach (Widget w in TopVBox.Children)
        {
            TopVBox.Remove(w);
        }
        TopVBox.Add(MenuBar);
        TopVBox.Add(TopPanedToolboxVPaned);

        if (this.Child == null)
        {
            this.Add(TopVBox);
        }


        ResetForNewData();

        FamilyPlantVarietySelector.SetSizeRequest(100, 400);

        AreaInfo.WrapMode = WrapMode.Word;
        AreaInfo.Editable = false;


        PlantAddButton.Sensitive = false;
        PlantAddButton.Clicked  += (sender, e) =>
        {
            GardenDrawingArea area = GardenDrawingArea.ActiveInstance;
            if (area.SelectedArea is Planting planting && SelectedEntry is PlantVariety variety)
            {
                EditPlantingInfoWindow.ShowPlantingInfoWindow((PlantingInfo plantingInfo) =>
                {
                    planting.AddVariety(variety, plantingInfo);
                    GardenDrawingArea.ActiveInstance.Draw();
                    ShowAreaSelectionInfo(area.SelectedArea);
                }, planting, variety.Name);
            }
            ;
        };

        PlantInfoButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (SelectedEntry is PlantFamily family)
            {
                InfoPlantFamilyWindow.ShowWindow(family, false);
            }
            else if (SelectedEntry is Plant plant)
            {
                InfoPlantWindow.ShowWindow(plant, false);
            }
            else if (SelectedEntry is PlantVariety variety)
            {
                InfoPlantVarietyWindow.ShowWindow(variety, false);
            }
        };


        PlantEditButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (SelectedEntry is PlantFamily family)
            {
                EditPlantFamilyWindow.ShowWindow(family);
            }
            else if (SelectedEntry is Plant plant)
            {
                EditPlantWindow.ShowWindow(plant);
            }
            else if (SelectedEntry is PlantVariety variety)
            {
                EditPlantVarietyWindow.ShowWindow(variety);
            }
        };


        ZoomButton.Value       = GardenDrawingArea.Zoom;
        ZoomButton.Events      = Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
        ZoomButton.TooltipText = "Zoom";



        AreaNewButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (AreaCancelButtonClicked)
            {
                AreaCancelButtonClicked    = false;
                AreaCancelButton.Sensitive = false;
                if (GardenDrawingArea.ActiveInstance != null)
                {
                    GardenDrawingArea.ActiveInstance.UndoSelection();
                    GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                    GardenDrawingArea.ActiveInstance.Draw();
                }
            }
            else if (!AreaNewButton.Active)//deactivated
            {
                AreaCancelButton.Sensitive = false;
                if (GardenDrawingArea.ActiveInstance != null)
                {
                    List <GardenPoint> points = GardenDrawingArea.ActiveInstance.NewPoints;
                    switch (AreaTypeComboBox.Active)
                    {
                    case 0:    //garden
                        if (GardenDrawingArea.ActiveInstance.Garden.Shape.GetPoints().Count == 0)
                        {
                            GardenDrawingArea.ActiveInstance.Garden.Shape.AddPoints(points);
                            GardenDrawingArea.ActiveInstance.Garden.Shape.FinishPoints();
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                        }
                        break;

                    case 1:    //planting
                        PlantingCreationDialog.ShowPlantingCreationDialog(new List <GardenPoint>(points), (Planting planting) =>
                        {
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                            GardenDrawingArea.ActiveInstance.Garden.AddPlanting(GardenData.GenID(planting.Name), planting);
                        });


                        break;

                    case 2:    //method area
                        GardenAreaCreationDialog.ShowGardenAreaCreationDialog(new List <GardenPoint>(points), (GardenArea area) => {
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                            GardenDrawingArea.ActiveInstance.Garden.AddMethodArea(GardenData.GenID(area.Name), area);
                        });

                        break;
                    }
                }
            }
            else //activated
            {
                if (AreaTypeComboBox.Active == 0) //garden
                {
                    if (GardenDrawingArea.ActiveInstance == null || GardenDrawingArea.ActiveInstance.Garden.Shape.GetPoints().Count > 0)
                    {
                        AreaNewButton.Active = false;
                        GardenCreationDialog.ShowGardenCreationDialog(new List <GardenPoint>(), ((Garden garden) =>
                        {
                            GardenData.LoadedData.AddGarden(GardenData.GenID(garden.Name), garden);
                            this.ResetForNewData();
                            GardenBedBook.Page = GardenBedBook.NPages - 1;
                            AreaNewButton.Active = true;
                        }));
                    }
                }

                AreaCancelButton.Sensitive = true;
            }
        };


        AreaCancelButton.Sensitive = false;
        AreaCancelButton.Clicked  += (object sender, System.EventArgs e) =>
        {
            AreaCancelButtonClicked    = true;
            AreaCancelButton.Sensitive = false;
            AreaNewButton.Active       = false;
        };


        AreaTypeComboBox.Active   = 0;
        AreaTypeComboBox.Changed += (object sender, System.EventArgs e) =>
        {
            switch (AreaTypeComboBox.Active)
            {
            case 0:
                AreaNewButton.Label = "New Garden";
                break;

            case 1:
                AreaNewButton.Label = "New Planting";
                break;

            case 2:
                AreaNewButton.Label = "New Method Area";
                break;
            }
        };

        AreaEditButton.Clicked += (object sender, System.EventArgs e) =>
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null || gardenDrawingArea.Garden == null || gardenDrawingArea.SelectedArea == null)
            {
                return;
            }

            if (gardenDrawingArea.SelectedArea is Planting planting)
            {
                PlantingCreationDialog.ShowPlantingEditDialog(planting);
            }
            else if (gardenDrawingArea.SelectedArea is Garden)
            {
                GardenAreaCreationDialog.ShowGardenAreaEditDialog(gardenDrawingArea.SelectedArea);
            }
            else
            {
                GardenAreaCreationDialog.ShowGardenAreaEditDialog(gardenDrawingArea.SelectedArea);
            }
        };

        AreaDeleteButton.Clicked += (object sender, System.EventArgs e) =>
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null || gardenDrawingArea.Garden == null)
            {
                return;
            }

            string name = gardenDrawingArea.SelectedArea != null ? gardenDrawingArea.SelectedArea.Name : gardenDrawingArea.Garden.Name;

            Dialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.OkCancel, "Do you want to delete '" + name + "'?", new { });

            int response = dialog.Run();
            //System.Console.WriteLine("response " + result);
            if (response == (int)ResponseType.Cancel)
            {
            }
            else if (response == (int)ResponseType.Ok)
            {
                if (gardenDrawingArea.Garden != null && (gardenDrawingArea.SelectedArea == null || gardenDrawingArea.SelectedArea is Garden))
                {
                    var garden = gardenDrawingArea.Garden;

                    GardenData.LoadedData.Gardens.Remove(garden.ID);
                    GardenBedBook.Remove(GardenBedBook.GetNthPage(GardenBedBook.CurrentPage));
                    //System.Console.WriteLine("delete garden");
                    GardenDrawingArea.ActiveInstance = null;
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    if (GardenBedBook.Page >= 0 && GardenBedBook.GetNthPage(GardenBedBook.Page) is GardenDrawingArea drawingArea)
                    {
                        GardenDrawingArea.ActiveInstance = drawingArea;
                        drawingArea.Draw();
                    }
                    GardenData.unsaved = true;
                }
                else if (gardenDrawingArea.SelectedArea is Planting planting)
                {
                    gardenDrawingArea.Garden.RemovePlanting(planting);
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    gardenDrawingArea.Draw();
                    GardenData.unsaved = true;
                }
                else if (gardenDrawingArea.SelectedArea is GardenArea area)
                {
                    gardenDrawingArea.Garden.RemoveMethodArea(area);
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    gardenDrawingArea.Draw();
                    GardenData.unsaved = true;
                }
            }
            dialog.Destroy();
        };



        int yearValue = yearButton.ValueAsInt;

        yearButton.ValueChanged += (sender, e) =>
        {
            if (yearButton.ValueAsInt > yearValue)
            {
                monthButton.Value = 1;
            }
            else
            {
                monthButton.Value = 12;
            }
            yearValue = yearButton.ValueAsInt;
            DateChanged();
        };
        monthButton.Changed += (sender, e) =>
        {
            DateChanged();
        };

        void DateChanged()
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null)
            {
                return;
            }

            if (gardenDrawingArea.SelectedArea != null && (!gardenDrawingArea.SelectedArea.CheckDate(GetYear(), GetMonth()) || !gardenDrawingArea.Garden.CheckDate(GetYear(), GetMonth())))
            {
                gardenDrawingArea.UndoSelection();
            }
            gardenDrawingArea.Draw();
            ShowAreaSelectionInfo(gardenDrawingArea.SelectedArea);
        }

        //FamilyPlantVarietySelector.Add1(PopulateFamilies(GardenData.LoadedData));
        //RepopulateGrowables();



        //Build();
        this.DeleteEvent += (object o, DeleteEventArgs args) =>
        {
            TryToClose();
            args.RetVal = true;
        };

        this.Destroyed += (sender, e) =>
        {
            GardenPlannerSettings.Save();
            Application.Quit();
        };
    }
コード例 #14
0
        public SearchResultsPage(FileSearch search)
        {
            VPaned         paned;
            TreeViewColumn column;
            ToolItem       spacerItem;
            ToolItem       filterItem;
            Alignment      filterAlignment;
            ToolButton     searchAgainToolButton;

            this.search = search;

            downloadToolButton = new ToolButton(new Image("gtk-save", IconSize.LargeToolbar), "Download");
            downloadToolButton.IsImportant = true;
            downloadToolButton.Sensitive = false;
            downloadToolButton.Clicked += DownloadToolButtonClicked;

            searchAgainToolButton = new ToolButton(new Image("gtk-refresh", IconSize.LargeToolbar), "Search Again");
            searchAgainToolButton.IsImportant = true;
            searchAgainToolButton.Clicked += SearchAgainToolButtonClicked;

            spacerItem = new ToolItem();
            spacerItem.Expand = true;

            filterButton = new ToggleButton("Filter Results");
            filterButton.Image = new Image(Gui.LoadIcon(16, "application-x-executable"));
            filterButton.Toggled += delegate (object o, EventArgs args) {
                this.ShowFilter = filterButton.Active;
            };

            filterAlignment = new Alignment(0.5f, 0.5f, 0, 0);
            filterAlignment.Add(filterButton);

            filterItem = new ToolItem();
            filterItem.Add(filterAlignment);

            browseToolButton = new ToolButton(new Image("gtk-open", IconSize.LargeToolbar), "Browse");
            browseToolButton.IsImportant = true;
            browseToolButton.Sensitive = false;
            browseToolButton.Clicked += BrowseToolButtonClicked;

            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Insert(downloadToolButton, -1);
            toolbar.Insert(browseToolButton, -1);
            toolbar.Insert(spacerItem, -1);
            toolbar.Insert(filterItem, -1);
            toolbar.Insert(new SeparatorToolItem(), -1);
            toolbar.Insert(searchAgainToolButton, -1);
            toolbar.ShowAll();

            this.PackStart(toolbar, false, false, 0);

            resultCountByTypeCache = new Dictionary<FilterType, int>();

            Gdk.Pixbuf audioPixbuf = Gui.LoadIcon(16, "audio-x-generic");
            Gdk.Pixbuf videoPixbuf = Gui.LoadIcon(16, "video-x-generic");
            Gdk.Pixbuf imagePixbuf = Gui.LoadIcon(16, "image-x-generic");
            Gdk.Pixbuf docPixbuf = Gui.LoadIcon(16, "x-office-document");
            unknownPixbuf = Gui.LoadIcon(16, "text-x-generic");
            folderPixbuf = Gui.LoadIcon(16, "folder");

            typeStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(FilterType));
            typeStore.AppendValues(null, "All Results", FilterType.All);
            typeStore.AppendValues(null, "-");
            typeStore.AppendValues(audioPixbuf, "Audio", FilterType.Audio);
            typeStore.AppendValues(videoPixbuf, "Video", FilterType.Video);
            typeStore.AppendValues(imagePixbuf, "Images", FilterType.Image);
            typeStore.AppendValues(docPixbuf, "Documents", FilterType.Document);
            typeStore.AppendValues(folderPixbuf, "Folders", FilterType.Folder);
            typeStore.AppendValues(unknownPixbuf, "Other", FilterType.Other);

            typeTree = new TreeView();
            typeTree.HeadersVisible = false;
            typeTree.RowSeparatorFunc = delegate (TreeModel m, TreeIter i) {
                string text = (string)m.GetValue(i, 1);
                return (text == "-");
            };
            typeTree.Selection.Changed += TypeSelectionChanged;

            typeTree.Model = typeStore;

            CellRendererPixbuf pixbufCell = new CellRendererPixbuf();
            CellRendererText textCell = new CellRendererText();
            CellRendererText countTextCell = new CellRendererText();
            countTextCell.Sensitive = false;
            countTextCell.Alignment = Pango.Alignment.Right;
            countTextCell.Xalign = 1;

            column = new TreeViewColumn();
            column.PackStart(pixbufCell, false);
            column.PackStart(textCell, true);
            column.PackStart(countTextCell, false);
            column.AddAttribute(pixbufCell, "pixbuf", 0);
            column.AddAttribute(textCell, "text", 1);
            column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(TypeCountCellFunc));

            typeTree.AppendColumn(column);

            TreeView artistTree = new TreeView();
            artistTree.HeadersVisible = false;

            TreeView albumTree = new TreeView();
            albumTree.HeadersVisible = false;

            HBox topBox = new HBox();
            topBox.PackStart(Gui.AddScrolledWindow(typeTree), true, true, 0);
            topBox.PackStart(Gui.AddScrolledWindow(artistTree), true, true, 1);
            topBox.PackStart(Gui.AddScrolledWindow(albumTree), true, true, 0);
            topBox.Homogeneous = true;

            resultsStore = new ListStore(typeof(SearchResult));
            resultsStore.RowInserted += delegate {
                Refilter();
            };
            resultsStore.RowDeleted += delegate {
                Refilter();
            };
            resultsTree = new TreeView();
            resultsTree.RowActivated += resultsTree_RowActivated;
            resultsTree.ButtonPressEvent += resultsTree_ButtonPressEvent;
            resultsTree.Selection.Changed += ResultsTreeSelectionChanged;

            imageColumns = new List<TreeViewColumn>();
            audioColumns = new List<TreeViewColumn>();
            videoColumns = new List<TreeViewColumn>();
            fileOnlyColumns = new List<TreeViewColumn>();
            folderOnlyColumns = new List<TreeViewColumn>();

            column = new TreeViewColumn();
            column.Title = "File Name";
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Autosize;
            column.Resizable = true;
            column.SortColumnId = 0;
            //resultsTree.ExpanderColumn = column;

            CellRenderer cell = new CellRendererPixbuf();
            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconFunc));

            cell = new CellRendererText();
            column.PackStart(cell, true);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(FileNameFunc));

            resultsTree.AppendColumn(column);

            column = resultsTree.AppendColumn("Codec", new CellRendererText(), new TreeCellDataFunc(CodecFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 120;
            column.Resizable = true;
            column.SortColumnId = 1;
            videoColumns.Add(column);

            column = resultsTree.AppendColumn("Format", new CellRendererText(), new TreeCellDataFunc(FormatFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 90;
            column.Resizable = true;
            column.SortColumnId = 2;
            imageColumns.Add(column);

            column = resultsTree.AppendColumn("Resolution", new CellRendererText(), new TreeCellDataFunc(ResolutionFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 90;
            column.Resizable = true;
            column.SortColumnId = 3;
            videoColumns.Add(column);
            imageColumns.Add(column);

            column = resultsTree.AppendColumn("Artist", new CellRendererText(), new TreeCellDataFunc(ArtistFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 110;
            column.Resizable = true;
            column.SortColumnId = 4;
            audioColumns.Add(column);

            column = resultsTree.AppendColumn("Album", new CellRendererText(), new TreeCellDataFunc(AlbumFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 110;
            column.Resizable = true;
            column.SortColumnId = 5;
            audioColumns.Add(column);

            column = resultsTree.AppendColumn("Bitrate", new CellRendererText(), new TreeCellDataFunc(BitrateFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 70;
            column.Resizable = true;
            column.SortColumnId = 6;
            audioColumns.Add(column);

            column = resultsTree.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(SizeFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 70;
            column.SortColumnId = 7;
            column.Resizable = true;
            fileOnlyColumns.Add(column);

            column = resultsTree.AppendColumn("Sources", new CellRendererText(), new TreeCellDataFunc(SourcesFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 85;
            column.SortColumnId = 8;
            column.Resizable = true;
            fileOnlyColumns.Add(column);

            column = resultsTree.AppendColumn("User", new CellRendererText(), new TreeCellDataFunc(UserFunc));
            column.Clickable = true;
            column.Sizing = TreeViewColumnSizing.Fixed;
            column.FixedWidth = 85;
            column.SortColumnId = 8;
            column.Resizable = true;
            folderOnlyColumns.Add(column);

            column = resultsTree.AppendColumn("Full Path", new CellRendererText(), new TreeCellDataFunc(FullPathFunc));
            column.Clickable = true;
            column.Resizable = true;
            column.SortColumnId = 9;

            column = resultsTree.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(InfoHashFunc));
            column.Clickable = true;
            column.Resizable = true;
            column.SortColumnId = 10;
            fileOnlyColumns.Add(column);

            resultsFilter = new TreeModelFilter(resultsStore, null);
            resultsFilter.VisibleFunc = resultsFilterFunc;

            resultsSort = new TreeModelSort(resultsFilter);
            for (int x = 0; x < resultsTree.Columns.Length; x++) {
                resultsSort.SetSortFunc(x, resultsSortFunc);
            }
            resultsTree.Model = resultsSort;

            ScrolledWindow resultsTreeSW = new ScrolledWindow();
            resultsTreeSW.Add(resultsTree);

            paned = new VPaned();
            paned.Add1(topBox);
            paned.Add2(resultsTreeSW);
            paned.Position = 160;
            paned.ShowAll();

            filterWidget = new FilterWidget(search);
            filterWidget.FiltersChanged += filterWidget_FiltersChanged;
            filterWidget.Hidden += filterWidget_Hidden;

            this.PackStart(filterWidget, false, false, 0);
            this.PackStart(paned, true, true, 0);

            TypeSelectionChanged(typeTree, EventArgs.Empty);

            search.NewResults += (NewResultsEventHandler)DispatchService.GuiDispatch(new NewResultsEventHandler(search_NewResults));
            search.ClearedResults += (EventHandler)DispatchService.GuiDispatch(new EventHandler(search_ClearedResults));

            resultPopupMenu = new Menu();

            browseResultMenuItem = new ImageMenuItem("Browse");
            browseResultMenuItem.Image = new Image(Gui.LoadIcon(16, "document-open"));
            browseResultMenuItem.Activated += BrowseToolButtonClicked;
            resultPopupMenu.Append(browseResultMenuItem);

            downloadResultMenuItem = new ImageMenuItem("Download");
            downloadResultMenuItem.Image = new Image(Gui.LoadIcon(16, "go-down"));
            downloadResultMenuItem.Activated += DownloadToolButtonClicked;
            resultPopupMenu.Append(downloadResultMenuItem);

            resultPropertiesMenuItem = new ImageMenuItem(Gtk.Stock.Properties, null);
            resultPropertiesMenuItem.Activated += FilePropertiesButtonClicked;
            resultPopupMenu.Append(resultPropertiesMenuItem);
        }
コード例 #15
0
        //Gtk.Action actOpen = new Gtk.Action("Open", "Open", "Open file", Stock.Open);

        public MainWindow() : base("TikzEdt ")
        {
            (GlobalUI.UI as GlobalUIGTK).MainForm  = this;
            ScintillaDocumentWrapper.TheOneAndOnly = txtCode;
            TheVM = new MainWindowVM <ScintillaDocumentWrapper>(TheCompiler.Instance);

            rasterControl1            = rasterControl1Box.RasterControl;
            rasterControl1.Rasterizer = rasterControl1.TheRasterModel;

            txtStatus.Buffer.TagTable.Add(new TextTag("red")
            {
                Foreground = "red"
            });
            //txtCode.LexerLanguage = "html";
            txtCode.Lexer = 4; // html

            Resize(800, 600);
            Destroyed   += (s, e) => Application.Quit();
            myLabel.Text = "Hello World!!!!";

            CreateMenus();
            CreateToolBars();

            VBox vb = new VBox(false, 0);

            vb.PackStart(mainMenu, false, false, 0);
            vb.PackStart(mainToolbar, false, false, 0);
            vb.PackStart(toolsToolbar, false, false, 0);

            HBox hb = new HBox(false, 0);

            hb.PackStart(toolsPaneBar, false, false, 0);

            ScrolledWindow scrw = txtStatusWnd = new ScrolledWindow();

            scrw.Add(txtStatus);
            statusTabPanel.AppendPage(scrw, new Label("Status"));

            statusTabPanel.AppendPage(lstErrors, new Label("Errors"));
            scrw = new ScrolledWindow();
            scrw.Add(txtTexOut);
            statusTabPanel.AppendPage(scrw, new Label("TeX Output"));

            //txtCode.SetText("This is Scintilla");

            vSplitter1.Add1(txtCode);
            vSplitter1.Add2(statusTabPanel);
            vSplitter1.Position = 400;

            hSplitter1.Add1(vSplitter1);
            var sw = new ScrolledWindow();

            sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            //sw.Placement = CornerType.
            //Alignment a = new Alignment(0.5f,0.5f,0,0);
            //var vv = new Table(1,1,false);
            //vv.Attach(rasterControl1, 0, 0, 1,1,AttachOptions.Expand, AttachOptions.Expand, 0,0);

            /*var vv = new VBox();
             * var vh = new HBox();
             * vv.PackStart(rasterControl1, true, false, 0);
             * vh.PackStart(vv, true, false, 0);*/
            Alignment al = new Alignment(.5f, .5f, 0, 0);

            al.Add(rasterControl1Box);
            sw.Add(al);
            hSplitter1.Add2(sw);
            hSplitter1.Position = 350;

            hSplitter2.Add1(new TextView());
            hSplitter2.Add2(hSplitter1);
            hSplitter2.Position = 150;
            hb.PackStart(hSplitter2, true, true, 0);

            vb.PackStart(hb, true, true, 0);


            statusBar.PackStart(new Alignment(.5f, .5f, 1, 1), true, true, 0);
            statusBar.PackStart(lblStandAlone, false, false, 0);
            statusBar.PackStart(new Label("Grid"), false, false, 0);
            statusBar.PackStart(cmbGrid, false, false, 0);
            statusBar.PackStart(new Label("RS"), false, false, 0);
            statusBar.PackStart(txtRadialSteps, false, false, 0);
            statusBar.PackStart(new Label("RO"), false, false, 0);
            statusBar.PackStart(txtRadialOffset, false, false, 0);
            //statusBar.PackStart(new Separator(), false, false, 0);
            Button b = new Button(Stock.ZoomOut);

            //b.Label = "";
            statusBar.PackStart(b);
            statusBar.PackStart(scZoom);
            statusBar.PackStart(new Button(Stock.ZoomIn));
            vb.PackEnd(statusBar, false, false, 0);

            Add(vb);

            SetupBindings();

            ShowAll();
        }
コード例 #16
0
ファイル: SearchResultsPage.cs プロジェクト: tabrath/meshwork
        public SearchResultsPage(FileSearch search)
        {
            VPaned         paned;
            TreeViewColumn column;
            ToolItem       spacerItem;
            ToolItem       filterItem;
            Alignment      filterAlignment;
            ToolButton     searchAgainToolButton;

            this.search = search;

            downloadToolButton             = new ToolButton(new Image("gtk-save", IconSize.LargeToolbar), "Download");
            downloadToolButton.IsImportant = true;
            downloadToolButton.Sensitive   = false;
            downloadToolButton.Clicked    += DownloadToolButtonClicked;

            searchAgainToolButton             = new ToolButton(new Image("gtk-refresh", IconSize.LargeToolbar), "Search Again");
            searchAgainToolButton.IsImportant = true;
            searchAgainToolButton.Clicked    += SearchAgainToolButtonClicked;

            spacerItem        = new ToolItem();
            spacerItem.Expand = true;

            filterButton          = new ToggleButton("Filter Results");
            filterButton.Image    = new Image(Gui.LoadIcon(16, "application-x-executable"));
            filterButton.Toggled += delegate(object o, EventArgs args) {
                this.ShowFilter = filterButton.Active;
            };

            filterAlignment = new Alignment(0.5f, 0.5f, 0, 0);
            filterAlignment.Add(filterButton);

            filterItem = new ToolItem();
            filterItem.Add(filterAlignment);

            browseToolButton             = new ToolButton(new Image("gtk-open", IconSize.LargeToolbar), "Browse");
            browseToolButton.IsImportant = true;
            browseToolButton.Sensitive   = false;
            browseToolButton.Clicked    += BrowseToolButtonClicked;

            toolbar = new Toolbar();
            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.Insert(downloadToolButton, -1);
            toolbar.Insert(browseToolButton, -1);
            toolbar.Insert(spacerItem, -1);
            toolbar.Insert(filterItem, -1);
            toolbar.Insert(new SeparatorToolItem(), -1);
            toolbar.Insert(searchAgainToolButton, -1);
            toolbar.ShowAll();

            this.PackStart(toolbar, false, false, 0);

            resultCountByTypeCache = new Dictionary <FilterType, int>();

            Gdk.Pixbuf audioPixbuf = Gui.LoadIcon(16, "audio-x-generic");
            Gdk.Pixbuf videoPixbuf = Gui.LoadIcon(16, "video-x-generic");
            Gdk.Pixbuf imagePixbuf = Gui.LoadIcon(16, "image-x-generic");
            Gdk.Pixbuf docPixbuf   = Gui.LoadIcon(16, "x-office-document");
            unknownPixbuf = Gui.LoadIcon(16, "text-x-generic");
            folderPixbuf  = Gui.LoadIcon(16, "folder");

            typeStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(FilterType));
            typeStore.AppendValues(null, "All Results", FilterType.All);
            typeStore.AppendValues(null, "-");
            typeStore.AppendValues(audioPixbuf, "Audio", FilterType.Audio);
            typeStore.AppendValues(videoPixbuf, "Video", FilterType.Video);
            typeStore.AppendValues(imagePixbuf, "Images", FilterType.Image);
            typeStore.AppendValues(docPixbuf, "Documents", FilterType.Document);
            typeStore.AppendValues(folderPixbuf, "Folders", FilterType.Folder);
            typeStore.AppendValues(unknownPixbuf, "Other", FilterType.Other);

            typeTree = new TreeView();
            typeTree.HeadersVisible   = false;
            typeTree.RowSeparatorFunc = delegate(TreeModel m, TreeIter i) {
                string text = (string)m.GetValue(i, 1);
                return(text == "-");
            };
            typeTree.Selection.Changed += TypeSelectionChanged;

            typeTree.Model = typeStore;

            CellRendererPixbuf pixbufCell    = new CellRendererPixbuf();
            CellRendererText   textCell      = new CellRendererText();
            CellRendererText   countTextCell = new CellRendererText();

            countTextCell.Sensitive = false;
            countTextCell.Alignment = Pango.Alignment.Right;
            countTextCell.Xalign    = 1;

            column = new TreeViewColumn();
            column.PackStart(pixbufCell, false);
            column.PackStart(textCell, true);
            column.PackStart(countTextCell, false);
            column.AddAttribute(pixbufCell, "pixbuf", 0);
            column.AddAttribute(textCell, "text", 1);
            column.SetCellDataFunc(countTextCell, new TreeCellDataFunc(TypeCountCellFunc));

            typeTree.AppendColumn(column);

            TreeView artistTree = new TreeView();

            artistTree.HeadersVisible = false;

            TreeView albumTree = new TreeView();

            albumTree.HeadersVisible = false;

            HBox topBox = new HBox();

            topBox.PackStart(Gui.AddScrolledWindow(typeTree), true, true, 0);
            topBox.PackStart(Gui.AddScrolledWindow(artistTree), true, true, 1);
            topBox.PackStart(Gui.AddScrolledWindow(albumTree), true, true, 0);
            topBox.Homogeneous = true;

            resultsStore              = new ListStore(typeof(SearchResult));
            resultsStore.RowInserted += delegate {
                Refilter();
            };
            resultsStore.RowDeleted += delegate {
                Refilter();
            };
            resultsTree = new TreeView();
            resultsTree.RowActivated      += resultsTree_RowActivated;
            resultsTree.ButtonPressEvent  += resultsTree_ButtonPressEvent;
            resultsTree.Selection.Changed += ResultsTreeSelectionChanged;

            imageColumns      = new List <TreeViewColumn>();
            audioColumns      = new List <TreeViewColumn>();
            videoColumns      = new List <TreeViewColumn>();
            fileOnlyColumns   = new List <TreeViewColumn>();
            folderOnlyColumns = new List <TreeViewColumn>();

            column              = new TreeViewColumn();
            column.Title        = "File Name";
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Autosize;
            column.Resizable    = true;
            column.SortColumnId = 0;
            //resultsTree.ExpanderColumn = column;

            CellRenderer cell = new CellRendererPixbuf();

            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconFunc));

            cell = new CellRendererText();
            column.PackStart(cell, true);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(FileNameFunc));

            resultsTree.AppendColumn(column);

            column              = resultsTree.AppendColumn("Codec", new CellRendererText(), new TreeCellDataFunc(CodecFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 120;
            column.Resizable    = true;
            column.SortColumnId = 1;
            videoColumns.Add(column);

            column              = resultsTree.AppendColumn("Format", new CellRendererText(), new TreeCellDataFunc(FormatFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 90;
            column.Resizable    = true;
            column.SortColumnId = 2;
            imageColumns.Add(column);

            column              = resultsTree.AppendColumn("Resolution", new CellRendererText(), new TreeCellDataFunc(ResolutionFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 90;
            column.Resizable    = true;
            column.SortColumnId = 3;
            videoColumns.Add(column);
            imageColumns.Add(column);

            column              = resultsTree.AppendColumn("Artist", new CellRendererText(), new TreeCellDataFunc(ArtistFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 110;
            column.Resizable    = true;
            column.SortColumnId = 4;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Album", new CellRendererText(), new TreeCellDataFunc(AlbumFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 110;
            column.Resizable    = true;
            column.SortColumnId = 5;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Bitrate", new CellRendererText(), new TreeCellDataFunc(BitrateFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 70;
            column.Resizable    = true;
            column.SortColumnId = 6;
            audioColumns.Add(column);

            column              = resultsTree.AppendColumn("Size", new CellRendererText(), new TreeCellDataFunc(SizeFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 70;
            column.SortColumnId = 7;
            column.Resizable    = true;
            fileOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("Sources", new CellRendererText(), new TreeCellDataFunc(SourcesFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 85;
            column.SortColumnId = 8;
            column.Resizable    = true;
            fileOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("User", new CellRendererText(), new TreeCellDataFunc(UserFunc));
            column.Clickable    = true;
            column.Sizing       = TreeViewColumnSizing.Fixed;
            column.FixedWidth   = 85;
            column.SortColumnId = 8;
            column.Resizable    = true;
            folderOnlyColumns.Add(column);

            column              = resultsTree.AppendColumn("Full Path", new CellRendererText(), new TreeCellDataFunc(FullPathFunc));
            column.Clickable    = true;
            column.Resizable    = true;
            column.SortColumnId = 9;

            column              = resultsTree.AppendColumn("Info Hash", new CellRendererText(), new TreeCellDataFunc(InfoHashFunc));
            column.Clickable    = true;
            column.Resizable    = true;
            column.SortColumnId = 10;
            fileOnlyColumns.Add(column);

            resultsFilter             = new TreeModelFilter(resultsStore, null);
            resultsFilter.VisibleFunc = resultsFilterFunc;

            resultsSort = new TreeModelSort(resultsFilter);
            for (int x = 0; x < resultsTree.Columns.Length; x++)
            {
                resultsSort.SetSortFunc(x, resultsSortFunc);
            }
            resultsTree.Model = resultsSort;

            ScrolledWindow resultsTreeSW = new ScrolledWindow();

            resultsTreeSW.Add(resultsTree);

            paned = new VPaned();
            paned.Add1(topBox);
            paned.Add2(resultsTreeSW);
            paned.Position = 160;
            paned.ShowAll();

            filterWidget = new FilterWidget(search);
            filterWidget.FiltersChanged += filterWidget_FiltersChanged;
            filterWidget.Hidden         += filterWidget_Hidden;

            this.PackStart(filterWidget, false, false, 0);
            this.PackStart(paned, true, true, 0);

            TypeSelectionChanged(typeTree, EventArgs.Empty);

            search.NewResults     += (EventHandler <SearchResultsEventArgs>)DispatchService.GuiDispatch(new EventHandler <SearchResultsEventArgs>(search_NewResults));
            search.ClearedResults += (EventHandler)DispatchService.GuiDispatch(new EventHandler(search_ClearedResults));

            resultPopupMenu = new Menu();

            browseResultMenuItem            = new ImageMenuItem("Browse");
            browseResultMenuItem.Image      = new Image(Gui.LoadIcon(16, "document-open"));
            browseResultMenuItem.Activated += BrowseToolButtonClicked;
            resultPopupMenu.Append(browseResultMenuItem);

            downloadResultMenuItem            = new ImageMenuItem("Download");
            downloadResultMenuItem.Image      = new Image(Gui.LoadIcon(16, "go-down"));
            downloadResultMenuItem.Activated += DownloadToolButtonClicked;
            resultPopupMenu.Append(downloadResultMenuItem);

            resultPropertiesMenuItem            = new ImageMenuItem(Gtk.Stock.Properties, null);
            resultPropertiesMenuItem.Activated += FilePropertiesButtonClicked;
            resultPopupMenu.Append(resultPropertiesMenuItem);
        }
コード例 #17
0
ファイル: sqlsharpgtk.cs プロジェクト: Zman0169/mono
		public void CreateGui() 
		{
			win = new Gtk.Window (ApplicationName);
			win.DeleteEvent += new GtkSharp.DeleteEventHandler(OnWindow_Delete);
			win.BorderWidth = 4;
			win.DefaultSize = new Size (450, 300);
			
			VBox vbox = new VBox (false, 4);
			win.Add (vbox);
			
			// Menu Bar
			MenuBar mb = CreateMenuBar ();
			vbox.PackStart(mb, false, false, 0);

			// Tool Bar
			toolbar = CreateToolbar ();
			vbox.PackStart (toolbar, false, false, 0);
			
			// Panels
			VPaned paned = new VPaned ();
			vbox.PackStart (paned, true, true, 0);

			// SQL Editor (top TextView panel)
			sourceFileNotebook = new Notebook();
			sourceFileNotebook.Scrollable = true;
			NewEditorTab();
			paned.Add1 (sourceFileNotebook);
			sourceFileNotebook.SwitchPage += new 
				GtkSharp.SwitchPageHandler(OnEditorTabSwitched);

			// bottom panel
			resultsNotebook = CreateOutputResultsGui ();
			paned.Add2 (resultsNotebook);

			statusBar = new Statusbar ();
			vbox.PackEnd (statusBar, false, false, 0);
			
			outputResults = OutputResults.TextView;
			ToggleResultsOutput ();
		}
コード例 #18
0
ファイル: QueryDebugger.cs プロジェクト: Yetangitu/f-spot
        public QueryDebugger () : base ("Hyena.Query Debugger")
        {
            SetDefaultSize (800, 600);

            VBox input_box = new VBox ();
            input_box.Spacing = 8;
            ScrolledWindow sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            input = new TextView ();
            input.AcceptsTab = false;
            input.KeyReleaseEvent += delegate (object o, KeyReleaseEventArgs args) {
                if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) {
                    input.Buffer.Text = input.Buffer.Text.Trim ();
                    OnParseUserQuery (null, EventArgs.Empty);
                }
            };
            input.WrapMode = WrapMode.Word;
            sw.Add (input);
            input_box.PackStart (sw, true, true, 0);
            HBox button_box = new HBox ();
            Button parse = new Button ("Parse as User Query");
            parse.Clicked += OnParseUserQuery;
            button_box.PackStart (parse, false, false, 0);
            input_box.PackStart (button_box, false, false, 0);

            HBox output_box = new HBox ();
            output_box.Spacing = 8;
            sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            sql = new TextView ();
            sql.WrapMode = WrapMode.Word;
            sw.Add (sql);
            output_box.PackStart (sw, true, true, 0);
            sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.In;
            sw.HscrollbarPolicy = PolicyType.Never;
            xml = new TextView ();
            xml.WrapMode = WrapMode.Word;
            sw.Add (xml);
            output_box.PackStart (sw, true, true, 0);

            VPaned pane = new VPaned ();
            pane.Add1 (input_box);
            pane.Add2 (output_box);
            pane.Position = 100;

            Add (pane);
            pane.ShowAll ();

            input.HasFocus = true;

            LoadQueryFieldSet ();
        }
コード例 #19
0
        private void BuildView()
        {
            podcast_view_scroller = new ScrolledWindow();

            podcast_view_scroller.ShadowType = ShadowType.In;
            podcast_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_feed_view_scroller = new ScrolledWindow();

            podcast_feed_view_scroller.ShadowType = ShadowType.In;
            podcast_feed_view_scroller.VscrollbarPolicy = PolicyType.Automatic;
            podcast_feed_view_scroller.HscrollbarPolicy = PolicyType.Automatic;

            podcast_model = new PodcastPlaylistModel ();
            podcast_feed_model = new PodcastFeedModel ();

            podcast_model.ClearModel ();
            podcast_feed_model.ClearModel ();

            podcast_model.QueueAdd (PodcastCore.Library.Podcasts);
            podcast_feed_model.QueueAdd (PodcastCore.Library.Feeds);

            podcast_view = new PodcastPlaylistView (podcast_model);
            podcast_view.ButtonPressEvent += OnPlaylistViewButtonPressEvent;

            podcast_feed_view = new PodcastFeedView (podcast_feed_model);
            podcast_feed_view.Selection.Changed += OnFeedViewSelectionChanged;
            podcast_feed_view.ButtonPressEvent += OnPodcastFeedViewButtonPressEvent;
            podcast_feed_view.SelectAll += OnSelectAllHandler;

            podcast_view_scroller.Add (podcast_view);
            podcast_feed_view_scroller.Add (podcast_feed_view);

            feed_info_pane = new HPaned ();
            feed_info_pane.Add1 (podcast_feed_view_scroller);
            // -- later-- feed_info_pane.Add2 ();

            feed_playlist_pane = new VPaned ();
            feed_playlist_pane.Add1 (feed_info_pane);
            feed_playlist_pane.Add2 (podcast_view_scroller);

            try
            {
                feed_playlist_pane.Position =
                    GConfSchemas.PlaylistSeparatorPositionSchema.Get ();
            }
            catch {
                feed_playlist_pane.Position = 300;
                GConfSchemas.PlaylistSeparatorPositionSchema.Set (
                    feed_playlist_pane.Position
                );
            }

            update_button = new ActionButton (Globals.ActionManager ["PodcastUpdateFeedsAction"]);
            viewWidget = feed_playlist_pane;

            viewWidget.ShowAll ();
        }