int progressX = 0;
if (progLength > 0) {
progressX = elapsedMinutes * width / progLength;
}
Color c = Settings.propProgramTableColorOnAirDark.getColor();
grp.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(c.getAlpha()*mProgramImportance/10.)));
int fillWidth = progressX - borderWidth;
if (fillWidth > 0) {
grp.fillRect(borderWidth, borderWidth, fillWidth, height - borderWidth);
}
c = Settings.propProgramTableColorOnAirLight.getColor();
grp.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(c.getAlpha()*mProgramImportance/10.)));
fillWidth = width - progressX - borderWidth * 2;
if (fillWidth > 0) {
grp.fillRect(progressX, borderWidth, fillWidth, height - borderWidth);
}
} else {
// vertical filling panel
int progressY = 0;
if (progLength > 0) {
progressY = elapsedMinutes * height / progLength;
}
Color c = Settings.propProgramTableColorOnAirDark.getColor();
grp.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(c.getAlpha()*mProgramImportance/10.)));
int fillHeight = progressY - borderWidth;
if (fillHeight > height) {
mLog.severe("paint program panel: fill height 1 to large");
fillHeight = height;
}
if (fillHeight > 0) {
grp.fillRect(borderWidth, borderWidth, width - borderWidth * 2, fillHeight);
}
c = Settings.propProgramTableColorOnAirLight.getColor();
grp.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(c.getAlpha()*mProgramImportance/10.)));
fillHeight = height - progressY - borderWidth;
if (fillHeight > height) {
mLog.severe("paint program panel: fill height 2 to large");
fillHeight = height;
}
if (fillHeight > 0) {
grp.fillRect(borderWidth, progressY, width - borderWidth * 2, fillHeight);
}
}
if (Settings.propProgramTableOnAirProgramsShowingBorder.getBoolean()) {
grp.draw3DRect(0, 0, width - 1, height - 1, true);
}
}
// If there are plugins that have marked the program -> paint the background
Marker[] markedByPluginArr = mProgram.getMarkerArr();
if (markedByPluginArr.length != 0) {
Color c = Plugin.getPluginManager().getTvBrowserSettings().getColorForMarkingPriority(mProgram.getMarkPriority());
if(c == null) {
c = Settings.propProgramPanelMarkedMinPriorityColor.getColor();
}
int alphaValue = (int)(c.getAlpha()*mProgramImportance/10.);
if(mProgram.isExpired()) {
grp.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), (int)(alphaValue*6/10.)));
}
else {
grp.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), alphaValue));
}
if(mProgram.getMarkPriority() > Program.NO_MARK_PRIORITY) {
if(Settings.propProgramPanelWithMarkingsShowingBoder.getBoolean()) {
grp.fill3DRect(0, 0, width, height, true);
}
else {
grp.fillRect(0, 0, width, height);
}
}
}
if (mMouseOver || mIsSelected) {
Color test = Settings.propProgramTableMouseOverColor.getColor();
if (mIsSelected) {
test = Settings.propKeyboardSelectedColor.getColor();
}
grp.setColor(test);
grp.fillRect(0, 0, width - 1, height - 1);
Stroke str = grp.getStroke();
Color col = grp.getColor();
float[] dash = { 2.0f };
int lineWidth = 1;
BasicStroke dashed = new BasicStroke(lineWidth, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
grp.setColor(Color.BLACK);
grp.setStroke(dashed);
grp.drawRect(lineWidth - 1, lineWidth - 1, width - lineWidth, height - lineWidth);
grp.setStroke(str);
grp.setColor(col);
}
// Draw all the text
if (mPaintExpiredProgramsPale && mProgram.isExpired()) {
Color c = new Color(Color.gray.getRed(), Color.gray.getGreen(), Color.gray.getBlue(), (int)(Color.gray.getAlpha()*mProgramImportance/10.));
setForeground(c);
grp.setColor(c);
} else {
Color c = new Color(mTextColor.getRed(), mTextColor.getGreen(), mTextColor.getBlue(), (int)(mTextColor.getAlpha()*mProgramImportance/10.));
setForeground(c);
grp.setColor(c);
}
grp.setFont(ProgramPanel.mTimeFont);