示例#1
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 (); };
        }
        // "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 ();
        }
示例#3
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;
        }
示例#4
0
文件: Lyrics.cs 项目: gsterjov/fusemc
        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;
        }
示例#5
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;
    }
示例#6
0
        public UITabPage
            (GameConfigDB gameConfigDB
            , Gtk.ScrolledWindow scrolledWindow
            , Gtk.Viewport viewport
            , Gtk.Label label
            , Gtk.Fixed canvas)
        {
            _scrolledWindow      = scrolledWindow;
            _viewport            = viewport;
            _label               = label;
            _canvas              = canvas;
            _canvas.ScrollEvent += OnScrollEvent;
            _scrolledWindow.ButtonPressEvent += OnMainWindowButtonPressed;
            _label.Parent.ButtonPressEvent   += OnTabButtonPressed;

            _gameConfigDB = gameConfigDB;
            _uiSections   = new List <UISection>();

            Point currentSectionPoint = UISection.DEFAULT_ORIGIN_POINT;

            foreach (GameConfigSectionDescriptor sectionDescriptor in _gameConfigDB.GetSections())
            {
                UISection newSection = new UISection(this, sectionDescriptor, currentSectionPoint);
                currentSectionPoint = newSection.GetNextPosition();
                _uiSections.Add(newSection);
            }

            ResizeCanvas();
        }
示例#7
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 ());
                        }
        }
示例#8
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();
    }
示例#9
0
    public static void ChronopicColors(Gtk.Viewport v, Gtk.Label l1, Gtk.Label l2, bool connected)
    {
        //if(! v.Style.Background(StateType.Normal).Equal(BLUE))
        if (!v.Style.Background(StateType.Normal).Equal(v.Style.Background(StateType.Selected)))
        {
            chronopicViewportDefaultBg = v.Style.Background(StateType.Normal);
        }
        if (!l1.Style.Foreground(StateType.Normal).Equal(WHITE))
        {
            chronopicLabelsDefaultFg = l1.Style.Foreground(StateType.Normal);
        }

        if (connected)
        {
            v.ModifyBg(StateType.Normal, chronopicViewportDefaultBg);
            l1.ModifyFg(StateType.Normal, chronopicLabelsDefaultFg);
            l2.ModifyFg(StateType.Normal, chronopicLabelsDefaultFg);
        }
        else
        {
            //v.ModifyBg(StateType.Normal, BLUE);
            v.ModifyBg(StateType.Normal, v.Style.Background(StateType.Selected));
            l1.ModifyFg(StateType.Normal, WHITE);
            l2.ModifyFg(StateType.Normal, WHITE);
        }
    }
		/// <summary>Default constructor.</summary>
		/// <param name="UnderlyingGallery">The underlying gallery.</param>
		public GalleryPopupWindow (Gallery UnderlyingGallery) : base (WindowType.Popup)
		{
			this.underlyingGallery = UnderlyingGallery;
			this.tiles = new List<Tile> ();
			this.mapping = new Dictionary<Tile, Tile> ();
			foreach(Tile t in UnderlyingGallery.Tiles)
			{
				Tile copy = t.Copy ();
				tiles.Add (copy);
				
				if(t == UnderlyingGallery.SelectedTile)
				{
					copy.Selected = true;
					selectedTile = t;
				}
				
				mapping.Add (copy, t);
			}
			
			int width = UnderlyingGallery.Allocation.Width;
			
			columns = (uint)(width / underlyingGallery.TileWidth);
			rows = (uint)Math.Ceiling ((double)tiles.Count / columns);
			
			this.tileTable = new Table (rows, columns, true);
			this.tileTable.HeightRequest = (int)rows * UnderlyingGallery.TileHeight;
			this.tileTable.WidthRequest = (int)columns * UnderlyingGallery.TileWidth;
			
			Viewport vp = new Viewport ();
			vp.Child = tileTable;
			
			this.internalWindow = new ScrolledWindow ();
			this.internalWindow.Child = vp;
			this.internalWindow.HeightRequest = Math.Min (this.tileTable.HeightRequest, MAX_HEIGHT) + SCROLLBAR_SIZE;
			this.internalWindow.WidthRequest = this.tileTable.WidthRequest + SCROLLBAR_SIZE;
			
			uint x = 0, y = 0;
			foreach(Tile t in tiles)
			{
				ExtraEventBox box = new ExtraEventBox ();
				box.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));
				box.Child = t;
				
				tileTable.Attach (box, x, x+1, y, y+1);
				t.Clicked += tile_Clicked;
				
				if(++x == columns)
				{
					x = 0;
					++y;
				}
			}
			
			this.Child = internalWindow;
		}
示例#11
0
    public static void ViewportColorDefault(Gtk.Viewport v)
    {
        //v.ModifyBg(StateType.Normal); //resets to the default color

        //create a new viewport and get the color
        Gtk.Viewport vTemp = new Gtk.Viewport();
        Gdk.Color    colorViewportDefault = vTemp.Style.Background(StateType.Normal);

        //assign the color to our requested viewport
        v.ModifyBg(StateType.Normal, colorViewportDefault);         //resets to the default color
    }
示例#12
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;
 }
        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 ();
        }
示例#14
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;
		}
示例#15
0
    //private methods -------------------------------

    private void assignPersonData()
    {
        Array box_elements = getButtonBoxElements(button);

        //access uniqueID
        Gtk.Label l = (Gtk.Label)box_elements.GetValue(1);          //the ID
        personID = Convert.ToInt32(l.Text);
        //LogB.Information("UniqueID: " + l.Text.ToString());

        //access name
        Gtk.Viewport v = (Gtk.Viewport)box_elements.GetValue(2); //the name
        l          = (Gtk.Label)v.Child;                         //the name
        personName = l.Text;
        //LogB.Information("Name: " + l.Text.ToString());
    }
示例#16
0
        public StatusView(string filepath, VersionControlSystem vc)
            : base(Path.GetFileName(filepath) + " Status")
        {
            this.vc = vc;
            this.filepath = filepath;

            main = new VBox(false, 5);
            widget = main;
            main.Show();

            commandbar = new HBox(false, 5);
            main.PackStart(commandbar, false, false, 5);

            showRemoteStatus = new Button("Show Remote Status");
            commandbar.PackEnd(showRemoteStatus, false, false, 0);
            showRemoteStatus.Clicked += new EventHandler(OnShowRemoteStatusClicked);

            buttonCommit = new Button("Commit...");
            commandbar.PackEnd(buttonCommit, false, false, 0);
            buttonCommit.Clicked += new EventHandler(OnCommitClicked);

            boxCommit = new VBox(false, 2);
            textCommitMessage = new TextView();
            HBox boxCommitButtons = new HBox(false, 2);
            buttonCommitCancel = new Button("Cancel");
            buttonCommitCommit = new Button("Commit");
            textCommitMessage.Show();
            buttonCommitCancel.Show();
            buttonCommitCommit.Show();
            boxCommit.PackStart(textCommitMessage, true, true, 0);
            boxCommit.PackStart(boxCommitButtons, false, false, 0);
            boxCommitButtons.PackEnd(buttonCommitCancel, false, false, 0);
            boxCommitButtons.PackEnd(buttonCommitCommit, false, false, 0);
            buttonCommitCancel.Clicked += new EventHandler(OnCommitCancelClicked);
            buttonCommitCommit.Clicked += new EventHandler(OnCommitCommitClicked);

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

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

            main.ShowAll();

            StartUpdate();
        }
示例#17
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();
    }
示例#18
0
    public static void DeviceColors(Gtk.Viewport v, bool connected)
    {
        if (!v.Style.Background(StateType.Normal).Equal(v.Style.Background(StateType.Selected)))
        {
            chronopicViewportDefaultBg = v.Style.Background(StateType.Normal);
        }

        if (connected)
        {
            //v.ModifyBg(StateType.Normal, chronopicViewportDefaultBg);
            v.ModifyBg(StateType.Normal, WHITE);
        }
        else
        {
            //v.ModifyBg(StateType.Normal, BLUE);
            v.ModifyBg(StateType.Normal, v.Style.Background(StateType.Selected));
        }
    }
        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 ();
        }
示例#20
0
    //public methods -------------------------------

    public void Select(bool select)
    {
        Array box_elements = getButtonBoxElements(button);

        //image
        Gtk.Image image = (Gtk.Image)box_elements.GetValue(0);          //the image

        Gtk.Viewport viewport = (Gtk.Viewport)box_elements.GetValue(2); //the name

        if (select)
        {
            UtilGtk.ViewportColor(viewport, UtilGtk.YELLOW);
        }
        else
        {
            UtilGtk.ViewportColorDefault(viewport);
        }

        Selected = select;
    }
示例#21
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;
        }
示例#22
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;
	}
示例#23
0
        private void Activated(object sender, EventArgs e)
        {
            // If no documents are open, activate the
            // PasteIntoNewImage action and abort this Paste action.
            if (!PintaCore.Workspace.HasOpenDocuments)
            {
                PintaCore.Actions.Edit.PasteIntoNewImage.Activate();
                return;
            }

            var doc = PintaCore.Workspace.ActiveDocument;

            // Get the scroll position in canvas co-ordinates
            Gtk.Viewport view      = (Gtk.Viewport)doc.Workspace.Canvas.Parent;
            Cairo.PointD canvasPos = doc.Workspace.WindowPointToCanvas(
                view.Hadjustment.Value,
                view.Vadjustment.Value);

            // Paste into the active document.
            // The 'false' argument indicates that paste should be
            // performed into the current (not a new) layer.
            doc.Paste(false, (int)canvasPos.X, (int)canvasPos.Y);
        }
示例#24
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 ();
		}
示例#25
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();
        }
示例#26
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();
        }
示例#27
0
        public static void Initialize(Toolbar toolToolBar,
		                               Label statusTextLabel,
		                               DrawingArea drawingArea,
		                               TreeView historyStack,
		                               Window mainWindow,
		                               IProgressDialog progressDialog,
		                               Viewport viewport)
        {
            Chrome = new ChromeManager ();
            Chrome.Initialize (toolToolBar,
                               statusTextLabel,
                               drawingArea,
                               historyStack,
                               mainWindow,
                               progressDialog);

            Palette = new PaletteManager ();

            Workspace.Initialize (viewport);

            Actions.RegisterHandlers ();
        }
		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;
		}
示例#29
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);
 }
示例#30
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";
        }
示例#31
0
        private void AddHTML()
        {
            Application.Invoke (delegate {
                Spinner.Stop ();
                LogContent.Remove (LogContent.Child);

                ScrolledWindow = new ScrolledWindow () {
                    HscrollbarPolicy = PolicyType.Never
                };

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

                WebView.Reparent (viewport);
                ScrolledWindow.Add (viewport);

                WebView.LoadString (HTML, null, null, "file://");

                LogContent.Add (ScrolledWindow);
                LogContent.ShowAll ();
            });
        }
        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;
        }
示例#33
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 ();
    }
示例#34
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);
        }
        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);
        }
示例#36
0
 public static void ViewportColor(Gtk.Viewport v, Gdk.Color color)
 {
     v.ModifyBg(StateType.Normal, color);
 }
示例#37
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); };
        }
示例#38
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;
			}
		}
示例#39
0
 public static void ColorsTestLabel(Gtk.Viewport v, Gtk.Label l)
 {
     l.ModifyFg(StateType.Active, v.Style.Foreground(StateType.Selected));
     l.ModifyFg(StateType.Prelight, v.Style.Foreground(StateType.Selected));
 }
        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 ();
        }
示例#41
0
 public static void ColorsTreeView(Gtk.Viewport v, Gtk.TreeView tv)
 {
     tv.ModifyBg(StateType.Active, v.Style.Background(StateType.Selected));
     tv.ModifyBg(StateType.Prelight, v.Style.Background(StateType.Selected));
 }
示例#42
0
 public static void ColorsCheckbox(Gtk.Viewport v, Gtk.CheckButton c)
 {
     c.ModifyBg(StateType.Active, v.Style.Background(StateType.Selected));
     c.ModifyBg(StateType.Prelight, v.Style.Background(StateType.Selected));
 }
示例#43
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 ();
    }
示例#44
0
 public static void ColorsRadio(Gtk.Viewport v, Gtk.RadioButton r)
 {
     r.ModifyBg(StateType.Active, v.Style.Background(StateType.Selected));
     r.ModifyBg(StateType.Prelight, v.Style.Background(StateType.Selected));
 }
示例#45
0
        static int RunApp(string[] args, int n)
        {
            Project = SteticApp.CreateProject();

            Project.WidgetAdded     += OnWidgetAdded;
            Project.WidgetRemoved   += OnWidgetRemoved;
            Project.ModifiedChanged += OnProjectModified;
            Project.ProjectReloaded += OnProjectReloaded;

            Palette      = SteticApp.PaletteWidget;
            widgetTree   = SteticApp.WidgetTreeWidget;
            Signals      = SteticApp.SignalsWidget;
            propertyTree = SteticApp.PropertiesWidget;
            ProjectView  = new WindowListWidget();

            UIManager = new Stetic.UIManager(Project);

            Glade.XML.CustomHandler = CustomWidgetHandler;
            Glade.XML glade = new Glade.XML("stetic.glade", "MainWindow");
            glade.Autoconnect(typeof(SteticMain));

            if (ProjectView.Parent is Gtk.Viewport &&
                ProjectView.Parent.Parent is Gtk.ScrolledWindow)
            {
                Gtk.Viewport       viewport = (Gtk.Viewport)ProjectView.Parent;
                Gtk.ScrolledWindow scrolled = (Gtk.ScrolledWindow)viewport.Parent;
                viewport.Remove(ProjectView);
                scrolled.Remove(viewport);
                scrolled.AddWithViewport(ProjectView);
            }

            foreach (Gtk.Widget w in glade.GetWidgetPrefix(""))
            {
                Gtk.Window win = w as Gtk.Window;
                if (win != null)
                {
                    win.AddAccelGroup(UIManager.AccelGroup);
                    win.ShowAll();
                }
            }
            MainWindow                      = (Gtk.Window)Palette.Toplevel;
            WidgetNotebook                  = (Gtk.Notebook)glade ["notebook"];
            WidgetNotebook.SwitchPage      += OnPageChanged;
            ProjectView.ComponentActivated += OnWidgetActivated;
            widgetTree.SelectionChanged    += OnSelectionChanged;

#if GTK_SHARP_2_6
            // This is needed for both our own About dialog and for ones
            // the user constructs
            Gtk.AboutDialog.SetUrlHook(ActivateUrl);
#endif

            if (n < args.Length)
            {
                LoadProject(args [n]);
            }

            ReadConfiguration();

            foreach (string s in Configuration.WidgetLibraries)
            {
                SteticApp.AddWidgetLibrary(s);
            }
            SteticApp.UpdateWidgetLibraries(false);

            ProjectView.Fill(Project);

            Program.Run();
            return(0);
        }
示例#46
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));
 }
        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;
        }