public MatrixThresholdFilterDialog(
            MatrixThresholdFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as MatrixThresholdFilter;
            if (module == null) {
                modifiedModule = new MatrixThresholdFilter();
                module = modifiedModule as MatrixThresholdFilter;
            }

            matrixPanel = new ThresholdMatrixPanel(
                (uint)module.Matrix.Height,
                (uint)module.Matrix.Width);
            matrixPanel.Matrix = module.Matrix.DefinitionMatrix;
            matrixPanel.Scaled = !module.Matrix.Incremental;

            table = new Table(2, 1, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };
            table.Attach(new Label("Threshold matrix:") { Xalign = 0.0f },
                0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink,
                0, 0);
            table.Attach(matrixPanel, 0, 1, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);
            table.ShowAll();
            VBox.PackStart(table);
        }
		public CredentialsDialog (string uri, SupportedCredentialTypes type, Credentials cred)
		{
			this.Build ();

			this.UseNativeContextMenus ();

			labelTop1.Text = string.Format (labelTop1.Text, uri);

			var table = new Table (0, 0, false);
			table.ColumnSpacing = 6;
			vbox.PackStart (table, true, true, 0);

			Widget firstEditor = null;
			switch (type) {
			case SupportedCredentialTypes.UsernamePassword:
				upcred = (UsernamePasswordCredentials)cred;
				firstEditor = CreateEntry (table, "Username:"******"Password:"******"Passphrase:", true);
				break;
			}
			table.ShowAll ();
			Focus = firstEditor;
			Default = buttonOk;
		}
Example #3
0
        public Tile ()
        {
            Table table = new Table (2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing = 2;
            table.BorderWidth = 2;

            PrimaryLabel = new Label ();
            SecondaryLabel = new Label ();

            table.Attach (image, 0, 1, 0, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            table.Attach (PrimaryLabel, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.Attach (SecondaryLabel, 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            table.ShowAll ();
            Add (table);

            PrimaryLabel.Xalign = 0.0f;
            PrimaryLabel.Yalign = 0.0f;

            SecondaryLabel.Xalign = 0.0f;
            SecondaryLabel.Yalign = 0.0f;

            StyleSet += delegate {
                PrimaryLabel.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
                SecondaryLabel.ModifyFg (StateType.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
                    Style.Foreground (StateType.Normal), Style.Background (StateType.Normal)));
            };

            Relief = ReliefStyle.None;
        }
        /// <summary>
        /// Creates a Gtk.Widget that's used to configure the service.  This
        /// will be used in the Synchronization Preferences.  Preferences should
        /// not automatically be saved by a GConf Property Editor.  Preferences
        /// should be saved when SaveConfiguration () is called.
        /// </summary>
        public override Gtk.Widget CreatePreferencesControl()
        {
            Gtk.Table table = new Gtk.Table(1, 2, false);
            table.RowSpacing    = 5;
            table.ColumnSpacing = 10;

            // Read settings out of gconf
            string syncPath;

            if (GetConfigSettings(out syncPath) == false)
            {
                syncPath = string.Empty;
            }

            Label l = new Label(Catalog.GetString("_Folder Path:"));

            l.Xalign = 1;
            table.Attach(l, 0, 1, 0, 1,
                         Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            pathButton = new FileChooserButton(Catalog.GetString("Select Synchronization Folder..."),
                                               FileChooserAction.SelectFolder);
            l.MnemonicWidget = pathButton;
            pathButton.SetFilename(syncPath);

            table.Attach(pathButton, 1, 2, 0, 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            table.ShowAll();
            return(table);
        }
        public VectorErrorFilterDialog(VectorErrorFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as VectorErrorFilter;
            if (module == null) {
                modifiedModule = new VectorErrorFilter();
                module = modifiedModule as VectorErrorFilter;
            }

            vectorPanel = new ErrorVectorPanel((uint)module.Matrix.Width);
            vectorPanel.BareMatrix = module.Matrix.DefinitionMatrix;
            vectorPanel.Divisor = module.Matrix.Divisor;
            vectorPanel.UseCustomDivisor = false;
            vectorPanel.SourceOffsetX = module.Matrix.SourceOffsetX;

            table = new Table(2, 1, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };
            table.Attach(new Label("Error vector:") { Xalign = 0.0f },
                0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            table.Attach(vectorPanel, 0, 1, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);
            table.ShowAll();
            VBox.PackStart(table);
        }
Example #6
0
        protected override void BuildUI()
        {
            base.BuildUI();

            string title = Strings.Sharpen;

            dialog = new Gtk.Dialog(title, (Gtk.Window) this, DialogFlags.DestroyWithParent, new object[0])
            {
                BorderWidth = 12
            };
            dialog.VBox.Spacing = 6;

            var table = new Gtk.Table(3, 2, false)
            {
                ColumnSpacing = 6,
                RowSpacing    = 6
            };

            table.Attach(SetFancyStyle(new Gtk.Label(Strings.AmountColon)), 0, 1, 0, 1);
            table.Attach(SetFancyStyle(new Gtk.Label(Strings.RadiusColon)), 0, 1, 1, 2);
            table.Attach(SetFancyStyle(new Gtk.Label(Strings.ThresholdColon)), 0, 1, 2, 3);

            SetFancyStyle(amount_spin    = new Gtk.SpinButton(0.00, 100.0, .01));
            SetFancyStyle(radius_spin    = new Gtk.SpinButton(1.0, 50.0, .01));
            SetFancyStyle(threshold_spin = new Gtk.SpinButton(0.0, 50.0, .01));
            amount_spin.Value            = .5;
            radius_spin.Value            = 5;
            threshold_spin.Value         = 0.0;

            amount_spin.ValueChanged    += HandleSettingsChanged;
            radius_spin.ValueChanged    += HandleSettingsChanged;
            threshold_spin.ValueChanged += HandleSettingsChanged;

            table.Attach(amount_spin, 1, 2, 0, 1);
            table.Attach(radius_spin, 1, 2, 1, 2);
            table.Attach(threshold_spin, 1, 2, 2, 3);

            var cancel_button = new Gtk.Button(Gtk.Stock.Cancel);

            cancel_button.Clicked += HandleCancelClicked;
            dialog.AddActionWidget(cancel_button, Gtk.ResponseType.Cancel);

            var ok_button = new Gtk.Button(Gtk.Stock.Ok);

            ok_button.Clicked += HandleOkClicked;
            dialog.AddActionWidget(ok_button, Gtk.ResponseType.Cancel);

            dialog.DeleteEvent += HandleCancelClicked;

            Destroyed += HandleLoupeDestroyed;

            table.ShowAll();
            dialog.VBox.PackStart(table);
            dialog.ShowAll();
        }
Example #7
0
        public Base()
        {
            table               = new Gtk.Table(1, 2, false);
            table.RowSpacing    = 12;
            table.ColumnSpacing = 12;

            header_icon = new Gtk.Image();
            table.Attach(header_icon, 0, 1, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 5);

            header_label = new Gtk.Label();
            header_label.SetAlignment(0.0f, 0.5f);
            table.Attach(header_label, 1, 2, 0, 1, Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, 0, 0, 5);

            table.ShowAll();

            Add(table);
        }
Example #8
0
		public Base ()
		{
			table = new Gtk.Table (1, 2, false);
			table.RowSpacing = 12;
			table.ColumnSpacing = 12;

			header_icon = new Gtk.Image ();
			table.Attach (header_icon, 0, 1, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 5);

			header_label = new Gtk.Label ();
			header_label.SetAlignment (0.0f, 0.5f);
			table.Attach (header_label, 1, 2, 0, 1, Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, 0, 0, 5);

			table.ShowAll ();			

			Add (table);
		}
Example #9
0
        /// <summary>
        /// Change the specified name and players.
        /// </summary>
        /// <param name='name'>
        /// Name.
        /// </param>
        /// <param name='players'>
        /// Players.
        /// </param>
        public void Change(string name, Scrabble.Player.Player[] players)
        {
            scoresTable.HideAll();
            for (int i = 0; i < game.players.Length; i++)
            {
                if (typeof(Player.ComputerPlayer) == game.players[i].GetType())
                {
                    scoreValues[i].Markup = game.players[i].Name + " <span size=\"smaller\">(CPU)</span>";
                }
                else
                {
                    scoreValues[i].Text = game.players[i].Name + "  ";
                }
                scoreValues[i + 6].Text = string.Format("{0}", game.players[i].Score);
            }

            scoresTable.ShowAll();
        }
        /// <summary>
        /// Creates a Gtk.Widget that's used to configure the service.  This
        /// will be used in the Synchronization Preferences.  Preferences should
        /// not automatically be saved by a GConf Property Editor.  Preferences
        /// should be saved when SaveConfiguration () is called.
        /// </summary>
        public override Gtk.Widget CreatePreferencesControl(EventHandler requiredPrefChanged)
        {
            Gtk.Table table = new Gtk.Table(3, 2, false);
            table.RowSpacing    = 5;
            table.ColumnSpacing = 10;

            // Read settings out of gconf
            string url, username, password;

            GetConfigSettings(out url, out username, out password);

            if (url == null)
            {
                url = string.Empty;
            }
            if (username == null)
            {
                username = string.Empty;
            }
            if (password == null)
            {
                password = string.Empty;
            }

            urlEntry          = new Entry();
            urlEntry.Text     = url;
            urlEntry.Changed += requiredPrefChanged;
            AddRow(table, urlEntry, Catalog.GetString("_URL:"), 0);

            usernameEntry          = new Entry();
            usernameEntry.Text     = username;
            usernameEntry.Changed += requiredPrefChanged;
            AddRow(table, usernameEntry, Catalog.GetString("User_name:"), 1);

            passwordEntry            = new Entry();
            passwordEntry.Text       = password;
            passwordEntry.Visibility = false;
            passwordEntry.Changed   += requiredPrefChanged;
            AddRow(table, passwordEntry, Catalog.GetString("_Password:"), 2);

            table.ShowAll();
            return(table);
        }
        public PerturbedErrorFilterDialog(
            PerturbedErrorFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as PerturbedErrorFilter;
            if (module == null) {
                modifiedModule = new PerturbedErrorFilter();
                module = modifiedModule as PerturbedErrorFilter;
            }

            childFilterSelector = new SubmoduleSelector<MatrixErrorFilter>(
                module.ChildFilter);
            childFilterSelector.ModuleChanged += delegate
            {
                module.ChildFilter = childFilterSelector.Module;
            };

            perturbationAmplitudeHScale = new HScale(0.0, 1.0, 0.01);
            perturbationAmplitudeHScale.Value =
                module.PerturbationAmplitude;
            perturbationAmplitudeHScale.ValueChanged += delegate
            {
                module.PerturbationAmplitude = perturbationAmplitudeHScale.Value;
            };

            table = new Table(2, 2, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };
            table.Attach(new Label("Child filter:") { Xalign = 0.0f},
                0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink,
                0, 0);
            table.Attach(childFilterSelector, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.Attach(new Label("Perturbation amplitude:")
                { Xalign = 0.0f }, 0, 1, 1, 2, AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);
            table.Attach(perturbationAmplitudeHScale, 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.ShowAll();
            VBox.PackStart(table);
        }
        public RandomizedMatrixErrorFilterDialog(
            RandomizedMatrixErrorFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as RandomizedMatrixErrorFilter;
            if (module == null) {
                modifiedModule = new RandomizedMatrixErrorFilter();
                module = modifiedModule as RandomizedMatrixErrorFilter;
            }

            matrixPanel = new ErrorMatrixPanel((uint)module.Matrix.Height,
                (uint)module.Matrix.Width);
            matrixPanel.Matrix = module.Matrix;

            randCoeffCountCheckButton = new CheckButton();
            randCoeffCountCheckButton.Active =
                module.RandomizeCoeffCount;
            randCoeffCountCheckButton.Toggled += delegate
            {
                module.RandomizeCoeffCount =
                    randCoeffCountCheckButton.Active;
            };

            table = new Table(3, 2, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };
            table.Attach(new Label("Error matrix:") { Xalign = 0.0f },
                0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink,
                0, 0);
            table.Attach(matrixPanel, 0, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);
            table.Attach(new Label("Randomize coefficient count?")
                { Xalign = 0.0f }, 0, 1, 2, 3, AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);
            table.Attach(randCoeffCountCheckButton, 1, 2, 2, 3,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.ShowAll();
            VBox.PackStart(table);
        }
Example #13
0
    private void createTable()
    {
        LogB.Debug("Persons count" + persons.Count.ToString());
        uint padding = 4;
        uint cols    = 4;      //each row has 4 columns
        uint rows    = Convert.ToUInt32(Math.Floor(persons.Count / (1.0 * cols)) + 1);
        int  count   = 0;

        label_selected_person_name.Text = "";
        SelectedPerson = null;
        personButtonsSensitive(false);
        vbox_button_delete_confirm.Visible = false;

        for (int row_i = 0; row_i < rows; row_i++)
        {
            for (int col_i = 0; col_i < cols; col_i++)
            {
                if (count >= persons.Count)
                {
                    return;
                }

                Person p = (Person)persons[count++];

                PersonPhotoButton ppb = new PersonPhotoButton(p);
                Gtk.Button        b   = ppb.CreateButton();
                b.Show();

                b.Clicked += new EventHandler(on_button_portrait_clicked);
                b.CanFocus = true;

                table1.Attach(b, (uint)col_i, (uint)col_i + 1, (uint)row_i, (uint)row_i + 1,
                              Gtk.AttachOptions.Fill,
                              Gtk.AttachOptions.Fill,
                              padding, padding);
            }
        }

        table1.ShowAll();
    }
Example #14
0
        public MessagePane()
        {
            HasWindow = true;

            table = new Gtk.Table (1, 2, false);
            table.RowSpacing = table.ColumnSpacing = 12;

            headerIcon = new Gtk.Image ();
            headerIcon.Yalign = 0.0f;
            table.Attach (headerIcon, 0, 1, 0, 1,
                      0, Gtk.AttachOptions.Fill,
                      0, 0);

            header = new Gtk.Label ();
            header.SetAlignment (0.0f, 0.5f);
            table.Attach (header, 1, 2, 0, 1,
                      Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                      Gtk.AttachOptions.Fill,
                      0, 0);

            table.ShowAll ();
            Add (table);
        }
Example #15
0
        public Tile()
        {
            Table table = new Table (2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing = 2;
            table.BorderWidth = 2;

            PrimaryLabel = new Label ();
            SecondaryLabel = new Label ();

            table.Attach (image, 0, 1, 0, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            table.Attach (PrimaryLabel, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.Attach (SecondaryLabel, 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            table.ShowAll ();
            Add (table);

            PrimaryLabel.Xalign = 0.0f;
            PrimaryLabel.Yalign = 0.0f;

            SecondaryLabel.Xalign = 0.0f;
            SecondaryLabel.Yalign = 0.0f;

            StyleUpdated += delegate {
                PrimaryLabel.OverrideColor (StateFlags.Normal, StyleContext.GetColor (StateFlags.Normal));
                Gdk.RGBA rgba = StyleContext.GetColor (StateFlags.Normal);
                SecondaryLabel.OverrideColor (StateFlags.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
                    rgba, StyleContext.GetBackgroundColor (StateFlags.Normal)));
            };

            Relief = ReliefStyle.None;
        }
		/// <summary>
		/// Creates a Gtk.Widget that's used to configure the service.  This
		/// will be used in the Synchronization Preferences.  Preferences should
		/// not automatically be saved by a GConf Property Editor.  Preferences
		/// should be saved when SaveConfiguration () is called.
		/// </summary>
		public override Gtk.Widget CreatePreferencesControl (EventHandler requiredPrefChanged)
		{
			Gtk.Table table = new Gtk.Table (3, 2, false);
			table.RowSpacing = 5;
			table.ColumnSpacing = 10;

			// Read settings out of gconf
			string url, username, password;
			GetConfigSettings (out url, out username, out password);

			if (url == null)
				url = string.Empty;
			if (username == null)
				username = string.Empty;
			if (password == null)
				password = string.Empty;

			urlEntry = new Entry ();
			urlEntry.Text = url;
			urlEntry.Changed += requiredPrefChanged;
			AddRow (table, urlEntry, Catalog.GetString ("_URL:"), 0);

			usernameEntry = new Entry ();
			usernameEntry.Text = username;
			usernameEntry.Changed += requiredPrefChanged;
			AddRow (table, usernameEntry, Catalog.GetString ("User_name:"), 1);

			passwordEntry = new Entry ();
			passwordEntry.Text = password;
			passwordEntry.Visibility = false;
			passwordEntry.Changed += requiredPrefChanged;
			AddRow (table, passwordEntry, Catalog.GetString ("_Password:"), 2);

			table.ShowAll ();
			return table;
		}
		public FileSelectorDialog (string title, Gtk.FileChooserAction action): base (title, action)
		{
			LocalOnly = true;
			
			// Add the text encoding selector
			Table table = new Table (2, 2, false);
			table.RowSpacing = 6;
			table.ColumnSpacing = 6;
			
			encodingLabel = new Label (GettextCatalog.GetString ("_Character Coding:"));
			encodingLabel.Xalign = 0;
			table.Attach (encodingLabel, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			
			encodingMenu = new Gtk.OptionMenu ();
			FillEncodings ();
			encodingMenu.SetHistory (0);
			table.Attach (encodingMenu, 1, 2, 0, 1, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0);

			encodingMenu.Changed += EncodingChanged;
			
			// Add the viewer selector
			viewerLabel = new Label (GettextCatalog.GetString ("Open With:"));
			viewerLabel.Xalign = 0;
			table.Attach (viewerLabel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			
			Gtk.HBox box = new HBox (false, 6);
			viewerSelector = Gtk.ComboBox.NewText ();
			box.PackStart (viewerSelector, true, true, 0);
			closeWorkspaceCheck = new CheckButton (GettextCatalog.GetString ("Close current workspace"));
			closeWorkspaceCheck.Active = true;
			box.PackStart (closeWorkspaceCheck, false, false, 0);
			table.Attach (box, 1, 2, 1, 2, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0);
			FillViewers ();
			viewerSelector.Changed += OnViewerChanged;
			
			table.ShowAll ();
			this.ExtraWidget = table;
			
			// Give back the height that the extra widgets take
			int w, h;
			GetSize (out w, out h);
			Resize (w, h + table.SizeRequest ().Height);
			
			if (action == Gtk.FileChooserAction.SelectFolder)
				ShowEncodingSelector = false;
				
			if (action != Gtk.FileChooserAction.Open)
				closeWorkspaceCheck.Visible = ShowViewerSelector = false;
		}
Example #18
0
 private Widget CreateMoreOptionsExpander(string defaultDomainID)
 {
     optionsExpander = new Expander(Util.GS("More options"));
        optionsExpander.Activated += new EventHandler(OnOptionsExpanded);
        optionsExpander.Activate();
        Table optionsTable = new Table(2, 3, false);
        optionsExpander.Add(optionsTable);
        optionsTable.ColumnSpacing = 10;
        optionsTable.RowSpacing = 10;
        optionsTable.SetColSpacing(0, 30);
        Label l = new Label(Util.GS("iFolder account"));
        l.Xalign = 0;
        optionsTable.Attach(l, 1,2,0,1,
     AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        Encryption = new RadioButton(Util.GS("Passphrase Encryption"));
        optionsTable.Attach(Encryption, 2,3,1,2, AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        Regular = new RadioButton(Encryption, Util.GS("Regular"));
        optionsTable.Attach(Regular, 3,4,1,2, AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        SecureSync = new CheckButton(Util.GS("Secure Sync"));
                 optionsTable.Attach(SecureSync, 4,5,1,2, AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        l = new Label(Util.GS("Security"));
        l.Xalign = 0;
        optionsTable.Attach(l, 1,2,1,2,
     AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        domainComboBox = ComboBox.NewText();
        optionsTable.Attach(domainComboBox, 2,3,0,1,
     AttachOptions.Expand | AttachOptions.Fill, 0,0,0);
        int defaultDomain = 0;
        for (int x = 0; x < domains.Length; x++)
        {
     domainComboBox.AppendText(string.Format(domains[x].Name + " - " + domains[x].Host));
     if (defaultDomainID != null)
     {
      if (defaultDomainID == domains[x].ID)
       defaultDomain = x;
     }
     else
      defaultDomain = x;
        }
        domainComboBox.Active = defaultDomain;
        int SecurityPolicy = ifws.GetSecurityPolicy(this.DomainID);
        ChangeStatus(SecurityPolicy);
        optionsTable.ShowAll();
        return optionsExpander;
 }
Example #19
0
        public StationEditor(DatabaseTrackInfo track)
            : base()
        {
            AccelGroup accel_group = new AccelGroup ();
            AddAccelGroup (accel_group);

            Title = String.Empty;
            SkipTaskbarHint = true;
            Modal = true;

            this.track = track;

            string title = track == null
                ? Catalog.GetString ("Add new radio station")
                : Catalog.GetString ("Edit radio station");

            BorderWidth = 6;
            DefaultResponse = ResponseType.Ok;
            Modal = true;

            ContentArea.Spacing = 6;

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

            Image image = new Image ();
            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign = 0.0f;
            image.Show ();

            VBox main_box = new VBox ();
            main_box.BorderWidth = 5;
            main_box.Spacing = 10;

            Label header = new Label ();
            header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title));
            header.Xalign = 0.0f;
            header.Show ();

            Label message = new Label ();
            message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
            message.Xalign = 0.0f;
            message.Wrap = true;
            message.Show ();

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

            genre_entry = ComboBoxText.NewWithEntry ();

            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
                if (!String.IsNullOrEmpty (genre)) {
                    genre_entry.AppendText (genre);
                }
            }

            if (track != null && !String.IsNullOrEmpty (track.Genre)) {
                genre_entry.Entry.Text = track.Genre;
            }

            AddRow (Catalog.GetString ("Station Genre:"), genre_entry);

            name_entry        = AddEntryRow (Catalog.GetString ("Station Name:"));
            stream_entry      = AddEntryRow (Catalog.GetString ("Stream URL:"));
            creator_entry     = AddEntryRow (Catalog.GetString ("Station Creator:"));
            description_entry = AddEntryRow (Catalog.GetString ("Description:"));

            rating_entry = new RatingEntry ();
            HBox rating_box = new HBox ();
            rating_box.PackStart (rating_entry, false, false, 0);
            AddRow (Catalog.GetString ("Rating:"), rating_box);

            table.ShowAll ();

            main_box.PackStart (header, false, false, 0);
            main_box.PackStart (message, false, false, 0);
            main_box.PackStart (table, false, false, 0);
            main_box.Show ();

            split_box.PackStart (image, false, false, 0);
            split_box.PackStart (main_box, true, true, 0);
            split_box.Show ();

            ContentArea.PackStart (split_box, true, true, 0);

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.CanDefault = false;
            cancel_button.UseStock = true;
            cancel_button.Show ();
            AddActionWidget (cancel_button, ResponseType.Close);

            cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            save_button = new Button (Stock.Save);
            save_button.CanDefault = true;
            save_button.UseStock = true;
            save_button.Sensitive = false;
            save_button.Show ();
            AddActionWidget (save_button, ResponseType.Ok);

            save_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return,
                0, Gtk.AccelFlags.Visible);

            name_entry.HasFocus = true;

            if (track != null) {
                if (!String.IsNullOrEmpty (track.TrackTitle)) {
                    name_entry.Text = track.TrackTitle;
                }

                if (!String.IsNullOrEmpty (track.Uri.AbsoluteUri)) {
                    stream_entry.Text = track.Uri.AbsoluteUri;
                }

                if (!String.IsNullOrEmpty (track.Comment)) {
                    description_entry.Text = track.Comment;
                }

                if (!String.IsNullOrEmpty (track.ArtistName)) {
                    creator_entry.Text = track.ArtistName;
                }

                rating_entry.Value = track.Rating;
            }

            error_container = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            error_container.TopPadding = 6;
            HBox error_box = new HBox ();
            error_box.Spacing = 4;

            Image error_image = new Image ();
            error_image.Stock = Stock.DialogError;
            error_image.IconSize = (int)IconSize.Menu;
            error_image.Show ();

            error = new Label ();
            error.Xalign = 0.0f;
            error.Show ();

            error_box.PackStart (error_image, false, false, 0);
            error_box.PackStart (error, true, true, 0);
            error_box.Show ();

            error_container.Add (error_box);

            table.Attach (error_container, 0, 2, 6, 7, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            genre_entry.Entry.Changed += OnFieldsChanged;
            name_entry.Changed += OnFieldsChanged;
            stream_entry.Changed += OnFieldsChanged;

            OnFieldsChanged (this, EventArgs.Empty);
        }
Example #20
0
        private Table BuildWidget(string title)
        {
            var tile = new Table (3, 2, false);

            tile.ColumnSpacing = 5;
            tile.RowSpacing = 2;

            var title_label = new Label ();
            title_label.Xalign = 0.0f;
            title_label.Ellipsize = Pango.EllipsizeMode.End;
            title_label.Markup = String.Format ("<small><b>{0}</b></small>", GLib.Markup.EscapeText (title));

            var status_label = new Label ();
            status_label.Xalign = 0.0f;
            status_label.Ellipsize = Pango.EllipsizeMode.End;
            status_label.Markup = "<small>Testing...</small>";

            var progress_bar = new ProgressBar ();
            progress_bar.SetSizeRequest (0, -1);
            progress_bar.Fraction = 0.5;
            progress_bar.Text = "Doing nothing...";

            var cancel_button = new Button (new Image (Stock.Stop, IconSize.Menu));
            cancel_button.Relief = ReliefStyle.None;

            tile.Attach (title_label, 0, 3, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            tile.Attach (status_label, 0, 3, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill, 0, 0);

            tile.Attach (progress_bar, 1, 2, 2, 3,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            tile.Attach (cancel_button, 2, 3, 2, 3,
                AttachOptions.Shrink | AttachOptions.Fill,
                AttachOptions.Shrink | AttachOptions.Fill, 0, 0);

            tile.ShowAll ();

            return tile;
        }
        public DynamicMatrixThresholdFilterDialog(
            DynamicMatrixThresholdFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as DynamicMatrixThresholdFilter;
            if (module == null) {
                modifiedModule = new DynamicMatrixThresholdFilter();
                module = modifiedModule as DynamicMatrixThresholdFilter;
            }

            initRecordTable(module);

            noiseEnabledCheckButton = new CheckButton("Noise enabled?");
            noiseEnabledCheckButton.Active = module.NoiseEnabled;
            noiseEnabledCheckButton.Toggled += delegate
            {
                module.NoiseEnabled = noiseEnabledCheckButton.Active;
            };

            addRecordButton = new Button("gtk-new");
            addRecordButton.Clicked += delegate
            {
                ThresholdTableRecordDialog dialog = new ThresholdTableRecordDialog();
                DynamicMatrixThresholdFilter.ThresholdRecord record =
                    dialog.runConfiguration();
                addRecord(record);
            };

            editRecordButton = new Button("gtk-edit");
            editRecordButton.Clicked += delegate
            {
                TreeIter selectedIter = getSelectedRowIter();
                int selectedIntensity = getIntensityFromRow(selectedIter);
                if (selectedIntensity >= 0) {
                    DynamicMatrixThresholdFilter.ThresholdRecord record = module.MatrixTable.getDefinitionRecord(
                        selectedIntensity, false);
                    ThresholdTableRecordDialog dialog =
                        new ThresholdTableRecordDialog(record);
                    record = dialog.runConfiguration();
                    if (record != null) {
                        if (record.keyRangeStart == selectedIntensity) {
                            recordStore.SetValue(selectedIter, 0, record);
                        } else {
                            deleteRecord(ref selectedIter, selectedIntensity);
                            addRecord(record);
                        }
                    }
                }
            };

            deleteRecordButton = new Button("gtk-delete");
            deleteRecordButton.Clicked += delegate
            {
                TreeIter selectedIter = getSelectedRowIter();
                int selectedIntensity = getIntensityFromRow(selectedIter);
                if (selectedIntensity >= 0) {
                    deleteRecord(ref selectedIter, selectedIntensity);
                }
            };

            clearRecordsButton = new Button("Clear all");
            clearRecordsButton.Clicked += delegate
            {
                module.MatrixTable.clearDefinitionRecords();
                recordStore.Clear();
            };

            table = new Table(6, 2, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };

            table.Attach(new Label("Intensity range table:") { Xalign = 0.0f },
                0, 2, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            table.Attach(noiseEnabledCheckButton, 0, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            ScrolledWindow recordTreeViewScroll = new ScrolledWindow();
            recordTreeViewScroll.AddWithViewport(recordTreeView);
            table.Attach(recordTreeViewScroll, 1, 2, 2, 6,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

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

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

            table.Attach(deleteRecordButton, 0, 1, 4, 5,
                AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            table.Attach(clearRecordsButton, 0, 1, 5, 6,
                AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);

            table.ShowAll();
            VBox.PackStart(table);
        }
Example #22
0
    private void createTable()
    {
        LogB.Debug("Persons count" + persons.Count.ToString());
        uint padding = 4;
        uint cols    = 4;      //each row has 4 columns
        uint rows    = Convert.ToUInt32(Math.Floor(persons.Count / (1.0 * cols)) + 1);
        int  count   = 0;

        if (SelectedPerson == null)
        {
            selectedFirstClickPersonID      = -1;
            label_selected_person_name.Text = "";
        }
        else
        {
            selectedFirstClickPersonID           = SelectedPerson.UniqueID;
            label_selected_person_name.Text      = "<b>" + SelectedPerson.Name + "</b>";
            label_selected_person_name.UseMarkup = true;
        }

        personButtonsSensitive(false);
        vbox_button_delete_confirm.Visible = false;
        list_ppb = new List <PersonPhotoButton>();

        for (int row_i = 0; row_i < rows; row_i++)
        {
            for (int col_i = 0; col_i < cols; col_i++)
            {
                if (count >= persons.Count)
                {
                    return;
                }

                Person p = (Person)persons[count++];

                PersonPhotoButton ppb = new PersonPhotoButton(p.UniqueID, p.Name);                 //creates the button

                //select currentPerson
                if (selectedFirstClickPersonID != -1 && selectedFirstClickPersonID == p.UniqueID)
                {
                    ppb.Select(true);
                    assignPersonSelectedStuff(p);
                }

                list_ppb.Add(ppb);
                Gtk.Button b = ppb.Button;

                b.Show();

                b.Clicked += new EventHandler(on_button_portrait_clicked);
                b.CanFocus = true;

                table1.Attach(b, (uint)col_i, (uint)col_i + 1, (uint)row_i, (uint)row_i + 1,
                              Gtk.AttachOptions.Fill,
                              Gtk.AttachOptions.Fill,
                              padding, padding);
            }
        }

        table1.ShowAll();
    }
		public CredentialsDialog (URIish uri, IEnumerable<CredentialItem> credentials)
		{
			this.Build ();
			
			labelTop.Text = string.Format (labelTop.Text, uri.ToString ());
			
			Gtk.Table table = new Gtk.Table (0, 0, false);
			table.ColumnSpacing = 6;
			vbox.PackStart (table, true, true, 0);
			
			uint r = 0;
			Widget firstEditor = null;
			foreach (CredentialItem c in credentials) {
				Label lab = new Label (c.GetPromptText () + ":");
				lab.Xalign = 0;
				table.Attach (lab, 0, 1, r, r + 1);
				Table.TableChild tc = (Table.TableChild) table [lab];
				tc.XOptions = AttachOptions.Shrink;
				
				Widget editor = null;
				
				if (c is CredentialItem.YesNoType) {
					CredentialItem.YesNoType cred = (CredentialItem.YesNoType) c;
					if (credentials.Count (i => i is CredentialItem.YesNoType) == 1) {
						singleYesNoCred = cred;
						buttonOk.Hide ();
						buttonYes.Show ();
						buttonNo.Show ();
						// Remove the last colon
						lab.Text = lab.Text.Substring (0, lab.Text.Length - 1);
					}
					else {
						CheckButton btn = new CheckButton ();
						editor = btn;
						btn.Toggled += delegate {
							cred.SetValue (btn.Active);
						};
					}
				}
				else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType) {
					CredentialItem cred = c;
					Entry e = new Entry ();
					editor = e;
					e.ActivatesDefault = true;
					if (cred.IsValueSecure ())
						e.Visibility = false;
					e.Changed += delegate {
						if (cred is CredentialItem.StringType)
							((CredentialItem.StringType)cred).SetValue (e.Text);
						else
							((CredentialItem.CharArrayType)cred).SetValue (e.Text.ToCharArray ());
					};
					
					if (c is CredentialItem.Username)
						e.Text = uri.GetUser () ?? "";
				}
				if (editor != null) {
					table.Attach (editor, 1, 2, r, r + 1);
					tc = (Table.TableChild) table [lab];
					tc.XOptions = AttachOptions.Fill;
					if (firstEditor == null)
						firstEditor = editor;
				}
				
				r++;
			}
			table.ShowAll ();
			Focus = firstEditor;
			Default = buttonOk;
		}
Example #24
0
 /// <summary>
 /// Create a new matrix panel.
 /// </summary>
 /// <param name="rows">Number of rows (>0)</param>
 /// <param name="columns">Number of columns (>0)</param>
 /// <param name="resizable">True if the matrix dimensions are allowed
 /// to be changed</param>
 public MatrixPanel(uint rows, uint columns, bool resizable)
 {
     scroll = new ScrolledWindow();
     resize(rows, columns);
     if (resizable) {
         Table table = new Table(2, 1, false);
         matrixRows = new SpinButton(1, 16, 1) { Value = rows };
         matrixCols = new SpinButton(1, 16, 1) { Value = columns };
         Button resizeButton = new Button("Resize");
         resizeButton.Clicked += delegate
         {
             // Preserve values from the original matrix if possible.
             int[,] origMatrix = Matrix;
             resize((uint)matrixRows.ValueAsInt,
                    (uint)matrixCols.ValueAsInt);
             if (origMatrix != null) {
                 setMatrix(origMatrix, false);
             }
         };
         table.Attach(scroll, 0, 1, 0, 1,
             AttachOptions.Fill | AttachOptions.Expand,
             AttachOptions.Fill | AttachOptions.Expand, 0, 0);
         HBox hbox = new HBox(false, 2) { BorderWidth = 2 };
         hbox.PackStart(new Label("Rows:"));
         hbox.PackStart(matrixRows);
         hbox.PackStart(new Label("Columns:"));
         hbox.PackStart(matrixCols);
         hbox.PackStart(resizeButton);
         table.Attach(hbox, 0, 1, 1, 2,
             AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
         table.ShowAll();
         Add(table);
     } else {
         Add(scroll);
     }
 }
Example #25
0
		protected override void BuildUI ()
		{
			base.BuildUI ();

			string title = Catalog.GetString ("Sharpen");
			dialog = new Gtk.Dialog (title, (Gtk.Window) this,
						 DialogFlags.DestroyWithParent, new object [0]);
			dialog.BorderWidth = 12;
			dialog.VBox.Spacing = 6;
			
			Gtk.Table table = new Gtk.Table (3, 2, false);
			table.ColumnSpacing = 6;
			table.RowSpacing = 6;
			
			table.Attach (SetFancyStyle (new Gtk.Label (Catalog.GetString ("Amount:"))), 0, 1, 0, 1);
			table.Attach (SetFancyStyle (new Gtk.Label (Catalog.GetString ("Radius:"))), 0, 1, 1, 2);
			table.Attach (SetFancyStyle (new Gtk.Label (Catalog.GetString ("Threshold:"))), 0, 1, 2, 3);
			
			SetFancyStyle (amount_spin = new Gtk.SpinButton (0.00, 100.0, .01));
			SetFancyStyle (radius_spin = new Gtk.SpinButton (1.0, 50.0, .01));
			SetFancyStyle (threshold_spin = new Gtk.SpinButton (0.0, 50.0, .01));
			amount_spin.Value = .5;
			radius_spin.Value = 5;
			threshold_spin.Value = 0.0;

			amount_spin.ValueChanged += HandleSettingsChanged;
			radius_spin.ValueChanged += HandleSettingsChanged;
			threshold_spin.ValueChanged += HandleSettingsChanged;

			table.Attach (amount_spin, 1, 2, 0, 1);
			table.Attach (radius_spin, 1, 2, 1, 2);
			table.Attach (threshold_spin, 1, 2, 2, 3);
			
			Gtk.Button cancel_button = new Gtk.Button (Gtk.Stock.Cancel);
			cancel_button.Clicked += HandleCancelClicked;
			dialog.AddActionWidget (cancel_button, Gtk.ResponseType.Cancel);
			
			Gtk.Button ok_button = new Gtk.Button (Gtk.Stock.Ok);
			ok_button.Clicked += HandleOkClicked;
			dialog.AddActionWidget (ok_button, Gtk.ResponseType.Cancel);

			Destroyed += HandleLoupeDestroyed;
			
			table.ShowAll ();
			dialog.VBox.PackStart (table);
			dialog.ShowAll ();
		}
Example #26
0
        public FieldSlot AddField (Box parent, Widget label, Widget field, string syncTooltip, FieldLabelClosure labelClosure,
            FieldValueClosure readClosure, FieldValueClosure writeClosure, FieldValueClosure syncClosure, FieldOptions options)
        {
            var editor_field = field as IEditorField;

            if (editor_field != null && dialog.Mode == EditorMode.View) {
                editor_field.SetAsReadOnly ();
            }

            FieldSlot slot = new FieldSlot ();

            slot.Parent = parent;
            slot.Label = label;
            slot.Field = field;
            slot.LabelClosure = labelClosure;
            slot.ReadClosure = readClosure;
            slot.WriteClosure = writeClosure;
            slot.SyncClosure = syncClosure;

            if (MultipleTracks && (options & FieldOptions.NoSync) == 0) {
                slot.Sync = delegate {
                    dialog.ForeachNonCurrentTrack (delegate (EditorTrackInfo track) {
                        (slot.SyncClosure ?? slot.WriteClosure) (track, slot.Field);
                    });
                };
            }

            if (MultipleTracks && (options & FieldOptions.NoSync) == 0 && (options & FieldOptions.NoShowSync) == 0) {
                slot.SyncButton = new SyncButton ();
                if (syncTooltip != null) {
                    TooltipSetter.Set (tooltip_host, slot.SyncButton, syncTooltip);
                }

                slot.SyncButton.Clicked += delegate { slot.Sync (); };
            }

            Table table = new Table (1, 1, false);
            table.ColumnSpacing = 1;

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

            if (editor_field != null) {
                editor_field.Changed += delegate {
                    if (CurrentTrack != null) {
                        slot.WriteClosure (CurrentTrack, slot.Field);
                    }
                };
            }

            if (slot.SyncButton != null) {
                table.Attach (slot.SyncButton, 1, 2, 1, 2,
                    AttachOptions.Fill,
                    AttachOptions.Fill, 0, 0);
            }

            if (label != null) {
                if (label is Label) {
                    ((Label)label).MnemonicWidget = field;
                }
                table.Attach (label, 0, table.NColumns, 0, 1,
                    AttachOptions.Fill | AttachOptions.Expand,
                    AttachOptions.Fill, 0, 0);
            }

            table.ShowAll ();

            if ((options & FieldOptions.Shrink) == 0) {
                slot.Container = table;
                parent.PackStart (table, false, false, 0);
            } else {
                HBox shrink = new HBox ();
                shrink.Show ();
                slot.Container = shrink;
                shrink.PackStart (table, false, false, 0);
                parent.PackStart (shrink, false, false, 0);
            }

            field_slots.Add (slot);
            return slot;
        }
Example #27
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";
        }
            public ThresholdTableRecordDialog(DynamicMatrixThresholdFilter.ThresholdRecord
                editedRecord)
            {
                Title = "Threshold record editing";
                Modal = true;
                AddButton("OK", ResponseType.Ok);
                AddButton("Cancel", ResponseType.Cancel);

                record = editedRecord;
                if (record == null) {
                    record = new DynamicMatrixThresholdFilter.ThresholdRecord();
                }

                intensitySpinButton = new SpinButton(0, 255, 1);
                intensitySpinButton.Value = record.keyRangeStart;

                matrixPanel = new ThresholdMatrixPanel((uint)record.matrix.Height,
                (uint)record.matrix.Width);
                matrixPanel.Matrix = record.matrix.DefinitionMatrix;
                matrixPanel.Scaled = !record.matrix.Incremental;

                noiseHScale = new HScale(0, 1, 0.01);
                noiseHScale.Value = record.noiseAmplitude;

                table = new Table(4, 2, false)
                    { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };

                table.Attach(new Label("Intensity range start:")
                    { Xalign = 0.0f }, 0, 1, 0, 1, AttachOptions.Fill,
                    AttachOptions.Shrink, 0, 0);
                table.Attach(intensitySpinButton, 1, 2, 0, 1,
                    AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                table.Attach(new Label("Threshold matrix:") { Xalign = 0.0f },
                    0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                table.Attach(matrixPanel, 0, 2, 2, 3,
                    AttachOptions.Fill | AttachOptions.Expand,
                    AttachOptions.Fill | AttachOptions.Expand, 0, 0);

                table.Attach(new Label("Noise amplitude:") { Xalign = 0.0f },
                    0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
                table.Attach(noiseHScale, 1, 2, 3, 4,
                    AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

                table.ShowAll();
                VBox.PackStart(table);
            }
		public NewProjectOptionsWidget ()
		{
			Stetic.BinContainer.Attach (this);
			
			AttachOptions fill = AttachOptions.Fill;
			AttachOptions expand = AttachOptions.Expand | fill;
			AttachOptions shrink = AttachOptions.Shrink;
			
			var table = new Table (5, 3, false) {
				ColumnSpacing = 4,
				RowSpacing = 4,
			};
			uint row = 0;
			
			var header = new Label (GettextCatalog.GetString ("<b>Project Options</b>")) {
				Xalign = 0,
				UseMarkup = true,
			};
			table.Attach (header, 0, 3, row, row + 1, expand, shrink, 0, 0);
			
			row++;
			
			nameEntry = new Entry ();
			nameEntry.Changed += NameChanged;
			var nameLabel = new Label (GettextCatalog.GetString ("N_ame:")) {
				UseUnderline = true,
				MnemonicWidget = nameEntry,
				Xalign = 0,
			};
			table.Attach (nameLabel, 0, 1, row, row+1, fill, shrink, 0, 0);
			table.Attach (nameEntry, 1, 3, row, row+1, expand, shrink, 0, 0);
			
			row++;
			
			locationEntry = new FileEntry ();
			locationEntry.PathChanged += delegate {
				UpdateState ();
			};
			var locationLabel = new Label (GettextCatalog.GetString ("L_ocation:")) {
				UseUnderline = true,
				MnemonicWidget = locationEntry,
				Xalign = 0,
			};
			table.Attach (locationLabel, 0, 1, row, row+1, fill, shrink, 0, 0);
			table.Attach (locationEntry, 1, 3, row, row+1, expand, shrink, 0, 0);
			
			solutionNameEntry = new Entry ();
			solutionNameEntry.Sensitive = false;
			solutionNameEntry.Changed += delegate {
				UpdateState ();
			};
			solutionNameLabel = new Label (GettextCatalog.GetString ("_Solution name:")) {
				UseUnderline = true,
				MnemonicWidget = solutionNameEntry,
				Xalign = 0,
			};
			createSolutionDirectoryCheck = new CheckButton (GettextCatalog.GetString ("_Create directory for solution")) {
				UseUnderline = true,
			};
			createSolutionDirectoryCheck.Toggled += delegate {
				solutionNameEntry.Sensitive = createSolutionDirectoryCheck.Active;
				UpdateState ();
			};
			
			row++;
			
			table.Attach (solutionNameLabel, 0, 1, row, row+1, fill, shrink, 0, 0);
			table.Attach (solutionNameEntry, 1, 2, row, row+1, expand, shrink, 0, 0);
			table.Attach (createSolutionDirectoryCheck, 2, 3, row, row+1, fill, shrink, 0, 0);
			
			row++;
			
			saveInLabel = new Label () {
				Xalign = 0,
			};
			table.Attach (saveInLabel, 1, 3, row, row+1, fill, shrink, 0, 0);
			
			table.ShowAll ();
			this.Add (table);
		}
Example #30
0
		// called when no search results are found in the selected notebook
		void NoMatchesFoundAction ()
		{
			hpaned.Remove (matches_window);
			String message = Catalog.GetString ("No results found " +
				"in the selected notebook.\nClick here to " +
				"search across all notes.");
			Gtk.LinkButton link_button = new Gtk.LinkButton ("", message);
			Gtk.LinkButton.SetUriHook(ShowAllSearchResults);
			link_button.TooltipText = Catalog.GetString 
				("Click here to search across all notebooks");
			link_button.Show();
			Gtk.Table no_matches_found_table = new Gtk.Table (1, 3, false);
			no_matches_found_table.Attach (link_button, 1, 2, 0, 1,
			                               Gtk.AttachOptions.Fill | Gtk.AttachOptions.Shrink,
			                 Gtk.AttachOptions.Shrink,
			                0, 0
			              );
			
			no_matches_found_table.ColumnSpacing = 4;
			no_matches_found_table.ShowAll ();
			no_matches_box = new HBox (false, 0);
			no_matches_box.PackStart (no_matches_found_table, true, true, 0);
			no_matches_box.Show ();
			hpaned.Add2 (no_matches_box);
		}
        /// <summary>
        /// Creates a Gtk.Widget that's used to configure the service.  This
        /// will be used in the Synchronization Preferences.  Preferences should
        /// not automatically be saved by a GConf Property Editor.  Preferences
        /// should be saved when SaveConfiguration () is called.
        /// </summary>
        public override Widget CreatePreferencesControl()
        {
            Table table = new Table (1, 3, false) {RowSpacing = 5, ColumnSpacing = 10};

            // Read settings out of gconf
            string username;
            string password;
            if (GetConfigSettings(out username, out password) == false)
            {
                username = string.Empty;
                password = string.Empty;
            }

            Label usernameL = new Label(Catalog.GetString("_Username:"******"_Password:"));
            usernameL.Xalign = 1;
            table.Attach (usernameL, 0, 1, 0, 1,
                          AttachOptions.Fill,
                          AttachOptions.Expand | AttachOptions.Fill,
                          0, 0);
            table.Attach(passwordL, 0, 1, 1, 2,
                                      AttachOptions.Fill,
                                      AttachOptions.Expand | AttachOptions.Fill,
                                      0, 0);
            _usernameEntry = new Entry {Text = username};
            table.Attach(_usernameEntry, 1, 2, 0, 1,
                          AttachOptions.Expand | AttachOptions.Fill,
                          AttachOptions.Expand | AttachOptions.Fill,
                          0, 0);
            usernameL.MnemonicWidget = _usernameEntry;

            _passwordEntry = new Entry {Text = password, Visibility = false};
            table.Attach(_passwordEntry, 1, 2, 1, 2,
                          AttachOptions.Expand | AttachOptions.Fill,
                          AttachOptions.Expand | AttachOptions.Fill,
                          0, 0);
            passwordL.MnemonicWidget = _passwordEntry;

            table.ShowAll ();
            return table;
        }
Example #32
0
		protected NoteRecentChanges (NoteManager manager)
: base (Catalog.GetString ("Search All Notes"))
		{
			this.manager = manager;
			this.IconName = "tomboy";
			this.DefaultWidth = 450;
			this.DefaultHeight = 400;
			this.current_matches = new Dictionary<string, int> ();
			this.Resizable = true;

			selected_tags = new Dictionary<Tag, Tag> ();

			AddAccelGroup (Tomboy.ActionManager.UI.AccelGroup);

			menu_bar = CreateMenuBar ();

			Gtk.Label label = new Gtk.Label (Catalog.GetString ("_Search:"));
			label.Xalign = 0.0f;

			find_combo = Gtk.ComboBoxEntry.NewText ();
			label.MnemonicWidget = find_combo;
			find_combo.Changed += OnEntryChanged;
			find_combo.Entry.ActivatesDefault = false;
			find_combo.Entry.Activated += OnEntryActivated;
			find_combo.Entry.FocusInEvent += OnEntryFocusIn;
			if (previous_searches != null) {
				foreach (string prev in previous_searches) {
					find_combo.AppendText (prev);
				}
			}

			clear_search_button = new Gtk.Button (new Gtk.Image (Gtk.Stock.Clear,
							      Gtk.IconSize.Menu));
			clear_search_button.Sensitive = false;
			clear_search_button.Clicked += ClearSearchClicked;
			clear_search_button.Show ();

			Gtk.Table table = new Gtk.Table (1, 3, false);
			table.Attach (label, 0, 1, 0, 1,
			              Gtk.AttachOptions.Fill,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              0, 0);
			table.Attach (find_combo, 1, 2, 0, 1,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              0, 0);
			table.Attach (clear_search_button,
				      2, 3, 0, 1,
			              Gtk.AttachOptions.Fill,
			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
			              0, 0);
			table.ColumnSpacing = 4;
			table.ShowAll ();

			Gtk.HBox hbox = new Gtk.HBox (false, 0);
			hbox.PackStart (table, true, true, 0);
			hbox.ShowAll ();

			// Notebooks Pane
			Gtk.Widget notebooksPane = MakeNotebooksPane ();
			notebooksPane.Show ();

			MakeRecentTree ();
			tree.Show ();

			status_bar = new Gtk.Statusbar ();
			status_bar.HasResizeGrip = true;
			status_bar.Show ();

			// Update on changes to notes
			manager.NoteDeleted += OnNotesDeleted;
			manager.NoteAdded += OnNotesChanged;
			manager.NoteRenamed += OnNoteRenamed;
			manager.NoteSaved += OnNoteSaved;

			// List all the current notes
			UpdateResults ();

			matches_window = new Gtk.ScrolledWindow ();
			matches_window.ShadowType = Gtk.ShadowType.In;

			matches_window.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			matches_window.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			matches_window.Add (tree);
			matches_window.Show ();

			hpaned = new Gtk.HPaned ();
			hpaned.Position = 150;
			hpaned.Add1 (notebooksPane);
			hpaned.Add2 (matches_window);
			hpaned.Show ();

			RestorePosition ();

			Gtk.VBox vbox = new Gtk.VBox (false, 8);
			vbox.BorderWidth = 6;
			vbox.PackStart (hbox, false, false, 4);
			vbox.PackStart (hpaned, true, true, 0);
			vbox.PackStart (status_bar, false, false, 0);
			vbox.Show ();

			// Use another VBox to place the MenuBar
			// right at thetop of the window.
			content_vbox = new Gtk.VBox (false, 0);
#if !MAC
			content_vbox.PackStart (menu_bar, false, false, 0);
#endif
			content_vbox.PackStart (vbox, true, true, 0);
			content_vbox.Show ();

			this.Add (content_vbox);
			this.DeleteEvent += OnDelete;
			this.KeyPressEvent += OnKeyPressed; // For Escape

			// Watch when notes are added to notebooks so the search
			// results will be updated immediately instead of waiting
			// until the note's QueueSave () kicks in.
			Notebooks.NotebookManager.NoteAddedToNotebook += OnNoteAddedToNotebook;
			Notebooks.NotebookManager.NoteRemovedFromNotebook += OnNoteRemovedFromNotebook;
			
			// Set the focus chain for the top-most containers Bug #512175
			Gtk.Widget[] vbox_focus = new Gtk.Widget[2];
			vbox_focus[0] = hbox;
			vbox_focus[1] = hpaned;
			vbox.FocusChain = vbox_focus;

			// Set focus chain for sub widgits of first top-most container
			Gtk.Widget[] table_focus = new Gtk.Widget[2];
			table_focus[0] = find_combo;
			table_focus[1] = matches_window;
			hbox.FocusChain = table_focus;
			
			// set focus chain for sub widgits of seconf top-most container
			Gtk.Widget[] hpaned_focus = new Gtk.Widget[2];
			hpaned_focus[0] = matches_window;
			hpaned_focus[1] = notebooksPane;
			hpaned.FocusChain = hpaned_focus;
			
			// get back to the beginning of the focus chain
			Gtk.Widget[] scroll_right = new Gtk.Widget[1];
			scroll_right[0] = tree;
			matches_window.FocusChain = scroll_right;
			
			Tomboy.ExitingEvent += OnExitingEvent;
		}
            public ErrorTableRecordDialog(DynamicMatrixErrorFilter.ErrorRecord
                editedRecord)
            {
                Title = "Intensity record editing";
                Modal = true;
                AddButton("OK", ResponseType.Ok);
                AddButton("Cancel", ResponseType.Cancel);

                record = editedRecord;
                if (record == null) {
                    record = new DynamicMatrixErrorFilter.ErrorRecord();
                }

                intensitySpinButton = new SpinButton(0, 255, 1);
                intensitySpinButton.Value = record.keyRangeStart;

                matrixPanel = new ErrorMatrixPanel((uint)record.matrix.Height,
                (uint)record.matrix.Width);
                matrixPanel.Matrix = record.matrix;

                table = new Table(3, 2, false)
                    { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };

                table.Attach(new Label("Intensity range start:")
                    { Xalign = 0.0f }, 0, 1, 0, 1, AttachOptions.Fill,
                    AttachOptions.Shrink, 0, 0);

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

                table.Attach(new Label("Error matrix:") { Xalign = 0.0f },
                    0, 1, 1, 2, AttachOptions.Fill,
                    AttachOptions.Shrink, 0, 0);

                table.Attach(matrixPanel, 0, 2, 2, 3,
                    AttachOptions.Fill | AttachOptions.Expand,
                    AttachOptions.Shrink, 0, 0);

                table.ShowAll();
                VBox.PackStart(table);
            }
Example #34
0
        public PreferencesDialog(Settings set, Window parent,
				 string argsOver)
        {
            settings = set;
            argsOverride = argsOver;

            dialog = new Dialog("Preferences", parent,
            DialogFlags.Modal | DialogFlags.DestroyWithParent,
            new object[]{Gtk.Stock.Close, -1});

            var table = new Table(4, 3, false);

            sUseBundledDebugger = new CheckButton("Use bundled MSPDebug");
            sUseBundledDebugger.Clicked += OnBundledState;
            table.Attach(sUseBundledDebugger, 0, 3, 0, 1,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);

            Label lbl;

            lbl = new Label("MSPDebug path:");
            lbl.SetAlignment(0.0f, 0.5f);
            table.Attach(lbl, 0, 1, 1, 2, AttachOptions.Fill, 0, 4, 4);
            sMSPDebugPath = new Entry();
            table.Attach(sMSPDebugPath, 1, 2, 1, 2,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);
            chooseMSPDebug = new Button("Choose...");
            chooseMSPDebug.Clicked += OnChoose;
            table.Attach(chooseMSPDebug, 2, 3, 1, 2,
             AttachOptions.Fill, 0, 4, 4);

            lbl = new Label("MSPDebug arguments:");
            lbl.SetAlignment(0.0f, 0.5f);
            table.Attach(lbl, 0, 1, 2, 3, AttachOptions.Fill, 0, 4, 4);
            sMSPDebugArgs = new Entry();
            sMSPDebugArgs.Sensitive = (argsOverride == null);
            table.Attach(sMSPDebugArgs, 1, 3, 2, 3,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);

            lbl = new Label("Console font:");
            lbl.SetAlignment(0.0f, 0.5f);
            table.Attach(lbl, 0, 1, 3, 4, AttachOptions.Fill, 0, 4, 4);
            sConsoleFont = new FontButton();
            table.Attach(sConsoleFont, 1, 3, 3, 4,
             AttachOptions.Expand | AttachOptions.Fill,
             0, 4, 4);

            table.ShowAll();
            ((Container)dialog.Child).Add(table);

            chooseDialog = new FileChooserDialog("Choose MSPDebug binary",
            dialog, FileChooserAction.Open,
            new object[]{Stock.Cancel, ResponseType.Cancel,
                 Stock.Ok, ResponseType.Ok});
            chooseDialog.DefaultResponse = ResponseType.Ok;
        }
Example #35
0
 private Widget CreateMoreOptionsExpander(string filteredDomainID)
 {
     Expander moreOptionsExpander = new Expander(Util.GS("More options"));
        Table optionsTable = new Table(2, 3, false);
        moreOptionsExpander.Add(optionsTable);
        optionsTable.ColumnSpacing = 10;
        optionsTable.RowSpacing = 10;
        optionsTable.SetColSpacing(0, 30);
        Label l = new Label(Util.GS("iFolder Server:"));
        l.Xalign = 0;
        optionsTable.Attach(l, 1,2,0,1,
     AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        domainComboBox = ComboBox.NewText();
        optionsTable.Attach(domainComboBox, 2,3,0,1,
     AttachOptions.Expand | AttachOptions.Fill, 0,0,0);
        int defaultDomain = 0;
        for (int x = 0; x < domains.Length; x++)
        {
     domainComboBox.AppendText(domains[x].Name);
     if (filteredDomainID != null)
     {
      if (filteredDomainID == domains[x].ID)
       defaultDomain = x;
     }
     else
      defaultDomain = x;
        }
        domainComboBox.Active = defaultDomain;
        l = new Label(Util.GS("Description:"));
        l.Xalign = 0;
        optionsTable.Attach(l, 1,2,1,2,
     AttachOptions.Shrink | AttachOptions.Fill, 0,0,0);
        descriptionTextView = new TextView();
        descriptionTextView.LeftMargin = 4;
        descriptionTextView.RightMargin = 4;
        descriptionTextView.Editable = true;
        descriptionTextView.CursorVisible = true;
        descriptionTextView.AcceptsTab = false;
        descriptionTextView.WrapMode = WrapMode.WordChar;
        ScrolledWindow sw = new ScrolledWindow();
        sw.ShadowType = ShadowType.EtchedIn;
        sw.Add(descriptionTextView);
        optionsTable.Attach(sw, 2,3,1,2,
     AttachOptions.Expand | AttachOptions.Fill, 0,0,0);
        optionsTable.ShowAll();
        return moreOptionsExpander;
 }
Example #36
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); };
        }
Example #37
0
        public CredentialsDialog(URIish uri, IEnumerable <CredentialItem> credentials)
        {
            this.Build();

            labelTop.Text = string.Format(labelTop.Text, uri.ToString());

            Gtk.Table table = new Gtk.Table(0, 0, false);
            table.ColumnSpacing = 6;
            vbox.PackStart(table, true, true, 0);

            uint   r           = 0;
            Widget firstEditor = null;

            foreach (CredentialItem c in credentials)
            {
                Label lab = new Label(c.GetPromptText() + ":");
                lab.Xalign = 0;
                table.Attach(lab, 0, 1, r, r + 1);
                Table.TableChild tc = (Table.TableChild)table [lab];
                tc.XOptions = AttachOptions.Shrink;

                Widget editor = null;

                if (c is CredentialItem.YesNoType)
                {
                    CredentialItem.YesNoType cred = (CredentialItem.YesNoType)c;
                    if (credentials.Count(i => i is CredentialItem.YesNoType) == 1)
                    {
                        singleYesNoCred = cred;
                        buttonOk.Hide();
                        buttonYes.Show();
                        buttonNo.Show();
                        // Remove the last colon
                        lab.Text = lab.Text.Substring(0, lab.Text.Length - 1);
                    }
                    else
                    {
                        CheckButton btn = new CheckButton();
                        editor       = btn;
                        btn.Toggled += delegate
                        {
                            cred.SetValue(btn.Active);
                        };
                    }
                }
                else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType)
                {
                    CredentialItem cred = c;
                    Entry          e    = new Entry();
                    editor             = e;
                    e.ActivatesDefault = true;
                    if (cred.IsValueSecure())
                    {
                        e.Visibility = false;
                    }
                    e.Changed += delegate
                    {
                        if (cred is CredentialItem.StringType)
                        {
                            ((CredentialItem.StringType)cred).SetValue(e.Text);
                        }
                        else
                        {
                            ((CredentialItem.CharArrayType)cred).SetValue(e.Text.ToCharArray());
                        }
                    };

                    if (c is CredentialItem.Username)
                    {
                        e.Text = uri.GetUser() ?? "";
                    }
                }
                if (editor != null)
                {
                    table.Attach(editor, 1, 2, r, r + 1);
                    tc          = (Table.TableChild)table [lab];
                    tc.XOptions = AttachOptions.Fill;
                    if (firstEditor == null)
                    {
                        firstEditor = editor;
                    }
                }

                r++;
            }
            table.ShowAll();
            Focus   = firstEditor;
            Default = buttonOk;
        }
Example #38
0
 /// <summary>
 /// Resize the matrix.
 /// </summary>
 /// <param name="rows">New number of rows (>0)</param>
 /// <param name="columns">New number of rows (>0)</param>
 public void resize(uint rows, uint columns)
 {
     if ((matrixTable != null) && (matrixTable.NRows == rows) &&
         (matrixTable.NColumns == columns))
     {
         return; // no resize needed
     }
     if (matrixTable != null) {
         matrixTable.Destroy();
     }
     matrixTable = new Table(rows, columns, true);
     spinButtonMatrix = new SpinButton[rows, columns];
     for (uint row = 0; row < rows; row++) {
         for (uint col = 0; col < columns; col++) {
             SpinButton spin = new SpinButton(0, 10000, 1)
                 { HasFrame = false };
             spinButtonMatrix[row, col] = spin;
             matrixTable.Attach(spin,
                 col, col + 1, row, row + 1,
                 AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
         }
     }
     matrixTable.ShowAll();
     scroll.AddWithViewport(matrixTable);
     if ((matrixRows != null) && (matrixCols != null)) {
         matrixRows.Value = rows;
         matrixCols.Value = columns;
     }
     if (MatrixResized != null) {
         MatrixResized(this, new EventArgs());
     }
 }