Ejemplo n.º 1
0
        void Settings_FormClosing(object sender, FormClosingEventArgs e)
        {
            // if the user didn't click OK, do nothing.
            if (this.DialogResult != DialogResult.OK)
            {
                return;
            }

            // ensure that the brush folder has been created.
            if (bnBrushLibrary.Text != "")
            {
                if (!System.IO.Directory.Exists(bnBrushLibrary.Text))
                {
                    System.IO.Directory.CreateDirectory(bnBrushLibrary.Text);
                }
            }

            // save each path.
            Bootstrap.Settings settings = Bootstrap.Settings.Get();
            settings.SetWorkingFolder(bnWorkingFolder.Text);
            settings.SetBrushFolder(bnBrushLibrary.Text);
            settings.Save();

            // ensure that "editor/textures" has been created.
            EnsureEditorTexturesFolderCreated();
        }
Ejemplo n.º 2
0
        //-----------------------
        void thumbnailSelector_SelectionChanged(object sender, EventArgs e)
        {
            if (!_loadingSettings)
            {
                // save the brush selection (if we're not currently loading settings).
                Bootstrap.Settings settings = Bootstrap.Settings.Get();
                if (settings != null)
                {
                    Bootstrap.Brush selection = this.Selection;
                    string          brush     = "";
                    if (selection != null)
                    {
                        brush = selection.Name;
                    }
                    settings.SetUserSetting("selectedbrush", brush);
                    settings.Save();
                }
            }

            // notify others that the selection has changed.
            if (SelectionChanged != null)
            {
                SelectionChanged(sender, e);
            }

            // close the "edit brush" popup.
            popupEditBrush.Close();
        }
Ejemplo n.º 3
0
        //-----------------------
        private void bnOpen_Click(object sender, EventArgs e)
        {
            // present the palette selector to the user.
            DialogResult result = _brushPaletteSelectionDlg.ShowDialog();

            if (result != DialogResult.OK || _brushPaletteSelectionDlg.Selection == null)
            {
                return;
            }

            // select the new palette.
            Palette = _brushPaletteSelectionDlg.Selection;

            // save the fact that the user selected this palette.
            Bootstrap.Settings settings = Bootstrap.Settings.Get();
            if (settings != null)
            {
                string paletteName = "";
                if (Palette != null)
                {
                    paletteName = Palette.Name;
                }
                settings.SetUserSetting("selectedbrushpalette", paletteName);
                settings.Save();
            }
        }
Ejemplo n.º 4
0
        public Settings(string title)
        {
            InitializeComponent();

            // set the caption.
            this.Text = title;

            // set the text of the buttons.
            Bootstrap.Settings settings = Bootstrap.Settings.Get();
            bnWorkingFolder.Text = settings.GetWorkingFolder();
            bnBrushLibrary.Text  = settings.GetBrushFolder();

            // attach some events.
            bnBrushLibrary.Click  += new EventHandler(bn_Click);
            bnWorkingFolder.Click += new EventHandler(bn_Click);
            this.FormClosing      += new FormClosingEventHandler(Settings_FormClosing);
        }
Ejemplo n.º 5
0
        //-----------------------
        public void LoadDefaultPalette()
        {
            _loadingSettings = true;
            Bootstrap.Settings settings = Bootstrap.Settings.Get();
            if (settings != null)
            {
                // try to load the palette the user previously selected.
                string palette = settings.GetUserSetting("selectedbrushpalette");
                if (palette.Length > 0)
                {
                    Palette = Bootstrap.BrushPalette.TryLoad(palette);
                }

                // try to load the brush the user previously selected.
                string brush = settings.GetUserSetting("selectedbrush");
                if (brush.Length > 0)
                {
                    thumbnailSelector.SelectedName = brush;
                }
            }
            _loadingSettings = false;
        }