Esempio n. 1
0
    void Show3D(Tables.Denso.Table3D table)
    {
        if (table == null)
        {
            return;
        }

        navbarwidget.CurrentPos = table.Location;

        navbarwidget.SetMarkedPositions(new int[] { table.RangeX.Pos, table.RangeY.Pos, table.RangeZ.Pos });

        var valuesZ = table.GetValuesZasFloats();
        var tableUI = new GtkWidgets.TableWidget3D(coloring, table.ValuesX, table.ValuesY, valuesZ,
                                                   table.Xmin, table.Xmax, table.Ymin, table.Ymax, table.Zmin, table.Zmax);

        tableUI.TitleMarkup  = Util.Markup.NameUnit_Large(table.Title, table.UnitZ);
        tableUI.AxisXMarkup  = Util.Markup.NameUnit(table.NameX, table.UnitX);
        tableUI.AxisYMarkup  = Util.Markup.NameUnit(table.NameY, table.UnitY);
        tableUI.FormatValues = ScoobyRom.Data.AutomaticValueFormat(valuesZ, table.Zmin, table.Zmax);

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport();

        viewPort.Add(tableUI.Create());

        Gtk.Widget previous = this.scrolledwindowTable3D.Child;
        if (previous != null)
        {
            this.scrolledwindowTable3D.Remove(previous);
        }
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add(viewPort);
        this.scrolledwindowTable3D.ShowAll();
    }
Esempio n. 2
0
        public ArtistInfo(InfoBar info_bar)
            : base(info_bar)
        {
            Viewport view = new Viewport ();
            SearchBox search_box = new SearchBox ();
            ScrolledWindow scroll = new ScrolledWindow ();

            box.PackStart (scroll, true, true, 0);
            box.PackStart (new HSeparator (), false ,false, 0);
            box.PackStart (search_box, false, true, 0);

            artist_box.PackStart (artist_header.DisplayWidget, false, false, 0);
            artist_box.PackStart (content_tabs.DisplayWidget, true, true, 0);
            artist_box.BorderWidth = 20;

            content_tabs.AddContent (new SimilarArtists(this), "Similar Artists");
            content_tabs.AddContent (new TopTracks(this), "Top Tracks");
            content_tabs.AddContent (new TopAlbums(this), "Top Albums");
            content_tabs.AddContent (new SimilarTracks());
            content_tabs.AddContent (new AlbumDetails(this));

            tabs.ShowTabs = false;
            tabs.ShowBorder = false;
            tabs.AppendPage (new ArtistInfoHelp (), null);
            tabs.AppendPage (artist_box, null);

            scroll.ShadowType = ShadowType.None;
            scroll.Add (view);

            view.ShadowType = ShadowType.None;
            view.Add (tabs);

            search_box.Search += search;
            content_tabs.ContentChanged += content_changed;
        }
        // "Coming Soon: Profile, Friends, Events etc")
        public LastfmSourceContents () : base ()
        {
            HscrollbarPolicy = PolicyType.Never;
            VscrollbarPolicy = PolicyType.Automatic;

            viewport = new Viewport ();
            viewport.ShadowType = ShadowType.None;

            main_box = new VBox ();
            main_box.Spacing = 6;
            main_box.BorderWidth = 5;
            main_box.ReallocateRedraws = true;

            // Clamp the width, preventing horizontal scrolling
            SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
                // TODO '- 10' worked for Nereid, but not for Cubano; properly calculate the right width we should request
                main_box.WidthRequest = args.Allocation.Width - 30;
            };

            viewport.Add (main_box);

            StyleSet += delegate {
                viewport.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                viewport.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
            };

            AddWithFrame (viewport);
            ShowAll ();
        }
Esempio n. 4
0
    private void createButton()
    {
        Gtk.VBox vbox = new Gtk.VBox();

        Gtk.Image image = new Gtk.Image();
        addUserPhotoIfExists(image);
        image.HeightRequest = 150;
        image.Visible       = true;

        Gtk.Label label_select = new Gtk.Label("Select !");
        label_select.Visible = false;         //hide this to the user until button is clicked first time

        Gtk.Label label_id = new Gtk.Label(personID.ToString());
        label_id.Visible = false;         //hide this to the user

        Gtk.Viewport viewport = new Gtk.Viewport();
        UtilGtk.ViewportColorDefault(viewport);
        Gtk.Label label_name = new Gtk.Label(personName);
        label_name.Visible = true;
        label_name.Show();
        viewport.Add(label_name);
        viewport.Show();

        vbox.PackStart(image);                                  //0
        vbox.PackStart(label_id);                               //1
        vbox.PackEnd(viewport, false, false, 1);                //2 (contains label_name)

        vbox.Show();

        button = new Button(vbox);
        button.WidthRequest  = 150;
        button.HeightRequest = 170;
    }
Esempio n. 5
0
        public Lyrics(InfoBar info_bar)
            : base(info_bar)
        {
            Viewport view = new Viewport ();
            SearchBox search_box = new SearchBox ();
            ScrolledWindow scroll = new ScrolledWindow ();

            box.PackStart (scroll, true, true, 0);
            box.PackStart (new HSeparator (), false ,false, 0);
            box.PackStart (search_box, false, true, 0);

            lyrics_box.PackStart (content_tabs.DisplayWidget, true, true, 0);
            lyrics_box.BorderWidth = 20;

            tabs.ShowTabs = false;
            tabs.ShowBorder = false;
            tabs.AppendPage (new LyricsHelp (), null);
            tabs.AppendPage (lyrics_box, null);

            content_tabs.AddContent (new SongLyrics ());
            content_tabs.AddContent (new SearchArtist (this));

            scroll.ShadowType = ShadowType.None;
            scroll.Add (view);

            view.ShadowType = ShadowType.None;
            view.Add (tabs);

            search_box.Search += search;
        }
Esempio n. 6
0
 public FolderView(ViewBase owner)
     : base(owner)
 {
     scroller = new ScrolledWindow();
     scroller.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
     table = new Table(1, 1, false);
     Viewport vport = new Viewport();
     vport.Add(table);
     vport.ShadowType = ShadowType.None;
     scroller.Add(vport);
     _mainWidget = scroller;
 }
Esempio n. 7
0
		public static ScrolledWindow CreateViewport()
		{
			ScrolledWindow scroller = new ScrolledWindow();
			Viewport viewer = new Viewport();
			
			Table widgets = new Table(1, 2, false);
			
			widgets.Attach(new Entry("This is example Entry 1"), 0, 1, 0, 1);
			widgets.Attach(new Entry("This is example Entry 2"), 1, 2, 0, 1);
			
			// Place the widgets in a Viewport, and the Viewport in a ScrolledWindow
			viewer.Add(widgets);
			scroller.Add(viewer);
			return scroller;
		}
Esempio n. 8
0
    void Show3D(Table3D table)
    {
        if (table == null)
        {
            return;
        }
        var valuesZ = table.GetValuesZasFloats();
        var tableUI = new GtkWidgets.TableWidget(coloring, table.ValuesX, table.ValuesY, valuesZ, table.Zmin, table.Zmax);

        tableUI.TitleMarkup = GtkWidgets.TableWidget.MakeTitleMarkup(table.Title, table.UnitZ);
        tableUI.AxisMarkupX = GtkWidgets.TableWidget.MakeMarkup(table.NameX, table.UnitX);
        tableUI.AxisMarkupY = GtkWidgets.TableWidget.MakeMarkup(table.NameY, table.UnitY);

        // HACK FormatValues, no good digits algorithm yet
        int digits = ScoobyRom.Data.AutomaticMinDigits(valuesZ);

        if (digits <= 3)
        {
            tableUI.FormatValues = ScoobyRom.Data.ValueFormat(digits);
        }
        else
        {
            tableUI.FormatValues = table.Zmax < 30 ? "0.00" : "0.0";
            if (table.Zmax < 10)
            {
                tableUI.FormatValues = "0.000";
            }
        }


        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport();

        viewPort.Add(tableUI.Create());

        Gtk.Widget previous = this.scrolledwindowTable3D.Child;
        if (previous != null)
        {
            this.scrolledwindowTable3D.Remove(previous);
        }
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add(viewPort);
        this.scrolledwindowTable3D.ShowAll();
    }
        public RadioSourceContents()
        {
            HscrollbarPolicy = PolicyType.Never;
            VscrollbarPolicy = PolicyType.Automatic;

            viewport = new Viewport ();
            viewport.ShadowType = ShadowType.None;

            main_box = new VBox ();
            main_box.Spacing = 6;
            main_box.BorderWidth = 5;
            main_box.ReallocateRedraws = true;

            // Clamp the width, preventing horizontal scrolling
            SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                main_box.WidthRequest = args.Allocation.Width - 10;
            };

            viewport.Add (main_box);

            StyleSet += delegate {
                viewport.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                viewport.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
            };

            logo_pix = new Gdk.Pixbuf (System.Reflection.Assembly.GetExecutingAssembly ()
                                       .GetManifestResourceStream ("logo_color_large.gif"));
            logo = new Image (logo_pix);

            // auto-scale logo
            SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                int width = args.Allocation.Width - 50;
                logo.Pixbuf = logo_pix.ScaleSimple (width, (int)((float)width / 6.3f), Gdk.InterpType.Bilinear);
            };

            main_box.PackStart (logo, false, false, 0);

            genres = new TitledList ("Genres");
            main_box.PackStart (genres, false, false, 0);

            AddWithFrame (viewport);
            ShowAll ();
        }
Esempio n. 10
0
        public Profile(InfoBar info_bar)
            : base(info_bar)
        {
            Viewport view = new Viewport ();
            options = new ProfileOptions (this);

            profile_box.PackStart (profile_header.DisplayWidget, false, false, 0);
            profile_box.PackStart (content_tabs.DisplayWidget, true, true, 0);
            profile_box.BorderWidth = 20;

            content_tabs.AddContent (new RecommendedArtists (), "Recommendations");
            content_tabs.AddContent (new TopArtists (), "Top Artists");
            content_tabs.AddContent (new Friends (), "Friends");

            tabs.ShowTabs = false;
            tabs.ShowBorder = false;
            tabs.AppendPage (options.DisplayWidget, null);
            tabs.AppendPage (profile_box, null);

            scroll.ShadowType = ShadowType.None;
            scroll.Add (view);

            view.ShadowType = ShadowType.None;
            view.Add (tabs);

            Image signout_image = new Image (Stock.Disconnect, IconSize.Menu);
            Label signout_label = new Label ();
            signout_label.Markup = "<small>Sign Out</small>";

            signout.PackStart (signout_image, false, false, 0);
            signout.PackStart (signout_label, false, false, 0);

            info_bar.AddCustomMenu (signout_box);

            content_tabs.ContentChanged += content_changed;
            signout_box.Realized += signout_realized;
            signout_box.ButtonReleaseEvent += signout_released;
        }
Esempio n. 11
0
	public bool Initialize ()
	{
		tmpPath = Path.Combine (Path.GetTempPath (), "monodoc");
		try {
			string mozHome = System.Environment.GetEnvironmentVariable ("MOZILLA_HOME");
			if (mozHome != null)
				WebControl.CompPath = mozHome;
			html_panel = new WebControl (tmpPath, "MonodocGecko");
		}
		catch (Exception ex) {
			Console.WriteLine (ex.Message);
			Console.WriteLine (ex.StackTrace);
			return false;
		}

		html_panel.Show(); //due to Gecko bug
		html_panel.OpenUri += OnOpenUri;
		html_panel.LinkMsg += OnLinkMsg;
		panel = new Viewport();
		panel.Add (html_panel);
		cache_imgs = new Hashtable();
		return true;
	}
Esempio n. 12
0
		public Panes ()
		{
			Gtk.Viewport vp;

			mainSW = new Gtk.ScrolledWindow ();
			mainSW.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Always);
			mainSW.ShadowType = Gtk.ShadowType.In;
			mainSW.SizeAllocated += MainResized;
			Pack1 (mainSW, true, false);

			vp = new Gtk.Viewport (null, null);
			vp.ResizeMode = Gtk.ResizeMode.Parent;
			vp.ShadowType = ShadowType.None;
			mainSW.Add (vp);
			vp.Show ();

			main = new WhiteBox ();
			vp.Add (main);
			main.Show ();

			detailsSW = new Gtk.ScrolledWindow ();
			detailsSW.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Never);
			detailsSW.WidthRequest = 0;
			detailsSW.NoShowAll = true;
			detailsSW.ShadowType = Gtk.ShadowType.In;
			Pack2 (detailsSW, false, false);

			vp = new Gtk.Viewport (null, null);
			vp.ShadowType = ShadowType.None;
			detailsSW.Add (vp);
			vp.Show ();

			details = new WhiteBox ();
			vp.Add (details);
			details.Show ();
		}
Esempio n. 13
0
        public Panes()
        {
            Gtk.Viewport vp;

            mainSW = new Gtk.ScrolledWindow();
            mainSW.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Always);
            mainSW.ShadowType     = Gtk.ShadowType.In;
            mainSW.SizeAllocated += MainResized;
            Pack1(mainSW, true, false);

            vp            = new Gtk.Viewport(null, null);
            vp.ResizeMode = Gtk.ResizeMode.Parent;
            vp.ShadowType = ShadowType.None;
            mainSW.Add(vp);
            vp.Show();

            main = new WhiteBox();
            vp.Add(main);
            main.Show();

            detailsSW = new Gtk.ScrolledWindow();
            detailsSW.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
            detailsSW.WidthRequest = 0;
            detailsSW.NoShowAll    = true;
            detailsSW.ShadowType   = Gtk.ShadowType.In;
            Pack2(detailsSW, false, false);

            vp            = new Gtk.Viewport(null, null);
            vp.ShadowType = ShadowType.None;
            detailsSW.Add(vp);
            vp.Show();

            details = new WhiteBox();
            vp.Add(details);
            details.Show();
        }
        private void BuildWindow()
        {
            BorderWidth = 6;
            VBox.Spacing = 12;
            HasSeparator = false;

            HBox box = new HBox();
            box.BorderWidth = 6;
            box.Spacing = 12;

            // For later additions to the dialog.  (I.E. Feed art)
            HBox content_box = new HBox();
            content_box.Spacing = 12;

            Table table = new Table (2, 4, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 12;

            Label description_label = new Label ();
            description_label.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString ("Description:")));
            description_label.SetAlignment (0f, 0f);
            description_label.Justify = Justification.Left;

            Label last_updated_label = new Label ();
            last_updated_label.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString ("Last Updated:")));
            last_updated_label.SetAlignment (0f, 0f);
            last_updated_label.Justify = Justification.Left;

            Label feed_url_label = new Label ();
            feed_url_label.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString ("URL:")));
            feed_url_label.SetAlignment (0f, 0f);
            feed_url_label.Justify = Justification.Left;

            Label new_episode_option_label = new Label ();
            new_episode_option_label.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString (
                                                  "When feed is updated:")));
            new_episode_option_label.SetAlignment (0f, 0.5f);
            new_episode_option_label.Justify = Justification.Left;

            Label last_updated_text = new Label (feed.LastUpdated.ToString ("f"));
            last_updated_text.Justify = Justification.Left;
            last_updated_text.SetAlignment (0f, 0f);

            Label feed_url_text = new Label (feed.Url.ToString ());
            feed_url_text.Wrap = false;
            feed_url_text.Selectable = true;
            feed_url_text.SetAlignment (0f, 0f);
            feed_url_text.Justify = Justification.Left;
            feed_url_text.Ellipsize = Pango.EllipsizeMode.End;

            string description_string = (feed.Description == String.Empty ||
                                         feed.Description == null) ?
                                        Catalog.GetString ("No description available") :
                                        feed.Description;

            if (!description_string.StartsWith ("\""))
            {
                description_string =  "\""+description_string;
            }

            if (!description_string.EndsWith ("\""))
            {
                description_string = description_string+"\"";
            }

            Label descrition_text = new Label (description_string);
            descrition_text.Justify = Justification.Left;
            descrition_text.SetAlignment (0f, 0f);
            descrition_text.Wrap = true;
            descrition_text.Selectable = true;

            Viewport description_viewport = new Viewport();
            description_viewport.SetSizeRequest(-1, 150);
            description_viewport.ShadowType = ShadowType.None;

            ScrolledWindow description_scroller = new ScrolledWindow ();
            description_scroller.HscrollbarPolicy = PolicyType.Never;
            description_scroller.VscrollbarPolicy = PolicyType.Automatic;

            description_viewport.Add (descrition_text);
            description_scroller.Add (description_viewport);

            new_episode_option_combo = new SyncPreferenceComboBox (feed.SyncPreference);

            table.Attach (
                feed_url_label, 0, 1, 0, 1,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                last_updated_label, 0, 1, 1, 2,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                new_episode_option_label, 0, 1, 2, 3,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                description_label, 0, 1, 3, 4,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                feed_url_text, 1, 2, 0, 1,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                last_updated_text, 1, 2, 1, 2,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                new_episode_option_combo, 1, 2, 2, 3,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (description_scroller, 1, 2, 3, 4,
                          AttachOptions.Expand | AttachOptions.Fill,
                          AttachOptions.Expand | AttachOptions.Fill, 0, 0
                         );

            content_box.PackStart (table, true, true, 0);
            box.PackStart (content_box, true, true, 0);

            Button cancel_button = new Button("gtk-cancel");
            cancel_button.CanDefault = true;
            cancel_button.Show();

            Button save_button = new Button("gtk-save");
            save_button.CanDefault = true;
            save_button.Show();

            AddActionWidget (cancel_button, ResponseType.Cancel);
            AddActionWidget (save_button, ResponseType.Ok);

            DefaultResponse = Gtk.ResponseType.Cancel;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            box.ShowAll ();
            VBox.Add (box);

            Response += OnResponse;
        }
Esempio n. 15
0
        private void CreateDockAndPads(HBox container)
        {
            // Create canvas
            sw = new ScrolledWindow () {
                Name = "sw",
                ShadowType = ShadowType.EtchedOut
            };

            Viewport vp = new Viewport () {
                ShadowType = ShadowType.None
            };

            canvas = new PintaCanvas () {
                Name = "canvas",
                CanDefault = true,
                CanFocus = true,
                Events = (Gdk.EventMask)16134
            };

            // Dock widget
            dock = new DockFrame ();
            dock.CompactGuiLevel = 5;

            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Tools.Pencil.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Tools.Pencil.png")));
            fact.Add ("Pinta.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Pinta.png")));
            fact.AddDefault ();

            // Toolbox pad
            DockItem toolbox_item = dock.AddItem ("Toolbox");
            toolbox = new ToolBoxWidget () { Name = "toolbox" };

            toolbox_item.Label = Catalog.GetString ("Tools");
            toolbox_item.Content = toolbox;
            toolbox_item.Icon = PintaCore.Resources.GetIcon ("Tools.Pencil.png");
            toolbox_item.Behavior |= DockItemBehavior.CantClose;
            toolbox_item.DefaultWidth = 65;

            Gtk.Action show_toolbox = show_pad.AppendAction ("Tools", Catalog.GetString ("Tools"), null, "Tools.Pencil.png");
            show_toolbox.Activated += delegate { toolbox_item.Visible = true; };

            // Palette pad
            DockItem palette_item = dock.AddItem ("Palette");
            color = new ColorPaletteWidget () { Name = "color" };

            palette_item.Label = Catalog.GetString ("Palette");
            palette_item.Content = color;
            palette_item.Icon = PintaCore.Resources.GetIcon ("Pinta.png");
            palette_item.DefaultLocation = "Toolbox/Bottom";
            palette_item.Behavior |= DockItemBehavior.CantClose;
            palette_item.DefaultWidth = 65;

            Gtk.Action show_palette = show_pad.AppendAction ("Palette", Catalog.GetString ("Palette"), null, "Pinta.png");
            show_palette.Activated += delegate { palette_item.Visible = true; };

            // Canvas pad
            DockItem documentDockItem = dock.AddItem ("Canvas");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;

            documentDockItem.DrawFrame = false;
            documentDockItem.Label = Catalog.GetString ("Documents");
            documentDockItem.Content = sw;

            sw.Add (vp);
            vp.Add (canvas);

            canvas.Show ();
            vp.Show ();

            // Layer pad
            LayersListWidget layers = new LayersListWidget ();
            DockItem layers_item = dock.AddItem ("Layers");
            DockItemToolbar layers_tb = layers_item.GetToolbar (PositionType.Bottom);

            layers_item.Label = Catalog.GetString ("Layers");
            layers_item.Content = layers;
            layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png");

            layers_tb.Add (PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem ());

            Gtk.Action show_layers = show_pad.AppendAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png");
            show_layers.Activated += delegate { layers_item.Visible = true; };

            // History pad
            HistoryTreeView history = new HistoryTreeView ();
            DockItem history_item = dock.AddItem ("History");
            DockItemToolbar history_tb = history_item.GetToolbar (PositionType.Bottom);

            history_item.Label = Catalog.GetString ("History");
            history_item.DefaultLocation = "Layers/Bottom";
            history_item.Content = history;
            history_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.DuplicateLayer.png");

            history_tb.Add (PintaCore.Actions.Edit.Undo.CreateDockToolBarItem ());
            history_tb.Add (PintaCore.Actions.Edit.Redo.CreateDockToolBarItem ());

            Gtk.Action show_history = show_pad.AppendAction ("History", Catalog.GetString ("History"), null, "Menu.Layers.DuplicateLayer.png");
            show_history.Activated += delegate { history_item.Visible = true; };

            container.PackStart (dock, true, true, 0);

            string layout_file = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml");

            if (System.IO.File.Exists (layout_file))
                dock.LoadLayouts (layout_file);

            if (!dock.HasLayout ("Default"))
                dock.CreateLayout ("Default", false);

            dock.CurrentLayout = "Default";
        }
Esempio n. 16
0
    void Show3D(Table3D table)
    {
        if (table == null)
            return;
        var valuesZ = table.GetValuesZasFloats ();
        var tableUI = new GtkWidgets.TableWidget (coloring, table.ValuesX, table.ValuesY, valuesZ, table.Zmin, table.Zmax);
        tableUI.TitleMarkup = GtkWidgets.TableWidget.MakeTitleMarkup (table.Title, table.UnitZ);
        tableUI.AxisMarkupX = GtkWidgets.TableWidget.MakeMarkup (table.NameX, table.UnitX);
        tableUI.AxisMarkupY = GtkWidgets.TableWidget.MakeMarkup (table.NameY, table.UnitY);

        // HACK FormatValues, no good digits algorithm yet
        int digits = ScoobyRom.Data.AutomaticMinDigits(valuesZ);
        if (digits <= 3)
        {
            tableUI.FormatValues = ScoobyRom.Data.ValueFormat(digits);
        }
        else{
            tableUI.FormatValues = table.Zmax < 30 ? "0.00" : "0.0";
            if (table.Zmax < 10)
                tableUI.FormatValues = "0.000";
        }

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport ();
        viewPort.Add (tableUI.Create ());

        Gtk.Widget previous = this.scrolledwindowTable3D.Child;
        if (previous != null)
            this.scrolledwindowTable3D.Remove (previous);
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add (viewPort);
        this.scrolledwindowTable3D.ShowAll ();
    }
Esempio n. 17
0
        private void CreateDockAndPads(HBox container)
        {
            // Create canvas
            Table mainTable = new Table (2, 2, false);

            sw = new ScrolledWindow () {
                Name = "sw",
                ShadowType = ShadowType.EtchedOut
            };

            Viewport vp = new Viewport () {
                ShadowType = ShadowType.None
            };

            canvas = new PintaCanvas () {
                Name = "canvas",
                CanDefault = true,
                CanFocus = true,
                Events = (Gdk.EventMask)16134
            };

            // Dock widget
            dock = new DockFrame ();
            dock.CompactGuiLevel = 5;

            Gtk.IconFactory fact = new Gtk.IconFactory ();
            fact.Add ("Tools.Pencil.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Tools.Pencil.png")));
            fact.Add ("Pinta.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Pinta.png")));
            fact.AddDefault ();

            // Toolbox pad
            DockItem toolbox_item = dock.AddItem ("Toolbox");
            toolbox = new ToolBoxWidget () { Name = "toolbox" };

            toolbox_item.Label = Catalog.GetString ("Tools");
            toolbox_item.Content = toolbox;
            toolbox_item.Icon = PintaCore.Resources.GetIcon ("Tools.Pencil.png");
            toolbox_item.Behavior |= DockItemBehavior.CantClose;
            toolbox_item.DefaultWidth = 65;

            Gtk.Action show_toolbox = show_pad.AppendAction ("Tools", Catalog.GetString ("Tools"), null, "Tools.Pencil.png");
            show_toolbox.Activated += delegate { toolbox_item.Visible = true; };

            // Palette pad
            DockItem palette_item = dock.AddItem ("Palette");
            color = new ColorPaletteWidget () { Name = "color" };

            palette_item.Label = Catalog.GetString ("Palette");
            palette_item.Content = color;
            palette_item.Icon = PintaCore.Resources.GetIcon ("Pinta.png");
            palette_item.DefaultLocation = "Toolbox/Bottom";
            palette_item.Behavior |= DockItemBehavior.CantClose;
            palette_item.DefaultWidth = 65;

            Gtk.Action show_palette = show_pad.AppendAction ("Palette", Catalog.GetString ("Palette"), null, "Pinta.png");
            show_palette.Activated += delegate { palette_item.Visible = true; };

            // Canvas pad
            DockItem documentDockItem = dock.AddItem ("Canvas");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;

            documentDockItem.DrawFrame = false;
            documentDockItem.Label = Catalog.GetString ("Documents");
            documentDockItem.Content = mainTable;

            //rulers
            hruler = new HRuler ();
            hruler.Metric = MetricType.Pixels;
            mainTable.Attach (hruler, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            vruler = new VRuler ();
            vruler.Metric = MetricType.Pixels;
            mainTable.Attach (vruler, 0, 1, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            sw.Hadjustment.ValueChanged += delegate {
                UpdateRulerRange ();
            };

            sw.Vadjustment.ValueChanged += delegate {
                UpdateRulerRange ();
            };

            PintaCore.Workspace.CanvasSizeChanged += delegate {
                UpdateRulerRange ();
            };

            canvas.MotionNotifyEvent += delegate (object o, MotionNotifyEventArgs args) {
                if (!PintaCore.Workspace.HasOpenDocuments)
                    return;

                Cairo.PointD point = PintaCore.Workspace.WindowPointToCanvas (args.Event.X, args.Event.Y);

                hruler.Position = point.X;
                vruler.Position = point.Y;

            };
            mainTable.Attach (sw, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            sw.Add (vp);
            vp.Add (canvas);

            mainTable.ShowAll ();
            canvas.Show ();
            vp.Show ();

            HideRulers();

            // Layer pad
            layers = new LayersListWidget ();
            DockItem layers_item = dock.AddItem ("Layers");
            DockItemToolbar layers_tb = layers_item.GetToolbar (PositionType.Bottom);

            layers_item.Label = Catalog.GetString ("Layers");
            layers_item.Content = layers;
            layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png");

            layers_tb.Add (PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem ());
            layers_tb.Add (PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem ());

            Gtk.Action show_layers = show_pad.AppendAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png");
            show_layers.Activated += delegate { layers_item.Visible = true; };

            // History pad
            HistoryTreeView history = new HistoryTreeView ();
            DockItem history_item = dock.AddItem ("History");
            DockItemToolbar history_tb = history_item.GetToolbar (PositionType.Bottom);

            history_item.Label = Catalog.GetString ("History");
            history_item.DefaultLocation = "Layers/Bottom";
            history_item.Content = history;
            history_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.DuplicateLayer.png");

            history_tb.Add (PintaCore.Actions.Edit.Undo.CreateDockToolBarItem ());
            history_tb.Add (PintaCore.Actions.Edit.Redo.CreateDockToolBarItem ());

            Gtk.Action show_history = show_pad.AppendAction ("History", Catalog.GetString ("History"), null, "Menu.Layers.DuplicateLayer.png");
            show_history.Activated += delegate { history_item.Visible = true; };

            container.PackStart (dock, true, true, 0);

            string layout_file = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml");

            if (System.IO.File.Exists (layout_file))
                dock.LoadLayouts (layout_file);

            if (!dock.HasLayout ("Default"))
                dock.CreateLayout ("Default", false);

            dock.CurrentLayout = "Default";
        }
        private Widget RenderSimilarArtist(XmlNode node)
        {
            Button artist_button = new Button ();
            artist_button.Relief = ReliefStyle.None;

            HBox box = new HBox ();
            Viewport vp = new Viewport ();
            vp.Add (RenderImage (node.SelectSingleNode ("image_small").InnerText));
            box.PackStart (vp, false, false, 0);

            Label label = new Label ();
            label.Ellipsize = Pango.EllipsizeMode.End;
            label.Xalign = 0;

            label.Markup = String.Format ("{0}\n<small><span foreground=\"grey\">{1}% {2}</span></small>",
                              GLib.Markup.EscapeText (node.SelectSingleNode ("name").InnerText).Trim (),
                              node.SelectSingleNode ("match").InnerText,
                              Catalog.GetString ("similarity"));
            box.PackEnd (label, true, true, 3);

            artist_button.Add (box);

            artist_button.Clicked += delegate(object o, EventArgs args) {
                Gnome.Url.Show (node.SelectSingleNode ("url").InnerText);
            };

            return artist_button;
        }
        public SongKickSourceContents()
        {
            //HscrollbarPolicy = PolicyType.Never;
            //VscrollbarPolicy = PolicyType.Automatic;

            viewport = new Viewport ();
            viewport.ShadowType = ShadowType.None;

            main_box = new HBox () { Spacing = 6, BorderWidth = 5, ReallocateRedraws = true };

            search_by_artist_contents_box = new SearchEventsBox (new EventsByArtistSearch());
            search_by_location_contents_box = new SearchEventsBox (new EventsByLocationSearch());
            search_location_contents_box = new SearchLocationBox (new LocationSearch());
            search_artists_contents_box = new SearchArtistsBox (new ArtistSearch());

            recommendations_contents_box = new RecommendedArtistsBox();
            recommendations_contents_box.RowActivated += OnRecommendedArtistRowActivate;

            search_location_contents_box.View.RowActivated += SearchLocationRowActivate;
            search_artists_contents_box.View.RowActivated += SearchArtistRowActivate;

            menu_box = BuildTiles();

            main_box.PackStart (menu_box, false, false, 0);
            contents_box = new HBox ();
            main_box.PackStart (contents_box, true, true, 0);

            // set default contents box
            SetView (this.presonal_recommendation_view);

            // Clamp the width, preventing horizontal scrolling
            /*
            SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
                // TODO '- 10' worked for Nereid, but not for Cubano; properly calculate the right width we should request
                main_box.WidthRequest = args.Allocation.Width - 30;
            };
            */

            viewport.Add (main_box);
            #pragma warning disable 612
            StyleSet += delegate {
                viewport.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
                viewport.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
            };
            #pragma warning restore 612
            recommendations_contents_box.LoadAndPresentRecommendations ();

            AddWithFrame (viewport);
            ShowAll ();
        }
Esempio n. 20
0
        // Builds the handlers for the dettachable widgets
        private void BuildProperties()
        {
            System.Console.WriteLine ("BuildProperties");
            _canvasArea = new Widgets.CanvasArea ();
            _mainVPaned.Add1 (_canvasArea);
            _propertiesNotebook = new Notebook ();
            _mainVPaned.Add2 (_propertiesNotebook);
            _tree = new Widgets.Tree();
            _scrolledwindowTree.Add(_tree);
            _umlPropertiesTab = new Widgets.UMLPropertiesTab();
            // Push tab into a scrolledwindow
            Viewport propertiesViewport = new Viewport ();
            propertiesViewport.ShadowType = ShadowType.None;
            propertiesViewport.BorderWidth = 3;
            propertiesViewport.Add (_umlPropertiesTab);
            _propertiesScroll = new ScrolledWindow ();
            _propertiesScroll.HscrollbarPolicy = PolicyType.Automatic;
            _propertiesScroll.VscrollbarPolicy = PolicyType.Automatic;
            _propertiesScroll.ShadowType = ShadowType.In;
            _propertiesScroll.BorderWidth = 3;
            _propertiesScroll.Add (propertiesViewport);

            _propertiesNotebook.AppendPage(
                _propertiesScroll,
                new Gtk.Label (GettextCatalog.GetString ("UML Properties"))
            );
            _hub = Widgets.Hub.Instance;
            _hub.AddView (_tree);
            _hub.AddView (_canvasArea.NoteBook);
            _hub.AddView (_umlPropertiesTab);
        }
Esempio n. 21
0
        public LogView(string filepath, bool isDirectory, RevisionDescription[] history, VersionControlSystem vc)
            : base(Path.GetFileName(filepath) + " Log")
        {
            this.vc = vc;
            this.filepath = filepath;

            ScrolledWindow scroller = new ScrolledWindow();
            Viewport viewport = new Viewport();
            VBox box = new VBox(false, 5);

            viewport.Add(box);
            scroller.Add(viewport);
            widget = scroller;

            foreach (RevisionDescription d in history) {
                RevItem revitem = new RevItem();
                revitem.Path = d.RepositoryPath;
                revitem.Rev = d.Revision;

                VBox item = new VBox(false, 1);

                HBox header_row = new HBox(false, 2);
                item.PackStart(header_row, false, false, 0);

                Label header = new Label(d.Revision + " -- " + d.Time + " -- " + d.Author);
                header.Xalign = 0;
                header_row.Add(header);

                if (!isDirectory) {
                    Button viewdiff = new Button("View Changes");
                    viewdiff.Clicked += new EventHandler(DiffButtonClicked);
                    header_row.Add(viewdiff);
                    buttons[viewdiff] = revitem;

                    Button viewtext = new Button("View File");
                    viewtext.Clicked += new EventHandler(ViewTextButtonClicked);
                    header_row.Add(viewtext);
                    buttons[viewtext] = revitem;
                }

                TextView message = new TextView();
                message.Editable = false;
                message.WrapMode = Gtk.WrapMode.WordChar;
                message.Buffer.Text = d.Message == "" ? "No message." : d.Message;
                item.PackStart(message, false, false, 0);

                box.PackStart(item, false, false, 0);
            }

            widget.ShowAll();
        }
Esempio n. 22
0
        public CanvasWindow (Document document) : base (2, 2, false)
        {
            scrolled_window = new ScrolledWindow ();

            var vp = new Viewport () {
                ShadowType = ShadowType.None
            };

            Canvas = new PintaCanvas (this, document) {
                Name = "canvas",
                CanDefault = true,
                CanFocus = true,
                Events = (Gdk.EventMask)16134
            };

            // Rulers
            horizontal_ruler = new HRuler ();
            horizontal_ruler.Metric = MetricType.Pixels;
            Attach (horizontal_ruler, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            vertical_ruler = new VRuler ();
            vertical_ruler.Metric = MetricType.Pixels;
            Attach (vertical_ruler, 0, 1, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            scrolled_window.Hadjustment.ValueChanged += delegate {
                UpdateRulerRange ();
            };

            scrolled_window.Vadjustment.ValueChanged += delegate {
                UpdateRulerRange ();
            };

            document.Workspace.CanvasSizeChanged += delegate {
                UpdateRulerRange ();
            };

            Canvas.MotionNotifyEvent += delegate (object o, MotionNotifyEventArgs args) {
                if (!PintaCore.Workspace.HasOpenDocuments)
                    return;

                var point = PintaCore.Workspace.WindowPointToCanvas (args.Event.X, args.Event.Y);

                horizontal_ruler.Position = point.X;
                vertical_ruler.Position = point.Y;
            };

            Attach (scrolled_window, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            scrolled_window.Add (vp);
            vp.Add (Canvas);

            ShowAll ();
            Canvas.Show ();
            vp.Show ();

            horizontal_ruler.Visible = false;
            vertical_ruler.Visible = false;

            Canvas.SizeAllocated += delegate { UpdateRulerRange (); };
        }
Esempio n. 23
0
 private void build_attack_dialog()
 {
     if (this.attack_dialog != null)
     {
         this.attack_dialog.Hide ();
         this.attack_dialog.Dispose ();
     }
     this.attack_dialog = new Dialog ();
     this.attack_dialog.Title = "Attack";
     this.attack_dialog.KeepAbove = true;
     this.attack_dialog.Modal = false;
     this.attack_dialog.SkipPagerHint = true;
     this.attack_dialog.SkipTaskbarHint =true;
     this.attack_dialog.WindowPosition = WindowPosition.Center;
     ScrolledWindow sw = new ScrolledWindow ();
     Viewport vp = new Viewport ();
     this.atkdlg_vbox = new VBox();
     Label header= new Label();
     header.UseMarkup = true;
     header.LabelProp = "<b>Battle Details</b>";
     this.atkdlg_vbox.PackStart (header, false, true, 3);
     vp.Add (this.atkdlg_vbox);
     sw.Add (vp);
     this.attack_dialog.SetDefaultSize (400, 200);
     this.attack_dialog.VBox.PackStart (sw, true, true, 3);
     //this.attack_dialog.AddButton ("Close", ResponseType.Close);
 }
		public TemplatePickerWidget ()
		{
			Stetic.BinContainer.Attach (this);
			
			infoBox.BorderWidth = 4;
			infoBox.Spacing = 4;
			infoHeaderLabel.Wrap = true;
			infoHeaderLabel.Xalign = 0;
			infoDecriptionLabel.Wrap = true;
			infoDecriptionLabel.Xalign = 0;
			infoDecriptionLabel.Yalign = 0;
			
			infoBox.SizeAllocated += delegate {
				var w = infoBox.Allocation.Width - 10;
				if (infoHeaderLabel.WidthRequest != w) {
					infoHeaderLabel.WidthRequest = w;
					infoDecriptionLabel.WidthRequest = w;
				}
			};
			
			recentSection = sectionList.AddSection (GettextCatalog.GetString ("Recent Templates"), recentTemplateCatView);
			installedSection = sectionList.AddSection (GettextCatalog.GetString ("Installed Templates"), installedTemplateCatView);
			onlineSection = sectionList.AddSection (GettextCatalog.GetString ("Online Templates"), onlineTemplateCatView);
			
			recentSection.Activated += delegate {
				LoadTemplatesIntoView (recentTemplates);
				templateView.SetCategoryFilter (recentTemplateCatView.GetSelection ());
			};
			
			installedSection.Activated += delegate {
				LoadTemplatesIntoView (installedTemplates);
				templateView.SetCategoryFilter (installedTemplateCatView.GetSelection ());
			};
			
			onlineSection.Activated += delegate {
				LoadTemplatesIntoView (onlineTemplates);
				templateView.SetCategoryFilter (onlineTemplateCatView.GetSelection ());
			};
			
			recentTemplateCatView.SelectionChanged += delegate {
				if (recentSection.IsActive)
					templateView.SetCategoryFilter (recentTemplateCatView.GetSelection ());
			};
			
			installedTemplateCatView.SelectionChanged += delegate {
				if (installedSection.IsActive)
					templateView.SetCategoryFilter (installedTemplateCatView.GetSelection ());
			};
			
			onlineTemplateCatView.SelectionChanged += delegate {
				if (onlineSection.IsActive)
					templateView.SetCategoryFilter (onlineTemplateCatView.GetSelection ());
			};
			
			searchEntry.WidthRequest = 150;
			searchEntry.EmptyMessage = GettextCatalog.GetString ("Search…");
			searchEntry.Changed += delegate {
				templateView.SetSearchFilter (searchEntry.Entry.Text);
			};
			searchEntry.Activated += delegate {
				templateView.Child.GrabFocus ();
			};
			searchEntry.Ready = true;
			searchEntry.Show ();
			
			installedTemplateCatView.SelectionChanged += delegate (object sender, EventArgs e) {
				var selection = installedTemplateCatView.GetSelection ();
				templateView.SetCategoryFilter (selection);
			};
			
			templateView.SelectionChanged += TemplateSelectionChanged;
			templateView.DoubleClicked += delegate {
				OnActivated ();
			};
			
			Add (hsplit);
			hsplit.Pack1 (sectionList, true, false);
			hsplit.Pack2 (rightVbox, true, false);
			rightVbox.PackStart (searchHbox, false, false, 0);
			rightVbox.Spacing = 6;
			searchHbox.PackStart (new Label (), true, true, 0);
			searchHbox.PackStart (searchEntry, false, false, 0);
			rightVbox.PackStart (vsplit, true, true, 0);
			vsplit.Pack1 (templateView, true, false);
			vsplit.Pack2 (infoScrolledWindow, true, false);
			infoScrolledWindow.ShowBorderLine = true;
			var vp = new Viewport ();
			vp.ShadowType = ShadowType.None;
			vp.Add (infoBox);
			infoScrolledWindow.Add (vp);
			infoBox.PackStart (infoHeaderLabel, false, false, 0);
			infoBox.PackStart (infoDecriptionLabel, true, true, 0);
			hsplit.ShowAll ();
			
			//sane proportions for the splitter children
			templateView.HeightRequest = 200;
			infoScrolledWindow.HeightRequest = 75;
			sectionList.WidthRequest = 150;
			rightVbox.WidthRequest = 300;
			
			sectionList.ActiveIndex = 1;
		}
Esempio n. 25
0
        /// <summary>
        /// Add the twitts to the box
        /// </summary>
        public void AddTwitts()
        {
            if (w4 != null) {
                                w4.Destroy ();
                                w4 = null;
                        }
                        w4 = new Gtk.Viewport ();
                        w4.ShadowType = ((Gtk.ShadowType)(0));

                        scrolledwindow.Add (w4);
                        area_status = null;
                        scrolledwindow.Remove (area_status);

                        // Container child GtkViewport.Gtk.Container+ContainerChild
                        area_status = new Gtk.VBox ();
                        area_status.Name = "area_status";
                        area_status.Spacing = 6;

                        w4.Add (area_status);
                        scrolledwindow.Add (w4);

                        Status [] sts = ObjectCalls.GetPublicTimeline ();
                        foreach (Status st in sts) {
                        StatusViewItem stItem = new StatusViewItem (st);
                        area_status.Add (stItem);
                        if (st.StatusId != sts [sts.Length - 1].StatusId)
                                area_status.Add (new Gtk.HSeparator ());
                        }
        }
Esempio n. 26
0
        public MainWindow()
            : base("Virtual Machine Manager")
        {
            IconThemeUtils.SetWindowIcon (this);

            manager = new VirtualMachineManager ();
            controller = new MainController ();
            controller.MainWindow = this;
            controller.Manager = manager;

            Glade.XML xml = new Glade.XML ("vmx-manager.glade", "mainContent");
            xml.Autoconnect (this);

            noMachinesWidget = new Viewport ();
            noMachinesWidget.ShadowType = ShadowType.None;
            MessagePane pane = new MessagePane ();
            pane.HeaderIcon = IconThemeUtils.LoadIcon (48, "face-surprise", Stock.DialogInfo);
            pane.HeaderMarkup = Catalog.GetString ("<b>There are currently no virtual machines.</b>");
            pane.Append (Catalog.GetString ("You can add or create a new virtual machine using the buttons on the left"), false);
            pane.Show ();
            noMachinesWidget.Add (pane);

            vmview = new VMView (controller);
            controller.VMView = vmview;

            vmmodel = new VMModel (manager);
            vmview.Model = vmmodel;

            treeContent.Add (vmview);
            Add (mainContent);

            ActionEntry[] actionList = {
                new ActionEntry ("Start", Stock.Execute,
                                 Catalog.GetString ("Start Machine"), "<control>r",
                                 Catalog.GetString ("Start the virtual machine"),
                                 controller.OnStart),
                new ActionEntry ("Configure", Stock.Properties,
                                 Catalog.GetString ("Configure Machine"), "<control>p",
                                 Catalog.GetString ("Configure the connected devices"),
                                 controller.OnConfigure),
                new ActionEntry ("Remove", Stock.Remove,
                                 Catalog.GetString ("Remove Machine"), "<control>d",
                                 Catalog.GetString ("Remove the virtual machine"),
                                 controller.OnRemove),
                new ActionEntry ("CreateBlank", Stock.New,
                                 Catalog.GetString ("Create Blank Machine"), null,
                                 Catalog.GetString ("Create a new empty virtual machine"),
                                 controller.OnCreateBlank),
                new ActionEntry ("CreateFromIso", Stock.New,
                                 Catalog.GetString ("Create Machine From ISO"), null,
                                 Catalog.GetString ("Create a new machine which boots from a ISO"),
                                 controller.OnCreateFromIso),
                new ActionEntry ("AddMachine", Stock.Add,
                                 Catalog.GetString ("Add Existing Machine"), null,
                                 Catalog.GetString ("Add an existing virtual machine"),
                                 controller.OnAddExisting)
            };

            actions = new ActionGroup ("VmxManager Actions");
            actions.Add (actionList);

            ui = new UIManager ();
            ui.InsertActionGroup (actions, 0);
            ui.AddUiFromResource ("vmx-manager.xml");

            havePlayer = Utility.CheckForPlayer ();
            if (!havePlayer) {
                HigMessageDialog dialog = new HigMessageDialog (this, DialogFlags.Modal, MessageType.Warning,
                                                                ButtonsType.Close,
                                                                Catalog.GetString ("VMware Player not found"),
                                                                Catalog.GetString ("It will not be possible to run virtual machines."));
                dialog.Run ();
                dialog.Destroy ();
            }

            SetActionsSensitive ();

            DefaultWidth = 600;
            DefaultHeight = 400;

            vmview.ButtonPressEvent += OnTreeButtonPress;

            startButton.Clicked += controller.OnStart;
            configureButton.Clicked += controller.OnConfigure;
            removeButton.Clicked += controller.OnRemove;
            createBlankButton.Clicked += controller.OnCreateBlank;
            createFromIsoButton.Clicked += controller.OnCreateFromIso;
            addExistingButton.Clicked += controller.OnAddExisting;

            vmview.Selection.Changed += delegate {
                SetActionsSensitive ();
            };

            vmview.Model.RowInserted += delegate {
                SetActionsSensitive ();
            };

            vmview.Model.RowDeleted += delegate {
                SetActionsSensitive ();
            };

            foreach (VirtualMachine machine in manager.Machines) {
                machine.Started += OnMachineChanged;
                machine.Stopped += OnMachineChanged;
            }

            manager.Added += delegate (object o, VirtualMachineArgs args) {
                args.Machine.Started += OnMachineChanged;
                args.Machine.Stopped += OnMachineChanged;
            };
        }
Esempio n. 27
0
		private DiffWidget(Hunk[] hunks, Options options) : base(false, 0) {
			if (hunks == null || hunks.Length == 0 || options == null)
				throw new ArgumentException();
			
			if (options.SideBySide && options.LeftName != null && options.RightName != null) {
				HBox filetitles = new HBox(true, 2);
				PackStart(filetitles, false, false, 2);
				Label leftlabel = new Label(options.LeftName);
				Label rightlabel = new Label(options.RightName);
				filetitles.PackStart(leftlabel);
				filetitles.PackStart(rightlabel);
			}
			
			HBox centerpanel = new HBox(false, 0);
			PackStart(centerpanel);

			scroller = new ScrolledWindow();
			
			centerpanel.PackStart(new OverviewRenderer(scroller, hunks, options.SideBySide), false, false, 0);
			
			Viewport textviewport = new Viewport();
			
			centerpanel.PackStart(scroller);
			scroller.Add(textviewport);
			
			int nRows = 0;
			foreach (Hunk hunk in hunks) {
				if (options.SideBySide) {
					nRows += hunk.MaxLines();
				} else {
					if (hunk.Same) {
						nRows += hunk.Original().Count;
					} else {
						for (int i = 0; i < hunk.ChangedLists; i++)
							nRows += hunk.Changes(i).Count;
					}
				}
			}
			
			uint nCols = 1 + (uint)hunks[0].ChangedLists;
			if (options.SideBySide) nCols += 2;
			if (options.LineNumbers) nCols++;
			
			VBox tablecontainer = new VBox(false, 0);
			textviewport.Add(tablecontainer);
			
			Table difftable = new Table((uint)nRows, (uint)nCols, false);
			tablecontainer.PackStart(difftable, false, false, 0);	
			
			uint row = 0;
			
			Pango.FontDescription font = null;
			if (options.Font != null)
				font = Pango.FontDescription.FromString(options.Font);
			
			foreach (Hunk hunk in hunks) {
				char leftmode = hunk.Same ? ' ' : (hunk.ChangedLists == 1 && hunk.Changes(0).Count == 0) ? '-' : 'C';
				uint inc = 0;
				
				if (options.SideBySide) {
					ComposeLines(hunk.Original(), leftmode, -1, difftable, row, false, 0, options.LineWrap, font, options.LineNumbers);
					inc = (uint)hunk.Original().Count;
				} else { 
					if (leftmode == 'C') leftmode = '-';
					int altlines = -1;
					if (hunk.ChangedLists == 1 && hunk.Same)
						altlines = hunk.Changes(0).Start;
					ComposeLines(hunk.Original(), leftmode, altlines, difftable, row, true, 0, options.LineWrap, font, options.LineNumbers);
					row += (uint)hunk.Original().Count;
				}

				for (int i = 0; i < hunk.ChangedLists; i++) {
					char rightmode = hunk.Same ? ' ' : hunk.Original().Count == 0 ? '+' : 'C';
					
					if (options.SideBySide) {
						int colsper = 1 + (options.LineNumbers ? 1 : 0);			
						ComposeLines(hunk.Changes(i), rightmode, -1, difftable, row, false, (uint)((i+1)*colsper), options.LineWrap, font, options.LineNumbers);
						if (hunk.Changes(i).Count > inc)
							inc = (uint)hunk.Changes(i).Count;
					} else {
						if (rightmode == 'C') rightmode = '+';
		
						if (!hunk.Same) 
							ComposeLines(hunk.Changes(i), rightmode, -1, difftable, row, true, 0, options.LineWrap, font, options.LineNumbers);
						
						if (!hunk.Same) row += (uint)hunk.Changes(i).Count;
					}
				}
				
				if (options.SideBySide)
					row += inc;
			}
		}
        public void ShowTools()
        {
            // Remove any open editor, if present.
            if (current_editor != null) {
                active_editor.Hide ();
                widgets.Remove (active_editor);
                active_editor = null;
                current_editor.Restore ();
                current_editor = null;
            }

            // No need to build the widget twice.
            if (buttons != null) {
                buttons.Show ();
                return;
            }

            if (widgets == null) {
                widgets = new VBox (false, 0);
                widgets.NoShowAll = true;
                widgets.Show ();
                Viewport widgets_port = new Viewport ();
                widgets_port.Add (widgets);
                Add (widgets_port);
                widgets_port.ShowAll ();
            }

            // Build the widget (first time we call this method).
            buttons = new VButtonBox ();
            buttons.BorderWidth = 5;
            buttons.Spacing = 5;
            buttons.LayoutStyle = ButtonBoxStyle.Start;

            foreach (Editor editor in editors)
                PackButton (editor);

            buttons.Show ();
            widgets.Add (buttons);
        }
        private void UpdateGraphicObjects()
        {
            // Set dialog icon
            AboutDialog.Icon = Gdk.Pixbuf.LoadFromResource("themonospot.png");
            vpTitle.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
            AboutDialog.Title = GlobalData.GetLanguageKeyValue("ABOUTWINTITLE");

            ScrolledWindow sw = new ScrolledWindow();
            Viewport vp = new Viewport();
            sw.Add(vp);
            Label lblContent = new Label();
            lblContent.SetPadding(4,4);
            lblContent.SetAlignment((float)0, (float)0);
            vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
            lblContent.Markup =
                "<b>Themonospot Gtk</b>\r\n" +
                "  " + GlobalData.GuiDescription + "\r\n\r\n" +
                "Copyright " + GlobalData.GuiCopyright + "\r\n\r\n" +
                "<b>Website</b>\r\n" +
                "  www.integrazioneweb.com/themonospot\r\n\r\n" +
                "<b>Developers</b>\r\n" +
                "  Armando Basile <i>([email protected])</i>\r\n" +
                "  Giuseppe Coviello <i>([email protected])</i>\r\n\r\n" +
                "<b>Special thanks to</b>\r\n" +
                "  Moitah <i>([email protected])</i>\r\n" +
                "  Insomniac <i>([email protected])</i>\r\n" +
                "  Rigel.va\r\n" +
                "  Mubumba <i>([email protected])</i>\r\n\r\n" +
                "<b>Bugs report</b>\r\n" +
                "  https://github.com/armando-basile/themonospot/issues\r\n";

            vp.Add(lblContent);

            tabInfo.AppendPage(sw, new Label(GlobalData.GetLanguageKeyValue("ABOUTTABINFO")));

            string components = "<b>base component: </b>" + GlobalData.BaseRelease + "\r\n";
            for (int j=0; j<GlobalData.BasePlugins.Count; j++)
            {
                components += "<b>" + GlobalData.BasePlugins[j].FileName + ": </b>" +
                    GlobalData.BasePlugins[j].Release + "\r\n";
            }

            sw = new ScrolledWindow();
            vp = new Viewport();
            sw.Add(vp);
            lblContent = new Label();
            lblContent.SetPadding(4,4);
            lblContent.SetAlignment((float)0, (float)0);
            lblContent.Markup = components;
            vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));

            vp.Add(lblContent);

            tabInfo.AppendPage(sw, new Label(GlobalData.GetLanguageKeyValue("ABOUTTABCOMPONENTS")));

            tabInfo.ShowAll();

            imgLogo.Pixbuf = Gdk.Pixbuf.LoadFromResource("themonospot.png");
            vpLogo.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));

            lblTitle.Markup = "<b>Themonospot [Gtk]</b>\r\n" +
                GlobalData.GuiRelease;
            lblTitle.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));

            Gdk.Geometry geo = new Gdk.Geometry();
            geo.MinHeight = 380;
            geo.MinWidth = 500;
            AboutDialog.SetGeometryHints(tabInfo, geo, Gdk.WindowHints.MinSize);

            // wait for gui processes
            while (Gtk.Application.EventsPending ())
                Gtk.Application.RunIteration ();
        }
Esempio n. 30
0
        public RevisionView()
            : base(false, 0)
        {
            Count = 0;
            Selected = 0;

            TreeView treeview = new TreeView ();
            SelectedTextColor  = GdkColorToHex (treeview.Style.Foreground (StateType.Selected));

            Window window = new Window ("");
            SecondaryTextColor = GdkColorToHex (window.Style.Foreground (StateType.Insensitive));

            ToggleButton = new ToggleButton ();
            ToggleButton.Clicked += ToggleView;
            ToggleButton.Relief = ReliefStyle.None;

            ScrolledWindow = new ScrolledWindow ();

            Viewport = new Viewport ();
            Viewport.Add (new Label (""));

            Store = new ListStore (typeof (Gdk.Pixbuf),
                                   typeof (string),
                                   typeof (int));

            IconView = new IconView (Store);
            IconView.SelectionChanged += ChangeSelection;
            IconView.MarkupColumn = 1;
            IconView.Margin       = 12;
            IconView.Orientation  = Orientation.Horizontal;
            IconView.PixbufColumn = 0;
            IconView.Spacing      = 12;

            Image = new Image ();

            ScrolledWindow.Add (Viewport);
            PackStart (ScrolledWindow, true, true, 0);
        }
        private void BuildWindow()
        {
            BorderWidth = 6;
            VBox.Spacing = 12;
            HasSeparator = false;

            HBox box = new HBox();
            box.BorderWidth = 6;
            box.Spacing = 12;

            Button save_button = new Button("gtk-save");
            save_button.CanDefault = true;
            save_button.Show();

            // For later additions to the dialog.  (I.E. Feed art)
            HBox content_box = new HBox();
            content_box.Spacing = 12;

            Table table = new Table (2, 4, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 12;

            Label description_label = new Label (Catalog.GetString ("Description:"));
            description_label.SetAlignment (0f, 0f);
            description_label.Justify = Justification.Left;

            Label last_updated_label = new Label (Catalog.GetString ("Last updated:"));
            last_updated_label.SetAlignment (0f, 0f);
            last_updated_label.Justify = Justification.Left;

            Label name_label = new Label (Catalog.GetString ("Podcast Name:"));
            name_label.SetAlignment (0f, 0f);
            name_label.Justify = Justification.Left;

            name_entry = new Entry ();
            name_entry.Text = feed.Title;
            name_entry.Changed += delegate {
                save_button.Sensitive = !String.IsNullOrEmpty (name_entry.Text);
            };

            Label feed_url_label = new Label (Catalog.GetString ("URL:"));
            feed_url_label.SetAlignment (0f, 0f);
            feed_url_label.Justify = Justification.Left;

            Label new_episode_option_label = new Label (Catalog.GetString ("When feed is updated:"));
            new_episode_option_label.SetAlignment (0f, 0.5f);
            new_episode_option_label.Justify = Justification.Left;

            Label last_updated_text = new Label (feed.LastDownloadTime.ToString ("f"));
            last_updated_text.Justify = Justification.Left;
            last_updated_text.SetAlignment (0f, 0f);

            Label feed_url_text = new Label (feed.Url.ToString ());
            feed_url_text.Wrap = false;
            feed_url_text.Selectable = true;
            feed_url_text.SetAlignment (0f, 0f);
            feed_url_text.Justify = Justification.Left;
            feed_url_text.Ellipsize = Pango.EllipsizeMode.End;

            string description_string = String.IsNullOrEmpty (feed.Description) ?
                                        Catalog.GetString ("No description available") :
                                        feed.Description;

            Label descrition_text = new Label (description_string);
            descrition_text.Justify = Justification.Left;
            descrition_text.SetAlignment (0f, 0f);
            descrition_text.Wrap = true;
            descrition_text.Selectable = true;

            Viewport description_viewport = new Viewport();
            description_viewport.SetSizeRequest(-1, 150);
            description_viewport.ShadowType = ShadowType.None;

            ScrolledWindow description_scroller = new ScrolledWindow ();
            description_scroller.HscrollbarPolicy = PolicyType.Never;
            description_scroller.VscrollbarPolicy = PolicyType.Automatic;

            description_viewport.Add (descrition_text);
            description_scroller.Add (description_viewport);

            new_episode_option_combo = new SyncPreferenceComboBox (feed.AutoDownload);

            // First column
            uint i = 0;
            table.Attach (
                name_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                feed_url_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                last_updated_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                new_episode_option_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                description_label, 0, 1, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            // Second column
            i = 0;
            table.Attach (
                name_entry, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                feed_url_text, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                last_updated_text, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (
                new_episode_option_combo, 1, 2, i, ++i,
                AttachOptions.Fill, AttachOptions.Fill, 0, 0
            );

            table.Attach (description_scroller, 1, 2, i, ++i,
                          AttachOptions.Expand | AttachOptions.Fill,
                          AttachOptions.Expand | AttachOptions.Fill, 0, 0
                         );

            content_box.PackStart (table, true, true, 0);
            box.PackStart (content_box, true, true, 0);

            Button cancel_button = new Button("gtk-cancel");
            cancel_button.CanDefault = true;
            cancel_button.Show();

            AddActionWidget (cancel_button, ResponseType.Cancel);
            AddActionWidget (save_button, ResponseType.Ok);

            DefaultResponse = Gtk.ResponseType.Cancel;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            box.ShowAll ();
            VBox.Add (box);

            Response += OnResponse;
        }
Esempio n. 32
0
    void Show3D(Tables.Denso.Table3D table)
    {
        if (table == null)
            return;

        navbarwidget.CurrentPos = table.Location;

        navbarwidget.SetMarkedPositions (new int[] { table.RangeX.Pos, table.RangeY.Pos, table.RangeZ.Pos });

        var valuesZ = table.GetValuesZasFloats ();
        var tableUI = new GtkWidgets.TableWidget3D (coloring, table.ValuesX, table.ValuesY, valuesZ,
                          table.Xmin, table.Xmax, table.Ymin, table.Ymax, table.Zmin, table.Zmax);
        tableUI.TitleMarkup = Util.Markup.NameUnit_Large (table.Title, table.UnitZ);
        tableUI.AxisXMarkup = Util.Markup.NameUnit (table.NameX, table.UnitX);
        tableUI.AxisYMarkup = Util.Markup.NameUnit (table.NameY, table.UnitY);
        tableUI.FormatValues = ScoobyRom.Data.AutomaticValueFormat (valuesZ, table.Zmin, table.Zmax);

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport ();
        viewPort.Add (tableUI.Create ());

        Gtk.Widget previous = this.scrolledwindowTable3D.Child;
        if (previous != null)
            this.scrolledwindowTable3D.Remove (previous);
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add (viewPort);
        this.scrolledwindowTable3D.ShowAll ();
    }
Esempio n. 33
0
 /// <summary>
 /// Add tab to notebook object
 /// </summary>
 private void AddLabelTab(ref Gtk.Label lblObj, string title)
 {
     // Create and add tab for Thanks info
     ScrolledWindow sw = new ScrolledWindow();
     Viewport vp = new Viewport();
     sw.AddWithViewport(vp);
     lblObj = new Label();
     lblObj.SetPadding(4,4);
     lblObj.SetAlignment((float)0, (float)0);
     vp.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
     vp.Add(lblObj);
     tabInfo.AppendPage(sw, new Gtk.Label(title));
 }
Esempio n. 34
0
        public void Initialize(DockFrame workspace, Menu padMenu)
        {
            // Create canvas
            Table mainTable = new Table (2, 2, false);

            sw = new ScrolledWindow () {
                Name = "sw",
                ShadowType = ShadowType.EtchedOut
            };

            Viewport vp = new Viewport () {
                ShadowType = ShadowType.None
            };

            canvas = new PintaCanvas () {
                Name = "canvas",
                CanDefault = true,
                CanFocus = true,
                Events = (Gdk.EventMask)16134
            };

            // Canvas pad
            DockItem documentDockItem = workspace.AddItem ("Canvas");
            documentDockItem.Behavior = DockItemBehavior.Locked;
            documentDockItem.Expand = true;

            documentDockItem.DrawFrame = false;
            documentDockItem.Label = Catalog.GetString ("Canvas");
            documentDockItem.Content = mainTable;
            documentDockItem.Icon = PintaCore.Resources.GetIcon ("Menu.Effects.Artistic.OilPainting.png");

            //rulers
            hruler = new HRuler ();
            hruler.Metric = MetricType.Pixels;
            mainTable.Attach (hruler, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            vruler = new VRuler ();
            vruler.Metric = MetricType.Pixels;
            mainTable.Attach (vruler, 0, 1, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            sw.Hadjustment.ValueChanged += delegate {
                UpdateRulerRange ();
            };

            sw.Vadjustment.ValueChanged += delegate {
                UpdateRulerRange ();
            };

            PintaCore.Workspace.CanvasSizeChanged += delegate {
                UpdateRulerRange ();
            };

            canvas.MotionNotifyEvent += delegate (object o, MotionNotifyEventArgs args) {
                if (!PintaCore.Workspace.HasOpenDocuments)
                    return;

                Cairo.PointD point = PintaCore.Workspace.WindowPointToCanvas (args.Event.X, args.Event.Y);

                hruler.Position = point.X;
                vruler.Position = point.Y;

            };

            mainTable.Attach (sw, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            sw.Add (vp);
            vp.Add (canvas);

            mainTable.ShowAll ();
            canvas.Show ();
            vp.Show ();

            hruler.Visible = false;
            vruler.Visible = false;

            PintaCore.Chrome.InitializeCanvas (canvas);

            canvas.SizeAllocated += delegate { UpdateRulerRange (); };

            PintaCore.Actions.View.Rulers.Toggled += HandleRulersToggled;
            PintaCore.Actions.View.Pixels.Activated += (o, e) => { SetRulersUnit (MetricType.Pixels); };
            PintaCore.Actions.View.Inches.Activated += (o, e) => { SetRulersUnit (MetricType.Inches); };
            PintaCore.Actions.View.Centimeters.Activated += (o, e) => { SetRulersUnit (MetricType.Centimeters); };
        }