Example #1
0
        private void _add(Grid grid, int row, string display, string tooltip, Func <bool> get, Action <bool> set)
        {
            Grid ngrid = new Grid();

            ngrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(-1, GridUnitType.Auto)
            });
            ngrid.ColumnDefinitions.Add(new ColumnDefinition());

            TextBlock label = new TextBlock {
                Text = display, TextWrapping = System.Windows.TextWrapping.Wrap, Margin = new Thickness(3)
            };

            ngrid.Children.Add(label);
            //label.SetValue(Grid.RowProperty, row);
            label.SetValue(Grid.ColumnProperty, 1);

            if (tooltip != null)
            {
                label.ToolTip = new TextBlock {
                    Text = tooltip, MaxWidth = 350, TextWrapping = System.Windows.TextWrapping.Wrap
                };
                label.SetValue(ToolTipService.ShowDurationProperty, 2000000);
            }

            CheckBox box = new CheckBox {
                Margin = new Thickness(3)
            };

            box.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
            box.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            ngrid.Children.Add(box);
            //box.SetValue(Grid.RowProperty, row);
            box.SetValue(Grid.ColumnProperty, 0);

            label.MouseEnter += delegate {
                Mouse.OverrideCursor = Cursors.Hand;
                label.Foreground     = Application.Current.Resources["MouseOverTextBrush"] as SolidColorBrush;
                label.SetValue(TextBlock.TextDecorationsProperty, TextDecorations.Underline);
                label.MouseLeftButtonUp += delegate(object sender, MouseButtonEventArgs e) {
                    if (sender != label)
                    {
                        return;
                    }
                    box.IsChecked = !box.IsChecked;
                    e.Handled     = true;
                };
            };

            label.MouseLeave += delegate {
                Mouse.OverrideCursor = null;
                label.Foreground     = Application.Current.Resources["TextForeground"] as SolidColorBrush;
                label.SetValue(TextBlock.TextDecorationsProperty, null);
            };

            Binder.Bind(box, get, set);
            grid.Children.Add(ngrid);
            ngrid.SetValue(Grid.RowProperty, row);
            ngrid.SetValue(Grid.ColumnSpanProperty, 2);
        }
Example #2
0
        private void _loadSettingsTab()
        {
            _loadCompression();

            _metaGrfViewer.SaveResourceMethod = delegate(string resources) {
                ProjectConfiguration.SdeEditorResources = resources;
                ReloadSettings();
            };

            Binder.Bind(_cbClientDbSync, () => ProjectConfiguration.SynchronizeWithClientDatabases, () => this.Dispatch(delegate {
                _gridTextFilesSettingsClient.Visibility = ProjectConfiguration.SynchronizeWithClientDatabases ? Visibility.Visible : Visibility.Collapsed;
                _cbUseLuaFiles.Visibility     = ProjectConfiguration.SynchronizeWithClientDatabases ? Visibility.Visible : Visibility.Collapsed;
                _buttonLuaSettings.Visibility = ProjectConfiguration.SynchronizeWithClientDatabases ? Visibility.Visible : Visibility.Collapsed;
                _delayedReloadDatabase        = true;
            }), true);

            Binder.Bind(_cbUseLuaFiles, () => ProjectConfiguration.UseLuaFiles, delegate {
                _listItemClientTxtFiles.Dispatch(p => p.IsEnabled = !ProjectConfiguration.UseLuaFiles);
                _listItemClientLuaFiles.Dispatch(p => p.IsEnabled = ProjectConfiguration.UseLuaFiles);
                _delayedReloadDatabase = true;
            }, true);

            _metaGrfViewer.LoadResourceMethod = () => Methods.StringToList(ProjectConfiguration.SdeEditorResources);
            _metaGrfViewer.LoadResourcesInfo();

            WpfUtils.AddMouseInOutEffectsBox(_cbUseLuaFiles);
            WpfUtils.AddMouseInOutEffectsBox(_cbClientDbSync);

            _loadEncoding();
            _loadTxtFiles();
            _loadDatabaseFiles();
            _loadItemTxtFiles();
            _loadItemLuaFiles();
        }
Example #3
0
        public SettingsDialog() : base("Advanced settings", "settings.png")
        {
            InitializeComponent();
            int row;

            Binder.Bind(_pbNotepad.TextBox, () => SdeAppConfiguration.NotepadPath);

            _add(_gridComments, row = 0, "Add comments in item_trade.txt", "Displays the item name as a comment at the end of the line for item_trade.txt.", () => SdeAppConfiguration.AddCommentForItemTrade, v => SdeAppConfiguration.AddCommentForItemTrade = v);
            _add(_gridComments, ++row, "Add comments in item_avail.txt", "Displays the item names as a comment at the end of the line for item_avail.txt.", () => SdeAppConfiguration.AddCommentForItemAvail, v => SdeAppConfiguration.AddCommentForItemAvail = v);
            _add(_gridComments, ++row, "Add comments in item_nouse.txt", "Displays the item names as a comment at the end of the line for item_nouse.txt.", () => SdeAppConfiguration.AddCommentForItemNoUse, v => SdeAppConfiguration.AddCommentForItemNoUse = v);

            _add(_gridGeneral, row = 4, "Switch item types 4 and 5 for text based databases (requires a software restart)", "Switches the armor and weapon types when reading the databases.", () => SdeAppConfiguration.RevertItemTypes, v => SdeAppConfiguration.RevertItemTypes = v);
            _add(_gridGeneral, ++row, "Always reopen the latest opened project", "Always reopen the most recently opened project when starting the application.", () => SdeAppConfiguration.AlwaysReopenLatestProject, v => SdeAppConfiguration.AlwaysReopenLatestProject = v);
            _add(_gridGeneral, ++row, "Associate the .sde file extension with this tool", null, () => (SdeAppConfiguration.FileShellAssociated & FileAssociation.Sde) == FileAssociation.Sde, v => {
                if (v)
                {
                    SdeAppConfiguration.FileShellAssociated |= FileAssociation.Sde;
                    ApplicationManager.AddExtension(Methods.ApplicationFullPath, "Server database editor", ".sde", true);
                }
                else
                {
                    SdeAppConfiguration.FileShellAssociated &= ~FileAssociation.Sde;
                    GrfPath.Delete(GrfPath.Combine(SdeAppConfiguration.ProgramDataPath, "sde.ico"));
                    ApplicationManager.RemoveExtension(Methods.ApplicationFullPath, ".sde");
                }
            });
            _add(_gridGeneral, ++row, "Enable backups manager", null, () => SdeAppConfiguration.BackupsManagerState, v => SdeAppConfiguration.BackupsManagerState = v);
            _add(_gridGeneral, ++row, "Apply modifications to all selected items", "If checked, every field that you edit will modify all the currently selected items.", () => SdeAppConfiguration.EnableMultipleSetters, v => SdeAppConfiguration.EnableMultipleSetters = v);
            _add(_gridGeneral, ++row, "Bind item tabs together", "If checked, both the Client Items and Items tab will sync.", () => SdeAppConfiguration.BindItemTabs, v => SdeAppConfiguration.BindItemTabs = v);
            _add(_gridGeneral, ++row, "Always overwrite non-modified files", "If checked, non-modified files will be overwritten in your db folder.", () => SdeAppConfiguration.AlwaysOverwriteFiles, v => SdeAppConfiguration.AlwaysOverwriteFiles = v);

            _add(_gridDbWriter, row = 0, "Remove NoUse entry if the flag is 0 (ignore override)", "This will remove the line regardless of the override property, which must be normally at 100 for the line to be removed.", () => SdeAppConfiguration.DbNouseIgnoreOverride, v => SdeAppConfiguration.DbNouseIgnoreOverride = v);
            _add(_gridDbWriter, ++row, "Remove Trade entry if the flag is 0 (ignore override)", "This will remove the line regardless of the override property, which must be normally at 100 for the line to be removed.", () => SdeAppConfiguration.DbTradeIgnoreOverride, v => SdeAppConfiguration.DbTradeIgnoreOverride = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write unidentifiedDisplayName", null, () => SdeAppConfiguration.DbWriterItemInfoUnDisplayName, v => SdeAppConfiguration.DbWriterItemInfoUnDisplayName     = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write unidentifiedResourceName", null, () => SdeAppConfiguration.DbWriterItemInfoUnResource, v => SdeAppConfiguration.DbWriterItemInfoUnResource          = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write unidentifiedDescriptionName", null, () => SdeAppConfiguration.DbWriterItemInfoUnDescription, v => SdeAppConfiguration.DbWriterItemInfoUnDescription = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write identifiedDisplayName", null, () => SdeAppConfiguration.DbWriterItemInfoIdDisplayName, v => SdeAppConfiguration.DbWriterItemInfoIdDisplayName       = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write identifiedResourceName", null, () => SdeAppConfiguration.DbWriterItemInfoIdResource, v => SdeAppConfiguration.DbWriterItemInfoIdResource            = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write identifiedDescriptionName", null, () => SdeAppConfiguration.DbWriterItemInfoIdDescription, v => SdeAppConfiguration.DbWriterItemInfoIdDescription   = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write slotCount", null, () => SdeAppConfiguration.DbWriterItemInfoSlotCount, v => SdeAppConfiguration.DbWriterItemInfoSlotCount = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write ClassNum", null, () => SdeAppConfiguration.DbWriterItemInfoClassNum, v => SdeAppConfiguration.DbWriterItemInfoClassNum    = v);
            _add(_gridDbWriter, ++row, "itemInfo.lua : Write costume", null, () => SdeAppConfiguration.DbWriterItemInfoIsCostume, v => SdeAppConfiguration.DbWriterItemInfoIsCostume   = v);
            _add(_gridDbWriter, ++row, "item_group : force write in single file", "'Import' fields won't be used when saving the item groups", () => SdeAppConfiguration.DbWriterItemInfoClassNum, v => SdeAppConfiguration.DbWriterItemInfoClassNum = v);

            _add(_gridDialogs, row = 0, "Use integrated dialogs for flags", "If unchecked, this will open dialogs on all the '...' buttons.", () => SdeAppConfiguration.UseIntegratedDialogsForFlags, v => SdeAppConfiguration.UseIntegratedDialogsForFlags = v);
            _add(_gridDialogs, ++row, "Use integrated dialogs for scripts", "If unchecked, this will open dialogs on all the '...' buttons.", () => SdeAppConfiguration.UseIntegratedDialogsForScripts, v => SdeAppConfiguration.UseIntegratedDialogsForScripts = v);
            _add(_gridDialogs, ++row, "Use integrated dialogs for levels", "If unchecked, this will open dialogs on all the '...' buttons.", () => SdeAppConfiguration.UseIntegratedDialogsForLevels, v => SdeAppConfiguration.UseIntegratedDialogsForLevels    = v);
            _add(_gridDialogs, ++row, "Use integrated dialogs for jobs", "If unchecked, this will open dialogs on all the '...' buttons.", () => SdeAppConfiguration.UseIntegratedDialogsForJobs, v => SdeAppConfiguration.UseIntegratedDialogsForJobs          = v);
            _add(_gridDialogs, ++row, "Use integrated dialogs for time", "If unchecked, this will open dialogs on all the '...' buttons.", () => SdeAppConfiguration.UseIntegratedDialogsForTime, v => SdeAppConfiguration.UseIntegratedDialogsForTime          = v);

            _add(_gridRAthena, row = 0, "Use old rAthena mob mode", "If checked, this will use the old mob mode.", () => ProjectConfiguration.UseOldRAthenaMode, v => ProjectConfiguration.UseOldRAthenaMode = v);

            Binder.Bind(_comboBoxStyles, () => SdeAppConfiguration.ThemeIndex, v => {
                SdeAppConfiguration.ThemeIndex = v;
                Application.Current.Resources.MergedDictionaries.RemoveAt(Application.Current.Resources.MergedDictionaries.Count - 1);

                var path = "pack://application:,,,/" + Assembly.GetEntryAssembly().GetName().Name.Replace(" ", "%20") + ";component/WPF/Styles/";

                if (SdeAppConfiguration.ThemeIndex == 0)
                {
                    path += "StyleLightBlue.xaml";
                }
                else if (SdeAppConfiguration.ThemeIndex == 1)
                {
                    path += "StyleDark.xaml";
                }

                //Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(path, UriKind.RelativeOrAbsolute) });
                Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary {
                    Source = new Uri(path, UriKind.RelativeOrAbsolute)
                });
                ErrorHandler.HandleException("For the theme to apply properly, please restart the application.");
            });

            _loadEncoding();
            _comboBoxCompression.Init();
            _loadAutocomplete();
            _loadShortcuts();
        }
Example #4
0
        private void _loadAutocomplete()
        {
            Binder.Bind(_cbAcIdDn, () => ProjectConfiguration.AutocompleteIdDisplayName);
            Binder.Bind(_cbAcUnDn, () => ProjectConfiguration.AutocompleteUnDisplayName);
            Binder.Bind(_cbAcIdRn, () => ProjectConfiguration.AutocompleteIdResourceName);
            Binder.Bind(_cbAcUnRn, () => ProjectConfiguration.AutocompleteUnResourceName);
            Binder.Bind(_cbAcIdDesc, () => ProjectConfiguration.AutocompleteIdDescription);
            Binder.Bind(_cbAcUnDesc, () => ProjectConfiguration.AutocompleteUnDescription);
            Binder.Bind(_tbPropFormat, () => ProjectConfiguration.AutocompleteDescriptionFormat);
            Binder.Bind(_cbAcNumberOfSlot, () => ProjectConfiguration.AutocompleteNumberOfSlot);
            Binder.Bind(_cbAcEmptyFields, () => ProjectConfiguration.AutocompleteFillOnlyEmptyFields);
            Binder.Bind(_tbUnDesc, () => ProjectConfiguration.AutocompleteUnDescriptionFormat);
            Binder.Bind(_tbDescNotSet, () => ProjectConfiguration.AutocompleteDescNotSet);
            Binder.Bind(_cbWriteNeutralProperty, () => ProjectConfiguration.AutocompleteNeutralProperty);
            Binder.Bind(_cbAcViewId, () => ProjectConfiguration.AutocompleteViewId);

            int index = 0;

            List <TextBox> boxes = new List <TextBox>();

            foreach (ParameterHolderKeys property in ParameterHolderKeys.Keys)
            {
                ParameterHolderKeys key = property;
                Label label             = new Label {
                    Padding = new Thickness(0), Margin = new Thickness(3), Content = property.Key
                };
                TextBox box = new TextBox {
                    Text = SdeAppConfiguration.ConfigAsker["Autocompletion - " + key.Key, key.Key], Margin = new Thickness(3)
                };

                WpfUtilities.SetGridPosition(label, index, 1, 0, 1);
                WpfUtilities.SetGridPosition(box, index, 1, 2, 1);

                _gridDescProp.Children.Add(label);
                _gridDescProp.Children.Add(box);
                _gridDescProp.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(-1, GridUnitType.Auto)
                });

                SdeAppConfiguration.Bind(box, v => SdeAppConfiguration.ConfigAsker["Autocompletion - " + key.Key] = box.Text, p => p);

                index++;
            }

            index = 0;

            foreach (string property in ParameterHolder.Properties)
            {
                TextBox box = new TextBox {
                    Text = ProjectConfiguration.AutocompleteProperties[index], Margin = new Thickness(3)
                };
                TextBlock block = new TextBlock {
                    Text = property, Margin = new Thickness(3), VerticalAlignment = VerticalAlignment.Center
                };

                WpfUtilities.SetGridPosition(block, index / 2 + 4, 2 * (index % 2));
                WpfUtilities.SetGridPosition(box, index / 2 + 4, 2 * (index % 2) + 1);

                boxes.Add(box);
                _gridDescription.Children.Add(box);
                _gridDescription.Children.Add(block);

                SdeAppConfiguration.Bind(box, v => ProjectConfiguration.AutocompleteProperties = v, q => boxes.Select(p => p.Text).ToList());

                index++;
            }

            DisplayablePropertyHelper.FindAll <CheckBox>(_gridAutocomplete).ForEach(WpfUtils.AddMouseInOutEffectsBox);
        }