Ejemplo n.º 1
0
        public ViewConfigStrip()
        {
            this.SuspendLayout();
            InitializeComponent();

            this.windowText       = EnumLocalizer.EnumValueToLocalizedName(typeof(ZoomBasis), ZoomBasis.FitToWindow);
            this.percentageFormat = PdnResources.GetString("ZoomConfigWidget.Percentage.Format");

            double[] zoomValues = ScaleFactor.PresetValues;

            this.zoomComboBox.ComboBox.SuspendLayout();

            string percent100 = null; // ScaleFactor.PresetValues guarantees that 1.0, or "100%" is in the list, but the compiler can't be shown this so we must assign a value here

            for (int i = zoomValues.Length - 1; i >= 0; --i)
            {
                string zoomValueString = (zoomValues[i] * 100.0).ToString();
                string zoomItemString  = string.Format(this.percentageFormat, zoomValueString);

                if (zoomValues[i] == 1.0)
                {
                    percent100 = zoomItemString;
                }

                this.zoomComboBox.Items.Add(zoomItemString);
            }

            this.zoomComboBox.Items.Add(this.windowText);
            this.zoomComboBox.ComboBox.ResumeLayout(false);
            this.zoomComboBox.Size = new Size(UI.ScaleWidth(this.zoomComboBox.Width), zoomComboBox.Height);

            this.unitsLabel.Text = PdnResources.GetString("WorkspaceOptionsConfigWidget.UnitsLabel.Text");

            this.zoomComboBox.Text = percent100;
            this.ScaleFactor       = ScaleFactor.OneToOne;

            this.zoomOutButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomOutIcon.png").Reference;
            this.zoomInButton.Image  = PdnResources.GetImageResource("Icons.MenuViewZoomInIcon.png").Reference;
            this.gridButton.Image    = PdnResources.GetImageResource("Icons.MenuViewGridIcon.png").Reference;
            this.rulersButton.Image  = PdnResources.GetImageResource("Icons.MenuViewRulersIcon.png").Reference;

            this.zoomOutButton.ToolTipText = PdnResources.GetString("ZoomConfigWidget.ZoomOutButton.ToolTipText");
            this.zoomInButton.ToolTipText  = PdnResources.GetString("ZoomConfigWidget.ZoomInButton.ToolTipText");
            this.gridButton.ToolTipText    = PdnResources.GetString("WorkspaceOptionsConfigWidget.DrawGridToggleButton.ToolTipText");
            this.rulersButton.ToolTipText  = PdnResources.GetString("WorkspaceOptionsConfigWidget.RulersToggleButton.ToolTipText");

            this.unitsComboBox.Size = new Size(UI.ScaleWidth(this.unitsComboBox.Width), unitsComboBox.Height);

            this.zoomBasis = ZoomBasis.ScaleFactor;
            ScaleFactor    = ScaleFactor.OneToOne;

            this.ResumeLayout(false);
        }
Ejemplo n.º 2
0
        public static EnumLocalizer Create(Type enumType)
        {
            if (typeToWrapper == null)
            {
                typeToWrapper = new Hashtable();
            }

            object wrapper = typeToWrapper[enumType];

            if (wrapper == null)
            {
                wrapper = new EnumLocalizer(enumType);
                typeToWrapper[enumType] = wrapper;
            }

            return((EnumLocalizer)wrapper);
        }
Ejemplo n.º 3
0
        public static EnumLocalizer Create(Type enumType)
        {
            if (typeToWrapper == null)
            {
                typeToWrapper = new Hashtable();
            }

            object wrapper = typeToWrapper[enumType];

            if (wrapper == null)
            {
                wrapper = new EnumLocalizer(enumType);
                typeToWrapper[enumType] = wrapper;
            }

            return (EnumLocalizer)wrapper;
        }
Ejemplo n.º 4
0
        public static string EnumValueToLocalizedName(Type enumType, object enumValue)
        {
            EnumLocalizer wrapper = EnumLocalizer.Create(enumType);

            return(wrapper.EnumValueToLocalizedName(enumValue));
        }