Esempio n. 1
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            MenuItem show_pad = (MenuItem)menu.Children[0];

            menu.Remove(show_pad);

            menu.Append(ToolBar.CreateMenuItem());
            menu.Append(PixelGrid.CreateMenuItem());
            menu.Append(Rulers.CreateMenuItem());
            menu.Append(ImageTabs.CreateMenuItem());
            menu.AppendSeparator();

            ImageMenuItem zoomin = ZoomIn.CreateAcceleratedMenuItem(Gdk.Key.plus, Gdk.ModifierType.ControlMask);

            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.equal, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.equal, 0, AccelFlags.Visible));
            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomin.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Add, 0, AccelFlags.Visible));
            menu.Append(zoomin);

            ImageMenuItem zoomout = ZoomOut.CreateAcceleratedMenuItem(Gdk.Key.minus, Gdk.ModifierType.ControlMask);

            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.minus, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.minus, 0, AccelFlags.Visible));
            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            zoomout.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.KP_Subtract, 0, AccelFlags.Visible));
            menu.Append(zoomout);

            ImageMenuItem actualsize = ActualSize.CreateAcceleratedMenuItem(Gdk.Key.Key_0, Gdk.ModifierType.ControlMask);

            actualsize.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask, AccelFlags.Visible));
            menu.Append(actualsize);
            menu.Append(ZoomToWindow.CreateAcceleratedMenuItem(Gdk.Key.B, Gdk.ModifierType.ControlMask));
            //menu.Append (ZoomToSelection.CreateAcceleratedMenuItem (Gdk.Key.B, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append(Fullscreen.CreateAcceleratedMenuItem(Gdk.Key.F11, Gdk.ModifierType.None));

            menu.AppendSeparator();

            Gtk.Action unit_action = new Gtk.Action("RulerUnits", Mono.Unix.Catalog.GetString("Ruler Units"), null, null);
            Menu       unit_menu   = (Menu)menu.AppendItem(unit_action.CreateSubMenuItem()).Submenu;

            unit_menu.Append(Pixels.CreateMenuItem());
            unit_menu.Append(Inches.CreateMenuItem());
            unit_menu.Append(Centimeters.CreateMenuItem());

            menu.AppendSeparator();
            menu.Append(show_pad);
        }
Esempio n. 2
0
        private static void makeBracket()
        {
            OSCADObject cube    = new Cube(new Vector3(Inches.ToMillimeters(2.75), Inches.One, Inches.ToMillimeters(1.25)), true);
            var         outside = cube.Clone();

            ((Cube)outside).Size.X += Inches.Sixteenth;
            ((Cube)outside).Size.Z += Inches.Sixteenth;
            cube = cube.Scale(2, 1, 1).Translate(0, Inches.Sixteenth, 0);

            var obj    = outside - cube;
            var bounds = obj.Bounds();

            obj = obj + getEndCover(outside).Translate(bounds.XMax, 0, 0);
            obj = obj + getEndCover(outside).Translate(-bounds.XMax, 0, 0);

            obj.ToFile("leftBracket").Open();
        }
Esempio n. 3
0
        private void CreateAnnotations(List <Annotation_PointToPoint> list)
        {
            foreach (Annotation_PointToPoint a in list)
            {
                double length = (a.pt2 - a.pt1).magnitude();

                string label = new Inches(length).GetStringWithoutUnits();

                double extra = length - label.Length * a.size - 1;
                if (extra < 0)
                {
                    extra = 0;
                }

                Point3D p1 = new Point3D(a.pt1.x, a.pt1.y, a.pt1.z);
                Point3D p2 = new Point3D(a.pt2.x, a.pt2.y, a.pt2.z);

                Vector3D over = p2 - p1;
                over.Normalize();

                Vector3D up = new Vector3D(a.dir.x, a.dir.y, a.dir.z);

                ScreenSpaceLines3D ss = new ScreenSpaceLines3D();
                ss.Color     = Colors.Black;
                ss.Thickness = LineThickness;
                ss.Points.Add(p1 + up / 2);
                ss.Points.Add(p1 + up * (a.dist + a.size));
                ss.Points.Add(p2 + up / 2);
                ss.Points.Add(p2 + up * (a.dist + a.size));
                if (extra > 0)
                {
                    ss.Points.Add(p1 + up * (a.dist + a.size / 2));
                    ss.Points.Add(p1 + up * (a.dist + a.size / 2) + over * (extra / 2));
                    ss.Points.Add(p2 + up * (a.dist + a.size / 2));
                    ss.Points.Add(p2 + up * (a.dist + a.size / 2) - over * (extra / 2));
                }
                vp.Children.Add(ss);

                ModelVisual3D mv3d = wpfmisc.CreateTextLabel3D(label, Brushes.Black, true, a.size,
                                                               p1 + over * length / 2 + up * (a.dist + a.size / 2),
                                                               over, up);

                vp.Children.Add(mv3d);
            }
        }
        public void Provided_0Inch_And_NullValue_Shuold_Return_False()
        {
            Inches inch = new Inches();

            Assert.IsFalse(inch.Equals(null));
        }
        /// <summary>
        /// Method for converting inch to feet value
        /// </summary>
        /// <param name="inch"></param>
        /// <returns></returns>
        public Feet InchToFeetConverter(Inches inch)
        {
            var inchValue = quantityMeasurementRepository.InchToFeetConverter(inch);

            return(inchValue);
        }
        public override string ToString()
        {
            switch (Type)
            {
            case PropertyType.Null:
                return("null");

            case PropertyType.Calculated:
                return("calculated");

            case PropertyType.Bool:
                return(Bool.ToString());

            case PropertyType.String:
                return("string: " + StringHandle.ToString());

            case PropertyType.MultiValue:
                return("multi: " + MultiValueHandle.ToString());

            case PropertyType.Enum:
                return("enum: " + Enum.ToString());

            case PropertyType.Color:
                return("color: " + Color.ToString());

            case PropertyType.Integer:
                return(Integer.ToString() + " (integer)");

            case PropertyType.Fractional:
                return(Fractional.ToString() + " (fractional)");

            case PropertyType.Percentage:
                return(Percentage.ToString() + "%");

            case PropertyType.AbsLength:
                return(string.Concat(new string[]
                {
                    Points.ToString(),
                    "pt (",
                    Inches.ToString(),
                    "in, ",
                    Millimeters.ToString(),
                    "mm) (abs)"
                }));

            case PropertyType.RelLength:
                return(string.Concat(new string[]
                {
                    Points.ToString(),
                    "pt (",
                    Inches.ToString(),
                    "in, ",
                    Millimeters.ToString(),
                    "mm) (rel)"
                }));

            case PropertyType.Pixels:
                return(Pixels.ToString() + "px");

            case PropertyType.Ems:
                return(Ems.ToString() + "em");

            case PropertyType.Exs:
                return(Exs.ToString() + "ex");

            case PropertyType.HtmlFontUnits:
                return(HtmlFontUnits.ToString() + " (html font units)");

            case PropertyType.RelHtmlFontUnits:
                return(RelativeHtmlFontUnits.ToString() + " (relative html font units)");

            case PropertyType.Multiple:
                return(Integer.ToString() + "*");

            case PropertyType.Milliseconds:
                return(Milliseconds.ToString() + "ms");

            case PropertyType.kHz:
                return(kHz.ToString() + "kHz");

            case PropertyType.Degrees:
                return(Degrees.ToString() + "deg");

            default:
                return("unknown value type");
            }
        }
Esempio n. 7
0
 public void Inches_2_kilometers()
 {
     FloatCompare(0.0000254f, Inches.Kilometers(1));
 }
Esempio n. 8
0
 public void Inches_2_meters()
 {
     FloatCompare(0.0254f, Inches.Meters(1));
 }
Esempio n. 9
0
 public void Inches_2_millimeters()
 {
     FloatCompare(25.4f, Inches.Millimeters(1));
 }
Esempio n. 10
0
 public void Inches_2_centimeters()
 {
     FloatCompare(2.54f, Inches.Centimeters(1));
 }
Esempio n. 11
0
 public void Inches_2_miles()
 {
     FloatCompare(0.000015782828f, Inches.Miles(1), 8);
 }
Esempio n. 12
0
 public void Inches_2_feet()
 {
     FloatCompare(1 / 12f, Inches.Feet(1));
 }