<commit_before>﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Threading;
using System.Xml.Linq;
using TCC.Annotations;
using TCC.Controls;
using TCC.Data;
using TCC.Parsing;
using TCC.ViewModels;
using TCC.Windows;

namespace TCC.Settings
{
    public class WindowSettings : TSPropertyChanged
    {
        private double _w;
        private double _h;
        private bool _visible;
        private ClickThruMode _clickThruMode;
        private double _scale;
        private bool _autoDim;
        private double _dimOpacity;
        private bool _showAlways;
        private bool _enabled;
        private bool _allowOffScreen;

        public event Action ResetToCenter;
        public event Action EnabledChanged;
        public event Action ClickThruModeChanged;
        public event Action VisibilityChanged;

        public RelayCommand ResetPositionCommand { get; }

        public string Name { [UsedImplicitly] get; }
        public bool PerClassPosition { get; set; }

        private Class CurrentClass()
        {
            var cc = SessionManager.CurrentPlayer == null || SessionManager.CurrentPlayer?.Class == Class.None ? Class.Common : SessionManager.CurrentPlayer.Class;
            cc = PerClassPosition ? cc : Class.Common;
            return cc;
        }

        public double X
        {
            get
            {
                var cc = CurrentClass();
                return Positions.Position(cc).X;
            }
            set
            {
                var cc = CurrentClass();
                if (cc == Class.None) return;
                var old = Positions.Position(cc);
                Positions.SetPosition(cc, new Point(value, old.Y));
                N(nameof(X));
            }
        }

        public double Y
        {
            get
            {
                var cc = CurrentClass();
                return Positions.Position(cc).Y;
            }
            set
            {
                var cc = CurrentClass();
                if (cc == Class.None) return;
                var old = Positions.Position(cc);
                Positions.SetPosition(cc, new Point(old.X, value));
                N(nameof(Y));
            }
        }

        public ButtonsPosition ButtonsPosition
        {
            get<commit_msg>don't set X,Y if value is the same<commit_after>﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Threading;
using System.Xml.Linq;
using TCC.Annotations;
using TCC.Controls;
using TCC.Data;
using TCC.Parsing;
using TCC.ViewModels;
using TCC.Windows;

namespace TCC.Settings
{
    public class WindowSettings : TSPropertyChanged
    {
        private double _w;
        private double _h;
        private bool _visible;
        private ClickThruMode _clickThruMode;
        private double _scale;
        private bool _autoDim;
        private double _dimOpacity;
        private bool _showAlways;
        private bool _enabled;
        private bool _allowOffScreen;

        public event Action ResetToCenter;
        public event Action EnabledChanged;
        public event Action ClickThruModeChanged;
        public event Action VisibilityChanged;

        public RelayCommand ResetPositionCommand { get; }

        public string Name { [UsedImplicitly] get; }
        public bool PerClassPosition { get; set; }

        private Class CurrentClass()
        {
            var cc = SessionManager.CurrentPlayer == null || SessionManager.CurrentPlayer?.Class == Class.None ? Class.Common : SessionManager.CurrentPlayer.Class;
            cc = PerClassPosition ? cc : Class.Common;
            return cc;
        }

        public double X
        {
            get
            {
                var cc = CurrentClass();
                return Positions.Position(cc).X;
            }
            set
            {
                var cc = CurrentClass();
                if (cc == Class.None) return;
                var old = Positions.Position(cc);
                if (old.X == value) return;
                Positions.SetPosition(cc, new Point(value, old.Y));
                N(nameof(X));
            }
        }

        public double Y
        {
            get
            {
                var cc = CurrentClass();
                return Positions.Position(cc).Y;
            }
            set
            {
                var cc = CurrentClass();
                if (cc == Class.None) return;
                var old = Positions.Position(cc);
                if (old.Y == value) return;
                Positions.SetPosition(cc, new Point(old.X, value));
                N(nameof(Y));
            }
        }

        public ButtonsPosition ButtonsPosition
        {
            get
{'fraction_non_alphanumeric': 0.0764545263600084, 'fraction_numerical': 0.0, 'mean_word_length': 1.6021857923497267, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2537166', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1182, 'n_words': 332}