public void Initialize()
        {
            InitialiseExtensions();

            var settings = settingsService.GetSettings <MarkPadSettings>();
            var blogs    = blogService.GetBlogs();

            Blogs = new ObservableCollection <BlogSetting>(blogs);

            Languages    = Enum.GetValues(typeof(SpellingLanguages)).OfType <SpellingLanguages>().ToArray();
            FontSizes    = Enum.GetValues(typeof(FontSizes)).OfType <FontSizes>().ToArray();
            FontFamilies = Fonts.SystemFontFamilies.OrderBy(f => f.Source);

            SelectedLanguage = settings.Language;

            var fontFamily = settings.FontFamily;

            SelectedFontFamily = Fonts.SystemFontFamilies.FirstOrDefault(f => f.Source == fontFamily);
            SelectedFontSize   = settings.FontSize;

            if (SelectedFontFamily == null)
            {
                SelectedFontFamily = FontHelpers.TryGetFontFamilyFromStack(Constants.DEFAULT_EDITOR_FONT_FAMILY);
                SelectedFontSize   = Constants.DEFAULT_EDITOR_FONT_SIZE;
            }
            EnableFloatingToolBar = settings.FloatingToolBarEnabled;

            Plugins = plugins
                      .Where(plugin => !plugin.IsHidden)
                      .Select(plugin => pluginViewModelCreator(plugin));
        }
        private FontFamily GetFontFamily()
        {
            var configuredSource = settings.FontFamily;
            var fontFamily       = FontHelpers.TryGetFontFamilyFromStack(configuredSource, "Segoe UI", "Arial");

            if (fontFamily == null)
            {
                throw new Exception("Cannot find configured font family or fallback fonts");
            }
            return(fontFamily);
        }
Esempio n. 3
0
        public RenderingQueueWindow(RenderingQueue renderingQueue) :
            base(WindowType.Toplevel)
        {
            this.Build();

            title_Label.ModifyFont(FontHelpers.ScaleFontSize(title_Label, 1.4));

            // Adding queue event handlers
            mRenderingQueue = renderingQueue;
            mRenderingQueue.QueueProgressMessageReport += HandleRenderingQueueProgressMessageReport;
            mRenderingQueue.ItemAdded                   += HandleRenderingQueueItemAdded;
            mRenderingQueue.ItemIndexChanged            += HandleRenderingQueueItemIndexChanged;
            mRenderingQueue.ItemRemoved                 += HandleRenderingQueueItemRemoved;
            mRenderingQueue.BeforeItemProcessingStarted += HandleRenderingQueueBeforeItemProcessingStarted;
            mRenderingQueue.AfterItemProcessingFinished += HandleRenderingQueueAfterItemProcessingFinished;
            mRenderingQueue.ThreadStarted               += HandleRenderingQueueThreadStarted;
            mRenderingQueue.ThreadStopped               += HandleRenderingQueueThreadStopped;
            mRenderingQueue.QueueEmpty                  += HandleRenderingQueueQueueEmpty;
            mRenderingQueue.ItemRendering               += HandleRenderingQueueItemRendering;

            // Creating status icon

            string icon_res;

            if (System.Environment.OSVersion.Platform == PlatformID.Unix)
            {
                icon_res = "CatEye.UI.Gtk.res.svg-inkscape.cateye-small.svg";
            }
            else
            {
                // Windows, I hope.
                icon_res = "CatEye.UI.Gtk.res.png.cateye-small-16x16.png";
            }

            mProcessingStatusIcon           = new StatusIcon(Gdk.Pixbuf.LoadFromResource(icon_res));
            mProcessingStatusIcon.Visible   = false;            // In Windows status icon appears visible by default
            mProcessingStatusIcon.Activate += HandleProcessingStatusIconActivate;

            // Preparing queue list
            mQueueNodeStore          = new NodeStore(typeof(RenderingTaskTreeNode));
            queue_nodeview.NodeStore = mQueueNodeStore;

            queue_nodeview.AppendColumn("Source", new CellRendererText(), "text", 0);
            queue_nodeview.AppendColumn("Destination", new CellRendererText(), "text", 1);

            expander1.Expanded    = false;
            queue_GtkLabel.Markup = "<b>Queue (" + mRenderingQueue.Queue.Length + " left)</b>";
        }
Esempio n. 4
0
        public void CheckProduct()
        {
            driver.Url = "http://localhost/litecart/en/";

            //First product in Campaigns
            IWebElement product = driver.FindElement(By.XPath("//div[@id = 'box-campaigns']//a[@class = 'link']/div[@class='name']/.."));

            //Get elements and attributes from Main page
            string      nameMainPage                  = product.FindElement(By.XPath(".//div[@class = 'name']")).GetAttribute("innerText");
            IWebElement campaignPriceMainPage         = product.FindElement(By.XPath(".//strong[@class = 'campaign-price']"));
            IWebElement regularPriceMainPage          = product.FindElement(By.XPath(".//s[@class = 'regular-price']"));
            string      valueOfCampaignPriceMainPage  = campaignPriceMainPage.GetAttribute("innerText");
            string      valueOfRegularPriceMainPage   = regularPriceMainPage.GetAttribute("innerText");
            string      colorCampaignPriceMainPage    = campaignPriceMainPage.GetCssValue("color");
            string      colorRegularPriceMainPage     = regularPriceMainPage.GetCssValue("color");
            string      fontSizeCampaignPriceMainPage = campaignPriceMainPage.GetCssValue("font-size");
            string      fontSizeRegularPriceMainPage  = regularPriceMainPage.GetCssValue("font-size");

            //Asserts on Main page
            Assert.That(ColorHelpers.isGray(colorRegularPriceMainPage), Is.True);
            Assert.That(ColorHelpers.isRed(colorCampaignPriceMainPage), Is.True);
            Assert.That(FontHelpers.GetFontSizeValue(fontSizeCampaignPriceMainPage), Is.GreaterThan(FontHelpers.GetFontSizeValue(fontSizeRegularPriceMainPage)));

            product.Click();

            //Product box on Product page
            IWebElement productBox = driver.FindElement(By.XPath("//div[@id = 'box-product']"));

            //Get elements and attributes from Product page
            string      nameProductPage                  = productBox.FindElement(By.XPath(".//h1")).GetAttribute("innerText");
            IWebElement campaignPriceProductPage         = productBox.FindElement(By.XPath(".//strong[@class = 'campaign-price']"));
            IWebElement regularPriceProductPage          = productBox.FindElement(By.XPath(".//s[@class = 'regular-price']"));
            string      valueOfCampaignPriceProductPage  = campaignPriceProductPage.GetAttribute("innerText");
            string      valueOfRegularPriceProductPage   = regularPriceProductPage.GetAttribute("innerText");
            string      colorCampaignPriceProductPage    = campaignPriceProductPage.GetCssValue("color");
            string      colorRegularPriceProductPage     = regularPriceProductPage.GetCssValue("color");
            string      fontSizeCampaignPriceProductPage = campaignPriceProductPage.GetCssValue("font-size");
            string      fontSizeRegularPriceProductPage  = regularPriceProductPage.GetCssValue("font-size");

            //Asserts on Product page
            Assert.That(nameMainPage, Is.EqualTo(nameProductPage));
            Assert.That(valueOfCampaignPriceMainPage, Is.EqualTo(valueOfCampaignPriceProductPage));
            Assert.That(valueOfRegularPriceMainPage, Is.EqualTo(valueOfRegularPriceProductPage));
            Assert.That(ColorHelpers.isGray(colorRegularPriceProductPage), Is.True);
            Assert.That(ColorHelpers.isRed(colorCampaignPriceProductPage), Is.True);
            Assert.That(FontHelpers.GetFontSizeValue(fontSizeCampaignPriceProductPage), Is.GreaterThan(FontHelpers.GetFontSizeValue(fontSizeRegularPriceProductPage)));
        }
Esempio n. 5
0
        void UpdateDisplayOptions()
        {
            var displayOptions = Common.Instance.DisplayOptions;

            var scheme = ColorTheme.GetHighlightingScheme(displayOptions.ColorTheme);

            this._currentHighlightDefinition = ColorTheme.GetDefinition(scheme);

            string fontFamily = "Consolas";

            if (FontHelpers.IsFontFamilyExist(displayOptions.FontName))
            {
                fontFamily = displayOptions.FontName;
            }
            this.BytecodeListing.FontFamily         = new FontFamily(fontFamily);
            this.BytecodeListing.FontSize           = displayOptions.FontSize;
            this.BytecodeListing.ShowLineNumbers    = displayOptions.LineNumbers;
            this.BytecodeListing.SyntaxHighlighting = this._currentHighlightDefinition;
        }
Esempio n. 6
0
        public void Initialize()
        {
            using (var key = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Classes"))
            {
                Extensions = Constants.DefaultExtensions
                             .Select(s => new ExtensionViewModel(s,
                                                                 key.GetSubKeyNames().Contains(s) && !string.IsNullOrEmpty(key.OpenSubKey(s).GetValue("").ToString())))
                             .ToArray();
            }

            var settings = settingsService.GetSettings <MarkPadSettings>();
            var blogs    = settings.GetBlogs();

            Blogs = new ObservableCollection <BlogSetting>(blogs);

            Languages    = Enum.GetValues(typeof(SpellingLanguages)).OfType <SpellingLanguages>().ToArray();
            FontSizes    = Enum.GetValues(typeof(FontSizes)).OfType <FontSizes>().ToArray();
            FontFamilies = Fonts.SystemFontFamilies.OrderBy(f => f.Source);

            var spellCheckPlugin = plugins.OfType <SpellCheckPlugin.SpellCheckPluginSettings>().FirstOrDefault();

            SelectedLanguage = spellCheckPlugin != null ? spellCheckPlugin.Language : SpellingLanguages.UnitedStates;

            var fontFamily = settings.FontFamily;

            SelectedFontFamily = Fonts.SystemFontFamilies.FirstOrDefault(f => f.Source == fontFamily);
            SelectedFontSize   = settings.FontSize;

            if (SelectedFontFamily == null)
            {
                SelectedFontFamily = FontHelpers.TryGetFontFamilyFromStack(Constants.DEFAULT_EDITOR_FONT_FAMILY);
                SelectedFontSize   = Constants.DEFAULT_EDITOR_FONT_SIZE;
            }
            EnableFloatingToolBar = settings.FloatingToolBarEnabled;

            Plugins = plugins
                      .Where(plugin => !plugin.IsHidden)
                      .Select(plugin => pluginViewModelCreator(plugin));
        }
Esempio n. 7
0
        public void LoadFromFile(XmlTextReader xmlIn)
        {
            Canvas.SetLeft(this, Convert.ToDouble(xmlIn.GetAttribute("Left")));
            Canvas.SetTop(this, Convert.ToDouble(xmlIn.GetAttribute("Top")));
            this.Width      = Convert.ToDouble(xmlIn.GetAttribute("Width"));
            this.Height     = Convert.ToDouble(xmlIn.GetAttribute("Height"));
            ForegroundColor = Color.FromArgb(
                Convert.ToByte(xmlIn.GetAttribute("FontColorA")),
                Convert.ToByte(xmlIn.GetAttribute("FontColorR")),
                Convert.ToByte(xmlIn.GetAttribute("FontColorG")),
                Convert.ToByte(xmlIn.GetAttribute("FontColorB"))
                );
            ((ContentControl)this).RenderTransform = new RotateTransform(Convert.ToDouble(xmlIn.GetAttribute("RotateTransformAngle")));

            FontSize = Convert.ToDouble(xmlIn.GetAttribute("FontSize"));
            FontFamily ff = FontHelpers.GetFontBySource(xmlIn.GetAttribute("FontSource"));

            if (ff != null)
            {
                FontFamily = ff;
            }
            LoadAdditionalData(xmlIn);
        }
 public void ResetFont()
 {
     SelectedFontFamily = FontHelpers.TryGetFontFamilyFromStack(Constants.DEFAULT_EDITOR_FONT_FAMILY);
     SelectedFontSize   = Constants.DEFAULT_EDITOR_FONT_SIZE;
 }
Esempio n. 9
0
        public AboutBox()
        {
            this.Build();

            title_label.ModifyFont(FontHelpers.ScaleFontSize(title_label, 2));
        }
Esempio n. 10
0
    protected void OnTogglebuttonToggled(object sender, System.EventArgs e)
    {
        if (addNewOperation_togglebutton.Active)
        {
            Menu menu = new Menu();
            int  w, h;
            menu.GetSizeRequest(out w, out h);
            int menu_width = left_vbox.Allocation.Width;

            menu.SetSizeRequest(menu_width, h);

            Dictionary <MenuItem, Type> stage_operation_types = new Dictionary <MenuItem, Type>();

            for (int i = 0; i < mStageOperationTypes.Length; i++)
            {
                string name = StageOperationDescriptionAttribute.GetName(mStageOperationTypes[i]);
                if (name == null)
                {
                    name = mStageOperationTypes[i].Name;
                }
                string description = StageOperationDescriptionAttribute.GetDescription(mStageOperationTypes[i]);

                MenuItem item = new MenuItem();

                VBox item_vbox = new VBox();
                item_vbox.BorderWidth = 4;
                item_vbox.Show();


                Label lbl_name = new Label();
                lbl_name.Text    = name;
                lbl_name.Justify = Justification.Left;
                lbl_name.Xalign  = 0;

                // Setting the name font
                double name_size_k            = 1.1;
                Pango.FontDescription name_fd = FontHelpers.ScaleFontSize(lbl_name, name_size_k);
                name_fd.Weight = Pango.Weight.Bold;
                lbl_name.ModifyFont(name_fd);

                item_vbox.Add(lbl_name);
                lbl_name.Show();

                if (description != null && description != "")
                {
                    Label lbl_desc = new Label(description);
                    lbl_desc.LineWrapMode = Pango.WrapMode.Word;
                    lbl_desc.LineWrap     = true;
                    lbl_desc.Wrap         = true;

                    // Setting the description font
                    double desc_size_k            = 0.9;
                    Pango.FontDescription desc_fd = FontHelpers.ScaleFontSize(lbl_desc, desc_size_k);
                    lbl_desc.ModifyFont(desc_fd);

                    item_vbox.Add(lbl_desc);
                    lbl_desc.Show();
                    item_vbox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                        lbl_desc.WidthRequest = args.Allocation.Width - 10;
                    };
                }

                item.Child = item_vbox;
                stage_operation_types.Add(item, mStageOperationTypes[i]);

                item.Activated += delegate(object s, EventArgs ea) {
                    mStage.CreateAndAddNewItem(stage_operation_types[(MenuItem)s]).Active = true;
                    GtkScrolledWindow.HscrollbarPolicy  = PolicyType.Never;
                    GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
                    ArrangeVBoxes();
                };

                menu.Append(item);
                item_vbox.CheckResize();
                //lbl_desc.WidthRequest = ww;
            }
            menu.Deactivated += delegate {
                addNewOperation_togglebutton.Active = false;
            };

            menu.ShowAll();
            menu.Popup(null, null, delegate(Menu m, out int x, out int y, out bool push_in) {
                int x1, y1, x0, y0;
                GdkWindow.GetOrigin(out x0, out y0);
                left_vbox.TranslateCoordinates(this, 0, 0, out x1, out y1);
                x       = x0 + x1;
                y       = y0 + y1;
                push_in = false;
            }, 0, 0);
        }
    }