Exemple #1
0
        public void ZoomFit(bool upscale)
        {
            Gdk.Pixbuf         pixbuf   = this.Pixbuf;
            Gtk.ScrolledWindow scrolled = this.Parent as Gtk.ScrolledWindow;
            this.upscale = upscale;

            if (pixbuf == null)
            {
                return;
            }

            if (scrolled != null)
            {
                scrolled.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
            }

            int available_width  = (scrolled != null) ? scrolled.Allocation.Width : this.Allocation.Width;
            int available_height = (scrolled != null) ? scrolled.Allocation.Height : this.Allocation.Height;

            double zoom_to_fit = ZoomUtils.FitToScale((uint)available_width,
                                                      (uint)available_height,
                                                      (uint)pixbuf.Width,
                                                      (uint)pixbuf.Height,
                                                      upscale);

            double image_zoom = zoom_to_fit;

            this.SetZoom(image_zoom, image_zoom);

            if (scrolled != null)
            {
                scrolled.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
            }
        }
Exemple #2
0
        private void ZoomFit(bool upscale)
        {
            Gdk.Pixbuf         pixbuf   = this.Pixbuf;
            Gtk.ScrolledWindow scrolled = this.Parent as Gtk.ScrolledWindow;
            this.upscale = upscale;

            if (pixbuf == null)
            {
                return;
            }

            int available_width  = this.Allocation.Width;
            int available_height = this.Allocation.Height;

            double zoom_to_fit = ZoomUtils.FitToScale((uint)available_width,
                                                      (uint)available_height,
                                                      (uint)pixbuf.Width,
                                                      (uint)pixbuf.Height,
                                                      upscale);

            double image_zoom = zoom_to_fit;

            /*
             * System.Console.WriteLine ("Zoom = {0}, {1}, {2}", image_zoom,
             *                        available_width,
             *                        available_height);
             */

            if (scrolled != null)
            {
                scrolled.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Never);
            }

            this.SetZoom(image_zoom, image_zoom);

            if (scrolled != null)
            {
                scrolled.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
            }
        }
Exemple #3
0
        public BugzillaPreferences()
            : base(false, 12)
        {
            last_opened_dir = Environment.GetEnvironmentVariable("HOME");

            Gtk.Label l = new Gtk.Label(Catalog.GetString(
                                            "You can use any bugzilla just by dragging links " +
                                            "into notes.  If you want a special icon for " +
                                            "certain hosts, add them here."));
            l.Wrap   = true;
            l.Xalign = 0;

            PackStart(l, false, false, 0);

            icon_store = CreateIconStore();

            icon_tree = new Gtk.TreeView(icon_store);
            icon_tree.HeadersVisible     = true;
            icon_tree.Selection.Mode     = Gtk.SelectionMode.Single;
            icon_tree.Selection.Changed += SelectionChanged;

            Gtk.CellRenderer renderer;

            Gtk.TreeViewColumn host_col = new Gtk.TreeViewColumn();
            host_col.Title     = Catalog.GetString("Host Name");
            host_col.Sizing    = Gtk.TreeViewColumnSizing.Autosize;
            host_col.Resizable = true;
            host_col.Expand    = true;
            host_col.MinWidth  = 200;

            renderer = new Gtk.CellRendererText();
            host_col.PackStart(renderer, true);
            host_col.AddAttribute(renderer, "text", 1 /* host name */);
            host_col.SortColumnId  = 1;            /* host name */
            host_col.SortIndicator = false;
            host_col.Reorderable   = false;
            host_col.SortOrder     = Gtk.SortType.Ascending;

            icon_tree.AppendColumn(host_col);

            Gtk.TreeViewColumn icon_col = new Gtk.TreeViewColumn();
            icon_col.Title     = Catalog.GetString("Icon");
            icon_col.Sizing    = Gtk.TreeViewColumnSizing.Fixed;
            icon_col.MaxWidth  = 50;
            icon_col.MinWidth  = 50;
            icon_col.Resizable = false;

            renderer = new Gtk.CellRendererPixbuf();
            icon_col.PackStart(renderer, false);
            icon_col.AddAttribute(renderer, "pixbuf", 0 /* icon */);

            icon_tree.AppendColumn(icon_col);

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
            sw.ShadowType    = Gtk.ShadowType.In;
            sw.HeightRequest = 200;
            sw.WidthRequest  = 300;
            sw.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
            sw.Add(icon_tree);

            PackStart(sw, true, true, 0);

            add_button          = new Gtk.Button(Gtk.Stock.Add);
            add_button.Clicked += AddClicked;

            remove_button           = new Gtk.Button(Gtk.Stock.Remove);
            remove_button.Sensitive = false;
            remove_button.Clicked  += RemoveClicked;

            Gtk.HButtonBox hbutton_box = new Gtk.HButtonBox();
            hbutton_box.Layout  = Gtk.ButtonBoxStyle.Start;
            hbutton_box.Spacing = 6;

            hbutton_box.PackStart(add_button);
            hbutton_box.PackStart(remove_button);
            PackStart(hbutton_box, false, false, 0);

            ShowAll();
        }
Exemple #4
0
		private void AddTableToNotebook(Gtk.Table table)
		{
			Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow();
			frame.ShadowType = Gtk.ShadowType.None;
			frame.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
			frame.AddWithViewport(table);
			table.RowSpacing = 1;
			table.ColumnSpacing = 0;
		
			_notebook.AppendPage(frame, new Gtk.Label(string.Empty));
		}
        public DocumentationDialog(Documentation _doc)
        {
            ContentArea.PackStart(VBox, true, true, 0);

            documentation = _doc;

            Gtk.Label nameLabel = new Gtk.Label("<b>" + documentation.Name + "</b>");
            nameLabel.Wrap         = true;
            nameLabel.UseUnderline = false;
            nameLabel.UseMarkup    = true;
            nameLabel.Xalign       = 0.5f;
            VBox.PackStart(nameLabel, false, false, 10);

            string desc = documentation.Description;

            if (desc == null)
            {
                desc = "";
            }

            var subidEntries = documentation.Keys;

            Gtk.Label descLabel = new Gtk.Label(desc);
            descLabel.Wrap          = true;
            descLabel.UseUnderline  = false;
            descLabel.Xalign        = 0;
            descLabel.WidthChars    = 50;
            descLabel.MaxWidthChars = 50;
            VBox.PackStart(descLabel, false, false, 0);


            // Create SubID table
            if (subidEntries.Count > 0)
            {
                Gtk.Label valuesLabel = new Gtk.Label("\nValues:");
                valuesLabel.UseUnderline = false;
                valuesLabel.Xalign       = 0;
                VBox.PackStart(valuesLabel, false, false, 0);

                Gtk.Table subidTable = new Gtk.Table(2, (uint)subidEntries.Count * 2, false);

                uint subidX = 0;
                uint subidY = 0;

                foreach (string key in subidEntries)
                {
                    string value = documentation.GetField(key);

                    Gtk.Label l1 = new Gtk.Label(key);
                    l1.UseUnderline = false;
                    l1.Xalign       = 0;
                    l1.Yalign       = 0;

                    Gtk.Label l2 = new Gtk.Label(value);
                    l2.UseUnderline  = false;
                    l2.Wrap          = true;
                    l2.Xalign        = 0;
                    l2.Yalign        = 0;
                    l2.WidthChars    = 50;
                    l2.MaxWidthChars = 50;

                    subidTable.Attach(l1, subidX + 0, subidX + 1, subidY, subidY + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 4, 0);
                    subidTable.Attach(l2, subidX + 2, subidX + 3, subidY, subidY + 1);

                    subidY++;
                    subidTable.Attach(new Gtk.HSeparator(), subidX + 0, subidX + 3, subidY, subidY + 1, Gtk.AttachOptions.Fill, 0, 0, 0);
                    subidY++;
                }
                subidTable.Attach(new Gtk.VSeparator(), subidX + 1, subidX + 2, 0, subidTable.NRows, 0, Gtk.AttachOptions.Fill, 4, 0);

                Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow();
                scrolledWindow.AddWithViewport(subidTable);
                scrolledWindow.ShadowType = Gtk.ShadowType.EtchedIn;
                scrolledWindow.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Automatic);
                subidTable.ShowAll();

                // Determine width/height to request on scrolledWindow
                Gtk.Requisition subidTableRequest = subidTable.SizeRequest();
                int             width             = Math.Min(subidTableRequest.Width + 20, 700);
                width = Math.Max(width, 400);
                int height = Math.Min(subidTableRequest.Height + 5, 400);
                height = Math.Max(height, 200);
                scrolledWindow.SetSizeRequest(width, height);

                VBox.PackStart(scrolledWindow, true, true, 0);
            }

            AddActionWidget(new Gtk.Button("gtk-ok"), 0);

            ShowAll();
        }
        public BlogPreferences()
            : base(false, 12)
        {
            this.doc = Utils.OpenXmlfile();
            Gtk.Label l = new Gtk.Label (Catalog.GetString (
                "If your blog supports the Atom Publishing Protocol " +
                "(APP), you can add it here, and you'll then be able " +
                "to post notes directly from Tomboy to your blog. " +
                "You need the URL to either your service document, " +
                "or your collection document."));
            l.Wrap = true;
            l.Xalign = 0;

            PackStart (l, false, false, 0);

            blog_store = CreateBlogStore ();

            blog_tree = new Gtk.TreeView (blog_store);
            blog_tree.HeadersVisible = true;
            blog_tree.Selection.Mode = Gtk.SelectionMode.Single;
            blog_tree.Selection.Changed += SelectionChanged;
            Gtk.CellRenderer renderer;

            Gtk.TreeViewColumn label_col = new Gtk.TreeViewColumn ();
            label_col.Title = Catalog.GetString ("Label");
            label_col.Sizing = Gtk.TreeViewColumnSizing.Autosize;
            label_col.Resizable = true;
            label_col.Expand = true;

            renderer = new Gtk.CellRendererText ();
            label_col.PackStart (renderer, true);
            label_col.AddAttribute (renderer, "text", 0 /* label */);
            label_col.SortColumnId = 1; /* label */
            label_col.SortIndicator = false;
            label_col.Reorderable = false;
            label_col.SortOrder = Gtk.SortType.Ascending;

            blog_tree.AppendColumn (label_col);
            Gtk.TreeViewColumn url_col = new Gtk.TreeViewColumn ();
            url_col.Title = Catalog.GetString ("Location");
            url_col.Sizing = Gtk.TreeViewColumnSizing.Fixed;
            url_col.Resizable = true;

            renderer = new Gtk.CellRendererText ();
            url_col.PackStart (renderer, false);
            url_col.AddAttribute (renderer, "text", 1 /* url */);

            blog_tree.AppendColumn (url_col);

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
            sw.ShadowType = Gtk.ShadowType.In;
            sw.HeightRequest = 200;
            sw.WidthRequest = 300;
            sw.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
            sw.Add (blog_tree);

            PackStart (sw, true, true, 0);

            add_button = new Gtk.Button (Gtk.Stock.Add);
            add_button.Clicked += AddClicked;

            remove_button = new Gtk.Button (Gtk.Stock.Remove);
            remove_button.Sensitive = false;
            remove_button.Clicked += RemoveClicked;

            edit_button = new Gtk.Button (Gtk.Stock.Edit);
            edit_button.Sensitive = false;
            edit_button.Clicked += EditClicked;

            Gtk.HButtonBox hbutton_box = new Gtk.HButtonBox ();
            hbutton_box.Layout = Gtk.ButtonBoxStyle.Start;
            hbutton_box.Spacing = 6;

            hbutton_box.PackStart (add_button);
            hbutton_box.PackStart (remove_button);
            hbutton_box.PackStart (edit_button);
            PackStart (hbutton_box, false, false, 0);
            XmlText draft_state;
            draft_state = (XmlText) this.doc.SelectSingleNode ("preferences/settings/draft/text()");
            if (draft_state == null)
            {
                XmlNode node = this.doc.DocumentElement;
                Console.Write ("aa");
                if (node.SelectNodes("settings").Count == 0)
                {
                    XmlElement childelement = this.doc.CreateElement ("settings");
                    node.AppendChild (childelement);
                }
                node = node.SelectSingleNode ("settings");
                if (node.SelectNodes("draft").Count == 0)
                {
                    XmlElement child_element = this.doc.CreateElement ("draft");
                    node.AppendChild (child_element);
                }
                XmlText text = this.doc.CreateTextNode ("yes");
                node.SelectSingleNode ("draft").AppendChild (text);
                draft_state = (XmlText) this.doc.SelectSingleNode ("preferences/settings/draft/text()");
            }
            bool draftbool = (draft_state.Value == "yes" ? true : false);

            Gtk.CheckButton button = new Gtk.CheckButton ("Create posts as drafts");
            button.Active = draftbool;
            button.Clicked += DraftChanged;

            PackStart (button, false, false, 0);

            ShowAll ();
        }
		public BugzillaPreferences ()
: base (false, 12)
		{
			last_opened_dir = Environment.GetEnvironmentVariable ("HOME");

			Gtk.Label l = new Gtk.Label (Catalog.GetString (
			                                     "You can use any bugzilla just by dragging links " +
			                                     "into notes.  If you want a special icon for " +
			                                     "certain hosts, add them here."));
			l.Wrap = true;
			l.Xalign = 0;

			PackStart (l, false, false, 0);

			icon_store = CreateIconStore ();

			icon_tree = new Gtk.TreeView (icon_store);
			icon_tree.HeadersVisible = true;
			icon_tree.Selection.Mode = Gtk.SelectionMode.Single;
			icon_tree.Selection.Changed += SelectionChanged;

			Gtk.CellRenderer renderer;

			Gtk.TreeViewColumn host_col = new Gtk.TreeViewColumn ();
			host_col.Title = Catalog.GetString ("Host Name");
			host_col.Sizing = Gtk.TreeViewColumnSizing.Autosize;
			host_col.Resizable = true;
			host_col.Expand = true;
			host_col.MinWidth = 200;

			renderer = new Gtk.CellRendererText ();
			host_col.PackStart (renderer, true);
			host_col.AddAttribute (renderer, "text", 1 /* host name */);
			host_col.SortColumnId = 1; /* host name */
			host_col.SortIndicator = false;
			host_col.Reorderable = false;
			host_col.SortOrder = Gtk.SortType.Ascending;

			icon_tree.AppendColumn (host_col);

			Gtk.TreeViewColumn icon_col = new Gtk.TreeViewColumn ();
			icon_col.Title = Catalog.GetString ("Icon");
			icon_col.Sizing = Gtk.TreeViewColumnSizing.Fixed;
			icon_col.MaxWidth = 50;
			icon_col.MinWidth = 50;
			icon_col.Resizable = false;

			renderer = new Gtk.CellRendererPixbuf ();
			icon_col.PackStart (renderer, false);
			icon_col.AddAttribute (renderer, "pixbuf", 0 /* icon */);

			icon_tree.AppendColumn (icon_col);

			Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
			sw.ShadowType = Gtk.ShadowType.In;
			sw.HeightRequest = 200;
			sw.WidthRequest = 300;
			sw.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
			sw.Add (icon_tree);

			PackStart (sw, true, true, 0);

			add_button = new Gtk.Button (Gtk.Stock.Add);
			add_button.Clicked += AddClicked;

			remove_button = new Gtk.Button (Gtk.Stock.Remove);
			remove_button.Sensitive = false;
			remove_button.Clicked += RemoveClicked;

			Gtk.HButtonBox hbutton_box = new Gtk.HButtonBox ();
			hbutton_box.Layout = Gtk.ButtonBoxStyle.Start;
			hbutton_box.Spacing = 6;

			hbutton_box.PackStart (add_button);
			hbutton_box.PackStart (remove_button);
			PackStart (hbutton_box, false, false, 0);

			ShowAll ();
		}