Exemplo n.º 1
0
        private void SetupWidgets()
        {
            histogram_expander = new Expander (Catalog.GetString ("Histogram"));
            histogram_expander.Activated += delegate (object sender, EventArgs e) {
                ContextSwitchStrategy.SetHistogramVisible (Context, histogram_expander.Expanded);
                UpdateHistogram ();
            };
            histogram_expander.StyleSet += delegate (object sender, StyleSetArgs args) {
                Gdk.Color c = this.Toplevel.Style.Backgrounds [(int)Gtk.StateType.Active];
                histogram.RedColorHint = (byte) (c.Red / 0xff);
                histogram.GreenColorHint = (byte) (c.Green / 0xff);
                histogram.BlueColorHint = (byte) (c.Blue / 0xff);
                histogram.BackgroundColorHint = 0xff;
                UpdateHistogram ();
            };
            histogram_image = new Gtk.Image ();
            histogram = new Histogram ();
            histogram_expander.Add (histogram_image);

            Add (histogram_expander);

            info_expander = new Expander (Catalog.GetString ("Image Information"));
            info_expander.Activated += delegate (object sender, EventArgs e) {
                ContextSwitchStrategy.SetInfoBoxVisible (Context, info_expander.Expanded);
            };

            Table info_table = new Table (10, 2, false);
            info_table.BorderWidth = 0;

            string name_pre = "<b>";
            string name_post = "</b>";

            name_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Name") + name_post);
            info_table.Attach (name_label, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            version_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Version") + name_post);
            info_table.Attach (version_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            date_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Date") + name_post + Environment.NewLine);
            info_table.Attach (date_label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            size_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Size") + name_post);
            info_table.Attach (size_label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            default_exposure_string = name_pre + Catalog.GetString ("Exposure") + name_post;
            exposure_label = CreateRightAlignedLabel (default_exposure_string);
            info_table.Attach (exposure_label, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            focal_length_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Focal Length") + name_post);
            info_table.Attach (focal_length_label, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            camera_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Camera") + name_post);
            info_table.Attach (camera_label, 0, 1, 6, 7, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            file_size_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("File Size") + name_post);
            info_table.Attach (file_size_label, 0, 1, 7, 8, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            rating_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Rating") + name_post);
            info_table.Attach (rating_label, 0, 1, 8, 9, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
            rating_label.Visible = false;

            name_value_label = new Label ();
            name_value_label.Ellipsize = Pango.EllipsizeMode.Middle;
            name_value_label.Justify = Gtk.Justification.Left;
            name_value_label.Selectable = true;
            name_value_label.Xalign = 0;
            name_value_label.PopulatePopup += HandlePopulatePopup;

            info_table.Attach (name_value_label, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 3, 0);

            date_value_label = AttachLabel (info_table, 2, name_value_label);
            size_value_label = AttachLabel (info_table, 3, name_value_label);
            exposure_value_label = AttachLabel (info_table, 4, name_value_label);

            version_list = new ListStore (typeof (uint), typeof (string), typeof (bool));
            version_combo = new ComboBox ();
            CellRendererText version_name_cell = new CellRendererText ();
            version_name_cell.Ellipsize = Pango.EllipsizeMode.End;
            version_combo.PackStart (version_name_cell, true);
            version_combo.SetCellDataFunc (version_name_cell, new CellLayoutDataFunc (VersionNameCellFunc));
            version_combo.Model = version_list;
            version_combo.Changed += OnVersionComboChanged;
            info_table.Attach (version_combo, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            date_value_label.Text = Environment.NewLine;
            exposure_value_label.Text = Environment.NewLine;
            focal_length_value_label = AttachLabel (info_table, 5, name_value_label);
            camera_value_label = AttachLabel (info_table, 6, name_value_label);
            file_size_value_label = AttachLabel (info_table, 7, name_value_label);

            Gtk.Alignment rating_align = new Gtk.Alignment( 0, 0, 0, 0);
            info_table.Attach (rating_align, 1, 2, 8, 9, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            rating_view = new RatingSmall ();
            rating_view.Visible = false;
            rating_view.Changed += HandleRatingChanged;
            rating_align.Add (rating_view);

            tag_view = new TagView (MainWindow.ToolTips);
            info_table.Attach (tag_view, 0, 2, 9, 10, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            info_table.ShowAll ();

            EventBox eb = new EventBox ();
            eb.Add (info_table);
            info_expander.Add (eb);
            eb.ButtonPressEvent += HandleButtonPressEvent;

            Add (info_expander);
            rating_label.Visible = show_rating;
            rating_view.Visible = show_rating;
        }
Exemplo n.º 2
0
        private void SetupWidgets()
        {
            histogram_expander            = new Expander(Catalog.GetString("Histogram"));
            histogram_expander.Activated += delegate(object sender, EventArgs e) {
                ContextSwitchStrategy.SetHistogramVisible(Context, histogram_expander.Expanded);
                UpdateHistogram();
            };
            histogram_image = new Gtk.Image();
            histogram       = new Histogram();
            histogram_expander.Add(histogram_image);

            Window window = MainWindow.Toplevel.Window;

            Gdk.Color c = window.Style.Backgrounds [(int)Gtk.StateType.Active];
            histogram.RedColorHint        = (byte)(c.Red / 0xff);
            histogram.GreenColorHint      = (byte)(c.Green / 0xff);
            histogram.BlueColorHint       = (byte)(c.Blue / 0xff);
            histogram.BackgroundColorHint = 0xff;

            Add(histogram_expander);

            info_expander            = new Expander(Catalog.GetString("Image Information"));
            info_expander.Activated += delegate(object sender, EventArgs e) {
                ContextSwitchStrategy.SetInfoBoxVisible(Context, info_expander.Expanded);
            };

            Table info_table = new Table(7, 2, false);

            info_table.BorderWidth = 0;

            string name_pre  = "<b>";
            string name_post = "</b>";

            name_label = CreateRightAlignedLabel(name_pre + Catalog.GetString("Name") + name_post);
            info_table.Attach(name_label, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            version_label = CreateRightAlignedLabel(name_pre + Catalog.GetString("Version") + name_post);
            info_table.Attach(version_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            date_label = CreateRightAlignedLabel(name_pre + Catalog.GetString("Date") + name_post + Environment.NewLine);
            info_table.Attach(date_label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            size_label = CreateRightAlignedLabel(name_pre + Catalog.GetString("Size") + name_post);
            info_table.Attach(size_label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            default_exposure_string = name_pre + Catalog.GetString("Exposure") + name_post;
            exposure_label          = CreateRightAlignedLabel(default_exposure_string);
            info_table.Attach(exposure_label, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            rating_label = CreateRightAlignedLabel(name_pre + Catalog.GetString("Rating") + name_post);
            info_table.Attach(rating_label, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
            rating_label.Visible = false;

            name_value_label            = new Label();
            name_value_label.Ellipsize  = Pango.EllipsizeMode.Middle;
            name_value_label.Justify    = Gtk.Justification.Left;
            name_value_label.Selectable = true;
            name_value_label.Xalign     = 0;
            info_table.Attach(name_value_label, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 3, 0);

            date_value_label     = AttachLabel(info_table, 2, name_value_label);
            size_value_label     = AttachLabel(info_table, 3, name_value_label);
            exposure_value_label = AttachLabel(info_table, 4, name_value_label);

            version_option_menu = new OptionMenu();
            info_table.Attach(version_option_menu, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            date_value_label.Text     = Environment.NewLine;
            exposure_value_label.Text = Environment.NewLine;

            Gtk.Alignment rating_align = new Gtk.Alignment(0, 0, 0, 0);
            info_table.Attach(rating_align, 1, 2, 5, 6, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

            rating_view          = new RatingSmall();
            rating_view.Visible  = false;
            rating_view.Changed += HandleRatingChanged;
            rating_align.Add(rating_view);

            tag_view = new TagView(MainWindow.ToolTips);
            info_table.Attach(tag_view, 0, 2, 6, 7, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
            tag_view.Show();

            info_table.ShowAll();

            info_expander.Add(info_table);
            Add(info_expander);
            rating_label.Visible = show_rating;
            rating_view.Visible  = show_rating;
        }
Exemplo n.º 3
0
		private void SetupWidgets ()
		{

			histogram_expander = new Expander (Catalog.GetString ("Histogram"));
			histogram_expander.Activated += delegate (object sender, EventArgs e) { 
				ContextSwitchStrategy.SetHistogramVisible (Context, histogram_expander.Expanded);
				UpdateHistogram ();
			};
			histogram_image = new Gtk.Image ();
			histogram = new Histogram ();
			histogram_expander.Add (histogram_image);

			Window window = MainWindow.Toplevel.Window;
			Gdk.Color c = window.Style.Backgrounds [(int)Gtk.StateType.Active];
			histogram.RedColorHint = (byte) (c.Red / 0xff);
			histogram.GreenColorHint = (byte) (c.Green / 0xff);
			histogram.BlueColorHint = (byte) (c.Blue / 0xff);
			histogram.BackgroundColorHint = 0xff;

			Add (histogram_expander);

			info_expander = new Expander (Catalog.GetString ("Image Information"));
			info_expander.Activated += delegate (object sender, EventArgs e) {
				ContextSwitchStrategy.SetInfoBoxVisible (Context, info_expander.Expanded);
			};

			Table info_table = new Table (7, 2, false);
			info_table.BorderWidth = 0;
	
			string name_pre = "<b>";
			string name_post = "</b>";

			name_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Name") + name_post);
			info_table.Attach (name_label, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

			version_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Version") + name_post); 
			info_table.Attach (version_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

			date_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Date") + name_post + Environment.NewLine);
			info_table.Attach (date_label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

			size_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Size") + name_post);
			info_table.Attach (size_label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);

			default_exposure_string = name_pre + Catalog.GetString ("Exposure") + name_post;
			exposure_label = CreateRightAlignedLabel (default_exposure_string);
			info_table.Attach (exposure_label, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
			
			rating_label = CreateRightAlignedLabel (name_pre + Catalog.GetString ("Rating") + name_post);
			info_table.Attach (rating_label, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
			rating_label.Visible = false;

			name_value_label = new Label ();
			name_value_label.Ellipsize = Pango.EllipsizeMode.Middle;
			name_value_label.Justify = Gtk.Justification.Left;
			name_value_label.Selectable = true;
			name_value_label.Xalign = 0;
			info_table.Attach (name_value_label, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 3, 0);
			
			date_value_label = AttachLabel (info_table, 2, name_value_label);
			size_value_label = AttachLabel (info_table, 3, name_value_label);
			exposure_value_label = AttachLabel (info_table, 4, name_value_label);
	
			version_option_menu = new OptionMenu ();
			info_table.Attach (version_option_menu, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
	
			date_value_label.Text = Environment.NewLine;
			exposure_value_label.Text = Environment.NewLine;

			Gtk.Alignment rating_align = new Gtk.Alignment( 0, 0, 0, 0);
			info_table.Attach (rating_align, 1, 2, 5, 6, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
			
			rating_view = new RatingSmall ();
			rating_view.Visible = false;
			rating_view.Changed += HandleRatingChanged;
			rating_align.Add (rating_view);

			tag_view = new TagView (MainWindow.ToolTips);
			info_table.Attach (tag_view, 0, 2, 6, 7, AttachOptions.Fill, AttachOptions.Fill, TABLE_XPADDING, TABLE_YPADDING);
			tag_view.Show ();

			info_table.ShowAll ();
	
			info_expander.Add (info_table);
			Add (info_expander);
			rating_label.Visible = show_rating;
			rating_view.Visible = show_rating;
		}