Ejemplo n.º 1
0
        void comboBoxMapType_Select(GMapProvider provider)
        {
            Alt.GUI.Temporary.Gwen.Control.MenuItem item = comboBoxMapType.SelectedItem;
            if (item != null)
            {
                GMapProvider itemProvider = item.Tag as GMapProvider;
                if (itemProvider == provider)
                {
                    return;
                }
            }

            Alt.GUI.Temporary.Gwen.Control.MenuItem toSelect = null;
            foreach (Base child in comboBoxMapType.Children)
            {
                item = child as Alt.GUI.Temporary.Gwen.Control.MenuItem;
                if (item != null)
                {
                    GMapProvider itemProvider = item.Tag as GMapProvider;
                    if (itemProvider == provider)
                    {
                        toSelect = item;
                        break;
                    }
                }
            }

            if (toSelect != null)
            {
                comboBoxMapType.SelectedItem = toSelect;
            }
        }
Ejemplo n.º 2
0
        void OnFontFamilySelect(Base control)
        {
            m_FontStyle.DeleteAll();
            m_FontStyleMenus.Clear();

            Alt.GUI.Temporary.Gwen.Control.MenuItem label = m_FontFamily.SelectedItem;
            if (label == null)
            {
                return;
            }

            FontFamily family = label.Tag as FontFamily;

            if (family == null)
            {
                return;
            }


            AddFontStyle(family, FontStyle.Bold);
            AddFontStyle(family, FontStyle.BoldItalic);
            AddFontStyle(family, FontStyle.Italic);
            AddFontStyle(family, FontStyle.Regular);


            ClientRefresh();
        }
Ejemplo n.º 3
0
        void LoadComboBoxMapTypeValues()
        {
            //TEMP  #if !MONO

            // mono doesn't handle it, so we 'lost' provider list ;]
            //comboBoxMapType.ValueMember = "Name";
            //comboBoxMapType.DataSource = GMapProviders.List;
            //comboBoxMapType.SelectedItem = MainMap.MapProvider;

            List <GMapProvider> GMapProviders_List  = GMapProviders.List;
            GMapProvider        MainMap_MapProvider = MainMap.MapProvider;

            foreach (GMapProvider provider in GMapProviders_List)
            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem item = comboBoxMapType.AddItem(provider.Name, provider.Id.ToString());
                item.Tag = provider;

                if (provider.Id == MainMap_MapProvider.Id)
                {
                    comboBoxMapType.SelectedItem = item;
                }
            }

            comboBoxMapType.ItemSelected += new GwenEventHandler(comboBoxMapType_DropDownClosed);

            //TEMP  #endif
        }
Ejemplo n.º 4
0
        protected void CreateFontPanel()
        {
            //  Font
            m_FontPanel        = new Base(this);
            m_FontPanel.Dock   = Pos.Bottom;
            m_FontPanel.Margin = new Margin(0, 10, 0, 0);


            //  Font Family
            Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(m_FontPanel);
            label.AutoSizeToContents = true;
            label.Dock   = Pos.Top;
            label.Margin = new Margin(0, 0, 0, 3);
            label.Text   = "Font Family:";


            FontFamily[] families = (new InstalledFontCollection()).Families;

            m_FontFamily        = new Alt.GUI.Temporary.Gwen.Control.ComboBox(m_FontPanel);
            m_FontFamily.Dock   = Pos.Top;
            m_FontFamily.Margin = new Margin(0, 0, 0, 7);

            foreach (FontFamily family in families)
            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem item = m_FontFamily.AddItem(family.Name);
                item.Tag = family;

                m_FamilyMenus.Add(family.Name, item);
            }

            m_FontFamily.ItemSelected += OnFontFamilySelect;


            //  Font Style
            label = new Alt.GUI.Temporary.Gwen.Control.Label(m_FontPanel);
            label.AutoSizeToContents = true;
            label.Dock   = Pos.Top;
            label.Margin = new Margin(0, 0, 0, 3);
            label.Text   = "Font Style:";


            m_FontStyle      = new Alt.GUI.Temporary.Gwen.Control.ComboBox(m_FontPanel);
            m_FontStyle.Dock = Pos.Top;


            m_FontStyle.ItemSelected += OnFontStyleSelect;


            //  Set font style
            OnFontFamilySelect(null);
        }
Ejemplo n.º 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Alt.GUI.Temporary.Gwen.Control.MenuStrip menu = new Alt.GUI.Temporary.Gwen.Control.MenuStrip(this);

            Alt.GUI.Temporary.Gwen.Control.MenuItem root = menu.AddItem("Original Size");
            {
                root.Menu.AddItem("800%").SetAction(miZoom_Click);
                root.Menu.AddItem("600%").SetAction(miZoom_Click);
                root.Menu.AddItem("400%").SetAction(miZoom_Click);
                root.Menu.AddItem("200%").SetAction(miZoom_Click);
                root.Menu.AddItem("150%").SetAction(miZoom_Click);
                root.Menu.AddItem("100%").SetAction(miZoom_Click);
                root.Menu.AddItem("75%").SetAction(miZoom_Click);
                root.Menu.AddItem("50%").SetAction(miZoom_Click);
                root.Menu.AddItem("25%").SetAction(miZoom_Click);
                root.Menu.AddItem("10%").SetAction(miZoom_Click);
                root.Menu.AddDivider();
                root.Menu.AddItem("Best Fit").SetAction(miBestFit_Click);
                root.Menu.AddItem("Full Page").SetAction(miFullPage_Click);
            }

            menu.AddItem("Full Page" //, "AltData/Gwen/test16.png"
                         ).Clicked += miFullPage_Click;
            menu.AddItem("Best Fit"  //, "AltData/Gwen/test16.png"
                         ).Clicked += miBestFit_Click;
            menu.AddItem("Smaller"   //, "AltData/Gwen/test16.png"
                         ).Clicked += miSmaller_Click;
            menu.AddItem("Larger"    //, "AltData/Gwen/test16.png"
                         ).Clicked += miLarger_Click;
#if !SILVERLIGHT
            menu.AddItem("Create PDF"//, "AltData/Gwen/test16.png"
                         ).Clicked += miCreatePDF_Click;
#endif


            Alt.GUI.Temporary.Gwen.Control.StatusBar sb = new Alt.GUI.Temporary.Gwen.Control.StatusBar(this);
            m_StatisBarLabel = new Alt.GUI.Temporary.Gwen.Control.Label(sb);
            m_StatisBarLabel.AutoSizeToContents = true;
            m_StatisBarLabel.Text = "";
            sb.AddControl(m_StatisBarLabel, false);


            m_PagePreview.SetRenderEvent(new Alt.GUI.PdfSharp.Temporary.Gwen.PagePreview.RenderEvent(Render));


            m_PagePreview.PageSize = PageSizeConverter.ToSize(PageSize.A4);
            UpdateStatusBar();
        }
Ejemplo n.º 6
0
        Alt.GUI.Temporary.Gwen.Control.MenuItem AddFontStyle(FontFamily family, FontStyle style)
        {
            if (!family.IsStyleAvailable(style))
            {
                return(null);
            }

            Alt.GUI.Temporary.Gwen.Control.MenuItem item = m_FontStyle.AddItem(style.ToString());
            item.Tag = style;

            m_FontStyle.SelectedItem = item;

            m_FontStyleMenus.Add(style, item);

            return(item);
        }
Ejemplo n.º 7
0
        void FillEdgeColorTypeListBox()
        {
            foreach (Alt.GUI.PieChart.EdgeColorType ect in
                     //Enum.GetValues(typeof(Alt.Sketch.Ext.PieChart.EdgeColorType))
                     EnumHelper.GetValues <Alt.GUI.PieChart.EdgeColorType>()
                     )
            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem item = comboBoxEdgeType.AddItem(ect.ToString(), ect.ToString());
                item.Tag = ect;

                if (ect == Alt.GUI.PieChart.EdgeColorType.EnhancedContrast)//DarkerThanSurface)
                {
                    comboBoxEdgeType.SelectedItem = item;
                }
            }
        }
Ejemplo n.º 8
0
        void LoadComboBoxAccessModeValues()
        {
            //comboBoxMode.DataSource = Enum.GetValues(typeof(AccessMode));
            //comboBoxMode.SelectedItem = MainMap.Manager.Mode;

            AccessMode MainMap_Manager_Mode = MainMap.Manager.Mode;

            foreach (AccessMode mode in Enum.GetValues(typeof(AccessMode)))
            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem item = comboBoxMode.AddItem(mode.ToString(), mode.ToString());
                item.Tag = mode;

                if (mode == MainMap_Manager_Mode)
                {
                    comboBoxMode.SelectedItem = item;
                }
            }

            comboBoxMode.ItemSelected += new GwenEventHandler(comboBoxMode_DropDownClosed);
        }
Ejemplo n.º 9
0
        // Clear current image in picture box
        void ClearCurrentImage()
        {
            // clear current image from picture box
            pictureBox.Image = null;
            // free current image
            if ((noneFiltersItem.IsChecked == false) && (filteredImage != null))
            {
                filteredImage.Dispose();
                filteredImage = null;
            }

            // uncheck all menu items
            foreach (Base node in filtersItem.Menu.Children)
            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem item = node as Alt.GUI.Temporary.Gwen.Control.MenuItem;
                if (item != null)
                {
                    item.IsChecked = false;
                }
            }
        }
Ejemplo n.º 10
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Alt.GUI.Temporary.Gwen.Control.MenuStrip menu = new Alt.GUI.Temporary.Gwen.Control.MenuStrip(this);
            menu.Margin = Alt.GUI.Temporary.Gwen.Margin.Two;

            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem root = menu.AddItem("File");
                root.Menu.AddItem("New", "AltData/Gwen/test16.png", "Ctrl+N").SetAction(MenuItemSelect);
                root.Menu.AddItem("Load", "AltData/Gwen/test16.png", "Ctrl+L").SetAction(MenuItemSelect);
                root.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction(MenuItemSelect);
                root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A").SetAction(MenuItemSelect);
                root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction(MenuItemSelect);
            }

            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem pRoot = menu.AddItem("\u043F\u0438\u0440\u0430\u0442\u0441\u0442\u0432\u043E");
                pRoot.Menu.AddItem("\u5355\u5143\u6D4B\u8BD5").SetAction(MenuItemSelect);
                pRoot.Menu.AddItem("\u0111\u01A1n v\u1ECB th\u1EED nghi\u1EC7m", "AltData/Gwen/test16.png").SetAction(MenuItemSelect);
            }

            {
                Alt.GUI.Temporary.Gwen.Control.MenuItem pRoot = menu.AddItem("Submenu");

                Alt.GUI.Temporary.Gwen.Control.MenuItem pCheckable = pRoot.Menu.AddItem("Checkable");
                pCheckable.IsCheckable = true;
                pCheckable.IsCheckable = true;

                {
                    Alt.GUI.Temporary.Gwen.Control.MenuItem pRootB = pRoot.Menu.AddItem("Two");
                    pRootB.Menu.AddItem("Two.One");
                    pRootB.Menu.AddItem("Two.Two");
                    pRootB.Menu.AddItem("Two.Three");
                    pRootB.Menu.AddItem("Two.Four");
                    pRootB.Menu.AddItem("Two.Five");
                    pRootB.Menu.AddItem("Two.Six");
                    pRootB.Menu.AddItem("Two.Seven");
                    pRootB.Menu.AddItem("Two.Eight");
                    pRootB.Menu.AddItem("Two.Nine", "AltData/Gwen/test16.png");
                }

                pRoot.Menu.AddItem("Three");
                pRoot.Menu.AddItem("Four");
                pRoot.Menu.AddItem("Five");

                {
                    Alt.GUI.Temporary.Gwen.Control.MenuItem pRootB = pRoot.Menu.AddItem("Six");
                    pRootB.Menu.AddItem("Six.One");
                    pRootB.Menu.AddItem("Six.Two");
                    pRootB.Menu.AddItem("Six.Three");
                    pRootB.Menu.AddItem("Six.Four");
                    pRootB.Menu.AddItem("Six.Five", "AltData/Gwen/test16.png");

                    {
                        Alt.GUI.Temporary.Gwen.Control.MenuItem pRootC = pRootB.Menu.AddItem("Six.Six");
                        pRootC.Menu.AddItem("Sheep");
                        pRootC.Menu.AddItem("Goose");
                        {
                            Alt.GUI.Temporary.Gwen.Control.MenuItem pRootD = pRootC.Menu.AddItem("Camel");
                            pRootD.Menu.AddItem("Eyes");
                            pRootD.Menu.AddItem("Nose");
                            {
                                Alt.GUI.Temporary.Gwen.Control.MenuItem pRootE = pRootD.Menu.AddItem("Hair");
                                pRootE.Menu.AddItem("Blonde");
                                pRootE.Menu.AddItem("Black");
                                {
                                    Alt.GUI.Temporary.Gwen.Control.MenuItem pRootF = pRootE.Menu.AddItem("Red");
                                    pRootF.Menu.AddItem("Light");
                                    pRootF.Menu.AddItem("Medium");
                                    pRootF.Menu.AddItem("Dark");
                                }
                                pRootE.Menu.AddItem("Brown");
                            }
                            pRootD.Menu.AddItem("Ears");
                        }
                        pRootC.Menu.AddItem("Duck");
                    }

                    pRootB.Menu.AddItem("Six.Seven");
                    pRootB.Menu.AddItem("Six.Eight");
                    pRootB.Menu.AddItem("Six.Nine");
                }

                pRoot.Menu.AddItem("Seven");
            }
        }
Ejemplo n.º 11
0
 void MenuItemSelect(Alt.GUI.Temporary.Gwen.Control.Base control)
 {
     Alt.GUI.Temporary.Gwen.Control.MenuItem item = control as Alt.GUI.Temporary.Gwen.Control.MenuItem;
     UnitPrint(String.Format("Menu item selected: {0}", item.Text));
 }
Ejemplo n.º 12
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


#if SILVERLIGHT || UNITY_WEBPLAYER
            Alt.GUI.Temporary.Gwen.Control.Label label = new Alt.GUI.Temporary.Gwen.Control.Label(this);
            label.AutoSizeToContents = true;
            label.Text = //Description + "\n" + "(This example is not available in this Demo, please download SDK)";
                         "THIS EXAMPLE IS NOT AVAILABLE IN THIS DEMO,\nPLEASE DOWNLOAD AltGUI SDK";
            label.TextColor = Color.Orange * 1.2;
            label.Dock      = Pos.Top;
            label.Margin    = new Alt.GUI.Temporary.Gwen.Margin(0, 0, 0, 5);
            label.Font      = Example_NotAvailable_ScreenShot.Font;
#endif


            //  GUI
            {
                m_Menu = new Alt.GUI.Temporary.Gwen.Control.MenuStrip(this);
                {
                    Alt.GUI.Temporary.Gwen.Control.MenuItem root = filtersItem = m_Menu.AddItem("Filters");
                    {
                        (noneFiltersItem = root.Menu.AddItem("None")).SetAction(noneFiltersItem_Click);

                        root.Menu.AddDivider();

#if !SILVERLIGHT
                        //TEMP  (grayscaleFiltersItem = root.Menu.AddItem("Grayscale")).SetAction(grayscaleFiltersItem_Click);
                        (sepiaFiltersItem = root.Menu.AddItem("Sepia")).SetAction(sepiaFiltersItem_Click);
                        (invertFiltersItem = root.Menu.AddItem("Invert")).SetAction(invertFiltersItem_Click);
                        (rotateChannelFiltersItem = root.Menu.AddItem("Rotate channel")).SetAction(rotateChannelFiltersItem_Click);
                        (colorFiltersItem = root.Menu.AddItem("Color filtering")).SetAction(colorFiltersItem_Click);
                        (rgbLinearFiltersItem = root.Menu.AddItem("Levels linear correction")).SetAction(rgbLinearFiltersItem_Click);

                        root.Menu.AddDivider();

                        (hueModifierFiltersItem = root.Menu.AddItem("Hue modifier")).SetAction(hueModifierFiltersItem_Click);
                        (saturationAdjustingFiltersItem = root.Menu.AddItem("Saturation adjusting")).SetAction(saturationAdjustingFiltersItem_Click);
                        (brightnessAdjustingFiltersItem = root.Menu.AddItem("Brightness adjusting")).SetAction(brightnessAdjustingFiltersItem_Click);
                        (contrastAdjustingFiltersItem = root.Menu.AddItem("Contrast adjusting")).SetAction(contrastAdjustingFiltersItem_Click);
                        (hslFiltersItem = root.Menu.AddItem("HSL filtering")).SetAction(hslFiltersItem_Click);

                        root.Menu.AddDivider();

                        //TEMP  (yCbCrLinearFiltersItem = root.Menu.AddItem("YCbCr linear correction")).SetAction(yCbCrLinearFiltersItem_Click);
                        (yCbCrFiltersItem = root.Menu.AddItem("YCbCr filtering")).SetAction(yCbCrFiltersItem_Click);

                        root.Menu.AddDivider();

                        //TEMP  (thresholdFiltersItem = root.Menu.AddItem("Threshold binarization")).SetAction(thresholdFiltersItem_Click);
                        //TEMP  (floydFiltersItem = root.Menu.AddItem("Floyd-Steinberg dithering")).SetAction(floydFiltersItem_Click);
                        //TEMP  (orderedDitheringFiltersItem = root.Menu.AddItem("Ordered dithering")).SetAction(orderedDitheringFiltersItem_Click);

                        //TEMP  root.Menu.AddDivider();

                        (convolutionFiltersItem = root.Menu.AddItem("Convolution")).SetAction(convolutionFiltersItem_Click);
                        (sharpenFiltersItem = root.Menu.AddItem("Sharpen")).SetAction(sharpenFiltersItem_Click);
                        (gaussianFiltersItem = root.Menu.AddItem("Gaussian blur")).SetAction(gaussianFiltersItem_Click);

                        root.Menu.AddDivider();

                        //TEMP  (differenceEdgesFiltersItem = root.Menu.AddItem("Difference edge detector")).SetAction(differenceEdgesFiltersItem_Click);
                        //TEMP  (homogenityEdgesFiltersItem = root.Menu.AddItem("Homogenity edge detector")).SetAction(homogenityEdgesFiltersItem_Click);
                        //TEMP  (sobelEdgesFiltersItem = root.Menu.AddItem("Sobel edge detector")).SetAction(sobelEdgesFiltersItem_Click);

                        //TEMP  root.Menu.AddDivider();

                        (jitterFiltersItem = root.Menu.AddItem("Jitter")).SetAction(jitterFiltersItem_Click);
                        (oilFiltersItem = root.Menu.AddItem("Oil Painting")).SetAction(oilFiltersItem_Click);
                        (textureFiltersItem = root.Menu.AddItem("Texture")).SetAction(textureFiltersItem_Click);
#else
                        root.Menu.AddItem("Image filters are not available in Silverlight yet");
#endif
                    }


                    root = sizeItem = m_Menu.AddItem("Size mode");
                    {
                        sizeItem.Click += new EventHandler(sizeItem_Popup);

                        (normalSizeItem = root.Menu.AddItem("Normal")).SetAction(normalSizeItem_Click);
                        (stretchedSizeItem = root.Menu.AddItem("Stretched")).SetAction(stretchedSizeItem_Click);
                        (centeredSizeItem = root.Menu.AddItem("Centered")).SetAction(centeredSizeItem_Click);
                    }
                }


                pictureBox             = new Alt.GUI.Temporary.Gwen.Control.PictureBox(this);
                pictureBox.DrawBorder  = true;
                pictureBox.BorderColor = Color.DodgerBlue;
                pictureBox.Dock        = Pos.Fill;
            }

            // set default size mode of picture box
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;

            LoadImage();
        }