public void CreateRect(Element item)
        {
            List <RectangleNamed> rctngl = SomeUtilities.GetLogicalChildCollection <RectangleNamed>(canvas1);

            for (int i = 0; i < rctngl.Count; i++)
            {
                if (rctngl[i].Name == item.name)
                {
                    return;
                }
            }
            RectangleNamed rect;

            rect             = new RectangleNamed();
            rect.description = item.name;

            rect.Stroke  = new SolidColorBrush(Colors.Black);
            rect.Fill    = item.item_fill;
            rect.Opacity = item.opacity;
            rect.Width   = item.size_width;
            rect.Height  = item.size_height;
            Canvas.SetLeft(rect, item.pos_x);
            Canvas.SetTop(rect, item.pos_y);
            canvas1.Children.Add(rect);
        }
Exemple #2
0
 public static string openFileDialog(string filter, string currentfile, string themeFile)
 {
     if (!File.Exists(themeFile))
     {
         MessageBox.Show("To specify relative paths, select the platform with the theme.xml file", "Attention", MessageBoxButton.OK);
         return(null);
     }
     else
     {
         OpenFileDialog myDialog = new OpenFileDialog();
         myDialog.Filter = filter;
         if (currentfile != "")
         {
             currentfile = SomeUtilities.MakeAbsolutePath(themeFile, currentfile);
         }
         if (File.Exists(currentfile))
         {
             myDialog.FileName = currentfile;
         }
         myDialog.CheckFileExists = true;
         myDialog.Multiselect     = true;
         //myDialog.InitialDirectory = tb_themefolder.Text;
         if (myDialog.ShowDialog() == true)
         {
             return(SomeUtilities.MakeRelativePath(themeFile, myDialog.FileName));
         }
         return(null);
     }
 }
        public void CreateRect(string rectname, Brush rectcolor, double rectopacity, double width, double height, double x, double y)
        {
            List <RectangleNamed> rctngl = SomeUtilities.GetLogicalChildCollection <RectangleNamed>(canvas1);

            for (int i = 0; i < rctngl.Count; i++)
            {
                if (rctngl[i].Name == rectname)
                {
                    return;
                }
            }
            RectangleNamed rect;

            rect             = new RectangleNamed();
            rect.description = rectname;

            rect.Stroke  = new SolidColorBrush(Colors.Black);
            rect.Fill    = rectcolor;
            rect.Width   = width;
            rect.Height  = height;
            rect.Opacity = rectopacity;
            Canvas.SetLeft(rect, x);
            Canvas.SetTop(rect, y);
            canvas1.Children.Add(rect);
            SaveItem(rect);
        }
Exemple #4
0
 public void Clear(string defaultimage)
 {
     manualClear          = true;
     cb_tile.IsChecked    = false;
     btn_color.Background = SomeUtilities.GetBrushFromHex("#FFFFFFFF");
     tb_path.Text         = defaultimage;
     manualClear          = false;
 }
 public string getImagePath()
 {
     if (tb_filledPath.Text == "")
     {
         return("");
     }
     return(SomeUtilities.MakeAbsolutePath(((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml", tb_filledPath.Text));
 }
        private void hiddenAllGroupBox()
        {
            List <GroupBox> groupboxes = SomeUtilities.GetLogicalChildCollection <GroupBox>(propertiesbox);

            for (int i = 0; i < groupboxes.Count; i++)
            {
                groupboxes[i].Visibility = System.Windows.Visibility.Hidden;
            }
        }
Exemple #7
0
 public void Clear()
 {
     manualClear              = true;
     tb_fontPath.Text         = "./../SomeArt/font.ttf";
     tb_fontSize.Text         = "0.03";
     btn_iconColor.Foreground = SomeUtilities.GetBrushFromHex("#777777FF");
     btn_textColor.Foreground = SomeUtilities.GetBrushFromHex("#777777FF");
     manualClear              = false;
 }
Exemple #8
0
        public static double getOpacityFromHex(string hexString)
        {
            Brush  br         = SomeUtilities.GetBrushFromHex(hexString);
            double a          = ((Color)br.GetValue(SolidColorBrush.ColorProperty)).A;
            double max        = 255;
            double opacityval = (a / max);

            return(opacityval);
        }
 public void Clear()
 {
     manualClear          = true;
     btn_color.Foreground = SomeUtilities.GetBrushFromHex("#777777FF");
     tb_fontPath.Text     = "./../SomeArt/font.ttf";
     tb_fontSize.Text     = "0.03";
     //tb_lineSpacing.Text = "1.5";
     manualClear = false;
 }
 public void SelectRect(string rectname)
 {
     if (selected_rectangle != null)
     {
         selected_rectangle.Unselect();
     }
     selected_rectangle = SomeUtilities.FindChild <RectangleNamed>(canvas1, rectname);
     selected_rectangle.Select();
 }
 public void Clear()
 {
     manualClear            = true;
     cbx_type.SelectedValue = "horizontal";
     tb_logoScale.Text      = "1.2";
     btn_color.Foreground   = SomeUtilities.GetBrushFromHex("#FF777777");
     tb_maxLogoCount.Text   = "5";
     tb_logoSize_w.Text     = "0.125";
     tb_logoSize_h.Text     = "0.155";
     manualClear            = false;
 }
Exemple #12
0
        private void textColor_Click(object sender, RoutedEventArgs e)
        {
            ColorPickerDialog cpd = new ColorPickerDialog();

            cpd.ColorPicker.SelectedColor = ((System.Windows.Media.SolidColorBrush)(((Button)sender).Foreground)).Color;
            if (cpd.ShowDialog() == true)
            {
                ((Button)sender).Foreground = cpd.SelectedColor;
                onPropertyChanged(((Button)sender).Name.Replace("btn_", ""), SomeUtilities.GetHexFromBrush(((Button)sender).Foreground));
            }
        }
        private void btn_bgsound_system_Click(object sender, RoutedEventArgs e)
        {
            string themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml";
            string filename      = SomeUtilities.openFileDialog("Sound files(*.wav;*.ogg)|*.wav;*.ogg" + "|Все файлы (*.*)|*.* ", this.tb_bgsound.Text, themeFilename);

            if (filename != null)
            {
                this.tb_bgsound.Text = filename;
            }
            //saveSystemView();
        }
        //Universal metod for item add/delete checkboxes
        private void CheckBox_Checked_1(object sender, RoutedEventArgs e)
        {
            Element.types typeOfElement;
            string        str            = ((CheckBox)sender).Name;
            Rectangle     foundRectangle = SomeUtilities.FindChild <Rectangle>(grid1, str.Replace("cb", "rctngl"));

            if (!cbManualChangeState)
            {
                typeOfElement = Element.GetType(str.Replace("cb_", ""));
                onElementCreate(str.Replace("cb_", ""), typeOfElement, foundRectangle.Fill, 0.5);
            }
        }
        private void uncheckAllCheckboxes()
        {
            List <CheckBox> checkboxes = SomeUtilities.GetLogicalChildCollection <CheckBox>(grid1);

            for (int i = 0; i < checkboxes.Count; i++)
            {
                if (checkboxes[i].Content.ToString() == "")
                {
                    checkboxes[i].IsChecked = false;
                }
            }
        }
Exemple #16
0
 public void Clear()
 {
     manualClear                 = true;
     tb_fontPath.Text            = "./../SomeArt/font.ttf";
     tb_fontSize.Text            = "0.03";
     cb_forceUppercase.IsChecked = false;
     btn_color.Foreground        = SomeUtilities.GetBrushFromHex("#FF000000");
     tb_lineSpacing.Text         = "1.5";
     tb_text.Text                = "";
     cbx_alignment.SelectedValue = "center";
     manualClear                 = false;
 }
        private bool checCheckedCheckboxes(DependencyObject parent)
        {
            List <CheckBox> checkboxes = SomeUtilities.GetLogicalChildCollection <CheckBox>(parent);

            for (int i = 0; i < checkboxes.Count; i++)
            {
                if (checkboxes[i].IsChecked == true)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #18
0
        private void btn_fontPath_Click(object sender, RoutedEventArgs e)
        {
            string toollName = ((Button)sender).Name;

            toollName = toollName.Replace("btn", "tb");
            string  themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml";
            TextBox foundTextBox  = SomeUtilities.FindChild <TextBox>(this, toollName);
            string  filename      = SomeUtilities.openFileDialog("Font files(*.ttf)|*.ttf" + "|Все файлы (*.*)|*.* ", foundTextBox.Text, themeFilename);

            if (filename != null)
            {
                foundTextBox.Text = filename;
            }
        }
        private void btn_getimagefile_Click(object sender, RoutedEventArgs e)
        {
            string toollName = ((Button)sender).Name;

            toollName = toollName.Replace("btn", "tb");
            string  themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml";
            TextBox foundTextBox  = SomeUtilities.FindChild <TextBox>(canvas, toollName);
            string  filename      = SomeUtilities.openFileDialog("Image files(*.png;*.jpg;*.svg)|*.png;*.jpg;*.svg" + "|Все файлы (*.*)|*.* ", foundTextBox.Text, themeFilename);

            if (!string.IsNullOrEmpty(filename))
            {
                foundTextBox.Text = filename;
            }
            //saveSystemView();
        }
 private void btn_BringToFront_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (selected_rectangle != null)
         {
             RectangleNamed pToMove = SomeUtilities.FindChild <RectangleNamed>(canvas1, selected_rectangle.Name);
             canvas1.Children.Remove(pToMove);
             canvas1.Children.Add(pToMove);
         }
     }
     catch (Exception)
     {
     }
 }
 public void Clear()
 {
     manualClear = true;
     cbx_alignment.SelectedValue   = "center";
     tb_fontPath.Text              = "./../SomeArt/font.ttf";
     tb_scrollSound.Text           = "./../SomeArt/scrollsound.ogg";
     tb_fontSize.Text              = "0.03";
     cb_forceUppercase.IsChecked   = false;
     btn_secondaryColor.Foreground = SomeUtilities.GetBrushFromHex("#FF777777");
     btn_selectedColor.Foreground  = SomeUtilities.GetBrushFromHex("#FFe2ead9");
     btn_selectorColor.Foreground  = SomeUtilities.GetBrushFromHex("#77ffa500");
     btn_primaryColor.Foreground   = SomeUtilities.GetBrushFromHex("#FF440040");
     tb_lineSpacing.Text           = "1.5";
     manualClear = false;
 }
Exemple #22
0
        //For element image, the color property sets only the alpha channel, and the other parameters 255
        private void btn_image_color_Click(object sender, RoutedEventArgs e)
        {
            ColorPickerDialog cpd = new ColorPickerDialog();

            cpd.ColorPicker.SelectedColor = ((System.Windows.Media.SolidColorBrush)(((Button)sender).Background)).Color;
            if (cpd.ShowDialog() == true)
            {
                Color myColor = ((System.Windows.Media.SolidColorBrush)(cpd.SelectedColor)).Color;
                myColor.B = 255;
                myColor.G = 255;
                myColor.R = 255;
                System.Windows.Media.SolidColorBrush scb = new SolidColorBrush(myColor);
                ((Button)sender).Background = scb;
                onPropertyChanged(((Button)sender).Name.Replace("btn_", ""), SomeUtilities.GetHexFromBrush(((Button)sender).Background));
            }
        }
        public void propertiesTabVisibilityChange(string gb_name)
        {
            GroupBox foundGrid = SomeUtilities.FindChild <GroupBox>(this, "gb_" + gb_name);

            if (foundGrid != null)
            {
                foundGrid.Visibility = System.Windows.Visibility.Visible;
            }
            if (gb_name == "base")
            {
                cb_extra_on_off.IsEnabled = false;
            }
            else
            {
                cb_extra_on_off.IsEnabled = true;
            }
        }
Exemple #24
0
        private void btn_path_Click(object sender, RoutedEventArgs e)
        {
            string toollName = ((Button)sender).Name;

            toollName = toollName.Replace("btn", "tb");
            string  themeFilename = ((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml";
            TextBox foundTextBox  = SomeUtilities.FindChild <TextBox>(this, toollName);
            string  filename      = SomeUtilities.openFileDialog("Image files(*.png;*.jpg;*.svg)|*.png;*.jpg;*.svg" + "|Все файлы (*.*)|*.* ", foundTextBox.Text, themeFilename);

            if (filename != null)
            {
                manualClear       = true;
                foundTextBox.Text = filename;
                manualClear       = false;
                onPropertyChanged(((Button)sender).Name.Replace("btn_", ""), filename);
            }
        }
        public void RemoveRect(string rectname)
        {
            List <RectangleNamed> rctngl = SomeUtilities.GetLogicalChildCollection <RectangleNamed>(canvas1);

            for (int i = 0; i < rctngl.Count; i++)
            {
                if (rctngl[i].Name == rectname)
                {
                    if (rctngl[i].isSelected)
                    {
                        rctngl[i].Unselect();
                    }
                    canvas1.Children.Remove(rctngl[i]);
                    toolbox.currentView.removeItem(rectname);
                }
            }
        }
        public void setProperty(string name, string value)
        {
            //if (name == "")
            //    return;

            switch (name)
            {
            case "path":
            case "filledPath":    //сюда же будем показывать и рейтинг
            case "unfilledPath":  //сюда же будем показывать и рейтинг
                if (value != "")
                {
                    value = SomeUtilities.MakeAbsolutePath(((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml", value);
                }
                if (setImage(value))
                {
                    this.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.Visibility = System.Windows.Visibility.Hidden;
                }
                break;

            case "color":
                image.Opacity = SomeUtilities.getOpacityFromHex(value);
                break;

            case "tile":
                if (value == "1")
                {
                    image.Stretch = Stretch.Fill;
                }
                if (value == "0")
                {
                    image.Stretch = Stretch.Uniform;
                }
                break;
            }
        }
Exemple #27
0
 private void btn_read_XML_Click(object sender, RoutedEventArgs e)
 {
     include = "";
     views.Clear();
     readXML();
     if (include != "")
     {
         string filename = SomeUtilities.MakeAbsolutePath(tb_themefolder.Text + "\\" + cbx_gameplatformtheme.SelectedItem.ToString() + "\\theme.xml", include);
         if (File.Exists(filename))
         {
             tb_log.Text = File.ReadAllText(filename);
         }
         try
         {
             readXML();
         }
         catch (Exception err)
         {
             Logger.Write(err);
             return;
         }
     }
 }
        public bool setImage(string filename)
        {
            if (!File.Exists(filename))
            {
                filename = SomeUtilities.MakeAbsolutePath(((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml", filename);
                if (!File.Exists(filename))
                {
                    return(false);
                }
            }

            BitmapImage bitmap = new BitmapImage();

            bitmap.BeginInit();
            bitmap.UriSource = new Uri(filename);
            bitmap.EndInit();
            image.Source = bitmap;
            if (bitmap != null)
            {
                return(true);
            }

            return(false);
        }
        public void CreateRect(string rectname, Element.types typeOfElement, Brush rectcolor, double rectopacity, double width, double height, double x, double y, bool horizontalResizing = true, bool verticallResizing = true)
        {
            List <RectangleNamed> rctngl = SomeUtilities.GetLogicalChildCollection <RectangleNamed>(canvas1);

            for (int i = 0; i < rctngl.Count; i++)
            {
                if (rctngl[i].Name == rectname)
                {
                    return;
                }
            }
            RectangleNamed rect;

            rect             = new RectangleNamed(rectname, typeOfElement, rectcolor, rectopacity, width, height, x, y);
            rect.MouseMove  += RectangleNamed_MouseMove;
            rect.MouseLeave += RectangleNamed_MouseLeave;
            rect.MouseDown  += RectangleNamed_MouseDown;
            rect.onRectangleNamedSelectedChange += rectangleSelectChanget;
            rect.horizontalResizing              = horizontalResizing;
            rect.verticallResizing = verticallResizing;
            SaveItem(rect, typeOfElement);
            rect.fillProperties(propertiesbox.getPropertiesByType(typeOfElement));
            canvas1.Children.Add(rect);
        }
Exemple #30
0
        public void setProperty(string name, string value)
        {
            if (name == "")
            {
                return;
            }
            switch (name)
            {
            case "alignment":
                if (value.ToLower() == "center")
                {
                    alignment = "Center";
                }
                if (value.ToLower() == "right")
                {
                    alignment = "Right";
                }
                if (value.ToLower() == "left")
                {
                    alignment = "Left";
                }
                setStyle();
                break;

            case "primaryColor":
                if (primaryColor != value)
                {
                    primaryColor = value;
                    setStyle();
                }
                break;

            case "selectedColor":
                if (selectedColor != value)
                {
                    selectedColor = value;
                    setStyle();
                }
                break;

            case "selectorColor":
                if (selectorColor != value)
                {
                    selectorColor = value;
                    setStyle();
                }
                break;

            case "fontSize":
                double fontsize;
                if (!double.TryParse(value.Replace(".", ","), out fontsize))
                {
                    return;
                }
                if (fontsize > 0)
                {
                    fontsize             = ((App)Application.Current).Height * fontsize;
                    lb_gamelist.FontSize = fontsize;
                    ScrollToLastItem();
                    this.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.Visibility = System.Windows.Visibility.Hidden;
                }
                break;

            case "fontPath":
                value = SomeUtilities.MakeAbsolutePath(((App)Application.Current).themefolder + ((App)Application.Current).gameplatformtheme + "\\theme.xml", value);
                if (File.Exists(value))
                {
                    PrivateFontCollection fileFonts = new PrivateFontCollection();
                    fileFonts.AddFontFile(value);
                    value = value.Replace(System.IO.Path.GetFileName(value), "#" + fileFonts.Families[0].Name).Replace("\\", "/");
                    lb_gamelist.FontFamily = new FontFamily("file:///" + value);
                    this.Visibility        = System.Windows.Visibility.Visible;
                    lb_gamelist.UpdateLayout();
                }
                else
                {
                    this.Visibility = System.Windows.Visibility.Hidden;
                }
                break;

            case "forceUppercase":
                if (value == "1")
                {
                    fillCBX(true);
                }
                if (value == "0")
                {
                    fillCBX();
                }
                break;
            }
        }