mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -05:00
Merge pull request #209 from DSheirer/153-cursor-frequency-artifacts
Resolves issue with spectral display rendering artifacts
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* sdrtrunk
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
* Copyright (C) 2014-2017 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -14,31 +14,17 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package spectrum;
|
package spectrum;
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
import controller.channel.Channel;
|
||||||
import java.awt.Color;
|
import controller.channel.Channel.ChannelType;
|
||||||
import java.awt.Font;
|
import controller.channel.ChannelEvent;
|
||||||
import java.awt.FontMetrics;
|
import controller.channel.ChannelEventListener;
|
||||||
import java.awt.Graphics;
|
import controller.channel.ChannelModel;
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.Stroke;
|
|
||||||
import java.awt.event.ComponentEvent;
|
|
||||||
import java.awt.event.ComponentListener;
|
|
||||||
import java.awt.geom.Line2D;
|
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import settings.ColorSetting;
|
import settings.ColorSetting;
|
||||||
import settings.ColorSetting.ColorSettingName;
|
import settings.ColorSetting.ColorSettingName;
|
||||||
import settings.Setting;
|
import settings.Setting;
|
||||||
@@ -47,34 +33,34 @@ import settings.SettingsManager;
|
|||||||
import source.tuner.TunerChannel;
|
import source.tuner.TunerChannel;
|
||||||
import source.tuner.frequency.FrequencyChangeEvent;
|
import source.tuner.frequency.FrequencyChangeEvent;
|
||||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||||
import controller.channel.Channel;
|
|
||||||
import controller.channel.Channel.ChannelType;
|
|
||||||
import controller.channel.ChannelEvent;
|
|
||||||
import controller.channel.ChannelEventListener;
|
|
||||||
import controller.channel.ChannelModel;
|
|
||||||
|
|
||||||
public class OverlayPanel extends JPanel
|
import javax.swing.*;
|
||||||
implements ChannelEventListener,
|
import java.awt.*;
|
||||||
IFrequencyChangeProcessor,
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.ComponentListener;
|
||||||
|
import java.awt.geom.Line2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
public class OverlayPanel extends JPanel implements ChannelEventListener, IFrequencyChangeProcessor,
|
||||||
SettingChangeListener
|
SettingChangeListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final static Logger mLog =
|
private final static Logger mLog = LoggerFactory.getLogger(OverlayPanel.class);
|
||||||
LoggerFactory.getLogger( OverlayPanel.class );
|
|
||||||
|
|
||||||
private final static RenderingHints RENDERING_HINTS =
|
private final static RenderingHints RENDERING_HINTS = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
|
||||||
new RenderingHints( RenderingHints.KEY_ANTIALIASING,
|
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
RENDERING_HINTS.put( RenderingHints.KEY_RENDERING,
|
RENDERING_HINTS.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||||
RenderingHints.VALUE_RENDER_QUALITY );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static BasicStroke DASHED_STROKE = new BasicStroke(0.8f,
|
private final static BasicStroke DASHED_STROKE = new BasicStroke(0.8f, BasicStroke.CAP_BUTT,
|
||||||
BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f, new float[] {2.0f, 4.0f}, 0.0f);
|
BasicStroke.JOIN_MITER, 5.0f, new float[]{2.0f, 4.0f}, 0.0f);
|
||||||
|
|
||||||
private static DecimalFormat CURSOR_FORMAT = new DecimalFormat("000.00000");
|
private static DecimalFormat CURSOR_FORMAT = new DecimalFormat("000.00000");
|
||||||
private long mFrequency = 0;
|
private long mFrequency = 0;
|
||||||
@@ -107,13 +93,13 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
private SettingsManager mSettingsManager;
|
private SettingsManager mSettingsManager;
|
||||||
private ChannelModel mChannelModel;
|
private ChannelModel mChannelModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translucent overlay panel for displaying channel configurations,
|
* Translucent overlay panel for displaying channel configurations,
|
||||||
* processing channels, selected channels, frequency labels and lines, and
|
* processing channels, selected channels, frequency labels and lines, and
|
||||||
* a cursor with a frequency readout.
|
* a cursor with a frequency readout.
|
||||||
*/
|
*/
|
||||||
public OverlayPanel( SettingsManager settingsManager,
|
public OverlayPanel(SettingsManager settingsManager, ChannelModel channelModel)
|
||||||
ChannelModel channelModel )
|
|
||||||
{
|
{
|
||||||
mSettingsManager = settingsManager;
|
mSettingsManager = settingsManager;
|
||||||
|
|
||||||
@@ -222,18 +208,15 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
mColorChannelConfig = getColor(ColorSettingName.CHANNEL_CONFIG);
|
mColorChannelConfig = getColor(ColorSettingName.CHANNEL_CONFIG);
|
||||||
|
|
||||||
mColorChannelConfigProcessing =
|
mColorChannelConfigProcessing = getColor(ColorSettingName.CHANNEL_CONFIG_PROCESSING);
|
||||||
getColor( ColorSettingName.CHANNEL_CONFIG_PROCESSING );
|
|
||||||
|
|
||||||
mColorChannelConfigSelected =
|
mColorChannelConfigSelected = getColor(ColorSettingName.CHANNEL_CONFIG_SELECTED);
|
||||||
getColor( ColorSettingName.CHANNEL_CONFIG_SELECTED );
|
|
||||||
|
|
||||||
mColorSpectrumCursor = getColor(ColorSettingName.SPECTRUM_CURSOR);
|
mColorSpectrumCursor = getColor(ColorSettingName.SPECTRUM_CURSOR);
|
||||||
|
|
||||||
mColorSpectrumLine = getColor(ColorSettingName.SPECTRUM_LINE);
|
mColorSpectrumLine = getColor(ColorSettingName.SPECTRUM_LINE);
|
||||||
|
|
||||||
mColorSpectrumBackground =
|
mColorSpectrumBackground = getColor(ColorSettingName.SPECTRUM_BACKGROUND);
|
||||||
getColor( ColorSettingName.SPECTRUM_BACKGROUND );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -310,21 +293,23 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
if(mCursorVisible)
|
if(mCursorVisible)
|
||||||
{
|
{
|
||||||
drawFrequencyLine( graphics,
|
drawFrequencyLine(graphics, mCursorLocation.x, mColorSpectrumCursor);
|
||||||
mCursorLocation.x,
|
|
||||||
mColorSpectrumCursor );
|
|
||||||
|
|
||||||
String frequency = CURSOR_FORMAT.format(
|
String frequency = CURSOR_FORMAT.format(getFrequencyFromAxis(mCursorLocation.getX()) / 1E6D);
|
||||||
getFrequencyFromAxis( mCursorLocation.getX() ) / 1E6D );
|
|
||||||
|
|
||||||
graphics.drawString( frequency ,
|
FontMetrics fontMetrics = graphics.getFontMetrics(this.getFont());
|
||||||
mCursorLocation.x + 5,
|
|
||||||
mCursorLocation.y );
|
Rectangle2D rect = fontMetrics.getStringBounds(frequency, graphics);
|
||||||
|
|
||||||
|
if(mCursorLocation.y > rect.getHeight())
|
||||||
|
{
|
||||||
|
graphics.drawString(frequency, mCursorLocation.x + 5, mCursorLocation.y);
|
||||||
|
}
|
||||||
|
|
||||||
if(mZoom != 0)
|
if(mZoom != 0)
|
||||||
{
|
{
|
||||||
graphics.drawString( "Zoom: " + (int)Math.pow( 2.0, mZoom ) + "x",
|
graphics.drawString("Zoom: " + (int)Math.pow(2.0, mZoom) + "x", mCursorLocation.x + 17,
|
||||||
mCursorLocation.x + 17, mCursorLocation.y + 11 );
|
mCursorLocation.y + 11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,8 +321,6 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
Stroke currentStroke = graphics.getStroke();
|
Stroke currentStroke = graphics.getStroke();
|
||||||
|
|
||||||
// graphics.setStroke( DASHED_STROKE );
|
|
||||||
|
|
||||||
long minFrequency = getMinDisplayFrequency();
|
long minFrequency = getMinDisplayFrequency();
|
||||||
long maxFrequency = getMaxDisplayFrequency();
|
long maxFrequency = getMaxDisplayFrequency();
|
||||||
|
|
||||||
@@ -372,8 +355,6 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
frequency += minor;
|
frequency += minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// graphics.setStroke( currentStroke );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -415,8 +396,7 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
graphics.setColor(color);
|
graphics.setColor(color);
|
||||||
|
|
||||||
graphics.draw( new Line2D.Double( xaxis, 0.0d,
|
graphics.draw(new Line2D.Double(xaxis, 0.0d, xaxis, getSize().getHeight() - mSpectrumInset));
|
||||||
xaxis, getSize().getHeight() - mSpectrumInset ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -428,8 +408,7 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
graphics.setColor(Color.LIGHT_GRAY);
|
graphics.setColor(Color.LIGHT_GRAY);
|
||||||
|
|
||||||
graphics.draw( new Line2D.Double( xaxis, height * 0.65d,
|
graphics.draw(new Line2D.Double(xaxis, height * 0.65d, xaxis, height - 1.0d));
|
||||||
xaxis, height - 1.0d ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -443,12 +422,10 @@ public class OverlayPanel extends JPanel
|
|||||||
graphics.setColor(Color.YELLOW);
|
graphics.setColor(Color.YELLOW);
|
||||||
|
|
||||||
//Vertical frequency error line
|
//Vertical frequency error line
|
||||||
graphics.draw( new Line2D.Double( errorAxis, lineHeight,
|
graphics.draw(new Line2D.Double(errorAxis, lineHeight, errorAxis, height - 1.0d));
|
||||||
errorAxis, height - 1.0d ) );
|
|
||||||
|
|
||||||
//Horizontal line connecting frequency and error lines
|
//Horizontal line connecting frequency and error lines
|
||||||
graphics.draw( new Line2D.Double( frequencyAxis, lineHeight,
|
graphics.draw(new Line2D.Double(frequencyAxis, lineHeight, errorAxis, lineHeight));
|
||||||
errorAxis, lineHeight ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -484,8 +461,7 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
double offset = xAxis / width;
|
double offset = xAxis / width;
|
||||||
|
|
||||||
long frequency = getMinDisplayFrequency() +
|
long frequency = getMinDisplayFrequency() + Math.round((double)getDisplayBandwidth() * offset);
|
||||||
Math.round( (double)getDisplayBandwidth() * offset );
|
|
||||||
|
|
||||||
if(frequency > (getMaxFrequency()))
|
if(frequency > (getMaxFrequency()))
|
||||||
{
|
{
|
||||||
@@ -498,9 +474,7 @@ public class OverlayPanel extends JPanel
|
|||||||
/**
|
/**
|
||||||
* Draws a frequency label at the x-axis position, at the bottom of the panel
|
* Draws a frequency label at the x-axis position, at the bottom of the panel
|
||||||
*/
|
*/
|
||||||
private void drawFrequencyLabel( Graphics2D graphics,
|
private void drawFrequencyLabel(Graphics2D graphics, double xaxis, long frequency)
|
||||||
double xaxis,
|
|
||||||
long frequency )
|
|
||||||
{
|
{
|
||||||
String label = mLabelSizeMonitor.format(frequency);
|
String label = mLabelSizeMonitor.format(frequency);
|
||||||
|
|
||||||
@@ -510,8 +484,7 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
float xOffset = (float)rect.getWidth() / 2;
|
float xOffset = (float)rect.getWidth() / 2;
|
||||||
|
|
||||||
graphics.drawString( label, (float)( xaxis - xOffset ),
|
graphics.drawString(label, (float)(xaxis - xOffset), (float)(getSize().getHeight() - 2.0f));
|
||||||
(float)( getSize().getHeight() - 2.0f ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -523,8 +496,7 @@ public class OverlayPanel extends JPanel
|
|||||||
for(Channel channel : mVisibleChannels)
|
for(Channel channel : mVisibleChannels)
|
||||||
{
|
{
|
||||||
if(mChannelDisplay == ChannelDisplay.ALL ||
|
if(mChannelDisplay == ChannelDisplay.ALL ||
|
||||||
( mChannelDisplay == ChannelDisplay.ENABLED &&
|
(mChannelDisplay == ChannelDisplay.ENABLED && channel.getEnabled()))
|
||||||
channel.getEnabled() ) )
|
|
||||||
{
|
{
|
||||||
//Choose the correct background color to use
|
//Choose the correct background color to use
|
||||||
if(channel.isSelected())
|
if(channel.isSelected())
|
||||||
@@ -546,12 +518,10 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
double xAxis = getAxisFromFrequency(tunerChannel.getFrequency());
|
double xAxis = getAxisFromFrequency(tunerChannel.getFrequency());
|
||||||
|
|
||||||
double width = (double)( tunerChannel.getBandwidth() ) /
|
double width = (double)(tunerChannel.getBandwidth()) / (double)getDisplayBandwidth() * getSize().getWidth();
|
||||||
(double)getDisplayBandwidth() * getSize().getWidth();
|
|
||||||
|
|
||||||
Rectangle2D.Double box =
|
Rectangle2D.Double box =
|
||||||
new Rectangle2D.Double( xAxis - ( width / 2.0d ),
|
new Rectangle2D.Double(xAxis - (width / 2.0d), 0.0d, width, getSize().getHeight() - mSpectrumInset);
|
||||||
0.0d, width, getSize().getHeight() - mSpectrumInset );
|
|
||||||
|
|
||||||
//Fill the box with the correct color
|
//Fill the box with the correct color
|
||||||
graphics.fill(box);
|
graphics.fill(box);
|
||||||
@@ -567,30 +537,15 @@ public class OverlayPanel extends JPanel
|
|||||||
//Draw the system label and adjust the y-axis position
|
//Draw the system label and adjust the y-axis position
|
||||||
String system = channel.hasSystem() ? channel.getSystem() : " ";
|
String system = channel.hasSystem() ? channel.getSystem() : " ";
|
||||||
|
|
||||||
yAxis += drawLabel( graphics,
|
yAxis += drawLabel(graphics, system, this.getFont(), xAxis, yAxis, width);
|
||||||
system,
|
|
||||||
this.getFont(),
|
|
||||||
xAxis,
|
|
||||||
yAxis,
|
|
||||||
width );
|
|
||||||
|
|
||||||
//Draw the site label and adjust the y-axis position
|
//Draw the site label and adjust the y-axis position
|
||||||
String site = channel.hasSite() ? channel.getSite() : " ";
|
String site = channel.hasSite() ? channel.getSite() : " ";
|
||||||
|
|
||||||
yAxis += drawLabel( graphics,
|
yAxis += drawLabel(graphics, site, this.getFont(), xAxis, yAxis, width);
|
||||||
site,
|
|
||||||
this.getFont(),
|
|
||||||
xAxis,
|
|
||||||
yAxis,
|
|
||||||
width );
|
|
||||||
|
|
||||||
//Draw the channel label and adjust the y-axis position
|
//Draw the channel label and adjust the y-axis position
|
||||||
yAxis += drawLabel( graphics,
|
yAxis += drawLabel(graphics, channel.getName(), this.getFont(), xAxis, yAxis, width);
|
||||||
channel.getName(),
|
|
||||||
this.getFont(),
|
|
||||||
xAxis,
|
|
||||||
yAxis,
|
|
||||||
width );
|
|
||||||
|
|
||||||
//Draw the decoder label
|
//Draw the decoder label
|
||||||
drawLabel(graphics, channel.getDecodeConfiguration().getDecoderType().getShortDisplayString(),
|
drawLabel(graphics, channel.getDecodeConfiguration().getDecoderType().getShortDisplayString(),
|
||||||
@@ -623,8 +578,7 @@ public class OverlayPanel extends JPanel
|
|||||||
*
|
*
|
||||||
* @return height of the drawn label
|
* @return height of the drawn label
|
||||||
*/
|
*/
|
||||||
private double drawLabel( Graphics2D graphics, String text, Font font,
|
private double drawLabel(Graphics2D graphics, String text, Font font, double x, double baseY, double maxWidth)
|
||||||
double x, double baseY, double maxWidth )
|
|
||||||
{
|
{
|
||||||
FontMetrics fontMetrics = graphics.getFontMetrics(font);
|
FontMetrics fontMetrics = graphics.getFontMetrics(font);
|
||||||
|
|
||||||
@@ -639,15 +593,11 @@ public class OverlayPanel extends JPanel
|
|||||||
*/
|
*/
|
||||||
if(offset > (maxWidth / 2.0d))
|
if(offset > (maxWidth / 2.0d))
|
||||||
{
|
{
|
||||||
label.setRect( x - ( maxWidth / 2.0d ),
|
label.setRect(x - (maxWidth / 2.0d), y - label.getHeight(), maxWidth, label.getHeight());
|
||||||
y - label.getHeight(),
|
|
||||||
maxWidth,
|
|
||||||
label.getHeight() );
|
|
||||||
|
|
||||||
graphics.setClip(label);
|
graphics.setClip(label);
|
||||||
|
|
||||||
graphics.drawString( text,
|
graphics.drawString(text, (float)(x - (maxWidth / 2.0d)), (float)y);
|
||||||
(float)( x - ( maxWidth / 2.0d ) ), (float)y );
|
|
||||||
|
|
||||||
graphics.setClip(null);
|
graphics.setClip(null);
|
||||||
}
|
}
|
||||||
@@ -683,9 +633,7 @@ public class OverlayPanel extends JPanel
|
|||||||
* Reset the visible channels list
|
* Reset the visible channels list
|
||||||
*/
|
*/
|
||||||
mVisibleChannels.clear();
|
mVisibleChannels.clear();
|
||||||
mVisibleChannels.addAll(
|
mVisibleChannels.addAll(mChannelModel.getChannelsInFrequencyRange(getMinFrequency(), getMaxFrequency()));
|
||||||
mChannelModel.getChannelsInFrequencyRange( getMinFrequency(),
|
|
||||||
getMaxFrequency() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -701,8 +649,7 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
case NOTIFICATION_ADD:
|
case NOTIFICATION_ADD:
|
||||||
case NOTIFICATION_PROCESSING_START:
|
case NOTIFICATION_PROCESSING_START:
|
||||||
if( !mVisibleChannels.contains( channel ) &&
|
if(!mVisibleChannels.contains(channel) && channel.isWithin(getMinFrequency(), getMaxFrequency()))
|
||||||
channel.isWithin( getMinFrequency(), getMaxFrequency() ) )
|
|
||||||
{
|
{
|
||||||
mVisibleChannels.add(channel);
|
mVisibleChannels.add(channel);
|
||||||
}
|
}
|
||||||
@@ -717,14 +664,12 @@ public class OverlayPanel extends JPanel
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NOTIFICATION_CONFIGURATION_CHANGE:
|
case NOTIFICATION_CONFIGURATION_CHANGE:
|
||||||
if( mVisibleChannels.contains( channel ) &&
|
if(mVisibleChannels.contains(channel) && !channel.isWithin(getMinFrequency(), getMaxFrequency()))
|
||||||
!channel.isWithin( getMinFrequency(), getMaxFrequency() ) )
|
|
||||||
{
|
{
|
||||||
mVisibleChannels.remove(channel);
|
mVisibleChannels.remove(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !mVisibleChannels.contains( channel ) &&
|
if(!mVisibleChannels.contains(channel) && channel.isWithin(getMinFrequency(), getMaxFrequency()))
|
||||||
channel.isWithin( getMinFrequency(), getMaxFrequency() ) )
|
|
||||||
{
|
{
|
||||||
mVisibleChannels.add(channel);
|
mVisibleChannels.add(channel);
|
||||||
}
|
}
|
||||||
@@ -796,9 +741,7 @@ public class OverlayPanel extends JPanel
|
|||||||
{
|
{
|
||||||
TunerChannel channel = config.getTunerChannel();
|
TunerChannel channel = config.getTunerChannel();
|
||||||
|
|
||||||
if( channel != null &&
|
if(channel != null && channel.getMinFrequency() <= frequency && channel.getMaxFrequency() >= frequency)
|
||||||
channel.getMinFrequency() <= frequency &&
|
|
||||||
channel.getMaxFrequency() >= frequency )
|
|
||||||
{
|
{
|
||||||
configs.add(config);
|
configs.add(config);
|
||||||
}
|
}
|
||||||
@@ -808,7 +751,8 @@ public class OverlayPanel extends JPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void settingDeleted( Setting setting ) { /* not implemented */ }
|
public void settingDeleted(Setting setting)
|
||||||
|
{ /* not implemented */ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates correct spacing and format for frequency labels and major/minor
|
* Calculates correct spacing and format for frequency labels and major/minor
|
||||||
@@ -858,9 +802,7 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
int maxLabelWidth = fontMetrics.stringWidth(format(getMaxDisplayFrequency()));
|
int maxLabelWidth = fontMetrics.stringWidth(format(getMaxDisplayFrequency()));
|
||||||
|
|
||||||
double maxLabels = ( (double)OverlayPanel.this.getWidth() *
|
double maxLabels = ((double)OverlayPanel.this.getWidth() * LABEL_FILL_THRESHOLD) / (double)maxLabelWidth;
|
||||||
LABEL_FILL_THRESHOLD ) /
|
|
||||||
(double)maxLabelWidth;
|
|
||||||
|
|
||||||
//Calculate the next smallest base 10 value for the major increment
|
//Calculate the next smallest base 10 value for the major increment
|
||||||
int power = (int)Math.log10((double)getDisplayBandwidth() / maxLabels);
|
int power = (int)Math.log10((double)getDisplayBandwidth() / maxLabels);
|
||||||
@@ -874,9 +816,7 @@ public class OverlayPanel extends JPanel
|
|||||||
|
|
||||||
int labelIncrement = start;
|
int labelIncrement = start;
|
||||||
|
|
||||||
while( ( (double)getDisplayBandwidth() /
|
while(((double)getDisplayBandwidth() / (double)labelIncrement) < maxLabels && labelIncrement >= minimum)
|
||||||
(double)labelIncrement ) < maxLabels &&
|
|
||||||
labelIncrement >= minimum )
|
|
||||||
{
|
{
|
||||||
labelIncrement /= 2;
|
labelIncrement /= 2;
|
||||||
precision++;
|
precision++;
|
||||||
@@ -930,9 +870,17 @@ public class OverlayPanel extends JPanel
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void componentHidden( ComponentEvent arg0 ) {}
|
public void componentHidden(ComponentEvent arg0)
|
||||||
public void componentMoved( ComponentEvent arg0 ) {}
|
{
|
||||||
public void componentShown( ComponentEvent arg0 ) {}
|
}
|
||||||
|
|
||||||
|
public void componentMoved(ComponentEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void componentShown(ComponentEvent arg0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user