예제 #1
0
        private static void sSaveDefaultKeyInSettings(Settings settings, bool saveOnDisk)
        {
            // PATCH FIX BECAUSE DOT NET FRAMEWORK IS BUGGED
            // Indeed the "Ctrl" string doesn't not exist on german OS (the key name is "Strg"),
            // so the default setting fail to load if you put a CTRL as default key in the default
            // Setting. So instead we save the default key here if the default key is not saved
            // and then after the application will be able to reload correctly the settings
            bool needToSave = false;

            if (settings.MouseMultipleSelectionKey == Keys.None)
            {
                settings.MouseMultipleSelectionKey = Keys.Control;
                needToSave = true;
            }
            if (settings.MouseDuplicateSelectionKey == Keys.None)
            {
                settings.MouseDuplicateSelectionKey = Keys.Alt;
                needToSave = true;
            }
            if (settings.MouseZoomPanKey == Keys.None)
            {
                settings.MouseZoomPanKey = Keys.Shift;
                needToSave = true;
            }

            // try to save (never mind if we can not (for example BlueBrick is launched
            // from a write protected drive)
            try
            {
                if (saveOnDisk && needToSave)
                    settings.Save();
            }
            catch
            {
            }
        }
예제 #2
0
 private void copySettings(Settings destination, Settings source, TabPageFilter tabPageFilter)
 {
     // general
     if ((tabPageFilter & TabPageFilter.GENERAL) != 0)
     {
         // language
         destination.Language = source.Language.Clone() as string;
         // map
         destination.AddBrickLayerOnNewMap = source.AddBrickLayerOnNewMap;
         destination.AddGridLayerOnNewMap = source.AddGridLayerOnNewMap;
         destination.AddAreaLayerOnNewMap = source.AddAreaLayerOnNewMap;
         destination.AddTextLayerOnNewMap = source.AddTextLayerOnNewMap;
         destination.AddRulerLayerOnNewMap = source.AddRulerLayerOnNewMap;
         destination.DefaultAuthor = source.DefaultAuthor.Clone() as string;
         destination.DefaultLUG = source.DefaultLUG.Clone() as string;
         destination.DefaultShow = source.DefaultShow.Clone() as string;
         // performance
         destination.StartSavedMipmapLevel = source.StartSavedMipmapLevel;
         // recent files
         destination.MaxRecentFilesNum = source.MaxRecentFilesNum;
         // undo/redo
         destination.UndoStackDepth = source.UndoStackDepth;
         destination.UndoStackDisplayedDepth = source.UndoStackDisplayedDepth;
         // Notification
         destination.DisplayWarningMessageForNotSavingInBBM = source.DisplayWarningMessageForNotSavingInBBM;
         destination.DisplayWarningMessageForBrickNotAddedDueToBudgetLimitation = source.DisplayWarningMessageForBrickNotAddedDueToBudgetLimitation;
         destination.DisplayWarningMessageForBrickNotCopiedDueToBudgetLimitation = source.DisplayWarningMessageForBrickNotCopiedDueToBudgetLimitation;
         destination.DisplayWarningMessageForBrickNotReplacedDueToBudgetLimitation = source.DisplayWarningMessageForBrickNotReplacedDueToBudgetLimitation;
         destination.DisplayWarningMessageForShowingBudgetNumbers = source.DisplayWarningMessageForShowingBudgetNumbers;
     }
     // edition
     if ((tabPageFilter & TabPageFilter.EDITION) != 0)
     {
         // mouse
         destination.MouseMultipleSelectionKey = source.MouseMultipleSelectionKey;
         destination.WheelMouseIsZoomOnCursor = source.WheelMouseIsZoomOnCursor;
         destination.WheelMouseZoomSpeed = source.WheelMouseZoomSpeed;
         // copy/paste
         destination.OffsetAfterCopyStyle = source.OffsetAfterCopyStyle;
         destination.OffsetAfterCopyValue = source.OffsetAfterCopyValue;
         // ruler
         destination.RulerControlPointRadiusInPixel = source.RulerControlPointRadiusInPixel;
         destination.SwitchToEditionAfterRulerCreation = source.SwitchToEditionAfterRulerCreation;
         // line appearance
         destination.RulerDefaultLineThickness = source.RulerDefaultLineThickness;
         destination.RulerDefaultLineColor = source.RulerDefaultLineColor;
         destination.RulerDefaultAllowOffset = source.RulerDefaultAllowOffset;
         // guideline appearance
         destination.RulerDefaultDashPatternLine = source.RulerDefaultDashPatternLine;
         destination.RulerDefaultDashPatternSpace = source.RulerDefaultDashPatternSpace;
         destination.RulerDefaultGuidelineThickness = source.RulerDefaultGuidelineThickness;
         destination.RulerDefaultGuidelineColor = source.RulerDefaultGuidelineColor;
         // measure and unit
         destination.RulerDefaultDisplayUnit = source.RulerDefaultDisplayUnit;
         destination.RulerDefaultDisplayMeasureText = source.RulerDefaultDisplayMeasureText;
         destination.RulerDefaultUnit = source.RulerDefaultUnit;
         destination.RulerDefaultFontColor = source.RulerDefaultFontColor;
         destination.RulerDefaultFont = source.RulerDefaultFont.Clone() as Font;
     }
     // appearance
     if ((tabPageFilter & TabPageFilter.APPEARANCE) != 0)
     {
         destination.DefaultBackgroundColor = source.DefaultBackgroundColor;
         destination.DefaultAreaTransparency = source.DefaultAreaTransparency;
         destination.DefaultAreaSize = source.DefaultAreaSize;
         destination.GammaForSelection = source.GammaForSelection;
         destination.GammaForSnappingPart = source.GammaForSnappingPart;
         destination.DefaultGridColor = source.DefaultGridColor;
         destination.DefaultGridSize = source.DefaultGridSize;
         destination.DefaultGridEnabled = source.DefaultGridEnabled;
         destination.DefaultSubDivisionNumber = source.DefaultSubDivisionNumber;
         destination.DefaultSubGridEnabled = source.DefaultSubGridEnabled;
         destination.DefaultSubGridColor = source.DefaultSubGridColor;
         destination.DefaultTextColor = source.DefaultTextColor;
         destination.DefaultTextFont = source.DefaultTextFont.Clone() as Font;
     }
     // part lib
     if ((tabPageFilter & TabPageFilter.PART_LIBRARY) != 0)
     {
         destination.PartLibTabOrder = new System.Collections.Specialized.StringCollection();
         foreach (string text in source.PartLibTabOrder)
             destination.PartLibTabOrder.Add(text.Clone() as string);
         destination.PartLibBackColor = source.PartLibBackColor;
         destination.PartLibShowOnlyBudgetedPartsColor = source.PartLibShowOnlyBudgetedPartsColor;
         destination.PartLibFilteredBackColor = source.PartLibFilteredBackColor;
         destination.BudgetFilenameToLoadAtStartup = source.BudgetFilenameToLoadAtStartup;
         destination.IsDefaultBudgetInfinite = source.IsDefaultBudgetInfinite;
         destination.PartLibBubbleInfoPartID = source.PartLibBubbleInfoPartID;
         destination.PartLibBubbleInfoPartColor = source.PartLibBubbleInfoPartColor;
         destination.PartLibBubbleInfoPartDescription = source.PartLibBubbleInfoPartDescription;
         destination.PartLibDisplayBubbleInfo = source.PartLibDisplayBubbleInfo;
     }
     // shortcut
     if ((tabPageFilter & TabPageFilter.SHORTCUT_KEYS) != 0)
     {
         destination.ShortcutKey = new System.Collections.Specialized.StringCollection();
         foreach (string text in source.ShortcutKey)
             destination.ShortcutKey.Add(text.Clone() as string);
     }
 }
예제 #3
0
 /// <summary>
 /// Reset the settings which belong to the specified page, to the default values
 /// </summary>
 /// <param name="tabPageFilter">A bit field that decribe the page that should be reset</param>
 private void resetSettings(TabPageFilter tabPageFilter)
 {
     // reset the settings (except the language)
     string currentLanguage = Settings.Default.Language;
     // create a new setting object cause we only want to copy the settings of the tab page, not the UI settings
     Settings defaultSetting = new Settings();
     defaultSetting.Upgrade();
     defaultSetting.Reset();
     sSaveDefaultKeyInSettings(defaultSetting, false);
     // restore the language
     defaultSetting.Language = currentLanguage;
     // now copy only the settings specified with the default settings
     copySettings(Settings.Default, defaultSetting, tabPageFilter);
     // init the controls
     initControlValues(true, tabPageFilter);
 }