private void Activated(object sender, EventArgs e)
        {
            // TODO - allow the layer to be zoomed in or out

            var data = new RotateZoomData();

            Gtk.ResponseType response;
            using (var dialog = new SimpleEffectDialog(Translations.GetString("Rotate / Zoom Layer"),
                                                       Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerRotateZoom, 16),
                                                       data,
                                                       new PintaLocalizer())) {
                // When parameters are modified, update the display transform of the layer.
                dialog.EffectDataChanged += (o, args) => {
                    var xform = ComputeMatrix(data);
                    var doc   = PintaCore.Workspace.ActiveDocument;
                    doc.Layers.CurrentUserLayer.Transform.InitMatrix(xform);
                    PintaCore.Workspace.Invalidate();
                };

                response = (Gtk.ResponseType)dialog.Run();
            }

            ClearLivePreview();
            if (response == Gtk.ResponseType.Ok && !data.IsDefault)
            {
                ApplyTransform(data);
            }
        }
Exemple #2
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = DrawAreaX + 0.25;

            base.Draw(gr, area_width, area_height, rtl);

            gr.SetPangoLargeFontSize();
            gr.MoveTo(x, DrawAreaY + 0.22);

            switch (type)
            {
            case SubGameTypes.Addition:
                gr.ShowPangoText(String.Format(Translations.GetString("x + y = {0}"), op1));
                break;

            case SubGameTypes.Subtraction:
                gr.ShowPangoText(String.Format(Translations.GetString("x - y = {0}"), op1));
                break;

            default:
                throw new InvalidOperationException();
            }

            gr.MoveTo(x, DrawAreaY + 0.44);
            gr.ShowPangoText(String.Format(Translations.GetString("x * y = {0}"), op2));
        }
Exemple #3
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            const double SEPARATION = 0.05;
            double       x = DrawAreaX, y = 0.05;

            base.Draw(gr, area_width, area_height, rtl);
            gr.SetPangoLargeFontSize();

            gr.MoveTo(0.05, y);
            gr.SetPangoLargeFontSize();
            gr.ShowPangoText(Translations.GetString("Numbers"));
            y += 0.08;

            x = ((1 - (DrawAreaX * 2) - SEPARATION * numbers.Length) / 2) + DrawAreaX;
            for (int n = 0; n < numbers.Length; n++)
            {
                gr.MoveTo(x, y);
                gr.ShowPangoText(numbers[n].ToString());
                gr.Stroke();
                x += SEPARATION;
            }

            gr.MoveTo(0.1, 0.25);
            gr.ShowPangoText(Translations.GetString("Choose one of the following:"));
        }
Exemple #4
0
        private void UpdateOrientation()
        {
            if (NewImageWidth < NewImageHeight && !portrait_radio.Active)
            {
                portrait_radio.Activate();
            }
            else if (NewImageWidth > NewImageHeight && !landscape_radio.Active)
            {
                landscape_radio.Activate();
            }

            for (var i = 1; i < preset_combo.GetItemCount(); i++)
            {
                var text = preset_combo.GetValueAt <string> (i);

                if (text == Translations.GetString("Clipboard") || text == Translations.GetString("Custom"))
                {
                    continue;
                }

                var text_parts = text.Split('x');
                var width      = int.Parse(text_parts[0].Trim());
                var height     = int.Parse(text_parts[1].Trim());

                var new_size = new Gdk.Size(NewImageWidth < NewImageHeight ? Math.Min(width, height) : Math.Max(width, height), NewImageWidth < NewImageHeight ? Math.Max(width, height) : Math.Min(width, height));
                var new_text = string.Format("{0} x {1}", new_size.Width, new_size.Height);

                preset_combo.SetValueAt(i, new_text);
            }
        }
        public AboutPintaTabPage()
        {
            Label label = new Label();

            label.Selectable = true;
            label.Markup     = String.Format(
                "<b>{0}</b>\n    {1}",
                Translations.GetString("Version"),
                PintaCore.ApplicationVersion);

            HBox hBoxVersion = new HBox();

            hBoxVersion.PackStart(label, false, false, 5);
            this.PackStart(hBoxVersion, false, true, 5);

            label        = new Label();
            label.Markup = string.Format("<b>{0}</b>\n    {1}", Translations.GetString("License"), Translations.GetString("Released under the MIT X11 License."));
            HBox hBoxLicense = new HBox();

            hBoxLicense.PackStart(label, false, false, 5);
            this.PackStart(hBoxLicense, false, true, 5);

            label        = new Label();
            label.Markup = string.Format("<b>{0}</b>\n    (c) 2010-2022 {1}", Translations.GetString("Copyright"), Translations.GetString("by Pinta contributors"));
            HBox hBoxCopyright = new HBox();

            hBoxCopyright.PackStart(label, false, false, 5);
            this.PackStart(hBoxCopyright, false, true, 5);

            this.ShowAll();
        }
        private void Build()
        {
            Resizable = false;

            ContentArea.WidthRequest = 400;
            ContentArea.BorderWidth  = 6;
            ContentArea.Spacing      = 6;

            red_spinbox       = new HScaleSpinButtonWidget();
            red_spinbox.Label = Translations.GetString("Red");
            InitSpinBox(red_spinbox);

            green_spinbox       = new HScaleSpinButtonWidget();
            green_spinbox.Label = Translations.GetString("Green");
            InitSpinBox(green_spinbox);

            blue_spinbox       = new HScaleSpinButtonWidget();
            blue_spinbox.Label = Translations.GetString("Blue");
            InitSpinBox(blue_spinbox);

            link_button        = new CheckButton(Translations.GetString("Linked"));
            link_button.Active = true;
            ContentArea.Add(link_button);

            DefaultWidth  = 400;
            DefaultHeight = 300;
            ShowAll();
        }
Exemple #7
0
        public override void HandleBuildToolBar(Gtk.Toolbar tb, ISettingsService settings, string toolPrefix)
        {
            base.HandleBuildToolBar(tb, settings, toolPrefix);


            if (radius_sep == null)
            {
                radius_sep = new Gtk.SeparatorToolItem();
            }

            tb.AppendItem(radius_sep);

            if (radius_label == null)
            {
                radius_label = new ToolBarLabel(string.Format("  {0}: ", Translations.GetString("Radius")));
            }

            tb.AppendItem(radius_label);

            if (radius == null)
            {
                radius = new (new Gtk.SpinButton(0, 1e5, 1)
                {
                    Value = settings.GetSetting(RADIUS_SETTING(toolPrefix), 20)
                });

                radius.Widget.ValueChanged += (o, e) => {
                    //Go through the Get/Set routine.
                    Radius = Radius;
                };
            }

            tb.AppendItem(radius);
        }
Exemple #8
0
        public void Initialize(Dock workspace, Application app, GLib.Menu padMenu)
        {
            var      layers      = new LayersListWidget();
            DockItem layers_item = new DockItem(layers, "Layers")
            {
                Label = Translations.GetString("Layers")
            };

            var layers_tb = layers_item.AddToolBar();

            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());

            // TODO-GTK3 (docking)
#if false
            layers_item.Icon         = Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerMergeDown, 16);
            layers_item.DefaultWidth = 100;
            layers_item.Behavior    |= DockItemBehavior.CantClose;
#endif
            workspace.AddItem(layers_item, DockPlacement.Right);

            var show_layers = new ToggleCommand("layers", Translations.GetString("Layers"), null, Resources.Icons.LayerMergeDown)
            {
                Value = true
            };
            app.AddAction(show_layers);
            padMenu.AppendItem(show_layers.CreateMenuItem());

            show_layers.Toggled += (val) => { layers_item.Visible = val; };
            layers_item.VisibilityNotifyEvent += (o, args) => { show_layers.Value = layers_item.Visible; };
        }
Exemple #9
0
        public void Initialize(Dock workspace, Application app, GLib.Menu padMenu)
        {
            var      history      = new HistoryTreeView();
            DockItem history_item = new DockItem(history, "History")
            {
                Label = Translations.GetString("History")
            };

            // TODO-GTK3 (docking)
#if false
            history_item.DefaultLocation = "Images/Bottom";
            history_item.Icon            = Gtk.IconTheme.Default.LoadIcon(Resources.Icons.LayerDuplicate, 16);
            history_item.DefaultWidth    = 100;
            history_item.Behavior       |= DockItemBehavior.CantClose;
#endif
            var history_tb = history_item.AddToolBar();
            history_tb.Add(PintaCore.Actions.Edit.Undo.CreateDockToolBarItem());
            history_tb.Add(PintaCore.Actions.Edit.Redo.CreateDockToolBarItem());

            workspace.AddItem(history_item, DockPlacement.Right);

            var show_history = new ToggleCommand("history", Translations.GetString("History"), null, Resources.Icons.LayerDuplicate)
            {
                Value = true
            };
            app.AddAction(show_history);
            padMenu.AppendItem(show_history.CreateMenuItem());

            show_history.Toggled += (val) => { history_item.Visible = val; };
            history_item.VisibilityNotifyEvent += (o, args) => { show_history.Value = history_item.Visible; };
        }
Exemple #10
0
        /// <summary>
        /// Sets up the DashPatternBox in the Toolbar.
        ///
        /// Note that the dash pattern change event response code must be created manually outside of the DashPatternBox
        /// (using the returned Gtk.ComboBox from the SetupToolbar method) so that each tool that uses it
        /// can react to the change in pattern according to its usage.
        ///
        /// Returns null if the DashPatternBox has already been setup; otherwise, returns the DashPatternBox itself.
        /// </summary>
        /// <param name="tb">The Toolbar to add the DashPatternBox to.</param>
        /// <returns>null if the DashPatternBox has already been setup; otherwise, returns the DashPatternBox itself.</returns>
        public Gtk.ComboBoxText?SetupToolbar(Toolbar tb)
        {
            if (dashPatternSep == null)
            {
                dashPatternSep = new SeparatorToolItem();
            }

            tb.AppendItem(dashPatternSep);

            if (dashPatternLabel == null)
            {
                dashPatternLabel = new ToolBarLabel(string.Format(" {0}: ", Translations.GetString("Dash")));
            }

            tb.AppendItem(dashPatternLabel);

            if (comboBox == null)
            {
                comboBox = new ToolBarComboBox(50, 0, true,
                                               "-", " -", " --", " ---", "  -", "   -", " - --", " - - --------", " - - ---- - ----");
            }

            tb.AppendItem(comboBox);

            if (dashChangeSetup)
            {
                return(null);
            }
            else
            {
                dashChangeSetup = true;

                return(comboBox.ComboBox);
            }
        }
Exemple #11
0
        public AboutDialog() : base(string.Empty, PintaCore.Chrome.MainWindow, DialogFlags.Modal)
        {
            Title = Translations.GetString("About Pinta");
            //TransientFor = IdeApp.Workbench.RootWindow;
            Resizable = false;
            IconName  = Pinta.Resources.Icons.AboutPinta;

            ContentArea.BorderWidth = 0;

            aboutPictureScrollBox = new ScrollBox();

            ContentArea.PackStart(aboutPictureScrollBox, false, false, 0);
            imageSep = PintaCore.Resources.GetIcon("About.ImageSep.png");

            ContentArea.PackStart(new Gtk.Image(imageSep), false, false, 0);

            Notebook notebook = new Notebook();

            notebook.BorderWidth = 6;
            notebook.AppendPage(new AboutPintaTabPage(), new Label(Title));
            notebook.AppendPage(new VersionInformationTabPage(), new Label(Translations.GetString("Version Info")));

            ContentArea.PackStart(notebook, true, true, 4);

            AddButton(Gtk.Stock.Close, (int)ResponseType.Close);

            this.Resizable = true;

            ShowAll();
        }
Exemple #12
0
        protected void SetAnswerCorrectShow()
        {
            if (Current == null ||
                Current.MultipleAnswers == false ||
                String.IsNullOrEmpty(Answer.Correct))
            {
                return;
            }

            string [] items;
            string    str = string.Empty;

            items = Answer.Correct.Split(AnalogiesFactory.Separator);

            for (int i = 0; i < items.Length; i++)
            {
                str += items [i].Trim();
                if (i + 1 < items.Length)
                {
                    // Translators: this the separator used when concatenating multiple possible answers for verbal analogies
                    // For example: "Possible correct answers are: sleep, rest."
                    str += Translations.GetString(", ");
                }
            }
            Answer.CorrectShow = str;
        }
Exemple #13
0
        private string GetLayerPropertyUpdateMessage(LayerProperties initial, LayerProperties updated)
        {
            string?ret   = null;
            int    count = 0;

            if (updated.Opacity != initial.Opacity)
            {
                ret = Translations.GetString("Layer Opacity");
                count++;
            }

            if (updated.Name != initial.Name)
            {
                ret = Translations.GetString("Rename Layer");
                count++;
            }

            if (updated.Hidden != initial.Hidden)
            {
                ret = (updated.Hidden) ? Translations.GetString("Hide Layer") : Translations.GetString("Show Layer");
                count++;
            }

            if (ret == null || count > 1)
            {
                ret = Translations.GetString("Layer Properties");
            }

            return(ret);
        }
Exemple #14
0
 private static void ShowHelp(OptionSet p)
 {
     Console.WriteLine(Translations.GetString("Usage: pinta [files]"));
     Console.WriteLine();
     Console.WriteLine(Translations.GetString("Options: "));
     p.WriteOptionDescriptions(Console.Out);
 }
        private void Activated(object sender, EventArgs e)
        {
            // Commit any pending changes
            PintaCore.Tools.Commit();

            // If it's not dirty, just close it
            if (!PintaCore.Workspace.ActiveDocument.IsDirty)
            {
                PintaCore.Workspace.CloseActiveDocument();
                return;
            }

            var primary   = Translations.GetString("Save changes to image \"{0}\" before closing?");
            var secondary = Translations.GetString("If you don't save, all changes will be permanently lost.");
            var message   = string.Format(markup, primary, secondary);

            using var md = new MessageDialog(PintaCore.Chrome.MainWindow, DialogFlags.Modal,
                                             MessageType.Question, ButtonsType.None, true,
                                             message, System.IO.Path.GetFileName(PintaCore.Workspace.ActiveDocument.Filename));

            // Use the standard button order for each OS.
            Widget closeButton;

            if (PintaCore.System.OperatingSystem == OS.Windows)
            {
                md.AddButton(Stock.Save, ResponseType.Yes);
                closeButton = md.AddButton(Translations.GetString("Close _without Saving"), ResponseType.No);
                md.AddButton(Stock.Cancel, ResponseType.Cancel);
            }
            else
            {
                closeButton = md.AddButton(Translations.GetString("Close _without Saving"), ResponseType.No);
                md.AddButton(Stock.Cancel, ResponseType.Cancel);
                md.AddButton(Stock.Save, ResponseType.Yes);
            }

            // Style the close button as being a destructive action.
            // (https://developer.gnome.org/hig/stable/buttons.html.en)
            closeButton.StyleContext.AddClass("destructive-action");

            md.DefaultResponse = ResponseType.Yes;

            ResponseType response = (ResponseType)md.Run();

            if (response == ResponseType.Yes)
            {
                PintaCore.Workspace.ActiveDocument.Save(false);

                // If the image is still dirty, the user
                // must have cancelled the Save dialog
                if (!PintaCore.Workspace.ActiveDocument.IsDirty)
                {
                    PintaCore.Workspace.CloseActiveDocument();
                }
            }
            else if (response == ResponseType.No)
            {
                PintaCore.Workspace.CloseActiveDocument();
            }
        }
Exemple #16
0
        protected override void Initialize()
        {
            int      hour;
            DateTime now;

            after = 4 + random.Next(3);
            hour  = 2 + random.Next(3);
            now   = DateTime.Now;

            position_a = new DateTime(now.Year, now.Month, now.Day, hour, 0, 0);
            position_b = new DateTime(now.Year, now.Month, now.Day, hour + 12, 0, 0);
            ans        = new DateTime(now.Year, now.Month, now.Day, ((hour + hour + 12) / 2) + after, 0, 0);

            if (position_b != ans)
            {
                sample = position_b;
            }
            else
            {
                sample = position_a;
            }

            // TimeNow Puzzle. Translators: {0} is used to check the hour answered by the user.
            // Use the right time format specification for your culture
            // Explanation of the date and time format specifications can be found here:
            // http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx
            // For 12-hour clock format use {0:%h} and for 24-hour clock format use {0:%H}. The date formats {0:h} and {0:H} are invalid.
            // 'tt' is the A.M./P.M. designator
            Answer.Correct         = String.Format(Translations.GetString("{0:h tt}"), ans);
            Answer.CheckAttributes = GameAnswerCheckAttributes.IgnoreCase | GameAnswerCheckAttributes.IgnoreSpaces;
        }
Exemple #17
0
        // A string of for format "A, B or C
        public string GetMultiOptionsPossibleAnswers(int num_answers)
        {
            switch (num_answers)
            {
            case 0:
            case 1:
                throw new InvalidOperationException("You need more than 1 answer to select from");

            case 2:
                // Translators. This is the list of valid answers, like A or B.
                return(String.Format(Translations.GetString("{0} or {1}"),
                                     GetMultiOption(0), GetMultiOption(1)));

            case 3:
                // Translators. This is the list of valid answers, like A, B or C.
                return(String.Format(Translations.GetString("{0}, {1} or {2}"),
                                     GetMultiOption(0), GetMultiOption(1), GetMultiOption(2)));

            case 4:
                // Translators. This is the list of valid answers, like A, B, C or D.
                return(String.Format(Translations.GetString("{0}, {1}, {2} or {3}"),
                                     GetMultiOption(0), GetMultiOption(1), GetMultiOption(2), GetMultiOption(3)));

            default:
                throw new InvalidOperationException("Number of multiple options not supported");
            }
        }
        private bool ConfirmOverwrite(IFileChooser fcd, string file)
        {
            string primary   = Translations.GetString("A file named \"{0}\" already exists. Do you want to replace it?");
            string secondary = Translations.GetString("The file already exists in \"{1}\". Replacing it will overwrite its contents.");
            string message   = string.Format(markup, primary, secondary);

            using var md = new MessageDialog(PintaCore.Chrome.MainWindow, DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                             MessageType.Question, ButtonsType.None,
                                             true, message, System.IO.Path.GetFileName(file), fcd.CurrentFolder);

            // Use the standard button order for each OS.
            if (PintaCore.System.OperatingSystem == OS.Windows)
            {
                md.AddButton(Translations.GetString("Replace"), ResponseType.Ok);
                md.AddButton(Stock.Cancel, ResponseType.Cancel);
            }
            else
            {
                md.AddButton(Stock.Cancel, ResponseType.Cancel);
                md.AddButton(Translations.GetString("Replace"), ResponseType.Ok);
            }

            md.DefaultResponse = ResponseType.Cancel;

            int response = md.Run();

            return(response == (int)ResponseType.Ok);
        }
Exemple #19
0
        void DrawingAnswerObjects()
        {
            Container container = new Container(DrawAreaX + 0.2, DrawAreaY + 0.4, 0.5, answers.Length * 0.10);

            AddWidget(container);

            for (int i = 0; i < answers.Length; i++)
            {
                DrawableArea drawable_area = new DrawableArea(0.4, 0.1);
                drawable_area.X = DrawAreaX + 0.23;
                drawable_area.Y = DrawAreaY + 0.4 + i * 0.1;
                container.AddChild(drawable_area);
                drawable_area.Data   = i;
                drawable_area.DataEx = Answer.GetMultiOption(i);

                drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e)
                {
                    int d = (int)e.Data;
                    e.Context.SetPangoLargeFontSize();
                    e.Context.MoveTo(0.07, 0.02);
                    e.Context.ShowPangoText(String.Format(Translations.GetString("{0}) {1}"), Answer.GetMultiOption(d),
                                                          converter.ToString(answers[d])));
                };
            }
        }
Exemple #20
0
        public ResizeImageDialog() : base(Translations.GetString("Resize Image"), PintaCore.Chrome.MainWindow,
                                          DialogFlags.Modal,
                                          Core.GtkExtensions.DialogButtonsCancelOk())
        {
            Build();

            aspectCheckbox.Active = true;

            widthSpinner.Value  = PintaCore.Workspace.ImageSize.Width;
            heightSpinner.Value = PintaCore.Workspace.ImageSize.Height;

            percentageRadio.Toggled += new EventHandler(percentageRadio_Toggled);
            absoluteRadio.Toggled   += new EventHandler(absoluteRadio_Toggled);
            percentageRadio.Toggle();

            percentageSpinner.Value         = 100;
            percentageSpinner.ValueChanged += new EventHandler(percentageSpinner_ValueChanged);

            widthSpinner.ValueChanged  += new EventHandler(widthSpinner_ValueChanged);
            heightSpinner.ValueChanged += new EventHandler(heightSpinner_ValueChanged);

            DefaultResponse = Gtk.ResponseType.Ok;

            widthSpinner.ActivatesDefault      = true;
            heightSpinner.ActivatesDefault     = true;
            percentageSpinner.ActivatesDefault = true;
            percentageSpinner.GrabFocus();
        }
        protected override void Initialize()
        {
            Current = GetNext();

            if (Current == null || Current.answers == null)
            {
                return;
            }

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
            Answer.SetMultiOptionAnswer(Current.right, Current.answers[Current.right]);

            Container container = new Container(DrawAreaX, DrawAreaY + 0.2, 0.8, Current.answers.Length * 0.15);

            AddWidget(container);

            for (int i = 0; i < Current.answers.Length; i++)
            {
                DrawableArea drawable_area = new DrawableArea(0.8, 0.1);
                drawable_area.X = DrawAreaX;
                drawable_area.Y = DrawAreaY + 0.2 + i * 0.15;
                container.AddChild(drawable_area);
                drawable_area.Data   = i;
                drawable_area.DataEx = Answer.GetMultiOption(i);

                drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e)
                {
                    int n = (int)e.Data;

                    e.Context.MoveTo(0.05, 0.02);
                    e.Context.ShowPangoText(String.Format(Translations.GetString("{0}) {1}"), Answer.GetMultiOption(n), Current.answers[n].ToString()));
                };
            }
            SetAnswerCorrectShow();
        }
Exemple #22
0
        Fact GetFact(int index)
        {
            Fact fact = new Fact();

            switch (index)
            {
            case 0:
                fact.Initialize(2);
                fact.answers [0] = 2 + random.Next(14);
                fact.answers [1] = 1914 + random.Next(50);
                fact.fact        = String.Format(
                    // Translators: {0} is replaced by a number, {1} by a year (like 1940)
                    // Day in English does not need to be plural
                    Translations.GetPluralString("Shiny Cars had already announced a {0} day production halt next month, but before then it had not halted production since {1}.",
                                                 "Shiny Cars had already announced a {0} day production halt next month, but before then it had not halted production since {1}.",
                                                 fact.answers [0]),
                    fact.answers [0], fact.answers [1]);
                fact.questions [0] = Translations.GetString("How many days did Shiny Cars halt its production for?");
                fact.questions [1] = Translations.GetString("In what year did Shiny Cars last halt its production?");
                break;

            case 1:
                fact.Initialize(2);
                fact.answers [0] = 10 + random.Next(30);
                fact.answers [1] = 1914 + random.Next(50);
                fact.fact        = String.Format(
                    // Translators: {0} is replaced by a number, {1} by a year (like 1940)
                    Translations.GetString("Shiny Cars sales fell {0}% this past December, the worst decline since {1}."),
                    fact.answers [0], fact.answers [1]);
                fact.questions [0] = Translations.GetString("By how much did company sales fall last December?");
                fact.questions [1] = String.Format(
                    Translations.GetString("Shiny Cars sales fell {0}% this past December. This is the worst decline since which year?"),
                    fact.answers [0]);
                break;

            case 2:
                fact.Initialize(1);
                fact.answers [0] = 10 + random.Next(30);
                fact.fact        = String.Format(Translations.GetString("About {0}% of Shiny Cars produced worldwide are sold in Europe."),
                                                 fact.answers [0]);
                fact.questions [0] = Translations.GetString("What percentage of all Shiny Cars produced worldwide are sold in Europe?");
                break;

            case 3:
                fact.Initialize(2);
                fact.answers [0] = 10 + random.Next(30);
                fact.answers [1] = 100 - (1 + random.Next(10)) - fact.answers [0];
                fact.fact        = String.Format(Translations.GetString("About {0}% of Shiny Cars use diesel, {1}% use gasoline and the remainder use electricity."),
                                                 fact.answers [0], fact.answers [1]);
                fact.questions [0] = Translations.GetString("What percentage of Shiny Cars use diesel?");
                fact.questions [1] = Translations.GetString("What percentage of Shiny Cars use gasoline?");
                break;

            default:
                throw new Exception("Invalid index value");
            }

            return(fact);
        }
Exemple #23
0
        public static void ShowClipboardEmptyDialog()
        {
            var primary   = Translations.GetString("Image cannot be pasted");
            var secondary = Translations.GetString("The clipboard does not contain an image.");
            var markup    = $"<span weight=\"bold\" size=\"larger\">{primary}</span>\n\n{secondary}\n";

            DialogExtensions.ShowErrorDialog(markup);
        }
Exemple #24
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            base.Draw(gr, area_width, area_height, rtl);
            gr.DrawImageFromAssembly("people_table.svg", 0.2, 0.2, 0.6, 0.6);

            gr.DrawTextCentered(0.5, 0.85,
                                Translations.GetString("Two people in the table sitting across from each other"));
        }
Exemple #25
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            base.Draw(gr, area_width, area_height, rtl);

            gr.DrawClock(DrawAreaX + 0.15, DrawAreaY + 0.1, figure_size, 0, 0 /* No hands */);
            gr.SetPangoLargeFontSize();
            gr.DrawTextCentered(0.5, DrawAreaY + 0.2 + figure_size, Translations.GetString("Sample clock"));
        }
Exemple #26
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            base.Draw(gr, area_width, area_height, rtl);

            gr.MoveTo(0.1, 0.3);
            gr.ShowPangoText(Translations.GetString("Choose one of the following:"));
            gr.Stroke();
        }
Exemple #27
0
        private void Activated(object sender, EventArgs e)
        {
            using var fcd = new FileChooserNative(
                      Translations.GetString("Open Image File"),
                      PintaCore.Chrome.MainWindow,
                      FileChooserAction.Open,
                      Translations.GetString("Open"),
                      Translations.GetString("Cancel"));

            // Add image files filter
            var ff = new FileFilter {
                Name = Translations.GetString("Image files")
            };

            foreach (var format in PintaCore.System.ImageFormats.Formats)
            {
                if (!format.IsWriteOnly())
                {
                    foreach (var ext in format.Extensions)
                    {
                        ff.AddPattern(string.Format("*.{0}", ext));
                    }
                }
            }

            fcd.AddFilter(ff);

            var ff2 = new FileFilter {
                Name = Translations.GetString("All files")
            };

            ff2.AddPattern("*.*");
            fcd.AddFilter(ff2);

            fcd.SetCurrentFolder(PintaCore.System.GetDialogDirectory());
            fcd.SelectMultiple = true;

            var response = (ResponseType)fcd.Run();

            if (response == ResponseType.Accept)
            {
                PintaCore.System.LastDialogDirectory = fcd.CurrentFolder;

                foreach (var file in fcd.Filenames)
                {
                    if (PintaCore.Workspace.OpenFile(file))
                    {
                        RecentManager.Default.AddFull(fcd.Uri, PintaCore.System.RecentData);

                        var directory = System.IO.Path.GetDirectoryName(file);
                        if (directory is not null)
                        {
                            PintaCore.System.LastDialogDirectory = directory;
                        }
                    }
                }
            }
        }
Exemple #28
0
        // Protect from calling with null (exception)
        internal string CatalogGetString(string str)
        {
            if (String.IsNullOrEmpty(str))
            {
                return(str);
            }

            return(Translations.GetString(str));
        }
Exemple #29
0
        public void RegisterRepositories(bool enable)
        {
            RegisterRepository(GetPlatformRepositoryUrl(),
                               Translations.GetString("Pinta Community Addins - Platform-Specific"),
                               enable);

            RegisterRepository(GetAllRepositoryUrl(),
                               Translations.GetString("Pinta Community Addins - Cross-Platform"),
                               enable);
        }
Exemple #30
0
        public static ResponseType ShowExpandCanvasDialog()
        {
            var primary   = Translations.GetString("Image larger than canvas");
            var secondary = Translations.GetString("The image being pasted is larger than the canvas size. What would you like to do?");
            var markup    = $"<span weight=\"bold\" size=\"larger\">{primary}</span>\n\n{secondary}";

            return(DialogExtensions.ShowQuestionDialog(markup,
                                                       new DialogButton(Translations.GetString("Expand canvas"), ResponseType.Accept, true),
                                                       new DialogButton(Translations.GetString("Don't change canvas size"), ResponseType.Reject),
                                                       new DialogButton(Stock.Cancel, ResponseType.Cancel)));
        }