Пример #1
0
        /// <summary>
        ///     Initialize a new instance of <see cref="MainWindow" />.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            // Add a new initialized item
            CharSetFontMappings = new ObservableCollection <CharSetFontMapping>
            {
                new CharSetFontMapping
                {
                    CharSet = new FullCharSetSource(),
                    Font    = new SystemFontSource(FontInfo.GetControlFont(this))
                }
            };

            // Default setting
            GenerationSetting = new GenerationSetting
            {
                TextureSize           = Settings.Default.DefaultTextureSize,
                GlyphSize             = Settings.Default.DefaultGlyphSize,
                GlyphSpace            = Settings.Default.DefaultGlyphSpace,
                SurfaceFileNameFormat = Settings.Default.DefaultSurfaceFileFormat,
                MetadataFileName      = Settings.Default.DefaultMetaFileName,
                OutputDirectory       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
            };
        }
Пример #2
0
        private void fontSelecterButtonClick(object sender, RoutedEventArgs e)
        {
            //We can pass a bool to choose if we preview the font directly in the list of fonts.
            bool previewFontInFontList = false;
            //True to allow user to input arbitrary font sizes. False to only allow predtermined sizes
            bool allowArbitraryFontSizes = false;


            ColorFontDialog dialog = new ColorFontDialog(previewFontInFontList, allowArbitraryFontSizes);

            //TextElement.Foreground = "{DynamicResource MaterialDesignBody}"
            //Background = "{DynamicResource MaterialDesignPaper}"
            //FontFamily = "{DynamicResource MaterialDesignFont}"
            dialog.Background = this.FindResource("MaterialDesignPaper") as SolidColorBrush;
            dialog.Foreground = this.FindResource("MaterialDesignBody") as SolidColorBrush;
            dialog.Font       = FontInfo.GetControlFont(tbTitleAction);

            //Optional custom allowed size range
            dialog.FontSizes = new int[] { 10, 12, 14, 16, 18, 20, 22 };

            if (dialog.ShowDialog() == true)
            {
                FontInfo font = dialog.Font;
                if (font != null)
                {
                    FontInfo.ApplyFont(tbTitleAction, font);
                }
            }
        }
Пример #3
0
        private void mnSetting_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SettingWindow sw = new SettingWindow()
                {
                    Owner = this
                };
                sw.BoardFontInfo   = FontInfo.GetControlFont(this.tbBoard);
                sw.BoardBackground = this.tbBoard.Background;
                if (sw.ShowDialog() == true)
                {
                    RegistryHelper regHelper = new RegistryHelper(this);
                    regHelper.SaveSettings();
                    this.HighlightCurrentString();
                    this.ResetClientsUpdate();
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
#endif
                MessageBox.Show(ex.Message, "Применение (сохранение) настроек", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Пример #4
0
 public MainWindow()
 {
     InitializeComponent();
     fileManager = new FileManager();
     fileManager.SetFont(FontInfo.GetControlFont(LoadedFontFamily));
     //process = new Process();
     stopwatch = new Stopwatch();
     //workerManager = new WorkerManager(FFMpegProgress, ConsoleBox);
 }
 private void Button_SpotDetailFont_Click(object sender, RoutedEventArgs e)
 {
     ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog();
     fntDialog.Owner = this;
     fntDialog.Font  = FontInfo.GetControlFont(this.SpotDetailList[0]);
     if (fntDialog.ShowDialog() == true)
     {
         SettingInfo.SpotDetailFontInfo = fntDialog.Font;
     }
 }
 private void Button_TitleFont_Click(object sender, RoutedEventArgs e)
 {
     ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog();
     fntDialog.Owner = this;
     fntDialog.Font  = FontInfo.GetControlFont(this.TextBox_Title);
     if (fntDialog.ShowDialog() == true)
     {
         SettingInfo.TitleFontInfo = fntDialog.Font;
     }
 }
Пример #7
0
        private void button_Click(Object sender, RoutedEventArgs e)
        {
            ColorFontDialog dialog = new ColorFontDialog();

            dialog.Font = FontInfo.GetControlFont(label);
            if (dialog.ShowDialog() == true)
            {
                font = dialog.Font;
            }
        }
Пример #8
0
        private void Font_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var dlg = new ColorFontDialog(showColorPicker: false);

            dlg.Font = FontInfo.GetControlFont(tables.SelectedContent as Control);
            if (dlg.ShowDialog() == true)
            {
                FontInfo.ApplyFont(tables.SelectedContent as Control, dlg.Font);
            }
            e.Handled = true;
        }
Пример #9
0
        void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            _selectedFont = FontInfo.GetControlFont(this.DummyTextBox);

            _smallTemplateImage  = new BitmapImage(new Uri("Data/Small.png", UriKind.Relative));
            _mediumTemplateImage = new BitmapImage(new Uri("Data/Medium.png", UriKind.Relative));

            Lines.Text = File.ReadAllText("Data/Default.txt");

            Directory.CreateDirectory("./Output");

            RedrawPreview();
        }
Пример #10
0
        private void btFont_Click(object sender, RoutedEventArgs e)
        {
            ColorFontDialog fntDialog = new ColorFontDialog();

            fntDialog.Owner = this;
            fntDialog.Font  = FontInfo.GetControlFont(this.tbExample);
            if (fntDialog.ShowDialog() == true)
            {
                FontInfo selectedFont = fntDialog.Font;
                if (selectedFont != null)
                {
                    FontInfo.ApplyFont(this.tbExample, selectedFont);
                }
            }
        }
Пример #11
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog();
            fntDialog.Owner = this;
            fntDialog.Font  = FontInfo.GetControlFont(this.txtText);
            if (fntDialog.ShowDialog() == true)
            {
                FontInfo selectedFont = fntDialog.Font;

                if (selectedFont != null)
                {
                    FontInfo.ApplyFont(this.txtText, selectedFont);
                }
            }
        }
Пример #12
0
        private void saveButtonClick(object sender, RoutedEventArgs e)
        {
            Actions[SelectedNumber].Title          = tbTitleAction.Text;
            Actions[SelectedNumber].Titlefont      = FontInfo.GetControlFont(tbTitleAction);
            Actions[SelectedNumber].ShowTitleLabel = showTitleToggleButton.IsChecked ?? false;
            if (Actions[SelectedNumber] is LaunchAction)
            {
                var fullPath = FindExePath(tbPath.Text);
                if (File.Exists(fullPath) && fullPath != (Actions[SelectedNumber] as LaunchAction).ExePath)
                {
                    var icon = GetBestIcon(fullPath);
                    if (icon != null)
                    {
                        //Bitmap bitmap = IconUtil.ToBitmap(icon);
                        Bitmap bitmap = icon.ToBitmap();
                        bitmap.Save("Temp.png");
                        controller.AddImage(SelectedNumber + 1, "Temp.png");
                    }
                }

                (Actions[SelectedNumber] as LaunchAction).ExePath = fullPath;
                (Actions[SelectedNumber] as LaunchAction).Args    = tbArgs.Text;
                var result = LaunchAction.ProcessRunningAction.FocusOldProcess;
                Enum.TryParse(tbNewProcessAction.SelectedItem.ToString(), out result);
                (Actions[SelectedNumber] as LaunchAction).AlreadyRunningAction = result;
                controller.Save();
            }
            else if (Actions[SelectedNumber] is TextStringAction)
            {
                (Actions[SelectedNumber] as TextStringAction).Value = tbValue.Text;
            }
            else if (Actions[SelectedNumber] is FolderAction)
            {
                (Actions[SelectedNumber] as FolderAction).ExeConditionName = tbFolderCondition.Text;
            }
            else if (Actions[SelectedNumber] is HotkeyAction)
            {
                (Actions[SelectedNumber] as HotkeyAction).MainKey   = MainKey;
                (Actions[SelectedNumber] as HotkeyAction).Modifiers = Modifiers;
            }

            Color c = Color.FromArgb(ClrPcker_Background.SelectedColor.Value.R,
                                     ClrPcker_Background.SelectedColor.Value.G, ClrPcker_Background.SelectedColor.Value.B);

            Actions[SelectedNumber].BackgroundColor = c;
            controller.Save();
            controller.LoadIcons();
        }
Пример #13
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ColorFontDialog dialog = new ColorFontDialog(true, true, true);

            dialog.Owner = this;
            dialog.Font  = FontInfo.GetControlFont(this.TextBlockSample);
            //dialog.FontSizes = new int[] { 10, 12, 14, 16, 18 };
            if (dialog.ShowDialog() == true)
            {
                FontInfo font = dialog.Font;
                if (font != null)
                {
                    FontInfo.ApplyFont(this.TextBlockSample, font);
                }
            }
        }
Пример #14
0
        private void FontMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new ColorFontDialog
            {
                Font = FontInfo.GetControlFont(LogTextBox)
            };

            if (dialog.ShowDialog() == true)
            {
                var font = dialog.Font;
                if (font != null)
                {
                    FontInfo.ApplyFont(LogTextBox, font);
                }
            }
        }
Пример #15
0
        void OnfontMenuClick(object sender, RoutedEventArgs e)
        {
            FontWindow fw = new FontWindow();

            fw.Title = "글꼴";
            fw.Owner = Owner;
            fw.Font  = FontInfo.GetControlFont(this.beforeTextBox);
            if (fw.ShowDialog() == true)
            {
                FontInfo selectedFont = fw.Font;
                if (selectedFont != null)
                {
                    FontInfo.ApplyFont(this.beforeTextBox, selectedFont);
                    FontInfo.ApplyFont(this.afterTextBox, selectedFont);
                }
            }
        }
Пример #16
0
        private void font_Click(object sender, RoutedEventArgs e)
        {
            //https://github.com/sskodje/WpfColorFont
            bool            previewFontInFontList = true;
            ColorFontDialog dialog = new ColorFontDialog(previewFontInFontList);

            dialog.Font = FontInfo.GetControlFont(mainTextBox);

            if (dialog.ShowDialog() == true)
            {
                FontInfo font = dialog.Font;
                if (font != null)
                {
                    FontInfo.ApplyFont(mainTextBox, font);
                }
            }
        }
Пример #17
0
        /// <summary>
        /// This event is handled when user wants to set font settings of the code editor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FontSettingsItem_Click(object sender, RoutedEventArgs e)
        {
            ColorFontDialog fntDialog = new ColorFontDialog
            {
                Owner = this,
                Font  = FontInfo.GetControlFont(TabManager.CodeEditorBox)
            };

            if (fntDialog.ShowDialog() == true)
            {
                FontInfo selectedFont = fntDialog.Font;
                if (selectedFont != null)
                {
                    FontInfo.ApplyFont(TabManager.CodeEditorBox, selectedFont);
                }
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     SpotList                        = new List <TextBox>();
     SpotDetailList                  = new List <TextBox>();
     SpotIndexColorList              = new List <Xceed.Wpf.Toolkit.ColorPicker>();
     SettingInfo                     = new SettingInfo();
     SettingInfo.TitleFontInfo       = FontInfo.GetControlFont(this.TextBox_Title);
     SettingInfo.TitleDetailFontInfo = FontInfo.GetControlFont(this.TextBox_Title);
     SettingInfo.SpotFontInfo        = FontInfo.GetControlFont(this.TextBox_Title);
     SettingInfo.SpotDetailFontInfo  = FontInfo.GetControlFont(this.TextBox_Title);
     SettingInfo.TitleSize           = 25d;
     SettingInfo.TitleDetailSize     = 20d;
     SettingInfo.SpotSize            = 15d;
     SettingInfo.SpotDetailSize      = 12d;
     SettingInfo.ImageAreaRatio      = 0.618d;
     Button_Generate.IsEnabled       = false;
     this.DataContext                = SettingInfo;
 }
Пример #19
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            if (this.DialogResult == true)
            {
                this.BoardFontInfo   = FontInfo.GetControlFont(this.tbExample);
                this.BoardBackground = this.tbExample.Background;

                this._editor.inkBoard.Width  = this.slWidth.Value;
                this._editor.inkBoard.Height = this.slHeight.Value;

                this._editor.IP   = this.cbIp.SelectedItem.ToString();
                this._editor.Port = Int32.Parse(this.tbPort.Text.Trim());

                FontInfo.ApplyFont(this._editor.tbBoard, this.BoardFontInfo);
                this._editor.tbBoard.Background = this.BoardBackground;

                this._editor.ResetClientsUpdate();
            }
        }
Пример #20
0
        void AddElement(int type)
        {
            ElementControl E = new ElementControl(type, elements.Count);

            elements.Add(E);
            elements.Last().TopClick              += Element_Click;
            elements.Last().DataChanged           += Element_DataChanged;
            elements.Last().LayerUpClick          += LayerUp_Click;
            elements.Last().LayerDownClick        += LayerDown_Click;
            elements.Last().DeletElementClick     += DeletElement_Click;
            elements.Last().FontButtonClick       += FontButton_Click;
            elements.Last().TextBorderSatusChange += TextBorderCheck_Change;

            fonts.Add(FontInfo.GetControlFont(cardWidth));

            switch (type)
            {
            case 0:
                card.Set(new CardBackground());
                break;

            case 1:
                card.Set(new CardFram());
                break;

            case 2:
                card.Set(new CardImage());
                break;

            case 3:
                card.Set(new CardImgNum());
                break;

            case 4:
                card.Set(new CardText());
                break;
            }

            ShowElements();
        }
        void newBtn_Click(object sender, RoutedEventArgs e)
        {
            ColorFont.ColorFontDialog fntDialog = new ColorFont.ColorFontDialog();
            //fntDialog.Owner = this;
            Canvas canva2 = ((tabs.SelectedItem as TabItem).Content as StackPanel).Children[0] as Canvas;

            foreach (TextBlock a in canva2.Children.OfType <TextBlock>())
            {
                if (a.Name == (sender as Button).Name)
                {
                    Control s = new Control();
                    s.FontFamily   = a.FontFamily;
                    s.FontSize     = a.FontSize;
                    s.FontWeight   = a.FontWeight;
                    s.FontStyle    = a.FontStyle;
                    s.Foreground   = a.Foreground;
                    fntDialog.Font = FontInfo.GetControlFont(s as Control);
                }
            }
            if (fntDialog.ShowDialog() == true)
            {
                Canvas canva = ((tabs.SelectedItem as TabItem).Content as StackPanel).Children[0] as Canvas;
                foreach (TextBlock a in canva.Children.OfType <TextBlock>())
                {
                    if (a.Name == (sender as Button).Name)
                    {
                        FontInfo selectedFont = fntDialog.Font;
                        if (selectedFont != null)
                        {
                            a.FontFamily = selectedFont.Family;
                            a.FontSize   = selectedFont.Size;
                            a.FontWeight = selectedFont.Weight;
                            a.FontStyle  = selectedFont.Style;
                        }
                    }
                }
            }
            //throw new NotImplementedException();
        }
Пример #22
0
        private void mnSetting_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SettingWindow sw = new SettingWindow()
                {
                    Owner = this
                };
                sw.BoardFontInfo   = FontInfo.GetControlFont(this.tbBoard);
                sw.BoardBackground = this.tbBoard.Background;

                if (sw.ShowDialog() == true)
                {
                    FontInfo.ApplyFont(this.tbBoard, sw.BoardFontInfo);
                    this.tbBoard.Background = sw.BoardBackground;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Применение настроек", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }