public void copyStatesFrom(GaugeSet source)
 {
     foreach (int key in source.gaugesEnabled.Keys)
     {
         SetGaugeEnabled(key, source.IsGaugeEnabled(key));
     }
     foreach (int key in gaugeIds)
     {
         gaugesEnabled[key] = source.IsGaugeEnabled(key);
     }
 }
Exemple #2
0
 private bool Declutter(GaugeSet set, int id)
 {
     foreach (int other in set)
     {
         if (!set.IsGaugeEnabled(other))
         {
             continue;
         }
         if (id != other)
         {
             Pair <int, int> position = set.GetWindowPosition(id);
             Pair <int, int> cmp      = set.GetWindowPosition(other);
             if (Math.Abs(position.first - cmp.first) < MIN_GAUGE_DISTANCE && Math.Abs(position.second - cmp.second) < MIN_GAUGE_DISTANCE)
             {
                 int x = position.first + MIN_GAUGE_DISTANCE;
                 int y = position.second + MIN_GAUGE_DISTANCE;
                 if (x >= Screen.width - NanoGauges.configuration.verticalGaugeWidth)
                 {
                     x = 0;
                 }
                 if (y >= Screen.height - NanoGauges.configuration.verticalGaugeHeight)
                 {
                     y = 0;
                 }
                 Pair <int, int> newPosition = new Pair <int, int>(x, y);
                 set.SetWindowPosition(id, newPosition);
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #3
0
 private void WriteGaugesEnabled(BinaryWriter writer, GaugeSet set)
 {
     Log.Info("storing gauges enabled/disabled states");
     writer.Write((Int16)set.Count());
     Log.Info("writing " + set.Count() + " gauge states");
     foreach (int id in set.Keys())
     {
         writer.Write((Int32)id);
         bool enabled = set.IsGaugeEnabled(id);
         writer.Write(enabled);
         Log.Detail("window state written for window id " + id + ": " + enabled);
     }
 }
Exemple #4
0
 public void Declutter(GaugeSet set)
 {
     Log.Info("declutter " + set);
     foreach (int id in set)
     {
         if (!set.IsGaugeEnabled(id))
         {
             continue;
         }
         while (Declutter(set, id))
         {
             Log.Info("decluttering gauge id " + id + " to " + set.GetWindowPosition(id) + " in set " + set);
         }
     }
 }
Exemple #5
0
 private void WriteGaugesEnabled(BinaryWriter writer, GaugeSet set)
 {
     Log.Info("storing gauges enabled/disabled states for gauge set " + set);
     writer.Write((Int16)set.Count());
     Log.Detail("writing " + set.Count() + " gauge states");
     foreach (int id in set.Keys())
     {
         // never write the aligment gauge
         if (id == Constants.WINDOW_ID_GAUGE_ALIGNMENT)
         {
             continue;
         }
         //
         writer.Write((Int32)id);
         bool enabled = set.IsGaugeEnabled(id);
         writer.Write(enabled);
         Log.Trace("window state written for window id " + id + ": " + enabled);
     }
 }
Exemple #6
0
 public bool IsGaugeEnabled(int id)
 {
     return(currentGaugeSet.IsGaugeEnabled(id));
 }